From 65ddad359ed3b9b739215ec89a7645455ae10dce Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Tue, 5 Oct 2010 18:28:42 +0000 Subject: - added webcam support - faster program start - faster sorting (mergesort) - sync lyrics to music - some new backgrounds and credits graphics (thx to MezzoX) - own thread for video decoding - finished 6-Player-on-one-screen-mode - changqed player-colors - fixed some bugs... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2637 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/DSPack/DSPack/BaseClass.pas | 15581 ++++++++++ Game/Code/lib/DSPack/DSPack/BaseFilterEditor.dfm | 445 + Game/Code/lib/DSPack/DSPack/BaseFilterEditor.pas | 961 + Game/Code/lib/DSPack/DSPack/BaseFilterEditor.res | Bin 0 -> 10632 bytes Game/Code/lib/DSPack/DSPack/DSEditors.pas | 131 + Game/Code/lib/DSPack/DSPack/DSPack.dcr | Bin 0 -> 19312 bytes Game/Code/lib/DSPack/DSPack/DSPack.pas | 5947 ++++ Game/Code/lib/DSPack/DSPack/DSUtil.pas | 5067 ++++ Game/Code/lib/DSPack/DSPack/MediaTypeEditor.dfm | 148 + Game/Code/lib/DSPack/DSPack/MediaTypeEditor.pas | 328 + Game/Code/lib/DSPack/DSPack/clean.bat | 2 + Game/Code/lib/DSPack/DirectX9/D3DX8.pas | 4951 ++++ Game/Code/lib/DSPack/DirectX9/D3DX9.pas | 7972 ++++++ Game/Code/lib/DSPack/DirectX9/DX7toDX8.pas | 261 + Game/Code/lib/DSPack/DirectX9/DXFile.pas | 654 + Game/Code/lib/DSPack/DirectX9/DXTypes.pas | 68 + Game/Code/lib/DSPack/DirectX9/Direct3D.pas | 5609 ++++ Game/Code/lib/DSPack/DirectX9/Direct3D8.pas | 4256 +++ Game/Code/lib/DSPack/DirectX9/Direct3D9.pas | 4943 ++++ Game/Code/lib/DSPack/DirectX9/DirectDraw.pas | 7162 +++++ Game/Code/lib/DSPack/DirectX9/DirectInput.pas | 6524 +++++ Game/Code/lib/DSPack/DirectX9/DirectMusic.pas | 8102 ++++++ Game/Code/lib/DSPack/DirectX9/DirectPlay8.pas | 3451 +++ Game/Code/lib/DSPack/DirectX9/DirectShow9.pas | 31887 +++++++++++++++++++++ Game/Code/lib/DSPack/DirectX9/DirectSound.pas | 2427 ++ Game/Code/lib/DSPack/DirectX9/DirectX.inc | 29 + Game/Code/lib/DSPack/DirectX9/Jedi.inc | 510 + Game/Code/lib/DSPack/DirectX9/UseD3D8.inc | 3 + Game/Code/lib/DSPack/DirectX9/WMF9.pas | 15613 ++++++++++ Game/Code/lib/DSPack/DirectX9/dxerr8.pas | 129 + Game/Code/lib/DSPack/DirectX9/dxerr9.pas | 150 + Game/Code/lib/DSPack/UCaptureWDM.pas | 406 + Game/Code/lib/acinerella/acinerella.c | 14 +- 33 files changed, 133726 insertions(+), 5 deletions(-) create mode 100644 Game/Code/lib/DSPack/DSPack/BaseClass.pas create mode 100644 Game/Code/lib/DSPack/DSPack/BaseFilterEditor.dfm create mode 100644 Game/Code/lib/DSPack/DSPack/BaseFilterEditor.pas create mode 100644 Game/Code/lib/DSPack/DSPack/BaseFilterEditor.res create mode 100644 Game/Code/lib/DSPack/DSPack/DSEditors.pas create mode 100644 Game/Code/lib/DSPack/DSPack/DSPack.dcr create mode 100644 Game/Code/lib/DSPack/DSPack/DSPack.pas create mode 100644 Game/Code/lib/DSPack/DSPack/DSUtil.pas create mode 100644 Game/Code/lib/DSPack/DSPack/MediaTypeEditor.dfm create mode 100644 Game/Code/lib/DSPack/DSPack/MediaTypeEditor.pas create mode 100644 Game/Code/lib/DSPack/DSPack/clean.bat create mode 100644 Game/Code/lib/DSPack/DirectX9/D3DX8.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/D3DX9.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DX7toDX8.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DXFile.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DXTypes.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/Direct3D.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/Direct3D8.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/Direct3D9.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DirectDraw.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DirectInput.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DirectMusic.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DirectPlay8.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DirectShow9.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DirectSound.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/DirectX.inc create mode 100644 Game/Code/lib/DSPack/DirectX9/Jedi.inc create mode 100644 Game/Code/lib/DSPack/DirectX9/UseD3D8.inc create mode 100644 Game/Code/lib/DSPack/DirectX9/WMF9.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/dxerr8.pas create mode 100644 Game/Code/lib/DSPack/DirectX9/dxerr9.pas create mode 100644 Game/Code/lib/DSPack/UCaptureWDM.pas (limited to 'Game/Code/lib') diff --git a/Game/Code/lib/DSPack/DSPack/BaseClass.pas b/Game/Code/lib/DSPack/DSPack/BaseClass.pas new file mode 100644 index 00000000..c9a44e1d --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/BaseClass.pas @@ -0,0 +1,15581 @@ + (********************************************************************* + * DSPack 2.3.3 * + * DirectShow BaseClass * + * * + * home page : http://www.progdigy.com * + * email : hgourvest@progdigy.com * + * * + * date : 21-02-2003 * + * * + * 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. * + * * + * Contributor(s) * + * Andriy Nevhasymyy * + * Milenko Mitrovic * + * Michael Andersen * + * Martin Offenwanger * + * * + *********************************************************************) + +{.$DEFINE DEBUG} // Debug Log +{.$DEFINE TRACE} // Trace Criteral Section (DEBUG must be ON) +{.$DEFINE MESSAGE} // Use OutputDebugString instead of a File (DEBUG must be ON) + +{.$DEFINE PERF} // Show Performace Counter +{.$DEFINE VTRANSPERF} // Show additional TBCVideoTransformFilter Performace Counter (PERF must be ON) + +{$MINENUMSIZE 4} +{$ALIGN ON} + +unit BaseClass; + +{$IFDEF VER150} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} + +interface +uses Windows, SysUtils, Classes, Math, ActiveX, Forms, Messages, Controls, + DirectShow9, dialogs, ComObj, mmsystem, DSUtil; + +const + OATRUE = -1; + OAFALSE = 0; + + DEFAULTCACHE = 10; // Default node object cache size + + +type + TBCCritSec = class + private + FCritSec : TRTLCriticalSection; + {$IFDEF DEBUG} + FcurrentOwner: Longword; + FlockCount : Longword; + {$ENDIF} + public + constructor Create; + destructor Destroy; override; + procedure Lock; + procedure UnLock; + function CritCheckIn: boolean; + function CritCheckOut: boolean; + end; + + TBCBaseObject = class(TObJect) + private + FName: string; + public + constructor Create(Name: string); + destructor Destroy; override; + class function NewInstance: TObject; override; + procedure FreeInstance; override; + class function ObjectsActive: integer; + end; + + TBCClassFactory = Class; + + TBCUnknown = class(TBCBaseObject, IUnKnown) + private + FRefCount: integer; + FOwner : Pointer; + protected + function IUnknown.QueryInterface = NonDelegatingQueryInterface; + function IUnknown._AddRef = NonDelegatingAddRef; + function IUnknown._Release = NonDelegatingRelease; + function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall; + public + function _AddRef: Integer; stdcall; + function _Release: Integer; stdcall; + constructor Create(name: string; Unk: IUnknown); + constructor CreateFromFactory(Factory: TBCClassFactory; const Controller: IUnknown); virtual; + function NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall; + function NonDelegatingAddRef: Integer; virtual; stdcall; + function NonDelegatingRelease: Integer; virtual; stdcall; + function GetOwner: IUnKnown; + end; + + TBCUnknownClass = Class of TBCUnknown; + + TFormPropertyPage = class; + TFormPropertyPageClass = class of TFormPropertyPage; + + TBCBaseFilter = class; + TBCBaseFilterClass = class of TBCBaseFilter; + + TBCClassFactory = class(TObject, IUnKnown, IClassFactory) + private + FNext : TBCClassFactory; + FComClass : TBCUnknownClass; + FPropClass: TFormPropertyPageClass; + FName : String; + FClassID : TGUID; + FCategory : TGUID; + FMerit : LongWord; + FPinCount : Cardinal; + FPins : PRegFilterPins; + function RegisterFilter(FilterMapper: IFilterMapper; Register: Boolean): boolean; overload; + function RegisterFilter(FilterMapper: IFilterMapper2; Register: Boolean): boolean; overload; + procedure UpdateRegistry(Register: Boolean); overload; + protected + function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall; + function _AddRef: Integer; stdcall; + function _Release: Integer; stdcall; + function CreateInstance(const UnkOuter: IUnknown; const IID: TGUID; + out Obj): HResult; stdcall; + function LockServer(fLock: BOOL): HResult; stdcall; + public + constructor CreateFilter(ComClass: TBCUnknownClass; Name: string; + const ClassID: TGUID; const Category: TGUID; Merit: LongWord; + PinCount: Cardinal; Pins: PRegFilterPins); + constructor CreatePropertyPage(ComClass: TFormPropertyPageClass; const ClassID: TGUID); + property Name: String read FName; + property ClassID: TGUID read FClassID; + end; + + + + TBCFilterTemplate = class + private + FFactoryList : TBCClassFactory; + procedure AddObjectFactory(Factory: TBCClassFactory); + public + constructor Create; + destructor Destroy; override; + function RegisterServer(Register: Boolean): boolean; + function GetFactoryFromClassID(const CLSID: TGUID): TBCClassFactory; + end; + + + TBCMediaType = object + MediaType: PAMMediaType; + function Equal(mt: TBCMediaType): boolean; overload; + function Equal(mt: PAMMediaType): boolean; overload; + function MatchesPartial(Partial: PAMMediaType): boolean; + function IsPartiallySpecified: boolean; + function IsValid: boolean; + procedure InitMediaType; + function FormatLength: Cardinal; + end; + + + TBCBasePin = class; + + TBCBaseFilter = class(TBCUnknown, IBaseFilter, IAMovieSetup) + protected + FState : TFilterState; // current state: running, paused + FClock : IReferenceClock; // this graph's ref clock + FStart : TReferenceTime; // offset from stream time to reference time + FCLSID : TGUID; // This filters clsid used for serialization + FLock : TBCCritSec; // Object we use for locking + + FFilterName : WideString; // Full filter name + FGraph : IFilterGraph; // Graph we belong to + FSink : IMediaEventSink; // Called with notify events + FPinVersion: Integer; // Current pin version + public + constructor Create(Name: string; // Object description + Unk : IUnKnown; // IUnknown of delegating object + Lock: TBCCritSec; // Object who maintains lock + const clsid: TGUID // The clsid to be used to serialize this filter + ); overload; + + constructor Create(Name: string; // Object description + Unk : IUnKnown; // IUnknown of delegating object + Lock: TBCCritSec; // Object who maintains lock + const clsid: TGUID; // The clsid to be used to serialize this filter + out hr: HRESULT // General OLE return code + ); overload; + constructor CreateFromFactory(Factory: TBCClassFactory; const Controller: IUnknown); override; + destructor destroy; override; + // --- IPersist method --- + function GetClassID(out classID: TCLSID): HResult; stdcall; + // --- IMediaFilter methods --- + // override Stop and Pause so we can activate the pins. + // Note that Run will call Pause first if activation needed. + // Override these if you want to activate your filter rather than + // your pins. + function Stop: HRESULT; virtual; stdcall; + function Pause: HRESULT; virtual; stdcall; + // the start parameter is the difference to be added to the + // sample's stream time to get the reference time for + // its presentation + function Run(tStart: TReferenceTime): HRESULT; virtual; stdcall; + function GetState(dwMilliSecsTimeout: DWORD; out State: TFilterState): HRESULT; virtual; stdcall; + function SetSyncSource(pClock: IReferenceClock): HRESULT; stdcall; + function GetSyncSource(out pClock: IReferenceClock): HRESULT; stdcall; + // --- helper methods --- + // return the current stream time - ie find out what + // stream time should be appearing now + function StreamTime(out rtStream: TReferenceTime): HRESULT; virtual; + // Is the filter currently active? + function IsActive: boolean; + // Is this filter stopped (without locking) + function IsStopped: boolean; + // --- IBaseFilter methods --- + // pin enumerator + function EnumPins(out ppEnum: IEnumPins): HRESULT; stdcall; + // default behaviour of FindPin assumes pin ids are their names + function FindPin(Id: PWideChar; out Pin: IPin): HRESULT; virtual; stdcall; + function QueryFilterInfo(out pInfo: TFilterInfo): HRESULT; stdcall; +// milenko start (added virtual to be able to override it in the renderers) + function JoinFilterGraph(pGraph: IFilterGraph; pName: PWideChar): HRESULT; virtual; stdcall; +// milenko end + // return a Vendor information string. Optional - may return E_NOTIMPL. + // memory returned should be freed using CoTaskMemFree + // default implementation returns E_NOTIMPL + function QueryVendorInfo(out pVendorInfo: PWideChar): HRESULT; stdcall; + // --- helper methods --- + // send an event notification to the filter graph if we know about it. + // returns S_OK if delivered, S_FALSE if the filter graph does not sink + // events, or an error otherwise. + function NotifyEvent(EventCode, EventParam1, EventParam2: LongInt): HRESULT; + // return the filter graph we belong to + function GetFilterGraph: IFilterGraph; + // Request reconnect + // pPin is the pin to reconnect + // pmt is the type to reconnect with - can be NULL + // Calls ReconnectEx on the filter graph + function ReconnectPin(Pin: IPin; pmt: PAMMediaType): HRESULT; + // find out the current pin version (used by enumerators) + function GetPinVersion: LongInt; virtual; + procedure IncrementPinVersion; + // you need to supply these to access the pins from the enumerator + // and for default Stop and Pause/Run activation. + function GetPinCount: integer; virtual; abstract; + function GetPin(n: Integer): TBCBasePin; virtual; abstract; + // --- IAMovieSetup methods --- +{nev: start 04/16/04 added "virtual"} + function Register: HRESULT; virtual; stdcall; + function Unregister: HRESULT; virtual; stdcall; +{nev: end} + + property State: TFilterState read FState; + property GRaph : IFilterGraph read FGRaph; + end; + + { NOTE The implementation of this class calls the CUnknown constructor with + a NULL outer unknown pointer. This has the effect of making us a self + contained class, ie any QueryInterface, AddRef or Release calls will be + routed to the class's NonDelegatingUnknown methods. You will typically + find that the classes that do this then override one or more of these + virtual functions to provide more specialised behaviour. A good example + of this is where a class wants to keep the QueryInterface internal but + still wants its lifetime controlled by the external object } + + TBCBasePin = class(TBCUnknown, IPin, IQualityControl) + protected + FPinName: WideString; + FConnected : IPin; // Pin we have connected to + Fdir : TPinDirection; // Direction of this pin + FLock : TBCCritSec; // Object we use for locking + FRunTimeError : boolean; // Run time error generated + FCanReconnectWhenActive: boolean; // OK to reconnect when active + FTryMyTypesFirst : boolean; // When connecting enumerate + // this pin's types first + FFilter : TBCBaseFilter; // Filter we were created by + FQSink : IQualityControl; // Target for Quality messages + FTypeVersion : LongInt; // Holds current type version + Fmt : TAMMediaType; // Media type of connection + + FStart : TReferenceTime; // time from NewSegment call + FStop : TReferenceTime; // time from NewSegment + FRate : double; // rate from NewSegment + + FRef : LongInt; + function GetCurrentMediaType: TBCMediaType; + function GetAMMediaType: PAMMediaType; + protected + procedure DisplayPinInfo(ReceivePin: IPin); + procedure DisplayTypeInfo(Pin: IPin; pmt: PAMMediaType); + + // used to agree a media type for a pin connection + // given a specific media type, attempt a connection (includes + // checking that the type is acceptable to this pin) + function AttemptConnection( + ReceivePin: IPin; // connect to this pin + pmt : PAMMediaType // using this type + ): HRESULT; + // try all the media types in this enumerator - for each that + // we accept, try to connect using ReceiveConnection. + function TryMediaTypes( + ReceivePin: IPin; // connect to this pin + pmt : PAMMediaType; // proposed type from Connect + Enum : IEnumMediaTypes // try this enumerator + ): HRESULT; + + // establish a connection with a suitable mediatype. Needs to + // propose a media type if the pmt pointer is null or partially + // specified - use TryMediaTypes on both our and then the other pin's + // enumerator until we find one that works. + function AgreeMediaType( + ReceivePin: IPin; // connect to this pin + pmt : PAMMediaType // proposed type from Connect + ): HRESULT; + function DisconnectInternal: HRESULT; stdcall; + public + function NonDelegatingAddRef: Integer; override; stdcall; + function NonDelegatingRelease: Integer; override; stdcall; + constructor Create( + ObjectName: string; // Object description + Filter : TBCBaseFilter; // Owning filter who knows about pins + Lock : TBCCritSec; // Object who implements the lock + out hr : HRESULT; // General OLE return code + Name : WideString; // Pin name for us + dir : TPinDirection); // Either PINDIR_INPUT or PINDIR_OUTPUT + destructor destroy; override; + // --- IPin methods --- + // take lead role in establishing a connection. Media type pointer + // may be null, or may point to partially-specified mediatype + // (subtype or format type may be GUID_NULL). + function Connect(pReceivePin: IPin; const pmt: PAMMediaType): HRESULT; virtual; stdcall; + // (passive) accept a connection from another pin + function ReceiveConnection(pConnector: IPin; const pmt: TAMMediaType): HRESULT; virtual; stdcall; + function Disconnect: HRESULT; virtual; stdcall; + function ConnectedTo(out pPin: IPin): HRESULT; virtual; stdcall; + function ConnectionMediaType(out pmt: TAMMediaType): HRESULT; virtual; stdcall; + function QueryPinInfo(out pInfo: TPinInfo): HRESULT; virtual; stdcall; + function QueryDirection(out pPinDir: TPinDirection): HRESULT; stdcall; + function QueryId(out Id: PWideChar): HRESULT; virtual; stdcall; + // does the pin support this media type + function QueryAccept(const pmt: TAMMediaType): HRESULT; virtual; stdcall; + // return an enumerator for this pins preferred media types + function EnumMediaTypes(out ppEnum: IEnumMediaTypes): HRESULT; virtual; stdcall; + // return an array of IPin* - the pins that this pin internally connects to + // All pins put in the array must be AddReffed (but no others) + // Errors: "Can't say" - FAIL, not enough slots - return S_FALSE + // Default: return E_NOTIMPL + // The filter graph will interpret NOT_IMPL as any input pin connects to + // all visible output pins and vice versa. + // apPin can be NULL if nPin==0 (not otherwise). + function QueryInternalConnections(out apPin: IPin; var nPin: ULONG): HRESULT; virtual; stdcall; + // Called when no more data will be sent + function EndOfStream: HRESULT; virtual; stdcall; + function BeginFlush: HRESULT; virtual; stdcall; abstract; + function EndFlush: HRESULT; virtual; stdcall; abstract; + // Begin/EndFlush still PURE + + // NewSegment notifies of the start/stop/rate applying to the data + // about to be received. Default implementation records data and + // returns S_OK. + // Override this to pass downstream. + function NewSegment(tStart, tStop: TReferenceTime; dRate: double): HRESULT; virtual; stdcall; + // --- IQualityControl methods --- + function Notify(pSelf: IBaseFilter; q: TQuality): HRESULT; virtual; stdcall; + function SetSink(piqc: IQualityControl): HRESULT; virtual; stdcall; + // --- helper methods --- + + // Returns True if the pin is connected. false otherwise. + function IsConnected: boolean; + // Return the pin this is connected to (if any) + property GetConnected: IPin read FConnected; + // Check if our filter is currently stopped + function IsStopped: boolean; + // find out the current type version (used by enumerators) + function GetMediaTypeVersion: longint; virtual; + procedure IncrementTypeVersion; + // switch the pin to active (paused or running) mode + // not an error to call this if already active + function Active: HRESULT; virtual; + // switch the pin to inactive state - may already be inactive + function Inactive: HRESULT; virtual; + // Notify of Run() from filter + function Run(Start: TReferenceTime): HRESULT; virtual; + // check if the pin can support this specific proposed type and format + function CheckMediaType(mt: PAMMediaType): HRESULT; virtual; abstract; + // set the connection to use this format (previously agreed) + function SetMediaType(mt: PAMMediaType): HRESULT; virtual; + // check that the connection is ok before verifying it + // can be overridden eg to check what interfaces will be supported. + function CheckConnect(Pin: IPin): HRESULT; virtual; + // Set and release resources required for a connection + function BreakConnect: HRESULT; virtual; + function CompleteConnect(ReceivePin: IPin): HRESULT; virtual; + // returns the preferred formats for a pin + function GetMediaType(Position: integer; out MediaType: PAMMediaType): HRESULT; virtual; + // access to NewSegment values + property CurrentStopTime: TReferenceTime read FStop; + property CurrentStartTime: TReferenceTime read FStart; + property CurrentRate: double read FRate; + // Access name + property Name: WideString read FPinName; + property CanReconnectWhenActive: boolean read FCanReconnectWhenActive write FCanReconnectWhenActive; + // Media type + property CurrentMediaType: TBCMediaType read GetCurrentMediaType; + property AMMediaType: PAMMediaType read GetAMMediaType; + end; + + TBCEnumPins = class(TInterfacedObject, IEnumPins) + private + FPosition: integer; // Current ordinal position + FPinCount: integer; // Number of pins available + FFilter: TBCBaseFilter; // The filter who owns us + FVersion: LongInt; // Pin version information + // These pointers have not been AddRef'ed and + // so they should not be dereferenced. They are + // merely kept to ID which pins have been enumerated. + FPinCache: TList; + { If while we are retrieving a pin for example from the filter an error + occurs we assume that our internal state is stale with respect to the + filter (someone may have deleted all the pins). We can check before + starting whether or not the operation is likely to fail by asking the + filter what it's current version number is. If the filter has not + overriden the GetPinVersion method then this will always match } + function AreWeOutOfSync: boolean; + + (* This method performs the same operations as Reset, except is does not clear + the cache of pins already enumerated. *) + function Refresh: HRESULT; stdcall; + public + constructor Create(Filter: TBCBaseFilter; EnumPins: TBCEnumPins); + destructor Destroy; override; + + function Next(cPins: ULONG; // place this many pins... + out ppPins: IPin; // ...in this array of IPin* + pcFetched: PULONG // actual count passed returned here + ): HRESULT; stdcall; + function Skip(cPins: ULONG): HRESULT; stdcall; + function Reset: HRESULT; stdcall; + function Clone(out ppEnum: IEnumPins): HRESULT; stdcall; + end; + + TBCEnumMediaTypes = class(TInterfacedObject, IEnumMediaTypes) + private + FPosition: Cardinal; // Current ordinal position + FPin : TBCBasePin; // The pin who owns us + FVersion : LongInt; // Media type version value + function AreWeOutOfSync: boolean; + public + constructor Create(Pin: TBCBasePin; EnumMediaTypes: TBCEnumMediaTypes); + destructor Destroy; override; + 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; + + + TBCBaseOutputPin = class(TBCBasePin) + protected + FAllocator: IMemAllocator; + // interface on the downstreaminput pin, set up in CheckConnect when we connect. + FInputPin : IMemInputPin; + public + constructor Create(ObjectName: string; Filter: TBCBaseFilter; Lock: TBCCritSec; + out hr: HRESULT; const Name: WideString); + + // override CompleteConnect() so we can negotiate an allocator + function CompleteConnect(ReceivePin: IPin): HRESULT; override; + // negotiate the allocator and its buffer size/count and other properties + // Calls DecideBufferSize to set properties + function DecideAllocator(Pin: IMemInputPin; out Alloc: IMemAllocator): HRESULT; virtual; + // override this to set the buffer size and count. Return an error + // if the size/count is not to your liking. + // The allocator properties passed in are those requested by the + // input pin - use eg the alignment and prefix members if you have + // no preference on these. + function DecideBufferSize(Alloc: IMemAllocator; propInputRequest: PAllocatorProperties): HRESULT; virtual; + + // returns an empty sample buffer from the allocator + function GetDeliveryBuffer(out Sample: IMediaSample; StartTime: PReferenceTime; + EndTime: PReferenceTime; Flags: Longword): HRESULT; virtual; + + // deliver a filled-in sample to the connected input pin + // note - you need to release it after calling this. The receiving + // pin will addref the sample if it needs to hold it beyond the + // call. + function Deliver(Sample: IMediaSample): HRESULT; virtual; + + // override this to control the connection + function InitAllocator(out Alloc: IMemAllocator): HRESULT; virtual; + function CheckConnect(Pin: IPin): HRESULT; override; + function BreakConnect: HRESULT; override; + + // override to call Commit and Decommit + function Active: HRESULT; override; + function Inactive: HRESULT; override; + + // we have a default handling of EndOfStream which is to return + // an error, since this should be called on input pins only + function EndOfStream: HRESULT; override; stdcall; + + // called from elsewhere in our filter to pass EOS downstream to + // our connected input pin + function DeliverEndOfStream: HRESULT; virtual; + + // same for Begin/EndFlush - we handle Begin/EndFlush since it + // is an error on an output pin, and we have Deliver methods to + // call the methods on the connected pin + function BeginFlush: HRESULT; override; stdcall; + function EndFlush: HRESULT; override; stdcall; + function DeliverBeginFlush: HRESULT; virtual; + function DeliverEndFlush: HRESULT; virtual; + + // deliver NewSegment to connected pin - you will need to + // override this if you queue any data in your output pin. + function DeliverNewSegment(Start, Stop: TReferenceTime; Rate: double): HRESULT; virtual; + end; + + TBCBaseInputPin = class(TBCBasePin, IMemInputPin) + protected + FAllocator: IMemAllocator; // Default memory allocator + // allocator is read-only, so received samples + // cannot be modified (probably only relevant to in-place + // transforms + FReadOnly: boolean; + + //private: this should really be private... only the MPEG code + // currently looks at it directly and it should use IsFlushing(). + // in flushing state (between BeginFlush and EndFlush) + // if True, all Receives are returned with S_FALSE + FFlushing: boolean; + + // Sample properties - initalized in Receive + + FSampleProps: TAMSample2Properties; + + public + + constructor Create(ObjectName: string; Filter: TBCBaseFilter; + Lock: TBCCritSec; out hr: HRESULT; Name: WideString); + destructor Destroy; override; + + // ----------IMemInputPin-------------- + // return the allocator interface that this input pin + // would like the output pin to use + function GetAllocator(out ppAllocator: IMemAllocator): HRESULT; stdcall; + // tell the input pin which allocator the output pin is actually + // going to use. + function NotifyAllocator(pAllocator: IMemAllocator; bReadOnly: BOOL): HRESULT; stdcall; + // this method is optional (can return E_NOTIMPL). + // default implementation returns E_NOTIMPL. Override if you have + // specific alignment or prefix needs, but could use an upstream + // allocator + function GetAllocatorRequirements(out pProps: TAllocatorProperties): HRESULT; stdcall; + // do something with this media sample + function Receive(pSample: IMediaSample): HRESULT; virtual; stdcall; + // do something with these media samples + function ReceiveMultiple(var pSamples: IMediaSample; nSamples: Longint; + out nSamplesProcessed: Longint): HRESULT; stdcall; + // See if Receive() blocks + function ReceiveCanBlock: HRESULT; stdcall; + + //-----------Helper------------- + // Default handling for BeginFlush - call at the beginning + // of your implementation (makes sure that all Receive calls + // fail). After calling this, you need to free any queued data + // and then call downstream. + function BeginFlush: HRESULT; override; stdcall; + + // default handling for EndFlush - call at end of your implementation + // - before calling this, ensure that there is no queued data and no thread + // pushing any more without a further receive, then call downstream, + // then call this method to clear the m_bFlushing flag and re-enable + // receives + function EndFlush: HRESULT; override; stdcall; + + // Release the pin's allocator. + function BreakConnect: HRESULT; override; + + // helper method to check the read-only flag + property IsReadOnly: boolean read FReadOnly; + + // helper method to see if we are flushing + property IsFlushing: boolean read FFlushing; + + // Override this for checking whether it's OK to process samples + // Also call this from EndOfStream. + function CheckStreaming: HRESULT; virtual; + + // Pass a Quality notification on to the appropriate sink + function PassNotify(const q: TQuality): HRESULT; + + + //================================================================================ + // IQualityControl methods (from CBasePin) + //================================================================================ + + function Notify(pSelf: IBaseFilter; q: TQuality): HRESULT; override; stdcall; + + // no need to override: + // STDMETHODIMP SetSink(IQualityControl * piqc); + + // switch the pin to inactive state - may already be inactive + function Inactive: HRESULT; override; + + // Return sample properties pointer + function SampleProps: PAMSample2Properties; + end; + +// milenko start (added TBCDynamicOutputPin conversion) + TBLOCK_STATE = (NOT_BLOCKED, PENDING, BLOCKED); + + TBCDynamicOutputPin = class(TBCBaseOutputPin, IPinFlowControl) + public + constructor Create(ObjectName: WideString; Filter: TBCBaseFilter; + Lock: TBCCritSec; out hr: HRESULT; Name: WideString); + destructor Destroy; override; + // IUnknown Methods + function NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; override; + // IPin Methods + function Disconnect: HRESULT; override; stdcall; + // IPinFlowControl Methods + function Block(dwBlockFlags: DWORD; hEvent: THandle): HResult; stdcall; + // Set graph config info + procedure SetConfigInfo(GraphConfig: IGraphConfig; StopEvent: THandle); + {$IFDEF DEBUG} + function Deliver(Sample: IMediaSample): HRESULT; override; + function DeliverEndOfStream: HRESULT; override; + function DeliverNewSegment(Start, Stop: TReferenceTime; Rate: double): HRESULT; override; + {$ENDIF} // DEBUG + function DeliverBeginFlush: HRESULT; override; + function DeliverEndFlush: HRESULT; override; + function Active: HRESULT; override; + function Inactive: HRESULT; override; + function CompleteConnect(ReceivePin: IPin): HRESULT; override; + function StartUsingOutputPin: HRESULT; virtual; + procedure StopUsingOutputPin; virtual; + function StreamingThreadUsingOutputPin: Boolean; virtual; + function ChangeOutputFormat(const pmt: PAMMediaType; tSegmentStart, tSegmentStop: + TreferenceTime; dSegmentRate: Double): HRESULT; + function ChangeMediaType(const pmt: PAMMEdiaType): HRESULT; + function DynamicReconnect(const pmt: PAMMediaType): HRESULT; + protected + // This lock should be held when the following class members are + // being used: m_hNotifyCallerPinBlockedEvent, m_BlockState, + // m_dwBlockCallerThreadID and m_dwNumOutstandingOutputPinUsers. + FBlockStateLock: TBCCritSec; + // This event should be signaled when the output pin is + // not blocked. This is a manual reset event. For more + // information on events, see the documentation for + // CreateEvent() in the Windows SDK. + FUnblockOutputPinEvent: THandle; + // This event will be signaled when block operation succeedes or + // when the user cancels the block operation. The block operation + // can be canceled by calling IPinFlowControl2::Block( 0, NULL ) + // while the block operation is pending. + FNotifyCallerPinBlockedEvent: THandle; + // The state of the current block operation. + FBlockState: TBLOCK_STATE; + // The ID of the thread which last called IPinFlowControl::Block(). + // For more information on thread IDs, see the documentation for + // GetCurrentThreadID() in the Windows SDK. + FBlockCallerThreadID: DWORD; + // The number of times StartUsingOutputPin() has been sucessfully + // called and a corresponding call to StopUsingOutputPin() has not + // been made. When this variable is greater than 0, the streaming + // thread is calling IPin::NewSegment(), IPin::EndOfStream(), + // IMemInputPin::Receive() or IMemInputPin::ReceiveMultiple(). The + // streaming thread could also be calling: DynamicReconnect(), + // ChangeMediaType() or ChangeOutputFormat(). The output pin cannot + // be blocked while the output pin is being used. + FNumOutstandingOutputPinUsers: DWORD; + // This event should be set when the IMediaFilter::Stop() is called. + // This is a manual reset event. It is also set when the output pin + // delivers a flush to the connected input pin. + FStopEvent: THandle; + FGraphConfig: IGraphConfig; + // TRUE if the output pin's allocator's samples are read only. + // Otherwise FALSE. For more information, see the documentation + // for IMemInputPin::NotifyAllocator(). + FPinUsesReadOnlyAllocator: Boolean; + function SynchronousBlockOutputPin: HRESULT; + function AsynchronousBlockOutputPin(NotifyCallerPinBlockedEvent: THandle): HRESULT; + function UnblockOutputPin: HRESULT; + procedure BlockOutputPin; + procedure ResetBlockState; + class function WaitEvent(Event: THandle): HRESULT; + private + function Initialize: HRESULT; + function ChangeMediaTypeHelper(const pmt: PAMMediaType): HRESULT; + {$IFDEF DEBUG} + procedure AssertValid; + {$ENDIF} // DEBUG + end; +// milenko end + + TBCTransformOutputPin = class; + TBCTransformInputPin = class; + + TBCTransformFilter = class(TBCBaseFilter) + protected + FEOSDelivered : boolean; // have we sent EndOfStream + FSampleSkipped : boolean; // Did we just skip a frame + FQualityChanged: boolean; // Have we degraded? + // critical section protecting filter state. + FcsFilter: TBCCritSec; + // critical section stopping state changes (ie Stop) while we're + // processing a sample. + // + // This critical section is held when processing + // events that occur on the receive thread - Receive() and EndOfStream(). + // + // If you want to hold both m_csReceive and m_csFilter then grab + // m_csFilter FIRST - like CTransformFilter::Stop() does. + FcsReceive: TBCCritSec; + // these hold our input and output pins + FInput : TBCTransformInputPin; + FOutput: TBCTransformOutputPin; + public + // map getpin/getpincount for base enum of pins to owner + // override this to return more specialised pin objects + + function GetPinCount: integer; override; + function GetPin(n: integer): TBCBasePin; override; + function FindPin(Id: PWideChar; out ppPin: IPin): HRESULT; override; stdcall; + + // override state changes to allow derived transform filter + // to control streaming start/stop + function Stop: HRESULT; override; stdcall; + function Pause: HRESULT; override; stdcall; + + constructor Create(ObjectName: string; unk: IUnKnown; const clsid: TGUID); + constructor CreateFromFactory(Factory: TBCClassFactory; const Controller: IUnknown); override; + destructor destroy; override; + + // ================================================================= + // ----- override these bits --------------------------------------- + // ================================================================= + + // These must be supplied in a derived class + function Transform(msIn, msout: IMediaSample): HRESULT; virtual; + + // check if you can support mtIn + function CheckInputType(mtIn: PAMMediaType): HRESULT; virtual; abstract; + + // check if you can support the transform from this input to this output + function CheckTransform(mtIn, mtOut: PAMMediaType): HRESULT; virtual; abstract; + + // this goes in the factory template table to create new instances + // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); + + // call the SetProperties function with appropriate arguments + function DecideBufferSize(Allocator: IMemAllocator; prop: PAllocatorProperties): HRESULT; virtual; abstract; + + // override to suggest OUTPUT pin media types + function GetMediaType(Position: integer; out MediaType: PAMMediaType): HRESULT; virtual; abstract; + + + + // ================================================================= + // ----- Optional Override Methods ----------------------- + // ================================================================= + + // you can also override these if you want to know about streaming + function StartStreaming: HRESULT; virtual; + function StopStreaming: HRESULT; virtual; + + // override if you can do anything constructive with quality notifications + function AlterQuality(const q: TQuality): HRESULT; virtual; + + // override this to know when the media type is actually set + function SetMediaType(direction: TPinDirection; pmt: PAMMediaType): HRESULT; virtual; + + // chance to grab extra interfaces on connection + function CheckConnect(dir: TPinDirection; Pin: IPin): HRESULT; virtual; + function BreakConnect(dir: TPinDirection): HRESULT; virtual; + function CompleteConnect(direction: TPinDirection; ReceivePin: IPin): HRESULT; virtual; + + // chance to customize the transform process + function Receive(Sample: IMediaSample): HRESULT; virtual; + + // Standard setup for output sample + function InitializeOutputSample(Sample: IMediaSample; out OutSample: IMediaSample): HRESULT; virtual; + + // if you override Receive, you may need to override these three too + function EndOfStream: HRESULT; virtual; + function BeginFlush: HRESULT; virtual; + function EndFlush: HRESULT; virtual; + function NewSegment(Start, Stop: TReferenceTime; Rate: double): HRESULT; virtual; + + property Input: TBCTransformInputPin read FInput write FInput; + property Output: TBCTransformOutputPin read FOutPut write FOutput; + + end; + + TBCTransformInputPin = class(TBCBaseInputPin) + private + FTransformFilter: TBCTransformFilter; + public + constructor Create(ObjectName: string; TransformFilter: TBCTransformFilter; + out hr: HRESULT; Name: WideString); + + destructor destroy; override; + function QueryId(out id: PWideChar): HRESULT; override; stdcall; + + + // Grab and release extra interfaces if required + + function CheckConnect(Pin: IPin): HRESULT; override; + function BreakConnect: HRESULT; override; + function CompleteConnect(ReceivePin: IPin): HRESULT; override; + + // check that we can support this output type + function CheckMediaType(mtIn: PAMMediaType): HRESULT; override; + + // set the connection media type + function SetMediaType(mt: PAMMediaType): HRESULT; override; + + // --- IMemInputPin ----- + + // here's the next block of data from the stream. + // AddRef it yourself if you need to hold it beyond the end + // of this call. + function Receive(pSample: IMediaSample): HRESULT; override; stdcall; + + // provide EndOfStream that passes straight downstream + // (there is no queued data) + function EndOfStream: HRESULT; override; stdcall; + + // passes it to CTransformFilter::BeginFlush + function BeginFlush: HRESULT; override; stdcall; + + // passes it to CTransformFilter::EndFlush + function EndFlush: HRESULT; override; stdcall; + + function NewSegment(Start, Stop: TReferenceTime; Rate: double): HRESULT; override; stdcall; + + // Check if it's OK to process samples + function CheckStreaming: HRESULT; override; + end; + + TBCTransformOutputPin = class(TBCBaseOutputPin) + protected + FTransformFilter: TBCTransformFilter; + // implement IMediaPosition by passing upstream + FPosition: IUnknown; + public + constructor Create(ObjectName: string; TransformFilter: TBCTransformFilter; + out hr: HRESULT; Name: WideString); + destructor destroy; override; + // override to expose IMediaPosition + function NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; override; + + // --- TBCBaseOutputPin ------------ + + function QueryId(out Id: PWideChar): HRESULT; override; stdcall; + // Grab and release extra interfaces if required + function CheckConnect(Pin: IPin): HRESULT; override; + function BreakConnect: HRESULT; override; + function CompleteConnect(ReceivePin: IPin): HRESULT; override; + + // check that we can support this output type + function CheckMediaType(mtOut: PAMMediaType): HRESULT; override; + + // set the connection media type + function SetMediaType(pmt: PAMMediaType): HRESULT; override; + + // called from CBaseOutputPin during connection to ask for + // the count and size of buffers we need. + function DecideBufferSize(Alloc: IMemAllocator; Prop: PAllocatorProperties): HRESULT; override; + + // returns the preferred formats for a pin + function GetMediaType(Position: integer; out MediaType: PAMMediaType): HRESULT; override; + + // inherited from IQualityControl via CBasePin + function Notify(Sendr: IBaseFilter; q: TQuality): HRESULT; override; stdcall; + end; + +// milenko start (added TBCVideoTransformFilter conversion) + TBCVideoTransformFilter = class(TBCTransformFilter) + public + constructor Create(Name: WideString; Unk: IUnknown; clsid: TGUID); + destructor Destroy; override; + function EndFlush: HRESULT; override; + + // ================================================================= + // ----- override these bits --------------------------------------- + // ================================================================= + // The following methods are in CTransformFilter which is inherited. + // They are mentioned here for completeness + // + // These MUST be supplied in a derived class + // + // NOTE: + // virtual HRESULT Transform(IMediaSample * pIn, IMediaSample *pOut); + // virtual HRESULT CheckInputType(const CMediaType* mtIn) PURE; + // virtual HRESULT CheckTransform + // (const CMediaType* mtIn, const CMediaType* mtOut) PURE; + // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); + // virtual HRESULT DecideBufferSize + // (IMemAllocator * pAllocator, ALLOCATOR_PROPERTIES *pprop) PURE; + // virtual HRESULT GetMediaType(int iPosition, CMediaType *pMediaType) PURE; + // + // These MAY also be overridden + // + // virtual HRESULT StopStreaming(); + // virtual HRESULT SetMediaType(PIN_DIRECTION direction,const CMediaType *pmt); + // virtual HRESULT CheckConnect(PIN_DIRECTION dir,IPin *pPin); + // virtual HRESULT BreakConnect(PIN_DIRECTION dir); + // virtual HRESULT CompleteConnect(PIN_DIRECTION direction,IPin *pReceivePin); + // virtual HRESULT EndOfStream(void); + // virtual HRESULT BeginFlush(void); + // virtual HRESULT EndFlush(void); + // virtual HRESULT NewSegment + // (REFERENCE_TIME tStart,REFERENCE_TIME tStop,double dRate); + {$IFDEF PERF} + // If you override this - ensure that you register all these ids + // as well as any of your own, + procedure RegisterPerfId; virtual; + {$ENDIF} + protected + // =========== QUALITY MANAGEMENT IMPLEMENTATION ======================== + // Frames are assumed to come in three types: + // Type 1: an AVI key frame or an MPEG I frame. + // This frame can be decoded with no history. + // Dropping this frame means that no further frame can be decoded + // until the next type 1 frame. + // Type 1 frames are sync points. + // Type 2: an AVI non-key frame or an MPEG P frame. + // This frame cannot be decoded unless the previous type 1 frame was + // decoded and all type 2 frames since have been decoded. + // Dropping this frame means that no further frame can be decoded + // until the next type 1 frame. + // Type 3: An MPEG B frame. + // This frame cannot be decoded unless the previous type 1 or 2 frame + // has been decoded AND the subsequent type 1 or 2 frame has also + // been decoded. (This requires decoding the frames out of sequence). + // Dropping this frame affects no other frames. This implementation + // does not allow for these. All non-sync-point frames are treated + // as being type 2. + // + // The spacing of frames of type 1 in a file is not guaranteed. There MUST + // be a type 1 frame at (well, near) the start of the file in order to start + // decoding at all. After that there could be one every half second or so, + // there could be one at the start of each scene (aka "cut", "shot") or + // there could be no more at all. + // If there is only a single type 1 frame then NO FRAMES CAN BE DROPPED + // without losing all the rest of the movie. There is no way to tell whether + // this is the case, so we find that we are in the gambling business. + // To try to improve the odds, we record the greatest interval between type 1s + // that we have seen and we bet on things being no worse than this in the + // future. + + // You can tell if it's a type 1 frame by calling IsSyncPoint(). + // there is no architected way to test for a type 3, so you should override + // the quality management here if you have B-frames. + + FKeyFramePeriod: integer; // the largest observed interval between type 1 frames + // 1 means every frame is type 1, 2 means every other. + + FFramesSinceKeyFrame: integer; // Used to count frames since the last type 1. + // becomes the new m_nKeyFramePeriod if greater. + + FSkipping: Boolean; // we are skipping to the next type 1 frame + + {$IFDEF PERF} + FidFrameType: integer; // MSR id Frame type. 1=Key, 2="non-key" + FidSkip: integer; // MSR id skipping + FidLate: integer; // MSR id lateness + FidTimeTillKey: integer; // MSR id for guessed time till next key frame. + {$ENDIF} + + FitrLate: integer; // lateness from last Quality message + // (this overflows at 214 secs late). + FtDecodeStart: integer; // timeGetTime when decode started. + FitrAvgDecode: integer; // Average decode time in reference units. + + FNoSkip: Boolean; // debug - no skipping. + + // We send an EC_QUALITY_CHANGE notification to the app if we have to degrade. + // We send one when we start degrading, not one for every frame, this means + // we track whether we've sent one yet. + FQualityChanged: Boolean; + + // When non-zero, don't pass anything to renderer until next keyframe + // If there are few keys, give up and eventually draw something + FWaitForKey: integer; + + function AbortPlayback(hr: HRESULT): HRESULT; // if something bad happens + function ShouldSkipFrame(pIn: IMediaSample): Boolean; + public + function StartStreaming: HRESULT; override; + function Receive(Sample: IMediaSample): HRESULT; override; + function AlterQuality(const q: TQuality): HRESULT; override; + end; +// milenko end + + TBCTransInPlaceOutputPin = class; + TBCTransInPlaceInputPin = class; + + TBCTransInPlaceFilter = class(TBCTransformFilter) + public + // map getpin/getpincount for base enum of pins to owner + // override this to return more specialised pin objects + function GetPin(n: integer): TBCBasePin; override; + + // Set bModifiesData == false if your derived filter does + // not modify the data samples (for instance it's just copying + // them somewhere else or looking at the timestamps). + constructor Create(ObjectName: string; unk: IUnKnown; clsid: TGUID; + out hr: HRESULT; ModifiesData: boolean = True); + + constructor CreateFromFactory(Factory: TBCClassFactory; const Controller: IUnknown); override; + + // The following are defined to avoid undefined pure virtuals. + // Even if they are never called, they will give linkage warnings/errors + + // We override EnumMediaTypes to bypass the transform class enumerator + // which would otherwise call this. + function GetMediaType(Position: integer; out MediaType: PAMMediaType): HRESULT; override; + + // This is called when we actually have to provide out own allocator. + function DecideBufferSize(Alloc: IMemAllocator; propInputRequest: PAllocatorProperties): HRESULT; override; + + // The functions which call this in CTransform are overridden in this + // class to call CheckInputType with the assumption that the type + // does not change. In Debug builds some calls will be made and + // we just ensure that they do not assert. + function CheckTransform(mtIn, mtOut: PAMMediaType): HRESULT; override; + + // ================================================================= + // ----- You may want to override this ----------------------------- + // ================================================================= + + function CompleteConnect(dir: TPinDirection; ReceivePin: IPin): HRESULT; override; + + // chance to customize the transform process + function Receive(Sample: IMediaSample): HRESULT; override; + + // ================================================================= + // ----- You MUST override these ----------------------------------- + // ================================================================= + + function Transform(Sample: IMediaSample): HRESULT; reintroduce; virtual; abstract; + + // this goes in the factory template table to create new instances + // static CCOMObject * CreateInstance(LPUNKNOWN, HRESULT *); + + protected + FModifiesData: boolean; // Does this filter change the data? + function Copy(Source: IMediaSample): IMediaSample; + + // these hold our input and output pins + function InputPin: TBCTransInPlaceInputPin; + function OutputPin: TBCTransInPlaceOutputPin; + + // Helper to see if the input and output types match + function TypesMatch: boolean; + + // Are the input and output allocators different? + function UsingDifferentAllocators: boolean; + end; + + TBCTransInPlaceInputPin = class(TBCTransformInputPin) + protected + FTIPFilter: TBCTransInPlaceFilter; // our filter + FReadOnly : boolean; // incoming stream is read only + public + constructor Create(ObjectName: string; Filter: TBCTransInPlaceFilter; + out hr: HRESULT; Name: WideString); + // --- IMemInputPin ----- + // Provide an enumerator for media types by getting one from downstream + function EnumMediaTypes(out ppEnum: IEnumMediaTypes): HRESULT; override; stdcall; + + // Say whether media type is acceptable. + function CheckMediaType(pmt: PAMMediaType): HRESULT; override; + + // Return our upstream allocator + function GetAllocator(out Allocator: IMemAllocator): HRESULT; stdcall; + + // get told which allocator the upstream output pin is actually + // going to use. + function NotifyAllocator(Allocator: IMemAllocator; ReadOnly: BOOL): HRESULT; stdcall; + + // Allow the filter to see what allocator we have + // N.B. This does NOT AddRef + function PeekAllocator: IMemAllocator; + + // Pass this on downstream if it ever gets called. + function GetAllocatorRequirements(props: PAllocatorProperties): HRESULT; stdcall; + + property ReadOnly: Boolean read FReadOnly; + end; + + +// ================================================== +// Implements the output pin +// ================================================== + + TBCTransInPlaceOutputPin = class(TBCTransformOutputPin) + protected + // m_pFilter points to our CBaseFilter + FTIPFilter: TBCTransInPlaceFilter; + public + constructor Create(ObjectName: string; Filter: TBCTransInPlaceFilter; + out hr: HRESULT; Name: WideString); + + // --- CBaseOutputPin ------------ + + // negotiate the allocator and its buffer size/count + // Insists on using our own allocator. (Actually the one upstream of us). + // We don't override this - instead we just agree the default + // then let the upstream filter decide for itself on reconnect + // virtual HRESULT DecideAllocator(IMemInputPin * pPin, IMemAllocator ** pAlloc); + + // Provide a media type enumerator. Get it from upstream. + function EnumMediaTypes(out ppEnum: IEnumMediaTypes): HRESULT; override; stdcall; + + // Say whether media type is acceptable. + function CheckMediaType(pmt: PAMMediaType): HRESULT; override; + + // This just saves the allocator being used on the output pin + // Also called by input pin's GetAllocator() + procedure SetAllocator(Allocator: IMemAllocator); + + function ConnectedIMemInputPin: IMemInputPin; + + // Allow the filter to see what allocator we have + // N.B. This does NOT AddRef + function PeekAllocator: IMemAllocator; + end; + + + TBCBasePropertyPage = class(TBCUnknown, IPropertyPage) + private + FObjectSet: boolean; // SetObject has been called or not. + protected + FPageSite: IPropertyPageSite; // Details for our property site + FDirty: boolean; // Has anything been changed + FForm: TFormPropertyPage; + public + constructor Create(Name: String; Unk: IUnKnown; Form: TFormPropertyPage); + destructor Destroy; override; + procedure SetPageDirty; + + { IPropertyPage } + function SetPageSite(const pageSite: IPropertyPageSite): HResult; stdcall; + function Activate(hwndParent: HWnd; const rc: TRect; bModal: BOOL): HResult; stdcall; + function Deactivate: HResult; stdcall; + function GetPageInfo(out pageInfo: TPropPageInfo): HResult; stdcall; + function SetObjects(cObjects: Longint; pUnkList: PUnknownList): HResult; stdcall; + function Show(nCmdShow: Integer): HResult; stdcall; + function Move(const rect: TRect): HResult; stdcall; + function IsPageDirty: HResult; stdcall; + function Apply: HResult; stdcall; + function Help(pszHelpDir: POleStr): HResult; stdcall; + function TranslateAccelerator(msg: PMsg): HResult; stdcall; + end; + + TOnConnect = procedure(sender: Tobject; Unknown: IUnknown) of object; + + TFormPropertyPage = class(TForm, IUnKnown, IPropertyPage) + private + FPropertyPage: TBCBasePropertyPage; + procedure MyWndProc(var aMsg: TMessage); + public + constructor Create(AOwner: TComponent); override; + published + function OnConnect(Unknown: IUnknown): HRESULT; virtual; + function OnDisconnect: HRESULT; virtual; + function OnApplyChanges: HRESULT; virtual; + property PropertyPage : TBCBasePropertyPage read FPropertyPage implements IUnKnown, IPropertyPage; + end; + + TBCBaseDispatch = class{IDispatch} + protected + FTI: ITypeInfo; + public + // IDispatch methods + function GetTypeInfoCount(out Count: Integer): HResult; stdcall; + function GetTypeInfo(const iid: TGUID; info: Cardinal; lcid: LCID; out tinfo): HRESULT; stdcall; + function GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall; + end; + + TBCMediaControl = class(TBCUnknown, IDispatch) + public + FBaseDisp: TBCBaseDispatch; + constructor Create(name: string; unk: IUnknown); + destructor Destroy; override; + + // IDispatch methods + function GetTypeInfoCount(out Count: Integer): HResult; stdcall; + function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall; + function GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall; + function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer; + Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall; + end; + + TBCMediaEvent = class(TBCUnknown, IDisPatch{,IMediaEventEx}) + protected + FBasedisp: TBCBaseDispatch; + public + constructor Create(Name: string; Unk: IUnknown); + destructor destroy; override; + // IDispatch methods + function GetTypeInfoCount(out Count: Integer): HResult; stdcall; + function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall; + function GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall; + function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer; + Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall; + end; + + TBCMediaPosition = class(TBCUnknown, IDispatch {IMediaPosition}) + protected + FBaseDisp: TBCBaseDispatch; + public + constructor Create(Name: String; Unk: IUnknown); overload; + constructor Create(Name: String; Unk: IUnknown; out hr: HRESULT); overload; + destructor Destroy; override; + // IDispatch methods + function GetTypeInfoCount(out Count: Integer): HResult; stdcall; + function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall; + function GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall; + function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer; + Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall; + end; + + +// A utility class that handles IMediaPosition and IMediaSeeking on behalf +// of single-input pin renderers, or transform filters. +// +// Renderers will expose this from the filter; transform filters will +// expose it from the output pin and not the renderer. +// +// Create one of these, giving it your IPin* for your input pin, and delegate +// all IMediaPosition methods to it. It will query the input pin for +// IMediaPosition and respond appropriately. +// +// Call ForceRefresh if the pin connection changes. +// +// This class no longer caches the upstream IMediaPosition or IMediaSeeking +// it acquires it on each method call. This means ForceRefresh is not needed. +// The method is kept for source compatibility and to minimise the changes +// if we need to put it back later for performance reasons. + + TBCPosPassThru = class(TBCMediaPosition, IMediaSeeking) + protected + FPin: IPin; + function GetPeer(out MP: IMediaPosition): HRESULT; + function GetPeerSeeking(out MS: IMediaSeeking): HRESULT; + public + + constructor Create(name: String; Unk: IUnknown; out hr: HRESULT; Pin: IPin); + function ForceRefresh: HRESULT;{return S_OK;} + + // override to return an accurate current position + function GetMediaTime(out StartTime, EndTime: int64): HRESULT; virtual; + + // 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; + + // IMediaPosition properties + 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; + + TBCRendererPosPassThru = class(TBCPosPassThru) + protected + FPositionLock: TBCCritSec; // Locks access to our position + FStartMedia : Int64; // Start media time last seen + FEndMedia : Int64; // And likewise the end media + FReset : boolean; // Have media times been set + public + // Used to help with passing media times through graph + constructor Create(name: String; Unk: IUnknown; out hr: HRESULT; Pin: IPin); reintroduce; + destructor destroy; override; + + function RegisterMediaTime(MediaSample: IMediaSample): HRESULT; overload; + function RegisterMediaTime(StartTime, EndTime: int64): HRESULT; overload; + function GetMediaTime(out StartTime, EndTime: int64): HRESULT; override; + function ResetMediaTime: HRESULT; + function EOS: HRESULT; + end; + + // wrapper for event objects + TBCAMEvent = class + protected + FEvent: THANDLE; + public + constructor Create(ManualReset: boolean = false); + destructor destroy; override; + property Handle: THandle read FEvent; + procedure SetEv; + function Wait(Timeout: Cardinal = INFINITE): boolean; + procedure Reset; + function Check: boolean; + end; + + TBCTimeoutEvent = TBCAMEvent; + + // wrapper for event objects that do message processing + // This adds ONE method to the CAMEvent object to allow sent + // messages to be processed while waiting + TBCAMMsgEvent = class(TBCAMEvent) + public + // Allow SEND messages to be processed while waiting + function WaitMsg(Timeout: DWord = INFINITE): boolean; + end; + + // support for a worker thread + // simple thread class supports creation of worker thread, synchronization + // and communication. Can be derived to simplify parameter passing + TThreadProc = function: DWORD of object; + + TBCAMThread = class + private + FEventSend: TBCAMEvent; + FEventComplete: TBCAMEvent; + FParam: DWord; + FReturnVal: DWord; + FThreadProc: TThreadProc; + protected + FThread: THandle; + + // thread will run this function on startup + // must be supplied by derived class + function ThreadProc: DWord; virtual; + public + FAccessLock: TBCCritSec; // locks access by client threads + FWorkerLock: TBCCritSec; // locks access to shared objects + constructor Create; + destructor Destroy; override; + + + // thread initially runs this. param is actually 'this'. function + // just gets this and calls ThreadProc + function InitialThreadProc(p: Pointer): DWORD; virtual; stdcall; // WINAPI; + + // start thread running - error if already running + function Create_: boolean; + + // signal the thread, and block for a response + // + function CallWorker(Param: DWORD): DWORD; + + // accessor thread calls this when done with thread (having told thread + // to exit) + procedure Close; + + // ThreadExists + // Return True if the thread exists. FALSE otherwise + function ThreadExists: boolean; // const + + // wait for the next request + function GetRequest: DWORD; + + // is there a request? + function CheckRequest(Param: PDWORD): boolean; + + // reply to the request + procedure Reply(v: DWORD); + + // If you want to do WaitForMultipleObjects you'll need to include + // this handle in your wait list or you won't be responsive + function GetRequestHandle: THANDLE; + + // Find out what the request was + function GetRequestParam: DWORD; + + // call CoInitializeEx (COINIT_DISABLE_OLE1DDE) if + // available. S_FALSE means it's not available. + class function CoInitializeHelper: HRESULT; + end; + + + + TBCRenderedInputPin = class(TBCBaseInputPin) + private + procedure DoCompleteHandling; + protected + // Member variables to track state + FAtEndOfStream : boolean; // Set by EndOfStream + FCompleteNotified : boolean; // Set when we notify for EC_COMPLETE + public + constructor Create(ObjectName: string; Filter: TBCBaseFilter; + Lock: TBCCritSec; out hr: HRESULT; Name: WideString); + + // Override methods to track end of stream state + function EndOfStream: HRESULT; override; stdcall; + function EndFlush: HRESULT; override; stdcall; + + function Active: HRESULT; override; + function Run(Start: TReferenceTime): HRESULT; override; + end; + + +(* A generic list of pointers to objects. + No storage management or copying is done on the objects pointed to. + Objectives: avoid using MFC libraries in ndm kernel mode and + provide a really useful list type. + + The class is thread safe in that separate threads may add and + delete items in the list concurrently although the application + must ensure that constructor and destructor access is suitably + synchronised. An application can cause deadlock with operations + which use two lists by simultaneously calling + list1->Operation(list2) and list2->Operation(list1). So don't! + + The names must not conflict with MFC classes as an application + may use both. + *) + + + (* A POSITION represents (in some fashion that's opaque) a cursor + on the list that can be set to identify any element. NULL is + a valid value and several operations regard NULL as the position + "one step off the end of the list". (In an n element list there + are n+1 places to insert and NULL is that "n+1-th" value). + The POSITION of an element in the list is only invalidated if + that element is deleted. Move operations may mean that what + was a valid POSITION in one list is now a valid POSITION in + a different list. + + Some operations which at first sight are illegal are allowed as + harmless no-ops. For instance RemoveHead is legal on an empty + list and it returns NULL. This allows an atomic way to test if + there is an element there, and if so, get it. The two operations + AddTail and RemoveHead thus implement a MONITOR (See Hoare's paper). + + Single element operations return POSITIONs, non-NULL means it worked. + whole list operations return a BOOL. True means it all worked. + + This definition is the same as the POSITION type for MFCs, so we must + avoid defining it twice. + *) + + + Position = Pointer; + +{$ifdef DEBUG} + TBCNode = class(TBCBaseObject) +{$else} + TBCNode = class +{$endif} + private + FPrev: TBCNode; // Previous node in the list + FNext: TBCNode; // Next node in the list + FObject: Pointer; // Pointer to the object + public + // Constructor - initialise the object's pointers +{$ifdef DEBUG} + constructor Create; +{$endif} + // Return the previous node before this one + property Prev: TBCNode read FPrev write FPrev; + // Return the next node after this one + property Next: TBCNode read FNext write FNext; + // Get the pointer to the object for this node */ + property Data: Pointer read FObject write FObject; + end; + + TBCNodeCache = class + private + FCacheSize: Integer; + FUsed: Integer; + FHead: TBCNode; + public + constructor Create(CacheSize: Integer); + destructor Destroy; override; + procedure AddToCache(Node: TBCNode); + function RemoveFromCache: TBCNode; + end; + + + +(* A class representing one node in a list. + Each node knows a pointer to it's adjacent nodes and also a pointer + to the object that it looks after. + All of these pointers can be retrieved or set through member functions. +*) + TBCBaseList = class +{$ifdef DEBUG} + (TBCBaseObject) +{$endif} + (* Making these classes inherit from CBaseObject does nothing + functionally but it allows us to check there are no memory + leaks in debug builds. + *) + protected + FFirst: TBCNode; // Pointer to first node in the list + FLast: TBCNode; // Pointer to the last node in the list + FCount: LongInt; // Number of nodes currently in the list + private + FCache: TBCNodeCache; // Cache of unused node pointers + public + constructor Create(Name: string; Items: Integer = DEFAULTCACHE); + destructor Destroy; override; + // Remove all the nodes from self i.e. make the list empty + procedure RemoveAll; + // Return a cursor which identifies the first element of self + function GetHeadPositionI: Position; + /// Return a cursor which identifies the last element of self + function GetTailPositionI: Position; + // Return the number of objects in self + function GetCountI: Integer; + protected + (* Return the pointer to the object at rp, + Update rp to the next node in self + but make it nil if it was at the end of self. + This is a wart retained for backwards compatibility. + GetPrev is not implemented. + Use Next, Prev and Get separately. + *) + function GetNextI(var rp: Position): Pointer; + (* Return a pointer to the object at p + Asking for the object at nil will return nil harmlessly. + *) + function GetI(p: Position): Pointer; + public + (* return the next / prev position in self + return NULL when going past the end/start. + Next(nil) is same as GetHeadPosition() + Prev(nil) is same as GetTailPosition() + An n element list therefore behaves like a n+1 element + cycle with nil at the start/end. + + !!WARNING!! - This handling of nil is DIFFERENT from GetNext. + + Some reasons are: + 1. For a list of n items there are n+1 positions to insert + These are conveniently encoded as the n POSITIONs and nil. + 2. If you are keeping a list sorted (fairly common) and you + search forward for an element to insert before and don't + find it you finish up with nil as the element before which + to insert. You then want that nil to be a valid POSITION + so that you can insert before it and you want that insertion + point to mean the (n+1)-th one that doesn't have a POSITION. + (symmetrically if you are working backwards through the list). + 3. It simplifies the algebra which the methods generate. + e.g. AddBefore(p,x) is identical to AddAfter(Prev(p),x) + in ALL cases. All the other arguments probably are reflections + of the algebraic point. + *) + function Next(pos: Position): Position; + function Prev(pos: Position): Position; + + (* Return the first position in self which holds the given + pointer. Return nil if the pointer was not not found. + *) + protected + function FindI(Obj: Pointer): Position; + + (* Remove the first node in self (deletes the pointer to its + object from the list, does not free the object itself). + Return the pointer to its object. + If self was already empty it will harmlessly return nil. + *) + function RemoveHeadI: Pointer; + + (* Remove the last node in self (deletes the pointer to its + object from the list, does not free the object itself). + Return the pointer to its object. + If self was already empty it will harmlessly return nil. + *) + function RemoveTailI: Pointer; + + (* Remove the node identified by p from the list (deletes the pointer + to its object from the list, does not free the object itself). + Asking to Remove the object at nil will harmlessly return nil. + Return the pointer to the object removed. + *) + function RemoveI(pos: Position): Pointer; + + (* Add single object *pObj to become a new last element of the list. + Return the new tail position, nil if it fails. + If you are adding a COM objects, you might want AddRef it first. + Other existing POSITIONs in self are still valid + *) + function AddTailI(Obj: Pointer): Position; + public + (* Add all the elements in *pList to the tail of self. + This duplicates all the nodes in *pList (i.e. duplicates + all its pointers to objects). It does not duplicate the objects. + If you are adding a list of pointers to a COM object into the list + it's a good idea to AddRef them all it when you AddTail it. + Return True if it all worked, FALSE if it didn't. + If it fails some elements may have been added. + Existing POSITIONs in self are still valid + + If you actually want to MOVE the elements, use MoveToTail instead. + *) + function AddTail(List: TBCBaseList): boolean; + + // Mirror images of AddHead: + + (* Add single object to become a new first element of the list. + Return the new head position, nil if it fails. + Existing POSITIONs in self are still valid + *) + protected + function AddHeadI(Obj: Pointer): Position; + public + (* Add all the elements in *pList to the head of self. + Same warnings apply as for AddTail. + Return True if it all worked, FALSE if it didn't. + If it fails some of the objects may have been added. + + If you actually want to MOVE the elements, use MoveToHead instead. + *) + function AddHead(List: TBCBaseList): BOOL; + + (* Add the object *pObj to self after position p in self. + AddAfter(nil,x) adds x to the start - equivalent to AddHead + Return the position of the object added, nil if it failed. + Existing POSITIONs in self are undisturbed, including p. + *) + protected + function AddAfterI(pos: Position; Obj: Pointer): Position; + public + + (* Add the list *pList to self after position p in self + AddAfter(nil,x) adds x to the start - equivalent to AddHead + Return True if it all worked, FALSE if it didn't. + If it fails, some of the objects may be added + Existing POSITIONs in self are undisturbed, including p. + *) + function AddAfter(p: Position; List: TBCBaseList): BOOL; + + (* Mirror images: + Add the object *pObj to this-List after position p in self. + AddBefore(nil,x) adds x to the end - equivalent to AddTail + Return the position of the new object, nil if it fails + Existing POSITIONs in self are undisturbed, including p. + *) + protected + function AddBeforeI(pos: Position; Obj: Pointer): Position; + public + (* Add the list *pList to self before position p in self + AddAfter(nil,x) adds x to the start - equivalent to AddHead + Return True if it all worked, FALSE if it didn't. + If it fails, some of the objects may be added + Existing POSITIONs in self are undisturbed, including p. + *) + function AddBefore(p: Position; List: TBCBaseList): BOOL; + + (* Note that AddAfter(p,x) is equivalent to AddBefore(Next(p),x) + even in cases where p is nil or Next(p) is nil. + Similarly for mirror images etc. + This may make it easier to argue about programs. + *) + + (* The following operations do not copy any elements. + They move existing blocks of elements around by switching pointers. + They are fairly efficient for long lists as for short lists. + (Alas, the Count slows things down). + + They split the list into two parts. + One part remains as the original list, the other part + is appended to the second list. There are eight possible + variations: + Split the list {after/before} a given element + keep the {head/tail} portion in the original list + append the rest to the {head/tail} of the new list. + + Since After is strictly equivalent to Before Next + we are not in serious need of the Before/After variants. + That leaves only four. + + If you are processing a list left to right and dumping + the bits that you have processed into another list as + you go, the Tail/Tail variant gives the most natural result. + If you are processing in reverse order, Head/Head is best. + + By using nil positions and empty lists judiciously either + of the other two can be built up in two operations. + + The definition of nil (see Next/Prev etc) means that + degenerate cases include + "move all elements to new list" + "Split a list into two lists" + "Concatenate two lists" + (and quite a few no-ops) + + !!WARNING!! The type checking won't buy you much if you get list + positions muddled up - e.g. use a POSITION that's in a different + list and see what a mess you get! + *) + + (* Split self after position p in self + Retain as self the tail portion of the original self + Add the head portion to the tail end of *pList + Return True if it all worked, FALSE if it didn't. + + e.g. + foo->MoveToTail(foo->GetHeadPosition(), bar); + moves one element from the head of foo to the tail of bar + foo->MoveToTail(nil, bar); + is a no-op, returns nil + foo->MoveToTail(foo->GetTailPosition, bar); + concatenates foo onto the end of bar and empties foo. + + A better, except excessively long name might be + MoveElementsFromHeadThroughPositionToOtherTail + *) + function MoveToTail(pos: Position; List: TBCBaseList): boolean; + + (* Mirror image: + Split self before position p in self. + Retain in self the head portion of the original self + Add the tail portion to the start (i.e. head) of *pList + + e.g. + foo->MoveToHead(foo->GetTailPosition(), bar); + moves one element from the tail of foo to the head of bar + foo->MoveToHead(nil, bar); + is a no-op, returns nil + foo->MoveToHead(foo->GetHeadPosition, bar); + concatenates foo onto the start of bar and empties foo. + *) + function MoveToHead(pos: Position; List: TBCBaseList): boolean; + + (* Reverse the order of the [pointers to] objects in self *) + procedure Reverse; + end; + +// Desc: DirectShow base classes - defines classes to simplify creation of +// ActiveX source filters that support continuous generation of data. +// No support is provided for IMediaControl or IMediaPosition. +// +// Derive your source filter from CSource. +// During construction either: +// Create some CSourceStream objects to manage your pins +// Provide the user with a means of doing so eg, an IPersistFile interface. +// +// CSource provides: +// IBaseFilter interface management +// IMediaFilter interface management, via CBaseFilter +// Pin counting for CBaseFilter +// +// Derive a class from CSourceStream to manage your output pin types +// Implement GetMediaType/1 to return the type you support. If you support multiple +// types then overide GetMediaType/3, CheckMediaType and GetMediaTypeCount. +// Implement Fillbuffer() to put data into one buffer. +// +// CSourceStream provides: +// IPin management via CBaseOutputPin +// Worker thread management + +// Override construction to provide a means of creating +// CSourceStream derived objects - ie a way of creating pins. + + TBCSourceStream = class; + TStreamArray = array of TBCSourceStream; + + TBCSource = class(TBCBaseFilter) + protected + FPins: Integer; // The number of pins on this filter. Updated by CSourceStream + FStreams: Pointer; // the pins on this filter. + FStateLock: TBCCritSec; + public + constructor Create(const Name: string; unk: IUnknown; const clsid: TGUID; out hr: HRESULT); overload; + constructor Create(const Name: string; unk: IUnknown; const clsid: TGUID); overload; + destructor Destroy; override; + + function GetPinCount: Integer; override; + function GetPin(n: Integer): TBCBasePin; override; + + // -- Utilities -- + + property StateLock: TBCCritSec read FStateLock; // provide our critical section + function AddPin(Stream: TBCSourceStream): HRESULT; + function RemovePin(Stream: TBCSourceStream): HRESULT; + function FindPin(Id: PWideChar; out Pin: IPin): HRESULT; override; + function FindPinNumber(Pin: IPin): Integer; + end; + + +// +// CSourceStream +// +// Use this class to manage a stream of data that comes from a +// pin. +// Uses a worker thread to put data on the pin. + + TThreadCommand = ( + CMD_INIT, + CMD_PAUSE, + CMD_RUN, + CMD_STOP, + CMD_EXIT + ); + + TBCSourceStream = class(TBCBaseOutputPin) + public + constructor Create(const ObjectName: string; out hr: HRESULT; + Filter: TBCSource; const Name: WideString); + destructor Destroy; override; + protected + FThread: TBCAMThread; + FFilter: TBCSource; // The parent of this stream + + + // * + // * Data Source + // * + // * The following three functions: FillBuffer, OnThreadCreate/Destroy, are + // * called from within the ThreadProc. They are used in the creation of + // * the media samples this pin will provide + // * + + // Override this to provide the worker thread a means + // of processing a buffer + function FillBuffer(Samp: IMediaSample): HRESULT; virtual; abstract; + + // Called as the thread is created/destroyed - use to perform + // jobs such as start/stop streaming mode + // If OnThreadCreate returns an error the thread will exit. + function OnThreadCreate: HRESULT; virtual; + function OnThreadDestroy: HRESULT; virtual; + function OnThreadStartPlay: HRESULT; virtual; + + + public + // * + // * Worker Thread + // * + + function Active: HRESULT; override; // Starts up the worker thread + function Inactive: HRESULT; override; // Exits the worker thread. + + // thread commands + function Init: HRESULT; + function Exit_: HRESULT; + function Run: HRESULT; reintroduce; + function Pause: HRESULT; + function Stop: HRESULT; + + // * + // * AM_MEDIA_TYPE support + // * + + // If you support more than one media type then override these 2 functions + function CheckMediaType(MediaType: PAMMediaType): HRESULT; override; + function GetMediaType(Position: integer; out MediaType: PAMMediaType): HRESULT; overload; override; // List pos. 0-n + // If you support only one type then override this fn. + // This will only be called by the default implementations + // of CheckMediaType and GetMediaType(int, CMediaType*) + // You must override this fn. or the above 2! + function GetMediaType(MediaType: PAMMediaType): HRESULT; reintroduce; overload; virtual; + + function QueryId(out id: PWideChar): HRESULT; override; + protected + function GetRequest: TThreadCommand; + function CheckRequest(var com: TThreadCommand): boolean; + + // override these if you want to add thread commands + function ThreadProc: DWORD; virtual; // the thread function + + function DoBufferProcessingLoop: HRESULT; virtual; // the loop executed whilst running + end; + + TBCBaseRenderer = class; + TBCRendererInputPin = class; + + // This is our input pin class that channels calls to the renderer + + TBCRendererInputPin = class(TBCBaseInputPin) + protected + FRenderer: TBCBaseRenderer; + + public + constructor Create(Renderer: TBCBaseRenderer; out hr: HResult; + Name: PWideChar); + + // Overriden from the base pin classes + function BreakConnect: HResult; override; + function CompleteConnect(ReceivePin: IPin): HResult; override; + function SetMediaType(MediaType: PAMMediaType): HResult; override; + function CheckMediaType(MediaType: PAMMediaType): HResult; override; + function Active: HResult; override; + function Inactive: HResult; override; + + // Add rendering behaviour to interface functions + function QueryId(out Id: PWideChar): HResult; override; stdcall; + function EndOfStream: HResult; override; stdcall; + function BeginFlush: HResult; override; stdcall; + function EndFlush: HResult; override; stdcall; + function Receive(MediaSample: IMediaSample): HResult; override; stdcall; + function InheritedReceive(MediaSample: IMediaSample): HResult; + virtual; stdcall; + end; + + // Main renderer class that handles synchronisation and state changes + + TBCBaseRenderer = class(TBCBaseFilter) + protected + // friend class CRendererInputPin; + //FEndOfStreamTimerCB: TFNTimeCallBack; + // Media seeking pass by object + FPosition: TBCRendererPosPassThru; + //FPosition: IUnknown; + // Used to signal timer events + FRenderEvent: TBCAMEvent; + // Signalled to release worker thread + FThreadSignal: TBCAMEvent; + // Signalled when state complete + FCompleteEvent: TBCAMEvent; + // Stop us from rendering more data + FAbort: Boolean; + // Are we currently streaming + FIsStreaming: Boolean; + // Timer advise cookie + FAdvisedCookie: DWord; + // Current image media sample + FMediaSample: IMediaSample; + // Any more samples in the stream + FIsEOS: Boolean; + // Have we delivered an EC_COMPLETE + FIsEOSDelivered: Boolean; + // Our renderer input pin object + FInputPin: TBCRendererInputPin; + // Critical section for interfaces + FInterfaceLock: TBCCritSec; + // Controls access to internals + FRendererLock: TBCCritSec; + // QualityControl sink + FQSink: IQualityControl; + // Can we signal an EC_REPAINT + FRepaintStatus: Boolean; + // Avoid some deadlocks by tracking filter during stop + // Inside Receive between PrepareReceive and actually processing the sample + FInReceive: Boolean; + // Time when we signal EC_COMPLETE + FSignalTime: TReferenceTime; + // Used to signal end of stream + FEndOfStreamTimer: DWord; + // This lock protects the creation and of FPosition and FInputPin. + // It ensures that two threads cannot create either object simultaneously. + FObjectCreationLock: TBCCritSec; +// Milenko start (must be outside of the class and with stdcall; or it will crash) +// procedure EndOfStreamTimer( +// uID: UINT; // Timer identifier +// uMsg: UINT; // Not currently used +// dwUser: DWord; // User information +// dw1: DWord; // Windows reserved +// dw2: DWord // Is also reserved +// ); stdcall; +// Milenko end + + public +{$IFDEF PERF} + // Just before we started drawing + // Set in OnRenderStart, Used in OnRenderEnd + FRenderStart: TReferenceTime; + // MSR_id for frame time stamp + FBaseStamp: Integer; + // MSR_id for true wait time + FBaseRenderTime: Integer; + // MSR_id for time frame is late (int) + FBaseAccuracy: Integer; +{$ENDIF} + + constructor Create( + // CLSID for this renderer + RendererClass: TGUID; + // Debug ONLY description + Name: PChar; + // Aggregated owner object + Unk: IUnknown; + // General OLE return code + hr: HResult); + destructor Destroy; override; +// milenko start (added as a workaround for the TBCRendererPosPAssThru/FPosition and Renderer destructor) + function JoinFilterGraph(pGraph: IFilterGraph; pName: PWideChar): HRESULT; override; +// milenko end + + // Overriden to say what interfaces we support and where + + function GetMediaPositionInterface(IID: TGUID; out Obj): HResult; + virtual; + function NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; + override; stdcall; + + function SourceThreadCanWait(CanWait: Boolean): HResult; virtual; +{$IFDEF DEBUG} + // Debug only dump of the renderer state + procedure DisplayRendererState; +{$ENDIF} + + function WaitForRenderTime: HResult; virtual; + function CompleteStateChange(OldState: TFilterState): HResult; virtual; + + // Return internal information about this filter + + property IsEndOfStream: Boolean read FIsEOS; + property IsEndOfStreamDelivered: Boolean read FIsEOSDelivered; + property IsStreaming: Boolean read FIsStreaming; + + procedure SetAbortSignal(Abort_: Boolean); + procedure OnReceiveFirstSample(MediaSample: IMediaSample); virtual; + property RenderEvent: TBCAMEvent read FRenderEvent; + + // Permit access to the transition state + + procedure Ready; + procedure NotReady; + function CheckReady: Boolean; + + function GetPinCount: Integer; override; + function GetPin(n: integer): TBCBasePin; override; + function GetRealState: TFilterState; + procedure SendRepaint; + procedure SendNotifyWindow(Pin: IPin; Handle: HWND); + function OnDisplayChange: Boolean; + procedure SetRepaintStatus(Repaint: Boolean); + + // Override the filter and pin interface functions + + function Stop: HResult; override; stdcall; + function Pause: HResult; override; stdcall; + function Run(StartTime: TReferenceTime): HResult; override; stdcall; + function GetState(MSecs: DWord; out State: TFilterState): HResult; + override; stdcall; + function FindPin(id: PWideChar; out Pin: IPin): HResult; + override; stdcall; + + // These are available for a quality management implementation + + procedure OnRenderStart(MediaSample: IMediaSample); virtual; + procedure OnRenderEnd(MediaSample: IMediaSample); virtual; + function OnStartStreaming: HResult; virtual; + function OnStopStreaming: HResult; virtual; + procedure OnWaitStart; virtual; + procedure OnWaitEnd; virtual; + procedure PrepareRender; virtual; + + // Quality management implementation for scheduling rendering + + function ScheduleSample(MediaSample: IMediaSample): Boolean; virtual; + function GetSampleTimes(MediaSample: IMediaSample; + out StartTime: TReferenceTime; out EndTime: TReferenceTime): HResult; + virtual; + + function ShouldDrawSampleNow(MediaSample: IMediaSample; + StartTime: TReferenceTime; out EndTime: TReferenceTime): HResult; virtual; + + // Lots of end of stream complexities + + procedure TimerCallback; + procedure ResetEndOfStreamTimer; + function NotifyEndOfStream: HResult; + function SendEndOfStream: HResult; virtual; + function ResetEndOfStream: HResult; virtual; + function EndOfStream: HResult; virtual; + + // Rendering is based around the clock + + procedure SignalTimerFired; + function CancelNotification: HResult; virtual; + function ClearPendingSample: HResult; virtual; + + // Called when the filter changes state + + function Active: HResult; virtual; + function Inactive: HResult; virtual; + function StartStreaming: HResult; virtual; + function StopStreaming: HResult; virtual; + function BeginFlush: HResult; virtual; + function EndFlush: HResult; virtual; + + // Deal with connections and type changes + + function BreakConnect: HResult; virtual; + function SetMediaType(MediaType: PAMMediaType): HResult; virtual; + function CompleteConnect(ReceivePin: IPin): HResult; virtual; + + // These look after the handling of data samples + + function PrepareReceive(MediaSample: IMediaSample): HResult; virtual; + function Receive(MediaSample: IMediaSample): HResult; virtual; + function HaveCurrentSample: Boolean; virtual; + function GetCurrentSample: IMediaSample; virtual; + function Render(MediaSample: IMediaSample): HResult; virtual; + + // Derived classes MUST override these + function DoRenderSample(MediaSample: IMediaSample): HResult; + virtual; abstract; + function CheckMediaType(MediaType: PAMMediaType): HResult; + virtual; abstract; + + // Helper + procedure WaitForReceiveToComplete; +(* + // callback + property EndOfStreamTimerCB: TFNTimeCallBack read FEndOfStreamTimerCB + write FEndOfStreamTimerCB; +*) + end; + +const + AVGPERIOD = 4; + +type + // CBaseVideoRenderer is a renderer class (see its ancestor class) and + // it handles scheduling of media samples so that they are drawn at the + // correct time by the reference clock. It implements a degradation + // strategy. Possible degradation modes are: + // Drop frames here (only useful if the drawing takes significant time) + // Signal supplier (upstream) to drop some frame(s) - i.e. one-off skip. + // Signal supplier to change the frame rate - i.e. ongoing skipping. + // Or any combination of the above. + // In order to determine what's useful to try we need to know what's going + // on. This is done by timing various operations (including the supplier). + // This timing is done by using timeGetTime as it is accurate enough and + // usually cheaper than calling the reference clock. It also tells the + // truth if there is an audio break and the reference clock stops. + // We provide a number of public entry points (named OnXxxStart, OnXxxEnd) + // which the rest of the renderer calls at significant moments. These do + // the timing. + + // the number of frames that the sliding averages are averaged over. + // the rule is (1024*NewObservation + (AVGPERIOD-1) * PreviousAverage)/AVGPERIOD + + // #define DO_MOVING_AVG(avg,obs) (avg = (1024*obs + (AVGPERIOD-1)*avg)/AVGPERIOD) + + // Spot the bug in this macro - I can't. but it doesn't work! + + TBCBaseVideoRenderer = class( + // Base renderer class + TBCBaseRenderer, + // Property page guff + IQualProp, + // Allow throttling + IQualityControl) + protected + + //****************************************************************** + // State variables to control synchronisation + //****************************************************************** + + // Control of sending Quality messages. We need to know whether + // we are in trouble (e.g. frames being dropped) and where the time + // is being spent. + + // When we drop a frame we play the next one early. + // The frame after that is likely to wait before drawing and counting this + // wait as spare time is unfair, so we count it as a zero wait. + // We therefore need to know whether we are playing frames early or not. + + // The number of consecutive frames drawn at their normal time (not early) + // -1 means we just dropped a frame. + FNormal: Integer; + +{$IFDEF PERF} + // Don't drop any frames (debug and I'm not keen on people using it!) + FDrawLateFrames: Bool; +{$ENDIF} + + // The response to Quality messages says our supplier is handling things. + // We will allow things to go extra late before dropping frames. + // We will play very early after he has dropped one. + FSupplierHandlingQuality: Boolean; + + // Control of scheduling, frame dropping etc. + // We need to know where the time is being spent so as to tell whether + // we should be taking action here, signalling supplier or what. + // The variables are initialised to a mode of NOT dropping frames. + // They will tell the truth after a few frames. + // We typically record a start time for an event, later we get the time + // again and subtract to get the elapsed time, and we average this over + // a few frames. The average is used to tell what mode we are in. + + // Although these are reference times (64 bit) they are all DIFFERENCES + // between times which are small. An int will go up to 214 secs before + // overflow. Avoiding 64 bit multiplications and divisions seems + // worth while. + + // Audio-video throttling. If the user has turned up audio quality + // very high (in principle it could be any other stream, not just audio) + // then we can receive cries for help via the graph manager. In this case + // we put in a wait for some time after rendering each frame. + FThrottle: Integer; + + // The time taken to render (i.e. BitBlt) frames controls which component + // needs to degrade. If the blt is expensive, the renderer degrades. + // If the blt is cheap it's done anyway and the supplier degrades. + + // Time frames are taking to blt + FRenderAvg: Integer; + // Time for last frame blt + FRenderLast: Integer; + // Just before we started drawing (mSec) derived from timeGetTime. + FRenderStart: Integer; + + // When frames are dropped we will play the next frame as early as we can. + // If it was a false alarm and the machine is fast we slide gently back to + // normal timing. To do this, we record the offset showing just how early + // we really are. This will normally be negative meaning early or zero. + FEarliness: Integer; + + // Target provides slow long-term feedback to try to reduce the + // average sync offset to zero. Whenever a frame is actually rendered + // early we add a msec or two, whenever late we take off a few. + // We add or take off 1/32 of the error time. + // Eventually we should be hovering around zero. For a really bad case + // where we were (say) 300mSec off, it might take 100 odd frames to + // settle down. The rate of change of this is intended to be slower + // than any other mechanism in Quartz, thereby avoiding hunting. + FTarget: Integer; + + // The proportion of time spent waiting for the right moment to blt + // controls whether we bother to drop a frame or whether we reckon that + // we're doing well enough that we can stand a one-frame glitch. + + // Average of last few wait times (actually we just average how early we were). + // Negative here means LATE. + FWaitAvg: Integer; + + // The average inter-frame time. + // This is used to calculate the proportion of the time used by the + // three operations (supplying us, waiting, rendering) + + // Average inter-frame time + FFrameAvg: Integer; + // duration of last frame. + FDuration: Integer; + +{$IFDEF PERF} + // Performance logging identifiers + // MSR_id for frame time stamp + FTimeStamp: Integer; + // MSR_id for true wait time + FWaitReal: Integer; + // MSR_id for wait time recorded + FWait: Integer; + // MSR_id for time frame is late (int) + FFrameAccuracy: Integer; + // MSR_id for lateness at scheduler + FSchLateTime: Integer; + // MSR_id for Quality rate requested + FQualityRate: Integer; + // MSR_id for Quality time requested + FQualityTime: Integer; + // MSR_id for decision code + FDecision: Integer; + // MSR_id for trace style debugging + FDebug: Integer; + // MSR_id for timing the notifications per se + FSendQuality: Integer; +{$ENDIF} + // original time stamp of frame with no earliness fudges etc. + FRememberStampforPerf: TReferenceTime; +{$IFDEF PERF} + // time when previous frame rendered + FRememberFrameForPerf: TReferenceTime; +{$ENDIF} + + // PROPERTY PAGE + // This has edit fields that show the user what's happening + // These member variables hold these counts. + + // cumulative frames dropped IN THE RENDERER + FFramesDropped: Integer; + // Frames since streaming started seen BY THE RENDERER + // (some may be dropped upstream) + FFramesDrawn: Integer; + + // Next two support average sync offset and standard deviation of sync offset. + + // Sum of accuracies in mSec + FTotAcc: Int64; + // Sum of squares of (accuracies in mSec) + FSumSqAcc: Int64; + + // Next two allow jitter calculation. Jitter is std deviation of frame time. + // Time of prev frame (for inter-frame times) + FLastDraw: TReferenceTime; + // Sum of squares of (inter-frame time in mSec) + FSumSqFrameTime: Int64; + // Sum of inter-frame times in mSec + FSumFrameTime: Int64; + + // To get performance statistics on frame rate, jitter etc, we need + // to record the lateness and inter-frame time. What we actually need are the + // data above (sum, sum of squares and number of entries for each) but the data + // is generated just ahead of time and only later do we discover whether the + // frame was actually drawn or not. So we have to hang on to the data + + // hold onto frame lateness + FLate: Integer; + // hold onto inter-frame time + FFrame: Integer; + // if streaming then time streaming started + // else time of last streaming session + // used for property page statistics + FStreamingStart: Integer; + +{$IFDEF PERF} + // timeGetTime*10000+m_llTimeOffset==ref time + FTimeOffset: Int64; +{$ENDIF} + + public + constructor Create( + // CLSID for this renderer + RenderClass: TGUID; + // Debug ONLY description + Name: PChar; + // Aggregated owner object + Unk: IUnknown; + // General OLE return code + hr: HResult); + + destructor Destroy; override; + + function NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; + override; stdcall; + + // IQualityControl methods - Notify allows audio-video throttling + function SetSink(QualityControl: IQualityControl): HResult; stdcall; + function Notify(Filter: IBaseFilter; q: TQuality): HResult; stdcall; + + // These provide a full video quality management implementation + + procedure OnRenderStart(MediaSample: IMediaSample); override; + procedure OnRenderEnd(MediaSample: IMediaSample); override; + procedure OnWaitStart; reintroduce; + procedure OnWaitEnd; reintroduce; + function OnStartStreaming: HResult; reintroduce; + function OnStopStreaming: HResult; reintroduce; + procedure ThrottleWait; + + // Handle the statistics gathering for our quality management + + procedure PreparePerformanceData(Late, Frame: Integer); + procedure RecordFrameLateness(Late, Frame: Integer); virtual; + procedure OnDirectRender(MediaSample: IMediaSample); virtual; + function ResetStreamingTimes: HResult; virtual; + function ScheduleSample(MediaSample: IMediaSample): Boolean; override; + function ShouldDrawSampleNow(MediaSample: IMediaSample; + StartTime: TReferenceTime; out EndTime: TReferenceTime): HResult; + override; + + function SendQuality(Late, RealStream: TReferenceTime): HResult; virtual; +// milenko start (TBCBaseFilter made virtual, so just add override here) + function JoinFilterGraph(Graph: IFilterGraph; Name: PWideChar): HResult; override; +// milenko end + + // + // Do estimates for standard deviations for per-frame + // statistics + // + // *piResult = (llSumSq - iTot * iTot / m_cFramesDrawn - 1) / + // (m_cFramesDrawn - 2) + // or 0 if m_cFramesDrawn <= 3 + // + function GetStdDev(Samples: Integer; out Res: Integer; + SumSq, Tot: Int64): HResult; + + // IQualProp property page support + // ??? out <- var function get_FramesDroppedInRenderer(out pcFrames : Integer) : HResult; stdcall; + function get_FramesDroppedInRenderer(var FramesDropped: Integer): HResult; + stdcall; + function get_FramesDrawn(out FramesDrawn: Integer): HResult; stdcall; + function get_AvgFrameRate(out AvgFrameRate: Integer): HResult; stdcall; + function get_Jitter(out Jitter: Integer): HResult; stdcall; + function get_AvgSyncOffset(out Avg: Integer): HResult; stdcall; + function get_DevSyncOffset(out Dev: Integer): HResult; stdcall; + end; + + // milenko start (added TBCPullPin) + + // + // CPullPin +// +// object supporting pulling data from an IAsyncReader interface. +// Given a start/stop position, calls a pure Receive method with each +// IMediaSample received. +// +// This is essentially for use in a MemInputPin when it finds itself +// connected to an IAsyncReader pin instead of a pushing pin. +// + TThreadMsg = ( + TM_Pause, // stop pulling and wait for next message + TM_Start, // start pulling + TM_Exit // stop and exit + ); + + TBCPullPin = class(TBCAMThread) + private + FReader: IAsyncReader; + FStart: TReferenceTime; + FStop: TReferenceTime; + FDuration: TReferenceTime; + FSync: Boolean; + FState: TThreadMsg; + // running pull method (check m_bSync) + procedure Process; + // clean up any cancelled i/o after a flush + procedure CleanupCancelled; + // suspend thread from pulling, eg during seek + function PauseThread: HRESULT; + // start thread pulling - create thread if necy + function StartThread: HRESULT; + // stop and close thread + function StopThread: HRESULT; + // called from ProcessAsync to queue and collect requests + function QueueSample(var tCurrent: TReferenceTime; tAlignStop: TReferenceTime; bDiscontinuity: Boolean): HRESULT; + function CollectAndDeliver(tStart,tStop: TReferenceTime): HRESULT; + function DeliverSample(pSample: IMediaSample; tStart,tStop: TReferenceTime): HRESULT; + protected + FAlloc: IMemAllocator; + // override pure thread proc from CAMThread + function ThreadProc: DWord; override; + public + constructor Create; + destructor Destroy; override; + // returns S_OK if successfully connected to an IAsyncReader interface + // from this object + // Optional allocator should be proposed as a preferred allocator if + // necessary + // bSync is TRUE if we are to use sync reads instead of the + // async methods. + function Connect(pUnk: IUnknown; pAlloc: IMemAllocator; bSync: Boolean): HRESULT; + // disconnect any connection made in Connect + function Disconnect: HRESULT; + // agree an allocator using RequestAllocator - optional + // props param specifies your requirements (non-zero fields). + // returns an error code if fail to match requirements. + // optional IMemAllocator interface is offered as a preferred allocator + // but no error occurs if it can't be met. + function DecideAllocator(pAlloc: IMemAllocator; pProps: PAllocatorProperties): HRESULT; + // set start and stop position. if active, will start immediately at + // the new position. Default is 0 to duration + function Seek(tStart, tStop: TReferenceTime): HRESULT; + // return the total duration + function Duration(out ptDuration: TReferenceTime): HRESULT; + // start pulling data + function Active: HRESULT; + // stop pulling data + function Inactive: HRESULT; + // helper functions + function AlignDown(ll: Int64; lAlign: LongInt): Int64; + function AlignUp(ll: Int64; lAlign: LongInt): Int64; + // GetReader returns the (addrefed) IAsyncReader interface + // for SyncRead etc + function GetReader: IAsyncReader; + // -- pure -- + // override this to handle data arrival + // return value other than S_OK will stop data + function Receive(Sample: IMediaSample): HRESULT; virtual; abstract; + // override this to handle end-of-stream + function EndOfStream: HRESULT; virtual; abstract; + // called on runtime errors that will have caused pulling + // to stop + // these errors are all returned from the upstream filter, who + // will have already reported any errors to the filtergraph. + procedure OnError(hr: HRESULT); virtual; abstract; + // flush this pin and all downstream + function BeginFlush: HRESULT; virtual; abstract; + function EndFlush: HRESULT; virtual; abstract; + end; +// milenko end + +// milenko start (needed to access functions outside. usefull for Filter Development) +function CreateMemoryAllocator(out Allocator: IMemAllocator): HRESULT; +function AMGetWideString(Source: WideString; out Dest: PWideChar): HRESULT; +function CreatePosPassThru(Agg: IUnknown; Renderer: boolean; Pin: IPin; out PassThru: IUnknown): HRESULT; stdcall; +// milenko end + +// milenko start reftime implementation +//------------------------------------------------------------------------------ +// File: RefTime.h +// +// Desc: DirectShow base classes - defines CRefTime, a class that manages +// reference times. +// +// Copyright (c) 1992-2002 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +// +// CRefTime +// +// Manage reference times. +// Shares same data layout as REFERENCE_TIME, but adds some (nonvirtual) +// functions providing simple comparison, conversion and arithmetic. +// +// A reference time (at the moment) is a unit of seconds represented in +// 100ns units as is used in the Win32 FILETIME structure. BUT the time +// a REFERENCE_TIME represents is NOT the time elapsed since 1/1/1601 it +// will either be stream time or reference time depending upon context +// +// This class provides simple arithmetic operations on reference times +// +// keep non-virtual otherwise the data layout will not be the same as +// REFERENCE_TIME + + +// ----- +// note that you are safe to cast a CRefTime* to a REFERENCE_TIME*, but +// you will need to do so explicitly +// ----- + +type + TBCRefTime = object + public + // *MUST* be the only data member so that this class is exactly + // equivalent to a REFERENCE_TIME. + // Also, must be *no virtual functions* + FTime: TReferenceTime; + // DCODER: using Create_ as contructor replacement ... + procedure Create_; overload; + procedure Create_(msecs: Longint); overload; + // delphi 5 doesn't like "const rt: TBCRefTime" ??? + function SetTime(var rt: TBCRefTime): TBCRefTime; overload; + function SetTime(var ll: LONGLONG): TBCRefTime; overload; + function AddTime(var rt: TBCRefTime): TBCRefTime; overload; + function SubstractTime(var rt: TBCRefTime): TBCRefTime; overload; + function Millisecs: Longint; + function GetUnits: LONGLONG; + end; +// milenko end; + +// milenko start schedule implementation +//------------------------------------------------------------------------------ +// File: Schedule.cpp +// +// Desc: DirectShow base classes. +// +// Copyright (c) 1996-2002 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +type + TBCAdvisePacket = class + public + FNext : TBCAdvisePacket; + FAdviseCookie: DWORD; + FEventTime : TReferenceTime; // Time at which event should be set + FPeriod : TReferenceTime; // Periodic time + FNotify : THandle; // Handle to event or semephore + FPeriodic : Boolean; // TRUE => Periodic event + constructor Create; overload; + constructor Create(Next: TBCAdvisePacket; Time: LONGLONG); overload; + procedure InsertAfter(Packet: TBCAdvisePacket); + // That is, is it the node that represents the end of the list + function IsZ: Boolean; + function RemoveNext: TBCAdvisePacket; + procedure DeleteNext; + function Next: TBCAdvisePacket; + function Cookie: DWORD; + end; + + TBCAMSchedule = class(TBCBaseObject) + private + // Structure is: + // head -> elmt1 -> elmt2 -> z -> null + // So an empty list is: head -> z -> null + // Having head & z as links makes insertaion, + // deletion and shunting much easier. + FHead, + FZ : TBCAdvisePacket; // z is both a tail and a sentry + FNextCookie : DWORD; // Strictly increasing + FAdviseCount: DWORD; // Number of elements on list + FSerialize : TBCCritSec; + // Event that we should set if the packed added above will be the next to fire. + FEvent : THandle; + // Rather than delete advise packets, we cache them for future use + FAdviseCache: TBCAdvisePacket; + FCacheCount : DWORD; + // AddAdvisePacket: adds the packet, returns the cookie (0 if failed) + function AddAdvisePacket(Packet: TBCAdvisePacket): DWORD; overload; + // A Shunt is where we have changed the first element in the + // list and want it re-evaluating (i.e. repositioned) in + // the list. + procedure ShuntHead; + procedure Delete(Packet: TBCAdvisePacket);// This "Delete" will cache the Link + public + // ev is the event we should fire if the advise time needs re-evaluating + constructor Create(Event: THandle); + destructor Destroy; override; + function GetAdviseCount: DWORD; + function GetNextAdviseTime: TReferenceTime; + // We need a method for derived classes to add advise packets, we return the cookie + function AddAdvisePacket(const Time1, Time2: TReferenceTime; h: THandle; + Periodic: Boolean): DWORD; overload; + // And a way to cancel + function Unadvise(AdviseCookie: DWORD): HRESULT; + // Tell us the time please, and we'll dispatch the expired events. + // We return the time of the next event. + // NB: The time returned will be "useless" if you start adding extra Advises. + // But that's the problem of + // whoever is using this helper class (typically a clock). + function Advise(const Time_: TReferenceTime): TReferenceTime; + // Get the event handle which will be set if advise time requires re-evaluation. + function GetEvent: THandle; + procedure DumpLinkedList; + end; +// milenko end + +// milenko start refclock implementation +//------------------------------------------------------------------------------ +// File: RefClock.h +// +// Desc: DirectShow base classes - defines the IReferenceClock interface. +// +// Copyright (c) 1992-2002 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +(* This class hierarchy will support an IReferenceClock interface so + that an audio card (or other externally driven clock) can update the + system wide clock that everyone uses. + + The interface will be pretty thin with probably just one update method + This interface has not yet been defined. + *) + +(* This abstract base class implements the IReferenceClock + * interface. Classes that actually provide clock signals (from + * whatever source) have to be derived from this class. + * + * The abstract class provides implementations for: + * CUnknown support + * locking support (CCritSec) + * client advise code (creates a thread) + * + * Question: what can we do about quality? Change the timer + * resolution to lower the system load? Up the priority of the + * timer thread to force more responsive signals? + * + * During class construction we create a worker thread that is destroyed during + * destuction. This thread executes a series of WaitForSingleObject calls, + * waking up when a command is given to the thread or the next wake up point + * is reached. The wakeup points are determined by clients making Advise + * calls. + * + * Each advise call defines a point in time when they wish to be notified. A + * periodic advise is a series of these such events. We maintain a list of + * advise links and calculate when the nearest event notification is due for. + * We then call WaitForSingleObject with a timeout equal to this time. The + * handle we wait on is used by the class to signal that something has changed + * and that we must reschedule the next event. This typically happens when + * someone comes in and asks for an advise link while we are waiting for an + * event to timeout. + * + * While we are modifying the list of advise requests we + * are protected from interference through a critical section. Clients are NOT + * advised through callbacks. One shot clients have an event set, while + * periodic clients have a semaphore released for each event notification. A + * semaphore allows a client to be kept up to date with the number of events + * actually triggered and be assured that they can't miss multiple events being + * set. + * + * Keeping track of advises is taken care of by the CAMSchedule class. + *) + +type + TBCBaseReferenceClock = class(TBCUnknown, IReferenceClock) + private + FLock : TBCCritSec; + FAbort : Boolean; // Flag used for thread shutdown + FThread : THandle; // Thread handle + FPrivateTime : TReferenceTime; // Current best estimate of time + FPrevSystemTime : DWORD; // Last vaule we got from timeGetTime + FLastGotTime : TReferenceTime; // Last time returned by GetTime + FNextAdvise : TReferenceTime; // Time of next advise + FTimerResolution: DWORD; + {$IFDEF PERF} + FGetSystemTime : integer; + {$ENDIF} + function AdviseThread: HRESULT; // Method in which the advise thread runs + protected + FSchedule : TBCAMSchedule; + public + constructor Create(Name: String; Unk: IUnknown; out hr: HRESULT; Sched: + TBCAMSchedule = nil); + destructor Destroy; override; // Don't let me be created on the stack! + function NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; + // IReferenceClock methods + // Derived classes must implement GetPrivateTime(). All our GetTime + // does is call GetPrivateTime and then check so that time does not + // go backwards. A return code of S_FALSE implies that the internal + // clock has gone backwards and GetTime time has halted until internal + // time has caught up. (Don't know if this will be much use to folk, + // but it seems odd not to use the return code for something useful.) + function GetTime(out Time: int64): HResult; stdcall; + // When this is called, it sets m_rtLastGotTime to the time it returns. + // Provide standard mechanisms for scheduling events + // Ask for an async notification that a time has elapsed */ + function AdviseTime( + BaseTime, // base reference time + StreamTime: int64; // stream offset time + Event: THandle; // advise via this event + out AdviseCookie: DWORD // where your cookie goes + ): HResult; stdcall; + // Ask for an asynchronous periodic notification that a time has elapsed + function AdvisePeriodic( + const StartTime, // starting at this time + PeriodTime: int64; // time between notifications + Semaphore: THandle; // advise via a semaphore + out AdviseCookie: DWORD // where your cookie goes + ): HResult; stdcall; + (* Cancel a request for notification(s) - if the notification was + * a one shot timer then this function doesn't need to be called + * as the advise is automatically cancelled, however it does no + * harm to explicitly cancel a one-shot advise. It is REQUIRED that + * clients call Unadvise to clear a Periodic advise setting. + *) + function Unadvise(AdviseCookie: DWORD): HResult; stdcall; + // Methods for the benefit of derived classes or outer objects + // GetPrivateTime() is the REAL clock. GetTime is just a cover for + // it. Derived classes will probably override this method but not + // GetTime() itself. + // The important point about GetPrivateTime() is it's allowed to go + // backwards. Our GetTime() will keep returning the LastGotTime + // until GetPrivateTime() catches up. + function GetPrivateTime: TReferenceTime; virtual; + // Provide a method for correcting drift + function SetTimeDelta(const TimeDelta: TReferenceTime): HRESULT; stdcall; + function GetSchedule: TBCAMSchedule; + // Thread stuff + // Wakes thread up. Need to do this if time to next advise needs reevaluating. + procedure TriggerThread; + end; +// milenko end + +// milenko start sysclock implementation +//------------------------------------------------------------------------------ +// File: SysClock.h +// +// Desc: DirectShow base classes - defines a system clock implementation of +// IReferenceClock. +// +// Copyright (c) 1992-2002 Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ +const + IID_IPersist : TGUID = '{0000010C-0000-0000-C000-000000000046}'; + +type + TBCSystemClock = class(TBCBaseReferenceClock, IAMClockAdjust, IPersist) + public + constructor Create(Name: WideString; Unk : IUnknown; out hr : HRESULT); + function NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; + // Yield up our class id so that we can be persisted + // Implement required Ipersist method + function GetClassID(out classID: TCLSID): HResult; stdcall; + // IAMClockAdjust methods + function SetClockDelta(rtDelta: TReferenceTime): HResult; stdcall; + end; + + +{$IFDEF DEBUG} + procedure DbgLog(obj: TBCBaseObJect; const msg: string); overload; + procedure DbgLog(const msg: string); overload; + procedure DbgAssert(const Message, Filename: string; LineNumber: Integer; + ErrorAddr: Pointer); +{$ENDIF} + + function DllGetClassObject(const CLSID, IID: TGUID; var Obj): HResult; stdcall; + function DllCanUnloadNow: HResult; stdcall; + function DllRegisterServer: HResult; stdcall; + function DllUnregisterServer: HResult; stdcall; + +(* milenko start (needed for TBCBaseReferenceClock and TBCVideoTransformFilter ) *) +{$IFDEF PERF} + procedure MSR_START(Id_: Integer); + procedure MSR_STOP(Id_: Integer); + procedure MSR_INTEGER(Id_, i: Integer); + function MSR_REGISTER(s: String): Integer; +{$ENDIF} +(* milenko end *) + +implementation + +var + ObjectCount : Integer; + FactoryCount : Integer; + TemplatesVar : TBCFilterTemplate; +// milenko start (added global variables instead of local constants) + IsCheckedVersion: Bool = False; + IsTimeKillSynchronousFlagAvailable: Bool = False; + MsgId: Cardinal = 0; +// milenko end + +{$IFDEF DEBUG} + {$IFNDEF MESSAGE} + DebugFile : TextFile; + {$ENDIF} + procedure DbgLog(obj: TBCBaseObJect; const msg: string); + begin + {$IFNDEF MESSAGE} + if (obj = nil) then + Writeln(DebugFile, TimeToStr(time) +' > '+ msg) else + Writeln(DebugFile, TimeToStr(time) +' > '+ format('Object: %s, msg: %s.',[obj.FName, msg])); + Flush(DebugFile); + {$ELSE} + if (obj = nil) then OutputDebugString(PChar(TimeToStr(time) +' > '+ msg)) else + OutputDebugString(PChar(TimeToStr(time) +' > '+ format('Object: %s, msg: %s.',[obj.FName, msg]))); + {$ENDIF} + end; + + procedure DbgLog(const msg: string); overload; + begin + {$IFNDEF MESSAGE} + Writeln(DebugFile, TimeToStr(time) +' > '+ msg); + Flush(DebugFile); + {$ELSE} + OutputDebugString(PChar(TimeToStr(time) +' > '+ msg)); + {$ENDIF} + end; + + procedure DbgAssert(const Message, Filename: string; LineNumber: Integer; + ErrorAddr: Pointer); + begin + DbgLog(format('[ASSERT] %s (%s) line: %d, adr: $%x', + [Message, Filename, LineNumber, Integer(ErrorAddr)])); + end; +{$ENDIF} + +// ----------------------------------------------------------------------------- +// TBCMediaType +// ----------------------------------------------------------------------------- + + function TBCMediaType.Equal(mt: TBCMediaType): boolean; + begin + result := ((IsEqualGUID(Mediatype.majortype,mt.MediaType.majortype) = True) and + (IsEqualGUID(Mediatype.subtype,mt.MediaType.subtype) = True) and + (IsEqualGUID(Mediatype.formattype,mt.MediaType.formattype) = True) and + (Mediatype.cbFormat = mt.MediaType.cbFormat) and + ( (Mediatype.cbFormat = 0) or + (CompareMem(Mediatype.pbFormat, mt.MediaType.pbFormat, Mediatype.cbFormat)))); + end; + + function TBCMediaType.Equal(mt: PAMMediaType): boolean; + begin + result := ((IsEqualGUID(Mediatype.majortype,mt.majortype) = True) and + (IsEqualGUID(Mediatype.subtype,mt.subtype) = True) and + (IsEqualGUID(Mediatype.formattype,mt.formattype) = True) and + (Mediatype.cbFormat = mt.cbFormat) and + ( (Mediatype.cbFormat = 0) or + (CompareMem(Mediatype.pbFormat, mt.pbFormat, Mediatype.cbFormat)))); + end; + + function TBCMediaType.MatchesPartial(Partial: PAMMediaType): boolean; + begin + result := false; + if (not IsEqualGUID(partial.majortype, GUID_NULL) and + not IsEqualGUID(MediaType.majortype, partial.majortype)) then exit; + + if (not IsEqualGUID(partial.subtype, GUID_NULL) and + not IsEqualGUID(MediaType.subtype, partial.subtype)) then exit; + + if not IsEqualGUID(partial.formattype, GUID_NULL) then + begin + if not IsEqualGUID(MediaType.formattype, partial.formattype) then exit; + if (MediaType.cbFormat <> partial.cbFormat) then exit; + if ((MediaType.cbFormat <> 0) and + (CompareMem(MediaType.pbFormat, partial.pbFormat, MediaType.cbFormat) <> false)) then exit; + end; + result := True; + end; + + function TBCMediaType.IsPartiallySpecified: boolean; + begin + if (IsEqualGUID(Mediatype.majortype, GUID_NULL) or + IsEqualGUID(Mediatype.formattype, GUID_NULL)) then result := True + else result := false; + end; + + function TBCMediaType.IsValid: boolean; + begin + result := not IsEqualGUID(MediaType.majortype,GUID_NULL); + end; + + procedure TBCMediaType.InitMediaType; + begin + ZeroMemory(MediaType, sizeof(TAMMediaType)); + MediaType.lSampleSize := 1; + MediaType.bFixedSizeSamples := True; + end; + + function TBCMediaType.FormatLength: Cardinal; + begin + result := MediaType.cbFormat + end; + + +// ----------------------------------------------------------------------------- +// milenko start + function AMGetWideString(Source: WideString; out Dest: PWideChar): HRESULT; + var NameLen: Cardinal; + begin + if not assigned(@Dest) then + begin + Result := E_POINTER; + Exit; + end; + + nameLen := sizeof(WCHAR) * (length(source)+1); + Dest := CoTaskMemAlloc(nameLen); + if (Dest = nil) then + begin + Result := E_OUTOFMEMORY; + Exit; + end; + CopyMemory(Dest, PWideChar(Source), nameLen); + Result := NOERROR; + end; +{ + function AMGetWideString(Source: WideString; out Dest: PWideChar): HRESULT; + type TWideCharArray = array of WideChar; + var NameLen: Cardinal; + begin + if Source = '' then + begin + dest := nil; + result := S_OK; + exit; + end; + assert(@dest <> nil); + nameLen := (length(Source)+1)*2; + Dest := CoTaskMemAlloc(nameLen); + if(Dest = nil) then + begin + result := E_OUTOFMEMORY; + exit; + end; + CopyMemory(dest, pointer(Source), nameLen-1); + TWideCharArray(dest)[(nameLen div 2)-1] := #0; + result := NOERROR; + end; + } +// milenko end +// ----------------------------------------------------------------------------- + + +function CreateMemoryAllocator(out Allocator: IMemAllocator): HRESULT; +begin + result := CoCreateInstance(CLSID_MemoryAllocator, nil, CLSCTX_INPROC_SERVER, + IID_IMemAllocator, Allocator); +end; + +// Put this one here rather than in ctlutil.cpp to avoid linking +// anything brought in by ctlutil.cpp +function CreatePosPassThru(Agg: IUnknown; Renderer: boolean; Pin: IPin; out PassThru: IUnknown): HRESULT; stdcall; +var + UnkSeek: IUnknown; + APassThru: ISeekingPassThru; +begin + PassThru := nil; + + result := CoCreateInstance(CLSID_SeekingPassThru, Agg, CLSCTX_INPROC_SERVER, + IUnknown, UnkSeek); + if FAILED(result) then exit; + + result := UnkSeek.QueryInterface(IID_ISeekingPassThru, APassThru); + if FAILED(result) then + begin + UnkSeek := nil; + exit; + end; + + result := APassThru.Init(Renderer, Pin); + APassThru := nil; + if FAILED(result) then + begin + UnkSeek := nil; + exit; + end; + + PassThru := UnkSeek; + result := S_OK; +end; + +// ----------------------------------------------------------------------------- + + function Templates: TBCFilterTemplate; + begin + if TemplatesVar = nil then TemplatesVar := TBCFilterTemplate.Create; + result := TemplatesVar; + end; + + function DllGetClassObject(const CLSID, IID: TGUID; var Obj): HResult; stdcall; + var + Factory: TBCClassFactory; + begin + Factory := Templates.GetFactoryFromClassID(CLSID); + if Factory <> nil then + if Factory.GetInterface(IID, Obj) then + Result := S_OK + else + Result := E_NOINTERFACE + else + begin + Pointer(Obj) := nil; + Result := CLASS_E_CLASSNOTAVAILABLE; + end; + end; + + function DllCanUnloadNow: HResult; stdcall; + begin + if (ObjectCount = 0) and (FactoryCount = 0) then + result := S_OK else result := S_FALSE;; + end; + + function DllRegisterServer: HResult; stdcall; + begin + if Templates.RegisterServer(True) then result := S_OK else result := E_FAIL; + end; + + function DllUnregisterServer: HResult; stdcall; + begin + if Templates.RegisterServer(false) then result := S_OK else result := E_FAIL; + end; + +{ TBCClassFactory } + +constructor TBCClassFactory.CreateFilter(ComClass: TBCUnknownClass; Name: string; + const ClassID: TGUID; const Category: TGUID; Merit: LongWord; + PinCount: Cardinal; Pins: PRegFilterPins); +begin + Templates.AddObjectFactory(Self); + FComClass := ComClass; + FName := Name; + FClassID := ClassID; + FCategory := Category; + FMerit := Merit; + FPinCount := PinCount; + FPins := Pins; +end; + +constructor TBCClassFactory.CreatePropertyPage(ComClass: TFormPropertyPageClass; const ClassID: TGUID); +begin + Templates.AddObjectFactory(Self); + FPropClass := ComClass; + FClassID := ClassID; + FCategory := ClassID; +end; + +function TBCClassFactory.CreateInstance(const unkOuter: IUnKnown; + const iid: TIID; out obj): HResult; +var + ComObject: TBCUnknown; + PropObject: TFormPropertyPage; +begin + if @obj = nil then + begin + Result := E_POINTER; + Exit; + end; + Pointer(obj) := nil; + if FPropClass <> nil then + begin + PropObject := TFormPropertyPageClass(FPropClass).Create(nil); + PropObject.FPropertyPage := TBCBasePropertyPage.Create('',nil, PropObject); + Result := PropObject.QueryInterface(IID, obj); + end + else + begin + ComObject := TBCUnknownClass(FComClass).CreateFromFactory(self, unkOuter); + Result := ComObject.QueryInterface(IID, obj); + if ComObject.FRefCount = 0 then ComObject.Free; + end; +end; + +procedure TBCClassFactory.UpdateRegistry(Register: Boolean); +var + FileName: array[0..MAX_PATH-1] of Char; + ClassID, ServerKeyName: String; +begin + ClassID := GUIDToString(FClassID); + ServerKeyName := 'CLSID\' + ClassID + '\' + 'InprocServer32'; + if Register then + begin + CreateRegKey('CLSID\' + ClassID, '', FName); + GetModuleFileName(hinstance, FileName, MAX_PATH); + CreateRegKey(ServerKeyName, '', FileName); + CreateRegKey(ServerKeyName, 'ThreadingModel', 'Both'); + end else + begin + DeleteRegKey(ServerKeyName); + DeleteRegKey('CLSID\' + ClassID); + end; +end; + +function TBCClassFactory.RegisterFilter(FilterMapper: IFilterMapper; Register: Boolean): boolean; +type + TDynArrayPins = array of TRegFilterPins; + TDynArrayPinType = array of TRegPinTypes; +var + i, j: integer; + FilterGUID: TGUID; +begin + result := Succeeded(FilterMapper.UnregisterFilter(FClassID)); + if Register then + begin + result := Succeeded(FilterMapper.RegisterFilter(FClassID, StringToOleStr(FName), FMerit)); + if result then + begin + for i := 0 to FPinCount - 1 do + begin + if TDynArrayPins(FPins)[i].oFilter = nil then + FilterGUID := GUID_NULL else + FilterGUID := TDynArrayPins(FPins)[i].oFilter^; + result := Succeeded(FilterMapper.RegisterPin(FClassID, + TDynArrayPins(FPins)[i].strName, + TDynArrayPins(FPins)[i].bRendered, + TDynArrayPins(FPins)[i].bOutput, + TDynArrayPins(FPins)[i].bZero, + TDynArrayPins(FPins)[i].bMany, + FilterGUID, + TDynArrayPins(FPins)[i].strConnectsToPin)); + if result then + begin + for j := 0 to TDynArrayPins(FPins)[i].nMediaTypes - 1 do + begin + result := Succeeded(FilterMapper.RegisterPinType(FClassID, + TDynArrayPins(FPins)[i].strName, + TDynArrayPinType(TDynArrayPins(FPins)[i].lpMediaType)[j].clsMajorType^, + TDynArrayPinType(TDynArrayPins(FPins)[i].lpMediaType)[j].clsMinorType^)); + if not result then break; + end; + if not result then break; + end; + if not result then break; + end; + end; + end; +end; + +function TBCClassFactory.RegisterFilter(FilterMapper: IFilterMapper2; Register: Boolean): boolean; +var + RegFilter: TRegFilter2; +begin + result := Succeeded(FilterMapper.UnregisterFilter(FCategory, nil, FClassID)); +// milenko start (bugfix for Windows 98) +// Windows 98 fails when unregistering a Property Page, so the whole +// DLLUnregisterServer function fails without unregistering the Filter. + if not result and not Register and (FName = '') then Result := True; +// milenko end + if Register then + begin + RegFilter.dwVersion := 1; + RegFilter.dwMerit := FMerit; + RegFilter.cPins := FPinCount; + RegFilter.rgPins := FPins; + result := Succeeded(FilterMapper.RegisterFilter(FClassID, PWideChar(WideString(FName)), + nil, @FCategory, nil, RegFilter)); + end; +end; + +function TBCClassFactory._AddRef: Integer; +begin + result := InterlockedIncrement(FactoryCount); +end; + +function TBCClassFactory._Release: Integer; +begin + result := InterlockedDecrement(FactoryCount); +end; + +function TBCClassFactory.LockServer(fLock: BOOL): HResult; +begin + Result := CoLockObjectExternal(Self, fLock, True); + if flock then InterlockedIncrement(ObjectCount) + else InterlockedDecrement(ObjectCount); +end; + +function TBCClassFactory.QueryInterface(const IID: TGUID; out Obj): HResult; +begin + if GetInterface(IID, Obj) then Result := S_OK else Result := E_NOINTERFACE; +end; + +{ TBCFilterTemplate } + +procedure TBCFilterTemplate.AddObjectFactory(Factory: TBCClassFactory); +begin + Factory.FNext := FFactoryList; + FFactoryList := Factory; +end; + +constructor TBCFilterTemplate.Create; +begin + FFactoryList := nil; +end; + +destructor TBCFilterTemplate.Destroy; +var AFactory: TBCClassFactory; +begin + while FFactoryList <> nil do + begin + AFactory := FFactoryList; + FFactoryList := AFactory.FNext; + AFactory.Free; + end; + inherited Destroy; +end; + +function TBCFilterTemplate.GetFactoryFromClassID(const CLSID: TGUID): TBCClassFactory; +var AFactory: TBCClassFactory; +begin + result := nil; + AFactory := FFactoryList; + while AFactory <> nil do + begin + if IsEqualGUID(CLSID, AFactory.FClassID) then + begin + result := AFactory; + break; + end; + AFactory := AFactory.FNext; + end; +end; + +function TBCFilterTemplate.RegisterServer(Register: Boolean): boolean; + var + {$IFDEF DEBUG} + Filename: array[0..MAX_PATH-1] of Char; + {$ENDIF} + FilterMapper : IFilterMapper; + FilterMapper2: IFilterMapper2; + Factory: TBCClassFactory; + begin + result := false; + {$IFDEF DEBUG} + GetModuleFileName(hinstance, Filename, sizeof(Filename)); + DbgLog('TBCFilterTemplate.RegisterServer in ' + Filename); + {$ENDIF} + if Failed(CoCreateInstance(CLSID_FilterMapper2, nil, CLSCTX_INPROC_SERVER, IFilterMapper2, FilterMapper2)) then + if Failed(CoCreateInstance(CLSID_FilterMapper, nil, CLSCTX_INPROC_SERVER, IFilterMapper, FilterMapper)) then exit; + + Factory := FFactoryList; + while Factory <> nil do + begin + Factory.UpdateRegistry(false); + if FilterMapper2 <> nil then + result := Factory.RegisterFilter(FilterMapper2, Register) + else result := Factory.RegisterFilter(FilterMapper, Register); + if not result then break else Factory.UpdateRegistry(register); + Factory := Factory.FNext; + end; + FilterMapper := nil; + FilterMapper2 := nil; + end; + +{ TBCBaseObject } + +constructor TBCBaseObject.Create(Name: string); +begin +{$IFDEF DEBUG} + DbgLog('[' + ClassName + ': ' + Name + '] CREATE'); +{$ENDIF} + FName := name; +end; + +destructor TBCBaseObject.Destroy; +begin +{$IFDEF DEBUG} + DbgLog('[' + ClassName + ': ' + FName + '] FREE'); +{$ENDIF} + inherited; +end; + +procedure TBCBaseObject.FreeInstance; +begin + inherited; + InterlockedDecrement(ObjectCount); +end; + +class function TBCBaseObject.NewInstance: TObject; +begin + result := inherited NewInstance; + InterlockedIncrement(ObjectCount); +end; + +class function TBCBaseObject.ObjectsActive: integer; +begin + result := ObjectCount; +end; + +{ TBCUnknown } + +function TBCUnknown.QueryInterface(const IID: TGUID; out Obj): HResult; +begin + if FOwner <> nil then + Result := IUnknown(FOwner).QueryInterface(IID, Obj) + else + Result := NonDelegatingQueryInterface(IID, Obj); +end; + +function TBCUnknown._AddRef: Integer; +begin + if FOwner <> nil then + Result := IUnknown(FOwner)._AddRef else + Result := NonDelegatingAddRef; +end; + +function TBCUnknown._Release: Integer; +begin + if FOwner <> nil then + Result := IUnknown(FOwner)._Release else + Result := NonDelegatingRelease; +end; + +function TBCUnknown.NonDelegatingQueryInterface(const IID: TGUID; + out Obj): HResult; +begin + if GetInterface(IID, Obj) then Result := S_OK else Result := E_NOINTERFACE; +end; + +function TBCUnknown.NonDelegatingAddRef: Integer; +begin + Result := InterlockedIncrement(FRefCount); +end; + +function TBCUnknown.NonDelegatingRelease: Integer; +begin + Result := InterlockedDecrement(FRefCount); + if Result = 0 then Destroy; +end; + +function TBCUnknown.GetOwner: IUnKnown; +begin + result := IUnKnown(FOwner); +end; + +constructor TBCUnknown.Create(name: string; Unk: IUnKnown); +begin + inherited Create(name); + FOwner := Pointer(Unk); +end; + +constructor TBCUnknown.CreateFromFactory(Factory: TBCClassFactory; + const Controller: IUnKnown); +begin + Create(Factory.FName, Controller); +end; + +{ TBCBaseFilter } + +constructor TBCBaseFilter.Create(Name: string; Unk: IUnKnown; + Lock: TBCCritSec; const clsid: TGUID); +begin + inherited Create(Name, Unk); + FLock := Lock; + Fclsid := clsid; + FState := State_Stopped; + FClock := nil; + FGraph := nil; + FSink := nil; + FFilterName := ''; + FPinVersion := 1; + Assert(FLock <> nil, 'Lock = nil !'); +end; + +constructor TBCBaseFilter.Create(Name: string; Unk: IUnKnown; + Lock: TBCCritSec; const clsid: TGUID; out hr: HRESULT); +begin + Create(Name, Unk, Lock, clsid); + assert(@hr <> nil, 'Unreferenced parameter: hr'); +end; + +constructor TBCBaseFilter.CreateFromFactory(Factory: TBCClassFactory; const Controller: IUnknown); +begin + Create(Factory.FName,Controller, TBCCritSec.Create, Factory.FClassID); +end; + +destructor TBCBaseFilter.destroy; +begin + FFilterName := ''; + FClock := nil; + FLock.Free; + inherited; +end; + +function TBCBaseFilter.EnumPins(out ppEnum: IEnumPins): HRESULT; +begin + // Create a new ref counted enumerator + ppEnum := TBCEnumPins.Create(self, nil); + if ppEnum = nil then result := E_OUTOFMEMORY else result := NOERROR; +end; + +function TBCBaseFilter.FindPin(Id: PWideChar; out Pin: IPin): HRESULT; +var + i: integer; + APin: TBCBasePin; +begin + // We're going to search the pin list so maintain integrity + FLock.Lock; + try + for i := 0 to GetPinCount - 1 do + begin + APin := GetPin(i); + ASSERT(APin <> nil); + if (APin.FPinName = WideString(Id)) then + begin + // Found one that matches + // AddRef() and return it + Pin := APin; + result := S_OK; + exit; + end; + end; + Pin := nil; + result := VFW_E_NOT_FOUND; + finally + FLock.UnLock; + end; +end; + +function TBCBaseFilter.GetClassID(out classID: TCLSID): HResult; +begin + classID := FCLSID; + result := NOERROR; +end; + +function TBCBaseFilter.GetFilterGraph: IFilterGraph; +begin + result := FGRaph; +end; + +function TBCBaseFilter.GetPinVersion: LongInt; +begin + result := FPinVersion; +end; + +function TBCBaseFilter.GetState(dwMilliSecsTimeout: DWORD; + out State: TFilterState): HRESULT; +begin + State := FState; + result := S_OK; +end; + +function TBCBaseFilter.GetSyncSource(out pClock: IReferenceClock): HRESULT; +begin + FLock.Lock; + try + pClock := FClock; + finally + result := NOERROR; + FLock.UnLock; + end; +end; + +procedure TBCBaseFilter.IncrementPinVersion; +begin + InterlockedIncrement(FPinVersion) +end; + +function TBCBaseFilter.IsActive: boolean; +begin + FLock.Lock; + try + result := ((FState = State_Paused) or (FState = State_Running)); + finally + FLock.UnLock; + end; +end; + +function TBCBaseFilter.IsStopped: boolean; +begin + result := (FState = State_Stopped); +end; + +function TBCBaseFilter.JoinFilterGraph(pGraph: IFilterGraph; + pName: PWideChar): HRESULT; +begin + FLock.Lock; + try + //Henri: This implementation seem to be stupid but it's the exact conversion ????? + // NOTE: we no longer hold references on the graph (m_pGraph, m_pSink) + Pointer(FGraph) := Pointer(pGraph); + if (FGraph <> nil) then + begin + if FAILED(FGraph.QueryInterface(IID_IMediaEventSink, FSink)) then + ASSERT(FSink = nil) + else FSink._Release; // we do NOT keep a reference on it. + end + else + begin + // if graph pointer is null, then we should + // also release the IMediaEventSink on the same object - we don't + // refcount it, so just set it to null + Pointer(FSink) := nil; + end; + + FFilterName := ''; + if assigned(pName) then FFilterName := WideString(pName); + result := NOERROR; + finally + FLock.UnLock; + end; +end; + +function TBCBaseFilter.NotifyEvent(EventCode, EventParam1, + EventParam2: Integer): HRESULT; +var + Filter : IBaseFilter; +begin + // Snapshot so we don't have to lock up + if assigned(FSink) then + begin + QueryInterface(IID_IBaseFilter,Filter); + if (EC_COMPLETE = EventCode) then EventParam2 := LongInt(Filter); + result := FSink.Notify(EventCode, EventParam1, EventParam2); + Filter := nil; + end + else + result := E_NOTIMPL; +end; + +function TBCBaseFilter.Pause: HRESULT; +var + c: integer; + pin: TBCBasePin; +begin + FLock.Lock; + try + if FState = State_Stopped then + begin + for c := 0 to GetPinCount - 1 do + begin + Pin := GetPin(c); + // Disconnected pins are not activated - this saves pins + // worrying about this state themselves + if Pin.IsConnected then + begin + result := Pin.Active; + if FAILED(result) then exit; + end; + end; + end; + // notify all pins of the change to active state + FState := State_Paused; + result := S_OK; + finally + FLock.UnLock; + end; +end; + +function TBCBaseFilter.QueryFilterInfo(out pInfo: TFilterInfo): HRESULT; +var + len: Integer; +begin + len := Length(pInfo.achName)-1; + if (Length(FFilterName) > 0) then + if (Length(FFilterName) > len) then + begin + CopyMemory(@pInfo.achName, PWideChar(FFilterName), len * SizeOf(WCHAR)); + pInfo.achName[len] := #0; + end + else + CopyMemory(@pInfo.achName, PWideChar(FFilterName), (Length(FFilterName)+1) * SizeOf(WCHAR)) + else + pInfo.achName[0] := #0; + pInfo.pGraph := FGraph; + result := NOERROR; +end; + +function TBCBaseFilter.QueryVendorInfo(out pVendorInfo: PWideChar): HRESULT; +begin + result := E_NOTIMPL; +end; + +function TBCBaseFilter.ReconnectPin(Pin: IPin; pmt: PAMMediaType): HRESULT; +var Graph2: IFilterGraph2; +begin + if (FGraph <> nil) then + begin + result := FGraph.QueryInterface(IID_IFilterGraph2, Graph2); + if Succeeded(result) then + begin + result := Graph2.ReconnectEx(Pin, pmt); + Graph2 := nil; + end + else + result := FGraph.Reconnect(Pin); + end + else + result := E_NOINTERFACE; +end; + +function TBCBaseFilter.Register: HRESULT; +var + {$IFDEF DEBUG} + Filename: array[0..MAX_PATH-1] of Char; + {$ENDIF} + FilterMapper : IFilterMapper; + FilterMapper2: IFilterMapper2; + Factory: TBCClassFactory; + AResult : boolean; +begin + Aresult := false; + Result := S_FALSE; + Factory := Templates.GetFactoryFromClassID(FCLSID); + if Factory <> nil then + begin + {$IFDEF DEBUG} + GetModuleFileName(hinstance, Filename, sizeof(Filename)); + DbgLog(Self,'Register in ' + Filename); + {$ENDIF} + if Failed(CoCreateInstance(CLSID_FilterMapper2, nil, CLSCTX_INPROC_SERVER, IFilterMapper2, FilterMapper2)) then + if Failed(CoCreateInstance(CLSID_FilterMapper, nil, CLSCTX_INPROC_SERVER, IFilterMapper, FilterMapper)) then exit; + Factory.UpdateRegistry(false); + if FilterMapper2 <> nil then + AResult := Factory.RegisterFilter(FilterMapper2, True) + else AResult := Factory.RegisterFilter(FilterMapper, True); + if Aresult then Factory.UpdateRegistry(True); + FilterMapper := nil; + FilterMapper2 := nil; + end; + if AResult then result := S_OK else result := S_False; +end; + +function TBCBaseFilter.Run(tStart: TReferenceTime): HRESULT; +var + c: integer; + Pin: TBCBasePin; +begin + FLock.Lock; + try + // remember the stream time offset + FStart := tStart; + if FState = State_Stopped then + begin + result := Pause; + if FAILED(result) then exit; + end; + // notify all pins of the change to active state + if (FState <> State_Running) then + begin + for c := 0 to GetPinCount - 1 do + begin + Pin := GetPin(c); + // Disconnected pins are not activated - this saves pins + // worrying about this state themselves + if Pin.IsConnected then + begin + result := Pin.Run(tStart); + if FAILED(result) then exit; + end; + end; + end; + FState := State_Running; + result := S_OK; + finally + FLock.UnLock; + end; +end; + +function TBCBaseFilter.SetSyncSource(pClock: IReferenceClock): HRESULT; +begin + FLock.Lock; + try + FClock := pClock; + finally + result := NOERROR; + FLock.UnLock; + end; +end; + +function TBCBaseFilter.Stop: HRESULT; +var + c: integer; + Pin: TBCBasePin; + hr: HResult; +begin + FLock.Lock; + try + result := NOERROR; + // notify all pins of the state change + if (FState <> State_Stopped) then + begin + for c := 0 to GetPinCount - 1 do + begin + Pin := GetPin(c); + // Disconnected pins are not activated - this saves pins worrying + // about this state themselves. We ignore the return code to make + // sure everyone is inactivated regardless. The base input pin + // class can return an error if it has no allocator but Stop can + // be used to resync the graph state after something has gone bad + if Pin.IsConnected then + begin + hr := Pin.Inactive; + if (Failed(hr) and SUCCEEDED(result)) then result := hr; + end; + end; + end; + FState := State_Stopped; + finally + FLock.UnLock; + end; +end; + +function TBCBaseFilter.StreamTime(out rtStream: TReferenceTime): HRESULT; +begin + // Caller must lock for synchronization + // We can't grab the filter lock because we want to be able to call + // this from worker threads without deadlocking + if FClock = nil then + begin + result := VFW_E_NO_CLOCK; + exit; + end; + // get the current reference time + result := FClock.GetTime(PInt64(@rtStream)^); + if FAILED(result) then exit; + // subtract the stream offset to get stream time + rtStream := rtStream - FStart; + result := S_OK; +end; + +function TBCBaseFilter.Unregister: HRESULT; +var + {$IFDEF DEBUG} + Filename: array[0..MAX_PATH-1] of Char; + {$ENDIF} + FilterMapper : IFilterMapper; + FilterMapper2: IFilterMapper2; + Factory: TBCClassFactory; + AResult : boolean; +begin + Aresult := false; + Result := S_FALSE; + Factory := Templates.GetFactoryFromClassID(FCLSID); + if Factory <> nil then + begin + {$IFDEF DEBUG} + GetModuleFileName(hinstance, Filename, sizeof(Filename)); + DbgLog(Self,'Unregister in ' + Filename); + {$ENDIF} + if Failed(CoCreateInstance(CLSID_FilterMapper2, nil, CLSCTX_INPROC_SERVER, IFilterMapper2, FilterMapper2)) then + if Failed(CoCreateInstance(CLSID_FilterMapper, nil, CLSCTX_INPROC_SERVER, IFilterMapper, FilterMapper)) then exit; + Factory.UpdateRegistry(false); + if FilterMapper2 <> nil then + AResult := Factory.RegisterFilter(FilterMapper2, false) + else AResult := Factory.RegisterFilter(FilterMapper, false); + if Aresult then Factory.UpdateRegistry(false); + FilterMapper := nil; + FilterMapper2 := nil; + end; + if AResult then result := S_OK else result := S_False; +end; + +{ TBCEnumPins } + +constructor TBCEnumPins.Create(Filter: TBCBaseFilter; EnumPins: TBCEnumPins); +var i: integer; +begin + FPosition := 0; + FPinCount := 0; + FFilter := Filter; + FPinCache := TList.Create; + + // We must be owned by a filter derived from CBaseFilter + ASSERT(FFilter <> nil); + + // Hold a reference count on our filter + FFilter._AddRef; + + // Are we creating a new enumerator + if (EnumPins = nil) then + begin + FVersion := FFilter.GetPinVersion; + FPinCount := FFilter.GetPinCount; + end + else + begin + ASSERT(FPosition <= FPinCount); + FPosition := EnumPins.FPosition; + FPinCount := EnumPins.FPinCount; + FVersion := EnumPins.FVersion; + FPinCache.Clear; + if EnumPins.FPinCache.Count > 0 then + for i := 0 to EnumPins.FPinCache.Count - 1 do + FPinCache.Add(EnumPins.FPinCache.Items[i]); + end; +end; + +destructor TBCEnumPins.Destroy; +begin + FPinCache.Free; + FFilter._Release; + inherited Destroy; +end; + +function TBCEnumPins.Clone(out ppEnum: IEnumPins): HRESULT; +begin + result := NOERROR; + // Check we are still in sync with the filter + if AreWeOutOfSync then + begin + ppEnum := nil; + result := VFW_E_ENUM_OUT_OF_SYNC; + end + else + begin + ppEnum := TBCEnumPins.Create(FFilter, self); + if ppEnum = nil then result := E_OUTOFMEMORY; + end; +end; + +function TBCEnumPins.Next(cPins: ULONG; out ppPins: IPin; + pcFetched: PULONG): HRESULT; +type + TPointerDynArray = array of Pointer; + TIPinDynArray = array of IPin; +var + Fetched: cardinal; + RealPins: integer; + Pin: TBCBasePin; +begin + if pcFetched <> nil then + pcFetched^ := 0 + else + if (cPins>1) then + begin + result := E_INVALIDARG; + exit; + end; + Fetched := 0; // increment as we get each one. + + // Check we are still in sync with the filter + // If we are out of sync, we should refresh the enumerator. + // This will reset the position and update the other members, but + // will not clear cache of pins we have already returned. + if AreWeOutOfSync then + Refresh; + + // Calculate the number of available pins + RealPins := min(FPinCount - FPosition, cPins); + if RealPins = 0 then + begin + result := S_FALSE; + exit; + end; + + { Return each pin interface NOTE GetPin returns CBasePin * not addrefed + so we must QI for the IPin (which increments its reference count) + If while we are retrieving a pin from the filter an error occurs we + assume that our internal state is stale with respect to the filter + (for example someone has deleted a pin) so we + return VFW_E_ENUM_OUT_OF_SYNC } + + while RealPins > 0 do + begin + // Get the next pin object from the filter */ + inc(FPosition); + Pin := FFilter.GetPin(FPosition-1); + if Pin = nil then + begin + // If this happend, and it's not the first time through, then we've got a problem, + // since we should really go back and release the iPins, which we have previously + // AddRef'ed. + ASSERT(Fetched = 0); + result := VFW_E_ENUM_OUT_OF_SYNC; + exit; + end; + + // We only want to return this pin, if it is not in our cache + if FPinCache.IndexOf(Pin) = -1 then + begin + // From the object get an IPin interface + TPointerDynArray(@ppPins)[Fetched] := nil; + TIPinDynArray(@ppPins)[Fetched] := Pin; + inc(Fetched); + FPinCache.Add(Pin); + dec(RealPins); + end; + end; + + if (pcFetched <> nil) then pcFetched^ := Fetched; + + if (cPins = Fetched) then result := NOERROR else result := S_FALSE; +end; + +function TBCEnumPins.Skip(cPins: ULONG): HRESULT; +var PinsLeft: Cardinal; +begin + // Check we are still in sync with the filter + if AreWeOutOfSync then + begin + result := VFW_E_ENUM_OUT_OF_SYNC; + exit; + end; + + // Work out how many pins are left to skip over + // We could position at the end if we are asked to skip too many... + // ..which would match the base implementation for CEnumMediaTypes::Skip + + PinsLeft := FPinCount - FPosition; + if (cPins > PinsLeft) then + begin + result := S_FALSE; + exit; + end; + + inc(FPosition, cPins); + result := NOERROR; +end; + +function TBCEnumPins.Reset: HRESULT; +begin + FVersion := FFilter.GetPinVersion; + FPinCount := FFilter.GetPinCount; + FPosition := 0; + FPinCache.Clear; + result := S_OK; +end; + +function TBCEnumPins.Refresh: HRESULT; +begin + FVersion := FFilter.GetPinVersion; + FPinCount := FFilter.GetPinCount; + Fposition := 0; + result := S_OK; +end; + +function TBCEnumPins.AreWeOutOfSync: boolean; +begin + if FFilter.GetPinVersion = FVersion then result:= FALSE else result := True; +end; + +{ TBCBasePin } + +{ Called by IMediaFilter implementation when the state changes from Stopped + to either paused or running and in derived classes could do things like + commit memory and grab hardware resource (the default is to do nothing) } + +function TBCBasePin.Active: HRESULT; +begin + result := NOERROR; +end; + +{ This is called to make the connection, including the task of finding + a media type for the pin connection. pmt is the proposed media type + from the Connect call: if this is fully specified, we will try that. + Otherwise we enumerate and try all the input pin's types first and + if that fails we then enumerate and try all our preferred media types. + For each media type we check it against pmt (if non-null and partially + specified) as well as checking that both pins will accept it. } + +function TBCBasePin.AgreeMediaType(ReceivePin: IPin; pmt: PAMMediaType): HRESULT; +var + EnumMT: IEnumMediaTypes; + hrFailure: HResult; + i: integer; +begin + ASSERT(ReceivePin <> nil); + + // if the media type is fully specified then use that + if ((pmt <> nil) and (not TBCMediaType(pmt).IsPartiallySpecified)) then + begin + // if this media type fails, then we must fail the connection + // since if pmt is nonnull we are only allowed to connect + // using a type that matches it. + result := AttemptConnection(ReceivePin, pmt); + exit; + end; + + + // Try the other pin's enumerator + hrFailure := VFW_E_NO_ACCEPTABLE_TYPES; + for i := 0 to 1 do + begin + if (i = byte(FTryMyTypesFirst)) then + result := ReceivePin.EnumMediaTypes(EnumMT) + else result := EnumMediaTypes(EnumMT); + + if Succeeded(Result) then + begin + Assert(EnumMT <> nil); + result := TryMediaTypes(ReceivePin,pmt,EnumMT); + EnumMT := nil; + if Succeeded(result) then + begin + result := NOERROR; + exit; + end + else + begin + // try to remember specific error codes if there are any + if ((result <> E_FAIL) and + (result <> E_INVALIDARG) and + (result <> VFW_E_TYPE_NOT_ACCEPTED)) then hrFailure := result; + end; + end; + end; + result := hrFailure; +end; + +function TBCBasePin.AttemptConnection(ReceivePin: IPin; pmt: PAMMediaType): HRESULT; +begin + + // The caller should hold the filter lock becasue this function + // uses m_Connected. The caller should also hold the filter lock + // because this function calls SetMediaType(), IsStopped() and + // CompleteConnect(). + ASSERT(FLock.CritCheckIn); + + // Check that the connection is valid -- need to do this for every + // connect attempt since BreakConnect will undo it. + result := CheckConnect(ReceivePin); + if FAILED(result) then + begin + {$IFDEF DEBUG} + DbgLog(self, 'CheckConnect failed'); + {$ENDIF} + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + Assert(SUCCEEDED(BreakConnect)); + exit; + end; + + DisplayTypeInfo(ReceivePin, pmt); + + // Check we will accept this media type + + result := CheckMediaType(pmt); + if (result = NOERROR) then + begin + // Make ourselves look connected otherwise ReceiveConnection + // may not be able to complete the connection + FConnected := ReceivePin; + result := SetMediaType(pmt); + if Succeeded(result) then + begin + // See if the other pin will accept this type */ + result := ReceivePin.ReceiveConnection(self, pmt^); + if Succeeded(result) then + begin + // Complete the connection + result := CompleteConnect(ReceivePin); + if Succeeded(result) then exit + else + begin + {$IFDEF DEBUG} + DbgLog(self, 'Failed to complete connection'); + {$ENDIF} + ReceivePin.Disconnect; + end; + end; + end; + end + else + begin + // we cannot use this media type + // return a specific media type error if there is one + // or map a general failure code to something more helpful + // (in particular S_FALSE gets changed to an error code) + if (SUCCEEDED(result) or (result = E_FAIL) or (result = E_INVALIDARG)) then + result := VFW_E_TYPE_NOT_ACCEPTED; + end; + + // BreakConnect and release any connection here in case CheckMediaType + // failed, or if we set anything up during a call back during + // ReceiveConnection. + + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + Assert(Succeeded(BreakConnect)); + + // If failed then undo our state + FConnected := nil; +end; + +{ This is called when we realise we can't make a connection to the pin and + must undo anything we did in CheckConnect - override to release QIs done } + +function TBCBasePin.BreakConnect: HRESULT; +begin + result := NOERROR; +end; + +{ This is called during Connect() to provide a virtual method that can do + any specific check needed for connection such as QueryInterface. This + base class method just checks that the pin directions don't match } + +function TBCBasePin.CheckConnect(Pin: IPin): HRESULT; +var pd: TPinDirection; +begin + // Check that pin directions DONT match + Pin.QueryDirection(pd); + ASSERT((pd = PINDIR_OUTPUT) or (pd = PINDIR_INPUT)); + ASSERT((Fdir = PINDIR_OUTPUT) or (Fdir = PINDIR_INPUT)); + + // we should allow for non-input and non-output connections? + if (pd = Fdir) then result := VFW_E_INVALID_DIRECTION + else result := NOERROR; +end; + +{ Called when we want to complete a connection to another filter. Failing + this will also fail the connection and disconnect the other pin as well } + +function TBCBasePin.CompleteConnect(ReceivePin: IPin): HRESULT; +begin + result := NOERROR; +end; + + { Asked to connect to a pin. A pin is always attached to an owning filter + object so we always delegate our locking to that object. We first of all + retrieve a media type enumerator for the input pin and see if we accept + any of the formats that it would ideally like, failing that we retrieve + our enumerator and see if it will accept any of our preferred types } + +function TBCBasePin.Connect(pReceivePin: IPin; const pmt: PAMMediaType): HRESULT; +var HR: HResult; +begin + FLock.Lock; + try + DisplayPinInfo(pReceivePin); + // See if we are already connected + if FConnected <> nil then + begin + {$IFDEF DEBUG} + DbgLog(self, 'Already connected'); + {$ENDIF} + result := VFW_E_ALREADY_CONNECTED; +// milenko start + Exit; +// milenko end + end; + + // See if the filter is active + if (not IsStopped) and (not FCanReconnectWhenActive) then + begin + result := VFW_E_NOT_STOPPED; + exit; + end; + + // Find a mutually agreeable media type - + // Pass in the template media type. If this is partially specified, + // each of the enumerated media types will need to be checked against + // it. If it is non-null and fully specified, we will just try to connect + // with this. + Hr := AgreeMediaType(pReceivePin, pmt); + if Failed(hr) then + begin + {$IFDEF DEBUG} + DbgLog(self, 'Failed to agree type'); + {$ENDIF} + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + ASSERT(SUCCEEDED(BreakConnect)); + result := HR; + exit; + end; + {$IFDEF DEBUG} + DbgLog(self, 'Connection succeeded'); + {$ENDIF} + result := NOERROR; + finally + FLock.UnLock; + end; +end; + +// Return an AddRef()'d pointer to the connected pin if there is one + +function TBCBasePin.ConnectedTo(out pPin: IPin): HRESULT; +begin + // It's pointless to lock here. + // The caller should ensure integrity. + pPin := FConnected; + if (pPin <> nil) then + result := S_OK + else result := VFW_E_NOT_CONNECTED; +end; + +function TBCBasePin.ConnectionMediaType(out pmt: TAMMediaType): HRESULT; +begin + FLock.Lock; + try + // Copy constructor of m_mt allocates the memory + if IsConnected then + begin + CopyMediaType(@pmt,@Fmt); + result := S_OK; + end + else + begin + zeromemory(@pmt, SizeOf(TAMMediaType)); + pmt.lSampleSize := 1; + pmt.bFixedSizeSamples := True; + result := VFW_E_NOT_CONNECTED; + end; + finally + + FLock.UnLock; + end; +end; + +constructor TBCBasePin.Create(ObjectName: string; Filter: TBCBaseFilter; + Lock: TBCCritSec; out hr: HRESULT; Name: WideString; + dir: TPinDirection); +begin + inherited Create(ObjectName, nil); + FFilter := Filter; + FLock := Lock; + FPinName := Name; + FConnected := nil; + Fdir := dir; + FRunTimeError := FALSE; + FQSink := nil; + FTypeVersion := 1; + FStart := 0; + FStop := MAX_TIME; + FCanReconnectWhenActive := false; + FTryMyTypesFirst := false; + FRate := 1.0; + { WARNING - Filter is often not a properly constituted object at + this state (in particular QueryInterface may not work) - this + is because its owner is often its containing object and we + have been called from the containing object's constructor so + the filter's owner has not yet had its CUnknown constructor + called.} + + FRef := 0; // debug + ZeroMemory(@fmt, SizeOf(TAMMediaType)); + ASSERT(Filter <> nil); + ASSERT(Lock <> nil); +end; + +destructor TBCBasePin.destroy; +begin + // We don't call disconnect because if the filter is going away + // all the pins must have a reference count of zero so they must + // have been disconnected anyway - (but check the assumption) + ASSERT(FConnected = nil); + FPinName := ''; + Assert(FRef = 0); + FreeMediaType(@fmt); + inherited Destroy; +end; + +// Called when we want to terminate a pin connection + +function TBCBasePin.Disconnect: HRESULT; +begin + FLock.Lock; + try + // See if the filter is active + if not IsStopped then + result := VFW_E_NOT_STOPPED + else result := DisconnectInternal; + finally + FLock.UnLock; + end; +end; + +function TBCBasePin.DisconnectInternal: HRESULT; +begin + ASSERT(FLock.CritCheckIn); + if (FConnected <> nil) then + begin + result := BreakConnect; + if FAILED(result) then + begin + // There is usually a bug in the program if BreakConnect() fails. + {$IFDEF DEBUG} + DbgLog(self, 'WARNING: BreakConnect() failed in CBasePin::Disconnect().'); + {$ENDIF} + exit; + end; + FConnected := nil; + result := S_OK; + exit; + end + else + // no connection - not an error + result := S_FALSE; +end; + +procedure TBCBasePin.DisplayPinInfo(ReceivePin: IPin); +{$IFDEF DEBUG} +const + BadPin : WideString = 'Bad Pin'; +var + ConnectPinInfo, ReceivePinInfo: TPinInfo; +begin + if FAILED(QueryPinInfo(ConnectPinInfo)) then + move(Pointer(BadPin)^, ConnectPinInfo.achName, length(BadPin) * 2 +2) + else ConnectPinInfo.pFilter := nil; + if FAILED(ReceivePin.QueryPinInfo(ReceivePinInfo)) then + move(Pointer(BadPin)^, ReceivePinInfo.achName, length(BadPin) * 2 +2) + else ReceivePinInfo.pFilter := nil; + DbgLog(self, 'Trying to connect Pins :'); + DbgLog(self, format(' <%s>', [ConnectPinInfo.achName])); + DbgLog(self, format(' <%s>', [ReceivePinInfo.achName])); +{$ELSE} +begin +{$ENDIF} +end; + +procedure TBCBasePin.DisplayTypeInfo(Pin: IPin; pmt: PAMMediaType); +begin +{$IFDEF DEBUG} + DbgLog(self, 'Trying media type:'); + DbgLog(self, ' major type: '+ GuidToString(pmt.majortype)); + DbgLog(self, ' sub type : '+ GuidToString(pmt.subtype)); + DbgLog(self, GetMediaTypeDescription(pmt)); +{$ENDIF} +end; + +// Called when no more data will arrive + +function TBCBasePin.EndOfStream: HRESULT; +begin + result := S_OK; +end; + +{ This can be called to return an enumerator for the pin's list of preferred + media types. An input pin is not obliged to have any preferred formats + although it can do. For example, the window renderer has a preferred type + which describes a video image that matches the current window size. All + output pins should expose at least one preferred format otherwise it is + possible that neither pin has any types and so no connection is possible } + +function TBCBasePin.EnumMediaTypes(out ppEnum: IEnumMediaTypes): HRESULT; +begin + // Create a new ref counted enumerator + ppEnum := TBCEnumMediaTypes.Create(self, nil); + if (ppEnum = nil) then result := E_OUTOFMEMORY + else result := NOERROR; +end; + + +{ This is a virtual function that returns a media type corresponding with + place iPosition in the list. This base class simply returns an error as + we support no media types by default but derived classes should override } + +function TBCBasePin.GetMediaType(Position: integer; + out MediaType: PAMMediaType): HRESULT; +begin + result := E_UNEXPECTED;; +end; + + +{ This is a virtual function that returns the current media type version. + The base class initialises the media type enumerators with the value 1 + By default we always returns that same value. A Derived class may change + the list of media types available and after doing so it should increment + the version either in a method derived from this, or more simply by just + incrementing the m_TypeVersion base pin variable. The type enumerators + call this when they want to see if their enumerations are out of date } + +function TBCBasePin.GetMediaTypeVersion: longint; +begin + result := FTypeVersion; +end; + +{ Also called by the IMediaFilter implementation when the state changes to + Stopped at which point you should decommit allocators and free hardware + resources you grabbed in the Active call (default is also to do nothing) } + +function TBCBasePin.Inactive: HRESULT; +begin + FRunTimeError := FALSE; + result := NOERROR; +end; + +// Increment the cookie representing the current media type version + +procedure TBCBasePin.IncrementTypeVersion; +begin + InterlockedIncrement(FTypeVersion); +end; + +function TBCBasePin.IsConnected: boolean; +begin + result := FConnected <> nil; +end; + +function TBCBasePin.IsStopped: boolean; +begin + result := FFilter.FState = State_Stopped; +end; + +// NewSegment notifies of the start/stop/rate applying to the data +// about to be received. Default implementation records data and +// returns S_OK. +// Override this to pass downstream. + +function TBCBasePin.NewSegment(tStart, tStop: TReferenceTime; + dRate: double): HRESULT; +begin + FStart := tStart; + FStop := tStop; + FRate := dRate; + result := S_OK; +end; + +function TBCBasePin.NonDelegatingAddRef: Integer; +begin + ASSERT(InterlockedIncrement(FRef) > 0); + result := FFilter._AddRef; +end; + +function TBCBasePin.NonDelegatingRelease: Integer; +begin + ASSERT(InterlockedDecrement(FRef) >= 0); + result := FFilter._Release +end; + +function TBCBasePin.Notify(pSelf: IBaseFilter; q: TQuality): HRESULT; +begin + {$IFDEF DEBUG} + DbgLog(self, 'IQualityControl::Notify not over-ridden from CBasePin. (IGNORE is OK)'); + {$ENDIF} + result := E_NOTIMPL; +end; + +{ Does this pin support this media type WARNING this interface function does + not lock the main object as it is meant to be asynchronous by nature - if + the media types you support depend on some internal state that is updated + dynamically then you will need to implement locking in a derived class } + +function TBCBasePin.QueryAccept(const pmt: TAMMediaType): HRESULT; +begin + { The CheckMediaType method is valid to return error codes if the media + type is horrible, an example might be E_INVALIDARG. What we do here + is map all the error codes into either S_OK or S_FALSE regardless } + result := CheckMediaType(@pmt); + if FAILED(result) then result := S_FALSE; +end; + +function TBCBasePin.QueryDirection(out pPinDir: TPinDirection): HRESULT; +begin + pPinDir := Fdir; + result := NOERROR; +end; + +function TBCBasePin.QueryId(out Id: PWideChar): HRESULT; +begin + result := AMGetWideString(FPinName, id); +end; + +function TBCBasePin.QueryInternalConnections(out apPin: IPin; + var nPin: ULONG): HRESULT; +begin + result := E_NOTIMPL; +end; + +// Return information about the filter we are connect to + +function TBCBasePin.QueryPinInfo(out pInfo: TPinInfo): HRESULT; +begin + pInfo.pFilter := FFilter; + if (FPinName <> '') then + begin + move(Pointer(FPinName)^, pInfo.achName, length(FPinName)*2); + pInfo.achName[length(FPinName)] := #0; + end + else pInfo.achName[0] := #0; + pInfo.dir := Fdir; + result := NOERROR; +end; + +{ Called normally by an output pin on an input pin to try and establish a + connection. } + +function TBCBasePin.ReceiveConnection(pConnector: IPin; + const pmt: TAMMediaType): HRESULT; +begin + FLock.Lock; + try + // Are we already connected + if (FConnected <> nil) then + begin + result := VFW_E_ALREADY_CONNECTED; + exit; + end; + + // See if the filter is active + if (not IsStopped) and (not FCanReconnectWhenActive) then + begin + result := VFW_E_NOT_STOPPED; + exit; + end; + + result := CheckConnect(pConnector); + if FAILED(result) then + begin + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + ASSERT(SUCCEEDED(BreakConnect)); + exit; + end; + + // Ask derived class if this media type is ok + + //CMediaType * pcmt = (CMediaType*) pmt; + result := CheckMediaType(@pmt); + if (result <> NOERROR) then + begin + // no -we don't support this media type + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + ASSERT(SUCCEEDED(BreakConnect)); + // return a specific media type error if there is one + // or map a general failure code to something more helpful + // (in particular S_FALSE gets changed to an error code) + if (SUCCEEDED(result) or + (result = E_FAIL) or + (result = E_INVALIDARG)) then + result := VFW_E_TYPE_NOT_ACCEPTED; + exit; + end; + + // Complete the connection + FConnected := pConnector; + result := SetMediaType(@pmt); + if SUCCEEDED(result) then + begin + result := CompleteConnect(pConnector); + if SUCCEEDED(result) then + begin + result := S_OK; + exit; + end; + end; + + {$IFDEF DEBUG} + DbgLog(self, 'Failed to set the media type or failed to complete the connection.'); + {$ENDIF} + FConnected := nil; + + // Since the procedure is already returning an error code, there + // is nothing else this function can do to report the error. + ASSERT(SUCCEEDED(BreakConnect)); + finally + FLock.UnLock; + end; +end; + +{ Called by IMediaFilter implementation when the state changes from + to either paused to running and in derived classes could do things like + commit memory and grab hardware resource (the default is to do nothing) } + +function TBCBasePin.Run(Start: TReferenceTime): HRESULT; +begin + result := NOERROR; +end; + + +function TBCBasePin.GetCurrentMediaType: TBCMediaType; +begin + result := TBCMediaType(@FMT); +end; + +function TBCBasePin.GetAMMediaType: PAMMediaType; +begin + result := @FMT; +end; + +{ This is called to set the format for a pin connection - CheckMediaType + will have been called to check the connection format and if it didn't + return an error code then this (virtual) function will be invoked } + +function TBCBasePin.SetMediaType(mt: PAMMediaType): HRESULT; +begin + FreeMediaType(@Fmt); + CopyMediaType(@Fmt, mt); + result := NOERROR; +end; + +function TBCBasePin.SetSink(piqc: IQualityControl): HRESULT; +begin + FLock.Lock; + try + FQSink := piqc; + result := NOERROR; + finally + FLock.UnLock; + end; +end; + +{ Given an enumerator we cycle through all the media types it proposes and + firstly suggest them to our derived pin class and if that succeeds try + them with the pin in a ReceiveConnection call. This means that if our pin + proposes a media type we still check in here that we can support it. This + is deliberate so that in simple cases the enumerator can hold all of the + media types even if some of them are not really currently available } + +function TBCBasePin.TryMediaTypes(ReceivePin: IPin; pmt: PAMMediaType; + Enum: IEnumMediaTypes): HRESULT; +var + MediaCount: Cardinal; + hrFailure : HResult; + MediaType : PAMMediaType; +begin + // Reset the current enumerator position + result := Enum.Reset; + if Failed(result) then exit; + + MediaCount := 0; + + // attempt to remember a specific error code if there is one + hrFailure := S_OK; + + while True do + begin + { Retrieve the next media type NOTE each time round the loop the + enumerator interface will allocate another AM_MEDIA_TYPE structure + If we are successful then we copy it into our output object, if + not then we must delete the memory allocated before returning } + + result := Enum.Next(1, MediaType, @MediaCount); + if (result <> S_OK) then + begin + if (S_OK = hrFailure) then + hrFailure := VFW_E_NO_ACCEPTABLE_TYPES; + result := hrFailure; + exit; + end; + + ASSERT(MediaCount = 1); + ASSERT(MediaType <> nil); + // check that this matches the partial type (if any) + + if (pmt = nil) or TBCMediaType(MediaType).MatchesPartial(pmt) then + begin + result := AttemptConnection(ReceivePin, MediaType); + // attempt to remember a specific error code + if FAILED(result) and + SUCCEEDED(hrFailure) and + (result <> E_FAIL) and + (result <> E_INVALIDARG) and + (result <> VFW_E_TYPE_NOT_ACCEPTED) then hrFailure := result; + end + else result := VFW_E_NO_ACCEPTABLE_TYPES; + DeleteMediaType(MediaType); + if result = S_OK then exit; + end; +end; + +{ TBCEnumMediaTypes } + +{ The media types a filter supports can be quite dynamic so we add to + the general IEnumXXXX interface the ability to be signaled when they + change via an event handle the connected filter supplies. Until the + Reset method is called after the state changes all further calls to + the enumerator (except Reset) will return E_UNEXPECTED error code. } + +function TBCEnumMediaTypes.AreWeOutOfSync: boolean; +begin + if FPin.GetMediaTypeVersion = FVersion then result := FALSE else result := True; +end; + +{ One of an enumerator's basic member functions allows us to create a cloned + interface that initially has the same state. Since we are taking a snapshot + of an object (current position and all) we must lock access at the start } + +function TBCEnumMediaTypes.Clone(out ppEnum: IEnumMediaTypes): HRESULT; +begin + result := NOERROR; + // Check we are still in sync with the pin + if AreWeOutOfSync then + begin + ppEnum := nil; + result := VFW_E_ENUM_OUT_OF_SYNC; + exit; + end + else + begin + ppEnum := TBCEnumMediaTypes.Create(FPin, self); + if (ppEnum = nil) then result := E_OUTOFMEMORY; + end; +end; + +constructor TBCEnumMediaTypes.Create(Pin: TBCBasePin; + EnumMediaTypes: TBCEnumMediaTypes); +begin + FPosition := 0; + FPin := Pin; + {$IFDEF DEBUG} + DbgLog('TBCEnumMediaTypes.Create'); + {$ENDIF} + + // We must be owned by a pin derived from CBasePin */ + ASSERT(Pin <> nil); + + // Hold a reference count on our pin + FPin._AddRef; + + // Are we creating a new enumerator + + if (EnumMediaTypes = nil) then + begin + FVersion := FPin.GetMediaTypeVersion; + exit; + end; + + FPosition := EnumMediaTypes.FPosition; + FVersion := EnumMediaTypes.FVersion; +end; + +{ Destructor releases the reference count on our base pin. NOTE since we hold + a reference count on the pin who created us we know it is safe to release + it, no access can be made to it afterwards though as we might have just + caused the last reference count to go and the object to be deleted } + +destructor TBCEnumMediaTypes.Destroy; +begin + {$IFDEF DEBUG} + DbgLog('TBCEnumMediaTypes.Destroy'); + {$ENDIF} + FPin._Release; + inherited; +end; + +{ Enumerate the next pin(s) after the current position. The client using this + interface passes in a pointer to an array of pointers each of which will + be filled in with a pointer to a fully initialised media type format + Return NOERROR if it all works, + S_FALSE if fewer than cMediaTypes were enumerated. + VFW_E_ENUM_OUT_OF_SYNC if the enumerator has been broken by + state changes in the filter + The actual count always correctly reflects the number of types in the array.} + +function TBCEnumMediaTypes.Next(cMediaTypes: ULONG; + out ppMediaTypes: PAMMediaType; pcFetched: PULONG): HRESULT; +type TMTDynArray = array of PAMMediaType; +var + Fetched: Cardinal; + cmt: PAMMediaType; +begin + // Check we are still in sync with the pin + if AreWeOutOfSync then + begin + result := VFW_E_ENUM_OUT_OF_SYNC; + exit; + end; + + if (pcFetched <> nil) then + pcFetched^ := 0 // default unless we succeed + // now check that the parameter is valid + else + if (cMediaTypes > 1) then + begin // pcFetched == NULL + result := E_INVALIDARG; + exit; + end; + + Fetched := 0; // increment as we get each one. + + { Return each media type by asking the filter for them in turn - If we + have an error code retured to us while we are retrieving a media type + we assume that our internal state is stale with respect to the filter + (for example the window size changing) so we return + VFW_E_ENUM_OUT_OF_SYNC } + + new(cmt); + while (cMediaTypes > 0) do + begin + TBCMediaType(cmt).InitMediaType; + inc(FPosition); + result := FPin.GetMediaType(FPosition-1, cmt); + if (S_OK <> result) then Break; + + { We now have a CMediaType object that contains the next media type + but when we assign it to the array position we CANNOT just assign + the AM_MEDIA_TYPE structure because as soon as the object goes out of + scope it will delete the memory we have just copied. The function + we use is CreateMediaType which allocates a task memory block } + + { Transfer across the format block manually to save an allocate + and free on the format block and generally go faster } + + TMTDynArray(@ppMediaTypes)[Fetched] := CoTaskMemAlloc(sizeof(TAMMediaType)); + if TMTDynArray(@ppMediaTypes)[Fetched] = nil then Break; + + { Do a regular copy } + //CopyMediaType(TMTDynArray(@ppMediaTypes)[Fetched], cmt); + Move(cmt^,TMTDynArray(@ppMediaTypes)[Fetched]^,SizeOf(TAMMediaType)); + + // Make sure the destructor doesn't free these + cmt.pbFormat := nil; + cmt.cbFormat := 0; + Pointer(cmt.pUnk) := nil; + + inc(Fetched); + dec(cMediaTypes); + end; + dispose(cmt); + if (pcFetched <> nil) then pcFetched^ := Fetched; + if cMediaTypes = 0 then result := NOERROR else result := S_FALSE; +end; + +{ Set the current position back to the start + Reset has 3 simple steps: + set position to head of list + sync enumerator with object being enumerated + return S_OK } + +function TBCEnumMediaTypes.Reset: HRESULT; +begin + FPosition := 0; + // Bring the enumerator back into step with the current state. This + // may be a noop but ensures that the enumerator will be valid on the + // next call. + FVersion := FPin.GetMediaTypeVersion; + result := NOERROR; +end; + +// Skip over one or more entries in the enumerator + +function TBCEnumMediaTypes.Skip(cMediaTypes: ULONG): HRESULT; +var cmt: PAMMediaType; +begin + cmt := nil; + // If we're skipping 0 elements we're guaranteed to skip the + // correct number of elements + if (cMediaTypes = 0) then + begin + result := S_OK; + exit; + end; + // Check we are still in sync with the pin + if AreWeOutOfSync then + begin + result := VFW_E_ENUM_OUT_OF_SYNC; + exit; + end; + + FPosition := FPosition + cMediaTypes; + + // See if we're over the end + if (S_OK = FPin.GetMediaType(FPosition - 1, cmt)) then result := S_OK else result := S_FALSE; +end; + +{ TBCBaseOutputPin } + +// Commit the allocator's memory, this is called through IMediaFilter +// which is responsible for locking the object before calling us + +function TBCBaseOutputPin.Active: HRESULT; +begin + if (FAllocator = nil) then + result := VFW_E_NO_ALLOCATOR + else result := FAllocator.Commit; +end; + +function TBCBaseOutputPin.BeginFlush: HRESULT; +begin + result := E_UNEXPECTED; +end; + +// Overriden from CBasePin +function TBCBaseOutputPin.BreakConnect: HRESULT; +begin + // Release any allocator we hold + if (FAllocator <> nil) then + begin + // Always decommit the allocator because a downstream filter may or + // may not decommit the connection's allocator. A memory leak could + // occur if the allocator is not decommited when a connection is broken. + result := FAllocator.Decommit; + if FAILED(result) then exit; + FAllocator := nil; + end; + + // Release any input pin interface we hold + if (FInputPin <> nil) then FInputPin := nil; + result := NOERROR; +end; + +{ This method is called when the output pin is about to try and connect to + an input pin. It is at this point that you should try and grab any extra + interfaces that you need, in this case IMemInputPin. Because this is + only called if we are not currently connected we do NOT need to call + BreakConnect. This also makes it easier to derive classes from us as + BreakConnect is only called when we actually have to break a connection + (or a partly made connection) and not when we are checking a connection } + +function TBCBaseOutputPin.CheckConnect(Pin: IPin): HRESULT; +begin + result := inherited CheckConnect(Pin); + if FAILED(result) then exit; + + // get an input pin and an allocator interface + result := Pin.QueryInterface(IID_IMemInputPin, FInputPin); + if FAILED(result) then exit; + result := NOERROR; +end; + +// This is called after a media type has been proposed +// Try to complete the connection by agreeing the allocator +function TBCBaseOutputPin.CompleteConnect(ReceivePin: IPin): HRESULT; +begin + result := DecideAllocator(FInputPin, FAllocator); +end; + +constructor TBCBaseOutputPin.Create(ObjectName: string; + Filter: TBCBaseFilter; Lock: TBCCritSec; out hr: HRESULT; + const Name: WideString); +begin + inherited Create(ObjectName, Filter, Lock, hr, Name, PINDIR_OUTPUT); + FAllocator := nil; + FInputPin := nil; + ASSERT(FFilter <> nil); +end; + +{ Decide on an allocator, override this if you want to use your own allocator + Override DecideBufferSize to call SetProperties. If the input pin fails + the GetAllocator call then this will construct a CMemAllocator and call + DecideBufferSize on that, and if that fails then we are completely hosed. + If the you succeed the DecideBufferSize call, we will notify the input + pin of the selected allocator. NOTE this is called during Connect() which + therefore looks after grabbing and locking the object's critical section } + +// We query the input pin for its requested properties and pass this to +// DecideBufferSize to allow it to fulfill requests that it is happy +// with (eg most people don't care about alignment and are thus happy to +// use the downstream pin's alignment request). + +function TBCBaseOutputPin.DecideAllocator(Pin: IMemInputPin; + out Alloc: IMemAllocator): HRESULT; +var + prop: TAllocatorProperties; +begin + Alloc := nil; + + // get downstream prop request + // the derived class may modify this in DecideBufferSize, but + // we assume that he will consistently modify it the same way, + // so we only get it once + ZeroMemory(@prop, sizeof(TAllocatorProperties)); + + // whatever he returns, we assume prop is either all zeros + // or he has filled it out. + Pin.GetAllocatorRequirements(prop); + + // if he doesn't care about alignment, then set it to 1 + if (prop.cbAlign = 0) then prop.cbAlign := 1; + + // Try the allocator provided by the input pin + + result := Pin.GetAllocator(Alloc); + if SUCCEEDED(result) then + begin + result := DecideBufferSize(Alloc, @prop); + if SUCCEEDED(result) then + begin + result := Pin.NotifyAllocator(Alloc, FALSE); + if SUCCEEDED(result) then + begin + result := NOERROR; + exit; + end; + end; + end; + + // If the GetAllocator failed we may not have an interface + + if (Alloc <> nil) then Alloc := nil; + + // Try the output pin's allocator by the same method + + result := InitAllocator(Alloc); + if SUCCEEDED(result) then + begin + // note - the properties passed here are in the same + // structure as above and may have been modified by + // the previous call to DecideBufferSize + result := DecideBufferSize(Alloc, @prop); + if SUCCEEDED(result) then + begin + result := Pin.NotifyAllocator(Alloc, FALSE); + if SUCCEEDED(result) then + begin + result := NOERROR; + exit; + end; + end; + end; + // Likewise we may not have an interface to release + if (Alloc <> nil) then Alloc := nil; +end; + +function TBCBaseOutputPin.DecideBufferSize(Alloc: IMemAllocator; + propInputRequest: PAllocatorProperties): HRESULT; +begin + result := S_OK; // ??? +end; + +{ Deliver a filled-in sample to the connected input pin. NOTE the object must + have locked itself before calling us otherwise we may get halfway through + executing this method only to find the filter graph has got in and + disconnected us from the input pin. If the filter has no worker threads + then the lock is best applied on Receive(), otherwise it should be done + when the worker thread is ready to deliver. There is a wee snag to worker + threads that this shows up. The worker thread must lock the object when + it is ready to deliver a sample, but it may have to wait until a state + change has completed, but that may never complete because the state change + is waiting for the worker thread to complete. The way to handle this is for + the state change code to grab the critical section, then set an abort event + for the worker thread, then release the critical section and wait for the + worker thread to see the event we set and then signal that it has finished + (with another event). At which point the state change code can complete } + +// note (if you've still got any breath left after reading that) that you +// need to release the sample yourself after this call. if the connected +// input pin needs to hold onto the sample beyond the call, it will addref +// the sample itself. + +// of course you must release this one and call GetDeliveryBuffer for the +// next. You cannot reuse it directly. + +function TBCBaseOutputPin.Deliver(Sample: IMediaSample): HRESULT; +begin + if (FInputPin = nil) then result := VFW_E_NOT_CONNECTED + else result := FInputPin.Receive(Sample); +end; + +// call BeginFlush on the connected input pin +function TBCBaseOutputPin.DeliverBeginFlush: HRESULT; +begin + // remember this is on IPin not IMemInputPin + if (FConnected = nil) then + result := VFW_E_NOT_CONNECTED + else result := FConnected.BeginFlush; +end; + +// call EndFlush on the connected input pin +function TBCBaseOutputPin.DeliverEndFlush: HRESULT; +begin + // remember this is on IPin not IMemInputPin + if (FConnected = nil) then + result := VFW_E_NOT_CONNECTED + else result := FConnected.EndFlush; +end; + +// called from elsewhere in our filter to pass EOS downstream to +// our connected input pin + +function TBCBaseOutputPin.DeliverEndOfStream: HRESULT; +begin + // remember this is on IPin not IMemInputPin + if (FConnected = nil) then + result := VFW_E_NOT_CONNECTED + else result := FConnected.EndOfStream; +end; + +// deliver NewSegment to connected pin +function TBCBaseOutputPin.DeliverNewSegment(Start, Stop: TReferenceTime; + Rate: double): HRESULT; +begin + if (FConnected = nil) then + result := VFW_E_NOT_CONNECTED + else result := FConnected.NewSegment(Start, Stop, Rate); +end; + +function TBCBaseOutputPin.EndFlush: HRESULT; +begin + result := E_UNEXPECTED; +end; + +// we have a default handling of EndOfStream which is to return +// an error, since this should be called on input pins only +function TBCBaseOutputPin.EndOfStream: HRESULT; +begin + result := E_UNEXPECTED; +end; + +// This returns an empty sample buffer from the allocator WARNING the same +// dangers and restrictions apply here as described below for Deliver() + +function TBCBaseOutputPin.GetDeliveryBuffer(out Sample: IMediaSample; + StartTime, EndTime: PReferenceTime; Flags: Longword): HRESULT; +begin + if (FAllocator <> nil) then + result := FAllocator.GetBuffer(Sample, StartTime, EndTime, Flags) + else result := E_NOINTERFACE; +end; + +{ Free up or unprepare allocator's memory, this is called through + IMediaFilter which is responsible for locking the object first } + +function TBCBaseOutputPin.Inactive: HRESULT; +begin + FRunTimeError := FALSE; + if (FAllocator = nil) then + result := VFW_E_NO_ALLOCATOR + else result := FAllocator.Decommit; +end; + +// This is called when the input pin didn't give us a valid allocator +function TBCBaseOutputPin.InitAllocator(out Alloc: IMemAllocator): HRESULT; +begin + result := CoCreateInstance(CLSID_MemoryAllocator, nil, CLSCTX_INPROC_SERVER, + IID_IMemAllocator, Alloc); +end; + +{ TBCBaseInputPin } + +// Default handling for BeginFlush - call at the beginning +// of your implementation (makes sure that all Receive calls +// fail). After calling this, you need to free any queued data +// and then call downstream. + +function TBCBaseInputPin.BeginFlush: HRESULT; +begin + // BeginFlush is NOT synchronized with streaming but is part of + // a control action - hence we synchronize with the filter + FLock.Lock; + try + // if we are already in mid-flush, this is probably a mistake + // though not harmful - try to pick it up for now so I can think about it + ASSERT(not FFlushing); + // first thing to do is ensure that no further Receive calls succeed + FFlushing := True; + // now discard any data and call downstream - must do that + // in derived classes + result := S_OK; + finally + FLock.UnLock; + end; + +end; + +function TBCBaseInputPin.BreakConnect: HRESULT; +begin + // We don't need our allocator any more + if (FAllocator <> nil) then + begin + // Always decommit the allocator because a downstream filter may or + // may not decommit the connection's allocator. A memory leak could + // occur if the allocator is not decommited when a pin is disconnected. + result := FAllocator.Decommit; + if FAILED(result) then exit; + FAllocator := nil; + end; + result := S_OK; +end; + +// Check if it's OK to process data + +function TBCBaseInputPin.CheckStreaming: HRESULT; +begin + // Shouldn't be able to get any data if we're not connected! + ASSERT(IsConnected); + // Don't process stuff in Stopped state + if IsStopped then begin result := VFW_E_WRONG_STATE; exit end; + if FFlushing then begin result := S_FALSE; exit end; + if FRunTimeError then begin result := VFW_E_RUNTIME_ERROR; exit end; + result := S_OK; +end; + +// Constructor creates a default allocator object + +constructor TBCBaseInputPin.Create(ObjectName: string; + Filter: TBCBaseFilter; Lock: TBCCritSec; out hr: HRESULT; + Name: WideString); +begin + inherited create(ObjectName, Filter, Lock, hr, Name, PINDIR_INPUT); + FAllocator := nil; + FReadOnly := false; + FFlushing := false; + ZeroMemory(@FSampleProps, sizeof(FSampleProps)); +end; + +destructor TBCBaseInputPin.Destroy; +begin + if FAllocator <> nil then FAllocator := nil; + inherited; +end; + +// default handling for EndFlush - call at end of your implementation +// - before calling this, ensure that there is no queued data and no thread +// pushing any more without a further receive, then call downstream, +// then call this method to clear the m_bFlushing flag and re-enable +// receives + +function TBCBaseInputPin.EndFlush: HRESULT; +begin + // Endlush is NOT synchronized with streaming but is part of + // a control action - hence we synchronize with the filter + FLock.Lock; + try + // almost certainly a mistake if we are not in mid-flush + ASSERT(FFlushing); + // before calling, sync with pushing thread and ensure + // no more data is going downstream, then call EndFlush on + // downstream pins. + // now re-enable Receives + FFlushing := FALSE; + // No more errors + FRunTimeError := FALSE; + result := S_OK; + finally + FLock.UnLock; + end; +end; + +{ Return the allocator interface that this input pin would like the output + pin to use. NOTE subsequent calls to GetAllocator should all return an + interface onto the SAME object so we create one object at the start + + Note: + The allocator is Release()'d on disconnect and replaced on + NotifyAllocator(). + + Override this to provide your own allocator.} +function TBCBaseInputPin.GetAllocator( + out ppAllocator: IMemAllocator): HRESULT; +begin + FLock.Lock; + try + if (FAllocator = nil) then + begin + result := CoCreateInstance(CLSID_MemoryAllocator, nil, CLSCTX_INPROC_SERVER, + IID_IMemAllocator, FAllocator); + if FAILED(result) then exit; + end; + ASSERT(FAllocator <> nil); + ppAllocator := FAllocator; + result := NOERROR; + finally + FLock.UnLock; + end; +end; + +// what requirements do we have of the allocator - override if you want +// to support other people's allocators but need a specific alignment +// or prefix. + +function TBCBaseInputPin.GetAllocatorRequirements( + out pProps: TAllocatorProperties): HRESULT; +begin + result := E_NOTIMPL; +end; + +{ Free up or unprepare allocator's memory, this is called through + IMediaFilter which is responsible for locking the object first. } + +function TBCBaseInputPin.Inactive: HRESULT; +begin + FRunTimeError := FALSE; + if (FAllocator = nil) then + begin + result := VFW_E_NO_ALLOCATOR; + exit; + end; + FFlushing := FALSE; + result := FAllocator.Decommit; +end; + +function TBCBaseInputPin.Notify(pSelf: IBaseFilter; q: TQuality): HRESULT; +begin +{$IFDEF DEBUG} + DbgLog(self, 'IQuality.Notify called on an input pin'); +{$ENDIF} + result := NOERROR; +end; + +{ Tell the input pin which allocator the output pin is actually going to use + Override this if you care - NOTE the locking we do both here and also in + GetAllocator is unnecessary but derived classes that do something useful + will undoubtedly have to lock the object so this might help remind people } + +function TBCBaseInputPin.NotifyAllocator(pAllocator: IMemAllocator; + bReadOnly: BOOL): HRESULT; +begin + FLock.Lock; + try + FAllocator := pAllocator; + // the readonly flag indicates whether samples from this allocator should + // be regarded as readonly - if True, then inplace transforms will not be + // allowed. + FReadOnly := bReadOnly; + result := NOERROR; + finally + FLock.UnLock; + end; +end; + +// Pass on the Quality notification q to +// a. Our QualityControl sink (if we have one) or else +// b. to our upstream filter +// and if that doesn't work, throw it away with a bad return code + +function TBCBaseInputPin.PassNotify(const q: TQuality): HRESULT; +var IQC: IQualityControl; +begin + // We pass the message on, which means that we find the quality sink + // for our input pin and send it there + +{$IFDEF DEBUG} + DbgLog(self, 'Passing Quality notification through transform'); +{$ENDIF} + if (FQSink <> nil) then + begin + result := FQSink.Notify(FFilter, q); + exit; + end + else + begin + // no sink set, so pass it upstream + result := VFW_E_NOT_FOUND; // default + if (FConnected <> nil) then + begin + FConnected.QueryInterface(IID_IQualityControl, IQC); + if (IQC <> nil) then + begin + result := IQC.Notify(FFilter, q); + IQC := nil; + end; + end; + end; +end; + +{ Do something with this media sample - this base class checks to see if the + format has changed with this media sample and if so checks that the filter + will accept it, generating a run time error if not. Once we have raised a + run time error we set a flag so that no more samples will be accepted + It is important that any filter should override this method and implement + synchronization so that samples are not processed when the pin is + disconnected etc. } + +function TBCBaseInputPin.Receive(pSample: IMediaSample): HRESULT; +var Sample2: IMediaSample2; +begin + ASSERT(pSample <> nil); + + result := CheckStreaming; + if (S_OK <> result) then exit; + + // Check for IMediaSample2 + if SUCCEEDED(pSample.QueryInterface(IID_IMediaSample2, Sample2)) then + begin + result := Sample2.GetProperties(sizeof(FSampleProps), FSampleProps); + Sample2 := nil; + if FAILED(result) then exit; + end + else + begin + // Get the properties the hard way + FSampleProps.cbData := sizeof(FSampleProps); + FSampleProps.dwTypeSpecificFlags := 0; + FSampleProps.dwStreamId := AM_STREAM_MEDIA; + FSampleProps.dwSampleFlags := 0; + if (S_OK = pSample.IsDiscontinuity) then + FSampleProps.dwSampleFlags := FSampleProps.dwSampleFlags or AM_SAMPLE_DATADISCONTINUITY; + if (S_OK = pSample.IsPreroll) then + FSampleProps.dwSampleFlags := FSampleProps.dwSampleFlags or AM_SAMPLE_PREROLL; + if (S_OK = pSample.IsSyncPoint) then + FSampleProps.dwSampleFlags := FSampleProps.dwSampleFlags or AM_SAMPLE_SPLICEPOINT; + if SUCCEEDED(pSample.GetTime(FSampleProps.tStart, FSampleProps.tStop)) then + FSampleProps.dwSampleFlags := FSampleProps.dwSampleFlags or AM_SAMPLE_TIMEVALID or AM_SAMPLE_STOPVALID; + if (S_OK = pSample.GetMediaType(FSampleProps.pMediaType)) then + FSampleProps.dwSampleFlags := FSampleProps.dwSampleFlags or AM_SAMPLE_TYPECHANGED; + pSample.GetPointer(PByte(FSampleProps.pbBuffer)); + FSampleProps.lActual := pSample.GetActualDataLength; + FSampleProps.cbBuffer := pSample.GetSize; + end; + + // Has the format changed in this sample + + if (not BOOL(FSampleProps.dwSampleFlags and AM_SAMPLE_TYPECHANGED)) then + begin + result := NOERROR; + exit; + end; + + // Check the derived class accepts this format */ + // This shouldn't fail as the source must call QueryAccept first */ + + result := CheckMediaType(FSampleProps.pMediaType); + + if (result = NOERROR) then exit; + + // Raise a runtime error if we fail the media type + + FRunTimeError := True; + EndOfStream; + FFilter.NotifyEvent(EC_ERRORABORT,VFW_E_TYPE_NOT_ACCEPTED,0); + result := VFW_E_INVALIDMEDIATYPE; +end; + +// See if Receive() might block + +function TBCBaseInputPin.ReceiveCanBlock: HRESULT; +var + c, Pins, OutputPins: Integer; + Pin: TBCBasePin; + pd: TPinDirection; + Connected: IPin; + InputPin: IMemInputPin; +begin + { Ask all the output pins if they block + If there are no output pin assume we do block. } + Pins := FFilter.GetPinCount; + OutputPins := 0; + for c := 0 to Pins - 1 do + begin + Pin := FFilter.GetPin(c); + result := Pin.QueryDirection(pd); + if FAILED(result) then exit; + if (pd = PINDIR_OUTPUT) then + begin + result := Pin.ConnectedTo(Connected); + if SUCCEEDED(result) then + begin + assert(Connected <> nil); + inc(OutputPins); + result := Connected.QueryInterface(IID_IMemInputPin, InputPin); + Connected := nil; + if SUCCEEDED(result) then + begin + result := InputPin.ReceiveCanBlock; + InputPin := nil; + if (result <> S_FALSE) then + begin + result := S_OK; + exit; + end; + end + else + begin + // There's a transport we don't understand here + result := S_OK; + exit; + end; + end; + end; + end; + if OutputPins = 0 then result := S_OK else result := S_FALSE; +end; + +// Receive multiple samples + +function TBCBaseInputPin.ReceiveMultiple(var pSamples: IMediaSample; + nSamples: Integer; out nSamplesProcessed: Integer): HRESULT; +type + TMediaSampleDynArray = array of IMediaSample; +begin + result := S_OK; + nSamplesProcessed := 0; + dec(nSamples); + while (nSamples >= 0) do + begin + result := Receive(TMediaSampleDynArray(@pSamples)[nSamplesProcessed]); + // S_FALSE means don't send any more + if (result <> S_OK) then break; + inc(nSamplesProcessed); + dec(nSamples) + end; +end; + +function TBCBaseInputPin.SampleProps: PAMSample2Properties; +begin + ASSERT(FSampleProps.cbData <> 0); + result := @FSampleProps; +end; + +// milenko start (added TBCDynamicOutputPin conversion) +{ TBCDynamicOutputPin } +// +// The streaming thread calls IPin::NewSegment(), IPin::EndOfStream(), +// IMemInputPin::Receive() and IMemInputPin::ReceiveMultiple() on the +// connected input pin. The application thread calls Block(). The +// following class members can only be called by the streaming thread. +// +// Deliver() +// DeliverNewSegment() +// StartUsingOutputPin() +// StopUsingOutputPin() +// ChangeOutputFormat() +// ChangeMediaType() +// DynamicReconnect() +// +// The following class members can only be called by the application thread. +// +// Block() +// SynchronousBlockOutputPin() +// AsynchronousBlockOutputPin() +// +constructor TBCDynamicOutputPin.Create(ObjectName: WideString; Filter: TBCBaseFilter; + Lock: TBCCritSec; out hr: HRESULT; Name: WideString); +begin + inherited Create(ObjectName,Filter,Lock,hr,Name); + FStopEvent := 0; + FGraphConfig := nil; + FPinUsesReadOnlyAllocator := False; + FBlockState := NOT_BLOCKED; + FUnblockOutputPinEvent := 0; + FNotifyCallerPinBlockedEvent := 0; + FBlockCallerThreadID := 0; + FNumOutstandingOutputPinUsers := 0; + + FBlockStateLock := TBCCritSec.Create; + + hr := Initialize; +end; + +destructor TBCDynamicOutputPin.Destroy; +begin + if(FUnblockOutputPinEvent <> 0) then + begin + // This call should not fail because we have access to m_hUnblockOutputPinEvent + // and m_hUnblockOutputPinEvent is a valid event. + ASSERT(CloseHandle(FUnblockOutputPinEvent)); + end; + + if(FNotifyCallerPinBlockedEvent <> 0) then + begin + // This call should not fail because we have access to m_hNotifyCallerPinBlockedEvent + // and m_hNotifyCallerPinBlockedEvent is a valid event. + ASSERT(CloseHandle(FNotifyCallerPinBlockedEvent)); + end; + + if Assigned(FBlockStateLock) then FreeAndNil(FBlockStateLock); + + inherited Destroy; +end; + +function TBCDynamicOutputPin.NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; +begin + if IsEqualGUID(IID,IID_IPinFlowControl) then + begin + if GetInterface(IID_IPinFlowControl, Obj) then Result := S_OK + else Result := E_NOINTERFACE; + end else + begin + Result := inherited NonDelegatingQueryInterface(IID,Obj); + end; +end; + +function TBCDynamicOutputPin.Disconnect: HRESULT; +begin + FLock.Lock; + try + Result := DisconnectInternal; + finally + FLock.Unlock; + end; +end; + +function TBCDynamicOutputPin.Block(dwBlockFlags: DWORD; hEvent: THandle): HResult; +begin + // Check for illegal flags. + if BOOL(dwBlockFlags and not AM_PIN_FLOW_CONTROL_BLOCK) then + begin + Result := E_INVALIDARG; + Exit; + end; + + // Make sure the event is unsignaled. + if(BOOL(dwBlockFlags and AM_PIN_FLOW_CONTROL_BLOCK) and (hEvent <> 0)) then + begin + if not ResetEvent(hEvent) then + begin + Result := AmGetLastErrorToHResult; + Exit + end; + end; + + // No flags are set if we are unblocking the output pin. + if(dwBlockFlags = 0) then + begin + // This parameter should be NULL because unblock operations are always synchronous. + // There is no need to notify the caller when the event is done. + if(hEvent <> 0) then + begin + Result := E_INVALIDARG; + Exit; + end; + end; + + {$IFDEF DEBUG} + AssertValid; + {$ENDIF} // DEBUG + + if BOOL(dwBlockFlags and AM_PIN_FLOW_CONTROL_BLOCK) then + begin + // IPinFlowControl::Block()'s hEvent parameter is NULL if the block is synchronous. + // If hEvent is not NULL, the block is asynchronous. + if(hEvent = 0) then Result := SynchronousBlockOutputPin + else Result := AsynchronousBlockOutputPin(hEvent); + + end else + begin + Result := UnblockOutputPin; + end; + + {$IFDEF DEBUG} + AssertValid; + {$ENDIF} // DEBUG + + if(FAILED(Result)) then Exit; + + Result := S_OK; +end; + +procedure TBCDynamicOutputPin.SetConfigInfo(GraphConfig: IGraphConfig; StopEvent: THandle); +begin + // This pointer is not addrefed because filters are not allowed to + // hold references to the filter graph manager. See the documentation for + // IBaseFilter::JoinFilterGraph() in the Direct Show SDK for more information. + Pointer(FGraphConfig) := Pointer(GraphConfig); + FStopEvent := StopEvent; +end; + +{$IFDEF DEBUG} +function TBCDynamicOutputPin.Deliver(Sample: IMediaSample): HRESULT; +begin + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin); + Result := inherited Deliver(Sample); +end; + +function TBCDynamicOutputPin.DeliverEndOfStream: HRESULT; +begin + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin); + Result := inherited DeliverEndOfStream; +end; + +function TBCDynamicOutputPin.DeliverNewSegment(Start, Stop: TReferenceTime; Rate: Double): HRESULT; +begin + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin); + Result := inherited DeliverNewSegment(Start, Stop, Rate); +end; +{$ENDIF} + +function TBCDynamicOutputPin.DeliverBeginFlush: HRESULT; +begin + // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). + // The ASSERT can also fire if the event if destroyed and then DeliverBeginFlush() is called. + // An event handle is invalid if 1) the event does not exist or the user does not have the security + // permissions to use the event. + ASSERT(SetEvent(FStopEvent)); + Result := inherited DeliverBeginFlush; +end; + +function TBCDynamicOutputPin.DeliverEndFlush: HRESULT; +begin + // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). + // The ASSERT can also fire if the event if destroyed and then DeliverBeginFlush() is called. + // An event handle is invalid if 1) the event does not exist or the user does not have the security + // permissions to use the event. + ASSERT(ResetEvent(FStopEvent)); + Result := inherited DeliverEndFlush; +end; + +function TBCDynamicOutputPin.Active: HRESULT; +begin + // Make sure the user initialized the object by calling SetConfigInfo(). + if(FStopEvent = 0) or (FGraphConfig = nil) then + begin + {$IFDEF DEBUG} + DbgLog('ERROR: TBCDynamicOutputPin.Active() failed because m_pGraphConfig' + + ' and m_hStopEvent were not initialized. Call SetConfigInfo() to initialize them.'); + {$ENDIF} // DEBUG + Result := E_FAIL; + Exit; + end; + + // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). + // The ASSERT can also fire if the event if destroyed and then Active() is called. An event + // handle is invalid if 1) the event does not exist or the user does not have the security + // permissions to use the event. + ASSERT(ResetEvent(FStopEvent)); + + Result := inherited Active; +end; + +function TBCDynamicOutputPin.Inactive: HRESULT; +begin + // If this ASSERT fires, the user may have passed an invalid event handle to SetConfigInfo(). + // The ASSERT can also fire if the event if destroyed and then Active() is called. An event + // handle is invalid if 1) the event does not exist or the user does not have the security + // permissions to use the event. + ASSERT(SetEvent(FStopEvent)); + Result := inherited Inactive; +end; + +function TBCDynamicOutputPin.CompleteConnect(ReceivePin: IPin): HRESULT; +begin + Result := inherited CompleteConnect(ReceivePin); + if(SUCCEEDED(Result)) then + begin + if (not IsStopped) and (FAllocator <> nil) then + begin + Result := FAllocator.Commit; + ASSERT(Result <> VFW_E_ALREADY_COMMITTED); + end; + end; +end; + +function TBCDynamicOutputPin.StartUsingOutputPin: HRESULT; +var + WaitEvents: array[0..1] of THandle; + NumWaitEvents: DWORD; + ReturnValue: DWORD; +begin + // The caller should not hold m_BlockStateLock. If the caller does, + // a deadlock could occur. + ASSERT(FBlockStateLock.CritCheckIn); + + FBlockStateLock.Lock; + try + {$IFDEF DEBUG} + AssertValid; + {$ENDIF} // DEBUG + + // Are we in the middle of a block operation? + while(BLOCKED = FBlockState) do + begin + FBlockStateLock.Unlock; + + // If this ASSERT fires, a deadlock could occur. The caller should make sure + // that this thread never acquires the Block State lock more than once. + ASSERT(FBlockStateLock.CritCheckIn); + + // WaitForMultipleObjects() returns WAIT_OBJECT_0 if the unblock event + // is fired. It returns WAIT_OBJECT_0 + 1 if the stop event if fired. + // See the Windows SDK documentation for more information on + // WaitForMultipleObjects(). + + WaitEvents[0] := FUnblockOutputPinEvent; + WaitEvents[0] := FStopEvent; + + NumWaitEvents := sizeof(WaitEvents) div sizeof(THANDLE); + + ReturnValue := WaitForMultipleObjects(NumWaitEvents, @WaitEvents, False, INFINITE); + + FBlockStateLock.Lock; + + {$IFDEF DEBUG} + AssertValid; + {$ENDIF} // DEBUG + + case ReturnValue of + WAIT_OBJECT_0: break; + WAIT_OBJECT_0 + 1: + begin + Result := VFW_E_STATE_CHANGED; + Exit; + end; + WAIT_FAILED: + begin + Result := AmGetLastErrorToHResult; + Exit; + end; + else + begin + {$IFDEF DEBUG} + DbgLog('An Unexpected case occured in TBCDynamicOutputPin.StartUsingOutputPin().'); + {$ENDIF} // DEBUG + Result := E_UNEXPECTED; + Exit; + end; + end; + end; + + inc(FNumOutstandingOutputPinUsers); + + {$IFDEF DEBUG} + AssertValid; + {$ENDIF} // DEBUG + + Result := S_OK; + finally + FBlockStateLock.Unlock; + end; +end; + +procedure TBCDynamicOutputPin.StopUsingOutputPin; +begin + FBlockStateLock.Lock; + try + {$IFDEF DEBUG} + AssertValid; + {$ENDIF} // DEBUG + + dec(FNumOutstandingOutputPinUsers); + + if(FNumOutstandingOutputPinUsers = 0) and (NOT_BLOCKED <> FBlockState) + then BlockOutputPin; + + {$IFDEF DEBUG} + AssertValid; + {$ENDIF} // DEBUG + finally + FBlockStateLock.Unlock; + end; +end; + +function TBCDynamicOutputPin.StreamingThreadUsingOutputPin: Boolean; +begin + FBlockStateLock.Lock; + try + Result := (FNumOutstandingOutputPinUsers > 0); + finally + FBlockStateLock.UnLock; + end; +end; + +function TBCDynamicOutputPin.ChangeOutputFormat(const pmt: PAMMEdiaType; tSegmentStart, tSegmentStop: + TreferenceTime; dSegmentRate: Double): HRESULT; +begin + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin); + + // Callers should always pass a valid media type to ChangeOutputFormat() . + ASSERT(pmt <> nil); + + Result := ChangeMediaType(pmt); + if (FAILED(Result)) then Exit; + + Result :=DeliverNewSegment(tSegmentStart, tSegmentStop, dSegmentRate); + if(FAILED(Result)) then Exit; + + Result := S_OK; +end; + +function TBCDynamicOutputPin.ChangeMediaType(const pmt: PAMMediaType): HRESULT; +var + pConnection: IPinConnection; +begin + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin); + + // This function assumes the filter graph is running. + ASSERT(not IsStopped); + + if (not IsConnected) then + begin + Result := VFW_E_NOT_CONNECTED; + Exit; + end; + + // First check if the downstream pin will accept a dynamic + // format change + + FConnected.QueryInterface(IID_IPinConnection, pConnection); + if(pConnection <> nil) then + begin + if(S_OK = pConnection.DynamicQueryAccept(pmt^)) then + begin + Result := ChangeMediaTypeHelper(pmt); + if(FAILED(Result)) then Exit; + Result := S_OK; + Exit; + end; + end; + + // Can't do the dynamic connection + Result := DynamicReconnect(pmt); +end; + +// this method has to be called from the thread that is pushing data, +// and it's the caller's responsibility to make sure that the thread +// has no outstand samples because they cannot be delivered after a +// reconnect +// +function TBCDynamicOutputPin.DynamicReconnect(const pmt: PAMMediaType): HRESULT; +begin + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin); + + if(FGraphConfig = nil) or (FStopEvent = 0) then + begin + Result := E_FAIL; + Exit; + end; + + Result := FGraphConfig.Reconnect(Self,nil,pmt,nil,FStopEvent, + AM_GRAPH_CONFIG_RECONNECT_CACHE_REMOVED_FILTERS); +end; + +function TBCDynamicOutputPin.SynchronousBlockOutputPin: HRESULT; +var + NotifyCallerPinBlockedEvent: THandle; +begin + NotifyCallerPinBlockedEvent := CreateEvent(nil, // The event will have the default security attributes. + False, // This is an automatic reset event. + False, // The event is initially unsignaled. + nil); // The event is not named. + + // CreateEvent() returns NULL if an error occurs. + if(NotifyCallerPinBlockedEvent = 0) then + begin + Result := AmGetLastErrorToHResult; + Exit; + end; + + Result := AsynchronousBlockOutputPin(NotifyCallerPinBlockedEvent); + if(FAILED(Result)) then + begin + // This call should not fail because we have access to hNotifyCallerPinBlockedEvent + // and hNotifyCallerPinBlockedEvent is a valid event. + ASSERT(CloseHandle(NotifyCallerPinBlockedEvent)); + Exit; + end; + + Result := WaitEvent(NotifyCallerPinBlockedEvent); + + // This call should not fail because we have access to hNotifyCallerPinBlockedEvent + // and hNotifyCallerPinBlockedEvent is a valid event. + ASSERT(CloseHandle(NotifyCallerPinBlockedEvent)); + + if(FAILED(Result)) then Exit; + + Result := S_OK; +end; + +function TBCDynamicOutputPin.AsynchronousBlockOutputPin(NotifyCallerPinBlockedEvent: THandle): HRESULT; +var + Success : Boolean; +begin + // This function holds the m_BlockStateLock because it uses + // m_dwBlockCallerThreadID, m_BlockState and + // m_hNotifyCallerPinBlockedEvent. + FBlockStateLock.Lock; + try + if (NOT_BLOCKED <> FBlockState) then + begin + if(FBlockCallerThreadID = GetCurrentThreadId) + then Result := VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD + else Result := VFW_E_PIN_ALREADY_BLOCKED; + Exit; + end; + + Success := DuplicateHandle(GetCurrentProcess, + NotifyCallerPinBlockedEvent, + GetCurrentProcess, + @FNotifyCallerPinBlockedEvent, + EVENT_MODIFY_STATE, + False, + 0); + if not Success then + begin + Result := AmGetLastErrorToHResult; + Exit; + end; + + FBlockState := PENDING; + FBlockCallerThreadID := GetCurrentThreadId; + + // The output pin cannot be blocked if the streaming thread is + // calling IPin::NewSegment(), IPin::EndOfStream(), IMemInputPin::Receive() + // or IMemInputPin::ReceiveMultiple() on the connected input pin. Also, it + // cannot be blocked if the streaming thread is calling DynamicReconnect(), + // ChangeMediaType() or ChangeOutputFormat(). + + // The output pin can be immediately blocked. + if not StreamingThreadUsingOutputPin then BlockOutputPin(); + + Result := S_OK; + finally + FBlockStateLock.Unlock; + end; +end; + +function TBCDynamicOutputPin.UnblockOutputPin: HRESULT; +begin + // UnblockOutputPin() holds the m_BlockStateLock because it + // uses m_BlockState, m_dwBlockCallerThreadID and + // m_hNotifyCallerPinBlockedEvent. + FBlockStateLock.Lock; + try + if (NOT_BLOCKED = FBlockState) then + begin + Result := S_FALSE; + Exit; + end; + + // This should not fail because we successfully created the event + // and we have the security permissions to change it's state. + ASSERT(SetEvent(FUnblockOutputPinEvent)); + + // Cancel the block operation if it's still pending. + if (FNotifyCallerPinBlockedEvent <> 0) then + begin + // This event should not fail because AsynchronousBlockOutputPin() successfully + // duplicated this handle and we have the appropriate security permissions. + ASSERT(SetEvent(FNotifyCallerPinBlockedEvent)); + ASSERT(CloseHandle(FNotifyCallerPinBlockedEvent)); + end; + + FBlockState := NOT_BLOCKED; + FBlockCallerThreadID := 0; + FNotifyCallerPinBlockedEvent := 0; + + Result := S_OK; + finally + FBlockStateLock.Unlock; + end; +end; + +procedure TBCDynamicOutputPin.BlockOutputPin; +begin + // The caller should always hold the m_BlockStateLock because this function + // uses m_BlockState and m_hNotifyCallerPinBlockedEvent. + ASSERT(FBlockStateLock.CritCheckIn); + + // This function should not be called if the streaming thread is modifying + // the connection state or it's passing data downstream. + ASSERT(not StreamingThreadUsingOutputPin); + + // This should not fail because we successfully created the event + // and we have the security permissions to change it's state. + ASSERT(ResetEvent(FUnblockOutputPinEvent)); + + // This event should not fail because AsynchronousBlockOutputPin() successfully + // duplicated this handle and we have the appropriate security permissions. + ASSERT(SetEvent(FNotifyCallerPinBlockedEvent)); + ASSERT(CloseHandle(FNotifyCallerPinBlockedEvent)); + + FBlockState := BLOCKED; + FNotifyCallerPinBlockedEvent := 0; +end; + +procedure TBCDynamicOutputPin.ResetBlockState; +begin + +end; + +class function TBCDynamicOutputPin.WaitEvent(Event: THandle): HRESULT; +var + ReturnValue: DWORD; +begin + ReturnValue := WaitForSingleObject(Event, INFINITE); + + case ReturnValue of + WAIT_OBJECT_0: Result := S_OK; + WAIT_FAILED : Result := AmGetLastErrorToHResult; + else + begin + {$IFDEF DEBUG} + DbgLog('An Unexpected case occured in TBCDynamicOutputPin::WaitEvent.'); + {$ENDIF} + Result := E_UNEXPECTED; + end; + end; +end; + +function TBCDynamicOutputPin.Initialize: HRESULT; +begin + FUnblockOutputPinEvent := CreateEvent(nil, // The event will have the default security descriptor. + True, // This is a manual reset event. + True, // The event is initially signaled. + nil); // The event is not named. + + // CreateEvent() returns NULL if an error occurs. + if (FUnblockOutputPinEvent = 0) then + begin + Result := AmGetLastErrorToHResult; + Exit; + end; + + // Set flag to say we can reconnect while streaming. + CanReconnectWhenActive := True; + + Result := S_OK; +end; + +function TBCDynamicOutputPin.ChangeMediaTypeHelper(const pmt: PAMMediaType): HRESULT; +var + InputPinRequirements: ALLOCATOR_PROPERTIES; +begin + // The caller should call StartUsingOutputPin() before calling this + // method. + ASSERT(StreamingThreadUsingOutputPin); + + Result := FConnected.ReceiveConnection(Self,pmt^); + if(FAILED(Result)) then Exit; + + Result := SetMediaType(pmt); + if(FAILED(Result)) then Exit; + + // Does this pin use the local memory transport? + if(FInputPin <> nil) then + begin + // This function assumes that m_pInputPin and m_Connected are + // two different interfaces to the same object. + ASSERT(IsEqualObject(FConnected, FInputPin)); + + InputPinRequirements.cbAlign := 0; + InputPinRequirements.cbBuffer := 0; + InputPinRequirements.cbPrefix := 0; + InputPinRequirements.cBuffers := 0; + + FInputPin.GetAllocatorRequirements(InputPinRequirements); + + // A zero allignment does not make any sense. + if(0 = InputPinRequirements.cbAlign) + then InputPinRequirements.cbAlign := 1; + + Result := FAllocator.Decommit; + if(FAILED(Result)) then Exit; + + Result := DecideBufferSize(FAllocator, @InputPinRequirements); + if(FAILED(Result)) then Exit; + + Result := FAllocator.Commit; + if(FAILED(Result)) then Exit; + + Result := FInputPin.NotifyAllocator(FAllocator, FPinUsesReadOnlyAllocator); + if(FAILED(Result)) then Exit; + end; + + Result := S_OK; +end; + +{$IFDEF DEBUG} +procedure TBCDynamicOutputPin.AssertValid; +begin + // Make sure the object was correctly initialized. + + // This ASSERT only fires if the object failed to initialize + // and the user ignored the constructor's return code (phr). + ASSERT(FUnblockOutputPinEvent <> 0); + + // If either of these ASSERTs fire, the user did not correctly call + // SetConfigInfo(). + ASSERT(FStopEvent <> 0); + ASSERT(FGraphConfig <> nil); + + // Make sure the block state is consistent. + + FBlockStateLock.Lock; + try + // BLOCK_STATE variables only have three legal values: PENDING, BLOCKED and NOT_BLOCKED. + ASSERT((NOT_BLOCKED = FBlockState) or (PENDING = FBlockState) or (BLOCKED = FBlockState)); + + // m_hNotifyCallerPinBlockedEvent is only needed when a block operation cannot complete + // immediately. + ASSERT(((FNotifyCallerPinBlockedEvent = 0) and (PENDING <> FBlockState)) or + ((FNotifyCallerPinBlockedEvent <> 0) and (PENDING = FBlockState)) ); + + // m_dwBlockCallerThreadID should always be 0 if the pin is not blocked and + // the user is not trying to block the pin. + ASSERT((0 = FBlockCallerThreadID) or (NOT_BLOCKED <> FBlockState)); + + // If this ASSERT fires, the streaming thread is using the output pin and the + // output pin is blocked. + ASSERT(((0 <> FNumOutstandingOutputPinUsers) and (BLOCKED <> FBlockState)) or + ((0 = FNumOutstandingOutputPinUsers) and (NOT_BLOCKED <> FBlockState)) or + ((0 = FNumOutstandingOutputPinUsers) and (NOT_BLOCKED = FBlockState)) ); + finally + FBlockStateLock.UnLock; + end; +end; +{$ENDIF} +// milenko end + +{ TBCTransformInputPin } + +// enter flushing state. Call default handler to block Receives, then +// pass to overridable method in filter + +function TBCTransformInputPin.BeginFlush: HRESULT; +begin + FTransformFilter.FcsFilter.Lock; + try + // Are we actually doing anything? + ASSERT(FTransformFilter.FOutput <> nil); + if ((not IsConnected) or (not FTransformFilter.FOutput.IsConnected)) then + begin + result := VFW_E_NOT_CONNECTED; + exit; + end; + result := inherited BeginFlush; + if FAILED(result) then exit; + result := FTransformFilter.BeginFlush; + finally + FTransformFilter.FcsFilter.UnLock; + end; +end; + +// provides derived filter a chance to release it's extra interfaces + +function TBCTransformInputPin.BreakConnect: HRESULT; +begin + ASSERT(IsStopped); + FTransformFilter.BreakConnect(PINDIR_INPUT); + result := inherited BreakConnect; +end; + +function TBCTransformInputPin.CheckConnect(Pin: IPin): HRESULT; +begin + result := FTransformFilter.CheckConnect(PINDIR_INPUT, Pin); + if FAILED(result) then exit; + result := inherited CheckConnect(Pin); +end; + +// check that we can support a given media type + +function TBCTransformInputPin.CheckMediaType( + mtIn: PAMMediaType): HRESULT; +begin + // Check the input type + result := FTransformFilter.CheckInputType(mtIn); + if (S_OK <> result) then exit; + // if the output pin is still connected, then we have + // to check the transform not just the input format + if ((FTransformFilter.FOutput <> nil) and + (FTransformFilter.FOutput.IsConnected)) then + begin + result := FTransformFilter.CheckTransform(mtIn, + FTransformFilter.FOutput.AMMediaType); + end; +end; + +function TBCTransformInputPin.CheckStreaming: HRESULT; +begin + ASSERT(FTransformFilter.FOutput <> nil); + if(not FTransformFilter.FOutput.IsConnected) then + begin + result := VFW_E_NOT_CONNECTED; + exit; + end + else + begin + // Shouldn't be able to get any data if we're not connected! + ASSERT(IsConnected); + // we're flushing + if FFlushing then + begin + result := S_FALSE; + exit; + end; + // Don't process stuff in Stopped state + if IsStopped then + begin + result := VFW_E_WRONG_STATE; + exit; + end; + if FRunTimeError then + begin + result := VFW_E_RUNTIME_ERROR; + exit; + end; + result := S_OK; + end; +end; + +function TBCTransformInputPin.CompleteConnect(ReceivePin: IPin): HRESULT; +begin + result := FTransformFilter.CompleteConnect(PINDIR_INPUT, ReceivePin); + if FAILED(result) then exit; + result := inherited CompleteConnect(ReceivePin); +end; + +constructor TBCTransformInputPin.Create(ObjectName: string; + TransformFilter: TBCTransformFilter; out hr: HRESULT; Name: WideString); +begin + inherited Create(ObjectName, TransformFilter, TransformFilter.FcsFilter, hr, Name); +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransformInputPin.Create'); +{$ENDIF} + FTransformFilter := TransformFilter; +end; + +// leave flushing state. +// Pass to overridable method in filter, then call base class +// to unblock receives (finally) + +destructor TBCTransformInputPin.destroy; +begin +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransformInputPin.destroy'); +{$ENDIF} + inherited; +end; + +function TBCTransformInputPin.EndFlush: HRESULT; +begin + FTransformFilter.FcsFilter.Lock; + try + // Are we actually doing anything? + ASSERT(FTransformFilter.FOutput <> nil); + if((not IsConnected) or (not FTransformFilter.FOutput.IsConnected)) then + begin + result := VFW_E_NOT_CONNECTED; + exit; + end; + + result := FTransformFilter.EndFlush; + if FAILED(result) then exit; + result := inherited EndFlush; + finally + FTransformFilter.FcsFilter.UnLock; + end; +end; + +// provide EndOfStream that passes straight downstream +// (there is no queued data) + +function TBCTransformInputPin.EndOfStream: HRESULT; +begin + FTransformFilter.FcsReceive.Lock; + try + result := CheckStreaming; + if (S_OK = result) then + result := FTransformFilter.EndOfStream; + finally + FTransformFilter.FcsReceive.UnLock; + end; +end; + +function TBCTransformInputPin.NewSegment(Start, Stop: TReferenceTime; + Rate: double): HRESULT; +begin + // Save the values in the pin + inherited NewSegment(Start, Stop, Rate); + result := FTransformFilter.NewSegment(Start, Stop, Rate); +end; + +function TBCTransformInputPin.QueryId(out id: PWideChar): HRESULT; +begin +// milenko start (AMGetWideString was bugged, now the second line is not needed) + Result := AMGetWideString('In', Id); +// if id <> nil then result := S_OK else result := S_FALSE; +// milenko end +end; + +// here's the next block of data from the stream. +// AddRef it yourself if you need to hold it beyond the end +// of this call. + +function TBCTransformInputPin.Receive(pSample: IMediaSample): HRESULT; +begin + FTransformFilter.FcsReceive.Lock; + try + ASSERT(pSample <> nil); + // check all is well with the base class + result := inherited Receive(pSample); + if (result = S_OK) then + result := FTransformFilter.Receive(pSample); + finally + FTransformFilter.FcsReceive.Unlock; + end; +end; + +// set the media type for this connection + +function TBCTransformInputPin.SetMediaType(mt: PAMMediaType): HRESULT; +begin + // Set the base class media type (should always succeed) + result := inherited SetMediaType(mt); + if FAILED(result) then exit; + // check the transform can be done (should always succeed) + ASSERT(SUCCEEDED(FTransformFilter.CheckInputType(mt))); + result := FTransformFilter.SetMediaType(PINDIR_INPUT,mt); +end; + +{ TBCCritSec } + +constructor TBCCritSec.Create; +begin + InitializeCriticalSection(FCritSec); + {$IFDEF DEBUG} + FcurrentOwner := 0; + FlockCount := 0; +// {$IFDEF TRACE} +// FTrace := True; +// {$ELSE} +// FTrace := FALSE; +// {$ENDIF} + {$ENDIF} +end; + +function TBCCritSec.CritCheckIn: boolean; +begin +{$IFDEF DEBUG} + result := (GetCurrentThreadId = Self.FcurrentOwner); +{$ELSE} + result := True; +{$ENDIF} +end; + +function TBCCritSec.CritCheckOut: boolean; +begin +{$IFDEF DEBUG} + result := (GetCurrentThreadId <> Self.FcurrentOwner); +{$ELSE} + result := false; +{$ENDIF} +end; + +destructor TBCCritSec.Destroy; +begin + DeleteCriticalSection(FCritSec) +end; + +procedure TBCCritSec.Lock; +begin + {$IFDEF DEBUG} + if ((FCurrentOwner <> 0) and (FCurrentOwner <> GetCurrentThreadId)) then + begin + // already owned, but not by us + {$IFDEF TRACE} + DbgLog(format('Thread %d about to wait for lock %x owned by %d', + [GetCurrentThreadId, longint(self), FCurrentOwner])); + {$ENDIF} + end; + {$ENDIF} + EnterCriticalSection(FCritSec); + {$IFDEF DEBUG} + inc(FLockCount); + if (FLockCount > 0) then + begin + // we now own it for the first time. Set owner information + FcurrentOwner := GetCurrentThreadId; + {$IFDEF TRACE} + DbgLog(format('Thread %d now owns lock %x', [FcurrentOwner, LongInt(self)])); + {$ENDIF} + end; + {$ENDIF} +end; + +procedure TBCCritSec.UnLock; +begin + {$IFDEF DEBUG} + dec(FlockCount); + if(FlockCount = 0) then + begin + // about to be unowned + {$IFDEF TRACE} + DbgLog(format('Thread %d releasing lock %x', [FcurrentOwner, LongInt(Self)])); + {$ENDIF} + FcurrentOwner := 0; + end; + {$ENDIF} + LeaveCriticalSection(FCritSec) +end; + +{ TBCTransformFilter } + +// Return S_FALSE to mean "pass the note on upstream" +// Return NOERROR (Same as S_OK) +// to mean "I've done something about it, don't pass it on" + +function TBCTransformFilter.AlterQuality(const q: TQuality): HRESULT; +begin + result := S_FALSE; +end; + +// enter flush state. Receives already blocked +// must override this if you have queued data or a worker thread + +function TBCTransformFilter.BeginFlush: HRESULT; +begin + result := NOERROR; + if (FOutput <> nil) then + // block receives -- done by caller (CBaseInputPin::BeginFlush) + // discard queued data -- we have no queued data + // free anyone blocked on receive - not possible in this filter + // call downstream + result := FOutput.DeliverBeginFlush; +end; + +function TBCTransformFilter.BreakConnect(dir: TPinDirection): HRESULT; +begin + result := NOERROR; +end; + +function TBCTransformFilter.CheckConnect(dir: TPinDirection; + Pin: IPin): HRESULT; +begin + result := NOERROR; +end; + +function TBCTransformFilter.CompleteConnect(direction: TPinDirection; + ReceivePin: IPin): HRESULT; +begin + result := NOERROR; +end; + +constructor TBCTransformFilter.Create(ObjectName: string; unk: IUnKnown; + const clsid: TGUID); +begin + FcsFilter := TBCCritSec.Create; + FcsReceive := TBCCritSec.Create; + inherited Create(ObjectName,Unk,FcsFilter, clsid); + FInput := nil; + FOutput := nil; + FEOSDelivered := FALSE; + FQualityChanged:= FALSE; + FSampleSkipped := FALSE; +{$ifdef PERF} +// RegisterPerfId; +{$endif} +end; + +constructor TBCTransformFilter.CreateFromFactory(Factory: TBCClassFactory; const Controller: IUnknown); +begin + Create(Factory.FName, Controller, Factory.FClassID); +end; + +destructor TBCTransformFilter.destroy; +begin + if FInput <> nil then FInput.Free; + if FOutput <> nil then FOutput.Free; +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransformFilter.destroy'); +{$ENDIF} + FcsReceive.Free; + inherited; +end; + +// leave flush state. must override this if you have queued data +// or a worker thread + +function TBCTransformFilter.EndFlush: HRESULT; +begin + // sync with pushing thread -- we have no worker thread + // ensure no more data to go downstream -- we have no queued data + // call EndFlush on downstream pins + ASSERT(FOutput <> nil); + result := FOutput.DeliverEndFlush; + // caller (the input pin's method) will unblock Receives +end; + +// EndOfStream received. Default behaviour is to deliver straight +// downstream, since we have no queued data. If you overrode Receive +// and have queue data, then you need to handle this and deliver EOS after +// all queued data is sent + +function TBCTransformFilter.EndOfStream: HRESULT; +begin + result := NOERROR; + if (FOutput <> nil) then + result := FOutput.DeliverEndOfStream; +end; + +// If Id is In or Out then return the IPin* for that pin +// creating the pin if need be. Otherwise return NULL with an error. + +function TBCTransformFilter.FindPin(Id: PWideChar; out ppPin: IPin): HRESULT; +begin + if(WideString(Id) = 'In') then ppPin := GetPin(0) else + if(WideString(Id) = 'Out') then ppPin := GetPin(1) else + begin + ppPin := nil; + result := VFW_E_NOT_FOUND; + exit; + end; + + result := NOERROR; + if(ppPin = nil) then result := E_OUTOFMEMORY; +end; + +// return a non-addrefed CBasePin * for the user to addref if he holds onto it +// for longer than his pointer to us. We create the pins dynamically when they +// are asked for rather than in the constructor. This is because we want to +// give the derived class an oppportunity to return different pin objects + +// We return the objects as and when they are needed. If either of these fails +// then we return NULL, the assumption being that the caller will realise the +// whole deal is off and destroy us - which in turn will delete everything. + +function TBCTransformFilter.GetPin(n: integer): TBCBasePin; +var hr: HRESULT; +begin + hr := S_OK; + // Create an input pin if necessary + if(FInput = nil) then + begin + FInput := TBCTransformInputPin.Create('Transform input pin', + self, // Owner filter + hr, // Result code + 'XForm In'); // Pin name + + // Can't fail + ASSERT(SUCCEEDED(hr)); + if(FInput = nil) then + begin + result := nil; + exit; + end; + FOutput := TBCTransformOutputPin.Create('Transform output pin', + self, // Owner filter + hr, // Result code + 'XForm Out'); // Pin name + + // Can't fail + ASSERT(SUCCEEDED(hr)); + if(FOutput = nil) then FreeAndNil(FInput); + end; + + // Return the appropriate pin + + case n of + 0 : result := FInput; + 1 : result := FOutput; + else + result := nil; + end; +end; + +function TBCTransformFilter.GetPinCount: integer; +begin + result := 2; +end; + +// Set up our output sample + +function TBCTransformFilter.InitializeOutputSample(Sample: IMediaSample; + out OutSample: IMediaSample): HRESULT; +var + Props: PAMSample2Properties; + Flags: DWORD; + Start, Stop: PReferenceTime; + OutSample2: IMediaSample2; + OutProps: TAMSample2Properties; + MediaStart, MediaEnd: Int64; +begin + // default - times are the same + + Props := FInput.SampleProps; + if FSampleSkipped then Flags := AM_GBF_PREVFRAMESKIPPED else Flags := 0; + + // This will prevent the image renderer from switching us to DirectDraw + // when we can't do it without skipping frames because we're not on a + // keyframe. If it really has to switch us, it still will, but then we + // will have to wait for the next keyframe + if(not BOOL(Props.dwSampleFlags and AM_SAMPLE_SPLICEPOINT)) then Flags := Flags or AM_GBF_NOTASYNCPOINT; + + ASSERT(FOutput.FAllocator <> nil); + if BOOL(Props.dwSampleFlags and AM_SAMPLE_TIMEVALID) then Start := @Props.tStart else Start := nil; + if BOOL(Props.dwSampleFlags and AM_SAMPLE_STOPVALID) then Stop := @Props.tStop else Stop := nil; + result := FOutput.FAllocator.GetBuffer(OutSample, Start, Stop, Flags); + if FAILED(result) then exit; + ASSERT(OutSample <> nil); + if SUCCEEDED(OutSample.QueryInterface(IID_IMediaSample2, OutSample2)) then + begin + ASSERT(SUCCEEDED(OutSample2.GetProperties(4*4, OutProps))); + OutProps.dwTypeSpecificFlags := Props.dwTypeSpecificFlags; + OutProps.dwSampleFlags := (OutProps.dwSampleFlags and AM_SAMPLE_TYPECHANGED) or + (Props.dwSampleFlags and (not AM_SAMPLE_TYPECHANGED)); + + OutProps.tStart := Props.tStart; + OutProps.tStop := Props.tStop; + OutProps.cbData := (4*4) + (2*8); + + OutSample2.SetProperties((4*4)+(2*8), OutProps); + if BOOL(Props.dwSampleFlags and AM_SAMPLE_DATADISCONTINUITY) then FSampleSkipped := FALSE; + OutSample2 := nil; + end + else + begin + if BOOL(Props.dwSampleFlags and AM_SAMPLE_TIMEVALID) then + OutSample.SetTime(@Props.tStart, @Props.tStop); + if BOOL(Props.dwSampleFlags and AM_SAMPLE_SPLICEPOINT) then + OutSample.SetSyncPoint(True); + if BOOL(Props.dwSampleFlags and AM_SAMPLE_DATADISCONTINUITY) then + begin + OutSample.SetDiscontinuity(True); + FSampleSkipped := FALSE; + end; + // Copy the media times + if (Sample.GetMediaTime(MediaStart,MediaEnd) = NOERROR) then + OutSample.SetMediaTime(@MediaStart, @MediaEnd); + end; + result := S_OK; +end; + +function TBCTransformFilter.NewSegment(Start, Stop: TReferenceTime; + Rate: double): HRESULT; +begin + result := S_OK; + if (FOutput <> nil) then + result := FOutput.DeliverNewSegment(Start, Stop, Rate); +end; + +function TBCTransformFilter.Pause: HRESULT; +begin + FcsFilter.Lock; + try + result := NOERROR; + if (FState = State_Paused) then + begin + // (This space left deliberately blank) + end + // If we have no input pin or it isn't yet connected then when we are + // asked to pause we deliver an end of stream to the downstream filter. + // This makes sure that it doesn't sit there forever waiting for + // samples which we cannot ever deliver without an input connection. + + else + if ((FInput = nil) or (FInput.IsConnected = FALSE)) then + begin + if ((FOutput <> nil) and (FEOSDelivered = FALSE)) then + begin + FOutput.DeliverEndOfStream; + FEOSDelivered := True; + end; + FState := State_Paused; + end + + // We may have an input connection but no output connection + // However, if we have an input pin we do have an output pin + + else + if (FOutput.IsConnected = FALSE) then + FState := State_Paused + else + begin + if(FState = State_Stopped) then + begin + // allow a class derived from CTransformFilter + // to know about starting and stopping streaming + FcsReceive.Lock; + try + result := StartStreaming; + finally + FcsReceive.UnLock; + end; + end; + if SUCCEEDED(result) then result := inherited Pause; + end; + FSampleSkipped := FALSE; + FQualityChanged := FALSE; + finally + FcsFilter.UnLock; + end; +end; + +// override this to customize the transform process + +function TBCTransformFilter.Receive(Sample: IMediaSample): HRESULT; +var + Props: PAMSample2Properties; + OutSample: IMediaSample; +begin + // Check for other streams and pass them on + Props := FInput.SampleProps; + if(Props.dwStreamId <> AM_STREAM_MEDIA) then + begin + result := FOutput.FInputPin.Receive(Sample); + exit; + end; + // If no output to deliver to then no point sending us data + ASSERT(FOutput <> nil) ; + // Set up the output sample + result := InitializeOutputSample(Sample, OutSample); + if FAILED(result) then exit; + result := Transform(Sample, OutSample); + if FAILED(result) then + begin + {$IFDEF DEBUG} + DbgLog(self, 'Error from transform'); + {$ENDIF} + exit; + end + else + begin + // the Transform() function can return S_FALSE to indicate that the + // sample should not be delivered; we only deliver the sample if it's + // really S_OK (same as NOERROR, of course.) + if (result = NOERROR) then + begin + result := FOutput.FInputPin.Receive(OutSample); + FSampleSkipped := FALSE; // last thing no longer dropped + end + else + begin + // S_FALSE returned from Transform is a PRIVATE agreement + // We should return NOERROR from Receive() in this cause because returning S_FALSE + // from Receive() means that this is the end of the stream and no more data should + // be sent. + if (result = S_FALSE) then + begin + // Release the sample before calling notify to avoid + // deadlocks if the sample holds a lock on the system + // such as DirectDraw buffers do + OutSample := nil; + FSampleSkipped := True; + if not FQualityChanged then + begin + NotifyEvent(EC_QUALITY_CHANGE,0,0); + FQualityChanged := True; + end; + result := NOERROR; + exit; + end; + end; + end; + // release the output buffer. If the connected pin still needs it, + // it will have addrefed it itself. + OutSample := nil; +end; + +function TBCTransformFilter.SetMediaType(direction: TPinDirection; + pmt: PAMMediaType): HRESULT; +begin + result := NOERROR; +end; + +// override these two functions if you want to inform something +// about entry to or exit from streaming state. + +function TBCTransformFilter.StartStreaming: HRESULT; +begin + result := NOERROR; +end; + +// override these so that the derived filter can catch them + +function TBCTransformFilter.Stop: HRESULT; +begin + FcsFilter.Lock; + try + if(FState = State_Stopped) then + begin + result := NOERROR; + exit; + end; + // Succeed the Stop if we are not completely connected + ASSERT((FInput = nil) or (FOutput <> nil)); + if((FInput = nil) or (FInput.IsConnected = FALSE) or (FOutput.IsConnected = FALSE)) then + begin + FState := State_Stopped; + FEOSDelivered := FALSE; + result := NOERROR; + exit; + end; + ASSERT(FInput <> nil); + ASSERT(FOutput <> nil); + // decommit the input pin before locking or we can deadlock + FInput.Inactive; + // synchronize with Receive calls + FcsReceive.Lock; + try + FOutput.Inactive; + // allow a class derived from CTransformFilter + // to know about starting and stopping streaming + result := StopStreaming; + if SUCCEEDED(result) then + begin + // complete the state transition + FState := State_Stopped; + FEOSDelivered := FALSE; + end; + finally + FcsReceive.UnLock; + end; + finally + FcsFilter.UnLock; + end; +end; + +function TBCTransformFilter.StopStreaming: HRESULT; +begin + result := NOERROR; +end; + +function TBCTransformFilter.Transform(msIn, msout: IMediaSample): HRESULT; +begin +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransformFilter.Transform should never be called'); +{$ENDIF} + result := E_UNEXPECTED; +end; + +{ TBCTransformOutputPin } + +// provides derived filter a chance to release it's extra interfaces + +function TBCTransformOutputPin.BreakConnect: HRESULT; +begin + // Can't disconnect unless stopped + ASSERT(IsStopped); + FTransformFilter.BreakConnect(PINDIR_OUTPUT); + result := inherited BreakConnect; +end; + +// provides derived filter a chance to grab extra interfaces + +function TBCTransformOutputPin.CheckConnect(Pin: IPin): HRESULT; +begin + // we should have an input connection first + ASSERT(FTransformFilter.FInput <> nil); + if(FTransformFilter.FInput.IsConnected = FALSE) then + begin + result := E_UNEXPECTED; + exit; + end; + + result := FTransformFilter.CheckConnect(PINDIR_OUTPUT, Pin); + if FAILED(result) then exit; + result := inherited CheckConnect(Pin); +end; + +// check a given transform - must have selected input type first + +function TBCTransformOutputPin.CheckMediaType( + mtOut: PAMMediaType): HRESULT; +begin + // must have selected input first + ASSERT(FTransformFilter.FInput <> nil); + if(FTransformFilter.FInput.IsConnected = FALSE) then + begin + result := E_INVALIDARG; + exit; + end; + result := FTransformFilter.CheckTransform(FTransformFilter.FInput.AMMediaType, mtOut); +end; + +// Let derived class know when the output pin is connected + +function TBCTransformOutputPin.CompleteConnect(ReceivePin: IPin): HRESULT; +begin + result := FTransformFilter.CompleteConnect(PINDIR_OUTPUT, ReceivePin); + if FAILED(result) then exit; + result := inherited CompleteConnect(ReceivePin); +end; + +constructor TBCTransformOutputPin.Create(ObjectName: string; + TransformFilter: TBCTransformFilter; out hr: HRESULT; Name: WideString); +begin + inherited create(ObjectName, TransformFilter, TransformFilter.FcsFilter, hr, Name); + FPosition := nil; +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransformOutputPin.Create'); +{$ENDIF} + FTransformFilter := TransformFilter; +end; + +function TBCTransformOutputPin.DecideBufferSize(Alloc: IMemAllocator; + Prop: PAllocatorProperties): HRESULT; +begin + result := FTransformFilter.DecideBufferSize(Alloc, Prop); +end; + +destructor TBCTransformOutputPin.destroy; +begin +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransformOutputPin.Destroy'); +{$ENDIF} + FPosition := nil; + inherited; +end; + +function TBCTransformOutputPin.GetMediaType(Position: integer; + out MediaType: PAMMediaType): HRESULT; +begin + ASSERT(FTransformFilter.FInput <> nil); + // We don't have any media types if our input is not connected + if(FTransformFilter.FInput.IsConnected) then + begin + result := FTransformFilter.GetMediaType(Position, MediaType); + exit; + end + else + result := VFW_S_NO_MORE_ITEMS; +end; + +function TBCTransformOutputPin.NonDelegatingQueryInterface( + const IID: TGUID; out Obj): HResult; +begin + if IsEqualGUID(iid, IID_IMediaPosition) or IsEqualGUID(iid, IID_IMediaSeeking) then + begin + // we should have an input pin by now + ASSERT(FTransformFilter.FInput <> nil); + if (FPosition = nil) then + begin + result := CreatePosPassThru(GetOwner, FALSE, FTransformFilter.FInput, FPosition); + if FAILED(result) then exit; + end; + result := FPosition.QueryInterface(iid, obj); + end + else + result := inherited NonDelegatingQueryInterface(iid, obj); +end; + +// Override this if you can do something constructive to act on the +// quality message. Consider passing it upstream as well + +// Pass the quality mesage on upstream. + +function TBCTransformOutputPin.Notify(Sendr: IBaseFilter; q: TQuality): HRESULT; +begin + // First see if we want to handle this ourselves + result := FTransformFilter.AlterQuality(q); + if (result <> S_FALSE) then exit; + // S_FALSE means we pass the message on. + // Find the quality sink for our input pin and send it there + ASSERT(FTransformFilter.FInput <> nil); + result := FTransformFilter.FInput.PassNotify(q); +end; + +function TBCTransformOutputPin.QueryId(out Id: PWideChar): HRESULT; +begin + result := AMGetWideString('Out', Id); +end; + +// called after we have agreed a media type to actually set it in which case +// we run the CheckTransform function to get the output format type again + +function TBCTransformOutputPin.SetMediaType(pmt: PAMMediaType): HRESULT; +begin + ASSERT(FTransformFilter.FInput <> nil); + ASSERT(not IsEqualGUID(FTransformFilter.FInput.AMMediaType.majortype,GUID_NULL)); + // Set the base class media type (should always succeed) + result := inherited SetMediaType(pmt); + if FAILED(result) then exit; +{$ifdef DEBUG} + if(FAILED(FTransformFilter.CheckTransform(FTransformFilter.FInput.AMMediaType, pmt))) then + begin + DbgLog(self, '*** This filter is accepting an output media type'); + DbgLog(self, ' that it can''t currently transform to. I hope'); + DbgLog(self, ' it''s smart enough to reconnect its input.'); + end; +{$endif} + result := FTransformFilter.SetMediaType(PINDIR_OUTPUT,pmt); +end; + +// milenko start (added TBCVideoTransformFilter conversion) + +{ TBCVideoTransformFilter } + +// This class is derived from CTransformFilter, but is specialised to handle +// the requirements of video quality control by frame dropping. +// This is a non-in-place transform, (i.e. it copies the data) such as a decoder. + +constructor TBCVideoTransformFilter.Create(Name: WideString; Unk: IUnknown; clsid: TGUID); +begin + inherited Create(name, Unk, clsid); + FitrLate := 0; + FKeyFramePeriod := 0; // No QM until we see at least 2 key frames + FFramesSinceKeyFrame := 0; + FSkipping := False; + FtDecodeStart := 0; + FitrAvgDecode := 300000; // 30mSec - probably allows skipping + FQualityChanged := False; +{$IFDEF PERF} + RegisterPerfId(); +{$ENDIF} // PERF +end; + +destructor TBCVideoTransformFilter.Destroy; +begin + inherited Destroy; +end; + +// Overriden to reset quality management information + +function TBCVideoTransformFilter.EndFlush: HRESULT; +begin + FcsReceive.Lock; + try + // Reset our stats + // + // Note - we don't want to call derived classes here, + // we only want to reset our internal variables and this + // is a convenient way to do it + StartStreaming; + Result := inherited EndFlush; + finally + FcsReceive.UnLock; + end; +end; + +{$IFDEF PERF} +procedure TBCVideoTransformFilter.RegisterPerfId; +begin + FidSkip := MSR_REGISTER('Video Transform Skip frame'); + FidFrameType := MSR_REGISTER('Video transform frame type'); + FidLate := MSR_REGISTER('Video Transform Lateness'); + FidTimeTillKey := MSR_REGISTER('Video Transform Estd. time to next key'); +// inherited RegisterPerfId; +end; +{$ENDIF} + +function TBCVideoTransformFilter.StartStreaming: HRESULT; +begin + FitrLate := 0; + FKeyFramePeriod := 0; // No QM until we see at least 2 key frames + FFramesSinceKeyFrame := 0; + FSkipping := False; + FtDecodeStart := 0; + FitrAvgDecode := 300000; // 30mSec - probably allows skipping + FQualityChanged := False; + FSampleSkipped := False; + Result := NOERROR; +end; + +// Reset our quality management state + +function TBCVideoTransformFilter.AbortPlayback(hr: HRESULT): HRESULT; +begin + NotifyEvent(EC_ERRORABORT, hr, 0); + FOutput.DeliverEndOfStream; + Result := hr; +end; + +// Receive() +// +// Accept a sample from upstream, decide whether to process it +// or drop it. If we process it then get a buffer from the +// allocator of the downstream connection, transform it into the +// new buffer and deliver it to the downstream filter. +// If we decide not to process it then we do not get a buffer. + +// Remember that although this code will notice format changes coming into +// the input pin, it will NOT change its output format if that results +// in the filter needing to make a corresponding output format change. Your +// derived filter will have to take care of that. (eg. a palette change if +// the input and output is an 8 bit format). If the input sample is discarded +// and nothing is sent out for this Receive, please remember to put the format +// change on the first output sample that you actually do send. +// If your filter will produce the same output type even when the input type +// changes, then this base class code will do everything you need. + +function TBCVideoTransformFilter.Receive(Sample: IMediaSample): HRESULT; +var + pmtOut, pmt: PAMMediaType; + pOutSample: IMediaSample; +{$IFDEF DEBUG} + fccOut: TGUID; + lCompression: LongInt; + lBitCount: LongInt; + lStride: LongInt; + rcS: TRect; + rcT: TRect; + rcS1: TRect; + rcT1: TRect; +{$ENDIF} +begin + // If the next filter downstream is the video renderer, then it may + // be able to operate in DirectDraw mode which saves copying the data + // and gives higher performance. In that case the buffer which we + // get from GetDeliveryBuffer will be a DirectDraw buffer, and + // drawing into this buffer draws directly onto the display surface. + // This means that any waiting for the correct time to draw occurs + // during GetDeliveryBuffer, and that once the buffer is given to us + // the video renderer will count it in its statistics as a frame drawn. + // This means that any decision to drop the frame must be taken before + // calling GetDeliveryBuffer. + + ASSERT(FcsReceive.CritCheckIn); + ASSERT(Sample <> nil); + + // If no output pin to deliver to then no point sending us data + ASSERT (FOutput <> nil) ; + + // The source filter may dynamically ask us to start transforming from a + // different media type than the one we're using now. If we don't, we'll + // draw garbage. (typically, this is a palette change in the movie, + // but could be something more sinister like the compression type changing, + // or even the video size changing) + + Sample.GetMediaType(pmt); + if (pmt <> nil) and (pmt.pbFormat <> nil) then + begin + // spew some debug output + ASSERT(not IsEqualGUID(pmt.majortype, GUID_NULL)); + {$IFDEF DEBUG} + fccOut := pmt.subtype; + lCompression := PVideoInfoHeader(pmt.pbFormat).bmiHeader.biCompression; + lBitCount := PVideoInfoHeader(pmt.pbFormat).bmiHeader.biBitCount; + lStride := (PVideoInfoHeader(pmt.pbFormat).bmiHeader.biWidth * lBitCount + 7) div 8; + lStride := (lStride + 3) and not 3; + + rcS1 := PVideoInfoHeader(pmt.pbFormat).rcSource; + rcT1 := PVideoInfoHeader(pmt.pbFormat).rcTarget; + + DbgLog(Self,'Changing input type on the fly to'); + DbgLog(Self,'FourCC: ' + inttohex(fccOut.D1,8) + ' Compression: ' + inttostr(lCompression) + + ' BitCount: ' + inttostr(lBitCount)); + DbgLog(Self,'biHeight: ' + inttostr(PVideoInfoHeader(pmt.pbFormat).bmiHeader.biHeight) + + ' rcDst: (' + inttostr(rcT1.left) + ', ' + inttostr(rcT1.top) + ', ' + + inttostr(rcT1.right) + ', ' + inttostr(rcT1.bottom) + ')'); + DbgLog(Self,'rcSrc: (' + inttostr(rcS1.left) + ', ' + inttostr(rcS1.top) + ', ' + + inttostr(rcS1.right) + ', ' + inttostr(rcS1.bottom) + ') Stride' + inttostr(lStride)); + {$ENDIF} + + // now switch to using the new format. I am assuming that the + // derived filter will do the right thing when its media type is + // switched and streaming is restarted. + + StopStreaming(); + CopyMediaType(FInput.AMMediaType,pmt); + DeleteMediaType(pmt); + // if this fails, playback will stop, so signal an error + Result := StartStreaming; + if (FAILED(Result)) then + begin + Result := AbortPlayback(Result); + Exit; + end; + end; + + // Now that we have noticed any format changes on the input sample, it's + // OK to discard it. + + if ShouldSkipFrame(Sample) then + begin + {$IFDEF PERF} +// MSR_NOTE(m_idSkip); + {$ENDIF} + FSampleSkipped := True; + Result := NOERROR; + Exit; + end; + + // Set up the output sample + Result := InitializeOutputSample(Sample, pOutSample); + + if (FAILED(Result)) then Exit; + + FSampleSkipped := False; + + // The renderer may ask us to on-the-fly to start transforming to a + // different format. If we don't obey it, we'll draw garbage + + pOutSample.GetMediaType(pmtOut); + if (pmtOut <> nil) and (pmtOut.pbFormat <> nil) then + begin + // spew some debug output + ASSERT(not IsEqualGUID(pmtOut.majortype, GUID_NULL)); + {$IFDEF DEBUG} + fccOut := pmtOut.subtype; + lCompression := PVideoInfoHeader(pmtOut.pbFormat).bmiHeader.biCompression; + lBitCount := PVideoInfoHeader(pmtOut.pbFormat).bmiHeader.biBitCount; + lStride := (PVideoInfoHeader(pmtOut.pbFormat).bmiHeader.biWidth * lBitCount + 7) div 8; + lStride := (lStride + 3) and not 3; + + rcS := PVideoInfoHeader(pmtOut.pbFormat).rcSource; + rcT := PVideoInfoHeader(pmtOut.pbFormat).rcTarget; + + DbgLog(Self,'Changing input type on the fly to'); + DbgLog(Self,'FourCC: ' + inttohex(fccOut.D1,8) + ' Compression: ' + inttostr(lCompression) + + ' BitCount: ' + inttostr(lBitCount)); + DbgLog(Self,'biHeight: ' + inttostr(PVideoInfoHeader(pmtOut.pbFormat).bmiHeader.biHeight) + + ' rcDst: (' + inttostr(rcT1.left) + ', ' + inttostr(rcT1.top) + ', ' + + inttostr(rcT1.right) + ', ' + inttostr(rcT1.bottom) + ')'); + DbgLog(Self,'rcSrc: (' + inttostr(rcS1.left) + ', ' + inttostr(rcS1.top) + ', ' + + inttostr(rcS1.right) + ', ' + inttostr(rcS1.bottom) + ') Stride' + inttostr(lStride)); + {$ENDIF} + + // now switch to using the new format. I am assuming that the + // derived filter will do the right thing when its media type is + // switched and streaming is restarted. + + StopStreaming(); + CopyMediaType(FOutput.AMMediaType,pmtOut); + DeleteMediaType(pmtOut); + Result := StartStreaming; + + if (SUCCEEDED(Result)) then + begin + // a new format, means a new empty buffer, so wait for a keyframe + // before passing anything on to the renderer. + // !!! a keyframe may never come, so give up after 30 frames + {$IFDEF DEBUG} + DbgLog(Self,'Output format change means we must wait for a keyframe'); + {$ENDIF} + FWaitForKey := 30; + // if this fails, playback will stop, so signal an error + end else + begin + // Must release the sample before calling AbortPlayback + // because we might be holding the win16 lock or + // ddraw lock + pOutSample := nil; + AbortPlayback(Result); + Exit; + end; + end; + + // After a discontinuity, we need to wait for the next key frame + if (Sample.IsDiscontinuity = S_OK) then + begin + {$IFDEF DEBUG} + DbgLog(Self,'Non-key discontinuity - wait for keyframe'); + {$ENDIF} + FWaitForKey := 30; + end; + + // Start timing the transform (and log it if PERF is defined) + + if (SUCCEEDED(Result)) then + begin + FtDecodeStart := timeGetTime; + {$IFDEF PERF} +// MSR_START(FidTransform); // not added in conversion + {$ENDIF} + // have the derived class transform the data + Result := Transform(Sample, pOutSample); + + // Stop the clock (and log it if PERF is defined) + {$IFDEF PERF} +// MSR_STOP(m_idTransform); // not added in conversion + {$ENDIF} + FtDecodeStart := timeGetTime - int64(FtDecodeStart); + FitrAvgDecode := Round(FtDecodeStart * (10000 / 16) + 15 * (FitrAvgDecode / 16)); + + // Maybe we're waiting for a keyframe still? + if (FWaitForKey > 0) then dec(FWaitForKey); + if (FWaitForKey > 0) and (Sample.IsSyncPoint = S_OK) then BOOL(FWaitForKey) := False; + + // if so, then we don't want to pass this on to the renderer + if (FWaitForKey > 0) and (Result = NOERROR) then + begin + {$IFDEF DEBUG} + DbgLog(Self,'still waiting for a keyframe'); + Result := S_FALSE; + {$ENDIF} + end; + end; + + if (FAILED(Result)) then + begin + {$IFDEF DEBUG} + DbgLog(Self,'Error from video transform'); + {$ENDIF} + end else + begin + // the Transform() function can return S_FALSE to indicate that the + // sample should not be delivered; we only deliver the sample if it's + // really S_OK (same as NOERROR, of course.) + // Try not to return S_FALSE to a direct draw buffer (it's wasteful) + // Try to take the decision earlier - before you get it. + + if (Result = NOERROR) then + begin + Result := FOutput.Deliver(pOutSample); + end else + begin + // S_FALSE returned from Transform is a PRIVATE agreement + // We should return NOERROR from Receive() in this case because returning S_FALSE + // from Receive() means that this is the end of the stream and no more data should + // be sent. + if (S_FALSE = Result) then + begin + // We must Release() the sample before doing anything + // like calling the filter graph because having the + // sample means we may have the DirectDraw lock + // (== win16 lock on some versions) + pOutSample := nil; + FSampleSkipped := True; + if not FQualityChanged then + begin + FQualityChanged := True; + NotifyEvent(EC_QUALITY_CHANGE,0,0); + end; + Result := NOERROR; + Exit; + end; + end; + end; + + // release the output buffer. If the connected pin still needs it, + // it will have addrefed it itself. + pOutSample := nil; + ASSERT(FcsReceive.CritCheckIn); +end; + +function TBCVideoTransformFilter.AlterQuality(const q: TQuality): HRESULT; +begin + // to reduce the amount of 64 bit arithmetic, m_itrLate is an int. + // +, -, >, == etc are not too bad, but * and / are painful. + if (FitrLate > 300000000) then + begin + // Avoid overflow and silliness - more than 30 secs late is already silly + FitrLate := 300000000; + end else + begin + FitrLate := integer(q.Late); + end; + + // We ignore the other fields + + // We're actually not very good at handling this. In non-direct draw mode + // most of the time can be spent in the renderer which can skip any frame. + // In that case we'd rather the renderer handled things. + // Nevertheless we will keep an eye on it and if we really start getting + // a very long way behind then we will actually skip - but we'll still tell + // the renderer (or whoever is downstream) that they should handle quality. + + Result := E_FAIL; // Tell the renderer to do his thing. +end; + +function TBCVideoTransformFilter.ShouldSkipFrame(pIn: IMediaSample): Boolean; +var + Start, StopAt: TReferenceTime; + itrFrame: integer; + it: integer; +begin + Result := pIn.GetTime(Start, StopAt) = S_OK; + + // Don't skip frames with no timestamps + if not Result then Exit; + + itrFrame := integer(StopAt - Start); // frame duration + + if(S_OK = pIn.IsSyncPoint) then + begin + {$IFDEF PERF} + MSR_INTEGER(FidFrameType, 1); + {$ENDIF} + if (FKeyFramePeriod < FFramesSinceKeyFrame) then + begin + // record the max + FKeyFramePeriod := FFramesSinceKeyFrame; + end; + FFramesSinceKeyFrame := 0; + FSkipping := False; + end else + begin + {$IFDEF PERF} + MSR_INTEGER(FidFrameType, 2); + {$ENDIF} + if (FFramesSinceKeyFrame > FKeyFramePeriod) and (FKeyFramePeriod > 0) then + begin + // We haven't seen the key frame yet, but we were clearly being + // overoptimistic about how frequent they are. + FKeyFramePeriod := FFramesSinceKeyFrame; + end; + end; + + + // Whatever we might otherwise decide, + // if we are taking only a small fraction of the required frame time to decode + // then any quality problems are actually coming from somewhere else. + // Could be a net problem at the source for instance. In this case there's + // no point in us skipping frames here. + if (FitrAvgDecode * 4 > itrFrame) then + begin + // Don't skip unless we are at least a whole frame late. + // (We would skip B frames if more than 1/2 frame late, but they're safe). + if (FitrLate > itrFrame) then + begin + // Don't skip unless the anticipated key frame would be no more than + // 1 frame early. If the renderer has not been waiting (we *guess* + // it hasn't because we're late) then it will allow frames to be + // played early by up to a frame. + + // Let T = Stream time from now to anticipated next key frame + // = (frame duration) * (KeyFramePeriod - FramesSinceKeyFrame) + // So we skip if T - Late < one frame i.e. + // (duration) * (freq - FramesSince) - Late < duration + // or (duration) * (freq - FramesSince - 1) < Late + + // We don't dare skip until we have seen some key frames and have + // some idea how often they occur and they are reasonably frequent. + if (FKeyFramePeriod > 0) then + begin + // It would be crazy - but we could have a stream with key frames + // a very long way apart - and if they are further than about + // 3.5 minutes apart then we could get arithmetic overflow in + // reference time units. Therefore we switch to mSec at this point + it := (itrFrame div 10000) * (FKeyFramePeriod - FFramesSinceKeyFrame - 1); + {$IFDEF PERF} + MSR_INTEGER(FidTimeTillKey, it); + {$ENDIF} + + // For debug - might want to see the details - dump them as scratch pad + {$IFDEF VTRANSPERF} + MSR_INTEGER(0, itrFrame); + MSR_INTEGER(0, FFramesSinceKeyFrame); + MSR_INTEGER(0, FKeyFramePeriod); + {$ENDIF} + if (FitrLate div 10000 > it) then + begin + FSkipping := True; + // Now we are committed. Once we start skipping, we + // cannot stop until we hit a key frame. + end else + begin + {$IFDEF VTRANSPERF} + MSR_INTEGER(0, 777770); // not near enough to next key + {$ENDIF} + end; + end else + begin + {$IFDEF VTRANSPERF} + MSR_INTEGER(0, 777771); // Next key not predictable + {$ENDIF} + end; + end else + begin + {$IFDEF VTRANSPERF} + MSR_INTEGER(0, 777772); // Less than one frame late + MSR_INTEGER(0, FitrLate); + MSR_INTEGER(0, itrFrame); + {$ENDIF} + end; + end else + begin + {$IFDEF VTRANSPERF} + MSR_INTEGER(0, 777773); // Decode time short - not not worth skipping + MSR_INTEGER(0, FitrAvgDecode); + MSR_INTEGER(0, itrFrame); + {$ENDIF} + end; + + inc(FFramesSinceKeyFrame); + + if FSkipping then + begin + // We will count down the lateness as we skip each frame. + // We re-assess each frame. The key frame might not arrive when expected. + // We reset m_itrLate if we get a new Quality message, but actually that's + // not likely because we're not sending frames on to the Renderer. In + // fact if we DID get another one it would mean that there's a long + // pipe between us and the renderer and we might need an altogether + // better strategy to avoid hunting! + FitrLate := FitrLate - itrFrame; + end; + +{$IFDEF PERF} + MSR_INTEGER(FidLate, integer(FitrLate div 10000)); // Note how late we think we are +{$ENDIF} + if FSkipping then + begin + if not FQualityChanged then + begin + FQualityChanged := True; + NotifyEvent(EC_QUALITY_CHANGE,0,0); + end; + end; + + Result := FSkipping; +end; +// milenko end + +{ TCTransInPlaceInputPin } + +function TBCTransInPlaceInputPin.CheckMediaType( + pmt: PAMMediaType): HRESULT; +begin + result := FTIPFilter.CheckInputType(pmt); + if (result <> S_OK) then exit; + if FTIPFilter.FOutput.IsConnected then + result := FTIPFilter.FOutput.GetConnected.QueryAccept(pmt^) + else + result := S_OK; +end; + +function TBCTransInPlaceInputPin.EnumMediaTypes( + out ppEnum: IEnumMediaTypes): HRESULT; +begin + // Can only pass through if connected + if (not FTIPFilter.FOutput.IsConnected) then + begin + result := VFW_E_NOT_CONNECTED; + exit; + end; + + result := FTIPFilter.FOutput.GetConnected.EnumMediaTypes(ppEnum); +end; + +function TBCTransInPlaceInputPin.GetAllocator( + out Allocator: IMemAllocator): HRESULT; +begin + FLock.Lock; + try + if FTIPFilter.FOutput.IsConnected then + begin + // Store the allocator we got + result := FTIPFilter.OutputPin.ConnectedIMemInputPin.GetAllocator(Allocator); + if SUCCEEDED(result) then + FTIPFilter.OutputPin.SetAllocator(Allocator); + end + else + begin + // Help upstream filter (eg TIP filter which is having to do a copy) + // by providing a temp allocator here - we'll never use + // this allocator because when our output is connected we'll + // reconnect this pin + result := inherited GetAllocator(Allocator); + end; + finally + FLock.UnLock; + end; +end; + +function TBCTransInPlaceInputPin.GetAllocatorRequirements( + props: PAllocatorProperties): HRESULT; +begin + if FTIPFilter.FOutput.IsConnected then + result := FTIPFilter.OutputPin.ConnectedIMemInputPin.GetAllocatorRequirements(Props^) + else + result := E_NOTIMPL; +end; + +function TBCTransInPlaceInputPin.NotifyAllocator(Allocator: IMemAllocator; + ReadOnly: BOOL): HRESULT; +var + OutputAllocator: IMemAllocator; + Props, Actual: TAllocatorProperties; +begin + result := S_OK; + FLock.Lock; + try + FReadOnly := ReadOnly; + // If we modify data then don't accept the allocator if it's + // the same as the output pin's allocator + + // If our output is not connected just accept the allocator + // We're never going to use this allocator because when our + // output pin is connected we'll reconnect this pin + if not FTIPFilter.OutputPin.IsConnected then + begin + result := inherited NotifyAllocator(Allocator, ReadOnly); + exit; + end; + + // If the allocator is read-only and we're modifying data + // and the allocator is the same as the output pin's + // then reject + if (FReadOnly and FTIPFilter.FModifiesData) then + begin + OutputAllocator := FTIPFilter.OutputPin.PeekAllocator; + + // Make sure we have an output allocator + if (OutputAllocator = nil) then + begin + result := FTIPFilter.OutputPin.ConnectedIMemInputPin.GetAllocator(OutputAllocator); + if FAILED(result) then result := CreateMemoryAllocator(OutputAllocator); + if SUCCEEDED(result) then + begin + FTIPFilter.OutputPin.SetAllocator(OutputAllocator); + OutputAllocator := nil; + end; + end; + if (Allocator = OutputAllocator) then + begin + result := E_FAIL; + exit; + end + else + if SUCCEEDED(result) then + begin + // Must copy so set the allocator properties on the output + result := Allocator.GetProperties(Props); + if SUCCEEDED(result) then + result := OutputAllocator.SetProperties(Props, Actual); + if SUCCEEDED(result) then + begin + if ((Props.cBuffers > Actual.cBuffers) + or (Props.cbBuffer > Actual.cbBuffer) + or (Props.cbAlign > Actual.cbAlign)) then + result := E_FAIL; + + end; + + // Set the allocator on the output pin + if SUCCEEDED(result) then + result := FTIPFilter.OutputPin.ConnectedIMemInputPin.NotifyAllocator(OutputAllocator, FALSE); + end; + end + else + begin + result := FTIPFilter.OutputPin.ConnectedIMemInputPin.NotifyAllocator(Allocator, ReadOnly); + if SUCCEEDED(result) then FTIPFilter.OutputPin.SetAllocator(Allocator); + end; + + if SUCCEEDED(result) then + begin + // It's possible that the old and the new are the same thing. + // AddRef before release ensures that we don't unload it. + Allocator._AddRef; + if (FAllocator <> nil) then FAllocator := nil; + Pointer(FAllocator) := Pointer(Allocator); // We have an allocator for the input pin + end; + finally + FLock.UnLock; + end; +end; + +function TBCTransInPlaceInputPin.PeekAllocator: IMemAllocator; +begin + result := FAllocator; +end; + +constructor TBCTransInPlaceInputPin.Create(ObjectName: string; + Filter: TBCTransInPlaceFilter; out hr: HRESULT; Name: WideString); +begin + inherited Create(ObjectName, Filter, hr, Name); + FReadOnly := FALSE; + FTIPFilter := Filter; +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransInPlaceInputPin.Create'); +{$ENDIF} +end; + +{ TBCTransInPlaceOutputPin } + +function TBCTransInPlaceOutputPin.CheckMediaType( + pmt: PAMMediaType): HRESULT; +begin + // Don't accept any output pin type changes if we're copying + // between allocators - it's too late to change the input + // allocator size. + if (FTIPFilter.UsingDifferentAllocators and (not FFilter.IsStopped)) then + begin + if TBCMediaType(pmt).Equal(@Fmt) then result := S_OK else result := VFW_E_TYPE_NOT_ACCEPTED; + exit; + end; + + // Assumes the type does not change. That's why we're calling + // CheckINPUTType here on the OUTPUT pin. + result := FTIPFilter.CheckInputType(pmt); + if (result <> S_OK) then exit; + if (FTIPFilter.FInput.IsConnected) then + result := FTIPFilter.FInput.GetConnected.QueryAccept(pmt^) + else + result := S_OK; +end; + +function TBCTransInPlaceOutputPin.ConnectedIMemInputPin: IMemInputPin; +begin + pointer(result) := pointer(FInputPin); +end; + +constructor TBCTransInPlaceOutputPin.Create(ObjectName: string; + Filter: TBCTransInPlaceFilter; out hr: HRESULT; Name: WideString); +begin + inherited Create(ObjectName, Filter, hr, Name); + FTIPFilter := Filter; +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransInPlaceOutputPin.Create'); +{$ENDIF} +end; + +function TBCTransInPlaceOutputPin.EnumMediaTypes( + out ppEnum: IEnumMediaTypes): HRESULT; +begin + // Can only pass through if connected. + if not FTIPFilter.FInput.IsConnected then + result := VFW_E_NOT_CONNECTED + else + result := FTIPFilter.FInput.GetConnected.EnumMediaTypes(ppEnum); +end; + +function TBCTransInPlaceOutputPin.PeekAllocator: IMemAllocator; +begin + result := FAllocator; +end; + +procedure TBCTransInPlaceOutputPin.SetAllocator(Allocator: IMemAllocator); +begin + Allocator._AddRef; + if(FAllocator <> nil) then FAllocator._Release; + Pointer(FAllocator) := Pointer(Allocator); +end; + +{ TBCTransInPlaceFilter } + +function TBCTransInPlaceFilter.CheckTransform(mtIn, + mtOut: PAMMediaType): HRESULT; +begin + result := S_OK; +end; + +// dir is the direction of our pin. +// pReceivePin is the pin we are connecting to. + +function TBCTransInPlaceFilter.CompleteConnect(dir: TPinDirection; + ReceivePin: IPin): HRESULT; +var + pmt: PAMMediaType; +begin + ASSERT(FInput <> nil); + ASSERT(FOutput <> nil); + + // if we are not part of a graph, then don't indirect the pointer + // this probably prevents use of the filter without a filtergraph + if(FGraph = nil) then + begin + result := VFW_E_NOT_IN_GRAPH; + exit; + end; + + // Always reconnect the input to account for buffering changes + // + // Because we don't get to suggest a type on ReceiveConnection + // we need another way of making sure the right type gets used. + // + // One way would be to have our EnumMediaTypes return our output + // connection type first but more deterministic and simple is to + // call ReconnectEx passing the type we want to reconnect with + // via the base class ReconeectPin method. + + if(dir = PINDIR_OUTPUT) then + begin + if FInput.IsConnected then + begin + result := ReconnectPin(FInput, FOutput.AMMediaType); + exit; + end; + result := NOERROR; + exit; + end; + + ASSERT(dir = PINDIR_INPUT); + + // Reconnect output if necessary + + if FOutput.IsConnected then + begin + pmt := FInput.CurrentMediaType.MediaType; + if (not TBCMediaType(pmt).Equal(FOutput.CurrentMediaType.MediaType)) then + begin + result := ReconnectPin(FOutput, FInput.CurrentMediaType.MediaType); + exit; + end; + end; + result := NOERROR; +end; + +function TBCTransInPlaceFilter.Copy(Source: IMediaSample): IMediaSample; +var + Start, Stop: TReferenceTime; + Time: boolean; + pStartTime, pEndTime: PReferenceTime; + TimeStart, TimeEnd: Int64; + Flags: DWORD; + Sample2: IMediaSample2; + props: PAMSample2Properties; + MediaType: PAMMediaType; + DataLength: LongInt; + SourceBuffer, DestBuffer: PByte; + SourceSize, DestSize: LongInt; + hr: hresult; +begin + Time := (Source.GetTime(Start, Stop) = S_OK); + // this may block for an indeterminate amount of time + if Time then + begin + pStartTime := @Start; + pEndTime := @Stop; + end + else + begin + pStartTime := nil; + pEndTime := nil; + end; + if FSampleSkipped then Flags := AM_GBF_PREVFRAMESKIPPED else Flags := 0; + hr := OutputPin.PeekAllocator.GetBuffer(result, pStartTime, pEndTime, Flags); + + if FAILED(hr) then exit; + + ASSERT(result <> nil); + if(SUCCEEDED(result.QueryInterface(IID_IMediaSample2, Sample2))) then + begin + props := FInput.SampleProps; + hr := Sample2.SetProperties(SizeOf(TAMSample2Properties) - (4*2), props^); + Sample2 := nil; + if FAILED(hr) then + begin + result := nil; + exit; + end; + end + else + begin + if Time then result.SetTime(@Start, @Stop); + if (Source.IsSyncPoint = S_OK) then result.SetSyncPoint(True); + if ((Source.IsDiscontinuity = S_OK) or FSampleSkipped) then result.SetDiscontinuity(True); + if (Source.IsPreroll = S_OK) then result.SetPreroll(True); + // Copy the media type + if (Source.GetMediaType(MediaType) = S_OK) then + begin + result.SetMediaType(MediaType^); + DeleteMediaType(MediaType); + end; + + end; + + FSampleSkipped := FALSE; + + // Copy the sample media times + if (Source.GetMediaTime(TimeStart, TimeEnd) = NOERROR) then + result.SetMediaTime(@TimeStart,@TimeEnd); + + // Copy the actual data length and the actual data. + DataLength := Source.GetActualDataLength; + + result.SetActualDataLength(DataLength); + + // Copy the sample data + SourceSize := Source.GetSize; + DestSize := result.GetSize; + + // milenko start get rid of compiler warnings + if (DestSize < SourceSize) then + begin + end; + // milenko end + + ASSERT(DestSize >= SourceSize, format('DestSize (%d) < SourceSize (%d)',[DestSize, SourceSize])); + ASSERT(DestSize >= DataLength); + + Source.GetPointer(SourceBuffer); + result.GetPointer(DestBuffer); + ASSERT((DestSize = 0) or (SourceBuffer <> nil) and (DestBuffer <> nil)); + CopyMemory(DestBuffer, SourceBuffer, DataLength); +end; + +constructor TBCTransInPlaceFilter.Create(ObjectName: string; + unk: IUnKnown; clsid: TGUID; out hr: HRESULT; ModifiesData: boolean); +begin + inherited create(ObjectName, Unk, clsid); + FModifiesData := ModifiesData; +end; + +constructor TBCTransInPlaceFilter.CreateFromFactory(Factory: TBCClassFactory; + const Controller: IUnknown); +begin + inherited create(FacTory.FName, Controller, FacTory.FClassID); + FModifiesData := True; +end; + +// Tell the output pin's allocator what size buffers we require. +// *pAlloc will be the allocator our output pin is using. + +function TBCTransInPlaceFilter.DecideBufferSize(Alloc: IMemAllocator; + propInputRequest: PAllocatorProperties): HRESULT; +var Request, Actual: TAllocatorProperties; +begin + // If we are connected upstream, get his views + if FInput.IsConnected then + begin + // Get the input pin allocator, and get its size and count. + // we don't care about his alignment and prefix. + result := InputPin.FAllocator.GetProperties(Request); + //Request.cbBuffer := 230400; + if FAILED(result) then exit; // Input connected but with a secretive allocator - enough! + end + else + begin + // We're reduced to blind guessing. Let's guess one byte and if + // this isn't enough then when the other pin does get connected + // we can revise it. + ZeroMemory(@Request, sizeof(Request)); + Request.cBuffers := 1; + Request.cbBuffer := 1; + end; + + +{$IFDEF DEBUG} + DbgLog(self, 'Setting Allocator Requirements'); + DbgLog(self, format('Count %d, Size %d',[Request.cBuffers, Request.cbBuffer])); +{$ENDIF} + + // Pass the allocator requirements to our output side + // but do a little sanity checking first or we'll just hit + // asserts in the allocator. + + propInputRequest.cBuffers := Request.cBuffers; + propInputRequest.cbBuffer := Request.cbBuffer; + if (propInputRequest.cBuffers <= 0) then propInputRequest.cBuffers := 1; + if (propInputRequest.cbBuffer <= 0) then propInputRequest.cbBuffer := 1; + result := Alloc.SetProperties(propInputRequest^, Actual); + if FAILED(result) then exit; + +{$IFDEF DEBUG} + DbgLog(self, 'Obtained Allocator Requirements'); + DbgLog(self, format('Count %d, Size %d, Alignment %d', [Actual.cBuffers, Actual.cbBuffer, Actual.cbAlign])); +{$ENDIF} + + // Make sure we got the right alignment and at least the minimum required + + if ((Request.cBuffers > Actual.cBuffers) + or (Request.cbBuffer > Actual.cbBuffer) + or (Request.cbAlign > Actual.cbAlign)) then + result := E_FAIL + else + result := NOERROR; +end; + +function TBCTransInPlaceFilter.GetMediaType(Position: integer; + out MediaType: PAMMediaType): HRESULT; +begin +{$IFDEF DEBUG} + DbgLog(self, 'TBCTransInPlaceFilter.GetMediaType should never be called'); +{$ENDIF} + result := E_UNEXPECTED; +end; + +// return a non-addrefed CBasePin * for the user to addref if he holds onto it +// for longer than his pointer to us. We create the pins dynamically when they +// are asked for rather than in the constructor. This is because we want to +// give the derived class an oppportunity to return different pin objects + +// As soon as any pin is needed we create both (this is different from the +// usual transform filter) because enumerators, allocators etc are passed +// through from one pin to another and it becomes very painful if the other +// pin isn't there. If we fail to create either pin we ensure we fail both. + +function TBCTransInPlaceFilter.GetPin(n: integer): TBCBasePin; +var hr: HRESULT; +begin + hr := S_OK; + // Create an input pin if not already done + if(FInput = nil) then + begin + FInput := TBCTransInPlaceInputPin.Create('TransInPlace input pin', + self, // Owner filter + hr, // Result code + 'Input'); // Pin name + + // Constructor for CTransInPlaceInputPin can't fail + ASSERT(SUCCEEDED(hr)); + end; + + // Create an output pin if not already done + + if((FInput <> nil) and (FOutput = nil)) then + begin + FOutput := TBCTransInPlaceOutputPin.Create('TransInPlace output pin', + self, // Owner filter + hr, // Result code + 'Output'); // Pin name + + // a failed return code should delete the object + ASSERT(SUCCEEDED(hr)); + if(FOutput = nil) then + begin + FInput.Free; + FInput := nil; + end; + end; + + // Return the appropriate pin + + ASSERT(n in [0,1]); + case n of + 0: result := FInput; + 1: result := FOutput; + else + result := nil; + end; +end; + +function TBCTransInPlaceFilter.InputPin: TBCTransInPlaceInputPin; +begin + result := TBCTransInPlaceInputPin(FInput); +end; + +function TBCTransInPlaceFilter.OutputPin: TBCTransInPlaceOutputPin; +begin + result := TBCTransInPlaceOutputPin(FOutput); +end; + +function TBCTransInPlaceFilter.Receive(Sample: IMediaSample): HRESULT; +var Props: PAMSample2Properties; +begin + // Check for other streams and pass them on */ + Props := FInput.SampleProps; + if (Props.dwStreamId <> AM_STREAM_MEDIA) then + begin + result := FOutput.Deliver(Sample); + exit; + end; + + if UsingDifferentAllocators then + begin + // We have to copy the data. + Sample := Copy(Sample); + if (Sample = nil) then + begin + result := E_UNEXPECTED; + exit; + end; + end; + + // have the derived class transform the data + result := Transform(Sample); + + if FAILED(result) then + begin + {$IFDEF DEBUG} + DbgLog(self, 'Error from TransInPlace'); + {$ENDIF} + if UsingDifferentAllocators then Sample := nil; + exit; + end; + + // the Transform() function can return S_FALSE to indicate that the + // sample should not be delivered; we only deliver the sample if it's + // really S_OK (same as NOERROR, of course.) + if (result = NOERROR) then + result := FOutput.Deliver(Sample) + else + begin + // But it would be an error to return this private workaround + // to the caller ... + if (result = S_FALSE) then + begin + // S_FALSE returned from Transform is a PRIVATE agreement + // We should return NOERROR from Receive() in this cause because + // returning S_FALSE from Receive() means that this is the end + // of the stream and no more data should be sent. + FSampleSkipped := True; + if (not FQualityChanged) then + begin + NotifyEvent(EC_QUALITY_CHANGE,0,0); + FQualityChanged := True; + end; + result := NOERROR; + end; + end; + + // release the output buffer. If the connected pin still needs it, + // it will have addrefed it itself. + if UsingDifferentAllocators then Sample := nil; +end; + +function TBCTransInPlaceFilter.TypesMatch: boolean; +var + pmt: PAMMediaType; +begin + pmt := InputPin.CurrentMediaType.MediaType; + result := TBCMediaType(pmt).Equal(OutputPin.CurrentMediaType.MediaType); +end; + +function TBCTransInPlaceFilter.UsingDifferentAllocators: boolean; +begin + result := Pointer(InputPin.FAllocator) <> Pointer(OutputPin.FAllocator); +end; + +{ TBCBasePropertyPage } + +function TBCBasePropertyPage.Activate(hwndParent: HWnd; const rc: TRect; + bModal: BOOL): HResult; +begin + // Return failure if SetObject has not been called. + if (FObjectSet = FALSE) or (hwndParent = 0) then + begin + result := E_UNEXPECTED; + exit; + end; + + // FForm := TCustomFormClass(FFormClass).Create(nil); + + if (FForm = nil) then + begin + result := E_OUTOFMEMORY; + exit; + end; + + FForm.ParentWindow := hwndParent; + if assigned(FForm.OnActivate) then FForm.OnActivate(FForm); + Move(rc); + result := Show(SW_SHOWNORMAL); +end; + +function TBCBasePropertyPage.Apply: HResult; +begin + // In ActiveMovie 1.0 we used to check whether we had been activated or + // not. This is too constrictive. Apply should be allowed as long as + // SetObject was called to set an object. So we will no longer check to + // see if we have been activated (ie., m_hWnd != NULL), but instead + // make sure that m_bObjectSet is True (ie., SetObject has been called). + + if (FObjectSet = FALSE) or (FPageSite = nil) then + begin + result := E_UNEXPECTED; + exit; + end; + + if (FDirty = FALSE) then + begin + result := NOERROR; + exit; + end; + + // Commit derived class changes + + result := FForm.OnApplyChanges; + if SUCCEEDED(result) then FDirty := FALSE; +end; + +function TBCBasePropertyPage.Deactivate: HResult; +var Style: DWORD; +begin + if (FForm = nil) then + begin + result := E_UNEXPECTED; + exit; + end; + + // Remove WS_EX_CONTROLPARENT before DestroyWindow call + + Style := GetWindowLong(FForm.Handle, GWL_EXSTYLE); + Style := Style and (not WS_EX_CONTROLPARENT); + + // Set m_hwnd to be NULL temporarily so the message handler + // for WM_STYLECHANGING doesn't add the WS_EX_CONTROLPARENT + // style back in + + SetWindowLong(FForm.Handle, GWL_EXSTYLE, Style); + if assigned(FForm.OnDeactivate) then FForm.OnDeactivate(FForm); + + // Destroy the dialog window + + //FForm.Free; + //FForm := nil; + result := NOERROR; +end; + +function TBCBasePropertyPage.GetPageInfo(out pageInfo: TPropPageInfo): HResult; +begin + pageInfo.cb := sizeof(TPropPageInfo); + AMGetWideString(FForm.Caption, pageInfo.pszTitle); + PageInfo.pszDocString := nil; + PageInfo.pszHelpFile := nil; + PageInfo.dwHelpContext:= 0; + PageInfo.size.cx := FForm.width; + PageInfo.size.cy := FForm.Height; + Result := NoError; +end; + +function TBCBasePropertyPage.Help(pszHelpDir: POleStr): HResult; +begin + result := E_NOTIMPL; +end; + +function TBCBasePropertyPage.IsPageDirty: HResult; +begin + if FDirty then result := S_OK else result := S_FALSE; +end; + +function TBCBasePropertyPage.Move(const rect: TRect): HResult; +begin + if (FForm = nil) then + begin + result := E_UNEXPECTED; + exit; + end; + + MoveWindow(FForm.Handle, // Property page handle + Rect.left, // x coordinate + Rect.top, // y coordinate + Rect.Right - Rect.Left, // Overall window width + Rect.Bottom - Rect.Top, // And likewise height + True); // Should we repaint it + + result := NOERROR; +end; + +function TBCBasePropertyPage.SetObjects(cObjects: Integer; + pUnkList: PUnknownList): HResult; +begin + if (cObjects = 1) then + begin + if (pUnkList = nil) then + begin + result := E_POINTER; + exit; + end; + // Set a flag to say that we have set the Object + FObjectSet := True ; + result := FForm.OnConnect(pUnkList^[0]); + exit; + end + else + if (cObjects = 0) then + begin + // Set a flag to say that we have not set the Object for the page + FObjectSet := FALSE; + result := FForm.OnDisconnect; + exit; + end; + + {$IFDEF DEBUG} + DbgLog(self, 'No support for more than one object'); + {$ENDIF} + result := E_UNEXPECTED; +end; + +function TBCBasePropertyPage.SetPageSite( + const pageSite: IPropertyPageSite): HResult; +begin + if (pageSite <> nil) then + begin + if (FPageSite <> nil) then + begin + result := E_UNEXPECTED; + exit; + end; + FPageSite := pageSite; + end + else + begin + if (FPageSite = nil) then + begin + result := E_UNEXPECTED; + exit; + end; + FPageSite := nil; + end; + result := NOERROR; +end; + +function TBCBasePropertyPage.Show(nCmdShow: Integer): HResult; +begin + if (FForm = nil) then + begin + result := E_UNEXPECTED; + exit; + end; + + if ((nCmdShow <> SW_SHOW) and (nCmdShow <> SW_SHOWNORMAL) and (nCmdShow <> SW_HIDE)) then + begin + result := E_INVALIDARG; + exit; + end; + + if nCmdShow in [SW_SHOW,SW_SHOWNORMAL] then FForm.Show else FForm.Hide; + InvalidateRect(FForm.Handle, nil, True); + result := NOERROR; +end; + +function TBCBasePropertyPage.TranslateAccelerator(msg: PMsg): HResult; +begin + result := E_NOTIMPL; +end; + +constructor TBCBasePropertyPage.Create(Name: String; Unk: IUnKnown; Form: TFormPropertyPage); +begin + inherited Create(Name, Unk); + FForm := Form; + FForm.BorderStyle := bsNone; + FPageSite := nil; + FObjectSet := false; + FDirty := false; +end; + +destructor TBCBasePropertyPage.Destroy; +begin + if FForm <> nil then + begin + FForm.Free; + FForm := nil; + end; + inherited; +end; + +constructor TFormPropertyPage.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WindowProc := MyWndProc; +end; + +procedure TFormPropertyPage.MyWndProc(var aMsg: TMessage); +var + lpss : PStyleStruct; +begin + // we would like the TAB key to move around the tab stops in our property + // page, but for some reason OleCreatePropertyFrame clears the CONTROLPARENT + // style behind our back, so we need to switch it back on now behind its + // back. Otherwise the tab key will be useless in every page. + + // DCoder: removing CONTROLPARENT is also the reason for non responding + // PropertyPages when using ShowMessage and TComboBox. + if (aMsg.Msg = WM_STYLECHANGING) and (aMsg.WParam = GWL_EXSTYLE) then + begin + lpss := PStyleStruct(aMsg.LParam); + lpss.styleNew := lpss.styleNew or WS_EX_CONTROLPARENT; + aMsg.Result := 0; + Exit; + end; + WndProc(aMsg); +end; + +function TFormPropertyPage.OnApplyChanges: HRESULT; +begin + result := NOERROR; +end; + +function TFormPropertyPage.OnConnect(Unknown: IUnKnown): HRESULT; +begin + result := NOERROR; +end; + +function TFormPropertyPage.OnDisconnect: HRESULT; +begin + result := NOERROR; +end; + +procedure TBCBasePropertyPage.SetPageDirty; +begin + FDirty := True; + if Assigned(FPageSite) then FPageSite.OnStatusChange(PROPPAGESTATUS_DIRTY); +end; + +{ TBCBaseDispatch } + +function TBCBaseDispatch.GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; +var ti: ITypeInfo; +begin + // although the IDispatch riid is dead, we use this to pass from + // the interface implementation class to us the iid we are talking about. + result := GetTypeInfo(iid, 0, LocaleID, ti); + if SUCCEEDED(result) then + result := ti.GetIDsOfNames(Names, NameCount, DispIDs); +end; + +function TBCBaseDispatch.GetTypeInfo(const iid: TGUID; info: Cardinal; lcid: LCID; + out tinfo): HRESULT; stdcall; +var + tlib : ITypeLib; +begin + // we only support one type element + if (info <> 0) then + begin + result := TYPE_E_ELEMENTNOTFOUND; + exit; + end; + + // always look for neutral + if (FTI = nil) then + begin + result := LoadRegTypeLib(LIBID_QuartzTypeLib, 1, 0, lcid, tlib); + if FAILED(result) then + begin + result := LoadTypeLib('control.tlb', tlib); + if FAILED(result) then exit; + end; + result := tlib.GetTypeInfoOfGuid(iid, Fti); + tlib := nil; + if FAILED(result) then exit; + end; + ITypeInfo(tinfo) := Fti; + result := S_OK; +end; + +function TBCBaseDispatch.GetTypeInfoCount(out Count: Integer): HResult; +begin + count := 1; + result := S_OK; +end; + +{ TBCMediaControl } + +constructor TBCMediaControl.Create(name: string; unk: IUnknown); +begin + FBaseDisp := TBCBaseDispatch.Create; +end; + +destructor TBCMediaControl.Destroy; +begin + FBaseDisp.Free; + inherited; +end; + +function TBCMediaControl.GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; +begin + result := FBasedisp.GetIDsOfNames(IID_IMediaControl, Names, NameCount, LocaleID, DispIDs); +end; + +function TBCMediaControl.GetTypeInfo(Index, LocaleID: Integer; + out TypeInfo): HResult; +begin + result := Fbasedisp.GetTypeInfo(IID_IMediaControl, index, LocaleID, TypeInfo); +end; + +function TBCMediaControl.GetTypeInfoCount(out Count: Integer): HResult; +begin + result := FBaseDisp.GetTypeInfoCount(Count); +end; + +function TBCMediaControl.Invoke(DispID: Integer; const IID: TGUID; + LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo, + ArgErr: Pointer): HResult; +var ti: ITypeInfo; +begin + // this parameter is a dead leftover from an earlier interface + if not IsEqualGUID(GUID_NULL, IID) then + begin + result := DISP_E_UNKNOWNINTERFACE; + exit; + end; + result := GetTypeInfo(0, LocaleID, ti); + if FAILED(result) then exit; + result := ti.Invoke(Pointer(Integer(Self)), DISPID, Flags, TDispParams(Params), + VarResult, ExcepInfo, ArgErr); +end; + +{ TBCMediaEvent } + +constructor TBCMediaEvent.Create(Name: string; Unk: IUnknown); +begin + inherited Create(name, Unk); + FBasedisp := TBCBaseDispatch.Create; +end; + +destructor TBCMediaEvent.destroy; +begin + FBasedisp.Free; + inherited; +end; + +function TBCMediaEvent.GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; +begin + result := FBasedisp.GetIDsOfNames(IID_IMediaEvent, Names, NameCount, LocaleID, DispIDs); +end; + +function TBCMediaEvent.GetTypeInfo(Index, LocaleID: Integer; + out TypeInfo): HResult; +begin + result := Fbasedisp.GetTypeInfo(IID_IMediaEvent, index, LocaleID, TypeInfo); +end; + +function TBCMediaEvent.GetTypeInfoCount(out Count: Integer): HResult; +begin + result := FBaseDisp.GetTypeInfoCount(Count); +end; + +function TBCMediaEvent.Invoke(DispID: Integer; const IID: TGUID; + LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo, + ArgErr: Pointer): HResult; +var ti: ITypeInfo; +begin + // this parameter is a dead leftover from an earlier interface + if not IsEqualGUID(GUID_NULL, IID) then + begin + result := DISP_E_UNKNOWNINTERFACE; + exit; + end; + result := GetTypeInfo(0, LocaleID, ti); + if FAILED(result) then exit; + result := ti.Invoke(Pointer(Integer(Self)), DISPID, Flags, TDispParams(Params), VarResult, ExcepInfo, ArgErr); +end; + +{ TBCMediaPosition } + +constructor TBCMediaPosition.Create(Name: String; Unk: IUnknown); +begin + inherited Create(Name, Unk); + FBaseDisp := TBCBaseDispatch.Create; +end; + +constructor TBCMediaPosition.Create(Name: String; Unk: IUnknown; + out hr: HRESULT); +begin + inherited Create(Name, Unk); + FBaseDisp := TBCBaseDispatch.Create; +end; + +destructor TBCMediaPosition.Destroy; +begin + FBaseDisp.Free; + inherited; +end; + +function TBCMediaPosition.GetIDsOfNames(const IID: TGUID; Names: Pointer; + NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; +begin + result := FBasedisp.GetIDsOfNames(IID_IMediaPosition, Names, NameCount, LocaleID, DispIDs); +end; + +function TBCMediaPosition.GetTypeInfo(Index, LocaleID: Integer; + out TypeInfo): HResult; +begin + result := Fbasedisp.GetTypeInfo(IID_IMediaPosition, index, LocaleID, TypeInfo); +end; + +function TBCMediaPosition.GetTypeInfoCount(out Count: Integer): HResult; +begin + result := Fbasedisp.GetTypeInfoCount(Count); +end; + +function TBCMediaPosition.Invoke(DispID: Integer; const IID: TGUID; + LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo, + ArgErr: Pointer): HResult; +var ti: ITypeInfo; +begin + // this parameter is a dead leftover from an earlier interface + if not IsEqualGUID(GUID_NULL, IID) then + begin + result := DISP_E_UNKNOWNINTERFACE; + exit; + end; + result := GetTypeInfo(0, LocaleID, ti); + if FAILED(result) then exit; + result := ti.Invoke(Pointer(Integer(Self)), DISPID, Flags, TDispParams(Params), VarResult, ExcepInfo, ArgErr); +end; + +{ TBCPosPassThru } + +function TBCPosPassThru.CanSeekBackward( + out pCanSeekBackward: Integer): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.CanSeekBackward(pCanSeekBackward); +end; + +function TBCPosPassThru.CanSeekForward( + out pCanSeekForward: Integer): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.CanSeekForward(pCanSeekForward); +end; + +function TBCPosPassThru.CheckCapabilities( + var pCapabilities: DWORD): HRESULT; +var + MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.CheckCapabilities(pCapabilities); +end; + +function TBCPosPassThru.ConvertTimeFormat(out pTarget: int64; + pTargetFormat: PGUID; Source: int64; pSourceFormat: PGUID): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat); +end; + +constructor TBCPosPassThru.Create(name: String; Unk: IUnknown; + out hr: HRESULT; Pin: IPin); +begin + assert(Pin <> nil); + inherited Create(Name,Unk); + FPin := Pin; +end; + +function TBCPosPassThru.ForceRefresh: HRESULT; +begin + result := S_OK; +end; + +function TBCPosPassThru.get_CurrentPosition( + out pllTime: TRefTime): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.get_CurrentPosition(pllTime); +end; + +function TBCPosPassThru.get_Duration(out plength: TRefTime): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.get_Duration(plength); +end; + +function TBCPosPassThru.get_PrerollTime(out pllTime: TRefTime): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.get_PrerollTime(pllTime); +end; + +function TBCPosPassThru.get_Rate(out pdRate: double): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.get_Rate(pdRate); +end; + +function TBCPosPassThru.get_StopTime(out pllTime: TRefTime): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.get_StopTime(pllTime); +end; + +function TBCPosPassThru.GetAvailable(out pEarliest, + pLatest: int64): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetAvailable(pEarliest, pLatest); +end; + +function TBCPosPassThru.GetCapabilities(out pCapabilities: DWORD): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetCapabilities(pCapabilities); +end; + +function TBCPosPassThru.GetCurrentPosition(out pCurrent: int64): HRESULT; +var + MS: IMediaSeeking; + Stop: int64; +begin + result := GetMediaTime(pCurrent, Stop); + if SUCCEEDED(result) then + result := NOERROR + else + begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetCurrentPosition(pCurrent) + end; +end; + +function TBCPosPassThru.GetDuration(out pDuration: int64): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetDuration(pDuration); +end; + +function TBCPosPassThru.GetMediaTime(out StartTime, + EndTime: Int64): HRESULT; +begin + result := E_FAIL; +end; + +// Return the IMediaPosition interface from our peer + +function TBCPosPassThru.GetPeer(out MP: IMediaPosition): HRESULT; +var + Connected: IPin; +begin + result := FPin.ConnectedTo(Connected); + if FAILED(result) then + begin + result := E_NOTIMPL; + exit; + end; + + result := Connected.QueryInterface(IID_IMediaPosition, MP); + Connected := nil; + if FAILED(result) then + begin + result := E_NOTIMPL; + exit; + end; + result := S_OK; +end; + +function TBCPosPassThru.GetPeerSeeking(out MS: IMediaSeeking): HRESULT; +var + Connected: IPin; +begin + MS := nil; + + result := FPin.ConnectedTo(Connected); + if FAILED(result) then + begin + result := E_NOTIMPL; + exit; + end; + + result := Connected.QueryInterface(IID_IMediaSeeking, MS); + Connected := nil; + if FAILED(result) then + begin + result := E_NOTIMPL; + exit; + end; + + result := S_OK; +end; + +function TBCPosPassThru.GetPositions(out pCurrent, pStop: int64): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetPositions(pCurrent, pStop); +end; + +function TBCPosPassThru.GetPreroll(out pllPreroll: int64): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetPreroll(pllPreroll); +end; + +function TBCPosPassThru.GetRate(out pdRate: double): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetRate(pdRate); +end; + +function TBCPosPassThru.GetStopPosition(out pStop: int64): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetStopPosition(pStop); +end; + +function TBCPosPassThru.GetTimeFormat(out pFormat: TGUID): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.GetTimeFormat(pFormat); +end; + +function TBCPosPassThru.IsFormatSupported(const pFormat: TGUID): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.IsFormatSupported(pFormat); +end; + +function TBCPosPassThru.IsUsingTimeFormat(const pFormat: TGUID): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.IsUsingTimeFormat(pFormat); +end; + +function TBCPosPassThru.put_CurrentPosition(llTime: TRefTime): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.put_CurrentPosition(llTime); +end; + +function TBCPosPassThru.put_PrerollTime(llTime: TRefTime): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.put_PrerollTime(llTime); +end; + +function TBCPosPassThru.put_Rate(dRate: double): HResult; +var MP: IMediaPosition; +begin + if (dRate = 0.0) then + begin + result := E_INVALIDARG; + exit; + end; + + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.put_Rate(dRate); +end; + +function TBCPosPassThru.put_StopTime(llTime: TRefTime): HResult; +var MP: IMediaPosition; +begin + result := GetPeer(MP); + if FAILED(result) then exit; + result := MP.put_StopTime(llTime); +end; + +function TBCPosPassThru.QueryPreferredFormat(out pFormat: TGUID): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.QueryPreferredFormat(pFormat); +end; + +function TBCPosPassThru.SetPositions(var pCurrent: int64; + dwCurrentFlags: DWORD; var pStop: int64; dwStopFlags: DWORD): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.SetPositions(pCurrent, dwCurrentFlags, pStop, dwStopFlags); +end; + +function TBCPosPassThru.SetRate(dRate: double): HRESULT; +var MS: IMediaSeeking; +begin + if (dRate = 0.0) then + begin + result := E_INVALIDARG; + exit; + end; + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.SetRate(dRate); +end; + +function TBCPosPassThru.SetTimeFormat(const pFormat: TGUID): HRESULT; +var MS: IMediaSeeking; +begin + result := GetPeerSeeking(MS); + if FAILED(result) then exit; + result := MS.SetTimeFormat(pFormat); +end; + +{ TBCRendererPosPassThru } + +// Media times (eg current frame, field, sample etc) are passed through the +// filtergraph in media samples. When a renderer gets a sample with media +// times in it, it will call one of the RegisterMediaTime methods we expose +// (one takes an IMediaSample, the other takes the media times direct). We +// store the media times internally and return them in GetCurrentPosition. + +constructor TBCRendererPosPassThru.Create(name: String; Unk: IUnknown; + out hr: HRESULT; Pin: IPin); +begin + inherited Create(Name,Unk,hr,Pin); + FStartMedia:= 0; + FEndMedia := 0; + FReset := True; + FPositionLock := TBCCritSec.Create; +end; + +destructor TBCRendererPosPassThru.destroy; +begin + FPositionLock.Free; + inherited; +end; + +// Intended to be called by the owing filter during EOS processing so +// that the media times can be adjusted to the stop time. This ensures +// that the GetCurrentPosition will actully get to the stop position. + +function TBCRendererPosPassThru.EOS: HRESULT; +var Stop: int64; +begin + if FReset then result := E_FAIL + else + begin + result := GetStopPosition(Stop); + if SUCCEEDED(result) then + begin + FPositionLock.Lock; + try + FStartMedia := Stop; + FEndMedia := Stop; + finally + FPositionLock.UnLock; + end; + end; + end; +end; + +function TBCRendererPosPassThru.GetMediaTime(out StartTime, + EndTime: int64): HRESULT; +begin + FPositionLock.Lock; + try + if FReset then + begin + result := E_FAIL; + exit; + end; + // We don't have to return the end time + result := ConvertTimeFormat(StartTime, nil, FStartMedia, @TIME_FORMAT_MEDIA_TIME); + if SUCCEEDED(result) then + result := ConvertTimeFormat(EndTime, nil, FEndMedia, @TIME_FORMAT_MEDIA_TIME); + finally + FPositionLock.UnLock; + end; +end; + +// Sets the media times the object should report + +function TBCRendererPosPassThru.RegisterMediaTime( + MediaSample: IMediaSample): HRESULT; +var StartMedia, EndMedia: TReferenceTime; +begin + ASSERT(assigned(MediaSample)); + FPositionLock.Lock; + try + // Get the media times from the sample + result := MediaSample.GetTime(StartMedia, EndMedia); + if FAILED(result) then + begin + ASSERT(result = VFW_E_SAMPLE_TIME_NOT_SET); + exit; + end; + FStartMedia := StartMedia; + FEndMedia := EndMedia; + FReset := FALSE; + result := NOERROR; + finally + FPositionLock.Unlock; + end; +end; + +// Sets the media times the object should report + +function TBCRendererPosPassThru.RegisterMediaTime(StartTime, + EndTime: int64): HRESULT; +begin + FPositionLock.Lock; + try + FStartMedia := StartTime; + FEndMedia := EndTime; + FReset := FALSE; + result := NOERROR; + finally + FPositionLock.UnLock; + end; +end; + +// Resets the media times we hold + +function TBCRendererPosPassThru.ResetMediaTime: HRESULT; +begin + FPositionLock.Lock; + try + FStartMedia := 0; + FEndMedia := 0; + FReset := True; + result := NOERROR; + finally + FPositionLock.UnLock; + end; +end; + +{ TBCAMEvent } + +function TBCAMEvent.Check: boolean; +begin + result := Wait(0); +end; + +constructor TBCAMEvent.Create(ManualReset: boolean); +begin + FEvent := CreateEvent(nil, ManualReset, FALSE, nil); +end; + +destructor TBCAMEvent.destroy; +begin + if FEvent <> 0 then + Assert(CloseHandle(FEvent)); + inherited; +end; + +procedure TBCAMEvent.Reset; +begin + ResetEvent(FEvent); +end; + +procedure TBCAMEvent.SetEv; +begin + SetEvent(FEvent); +end; + +function TBCAMEvent.Wait(Timeout: Cardinal): boolean; +begin + result := (WaitForSingleObject(FEvent, Timeout) = WAIT_OBJECT_0); +end; + +{ TBCRenderedInputPin } + +function TBCRenderedInputPin.Active: HRESULT; +begin + FAtEndOfStream := FALSE; + FCompleteNotified := FALSE; + result := inherited Active; +end; + +constructor TBCRenderedInputPin.Create(ObjectName: string; + Filter: TBCBaseFilter; Lock: TBCCritSec; out hr: HRESULT; + Name: WideString); +begin + inherited Create(ObjectName, Filter, Lock, hr, Name); + FAtEndOfStream := FALSE; + FCompleteNotified := FALSE; +end; + +procedure TBCRenderedInputPin.DoCompleteHandling; +begin + ASSERT(FAtEndOfStream); + if (not FCompleteNotified) then + begin + FCompleteNotified := True; + FFilter.NotifyEvent(EC_COMPLETE, S_OK, Integer(FFilter)); + end; +end; + +function TBCRenderedInputPin.EndFlush: HRESULT; +begin + FLock.Lock; + try + // Clean up renderer state + FAtEndOfStream := FALSE; + FCompleteNotified := FALSE; + result := inherited EndFlush; + finally + FLock.UnLock; + end; +end; + +function TBCRenderedInputPin.EndOfStream: HRESULT; +var + fs: TFilterState; +begin + result := CheckStreaming; + // Do EC_COMPLETE handling for rendered pins + if ((result = S_OK) and (not FAtEndOfStream)) then + begin + FAtEndOfStream := True; + ASSERT(SUCCEEDED(FFilter.GetState(0, fs))); + if (fs = State_Running) then + DoCompleteHandling; + end; +end; + +function TBCRenderedInputPin.Run(Start: TReferenceTime): HRESULT; +begin + FCompleteNotified := FALSE; + if FAtEndOfStream then DoCompleteHandling; + result := S_OK; +end; + +{ TBCAMMsgEvent } + +function TBCAMMsgEvent.WaitMsg(Timeout: DWord): boolean; +var + // wait for the event to be signalled, or for the + // timeout (in MS) to expire. allow SENT messages + // to be processed while we wait + Wait, StartTime: DWord; + // set the waiting period. + WaitTime: Dword; + Msg: TMsg; + Elapsed: DWord; +begin + WaitTime := Timeout; + + // the timeout will eventually run down as we iterate + // processing messages. grab the start time so that + // we can calculate elapsed times. + if (WaitTime <> INFINITE) then + StartTime := timeGetTime else + StartTime := 0; // don't generate compiler hint + + repeat + Wait := MsgWaitForMultipleObjects(1, FEvent, FALSE, WaitTime, QS_SENDMESSAGE); + if (Wait = WAIT_OBJECT_0 + 1) then + begin + + PeekMessage(Msg, 0, 0, 0, PM_NOREMOVE); + + // If we have an explicit length of time to wait calculate + // the next wake up point - which might be now. + // If dwTimeout is INFINITE, it stays INFINITE + if (WaitTime <> INFINITE) then + begin + Elapsed := timeGetTime - StartTime; + if (Elapsed >= Timeout) then + WaitTime := 0 else // wake up with WAIT_TIMEOUT + WaitTime := Timeout - Elapsed; + end; + end + until (Wait <> WAIT_OBJECT_0 + 1); + + // return True if we woke on the event handle, + // FALSE if we timed out. + result := (Wait = WAIT_OBJECT_0); +end; + +{ TBCAMThread } + +function TBCAMThread.CallWorker(Param: DWORD): DWORD; +begin + // lock access to the worker thread for scope of this object + FAccessLock.Lock; + try + if not ThreadExists then + begin + Result := DWORD(E_FAIL); + Exit; + end; + + // set the parameter + FParam := Param; + + // signal the worker thread + FEventSend.SetEv; + + // wait for the completion to be signalled + FEventComplete.Wait; + + // done - this is the thread's return value + Result := FReturnVal; + finally + FAccessLock.unlock; + end; +end; + +function TBCAMThread.CheckRequest(Param: PDWORD): boolean; +begin + if not FEventSend.Check then + begin + Result := FALSE; + Exit; + end else + begin + if (Param <> nil) then + Param^ := FParam; + Result := True; + end; +end; + +procedure TBCAMThread.Close; +var + Thread: THandle; +begin + Thread := InterlockedExchange(Integer(FThread), 0); + if BOOL(Thread) then + begin + WaitForSingleObject(Thread, INFINITE); + CloseHandle(Thread); + end; +end; + +class function TBCAMThread.CoInitializeHelper: HRESULT; +var + hr: HRESULT; + hOle: LongWord; + CoInitializeEx: function(pvReserved: Pointer; coInit: Longint): HResult; stdcall; +begin + // call CoInitializeEx and tell OLE not to create a window (this + // thread probably won't dispatch messages and will hang on + // broadcast msgs o/w). + // + // If CoInitEx is not available, threads that don't call CoCreate + // aren't affected. Threads that do will have to handle the + // failure. Perhaps we should fall back to CoInitialize and risk + // hanging? + // + + // older versions of ole32.dll don't have CoInitializeEx + + hr := E_FAIL; + hOle := GetModuleHandle(PChar('ole32.dll')); + if (hOle <> 0) then + begin + CoInitializeEx := GetProcAddress(hOle, 'CoInitializeEx'); + if (@CoInitializeEx <> nil) then + hr := CoInitializeEx(nil, COINIT_DISABLE_OLE1DDE); + end else + begin + {$IFDEF DEBUG} + // caller must load ole32.dll + DbgLog('couldn''t locate ole32.dll'); + {$ENDIF} + end; + result := hr; +end; + +constructor TBCAMThread.Create; +begin + // must be manual-reset for CheckRequest() + FAccessLock := TBCCritSec.Create; + FWorkerLock := TBCCritSec.Create; + FEventSend := TBCAMEvent.Create(True); + FEventComplete := TBCAMEvent.Create; + FThread := 0; + FThreadProc := nil; +end; + +function TBCAMThread.Create_: boolean; +var + threadid: DWORD; +begin + FAccessLock.Lock; + try + if ThreadExists then + begin + Result := False; + Exit; + end; + FThread := CreateThread(nil, 0, @TBCAMThread.InitialThreadProc, + Self, 0, threadid); + if not BOOL(FThread) then + Result := FALSE else + Result := True; + finally + FAccessLock.Unlock; + end; +end; + +destructor TBCAMThread.Destroy; +begin + Close; + FAccessLock.Free; + FWorkerLock.Free; + FEventSend.Free; + FEventComplete.Free; + inherited; +end; + +function TBCAMThread.GetRequest: DWORD; +begin + FEventSend.Wait; + Result := FParam; +end; + +function TBCAMThread.GetRequestHandle: THANDLE; +begin + Result := FEventSend.FEvent +end; + +function TBCAMThread.GetRequestParam: DWORD; +begin + Result := FParam; +end; + +function TBCAMThread.InitialThreadProc(p: Pointer): DWORD; +var + hrCoInit: HRESULT; +begin + hrCoInit := TBCAMThread.CoInitializeHelper; +{$IFDEF DEBUG} + if(FAILED(hrCoInit)) then + DbgLog('CoInitializeEx failed.'); +{$ENDIF} + Result := ThreadProc; + if(SUCCEEDED(hrCoInit)) then + CoUninitialize; +end; + +procedure TBCAMThread.Reply(v: DWORD); +begin + FReturnVal := v; + + // The request is now complete so CheckRequest should fail from + // now on + // + // This event should be reset BEFORE we signal the client or + // the client may Set it before we reset it and we'll then + // reset it (!) + + FEventSend.Reset; + + // Tell the client we're finished + + FEventComplete.SetEv; +end; + +function TBCAMThread.ThreadExists: boolean; +begin + Result := FThread <> 0; +end; + +function TBCAMThread.ThreadProc: DWord; +begin + if @FThreadProc <> nil then + Result := FThreadProc else + Result := 0 +end; + +{ TBCNode } + +{$ifdef DEBUG} +constructor TBCNode.Create; +begin + inherited Create('List node'); +end; +{$ENDIF} + +{ TBCNodeCache } + +procedure TBCNodeCache.AddToCache(Node: TBCNode); +begin + if (FUsed < FCacheSize) then + begin + Node.Next := FHead; + FHead := Node; + inc(FUsed); + end else + Node.Free; +end; + +constructor TBCNodeCache.Create(CacheSize: Integer); +begin + FCacheSize := CacheSize; + FHead := nil; + FUsed := 0; +end; + +destructor TBCNodeCache.Destroy; +var Node, Current: TBCNode; +begin + Node := FHead; + while (Node <> nil) do + begin + Current := Node; + Node := Node.Next; + Current.Free; + end; + inherited; +end; + +function TBCNodeCache.RemoveFromCache: TBCNode; +var Node: TBCNode; +begin + Node := FHead; + if (Node <> nil) then + begin + FHead := Node.Next; + Dec(FUsed); + ASSERT(FUsed >= 0); + end else + ASSERT(FUsed = 0); + Result := Node; +end; + +{ TBCBaseList } + +function TBCBaseList.AddAfter(p: Position; List: TBCBaseList): BOOL; +var pos: Position; +begin + pos := list.GetHeadPositionI; + while(pos <> nil) do + begin + // p follows along the elements being added + p := AddAfterI(p, List.GetI(pos)); + if (p = nil) then + begin + Result := FALSE; + Exit; + end; + pos := list.Next(pos); + end; + Result := True; +end; + +(* Add the object after position p + p is still valid after the operation. + AddAfter(NULL,x) adds x to the start - same as AddHead + Return the position of the new object, NULL if it failed +*) +function TBCBaseList.AddAfterI(pos: Position; Obj: Pointer): Position; +var After, Node, Before: TBCNode; +begin + if (pos = nil) then + Result := AddHeadI(Obj) else + begin + + (* As someone else might be furkling with the list - + Lock the critical section before continuing + *) + After := pos; + ASSERT(After <> nil); + if (After = FLast) then + Result := AddTailI(Obj) else + begin + + // set pnode to point to a new node, preferably from the cache + + Node := FCache.RemoveFromCache; + if (Node = nil) then + Node := TBCNode.Create; + + // Check we have a valid object + + if (Node = nil) then + Result := nil else + begin + + (* Initialise all the CNode object + just in case it came from the cache + *) + + Node.Data := Obj; + + (* It is to be added to the middle of the list - there is a before + and after node. Chain it after pAfter, before pBefore. + *) + Before := After.Next; + ASSERT(Before <> nil); + + // chain it in (set four pointers) + Node.Prev := After; + Node.Next := Before; + Before.Prev := Node; + After.Next := Node; + + inc(FCount); + + Result := Node; + end; + end; + end; +end; + +function TBCBaseList.AddBefore(p: Position; List: TBCBaseList): BOOL; +var pos: Position; +begin + pos := List.GetTailPositionI; + while (pos <> nil) do + begin + // p follows along the elements being added + p := AddBeforeI(p, List.GetI(pos)); + if (p = nil) then + begin + Result := FALSE; + Exit; + end; + pos := list.Prev(pos); + end; + Result := True; +end; + +(* Mirror images: + Add the element or list after position p. + p is still valid after the operation. + AddBefore(NULL,x) adds x to the end - same as AddTail +*) +function TBCBaseList.AddBeforeI(pos: Position; Obj: Pointer): Position; +var + Before, Node, After: TBCNode; +begin + if (pos = nil) then + Result := AddTailI(Obj) else + begin + // set pnode to point to a new node, preferably from the cache + + Before := pos; + ASSERT(Before <> nil); + if (Before = FFirst) then + Result := AddHeadI(Obj) else + begin + Node := FCache.RemoveFromCache; + if (Node = nil) then + Node := TBCNode.Create; + + // Check we have a valid object */ + + if (Node = nil) then + Result := nil else + begin + (* Initialise all the CNode object + just in case it came from the cache + *) + + Node.Data := Obj; + + (* It is to be added to the middle of the list - there is a before + and after node. Chain it after pAfter, before pBefore. + *) + + After := Before.Prev; + ASSERT(After <> nil); + + // chain it in (set four pointers) + Node.Prev := After; + Node.Next := Before; + Before.Prev := Node; + After.Next := Node; + + inc(FCount); + + Result := Node; + end; + end; + end; +end; + +(* Add all the elements in *pList to the head of this list. + Return True if it all worked, FALSE if it didn't. + If it fails some elements may have been added. +*) +function TBCBaseList.AddHead(List: TBCBaseList): BOOL; +var + pos: Position; +begin + (* lock the object before starting then enumerate + each entry in the source list and add them one by one to + our list (while still holding the object lock) + Lock the other list too. + + To avoid reversing the list, traverse it backwards. + *) + + pos := list.GetTailPositionI; + while (pos <> nil) do + begin + if (nil = AddHeadI(List.GetI(pos))) then + begin + Result := FALSE; + Exit; + end; + pos := list.Prev(pos) + end; + + Result := True; +end; + +(* Add this object to the head end of our list + Return the new head position. +*) +function TBCBaseList.AddHeadI(Obj: Pointer): Position; +var Node: TBCNode; +begin + (* If there is a node objects in the cache then use + that otherwise we will have to create a new one *) + + Node := FCache.RemoveFromCache; + if (Node = nil) then + Node := TBCNode.Create; + + // Check we have a valid object + + if (Node = nil) then + begin + Result := nil; + Exit; + end; + + (* Initialise all the CNode object + just in case it came from the cache + *) + + Node.Data := Obj; + + // chain it in (set four pointers) + Node.Prev := nil; + Node.Next := FFirst; + + if (FFirst = nil) then + FLast := Node; + FFirst.Prev := Node; + FFirst := Node; + + inc(FCount); + Result := Node; +end; + +(* Add all the elements in *pList to the tail of this list. + Return True if it all worked, FALSE if it didn't. + If it fails some elements may have been added. +*) +function TBCBaseList.AddTail(List: TBCBaseList): boolean; +var pos: Position; +begin + (* lock the object before starting then enumerate + each entry in the source list and add them one by one to + our list (while still holding the object lock) + Lock the other list too. + *) + Result := false; + pos := List.GetHeadPositionI; + while (pos <> nil) do + if (nil = AddTailI(List.GetNextI(pos))) then + Exit; + Result := True; +end; + +(* Add this object to the tail end of our list + Return the new tail position. +*) +function TBCBaseList.AddTailI(Obj: Pointer): Position; +var + Node: TBCNode; +begin + // Lock the critical section before continuing + + // ASSERT(pObject); // NULL pointers in the list are allowed. + + (* If there is a node objects in the cache then use + that otherwise we will have to create a new one *) + + Node := FCache.RemoveFromCache; + if (Node = nil) then + Node := TBCNode.Create; + + // Check we have a valid object + + if Node = nil then // HG: out of memory ??? + begin + Result := nil; + Exit; + end; + + (* Initialise all the CNode object + just in case it came from the cache + *) + + Node.Data := Obj; + Node.Next := nil; + Node.Prev := FLast; + + if (FLast = nil) then + FFirst := Node; + FLast.Next := Node; + + (* Set the new last node pointer and also increment the number + of list entries, the critical section is unlocked when we + exit the function + *) + + FLast := Node; + inc(FCount); + + Result := Node; +end; + +(* Constructor calls a separate initialisation function that + creates a node cache, optionally creates a lock object + and optionally creates a signaling object. + + By default we create a locking object, a DEFAULTCACHE sized + cache but no event object so the list cannot be used in calls + to WaitForSingleObject +*) +constructor TBCBaseList.Create(Name: string; Items: Integer = DEFAULTCACHE); +begin +{$ifdef DEBUG} + inherited Create(Name); +{$endif} + FFirst := nil; + FLast := nil; + FCount := 0; + FCache := TBCNodeCache.Create(Items); +end; + +(* The destructor enumerates all the node objects in the list and + in the cache deleting each in turn. We do not do any processing + on the objects that the list holds (i.e. points to) so if they + represent interfaces for example the creator of the list should + ensure that each of them is released before deleting us +*) +destructor TBCBaseList.Destroy; +begin + RemoveAll; + FCache.Free; + inherited; +end; + +(* Return the first position in the list which holds the given pointer. + Return NULL if it's not found. +*) +function TBCBaseList.FindI(Obj: Pointer): Position; +begin + Result := GetHeadPositionI; + while (Result <> nil) do + begin + if (GetI(Result) = Obj) then Exit; + Result := Next(Result); + end; +end; + +(* Get the number of objects in the list, + Get the lock before accessing the count. + Locking may not be entirely necessary but it has the side effect + of making sure that all operations are complete before we get it. + So for example if a list is being added to this list then that + will have completed in full before we continue rather than seeing + an intermediate albeit valid state +*) +function TBCBaseList.GetCountI: Integer; +begin + Result := FCount; +end; + +(* Return a position enumerator for the entire list. + A position enumerator is a pointer to a node object cast to a + transparent type so all we do is return the head/tail node + pointer in the list. + WARNING because the position is a pointer to a node there is + an implicit assumption for users a the list class that after + deleting an object from the list that any other position + enumerators that you have may be invalid (since the node + may be gone). +*) +function TBCBaseList.GetHeadPositionI: Position; +begin + result := Position(FFirst); +end; + +(* Return the object at p. + Asking for the object at NULL ASSERTs then returns NULL + The object is NOT locked. The list is not being changed + in any way. If another thread is busy deleting the object + then locking would only result in a change from one bad + behaviour to another. +*) +function TBCBaseList.GetI(p: Position): Pointer; +begin + if (p = nil) then + Result := nil else + Result := TBCNode(p).Data; +end; + +(* Return the object at rp, update rp to the next object from + the list or NULL if you have moved over the last object. + You may still call this function once we return NULL but + we will continue to return a NULL position value +*) +function TBCBaseList.GetNextI(var rp: Position): Pointer; +var + pn: TBCNode; +begin + // have we reached the end of the list + + if (rp = nil) then + Result := nil else + begin + // Lock the object before continuing + // Copy the original position then step on + + pn := rp; + ASSERT(pn <> nil); + rp := Position(pn.Next); + + // Get the object at the original position from the list + + Result := pn.Data; + end; +end; + +function TBCBaseList.GetTailPositionI: Position; +begin + Result := Position(FLast); +end; + +(* Mirror image of MoveToTail: + Split self before position p in self. + Retain in self the head portion of the original self + Add the tail portion to the start (i.e. head) of *pList + Return True if it all worked, FALSE if it didn't. + + e.g. + foo->MoveToHead(foo->GetTailPosition(), bar); + moves one element from the tail of foo to the head of bar + foo->MoveToHead(NULL, bar); + is a no-op + foo->MoveToHead(foo->GetHeadPosition, bar); + concatenates foo onto the start of bar and empties foo. +*) +function TBCBaseList.MoveToHead(pos: Position; List: TBCBaseList): boolean; +var + p: TBCNode; + m: Integer; +begin + // See the comments on the algorithm in MoveToTail + + if (pos = nil) then + Result := True else // no-op. Eliminates special cases later. + begin + // Make cMove the number of nodes to move + p := pos; + m := 0; // number of nodes to move + while(p <> nil) do + begin + p := p.Next; + inc(m); + end; + + // Join the two chains together + if (List.FFirst <> nil) then + List.FFirst.Prev := FLast; + if (FLast <> nil) then + FLast.Next := List.FFirst; + + // set first and last pointers + p := pos; + + if (List.FLast = nil) then + List.FLast := FLast; + + FLast := p.Prev; + if (FLast = nil) then + FFirst := nil; + List.FFirst := p; + + // Break the chain after p to create the new pieces + if (FLast <> nil) then + FLast.Next := nil; + p.Prev := nil; + + // Adjust the counts + dec(FCount, m); + inc(List.FCount, m); + + Result := True; + end; +end; + +(* Split self after position p in self + Retain as self the tail portion of the original self + Add the head portion to the tail end of *pList + Return True if it all worked, FALSE if it didn't. + + e.g. + foo->MoveToTail(foo->GetHeadPosition(), bar); + moves one element from the head of foo to the tail of bar + foo->MoveToTail(NULL, bar); + is a no-op + foo->MoveToTail(foo->GetTailPosition, bar); + concatenates foo onto the end of bar and empties foo. + + A better, except excessively long name might be + MoveElementsFromHeadThroughPositionToOtherTail +*) +function TBCBaseList.MoveToTail(pos: Position; List: TBCBaseList): boolean; +var + p: TBCNode; + m: Integer; +begin + (* Algorithm: + Note that the elements (including their order) in the concatenation + of *pList to the head of self is invariant. + 1. Count elements to be moved + 2. Join *pList onto the head of this to make one long chain + 3. Set first/Last pointers in self and *pList + 4. Break the chain at the new place + 5. Adjust counts + 6. Set/Reset any events + *) + + if (pos = nil) then + Result := True else // no-op. Eliminates special cases later. + begin + + // Make m the number of nodes to move + p := pos; + m := 0; // number of nodes to move + while(p <> nil) do + begin + p := p.Prev; + inc(m); + end; + + // Join the two chains together + if (List.FLast <> nil) then + List.FLast.Next := FFirst; + if (FFirst <> nil) then + FFirst.Prev := List.FLast; + + + // set first and last pointers + p := pos; + + if (List.FFirst = nil) then + List.FFirst := FFirst; + FFirst := p.Next; + if (FFirst = nil) then + FLast := nil; + List.FLast := p; + + + // Break the chain after p to create the new pieces + if (FFirst <> nil) then + FFirst.Prev := nil; + p.Next := nil; + + + // Adjust the counts + dec(FCount, m); + inc(List.FCount, m); + + Result := True; + end; + +end; + +function TBCBaseList.Next(pos: Position): Position; +begin + if (pos = nil) then + Result := Position(FFirst) else + Result := Position(TBCNode(pos).Next); +end; + +function TBCBaseList.Prev(pos: Position): Position; +begin + if (pos = nil) then + Result := Position(FLast) else + Result := Position(TBCNode(pos).Prev); +end; + +(* Remove all the nodes from the list but don't do anything + with the objects that each node looks after (this is the + responsibility of the creator). + Aa a last act we reset the signalling event + (if available) to indicate to clients that the list + does not have any entries in it. +*) +procedure TBCBaseList.RemoveAll; +var pn, op: TBCNode; +begin + (* Free up all the CNode objects NOTE we don't bother putting the + deleted nodes into the cache as this method is only really called + in serious times of change such as when we are being deleted at + which point the cache will be deleted anyway *) + + pn := FFirst; + while (pn <> nil) do + begin + op := pn; + pn := pn.Next; + op.Free; + end; + + (* Reset the object count and the list pointers *) + + FCount := 0; + FFirst := nil; + FLast := nil; +end; + +(* Remove the first node in the list (deletes the pointer to its object + from the list, does not free the object itself). + Return the pointer to its object or NULL if empty +*) +function TBCBaseList.RemoveHeadI: Pointer; +begin + (* All we do is get the head position and ask for that to be deleted. + We could special case this since some of the code path checking + in Remove() is redundant as we know there is no previous + node for example but it seems to gain little over the + added complexity + *) + + Result := RemoveI(FFirst); +end; + +(* Remove the pointer to the object in this position from the list. + Deal with all the chain pointers + Return a pointer to the object removed from the list. + The node object that is freed as a result + of this operation is added to the node cache where + it can be used again. + Remove(NULL) is a harmless no-op - but probably is a wart. +*) +function TBCBaseList.RemoveI(pos: Position): Pointer; +var + Current, Node: TBCNode; +begin + (* Lock the critical section before continuing *) + + if (pos = nil) then + Result := nil else + begin + Current := pos; + ASSERT(Current <> nil); + // Update the previous node + + Node := Current.Prev; + if (Node = nil) then + FFirst := Current.Next else + Node.Next := Current.Next; + + // Update the following node + + Node := Current.Next; + if (Node = nil) then + FLast := Current.Prev else + Node.Prev := Current.Prev; + + // Get the object this node was looking after */ + Result := Current.Data; + + // ASSERT(pObject != NULL); // NULL pointers in the list are allowed. + + (* Try and add the node object to the cache - + a NULL return code from the cache means we ran out of room. + The cache size is fixed by a constructor argument when the + list is created and defaults to DEFAULTCACHE. + This means that the cache will have room for this many + node objects. So if you have a list of media samples + and you know there will never be more than five active at + any given time of them for example then override the default + constructor + *) + + FCache.AddToCache(Current); + + // If the list is empty then reset the list event + + Dec(FCount); + ASSERT(FCount >= 0); + end; +end; + +(* Remove the last node in the list (deletes the pointer to its object + from the list, does not free the object itself). + Return the pointer to its object or NULL if empty +*) +function TBCBaseList.RemoveTailI: Pointer; +begin + (* All we do is get the tail position and ask for that to be deleted. + We could special case this since some of the code path checking + in Remove() is redundant as we know there is no previous + node for example but it seems to gain little over the + added complexity + *) + Result := RemoveI(FLast); +end; + +(* Reverse the order of the [pointers to] objects in slef *) +procedure TBCBaseList.Reverse; +var p, q: TBCNode; +begin + (* algorithm: + The obvious booby trap is that you flip pointers around and lose + addressability to the node that you are going to process next. + The easy way to avoid this is do do one chain at a time. + + Run along the forward chain, + For each node, set the reverse pointer to the one ahead of us. + The reverse chain is now a copy of the old forward chain, including + the NULL termination. + + Run along the reverse chain (i.e. old forward chain again) + For each node set the forward pointer of the node ahead to point back + to the one we're standing on. + The first node needs special treatment, + it's new forward pointer is NULL. + Finally set the First/Last pointers + + *) + + // Yes we COULD use a traverse, but it would look funny! + p := FFirst; + while (p <> nil) do + begin + q := p.Next; + p.Next := p.Prev; + p.Prev := q; + p := q; + end; + p := FFirst; + FFirst := FLast; + FLast := p; +end; + +{ TBCSource } + +function TBCSource.AddPin(Stream: TBCSourceStream): HRESULT; +begin + FStateLock.Lock; + try + inc(FPins); + ReallocMem(FStreams, FPins * SizeOf(TBCSourceStream)); + TStreamArray(FStreams)[FPins-1] := Stream; + Result := S_OK; + finally + FStateLock.UnLock; + end; +end; +// milenko start (delphi 5 doesn't IInterface - changed IInterface to IUnknown) +constructor TBCSource.Create(const Name: string; unk: IUnknown; +// milenko end + const clsid: TGUID; out hr: HRESULT); +begin + FStateLock := TBCCritSec.Create; + // nev: changed 02/17/04 + inherited Create(Name, unk, FStateLock, clsid, hr); + FPins := 0; + FStreams := nil; +end; + +// milenko start (delphi 5 doesn't IInterface - changed IInterface to IUnknown) +constructor TBCSource.Create(const Name: string; unk: IUnknown; +// milenko end + const clsid: TGUID); +begin + FStateLock := TBCCritSec.Create; + inherited Create(Name, unk, FStateLock, clsid); + FPins := 0; + FStreams := nil; +end; + +destructor TBCSource.Destroy; +begin + // Free our pins and pin array + while (FPins <> 0) do + // deleting the pins causes them to be removed from the array... + TStreamArray(FStreams)[FPins - 1].Free; + if Assigned(FStreams) then FreeMem(FStreams); + ASSERT(FPins = 0); + inherited; +end; + +// Set Pin to the IPin that has the id Id. +// or to nil if the Id cannot be matched. +function TBCSource.FindPin(Id: PWideChar; out Pin: IPin): HRESULT; +var + i : integer; + Code : integer; +begin + // The -1 undoes the +1 in QueryId and ensures that totally invalid + // strings (for which WstrToInt delivers 0) give a deliver a NULL pin. + + // DCoder (1. Nov 2003) + // StrToInt throws EConvertError Exceptions if + // a Filter calls FindPin with a String instead of a Number in ID. + // To be sure, capture the Error Handling by using Val and call + // the inherited function if Val fails. + + Val(Id,i,Code); + if Code = 0 then + begin + i := i - 1; + Pin := GetPin(i); + if (Pin <> nil) then + Result := NOERROR else + Result := VFW_E_NOT_FOUND; + end else Result := inherited FindPin(Id,Pin); +end; + +// return the number of the pin with this IPin or -1 if none +function TBCSource.FindPinNumber(Pin: IPin): Integer; +begin + for Result := 0 to FPins - 1 do + if (IPin(TStreamArray(FStreams)[Result]) = Pin) then + Exit; + Result := -1; +end; + +// Return a non-addref'd pointer to pin n +// needed by CBaseFilter +function TBCSource.GetPin(n: Integer): TBCBasePin; +begin + FStateLock.Lock; + try + // n must be in the range 0..m_iPins-1 + // if m_iPins>n && n>=0 it follows that m_iPins>0 + // which is what used to be checked (i.e. checking that we have a pin) + if ((n >= 0) and (n < FPins)) then + begin + ASSERT(TStreamArray(FStreams)[n] <> nil); + Result := TStreamArray(FStreams)[n]; + end else + Result := nil; + finally + FStateLock.UnLock; + end; +end; + +// Returns the number of pins this filter has +function TBCSource.GetPinCount: Integer; +begin + FStateLock.Lock; + try + Result := FPins; + finally + FStateLock.UnLock; + end; +end; + +function TBCSource.RemovePin(Stream: TBCSourceStream): HRESULT; +var i, j: Integer; +begin + for i := 0 to FPins - 1 do + begin + if (TStreamArray(FStreams)[i] = Stream) then + begin + if (FPins = 1) then + begin + FreeMem(FStreams); + FStreams := nil; + end else + begin + // no need to reallocate + j := i + 1; + while (j < FPins) do + begin + TStreamArray(FStreams)[j-1] := TStreamArray(FStreams)[j]; + inc(j); + end; + end; + dec(FPins); + Result := S_OK; + Exit; + end; + end; + Result := S_FALSE; +end; + +{ TBCSourceStream } + +// The pin is active - start up the worker thread +function TBCSourceStream.Active: HRESULT; +begin + FFilter.FStateLock.Lock; + try + if (FFilter.IsActive) then + begin + Result := S_FALSE; // succeeded, but did not allocate resources (they already exist...) + Exit; + end; + + // do nothing if not connected - its ok not to connect to + // all pins of a source filter + if not IsConnected then + begin + Result := NOERROR; + Exit; + end; + + Result := inherited Active; + if FAILED(Result) then + Exit; + + ASSERT(not FThread.ThreadExists); + + // start the thread + if not FThread.Create_ then + begin + Result := E_FAIL; + Exit; + end; + + // Tell thread to initialize. If OnThreadCreate Fails, so does this. + Result := Init; + if FAILED(Result) then + Exit; + + Result := Pause; + finally + FFilter.FStateLock.UnLock; + end; +end; + +// Do we support this type? Provides the default support for 1 type. +function TBCSourceStream.CheckMediaType(MediaType: PAMMediaType): HRESULT; +var mt: TAMMediaType; + pmt: PAMMediaType; +begin + FFilter.FStateLock.Lock; + try + pmt := @mt; + GetMediaType(pmt); + if TBCMediaType(pmt).Equal(MediaType) then + Result := NOERROR else + Result := E_FAIL; + finally + FFilter.FStateLock.UnLock; + end; +end; + +function TBCSourceStream.CheckRequest(var com: TThreadCommand): boolean; +begin + Result := FThread.CheckRequest(@Com); +end; + +// increments the number of pins present on the filter +constructor TBCSourceStream.Create(const ObjectName: string; + out hr: HRESULT; Filter: TBCSource; const Name: WideString); +begin + FThread := TBCAMThread.Create; + FThread.FThreadProc := ThreadProc; + inherited Create(ObjectName, Filter, Filter.FStateLock, hr, Name); + FFilter := Filter; + hr := FFilter.AddPin(Self); +end; + +// Decrements the number of pins on this filter +destructor TBCSourceStream.Destroy; +begin + FFilter.RemovePin(Self); + inherited; + FThread.Free; +end; + +// Grabs a buffer and calls the users processing function. +// Overridable, so that different delivery styles can be catered for. +function TBCSourceStream.DoBufferProcessingLoop: HRESULT; +var + com: TThreadCommand; + Sample: IMediaSample; +begin + + OnThreadStartPlay; + repeat + begin + while not CheckRequest(com) do + begin + Result := GetDeliveryBuffer(Sample, nil, nil, 0); + if FAILED(result) then + begin + Sleep(1); + continue; // go round again. Perhaps the error will go away + // or the allocator is decommited & we will be asked to + // exit soon. + end; + + // Virtual function user will override. + Result := FillBuffer(Sample); + + if (Result = S_OK) then + begin + Result := Deliver(Sample); + Sample := nil; + // downstream filter returns S_FALSE if it wants us to + // stop or an error if it's reporting an error. + if (Result <> S_OK) then + begin + {$IFDEF DEBUG} + DbgLog(format('Deliver() returned %08x; stopping', [Result])); + {$ENDIF} + Result := S_OK; + Exit; + end; + end else + if (Result = S_FALSE) then + begin + // derived class wants us to stop pushing data + Sample := nil; + DeliverEndOfStream; + Result := S_OK; + Exit; + end else + begin + // derived class encountered an error + Sample := nil; + {$IFDEF DEBUG} + DbgLog(format('Error %08lX from FillBuffer!!!', [Result])); + {$ENDIF} + DeliverEndOfStream; + FFilter.NotifyEvent(EC_ERRORABORT, Result, 0); + Exit; + end; + // all paths release the sample + end; + + // For all commands sent to us there must be a Reply call! + + if ((com = CMD_RUN) or (com = CMD_PAUSE)) then + FThread.Reply(NOERROR) else + if (com <> CMD_STOP) then + begin + Fthread.Reply(DWORD(E_UNEXPECTED)); + {$IFDEF DEBUG} + DbgLog('Unexpected command!!!'); + {$ENDIF} + end + end until (com = CMD_STOP); + Result := S_FALSE; +end; + +function TBCSourceStream.Exit_: HRESULT; +begin + Result := FThread.CallWorker(Ord(CMD_EXIT)); +end; + +function TBCSourceStream.GetMediaType(MediaType: PAMMediaType): HRESULT; +begin + Result := E_UNEXPECTED; +end; + +function TBCSourceStream.GetMediaType(Position: integer; + out MediaType: PAMMediaType): HRESULT; +begin + // By default we support only one type + // Position indexes are 0-n + FFilter.FStateLock.Lock; + try + if (Position = 0) then + Result := GetMediaType(MediaType) + else + if (Position > 0) then + Result := VFW_S_NO_MORE_ITEMS else + Result := E_INVALIDARG; + finally + FFilter.FStateLock.UnLock; + end; +end; + +function TBCSourceStream.GetRequest: TThreadCommand; +begin + Result := TThreadCommand(FThread.GetRequest); +end; + +// Pin is inactive - shut down the worker thread +// Waits for the worker to exit before returning. +function TBCSourceStream.Inactive: HRESULT; +begin + FFilter.FStateLock.Lock; + try + + // do nothing if not connected - its ok not to connect to + // all pins of a source filter + if not IsConnected then + begin + Result := NOERROR; + Exit; + end; + + // !!! need to do this before trying to stop the thread, because + // we may be stuck waiting for our own allocator!!! + + Result := inherited Inactive; // call this first to Decommit the allocator + if FAILED(Result) then + Exit; + + if FThread.ThreadExists then + begin + Result := Stop; + + if FAILED(Result) then + Exit; + + Result := Exit_; + if FAILED(Result) then + Exit; + + FThread.Close; // Wait for the thread to exit, then tidy up. + end; + + Result := NOERROR; + finally + FFilter.FStateLock.UnLock; + end; +end; + +function TBCSourceStream.Init: HRESULT; +begin + Result := FThread.CallWorker(Ord(CMD_INIT)); +end; + +function TBCSourceStream.OnThreadCreate: HRESULT; +begin + Result := NOERROR; +end; + +function TBCSourceStream.OnThreadDestroy: HRESULT; +begin + Result := NOERROR; +end; + +function TBCSourceStream.OnThreadStartPlay: HRESULT; +begin + Result := NOERROR; +end; + +function TBCSourceStream.Pause: HRESULT; +begin + Result := FThread.CallWorker(Ord(CMD_PAUSE)); +end; + +// Set Id to point to a CoTaskMemAlloc'd +function TBCSourceStream.QueryId(out id: PWideChar): HRESULT; +var + i: Integer; +begin + // We give the pins id's which are 1,2,... + // FindPinNumber returns -1 for an invalid pin + i := 1 + FFilter.FindPinNumber(Self); + if (i < 1) then + Result := VFW_E_NOT_FOUND else + Result := AMGetWideString(IntToStr(i), id); +end; + +function TBCSourceStream.Run: HRESULT; +begin + Result := FThread.CallWorker(Ord(CMD_RUN)); +end; + +function TBCSourceStream.Stop: HRESULT; +begin + Result := FThread.CallWorker(Ord(CMD_STOP)); +end; + +// When this returns the thread exits +// Return codes > 0 indicate an error occured +function TBCSourceStream.ThreadProc: DWORD; +var + com, cmd: TThreadCommand; +begin + repeat + com := GetRequest; + if (com <> CMD_INIT) then + begin + {$IFDEF DEBUG} + DbgLog(self, 'Thread expected init command'); + {$ENDIF} + FThread.Reply(DWORD(E_UNEXPECTED)); + end; + until (com = CMD_INIT); + {$IFDEF DEBUG} + DbgLog(self, 'Worker thread initializing'); + {$ENDIF} + + Result := OnThreadCreate; // perform set up tasks + if FAILED(Result) then + begin + {$IFDEF DEBUG} + DbgLog(Self, 'OnThreadCreate failed. Aborting thread.'); + {$ENDIF} + OnThreadDestroy(); + FThread.Reply(Result); // send failed return code from OnThreadCreate + Result := 1; + Exit; + end; + + // Initialisation suceeded + FThread.Reply(NOERROR); + + repeat + cmd := GetRequest; + // nev: changed 02/17/04 + // "repeat..until false" ensures, that if cmd = CMD_RUN + // the next executing block will be CMD_PAUSE handler block. + // This corresponds to the original C "switch" functionality + repeat + case cmd of + CMD_EXIT, CMD_STOP: + begin + FThread.Reply(NOERROR); + Break; + end; + CMD_RUN: + begin + {$IFDEF DEBUG} + DbgLog(Self, 'CMD_RUN received before a CMD_PAUSE???'); + {$ENDIF} + // !!! fall through??? + cmd := CMD_PAUSE; + end; + CMD_PAUSE: + begin + FThread.Reply(NOERROR); + DoBufferProcessingLoop; + Break; + end; + else + {$IFDEF DEBUG} + DbgLog(self, format('Unknown command %d received!', [Integer(cmd)])); + {$ENDIF} + FThread.Reply(DWORD(E_NOTIMPL)); + Break; + end; + until False; + until (cmd = CMD_EXIT); + + Result := OnThreadDestroy; // tidy up. + if FAILED(Result) then + begin + {$IFDEF DEBUG} + DbgLog(self, 'OnThreadDestroy failed. Exiting thread.'); + {$ENDIF} + Result := 1; + Exit; + end; +{$IFDEF DEBUG} + DbgLog(Self, 'worker thread exiting'); +{$ENDIF} + Result := 0; +end; + +function TimeKillSynchronousFlagAvailable: Boolean; +var + osverinfo: TOSVERSIONINFO; +begin + osverinfo.dwOSVersionInfoSize := sizeof(osverinfo); + if GetVersionEx(osverinfo) then + // Windows XP's major version is 5 and its' minor version is 1. + // timeSetEvent() started supporting the TIME_KILL_SYNCHRONOUS flag + // in Windows XP. + Result := (osverinfo.dwMajorVersion > 5) or + ((osverinfo.dwMajorVersion = 5) and (osverinfo.dwMinorVersion >= 1)) + else + Result := False; +end; + +function CompatibleTimeSetEvent(Delay, Resolution: UINT; + TimeProc: TFNTimeCallBack; User: DWORD; Event: UINT): MMResult; +// milenko start (replaced with global variables) +//const +//{$IFOPT J-} +//{$DEFINE ResetJ} +//{$J+} +//{$ENDIF} +// IsCheckedVersion: Bool = False; +// IsTimeKillSynchronousFlagAvailable: Bool = False; +//{$IFDEF ResetJ} +//{$J-} +//{$UNDEF ResetJ} +//{$ENDIF} +const + TIME_KILL_SYNCHRONOUS = $100; +// Milenko end +var + Event_: UINT; +begin + Event_ := Event; + // ??? TIME_KILL_SYNCHRONOUS flag is defined in MMSystem for XP: + // need to check that D7 unit for proper compilation flag +// Milenko start (no need for "ifdef xp" in delphi) +// {$IFDEF XP} + if not IsCheckedVersion then + begin + IsTimeKillSynchronousFlagAvailable := TimeKillSynchronousFlagAvailable; + IsCheckedVersion := true; + end; + + if IsTimeKillSynchronousFlagAvailable then + Event_ := Event_ or TIME_KILL_SYNCHRONOUS; +// {$ENDIF} +// Milenko end + Result := timeSetEvent(Delay, Resolution, TimeProc, User, Event_); +end; + +// ??? See Measure.h for Msr_??? definition +// milenko start (only needed with PERF) +{$IFDEF PERF} +type + TIncidentRec = packed record + Name: String[255]; + end; + TIncidentLog = packed record + Id: Integer; + Time: TReferenceTime; + Data: Integer; + Note: String[10]; + end; + +var + Incidents: array of TIncidentRec; + IncidentsLog: array of TIncidentLog; +{$ENDIF} +// milenko end +function MSR_REGISTER(s: String): Integer; +// milenko start (only needed with PERF) +{$IFDEF PERF} +var + k: Integer; +{$ENDIF} +// milenko end +begin +// milenko start (only needed with PERF) +{$IFDEF PERF} + k := Length(Incidents) + 1; + SetLength(Incidents, k); + Incidents[k-1].Name := Copy(s, 0, 255); + Result := k-1; +{$ELSE} + Result := 0; +{$ENDIF} +// milenko end +end; + +procedure MSR_START(Id_: Integer); +{$IFDEF PERF} +var + k: Integer; +{$ENDIF} +begin +{$IFDEF PERF} + Assert((Id_>=0) and (Id_=0) and (Id_=0) and (Id_ 50 * UNITS) then + Result := 50 * UNITS + else + Result := Integer(rt); +end; + +// Implements the CBaseRenderer class + +constructor TBCBaseRenderer.Create(RendererClass: TGUID; Name: PChar; + Unk: IUnknown; hr: HResult); +begin + FInterfaceLock := TBCCritSec.Create; + FRendererLock := TBCCritSec.Create; + FObjectCreationLock := TBCCritSec.Create; + + inherited Create(Name, Unk, FInterfaceLock, RendererClass); + + FCompleteEvent := TBCAMEvent.Create(True); + FRenderEvent := TBCAMEvent.Create(True); + FAbort := False; + FPosition := nil; + FThreadSignal := TBCAMEvent.Create(True); + FIsStreaming := False; + FIsEOS := False; + FIsEOSDelivered := False; + FMediaSample := nil; + FAdvisedCookie := 0; + FQSink := nil; + FInputPin := nil; + FRepaintStatus := True; + FSignalTime := 0; + FInReceive := False; + FEndOfStreamTimer := 0; + + Ready; +{$IFDEF PERF} + FBaseStamp := MSR_REGISTER('BaseRenderer: sample time stamp'); + FBaseRenderTime := MSR_REGISTER('BaseRenderer: draw time(msec)'); + FBaseAccuracy := MSR_REGISTER('BaseRenderer: Accuracy(msec)'); +{$ENDIF} +end; + +// Delete the dynamically allocated IMediaPosition and IMediaSeeking helper +// object. The object is created when somebody queries us. These are standard +// control interfaces for seeking and setting start/stop positions and rates. +// We will probably also have made an input pin based on CRendererInputPin +// that has to be deleted, it's created when an enumerator calls our GetPin + +destructor TBCBaseRenderer.Destroy; +begin + Assert(not FIsStreaming); + Assert(FEndOfStreamTimer = 0); + StopStreaming; + ClearPendingSample; + + // Delete any IMediaPosition implementation + + if Assigned(FPosition) then + FreeAndNil(FPosition); + + // Delete any input pin created + + if Assigned(FInputPin) then + FreeAndNil(FInputPin); + + // Release any Quality sink + + Assert(FQSink = nil); + + // Release critical sections objects + // ??? will be deleted by the parent class destroy FreeAndNil(FInterfaceLock); + FreeAndNil(FRendererLock); + FreeAndNil(FObjectCreationLock); + + FreeAndNil(FCompleteEvent); + FreeAndNil(FRenderEvent); + FreeAndNil(FThreadSignal); + + inherited Destroy; +end; + +// This returns the IMediaPosition and IMediaSeeking interfaces + +function TBCBaseRenderer.GetMediaPositionInterface(IID: TGUID; + out Obj): HResult; +var + hr: HResult; + +begin + FObjectCreationLock.Lock; + try + if Assigned(FPosition) then + begin +// Milenko start +// Result := FPosition.QueryInterface(IID, Obj); + Result := FPosition.NonDelegatingQueryInterface(IID, Obj); +// Milenko end + Exit; + end; + + hr := NOERROR; + + // Create implementation of this dynamically since sometimes we may + // never try and do a seek. The helper object implements a position + // control interface (IMediaPosition) which in fact simply takes the + // calls normally from the filter graph and passes them upstream + + //hr := CreatePosPassThru(GetOwner, False, GetPin(0), FPosition); + FPosition := TBCRendererPosPassThru.Create('Renderer TBCPosPassThru', + Inherited GetOwner, hr, GetPin(0)); + if (FPosition = nil) then + begin + Result := E_OUTOFMEMORY; + Exit; + end; + if (Failed(hr)) then + begin + FreeAndNil(FPosition); + Result := E_NOINTERFACE; + Exit; + end; +// milenko start (needed or the class will destroy itself. Disadvantage=Destructor is not called) +// Solution is to keep FPosition alive without adding a Reference Count to it. But how??? + FPosition._AddRef; +// milenko end + + Result := GetMediaPositionInterface(IID, Obj); + finally + FObjectCreationLock.UnLock; + end; +end; + +// milenko start (workaround for destructor issue with FPosition) +function TBCBaseRenderer.JoinFilterGraph(pGraph: IFilterGraph; + pName: PWideChar): HRESULT; +begin + if (pGraph = nil) and (FPosition <> nil) then + begin + FPosition._Release; + Pointer(FPosition) := nil; + end; + Result := inherited JoinFilterGraph(pGraph,pName); +end; +// milenko end + +// Overriden to say what interfaces we support and where + +function TBCBaseRenderer.NonDelegatingQueryInterface(const IID: TGUID; + out Obj): HResult; +begin +// Milenko start (removed unnessacery code) + // Do we have this interface + if IsEqualGUID(IID, IID_IMediaPosition) or IsEqualGUID(IID, IID_IMediaSeeking) + then Result := GetMediaPositionInterface(IID,Obj) + else Result := inherited NonDelegatingQueryInterface(IID, Obj); +// Milenko end +end; + +// This is called whenever we change states, we have a manual reset event that +// is signalled whenever we don't won't the source filter thread to wait in us +// (such as in a stopped state) and likewise is not signalled whenever it can +// wait (during paused and running) this function sets or resets the thread +// event. The event is used to stop source filter threads waiting in Receive + +function TBCBaseRenderer.SourceThreadCanWait(CanWait: Boolean): HResult; +begin + if CanWait then + FThreadSignal.Reset + else + FThreadSignal.SetEv; + Result := NOERROR; +end; + +{$IFDEF DEBUG} +// Dump the current renderer state to the debug terminal. The hardest part of +// the renderer is the window where we unlock everything to wait for a clock +// to signal it is time to draw or for the application to cancel everything +// by stopping the filter. If we get things wrong we can leave the thread in +// WaitForRenderTime with no way for it to ever get out and we will deadlock + +procedure TBCBaseRenderer.DisplayRendererState; +var + bSignalled, bFlushing: Boolean; + CurrentTime, StartTime, EndTime, Offset, Wait: TReferenceTime; + + function RT_in_Millisecs(rt: TReferenceTime): Int64; + begin + Result := rt div 10000; + end; + +begin + DbgLog(Self, 'Timed out in WaitForRenderTime'); + + // No way should this be signalled at this point + + bSignalled := FThreadSignal.Check; + + DbgLog(Self, Format('Signal sanity check %d', [Byte(bSignalled)])); + + // Now output the current renderer state variables + + DbgLog(Self, Format('Filter state %d', [Ord(FState)])); + + DbgLog(Self, Format('Abort flag %d', [Byte(FAbort)])); + + DbgLog(Self, Format('Streaming flag %d', [Byte(FIsStreaming)])); + + DbgLog(Self, Format('Clock advise link %d', [FAdvisedCookie])); + +// DbgLog(Self, Format('Current media sample %x', [FMediaSample])); + + DbgLog(Self, Format('EOS signalled %d', [Byte(FIsEOS)])); + + DbgLog(Self, Format('EOS delivered %d', [Byte(FIsEOSDelivered)])); + + DbgLog(Self, Format('Repaint status %d', [Byte(FRepaintStatus)])); + + // Output the delayed end of stream timer information + + DbgLog(Self, Format('End of stream timer %x', [FEndOfStreamTimer])); + + // ??? convert reftime to str + // DbgLog((LOG_TIMING, 1, TEXT("Deliver time %s"),CDisp((LONGLONG)FSignalTime))); + DbgLog(Self, Format('Deliver time %d', [FSignalTime])); + + // Should never timeout during a flushing state + + bFlushing := FInputPin.IsFlushing; + + DbgLog(Self, Format('Flushing sanity check %d', [Byte(bFlushing)])); + + // Display the time we were told to start at +// ??? DbgLog((LOG_TIMING, 1, TEXT("Last run time %s"),CDisp((LONGLONG)m_tStart.m_time))); + DbgLog(Self, Format('Last run time %d', [FStart])); + + // Have we got a reference clock + if (FClock = nil) then + Exit; + + // Get the current time from the wall clock + + FClock.GetTime(int64(CurrentTime)); + Offset := CurrentTime - FStart; + + // Display the current time from the clock + + DbgLog(Self, Format('Clock time %d', [CurrentTime])); + + DbgLog(Self, Format('Time difference %d ms', [RT_in_Millisecs(Offset)])); + + // Do we have a sample ready to render + if (FMediaSample = nil) then + Exit; + + FMediaSample.GetTime(StartTime, EndTime); + DbgLog(Self, Format('Next sample stream times (Start %d End %d ms)', + [RT_in_Millisecs(StartTime), RT_in_Millisecs(EndTime)])); + // Calculate how long it is until it is due for rendering + Wait := (FStart + StartTime) - CurrentTime; + DbgLog(Self, Format('Wait required %d ms', [RT_in_Millisecs(Wait)])); +end; +{$ENDIF} + +// Wait until the clock sets the timer event or we're otherwise signalled. We +// set an arbitrary timeout for this wait and if it fires then we display the +// current renderer state on the debugger. It will often fire if the filter's +// left paused in an application however it may also fire during stress tests +// if the synchronisation with application seeks and state changes is faulty + +const + RENDER_TIMEOUT = 10000; + +function TBCBaseRenderer.WaitForRenderTime: HResult; +var + WaitObjects: array[0..1] of THandle; + +begin + WaitObjects[0] := FThreadSignal.Handle; + WaitObjects[1] := FRenderEvent.Handle; + + DWord(Result) := WAIT_TIMEOUT; + + // Wait for either the time to arrive or for us to be stopped + + OnWaitStart; + while (Result = WAIT_TIMEOUT) do + begin + Result := WaitForMultipleObjects(2, @WaitObjects, False, RENDER_TIMEOUT); + +{$IFDEF DEBUG} + if (Result = WAIT_TIMEOUT) then + DisplayRendererState; +{$ENDIF} + end; + OnWaitEnd; + + // We may have been awoken without the timer firing + + if (Result = WAIT_OBJECT_0) then + begin + Result := VFW_E_STATE_CHANGED; + Exit; + end; + + SignalTimerFired; + Result := NOERROR; +end; + +// Poll waiting for Receive to complete. This really matters when +// Receive may set the palette and cause window messages +// The problem is that if we don't really wait for a renderer to +// stop processing we can deadlock waiting for a transform which +// is calling the renderer's Receive() method because the transform's +// Stop method doesn't know to process window messages to unblock +// the renderer's Receive processing + +procedure TBCBaseRenderer.WaitForReceiveToComplete; +var + msg: TMsg; +begin + repeat + if Not FInReceive then + Break; + + // Receive all interthread sendmessages + PeekMessage(msg, 0, WM_NULL, WM_NULL, PM_NOREMOVE); + + Sleep(1); + until False; + + // If the wakebit for QS_POSTMESSAGE is set, the PeekMessage call + // above just cleared the changebit which will cause some messaging + // calls to block (waitMessage, MsgWaitFor...) now. + // Post a dummy message to set the QS_POSTMESSAGE bit again + + if (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) and QS_POSTMESSAGE) <> 0 then + // Send dummy message + PostThreadMessage(GetCurrentThreadId, WM_NULL, 0, 0); +end; + +// A filter can have four discrete states, namely Stopped, Running, Paused, +// Intermediate. We are in an intermediate state if we are currently trying +// to pause but haven't yet got the first sample (or if we have been flushed +// in paused state and therefore still have to wait for a sample to arrive) + +// This class contains an event called FCompleteEvent which is signalled when +// the current state is completed and is not signalled when we are waiting to +// complete the last state transition. As mentioned above the only time we +// use this at the moment is when we wait for a media sample in paused state +// If while we are waiting we receive an end of stream notification from the +// source filter then we know no data is imminent so we can reset the event +// This means that when we transition to paused the source filter must call +// end of stream on us or send us an image otherwise we'll hang indefinately + +// Simple internal way of getting the real state + +// !!! make property here + +function TBCBaseRenderer.GetRealState: TFilterState; +begin + Result := FState; +end; + +// Waits for the HANDLE hObject. While waiting messages sent +// to windows on our thread by SendMessage will be processed. +// Using this function to do waits and mutual exclusion +// avoids some deadlocks in objects with windows. +// Return codes are the same as for WaitForSingleObject + +function WaitDispatchingMessages(Object_: THandle; Wait: DWord; + Wnd: HWnd = 0; Msg: Cardinal = 0; Event: THandle = 0): DWord; +// milenko start (replaced with global variables) +//const +//{$IFOPT J-} +//{$DEFINE ResetJ} +//{$J+} +//{$ENDIF} +// MsgId: Cardinal = 0; +//{$IFDEF ResetJ} +//{$J-} +//{$UNDEF ResetJ} +//{$ENDIF} +// milenko end +var + Peeked: Boolean; + Res, Start, ThreadPriority: DWord; + Objects: array[0..1] of THandle; + Count, TimeOut, WakeMask, Now_, Diff: DWord; + Msg_: TMsg; + +begin + Peeked := False; + MsgId := 0; + Start := 0; + ThreadPriority := THREAD_PRIORITY_NORMAL; + + Objects[0] := Object_; + Objects[1] := Event; + if (Wait <> INFINITE) and (Wait <> 0) then + Start := GetTickCount; + + repeat + if (Event <> 0) then + Count := 2 + else + Count := 1; + + // Minimize the chance of actually dispatching any messages + // by seeing if we can lock immediately. + Res := WaitForMultipleObjects(Count, @Objects, False, 0); + if (Res < WAIT_OBJECT_0 + Count) then + Break; + + TimeOut := Wait; + if (TimeOut > 10) then + TimeOut := 10; + + if (Wnd = 0) then + WakeMask := QS_SENDMESSAGE + else + WakeMask := QS_SENDMESSAGE + QS_POSTMESSAGE; + + Res := MsgWaitForMultipleObjects(Count, Objects, False, + TimeOut, WakeMask); + if (Res = WAIT_OBJECT_0 + Count) or + ((Res = WAIT_TIMEOUT) and (TimeOut <> Wait)) then + begin + if (Wnd <> 0) then + while PeekMessage(Msg_, Wnd, Msg, Msg, PM_REMOVE) do + DispatchMessage(Msg_); + + // Do this anyway - the previous peek doesn't flush out the + // messages + PeekMessage(Msg_, 0, 0, 0, PM_NOREMOVE); + + if (Wait <> INFINITE) and (Wait <> 0) then + begin + Now_ := GetTickCount(); + + // Working with differences handles wrap-around + Diff := Now_ - Start; + if (Diff > Wait) then + Wait := 0 + else + Dec(Wait, Diff); + Start := Now_; + end; + + if not (Peeked) then + begin + // Raise our priority to prevent our message queue + // building up + ThreadPriority := GetThreadPriority(GetCurrentThread); + if (ThreadPriority < THREAD_PRIORITY_HIGHEST) then + begin + // ??? raising priority requires one more routine.... + SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST); + end; + Peeked := True; + end; + end + else + Break; + until False; + + if (Peeked) then + begin + // ??? setting priority requires one more routine.... + SetThreadPriority(GetCurrentThread, ThreadPriority); +// milenko start (important!) +// if (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) and QS_POSTMESSAGE) = 0 then + if (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) and QS_POSTMESSAGE) > 0 then +// milenko end + begin + if (MsgId = 0) then + MsgId := RegisterWindowMessage('AMUnblock') + else + // Remove old ones + while (PeekMessage(Msg_, (Wnd) - 1, MsgId, MsgId, PM_REMOVE)) do +// milenko start (this is a loop without any further function. +// it does not call PostThreadMEssage while looping!) + begin + end; +// milenko end + PostThreadMessage(GetCurrentThreadId, MsgId, 0, 0); + end; + end; + + Result := Res; +end; + +// The renderer doesn't complete the full transition to paused states until +// it has got one media sample to render. If you ask it for its state while +// it's waiting it will return the state along with VFW_S_STATE_INTERMEDIATE + +function TBCBaseRenderer.GetState(MSecs: DWord; out State: TFilterState): + HResult; +begin + if (WaitDispatchingMessages(FCompleteEvent.Handle, MSecs) = WAIT_TIMEOUT) then + Result := VFW_S_STATE_INTERMEDIATE + else + Result := NOERROR; + + State := FState; +end; + +// If we're pausing and we have no samples we don't complete the transition +// to State_Paused and we return S_FALSE. However if the FAborting flag has +// been set then all samples are rejected so there is no point waiting for +// one. If we do have a sample then return NOERROR. We will only ever return +// VFW_S_STATE_INTERMEDIATE from GetState after being paused with no sample +// (calling GetState after either being stopped or Run will NOT return this) + +function TBCBaseRenderer.CompleteStateChange(OldState: TFilterState): HResult; +begin + // Allow us to be paused when disconnected + if not (FInputPin.IsConnected) or + // Have we run off the end of stream + IsEndOfStream or + // Make sure we get fresh data after being stopped + (HaveCurrentSample and (OldState <> State_Stopped)) then + begin + Ready; + Result := S_OK; + Exit; + end; + + NotReady; + Result := S_False; +end; + +procedure TBCBaseRenderer.SetAbortSignal(Abort_: Boolean); +begin + FAbort := Abort_; +end; + +procedure TBCBaseRenderer.OnReceiveFirstSample(MediaSample: IMediaSample); +begin + +end; + +procedure TBCBaseRenderer.Ready; +begin + FCompleteEvent.SetEv +end; + +procedure TBCBaseRenderer.NotReady; +begin + FCompleteEvent.Reset +end; + +function TBCBaseRenderer.CheckReady: Boolean; +begin + Result := FCompleteEvent.Check +end; + +// When we stop the filter the things we do are:- + +// Decommit the allocator being used in the connection +// Release the source filter if it's waiting in Receive +// Cancel any advise link we set up with the clock +// Any end of stream signalled is now obsolete so reset +// Allow us to be stopped when we are not connected + +function TBCBaseRenderer.Stop: HResult; +begin + FInterfaceLock.Lock; + try + // Make sure there really is a state change + + if (FState = State_Stopped) then + begin + Result := NOERROR; + Exit; + end; + + // Is our input pin connected + + if not (FInputPin.IsConnected) then + begin +{$IFDEF DEBUG} + DbgLog(Self, 'Input pin is not connected'); +{$ENDIF} + FState := State_Stopped; + Result := NOERROR; + Exit; + end; + + inherited Stop; + + // If we are going into a stopped state then we must decommit whatever + // allocator we are using it so that any source filter waiting in the + // GetBuffer can be released and unlock themselves for a state change + + if Assigned(FInputPin.FAllocator) then + FInputPin.FAllocator.Decommit; + + // Cancel any scheduled rendering + + SetRepaintStatus(True); + StopStreaming; + SourceThreadCanWait(False); + ResetEndOfStream; + CancelNotification; + + // There should be no outstanding clock advise + Assert(CancelNotification = S_FALSE); + Assert(WAIT_TIMEOUT = WaitForSingleObject(FRenderEvent.Handle, 0)); + Assert(FEndOfStreamTimer = 0); + + Ready; + WaitForReceiveToComplete; + FAbort := False; + + Result := NOERROR; + + finally + FInterfaceLock.UnLock; + end; +end; + +// When we pause the filter the things we do are:- + +// Commit the allocator being used in the connection +// Allow a source filter thread to wait in Receive +// Cancel any clock advise link (we may be running) +// Possibly complete the state change if we have data +// Allow us to be paused when we are not connected + +function TBCBaseRenderer.Pause: HResult; +var + OldState: TFilterState; + hr: HResult; + +begin + FInterfaceLock.Lock; + try + OldState := FState; + Assert(not FInputPin.IsFlushing); + + // Make sure there really is a state change + + if (FState = State_Paused) then + begin + Result := CompleteStateChange(State_Paused); + Exit; + end; + + // Has our input pin been connected + + if Not FInputPin.IsConnected then + begin +{$IFDEF DEBUG} + DbgLog(Self, 'Input pin is not connected'); +{$ENDIF} + FState := State_Paused; + Result := CompleteStateChange(State_Paused); + Exit; + end; + + // Pause the base filter class + + hr := inherited Pause; + if Failed(hr) then + begin +{$IFDEF DEBUG} + DbgLog(Self, 'Pause failed'); +{$ENDIF} + Result := hr; + Exit; + end; + + // Enable EC_REPAINT events again + + SetRepaintStatus(True); + StopStreaming; + SourceThreadCanWait(True); + CancelNotification; + ResetEndOfStreamTimer; + // If we are going into a paused state then we must commit whatever + // allocator we are using it so that any source filter can call the + // GetBuffer and expect to get a buffer without returning an error + + if Assigned(FInputPin.FAllocator) then + FInputPin.FAllocator.Commit; + + // There should be no outstanding advise + Assert(CancelNotification = S_FALSE); + Assert(WAIT_TIMEOUT = WaitForSingleObject(FRenderEvent.Handle, 0)); + Assert(FEndOfStreamTimer = 0); + Assert(not FInputPin.IsFlushing); + + // When we come out of a stopped state we must clear any image we were + // holding onto for frame refreshing. Since renderers see state changes + // first we can reset ourselves ready to accept the source thread data + // Paused or running after being stopped causes the current position to + // be reset so we're not interested in passing end of stream signals + + if (OldState = State_Stopped) then + begin + FAbort := False; + ClearPendingSample; + end; + + Result := CompleteStateChange(OldState); + + finally + FInterfaceLock.Unlock; + end; +end; + +// When we run the filter the things we do are:- + +// Commit the allocator being used in the connection +// Allow a source filter thread to wait in Receive +// Signal the render event just to get us going +// Start the base class by calling StartStreaming +// Allow us to be run when we are not connected +// Signal EC_COMPLETE if we are not connected + +function TBCBaseRenderer.Run(StartTime: TReferenceTime): HResult; +var + OldState: TFilterState; + hr: HResult; +// milenko start + Filter: IBaseFilter; +// milenko end +begin + FInterfaceLock.Lock; + try + OldState := FState; + + // Make sure there really is a state change + + if (FState = State_Running) then + begin + Result := NOERROR; + Exit; + end; + + // Send EC_COMPLETE if we're not connected + + if not FInputPin.IsConnected then + begin +// milenko start (Delphi 5 compatibility) + QueryInterface(IID_IBaseFilter,Filter); + NotifyEvent(EC_COMPLETE, S_OK, Integer(Filter)); + Filter := nil; +// milenko end + FState := State_Running; + Result := NOERROR; + Exit; + end; + + Ready; + + // Pause the base filter class + + hr := inherited Run(StartTime); + if Failed(hr) then + begin +{$IFDEF DEBUG} + DbgLog(Self, 'Run failed'); +{$ENDIF} + Result := hr; + Exit; + end; + + // Allow the source thread to wait + Assert(not FInputPin.IsFlushing); + SourceThreadCanWait(True); + SetRepaintStatus(False); + + // There should be no outstanding advise + Assert(CancelNotification = S_FALSE); + Assert(WAIT_TIMEOUT = WaitForSingleObject(FRenderEvent.Handle, 0)); + Assert(FEndOfStreamTimer = 0); + Assert(not FInputPin.IsFlushing); + + // If we are going into a running state then we must commit whatever + // allocator we are using it so that any source filter can call the + // GetBuffer and expect to get a buffer without returning an error + + if Assigned(FInputPin.FAllocator) then + FInputPin.FAllocator.Commit; + + // When we come out of a stopped state we must clear any image we were + // holding onto for frame refreshing. Since renderers see state changes + // first we can reset ourselves ready to accept the source thread data + // Paused or running after being stopped causes the current position to + // be reset so we're not interested in passing end of stream signals + + if (OldState = State_Stopped) then + begin + FAbort := False; + ClearPendingSample; + end; + + Result := StartStreaming; + + finally + FInterfaceLock.Unlock; + end; +end; + +// Return the number of input pins we support + +function TBCBaseRenderer.GetPinCount: Integer; +begin + Result := 1; +end; + +// We only support one input pin and it is numbered zero + +function TBCBaseRenderer.GetPin(n: integer): TBCBasePin; +var + hr: HResult; +begin + FObjectCreationLock.Lock; + try + // Should only ever be called with zero + Assert(n = 0); + + if (n <> 0) then + begin + Result := nil; + Exit; + end; + + // Create the input pin if not already done so + + if (FInputPin = nil) then + begin + // hr must be initialized to NOERROR because + // CRendererInputPin's constructor only changes + // hr's value if an error occurs. + hr := NOERROR; + + FInputPin := TBCRendererInputPin.Create(Self, hr, 'In'); + if (FInputPin = nil) then + begin + Result := nil; + Exit; + end; + + if Failed(hr) then + begin + FreeAndNil(FInputPin); + Result := nil; + Exit; + end; + end; + + Result := FInputPin; + finally + FObjectCreationLock.UnLock; + end; +end; + +function DumbItDownFor95(const S1, S2: WideString; CmpFlags: Integer): Integer; +var + a1, a2: AnsiString; +begin + a1 := s1; + a2 := s2; + Result := CompareStringA(LOCALE_USER_DEFAULT, CmpFlags, PChar(a1), Length(a1), + PChar(a2), Length(a2)) - 2; +end; + +function WideCompareText(const S1, S2: WideString): Integer; +begin + SetLastError(0); + Result := CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, PWideChar(S1), + Length(S1), PWideChar(S2), Length(S2)) - 2; + case GetLastError of + 0: ; + ERROR_CALL_NOT_IMPLEMENTED: Result := DumbItDownFor95(S1, S2, NORM_IGNORECASE); + end; +end; + +// If "In" then return the IPin for our input pin, otherwise NULL and error +function TBCBaseRenderer.FindPin(id: PWideChar; out Pin: IPin): HResult; +begin +// Milenko start + if (@Pin = nil) then + begin + Result := E_POINTER; + Exit; + end; +// Milenko end +// milenko start (delphi 5 doesn't know WideCompareText) + if WideCompareText(id, 'In') = 0 then +// milenko end + begin + Pin := GetPin(0); + Assert(Pin <> nil); + // ??? Pin.AddRef; + Result := NOERROR; + end + else + begin + Pin := nil; + Result := VFW_E_NOT_FOUND; + end; +end; + +// Called when the input pin receives an EndOfStream notification. If we have +// not got a sample, then notify EC_COMPLETE now. If we have samples, then set +// m_bEOS and check for this on completing samples. If we're waiting to pause +// then complete the transition to paused state by setting the state event + +function TBCBaseRenderer.EndOfStream: HResult; +begin + // Ignore these calls if we are stopped + + if (FState = State_Stopped) then + begin + Result := NOERROR; + Exit; + end; + + // If we have a sample then wait for it to be rendered + + FIsEOS := True; + if Assigned(FMediaSample) then + begin + Result := NOERROR; + Exit; + end; + + // If we are waiting for pause then we are now ready since we cannot now + // carry on waiting for a sample to arrive since we are being told there + // won't be any. This sets an event that the GetState function picks up + + Ready; + + // Only signal completion now if we are running otherwise queue it until + // we do run in StartStreaming. This is used when we seek because a seek + // causes a pause where early notification of completion is misleading + + if FIsStreaming then + SendEndOfStream; + + Result := NOERROR; +end; + +// When we are told to flush we should release the source thread + +function TBCBaseRenderer.BeginFlush: HResult; +begin + // If paused then report state intermediate until we get some data + + if (FState = State_Paused) then + NotReady; + + SourceThreadCanWait(False); + CancelNotification; + ClearPendingSample; + // Wait for Receive to complete + WaitForReceiveToComplete; + + Result := NOERROR; +end; + +// After flushing the source thread can wait in Receive again + +function TBCBaseRenderer.EndFlush: HResult; +begin + // Reset the current sample media time + if Assigned(FPosition) then + FPosition.ResetMediaTime; + + // There should be no outstanding advise + + Assert(CancelNotification = S_FALSE); + SourceThreadCanWait(True); + Result := NOERROR; +end; + +// We can now send EC_REPAINTs if so required + +function TBCBaseRenderer.CompleteConnect(ReceivePin: IPin): HResult; +begin + // The caller should always hold the interface lock because + // the function uses CBaseFilter::m_State. + + {$IFDEF DEBUG} + Assert(FInterfaceLock.CritCheckIn); + {$ENDIF} + + FAbort := False; + + if (State_Running = GetRealState) then + begin + Result := StartStreaming; + if Failed(Result) then + Exit; + + SetRepaintStatus(False); + end + else + SetRepaintStatus(True); + + Result := NOERROR; +end; + +// Called when we go paused or running + +function TBCBaseRenderer.Active: HResult; +begin + Result := NOERROR; +end; + +// Called when we go into a stopped state + +function TBCBaseRenderer.Inactive: HResult; +begin + if Assigned(FPosition) then + FPosition.ResetMediaTime; + + // People who derive from this may want to override this behaviour + // to keep hold of the sample in some circumstances + ClearPendingSample; + + Result := NOERROR; +end; + +// Tell derived classes about the media type agreed + +function TBCBaseRenderer.SetMediaType(MediaType: PAMMediaType): HResult; +begin + Result := NOERROR; +end; + +// When we break the input pin connection we should reset the EOS flags. When +// we are asked for either IMediaPosition or IMediaSeeking we will create a +// CPosPassThru object to handles media time pass through. When we're handed +// samples we store (by calling CPosPassThru::RegisterMediaTime) their media +// times so we can then return a real current position of data being rendered + +function TBCBaseRenderer.BreakConnect: HResult; +begin + // Do we have a quality management sink + + if Assigned(FQSink) then + FQSink := nil; + + // Check we have a valid connection + + if not FInputPin.IsConnected then + begin + Result := S_FALSE; + Exit; + end; + + // Check we are stopped before disconnecting + if (FState <> State_Stopped) and (not FInputPin.CanReconnectWhenActive) then + begin + Result := VFW_E_NOT_STOPPED; + Exit; + end; + + SetRepaintStatus(False); + ResetEndOfStream; + ClearPendingSample; + FAbort := False; + + if (State_Running = FState) then + StopStreaming; + + Result := NOERROR; +end; + +// Retrieves the sample times for this samples (note the sample times are +// passed in by reference not value). We return S_FALSE to say schedule this +// sample according to the times on the sample. We also return S_OK in +// which case the object should simply render the sample data immediately + +function TBCBaseRenderer.GetSampleTimes(MediaSample: IMediaSample; + out StartTime: TReferenceTime; out EndTime: TReferenceTime): HResult; +begin + Assert(FAdvisedCookie = 0); + Assert(Assigned(MediaSample)); + + // If the stop time for this sample is before or the same as start time, + // then just ignore it (release it) and schedule the next one in line + // Source filters should always fill in the start and end times properly! + + if Succeeded(MediaSample.GetTime(StartTime, EndTime)) then + begin + if (EndTime < StartTime) then + begin + Result := VFW_E_START_TIME_AFTER_END; + Exit; + end; + end + else + begin + // no time set in the sample... draw it now? + Result := S_OK; + Exit; + end; + + // Can't synchronise without a clock so we return S_OK which tells the + // caller that the sample should be rendered immediately without going + // through the overhead of setting a timer advise link with the clock + + if (FClock = nil) then + Result := S_OK + else + Result := ShouldDrawSampleNow(MediaSample, StartTime, EndTime); +end; + +// By default all samples are drawn according to their time stamps so we +// return S_FALSE. Returning S_OK means draw immediately, this is used +// by the derived video renderer class in its quality management. + +function TBCBaseRenderer.ShouldDrawSampleNow(MediaSample: IMediaSample; + StartTime: TReferenceTime; out EndTime: TReferenceTime): HResult; +begin + Result := S_FALSE; +end; + +// We must always reset the current advise time to zero after a timer fires +// because there are several possible ways which lead us not to do any more +// scheduling such as the pending image being cleared after state changes + +procedure TBCBaseRenderer.SignalTimerFired; +begin + FAdvisedCookie := 0; +end; + +// Cancel any notification currently scheduled. This is called by the owning +// window object when it is told to stop streaming. If there is no timer link +// outstanding then calling this is benign otherwise we go ahead and cancel +// We must always reset the render event as the quality management code can +// signal immediate rendering by setting the event without setting an advise +// link. If we're subsequently stopped and run the first attempt to setup an +// advise link with the reference clock will find the event still signalled + +function TBCBaseRenderer.CancelNotification: HResult; +var + dwAdvisedCookie: DWord; + +begin + Assert((FAdvisedCookie = 0) or Assigned(FClock)); + dwAdvisedCookie := FAdvisedCookie; + + // Have we a live advise link + + if (FAdvisedCookie <> 0) then + begin + FClock.Unadvise(FAdvisedCookie); + SignalTimerFired; + Assert(FAdvisedCookie = 0); + end; + + // Clear the event and return our status + + FRenderEvent.Reset; + if (dwAdvisedCookie <> 0) then + Result := S_OK + else + Result := S_FALSE; +end; + +// Responsible for setting up one shot advise links with the clock +// Return FALSE if the sample is to be dropped (not drawn at all) +// Return TRUE if the sample is to be drawn and in this case also +// arrange for m_RenderEvent to be set at the appropriate time + +function TBCBaseRenderer.ScheduleSample(MediaSample: IMediaSample): Boolean; +var + StartSample, EndSample: TReferenceTime; + hr: HResult; + +begin + // Is someone pulling our leg + + if (MediaSample = nil) then + begin + Result := False; + Exit; + end; + + // Get the next sample due up for rendering. If there aren't any ready + // then GetNextSampleTimes returns an error. If there is one to be done + // then it succeeds and yields the sample times. If it is due now then + // it returns S_OK other if it's to be done when due it returns S_FALSE + + hr := GetSampleTimes(MediaSample, StartSample, EndSample); + if Failed(hr) then + begin + Result := False; + Exit; + end; + + // If we don't have a reference clock then we cannot set up the advise + // time so we simply set the event indicating an image to render. This + // will cause us to run flat out without any timing or synchronisation + + if (hr = S_OK) then + begin + // ???Assert(SetEvent(FRenderEvent.Handle)); + + FRenderEvent.SetEv; + Result := True; + Exit; + end; + + Assert(FAdvisedCookie = 0); + Assert(Assigned(FClock)); + Assert(Wait_Timeout = WaitForSingleObject(FRenderEvent.Handle, 0)); + + // We do have a valid reference clock interface so we can ask it to + // set an event when the image comes due for rendering. We pass in + // the reference time we were told to start at and also the current + // stream time which is the offset from the start reference time + + hr := FClock.AdviseTime( + FStart, // Start run time + StartSample, // Stream time + FRenderEvent.Handle, // Render notification + FAdvisedCookie); // Advise cookie + + if Succeeded(hr) then + begin + Result := True; + Exit; + end; + + // We could not schedule the next sample for rendering despite the fact + // we have a valid sample here. This is a fair indication that either + // the system clock is wrong or the time stamp for the sample is duff + + Assert(FAdvisedCookie = 0); + Result := False; +end; + +// This is called when a sample comes due for rendering. We pass the sample +// on to the derived class. After rendering we will initialise the timer for +// the next sample, NOTE signal that the last one fired first, if we don't +// do this it thinks there is still one outstanding that hasn't completed + +function TBCBaseRenderer.Render(MediaSample: IMediaSample): HResult; +begin + // If the media sample is NULL then we will have been notified by the + // clock that another sample is ready but in the mean time someone has + // stopped us streaming which causes the next sample to be released + + if (MediaSample = nil) then + begin + Result := S_FALSE; + Exit; + end; + + // If we have stopped streaming then don't render any more samples, the + // thread that got in and locked us and then reset this flag does not + // clear the pending sample as we can use it to refresh any output device + + if Not FIsStreaming then + begin + Result := S_FALSE; + Exit; + end; + + // Time how long the rendering takes + + OnRenderStart(MediaSample); + DoRenderSample(MediaSample); + OnRenderEnd(MediaSample); + + Result := NOERROR; +end; + +// Checks if there is a sample waiting at the renderer + +function TBCBaseRenderer.HaveCurrentSample: Boolean; +begin + FRendererLock.Lock; + try + Result := (FMediaSample <> nil); + + finally + FRendererLock.UnLock; + end; +end; + +// Returns the current sample waiting at the video renderer. We AddRef the +// sample before returning so that should it come due for rendering the +// person who called this method will hold the remaining reference count +// that will stop the sample being added back onto the allocator free list + +function TBCBaseRenderer.GetCurrentSample: IMediaSample; +begin + FRendererLock.Lock; + try + (* ??? + if (m_pMediaSample) { + m_pMediaSample->AddRef(); + *) + Result := FMediaSample; + finally + FRendererLock.Unlock; + end; +end; + +// Called when the source delivers us a sample. We go through a few checks to +// make sure the sample can be rendered. If we are running (streaming) then we +// have the sample scheduled with the reference clock, if we are not streaming +// then we have received an sample in paused mode so we can complete any state +// transition. On leaving this function everything will be unlocked so an app +// thread may get in and change our state to stopped (for example) in which +// case it will also signal the thread event so that our wait call is stopped + +function TBCBaseRenderer.PrepareReceive(MediaSample: IMediaSample): HResult; +var + hr: HResult; + +begin + FInterfaceLock.Lock; + try + FInReceive := True; + + // Check our flushing and filter state + + // This function must hold the interface lock because it calls + // CBaseInputPin::Receive() and CBaseInputPin::Receive() uses + // CBasePin::m_bRunTimeError. +// ??? HRESULT hr = m_pInputPin->CBaseInputPin::Receive(MediaSample); + + hr := FInputPin.InheritedReceive(MediaSample); + if (hr <> NOERROR) then + begin + FInReceive := False; + Result := E_FAIL; + Exit; + end; + + // Has the type changed on a media sample. We do all rendering + // synchronously on the source thread, which has a side effect + // that only one buffer is ever outstanding. Therefore when we + // have Receive called we can go ahead and change the format + // Since the format change can cause a SendMessage we just don't + // lock + if Assigned(FInputPin.SampleProps.pMediaType) then + begin + hr := FInputPin.SetMediaType(FInputPin.FSampleProps.pMediaType); + if Failed(hr) then + begin + Result := hr; + FInReceive := False; + Exit; + end; + end; + + FRendererLock.Lock; + try + Assert(IsActive); + Assert(not FInputPin.IsFlushing); + Assert(FInputPin.IsConnected); + Assert(FMediaSample = nil); + + // Return an error if we already have a sample waiting for rendering + // source pins must serialise the Receive calls - we also check that + // no data is being sent after the source signalled an end of stream + + if (Assigned(FMediaSample) or FIsEOS or FAbort) then + begin + Ready; + FInReceive := False; + Result := E_UNEXPECTED; + Exit; + end; + + // Store the media times from this sample + if Assigned(FPosition) then + FPosition.RegisterMediaTime(MediaSample); + + // Schedule the next sample if we are streaming + + if (FIsStreaming and (not ScheduleSample(MediaSample))) then + begin + Assert(WAIT_TIMEOUT = WaitForSingleObject(FRenderEvent.Handle, 0)); + Assert(CancelNotification = S_FALSE); + FInReceive := False; + Result := VFW_E_SAMPLE_REJECTED; + Exit; + end; + + // Store the sample end time for EC_COMPLETE handling + FSignalTime := FInputPin.FSampleProps.tStop; + + // BEWARE we sometimes keep the sample even after returning the thread to + // the source filter such as when we go into a stopped state (we keep it + // to refresh the device with) so we must AddRef it to keep it safely. If + // we start flushing the source thread is released and any sample waiting + // will be released otherwise GetBuffer may never return (see BeginFlush) + + FMediaSample := MediaSample; + //??? m_pMediaSample->AddRef(); + + if not FIsStreaming then + SetRepaintStatus(True); + + Result := NOERROR; + + finally + FRendererLock.Unlock; + end; + + finally + FInterfaceLock.UnLock; + end; +end; + +// Called by the source filter when we have a sample to render. Under normal +// circumstances we set an advise link with the clock, wait for the time to +// arrive and then render the data using the PURE virtual DoRenderSample that +// the derived class will have overriden. After rendering the sample we may +// also signal EOS if it was the last one sent before EndOfStream was called + +function TBCBaseRenderer.Receive(MediaSample: IMediaSample): HResult; +begin + Assert(Assigned(MediaSample)); + + // It may return VFW_E_SAMPLE_REJECTED code to say don't bother + + Result := PrepareReceive(MediaSample); + Assert(FInReceive = Succeeded(Result)); + if Failed(Result) then + begin + if (Result = VFW_E_SAMPLE_REJECTED) then + Result := NOERROR; + Exit; + end; + + // We realize the palette in "PrepareRender()" so we have to give away the + // filter lock here. + if (FState = State_Paused) then + begin + PrepareRender; + + // no need to use InterlockedExchange + FInReceive := False; + + // We must hold both these locks + FInterfaceLock.Lock; + try + if (FState = State_Stopped) then + begin + Result := NOERROR; + Exit; + end; + + FInReceive := True; + FRendererLock.Lock; + try + OnReceiveFirstSample(MediaSample); + finally + FRendererLock.UnLock; + end; + finally + FInterfaceLock.UnLock; + end; + + Ready; + end; + // Having set an advise link with the clock we sit and wait. We may be + // awoken by the clock firing or by a state change. The rendering call + // will lock the critical section and check we can still render the data + + Result := WaitForRenderTime; + if Failed(Result) then + begin + FInReceive := False; + Result := NOERROR; + Exit; + end; + + PrepareRender; + + // Set this here and poll it until we work out the locking correctly + // It can't be right that the streaming stuff grabs the interface + // lock - after all we want to be able to wait for this stuff + // to complete + FInReceive := False; + + // We must hold both these locks + FInterfaceLock.Lock; + try + // since we gave away the filter wide lock, the sate of the filter could + // have chnaged to Stopped + if (FState = State_Stopped) then + begin + Result := NOERROR; + Exit; + end; + FRendererLock.Lock; + try + // Deal with this sample + + Render(FMediaSample); + ClearPendingSample; +// milenko start (why commented before?) + SendEndOfStream; +// milenko end + CancelNotification; + Result := NOERROR; + + finally + FRendererLock.UnLock; + end; + finally + FInterfaceLock.UnLock; + end; +end; + +// This is called when we stop or are inactivated to clear the pending sample +// We release the media sample interface so that they can be allocated to the +// source filter again, unless of course we are changing state to inactive in +// which case GetBuffer will return an error. We must also reset the current +// media sample to NULL so that we know we do not currently have an image + +function TBCBaseRenderer.ClearPendingSample: HResult; +begin + FRendererLock.Lock; + try + if Assigned(FMediaSample) then + FMediaSample := nil; + Result := NOERROR; + finally + FRendererLock.Unlock; + end; +end; + +// Used to signal end of stream according to the sample end time +// Milenko start (use this callback outside of the class and with stdcall;) +procedure EndOfStreamTimer(uID, uMsg: UINT; + dwUser, dw1, dw2: DWord); stdcall; +var + Renderer: TBCBaseRenderer; +begin + Renderer := TBCBaseRenderer(dwUser); + {$IFDEF DEBUG} + //NOTE1("EndOfStreamTimer called (%d)",uID); + DbgLog(Format('EndOfStreamTimer called (%d)', [uID])); + {$ENDIF} + Renderer.TimerCallback; +{ +??? + CBaseRenderer *pRenderer = (CBaseRenderer * ) dwUser; + pRenderer->TimerCallback(); +} +end; +// Milenko end + +// Do the timer callback work + +procedure TBCBaseRenderer.TimerCallback; +begin + // Lock for synchronization (but don't hold this lock when calling + // timeKillEvent) + FRendererLock.Lock; + try + // See if we should signal end of stream now + + if (FEndOfStreamTimer <> 0) then + begin + FEndOfStreamTimer := 0; +// milenko start (why commented before?) + SendEndOfStream; +// milenko end + end; + + finally + FRendererLock.Unlock; + end; +end; + +// If we are at the end of the stream signal the filter graph but do not set +// the state flag back to FALSE. Once we drop off the end of the stream we +// leave the flag set (until a subsequent ResetEndOfStream). Each sample we +// get delivered will update m_SignalTime to be the last sample's end time. +// We must wait this long before signalling end of stream to the filtergraph + +const + TIMEOUT_DELIVERYWAIT = 50; + TIMEOUT_RESOLUTION = 10; + +function TBCBaseRenderer.SendEndOfStream: HResult; +var + Signal, CurrentTime: TReferenceTime; + Delay: Longint; + +begin + {$IFDEF DEBUG} + Assert(FRendererLock.CritCheckIn); + {$ENDIF} + if ((not FIsEOS) or FIsEOSDelivered or (FEndOfStreamTimer <> 0)) then + begin + Result := NOERROR; + Exit; + end; + + // If there is no clock then signal immediately + if (FClock = nil) then + begin + Result := NotifyEndOfStream; + Exit; + end; + + // How long into the future is the delivery time + + Signal := FStart + FSignalTime; + FClock.GetTime(int64(CurrentTime)); +// Milenko Start (important!) +// Delay := (Longint(Signal) - CurrentTime) div 10000; + Delay := LongInt((Signal - CurrentTime) div 10000); +// Milenko end + // Dump the timing information to the debugger +{$IFDEF DEBUG} + DbgLog(Self, Format('Delay until end of stream delivery %d', [Delay])); + // ??? NOTE1("Current %s",(LPCTSTR)CDisp((LONGLONG)CurrentTime)); + // ??? NOTE1("Signal %s",(LPCTSTR)CDisp((LONGLONG)Signal)); + DbgLog(Self, Format('Current %d', [CurrentTime])); + DbgLog(Self, Format('Signal %d', [Signal])); +{$ENDIF} + + // Wait for the delivery time to arrive + + if (Delay < TIMEOUT_DELIVERYWAIT) then + begin + Result := NotifyEndOfStream; + Exit; + end; + + // Signal a timer callback on another worker thread + FEndOfStreamTimer := CompatibleTimeSetEvent( + Delay, // Period of timer + TIMEOUT_RESOLUTION, // Timer resolution + // ??? +// Milenko start (callback is now outside of the class) + @EndOfStreamTimer,// Callback function +// Milenko end + Cardinal(Self), // Used information + TIME_ONESHOT); // Type of callback + + if (FEndOfStreamTimer = 0) then + begin + Result := NotifyEndOfStream; + Exit; + end; + + Result := NOERROR; +end; + +// Signals EC_COMPLETE to the filtergraph manager + +function TBCBaseRenderer.NotifyEndOfStream: HResult; +var + Filter: IBaseFilter; +begin + FRendererLock.Lock; + try + Assert(not FIsEOSDelivered); + Assert(FEndOfStreamTimer = 0); + + // Has the filter changed state + + if not FIsStreaming then + begin + Assert(FEndOfStreamTimer = 0); + Result := NOERROR; + Exit; + end; + + // Reset the end of stream timer + FEndOfStreamTimer := 0; + + // If we've been using the IMediaPosition interface, set it's start + // and end media "times" to the stop position by hand. This ensures + // that we actually get to the end, even if the MPEG guestimate has + // been bad or if the quality management dropped the last few frames + + if Assigned(FPosition) then + FPosition.EOS; + FIsEOSDelivered := True; +{$IFDEF DEBUG} + DbgLog('Sending EC_COMPLETE...'); +{$ENDIF} + // ??? return NotifyEvent(EC_COMPLETE,S_OK,(LONG_PTR)(IBaseFilter *)this); +// milenko start (Delphi 5 compatibility) + QueryInterface(IID_IBaseFilter,Filter); + Result := NotifyEvent(EC_COMPLETE, S_OK, Integer(Filter)); + Filter := nil; +// milenko end + finally + FRendererLock.UnLock; + end; +end; + +// Reset the end of stream flag, this is typically called when we transfer to +// stopped states since that resets the current position back to the start so +// we will receive more samples or another EndOfStream if there aren't any. We +// keep two separate flags one to say we have run off the end of the stream +// (this is the m_bEOS flag) and another to say we have delivered EC_COMPLETE +// to the filter graph. We need the latter otherwise we can end up sending an +// EC_COMPLETE every time the source changes state and calls our EndOfStream + +function TBCBaseRenderer.ResetEndOfStream: HResult; +begin + ResetEndOfStreamTimer; + FRendererLock.Lock; + try + FIsEOS := False; + FIsEOSDelivered := False; + FSignalTime := 0; + + Result := NOERROR; + finally + FRendererLock.UnLock; + end; +end; + +// Kills any outstanding end of stream timer + +procedure TBCBaseRenderer.ResetEndOfStreamTimer; +begin + {$IFDEF DEBUG} + Assert(FRendererLock.CritCheckOut); + {$ENDIF} + if (FEndOfStreamTimer <> 0) then + begin + timeKillEvent(FEndOfStreamTimer); + FEndOfStreamTimer := 0; + end; +end; + +// This is called when we start running so that we can schedule any pending +// image we have with the clock and display any timing information. If we +// don't have any sample but we have queued an EOS flag then we send it. If +// we do have a sample then we wait until that has been rendered before we +// signal the filter graph otherwise we may change state before it's done + +function TBCBaseRenderer.StartStreaming: HResult; +begin + FRendererLock.Lock; + try + if FIsStreaming then + begin + Result := NOERROR; + Exit; + end; + + // Reset the streaming times ready for running + + FIsStreaming := True; + + timeBeginPeriod(1); + OnStartStreaming; + + // There should be no outstanding advise + Assert(WAIT_TIMEOUT = WaitForSingleObject(FRenderEvent.Handle, 0)); + Assert(CancelNotification = S_FALSE); + + // If we have an EOS and no data then deliver it now + + if (FMediaSample = nil) then + begin + Result := SendEndOfStream; + Exit; + end; + + // Have the data rendered + + Assert(Assigned(FMediaSample)); + if not ScheduleSample(FMediaSample) then + FRenderEvent.SetEv; + + Result := NOERROR; + + finally + FRendererLock.UnLock; + end; +end; + +// This is called when we stop streaming so that we can set our internal flag +// indicating we are not now to schedule any more samples arriving. The state +// change methods in the filter implementation take care of cancelling any +// clock advise link we have set up and clearing any pending sample we have + +function TBCBaseRenderer.StopStreaming: HResult; +begin + FRendererLock.Lock; + try + FIsEOSDelivered := False; + + if FIsStreaming then + begin + FIsStreaming := False; + OnStopStreaming; + timeEndPeriod(1); + end; + Result := NOERROR; + + finally + FRendererLock.Unlock; + end; +end; + +// We have a boolean flag that is reset when we have signalled EC_REPAINT to +// the filter graph. We set this when we receive an image so that should any +// conditions arise again we can send another one. By having a flag we ensure +// we don't flood the filter graph with redundant calls. We do not set the +// event when we receive an EndOfStream call since there is no point in us +// sending further EC_REPAINTs. In particular the AutoShowWindow method and +// the DirectDraw object use this method to control the window repainting + +procedure TBCBaseRenderer.SetRepaintStatus(Repaint: Boolean); +begin + FRendererLock.Lock; + try + FRepaintStatus := Repaint; + finally + FRendererLock.Unlock; + end; +end; + +// Pass the window handle to the upstream filter + +procedure TBCBaseRenderer.SendNotifyWindow(Pin: IPin; Handle: HWND); +var + Sink: IMediaEventSink; + hr: HResult; +begin + // Does the pin support IMediaEventSink + hr := Pin.QueryInterface(IID_IMediaEventSink, Sink); + if Succeeded(hr) then + begin + Sink.Notify(EC_NOTIFY_WINDOW, Handle, 0); + Sink := nil; + end; + NotifyEvent(EC_NOTIFY_WINDOW, Handle, 0); +end; + +// Signal an EC_REPAINT to the filter graph. This can be used to have data +// sent to us. For example when a video window is first displayed it may +// not have an image to display, at which point it signals EC_REPAINT. The +// filtergraph will either pause the graph if stopped or if already paused +// it will call put_CurrentPosition of the current position. Setting the +// current position to itself has the stream flushed and the image resent + +// ??? #define RLOG(_x_) DbgLog((LOG_TRACE,1,TEXT(_x_))); + +procedure TBCBaseRenderer.SendRepaint; +var + Pin: IPin; +begin + FRendererLock.Lock; + try + Assert(Assigned(FInputPin)); + + // We should not send repaint notifications when... + // - An end of stream has been notified + // - Our input pin is being flushed + // - The input pin is not connected + // - We have aborted a video playback + // - There is a repaint already sent + + if (not FAbort) and + (FInputPin.IsConnected) and + (not FInputPin.IsFlushing) and + (not IsEndOfStream) and + FRepaintStatus then + begin +// milenko start (delphi 5 compatibility) +// Pin := FInputPin as IPin; + FInputPin.QueryInterface(IID_IPin,Pin); + NotifyEvent(EC_REPAINT, Integer(Pin), 0); + Pin := nil; +// milenko end + SetRepaintStatus(False); +{$IFDEF DEBUG} + DbgLog('Sending repaint'); +{$ENDIF} + end; + finally + FRendererLock.Unlock; + end; +end; + +// When a video window detects a display change (WM_DISPLAYCHANGE message) it +// can send an EC_DISPLAY_CHANGED event code along with the renderer pin. The +// filtergraph will stop everyone and reconnect our input pin. As we're then +// reconnected we can accept the media type that matches the new display mode +// since we may no longer be able to draw the current image type efficiently + +function TBCBaseRenderer.OnDisplayChange: Boolean; +var + Pin: IPin; +begin + // Ignore if we are not connected yet + FRendererLock.Lock; + try + if not FInputPin.IsConnected then + begin + Result := False; + Exit; + end; +{$IFDEF DEBUG} + DbgLog('Notification of EC_DISPLAY_CHANGE'); +{$ENDIF} + + // Pass our input pin as parameter on the event +// milenko start (Delphi 5 compatibility) +// Pin := FInputPin as IPin; + FInputPin.QueryInterface(IID_IPin,Pin); + // ??? m_pInputPin->AddRef(); + NotifyEvent(EC_DISPLAY_CHANGED, Integer(Pin), 0); + SetAbortSignal(True); + ClearPendingSample; +// FreeAndNil(FInputPin); + Pin := nil; +// milenko end + + Result := True; + finally + FRendererLock.Unlock; + end; +end; + +// Called just before we start drawing. +// Store the current time in m_trRenderStart to allow the rendering time to be +// logged. Log the time stamp of the sample and how late it is (neg is early) + +procedure TBCBaseRenderer.OnRenderStart(MediaSample: IMediaSample); +{$IFDEF PERF} +var + StartTime, EndTime, StreamTime: TReferenceTime; +{$ENDIF} +begin +{$IFDEF PERF} + MediaSample.GetTime(StartTime, EndTime); + + MSR_INTEGER(FBaseStamp, Integer(StartTime)); // dump low order 32 bits + + FClock.GetTime(pint64(@FRenderStart)^); + MSR_INTEGER(0, Integer(FRenderStart)); + StreamTime := FRenderStart - FStart; // convert reftime to stream time + MSR_INTEGER(0, Integer(StreamTime)); + + MSR_INTEGER(FBaseAccuracy, RefTimeToMiliSec(StreamTime - StartTime)); // dump in mSec +{$ENDIF} +end; + +// Called directly after drawing an image. +// calculate the time spent drawing and log it. + +procedure TBCBaseRenderer.OnRenderEnd(MediaSample: IMediaSample); +{$IFDEF PERF} +var + NowTime: TReferenceTime; + t: Integer; +{$ENDIF} +begin +{$IFDEF PERF} + FClock.GetTime(int64(NowTime)); + MSR_INTEGER(0, Integer(NowTime)); + + t := RefTimeToMiliSec(NowTime - FRenderStart); // convert UNITS->msec + MSR_INTEGER(FBaseRenderTime, t); +{$ENDIF} +end; + +function TBCBaseRenderer.OnStartStreaming: HResult; +begin + Result := NOERROR; +end; + +function TBCBaseRenderer.OnStopStreaming: HResult; +begin + Result := NOERROR; +end; + +procedure TBCBaseRenderer.OnWaitStart; +begin + +end; + +procedure TBCBaseRenderer.OnWaitEnd; +begin + +end; + +procedure TBCBaseRenderer.PrepareRender; +begin + +end; + +// Constructor must be passed the base renderer object + +constructor TBCRendererInputPin.Create(Renderer: TBCBaseRenderer; + out hr: HResult; Name: PWideChar); +begin + inherited Create('Renderer pin', Renderer, Renderer.FInterfaceLock, + hr, Name); + FRenderer := Renderer; + Assert(Assigned(FRenderer)); +end; + +// Signals end of data stream on the input pin + +function TBCRendererInputPin.EndOfStream: HResult; +begin + FRenderer.FInterfaceLock.Lock; + FRenderer.FRendererLock.Lock; + try + // Make sure we're streaming ok + + Result := CheckStreaming; + if (Result <> NOERROR) then + Exit; + + // Pass it onto the renderer + + Result := FRenderer.EndOfStream; + if Succeeded(Result) then + Result := inherited EndOfStream; + + finally + FRenderer.FRendererLock.UnLock; + FRenderer.FInterfaceLock.UnLock; + end; +end; + +// Signals start of flushing on the input pin - we do the final reset end of +// stream with the renderer lock unlocked but with the interface lock locked +// We must do this because we call timeKillEvent, our timer callback method +// has to take the renderer lock to serialise our state. Therefore holding a +// renderer lock when calling timeKillEvent could cause a deadlock condition + +function TBCRendererInputPin.BeginFlush: HResult; +begin + FRenderer.FInterfaceLock.Lock; + try + FRenderer.FRendererLock.Lock; + try + inherited BeginFlush; + FRenderer.BeginFlush; + finally + FRenderer.FRendererLock.UnLock; + end; + Result := FRenderer.ResetEndOfStream; + finally + FRenderer.FInterfaceLock.UnLock; + end; +end; + +// Signals end of flushing on the input pin + +function TBCRendererInputPin.EndFlush: HResult; +begin + FRenderer.FInterfaceLock.Lock; + FRenderer.FRendererLock.Lock; + try + Result := FRenderer.EndFlush; + if Succeeded(Result) then + Result := inherited EndFlush; + finally + FRenderer.FRendererLock.UnLock; + FRenderer.FInterfaceLock.UnLock; + end; +end; + +// Pass the sample straight through to the renderer object + +function TBCRendererInputPin.Receive(MediaSample: IMediaSample): HResult; +var + hr: HResult; +begin + hr := FRenderer.Receive(MediaSample); + if Failed(hr) then + begin + // A deadlock could occur if the caller holds the renderer lock and + // attempts to acquire the interface lock. + {$IFDEF DEBUG} + Assert(FRenderer.FRendererLock.CritCheckOut); + {$ENDIF} + // The interface lock must be held when the filter is calling + // IsStopped or IsFlushing. The interface lock must also + // be held because the function uses m_bRunTimeError. + FRenderer.FInterfaceLock.Lock; + try + // We do not report errors which occur while the filter is stopping, + // flushing or if the FAborting flag is set . Errors are expected to + // occur during these operations and the streaming thread correctly + // handles the errors. + if (not IsStopped) and (not IsFlushing) and + (not FRenderer.FAbort) and + (not FRunTimeError) then + begin + // EC_ERRORABORT's first parameter is the error which caused + // the event and its' last parameter is 0. See the Direct + // Show SDK documentation for more information. + FRenderer.NotifyEvent(EC_ERRORABORT, hr, 0); + FRenderer.FRendererLock.Lock; + try + if (FRenderer.IsStreaming and + (not FRenderer.IsEndOfStreamDelivered)) then + FRenderer.NotifyEndOfStream; + finally + FRenderer.FRendererLock.UnLock; + end; + FRunTimeError := True; + end; + finally + FRenderer.FInterfaceLock.UnLock; + end; + end; + Result := hr; +end; + +function TBCRendererInputPin.InheritedReceive(MediaSample: IMediaSample): HResult; +begin + Result := Inherited Receive(MediaSample); +end; + +// Called when the input pin is disconnected + +function TBCRendererInputPin.BreakConnect: HResult; +begin + Result := FRenderer.BreakConnect; + if Succeeded(Result) then + Result := inherited BreakConnect; +end; + +// Called when the input pin is connected + +function TBCRendererInputPin.CompleteConnect(ReceivePin: IPin): HResult; +begin + Result := FRenderer.CompleteConnect(ReceivePin); + if Succeeded(Result) then + Result := inherited CompleteConnect(ReceivePin); +end; + +// Give the pin id of our one and only pin + +function TBCRendererInputPin.QueryId(out Id: PWideChar): HRESULT; +begin +// milenko start (AMGetWideString bugged before, so this call only will do fine now) + Result := AMGetWideString('In', Id); +// milenko end +end; + +// Will the filter accept this media type + +function TBCRendererInputPin.CheckMediaType(MediaType: PAMMediaType): HResult; +begin + Result := FRenderer.CheckMediaType(MediaType); +end; + +// Called when we go paused or running + +function TBCRendererInputPin.Active: HResult; +begin + Result := FRenderer.Active; +end; + +// Called when we go into a stopped state + +function TBCRendererInputPin.Inactive: HResult; +begin + // The caller must hold the interface lock because + // this function uses FRunTimeError. + {$IFDEF DEBUG} + Assert(FRenderer.FInterfaceLock.CritCheckIn); + {$ENDIF} + + FRunTimeError := False; + Result := FRenderer.Inactive; +end; + +// Tell derived classes about the media type agreed + +function TBCRendererInputPin.SetMediaType(MediaType: PAMMediaType): HResult; +begin + Result := inherited SetMediaType(MediaType); + if Succeeded(Result) then + Result := FRenderer.SetMediaType(MediaType); +end; + +// We do not keep an event object to use when setting up a timer link with +// the clock but are given a pointer to one by the owning object through the +// SetNotificationObject method - this must be initialised before starting +// We can override the default quality management process to have it always +// draw late frames, this is currently done by having the following registry +// key (actually an INI key) called DrawLateFrames set to 1 (default is 0) + +(* ??? +const TCHAR AMQUALITY[] = TEXT("ActiveMovie"); +const TCHAR DRAWLATEFRAMES[] = TEXT("DrawLateFrames"); +*) +resourcestring + AMQUALITY = 'ActiveMovie'; + DRAWLATEFRAMES = 'DrawLateFrames'; + +constructor TBCBaseVideoRenderer.Create(RenderClass: TGUID; Name: PChar; + Unk: IUnknown; hr: HResult); +begin +// milenko start (not sure if this is really needed, but looks better) +// inherited; + inherited Create(RenderClass,Name,Unk,hr); +// milenko end + + FFramesDropped := 0; + FFramesDrawn := 0; + FSupplierHandlingQuality:= False; + + ResetStreamingTimes; + +{$IFDEF PERF} + FTimeStamp := MSR_REGISTER('Frame time stamp'); + FEarliness := MSR_REGISTER('Earliness fudge'); + FTarget := MSR_REGISTER('Target(mSec)'); + FSchLateTime := MSR_REGISTER('mSec late when scheduled'); + FDecision := MSR_REGISTER('Scheduler decision code'); + FQualityRate := MSR_REGISTER('Quality rate sent'); + FQualityTime := MSR_REGISTER('Quality time sent'); + FWaitReal := MSR_REGISTER('Render wait'); + FWait := MSR_REGISTER('wait time recorded (msec)'); + FFrameAccuracy := MSR_REGISTER('Frame accuracy(msecs)'); + FDrawLateFrames := Boolean(GetProfileInt(PChar(AMQUALITY), + PChar(DRAWLATEFRAMES), Integer(False))); + FSendQuality := MSR_REGISTER('Processing Quality message'); + FRenderAvg := MSR_REGISTER('Render draw time Avg'); + FFrameAvg := MSR_REGISTER('FrameAvg'); + FWaitAvg := MSR_REGISTER('WaitAvg'); + FDuration := MSR_REGISTER('Duration'); + FThrottle := MSR_REGISTER('Audio - video throttle wait'); + FDebug := MSR_REGISTER('Debug stuff'); +{$ENDIF} +end; + +// Destructor is just a placeholder + +destructor TBCBaseVideoRenderer.Destroy; +begin + Assert(FAdvisedCookie = 0); + // ??? seems should leave it, but... +// milenko start (not really needed...) +// inherited; + inherited Destroy; +// milenko end +end; + +// The timing functions in this class are called by the window object and by +// the renderer's allocator. +// The windows object calls timing functions as it receives media sample +// images for drawing using GDI. +// The allocator calls timing functions when it starts passing DCI/DirectDraw +// surfaces which are not rendered in the same way; The decompressor writes +// directly to the surface with no separate rendering, so those code paths +// call direct into us. Since we only ever hand out DCI/DirectDraw surfaces +// when we have allocated one and only one image we know there cannot be any +// conflict between the two. +// +// We use timeGetTime to return the timing counts we use (since it's relative +// performance we are interested in rather than absolute compared to a clock) +// The window object sets the accuracy of the system clock (normally 1ms) by +// calling timeBeginPeriod/timeEndPeriod when it changes streaming states + +// Reset all times controlling streaming. +// Set them so that +// 1. Frames will not initially be dropped +// 2. The first frame will definitely be drawn (achieved by saying that there +// has not ben a frame drawn for a long time). + +function TBCBaseVideoRenderer.ResetStreamingTimes: HResult; +begin + FLastDraw := -1000; // set up as first frame since ages (1 sec) ago + FStreamingStart := timeGetTime; + FRenderAvg := 0; + FFrameAvg := -1; // -1000 fps :=:= "unset" + FDuration := 0; // 0 - strange value + FRenderLast := 0; + FWaitAvg := 0; + FRenderStart := 0; + FFramesDrawn := 0; + FFramesDropped := 0; + FTotAcc := 0; + FSumSqAcc := 0; + FSumSqFrameTime := 0; + FFrame := 0; // hygiene - not really needed + FLate := 0; // hygiene - not really needed + FSumFrameTime := 0; + FNormal := 0; + FEarliness := 0; + FTarget := -300000; // 30mSec early + FThrottle := 0; + FRememberStampForPerf := 0; + +{$IFDEF PERF} + FRememberFrameForPerf := 0; +{$ENDIF} + Result := NOERROR; +end; + +// Reset all times controlling streaming. Note that we're now streaming. We +// don't need to set the rendering event to have the source filter released +// as it is done during the Run processing. When we are run we immediately +// release the source filter thread and draw any image waiting (that image +// may already have been drawn once as a poster frame while we were paused) + +function TBCBaseVideoRenderer.OnStartStreaming: HResult; +begin + ResetStreamingTimes; + Result := NOERROR; +end; + +// Called at end of streaming. Fixes times for property page report + +function TBCBaseVideoRenderer.OnStopStreaming: HResult; +begin +// milenko start (better to use int64 instead of integer) +// FStreamingStart := Integer(timeGetTime) - FStreamingStart; + FStreamingStart := Int64(timeGetTime) - FStreamingStart; +// milenko end + Result := NOERROR; +end; + +// Called when we start waiting for a rendering event. +// Used to update times spent waiting and not waiting. + +procedure TBCBaseVideoRenderer.OnWaitStart; +begin +{$IFDEF PERF} + MSR_START(FWaitReal); +{$ENDIF} +end; + +// Called when we are awoken from the wait in the window OR by our allocator +// when it is hanging around until the next sample is due for rendering on a +// DCI/DirectDraw surface. We add the wait time into our rolling average. +// We grab the interface lock so that we're serialised with the application +// thread going through the run code - which in due course ends up calling +// ResetStreaming times - possibly as we run through this section of code + +procedure TBCBaseVideoRenderer.OnWaitEnd; +{$IFDEF PERF} +var + RealStream, RefTime: TReferenceTime; + // the real time now expressed as stream time. + Late, Frame: Integer; +{$ENDIF} +begin +{$IFDEF PERF} + MSR_STOP(FWaitReal); + // for a perf build we want to know just exactly how late we REALLY are. + // even if this means that we have to look at the clock again. +{$IFDEF 0} + FClock.GetTime(RealStream); // Calling clock here causes W95 deadlock! +{$ELSE} + // We will be discarding overflows like mad here! + // This is wrong really because timeGetTime() can wrap but it's + // only for PERF + RefTime := timeGetTime * 10000; + RealStream := RefTime + FTimeOffset; +{$ENDIF} + Dec(RealStream, FStart); // convert to stream time (this is a reftime) + + if (FRememberStampForPerf = 0) then + // This is probably the poster frame at the start, and it is not scheduled + // in the usual way at all. Just count it. The rememberstamp gets set + // in ShouldDrawSampleNow, so this does invalid frame recording until we + // actually start playing. + PreparePerformanceData(0, 0) + else + begin + Late := RealStream - FRememberStampForPerf; + Frame := RefTime - FRememberFrameForPerf; + PreparePerformanceData(Late, Frame); + end; + FRememberFrameForPerf := RefTime; +{$ENDIF} +end; + +// Put data on one side that describes the lateness of the current frame. +// We don't yet know whether it will actually be drawn. In direct draw mode, +// this decision is up to the filter upstream, and it could change its mind. +// The rules say that if it did draw it must call Receive(). One way or +// another we eventually get into either OnRenderStart or OnDirectRender and +// these both call RecordFrameLateness to update the statistics. + +procedure TBCBaseVideoRenderer.PreparePerformanceData(Late, Frame: Integer); +begin + FLate := Late; + FFrame := Frame; +end; + +// update the statistics: +// m_iTotAcc, m_iSumSqAcc, m_iSumSqFrameTime, m_iSumFrameTime, m_cFramesDrawn +// Note that because the properties page reports using these variables, +// 1. We need to be inside a critical section +// 2. They must all be updated together. Updating the sums here and the count +// elsewhere can result in imaginary jitter (i.e. attempts to find square roots +// of negative numbers) in the property page code. + +procedure TBCBaseVideoRenderer.RecordFrameLateness(Late, Frame: Integer); +var + _Late, _Frame: Integer; +begin + // Record how timely we are. + _Late := Late div 10000; + + // Best estimate of moment of appearing on the screen is average of + // start and end draw times. Here we have only the end time. This may + // tend to show us as spuriously late by up to 1/2 frame rate achieved. + // Decoder probably monitors draw time. We don't bother. +{$IFDEF PERF} + MSR_INTEGER(FFrameAccuracy, _Late); +{$ENDIF} + + // This is a kludge - we can get frames that are very late + // especially (at start-up) and they invalidate the statistics. + // So ignore things that are more than 1 sec off. + if (_Late > 1000) or (_Late < -1000) then + if (FFramesDrawn <= 1) then + _Late := 0 + else if (_Late > 0) then + _Late := 1000 + else + _Late := -1000; + + // The very first frame often has a invalid time, so don't + // count it into the statistics. (???) + if (FFramesDrawn > 1) then + begin + Inc(FTotAcc, _Late); + Inc(FSumSqAcc, _Late * _Late); + end; + + // calculate inter-frame time. Doesn't make sense for first frame + // second frame suffers from invalid first frame stamp. + if (FFramesDrawn > 2) then + begin + _Frame := Frame div 10000; // convert to mSec else it overflows + + // This is a kludge. It can overflow anyway (a pause can cause + // a very long inter-frame time) and it overflows at 2**31/10**7 + // or about 215 seconds i.e. 3min 35sec + if (_Frame > 1000) or (_Frame < 0) then + _Frame := 1000; + Inc(FSumSqFrameTime, _Frame * _Frame); + Assert(FSumSqFrameTime >= 0); + Inc(FSumFrameTime, _Frame); + end; + Inc(FFramesDrawn); +end; + +procedure TBCBaseVideoRenderer.ThrottleWait; +var + Throttle: Integer; +begin + if (FThrottle > 0) then + begin + Throttle := FThrottle div 10000; // convert to mSec + MSR_INTEGER(FThrottle, Throttle); + {$IFDEF DEBUG} + DbgLog(Self, Format('Throttle %d ms', [Throttle])); + {$ENDIF} + Sleep(Throttle); + end + else + Sleep(0); +end; + +// Whenever a frame is rendered it goes though either OnRenderStart +// or OnDirectRender. Data that are generated during ShouldDrawSample +// are added to the statistics by calling RecordFrameLateness from both +// these two places. + +// Called in place of OnRenderStart..OnRenderEnd +// When a DirectDraw image is drawn + +procedure TBCBaseVideoRenderer.OnDirectRender(MediaSample: IMediaSample); +begin + FRenderAvg := 0; + FRenderLast := 5000000; // If we mode switch, we do NOT want this + // to inhibit the new average getting going! + // so we set it to half a second +// MSR_INTEGER(m_idRenderAvg, m_trRenderAvg div 10000); + RecordFrameLateness(FLate, FFrame); + ThrottleWait; +end; + +// Called just before we start drawing. All we do is to get the current clock +// time (from the system) and return. We have to store the start render time +// in a member variable because it isn't used until we complete the drawing +// The rest is just performance logging. + +procedure TBCBaseVideoRenderer.OnRenderStart(MediaSample: IMediaSample); +begin + RecordFrameLateness(FLate, FFrame); + FRenderStart := timeGetTime; +end; + +// Called directly after drawing an image. We calculate the time spent in the +// drawing code and if this doesn't appear to have any odd looking spikes in +// it then we add it to the current average draw time. Measurement spikes may +// occur if the drawing thread is interrupted and switched to somewhere else. + +procedure TBCBaseVideoRenderer.OnRenderEnd(MediaSample: IMediaSample); +var + RefTime: Integer; +begin + // The renderer time can vary erratically if we are interrupted so we do + // some smoothing to help get more sensible figures out but even that is + // not enough as figures can go 9,10,9,9,83,9 and we must disregard 83 +// milenko start +// RefTime := (Integer(timeGetTime) - FRenderStart) * 10000; + RefTime := (Int64(timeGetTime) - FRenderStart) * 10000; +// milenko end + // convert mSec->UNITS + if (RefTime < FRenderAvg * 2) or (RefTime < 2 * FRenderLast) then + // DO_MOVING_AVG(m_trRenderAvg, tr); + FRenderAvg := (RefTime + (AVGPERIOD - 1) * FRenderAvg) div AVGPERIOD; + FRenderLast := RefTime; + ThrottleWait; +end; + +function TBCBaseVideoRenderer.SetSink(QualityControl: IQualityControl): HResult; +begin + FQSink := QualityControl; + Result := NOERROR; +end; + +function TBCBaseVideoRenderer.Notify(Filter: IBaseFilter; + Q: TQuality): HResult; +begin + // NOTE: We are NOT getting any locks here. We could be called + // asynchronously and possibly even on a time critical thread of + // someone else's - so we do the minumum. We only set one state + // variable (an integer) and if that happens to be in the middle + // of another thread reading it they will just get either the new + // or the old value. Locking would achieve no more than this. + + // It might be nice to check that we are being called from m_pGraph, but + // it turns out to be a millisecond or so per throw! + + // This is heuristics, these numbers are aimed at being "what works" + // rather than anything based on some theory. + // We use a hyperbola because it's easy to calculate and it includes + // a panic button asymptote (which we push off just to the left) + // The throttling fits the following table (roughly) + // Proportion Throttle (msec) + // >=1000 0 + // 900 3 + // 800 7 + // 700 11 + // 600 17 + // 500 25 + // 400 35 + // 300 50 + // 200 72 + // 125 100 + // 100 112 + // 50 146 + // 0 200 + + // (some evidence that we could go for a sharper kink - e.g. no throttling + // until below the 750 mark - might give fractionally more frames on a + // P60-ish machine). The easy way to get these coefficients is to use + // Renbase.xls follow the instructions therein using excel solver. + + if (q.Proportion >= 1000) then + FThrottle := 0 + else + // The DWORD is to make quite sure I get unsigned arithmetic + // as the constant is between 2**31 and 2**32 + FThrottle := -330000 + (388880000 div (q.Proportion + 167)); + Result := NOERROR; +end; + +// Send a message to indicate what our supplier should do about quality. +// Theory: +// What a supplier wants to know is "is the frame I'm working on NOW +// going to be late?". +// F1 is the frame at the supplier (as above) +// Tf1 is the due time for F1 +// T1 is the time at that point (NOW!) +// Tr1 is the time that f1 WILL actually be rendered +// L1 is the latency of the graph for frame F1 = Tr1-T1 +// D1 (for delay) is how late F1 will be beyond its due time i.e. +// D1 = (Tr1-Tf1) which is what the supplier really wants to know. +// Unfortunately Tr1 is in the future and is unknown, so is L1 +// +// We could estimate L1 by its value for a previous frame, +// L0 = Tr0-T0 and work off +// D1' = ((T1+L0)-Tf1) = (T1 + (Tr0-T0) -Tf1) +// Rearranging terms: +// D1' = (T1-T0) + (Tr0-Tf1) +// adding (Tf0-Tf0) and rearranging again: +// = (T1-T0) + (Tr0-Tf0) + (Tf0-Tf1) +// = (T1-T0) - (Tf1-Tf0) + (Tr0-Tf0) +// But (Tr0-Tf0) is just D0 - how late frame zero was, and this is the +// Late field in the quality message that we send. +// The other two terms just state what correction should be applied before +// using the lateness of F0 to predict the lateness of F1. +// (T1-T0) says how much time has actually passed (we have lost this much) +// (Tf1-Tf0) says how much time should have passed if we were keeping pace +// (we have gained this much). +// +// Suppliers should therefore work off: +// Quality.Late + (T1-T0) - (Tf1-Tf0) +// and see if this is "acceptably late" or even early (i.e. negative). +// They get T1 and T0 by polling the clock, they get Tf1 and Tf0 from +// the time stamps in the frames. They get Quality.Late from us. +// + +function TBCBaseVideoRenderer.SendQuality(Late, + RealStream: TReferenceTime): HResult; +var + q: TQuality; + hr: HResult; + QC: IQualityControl; + OutputPin: IPin; +begin + // If we are the main user of time, then report this as Flood/Dry. + // If our suppliers are, then report it as Famine/Glut. + // + // We need to take action, but avoid hunting. Hunting is caused by + // 1. Taking too much action too soon and overshooting + // 2. Taking too long to react (so averaging can CAUSE hunting). + // + // The reason why we use trLate as well as Wait is to reduce hunting; + // if the wait time is coming down and about to go into the red, we do + // NOT want to rely on some average which is only telling is that it used + // to be OK once. + + q.TimeStamp := RealStream; + + if (FFrameAvg < 0) then + q.Typ := Famine // guess + // Is the greater part of the time taken bltting or something else + else if (FFrameAvg > 2 * FRenderAvg) then + q.Typ := Famine // mainly other + else + q.Typ := Flood; // mainly bltting + + q.Proportion := 1000; // default + + if (FFrameAvg < 0) then + // leave it alone - we don't know enough + else if (Late > 0) then + begin + // try to catch up over the next second + // We could be Really, REALLY late, but rendering all the frames + // anyway, just because it's so cheap. + + q.Proportion := 1000 - (Late div (UNITS div 1000)); + if (q.Proportion < 500) then + q.Proportion := 500; // don't go daft. (could've been negative!) + end +// milenko start + else if (FWaitAvg > 20000) and (Late < -20000) then + begin +// if (FWaitAvg > 20000) and (Late < -20000) then + // Go cautiously faster - aim at 2mSec wait. + if (FWaitAvg >= FFrameAvg) then + begin + // This can happen because of some fudges. + // The waitAvg is how long we originally planned to wait + // The frameAvg is more honest. + // It means that we are spending a LOT of time waiting + q.Proportion := 2000 // double. + end else + begin + if (FFrameAvg + 20000 > FWaitAvg) then + q.Proportion := 1000 * (FFrameAvg div (FFrameAvg + 20000 - FWaitAvg)) + else + // We're apparently spending more than the whole frame time waiting. + // Assume that the averages are slightly out of kilter, but that we + // are indeed doing a lot of waiting. (This leg probably never + // happens, but the code avoids any potential divide by zero). + q.Proportion := 2000; + end; + if (q.Proportion > 2000) then + q.Proportion := 2000; // don't go crazy. + end; +// milenko end + + // Tell the supplier how late frames are when they get rendered + // That's how late we are now. + // If we are in directdraw mode then the guy upstream can see the drawing + // times and we'll just report on the start time. He can figure out any + // offset to apply. If we are in DIB Section mode then we will apply an + // extra offset which is half of our drawing time. This is usually small + // but can sometimes be the dominant effect. For this we will use the + // average drawing time rather than the last frame. If the last frame took + // a long time to draw and made us late, that's already in the lateness + // figure. We should not add it in again unless we expect the next frame + // to be the same. We don't, we expect the average to be a better shot. + // In direct draw mode the RenderAvg will be zero. + + q.Late := Late + FRenderAvg div 2; + +{$IFDEF PERF} + // log what we're doing + MSR_INTEGER(FQualityRate, q.Proportion); + MSR_INTEGER(FQualityTime, refTimeToMiliSec(q.Late)); +{$ENDIF} + // A specific sink interface may be set through IPin + + if (FQSink = nil) then + begin + // Get our input pin's peer. We send quality management messages + // to any nominated receiver of these things (set in the IPin + // interface), or else to our source filter. + + QC := nil; + OutputPin := FInputPin.GetConnected; + Assert(Assigned(OutputPin)); + + // And get an AddRef'd quality control interface + + hr := OutputPin.QueryInterface(IID_IQualityControl, QC); + if Succeeded(hr) then + FQSink := QC; + end; + if Assigned(FQSink) then + Result := FQSink.Notify(Self, q) + else + Result := S_FALSE; +end; + +// We are called with a valid IMediaSample image to decide whether this is to +// be drawn or not. There must be a reference clock in operation. +// Return S_OK if it is to be drawn Now (as soon as possible) +// Return S_FALSE if it is to be drawn when it's due +// Return an error if we want to drop it +// m_nNormal=-1 indicates that we dropped the previous frame and so this +// one should be drawn early. Respect it and update it. +// Use current stream time plus a number of heuristics (detailed below) +// to make the decision + +(* ??? StartTime is changing inside routine: +Inc(StartTime, E); // N.B. earliness is negative +So, maybe it should be declared as var or out? +*) + +function TBCBaseVideoRenderer.ShouldDrawSampleNow(MediaSample: IMediaSample; + StartTime: TReferenceTime; out EndTime: TReferenceTime): HResult; +var + RealStream: TReferenceTime; // the real time now expressed as stream time. + RefTime: TReferenceTime; + TrueLate, Late, Duration, t, WaitAvg, L, Frame, E, Delay + {$IFNDEF PERF} , Accuracy{$ENDIF}: Integer; + hr: HResult; + JustDroppedFrame, Res, PlayASAP: Boolean; +begin + // Don't call us unless there's a clock interface to synchronise with + + Assert(Assigned(FClock)); + +{$IFDEF PERF} + MSR_INTEGER(FTimeStamp, Integer(StartTime shr 32)); // high order 32 bits + MSR_INTEGER(FTimeStamp, Integer(StartTime)); // low order 32 bits +{$ENDIF} + // We lose a bit of time depending on the monitor type waiting for the next + // screen refresh. On average this might be about 8mSec - so it will be + // later than we think when the picture appears. To compensate a bit + // we bias the media samples by -8mSec i.e. 80000 UNITs. + // We don't ever make a stream time negative (call it paranoia) + if (StartTime >= 80000) then + begin + Dec(StartTime, 80000); + Dec(EndTime, 80000); // bias stop to to retain valid frame duration + end; + + // Cache the time stamp now. We will want to compare what we did with what + // we started with (after making the monitor allowance). + FRememberStampForPerf := StartTime; + + // Get reference times (current and late) + FClock.GetTime(int64(RealStream)); + +{$IFDEF PERF} + // While the reference clock is expensive: + // Remember the offset from timeGetTime and use that. + // This overflows all over the place, but when we subtract to get + // differences the overflows all cancel out. + FTimeOffset := RealStream - timeGetTime * 10000; +{$ENDIF} + Dec(RealStream, FStart); // convert to stream time (this is a reftime) + + // We have to wory about two versions of "lateness". The truth, which we + // try to work out here and the one measured against m_trTarget which + // includes long term feedback. We report statistics against the truth + // but for operational decisions we work to the target. + // We use TimeDiff to make sure we get an integer because we + // may actually be late (or more likely early if there is a big time + // gap) by a very long time. + TrueLate := TimeDiff(RealStream - StartTime); + Late := TrueLate; + +{$IFDEF PERF} + MSR_INTEGER(FSchLateTime, refTimeToMiliSec(TrueLate)); +{$ENDIF} + + // Send quality control messages upstream, measured against target + hr := SendQuality(Late, RealStream); + // Note: the filter upstream is allowed to this FAIL meaning "you do it". + FSupplierHandlingQuality := (hr = S_OK); + + // Decision time! Do we drop, draw when ready or draw immediately? + + Duration := EndTime - StartTime; + // We need to see if the frame rate of the file has just changed. + // This would make comparing our previous frame rate with the current + // frame rate inefficent. Hang on a moment though. I've seen files + // where the frames vary between 33 and 34 mSec so as to average + // 30fps. A minor variation like that won't hurt us. + t := FDuration div 32; + if (Duration > FDuration + t) or (Duration < FDuration - t) then + begin + // There's a major variation. Reset the average frame rate to + // exactly the current rate to disable decision 9002 for this frame, + // and remember the new rate. + FFrameAvg := Duration; + FDuration := Duration; + end; + +{$IFDEF PERF} + MSR_INTEGER(FEarliness, refTimeToMiliSec(FEarliness)); + MSR_INTEGER(FRenderAvg, refTimeToMiliSec(FRenderAvg)); + MSR_INTEGER(FFrameAvg, refTimeToMiliSec(FFrameAvg)); + MSR_INTEGER(FWaitAvg, refTimeToMiliSec(FWaitAvg)); + MSR_INTEGER(FDuration, refTimeToMiliSec(FDuration)); + + if (S_OK = MediaSample.IsDiscontinuity) then + MSR_INTEGER(FDecision, 9000); +{$ENDIF} + + // Control the graceful slide back from slow to fast machine mode. + // After a frame drop accept an early frame and set the earliness to here + // If this frame is already later than the earliness then slide it to here + // otherwise do the standard slide (reduce by about 12% per frame). + // Note: earliness is normally NEGATIVE + JustDroppedFrame := + (FSupplierHandlingQuality and + // Can't use the pin sample properties because we might + // not be in Receive when we call this + (S_OK = MediaSample.IsDiscontinuity) // he just dropped one + ) or + (FNormal = -1); // we just dropped one + + // Set m_trEarliness (slide back from slow to fast machine mode) + if (Late > 0) then + FEarliness := 0 // we are no longer in fast machine mode at all! + else if ((Late >= FEarliness) or JustDroppedFrame) then + FEarliness := Late // Things have slipped of their own accord + else + FEarliness := FEarliness - FEarliness div 8; // graceful slide + + // prepare the new wait average - but don't pollute the old one until + // we have finished with it. + // We never mix in a negative wait. This causes us to believe in fast machines + // slightly more. + if (Late < 0) then + L := -Late + else + L := 0; + WaitAvg := (L + FWaitAvg * (AVGPERIOD - 1)) div AVGPERIOD; + + RefTime := RealStream - FLastDraw; // Cd be large - 4 min pause! + if (RefTime > 10000000) then + RefTime := 10000000; // 1 second - arbitrarily. + Frame := RefTime; + + if FSupplierHandlingQuality then + Res := (Late <= Duration * 4) + else + Res := (Late + Late < Duration); + // We will DRAW this frame IF... + if ( + // ...the time we are spending drawing is a small fraction of the total + // observed inter-frame time so that dropping it won't help much. + (3 * FRenderAvg <= FFrameAvg) + + // ...or our supplier is NOT handling things and the next frame would + // be less timely than this one or our supplier CLAIMS to be handling + // things, and is now less than a full FOUR frames late. + or Res + // ...or we are on average waiting for over eight milliseconds then + // this may be just a glitch. Draw it and we'll hope to catch up. + or (FWaitAvg > 80000) + + // ...or we haven't drawn an image for over a second. We will update + // the display, which stops the video looking hung. + // Do this regardless of how late this media sample is. + or ((RealStream - FLastDraw) > UNITS) + ) then + begin + // We are going to play this frame. We may want to play it early. + // We will play it early if we think we are in slow machine mode. + // If we think we are NOT in slow machine mode, we will still play + // it early by m_trEarliness as this controls the graceful slide back. + // and in addition we aim at being m_trTarget late rather than "on time". + + PlayASAP := False; + + // we will play it AT ONCE (slow machine mode) if... + + // ...we are playing catch-up + if (JustDroppedFrame) then + begin + PlayASAP := True; +{$IFDEF PERF} + MSR_INTEGER(FDecision, 9001); +{$ENDIF} + end + // ...or if we are running below the true frame rate + // exact comparisons are glitchy, for these measurements, + // so add an extra 5% or so + else if (FFrameAvg > Duration + Duration div 16) + + // It's possible to get into a state where we are losing ground, but + // are a very long way ahead. To avoid this or recover from it + // we refuse to play early by more than 10 frames. + and (Late > -Duration * 10) then + begin + PlayASAP := True; +{$IFDEF PERF} + MSR_INTEGER(FDecision, 9002); +{$ENDIF} + end +{$IFDEF 0} + // ...or if we have been late and are less than one frame early + else if ((Late + Duration > 0) and + (FWaitAvg <= 20000) then + begin + PlayASAP := True; +{$IFDEF PERF} + MSR_INTEGER(m_idDecision, 9003); +{$ENDIF} + end +{$ENDIF} + ; + // We will NOT play it at once if we are grossly early. On very slow frame + // rate movies - e.g. clock.avi - it is not a good idea to leap ahead just + // because we got starved (for instance by the net) and dropped one frame + // some time or other. If we are more than 900mSec early, then wait. + if (Late < -9000000) then + PlayASAP := False; + + if PlayASAP then + begin + FNormal := 0; +{$IFDEF PERF} + MSR_INTEGER(FDecision, 0); +{$ENDIF} + // When we are here, we are in slow-machine mode. trLate may well + // oscillate between negative and positive when the supplier is + // dropping frames to keep sync. We should not let that mislead + // us into thinking that we have as much as zero spare time! + // We just update with a zero wait. + FWaitAvg := (FWaitAvg * (AVGPERIOD - 1)) div AVGPERIOD; + + // Assume that we draw it immediately. Update inter-frame stats + FFrameAvg := (Frame + FFrameAvg * (AVGPERIOD - 1)) div AVGPERIOD; +{$IFNDEF PERF} + // If this is NOT a perf build, then report what we know so far + // without looking at the clock any more. This assumes that we + // actually wait for exactly the time we hope to. It also reports + // how close we get to the manipulated time stamps that we now have + // rather than the ones we originally started with. It will + // therefore be a little optimistic. However it's fast. + PreparePerformanceData(TrueLate, Frame); +{$ENDIF} + FLastDraw := RealStream; + if (FEarliness > Late) then + FEarliness := Late; // if we are actually early, this is neg + Result := S_OK; // Draw it now + end + else + begin + Inc(FNormal); + // Set the average frame rate to EXACTLY the ideal rate. + // If we are exiting slow-machine mode then we will have caught up + // and be running ahead, so as we slide back to exact timing we will + // have a longer than usual gap at this point. If we record this + // real gap then we'll think that we're running slow and go back + // into slow-machine mode and vever get it straight. + FFrameAvg := Duration; +{$IFDEF PERF} + MSR_INTEGER(FDecision, 1); +{$ENDIF} + + // Play it early by m_trEarliness and by m_trTarget + E := FEarliness; + if (E < -FFrameAvg) then + E := -FFrameAvg; + Inc(StartTime, E); // N.B. earliness is negative + + Delay := -TrueLate; + if (Delay <= 0) then + Result := S_OK + else + Result := S_FALSE; // OK = draw now, FALSE = wait + + FWaitAvg := WaitAvg; + + // Predict when it will actually be drawn and update frame stats + + if (Result = S_FALSE) then // We are going to wait + begin + {$IFNDEF PERF} + Frame := TimeDiff(StartTime - FLastDraw); + {$ENDIF} + FLastDraw := StartTime; + end + else + // trFrame is already = trRealStream-m_trLastDraw; + FLastDraw := RealStream; +{$IFNDEF PERF} + if (Delay > 0) then + // Report lateness based on when we intend to play it + Accuracy := TimeDiff(StartTime - FRememberStampForPerf) + else + // Report lateness based on playing it *now*. + Accuracy := TrueLate; // trRealStream-RememberStampForPerf; + PreparePerformanceData(Accuracy, Frame); +{$ENDIF} + end; + Exit; + end; + + // We are going to drop this frame! + // Of course in DirectDraw mode the guy upstream may draw it anyway. + + // This will probably give a large negative wack to the wait avg. + FWaitAvg := WaitAvg; + +{$IFDEF PERF} + // Respect registry setting - debug only! + if (FDrawLateFrames) then + begin + Result := S_OK; // draw it when it's ready + // even though it's late. + Exit; + end; +{$ENDIF} + + // We are going to drop this frame so draw the next one early + // n.b. if the supplier is doing direct draw then he may draw it anyway + // but he's doing something funny to arrive here in that case. +{$IFDEF PERF} + MSR_INTEGER(FDecision, 2); +{$ENDIF} + FNormal := -1; + Result := E_FAIL; // drop it +end; + +// NOTE we're called by both the window thread and the source filter thread +// so we have to be protected by a critical section (locked before called) +// Also, when the window thread gets signalled to render an image, it always +// does so regardless of how late it is. All the degradation is done when we +// are scheduling the next sample to be drawn. Hence when we start an advise +// link to draw a sample, that sample's time will always become the last one +// drawn - unless of course we stop streaming in which case we cancel links + +function TBCBaseVideoRenderer.ScheduleSample(MediaSample: IMediaSample): + Boolean; +begin + // We override ShouldDrawSampleNow to add quality management + + Result := inherited ScheduleSample(MediaSample); + if not Result then + Inc(FFramesDropped); + + // m_cFramesDrawn must NOT be updated here. It has to be updated + // in RecordFrameLateness at the same time as the other statistics. +end; + +// Implementation of IQualProp interface needed to support the property page +// This is how the property page gets the data out of the scheduler. We are +// passed into the constructor the owning object in the COM sense, this will +// either be the video renderer or an external IUnknown if we're aggregated. +// We initialise our CUnknown base class with this interface pointer. Then +// all we have to do is to override NonDelegatingQueryInterface to expose +// our IQualProp interface. The AddRef and Release are handled automatically +// by the base class and will be passed on to the appropriate outer object + +function TBCBaseVideoRenderer.get_FramesDroppedInRenderer(var FramesDropped: + Integer): HResult; +begin +// milenko start + if not Assigned(@FramesDropped) then + begin + Result := E_POINTER; + Exit; + end; +// milenko end + FInterfaceLock.Lock; + try + FramesDropped := FFramesDropped; + Result := NOERROR; + finally + FInterfaceLock.UnLock; + end; +end; + +// Set *pcFramesDrawn to the number of frames drawn since +// streaming started. + +function TBCBaseVideoRenderer.get_FramesDrawn(out FramesDrawn: Integer): + HResult; +begin +// milenko start + if not Assigned(@FramesDrawn) then + begin + Result := E_POINTER; + Exit; + end; +// milenko end + FInterfaceLock.Lock; + try + FramesDrawn := FFramesDrawn; + Result := NOERROR; + finally + FInterfaceLock.UnLock; + end; +end; + +// Set iAvgFrameRate to the frames per hundred secs since +// streaming started. 0 otherwise. + +function TBCBaseVideoRenderer.get_AvgFrameRate(out AvgFrameRate: Integer): + HResult; +var + t: Integer; +begin +// milenko start + if not Assigned(@AvgFrameRate) then + begin + Result := E_POINTER; + Exit; + end; +// milenko end + FInterfaceLock.Lock; + try + if (FIsStreaming) then +// milenko start +// t := Integer(timeGetTime) - FStreamingStart + t := Int64(timeGetTime) - FStreamingStart +// milenko end + else + t := FStreamingStart; + + if (t <= 0) then + begin + AvgFrameRate := 0; + Assert(FFramesDrawn = 0); + end + else + // i is frames per hundred seconds + AvgFrameRate := MulDiv(100000, FFramesDrawn, t); + Result := NOERROR; + finally + FInterfaceLock.UnLock; + end; +end; + +// Set *piAvg to the average sync offset since streaming started +// in mSec. The sync offset is the time in mSec between when the frame +// should have been drawn and when the frame was actually drawn. + +function TBCBaseVideoRenderer.get_AvgSyncOffset(out Avg: Integer): HResult; +begin +// milenko start + if not Assigned(@Avg) then + begin + Result := E_POINTER; + Exit; + end; +// milenko end + FInterfaceLock.Lock; + try + if (nil = FClock) then + begin + Avg := 0; + Result := NOERROR; + Exit; + end; + // Note that we didn't gather the stats on the first frame + // so we use m_cFramesDrawn-1 here + if (FFramesDrawn <= 1) then + Avg := 0 + else + Avg := (FTotAcc div (FFramesDrawn - 1)); + Result := NOERROR; + finally + FInterfaceLock.UnLock; + end; +end; + +// To avoid dragging in the maths library - a cheap +// approximate integer square root. +// We do this by getting a starting guess which is between 1 +// and 2 times too large, followed by THREE iterations of +// Newton Raphson. (That will give accuracy to the nearest mSec +// for the range in question - roughly 0..1000) +// +// It would be faster to use a linear interpolation and ONE NR, but +// who cares. If anyone does - the best linear interpolation is +// to approximates sqrt(x) by +// y = x * (sqrt(2)-1) + 1 - 1/sqrt(2) + 1/(8*(sqrt(2)-1)) +// 0r y = x*0.41421 + 0.59467 +// This minimises the maximal error in the range in question. +// (error is about +0.008883 and then one NR will give error .0000something +// (Of course these are integers, so you can't just multiply by 0.41421 +// you'd have to do some sort of MulDiv). +// Anyone wanna check my maths? (This is only for a property display!) + +function isqrt(x: Integer): Integer; +var + s: Integer; +begin + s := 1; + // Make s an initial guess for sqrt(x) + if (x > $40000000) then + s := $8000 // prevent any conceivable closed loop + else + begin + while (s * s < x) do // loop cannot possible go more than 31 times + s := 2 * s; // normally it goes about 6 times + // Three NR iterations. + if (x = 0) then + s := 0 // Wouldn't it be tragic to divide by zero whenever our + // accuracy was perfect! + else + begin + s := (s * s + x) div (2 * s); + if (s >= 0) then + s := (s * s + x) div (2 * s); + if (s >= 0) then + s := (s * s + x) div (2 * s); + end; + end; + Result := s; +end; + +// +// Do estimates for standard deviations for per-frame +// statistics +// + +function TBCBaseVideoRenderer.GetStdDev(Samples: Integer; out Res: Integer; + SumSq, Tot: Int64): HResult; +var + x: Int64; +begin +// milenko start + if not Assigned(@Res) then + begin + Result := E_POINTER; + Exit; + end; +// milenko end + FInterfaceLock.Lock; + try + if (nil = FClock) then + begin + Res := 0; + Result := NOERROR; + Exit; + end; + + // If S is the Sum of the Squares of observations and + // T the Total (i.e. sum) of the observations and there were + // N observations, then an estimate of the standard deviation is + // sqrt( (S - T**2/N) / (N-1) ) + + if (Samples <= 1) then + Res := 0 + else + begin + // First frames have invalid stamps, so we get no stats for them + // So we need 2 frames to get 1 datum, so N is cFramesDrawn-1 + + // so we use m_cFramesDrawn-1 here + // ??? llMilDiv ??? +// milenko start (removed the 2 outputdebugstring messages...i added them and +// they are not needed anymore) + x := SumSq - llMulDiv(Tot, Tot, Samples, 0); + x := x div (Samples - 1); +// milenko end + Assert(x >= 0); + Res := isqrt(Longint(x)); + end; + Result := NOERROR; + + finally + FInterfaceLock.UnLock; + end; +end; + +// Set *piDev to the standard deviation in mSec of the sync offset +// of each frame since streaming started. + +function TBCBaseVideoRenderer.get_DevSyncOffset(out Dev: Integer): HResult; +begin + // First frames have invalid stamps, so we get no stats for them + // So we need 2 frames to get 1 datum, so N is cFramesDrawn-1 + Result := GetStdDev(FFramesDrawn - 1, Dev, FSumSqAcc, FTotAcc); +end; + +// Set *piJitter to the standard deviation in mSec of the inter-frame time +// of frames since streaming started. + +function TBCBaseVideoRenderer.get_Jitter(out Jitter: Integer): HResult; +begin + // First frames have invalid stamps, so we get no stats for them + // So second frame gives invalid inter-frame time + // So we need 3 frames to get 1 datum, so N is cFramesDrawn-2 + Result := GetStdDev(FFramesDrawn - 2, Jitter, FSumSqFrameTime, FSumFrameTime); +end; + +// Overidden to return our IQualProp interface + +function TBCBaseVideoRenderer.NonDelegatingQueryInterface(const IID: TGUID; + out Obj): HResult; +begin + // We return IQualProp and delegate everything else + + if IsEqualGUID(IID, IID_IQualProp) then + if GetInterface(IID_IQualProp, Obj) then + Result := S_OK + else + Result := E_FAIL + else if IsEqualGUID(IID, IID_IQualityControl) then + if GetInterface(IID_IQualityControl, Obj) then + Result := S_OK + else + Result := E_FAIL + else + Result := inherited NonDelegatingQueryInterface(IID, Obj); +end; + +// Override JoinFilterGraph so that, just before leaving +// the graph we can send an EC_WINDOW_DESTROYED event + +function TBCBaseVideoRenderer.JoinFilterGraph(Graph: IFilterGraph; + Name: PWideChar): HResult; +var + Filter: IBaseFilter; +begin + // Since we send EC_ACTIVATE, we also need to ensure + // we send EC_WINDOW_DESTROYED or the resource manager may be + // holding us as a focus object + if (Graph = nil) and Assigned(FGraph) then + begin + // We were in a graph and now we're not + // Do this properly in case we are aggregated + QueryInterface(IID_IBaseFilter, Filter); + NotifyEvent(EC_WINDOW_DESTROYED, Integer(Filter), 0); + Filter := nil; + end; + + Result := inherited JoinFilterGraph(Graph, Name); +end; + +// milenko start (added TBCPullPin) +constructor TBCPullPin.Create; +begin + inherited Create; + FReader := nil; + FAlloc := nil; + FState := TM_Exit; +end; + +destructor TBCPullPin.Destroy; +begin + Disconnect; +end; + +procedure TBCPullPin.Process; +var + Discontinuity: Boolean; + Actual: TAllocatorProperties; + hr: HRESULT; + Start, Stop, Current, AlignStop: TReferenceTime; + Request: DWORD; + Sample: IMediaSample; + StopThis: Int64; +begin + // is there anything to do? + if (FStop <= FStart) then + begin + EndOfStream; + Exit; + end; + + Discontinuity := True; + + // if there is more than one sample at the allocator, + // then try to queue 2 at once in order to overlap. + // -- get buffer count and required alignment + FAlloc.GetProperties(Actual); + + // align the start position downwards + Start := AlignDown(FStart div UNITS, Actual.cbAlign) * UNITS; + Current := Start; + + Stop := FStop; + if (Stop > FDuration) then Stop := FDuration; + + // align the stop position - may be past stop, but that + // doesn't matter + AlignStop := AlignUp(Stop div UNITS, Actual.cbAlign) * UNITS; + + if not FSync then + begin + // Break out of the loop either if we get to the end or we're asked + // to do something else + while (Current < AlignStop) do + begin + // Break out without calling EndOfStream if we're asked to + // do something different + if CheckRequest(@Request) then Exit; + + // queue a first sample + if (Actual.cBuffers > 1) then + begin + hr := QueueSample(Current, AlignStop, True); + Discontinuity := False; + if FAILED(hr) then Exit; + end; + + // loop queueing second and waiting for first.. + while (Current < AlignStop) do + begin + hr := QueueSample(Current, AlignStop, Discontinuity); + Discontinuity := False; + if FAILED(hr) then Exit; + + hr := CollectAndDeliver(Start, Stop); + if (S_OK <> hr) then + begin + // stop if error, or if downstream filter said + // to stop. + Exit; + end; + end; + + if (Actual.cBuffers > 1) then + begin + hr := CollectAndDeliver(Start, Stop); + if FAILED(hr) then Exit; + end; + end; + end else + begin + // sync version of above loop + while (Current < AlignStop) do + begin + // Break out without calling EndOfStream if we're asked to + // do something different + if CheckRequest(@Request) then Exit; + + hr := FAlloc.GetBuffer(Sample, nil, nil, 0); + if FAILED(hr) then + begin + OnError(hr); + Exit; + end; + + StopThis := Current + (Sample.GetSize * UNITS); + if (StopThis > AlignStop) then StopThis := AlignStop; + Sample.SetTime(@Current, @StopThis); + Current := StopThis; + + if Discontinuity then + begin + Sample.SetDiscontinuity(True); + Discontinuity := False; + end; + + hr := FReader.SyncReadAligned(Sample); + + if FAILED(hr) then + begin + Sample := nil; + OnError(hr); + Exit; + end; + + hr := DeliverSample(Sample, Start, Stop); + if (hr <> S_OK) then + begin + if FAILED(hr) then OnError(hr); + Exit; + end; + end; + end; + + EndOfStream; +end; + +procedure TBCPullPin.CleanupCancelled; +var + Sample: IMediaSample; + Unused: DWORD; +begin + while True do + begin + FReader.WaitForNext( + 0, // no wait + Sample, + Unused); + if Assigned(Sample) then Sample := nil + else Exit; + end; +end; + +function TBCPullPin.PauseThread: HRESULT; +begin + FAccessLock.Lock; + try + if not ThreadExists then + begin + Result := E_UNEXPECTED; + Exit; + end; + + // need to flush to ensure the thread is not blocked + // in WaitForNext + Result := FReader.BeginFlush; + if FAILED(Result) then Exit; + + FState := TM_Pause; + Result := CallWorker(Cardinal(TM_Pause)); + + FReader.EndFlush; + finally + FAccessLock.UnLock; + end; +end; + +function TBCPullPin.StartThread: HRESULT; +begin + FAccessLock.Lock; + try + if not Assigned(FAlloc) or not Assigned(FReader) then + begin + Result := E_UNEXPECTED; + Exit; + end; + + if not ThreadExists then + begin + // commit allocator + Result := FAlloc.Commit; + if FAILED(Result) then Exit; + + // start thread + if not Create_ then + begin + Result := E_FAIL; + Exit; + end; + end; + + FState := TM_Start; + Result := HRESULT(CallWorker(DWORD(FState))); + finally + FAccessLock.UnLock; + end; +end; + +function TBCPullPin.StopThread: HRESULT; +begin + FAccessLock.Lock; + try + if not ThreadExists then + begin + Result := S_FALSE; + Exit; + end; + + // need to flush to ensure the thread is not blocked + // in WaitForNext + Result := FReader.BeginFlush; + if FAILED(Result) then Exit; + + FState := TM_Exit; + Result := CallWorker(Cardinal(TM_Exit)); + + FReader.EndFlush; + + // wait for thread to completely exit + Close; + + // decommit allocator + if Assigned(FAlloc) then FAlloc.Decommit; + Result := S_OK; + finally + FAccessLock.UnLock; + end; +end; + +function TBCPullPin.QueueSample(var tCurrent: TReferenceTime; tAlignStop: TReferenceTime; bDiscontinuity: Boolean): HRESULT; +var + Sample: IMediaSample; + StopThis: Int64; +begin + Result := FAlloc.GetBuffer(Sample, nil, nil, 0); + if FAILED(Result) then Exit; + + StopThis := tCurrent + (Sample.GetSize * UNITS); + if (StopThis > tAlignStop) then StopThis := tAlignStop; + + Sample.SetTime(@tCurrent, @StopThis); + tCurrent := StopThis; + + Sample.SetDiscontinuity(bDiscontinuity); + + Result := FReader.Request(Sample,0); + if FAILED(Result) then + begin + Sample := nil; + CleanupCancelled; + OnError(Result); + end; +end; + +function TBCPullPin.CollectAndDeliver(tStart,tStop: TReferenceTime): HRESULT; +var + Sample: IMediaSample; + Unused: DWORD; +begin + Result := FReader.WaitForNext(INFINITE,Sample,Unused); + if FAILED(Result) then + begin + if Assigned(Sample) then Sample := nil; + end else + begin + Result := DeliverSample(Sample, tStart, tStop); + end; + if FAILED(Result) then + begin + CleanupCancelled; + OnError(Result); + end; +end; + +function TBCPullPin.DeliverSample(pSample: IMediaSample; tStart,tStop: TReferenceTime): HRESULT; +var + t1, t2: TReferenceTime; +begin + // fix up sample if past actual stop (for sector alignment) + pSample.GetTime(t1, t2); + if (t2 > tStop) then t2 := tStop; + + // adjust times to be relative to (aligned) start time + dec(t1,tStart); + dec(t2,tStart); + pSample.SetTime(@t1, @t2); + + Result := Receive(pSample); + pSample := nil; +end; + +function TBCPullPin.ThreadProc: DWord; +var + cmd: DWORD; +begin + Result := 1; // ??? + while True do + begin + cmd := GetRequest; + case TThreadMsg(cmd) of + TM_Exit: + begin + Reply(S_OK); + Result := 0; + Exit; + end; + TM_Pause: + begin + // we are paused already + Reply(S_OK); + break; + end; + TM_Start: + begin + Reply(S_OK); + Process; + break; + end; + end; + + // at this point, there should be no outstanding requests on the + // upstream filter. + // We should force begin/endflush to ensure that this is true. + // !!!Note that we may currently be inside a BeginFlush/EndFlush pair + // on another thread, but the premature EndFlush will do no harm now + // that we are idle. + FReader.BeginFlush; + CleanupCancelled; + FReader.EndFlush; + end; +end; + +// returns S_OK if successfully connected to an IAsyncReader interface +// from this object +// Optional allocator should be proposed as a preferred allocator if +// necessary +function TBCPullPin.Connect(pUnk: IUnknown; pAlloc: IMemAllocator; bSync: Boolean): HRESULT; +var + Total, Avail: Int64; +begin + FAccessLock.Lock; + try + if Assigned(FReader) then + begin + Result := VFW_E_ALREADY_CONNECTED; + Exit; + end; + + Result := pUnk.QueryInterface(IID_IAsyncReader, FReader); + if FAILED(Result) then Exit; + + Result := DecideAllocator(pAlloc, nil); + if FAILED(Result) then + begin + Disconnect; + Exit; + end; + + Result := FReader.Length(Total, Avail); + if FAILED(Result) then + begin + Disconnect; + Exit; + end; + + // convert from file position to reference time + FDuration := Total * UNITS; + FStop := FDuration; + FStart := 0; + + FSync := bSync; + + Result := S_OK; + finally + FAccessLock.UnLock; + end; +end; + +// disconnect any connection made in Connect +function TBCPullPin.Disconnect: HRESULT; +begin + FAccessLock.Lock; + try + StopThread; + + if Assigned(FReader) then FReader := nil; + + if Assigned(FAlloc) then FAlloc := nil; + + Result := S_OK; + finally + FAccessLock.UnLock; + end; +end; + +// agree an allocator using RequestAllocator - optional +// props param specifies your requirements (non-zero fields). +// returns an error code if fail to match requirements. +// optional IMemAllocator interface is offered as a preferred allocator +// but no error occurs if it can't be met. +function TBCPullPin.DecideAllocator(pAlloc: IMemAllocator; pProps: PAllocatorProperties): HRESULT; +var + pRequest: PAllocatorProperties; + Request: TAllocatorProperties; +begin + if (pProps = nil) then + begin + Request.cBuffers := 3; + Request.cbBuffer := 64*1024; + Request.cbAlign := 0; + Request.cbPrefix := 0; + pRequest := @Request; + end else + begin + pRequest := pProps; + end; + Result := FReader.RequestAllocator(pAlloc,pRequest,FAlloc); +end; + +function TBCPullPin.Seek(tStart, tStop: TReferenceTime): HRESULT; +var + AtStart: TThreadMsg; +begin + FAccessLock.Lock; + try + AtStart := FState; + if (AtStart = TM_Start) then + begin + BeginFlush; + PauseThread; + EndFlush; + end; + + FStart := tStart; + FStop := tStop; + + Result := S_OK; + if (AtStart = TM_Start) then Result := StartThread; + finally + FAccessLock.UnLock; + end; +end; + +function TBCPullPin.Duration(out ptDuration: TReferenceTime): HRESULT; +begin + ptDuration := FDuration; + Result := S_OK; +end; + +// start pulling data +function TBCPullPin.Active: HRESULT; +begin + ASSERT(not ThreadExists); + Result := StartThread; +end; + +// stop pulling data +function TBCPullPin.Inactive: HRESULT; +begin + StopThread; + Result := S_OK; +end; + +function TBCPullPin.AlignDown(ll: Int64; lAlign: LongInt): Int64; +begin + Result := ll and not (lAlign-1); +end; + +function TBCPullPin.AlignUp(ll: Int64; lAlign: LongInt): Int64; +begin + Result := (ll + (lAlign -1)) and not (lAlign -1); +end; + +function TBCPullPin.GetReader: IAsyncReader; +begin + Result := FReader; +end; +// milenko end + +// milenko start reftime implementation +procedure TBCRefTime.Create_; +begin + FTime := 0; +end; + +procedure TBCRefTime.Create_(msecs: Longint); +begin + FTime := MILLISECONDS_TO_100NS_UNITS(msecs); +end; + +function TBCRefTime.SetTime(var rt: TBCRefTime): TBCRefTime; +begin + FTime := rt.FTime; + Result := Self; +end; + +function TBCRefTime.SetTime(var ll: LONGLONG): TBCRefTime; +begin + FTime := ll; +end; + +function TBCRefTime.AddTime(var rt: TBCRefTime): TBCRefTime; +begin + TReferenceTime(Self) := TReferenceTime(Self) + TReferenceTime(rt); + Result := Self; +end; + +function TBCRefTime.SubstractTime(var rt: TBCRefTime): TBCRefTime; +begin + TReferenceTime(Self) := TReferenceTime(Self) - TReferenceTime(rt); + Result := Self; +end; + +function TBCRefTime.Millisecs: Longint; +begin + Result := fTime div (UNITS div MILLISECONDS); +end; + +function TBCRefTime.GetUnits: LONGLONG; +begin + Result := fTime; +end; +// milenko end + +// milenko start schedule implementation +constructor TBCAdvisePacket.Create; +begin + inherited Create; +end; + +constructor TBCAdvisePacket.Create(Next: TBCAdvisePacket; Time: LONGLONG); +begin + inherited Create; + FNext := Next; + FEventTime := Time; +end; + +procedure TBCAdvisePacket.InsertAfter(Packet: TBCAdvisePacket); +begin + Packet.FNext := FNext; + FNext := Packet; +end; + +function TBCAdvisePacket.IsZ: Boolean; +begin + Result := FNext = nil; +end; + +function TBCAdvisePacket.RemoveNext: TBCAdvisePacket; +var + Next, + NewNext : TBCAdvisePacket; +begin + Next := FNext; + NewNext := Next.FNext; + FNext := NewNext; + Result := Next; +end; + +procedure TBCAdvisePacket.DeleteNext; +begin + RemoveNext.Free; +end; + +function TBCAdvisePacket.Next: TBCAdvisePacket; +begin + Result := FNext; + if Result.IsZ then Result := nil; +end; + +function TBCAdvisePacket.Cookie: DWORD; +begin + Result := FAdviseCookie; +end; + +constructor TBCAMSchedule.Create(Event: THandle); +begin + inherited Create('TBCAMSchedule'); + + FZ := TBCAdvisePacket.Create(nil,MAX_TIME); + FHead := TBCAdvisePacket.Create(FZ,0); + + FNextCookie := 0; + FAdviseCount := 0; + FAdviseCache := nil; + FCacheCount := 0; + FEvent := Event; + + FSerialize := TBCCritSec.Create; + + FZ.FAdviseCookie := 0; + FHead.FAdviseCookie := FZ.FAdviseCookie; +end; + +destructor TBCAMSchedule.Destroy; +var + p, p_next : TBCAdvisePacket; +begin + FSerialize.Lock; + try + // Delete cache + p := FAdviseCache; + while (p <> nil) do + begin + p_next := p.FNext; + FreeAndNil(p); + p := p_next; + end; + + ASSERT(FAdviseCount = 0); + // Better to be safe than sorry + if (FAdviseCount > 0) then + begin + DumpLinkedList; + while not FHead.FNext.IsZ do + begin + FHead.DeleteNext; + dec(FAdviseCount); + end; + end; + + // If, in the debug version, we assert twice, it means, not only + // did we have left over advises, but we have also let m_dwAdviseCount + // get out of sync. with the number of advises actually on the list. + ASSERT(FAdviseCount = 0); + finally + FSerialize.Unlock; + end; + FreeAndNil(FSerialize); + inherited Destroy; +end; + +function TBCAMSchedule.GetAdviseCount: DWORD; +begin + // No need to lock, m_dwAdviseCount is 32bits & declared volatile + // DCODER: No volatile in Delphi -> needs a lock ? + FSerialize.Lock; + try + Result := FAdviseCount; + finally + FSerialize.UnLock; + end; +end; + +function TBCAMSchedule.GetNextAdviseTime: TReferenceTime; +begin + FSerialize.Lock; // Need to stop the linked list from changing + try + Result := FHead.FNext.FEventTime; + finally + FSerialize.UnLock; + end; +end; + +function TBCAMSchedule.AddAdvisePacket(const time1, time2: TReferenceTime; + h: THandle; periodic: Boolean): DWORD; +var + p : TBCAdvisePacket; +begin + // Since we use MAX_TIME as a sentry, we can't afford to + // schedule a notification at MAX_TIME + + ASSERT(time1 < MAX_TIME); + FSerialize.Lock; + try + if Assigned(FAdviseCache) then + begin + p := FAdviseCache; + FAdviseCache := p.FNext; + dec(FCacheCount); + end else + begin + p := TBCAdvisePacket.Create; + end; + + if Assigned(p) then + begin + p.FEventTime := time1; + p.FPeriod := time2; + p.FNotify := h; + p.FPeriodic := periodic; + Result := AddAdvisePacket(p); + end else + begin + Result := 0; + end; + finally + FSerialize.UnLock; + end; +end; + +function TBCAMSchedule.Unadvise(AdviseCookie: DWORD): HRESULT; +var + p_prev, p_n : TBCAdvisePacket; +begin + Result := S_FALSE; + p_prev := FHead; + + FSerialize.Lock; + try + p_n := p_prev.Next; + while Assigned(p_n) do // The Next() method returns NULL when it hits z + begin + if (p_n.FAdviseCookie = AdviseCookie) then + begin + Delete(p_prev.RemoveNext); + dec(FAdviseCount); + Result := S_OK; + // Having found one cookie that matches, there should be no more + {$IFDEF DEBUG} + p_n := p_prev.Next; + while Assigned(p_n) do + begin + ASSERT(p_n.FAdviseCookie <> AdviseCookie); + p_prev := p_n; + p_n := p_prev.Next; + end; + {$ENDIF} + break; + end; + p_prev := p_n; + p_n := p_prev.Next; + end; + finally + FSerialize.UnLock; + end; +end; + +function TBCAMSchedule.Advise(const Time_: TReferenceTime): TReferenceTime; +var + NextTime : TReferenceTime; + Advise : TBCAdvisePacket; +begin + {$IFDEF DEBUG} + DbgLog( + Self, 'TBCAMSchedule.Advise( ' + + inttostr((Time_ div (UNITS div MILLISECONDS))) + ' ms ' + ); + {$ENDIF} + + FSerialize.Lock; + try + {$IFDEF DEBUG} + DumpLinkedList; + {$ENDIF} + + // Note - DON'T cache the difference, it might overflow + Advise := FHead.FNext; + NextTime := Advise.FEventTime; + while ((Time_ >= NextTime) and not Advise.IsZ) do + begin + // DCODER: assert raised here + ASSERT(Advise.FAdviseCookie > 0); // If this is zero, its the head or the tail!! + ASSERT(Advise.FNotify <> INVALID_HANDLE_VALUE); + if (Advise.FPeriodic = True) then + begin + ReleaseSemaphore(Advise.FNotify,1,nil); + Advise.FEventTime := Advise.FEventTime + Advise.FPeriod; + ShuntHead; + end else + begin + ASSERT(Advise.FPeriodic = False); + SetEvent(Advise.FNotify); + dec(FAdviseCount); + Delete(FHead.RemoveNext); + end; + Advise := FHead.FNext; + NextTime := Advise.FEventTime; + end; + finally + FSerialize.UnLock; + end; + {$IFDEF DEBUG} + DbgLog( + Self, 'TBCAMSchedule.Advise(Next time stamp: ' + + inttostr((NextTime div (UNITS div MILLISECONDS))) + + ' ms, for advise ' + inttostr(Advise.FAdviseCookie) + ); + {$ENDIF} + Result := NextTime; +end; + +function TBCAMSchedule.GetEvent: THandle; +begin + Result := FEvent; +end; + +procedure TBCAMSchedule.DumpLinkedList; +{$IFDEF DEBUG} +var + i : integer; + p : TBCAdvisePacket; +{$ENDIF} +begin + {$IFDEF DEBUG} + FSerialize.Lock; + try + DbgLog(Self,'TBCAMSchedule.DumpLinkedList'); + i := 0; + p := FHead; + while True do + begin + if p = nil then break; + DbgLog( + Self, 'Advise List # ' + inttostr(i) + ', Cookie ' + + inttostr(p.FAdviseCookie) + ', RefTime ' + + inttostr(p.FEventTime div (UNITS div MILLISECONDS)) + ); + inc(i); + p := p.Next; + end; + finally + FSerialize.Unlock; + end; + {$ENDIF} +end; + +function TBCAMSchedule.AddAdvisePacket(Packet: TBCAdvisePacket): DWORD; +var + p_prev, p_n : TBCAdvisePacket; +begin + ASSERT((Packet.FEventTime >= 0) and (Packet.FEventTime < MAX_TIME)); + + {$IFDEF DEBUG} + ASSERT(FSerialize.CritCheckIn); + {$ENDIF} + + p_prev := FHead; + inc(FNextCookie); + Packet.FAdviseCookie := FNextCookie; + Result := Packet.FAdviseCookie; + // This relies on the fact that z is a sentry with a maximal m_rtEventTime + + while True do + begin + p_n := p_prev.FNext; + if (p_n.FEventTime >= Packet.FEventTime) then break; + p_prev := p_n; + end; + + p_prev.InsertAfter(Packet); + inc(FAdviseCount); + + {$IFDEF DEBUG} + DbgLog( + Self, 'Added advise ' + inttostr(Packet.FAdviseCookie) + ', for thread ' + + inttostr(GetCurrentThreadId) + ', scheduled at ' + + inttostr(Packet.FEventTime div (UNITS div MILLISECONDS)) + ); + {$ENDIF} + + // If packet added at the head, then clock needs to re-evaluate wait time. + if (p_prev = FHead) then SetEvent(FEvent); +end; + +procedure TBCAMSchedule.ShuntHead; +var + p_prev, p_n : TBCAdvisePacket; + Packet : TBCAdvisePacket; +begin + p_prev := FHead; + p_n := nil; + + FSerialize.Lock; + try + Packet := FHead.FNext; + // This will catch both an empty list, + // and if somehow a MAX_TIME time gets into the list + // (which would also break this method). + ASSERT(Packet.FEventTime < MAX_TIME); + + // This relies on the fact that z is a sentry with a maximal m_rtEventTime + while True do + begin + p_n := p_prev.FNext; + if (p_n.FEventTime >= Packet.FEventTime) then break; + p_prev := p_n; + end; + + // If p_prev == pPacket then we're already in the right place + if (p_prev <> Packet) then + begin + FHead.FNext := Packet.FNext; + p_prev.FNext := Packet; + p_prev.FNext.FNext := p_n; + end; + + {$IFDEF DEBUG} + DbgLog( + Self, 'Periodic advise ' + inttostr(Packet.FAdviseCookie) + ', shunted to ' + + inttostr(Packet.FEventTime div (UNITS div MILLISECONDS)) + ); + {$ENDIF} + + finally + FSerialize.Unlock; + end; +end; + +procedure TBCAMSchedule.Delete(Packet: TBCAdvisePacket); +const + CacheMax = 5; // Don't bother caching more than five +begin + if (FCacheCount >= CacheMax) then FreeAndNil(Packet) + else + begin + FSerialize.Lock; + try + Packet.FNext := FAdviseCache; + FAdviseCache := Packet; + inc(FCacheCount); + finally + FSerialize.Unlock; + end; + end; +end; +// milenko end + +// milenko start refclock implementation +function AdviseThreadFunction(p: Pointer): DWORD; stdcall; +begin + Result := TBCBaseReferenceClock(p).AdviseThread; +end; + +constructor TBCBaseReferenceClock.Create(Name: String; Unk: IUnknown; out hr: HRESULT; + Sched: TBCAMSchedule); +var + tc : TIMECAPS; + ThreadID : DWORD; +begin + inherited Create(Name,Unk); + FLastGotTime := 0; + FTimerResolution := 0; + FAbort := False; + if not Assigned(Sched) + then FSchedule := TBCAMSchedule.Create(CreateEvent(nil,False,False,nil)) + else FSchedule := Sched; + + ASSERT(fSchedule <> nil); + if not Assigned(FSchedule) then + begin + hr := E_OUTOFMEMORY; + end else + begin + FLock := TBCCritSec.Create; + // Set up the highest resolution timer we can manage + if (timeGetDevCaps(@tc, sizeof(tc)) = TIMERR_NOERROR) + then FTimerResolution := tc.wPeriodMin + else FTimerResolution := 1; + + timeBeginPeriod(FTimerResolution); + + // Initialise our system times - the derived clock should set the right values + FPrevSystemTime := timeGetTime; + FPrivateTime := (UNITS div MILLISECONDS) * FPrevSystemTime; + + {$IFDEF PERF} + FGetSystemTime := MSR_REGISTER('TBCBaseReferenceClock.GetTime'); + {$ENDIF} + + if not Assigned(Sched) then + begin + FThread := CreateThread(nil, // Security attributes + 0, // Initial stack size + @AdviseThreadFunction, // Thread start address + Self, // Thread parameter + 0, // Creation flags + ThreadID); // Thread identifier + + if (FThread > 0) then + begin + SetThreadPriority(FThread, THREAD_PRIORITY_TIME_CRITICAL); + end else + begin + hr := E_FAIL; + CloseHandle(FSchedule.GetEvent); + FreeAndNil(FSchedule); + end; + end; + end; +end; + +destructor TBCBaseReferenceClock.Destroy; +begin + if (FTimerResolution > 0) then + begin + timeEndPeriod(FTimerResolution); + FTimerResolution := 0; + end; + + FSchedule.DumpLinkedList; + + if (FThread > 0) then + begin + FAbort := True; + TriggerThread; + WaitForSingleObject(FThread, INFINITE); + CloseHandle(FSchedule.GetEvent); + FreeAndNil(FSchedule); + end; + + if Assigned(FLock) then FreeAndNil(FLock); + + inherited Destroy; +end; + +function TBCBaseReferenceClock.AdviseThread: HRESULT; +var + dwWait : DWORD; + rtNow : TReferenceTime; + llWait : LONGLONG; +begin + dwWait := INFINITE; + + // The first thing we do is wait until something interesting happens + // (meaning a first advise or shutdown). This prevents us calling + // GetPrivateTime immediately which is goodness as that is a virtual + // routine and the derived class may not yet be constructed. (This + // thread is created in the base class constructor.) + + while not FAbort do + begin + // Wait for an interesting event to happen + {$IFDEF DEBUG} + DbgLog(Self,'AdviseThread Delay: ' + inttostr(dwWait) + ' ms'); + {$ENDIF} + + WaitForSingleObject(FSchedule.GetEvent, dwWait); + if FAbort then break; + + // There are several reasons why we need to work from the internal + // time, mainly to do with what happens when time goes backwards. + // Mainly, it stop us looping madly if an event is just about to + // expire when the clock goes backward (i.e. GetTime stop for a + // while). + rtNow := GetPrivateTime; + + {$IFDEF DEBUG} + DbgLog( + Self,'AdviseThread Woke at = ' + inttostr(RefTimeToMiliSec(rtNow)) + ' ms' + ); + {$ENDIF} + + // We must add in a millisecond, since this is the resolution of our + // WaitForSingleObject timer. Failure to do so will cause us to loop + // franticly for (approx) 1 a millisecond. + FNextAdvise := FSchedule.Advise(10000 + rtNow); + llWait := FNextAdvise - rtNow; + + ASSERT(llWait > 0); + + llWait := RefTimeToMiliSec(llWait); + // DON'T replace this with a max!! (The type's of these things is VERY important) + if (llWait > REFERENCE_TIME(HIGH(DWORD))) then dwWait := HIGH(DWORD) + else dwWait := DWORD(llWait) + end; + Result := NOERROR; +end; + +function TBCBaseReferenceClock.NonDelegatingQueryInterface(const IID: TGUID; + out Obj): HResult; stdcall; +begin + if (IsEqualGUID(IID,IID_IReferenceClock)) then + begin + if GetInterface(IID,Obj) then Result := S_OK + else Result := E_NOINTERFACE; + end + else + Result := inherited NonDelegatingQueryInterface(IID, Obj); +end; + +function TBCBaseReferenceClock.GetTime(out Time: int64): HResult; stdcall; +var + Now_ : TReferenceTime; +begin + if Assigned(@Time) then + begin + FLock.Lock; + try + Now_ := GetPrivateTime; + if (Now_ > FLastGotTime) then + begin + FLastGotTime := Now_; + Result := S_OK; + end else + begin + Result := S_FALSE; + end; + + Time := FLastGotTime; + finally + FLock.UnLock; + end; + {$IFDEF PERF} + MSR_INTEGER(FGetSystemTime, Time div (UNITS div MILLISECONDS)); + {$ENDIF} + end else Result := E_POINTER; +end; + +function TBCBaseReferenceClock.AdviseTime(BaseTime, StreamTime: int64; + Event: THandle; out AdviseCookie: DWORD): HResult; stdcall; +var + RefTime : TReferenceTime; +begin + if @AdviseCookie = nil then + begin + Result := E_POINTER; + Exit; + end; + AdviseCookie := 0; + + // Check that the event is not already set + ASSERT(WAIT_TIMEOUT = WaitForSingleObject(Event,0)); + + RefTime := BaseTime + StreamTime; + if ((RefTime <= 0) or (RefTime = MAX_TIME)) then + begin + Result := E_INVALIDARG; + end else + begin + AdviseCookie := FSchedule.AddAdvisePacket(RefTime, 0, Event, False); + if AdviseCookie > 0 then Result := NOERROR + else Result := E_OUTOFMEMORY; + end; +end; + +function TBCBaseReferenceClock.AdvisePeriodic(const StartTime, PeriodTime: int64; + Semaphore: THandle; out AdviseCookie: DWORD): HResult; stdcall; +begin + if @AdviseCookie = nil then + begin + Result := E_POINTER; + Exit; + end; + + AdviseCookie := 0; + + if ((StartTime > 0) and (PeriodTime > 0) and (StartTime <> MAX_TIME)) then + begin + AdviseCookie := FSchedule.AddAdvisePacket(StartTime,PeriodTime,Semaphore,True); + if AdviseCookie > 0 then Result := NOERROR + else Result := E_OUTOFMEMORY; + end + else Result := E_INVALIDARG; +end; + +function TBCBaseReferenceClock.Unadvise(AdviseCookie: DWORD): HResult; stdcall; +begin + Result := FSchedule.Unadvise(AdviseCookie); +end; + +function TBCBaseReferenceClock.GetPrivateTime: TReferenceTime; +var + Time_ : DWORD; +begin + FLock.Lock; + try + (* If the clock has wrapped then the current time will be less than + * the last time we were notified so add on the extra milliseconds + * + * The time period is long enough so that the likelihood of + * successive calls spanning the clock cycle is not considered. + *) + + Time_ := timeGetTime; + FPrivateTime := FPrivateTime + Int32x32To64(UNITS div MILLISECONDS, DWORD(Time_ - FPrevSystemTime)); + FPrevSystemTime := Time_; + finally + FLock.UnLock; + end; + + Result := FPrivateTime; +end; + +function TBCBaseReferenceClock.SetTimeDelta(const TimeDelta: TReferenceTime): HRESULT; stdcall; +{$IFDEF DEBUG} +var + llDelta : LONGLONG; + usDelta : Longint; + delta : DWORD; + Severity : integer; +{$ENDIF} +begin +{$IFDEF DEBUG} + // Just break if passed an improper time delta value + if TimeDelta > 0 then llDelta := TimeDelta + else llDelta := -TimeDelta; + + if (llDelta > UNITS * 1000) then + begin + DbgLog(Self,'Bad Time Delta'); + // DebugBreak; + end; + + // We're going to calculate a "severity" for the time change. Max -1 + // min 8. We'll then use this as the debug logging level for a + // debug log message. + usDelta := Longint(TimeDelta div 10); // Delta in micro-secs + + delta := abs(usDelta); // varying delta + + // Severity == 8 - ceil(log(abs( micro-secs delta))) + Severity := 8; + while (delta > 0) do + begin + delta := delta shr 3; // div 8 + dec(Severity); + end; + + // Sev == 0 => > 2 second delta! + DbgLog( + Self, 'Sev ' + inttostr(Severity) + ': CSystemClock::SetTimeDelta(' + + inttostr(usDelta) + ' us) ' + inttostr(RefTimeToMiliSec(FPrivateTime)) + + ' -> ' + inttostr(RefTimeToMiliSec(TimeDelta + FPrivateTime)) + ' ms' + ); +{$ENDIF} + + FLock.Lock; + try + FPrivateTime := FPrivateTime + TimeDelta; + // If time goes forwards, and we have advises, then we need to + // trigger the thread so that it can re-evaluate its wait time. + // Since we don't want the cost of the thread switches if the change + // is really small, only do it if clock goes forward by more than + // 0.5 millisecond. If the time goes backwards, the thread will + // wake up "early" (relativly speaking) and will re-evaluate at + // that time. + if ((TimeDelta > 5000) and (FSchedule.GetAdviseCount > 0)) then TriggerThread; + finally + FLock.UnLock; + end; + Result := NOERROR; +end; + +function TBCBaseReferenceClock.GetSchedule : TBCAMSchedule; +begin + Result := FSchedule; +end; + +procedure TBCBaseReferenceClock.TriggerThread; +begin +{$IFDEF DEBUG} + DbgLog(Self,'TriggerThread : ' + inttostr(FSchedule.GetEvent)); +{$ENDIF} + SetEvent(FSchedule.GetEvent); +end; +// milenko end + +// milenko start sysclock implementation +constructor TBCSystemClock.Create(Name: WideString; Unk : IUnknown; out hr : HRESULT); +begin + inherited Create(Name,Unk,hr); +end; + +function TBCSystemClock.NonDelegatingQueryInterface(const IID: TGUID; out Obj): HResult; +begin + if IsEqualGUID(IID,IID_IPersist) then + begin + if GetInterface(IID,Obj) then Result := S_OK + else Result := E_NOINTERFACE; + end else + if IsEqualGUID(IID,IID_IAMClockAdjust) then + begin + if GetInterface(IID,Obj) then Result := S_OK + else Result := E_NOINTERFACE; + end + else Result := inherited NonDelegatingQueryInterface(IID,Obj); +end; + +function TBCSystemClock.GetClassID(out classID: TCLSID): HResult; stdcall; +begin + if not Assigned(@ClassID) then + begin + Result := E_POINTER; + Exit; + end; + classID := CLSID_SystemClock; + Result := NOERROR; +end; + +function TBCSystemClock.SetClockDelta(rtDelta: TReferenceTime): HResult; stdcall; +begin + Result := SetTimeDelta(rtDelta); +end; +// milenko end + +initialization +{$IFDEF DEBUG} + {$IFDEF VER130} + AssertErrorProc := @DbgAssert; + {$ELSE} + AssertErrorProc := DbgAssert; + {$ENDIF} + {$IFNDEF MESSAGE} + AssignFile(DebugFile, ParamStr(0) + '.log'); + if FileExists(ParamStr(0) + '.log') then + Append(DebugFile) else + Rewrite(DebugFile); + {$ENDIF} +{$ENDIF} + +finalization +begin + if TemplatesVar <> nil then TemplatesVar.Free; + TemplatesVar := nil; +{$IFDEF DEBUG} + {$IFNDEF MESSAGE} + Writeln(DebugFile, format('FactoryCount: %d, ObjectCount: %d.',[FactoryCount, ObjectCount])); + CloseFile(DebugFile); + {$ELSE} + OutputDebugString(PChar(format('FactoryCount: %d, ObjectCount: %d.',[FactoryCount, ObjectCount]))); + {$ENDIF} +{$ENDIF} +// milenko start (only needed with PERF) +{$IFDEF PERF} + SetLength(Incidents, 0); + SetLength(IncidentsLog, 0); +{$ENDIF} +// milenko end +end; + +end. + + + + + + diff --git a/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.dfm b/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.dfm new file mode 100644 index 00000000..071b5737 --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.dfm @@ -0,0 +1,445 @@ +object FormBaseFilter: TFormBaseFilter + Left = 504 + Top = 199 + Width = 419 + Height = 350 + BorderStyle = bsSizeToolWin + Caption = 'Base Filter Editor' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnCloseQuery = FormCloseQuery + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object InfoBtn: TSpeedButton + Left = 9 + Top = 295 + Width = 24 + Height = 24 + Cursor = crHandPoint + Hint = 'Show Base Filter Editor info' + Anchors = [akRight, akBottom] + Flat = True + ParentShowHint = False + ShowHint = True + OnClick = InfoBtnClick + end + object btOK: TButton + Left = 234 + Top = 295 + Width = 75 + Height = 25 + Anchors = [akRight, akBottom] + Caption = '&OK' + ModalResult = 1 + TabOrder = 0 + end + object btCancel: TButton + Left = 322 + Top = 295 + Width = 75 + Height = 25 + Anchors = [akRight, akBottom] + Caption = '&Cancel' + ModalResult = 2 + TabOrder = 1 + end + object PageControl1: TPageControl + Left = 0 + Top = 0 + Width = 411 + Height = 292 + ActivePage = InfoSheet + Align = alTop + Anchors = [akLeft, akTop, akRight, akBottom] + TabOrder = 2 + object SelectorSheet: TTabSheet + Caption = 'Selector' + object Label1: TLabel + Left = 8 + Top = 2 + Width = 30 + Height = 13 + Caption = 'Filters:' + end + object Label2: TLabel + Left = 256 + Top = 0 + Width = 96 + Height = 13 + Anchors = [akTop, akRight] + Caption = 'Available Interfaces:' + end + object Label6: TLabel + Left = 256 + Top = 150 + Width = 23 + Height = 13 + Anchors = [akRight, akBottom] + Caption = 'Pins:' + end + object Filters: TTreeView + Left = 0 + Top = 17 + Width = 252 + Height = 188 + Anchors = [akLeft, akTop, akRight, akBottom] + HideSelection = False + HotTrack = True + Indent = 19 + ParentShowHint = False + PopupMenu = PopupMenu + ReadOnly = True + ShowHint = True + TabOrder = 0 + OnChange = FiltersChange + OnCustomDrawItem = FiltersCustomDrawItem + OnDblClick = FiltersDblClick + end + object Interfaces: TListBox + Left = 257 + Top = 16 + Width = 145 + Height = 130 + Anchors = [akTop, akRight, akBottom] + ItemHeight = 13 + Sorted = True + TabOrder = 1 + OnDblClick = InterfacesDblClick + end + object Pins: TListBox + Left = 257 + Top = 165 + Width = 145 + Height = 98 + Anchors = [akRight, akBottom] + ItemHeight = 14 + PopupMenu = PinMenu + Style = lbOwnerDrawVariable + TabOrder = 2 + OnDrawItem = PinsDrawItem + OnMeasureItem = PinsMeasureItem + end + object MonikerTag: TMemo + Left = 0 + Top = 212 + Width = 252 + Height = 50 + Hint = 'Filter Moniker.' + TabStop = False + Anchors = [akLeft, akRight, akBottom] + Color = clBtnFace + ParentShowHint = False + ReadOnly = True + ShowHint = True + TabOrder = 3 + end + end + object PinsSheet: TTabSheet + Caption = 'Pins Details' + ImageIndex = 1 + OnShow = PinsSheetShow + object Label3: TLabel + Left = 1 + Top = 0 + Width = 23 + Height = 13 + Caption = 'Pins:' + end + object Label4: TLabel + Left = 161 + Top = 0 + Width = 50 + Height = 13 + Anchors = [akTop, akRight] + Caption = 'Interfaces:' + end + object Label5: TLabel + Left = 1 + Top = 149 + Width = 61 + Height = 13 + Anchors = [akLeft, akBottom] + Caption = 'MediaTypes:' + end + object Pins1: TListBox + Left = 1 + Top = 16 + Width = 153 + Height = 129 + Anchors = [akLeft, akTop, akRight, akBottom] + ItemHeight = 13 + PopupMenu = PinMenu + Style = lbOwnerDrawVariable + TabOrder = 0 + OnClick = Pins1Click + OnDrawItem = PinsDrawItem + OnMeasureItem = PinsMeasureItem + end + object PinInterfaces: TListBox + Left = 161 + Top = 16 + Width = 241 + Height = 129 + Anchors = [akTop, akRight, akBottom] + ItemHeight = 13 + TabOrder = 1 + OnDblClick = PinInterfacesDblClick + end + object MediaTypes: TListBox + Left = 1 + Top = 165 + Width = 400 + Height = 97 + Anchors = [akLeft, akRight, akBottom] + ItemHeight = 13 + TabOrder = 2 + end + end + object InfoSheet: TTabSheet + Caption = 'Info' + ImageIndex = 2 + TabVisible = False + object Panel1: TPanel + Left = 0 + Top = 0 + Width = 403 + Height = 49 + Align = alTop + BevelOuter = bvNone + BorderWidth = 5 + Color = clHighlight + TabOrder = 0 + object Label16: TLabel + Left = 5 + Top = 5 + Width = 393 + Height = 22 + Align = alTop + Alignment = taCenter + Caption = 'Base Filter Editor' + Font.Charset = ANSI_CHARSET + Font.Color = clWhite + Font.Height = -19 + Font.Name = 'Arial' + Font.Style = [] + ParentFont = False + end + object Label17: TLabel + Left = 5 + Top = 27 + Width = 393 + Height = 13 + Align = alTop + Alignment = taCenter + Caption = 'Version 1.2' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWhite + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + end + end + object Panel2: TPanel + Left = 0 + Top = 49 + Width = 403 + Height = 215 + Align = alClient + BevelOuter = bvNone + BorderWidth = 2 + Color = clWindow + TabOrder = 1 + object Label7: TLabel + Left = 8 + Top = 8 + Width = 57 + Height = 13 + Caption = 'Filter Colors:' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsUnderline] + ParentFont = False + end + object Label8: TLabel + Left = 52 + Top = 25 + Width = 135 + Height = 13 + Caption = 'DirectX Media Object (DMO)' + end + object Label9: TLabel + Left = 52 + Top = 43 + Width = 159 + Height = 13 + Caption = 'Users Kernel Streaming (KSProxy)' + end + object Label10: TLabel + Left = 52 + Top = 61 + Width = 188 + Height = 13 + Caption = 'Uses Compression Manager (ACM/ICM)' + end + object Label11: TLabel + Left = 52 + Top = 79 + Width = 153 + Height = 13 + Caption = 'Plug and Play (PNP) device filter' + end + object Label12: TLabel + Left = 52 + Top = 97 + Width = 83 + Height = 13 + Caption = 'Default filter Color' + end + object Label13: TLabel + Left = 8 + Top = 128 + Width = 59 + Height = 13 + Caption = 'Pin Pictures:' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsUnderline] + ParentFont = False + end + object Label14: TLabel + Left = 48 + Top = 144 + Width = 93 + Height = 13 + Caption = 'Indicate a input pin.' + end + object Label15: TLabel + Left = 48 + Top = 162 + Width = 100 + Height = 13 + Caption = 'Indicate a output pin.' + end + object Image1: TImage + Left = 16 + Top = 24 + Width = 30 + Height = 16 + AutoSize = True + end + object Image2: TImage + Left = 16 + Top = 42 + Width = 30 + Height = 16 + AutoSize = True + end + object Image3: TImage + Left = 16 + Top = 60 + Width = 30 + Height = 16 + AutoSize = True + end + object Image4: TImage + Left = 16 + Top = 78 + Width = 30 + Height = 16 + AutoSize = True + end + object Image5: TImage + Left = 16 + Top = 96 + Width = 30 + Height = 16 + AutoSize = True + end + object Image6: TImage + Left = 24 + Top = 144 + Width = 16 + Height = 14 + AutoSize = True + Transparent = True + end + object Image7: TImage + Left = 24 + Top = 162 + Width = 16 + Height = 14 + AutoSize = True + Transparent = True + end + end + end + end + object FilterGraph: TFilterGraph + AutoCreate = True + GraphEdit = False + Left = 280 + Top = 256 + end + object Filter: TFilter + BaseFilter.data = {00000000} + FilterGraph = FilterGraph + Left = 312 + Top = 256 + end + object PopupMenu: TPopupMenu + OnPopup = PopupMenuPopup + Left = 344 + Top = 256 + object PropertyPage: TMenuItem + Caption = 'Property Page' + OnClick = PropertyPageClick + end + object VFWCapture: TMenuItem + Caption = 'VFW Capture' + object VFWFormat: TMenuItem + Caption = 'Format' + OnClick = VFWFormatClick + end + object VFWSource: TMenuItem + Caption = 'Source' + OnClick = VFWSourceClick + end + object VFWDisplay: TMenuItem + Caption = 'Display' + OnClick = VFWDisplayClick + end + end + object VFWConfig: TMenuItem + Caption = 'VFW Compress' + object Config1: TMenuItem + Caption = 'Config' + OnClick = Config1Click + end + object VFWAbout: TMenuItem + Caption = 'About' + OnClick = VFWAboutClick + end + end + end + object PinMenu: TPopupMenu + OnPopup = PinMenuPopup + Left = 376 + Top = 256 + object PinProperty: TMenuItem + Caption = 'Property Page' + OnClick = PinPropertyClick + end + end +end diff --git a/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.pas b/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.pas new file mode 100644 index 00000000..48033db6 --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.pas @@ -0,0 +1,961 @@ + + (********************************************************************* + * DSPack 2.3.3 * + * * + * home page : http://www.progdigy.com * + * email : hgourvest@progdigy.com * + * Thanks to Michael Andersen. (DSVideoWindowEx) * + * * + * date : 21-02-2003 * + * * + * 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. * + * * + *********************************************************************) + +{$IFDEF VER140} {$WARN SYMBOL_DEPRECATED OFF} {$ENDIF} +{$IFDEF VER150} + {$WARN SYMBOL_DEPRECATED OFF} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} + +unit BaseFilterEditor; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, DSUTIL, DirectShow9, ComCtrls, DSPack, Menus, ExtCtrls, + Buttons; + +type + TFormBaseFilter = class(TForm) + btOK: TButton; + btCancel: TButton; + FilterGraph: TFilterGraph; + Filter: TFilter; + PopupMenu: TPopupMenu; + PropertyPage: TMenuItem; + VFWDisplay: TMenuItem; + VFWFormat: TMenuItem; + VFWSource: TMenuItem; + VFWConfig: TMenuItem; + VFWCapture: TMenuItem; + Config1: TMenuItem; + VFWAbout: TMenuItem; + PinMenu: TPopupMenu; + PinProperty: TMenuItem; + PageControl1: TPageControl; + SelectorSheet: TTabSheet; + Label1: TLabel; + Label2: TLabel; + Label6: TLabel; + Filters: TTreeView; + Interfaces: TListBox; + Pins: TListBox; + PinsSheet: TTabSheet; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Pins1: TListBox; + PinInterfaces: TListBox; + MediaTypes: TListBox; + MonikerTag: TMemo; + InfoBtn: TSpeedButton; + InfoSheet: TTabSheet; + Panel1: TPanel; + Panel2: TPanel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + Label13: TLabel; + Label14: TLabel; + Label15: TLabel; + Image1: TImage; + Image2: TImage; + Image3: TImage; + Image4: TImage; + Image5: TImage; + Image6: TImage; + Image7: TImage; + Label16: TLabel; + Label17: TLabel; + procedure FormShow(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure PopupMenuPopup(Sender: TObject); + procedure PropertyPageClick(Sender: TObject); + procedure VFWDisplayClick(Sender: TObject); + procedure VFWFormatClick(Sender: TObject); + procedure VFWSourceClick(Sender: TObject); + procedure Config1Click(Sender: TObject); + procedure VFWAboutClick(Sender: TObject); + procedure PinMenuPopup(Sender: TObject); + procedure PinPropertyClick(Sender: TObject); + procedure PinsSheetShow(Sender: TObject); + procedure Pins1Click(Sender: TObject); + procedure InterfacesDblClick(Sender: TObject); + procedure PinInterfacesDblClick(Sender: TObject); + procedure PinsDrawItem(Control: TWinControl; Index: Integer; + Rect: TRect; State: TOwnerDrawState); + procedure FiltersChange(Sender: TObject; Node: TTreeNode); + procedure PinsMeasureItem(Control: TWinControl; Index: Integer; + var Height: Integer); + procedure FiltersDblClick(Sender: TObject); + procedure FiltersCustomDrawItem(Sender: TCustomTreeView; + Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean); + procedure InfoBtnClick(Sender: TObject); + public + SysDevEnum: TSysDevEnum; + PinList: TPinList; + InPinPic, + OutPinPic : TBitmap; + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure RefreshTree; +// procedure FiltersClick(Sender: TObject); + procedure GetFilterInfo; + end; + + TDSitf = record + name : string; + itf : TGUID; + end; + + pNodeItem = ^TNodeItem; + TNodeItem = Record + Index : integer; + Color : TColor; + MonikerStr : WideString; + End; + +const + FilterColors : array[0..4] of TColor = (clBlack, clPurple, clBlue, clRed, clGreen); + + DSItfs : array[0..382] of TDSitf = +((name: 'IPin'; itf: '{56A86891-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IEnumPins'; itf: '{56A86892-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IEnumMediaTypes'; itf: '{89C31040-846B-11CE-97D3-00AA0055595A}'), + (name: 'IFilterGraph'; itf: '{56A8689F-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IEnumFilters'; itf: '{56A86893-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMediaFilter'; itf: '{56A86899-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IBaseFilter'; itf: '{56A86895-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IReferenceClock'; itf: '{56A86897-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IReferenceClock2'; itf: '{36B73885-C2C8-11CF-8B46-00805F6CEF60}'), + (name: 'IMediaSample'; itf: '{56A8689A-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMediaSample2'; itf: '{36B73884-C2C8-11CF-8B46-00805F6CEF60}'), + (name: 'IMemAllocator'; itf: '{56A8689C-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMemInputPin'; itf: '{56A8689D-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IAMovieSetup'; itf: '{A3D8CEC0-7E5A-11CF-BBC5-00805F6CEF20}'), + (name: 'IMediaSeeking'; itf: '{36B73880-C2C8-11CF-8B46-00805F6CEF60}'), + (name: 'IEnumRegFilters'; itf: '{56A868A4-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IFilterMapper'; itf: '{56A868A3-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IFilterMapper2'; itf: '{B79BB0B0-33C1-11D1-ABE1-00A0C905F375}'), + (name: 'IQualityControl'; itf: '{56A868A5-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IOverlayNotify'; itf: '{56A868A0-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IOverlay'; itf: '{56A868A1-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMediaEventSink'; itf: '{56A868A2-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IFileSourceFilter'; itf: '{56A868A6-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IFileSinkFilter'; itf: '{A2104830-7C70-11CF-8BCE-00AA00A3F1A6}'), + (name: 'IFileSinkFilter2'; itf: '{00855B90-CE1B-11D0-BD4F-00A0C911CE86}'), + (name: 'IFileAsyncIO'; itf: '{56A868A7-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IGraphBuilder'; itf: '{56A868A9-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'ICaptureGraphBuilder'; itf: '{BF87B6E0-8C27-11D0-B3F0-00AA003761C5}'), + (name: 'IAMCopyCaptureFileProgress'; itf: '{670D1D20-A068-11D0-B3F0-00AA003761C5}'), + (name: 'IFilterGraph2'; itf: '{36B73882-C2C8-11CF-8B46-00805F6CEF60}'), + (name: 'IStreamBuilder'; itf: '{56A868BF-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IAsyncReader'; itf: '{56A868AA-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IGraphVersion'; itf: '{56A868AB-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IResourceConsumer'; itf: '{56A868AD-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IResourceManager'; itf: '{56A868AC-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IDistributorNotify'; itf: '{56A868AF-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IAMStreamControl'; itf: '{36B73881-C2C8-11CF-8B46-00805F6CEF60}'), + (name: 'ISeekingPassThru'; itf: '{36B73883-C2C8-11CF-8B46-00805F6CEF60}'), + (name: 'IAMStreamConfig'; itf: '{C6E13340-30AC-11D0-A18C-00A0C9118956}'), + (name: 'IConfigInterleaving'; itf: '{BEE3D220-157B-11D0-BD23-00A0C911CE86}'), + (name: 'IConfigAviMux'; itf: '{5ACD6AA0-F482-11CE-8B67-00AA00A3F1A6}'), + (name: 'IAMVideoCompression'; itf: '{C6E13343-30AC-11D0-A18C-00A0C9118956}'), + (name: 'IAMVfwCaptureDialogs'; itf: '{D8D715A0-6E5E-11D0-B3F0-00AA003761C5}'), + (name: 'IAMVfwCompressDialogs'; itf: '{D8D715A3-6E5E-11D0-B3F0-00AA003761C5}'), + (name: 'IAMDroppedFrames'; itf: '{C6E13344-30AC-11D0-A18C-00A0C9118956}'), + (name: 'IAMAudioInputMixer'; itf: '{54C39221-8380-11D0-B3F0-00AA003761C5}'), + (name: 'IAMAnalogVideoDecoder'; itf: '{C6E13350-30AC-11D0-A18C-00A0C9118956}'), + (name: 'IAMVideoProcAmp'; itf: '{C6E13360-30AC-11D0-A18C-00A0C9118956}'), + (name: 'IAMCameraControl'; itf: '{C6E13370-30AC-11D0-A18C-00A0C9118956}'), + (name: 'IAMCrossbar'; itf: '{C6E13380-30AC-11D0-A18C-00A0C9118956}'), + (name: 'IAMTuner'; itf: '{211A8761-03AC-11D1-8D13-00AA00BD8339}'), + (name: 'IAMTunerNotification'; itf: '{211A8760-03AC-11D1-8D13-00AA00BD8339}'), + (name: 'IAMTVTuner'; itf: '{211A8766-03AC-11D1-8D13-00AA00BD8339}'), + (name: 'IBPCSatelliteTuner'; itf: '{211A8765-03AC-11D1-8D13-00AA00BD8339}'), + (name: 'IAMTVAudio'; itf: '{83EC1C30-23D1-11D1-99E6-00A0C9560266}'), + (name: 'IAMTVAudioNotification'; itf: '{83EC1C33-23D1-11D1-99E6-00A0C9560266}'), + (name: 'IAMAnalogVideoEncoder'; itf: '{C6E133B0-30AC-11D0-A18C-00A0C9118956}'), + (name: 'IMediaPropertyBag'; itf: '{6025A880-C0D5-11D0-BD4E-00A0C911CE86}'), + (name: 'IPersistMediaPropertyBag'; itf: '{5738E040-B67F-11D0-BD4D-00A0C911CE86}'), + (name: 'IAMPhysicalPinInfo'; itf: '{F938C991-3029-11CF-8C44-00AA006B6814}'), + (name: 'IAMExtDevice'; itf: '{B5730A90-1A2C-11CF-8C23-00AA006B6814}'), + (name: 'IAMExtTransport'; itf: '{A03CD5F0-3045-11CF-8C44-00AA006B6814}'), + (name: 'IAMTimecodeReader'; itf: '{9B496CE1-811B-11CF-8C77-00AA006B6814}'), + (name: 'IAMTimecodeGenerator'; itf: '{9B496CE0-811B-11CF-8C77-00AA006B6814}'), + (name: 'IAMTimecodeDisplay'; itf: '{9B496CE2-811B-11CF-8C77-00AA006B6814}'), + (name: 'IAMDevMemoryAllocator'; itf: '{C6545BF0-E76B-11D0-BD52-00A0C911CE86}'), + (name: 'IAMDevMemoryControl'; itf: '{C6545BF1-E76B-11D0-BD52-00A0C911CE86}'), + (name: 'IAMStreamSelect'; itf: '{C1960960-17F5-11D1-ABE1-00A0C905F375}'), + (name: 'IAMovie'; itf: '{359ACE10-7688-11CF-8B23-00805F6CEF60}'), + (name: 'ICreateDevEnum'; itf: '{29840822-5B84-11D0-BD3B-00A0C911CE86}'), + (name: 'IDvdControl'; itf: '{A70EFE61-E2A3-11D0-A9BE-00AA0061BE93}'), + (name: 'IDvdControl2'; itf: '{33BC7430-EEC0-11D2-8201-00A0C9D74842}'), + (name: 'IDvdInfo'; itf: '{A70EFE60-E2A3-11D0-A9BE-00AA0061BE93}'), + (name: 'IDvdInfo2'; itf: '{34151510-EEC0-11D2-8201-00A0C9D74842}'), + (name: 'IDvdGraphBuilder'; itf: '{FCC152B6-F372-11D0-8E00-00C04FD7C08B}'), + (name: 'IDvdState'; itf: '{86303D6D-1C4A-4087-AB42-F711167048EF}'), + (name: 'IDvdCmd'; itf: '{5A4A97E4-94EE-4A55-9751-74B5643AA27D}'), + (name: 'IVideoFrameStep'; itf: '{E46A9787-2B71-444D-A4B5-1FAB7B708D6A}'), + (name: 'IFilterMapper3'; itf: '{B79BB0B1-33C1-11D1-ABE1-00A0C905F375}'), + (name: 'IOverlayNotify2'; itf: '{680EFA10-D535-11D1-87C8-00A0C9223196}'), + (name: 'ICaptureGraphBuilder2'; itf: '{93E5A4E0-2D50-11D2-ABFA-00A0C9C6E38D}'), + (name: 'IMemAllocatorCallbackTemp'; itf: '{379A0CF0-C1DE-11D2-ABF5-00A0C905F375}'), + (name: 'IMemAllocatorNotifyCallbackTemp'; itf: '{92980B30-C1DE-11D2-ABF5-00A0C905F375}'), + (name: 'IAMVideoControl'; itf: '{6A2E0670-28E4-11D0-A18C-00A0C9118956}'), + (name: 'IKsPropertySet'; itf: '{31EFAC30-515C-11D0-A9AA-00AA0061BE93}'), + (name: 'IAMResourceControl'; itf: '{8389D2D0-77D7-11D1-ABE6-00A0C905F375}'), + (name: 'IAMClockAdjust'; itf: '{4D5466B0-A49C-11D1-ABE8-00A0C905F375}'), + (name: 'IAMFilterMiscFlags'; itf: '{2DD74950-A890-11D1-ABE8-00A0C905F375}'), + (name: 'IDrawVideoImage'; itf: '{48EFB120-AB49-11D2-AED2-00A0C995E8D5}'), + (name: 'IDecimateVideoImage'; itf: '{2E5EA3E0-E924-11D2-B6DA-00A0C995E8DF}'), + (name: 'IAMVideoDecimationProperties'; itf: '{60D32930-13DA-11D3-9EC6-C4FCAEF5C7BE}'), + (name: 'IAMLatency'; itf: '{62EA93BA-EC62-11D2-B770-00C04FB6BD3D}'), + (name: 'IAMPushSource'; itf: '{F185FE76-E64E-11D2-B76E-00C04FB6BD3D}'), + (name: 'IAMDeviceRemoval'; itf: '{F90A6130-B658-11D2-AE49-0000F8754B99}'), + (name: 'IDVEnc'; itf: '{D18E17A0-AACB-11D0-AFB0-00AA00B67A42}'), + (name: 'IIPDVDec'; itf: '{B8E8BD60-0BFE-11D0-AF91-00AA00B67A42}'), + (name: 'IDVRGB219'; itf: '{58473A19-2BC8-4663-8012-25F81BABDDD1}'), + (name: 'IDVSplitter'; itf: '{92A3A302-DA7C-4A1F-BA7E-1802BB5D2D02}'), + (name: 'IAMAudioRendererStats'; itf: '{22320CB2-D41A-11D2-BF7C-D7CB9DF0BF93}'), + (name: 'IAMGraphStreams'; itf: '{632105FA-072E-11D3-8AF9-00C04FB6BD3D}'), + (name: 'IAMOverlayFX'; itf: '{62FAE250-7E65-4460-BFC9-6398B322073C}'), + (name: 'IAMOpenProgress'; itf: '{8E1C39A1-DE53-11CF-AA63-0080C744528D}'), + (name: 'IMpeg2Demultiplexer'; itf: '{436EEE9C-264F-4242-90E1-4E330C107512}'), + (name: 'IEnumStreamIdMap'; itf: '{945C1566-6202-46FC-96C7-D87F289C6534}'), + (name: 'IMPEG2StreamIdMap'; itf: '{D0E04C47-25B8-4369-925A-362A01D95444}'), + (name: 'IRegisterServiceProvider'; itf: '{7B3A2F01-0751-48DD-B556-004785171C54}'), + (name: 'IAMDecoderCaps'; itf: '{C0DFF467-D499-4986-972B-E1D9090FA941}'), + (name: 'IAMClockSlave'; itf: '{9FD52741-176D-4B36-8F51-CA8F933223BE}'), + (name: 'IDDrawExclModeVideo'; itf: '{153ACC21-D83B-11D1-82BF-00A0C9696C8F}'), + (name: 'IDDrawExclModeVideoCallback'; itf: '{913C24A0-20AB-11D2-9038-00A0C9697298}'), + (name: 'IPinConnection'; itf: '{4A9A62D3-27D4-403D-91E9-89F540E55534}'), + (name: 'IPinFlowControl'; itf: '{C56E9858-DBF3-4F6B-8119-384AF2060DEB}'), + (name: 'IGraphConfig'; itf: '{03A1EB8E-32BF-4245-8502-114D08A9CB88}'), + (name: 'IGraphConfigCallback'; itf: '{ADE0FD60-D19D-11D2-ABF6-00A0C905F375}'), + (name: 'IFilterChain'; itf: '{DCFBDCF6-0DC2-45F5-9AB2-7C330EA09C29}'), + (name: 'IVMRImagePresenter'; itf: '{CE704FE7-E71E-41FB-BAA2-C4403E1182F5}'), + (name: 'IVMRSurfaceAllocator'; itf: '{31CE832E-4484-458B-8CCA-F4D7E3DB0B52}'), + (name: 'IVMRSurfaceAllocatorNotify'; itf: '{AADA05A8-5A4E-4729-AF0B-CEA27AED51E2}'), + (name: 'IVMRWindowlessControl'; itf: '{0EB1088C-4DCD-46F0-878F-39DAE86A51B7}'), + (name: 'IVMRMixerControl'; itf: '{1C1A17B0-BED0-415D-974B-DC6696131599}'), + (name: 'IVMRMonitorConfig'; itf: '{9CF0B1B6-FBAA-4B7F-88CF-CF1F130A0DCE}'), + (name: 'IVMRFilterConfig'; itf: '{9E5530C5-7034-48B4-BB46-0B8A6EFC8E36}'), + (name: 'IVMRMixerBitmap'; itf: '{1E673275-0257-40AA-AF20-7C608D4A0428}'), + (name: 'IVMRImageCompositor'; itf: '{7A4FB5AF-479F-4074-BB40-CE6722E43C82}'), + (name: 'IVMRVideoStreamControl'; itf: '{058D1F11-2A54-4BEF-BD54-DF706626B727}'), + (name: 'IVMRSurface'; itf: '{A9849BBE-9EC8-4263-B764-62730F0D15D0}'), + (name: 'IVPManager'; itf: '{AAC18C18-E186-46D2-825D-A1F8DC8E395A}'), + (name: 'IVMRImagePresenterConfig'; itf: '{9F3A1C85-8555-49BA-935F-BE5B5B29D178}'), + (name: 'IVMRImagePresenterExclModeConfig'; itf: '{E6F7CE40-4673-44F1-8F77-5499D68CB4EA}'), + (name: 'IAMBufferNegotiation'; itf: '{56ED71A0-AF5F-11D0-B3F0-00AA003761C5}'), + (name: 'IMultiMediaStream'; itf: '{B502D1BC-9A57-11D0-8FDE-00C04FD9189D}'), + (name: 'IMediaStream'; itf: '{B502D1BD-9A57-11D0-8FDE-00C04FD9189D}'), + (name: 'IStreamSample'; itf: '{B502D1BE-9A57-11D0-8FDE-00C04FD9189D}'), + (name: 'IDirectShowStream'; itf: '{7DB01C96-C0C3-11D0-8FF1-00C04FD9189D}'), + (name: 'IAMMultiMediaStream'; itf: '{BEBE595C-9A6F-11D0-8FDE-00C04FD9189D}'), + (name: 'IAMMediaStream'; itf: '{BEBE595D-9A6F-11D0-8FDE-00C04FD9189D}'), + (name: 'IMediaStreamFilter'; itf: '{BEBE595E-9A6F-11D0-8FDE-00C04FD9189D}'), + (name: 'IDirectDrawMediaSampleAllocator'; itf: '{AB6B4AFC-F6E4-11D0-900D-00C04FD9189D}'), + (name: 'IDirectDrawMediaSample'; itf: '{AB6B4AFE-F6E4-11D0-900D-00C04FD9189D}'), + (name: 'IAMMediaTypeStream'; itf: '{AB6B4AFA-F6E4-11D0-900D-00C04FD9189D}'), + (name: 'IAMMediaTypeSample'; itf: '{AB6B4AFB-F6E4-11D0-900D-00C04FD9189D}'), + (name: 'IDirectDrawMediaStream'; itf: '{F4104FCE-9A70-11D0-8FDE-00C04FD9189D}'), + (name: 'IDirectDrawStreamSample'; itf: '{F4104FCF-9A70-11D0-8FDE-00C04FD9189D}'), + (name: 'IAudioMediaStream'; itf: '{F7537560-A3BE-11D0-8212-00C04FC32C45}'), + (name: 'IAudioStreamSample'; itf: '{345FEE00-ABA5-11D0-8212-00C04FC32C45}'), + (name: 'IMemoryData'; itf: '{327FC560-AF60-11D0-8212-00C04FC32C45}'), + (name: 'IAudioData'; itf: '{54C719C0-AF60-11D0-8212-00C04FC32C45}'), + (name: 'IMixerPinConfig'; itf: '{593CDDE1-0759-11D1-9E69-00C04FD7C15B}'), + (name: 'IMixerPinConfig2'; itf: '{EBF47182-8764-11D1-9E69-00C04FD7C15B}'), + (name: 'IAMCollection'; itf: '{56A868B9-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMediaControl'; itf: '{56A868B1-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMediaEvent'; itf: '{56A868B6-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMediaEventEx'; itf: '{56A868C0-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMediaPosition'; itf: '{56A868B2-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IBasicAudio'; itf: '{56A868B3-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IVideoWindow'; itf: '{56A868B4-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IBasicVideo'; itf: '{56A868B5-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IBasicVideo2'; itf: '{329BB360-F6EA-11D1-9038-00A0C9697298}'), + (name: 'IDeferredCommand'; itf: '{56A868B8-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IQueueCommand'; itf: '{56A868B7-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IFilterInfo'; itf: '{56A868BA-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IRegFilterInfo'; itf: '{56A868BB-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IMediaTypeInfo'; itf: '{56A868BC-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IPinInfo'; itf: '{56A868BD-0AD4-11CE-B03A-0020AF0BA770}'), + (name: 'IAMStats'; itf: '{BC9BCF80-DCD2-11D2-ABF6-00A0C905F375}'), + (name: 'IAMNetShowConfig'; itf: '{FA2AA8F1-8B62-11D0-A520-000000000000}'), + (name: 'IAMChannelInfo'; itf: '{FA2AA8F2-8B62-11D0-A520-000000000000}'), + (name: 'IAMNetworkStatus'; itf: '{FA2AA8F3-8B62-11D0-A520-000000000000}'), + (name: 'IAMExtendedSeeking'; itf: '{FA2AA8F9-8B62-11D0-A520-000000000000}'), + (name: 'IAMNetShowExProps'; itf: '{FA2AA8F5-8B62-11D0-A520-000000000000}'), + (name: 'IAMExtendedErrorInfo'; itf: '{FA2AA8F6-8B62-11D0-A520-000000000000}'), + (name: 'IAMMediaContent'; itf: '{FA2AA8F4-8B62-11D0-A520-000000000000}'), + (name: 'IAMMediaContent2'; itf: '{CE8F78C1-74D9-11D2-B09D-00A0C9A81117}'), + (name: 'IAMNetShowPreroll'; itf: '{AAE7E4E2-6388-11D1-8D93-006097C9A2B2}'), + (name: 'IDShowPlugin'; itf: '{4746B7C8-700E-11D1-BECC-00C04FB6E937}'), + (name: 'IAMPlayListItem'; itf: '{56A868FF-0AD4-11CE-B0A3-0020AF0BA770}'), + (name: 'IAMPlayList'; itf: '{56A868FE-0AD4-11CE-B0A3-0020AF0BA770}'), + (name: 'ISpecifyParticularPages'; itf: '{4C437B91-6E9E-11D1-A704-006097C4E476}'), + (name: 'IAMRebuild'; itf: '{02EF04DD-7580-11D1-BECE-00C04FB6E937}'), + (name: 'IDirectDrawVideo'; itf: '{36D39EB0-DD75-11CE-BF0E-00AA0055595A}'), + (name: 'IQualProp'; itf: '{1BD0ECB0-F8E2-11CE-AAC6-0020AF0B99A3}'), + (name: 'IFullScreenVideo'; itf: '{DD1D7110-7836-11CF-BF47-00AA0055595A}'), + (name: 'IFullScreenVideoEx'; itf: '{53479470-F1DD-11CF-BC42-00AA00AC74F6}'), + (name: 'IBaseVideoMixer'; itf: '{61DED640-E912-11CE-A099-00AA00479A58}'), + (name: 'IAMDirectSound'; itf: '{546F4260-D53E-11CF-B3F0-00AA003761C5}'), + (name: 'IVPConfig'; itf: '{BC29A660-30E3-11D0-9E69-00C04FD7C15B}'), + (name: 'IVPVBIConfig'; itf: '{EC529B00-1A1F-11D1-BAD9-00609744111A}'), + (name: 'IVPNotify'; itf: '{C76794A1-D6C5-11D0-9E69-00C04FD7C15B}'), + (name: 'IVPVBINotify'; itf: '{EC529B01-1A1F-11D1-BAD9-00609744111A}'), + (name: 'IVPNotify2'; itf: '{EBF47183-8764-11D1-9E69-00C04FD7C15B}'), + (name: 'IMpegAudioDecoder'; itf: '{B45DD570-3C77-11D1-ABE1-00A0C905F375}'), + (name: 'IAMLine21Decoder'; itf: '{6E8D4A21-310C-11D0-B79A-00AA003767A7}'), + (name: 'IVPObject'; itf: '{CE292862-FC88-11D0-9E69-00C04FD7C15B}'), + (name: 'IVPControl'; itf: '{25DF12C1-3DE0-11D1-9E69-00C04FD7C15B}'), + (name: 'IVPVBIObject'; itf: '{814B9802-1C88-11D1-BAD9-00609744111A}'), + (name: 'IAMWstDecoder'; itf: '{C056DE21-75C2-11D3-A184-00105AEF9F33}'), + (name: 'IKsInterfaceHandler'; itf: '{D3ABC7E0-9A61-11D0-A40D-00A0C9223196}'), + (name: 'IKsDataTypeHandler'; itf: '{5FFBAA02-49A3-11D0-9F36-00AA00A216A1}'), + (name: 'IKsPin'; itf: '{B61178D1-A2D9-11CF-9E53-00AA00A216A1}'), + (name: 'IKsControl'; itf: '{28F54685-06FD-11D2-B27A-00A0C9223196}'), + (name: 'IKsPinFactory'; itf: '{CD5EBE6B-8B6E-11D1-8AE0-00A0C9223196}'), + (name: 'IAMVideoAcceleratorNotify'; itf: '{256A6A21-FBAD-11D1-82BF-00A0C9696C8F}'), + (name: 'IAMVideoAccelerator'; itf: '{256A6A22-FBAD-11D1-82BF-00A0C9696C8F}'), + (name: 'ICreatePropBagOnRegKey'; itf: '{8A674B48-1F63-11D3-B64C-00C04F79498E}'), + (name: 'ITuningSpaces' ; itf: '{901284E4-33FE-4b69-8D63-634A596F3756}'), + (name: 'ITuningSpaceContainer' ; itf: '{5B692E84-E2F1-11d2-9493-00C04F72D980}'), + (name: 'ITuningSpace' ; itf: '{061C6E30-E622-11d2-9493-00C04F72D980}'), + (name: 'IEnumTuningSpaces' ; itf: '{8B8EB248-FC2B-11d2-9D8C-00C04F72D980}'), + (name: 'IDVBTuningSpace' ; itf: '{ADA0B268-3B19-4e5b-ACC4-49F852BE13BA}'), + (name: 'IAnalogTVTuningSpace' ; itf: '{2A6E293C-2595-11d3-B64C-00C04F79498E}'), + (name: 'IATSCTuningSpace' ; itf: '{0369B4E2-45B6-11d3-B650-00C04F79498E}'), + (name: 'IAnalogRadioTuningSpace' ; itf: '{2A6E293B-2595-11d3-B64C-00C04F79498E}'), + (name: 'ITuneRequest' ; itf: '{07DDC146-FC3D-11d2-9D8C-00C04F72D980}'), + (name: 'IChannelTuneRequest' ; itf: '{0369B4E0-45B6-11d3-B650-00C04F79498E}'), + (name: 'IATSCChannelTuneRequest' ; itf: '{0369B4E1-45B6-11d3-B650-00C04F79498E}'), + (name: 'IDVBTuneRequest' ; itf: '{0D6F567E-A636-42bb-83BA-CE4C1704AFA2}'), + (name: 'ITuner' ; itf: '{28C52640-018A-11d3-9D8E-00C04F72D980}'), + (name: 'IScanningTuner' ; itf: '{1DFD0A5C-0284-11d3-9D8E-00C04F72D980}'), + (name: 'ITunerEvents' ; itf: '{68481420-0280-11d3-9D8E-00C04F72D980}'), + (name: 'ISignalEvents' ; itf: '{85E2439E-0E23-11d3-9D8E-00C04F72D980}'), + (name: 'IComponentType' ; itf: '{6A340DC0-0311-11d3-9D8E-00C04F72D980}'), + (name: 'ILanguageComponentType' ; itf: '{B874C8BA-0FA2-11d3-9D8E-00C04F72D980}'), + (name: 'IMPEG2ComponentType' ; itf: '{2C073D84-B51C-48c9-AA9F-68971E1F6E38}'), + (name: 'IATSCComponentType' ; itf: '{FC189E4D-7BD4-4125-B3B3-3A76A332CC96}'), + (name: 'IEnumComponentTypes' ; itf: '{8A674B4A-1F63-11d3-B64C-00C04F79498E}'), + (name: 'IComponentTypes' ; itf: '{0DC13D4A-0313-11d3-9D8E-00C04F72D980}'), + (name: 'IComponent' ; itf: '{1A5576FC-0E19-11d3-9D8E-00C04F72D980}'), + (name: 'IMPEG2Component' ; itf: '{1493E353-1EB6-473c-802D-8E6B8EC9D2A9}'), + (name: 'IEnumComponents' ; itf: '{2A6E2939-2595-11d3-B64C-00C04F79498E}'), + (name: 'IComponents' ; itf: '{FCD01846-0E19-11d3-9D8E-00C04F72D980}'), + (name: 'ILocator' ; itf: '{286D7F89-760C-4F89-80C4-66841D2507AA}'), + (name: 'IATSCLocator' ; itf: '{BF8D986F-8C2B-4131-94D7-4D3D9FCC21EF}'), + (name: 'IDVBTLocator' ; itf: '{8664DA16-DDA2-42ac-926A-C18F9127C302}'), + (name: 'IDVBSLocator' ; itf: '{3D7C353C-0D04-45f1-A742-F97CC1188DC8}'), + (name: 'IDVBCLocator' ; itf: '{6E42F36E-1DD2-43c4-9F78-69D25AE39034}'), + (name: 'IDVBTuningSpace2' ; itf: '{843188B4-CE62-43db-966B-8145A094E040}'), + (name: 'IDVBSTuningSpace' ; itf: '{CDF7BE60-D954-42fd-A972-78971958E470}'), + (name: 'IMPEG2TuneRequest' ; itf: '{EB7D987F-8A01-42AD-B8AE-574DEEE44D1A}'), + (name: 'IMPEG2TuneRequestFactory' ; itf: '{14E11ABD-EE37-4893-9EA1-6964DE933E39}'), + (name: 'IMPEG2TuneRequestSupport' ; itf: '{1B9D5FC3-5BBC-4b6c-BB18-B9D10E3EEEBF}'), + (name: 'IBroadcastEvent' ; itf: '{3B21263F-26E8-489d-AAC4-924F7EFD9511}'), + (name: 'IDXBaseObject' ; itf: '{17B59B2B-9CC8-11D1-9053-00C04FD9189D}'), + (name: 'IDXTransformFactory' ; itf: '{6A950B2B-A971-11D1-81C8-0000F87557DB}'), + (name: 'IDXTransform' ; itf: '{30A5FB78-E11F-11D1-9064-00C04FD9189D}'), + (name: 'IDXSurfacePick' ; itf: '{30A5FB79-E11F-11d1-9064-00C04FD9189D}'), + (name: 'IDXTBindHost' ; itf: '{D26BCE55-E9DC-11d1-9066-00C04FD9189D}'), + (name: 'IDXTaskManager' ; itf: '{254DBBC1-F922-11D0-883A-3C8B00C10000}'), + (name: 'IDXSurfaceFactory' ; itf: '{144946F5-C4D4-11D1-81D1-0000F87557DB}'), + (name: 'IDXSurfaceModifier' ; itf: '{9EA3B637-C37D-11D1-905E-00C04FD9189D}'), + (name: 'IDXSurface' ; itf: '{B39FD73F-E139-11D1-9065-00C04FD9189D}'), + (name: 'IDXSurfaceInit' ; itf: '{9EA3B639-C37D-11d1-905E-00C04FD9189D}'), + (name: 'IDXARGBSurfaceInit' ; itf: '{9EA3B63A-C37D-11d1-905E-00C04FD9189D}'), + (name: 'IDXARGBReadPtr' ; itf: '{EAAAC2D6-C290-11d1-905D-00C04FD9189D}'), + (name: 'IDXARGBReadWritePtr' ; itf: '{EAAAC2D7-C290-11d1-905D-00C04FD9189D}'), + (name: 'IDXDCLock' ; itf: '{0F619456-CF39-11D1-905E-00C04FD9189D}'), + (name: 'IDXTScaleOutput' ; itf: '{B2024B50-EE77-11D1-9066-00C04FD9189D}'), + (name: 'IDXGradient' ; itf: '{B2024B51-EE77-11D1-9066-00C04FD9189D}'), + (name: 'IDXTScale' ; itf: '{B39FD742-E139-11D1-9065-00C04FD9189D}'), + (name: 'IDXEffect' ; itf: '{E31FB81B-1335-11d1-8189-0000F87557DB}'), + (name: 'IDXLookupTable' ; itf: '{01BAFC7F-9E63-11D1-9053-00C04FD9189D}'), + (name: 'IDXRawSurface' ; itf: '{09756C8A-D96A-11d1-9062-00C04FD9189D}'), + (name: 'IHTMLDXTransform' ; itf: '{30E2AB7D-4FDD-4159-B7EA-DC722BF4ADE5}'), + (name: 'IMpegVideoDecoder' ; itf: '{EB1BB270-F71F-11CE-8E85-02608C9BABA2}'), + (name: 'IConfigAsfWriter' ; itf: '{45086030-F7E4-486A-B504-826BB5792A3B}'), + (name: 'IAMParse' ; itf: '{C47A3420-005C-11D2-9038-00A0C9697298}'), + (name: 'IMediaParamInfo' ; itf: '{6D6CBB60-A223-44AA-842F-A2F06750BE6D}'), + (name: 'IMediaParams' ; itf: '{6D6CBB61-A223-44AA-842F-A2F06750BE6E}'), + (name: 'IMediaBuffer' ; itf: '{59EFF8B9-938C-4A26-82F2-95CB84CDC837}'), + (name: 'IMediaObject' ; itf: '{D8AD0F58-5494-4102-97C5-EC798E59BCF4}'), + (name: 'IEnumDMO' ; itf: '{2C3CD98A-2BFA-4A53-9C27-5249BA64BA0F}'), + (name: 'IMediaObjectInPlace' ; itf: '{651B9AD0-0FC7-4AA9-9538-D89931010741}'), + (name: 'IDMOQualityControl' ; itf: '{65ABEA96-CF36-453F-AF8A-705E98F16260}'), + (name: 'IDMOVideoOutputOptimizations'; itf: '{BE8F4F4E-5B16-4D29-B350-7F6B5D9298AC}'), + (name: 'IDMOWrapperFilter' ; itf: '{52D6F586-9F0F-4824-8FC8-E32CA04930C2}'), + (name: 'IKsObject' ; itf: '{423C13A2-2070-11D0-9EF7-00AA00A216A1}'), + (name: 'IKsPinEx' ; itf: '{7BB38260-D19C-11D2-B38A-00A0C95EC22E}'), + (name: 'IKsPinPipe' ; itf: '{E539CD90-A8B4-11D1-8189-00A0C9062802}'), + (name: 'IKsDataTypeCompletion' ; itf: '{827D1A0E-0F73-11D2-B27A-00A0C9223196}'), + (name: 'IKsClockPropertySet' ; itf: '{5C5CBD84-E755-11D0-AC18-00A0C9223196}'), + (name: 'IKsAllocator' ; itf: '{8DA64899-C0D9-11D0-8413-0000F822FE8A}'), + (name: 'IKsAllocatorEx' ; itf: '{091BB63A-603F-11D1-B067-00A0C9062802}'), + (name: 'IKsTopology' ; itf: '{28F54683-06FD-11D2-B27A-00A0C9223196}'), + (name: 'IKsAggregateControl' ; itf: '{7F40EAC0-3947-11D2-874E-00A0C9223196}'), + (name: 'IKsQualityForwarder' ; itf: '{97EBAACB-95BD-11D0-A3EA-00A0C9223196}'), + (name: 'IPropertySetter' ; itf: '{AE9472BD-B0C3-11D2-8D24-00A0C9441E20}'), + (name: 'IDxtCompositor' ; itf: '{BB44391E-6ABD-422F-9E2E-385C9DFF51FC}'), + (name: 'IDxtAlphaSetter' ; itf: '{4EE9EAD9-DA4D-43D0-9383-06B90C08B12B}'), + (name: 'IDxtJpeg' ; itf: '{DE75D011-7A65-11D2-8CEA-00A0C9441E20}'), + (name: 'IDxtKey' ; itf: '{3255DE56-38FB-4901-B980-94B438010D7B}'), + (name: 'IMediaLocator' ; itf: '{288581E0-66CE-11D2-918F-00C0DF10D434}'), + (name: 'IMediaDet' ; itf: '{65BD0710-24D2-4FF7-9324-ED2E5D3ABAFA}'), + (name: 'IGrfCache' ; itf: '{AE9472BE-B0C3-11D2-8D24-00A0C9441E20}'), + (name: 'IRenderEngine' ; itf: '{6BEE3A81-66C9-11D2-918F-00C0DF10D434}'), + (name: 'IFindCompressorCB' ; itf: '{F03FA8DE-879A-4D59-9B2C-26BB1CF83461}'), + (name: 'ISmartRenderEngine' ; itf: '{F03FA8CE-879A-4D59-9B2C-26BB1CF83461}'), + (name: 'IAMTimelineObj' ; itf: '{78530B77-61F9-11D2-8CAD-00A024580902}'), + (name: 'IAMTimelineEffectable' ; itf: '{EAE58537-622E-11D2-8CAD-00A024580902}'), + (name: 'IAMTimelineEffect' ; itf: '{BCE0C264-622D-11D2-8CAD-00A024580902}'), + (name: 'IAMTimelineTransable' ; itf: '{378FA386-622E-11D2-8CAD-00A024580902}'), + (name: 'IAMTimelineSplittable' ; itf: '{A0F840A0-D590-11D2-8D55-00A0C9441E20}'), + (name: 'IAMTimelineTrans' ; itf: '{BCE0C265-622D-11D2-8CAD-00A024580902}'), + (name: 'IAMTimelineSrc' ; itf: '{78530B79-61F9-11D2-8CAD-00A024580902}'), + (name: 'IAMTimelineTrack' ; itf: '{EAE58538-622E-11D2-8CAD-00A024580902}'), + (name: 'IAMTimelineVirtualTrack' ; itf: '{A8ED5F80-C2C7-11D2-8D39-00A0C9441E20}'), + (name: 'IAMTimelineComp' ; itf: '{EAE58536-622E-11D2-8CAD-00A024580902}'), + (name: 'IAMTimelineGroup' ; itf: '{9EED4F00-B8A6-11D2-8023-00C0DF10D434}'), + (name: 'IAMTimeline' ; itf: '{78530B74-61F9-11D2-8CAD-00A024580902}'), + (name: 'IXml2Dex' ; itf: '{18C628ED-962A-11D2-8D08-00A0C9441E20}'), + (name: 'IAMErrorLog' ; itf: '{E43E73A2-0EFA-11D3-9601-00A0C9441E20}'), + (name: 'IAMSetErrorLog' ; itf: '{963566DA-BE21-4EAF-88E9-35704F8F52A1}'), + (name: 'ISampleGrabberCB' ; itf: '{0579154A-2B53-4994-B0D0-E773148EFF85}'), + (name: 'ISampleGrabber' ; itf: '{6B652FFF-11FE-4FCE-92AD-0266B5D7C78F}'), + (name: 'IBDA_NetworkProvider' ; itf: '{fd501041-8ebe-11ce-8183-00aa00577da2}'), + (name: 'IBDA_EthernetFilter' ; itf: '{71985F43-1CA1-11d3-9CC8-00C04F7971E0}'), + (name: 'IBDA_IPV4Filter' ; itf: '{71985F44-1CA1-11d3-9CC8-00C04F7971E0}'), + (name: 'IBDA_IPV6Filter' ; itf: '{E1785A74-2A23-4fb3-9245-A8F88017EF33}'), + (name: 'IBDA_DeviceControl' ; itf: '{FD0A5AF3-B41D-11d2-9C95-00C04F7971E0}'), + (name: 'IBDA_PinControl' ; itf: '{0DED49D5-A8B7-4d5d-97A1-12B0C195874D}'), + (name: 'IBDA_SignalProperties' ; itf: '{D2F1644B-B409-11d2-BC69-00A0C9EE9E16}'), + (name: 'IBDA_SignalStatistics' ; itf: '{1347D106-CF3A-428a-A5CB-AC0D9A2A4338}'), + (name: 'IBDA_Topology' ; itf: '{79B56888-7FEA-4690-B45D-38FD3C7849BE}'), + (name: 'IBDA_VoidTransform' ; itf: '{71985F46-1CA1-11d3-9CC8-00C04F7971E0}'), + (name: 'IBDA_NullTransform' ; itf: '{DDF15B0D-BD25-11d2-9CA0-00C04F7971E0}'), + (name: 'IBDA_FrequencyFilter' ; itf: '{71985F47-1CA1-11d3-9CC8-00C04F7971E0}'), + (name: 'IBDA_LNBInfo' ; itf: '{992CF102-49F9-4719-A664-C4F23E2408F4}'), + (name: 'IBDA_AutoDemodulate' ; itf: '{DDF15B12-BD25-11d2-9CA0-00C04F7971E0}'), + (name: 'IBDA_DigitalDemodulator' ; itf: '{EF30F379-985B-4d10-B640-A79D5E04E1E0}'), + (name: 'IBDA_IPSinkControl' ; itf: '{3F4DC8E2-4050-11d3-8F4B-00C04F7971E2}'), + (name: 'IBDA_IPSinkInfo' ; itf: '{A750108F-492E-4d51-95F7-649B23FF7AD7}'), + (name: 'IEnumPIDMap' ; itf: '{afb6c2a2-2c41-11d3-8a60-0000f81e0e4a}'), + (name: 'IMPEG2PIDMap' ; itf: '{afb6c2a1-2c41-11d3-8a60-0000f81e0e4a}'), + (name: 'IMPEG2_TIF_CONTROL' ; itf: '{F9BAC2F9-4149-4916-B2EF-FAA202326862}'), + (name: 'ITuneRequestInfo' ; itf: '{A3B152DF-7A90-4218-AC54-9830BEE8C0B6}'), + (name: 'IGuideDataEvent' ; itf: '{EFDA0C80-F395-42c3-9B3C-56B37DEC7BB7}'), + (name: 'IGuideDataProperty' ; itf: '{88EC5E58-BB73-41d6-99CE-66C524B8B591}'), + (name: 'IEnumGuideDataProperties' ; itf: '{AE44423B-4571-475c-AD2C-F40A771D80EF}'), + (name: 'IEnumTuneRequests' ; itf: '{1993299C-CED6-4788-87A3-420067DCE0C7}'), + (name: 'IGuideData' ; itf: '{61571138-5B01-43cd-AEAF-60B784A0BF93}'), + (name: 'IGuideDataLoader' ; itf: '{4764ff7c-fa95-4525-af4d-d32236db9e38}'), + (name: 'IVPEConfig' ; itf: '{BC29A660-30E3-11d0-9E69-00C04FD7C15B}'), + (name: 'IVPE' ; itf: '{BC29A661-30E3-11d0-9E69-00C04FD7C15B}'), + (name: 'IDivXFilterInterface' ; itf: '{D132EE97-3E38-4030-8B17-59163B30A1F5}'), + + (name: 'IVMRAspectRatioControl9' ; itf: '{00d96c29-bbde-4efc-9901-bb5036392146}'), + (name: 'IVMRDeinterlaceControl9' ; itf: '{a215fb8d-13c2-4f7f-993c-003d6271a459}'), + (name: 'IVMRFilterConfig9' ; itf: '{5a804648-4f66-4867-9c43-4f5c822cf1b8}'), + (name: 'IVMRImageCompositor9' ; itf: '{4a5c89eb-df51-4654-ac2a-e48e02bbabf6}'), + (name: 'IVMRImagePresenter9' ; itf: '{69188c61-12a3-40f0-8ffc-342e7b433fd7}'), + (name: 'IVMRImagePresenterConfig9' ; itf: '{45c15cab-6e22-420a-8043-ae1f0ac02c7d}'), + (name: 'IVMRMixerBitmap9' ; itf: '{ced175e5-1935-4820-81bd-ff6ad00c9108}'), + (name: 'IVMRMixerControl9' ; itf: '{1a777eaa-47c8-4930-b2c9-8fee1c1b0f3b}'), + (name: 'IVMRMonitorConfig9' ; itf: '{46c2e457-8ba0-4eef-b80b-0680f0978749}'), + (name: 'IVMRSurface9' ; itf: '{dfc581a1-6e1f-4c3a-8d0a-5e9792ea2afc}'), + (name: 'IVMRSurfaceAllocator9' ; itf: '{8d5148ea-3f5d-46cf-9df1-d1b896eedb1f}'), + (name: 'IVMRSurfaceAllocatorNotify9' ; itf: '{dca3f5df-bb3a-4d03-bd81-84614bfbfa0c}'), + (name: 'IVMRWindowlessControl9' ; itf: '{8f537d09-f85e-4414-b23b-502e54c79927}'), + (name: 'IVMRVideoStreamControl9' ; itf: '{d0cfe38b-93e7-4772-8957-0400c49a4485}'), + + (name: 'IEnumStreamBufferRecordingAttrib' ; itf: '{C18A9162-1E82-4142-8C73-5690FA62FE33}'), + (name: 'IStreamBufferConfigure' ; itf: '{ce14dfae-4098-4af7-bbf7-d6511f835414}'), + (name: 'IStreamBufferInitialize' ; itf: '{9ce50f2d-6ba7-40fb-a034-50b1a674ec78}'), + (name: 'IStreamBufferMediaSeeking' ; itf: '{f61f5c26-863d-4afa-b0ba-2f81dc978596}'), + (name: 'IStreamBufferRecComp' ; itf: '{9E259A9B-8815-42ae-B09F-221970B154FD}'), + (name: 'IStreamBufferRecordControl' ; itf: '{ba9b6c99-f3c7-4ff2-92db-cfdd4851bf31}'), + (name: 'IStreamBufferRecordingAttribute' ; itf: '{16CA4E03-FE69-4705-BD41-5B7DFC0C95F3}'), + (name: 'IStreamBufferSink' ; itf: '{afd1f242-7efd-45ee-ba4e-407a25c9a77a}'), + (name: 'IStreamBufferSource' ; itf: '{1c5bd776-6ced-4f44-8164-5eab0e98db12}'), + + // ole + (name: 'IPersist' ; itf: '{0000010C-0000-0000-C000-000000000046}'), + (name: 'IPersistStream' ; itf: '{00000109-0000-0000-C000-000000000046}'), + (name: 'IPersistFile' ; itf: '{0000010B-0000-0000-C000-000000000046}'), + (name: 'IPersistPropertyBag' ; itf: '{37D84F60-42CB-11CE-8135-00AA004BB851}'), + (name: 'IPersistStorage' ; itf: '{0000010A-0000-0000-C000-000000000046}'), + (name: 'IMoniker' ; itf: '{0000000F-0000-0000-C000-000000000046}'), + (name: 'IStream' ; itf: '{0000000C-0000-0000-C000-000000000046}'), + (name: 'IBindCtx' ; itf: '{0000000E-0000-0000-C000-000000000046}'), + (name: 'IRunningObjectTable' ; itf: '{00000010-0000-0000-C000-000000000046}'), + (name: 'IPropertyBag' ; itf: '{55272A00-42CB-11CE-8135-00AA004BB851}'), + (name: 'IPropertyPage' ; itf: '{B196B28D-BAB4-101A-B69C-00AA00341D07}'), + (name: 'IPropertyPage2' ; itf: '{01E44665-24AC-101B-84ED-08002B2EC713}'), + (name: 'IPropertyStorage' ; itf: '{00000138-0000-0000-C000-000000000046}'), + (name: 'IServiceProvider' ; itf: '{6d5140c1-7436-11ce-8034-00aa006009fa}'), + (name: 'ISpecifyPropertyPages' ; itf: '{B196B28B-BAB4-101A-B69C-00AA00341D07}'), + (name: 'IErrorLog' ; itf: '{3127CA40-446E-11CE-8135-00AA004BB851}'), + (name: 'IErrorInfo' ; itf: '{1CF2B120-547D-101B-8E65-08002B2BD119}'), + (name: 'IStorage' ; itf: '{0000000B-0000-0000-C000-000000000046}')); + + +var + FormBaseFilter: TFormBaseFilter; + + +implementation +uses Activex, ComObj; + +{$R *.dfm} +{$R BaseFilterEditor.res} + + constructor TFormBaseFilter.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + SysDevEnum := TSysDevEnum.Create; + PinList:= TPinList.Create; + InPinPic := TBitmap.Create; + OutPinPic := TBitmap.Create; + InPinPic.LoadFromResourceName(hinstance, 'INPUT'); + OutPinPic.LoadFromResourceName(hinstance, 'OUTPUT'); + InfoBtn.Glyph.LoadFromResourceName(hinstance, 'INFO'); + Image1.Picture.Bitmap.LoadFromResourceName(hinstance, 'GREEN_MARK'); + Image2.Picture.Bitmap.LoadFromResourceName(hinstance, 'RED_MARK'); + Image3.Picture.Bitmap.LoadFromResourceName(hinstance, 'BLUE_MARK'); + Image4.Picture.Bitmap.LoadFromResourceName(hinstance, 'PURPLE_MARK'); + Image5.Picture.Bitmap.LoadFromResourceName(hinstance, 'BLACK_MARK'); + Image6.Picture.Bitmap.LoadFromResourceName(hinstance, 'INPUT'); + Image7.Picture.Bitmap.LoadFromResourceName(hinstance, 'OUTPUT'); + end; + + destructor TFormBaseFilter.Destroy; + begin + SysDevEnum.Free; + PinList.Free; + InPinPic.Free; + OutPinPic.Free; + inherited destroy; + end; + +procedure TFormBaseFilter.FormShow(Sender: TObject); +var + i, j: integer; + a, b : integer; + AMoniker, MyMoniker: IMoniker; + PropBag: IPropertyBag; + AVariant: OleVariant; + CLSID: TGUID; + Found: boolean; + NodeItem : pNodeItem; + TmpItem : TTreeNode; +begin + PageControl1.ActivePageIndex := 0; + RefreshTree; + Found := False; + j := 0; + MyMoniker := Filter.BaseFilter.Moniker; + if MyMoniker = nil then exit; + MyMoniker.BindToStorage(nil,nil,IPropertyBag, PropBag); + if PropBag.Read('CLSID',AVariant,nil) = S_OK then + CLSID := StringToGUID(AVariant) + else CLSID := GUID_NULL; + for i := 0 to SysDevEnum.CountCategories - 1 do + begin + SysDevEnum.SelectIndexCategory(i); + if SysDevEnum.CountFilters > 0 then + for j := 0 to SysDevEnum.CountFilters - 1 do + begin + if IsEqualGUID(CLSID, SysDevEnum.Filters[j].CLSID) then + begin + AMoniker := SysDevEnum.GetMoniker(j); + Found := AMoniker.IsEqual(MyMoniker) = S_OK; + AMoniker := nil; + end; + if Found then Break; + end; + Filters.SetFocus; + if Found then + begin + for a := 0 to Filters.Items.Count -1 do + begin + NodeItem := pNodeItem(Filters.Items[a].Data); + if (Filters.Items[a].Level = 0) and (NodeItem^.Index = I) then + begin + TmpItem := Filters.Items[a]; + for b := 0 to TmpItem.Count -1 do + begin + NodeItem := pNodeItem(TmpItem.Item[b].data); + If NodeItem^.Index = J then + begin + Filters.Selected := TmpItem.Item[b]; + Filterschange(Self, TmpItem.Item[b]); + end; + end; + end; + end; + break; + end; + end; + PropBag := nil; + MyMoniker := nil; +end; + +procedure TFormBaseFilter.GetFilterInfo; +var + i: integer; + unk: IUnknown; + PinInfo: TPinInfo; + BaseF: IBaseFilter; +begin + BaseF := nil; + try + if Filter.BaseFilter.CreateFilter <> nil then + begin + for i := 0 to length(DSItfs)-1 do + begin + unk := nil; + if Succeeded(IFilter(Filter).QueryInterface(DSItfs[i].itf, unk)) then + Interfaces.Items.Add(DSItfs[i].name); + end; + + if Succeeded(Filter.QueryInterface(IBaseFilter, BaseF)) then + begin + PinList.Assign(BaseF); + if PinList.Count > 0 then + for i := 0 to PinList.Count - 1 do + begin + PinInfo := PinList.PinInfo[i]; + case PinInfo.dir of + PINDIR_INPUT : Pins.Items.AddObject(format('%s',[PinInfo.achName]), InPinPic); + PINDIR_OUTPUT : Pins.Items.AddObject(format('%s',[PinInfo.achName]), OutPinPic); + end; + PinInfo.pFilter := nil; + end; + End; + end; + finally + unk := nil; + BaseF := nil; + end +end; + +procedure TFormBaseFilter.RefreshTree; +var + i, j : Integer; + TmpNode : TTreeNode; + NodeItem : pNodeItem; + MonikerStr : PWideChar; + Tmp : WideString; +begin + Filters.Items.BeginUpdate; + Filters.Items.Clear; + for i := 0 to SysDevEnum.CountCategories - 1 do + begin + New(NodeItem); + NodeItem^.Index := i; + TmpNode := Filters.Items.AddChildObject(nil, SysDevEnum.Categories[i].FriendlyName, NodeItem); + SysDevEnum.SelectIndexCategory(i); + if SysDevEnum.CountFilters > 0 then + for j := 0 to SysDevEnum.CountFilters - 1 do + begin + SysDevEnum.GetMoniker(j).GetDisplayName(nil, nil, MonikerStr); + New(NodeItem); + NodeItem^.Index := j; + NodeItem^.Color := FilterColors[0]; + Tmp := MonikerStr; + Tmp := Copy(Tmp, Pos(':', Tmp)+1, 255); + Tmp := uppercase(Copy(Tmp, 1, pos(':', Tmp) -1)); + If Tmp = 'PNP' then NodeItem^.Color := FilterColors[1]; + If Tmp = 'CM' then NodeItem^.Color := FilterColors[2]; + If Tmp = 'KS' then NodeItem^.Color := FilterColors[3]; + If Tmp = 'DMO' then NodeItem^.Color := FilterColors[4]; + Filters.Items.AddChildObject(TmpNode, SysDevEnum.Filters[j].FriendlyName, NodeItem); + end; + end; + {$IFDEF VER130} + Filters.AlphaSort; + {$ELSE} + Filters.AlphaSort(True); + {$ENDIF} + Filters.Items.EndUpdate; +end; + +procedure TFormBaseFilter.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + PinList.Clear; + FilterGraph.ClearGraph; + FilterGraph.Active := false; +end; + +procedure TFormBaseFilter.PopupMenuPopup(Sender: TObject); +var + AFilter: IBaseFilter; +begin + PopupMenu.Items.Items[0].Enabled := false; + PopupMenu.Items.Items[1].Items[0].Enabled := false; + PopupMenu.Items.Items[1].Items[1].Enabled := false; + PopupMenu.Items.Items[1].Items[2].Enabled := false; + PopupMenu.Items.Items[2].Items[0].Enabled := false; + PopupMenu.Items.Items[2].Items[1].Enabled := false; + If (Filters.Selected = Nil) or (Filters.Selected.Level = 0) then Abort; + + Filter.QueryInterface(IBaseFilter, AFilter); + if HaveFilterPropertyPage(AFilter, ppDefault) then PopupMenu.Items.Items[0].Enabled := true; + if HaveFilterPropertyPage(AFilter, ppVFWCapFormat) then PopupMenu.Items.Items[1].Items[0].Enabled := true; + if HaveFilterPropertyPage(AFilter, ppVFWCapSource) then PopupMenu.Items.Items[1].Items[1].Enabled := true; + if HaveFilterPropertyPage(AFilter, ppVFWCapDisplay) then PopupMenu.Items.Items[1].Items[2].Enabled := true; + if HaveFilterPropertyPage(AFilter, ppVFWCompConfig) then PopupMenu.Items.Items[2].Items[0].Enabled := true; + if HaveFilterPropertyPage(AFilter, ppVFWCompAbout) then PopupMenu.Items.Items[2].Items[1].Enabled := true; + AFilter := nil; +end; + +procedure TFormBaseFilter.PropertyPageClick(Sender: TObject); +var AFilter: IBaseFilter; +begin + Filter.QueryInterface(IBaseFilter, AFilter); + ShowFilterPropertyPage(Self.Handle, AFilter, ppDefault); + AFilter := nil; +end; + +procedure TFormBaseFilter.PinMenuPopup(Sender: TObject); +begin + If PageControl1.ActivePageIndex = 0 then + Begin + if Pins.ItemIndex = -1 then abort; + End + else + if Pins1.ItemIndex = -1 then abort; +end; + +procedure TFormBaseFilter.PinPropertyClick(Sender: TObject); +begin + If PageControl1.ActivePageIndex = 0 then + ShowPinPropertyPage(Self.Handle, PinList.Items[Pins.ItemIndex]) + else + ShowPinPropertyPage(Self.Handle, PinList.Items[Pins1.ItemIndex]); +end; + +procedure TFormBaseFilter.PinsSheetShow(Sender: TObject); +begin + Pins1.Items := Pins.Items; +end; + +procedure TFormBaseFilter.Pins1Click(Sender: TObject); +var + i: integer; + unk: IUnknown; + EnumMT : TEnumMediaType; +begin + PinInterfaces.Clear; + if Pins1.ItemIndex <> -1 then + try + with PinList.Items[Pins1.ItemIndex] do + for i := 0 to length(DSItfs)-1 do + if Succeeded(QueryInterface(DSItfs[i].itf, unk)) then + PinInterfaces.Items.Add(DSItfs[i].name); + finally + unk := nil; + end; + + MediaTypes.Clear; + if Pins1.ItemIndex <> -1 then + begin + EnumMT:= TEnumMediaType.Create(PinList.Items[Pins1.ItemIndex]); + try + if EnumMT.Count > 0 then + for i := 0 to EnumMT.Count - 1 do + MediaTypes.Items.Add(EnumMt.MediaDescription[i]); + finally + EnumMT.Free; + end; + end; +end; + +procedure TFormBaseFilter.VFWFormatClick(Sender: TObject); +var AFilter: IBaseFilter; +begin + Filter.QueryInterface(IBaseFilter, AFilter); + ShowFilterPropertyPage(Self.Handle, AFilter, ppVFWCapFormat); + AFilter := nil; +end; + +procedure TFormBaseFilter.VFWSourceClick(Sender: TObject); +var AFilter: IBaseFilter; +begin + Filter.QueryInterface(IBaseFilter, AFilter); + ShowFilterPropertyPage(Self.Handle, AFilter , ppVFWCapSource); + AFilter := nil; +end; + +procedure TFormBaseFilter.VFWDisplayClick(Sender: TObject); +var AFilter: IBaseFilter; +begin + Filter.QueryInterface(IBaseFilter, AFilter); + ShowFilterPropertyPage(Self.Handle, AFilter, ppVFWCapDisplay); + AFilter := nil; +end; + +procedure TFormBaseFilter.Config1Click(Sender: TObject); +var AFilter: IBaseFilter; +begin + Filter.QueryInterface(IBaseFilter, AFilter); + ShowFilterPropertyPage(Self.Handle, AFilter, ppVFWCompConfig); + AFilter := nil; +end; + +procedure TFormBaseFilter.VFWAboutClick(Sender: TObject); +var AFilter: IBaseFilter; +begin + Filter.QueryInterface(IBaseFilter, AFilter); + ShowFilterPropertyPage(Self.Handle, AFilter, ppVFWCompAbout); + AFilter := nil; +end; + +procedure TFormBaseFilter.InterfacesDblClick(Sender: TObject); +var + AFilter: IBaseFilter; +begin + Filter.QueryInterface(IBaseFilter, AFilter); + if Interfaces.ItemIndex <> -1 then + if Interfaces.Items.Strings[Interfaces.ItemIndex] = 'ISpecifyPropertyPages' then + ShowFilterPropertyPage(Self.Handle, AFilter); + AFilter := nil; +end; + +procedure TFormBaseFilter.PinInterfacesDblClick(Sender: TObject); +begin + if PinInterfaces.ItemIndex <> -1 then + if PinInterfaces.Items.Strings[PinInterfaces.ItemIndex] = 'ISpecifyPropertyPages' then + ShowPinPropertyPage(Self.Handle, PinList.Items[Pins1.ItemIndex]); +end; + +procedure TFormBaseFilter.PinsDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); +var + Bitmap: TBitmap; { temporary variable for the item’s bitmap } + Offset: Integer; { text offset width } +begin + with (Control as TListBox).Canvas do { draw on control canvas, not on the form } + begin + Brush.Color := (Control as TListBox).Color; + Brush.Style := bsSolid; + FillRect(Rect); { clear the rectangle } + Offset := 2; { provide default offset } + Bitmap := TBitmap((Control as TListBox).Items.Objects[Index]); { get the bitmap } + if Bitmap <> nil then + begin + BrushCopy(Bounds(Rect.Left + Offset, Rect.Top, Bitmap.Width, Bitmap.Height), + Bitmap, Bounds(0, 0, Bitmap.Width, Bitmap.Height), clOlive); {render bitmap} + Offset := Bitmap.width + 6; { add four pixels between bitmap and text} + end; + If odSelected in State then + Brush.Color := clHighLight; + TextOut(Rect.Left + Offset, Rect.Top, (Control as TListBox).Items[Index]); { display the text } + If odFocused in state then + Begin + Drawfocusrect(Rect); + Drawfocusrect(Bounds(Rect.Left + Offset, Rect.Top, TextWidth((Control as TListBox).Items[Index])+1, Rect.Bottom - Rect.Top)); + End; + end; +end; + +procedure TFormBaseFilter.FiltersChange(Sender: TObject; + Node: TTreeNode); +var + NodeItem : pNodeItem; + Tmp : pWidechar; +begin + if Node = nil then Exit; + Interfaces.Items.BeginUpdate; + Interfaces.Items.Clear; + Pins.Items.BeginUpdate; + Pins.Items.Clear; + MonikerTag.Clear; + Try + if Node.Level = 1 then + begin + NodeItem := pNodeItem(Node.Parent.Data); + If NodeItem = nil then exit; + SysDevEnum.SelectIndexCategory(NodeItem^.Index); + NodeItem := pNodeItem(Node.Data); + SysDevEnum.GetMoniker(NodeItem^.Index).GetDisplayName(nil, nil, Tmp); + MonikerTag.Text := Tmp; + Filter.BaseFilter.Moniker := SysDevEnum.GetMoniker(NodeItem^.Index); + IFilter(Filter).NotifyFilter(foRefresh); + GetFilterInfo; + end; + finally + Interfaces.Items.EndUpdate; + Pins.Items.EndUpdate; + end; +end; + +procedure TFormBaseFilter.PinsMeasureItem(Control: TWinControl; + Index: Integer; var Height: Integer); +begin + (Control as TListBox).Canvas.Font := (Control as TListBox).Font; + If Height < (Control as TListBox).Canvas.TextHeight((Control as TListBox).Items[Index]) then + Height := (Control as TListBox).Canvas.TextHeight((Control as TListBox).Items[Index]); +end; + +procedure TFormBaseFilter.FiltersDblClick(Sender: TObject); +begin + If Filters.Selected = nil then Exit; + If Filters.Selected.Level = 1 then btok.Click; +end; + +procedure TFormBaseFilter.FiltersCustomDrawItem(Sender: TCustomTreeView; + Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean); +var + NodeItem : pNodeItem; +begin + Filters.Canvas.Font.Color := FilterColors[0]; + if Node = nil then Exit; + if Node.Level < 1 then exit; + NodeItem := pNodeItem(Node.Data); + Filters.Canvas.Font.Color := NodeItem^.Color; +end; + +procedure TFormBaseFilter.InfoBtnClick(Sender: TObject); +begin + PageControl1.ActivePageIndex := 2; +end; + +end. + + diff --git a/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.res b/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.res new file mode 100644 index 00000000..452e3d25 Binary files /dev/null and b/Game/Code/lib/DSPack/DSPack/BaseFilterEditor.res differ diff --git a/Game/Code/lib/DSPack/DSPack/DSEditors.pas b/Game/Code/lib/DSPack/DSPack/DSEditors.pas new file mode 100644 index 00000000..facaa1e4 --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/DSEditors.pas @@ -0,0 +1,131 @@ + + (********************************************************************* + * DSPack 2.3.3 * + * * + * home page : http://www.progdigy.com * + * email : hgourvest@progdigy.com * + * Thanks to Michael Andersen. (DSVideoWindowEx) * + * * + * date : 21-02-2003 * + * * + * 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. * + * * + *********************************************************************) + +unit DSEditors; + +{$IFDEF VER150} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} + +interface +uses +{$IFDEF VER140} DesignIntf, DesignEditors, {$ELSE} +{$IFDEF VER150} DesignIntf, DesignEditors, {$ELSE} + DsgnIntf, {$ENDIF} {$ENDIF} + Forms, Controls, DSUtil, DSPack; + +type + +// ***************************************************************************** +// TMediaTypePropertyClass +// ***************************************************************************** + + TMediaTypePropertyClass = class(TClassProperty) + public + procedure Edit; override; + function GetAttributes: TPropertyAttributes; override; + end; + +// ***************************************************************************** +// TBaseFilterPropertyClass +// ***************************************************************************** + + TBaseFilterPropertyClass = class(TClassProperty) + public + procedure Edit; override; + function GetAttributes: TPropertyAttributes; override; + end; + + procedure Register; + +implementation + +uses MediaTypeEditor, BaseFilterEditor, Classes; + +// ***************************************************************************** +// TMediaTypePropertyClass +// ***************************************************************************** + + procedure TMediaTypePropertyClass.Edit; + var + Dlg: TFormMediaType; + begin + Dlg := TFormMediaType.create(Application); + try + Dlg.MediaType.Assign(TMediaType(GetOrdValue)); + if Dlg.ShowModal = mrOk then + begin + TMediaType(GetOrdValue).Assign(Dlg.MediaType); + if (GetComponent(0) is TSampleGrabber) then + IFilter(GetComponent(0) as TSampleGrabber).NotifyFilter(foRefresh); + Modified; + end; + finally + Dlg.Free; + end; + end; + + function TMediaTypePropertyClass.GetAttributes: TPropertyAttributes; + begin + Result := [paDialog]; + end; + +// ***************************************************************************** +// TBaseFilterPropertyClass +// ***************************************************************************** + + procedure TBaseFilterPropertyClass.Edit; + var + Dlg: TFormBaseFilter; + begin + Dlg := TFormBaseFilter.create(Application); + try + Dlg.Filter.BaseFilter.Assign(TBaseFilter(GetOrdValue)); + if Dlg.ShowModal = mrOk then + begin + TBaseFilter(GetOrdValue).Assign(Dlg.Filter.BaseFilter); + if (GetComponent(0) is TFilter) then + IFilter(GetComponent(0) as TFilter).NotifyFilter(foRefresh); + Modified; + end; + finally + Dlg.Free; + end; + end; + + function TBaseFilterPropertyClass.GetAttributes: TPropertyAttributes; + begin + Result := [paDialog]; + end; + + procedure Register; + begin + RegisterComponents('DSPack', [TFilterGraph, TVideoWindow, TSampleGrabber, + TFilter, TASFWriter, TDSTrackBar, TDSVideoWindowEx2]); + RegisterPropertyEditor(TypeInfo(TMediaType), nil, '', TMediaTypePropertyClass); + RegisterPropertyEditor(TypeInfo(TBaseFilter), nil, '', TBaseFilterPropertyClass); + end; + +end. diff --git a/Game/Code/lib/DSPack/DSPack/DSPack.dcr b/Game/Code/lib/DSPack/DSPack/DSPack.dcr new file mode 100644 index 00000000..6179f178 Binary files /dev/null and b/Game/Code/lib/DSPack/DSPack/DSPack.dcr differ diff --git a/Game/Code/lib/DSPack/DSPack/DSPack.pas b/Game/Code/lib/DSPack/DSPack/DSPack.pas new file mode 100644 index 00000000..2e9eee06 --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/DSPack.pas @@ -0,0 +1,5947 @@ + + (********************************************************************* + * DSPack 2.3.3 * + * * + * home page : http://www.progdigy.com * + * email : hgourvest@progdigy.com * + * Thanks to Michael Andersen. (DSVideoWindowEx) * + * * + * date : 2003-09-08 * + * * + * 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. * + * * + * Contributor(s) * + * Peter J. Haas * + * Andriy Nevhasymyy * + * Milenko Mitrovic * + * Michael Andersen * + * Martin Offenwanger * + * * + *********************************************************************) + +{ + @abstract(DSPack Components.) + @author(Henri Gourvest: hgourvest@progdigy.com) + @created(Mar 14, 2002) + @lastmod(Oct 24, 2003) +} +{$I jedi.inc} +{$IFDEF COMPILER6_UP} + {$WARN SYMBOL_DEPRECATED OFF} +{$ENDIF} +{$IFDEF COMPILER7_UP} + {$WARN SYMBOL_DEPRECATED OFF} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} +{$ALIGN ON} +{$MINENUMSIZE 4} + +unit DSPack; + +interface +uses + Windows, Classes, SysUtils, Messages, Graphics, Forms, Controls, ActiveX, DirectShow9, + DirectDraw, DSUtil, ComCtrls, MMSystem, Math, Consts, ExtCtrls, + MultiMon, Dialogs, Registry, SyncObjs, Direct3D9, WMF9; + +const + { Filter Graph message identifier. } + WM_GRAPHNOTIFY = WM_APP + 1; + { Sample Grabber message identifier. } + WM_CAPTURE_BITMAP = WM_APP + 2; + +type + + { Video mode to use with @link(TVideoWindow). } + TVideoMode = ( + vmNormal, + vmVMR + ); + + { Graph Mode to use with @link(TFilterGraph).} + TGraphMode = ( + gmNormal, + gmCapture, + gmDVD + ); + + { Render device returned by then OnGraphVMRRenderDevice event. } +{$IFDEF VER140} + TVMRRenderDevice = ( + rdOverlay = 1, + rdVidMem = 2, + rdSysMem = 4 + ); +{$ELSE} + TVMRRenderDevice = Integer; + const + rdOverlay = 1; + rdVidMem = 2; + rdSysMem = 4; +type +{$ENDIF} + + {@exclude} + TGraphState = ( + gsUninitialized, + gsStopped, + gsPaused, + gsPlaying + ); + + { Specifies the seeking capabilities of a media stream. } + TSeekingCap = ( + CanSeekAbsolute, // The stream can seek to an absolute position. + CanSeekForwards, // The stream can seek forward. + CanSeekBackwards, // The stream can seek backward. + CanGetCurrentPos, // The stream can report its current position. + CanGetStopPos, // The stream can report its stop position. + CanGetDuration, // The stream can report its duration. + CanPlayBackwards, // The stream can play backward. + CanDoSegments, // The stream can do seamless looping (see IMediaSeeking.SetPositions). + Source // Reserved. + ); + { Specifies the seeking capabilities of a media stream. } + TSeekingCaps = set of TSeekingCap; + + { Video Mixer Render Preferences:
+ vpForceOffscreen: Indicates that the VMR should use only offscreen surfaces for rendering.
+ vpForceOverlays: Indicates that the VMR should fail if no overlay surfaces are available.
+ vpForceMixer: Indicates that the VMR must use Mixer when the number of streams is 1.
+ vpDoNotRenderColorKeyAndBorder: Indicates that the application is responsible for painting the color keys.
+ vpRestrictToInitialMonitor: Indicates that the VMR should output only to the initial monitor.
+ vpPreferAGPMemWhenMixing: Indicates that the VMR should attempt to use AGP memory when allocating texture surfaces.} + TVMRPreference = ( + vpForceOffscreen, + vpForceOverlays, + vpForceMixer, + vpDoNotRenderColorKeyAndBorder, + vpRestrictToInitialMonitor, + vpPreferAGPMemWhenMixing + ); + + { Pointer to @link(TVMRPreferences).} + PVMRPreferences = ^TVMRPreferences; + { Set of @link(TVMRPreference).} + TVMRPreferences = set of TVMRPreference; + + TOnDSEvent = procedure(sender: TComponent; Event, Param1, Param2: Integer) of object; + {@exclude} + TOnGraphBufferingData = procedure(sender: TObject; Buffering: boolean) of object ; {@exclude} + TOnGraphComplete = procedure(sender: TObject; Result: HRESULT; Renderer: IBaseFilter) of object ; {@exclude} + TOnGraphDeviceLost = procedure(sender: TObject; Device: IUnknown; Removed: Boolean) of object ; {@exclude} + TOnGraphEndOfSegment = procedure(sender: TObject; StreamTime: TReferenceTime; NumSegment: Cardinal) of object ; {@exclude} + TOnDSResult = procedure(sender: TObject; Result: HRESULT) of object ; {@exclude} + TOnGraphFullscreenLost = procedure(sender: TObject; Renderer: IBaseFilter) of object ; {@exclude} + TOnGraphOleEvent = procedure(sender: TObject; String1, String2: WideString) of object ; {@exclude} + TOnGraphOpeningFile = procedure(sender: TObject; opening: boolean) of object ; {@exclude} + TOnGraphSNDDevError = procedure(sender: TObject; OccurWhen: TSndDevErr; ErrorCode: LongWord) of object ; {@exclude} + TOnGraphStreamControl = procedure(sender: TObject; PinSender: IPin; Cookie: LongWord) of object ; {@exclude} + TOnGraphStreamError = procedure(sender: TObject; Operation: HRESULT; Value: LongWord) of object ; {@exclude} + TOnGraphVideoSizeChanged = procedure(sender: TObject; Width, height: word) of object ; {@exclude} + TOnGraphTimeCodeAvailable = procedure(sender: TObject; From: IBaseFilter; DeviceID: LongWord) of object ; {@exclude} + TOnGraphEXTDeviceModeChange = procedure(sender: TObject; NewMode, DeviceID: LongWord) of object ; {@exclude} + TOnGraphVMRRenderDevice = procedure(sender: TObject; RenderDevice: TVMRRenderDevice) of object; + {@exclude} + TOnDVDAudioStreamChange = procedure(sender: TObject; stream, lcid: Integer; Lang: string) of object; {@exclude} + TOnDVDCurrentTime = procedure(sender: TObject; Hours, minutes,seconds,frames,frate : Integer) of object; {@exclude} + TOnDVDTitleChange = procedure(sender: TObject; title: Integer) of object; {@exclude} + TOnDVDChapterStart = procedure(sender: TObject; chapter: Integer) of object; {@exclude} + TOnDVDValidUOPSChange = procedure(sender: TObject; UOPS: Integer) of object; {@exclude} + TOnDVDChange = procedure(sender: TObject; total,current: Integer) of object; {@exclude} + TOnDVDStillOn = procedure(sender: TObject; NoButtonAvailable: boolean; seconds: Integer) of object; {@exclude} + TOnDVDSubpictureStreamChange = procedure(sender: TObject; SubNum, lcid: Integer; Lang: string) of object; {@exclude} + TOnDVDPlaybackRateChange = procedure(sender: TObject; rate: single) of object; {@exclude} + TOnDVDParentalLevelChange = procedure(sender: TObject; level: Integer) of object; {@exclude} + TOnDVDAnglesAvailable = procedure(sender: TObject; available: boolean) of object; {@exclude} + TOnDVDButtonAutoActivated = procedure(sender: TObject; Button: Cardinal) of object; {@exclude} + TOnDVDCMD = procedure(sender: TObject; CmdID: Cardinal) of object; {@exclude} + TOnDVDCurrentHMSFTime = procedure(sender: TObject; HMSFTimeCode: TDVDHMSFTimeCode; TimeCode: TDVDTimeCode) of object; {@exclude} + TOnDVDKaraokeMode = procedure(sender: TObject; Played: boolean) of object; + {@exclude} + TOnBuffer = procedure(sender: TObject; SampleTime: Double; pBuffer: Pointer; BufferLen: longint) of object ; + + TOnSelectedFilter = function (Moniker: IMoniker; FilterName: WideString; ClassID: TGuid): Boolean of Object; + TOnCreatedFilter = function (Filter: IBaseFilter; ClassID: TGuid): Boolean of Object; + TOnUnableToRender = function (Pin: IPin): Boolean of Object; +// ***************************************************************************** +// IFilter +// ***************************************************************************** + + {@exclude} + TFilterOperation = ( + foAdding, // Before the filter is added to graph. + foAdded, // After the filter is added to graph. + foRemoving, // Before the filter is removed from graph. + foRemoved, // After the filter is removed from graph. + foRefresh // Designer notification to Refresh the filter . + ); + + + {@exclude} + IFilter = interface + ['{887F94DA-29E9-44C6-B48E-1FBF0FB59878}'] + { Return the IBaseFilter Interface (All DirectShow filters expose this interface). } + function GetFilter: IBaseFilter; + { Return the filter name (generally the component name). } + function GetName: string; + { Called by the @link(TFilterGraph) component, this method receive notifications + on what the TFilterGraph is doing. if Operation = foGraphEvent then Param is the + event code received by the FilterGraph.} + procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0); + end; + + {@exclude} + TControlEvent = ( + cePlay, + cePause, + ceStop, + ceFileRendering, + ceFileRendered, + ceDVDRendering, + ceDVDRendered, + ceActive + ); + + {@exclude} + IEvent = interface + ['{6C0DCD7B-1A98-44EF-A6D5-E23CBC24E620}'] + { FilterGraph events. } + procedure GraphEvent(Event, Param1, Param2: integer); + { Control Events. } + procedure ControlEvent(Event: TControlEvent; Param: integer = 0); + end; + + + +// ***************************************************************************** +// TFilterGraph +// ***************************************************************************** + + { This component is the central component in DirectShow, the Filter Graph + handle synchronization, event notification, and other aspects of the + controlling the filter graph. } + TFilterGraph = class(TComponent, IAMGraphBuilderCallback, IAMFilterGraphCallback, + IServiceProvider) + private + FActive : boolean; + FAutoCreate : boolean; + FHandle : THandle; // to capture events + FMode : TGraphMode; + + FVolume : integer; + FBalance : integer; + FRate : Double; + FLinearVolume : Boolean; + + FFilters: TInterfaceList; + FGraphEvents: TInterfaceList; + + // builders + FFilterGraph : IGraphBuilder; + FCaptureGraph : ICaptureGraphBuilder2; + FDVDGraph : IDvdGraphBuilder; + + // events interface + FMediaEventEx : IMediaEventEx; + + // Graphedit + FGraphEdit : boolean; + FGraphEditID : Integer; + + // Log File + FLogFileName: String; + FLogFile: TFileStream; + + FOnActivate: TNotifyEvent; + + // All Events Code + FOnDSEvent : TOnDSEvent; + // Generic Graph Events + FOnGraphBufferingData : TOnGraphBufferingData; + FOnGraphClockChanged : TNotifyEvent; + FOnGraphComplete : TOnGraphComplete; + FOnGraphDeviceLost : TOnGraphDeviceLost; + FOnGraphEndOfSegment : TOnGraphEndOfSegment; + FOnGraphErrorStillPlaying : TOnDSResult; + FOnGraphErrorAbort : TOnDSResult; + FOnGraphFullscreenLost : TOnGraphFullscreenLost; + FOnGraphChanged : TNotifyEvent; + FOnGraphOleEvent : TOnGraphOleEvent; + FOnGraphOpeningFile : TOnGraphOpeningFile; + FOnGraphPaletteChanged : TNotifyEvent; + FOnGraphPaused : TOnDSResult; + FOnGraphQualityChange : TNotifyEvent; + FOnGraphSNDDevInError : TOnGraphSNDDevError; + FOnGraphSNDDevOutError : TOnGraphSNDDevError; + FOnGraphStepComplete : TNotifyEvent; + FOnGraphStreamControlStarted : TOnGraphStreamControl; + FOnGraphStreamControlStopped : TOnGraphStreamControl; + FOnGraphStreamErrorStillPlaying : TOnGraphStreamError; + FOnGraphStreamErrorStopped : TOnGraphStreamError; + FOnGraphUserAbort : TNotifyEvent; + FOnGraphVideoSizeChanged : TOnGraphVideoSizeChanged; + FOnGraphTimeCodeAvailable : TOnGraphTimeCodeAvailable; + FOnGraphEXTDeviceModeChange : TOnGraphEXTDeviceModeChange; + FOnGraphClockUnset : TNotifyEvent; + FOnGraphVMRRenderDevice : TOnGraphVMRRenderDevice; + + FOnDVDAudioStreamChange : TOnDVDAudioStreamChange; + FOnDVDCurrentTime : TOnDVDCurrentTime; + FOnDVDTitleChange : TOnDVDTitleChange; + FOnDVDChapterStart : TOnDVDChapterStart; + FOnDVDAngleChange : TOnDVDChange; + FOnDVDValidUOPSChange : TOnDVDValidUOPSChange; + FOnDVDButtonChange : TOnDVDChange; + FOnDVDChapterAutoStop : TNotifyEvent; + FOnDVDStillOn : TOnDVDStillOn; + FOnDVDStillOff : TNotifyEvent; + FOnDVDSubpictureStreamChange : TOnDVDSubpictureStreamChange; + FOnDVDNoFP_PGC : TNotifyEvent; + FOnDVDPlaybackRateChange : TOnDVDPlaybackRateChange; + FOnDVDParentalLevelChange : TOnDVDParentalLevelChange; + FOnDVDPlaybackStopped : TNotifyEvent; + FOnDVDAnglesAvailable : TOnDVDAnglesAvailable; + FOnDVDPlayPeriodAutoStop : TNotifyEvent; + FOnDVDButtonAutoActivated : TOnDVDButtonAutoActivated; + FOnDVDCMDStart : TOnDVDCMD; + FOnDVDCMDEnd : TOnDVDCMD; + FOnDVDDiscEjected : TNotifyEvent; + FOnDVDDiscInserted : TNotifyEvent; + FOnDVDCurrentHMSFTime : TOnDVDCurrentHMSFTime; + FOnDVDKaraokeMode : TOnDVDKaraokeMode; + // DVD Warning + FOnDVDWarningInvalidDVD1_0Disc : TNotifyEvent;//=1, + FOnDVDWarningFormatNotSupported : TNotifyEvent;//=2, + FOnDVDWarningIllegalNavCommand : TNotifyEvent;//=3 + FOnDVDWarningOpen : TNotifyEvent;//=4 + FOnDVDWarningSeek : TNotifyEvent;//=5 + FOnDVDWarningRead : TNotifyEvent;//=6 + // DVDDomain + FOnDVDDomainFirstPlay : TNotifyEvent; + FOnDVDDomainVideoManagerMenu : TNotifyEvent; + FOnDVDDomainVideoTitleSetMenu : TNotifyEvent; + FOnDVDDomainTitle : TNotifyEvent; + FOnDVDDomainStop : TNotifyEvent; + // DVDError + FOnDVDErrorUnexpected : TNotifyEvent; + FOnDVDErrorCopyProtectFail : TNotifyEvent; + FOnDVDErrorInvalidDVD1_0Disc : TNotifyEvent; + FOnDVDErrorInvalidDiscRegion : TNotifyEvent; + FOnDVDErrorLowParentalLevel : TNotifyEvent; + FOnDVDErrorMacrovisionFail : TNotifyEvent; + FOnDVDErrorIncompatibleSystemAndDecoderRegions : TNotifyEvent; + FOnDVDErrorIncompatibleDiscAndDecoderRegions : TNotifyEvent; + + FOnSelectedFilter: TOnSelectedFilter; + FOnCreatedFilter: TOnCreatedFilter; + FOnUnableToRender: TOnUnableToRender; + + procedure HandleEvents; + procedure WndProc(var Msg: TMessage); + procedure SetActive(Activate: boolean); + procedure SetGraphMode(Mode: TGraphMode); + procedure SetGraphEdit(enable: boolean); + procedure ClearOwnFilters; + procedure AddOwnFilters; + procedure GraphEvents(Event, Param1, Param2: integer); + procedure ControlEvents(Event: TControlEvent; Param: integer = 0); + procedure SetLogFile(FileName: String); + function GetState: TGraphState; + procedure SetState(Value: TGraphState); + procedure SetVolume(Volume: Integer); + procedure SetBalance(Balance: integer); + function GetSeekCaps: TSeekingCaps; + procedure SetRate(Rate: double); + function GetDuration: integer; + procedure SetLinearVolume(aEnabled: Boolean); + procedure UpdateGraph; + + // IAMGraphBuilderCallback + function SelectedFilter(pMon: IMoniker): HResult; stdcall; + function CreatedFilter(pFil: IBaseFilter): HResult; stdcall; + + // IAMFilterGraphCallback + function UnableToRender(ph1, ph2: integer; pPin: IPin): HResult; // thiscall + protected + {@exclude} + procedure DoEvent(Event, Param1, Param2: Integer); virtual; + {@exclude} + procedure InsertFilter(AFilter: IFilter); + {@exclude} + procedure RemoveFilter(AFilter: IFilter); + {@exclude} + procedure InsertEventNotifier(AEvent: IEvent); + {@exclude} + procedure RemoveEventNotifier(AEvent: IEvent); + {@exclude} + function QueryService(const rsid, iid: TGuid; out Obj): HResult; stdcall; + public + { Retrieve the total duration of a stream. } + property Duration: Integer read GetDuration; + { Retrieve/Set the rate. } + property Rate: Double read fRate write SetRate; + { Retrieve the seeking capabilities. } + property SeekCapabilities: TSeekingCaps read GetSeekCaps; + { The volume balance. } + property Balance: integer read fBalance write SetBalance; + { The volume. } + property Volume: integer read fVolume write SetVolume; + { Current state of the filter graph. } + property State: TGraphState read GetState write SetState; + { TFilterGraph constructor. } + constructor Create(AOwner: TComponent); override; + { TFilterGraph destructor. } + destructor Destroy; override; + { @exclude} + procedure Loaded; override; + { Retrieve an Interface from the current Graph.
+ ex: (FilterGraph as IGraphBuilder).RenderFile('C:\speedis.avi', nil);
+ Remark: The interfaces you can Query depend of the @link(Mode) you + have defined.
+ gmNormal: IAMGraphStreams, IAMStats, IBasicAudio, IBasicVideo, + IBasicVideo2, IFilterChain, IFilterGraph, IFilterGraph2, + IFilterMapper2, IGraphBuilder, IGraphConfig, IGraphVersion, + IMediaControl, IMediaEvent, IMediaEventEx, IMediaEventSink, + IMediaFilter, IMediaPosition, IMediaSeeking, IQueueCommand, + IRegisterServiceProvider, IResourceManager, IServiceProvider, + IVideoFrameStep, IVideoWindow.
+ gmCapture: all gmNormal interfaces and ICaptureGraphBuilder2.
+ gmDVD: all gmNormal interfaces and IDvdGraphBuilder, IDvdControl2, + IDvdInfo2, IAMLine21Decoder.} + function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; + { The Run method runs all the filters in the filter graph. While the graph + is running, data moves through the graph and is rendered. } + function Play: boolean; + { The Pause method pauses all the filters in the filter graph. } + function Pause: boolean; + { The Stop method stops all the filters in the graph. } + function Stop: boolean; + { This method disconnect all pins.} + procedure DisconnectFilters; + { Disconnect and remove all filters from the filter graph excepting the custom components. } + procedure ClearGraph; + { Render a single file. } + function RenderFile(FileName: WideString): HRESULT; + function RenderFileEx(FileName: WideString): HRESULT; + { Render a DVD Video Volume or a File Name if specified. } + function RenderDVD(out status: TAMDVDRenderStatus; + FileName: WideString = ''; Mode: Integer = AM_DVD_HWDEC_PREFER): HRESULT; + { Save the current state and position of a DVD movie to a file.
+ See also: @link(DVDRestoreBookmark).} + procedure DVDSaveBookmark(BookMarkFile: WideString); + { Restore the State and position of a DVD movie saved by @link(DVDSaveBookmark).} + procedure DVDRestoreBookmark(BookMarkFile: WideString); + published + + { Specify a File Name to save the Filter Graph Log. } + property LogFile: String read FLogFileName write SetLogFile; + + { Activate the Filter Graph.} + property Active: boolean read FActive write SetActive default False; + + { Auto-Activate the Filter Graph when component is created.} + property AutoCreate: boolean read FAutoCreate write FAutoCreate default False; + + { There is 3 modes: gmNormal, gmCapture and gmDVD.
+ See also: @link(GraphInterFace).} + property Mode: TGraphMode read FMode write SetGraphMode default gmNormal; + + { if true you can use GraphEdit application to connect with the Filter Graph.} + property GraphEdit: boolean read FGraphEdit write SetGraphEdit; + + { if true, Volume and Balance is set by using a linear algorythm instead of + logatithmic. } + property LinearVolume: Boolean read FLinearVolume write SetLinearVolume; + + // ------------------------------------------------------------------------- + // Events + // ------------------------------------------------------------------------- + + property OnActivate: TNotifyEvent read FOnActivate write FOnActivate; + + { Generic Filter Graph event.
+ Event: message sent.
+ Param1: first message parameter.
+ Param2: second message parameter.} + property OnDSEvent: TOnDSEvent read FOnDSEvent write FOnDSEvent; + + { The graph is buffering data, or has stopped buffering data. + A filter can send this event if it needs to buffer data from an external + source. (for example, it might be loading data from a network.) + The application can use this event to adjust its user interface.
+ buffering: TRUE if the graph is starting to buffer, or FALSE if + the graph has stopped buffering. } + property OnGraphBufferingData: TOnGraphBufferingData read FOnGraphBufferingData write FOnGraphBufferingData; + + { The reference clock has changed. The filter graph manager sends this event + when its IMediaFilter.SetSyncSource method is called.} + property OnGraphClockChanged: TNotifyEvent read FOnGraphClockChanged write FOnGraphClockChanged; + + { All data from a particular stream has been rendered. + By default, the filter graph manager does not forward this event to the + application. However, after all the streams in the graph report EC_COMPLETE, + the filter graph manager posts a separate EC_COMPLETE event to the application.
+ Result: HRESULT value; can be S_OK.
+ Renderer: nil, or a reference to the renderer's IBaseFilter interface.} + property OnGraphComplete: TOnGraphComplete read FOnGraphComplete write FOnGraphComplete; + + { A Plug and Play device was removed or became available again. When the + device becomes available again, the previous state of the device filter is + no longer valid. The application must rebuild the graph in order to use the device.
+ Device: IUnknown interface of the filter that represents the device.
+ Removed: True if the device was removed, or False if the device is available again.} + property OnGraphDeviceLost: TOnGraphDeviceLost read FOnGraphDeviceLost write FOnGraphDeviceLost; + + { The end of a segment was reached. + This event code supports seamless looping. When a call to the IMediaSeeking.SetPositions + method includes the AM_SEEKING_Segment flag, the source filter sends this + event code instead of calling IPin.EndOfStream.
+ StreamTime: TREFERENCE_TIME value that specifies the accumulated stream time since the start of the segment.
+ NumSegment: Cardinal value indicating the segment number (zero-based).} + property OnGraphEndOfSegment: TOnGraphEndOfSegment read FOnGraphEndOfSegment write FOnGraphEndOfSegment; + + { An asynchronous command to run the graph has failed. + if the filter graph manager issues an asynchronous run command that fails, + it sends this event to the application. The graph remains in a running state. + The state of the underlying filters is indeterminate. Some filters might be + running, others might not.
+ Result: value of the operation that failed.} + property OnGraphErrorStillPlaying: TOnDSResult read FOnGraphErrorStillPlaying write FOnGraphErrorStillPlaying; + + { An operation was aborted because of an error.
+ Result: value of the operation that failed.} + property OnGraphErrorAbort: TOnDSResult read FOnGraphErrorAbort write FOnGraphErrorAbort; + + { The video renderer is switching out of full-screen mode. + When the Full Screen Renderer loses activation, it sends this event. When + another video renderer switches out of full-screen mode, the filter graph + manager sends this event, in response to an EC_ACTIVATE event from the renderer.
+ Renderer: the video renderer's IBaseFilter interface, or nil.} + property OnGraphFullscreenLost: TOnGraphFullscreenLost read FOnGraphFullscreenLost write FOnGraphFullscreenLost; + + { The filter graph has changed. + This event code is intended for debugging. It is not sent for all graph changes.} + property OnGraphChanged: TNotifyEvent read FOnGraphChanged write FOnGraphChanged; + + { A filter is passing a text string to the application. + By convention, the first parameter contains type information (for example, Text) + and the second parameter contains the text string.
+ String1, String2: Wide Strings} + property OnGraphOleEvent: TOnGraphOleEvent read FOnGraphOleEvent write FOnGraphOleEvent; + + { The graph is opening a file, or has finished opening a file. + A filter can send this event if it spends significant time opening a file. + (for example, the file might be located on a network.) The application can use + this event to adjust its user interface.
+ opening: TRUE if the graph is starting to open a file, or FALSE + if the graph is no longer opening the file.} + property OnGraphOpeningFile: TOnGraphOpeningFile read FOnGraphOpeningFile write FOnGraphOpeningFile; + + { The video palette has changed. + Video renderers send this event if they detect a palette change in the stream.} + property OnGraphPaletteChanged: TNotifyEvent read FOnGraphPaletteChanged write FOnGraphPaletteChanged; + + { A pause request has completed. + The filter graph manager sends this event when it completes an asynchronous pause command.
+ Result: value that indicates the result of the transition. if the + value is S_OK, the filter graph is now in a paused state.} + property OnGraphPaused: TOnDSResult read FOnGraphPaused write FOnGraphPaused; + + { The graph is dropping samples, for quality control. + A filter sends this event if it drops samples in response to a quality control + message. It sends the event only when it adjusts the quality level, not for each + sample that it drops. } + property OnGraphQualityChange: TNotifyEvent read FOnGraphQualityChange write FOnGraphQualityChange; + + { An audio device error occurred on an input pin.
+ OccurWhen: value from the TSNDDEV_ERR enumerated type, indicating how the device was being accessed when the failure occurred.
+ ErrorCode: value indicating the error returned from the sound device call.} + property OnGraphSNDDevInError: TOnGraphSNDDevError read FOnGraphSNDDevInError write FOnGraphSNDDevInError; + + { An audio device error occurred on an output pin.
+ OccurWhen: value from the TSNDDEV_ERR enumerated type, indicating how the device was being accessed when the failure occurred.
+ ErrorCode: value indicating the error returned from the sound device call.} + property OnGraphSNDDevOutError: TOnGraphSNDDevError read FOnGraphSNDDevOutError write FOnGraphSNDDevOutError; + + { A filter has completed frame stepping. + The filter graph manager pauses the graph and passes the event to the application.} + property OnGraphStepComplete: TNotifyEvent read FOnGraphStepComplete write FOnGraphStepComplete; + + { A stream-control start command has taken effect. + Filters send this event in response to the IAMStreamControl.StartAt method. + This method specifies a reference time for a pin to begin streaming. + When streaming does begin, the filter sends this event.
+ PinSender parameter specifies the pin that executes the start command. + Depending on the implementation, it might not be the pin that + received the StartAt call.
+ Cookie parameter is specified by the application in the StartAt method. + This parameter enables the application to track multiple calls to the method.} + property OnGraphStreamControlStarted: TOnGraphStreamControl read FOnGraphStreamControlStarted write FOnGraphStreamControlStarted; + + { A stream-control start command has taken effect. + Filters send this event in response to the IAMStreamControl.StopAt method. + This method specifies a reference time for a pin to stop streaming. + When streaming does halt, the filter sends this event.
+ PinSender parameter specifies the pin that executes the stop command. + Depending on the implementation, it might not be the pin + that received the StopAt call.
+ Cookie parameter is specified by the application in the StopAt method. + This parameter enables the application to track multiple calls to the method.} + property OnGraphStreamControlStopped: TOnGraphStreamControl read FOnGraphStreamControlStopped write FOnGraphStreamControlStopped; + + { An error occurred in a stream, but the stream is still playing.
+ Operation: HRESULT of the operation that failed.
+ Value: LongWord value, generally zero. } + property OnGraphStreamErrorStillPlaying : TOnGraphStreamError read FOnGraphStreamErrorStillPlaying write FOnGraphStreamErrorStillPlaying; + + { A stream has stopped because of an error.
+ Operation: HRESULT of the operation that failed.
+ Value: LongWord value, generally zero. } + property OnGraphStreamErrorStopped: TOnGraphStreamError read FOnGraphStreamErrorStopped write FOnGraphStreamErrorStopped; + + { The user has terminated playback.
+ This event code signals that the user has terminated normal graph playback. + for example, video renderers send this event if the user closes the video window.
+ After sending this event, the filter should reject all samples and not send + any EC_REPAINT events, until the filter stops and is reset.} + property OnGraphUserAbort: TNotifyEvent read FOnGraphUserAbort write FOnGraphUserAbort; + + { The native video size has changed.
+ width: new width, in pixels.
+ height: new height, in pixels. } + property OnGraphVideoSizeChanged: TOnGraphVideoSizeChanged read FOnGraphVideoSizeChanged write FOnGraphVideoSizeChanged; + + { Sent by filter supporting timecode.
+ From: sending object.
+ DeviceID: device ID of the sending object} + property OnGraphTimeCodeAvailable: TOnGraphTimeCodeAvailable read FOnGraphTimeCodeAvailable write FOnGraphTimeCodeAvailable; + + { Sent by filter supporting IAMExtDevice.
+ NewMode: the new mode
+ DeviceID: the device ID of the sending object} + property OnGraphEXTDeviceModeChange: TOnGraphEXTDeviceModeChange read FOnGraphEXTDeviceModeChange write FOnGraphEXTDeviceModeChange; + + { The clock provider was disconnected.
+ KSProxy signals this event when the pin of a clock-providing filter is disconnected.} + property OnGraphClockUnset: TNotifyEvent read FOnGraphClockUnset write FOnGraphClockUnset; + + { Identifies the type of rendering mechanism the VMR is using to display video.} + property OnGraphVMRRenderDevice: TOnGraphVMRRenderDevice read FOnGraphVMRRenderDevice write FOnGraphVMRRenderDevice; + + { Signals that the current audio stream number changed for the main title.
+ The current audio stream can change automatically with a navigation command + authored on the disc as well as through application control by using the IDvdControl2 interface.
+ stream: value indicating the new user audio stream number. Audio stream numbers + range from 0 to 7. Stream $FFFFFFFF indicates that no stream is selected.
+ lcid: Language identifier.
+ Lang: Language string. } + property OnDVDAudioStreamChange: TOnDVDAudioStreamChange read FOnDVDAudioStreamChange write FOnDVDAudioStreamChange; + + { Deprecated, use @link(OnDVDCurrentHMSFTime) instead.
+ Signals the beginning of every video object unit (VOBU), a video segment + which is 0.4 to 1.0 seconds in length.
} + property OnDVDCurrentTime: TOnDVDCurrentTime read FOnDVDCurrentTime write FOnDVDCurrentTime; + + { Indicates when the current title number changes.
+ Title numbers range from 1 to 99. This number 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.
+ Title: value indicating the new title number.} + property OnDVDTitleChange: TOnDVDTitleChange read FOnDVDTitleChange write FOnDVDTitleChange; + + { Signals that the DVD player started playback of a new program in the + DVD_DOMAIN_Title domain.
+ Only simple linear movies signal this event.
+ chapter: value indicating the new chapter (program) number.} + property OnDVDChapterStart: TOnDVDChapterStart read FOnDVDChapterStart write FOnDVDChapterStart; + + { Signals that either the number of available angles changed or that the + current angle number changed.
+ Angle numbers range from 1 to 9. The current angle number can change + automatically with a navigation command authored on the disc as well as + through application control by using the IDvdControl2 interface.
+ total: value indicating the number of available angles. When the + number of available angles is 1, the current video is not multiangle.
+ current: value indicating the current angle number.} + property OnDVDAngleChange: TOnDVDChange read FOnDVDAngleChange write FOnDVDAngleChange; + + { Signals that the available set of IDvdControl2 interface methods has changed.
+ UOPS: value representing a ULONG whose bits indicate which IDvdControl2 + commands the DVD disc explicitly disabled. } + property OnDVDValidUOPSChange: TOnDVDValidUOPSChange read FOnDVDValidUOPSChange write FOnDVDValidUOPSChange; + + { Signals that either the number of available buttons changed or that the + currently selected button number changed.
+ This event can signal any of the available button numbers. These numbers + do not always correspond to button numbers used for + IDvdControl2.SelectAndActivateButton because that method can activate only + a subset of buttons.
+ total: value indicating the number of available buttons.
+ current: value indicating the currently selected button number. + Selected button number zero implies that no button is selected.} + property OnDVDButtonChange: TOnDVDChange read FOnDVDButtonChange write FOnDVDButtonChange; + + { Indicates that playback stopped as the result of a call to the + IDvdControl2.PlayChaptersAutoStop method.} + property OnDVDChapterAutoStop: TNotifyEvent read FOnDVDChapterAutoStop write FOnDVDChapterAutoStop; + + { Signals the beginning of any still (PGC, Cell, or VOBU). + 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).
+ NoButtonAvailable: Boolean value indicating whether buttons are + available. False indicates buttons are available so the IDvdControl2.StillOff + method won't work. True indicates no buttons are available, so IDvdControl2.StillOff will work.
+ seconds: value indicating the number of seconds the still will last. + $FFFFFFFF indicates an infinite still, meaning wait until the user presses + a button or until the application calls IDvdControl2.StillOff.} + property OnDVDStillOn: TOnDVDStillOn read FOnDVDStillOn write FOnDVDStillOn; + + { Signals the end of any still (PGC, Cell, or VOBU).
+ This event indicates that any currently active still has been released.} + property OnDVDStillOff: TNotifyEvent read FOnDVDStillOff write FOnDVDStillOff; + + { Signals that the current subpicture stream number changed for the main title.
+ The subpicture can change automatically with a navigation command authored + on disc as well as through application control using IDvdControl2.
+ SubNum: value indicating the new user subpicture stream number. + Subpicture stream numbers range from 0 to 31. Stream $FFFFFFFF indicates + that no stream is selected.
+ lcid: Language identifier.
+ Lang: Language string.} + property OnDVDSubpictureStreamChange: TOnDVDSubpictureStreamChange read FOnDVDSubpictureStreamChange write FOnDVDSubpictureStreamChange; + + { Signals that the DVD disc does not have a FP_PGC (First Play Program Chain) + and that the DVD Navigator will not automatically load any PGC and start playback.} + property OnDVDNoFP_PGC: TNotifyEvent read FOnDVDNoFP_PGC write FOnDVDNoFP_PGC; + + { Signals that a rate change in the playback has been initiated. + rate: indicate the new playback rate. rate < 0 indicates reverse playback + mode. rate > 0 indicates forward playback mode.} + property OnDVDPlaybackRateChange: TOnDVDPlaybackRateChange read FOnDVDPlaybackRateChange write FOnDVDPlaybackRateChange; + + { Signals that the parental level of the authored content is about to change.
+ The DVD Navigator source filter does not currently support "on the fly" + parental level changes in response to SetTmpPML commands on a DVD disc.
+ level: value representing the new parental level set in the player.} + property OnDVDParentalLevelChange: TOnDVDParentalLevelChange read FOnDVDParentalLevelChange write FOnDVDParentalLevelChange; + + { Indicates that playback has been stopped. The DVD Navigator has completed + playback of the title or chapter and did not find any other branching + instruction for subsequent playback. } + property OnDVDPlaybackStopped: TNotifyEvent read FOnDVDPlaybackStopped write FOnDVDPlaybackStopped; + + { Indicates whether an angle block is being played and angle changes can be performed.
+ Angle changes are not restricted to angle blocks and the manifestation of + the angle change can be seen only in an angle block.
+ available: Boolean value that indicates if an angle block is being + played back. False indicates that playback is not in an angle block and + angles are not available, True indicates that an angle block is being played + back and angle changes can be performed.} + property OnDVDAnglesAvailable: TOnDVDAnglesAvailable read FOnDVDAnglesAvailable write FOnDVDAnglesAvailable; + + { Indicates that the Navigator has finished playing the segment specified + in a call to PlayPeriodInTitleAutoStop.} + property OnDVDPlayPeriodAutoStop: TNotifyEvent read FOnDVDPlayPeriodAutoStop write FOnDVDPlayPeriodAutoStop; + + { Signals that a menu button has been automatically activated per instructions + on the disc. This occurs when a menu times out and the disc has specified a + button to be automatically activated.
+ Button: value indicating the button that was activated.} + property OnDVDButtonAutoActivated: TOnDVDButtonAutoActivated read FOnDVDButtonAutoActivated write FOnDVDButtonAutoActivated; + + { Signals that a particular command has begun.
+ CmdID: The Command ID and the HRESULT return value.} + property OnDVDCMDStart: TOnDVDCMD read FOnDVDCMDStart Write FOnDVDCMDStart; + + { Signals that a particular command has completed.
+ CmdID The Command ID and the completion result.} + property OnDVDCMDEnd: TOnDVDCMD read FOnDVDCMDEnd Write FOnDVDCMDEnd; + + { Signals that a disc was ejected.
+ Playback automatically stops when a disc is ejected. The application does + not have to take any special action in response to this event.} + property OnDVDDiscEjected: TNotifyEvent read FOnDVDDiscEjected Write FOnDVDDiscEjected; + + { Signals that a disc was inserted into the drive.
+ Playback automatically begins when a disc is inserted. The application does + not have to take any special action in response to this event.} + property OnDVDDiscInserted: TNotifyEvent read FOnDVDDiscInserted write FOnDVDDiscInserted; + + { Signals the current time, in DVD_HMSF_TIMECODE format, relative to the start + of the title. This event is triggered at the beginning of every VOBU, which + occurs every 0.4 to 1.0 seconds.
+ The TDVD_HMSF_TIMECODE format is intended to replace the old BCD format that + is returned in OnDVDCurrentTime events. The HMSF timecodes are easier to + work with. To have the Navigator send EC_DVD_CURRENT_HMSF_TIME events instead + of EC_DVD_CURRENT_TIME events, an application must call + IDvdControl2.SetOption(DVD_HMSF_TimeCodeEvents, TRUE). When this flag is set, + the Navigator will also expect all time parameters in the IDvdControl2 and + IDvdInfo2 methods to be passed as TDVD_HMSF_TIMECODEs.
+ HMSFTimeCode: HMS Time code structure.
+ TimeCode: old time format, do not use. } + property OnDVDCurrentHMSFTime: TOnDVDCurrentHMSFTime read FOnDVDCurrentHMSFTime write FOnDVDCurrentHMSFTime; + + { Indicates that the Navigator has either begun playing or finished playing karaoke data.
+ The DVD player signals this event whenever it changes domains.
+ Played: TRUE means that a karaoke track is being played and FALSE means + that no karaoke data is being played. } + property OnDVDKaraokeMode: TOnDVDKaraokeMode read FOnDVDKaraokeMode write FOnDVDKaraokeMode; + + { Performing default initialization of a DVD disc.} + property OnDVDDomainFirstPlay: TNotifyEvent read FOnDVDDomainFirstPlay write FOnDVDDomainFirstPlay; + + { Displaying menus for whole disc. } + property OnDVDDomainVideoManagerMenu: TNotifyEvent read FOnDVDDomainVideoManagerMenu write FOnDVDDomainVideoManagerMenu; + + { Displaying menus for current title set. } + property OnDVDDomainVideoTitleSetMenu: TNotifyEvent read FOnDVDDomainVideoTitleSetMenu write FOnDVDDomainVideoTitleSetMenu; + + { Displaying the current title. } + property OnDVDDomainTitle: TNotifyEvent read FOnDVDDomainTitle write FOnDVDDomainTitle; + + { The DVD Navigator is in the DVD Stop domain.} + property OnDVDDomainStop: TNotifyEvent read FOnDVDDomainStop write FOnDVDDomainStop; + + { Something unexpected happened; perhaps content is authored incorrectly. + Playback is stopped.} + property OnDVDErrorUnexpected: TNotifyEvent read FOnDVDErrorUnexpected write FOnDVDErrorUnexpected; + + { Key exchange for DVD copy protection failed. Playback is stopped. } + property OnDVDErrorCopyProtectFail: TNotifyEvent read FOnDVDErrorCopyProtectFail write FOnDVDErrorCopyProtectFail; + + { DVD-Video disc is authored incorrectly for specification version 1.x. + Playback is stopped.} + property OnDVDErrorInvalidDVD1_0Disc: TNotifyEvent read FOnDVDErrorInvalidDVD1_0Disc write FOnDVDErrorInvalidDVD1_0Disc; + + { DVD-Video disc cannot be played because the disc is not authored to play in + the system region. } + property OnDVDErrorInvalidDiscRegion: TNotifyEvent read FOnDVDErrorInvalidDiscRegion write FOnDVDErrorInvalidDiscRegion; + + { Player parental level is lower than the lowest parental level available in + the DVD content. Playback is stopped. } + property OnDVDErrorLowParentalLevel: TNotifyEvent read FOnDVDErrorLowParentalLevel write FOnDVDErrorLowParentalLevel; + + { Macrovision® distribution failed. Playback stopped. } + property OnDVDErrorMacrovisionFail: TNotifyEvent read FOnDVDErrorMacrovisionFail write FOnDVDErrorMacrovisionFail; + + { No discs can be played because the system region does not match the decoder region. } + property OnDVDErrorIncompatibleSystemAndDecoderRegions: TNotifyEvent read FOnDVDErrorIncompatibleSystemAndDecoderRegions write FOnDVDErrorIncompatibleSystemAndDecoderRegions; + + { The disc cannot be played because the disc is not authored to be played in + the decoder's region. } + property OnDVDErrorIncompatibleDiscAndDecoderRegions: TNotifyEvent read FOnDVDErrorIncompatibleDiscAndDecoderRegions write FOnDVDErrorIncompatibleDiscAndDecoderRegions; + + { DVD-Video disc is authored incorrectly. Playback can continue, but unexpected + behavior might occur. } + property OnDVDWarningInvalidDVD1_0Disc: TNotifyEvent read FOnDVDWarningInvalidDVD1_0Disc write FOnDVDWarningInvalidDVD1_0Disc; + + { A decoder would not support the current format. Playback of a stream + (audio, video or subpicture) might not function. } + property OnDVDWarningFormatNotSupported : TNotifyEvent read FOnDVDWarningFormatNotSupported write FOnDVDWarningFormatNotSupported; + + { The internal DVD navigation command processor attempted to process an illegal command.} + property OnDVDWarningIllegalNavCommand : TNotifyEvent read FOnDVDWarningIllegalNavCommand write FOnDVDWarningIllegalNavCommand; + + { File Open failed. } + property OnDVDWarningOpen: TNotifyEvent read FOnDVDWarningOpen write FOnDVDWarningOpen; + + { File Seek failed. } + property OnDVDWarningSeek: TNotifyEvent read FOnDVDWarningSeek write FOnDVDWarningSeek; + + { File Read failed. } + property OnDVDWarningRead: TNotifyEvent read FOnDVDWarningRead write FOnDVDWarningRead; + + { Notifys when a Moniker has been found for a MediaType of a Pin in the Graph. + Return True to allow this Filter to be added, otherwise return False. + Note: The Guid might not be the real Filter Class ID, but a Group ID. + eg: Renderer Filters. } + property OnSelectedFilter: TOnSelectedFilter read FOnSelectedFilter write FOnSelectedFilter; + + { Notifys when a Filter has been created and is about to enter the Graph. + Return True to allow this Filter to be added, otherwise return False. } + property OnCreatedFilter: TOnCreatedFilter read FOnCreatedFilter write FOnCreatedFilter; + + { Notifys about a Pin that couldn't be Rendered. Return True to try it again, + otherwise return False. } + property OnUnableToRender: TOnUnableToRender read FOnUnableToRender write FOnUnableToRender; + end; + + +// ***************************************************************************** +// TVMROptions +// ***************************************************************************** + + {@exclude} + TVideoWindow = class; + + { See VRMOptions.
} + TVMRVideoMode = ( + vmrWindowed, + vmrWindowless, + vmrRenderless + ); + + { Video Mixer Renderer property editor. } + TVMROptions = class(TPersistent) + private + FOwner: TVideoWindow; + FStreams: cardinal; + FPreferences: TVMRPreferences; + FMode: TVMRVideoMode; + FKeepAspectRatio: boolean; + procedure SetStreams(Streams: cardinal); + procedure SetPreferences(Preferences: TVMRPreferences); + procedure SetMode(AMode: TVMRVideoMode); + procedure SetKeepAspectRatio(Keep: boolean); + public + { Constructor method. } + constructor Create(AOwner: TVideoWindow); + published + { Windowed or WindowLess} + property Mode: TVMRVideoMode read FMode write SetMode; + { Sets the number of streams to be mixed. } + property Streams: Cardinal read FStreams write SetStreams default 4; + { Sets various application preferences related to video rendering. } + property Preferences: TVMRPreferences read FPreferences write SetPreferences default [vpForceMixer]; + { Keep Aspect Ration on the video window. } + property KeepAspectRatio: boolean read FKeepAspectRatio write SetKeepAspectRatio default True; + end; + +// ***************************************************************************** +// TVideoWindow +// ***************************************************************************** + + TAbstractAllocator = class(TInterfacedObject) + constructor Create(out hr: HResult; wnd: THandle; d3d: IDirect3D9 = nil; d3dd: IDirect3DDevice9 = nil); virtual; abstract; + end; + TAbstractAllocatorClass = class of TAbstractAllocator; + + { Manage a Video Renderer or a Video Mixer Renderer (VMR) Filter to display + a video in your application. } + TVideoWindow = class(TCustomControl, IFilter, IEvent) + private + FMode : TVideoMode; + FVMROptions : TVMROptions; + FBaseFilter : IBaseFilter; + FVideoWindow : IVideoWindow; // VMR Windowed & Normal + FWindowLess : IVMRWindowlessControl9; // VMR Windowsless + + FFullScreen : boolean; + FFilterGraph : TFilterGraph; + FWindowStyle : LongWord; + FWindowStyleEx : LongWord; + FTopMost : boolean; + FIsFullScreen : boolean; + FOnPaint : TNotifyEvent; + FKeepAspectRatio: boolean; + FAllocatorClass: TAbstractAllocatorClass; + FCurrentAllocator: TAbstractAllocator; + FRenderLessUserID: Cardinal; + procedure SetVideoMode(AMode: TVideoMode); + procedure SetFilterGraph(AFilterGraph: TFilterGraph); + procedure SetFullScreen(Value: boolean); + procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0); + procedure GraphEvent(Event, Param1, Param2: integer); + function GetName: string; + function GetVideoHandle: THandle; + procedure ControlEvent(Event: TControlEvent; Param: integer = 0); + procedure SetTopMost(TopMost: boolean); + function GetVisible: boolean; + procedure SetVisible(Vis: boolean); + protected + FIsVideoWindowOwner: Boolean; + {@exclude} + procedure Loaded; override; + {@exclude} + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + {@exclude} + procedure Resize; override; + {@exclude} + procedure ConstrainedResize(var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer); override; + {@exclude} + function GetFilter: IBaseFilter; + {@exclude} + procedure WndProc(var Message: TMessage); override; + {@exclude} + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + {@exclude} + procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + {@exclude} + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + {@exclude} + procedure Paint; override; + public + {@exclude} + function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; + { Constructor. } + constructor Create(AOwner: TComponent);override; + { Destructor. } + destructor Destroy; override; + { Check if the Video Mixer Renderer is available (Windows XP). } + class function CheckVMR: boolean; + { Retrieve the current bitmap, only in WindowLess VMR Mode. } + function VMRGetBitmap(Stream: TStream): boolean; + function CheckInputPinsConnected: boolean; + procedure SetAllocator(Allocator: TAbstractAllocatorClass; UserID: Cardinal); + property IsVideoWindowOwner: Boolean read FIsVideoWindowOwner write FIsVideoWindowOwner; + published + { VMR/WindowsLess Mode only.} + property OnPaint: TNotifyEvent read FOnPaint write FOnPaint; + { The video Window stay on Top in FullScreen Mode. } + property FullScreenTopMost: boolean read FTopMost write SetTopMost default false; + { Video Mode, you can use Normal mode or VMR mode (VMR is only available on WindowsXP). } + property Mode: TVideoMode read FMode write SetVideoMode default vmNormal; + { The @link(TFilterGraph) component } + property FilterGraph: TFilterGraph read FFilterGraph write SetFilterGraph; + { Return the Handle where the video is displayed. } + property VideoHandle: THandle read GetVideoHandle; + { Video Mixer Renderer property editor. } + property VMROptions: TVMROptions read FVMROptions write FVMROptions; + { Set the full screen mode. } + property FullScreen: boolean read FFullScreen write SetFullScreen default false; + { Common properties & Events } + {@exclude} + property Color; {@exclude} + property Visible: boolean read GetVisible write SetVisible default True; {@exclude} + property ShowHint; {@exclude} + property Anchors; {@exclude} + property Canvas; {@exclude} + property PopupMenu; {@exclude} + property Align; {@exclude} + property TabStop default True; {@exclude} + property OnEnter; {@exclude} + property OnExit; {@exclude} + property OnKeyDown; {@exclude} + property OnKeyPress; {@exclude} + property OnKeyUp; {@exclude} + property OnCanResize; {@exclude} + property OnClick; {@exclude} + property OnConstrainedResize; {@exclude} + property OnDblClick; {@exclude} + property OnMouseDown; {@exclude} + property OnMouseMove; {@exclude} + property OnMouseUp; {@exclude} + property OnMouseWheel; {@exclude} + property OnMouseWheelDown; {@exclude} + property OnMouseWheelUp; {@exclude} + property OnResize; + end; + +//****************************************************************************** +// +// TFilterSampleGrabber declaration +// description: Sample Grabber Wrapper Filter +// +//****************************************************************************** + {@exclude} + TSampleGrabber = class; + + { This class is designed make a snapshoot of Video or Audio Datas. + WARNING: There is know problems with some DIVX movies, so use RGB32 Media Type + instead of RBG24.} + TSampleGrabber = class(TComponent, IFilter, ISampleGrabberCB) + private + FOnBuffer: TOnBuffer; + FBaseFilter: IBaseFilter; + FFilterGraph : TFilterGraph; + FMediaType: TMediaType; + // [pjh, 2003-07-14] delete BMPInfo field + // BMPInfo : PBitmapInfo; + FCriticalSection: TCriticalSection; + function GetFilter: IBaseFilter; + function GetName: string; + procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0); + procedure SetFilterGraph(AFilterGraph: TFilterGraph); + function SampleCB(SampleTime: Double; pSample: IMediaSample): HResult; stdcall; + function BufferCB(SampleTime: Double; pBuffer: PByte; BufferLen: longint): HResult; stdcall; + protected + {@exclude} + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + { ISampleGrabber Interface to control the SampleGrabber Filter. + The FilterGraph must be active.} + SampleGrabber: ISampleGrabber; + { The Input Pin. + The FilterGraph must be active.} + InPutPin : IPin; + { The Output Pin. + The FilterGraph must be active.} + OutPutPin : IPin; + { Constructor method. } + constructor Create(AOwner: TComponent); override; + { Destructor method. } + destructor Destroy; override; + { Configure the filter to cature the specified MediaType. + This method disconnect the Input pin if connected. + The FilterGraph must be active. } + procedure UpdateMediaType; + {@exclude} + function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; + { Configure the MediaType according to the Source MediaType to be compatible with the BMP format. + if Source = nil then this method use the default value to set the resolution: 1..32. + The MediaType is auto configured to RGB24.} + procedure SetBMPCompatible(Source: PAMMediaType; SetDefault: cardinal); + { This method read the buffer received in the OnBuffer event and paint the bitmap.} + function GetBitmap(Bitmap: TBitmap; Buffer: Pointer; BufferLen: Integer): boolean; overload; + { This method read the current buffer from the Sample Grabber Filter and paint the bitmap.} + function GetBitmap(Bitmap: TBitmap): boolean; overload; + { This method check if the Sample Grabber Filter is correctly registered on the system. } + class function CheckFilter: boolean; + published + { Receive the Buffer from the Sample Grabber Filter. } + property OnBuffer: TOnBuffer read FOnBuffer write FOnBuffer; + { The filter must connected to a TFilterGraph component.} + property FilterGraph: TFilterGraph read FFilterGraph write SetFilterGraph; + { The media type to capture. You can capture audio or video data. } + property MediaType: TMediaType read FMediaType write FMediaType; + end; + +// ***************************************************************************** +// TFilter +// ***************************************************************************** + + { This component is an easy way to add a specific filter to a filter graph. + You can retrieve an interface using the as operator whith D6 :)} + TFilter = class(TComponent, IFilter) + private + FFilterGraph : TFilterGraph; + FBaseFilter: TBaseFilter; + FFilter: IBaseFilter; + function GetFilter: IBaseFilter; + function GetName: string; + procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0); + procedure SetFilterGraph(AFilterGraph: TFilterGraph); + protected + {@exclude} + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + { Constructor method. } + constructor Create(AOwner: TComponent); override; + { Destructor method. } + destructor Destroy; override; + { Retrieve a filter interface. } + function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; + published + { This is the Filter Editor .} + property BaseFilter: TBaseFilter read FBaseFilter write FBaseFilter; + { The filter must be connected to a TFilterGraph component.} + property FilterGraph: TFilterGraph read FFilterGraph write SetFilterGraph; + end; + +// ***************************************************************************** +// TASFWriter +// ***************************************************************************** + + { This component is designed to create a ASF file or to stream over a network.} + TASFWriter = class(TComponent, IFilter) + private + FFilterGraph : TFilterGraph; + FFilter : IBaseFilter; + FPort : Cardinal; + FMaxUsers : Cardinal; + FProfile : TWMPofiles8; + FFileName : WideString; + FAutoIndex : boolean; + FMultiPass : boolean; + FDontCompress: boolean; + function GetProfile: TWMPofiles8; + procedure SetProfile(profile: TWMPofiles8); + function GetFileName: String; + procedure SetFileName(FileName: String); + function GetFilter: IBaseFilter; + function GetName: string; + procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0); + procedure SetFilterGraph(AFilterGraph: TFilterGraph); + protected + {@exclude} + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + { Sink configuration. } + WriterAdvanced2 : IWMWriterAdvanced2; + { NetWork streaming configuration. } + WriterNetworkSink : IWMWriterNetworkSink; + { The Audio Input Pin. } + AudioInput : IPin; + { The Video Input Pin. } + VideoInput : IPin; + { Audio Input configuration. } + AudioStreamConfig : IAMStreamConfig; + { VideoInput configuration} + VideoStreamConfig : IAMStreamConfig; + { Destructor method. } + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + {@exclude} + function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; + published + { The filter must be connected to a TFilterGraph component.} + property FilterGraph: TFilterGraph read FFilterGraph write SetFilterGraph; + { Windows media profile to use. } + property Profile: TWMPofiles8 read GetProfile write SetProfile; + { Destination file name to write the compressed file. } + property FileName: String read GetFileName write SetFileName; + { Port number to stream.} + property Port: DWORD read FPort write FPort; + { The max number of connections. } + property MaxUsers: DWORD read FMaxUsers write FMaxUsers; + property AutoIndex : boolean read FAutoIndex write FAutoIndex default True; + property MultiPass : boolean read FMultiPass write FMultiPass default False; + property DontCompress: boolean read FDontCompress write FDontCompress default False; + + end; + +// ***************************************************************************** +// TDSTrackBar +// ***************************************************************************** + {@exclude} + TTimerEvent = procedure(sender: TObject; CurrentPos, StopPos: Cardinal) of object ; + + { This control implement a seek bar for a media-player application. + The seek bar is implemented as a TTrackbar control. } + TDSTrackBar = class(TTrackBar, IEvent) + private + FFilterGraph: TFilterGraph; + FMediaSeeking: IMediaSeeking; + FWindowHandle: HWND; + FInterval: Cardinal; + FOnTimer: TTimerEvent; + FEnabled: Boolean; + FMouseDown: boolean; + procedure UpdateTimer; + procedure SetTimerEnabled(Value: Boolean); + procedure SetInterval(Value: Cardinal); + procedure SetOnTimer(Value: TTimerEvent); + procedure SetFilterGraph(AFilterGraph: TFilterGraph); + procedure GraphEvent(Event, Param1, Param2: integer); + procedure ControlEvent(Event: TControlEvent; Param: integer = 0); + procedure TimerWndProc(var Msg: TMessage); + property TimerEnabled: Boolean read FEnabled write SetTimerEnabled; + protected + {@exclude} + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + {@exclude} + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); override; + {@exclude} + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); override; + {@exclude} + procedure Timer; dynamic; + public + { constructor method. } + constructor Create(AOwner: TComponent); override; + { destructor method. } + destructor Destroy; override; + published + { Select the filtergraph to seek. } + property FilterGraph: TFilterGraph read FFilterGraph Write SetFilterGraph; + { Select the time interval in miliseconds. default = 1000 mls. } + property TimerInterval: Cardinal read FInterval write SetInterval default 1000; + { OnTimer event, you can retrieve the current and stop positions here. } + property OnTimer: TTimerEvent read FOnTimer write SetOnTimer; + end; + + { @exclude } + TDSVideoWindowEx2 = class; + +// ***************************************************************************** +// TColorControl +// ***************************************************************************** + + { Set and Get ColorControls from DSVideoWindowEx's OverlayMixer. + This is Hardware based so your graphic card has to support it. + Check DSVideoWindowEx's Capabilities if your card support a given + colorcontrol.} + TColorControl = class(TPersistent) + private + FBrightness : Integer; + FContrast : Integer; + FHue : Integer; + FSaturation : Integer; + FSharpness : Integer; + FGamma : Integer; + FUtilColor : Boolean; + FDefault : TDDColorControl; + protected + { Protected declarations } + { @exclude } + FOwner : TDSVideoWindowEx2; + { @exclude } + Procedure SetBrightness(Value : Integer); + { @exclude } + Procedure SetContrast(Value : Integer); + { @exclude } + procedure SetHue(Value : Integer); + { @exclude } + procedure SetSaturation(Value : Integer); + { @exclude } + procedure SetSharpness(Value : Integer); + { @exclude } + procedure SetGamma(Value : Integer); + { @exclude } + procedure SetUtilColor(Value : Boolean); + + { @exclude } + function GetBrightness : Integer; + { @exclude } + function GetContrast : Integer; + { @exclude } + function GetHue : Integer; + { @exclude } + function GetSaturation : Integer; + { @exclude } + function GetSharpness : Integer; + { @exclude } + function GetGamma : Integer; + { @exclude } + function GetUtilColor : Boolean; + { @exclude } + Procedure ReadDefault; + { @exclude } + procedure UpdateColorControls; + { @exclude } + procedure GetColorControls; + public + { Public declarations } + { @exclude } + constructor Create(AOwner: TDSVideoWindowEx2); virtual; + { Restore the colorcontrols to there (Default) values. + Default is the value the colorcontrol hat, just after we initilized the overlay Mixer. } + procedure RestoreDefault; + published + { The Brightness property defines the luminance intensity, in IRE units, multiplied by 100. + The possible range is from 0 to 10,000 with a default of 750.} + property Brightness : Integer read GetBrightness write SetBrightness; + + { The Contrast property defines the relative difference between higher and lower luminance values, in IRE units, multiplied by 100. + The possible range is from 0 to 20,000 with a default value of 10,000. } + property Contrast : Integer read GetContrast write SetContrast; + + { The Hue property defines the phase relationship, in degrees, of the chrominance components. + The possible range is from -180 to 180, with a default of 0.} + property Hue : Integer read GetHue write SetHue; + + { The Saturation property defines the color intensity, in IRE units, multiplied by 100. + The possible range is 0 to 20,000, with a default value of 10,000.} + property Saturation : Integer read GetSaturation write SetSaturation; + + { The Sharpness property defines the sharpness, in arbitrary units, of an image. + The possible range is 0 to 10, with a default value of 5.} + property Sharpness : Integer read GetSharpness write SetSharpness; + + { The Gamma property defines the amount, in gamma units, of gamma correction applied to the luminance values. + The possible range is from 1 to 500, with a default of 1.} + property Gamma : Integer read GetGamma write SetGamma; + + { The ColorEnable property defines whether color is utilized or not. + Color is used if this property is 1. Color is not used if this property is 0. The default value is 1.} + property ColorEnable : Boolean read GetUtilColor write SetUtilColor; + end; + +// ***************************************************************************** +// TDSVideoWindowEx2Caps +// ***************************************************************************** + + { Check capability of DSVideoWindowEx. } + TDSVideoWindowEx2Caps = class(TPersistent) + protected + { Protected declarations } + Owner : TDSVideoWindowEx2; + function GetCanOverlay : Boolean; + function GetCanControlBrigtness : Boolean; + function GetCanControlContrast : Boolean; + function GetCanControlHue : Boolean; + function GetCanControlSaturation : Boolean; + function GetCanControlSharpness : Boolean; + function GetCanControlGamma : Boolean; + function GetCanControlUtilizedColor : Boolean; + public + { Public declarations } + { @exclude } + constructor Create(AOwner: TDSVideoWindowEx2); virtual; + published + { if CanOverlayGraphics return true, you draw on DSVideoWindowEx's canvas and the + graphic will bee ontop of the Video.} + property CanOverlayGraphic : Boolean read GetCanOverlay; + + { Repport if you can control Brightness on the video overlay } + property CanControlBrigtness : Boolean read GetCanControlBrigtness; + { Repport if you can control Contrast on the video overlay } + property CanControlContrast : Boolean read GetCanControlContrast; + { Repport if you can control Hue on the video overlay } + property CanControlHue : Boolean read GetCanControlHue; + { Repport if you can control Saturation on the video overlay } + property CanControlSaturation : Boolean read GetCanControlSaturation; + { Repport if you can control Sharpness on the video overlay } + property CanControlSharpness : Boolean read GetCanControlSharpness; + { Repport if you can control Gamma on the video overlay } + property CanControlGamma : Boolean read GetCanControlGamma; + { Repport if you can control ColorEnabled on the video overlay } + property CanControlColorEnabled : Boolean read GetCanControlUtilizedColor; + end; + +// ***************************************************************************** +// TOverlayCallback +// ***************************************************************************** + + { @exclude } + TOverlayCallback = class(TInterfacedObject, IDDrawExclModeVideoCallBack) + AOwner : TObject; + constructor Create(Owner : TObject); virtual; + 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; + +// ***************************************************************************** +// TDSVideoWindowEx2 +// ***************************************************************************** + + { @exclude } + TRatioModes = (rmStretched, rmLetterBox, rmCrop); + + { @exclude } + TOverlayVisibleEvent = procedure (Sender: TObject; Visible : Boolean) of object; + + { @exclude } + TCursorVisibleEvent = procedure (Sender: TObject; Visible : Boolean) of object; + + { A alternative to the regular Video Renderer (TVideoWindow), that give a easy way to overlay graphics + onto your video in your application. } + TDSVideoWindowEx2 = class(TCustomControl, IFilter, IEvent) + private + FVideoWindow : IVideoWindow; + FFilterGraph : TFilterGraph; + FBaseFilter : IBaseFilter; + FOverlayMixer : IBaseFilter; + FVideoRenderer : IBaseFilter; + FDDXM : IDDrawExclModeVideo; + FFullScreen : Boolean; + FTopMost : Boolean; + FColorKey : TColor; + FWindowStyle : LongWord; + FWindowStyleEx : LongWord; + FVideoRect : TRect; + FOnPaint : TNotifyEvent; + FOnColorKey : TNotifyEvent; + FOnCursorVisible : TCursorVisibleEvent; + FOnOverlay : TOverlayVisibleEvent; + FColorControl : TColorControl; + FCaps : TDSVideoWindowEx2Caps; + FZoom : Integer; + FAspectMode : TRatioModes; + FNoScreenSaver : Boolean; + FIdleCursor : Integer; + FMonitor : TMonitor; + FFullscreenControl : TForm; + GraphWasUpdatet : Boolean; + FOldParent : TWinControl; + OverlayCallback : TOverlayCallback; + GraphBuildOK : Boolean; + FVideoWindowHandle : HWND; + LMousePos : TPoint; + LCursorMov : DWord; + RememberCursor : TCursor; + IsHidden : Bool; + FOverlayVisible : Boolean; + OldDesktopColor : Longint; + OldDesktopPic : String; + FDesktopPlay : Boolean; + procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0); + procedure GraphEvent(Event, Param1, Param2: integer); + function GetName: string; + procedure ControlEvent(Event: TControlEvent; Param: integer = 0); + procedure SetFilterGraph(AFilterGraph: TFilterGraph); + procedure SetTopMost(TopMost: boolean); + procedure SetZoom(Value : Integer); + function UpdateGraph : HResult; + function GetVideoInfo : HResult; + procedure SetAspectMode(Value : TRatioModes); + procedure FullScreenCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure SetVideoZOrder; + protected + FIsVideoWindowOwner: Boolean; + {@exclude} + function GetFilter: IBaseFilter; + {@exclude} + procedure Resize; override; + {@exclude} + procedure Loaded; override; + {@exclude} + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + {@exclude} + procedure WndProc(var Message: TMessage); override; + {@exclude} + procedure Paint; override; + {@exclude} + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + {@exclude} + procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + {@exclude} + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + {@exclude} + procedure MyIdleHandler(Sender: TObject; var Done: Boolean); + {@exclude} + procedure RefreshVideoWindow; + public + { constructor method. } + constructor Create(AOwner: TComponent); override; + { destructor method. } + destructor Destroy; override; + + {@exclude} + function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; + + { Clear the graphic ontop of DSVideoWindowEx. } + procedure ClearBack; + + { Use your Desktop as the Video renderer. + The video will display as a "wallpaper" on your Desktop } + procedure StartDesktopPlayback; overload; + + { Use your Desktop as the Video renderer. + The video will display as a "wallpaper" on your Desktop on the + specifyed monitor} + procedure StartDesktopPlayBack(OnMonitor : TMonitor); overload; + + { Return to normal window playback from Fullscreen or Desktop mode. } + procedure NormalPlayback; + + { Start playback in fullscreen } + procedure StartFullScreen; overload; + + { Start playback in fullscreen on specifyed Monitor} + procedure StartFullScreen(OnMonitor : TMonitor); overload; + + { repporting if you are currently playing in fullscreen. } + property FullScreen: boolean read FFullScreen; + + { repporting if you are currently playing on the Desktop. } + property DesktopPlayback : Boolean Read FDesktopPlay; + { @inherited } + property Canvas; + + { The Colorkey is the color that the Overlay Mixer Filter used by DSVideoWindowEx sees + as transparent, when you draw ontop of the movie always set the canvas’s brush + color to this color or set the style to bsclear. + Note: The colors returned through this method vary depending on the current display mode. + if the colors are 8-bit palettized, they will be bright system colors (such as magenta). + if the display is in a true-color mode, they will be shades of black. } + property ColorKey : TColor read FColorKey; + + { @link(TDSVideoWindowEx2Caps) } + property Capabilities : TDSVideoWindowEx2Caps read FCaps; + + { Check this property to see if the overlay is visible when you draw on DSVideoWindowEx's + canvas, if it is visible you should set your brush color to the same as the VideoColor and + if not set your brush to the same color as DSVideoWindowEx color. } + property OverlayVisible : Boolean read FOverlayVisible; + property IsVideoWindowOwner: Boolean read FIsVideoWindowOwner write FIsVideoWindowOwner; + published + { The AspectRatio property sets the aspect ratio correction mode for window resizing. + rmSTRETCHED : No aspect ratio correction. + rmLETTERBOX : Put the video in letterbox format. Paint background color in the + excess region so the video is not distorted. + rmCROP : Crop the video to the correct aspect ratio. } + property AspectRatio : TRatioModes read FAspectMode write SetAspectMode; + + { Set the amounts of milliseconds befor the cursor is hidden, if it is not moved. + Setting the value to 0 will disable this feature. } + property AutoHideCursor : Integer read FIdleCursor write FIdleCursor; + + { Specify a Zoom factor from 0 to 99 procent. } + property DigitalZoom : Integer read FZoom write SetZoom; + + { The @link(TFilterGraph) component } + property FilterGraph: TFilterGraph read FFilterGraph write SetFilterGraph; + + { Select if the VideoWindow it topmost or not. } + property FullScreenTopMost: boolean read FTopMost write SetTopMost default false; + + { Event to tell the main application that the Colorkey has changed. + Note: if you have controls placed ontop of your VideoWindow that need to act as + transparent, set there color to the same as the Colorkey.} + property OnColorKeyChanged: TNotifyEvent read FOnColorKey write FOnColorKey; + + { @link(TColorControl) } + property ColorControl : TColorControl read FColorControl write FColorControl; + + { Setting this to true will prevent the screen to go into screensaver or powerdown. } + property NoScreenSaver : Boolean read FNoScreenSaver write FNoScreenSaver; + + { This event accure when the Visible state of the overlay changes + Note: Most used to hide the video in the player window when going to + DesktopPlayback. } + property OnOverlayVisible : TOverlayVisibleEvent read FOnOverlay write FOnOverlay; + + property OnPaint : TNotifyevent read FOnPaint Write FOnPaint; + + { This event accure when the cursor change from showing to hiding or from hiding to showing. } + property OnCursorShowHide : TCursorVisibleEvent read FOnCursorVisible write FOnCursorVisible; + + property Color; {@exclude} + property Visible; {@exclude} + property ShowHint; {@exclude} + property Anchors; {@exclude} + property PopupMenu; {@exclude} + property Align; {@exclude} + property TabStop default True; {@exclude} + property OnEnter; {@exclude} + property OnExit; {@exclude} + property OnKeyDown; {@exclude} + property OnKeyPress; {@exclude} + property OnKeyUp; {@exclude} + property OnCanResize; {@exclude} + property OnClick; {@exclude} + property OnConstrainedResize; {@exclude} + property OnDblClick; {@exclude} + property OnMouseDown; {@exclude} + property OnMouseMove; {@exclude} + property OnMouseUp; {@exclude} + property OnMouseWheel; {@exclude} + property OnMouseWheelDown; {@exclude} + property OnMouseWheelUp; {@exclude} + property OnResize; + end; + +//////////////////////////////////////////////////////////////////////////////// +// +// TVMRBitmap Class +// +//////////////////////////////////////////////////////////////////////////////// +type + + { vmrbDisable: Disable the alpha bitmap. + vmrbSrcColorKey: Enable ColorKey. + vmrbSrcRect: Indicates that the Dest property is valid and specifies + a sub-rectangle of the original image to be blended. } + + TVMRBitmapOption = ( + vmrbDisable, + vmrbSrcColorKey, + vmrbSrcRect + ); + TVMRBitmapOptions = set of TVMRBitmapOption; + + TVMRBitmap = class + private + FVideoWindow: TVideoWindow; + FCanvas: TCanvas; + FVMRALPHABITMAP: TVMR9ALPHABITMAP; + FOptions: TVMRBitmapOptions; + FBMPOld: HBITMAP; + procedure SetOptions(Options: TVMRBitmapOptions); + procedure ResetBitmap; + procedure SetAlpha(const Value: Single); + procedure SetColorKey(const Value: COLORREF); + procedure SetDest(const Value: TVMR9NormalizedRect); + procedure SetDestBottom(const Value: Single); + procedure SetDestLeft(const Value: Single); + procedure SetDestRight(const Value: Single); + procedure SetDestTop(const Value: Single); + procedure SetSource(const Value: TRect); + function GetAlpha: Single; + function GetColorKey: COLORREF; + function GetDest: TVMR9NormalizedRect; + function GetDestBottom: Single; + function GetDestLeft: Single; + function GetDestRight: Single; + function GetDestTop: Single; + function GetSource: TRect; + public + // Contructor, set the video Window where the bitmat must be paint. + constructor Create(VideoWindow: TVideoWindow); + // Cleanup + destructor Destroy; override; + // Load a Bitmap from a TBitmap class. + procedure LoadBitmap(Bitmap: TBitmap); + // Initialize with an empty bitmap. + procedure LoadEmptyBitmap(Width, Height: Integer; PixelFormat: TPixelFormat; Color: TColor); + // Draw the bitmap to the Video Window. + procedure Draw; + // Draw the bitmap on a particular position. + procedure DrawTo(Left, Top, Right, Bottom, Alpha: Single; doUpdate: boolean = false); + // update the video window with the current bitmap + procedure Update; + // Uses this property to draw on the internal bitmap. + property Canvas: TCanvas read FCanvas write FCanvas; + // Change Alpha Blending + property Alpha: Single read GetAlpha write SetAlpha; + // set the source rectangle + property Source: TRect read GetSource write SetSource; + // Destination Left + property DestLeft : Single read GetDestLeft write SetDestLeft; + // Destination Top + property DestTop : Single read GetDestTop write SetDestTop; + // Destination Right + property DestRight : Single read GetDestRight write SetDestRight; + // Destination Bottom + property DestBottom : Single read GetDestBottom write SetDestBottom; + // Destination + property Dest: TVMR9NormalizedRect read GetDest write SetDest; + // Set the color key for transparency. + property ColorKey: COLORREF read GetColorKey write SetColorKey; + // VMR Bitmap Options. + property Options: TVMRBitmapOptions read FOptions write SetOptions; + end; + +implementation + +uses ComObj; + +const + CLSID_FilterGraphCallback: TGUID = '{C7CAA944-C191-4AB1-ABA7-D8B40EF4D5B2}'; + +// ***************************************************************************** +// TFilterGraph +// ***************************************************************************** + + + constructor TFilterGraph.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + FHandle := AllocateHWnd(WndProc); + FVolume := 10000; + FBalance := 0; + FRate := 1.0; + FLinearVolume := True; + end; + + destructor TFilterGraph.Destroy; + begin + SetActive(False); + DeallocateHWnd(FHandle); + inherited Destroy; + end; + + procedure TFilterGraph.SetGraphMode(Mode: TGraphMode); + var WasActive: boolean; + begin + if FMode = Mode then exit; + WasActive := Active; + Active := False; + FMode := Mode; + Active := WasActive; + end; + + procedure TFilterGraph.SetActive(Activate: boolean); + var + obj: IObjectWithSite; + fgcb: IAMFilterGraphCallback; + gbcb: IAMGraphBuilderCallback; + const + IID_IObjectWithSite: TGuid = '{FC4801A3-2BA9-11CF-A229-00AA003D7352}'; + begin + if Activate = FActive then exit; + case Activate of + true : + begin + case FMode of + gmNormal : CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC_SERVER, IID_IFilterGraph2, FFilterGraph); + gmCapture: begin + CoCreateInstance(CLSID_CaptureGraphBuilder2, nil, CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2, FCaptureGraph); + CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC_SERVER, IID_IFilterGraph2, FFilterGraph); + FCaptureGraph.SetFiltergraph(IGraphBuilder(FFilterGraph)); + end; + gmDVD : begin + CoCreateInstance(CLSID_DvdGraphBuilder, nil, CLSCTX_INPROC_SERVER, IID_IDvdGraphBuilder, FDvdGraph); + FDvdGraph.GetFiltergraph(IGraphBuilder(FFilterGraph)); + end; + end; + FActive := true; + // Events + if Succeeded(QueryInterface(IMediaEventEx, FMediaEventEx)) then + begin + FMediaEventEx.SetNotifyFlags(0); // enable events notification + FMediaEventEx.SetNotifyWindow(FHandle,WM_GRAPHNOTIFY,ULONG(FMediaEventEx)); + end; + + // Callbacks + if Succeeded(QueryInterface(IID_IObjectWithSite,obj)) then + begin + QueryInterface(IID_IAMGraphBuilderCallback,gbcb); + if Assigned(gbcb) then + begin + obj.SetSite(gbcb); + gbcb := nil; + end; + QueryInterface(IID_IAMFilterGraphCallback,fgcb); + if Assigned(fgcb) then + begin + obj.SetSite(fgcb); + fgcb := nil; + end; + obj := nil; + end; + + // Remote Object Table + GraphEdit := FGraphEdit; // Add the Filter Graph to the ROT if needed. + // Log File + SetLogFile(FLogFileName); + // Load Filters + AddOwnFilters; + // Notify Controlers + if assigned(FOnActivate) then FOnActivate(self); + ControlEvents(ceActive, 1); + end; + false: + begin + ControlEvents(ceActive, 0); + ClearOwnFilters; + if FMediaEventEx <> nil then + begin + FMediaEventEx.SetNotifyFlags(AM_MEDIAEVENT_NONOTIFY); // disable events notification + FMediaEventEx := nil; + end; + if FGraphEditID <> 0 then + begin + RemoveGraphFromRot(FGraphEditID); + FGraphEditID := 0; + end; + FFilterGraph.SetLogFile(0); + if Assigned(FLogFile) then FreeAndNil(FLogFile); + + FFilterGraph := nil; + FCaptureGraph := nil; + FDVDGraph := nil; + FActive := false; + end; + end; + end; + + procedure TFilterGraph.Loaded; + begin + if AutoCreate and (not (csDesigning in ComponentState)) then SetActive(True); + inherited Loaded; + end; + + procedure TFilterGraph.WndProc(var Msg: TMessage); + begin + with Msg do + if Msg = WM_GRAPHNOTIFY then + try + HandleEvents; + except + Application.HandleException(Self); + end + else + Result := DefWindowProc(FHandle, Msg, wParam, lParam); + end; + + procedure TFilterGraph.HandleEvents; + var hr: HRESULT; + Event, Param1, Param2: Integer; + begin + if assigned(FMediaEventEx) then + begin + hr := FMediaEventEx.GetEvent(Event, Param1, Param2, 0); + while (hr = S_OK) do + begin + DoEvent(Event, Param1, Param2); + FMediaEventEx.FreeEventParams(Event, Param1, Param2); + hr := FMediaEventEx.GetEvent(Event, Param1, Param2, 0); + end; + end; + end; + + procedure TFilterGraph.DoEvent(Event, Param1, Param2: Integer); + type + TVideoSize = record + Width : WORD; + Height: WORD; + end; + var + lcid : cardinal; + achLang : array[0..MAX_PATH] of Char; + tc : TDVDTimeCode; + frate : integer; + hmsftc : TDVDHMSFTimeCode; + DVDInfo2: IDVDInfo2; + begin + GraphEvents(Event, Param1, Param2); + if assigned(FOnDSEvent) then FOnDSEvent(self, Event, Param1, Param2); + case Event of + EC_BUFFERING_DATA : if assigned(FOnGraphBufferingData) then FOnGraphBufferingData(self,(Param1 = 1)); + EC_CLOCK_CHANGED : if assigned(FOnGraphClockChanged) then FOnGraphClockChanged(self); + EC_COMPLETE : if assigned(FOnGraphComplete) then FOnGraphComplete(self, Param1, IBaseFilter(Param2)); + EC_DEVICE_LOST : if assigned(FOnGraphDeviceLost) then FOnGraphDeviceLost(self,IUnKnown(Param1),(Param2 = 1)); + EC_END_OF_SEGMENT : if assigned(FOnGraphEndOfSegment) then FOnGraphEndOfSegment(self, PReferenceTime(Param1)^, Param2); + EC_ERROR_STILLPLAYING : if assigned(FOnGraphErrorStillPlaying) then FOnGraphErrorStillPlaying(self, Param1); + EC_ERRORABORT : if assigned(FOnGraphErrorAbort) then FOnGraphErrorAbort(self, Param1); + EC_FULLSCREEN_LOST : if assigned(FOnGraphFullscreenLost) then FOnGraphFullscreenLost(self, IBaseFilter(Param2)); + EC_GRAPH_CHANGED : if assigned(FOnGraphChanged) then FOnGraphChanged(self); + EC_OLE_EVENT : if assigned(FOnGraphOleEvent) then FOnGraphOleEvent(self, WideString(Param1), WideString(Param2)); + EC_OPENING_FILE : if assigned(FOnGraphOpeningFile) then FOnGraphOpeningFile(self, (Param1 = 1)); + EC_PALETTE_CHANGED : if assigned(FOnGraphPaletteChanged) then FOnGraphPaletteChanged(self); + EC_PAUSED : if assigned(FOnGraphPaused) then FOnGraphPaused(self, Param1); + EC_QUALITY_CHANGE : if assigned(FOnGraphQualityChange) then FOnGraphQualityChange(self); + EC_SNDDEV_IN_ERROR : if assigned(FOnGraphSNDDevInError) then FOnGraphSNDDevInError(self, TSndDevErr(Param1), Param2); + EC_SNDDEV_OUT_ERROR : if assigned(FOnGraphSNDDevOutError) then FOnGraphSNDDevOutError(self, TSndDevErr(Param1), Param2); + EC_STEP_COMPLETE : if assigned(FOnGraphStepComplete) then FOnGraphStepComplete(self); + EC_STREAM_CONTROL_STARTED : if assigned(FOnGraphStreamControlStarted) then FOnGraphStreamControlStarted(self, IPin(Param1), Param2); + EC_STREAM_CONTROL_STOPPED : if assigned(FOnGraphStreamControlStopped) then FOnGraphStreamControlStopped(self, IPin(Param1), Param2); + EC_STREAM_ERROR_STILLPLAYING : if assigned(FOnGraphStreamErrorStillPlaying) then FOnGraphStreamErrorStillPlaying(self, Param1, Param2); + EC_STREAM_ERROR_STOPPED : if assigned(FOnGraphStreamErrorStopped) then FOnGraphStreamErrorStopped(self, Param1, Param2); + EC_USERABORT : if assigned(FOnGraphUserAbort) then FOnGraphUserAbort(self); + EC_VIDEO_SIZE_CHANGED : if assigned(FOnGraphVideoSizeChanged) then FOnGraphVideoSizeChanged(self, TVideoSize(Param1).Width, TVideoSize(Param1).Height); + EC_TIMECODE_AVAILABLE : if assigned(FOnGraphTimeCodeAvailable) then FOnGraphTimeCodeAvailable(self,IBaseFilter(Param1), Param2); + EC_EXTDEVICE_MODE_CHANGE : if assigned(FOnGraphEXTDeviceModeChange) then FOnGraphEXTDeviceModeChange(self, Param1, Param2); + EC_CLOCK_UNSET : if assigned(FOnGraphClockUnset) then FOnGraphClockUnset(self); + EC_VMR_RENDERDEVICE_SET : if assigned(FOnGraphVMRRenderDevice) then FOnGraphVMRRenderDevice(self, TVMRRenderDevice(Param1)) ; + + EC_DVD_ANGLE_CHANGE : if Assigned(FOnDVDAngleChange) then FOnDVDAngleChange(self,Param1,Param2); + EC_DVD_AUDIO_STREAM_CHANGE : + begin + if Assigned(FOnDVDAudioStreamChange) then + if Succeeded(QueryInterFace(IDVDInfo2,DVDInfo2)) then + begin + CheckDSError(DvdInfo2.GetAudioLanguage(Param1, lcid)); + GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, achLang, MAX_PATH); + FOnDVDAudioStreamChange(self, Param1, lcid, string(achLang)); + DVDInfo2 := nil; + end; + end; + EC_DVD_BUTTON_CHANGE : if Assigned(FOnDVDButtonChange) then FOnDVDButtonChange(self, Param1, Param2); + EC_DVD_CHAPTER_AUTOSTOP : if Assigned(FOnDVDChapterAutoStop) then FOnDVDChapterAutoStop(self); + EC_DVD_CHAPTER_START : if Assigned(FOnDVDChapterStart) then FOnDVDChapterStart(self, Param1); + EC_DVD_CURRENT_TIME : + begin + if Assigned(FOnDVDCurrentTime) then + begin + tc := IntToTimeCode(Param1); + case tc.FrameRateCode of + 1 : frate := 25; + 3 : frate := 30; + else + frate := 0; + end; + FOnDVDCurrentTime(self,tc.Hours1+tc.Hours10*10,tc.Minutes1+tc.Minutes10*10,tc.Seconds1+tc.Seconds10*10,tc.Frames1+tc.Frames10*10,frate); + end; + end; + EC_DVD_DOMAIN_CHANGE : + begin + case Param1 of + 1 : if Assigned(FOnDVDDomainFirstPlay) then FOnDVDDomainFirstPlay(self); + 2 : if Assigned(FOnDVDDomainVideoManagerMenu) then FOnDVDDomainVideoManagerMenu(self); + 3 : if Assigned(FOnDVDDomainVideoTitleSetMenu) then FOnDVDDomainVideoTitleSetMenu(self); + 4 : if Assigned(FOnDVDDomainTitle) then FOnDVDDomainTitle(self); + 5 : if Assigned(FOnDVDDomainStop) then FOnDVDDomainStop(self); + end; + end; + EC_DVD_ERROR : + begin + case Param1 of + 1 : if Assigned(FOnDVDErrorUnexpected) then FOnDVDErrorUnexpected(self); + 2 : if Assigned(FOnDVDErrorCopyProtectFail) then FOnDVDErrorCopyProtectFail(self); + 3 : if Assigned(FOnDVDErrorInvalidDVD1_0Disc) then FOnDVDErrorInvalidDVD1_0Disc(self); + 4 : if Assigned(FOnDVDErrorInvalidDiscRegion) then FOnDVDErrorInvalidDiscRegion(self); + 5 : if Assigned(FOnDVDErrorLowParentalLevel) then FOnDVDErrorLowParentalLevel(self); + 6 : if Assigned(FOnDVDErrorMacrovisionFail) then FOnDVDErrorMacrovisionFail(self); + 7 : if Assigned(FOnDVDErrorIncompatibleSystemAndDecoderRegions) then FOnDVDErrorIncompatibleSystemAndDecoderRegions(self); + 8 : if Assigned(FOnDVDErrorIncompatibleDiscAndDecoderRegions) then FOnDVDErrorIncompatibleDiscAndDecoderRegions(self); + end; + end; + EC_DVD_NO_FP_PGC : if Assigned(FOnDVDNoFP_PGC) then FOnDVDNoFP_PGC(self); + EC_DVD_STILL_OFF : if Assigned(FOnDVDStillOff) then FOnDVDStillOff(self); + EC_DVD_STILL_ON : if Assigned(FOnDVDStillOn) then FOnDVDStillOn(self,(Param1 = 1), Param2); + EC_DVD_SUBPICTURE_STREAM_CHANGE: + begin + if Assigned(FOnDVDSubpictureStreamChange) and Succeeded(QueryInterFace(IDVDInfo2,DVDInfo2)) then + begin + DvdInfo2.GetSubpictureLanguage(Param1,lcid); + GetLocaleInfo(lcid,LOCALE_SENGLANGUAGE,achLang,MAX_PATH); + FOnDVDSubpictureStreamChange(self,Param1,lcid,string(achLang)); + DVDInfo2 := nil; + end; + end; + EC_DVD_TITLE_CHANGE : if Assigned(FOnDVDTitleChange) then FOnDVDTitleChange(self,Param1); + EC_DVD_VALID_UOPS_CHANGE : if Assigned(FOnDVDValidUOPSChange) then FOnDVDValidUOPSChange(self, Param1); + EC_DVD_WARNING : + begin + case Param1 of + 1 : if Assigned(FOnDVDWarningInvalidDVD1_0Disc) then FOnDVDWarningInvalidDVD1_0Disc(self); + 2 : if Assigned(FOnDVDWarningFormatNotSupported) then FOnDVDWarningFormatNotSupported(self); + 3 : if Assigned(FOnDVDWarningIllegalNavCommand) then FOnDVDWarningIllegalNavCommand(self); + 4 : if Assigned(FOnDVDWarningOpen) then FOnDVDWarningOpen(self); + 5 : if Assigned(FOnDVDWarningSeek) then FOnDVDWarningSeek(self); + 6 : if Assigned(FOnDVDWarningRead) then FOnDVDWarningRead(self); + end; + end; + EC_DVD_PLAYBACK_RATE_CHANGE : if Assigned(FOnDVDPlaybackRateChange) then FOnDVDPlaybackRateChange(self, Param1/10000); + EC_DVD_PARENTAL_LEVEL_CHANGE : if Assigned(FOnDVDParentalLevelChange) then FOnDVDParentalLevelChange(self,Param1); + EC_DVD_PLAYBACK_STOPPED : if Assigned(FOnDVDPlaybackStopped) then FOnDVDPlaybackStopped(self); + EC_DVD_ANGLES_AVAILABLE : if Assigned(FOnDVDAnglesAvailable) then FOnDVDAnglesAvailable(self,(Param1 = 1)); + EC_DVD_PLAYPERIOD_AUTOSTOP : if Assigned(FOnDVDPlayPeriodAutoStop) then FOnDVDPlayPeriodAutoStop(self); + EC_DVD_BUTTON_AUTO_ACTIVATED : if Assigned(FOnDVDButtonAutoActivated) then FOnDVDButtonAutoActivated(self,Param1); + EC_DVD_CMD_START : if Assigned(FOnDVDCMDStart) then FOnDVDCMDStart(self,Param1); + EC_DVD_CMD_END : if Assigned(FOnDVDCMDEnd) then FOnDVDCMDEnd(self,Param1); + EC_DVD_DISC_EJECTED : if Assigned(FOnDVDDiscEjected) then FOnDVDDiscEjected(self); + EC_DVD_DISC_INSERTED : if Assigned(FOnDVDDiscInserted) then FOnDVDDiscInserted(self); + EC_DVD_CURRENT_HMSF_TIME : + begin + if assigned(FOnDVDCurrentHMSFTime) then + begin + hmsftc := TDVDHMSFTimeCode(param1); + tc := IntToTimeCode(Param2); + FOnDVDCurrentHMSFTime(self,hmsftc,tc); + end; + end; + EC_DVD_KARAOKE_MODE : if assigned(FOnDVDKaraokeMode) then FOnDVDKaraokeMode(self,BOOL(Param1)); + end; + end; + + function TFilterGraph.QueryInterface(const IID: TGUID; out Obj): HResult; + begin + result := inherited QueryInterface(IID, Obj); + if (not Succeeded(result)) and Active then + case FMode of + gmNormal : result := FFilterGraph.QueryInterface(IID, Obj); + gmCapture : begin + result := FCaptureGraph.QueryInterface(IID, Obj); + if not Succeeded(result) then result := FFilterGraph.QueryInterface(IID, Obj); + end; + gmDVD : begin + result := FDvdGraph.QueryInterface(IID, Obj); + if not Succeeded(result) then result := FDvdGraph.GetDvdInterface(IID, Obj); + if not Succeeded(result) then result := FFilterGraph.QueryInterface(IID, Obj); + end; + end; + end; + + procedure TFilterGraph.SetGraphEdit(enable: boolean); + begin + case enable of + true : + begin + if FGraphEditID = 0 then + if Active then + AddGraphToRot(IFilterGraph2(FFilterGraph) , FGraphEditID); + end; + false : + begin + if FGraphEditID <> 0 then + begin + RemoveGraphFromRot(FGraphEditID); + FGraphEditID := 0; + end; + end; + end; + FGraphEdit := enable; + end; + + procedure TFilterGraph.InsertFilter(AFilter: IFilter); + var FilterName: WideString; + begin + if FFilters = nil then FFilters := TInterfaceList.Create; + FFilters.Add(AFilter); + if active then + begin + AFilter.NotifyFilter(foAdding); + FilterName := AFilter.GetName; + FFilterGraph.AddFilter(AFilter.GetFilter, PWideChar(FilterName)); + AFilter.NotifyFilter(foAdded); + end; + end; + + procedure TFilterGraph.RemoveFilter(AFilter: IFilter); + begin + FFilters.Remove(AFilter); + if active then + begin + AFilter.NotifyFilter(foRemoving); + FFilterGraph.RemoveFilter(AFilter.GetFilter); + AFilter.NotifyFilter(foRemoved); + end; + if FFilters.Count = 0 then + FreeAndNil(FFilters); + end; + + procedure TFilterGraph.InsertEventNotifier(AEvent: IEvent); + begin + if FGraphEvents = nil then FGraphEvents := TInterFaceList.Create; + FGraphEvents.Add(AEvent); + end; + + procedure TFilterGraph.RemoveEventNotifier(AEvent: IEvent); + begin + if FGraphEvents <> nil then + begin + FGraphEvents.Remove(AEvent); + if FGraphEvents.Count = 0 then FreeAndNil(FGraphEvents); + end; + end; + + procedure TFilterGraph.ClearOwnFilters; + var i: integer; + begin + if Active and (FFilters <> nil) then + for i := 0 to FFilters.Count - 1 do + begin + IFilter(FFilters.Items[i]).NotifyFilter(foRemoving); + FFilterGraph.RemoveFilter(IFilter(FFilters.Items[i]).GetFilter); + IFilter(FFilters.Items[i]).NotifyFilter(foRemoved); + end; + end; + + procedure TFilterGraph.AddOwnFilters; + var + i: integer; + FilterName: WideString; + begin + if Active and (FFilters <> nil) then + for i := 0 to FFilters.Count - 1 do + begin + IFilter(FFilters.Items[i]).NotifyFilter(foAdding); + FilterName := IFilter(FFilters.Items[i]).GetName; + FFilterGraph.AddFilter(IFilter(FFilters.Items[i]).GetFilter, PWideChar(FilterName)); + IFilter(FFilters.Items[i]).NotifyFilter(foAdded); + end; + end; + +{ + procedure TFilterGraph.NotifyFilters(operation: TFilterOperation; Param: integer); + var i: integer; + begin + if FFilters <> nil then + for i := 0 to FFilters.Count - 1 do + IFilter(FFilters.Items[i]).NotifyFilter(operation, Param); + + end; +} + + procedure TFilterGraph.GraphEvents(Event, Param1, Param2: integer); + var i: integer; + begin + if FGraphEvents <> nil then + for i := 0 to FGraphEvents.Count - 1 do + IEvent(FGraphEvents.Items[i]).GraphEvent(Event, Param1, Param2); + end; + + procedure TFilterGraph.ControlEvents(Event: TControlEvent; Param: integer = 0); + var i: integer; + begin + if FGraphEvents <> nil then + for i := 0 to FGraphEvents.Count - 1 do + IEvent(FGraphEvents.Items[i]).ControlEvent(Event, param); + end; + + function TFilterGraph.Play: boolean; + var MediaControl: IMediaControl; + begin + result := false; + if Succeeded(QueryInterface(IMediaControl, MediaControl)) then + begin + ControlEvents(cePlay); + result := Succeeded((CheckDSError(MediaControl.Run))); + MediaControl := nil; + end; + end; + + function TFilterGraph.Pause: boolean; + var MediaControl: IMediaControl; + begin + result := false; + if Succeeded(QueryInterface(IMediaControl, MediaControl)) then + begin + ControlEvents(cePause); + result := (CheckDSError(MediaControl.Pause) = S_OK); + MediaControl := nil; + end; + end; + + function TFilterGraph.Stop: boolean; + var MediaControl: IMediaControl; + begin + result := false; + if Succeeded(QueryInterface(IMediaControl, MediaControl)) then + begin + ControlEvents(ceStop); + result := (CheckDSError(MediaControl.Stop) = S_OK); + MediaControl := nil; + end; + end; + + procedure TFilterGraph.SetLogFile(FileName: String); + begin + if Active then + begin + FFilterGraph.SetLogFile(0); + if Assigned(FLogFile) then FreeAndNil(FLogFile); + if FileName <> '' then + try + + FLogFile := TFileStream.Create(FileName, fmCreate{$IFDEF VER140}, fmShareDenyNone{$ENDIF}); + + FFilterGraph.SetLogFile(FLogFile.Handle); + except + FFilterGraph.SetLogFile(0); + if Assigned(FLogFile) then FreeAndNil(FLogFile); + exit; + end; + end; + FLogFileName := FileName; + end; + + procedure TFilterGraph.DisconnectFilters; + var + FilterList: TFilterList; + PinList: TPinList; + BaseFilter: IBaseFilter; + i, j: integer; + begin + if assigned(FFilterGraph) then + begin + FilterList:= TFilterList.Create(FFilterGraph); + if FilterList.Count > 0 then + for i := 0 to FilterList.Count - 1 do + begin + BaseFilter := FilterList.Items[i] as IBaseFilter; + PinList := TPinList.Create(BaseFilter); + if PinList.Count > 0 then + for j := 0 to PinList.Count - 1 do + CheckDSError(IPin(PinList.Items[j]).Disconnect); + PinList.Free; + BaseFilter := nil; + end; + FilterList.Free; + end; + end; + + procedure TFilterGraph.ClearGraph; + var + i: integer; + FilterList: TFilterList; + begin + if Assigned(FFilterGraph) then + begin + Stop; + DisconnectFilters; + FilterList:= TFilterList.Create(FFilterGraph); + if assigned(FFilters) then + if FFilters.Count > 0 then + for i := 0 to FFilters.count - 1 do + FilterList.Remove(IFilter(FFilters.Items[i]).GetFilter); + if FilterList.count > 0 then + for i := 0 to FilterList.Count - 1 do + CheckDSError(FFilterGraph.RemoveFilter(FilterList.Items[i])); + FilterList.Free; + end; + end; + + function TFilterGraph.GetState: TGraphState; + var + AState: TFilterState; + MediaControl: IMediaControl; + begin + result := gsUninitialized; + if Succeeded(QueryInterface(IMediaControl, MediaControl)) then + begin + MediaControl.GetState(0,AState); + case AState of + State_Stopped : result := gsStopped; + State_Paused : result := gsPaused; + State_Running : result := gsPlaying; + end; + MediaControl := nil; + end; + end; + + procedure TFilterGraph.SetState(Value: TGraphState); + var + MediaControl: IMediaControl; + hr: HResult; + begin + if Succeeded(QueryInterface(IMediaControl, MediaControl)) then + begin + case Value of + gsStopped: hr := MediaControl.Stop; + gsPaused : hr := MediaControl.Pause; + gsPlaying: hr := MediaControl.Run; + else + hr := S_OK; + end; + MediaControl := nil; + CheckDSError(hr); + end; + end; + + procedure TFilterGraph.SetVolume(Volume: Integer); + var + BasicAudio: IBasicAudio; + begin + FVolume := EnsureRange(Volume,0,10000); + if Succeeded(QueryInterface(IBasicAudio, BasicAudio)) then + begin + if FLinearVolume + then BasicAudio.put_Volume(SetBasicAudioVolume(FVolume)) + else BasicAudio.put_Volume(FVolume-10000); + BasicAudio := nil; + end; + end; + + procedure TFilterGraph.SetBalance(Balance: integer); + var BasicAudio: IBasicAudio; + begin + FBalance := EnsureRange(Balance,-10000,10000); + if Succeeded(QueryInterface(IBasicAudio, BasicAudio)) then + begin + if FLinearVolume + then BasicAudio.put_Balance(SetBasicAudioPan(FBalance)) + else BasicAudio.put_Balance(FBalance); + BasicAudio := nil; + end; + end; + + function TFilterGraph.GetSeekCaps: TSeekingCaps; + var + MediaSeeking: IMediaSeeking; + Flags: Cardinal; + begin + result := []; + if Succeeded(QueryInterface(IMediaSeeking, MediaSeeking)) then + begin + MediaSeeking.GetCapabilities(Flags); + PByte(@Result)^ := Flags; + MediaSeeking := nil; + end; + end; + + function TFilterGraph.RenderFile(FileName: WideString): HRESULT; + begin + result := S_FALSE; + if assigned(FFilterGraph) then + begin + ControlEvents(ceFileRendering); + result := CheckDSError(FFilterGraph.RenderFile(PWideChar(FileName), nil)); + if Succeeded(result) then + begin + UpdateGraph; + ControlEvents(ceFileRendered); + end; + end; + end; + + { TODO -oHG : Add the audio rendering } + function TFilterGraph.RenderFileEx(FileName: WideString): HRESULT; + var + SourceFilter: IBaseFilter; + PinList: TPinList; + i: Integer; + begin + result := S_FALSE; + if assigned(FFilterGraph) then + begin + ControlEvents(ceFileRendering); + CheckDSError(FFilterGraph.AddSourceFilter(PWideChar(FileName), PWideChar(FileName), SourceFilter)); + PinList := TPinList.Create(SourceFilter); + try + for i := 0 to PinList.Count - 1 do + begin + CheckDSError(IFilterGraph2(FFilterGraph).RenderEx(PinList.Items[i], + AM_RENDEREX_RENDERTOEXISTINGRENDERERS, nil)); + end; + finally + PinList.Free; + end; + if Succeeded(result) then + begin + ControlEvents(ceFileRendered); + UpdateGraph; + end; + end; + end; + + function TFilterGraph.RenderDVD(out status: TAMDVDRenderStatus; + FileName: WideString = ''; Mode: Integer = AM_DVD_HWDEC_PREFER): HRESULT; + begin + result := HRESULT(VFW_E_DVD_RENDERFAIL); + if assigned(FDVDGraph) then + begin + ControlEvents(ceDVDRendering, Mode); + if FileName <> '' then + result := CheckDSError(FDVDGraph.RenderDvdVideoVolume(PWideChar(FileName), Mode, Status)) + else + result := CheckDSError(FDVDGraph.RenderDvdVideoVolume(nil, Mode, Status)); + if result in [S_OK..S_FALSE] then + begin + ControlEvents(ceDVDRendered, Mode); + UpdateGraph; + end; + end; + end; + + procedure TFilterGraph.SetRate(Rate: double); + var MediaSeeking: IMediaSeeking; + begin + FRate := Rate; + if Succeeded(QueryInterface(IMediaSeeking, MediaSeeking)) then + begin + MediaSeeking.SetRate(FRate); + MediaSeeking := nil; + end; + end; + + function TFilterGraph.GetDuration: integer; + var + MediaSeeking: IMediaSeeking; + RefTime: int64; + begin + if Succeeded(QueryInterface(IMediaSeeking, MediaSeeking)) then + begin + MediaSeeking.GetDuration(RefTime); + result := RefTimeToMiliSec(RefTime); + MediaSeeking := nil; + end + else + result := 0; + end; + + procedure TFilterGraph.DVDSaveBookmark(BookMarkFile: WideString); + var + DVDInfo2: IDVDInfo2; + Bookmark: IDvdState; + pStorage: IStorage; + pStream : IStream; + PersistStream : IPersistStream; + begin + if Active and (Mode = gmDVD) then + if Succeeded(QueryInterface(IDVDInfo2, DVDInfo2)) then + begin + DVDInfo2.GetState(Bookmark); + StgCreateDocfile(PWideChar(BookMarkFile), STGM_CREATE or STGM_WRITE or STGM_SHARE_EXCLUSIVE, 0, pStorage); + pStorage.CreateStream('BookMark', STGM_CREATE or STGM_WRITE or STGM_SHARE_EXCLUSIVE, 0, 0, pStream); + if Succeeded(Bookmark.QueryInterface(IID_IPersistStream,PersistStream)) then + begin + OleSaveToStream(PersistStream,pStream); + PersistStream := nil; + end + else + begin + PersistStream := nil; + DVDInfo2 := nil; + exit; + end; + DVDInfo2 := nil; + end; + end; + + procedure TFilterGraph.DVDRestoreBookmark(BookMarkFile: WideString); + var + DVDControl2: IDvdControl2; + pStorage : IStorage; + pStream : IStream; + pBookmark: IDvdState; + hr : HRESULT; + obj : IDVDCmd; + begin + if Succeeded(QueryInterface(IDvdControl2, DvdControl2)) then + begin + StgOpenStorage(PWideChar(BookMarkFile), nil, STGM_READ or STGM_SHARE_EXCLUSIVE, nil , 0, pStorage); + pStorage.OpenStream('BookMark', nil, STGM_READ or STGM_SHARE_EXCLUSIVE, 0, pStream); + OleLoadFromStream(pStream, IID_IDvdState, pBookmark); + hr := CheckDSError(DVDControl2.SetState(pBookmark, DVD_CMD_FLAG_None, obj)); + if not (failed(hr)) then + begin + obj.WaitForEnd; + obj := nil; + end; + DvdControl2 := nil; + end; + end; + + procedure TFilterGraph.SetLinearVolume(aEnabled: Boolean); + begin + if FLinearVolume = aEnabled then Exit; + FLinearVolume := aEnabled; + SetVolume(FVolume); + SetBalance(FBalance); + end; + + procedure TFilterGraph.UpdateGraph; + begin + SetVolume(FVolume); + SetBalance(FBalance); + SetRate(FRate); + end; + + function TFilterGraph.SelectedFilter(pMon: IMoniker): HResult; stdcall; + var + PropBag: IPropertyBag; + Name: OleVariant; + vGuid: OleVariant; + Guid: TGUID; + begin + if Assigned(FOnSelectedFilter) then + begin + pMon.BindToStorage(nil, nil, IID_IPropertyBag, PropBag); + if PropBag.Read('CLSID',vGuid,nil) = S_OK then Guid := StringToGUID(vGuid) + else Guid := GUID_NULL; + if PropBag.Read('FriendlyName', Name, nil) <> S_OK then Name := ''; + + PropBag := nil; + + if FOnSelectedFilter(pMon,Name,Guid) + then Result := S_OK + else Result := E_FAIL; + end else + Result := S_OK; + end; + + function TFilterGraph.CreatedFilter(pFil: IBaseFilter): HResult; stdcall; + var + guid: TGuid; + begin + if Assigned(FOnCreatedFilter) then + begin + pfil.GetClassID(guid); + if FOnCreatedFilter(pFil,guid) + then Result := S_OK + else Result := E_FAIL; + end else + Result := S_OK; + end; + + function TFilterGraph.UnableToRender(ph1, ph2: integer; pPin: IPin): HResult; + var + graph: TFilterGraph; + PinInfo: TPinInfo; + FilterInfo: TFilterInfo; + serviceProvider: IServiceProvider; + begin + Result := S_FALSE; + + if (pPin.QueryPinInfo(PinInfo) = S_OK) and + (Assigned(PinInfo.pFilter)) and + (PinInfo.pFilter.QueryFilterInfo(FilterInfo) = S_OK) and + (Assigned(FilterInfo.pGraph)) and + (FilterInfo.pGraph.QueryInterface(IServiceProvider, serviceProvider) = S_OK) and + (serviceProvider.QueryService(CLSID_FilterGraphCallback, CLSID_FilterGraphCallback, graph) = S_OK) and + (Assigned(graph) and Assigned(graph.FOnUnableToRender)) and + (graph.FOnUnableToRender(pPin)) + then Result := S_OK; + + PinInfo.pFilter := nil; + FilterInfo.pGraph := nil; + serviceProvider := nil; + end; + + function TFilterGraph.QueryService(const rsid, iid: TGuid; out Obj): HResult; + begin + if IsEqualGUID(CLSID_FilterGraphCallback, rsid) and + IsEqualGUID(CLSID_FilterGraphCallback, iid) then + begin + Pointer(Obj) := Pointer(Self); + Result := S_OK; + end else + Result := E_NOINTERFACE; + end; + +//****************************************************************************** +// TVMROptions +//****************************************************************************** + + constructor TVMROptions.Create(AOwner: TVideoWindow); + begin + FPreferences := [vpForceMixer]; + FStreams := 4; + FOwner := AOwner; + FMode := vmrWindowed; + FKeepAspectRatio := True; + end; + + procedure TVMROptions.SetStreams(Streams: cardinal); + begin + if Streams in [1..16] then FStreams := Streams else FStreams := 1; + with FOwner do + begin + if (mode <> vmVMR) or (FilterGraph = nil) then exit; + if not FilterGraph.Active then exit; + // need to reconnect + FilterGraph.RemoveFilter(FOwner); + FilterGraph.InsertFilter(FOwner); + end; + end; + + procedure TVMROptions.SetPreferences(Preferences: TVMRPreferences); + begin + FPreferences := Preferences; + with FOwner do + begin + if (mode <> vmVMR) or (FilterGraph = nil) then exit; + if not FilterGraph.Active then exit; + // need to reconnect + FilterGraph.RemoveFilter(FOwner); + FilterGraph.InsertFilter(FOwner); + end; + end; + + procedure TVMROptions.SetMode(AMode: TVMRVideoMode); + begin + FMode := AMode; + with FOwner do + begin + if (mode <> vmVMR) or (FilterGraph = nil) then exit; + if not FilterGraph.Active then exit; + // need to reconnect + FilterGraph.RemoveFilter(FOwner); + FilterGraph.InsertFilter(FOwner); + end; + end; + + procedure TVMROptions.SetKeepAspectRatio(Keep: boolean); + var AspectRatioControl: IVMRAspectRatioControl9; + begin + FKeepAspectRatio := Keep; + case Mode of + vmrWindowed, vmrWindowless: + begin + if Succeeded(FOwner.QueryInterface(IVMRAspectRatioControl9, AspectRatioControl)) then + case Keep of + true: CheckDSError(AspectRatioControl.SetAspectRatioMode(VMR_ARMODE_LETTER_BOX)); + false: CheckDSError(AspectRatioControl.SetAspectRatioMode(VMR_ARMODE_NONE)); + end; + + end; + vmrRenderless: {TODO}; + end; + end; + + +//****************************************************************************** +// TVideoWindow +//****************************************************************************** + + constructor TVideoWindow.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + FVMROptions:= TVMROptions.Create(self); + ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents, + csDoubleClicks, csReflector]; + TabStop := true; + Height := 120; + Width := 160; + color := $000000; + FIsFullScreen := false; + FKeepAspectRatio := True; + end; + + destructor TVideoWindow.Destroy; + begin + FVMROptions.Free; + FilterGraph := nil; + inherited destroy; + end; + + procedure TVideoWindow.SetVideoMode(AMode: TVideoMode); + begin + if (AMode = vmVMR) and (not CheckVMR) + then FMode := vmNormal + else FMode := AMode; + if FilterGraph = nil then exit; + if not FilterGraph.Active then exit; + // need to reconnect + FilterGraph.RemoveFilter(self); + FilterGraph.InsertFilter(self); + end; + + procedure TVideoWindow.Loaded; + begin + inherited Loaded; + FWindowStyle := GetWindowLong(Handle, GWL_STYLE); + FWindowStyleEx := GetWindowLong(Handle, GWL_EXSTYLE); + end; + + procedure TVideoWindow.Notification(AComponent: TComponent; + Operation: TOperation); + begin + inherited Notification(AComponent, Operation); + if ((AComponent = FFilterGraph) and (Operation = opRemove)) then + FFilterGraph := nil; + end; + + procedure TVideoWindow.SetFilterGraph(AFilterGraph: TFilterGraph); + begin + if AFilterGraph = FFilterGraph then exit; + if FFilterGraph <> nil then + begin + FFilterGraph.RemoveFilter(self); + FFilterGraph.RemoveEventNotifier(self); + end; + if AFilterGraph <> nil then + begin + AFilterGraph.InsertFilter(self); + AFilterGraph.InsertEventNotifier(self); + end; + FFilterGraph := AFilterGraph; + end; + + function TVideoWindow.GetFilter: IBaseFilter; + begin + result := FBaseFilter; + end; + + function TVideoWindow.GetName: string; + begin + result := name; + end; + + procedure TVideoWindow.NotifyFilter(operation: TFilterOperation; Param: integer); + var + EnumPins: TPinList; + VMRFilterConfig: IVMRFilterConfig9; + VMRSurfaceAllocatorNotify: IVMRSurfaceAllocatorNotify9; + VMRSurfaceAllocator: IVMRSurfaceAllocator9; + MyPrefs: TVMRPreferences; + APrefs: cardinal; + i: integer; + CW: Word; + hr: HResult; + DSPackException: EDSPackException; + + procedure UpdatePreferences; + begin + // VMR9 preferences + MyPrefs := FVMROptions.FPreferences - [vpForceMixer]; + CheckDSError(VMRFilterConfig.SetRenderingPrefs(PByte(@MyPrefs)^)); + APrefs := 0; + CheckDSError(VMRFilterConfig.GetRenderingPrefs(APrefs)); + if (vpForceMixer in FVMROptions.FPreferences) then + FVMROptions.FPreferences := PVMRPreferences(@APrefs)^ + [vpForceMixer] + else + FVMROptions.FPreferences := PVMRPreferences(@APrefs)^; + end; + begin + case operation of + foAdding: + begin + case mode of + vmVMR : + begin + CW := Get8087CW; + try + CoCreateInstance(CLSID_VideoMixingRenderer9, nil, CLSCTX_INPROC, IID_IBaseFilter ,FBaseFilter); + FBaseFilter.QueryInterface(IVMRFilterConfig9, VMRFilterConfig); + case FVMROptions.Mode of + vmrWindowed: CheckDSError(VMRFilterConfig.SetRenderingMode(VMR9Mode_Windowed)); + vmrWindowless: CheckDSError(VMRFilterConfig.SetRenderingMode(VMR9Mode_Windowless)); + vmrRenderless: + begin + if (FAllocatorClass = nil) then + raise EDSPackException.Create('Allocator class not set.'); + + FCurrentAllocator := FAllocatorClass.Create(hr, Handle); + if failed(hr) then + begin + DSPackException := EDSPackException.Create('Error Creating Allocator'); + DSPackException.ErrorCode := hr; + raise DSPackException; + end; + + CheckDSError(VMRFilterConfig.SetRenderingMode(VMR9Mode_Renderless)); + CheckDSError(FBaseFilter.QueryInterface(IID_IVMRSurfaceAllocatorNotify9, VMRSurfaceAllocatorNotify)); + CheckDSError(FCurrentAllocator.QueryInterface(IID_IVMRSurfaceAllocator9, VMRSurfaceAllocator)); + + VMRSurfaceAllocatorNotify.AdviseSurfaceAllocator(FRenderLessUserID, VMRSurfaceAllocator); + VMRSurfaceAllocator._AddRef; // manual increment; + VMRSurfaceAllocator.AdviseNotify(VMRSurfaceAllocatorNotify); + end; + end; + VMRFilterConfig := nil; + finally + Set8087CW(CW); + end; + end; + vmNormal : CoCreateInstance(CLSID_VideoRenderer, nil, CLSCTX_INPROC_SERVER, IID_IBaseFilter ,FBaseFilter); + end; + end; + foAdded: + begin + case mode of + vmVMR: + begin + if (FBaseFilter <> nil) then + if CheckDSError(FBaseFilter.QueryInterface(IVMRFilterConfig9, VMRFilterConfig)) = S_OK then + begin + if (FVMROptions.FStreams <> 4) + or (vpForceMixer in FVMROptions.FPreferences) then + begin + CheckDSError(VMRFilterConfig.SetNumberOfStreams(FVMROptions.FStreams)); + CheckDSError(VMRFilterConfig.GetNumberOfStreams(FVMROptions.FStreams)); + end; + + + case FVMROptions.Mode of + vmrWindowed : + begin + + CheckDSError(FBaseFilter.QueryInterface(IVideoWindow, FVideoWindow)); + UpdatePreferences; + end; + vmrWindowless : + begin + + CheckDSError(FBaseFilter.QueryInterface(IVMRWindowlessControl9, FWindowLess)); + CheckDSError(FWindowLess.SetVideoClippingWindow(Handle)); + UpdatePreferences; + Resize; + end; + vmrRenderless : + begin + //Assert(False, 'not yet imlemented.'); + //CheckDSError(FBaseFilter.QueryInterface(IVMRWindowlessControl9, FWindowLess)); + //CheckDSError(FWindowLess.SetVideoClippingWindow(Handle)); + end; + + end; + VMRFilterConfig := nil; + VMROptions.SetKeepAspectRatio(VMROptions.FKeepAspectRatio); + end; + end; + vmNormal: CheckDSError(FBaseFilter.QueryInterface(IVideoWindow, FVideoWindow)); + end; + end; + foRemoving: + if FBaseFilter <> nil then + begin + // it's important to stop and disconnect the filter before removing the VMR filter. + CheckDSError(FBaseFilter.Stop); + EnumPins := TPinList.Create(FBaseFilter); + if EnumPins.Count > 0 then + for i := 0 to EnumPins.Count - 1 do + CheckDSError(EnumPins.Items[i].Disconnect); + EnumPins.Free; + if (FCurrentAllocator <> nil) and (mode = vmVMR) and (VMROptions.Mode = vmrRenderless) then + begin + IUnKnown(FCurrentAllocator)._Release; + FCurrentAllocator := nil; + end; + end; + foRemoved : + begin + FVideoWindow := nil; + FWindowLess := nil; + FBaseFilter := nil; + end; + end; + end; + + procedure TVideoWindow.Paint; + begin + inherited Paint; + if Assigned(FOnPaint) then FOnPaint(self); + end; + + procedure TVideoWindow.Resize; + var ARect: TRect; + begin + inherited Resize; + case FMode of + vmNormal: + begin + if (FVideoWindow <> nil) and (not FullScreen) then + if FIsVideoWindowOwner then + FVideoWindow.SetWindowPosition(0, 0, Width, Height) + else + FVideoWindow.SetWindowPosition(Left, Top, Width, Height); + end; + vmVMR: + case FVMROptions.Mode of + vmrWindowed: + begin + if (FVideoWindow <> nil) and (not FullScreen) then + if FIsVideoWindowOwner then + FVideoWindow.SetWindowPosition(0, 0, Width, Height) + else + FVideoWindow.SetWindowPosition(Left, Top, Width, Height); + end; + vmrWindowless: + if FWindowLess <> nil then + begin + ARect := Rect(0,0, width, height); + FWindowLess.SetVideoPosition(nil, @ARect); + end; + end; + end; + + end; + + procedure TVideoWindow.ConstrainedResize(var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer); + begin + inherited ConstrainedResize(MinWidth, MinHeight, MaxWidth, MaxHeight); + Resize; + end; + + function TVideoWindow.GetVideoHandle: THandle; + begin + if FVideoWindow <> nil then + result := FindWindowEx(Parent.Handle,0,Pchar('VideoRenderer'), Pchar(name)) + else + Result := Canvas.Handle; + end; + + class function TVideoWindow.CheckVMR: boolean; + var + AFilter: IBaseFilter; + CW: Word; + begin + CW := Get8087CW; + try + result := (CoCreateInstance(CLSID_VideoMixingRenderer9, nil, CLSCTX_INPROC, IID_IBaseFilter ,AFilter) = S_OK); + finally + Set8087CW(CW); + AFilter := nil; + end; + end; + + procedure TVideoWindow.SetFullScreen(Value: boolean); + var + StyleEX: LongWord; + begin + if (FVideoWindow <> nil) and CheckInputPinsConnected then + case Value of + true: + begin + CheckDSError(FVideoWindow.put_Owner(0)); + CheckDSError(FVideoWindow.put_WindowStyle(FWindowStyle and not(WS_BORDER or WS_CAPTION or WS_THICKFRAME))); + StyleEX := FWindowStyleEx and not(WS_EX_CLIENTEDGE or WS_EX_STATICEDGE + or WS_EX_WINDOWEDGE or WS_EX_DLGMODALFRAME); + if FTopMost then StyleEX := StyleEX or WS_EX_TOPMOST; + CheckDSError(FVideoWindow.put_WindowStyleEx(StyleEX)); + CheckDSError(FVideoWindow.SetWindowPosition(0, 0, Screen.Width, Screen.Height)); + FIsFullScreen := True; + end; + false: + begin + if FIsVideoWindowOwner then + CheckDSError(FVideoWindow.put_Owner(Handle)) + else + CheckDSError(FVideoWindow.put_Owner(Parent.Handle)); + CheckDSError(FVideoWindow.put_WindowStyle(FWindowStyle or WS_CHILD or WS_CLIPSIBLINGS)); + CheckDSError(FVideoWindow.put_WindowStyleEx(FWindowStyleEx)); + if FIsVideoWindowOwner then + CheckDSError(FVideoWindow.SetWindowPosition(0, 0, Self.Width, Self.Height)) + else + CheckDSError(FVideoWindow.SetWindowPosition(Self.Left, Self.Top, Self.Width, Self.Height)); + FIsFullScreen := false; + end; + end; + + if FWindowLess <> nil then + FIsFullScreen := false; + + FFullScreen := Value; + end; + + + function TVideoWindow.QueryInterface(const IID: TGUID; out Obj): HResult; + begin + if IsEqualGUID(IID_IVMRWindowlessControl9, IID) and (FWindowLess <> nil) then + begin + result := S_OK; + IunKnown(Obj) := FWindowLess; + exit; + end; + result := inherited QueryInterface(IID, Obj); + if failed(result) and assigned(FBaseFilter) then + result := FBaseFilter.QueryInterface(IID, Obj); + end; + + procedure TVideoWindow.GraphEvent(Event, Param1, Param2: integer); + begin + case Event of + EC_PALETTE_CHANGED: + if FVideoWindow <> nil then + begin + SetFullScreen(FFullScreen); + if Name <> '' then + CheckDSError(FVideoWindow.put_Caption(Name)); + CheckDSError(FVideoWindow.put_MessageDrain(Handle)); + end; + EC_VMR_RENDERDEVICE_SET: + begin + if (FVMROptions.FMode = vmrWindowed) and (FVideoWindow <> nil) then + begin + if Name <> '' then + CheckDSError(FVideoWindow.put_Caption(Name)); + CheckDSError(FVideoWindow.put_MessageDrain(Handle)); + end; + end; + end; + end; + + function TVideoWindow.CheckInputPinsConnected: boolean; + var + PinList: TPinList; + i: Integer; + begin + result := False; + if (FBaseFilter = nil) then Exit; + PinList := TPinList.Create(FBaseFilter); + try + for i := 0 to PinList.Count - 1 do + if PinList.Connected[i] then + begin + Result := True; + Break; + end; + finally + PinList.Free; + end; + end; + + + procedure TVideoWindow.ControlEvent(Event: TControlEvent; Param: integer = 0); + var + FilterInfo: TFilterInfo; + FilterList: TFilterList; + i: integer; + GUID: TGUID; + begin + case Event of + ceDVDRendered: // mean our Video Filter have been removed + begin + ZeroMemory(@FilterInfo, SizeOf(TFilterInfo)); + CheckDSError(FBaseFilter.QueryFilterInfo(FilterInfo)); + if not assigned(FilterInfo.pGraph) then + begin + FilterList:= TFilterList.Create(FilterGraph.FFilterGraph); + if FilterList.Count > 0 then + for i := 0 to FilterList.Count - 1 do + begin + FilterList.Items[i].GetClassID(GUID); + if ISEqualGUID(GUID, CLSID_VideoRenderer) and (Mode = vmNormal) then + begin + FBaseFilter := nil; + FVideoWindow := nil; + FWindowLess := nil; + FBaseFilter := FilterList.Items[i]; + FBaseFilter.QueryInterface(IVideoWindow, FVideoWindow); + break; + end; + end; + end; + end; + cePlay: + begin + if CheckInputPinsConnected then + begin + case FMode of + vmNormal: + if FVideoWindow <> nil then + begin + SetFullScreen(FFullScreen); + if Name <> '' then + CheckDSError(FVideoWindow.put_Caption(Name)); + CheckDSError(FVideoWindow.put_MessageDrain(Handle)); + end; + vmVMR: SetFullScreen(FFullScreen); + end; + end; + end; + + end; + end; + + procedure TVideoWindow.WndProc(var Message: TMessage); + begin + if ((Message.Msg = WM_CONTEXTMENU) and FullScreen) then + begin + if assigned(PopupMenu) then + if PopupMenu.AutoPopup then + begin + PopupMenu.Popup(mouse.CursorPos.X, mouse.CursorPos.Y); + Message.Result := 1; + end; + end + else + inherited WndProc(Message); + end; + + procedure TVideoWindow.SetTopMost(TopMost: boolean); + begin + FTopMost := TopMost; + if FFullScreen then SetFullScreen(true); + end; + + procedure TVideoWindow.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + begin + if FIsFullScreen then + inherited MouseDown(Button, Shift, mouse.CursorPos.X, mouse.CursorPos.Y) + else + inherited MouseDown(Button, Shift, X, Y) + end; + + procedure TVideoWindow.MouseMove(Shift: TShiftState; X, Y: Integer); + begin + if Fisfullscreen then + inherited MouseMove(Shift, mouse.CursorPos.X, mouse.CursorPos.Y) + else + inherited MouseMove(Shift, X, Y) + end; + + procedure TVideoWindow.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + begin + if Fisfullscreen then + inherited MouseUp(Button, Shift, mouse.CursorPos.X, mouse.CursorPos.Y) + else + inherited MouseUp(Button, Shift, X, Y) + end; + + function TVideoWindow.VMRGetBitMap(Stream: TStream): boolean; + var + Image: PBitmapInfoHeader; + BFH: TBITMAPFILEHEADER; + function DibSize: cardinal; begin result := (Image.biSize + Image.biSizeImage + Image.biClrUsed * sizeof(TRGBQUAD)); end; + function DibNumColors: cardinal; + begin if (image.biClrUsed = 0) and (image.biBitCount <= 8) then + result := 1 shl integer(image.biBitCount) else + result := image.biClrUsed; end; + function DibPaletteSize: cardinal; begin result := (DibNumColors * sizeof(TRGBQUAD)) end; + begin + assert(assigned(Stream)); + result := false; + if FWindowLess <> nil then + if Succeeded(FWindowLess.GetCurrentImage(PByte(image))) then + begin + BFH.bfType := $4d42; // BM + BFH.bfSize := DibSize + sizeof(TBITMAPFILEHEADER); + BFH.bfReserved1 := 0; + BFH.bfReserved2 := 0; + BFH.bfOffBits := sizeof(TBITMAPFILEHEADER) + image.biSize + DibPaletteSize; + Stream.Write(BFH, SizeOf(TBITMAPFILEHEADER)); + Stream.Write(image^, BFH.bfSize); + Stream.Position :=0; + CoTaskMemFree(image); + result := true; + end; + end; + + function TVideoWindow.GetVisible: boolean; + begin + result := inherited visible; + end; + + procedure TVideoWindow.SetVisible(Vis: boolean); + begin + inherited Visible := Vis; + if assigned(FVideoWindow) then CheckDSError(FVideoWindow.put_Visible(vis)); + end; + + procedure TVideoWindow.SetAllocator(Allocator: TAbstractAllocatorClass; UserID: Cardinal); + begin + FAllocatorClass := Allocator; + FRenderLessUserID := UserID; + end; + +// ***************************************************************************** +// TSampleGrabber +// ***************************************************************************** + + procedure TSampleGrabber.SetFilterGraph(AFilterGraph: TFilterGraph); + begin + if AFilterGraph = FFilterGraph then exit; + if FFilterGraph <> nil then FFilterGraph.RemoveFilter(self); + if AFilterGraph <> nil then AFilterGraph.InsertFilter(self); + FFilterGraph := AFilterGraph; + end; + + function TSampleGrabber.GetFilter: IBaseFilter; + begin + result := FBaseFilter; + end; + + function TSampleGrabber.GetName: string; + begin + result := name; + end; + + procedure TSampleGrabber.NotifyFilter(operation: TFilterOperation; Param: integer = 0); + var + EnumPins: IEnumPins; + begin + case operation of + foAdding : Cocreateinstance(CLSID_SampleGrabber, nil, CLSCTX_INPROC ,IID_IBASEFilter, FBaseFilter); + foAdded : + begin + FBaseFilter.QueryInterface(IID_ISampleGrabber,SampleGrabber); + FBaseFilter.EnumPins(EnumPins); + EnumPins.Next(1,InPutPin,nil); + EnumPins.Next(1,OutPutPin,nil); + EnumPins := nil; + UpdateMediaType; + SampleGrabber.SetBufferSamples(true); + SampleGrabber.SetCallback(Self ,1); + end; + foRemoving : + begin + FBaseFilter.Stop; + InPutPin.Disconnect; + OutPutPin.Disconnect; + end; + foRemoved : + begin + SampleGrabber.SetCallback(nil ,1); + SampleGrabber.SetBufferSamples(false); + FBaseFilter := nil; + SampleGrabber := nil; + InPutPin := nil; + OutPutPin := nil; + end; + foRefresh: UpdateMediaType; + end; + end; + + constructor TSampleGrabber.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + FCriticalSection := TCriticalSection.Create; + assert(CheckFilter, 'The SampleGrabber Filter is not available on this system.'); + FMediaType := TMediaType.Create(MEDIATYPE_Video); + FMediaType.SubType := MEDIASUBTYPE_RGB24; + FMediaType.FormatType := FORMAT_VideoInfo; + // [pjh, 2003-07-14] BMPInfo local + // new(BMPInfo); + end; + + destructor TSampleGrabber.Destroy; + begin + FilterGraph := nil; + FMediaType.Free; + // [pjh, 2003-07-14] BMPInfo local + // Dispose(BMPInfo); + FCriticalSection.Free; + inherited destroy; + end; + + class function TSampleGrabber.CheckFilter: boolean; + var + AFilter: IBaseFilter; + begin + result := Cocreateinstance(CLSID_SampleGrabber, nil, CLSCTX_INPROC ,IID_IBASEFilter, AFilter) = S_OK; + AFilter := nil; + end; + + procedure TSampleGrabber.Notification(AComponent: TComponent; Operation: TOperation); + begin + inherited Notification(AComponent, Operation); + if ((AComponent = FFilterGraph) and (Operation = opRemove)) then + FFilterGraph := nil; + end; + + procedure TSampleGrabber.UpdateMediaType; + begin + if assigned(SampleGrabber) then + begin + FBaseFilter.Stop; + InPutPin.Disconnect; + SampleGrabber.SetMediaType(MediaType.AMMediaType^); + end; + end; + + procedure TSampleGrabber.SetBMPCompatible(Source: PAMMediaType; SetDefault: cardinal); + var + SubType : TGUID; + BitCount: LongWord; + begin + BitCount := SetDefault; + MediaType.ResetFormatBuffer; + ZeroMemory(MediaType.AMMediaType, sizeof(TAMMediaType)); + MediaType.majortype := MEDIATYPE_Video; + MediaType.formattype := FORMAT_VideoInfo; + if Source = nil then + begin + case SetDefault of + 0 : MediaType.subtype := MEDIASUBTYPE_RGB24; + 1 : MediaType.subtype := MEDIASUBTYPE_RGB1; + 2 ..4 : MediaType.subtype := MEDIASUBTYPE_RGB4; + 5 ..8 : MediaType.subtype := MEDIASUBTYPE_RGB8; + 9 ..16 : MediaType.subtype := MEDIASUBTYPE_RGB555; + 17..24 : MediaType.subtype := MEDIASUBTYPE_RGB24; + 25..32 : MediaType.subtype := MEDIASUBTYPE_RGB32 + else + MediaType.subtype := MEDIASUBTYPE_RGB32; + end; + UpdateMediaType; + exit; + end; + + SubType := Source.subtype; + if (IsEqualGUID(SubType, MEDIASUBTYPE_RGB1) or + IsEqualGUID(SubType, MEDIASUBTYPE_RGB4) or + IsEqualGUID(SubType, MEDIASUBTYPE_RGB8) or + IsEqualGUID(SubType, MEDIASUBTYPE_RGB555) or + IsEqualGUID(SubType, MEDIASUBTYPE_RGB24) or + IsEqualGUID(SubType, MEDIASUBTYPE_RGB32)) then + MediaType.subtype := SubType // no change + else + begin + // get bitcount + if assigned(Source.pbFormat) then + if IsEqualGUID(Source.formattype, FORMAT_VideoInfo) then + BitCount := PVideoInfoHeader(Source.pbFormat)^.bmiHeader.biBitCount else + if IsEqualGUID(Source.formattype, FORMAT_VideoInfo2) then + BitCount := PVideoInfoHeader2(Source.pbFormat)^.bmiHeader.biBitCount else + if IsEqualGUID(Source.formattype, FORMAT_MPEGVideo) then + BitCount := PMPEG1VideoInfo(Source.pbFormat)^.hdr.bmiHeader.biBitCount else + if IsEqualGUID(Source.formattype, FORMAT_MPEG2Video) then + BitCount := PMPEG2VideoInfo(Source.pbFormat)^.hdr.bmiHeader.biBitCount; + case BitCount of + 0 : MediaType.subtype := MEDIASUBTYPE_RGB24; + 1 : MediaType.subtype := MEDIASUBTYPE_RGB1; + 2 ..4 : MediaType.subtype := MEDIASUBTYPE_RGB4; + 5 ..8 : MediaType.subtype := MEDIASUBTYPE_RGB8; + 9 ..16 : MediaType.subtype := MEDIASUBTYPE_RGB555; + 17..24 : MediaType.subtype := MEDIASUBTYPE_RGB24; + 25..32 : MediaType.subtype := MEDIASUBTYPE_RGB32 + else + MediaType.subtype := MEDIASUBTYPE_RGB32; + end; + end; + UpdateMediaType; + end; + + function GetDIBLineSize(BitCount, Width: Integer): Integer; + begin + if BitCount = 15 then + BitCount := 16; + Result := ((BitCount * Width + 31) div 32) * 4; + end; + + // [pjh, 2003-07-17] modified + // Buffer = Nil -> Get the data from SampleGrabber + // Buffer <> Nil -> Copy the DIB from buffer to Bitmap + function TSampleGrabber.GetBitmap(Bitmap: TBitmap; Buffer: Pointer; BufferLen: Integer): Boolean; + var + hr: HRESULT; + BIHeaderPtr: PBitmapInfoHeader; + MediaType: TAMMediaType; + BitmapHandle: HBitmap; + DIBPtr: Pointer; + DIBSize: LongInt; + begin + Result := False; + if not Assigned(Bitmap) then + Exit; + if Assigned(Buffer) and (BufferLen = 0) then + Exit; + hr := SampleGrabber.GetConnectedMediaType(MediaType); + if hr <> S_OK then + Exit; + try + if IsEqualGUID(MediaType.majortype, MEDIATYPE_Video) then + begin + BIHeaderPtr := Nil; + if IsEqualGUID(MediaType.formattype, FORMAT_VideoInfo) then + begin + if MediaType.cbFormat = SizeOf(TVideoInfoHeader) then // check size + BIHeaderPtr := @(PVideoInfoHeader(MediaType.pbFormat)^.bmiHeader); + end + else if IsEqualGUID(MediaType.formattype, FORMAT_VideoInfo2) then + begin + if MediaType.cbFormat = SizeOf(TVideoInfoHeader2) then // check size + BIHeaderPtr := @(PVideoInfoHeader2(MediaType.pbFormat)^.bmiHeader); + end; + // check, whether format is supported by TSampleGrabber + if not Assigned(BIHeaderPtr) then + Exit; + BitmapHandle := CreateDIBSection(0, PBitmapInfo(BIHeaderPtr)^, + DIB_RGB_COLORS, DIBPtr, 0, 0); + if BitmapHandle <> 0 then + begin + try + if DIBPtr = Nil then + Exit; + // get DIB size + DIBSize := BIHeaderPtr^.biSizeImage; + if DIBSize = 0 then + begin + with BIHeaderPtr^ do + DIBSize := GetDIBLineSize(biBitCount, biWidth) * biHeight * biPlanes; + end; + // copy DIB + if not Assigned(Buffer) then + begin + // get buffer size + BufferLen := 0; + hr := SampleGrabber.GetCurrentBuffer(BufferLen, Nil); + if (hr <> S_OK) or (BufferLen <= 0) then + Exit; + // copy buffer to DIB + if BufferLen > DIBSize then // copy Min(BufferLen, DIBSize) + BufferLen := DIBSize; + hr := SampleGrabber.GetCurrentBuffer(BufferLen, DIBPtr); + if hr <> S_OK then + Exit; + end + else + begin + if BufferLen > DIBSize then // copy Min(BufferLen, DIBSize) + BufferLen := DIBSize; + Move(Buffer^, DIBPtr^, BufferLen); + end; + Bitmap.Handle := BitmapHandle; + Result := True; + finally + if Bitmap.Handle <> BitmapHandle then // preserve for any changes in Graphics.pas + DeleteObject(BitmapHandle); + end; + end; + end; + finally + FreeMediaType(@MediaType); + end; + end; + + function TSampleGrabber.GetBitmap(Bitmap: TBitmap): Boolean; + begin + Result := GetBitmap(Bitmap, Nil, 0); + end; + + function TSampleGrabber.QueryInterface(const IID: TGUID; out Obj): HResult; + begin + result := inherited QueryInterface(IID, Obj); + if failed(result) and assigned(FBaseFilter) then + result := FBaseFilter.QueryInterface(IID, Obj); + end; + + function TSampleGrabber.BufferCB(SampleTime: Double; pBuffer: PByte; + BufferLen: Integer): HResult; + begin + if assigned(FOnBuffer) then + begin + FCriticalSection.Enter; + try + FOnBuffer(self, SampleTime, pBuffer, BufferLen); + finally + FCriticalSection.Leave; + end; + end; + result := S_OK; + end; + + function TSampleGrabber.SampleCB(SampleTime: Double; + pSample: IMediaSample): HResult; + begin + result := S_OK; + end; + +// ***************************************************************************** +// TFilter +// ***************************************************************************** + + function TFilter.GetFilter: IBaseFilter; + begin + result := FFilter; + end; + + function TFilter.GetName: string; + begin + result := name; + end; + + procedure TFilter.NotifyFilter(operation: TFilterOperation; Param: integer = 0); + var + State : TFilterState; + begin + case operation of + foAdding: FFilter := BaseFilter.CreateFilter; + foRemoving: if (FFilter <> nil) and (FFilter.GetState(0,State) = S_OK) then + case State of + State_Paused, + State_Running: FFilter.Stop; + end; + foRemoved: FFilter := nil; + foRefresh: if assigned(FFilterGraph) then + begin + FFilterGraph.RemoveFilter(self); + FFilterGraph.InsertFilter(self); + end; + end; + end; + + constructor TFilter.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + FBaseFilter := TBaseFilter.Create; + end; + + destructor TFilter.Destroy; + begin + FBaseFilter.Free; + FilterGraph := nil; + inherited Destroy; + end; + + procedure TFilter.SetFilterGraph(AFilterGraph: TFilterGraph); + begin + if AFilterGraph = FFilterGraph then exit; + if FFilterGraph <> nil then FFilterGraph.RemoveFilter(self); + if AFilterGraph <> nil then AFilterGraph.InsertFilter(self); + FFilterGraph := AFilterGraph; + end; + + procedure TFilter.Notification(AComponent: TComponent; Operation: TOperation); + begin + inherited Notification(AComponent, Operation); + if ((AComponent = FFilterGraph) and (Operation = opRemove)) then + FFilterGraph := nil; + end; + + function TFilter.QueryInterface(const IID: TGUID; out Obj): HResult; + begin + result := inherited QueryInterface(IID, Obj); + if not Succeeded(Result) then + if Assigned(FFilter) then + result := FFilter.QueryInterface(IID, Obj); + end; + +// ***************************************************************************** +// TASFWriter +// ***************************************************************************** + + constructor TASFWriter.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + FAutoIndex := true; + FMultiPass := False; + FDontCompress := False; + end; + + destructor TASFWriter.Destroy; + begin + FilterGraph := nil; + inherited Destroy; + end; + + procedure TASFWriter.SetFilterGraph(AFilterGraph: TFilterGraph); + begin + if AFilterGraph = FFilterGraph then exit; + if FFilterGraph <> nil then FFilterGraph.RemoveFilter(self); + if AFilterGraph <> nil then AFilterGraph.InsertFilter(self); + FFilterGraph := AFilterGraph; + end; + + function TASFWriter.GetFilter: IBaseFilter; + begin + result := FFilter; + end; + + function TASFWriter.GetName: string; + begin + result := name; + end; + + procedure TASFWriter.NotifyFilter(operation: TFilterOperation; Param: integer = 0); + var + PinList: TPinList; + ServiceProvider: IServiceProvider; + FAsfConfig: IConfigAsfWriter2; + begin + case operation of + foAdding: cocreateinstance(CLSID_WMAsfWriter, nil, CLSCTX_INPROC ,IBaseFilter, FFilter); + foAdded : begin + if assigned(FFilter) then + begin + SetProfile(FProfile); + SetFileName(FFileName); + if Succeeded(FFilter.QueryInterface(IID_IConfigAsfWriter2, FAsfConfig)) then + begin + FAsfConfig.SetParam(AM_CONFIGASFWRITER_PARAM_AUTOINDEX, Cardinal(FAutoIndex), 0); + FAsfConfig.SetParam(AM_CONFIGASFWRITER_PARAM_MULTIPASS, Cardinal(FMultiPass), 0); + FAsfConfig.SetParam(AM_CONFIGASFWRITER_PARAM_DONTCOMPRESS, Cardinal(FDontCompress), 0); + end; + + PinList:= TPinList.Create(FFilter); + try + if PinList.Count >= 1 then + begin + AudioInput := PinList.Items[0]; + if PinList.Count = 2 then + begin + VideoInput := PinList.Items[1]; + VideoInput.QueryInterface(IID_IAMStreamConfig, VideoStreamConfig); + end; + AudioInput.QueryInterface(IID_IAMStreamConfig, AudioStreamConfig); + if Succeeded(QueryInterface(IServiceProvider, ServiceProvider)) then + begin + ServiceProvider.QueryService(IID_IWMWriterAdvanced2, IID_IWMWriterAdvanced2, WriterAdvanced2); + ServiceProvider := nil; + end; + if ((FPort > 0) and (FMaxUsers > 0)) then + if Succeeded(WMCreateWriterNetworkSink(WriterNetworkSink)) then + begin + WriterNetworkSink.SetNetworkProtocol(WMT_PROTOCOL_HTTP); + WriterNetworkSink.SetMaximumClients(FMaxUsers); + WriterNetworkSink.Open(FPort); + WriterAdvanced2.AddSink(WriterNetworkSink); + end; + end; + finally + PinList.Free; + end; + + end; + end; + foRemoving: begin + if assigned(FFilter) then FFilter.Stop; + if assigned(WriterNetworkSink) then + begin + WriterNetworkSink.Disconnect; + WriterNetworkSink.Close; + end; + if assigned(AudioInput) then AudioInput.Disconnect; + if assigned(VideoInput) then VideoInput.Disconnect; + end; + + foRemoved: begin + WriterAdvanced2 := nil; + WriterNetworkSink := nil; + AudioInput := nil; + VideoInput := nil; + AudioStreamConfig := nil; + VideoStreamConfig := nil; + FFilter := nil; + end; + end; + end; + + procedure TASFWriter.Notification(AComponent: TComponent; Operation: TOperation); + begin + inherited Notification(AComponent, Operation); + if ((AComponent = FFilterGraph) and (Operation = opRemove)) then + FFilterGraph := nil; + end; + + function TASFWriter.GetProfile: TWMPofiles8; + var + GUIDProf: TGUID; + ConfigAsfWriter: IConfigAsfWriter; + begin + if Succeeded(QueryInterface(IConfigAsfWriter, ConfigAsfWriter)) then + begin + ConfigAsfWriter.GetCurrentProfileGuid(GUIDProf); + result := ProfileFromGUID(GUIDProf); + ConfigAsfWriter := nil; + end + else + result := FProfile + end; + + procedure TASFWriter.SetProfile(profile: TWMPofiles8); + var + ConfigAsfWriter: IConfigAsfWriter; + begin + if Succeeded(QueryInterface(IConfigAsfWriter, ConfigAsfWriter)) then + begin + ConfigAsfWriter.ConfigureFilterUsingProfileGuid(WMProfiles8[profile]); + ConfigAsfWriter := nil; + end + else + FProfile := profile; + end; + + function TASFWriter.GetFileName: String; + var + F: PWideChar; + FileSinkFilter2: IFileSinkFilter2; + begin + if Succeeded(QueryInterface(IFileSinkFilter2, FileSinkFilter2)) then + begin + FileSinkFilter2.GetCurFile(F,nil); + FileSinkFilter2 := nil; + result := F; + end + else + result := FFileName; + end; + + procedure TASFWriter.SetFileName(FileName: String); + var FileSinkFilter2: IFileSinkFilter2; + begin + FFileName := FileName; + if Succeeded(QueryInterface(IFileSinkFilter2, FileSinkFilter2)) then + begin + FileSinkFilter2.SetFileName(PWideChar(FFileName),nil); + FileSinkFilter2 := nil; + end; + end; + + function TASFWriter.QueryInterface(const IID: TGUID; out Obj): HResult; + begin + result := inherited QueryInterface(IID, Obj); + if failed(result) and assigned(FFilter) then + result := FFilter.QueryInterface(IID, Obj); + end; + +// ***************************************************************************** +// TDSTrackBar +// ***************************************************************************** + + procedure TDSTrackBar.SetFilterGraph(AFilterGraph: TFilterGraph); + begin + if AFilterGraph = FFilterGraph then exit; + if FFilterGraph <> nil then FFilterGraph.RemoveEventNotifier(self); + if AFilterGraph <> nil then AFilterGraph.InsertEventNotifier(self); + FFilterGraph := AFilterGraph; + end; + + constructor TDSTrackBar.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + FMouseDown := false; + FEnabled := false; + FInterval := 1000; + FWindowHandle := AllocateHWnd(TimerWndProc); + end; + + destructor TDSTrackBar.Destroy; + begin + FEnabled := False; + UpdateTimer; + FilterGraph := nil; + DeallocateHWnd(FWindowHandle); + FMediaSeeking := nil; + inherited Destroy; + end; + + procedure TDSTrackBar.Notification(AComponent: TComponent; + Operation: TOperation); + begin + inherited Notification(AComponent, Operation); + if ((AComponent = FFilterGraph) and (Operation = opRemove)) then + begin + FMediaSeeking := nil; + FFilterGraph := nil; + end; + end; + + procedure TDSTrackBar.GraphEvent(Event, Param1, Param2: integer); + var + Duration: int64; + Zero: int64; + begin + case Event of + EC_CLOCK_CHANGED: if assigned(FMediaSeeking) then + begin + Zero := 0; + FMediaSeeking.GetDuration(Duration); + FMediaSeeking.SetPositions(Zero, AM_SEEKING_AbsolutePositioning, + Duration , AM_SEEKING_NoPositioning); + end; + end; + end; + + procedure TDSTrackBar.ControlEvent(Event: TControlEvent; Param: integer = 0); + begin + case event of + cePlay: TimerEnabled := Enabled; + cePause..ceStop: TimerEnabled := false; + ceActive: case Param of + 0: FMediaSeeking := nil; + 1: FFilterGraph.QueryInterface(IMediaSeeking, FMediaSeeking); + end; + end; + end; + + procedure TDSTrackBar.SetTimerEnabled(Value: Boolean); + begin + if Value <> FEnabled then + begin + FEnabled := Value; + UpdateTimer; + end; + end; + + procedure TDSTrackBar.SetInterval(Value: Cardinal); + begin + if Value <> FInterval then + begin + FInterval := Value; + UpdateTimer; + end; + end; + + procedure TDSTrackBar.SetOnTimer(Value: TTimerEvent); + begin + FOnTimer := Value; + UpdateTimer; + end; + + procedure TDSTrackBar.UpdateTimer; + begin + KillTimer(FWindowHandle, 1); + if (FInterval <> 0) and FEnabled then + if SetTimer(FWindowHandle, 1, FInterval, nil) = 0 then + raise EOutOfResources.Create(SNoTimers); + end; + + procedure TDSTrackBar.Timer; + var + CurrentPos, StopPos: int64; + MlsCurrentPos, MlsStopPos: Cardinal; + begin + if assigned(FMediaSeeking) and (not FMouseDown) then + if Succeeded(FMediaSeeking.GetDuration(StopPos)) then + if Succeeded(FMediaSeeking.GetCurrentPosition(CurrentPos)) then + begin + MlsCurrentPos := RefTimeToMiliSec(CurrentPos); + MlsStopPos := RefTimeToMiliSec(StopPos); + min := 0; + max := MlsStopPos div TimerInterval; + Position := MlsCurrentPos div TimerInterval; + if Assigned(FOnTimer) then FOnTimer(Self, MlsCurrentPos, MlsStopPos); + end; + end; + + procedure TDSTrackBar.TimerWndProc(var Msg: TMessage); + begin + with Msg do + if Msg = WM_TIMER then + try + Timer; + except + Application.HandleException(Self); + end + else + Result := DefWindowProc(FWindowHandle, Msg, wParam, lParam); + end; + + procedure TDSTrackBar.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + var + StopPosition, CurrentPosition: int64; + begin + inherited MouseUp(Button, Shift, X, Y); + if Button = mbLeft then + if assigned(FMediaSeeking) then + begin + FMediaSeeking.GetStopPosition(StopPosition); + CurrentPosition := (StopPosition * Position) div max ; + FMediaSeeking.SetPositions(CurrentPosition, AM_SEEKING_AbsolutePositioning, + StopPosition , AM_SEEKING_NoPositioning); + + end; + FMouseDown := False; + end; + + procedure TDSTrackBar.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + begin + inherited MouseDown(Button, Shift, X, Y); + if Button = mbLeft then FMouseDown := true; + end; + + // --------------------------- Color Control ------------------------------- + constructor TColorControl.Create(AOwner: TDSVideoWindowEx2); + begin + inherited Create; + FOwner := AOwner; + ZeroMemory(@FDefault,SizeOf(TDDColorControl)); + with FDefault do + begin + dwSize := SizeOf(TDDCOLORCONTROL); + dwFlags := DDCOLOR_BRIGHTNESS or DDCOLOR_CONTRAST or DDCOLOR_HUE + or DDCOLOR_SATURATION or DDCOLOR_GAMMA or DDCOLOR_SHARPNESS + or DDCOLOR_COLORENABLE; + lBrightness := 750; + lContrast := 10000; + lGamma := 1; + lHue := 0; + lSaturation := 10000; + lSharpness := 5; + lColorEnable := integer(True); + dwReserved1 := 0; + end; + FBrightness := FDefault.lBrightness; + FContrast := FDefault.lContrast; + FGamma := FDefault.lGamma; + FHue := FDefault.lHue; + FSaturation := FDefault.lSaturation; + FSharpness := FDefault.lSharpness; + FUtilColor := Bool(FDefault.lColorEnable); + end; + + procedure TColorControl.ReadDefault; + var + EnumPins : IEnumPins; + Pin : IPin; + ul : cardinal; + pd : TPinDirection; + MPC : IMixerPinConfig2; + Tel : Integer; + FG : IFilterGraph; + FilterList : TFilterList; + Hr : HResult; + OVM : IBaseFilter; + FClass : TGuid; + Tmp : TDDColorControl; + begin + if (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState) or + (TDSVideoWindowEx2(FOwner).FFilterGraph = nil) or + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = False) then Exit; + + MPC := nil; + OVM := nil; + FG := nil; + FG := TDSVideoWindowEx2(FOwner).FFilterGraph.FFilterGraph; + FilterList := TFilterList.Create(FG); + try + for Tel := 0 to FilterList.Count -1 do + begin + FilterList[Tel].GetClassID(FClass); + if IsEqualGuid(FClass, CLSID_OverlayMixer) then + OVM := FilterList[Tel]; + if IsEqualGuid(FClass, CLSID_OverlayMixer2) then + OVM := FilterList[Tel]; + end; + + if OVM = nil then Exit; + Hr := OVM.EnumPins(EnumPins); + if Failed(Hr) then Exit; + + Tel := 0; + while (EnumPins.Next(1, Pin, @ul) = S_OK) and (ul = 1) and (Tel = 0) do + begin + Hr := Pin.QueryDirection(pd); + if Failed(Hr) then Exit; + + if pd = PINDIR_INPUT then + begin + Hr := Pin.QueryInterface(IID_IMixerPinConfig2, MPC); + if Failed(Hr) then Exit; + Inc(Tel); + end; + Pin := nil; + end; + EnumPins := nil; + + ZeroMemory(@Tmp,SizeOf(TDDColorControl)); + Tmp.dwSize:=SizeOf(TDDCOLORCONTROL); + + Hr := MPC.GetOverlaySurfaceColorControls(Tmp); + if Failed(Hr) then Exit; + + FDefault := Tmp; + finally + FilterList.Free; + FG := nil; + OVM := nil; + EnumPins := nil; + Pin := nil; + MPC := nil; + end; + end; + + procedure TColorControl.UpdateColorControls; + var + EnumPins : IEnumPins; + Pin : IPin; + ul : cardinal; + pd : TPinDirection; + MPC : IMixerPinConfig2; + Tel : Integer; + FG : IFilterGraph; + FilterList : TFilterList; + Hr : HResult; + OVM : IBaseFilter; + FClass : TGuid; + Tmp : TDDColorControl; + begin + if (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState) or + (TDSVideoWindowEx2(FOwner).FFilterGraph = nil) or + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = False) then Exit; + + MPC := nil; + OVM := nil; + FG := nil; + FG := TDSVideoWindowEx2(FOwner).FFilterGraph.FFilterGraph; + FilterList := TFilterList.Create(FG); + try + for Tel := 0 to FilterList.Count -1 do + begin + FilterList[Tel].GetClassID(FClass); + if IsEqualGuid(FClass, CLSID_OverlayMixer) then + OVM := FilterList[Tel]; + if IsEqualGuid(FClass, CLSID_OverlayMixer2) then + OVM := FilterList[Tel]; + end; + + if OVM = nil then Exit; + Hr := OVM.EnumPins(EnumPins); + if Failed(Hr) then Exit; + + Tel := 0; + while (EnumPins.Next(1, Pin, @ul) = S_OK) and (ul = 1) and (Tel = 0) do + begin + Hr := Pin.QueryDirection(pd); + if Failed(Hr) then Exit; + + if pd = PINDIR_INPUT then + begin + Hr := Pin.QueryInterface(IID_IMixerPinConfig2, MPC); + if Failed(Hr) then Exit; + Inc(Tel); + end; + Pin := nil; + end; + EnumPins := nil; + + Tmp.dwSize := SizeOf(TDDCOLORCONTROL); + Tmp.dwFlags := DDCOLOR_BRIGHTNESS or DDCOLOR_CONTRAST or DDCOLOR_HUE or DDCOLOR_SATURATION or DDCOLOR_GAMMA or DDCOLOR_SHARPNESS or DDCOLOR_COLORENABLE; + Tmp.lBrightness := FBrightness; + Tmp.lContrast := FContrast; + Tmp.lHue := FHue; + Tmp.lSaturation := FSaturation; + Tmp.lSharpness := FSharpness; + Tmp.lGamma := FGamma; + Tmp.lColorEnable := integer(FUtilColor); + Tmp.dwReserved1 := 0; + + Hr := MPC.setOverlaySurfaceColorControls(Pointer(@Tmp)); + if Failed(Hr) then Exit; + finally + FilterList.Free; + FG := nil; + OVM := nil; + EnumPins := nil; + Pin := nil; + MPC := nil; + end; + end; + + procedure TColorControl.GetColorControls; + var + EnumPins : IEnumPins; + Pin : IPin; + ul : cardinal; + pd : TPinDirection; + MPC : IMixerPinConfig2; + Tel : Integer; + FG : IFilterGraph; + FilterList : TFilterList; + Hr : HResult; + OVM : IBaseFilter; + FClass : TGuid; + Tmp : TDDColorControl; + begin + if (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState) or + (TDSVideoWindowEx2(FOwner).FFilterGraph = nil) or + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = False) then Exit; + + MPC := nil; + OVM := nil; + FG := nil; + FG := TDSVideoWindowEx2(FOwner).FFilterGraph.FFilterGraph; + FilterList := TFilterList.Create(FG); + try + for Tel := 0 to FilterList.Count -1 do + begin + FilterList[Tel].GetClassID(FClass); + if IsEqualGuid(FClass, CLSID_OverlayMixer) then + OVM := FilterList[Tel]; + if IsEqualGuid(FClass, CLSID_OverlayMixer2) then + OVM := FilterList[Tel]; + end; + + if OVM = nil then Exit; + Hr := OVM.EnumPins(EnumPins); + if Failed(Hr) then Exit; + + Tel := 0; + while (EnumPins.Next(1, Pin, @ul) = S_OK) and (ul = 1) and (Tel = 0) do + begin + Hr := Pin.QueryDirection(pd); + if Failed(Hr) then Exit; + + if pd = PINDIR_INPUT then + begin + Hr := Pin.QueryInterface(IID_IMixerPinConfig2, MPC); + if Failed(Hr) then Exit; + Inc(Tel); + end; + Pin := nil; + end; + EnumPins := nil; + + ZeroMemory(@Tmp,SizeOf(TDDColorControl)); + Tmp.dwSize := SizeOf(TDDCOLORCONTROL); + + Hr := MPC.GetOverlaySurfaceColorControls(Tmp); + if Failed(Hr) then + begin + FBrightness := 750; + FContrast := 10000; + FHue := 0; + FSaturation := 10000; + FSharpness := 5; + FGamma := 1; + FUtilColor := True; + Exit; + end + else + begin + FBrightness := Tmp.lBrightness; + FContrast := Tmp.lContrast; + FHue := Tmp.lHue; + FSaturation := Tmp.lSaturation; + FSharpness := Tmp.lSharpness; + FGamma := Tmp.lGamma; + FUtilColor := Bool(Tmp.lColorEnable); + end; + finally + FilterList.Free; + FG := nil; + OVM := nil; + EnumPins := nil; + Pin := nil; + MPC := nil; + end; + end; + + procedure TColorControl.RestoreDefault; + begin + FBrightness := FDefault.lBrightness; + FContrast := FDefault.lContrast; + FHue := FDefault.lHue; + FSaturation := FDefault.lSaturation; + FSharpness := FDefault.lSharpness; + FGamma := FDefault.lGamma; + FUtilColor := Bool(FDefault.lColorEnable); + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + UpdateColorControls; + end; + + Procedure TColorControl.SetBrightness(Value : Integer); + begin + if (Value > -1) and (Value < 10001) then + begin + if Value <> FBrightness then + FBrightness := Value; + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + UpdateColorControls; + end + else + raise Exception.CreateFmt('Value %d out of range. Value must bee between 0 -> 10.000', [Value]); + end; + + Procedure TColorControl.SetContrast(Value : Integer); + begin + if (Value > -1) and (Value < 20001) then + begin + if Value <> FContrast then + FContrast := Value; + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + UpdateColorControls; + end + else + raise Exception.CreateFmt('Value %d out of range. Value must bee between 0 -> 20.000', [Value]); + end; + + procedure TColorControl.SetHue(Value : Integer); + begin + if (Value > -181) and (Value < 182) then + begin + if Value <> FHue then + FHue := Value; + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + UpdateColorControls; + end + else + raise Exception.CreateFmt('Value %d out of range. Value must bee between -180 -> 180', [Value]); + end; + + procedure TColorControl.SetSaturation(Value : Integer); + begin + if (Value > -1) and (Value < 20001) then + begin + if Value <> FSaturation then + FSaturation := Value; + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + UpdateColorControls; + end + else + raise Exception.CreateFmt('Value %d out of range. Value must bee between 0 -> 20.000', [Value]); + end; + + procedure TColorControl.SetSharpness(Value : Integer); + begin + if (Value > -1) and (Value < 11) then + begin + if Value <> FSharpness then + FSharpness := Value; + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + UpdateColorControls; + end + else + raise Exception.CreateFmt('Value %d out of range. Value must bee between 0 -> 10', [Value]); + end; + + procedure TColorControl.SetGamma(Value : Integer); + begin + if (Value > 0) and (Value < 501) then + begin + if Value <> FGamma then + FGamma := Value; + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + UpdateColorControls; + end + else + raise Exception.CreateFmt('Value %d out of range. Value must bee between 1 -> 500', [Value]); + end; + + procedure TColorControl.SetUtilColor(Value : Boolean); + begin + FUtilColor := Value; + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + UpdateColorControls; + end; + + function TColorControl.GetBrightness : Integer; + begin + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + GetColorControls; + Result := fBrightness; + end; + + function TColorControl.GetContrast : Integer; + begin + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + GetColorControls; + Result := fContrast; + end; + + function TColorControl.GetHue : Integer; + begin + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + GetColorControls; + Result := fHue; + end; + + function TColorControl.GetSaturation : Integer; + begin + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + GetColorControls; + Result := fSaturation; + end; + + function TColorControl.GetSharpness : Integer; + begin + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + GetColorControls; + Result := fSharpness; + end; + + function TColorControl.GetGamma : Integer; + begin + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + GetColorControls; + Result := fGamma; + end; + + function TColorControl.GetUtilColor : Boolean; + begin + if (not (csDesigning in TDSVideoWindowEx2(FOwner).ComponentState)) and + (TDSVideoWindowEx2(FOwner).FFilterGraph <> nil) and + (TDSVideoWindowEx2(FOwner).FFilterGraph.Active = True) then + GetColorControls; + Result := fUtilColor; + end; + + // ---------------------- DSVideoWindowEx2Capabilities ------------------- + + constructor TDSVideoWindowEx2Caps.create(AOwner: TDSVideoWindowEx2); + begin + inherited Create; + Owner := AOwner; + end; + + function TDSVideoWindowEx2Caps.GetCanOverlay : Boolean; + begin + Result := TDSVideoWindowEx2(Owner).FOverlayMixer <> nil; + end; + + function TDSVideoWindowEx2Caps.GetCanControlBrigtness : Boolean; + begin + if TDSVideoWindowEx2(Owner).FColorControl <> nil then + Result := TDSVideoWindowEx2(Owner).FColorControl.FDefault.dwFlags and DDCOLOR_BRIGHTNESS = DDCOLOR_BRIGHTNESS + else + Result := False; + end; + + function TDSVideoWindowEx2Caps.GetCanControlContrast : Boolean; + begin + if TDSVideoWindowEx2(Owner).FColorControl <> nil then + Result := TDSVideoWindowEx2(Owner).FColorControl.FDefault.dwFlags and DDCOLOR_CONTRAST = DDCOLOR_CONTRAST + else + Result := False; + end; + + function TDSVideoWindowEx2Caps.GetCanControlHue : Boolean; + begin + if TDSVideoWindowEx2(Owner).FColorControl <> nil then + Result := TDSVideoWindowEx2(Owner).FColorControl.FDefault.dwFlags and DDCOLOR_HUE = DDCOLOR_HUE + else + Result := False; + end; + + function TDSVideoWindowEx2Caps.GetCanControlSaturation : Boolean; + begin + if TDSVideoWindowEx2(Owner).FColorControl <> nil then + Result := TDSVideoWindowEx2(Owner).FColorControl.FDefault.dwFlags and DDCOLOR_SATURATION = DDCOLOR_SATURATION + else + Result := False; + end; + + function TDSVideoWindowEx2Caps.GetCanControlSharpness : Boolean; + begin + if TDSVideoWindowEx2(Owner).FColorControl <> nil then + Result := TDSVideoWindowEx2(Owner).FColorControl.FDefault.dwFlags and DDCOLOR_SHARPNESS = DDCOLOR_SHARPNESS + else + Result := False; + end; + + function TDSVideoWindowEx2Caps.GetCanControlGamma : Boolean; + begin + if TDSVideoWindowEx2(Owner).FColorControl <> nil then + Result := TDSVideoWindowEx2(Owner).FColorControl.FDefault.dwFlags and DDCOLOR_GAMMA = DDCOLOR_GAMMA + else + Result := False; + end; + + function TDSVideoWindowEx2Caps.GetCanControlUtilizedColor : Boolean; + begin + if TDSVideoWindowEx2(Owner).FColorControl <> nil then + Result := TDSVideoWindowEx2(Owner).FColorControl.FDefault.dwFlags and DDCOLOR_COLORENABLE = DDCOLOR_COLORENABLE + else + Result := False; + end; + + // ----------------------------------- Overlay Callback ------------------ + + constructor TOverlayCallBack.Create(Owner : TObject); + begin + AOwner := Owner; + end; + + function TOverlayCallback.OnUpdateOverlay(bBefore: BOOL; dwFlags: DWORD; bOldVisible: BOOL; + var prcOldSrc, prcOldDest: TRECT; bNewVisible: BOOL; var prcNewSrc, prcNewDest: TRECT): HRESULT; stdcall; + begin + Result := S_OK; + end; + + function TOverlayCallback.OnUpdateColorKey(var pKey: TCOLORKEY; dwColor: DWORD): HRESULT; stdcall; + begin + TDSVideoWindowEx2(AOwner).FColorKey := pKey.HighColorValue; + if Assigned(TDSVideoWindowEx2(AOwner).FOnColorKey) then + TDSVideoWindowEx2(AOwner).FOnColorKey(Self); + Result := S_OK; + end; + + function TOverlayCallback.OnUpdateSize(dwWidth, dwHeight, dwARWidth, dwARHeight: DWORD): HRESULT; stdcall; + begin + if (AOwner = nil) then + begin + Result := S_OK; + Exit; + end; + TDSVideoWindowEx2(AOwner).GetVideoInfo; + TDSVideoWindowEx2(AOwner).Clearback; + Result := S_OK; + end; + + // ------------------------------ DSVideoWindowEx ------------------------- + + procedure TDSVideoWindowEx2.NotifyFilter(operation: TFilterOperation; Param: integer); + var + i: integer; + EnumPins: TPinList; + pGB : IGraphBuilder; + begin + EnumPins := nil; + pGB := nil; + try + case operation of + foAdding: begin + GraphWasUpdatet := False; + CoCreateInstance(CLSID_VideoRenderer, nil, CLSCTX_INPROC_SERVER, IID_IBaseFilter ,FBaseFilter); + end; + foAdded: begin + FBaseFilter.QueryInterface(IVideoWindow, FVideoWindow); + end; + foRemoving: begin + if FOverlayMixer <> nil then + begin + FColorControl.RestoreDefault; + FBaseFilter.Stop; + EnumPins := TPinList.Create(FOverlayMixer); + if EnumPins.Count > 0 then + for i := 0 to EnumPins.Count - 1 do + EnumPins.Items[i].Disconnect; + end; + if FBaseFilter <> nil then + begin + FBaseFilter.Stop; + EnumPins := TPinList.Create(FBaseFilter); + if EnumPins.Count > 0 then + for i := 0 to EnumPins.Count - 1 do + EnumPins.Items[i].Disconnect; + end; + if FDDXM <> nil then + FDDXM.SetCallbackInterface(nil, 0); + if OverlayCallback <> nil then + OverlayCallback := nil; + end; + foRemoved : begin + GraphWasUpdatet := False; + FDDXM := nil; + FOverlayMixer := nil; + FVideoRenderer := nil; + FVideoWindow := nil; + FBaseFilter := nil; + end; + end; + finally + if EnumPins <> nil then + EnumPins.Free; + pGB := nil; + end; + end; + + procedure TDSVideoWindowEx2.GraphEvent(Event, Param1, Param2: integer); + begin + case Event of + EC_PALETTE_CHANGED : RefreshVideoWindow; + EC_CLOCK_CHANGED : begin + if GraphBuildOk then SetVideoZOrder; + SetZoom(FZoom); + SetAspectMode(FAspectMode); + if GraphBuildOk then ClearBack; + end; + + end; + end; + + function TDSVideoWindowEx2.GetName: string; + begin + result := name; + end; + + procedure TDSVideoWindowEx2.ControlEvent(Event: TControlEvent; Param: integer = 0); + var + FilterInfo: TFilterInfo; + FilterList: TFilterList; + i: integer; + GUID: TGUID; + TmpName : WideString; + begin + FilterList := nil; + try + case Event of + ceDVDRendered: begin // mean our Video Filter have been removed + ZeroMemory(@FilterInfo, SizeOf(TFilterInfo)); + FBaseFilter.QueryFilterInfo(FilterInfo); + if not assigned(FilterInfo.pGraph) then + begin + FilterList:= TFilterList.Create(FilterGraph.FFilterGraph); + if FilterList.Count > 0 then + for i := 0 to FilterList.Count - 1 do + begin + FilterList.Items[i].GetClassID(GUID); + if ISEqualGUID(GUID, CLSID_VideoRenderer) then + begin + FOverlayMixer := nil; + FBaseFilter := nil; + FVideoWindow := nil; + FVideoRenderer := nil; + FBaseFilter := FilterList.Items[i]; + FBaseFilter.QueryInterface(IVideoWindow, FVideoWindow); + GraphBuildOk := Succeeded(UpdateGraph); + if GraphBuildOk then + begin + FColorControl.ReadDefault; // Read the Colorcontrols settings of the OverlayMixer. + FColorControl.UpdateColorControls; // Apply our settings to the ColorControls. + end; + RefreshVideoWindow; + break; + end + else + if ISEqualGUID(GUID, CLSID_VideoMixingRenderer) then + begin + FOverlayMixer := nil; + FBaseFilter := nil; + FVideoRenderer := nil; + TmpName := Name; + if FVideoWindow <> nil then + FilterGraph.FFilterGraph.AddFilter(FVideoWindow as IBaseFilter, PWideChar(TmpName)); + FBaseFilter := FVideoWindow as IBaseFilter; + GraphBuildOk := Succeeded(UpdateGraph); + if GraphBuildOk then + begin + FColorControl.ReadDefault; // Read the Colorcontrols settings of the OverlayMixer. + FColorControl.UpdateColorControls; // Apply our settings to the ColorControls. + end; + RefreshVideoWindow; + break; + end; + end; + end; + end; + cePlay: begin + if not GraphWasUpdatet then + begin + GraphBuildOk := Succeeded(UpdateGraph); + if GraphBuildOk then + begin + FColorControl.ReadDefault; // Read the Colorcontrols settings of the OverlayMixer. + FColorControl.UpdateColorControls; // Apply our settings to the ColorControls. + end; + RefreshVideoWindow; + end; + if GraphBuildOk then + begin + if (not FOverlayVisible) and (not FDesktopPlay) then + begin + FOverlayVisible := True; + if Assigned(FOnOverlay) then + FOnOverlay(Self, True); + Clearback; + end; + end; + end; + cePause: begin + if not GraphWasUpdatet then + begin + GraphBuildOk := Succeeded(UpdateGraph); + if GraphBuildOk then + begin + FColorControl.ReadDefault; // Read the Colorcontrols settings of the OverlayMixer. + FColorControl.UpdateColorControls; // Apply our settings to the ColorControls. + end; + RefreshVideoWindow; + end; + if GraphBuildOk then + if (not FOverlayVisible) and (not FDesktopPlay) then + begin + FOverlayVisible := True; + if Assigned(FOnOverlay) then + FOnOverlay(Self, True); + Clearback; + end; + end; + ceStop: begin + if not GraphWasUpdatet then + begin + GraphBuildOk := Succeeded(UpdateGraph); + if GraphBuildOk then + begin + FColorControl.ReadDefault; // Read the Colorcontrols settings of the OverlayMixer. + FColorControl.UpdateColorControls; // Apply our settings to the ColorControls. + end; + RefreshVideoWindow; + end; + if GraphBuildOk then + if FOverlayVisible then + begin + FOverlayVisible := False; + Clearback; + if Assigned(FOnOverlay) then + FOnOverlay(Self, False); + end; + end; + ceFileRendered: begin + GraphBuildOk := Succeeded(UpdateGraph); + if GraphBuildOk then + begin + FColorControl.ReadDefault; // Read the Colorcontrols settings of the OverlayMixer. + FColorControl.UpdateColorControls; // Apply our settings to the ColorControls. + end; + RefreshVideoWindow; + end; + end; + finally + if FilterList <> nil then + FilterList.Free; + end; + end; + + procedure TDSVideoWindowEx2.RefreshVideoWindow; + begin + if FVideoWindow <> nil then + with FVideoWindow do + begin + if FIsVideoWindowOwner then + put_Owner(Handle) + else + put_Owner(Parent.Handle); + put_WindowStyle(FWindowStyle or WS_CHILD or WS_CLIPSIBLINGS); + put_WindowStyleEx(FWindowStyleEx); + if FIsVideoWindowOwner then + FVideoWindow.SetWindowPosition(0, 0, Width, Height) + else + FVideoWindow.SetWindowPosition(Left, Top, Width, Height); + if Name <> '' then + put_Caption(Name); + put_MessageDrain(Handle); + Application.ProcessMessages; + put_AutoShow(not FDesktopPlay); + end; + end; + + function TDSVideoWindowEx2.GetFilter: IBaseFilter; + begin + result := FBaseFilter; + end; + + constructor TDSVideoWindowEx2.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents, + csDoubleClicks, csReflector]; + TabStop := true; + Height := 240; + Width := 320; + color := $000000; + FColorKey := $100010; //clNone; + FFullScreen := false; + FColorControl := TColorControl.create(Self); + FCaps := TDSVideoWindowEx2Caps.Create(Self); + AspectRatio := rmLetterBox; + DigitalZoom := 0; + GraphBuildOK := False; + FNoScreenSaver := False; + FIdleCursor := 0; + if (csDesigning in componentstate) then Exit; + FFullScreenControl := TForm.Create(nil); + FFullScreenControl.Color := Color; + FFullScreenControl.DefaultMonitor := dmDesktop; + FFullScreenControl.BorderStyle := bsNone; + FFullScreenControl.OnCloseQuery := FullScreenCloseQuery; + FOldParent := nil; + FMonitor := nil; + FVideoWindowHandle := 0; + GraphWasUpdatet := False; + Application.OnIdle := MyIdleHandler; + end; + + destructor TDSVideoWindowEx2.Destroy; + begin + if DesktopPlayback then + NormalPlayback; + + if FDDXM <> nil then + FDDXM.SetCallbackInterface(nil, 0); + OverlayCallback := nil; + FOverlayMixer := nil; + FFilterGraph := nil; + FVideoWindow := nil; + FVideoRenderer := nil; + FCaps.Free; + FColorControl.Free; + inherited Destroy; + end; + + procedure TDSVideoWindowEx2.resize; + begin + if (FVideoWindow <> nil) and (not FFullScreen) and (not DesktopPlayback) then + if FIsVideoWindowOwner then + FVideoWindow.SetWindowPosition(0, 0, Width, Height) + else + FVideoWindow.SetWindowPosition(Left, Top, Width, Height); + end; + + procedure TDSVideoWindowEx2.Loaded; + begin + inherited Loaded; + FWindowStyle := GetWindowLong(Handle, GWL_STYLE); + FWindowStyleEx := GetWindowLong(Handle, GWL_EXSTYLE); + end; + + procedure TDSVideoWindowEx2.Notification(AComponent: TComponent; + Operation: TOperation); + begin + inherited Notification(AComponent, Operation); + if ((AComponent = FFilterGraph) and (Operation = opRemove)) then + FFilterGraph := nil; + end; + + procedure TDSVideoWindowEx2.SetFilterGraph(AFilterGraph: TFilterGraph); + begin + if AFilterGraph = FFilterGraph then exit; + if FFilterGraph <> nil then + begin + FFilterGraph.RemoveFilter(self); + FFilterGraph.RemoveEventNotifier(self); + end; + if AFilterGraph <> nil then + begin + AFilterGraph.InsertFilter(self); + AFilterGraph.InsertEventNotifier(self); + end; + FFilterGraph := AFilterGraph; + end; + + procedure TDSVideoWindowEx2.SetTopMost(TopMost: boolean); + begin + FTopMost := TopMost; + end; + + procedure TDSVideoWindowEx2.SetVideoZOrder; + var + input : IPin; + enum : IEnumPins; + ColorKey : TColorKey; + dwColorKey : DWord; + MPC : IMixerPinConfig; + begin + if not GraphBuildOK then Exit; + try + ColorKey.KeyType := CK_INDEX or CK_RGB; + ColorKey.PaletteIndex := 0; + ColorKey.LowColorValue := $000F000F; + ColorKey.HighColorValue := $000F000F; + + FVideoWindowHandle := findWindowEx(Parent.handle, 0, 'VideoRenderer', pchar(name)); + if FVideoWindowHandle = 0 then + FVideoWindowHandle := findWindowEx(0, 0, 'VideoRenderer', pchar(name)); + if FVideoWindowHandle = 0 then Exit; + SetWindowPos(FVideoWindowHandle, Handle, 0, 0, 0, 0, SWP_SHOWWINDOW or SWP_NOSIZE or SWP_NOMOVE or SWP_NOCOPYBITS or SWP_NOACTIVATE); + if (FVideoWindowHandle <> 0) then + begin + FOverlayMixer.EnumPins(Enum); + Enum.Next(1, Input, nil); + + if Succeeded(Input.QueryInterface(IID_IMixerPinConfig2, MPC)) then + begin + MPC.GetColorKey(ColorKey, dwColorKey); + FColorKey := ColorKey.HighColorValue; + if Assigned(FOnColorKey) then + FOnColorKey(Self); + end; + end; + finally + Input := nil; + Enum := nil; + MPC := nil; + end; + end; + + function TDSVideoWindowEx2.QueryInterface(const IID: TGUID; out Obj): HResult; + begin + result := inherited QueryInterface(IID, Obj); + if failed(result) and assigned(FBaseFilter) then + result := FBaseFilter.QueryInterface(IID, Obj); + end; + + function TDSVideoWindowEx2.UpdateGraph : HResult; + Type + TConnectAction = (caConnect, caDisConnect); + + PConnection = ^TConnection; + TConnection = record + FromPin : IPin; + ToPin : IPin; + Action : TConnectAction; + end; + + var + FilterList : TFilterList; + VMRPinList : TPinList; + OVMPinList : TPinList; + TmpPinList : TPinList; + OrigConnections : TList; + TmpVMRPinList : TPinList; + Connection : pConnection; + + i, a: integer; + GUID: TGUID; + pGB : IGraphBuilder; + VRInputPin, + VRConnectedToPin : IPin; + OVMInputPin : IPin; + OVMOutputPin : IPIN; + Pin : IPin; + pEnumPins : IEnumPins; + ul : cardinal; + pd : TPinDirection; + PinInfo : TPinInfo; + Hr : HResult; + VMR : IBaseFilter; + Line21Dec, + Line21Dec2 : IBaseFilter; + OVMInConected : Boolean; + OVMOutConected : Boolean; + Found : Boolean; + label + FailedSoReconnect, Cleanup, SetDrawExclMode; + begin + // Check if we are using Overlay. + FOverlayMixer := nil; + FVideoRenderer := nil; + VMR := nil; + Line21Dec := nil; + Line21Dec2 := nil; + + GraphWasUpdatet := True; + OrigConnections := TList.Create; + FilterList:= TFilterList.Create(FilterGraph.FFilterGraph); + if FilterList.Count > 0 then + for i := 0 to FilterList.Count - 1 do + begin + FilterList.Items[i].GetClassID(GUID); + if ISEqualGUID(GUID, CLSID_OverlayMixer) then + FOverlayMixer := FilterList.Items[i]; + if ISEqualGUID(GUID, CLSID_VideoMixingRenderer) then + VMR := FilterList.Items[i]; + if ISEqualGUID(GUID, CLSID_VideoRenderer) then + FVideoRenderer := FilterList.Items[i]; + end; + + // The Graph holds no overlay mixer filter, Let's add one. + Result := FFilterGraph.QueryInterface(IID_IGraphBuilder, pGB); + if Failed(Result) then + begin + Goto Cleanup; + end; + + if FOverlayMixer <> nil then + begin + // Check if The Overlay Mixer that already exists is connected + // correct to out VideoWindow + OVMInConected := False; + OVMOutConected := False; + OVMPinList := TPinList.Create(FOverlayMixer); + for i := 0 To OVMPinList.Count -1 do + begin + OVMPinList.Items[i].QueryDirection(pd); + if pd = PINDIR_OUTPUT then + begin + if Succeeded(OVMPinlist.Items[i].ConnectedTo(Pin)) then + begin + Pin.QueryPinInfo(PinInfo); + if PinInfo.pFilter = FVideoRenderer then + OVMOutConected := True; + end; + end + else + begin + if Succeeded(OVMPinlist.Items[i].ConnectedTo(Pin)) then + OVMInConected := True; + end; + end; + if (not OVMOutConected) or (not OVMInConected) then + begin + Result := E_FAIL; + Goto Cleanup; + end + else + begin + // Everything looks okay stop here. + OVMPinList.Free; + Goto SetDrawExclMode; + end; + end; + + Result := CoCreateInstance(CLSID_OverlayMixer, nil, CLSCTX_INPROC, IID_IBaseFilter, FOverlayMixer); + if Failed(Result) then goto Cleanup; + + Result := pGB.AddFilter(fOverlayMixer, 'Overlay Mixer'); + if Failed(Result) then goto Cleanup; + + if FVideoRenderer = nil then + begin + Result := E_Fail; + Goto Cleanup; + end; + + Result := FVideoRenderer.EnumPins(pEnumPins); + if Failed(Result) then goto Cleanup; + + Result := pEnumPins.Next(1, VRInputPin, @ul); + if Failed(Result) then goto Cleanup; + + Result := VRInputPin.QueryDirection(pd); + if (Failed(Result)) or (PD <> PINDIR_INPUT) then goto Cleanup; + + if VMR <> nil then + begin + // The Graph Uses the new VideoMixerRenderer let's try to connect + // all filter connected to the VideoMixerRenderer to the Overlay + // Mixer filter instead. + VMRPinList := TPinList.Create(VMR); + OVMPinList := TPinList.Create(FOverlayMixer); + TmpVMRPinList := TPinList.Create; + + I := 0; + while (i < VMRPinList.Count) and (Succeeded(VMRPinList.Items[i].ConnectedTo(Pin))) do + begin + // Let's find the first Input Pin on the overlay mixer not + // connected to anything. + + Result := Pin.Disconnect; + if Failed(Result) then goto FailedSoReconnect; + + Result := VMRPinList.Items[i].Disconnect; + if Failed(Result) then goto FailedSoReconnect; + + New(Connection); + Connection^.FromPin := VMRPinList.Items[i]; + Connection^.ToPin := Pin; + Connection^.Action := caDisconnect; + OrigConnections.Add(Connection); + + TmpVMRPinList.Add(Pin); + VMRPinList.Update; + Inc(i); + end; + + i := 0; + Repeat + Pin := TmpVMRPinList[i]; + a := 0; + Found := False; + Repeat + OVMPinList.Items[a].QueryDirection(pd); + if pd = PINDIR_INPUT then + begin + OVMInputPin := OVMPinList.Items[a]; + if Failed(OVMPinList.Items[a].ConnectedTo(OVMOutputPin)) then + begin + Found := True; + end; + end; + OVMPinList.Update; + inc(a); + until (a >= OVMPinList.count) or (Found); + if not Found then + begin + VMRPinList.Free; + OVMPinList.Free; + Result := E_Fail; + goto FailedSoReconnect; + end; + + // Before connecting we need to check if the filter we ar working on is a Line21 Decoder2 + // And the exchange it with a Line21 Decoder because The Overlay Mixer Filter cannot connect + // with a Line21 Decoder2 + Pin.QueryPinInfo(PinInfo); + PinInfo.pFilter.GetClassID(GUID); + + if ISEqualGUID(GUID, CLSID_Line21Decoder2) then + begin + Line21Dec2 := PinInfo.pFilter; + + TmpPinList := TPinList.Create(Line21Dec2); + Result := TmpPinList.Items[0].ConnectedTo(Pin); + if Failed(Result) then goto FailedSoReconnect; + + Result := TmpPinList.Items[0].Disconnect; + if Failed(Result) then goto FailedSoReconnect; + + Result := Pin.Disconnect; + if Failed(Result) then goto FailedSoReconnect; + + New(Connection); + Connection^.FromPin := Pin; + Connection^.ToPin := TmpPinList.Items[0]; + Connection^.Action := caDisconnect; + OrigConnections.Add(Connection); + TmpPinList.Free; + + Result := CoCreateInstance(CLSID_Line21Decoder, nil, CLSCTX_INPROC, IID_IBaseFilter, Line21Dec); + if Failed(Result) then goto Cleanup; + + Result := FilterGraph.FFilterGraph.AddFilter(Line21Dec, 'Line21 Decoder'); + if Failed(Result) then goto Cleanup; + + TmpPinList := TPinList.Create(Line21Dec); + + Result := FilterGraph.FFilterGraph.Connect(Pin, TmpPinList.Items[0]); + if Failed(Result) then goto Cleanup; + + New(Connection); + Connection^.FromPin := Pin; + Connection^.ToPin := TmpPinList.Items[0]; + Connection^.Action := caConnect; + OrigConnections.Add(Connection); + + Pin := TmpPinList.Items[1]; + TmpPinList.Free; + + Result := pGB.Connect(Pin, OVMInputPin); + if Failed(Result) then + begin + VMRPinList.Free; + OVMPinList.Free; + Goto Failedsoreconnect; + end; + + New(Connection); + Connection^.FromPin := Pin; + Connection^.ToPin := OVMInputPin; + Connection^.Action := caConnect; + OrigConnections.Add(Connection); + end + else + begin + Result := pGB.Connect(Pin, OVMInputPin); + if Failed(Result) then + begin + VMRPinList.Free; + OVMPinList.Free; + Goto Failedsoreconnect; + end; + + New(Connection); + Connection^.FromPin := Pin; + Connection^.ToPin := OVMInputPin; + Connection^.Action := caConnect; + OrigConnections.Add(Connection); + end; + + OVMPinList.Update; + inc(i); + until I >= TmpVMRPinList.Count; + + VMRPinList.Free; + OVMPinList.Free; + TmpVMRPinList.Free; + end + else + begin + Result := VRInputPin.ConnectedTo(VRConnectedToPin); + if Failed(Result) then goto FailedSoReconnect; + + Result := VRInputPin.Disconnect; + if Failed(Result) then goto FailedSoReconnect; + + Result := VRConnectedToPin.Disconnect; + if Failed(Result) then goto FailedSoReconnect; + + New(Connection); + Connection^.FromPin := VRInputPin; + Connection^.ToPin := VRConnectedToPin; + Connection^.Action := caDisconnect; + OrigConnections.Add(Connection); + + OVMPinList := TPinList.Create(FOverlayMixer); + a := 0; + Found := False; + Repeat + OVMPinList.Items[a].QueryDirection(pd); + if pd = PINDIR_INPUT then + begin + OVMInputPin := OVMPinList.Items[a]; + if Failed(OVMPinList.Items[a].ConnectedTo(Pin)) then + Found := True; + end; + inc(a); + until (a >= OVMPinList.count) or (Found); + if not Found then + begin + OVMPinList.Free; + Result := E_Fail; + Goto Cleanup; + end; + + result := pGB.Connect(VRConnectedToPin, OVMInputPin); + if Failed(Result) then + begin + OVMPinList.Free; + Goto FailedSoReconnect; + end; + + New(Connection); + Connection^.FromPin := VRConnectedToPin; + Connection^.ToPin := OVMInputPin; + Connection^.Action := caConnect; + OrigConnections.Add(Connection); + + OVMPinList.Free; + end; + + Result := FOverlayMixer.FindPin('Output', OVMOutputPin); + if Failed(Result) then goto FailedSoReconnect; + + Result := pGB.Connect(OVMOutputPin, VRInputPin); + if Failed(Result) then goto FailedSoReconnect; + + New(Connection); + Connection^.FromPin := OVMOutputPin; + Connection^.ToPin := VRInputPin; + Connection^.Action := caConnect; + OrigConnections.Add(Connection); + + SetDrawExclMode: + + Result := FOverlayMixer.QueryInterface(IID_IDDrawExclModeVideo, FDDXM); + if Failed(Result) then goto FailedSoReconnect; + + OverlayCallback := TOverlayCallback.Create(Self); + + Result := FDDXM.SetCallbackInterface(OverlayCallBack, 0); + if Failed(Result) then goto FailedSoReconnect; + + if Line21Dec2 <> nil then + filtergraph.FFilterGraph.RemoveFilter(Line21Dec2); + + if VMR <> nil then + filtergraph.FFilterGraph.RemoveFilter(VMR); + + Goto Cleanup; + + FailedSoReconnect: + for i := OrigConnections.Count -1 downto 0 do + begin + Connection := OrigConnections[i]; + Case Connection^.Action of + caConnect : begin + Connection^.FromPin.Disconnect; + Connection^.ToPin.Disconnect; + end; + caDisconnect : begin + pGB.Connect(Connection^.FromPin, Connection^.ToPin); + end; + end; + end; + + if Line21Dec <> nil then + FilterGraph.FFilterGraph.RemoveFilter(Line21Dec); + + Hr := pGB.RemoveFilter(FOverlayMixer); + if Failed(Hr) then + begin + Result := Hr; + Goto CleanUp; + end; + + FOverlayMixer := nil; + + if VMR <> nil then + begin + pGB.RemoveFilter((FVideoWindow as IBaseFilter)); + FVideoWindow := nil; + FVideoRenderer := VMR; + FVideoWindow := (VMR as IVIdeoWindow); + end; + + Cleanup: + for i := 0 to OrigConnections.Count -1 do + begin + Connection := OrigConnections[i]; + Connection^.FromPin := nil; + Connection^.ToPin := nil; + end; + + VMR := nil; + pEnumPins := nil; + OVMInputpin := nil; + OVMOutputPin := nil; + VRInputPin := nil; + VRConnectedToPin := nil; + Line21Dec := nil; + Line21Dec2 := nil; + OrigConnections.Free; + FilterList.Free; + end; + + procedure TDSVideoWindowEx2.WndProc(var Message: TMessage); + begin + if (csDesigning in ComponentState) then + begin + inherited WndProc(Message); + Exit; + end; + + if ((Message.Msg = WM_CONTEXTMENU) and FullScreen) then + begin + if assigned(PopupMenu) then + if PopupMenu.AutoPopup then + begin + PopupMenu.Popup(mouse.CursorPos.X, mouse.CursorPos.Y); + Message.Result := 1; + end; + + inherited WndProc(Message); + Exit; + end; + + if (Message.Msg = WM_ERASEBKGND) and (GraphBuildOk) then + begin + Message.Result := -1; + Exit; + end; + + if FNoScreenSaver then + if (Message.Msg = SC_SCREENSAVE) or (Message.Msg = SC_MONITORPOWER) then + begin + Message.Result := 0; + Exit; + end; + + inherited WndProc(Message); + end; + + procedure TDSVideoWindowEx2.ClearBack; + var + DC, MemDC: HDC; + MemBitmap, OldBitmap: HBITMAP; + BackBrush, OverlayBrush : HBrush; + begin + BackBrush := 0; + OverlayBrush := 0; + if (csDestroying in componentstate) then exit; + DC := GetDC(0); + MemBitmap := CreateCompatibleBitmap(DC, ClientRect.Right, ClientRect.Bottom); + ReleaseDC(0, DC); + MemDC := CreateCompatibleDC(0); + OldBitmap := SelectObject(MemDC, MemBitmap); + try + DC := GetDC(Handle); + BackBrush := CreateSolidBrush(Color); + FillRect(MemDC, Rect(0,0, ClientRect.Right, ClientRect.Bottom), BackBrush); + if not (csDesigning in ComponentState) then + begin + if Succeeded(GetVideoInfo) and (FOverlayVisible) then + begin + OverlayBrush := CreateSolidBrush(FColorKey); + FillRect(MemDC, FVideoRect, OverlayBrush); + end; + end; + BitBlt(DC, 0, 0, Self.ClientRect.Right, Self.ClientRect.Bottom, MemDC, 0, 0, SRCCOPY); + finally + SelectObject(MemDC, OldBitmap); + DeleteDC(MemDC); + DeleteObject(MemBitmap); + DeleteObject(BackBrush); + DeleteObject(OverlayBrush); + ReleaseDC(Handle, DC); + end; + if Assigned(FOnPaint) then FOnPaint(self); + end; + + procedure TDSVideoWindowEx2.Paint; + begin + inherited Paint; + clearback; + end; + + function TDSVideoWindowEx2.GetVideoInfo : HResult; + Var + BasicVideo : IBasicVideo2; + AspX, AspY : DWord; + VideoWidth, VideoHeight : DWord; + begin + Result := E_Fail; + if (FVideoWindow = nil) or (FBaseFilter = nil) or (FDDXM = nil) or + (FVideoRenderer = nil) or (FOverlayMixer = nil) then Exit; + + try + if FAspectMode = rmLetterbox then + begin + FDDXM.GetNativeVideoProps(VideoWidth, VideoHeight, AspX, AspY); + FVideoRect := StretchRect(ClientRect, Rect(0,0, AspX, AspY)); + end + else + FVideoRect := ClientRect; + Result := S_OK; + finally + BasicVideo := nil; + end; + end; + + Procedure TDSVideoWindowEx2.StartDesktopPlayback; + type + TMonitorDefaultTo = (mdNearest, mdNull, mdPrimary); + const + MonitorDefaultFlags: array[TMonitorDefaultTo] of DWORD = (MONITOR_DEFAULTTONEAREST, + MONITOR_DEFAULTTONULL, + MONITOR_DEFAULTTOPRIMARY); + function FindMonitor(Handle: HMONITOR): TMonitor; + var + I: Integer; + begin + Result := nil; + for I := 0 to Screen.MonitorCount - 1 do + if HMonitor(Screen.Monitors[I].Handle) = HMonitor(Handle) then + begin + Result := Screen.Monitors[I]; + break; + end; + end; + + function MonitorFromWindow(const Handle: THandle; + MonitorDefault: TMonitorDefaultTo = mdNearest): TMonitor; + begin + Result := FindMonitor(MultiMon.MonitorFromWindow(Handle, + MonitorDefaultFlags[MonitorDefault])); + end; + begin + StartDesktopPlayback(MonitorfromWindow(Self.Handle)); + end; + + procedure TDSVideoWindowEx2.StartDesktopPlayBack(OnMonitor : TMonitor); + + procedure SetWallpaper(sWallpaperBMPPath : String); + var + reg : TRegistry; + begin + reg := TRegistry.Create; + with reg do + begin + RootKey := HKEY_CURRENT_USER; + if KeyExists('\Control Panel\Desktop') then + if OpenKey('\Control Panel\Desktop', False) then + begin + if ValueExists('WallPaper') then + WriteString('WallPaper', sWallpaperBMPPath); + end; + end; + reg.Free; + SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, nil, SPIF_SENDWININICHANGE ); + end; + + function GetWallpaper : String; + var + reg : TRegistry; + begin + Result := ''; + reg := TRegistry.Create; + with reg do + begin + RootKey := HKEY_CURRENT_USER; + if KeyExists('\Control Panel\Desktop') then + if OpenKey('\Control Panel\Desktop', False) then + begin + if ValueExists('WallPaper') then + Result := ReadString('Wallpaper'); + end; + end; + reg.Free; + end; + var + ColorIndex : Integer; + Color : Longint; + begin + if DesktopPlayback then Exit; + + FMonitor := OnMonitor; + OldDesktopPic := GetWallpaper; + ColorIndex:=COLOR_DESKTOP; + OldDesktopColor := GetSysColor(ColorIndex); + + SetWallPaper(''); + Color := ColorTorgb(FColorKey); + SetSysColors(1, ColorIndex, Color); + + if FullScreen then + NormalPlayback; + + FOldParent := Parent; + + Parent := FFullScreenControl; + + FFullScreenControl.BoundsRect := rect(OnMonitor.Left, + OnMonitor.Top, + OnMonitor.Left + OnMonitor.Width, + OnMonitor.Top + OnMonitor.Height); + + FFullScreenControl.Show; + + FDesktopPlay := True; + + RefreshVideoWindow; + if GraphBuildOk then SetVideoZOrder; + + FFullScreenControl.Hide; + FOverlayVisible := False; + ClearBack; + if Assigned(FOnOverlay) then + FOnOverlay(Self, False); + end; + + procedure TDSVideoWindowEx2.NormalPlayback; + + procedure SetWallpaper(sWallpaperBMPPath : String); + var + reg : TRegistry; + begin + reg := TRegistry.Create; + with reg do + begin + RootKey := HKEY_CURRENT_USER; + if KeyExists('\Control Panel\Desktop') then + if OpenKey('\Control Panel\Desktop', False) then + begin + if ValueExists('WallPaper') then + WriteString('WallPaper', sWallpaperBMPPath); + end; + end; + reg.Free; + SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, nil, SPIF_SENDWININICHANGE ); + end; + + var + ColorIndex : Integer; + begin + if DesktopPlayback then + begin + ColorIndex := COLOR_DESKTOP; + + SetWallPaper(OldDesktopPic); + SetSysColors(1, ColorIndex, OldDesktopColor); + + FDesktopPlay := False; + if (csDestroying in componentstate) then exit; + end; + + if FoldParent <> nil then + Parent := FOldParent; + + if FullScreen then + begin + FFullScreenControl.Hide; + FFullScreenControl.Invalidate; + FFullScreen := False; + end; + RefreshVideoWindow; + if GraphBuildOk then SetVideoZOrder; + FOverlayVisible := True; + ClearBack; + if Assigned(FOnOverlay) then + FOnOverlay(Self, True); + FMonitor := nil; + end; + + procedure TDSVideoWindowEx2.StartFullScreen; + type + TMonitorDefaultTo = (mdNearest, mdNull, mdPrimary); + const + MonitorDefaultFlags: array[TMonitorDefaultTo] of DWORD = (MONITOR_DEFAULTTONEAREST, + MONITOR_DEFAULTTONULL, + MONITOR_DEFAULTTOPRIMARY); + function FindMonitor(Handle: HMONITOR): TMonitor; + var + I: Integer; + begin + Result := nil; + for I := 0 to Screen.MonitorCount - 1 do + if HMonitor(Screen.Monitors[I].Handle) = HMonitor(Handle) then + begin + Result := Screen.Monitors[I]; + break; + end; + end; + + function MonitorFromWindow(const Handle: THandle; + MonitorDefault: TMonitorDefaultTo = mdNearest): TMonitor; + begin + Result := FindMonitor(MultiMon.MonitorFromWindow(Handle, + MonitorDefaultFlags[MonitorDefault])); + end; + begin + StartFullScreen(MonitorfromWindow(Self.Handle)); + end; + + procedure TDSVideoWindowEx2.StartFullScreen(OnMonitor : TMonitor); + begin + if FFullscreen then Exit; + + if DesktopPlayback then + NormalPlayback; + + FMonitor := OnMonitor; + FOldParent := Parent; + + Parent := FFullScreenControl; + + FFullScreenControl.BoundsRect := rect(OnMonitor.Left, + OnMonitor.Top, + OnMonitor.Left + OnMonitor.Width, + OnMonitor.Top + OnMonitor.Height); + + if FTopMost then + FFullScreenControl.FormStyle := fsStayOnTop + Else + FFullScreenControl.FormStyle := fsNormal; + + FFullScreenControl.Show; + + FFullScreen := True; + + RefreshVideoWindow; + if GraphBuildOk then SetVideoZOrder; + end; + + procedure TDSVideoWindowEx2.FullScreenCloseQuery(Sender: TObject; var CanClose: Boolean); + begin + if csDestroying in componentstate then + begin + NormalPlayback; + CanClose := True; + end + else + CanClose := False; + end; + + procedure TDSVideoWindowEx2.SetZoom(Value : Integer); + var + Ratio : Real; + TmpX, TmpY : Real; + TmpLeft, TmpTop : Real; + BasicVideo2 : IBasicVideo2; + SLeft, STop, SWidth, SHeight : Integer; + begin + // Set DigitalZoom + if (Value < 0) or (Value > 99) then + begin + raise Exception.CreateFmt('Value %d out of range. Value must bee between 0 -> 99', [Value]); + Exit; + end; + + if (csDesigning in ComponentState) or (FVideoRenderer = nil) then + begin + FZoom := Value; + Exit; + end; + + BasicVideo2 := nil; + try + if (FVideoRenderer.QueryInterface(IID_IBasicVideo2, BasicVideo2) = S_OK) then + begin + BasicVideo2.SetDefaultSourcePosition; + BasicVideo2.get_SourceLeft(SLeft); + BasicVideo2.get_SourceTop(STop); + BasicVideo2.get_SourceWidth(SWidth); + BasicVideo2.get_SourceHeight(SHeight); + + Ratio := SHeight / SWidth; + + TmpX := SWidth - ((Value * Swidth) / 100); + TmpY := TmpX * Ratio; + + TmpLeft := (SWidth - TmpX) / 2; + TmpTop := (SHeight - TmpY) / 2; + + BasicVideo2.put_SourceWidth(Trunc(TmpX)); + BasicVideo2.put_SourceHeight(Trunc(TmpY)); + BasicVideo2.put_SourceLeft(Trunc(TmpLeft)); + BasicVideo2.put_SourceTop(Trunc(TmpTop)); + end; + FZoom := Value; + finally + BasicVideo2 := nil; + end; + end; + + procedure TDSVideoWindowEx2.SetAspectMode(Value : TRatioModes); + var + input : IPin; + enum : IEnumPins; + pMPC : IMixerPinConfig2; + begin + if (csDesigning in ComponentState) or (FVideoRenderer = nil) or (FOverlayMixer = nil) then + begin + FAspectMode := Value; + Exit; + end; + + try + FOverlayMixer.EnumPins(Enum); + Enum.Next(1, Input, nil); + + if Succeeded(Input.QueryInterface(IID_IMixerPinConfig2, pMPC)) then + if Succeeded(pMPC.SetAspectRatioMode(TAMAspectRatioMode(integer(Value)))) then + FAspectMode := Value; + finally + input := nil; + enum := nil; + pMPC := nil; + end; + if (GraphBuildOk) and (not FDesktopPlay) then Clearback; + end; + + procedure TDSVideoWindowEx2.MouseDown(Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + Var + MPos : TPoint; + begin + if Ffullscreen then + MPos := Point(mouse.CursorPos.X, mouse.CursorPos.Y) + else + MPos := Point(X, Y); + + if FVideoWindow <> nil then + begin + if GraphBuildOK then + begin + if Self.Cursor = crnone then + begin + Self.Cursor := RememberCursor; + LMousePos.X := MPos.X; + LMousePos.Y := MPos.Y; + LCursorMov := GetTickCount; + if Assigned(FOnCursorVisible) then + FOnCursorVisible(Self, True); + end; + end + else + begin + FVideoWindow.IsCursorHidden(IsHidden); + if IsHidden then + begin + FVideoWindow.HideCursor(False); + LMousePos.X := MPos.X; + LMousePos.Y := MPos.Y; + LCursorMov := GetTickCount; + IsHidden := False; + if Assigned(FOnCursorVisible) then + FOnCursorVisible(Self, True); + end; + end; + end; + + inherited MouseDown(Button, Shift, MPos.X, MPos.Y); + end; + + procedure TDSVideoWindowEx2.MouseMove(Shift: TShiftState; X, Y: Integer); + var + MPos : TPoint; + begin + if Ffullscreen then + MPos := Point(mouse.CursorPos.X, mouse.CursorPos.Y) + else + MPos := Point(X, Y); + + if (LMousePos.X <> MPos.X) or (LMousePos.Y <> MPos.Y) then + begin + LMousePos.X := MPos.X; + LMousePos.Y := MPos.Y; + LCursorMov := GetTickCount; + if FVideoWindow <> nil then + begin + if GraphBuildOk then + begin + if Self.Cursor = crnone then + begin + Self.Cursor := RememberCursor; + if Assigned(FOnCursorVisible) then + FOnCursorVisible(Self, True); + end; + end + else + begin + FVideoWindow.IsCursorHidden(IsHidden); + if IsHidden then + begin + FVideoWindow.HideCursor(False); + IsHidden := False; + if Assigned(FOnCursorVisible) then + FOnCursorVisible(Self, True); + end; + end; + end; + end; + + inherited MouseMove(Shift, MPos.X, MPos.Y); + end; + + procedure TDSVideoWindowEx2.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + var + MPos : TPoint; + begin + if Ffullscreen then + MPos := Point(mouse.CursorPos.X, mouse.CursorPos.Y) + else + MPos := Point(X, Y); + + if FVideoWindow <> nil then + begin + if GraphBuildOK then + begin + if Self.Cursor = crnone then + begin + Self.Cursor := RememberCursor; + LMousePos.X := MPos.X; + LMousePos.Y := MPos.Y; + LCursorMov := GetTickCount; + if Assigned(FOnCursorVisible) then + FOnCursorVisible(Self, True); + end; + end + else + begin + FVideoWindow.IsCursorHidden(IsHidden); + if IsHidden then + begin + FVideoWindow.HideCursor(False); + LMousePos.X := MPos.X; + LMousePos.Y := MPos.Y; + LCursorMov := GetTickCount; + IsHidden := False; + if Assigned(FOnCursorVisible) then + FOnCursorVisible(Self, True); + end; + end; + end; + inherited MouseUp(Button, Shift, MPos.X, MPos.Y); + end; + + procedure TDSVideoWindowEx2.MyIdleHandler(Sender: TObject; var Done: Boolean); + var + pt : TPoint; + begin + Done := True; + if (FIdleCursor = 0) or (csDesigning in ComponentState) then exit; + if (GetTickCount - LCursorMov >= Cardinal(FIdleCursor)) and (FVideoWindow <> nil) then + begin + if GraphBuildOK then + begin + if Self.Cursor <> crNone then + begin + RememberCursor := Self.Cursor; + Self.Cursor := crNone; + GetCursorPos(pt); + SetCursorPos(pt.x, pt.y); + if Assigned(FOnCursorVisible) then + FOnCursorVisible(Self, False); + end; + end + else + begin + FVideoWindow.IsCursorHidden(IsHidden); + if not IsHidden then + begin + FVideoWindow.HideCursor(True); + IsHidden := True; + GetCursorPos(pt); + SetCursorPos(pt.x, pt.y); + if Assigned(FOnCursorVisible) then + FOnCursorVisible(Self, False); + end; + end; + end; + end; + +{ TVMRBitmap } + + constructor TVMRBitmap.Create(VideoWindow: TVideoWindow); + begin + Assert(Assigned(VideoWindow),'No valid video Window.'); + FCanvas := TCanvas.Create; + FVideoWindow := VideoWindow; + FillChar(FVMRALPHABITMAP, SizeOf(FVMRALPHABITMAP), 0); + Options := []; + FVMRALPHABITMAP.hdc := 0; + FVMRALPHABITMAP.fAlpha := 1; + end; + + destructor TVMRBitmap.Destroy; + begin + ResetBitmap; + FCanvas.Free; + end; + + procedure TVMRBitmap.Draw; + var VMRMixerBitmap: IVMRMixerBitmap9; + begin + if Succeeded(FVideoWindow.QueryInterface(IVMRMixerBitmap9, VMRMixerBitmap)) then + VMRMixerBitmap.SetAlphaBitmap(@FVMRALPHABITMAP); + end; + + procedure TVMRBitmap.DrawTo(Left, Top, Right, Bottom, Alpha: Single; doUpdate: boolean = false); + begin + with FVMRALPHABITMAP do + begin + rDest.left := Left; + rDest.top := Top; + rDest.right := Right; + rDest.bottom := Bottom; + fAlpha := Alpha; + end; + if doUpdate then Update else Draw; + end; + + function TVMRBitmap.GetAlpha: Single; +begin + result := FVMRALPHABITMAP.fAlpha; +end; + +function TVMRBitmap.GetColorKey: COLORREF; +begin + Result := FVMRALPHABITMAP.clrSrcKey; +end; + +function TVMRBitmap.GetDest: TVMR9NormalizedRect; +begin + Result := FVMRALPHABITMAP.rDest; +end; + +function TVMRBitmap.GetDestBottom: Single; +begin + Result := FVMRALPHABITMAP.rDest.bottom; +end; + +function TVMRBitmap.GetDestLeft: Single; +begin + Result := FVMRALPHABITMAP.rDest.Left; +end; + +function TVMRBitmap.GetDestRight: Single; +begin + Result := FVMRALPHABITMAP.rDest.right +end; + +function TVMRBitmap.GetDestTop: Single; +begin + Result := FVMRALPHABITMAP.rDest.top; +end; + +function TVMRBitmap.GetSource: TRect; +begin + result := FVMRALPHABITMAP.rSrc; +end; + +procedure TVMRBitmap.LoadBitmap(Bitmap: TBitmap); +var + TmpHDC, HdcBMP: HDC; + BMP: Windows.TBITMAP; +begin + Assert(Assigned(Bitmap),'Invalid Bitmap.'); + ResetBitmap; + TmpHDC := GetDC(FVideoWindow.Handle); + if (TmpHDC = 0) then Exit; + HdcBMP := CreateCompatibleDC(TmpHDC); + ReleaseDC(FVideoWindow.Handle, TmpHDC); + if (HdcBMP = 0) then Exit; + if (0 = GetObject(Bitmap.Handle, sizeof(BMP), @BMP)) then exit; + FBMPOld := SelectObject(HdcBMP, Bitmap.Handle); + if (FBMPOld = 0) then Exit; + FVMRALPHABITMAP.hdc := HdcBMP; + FCanvas.Handle := HdcBMP; +end; + +procedure TVMRBitmap.LoadEmptyBitmap(Width, Height: Integer; + PixelFormat: TPixelFormat; Color: TColor); +var Bitmap: TBitmap; +begin + Bitmap := TBitmap.Create; + try + Bitmap.Width := Width; + Bitmap.Height := Height; + Bitmap.PixelFormat := PixelFormat; + Bitmap.Canvas.Brush.Color := Color; + Bitmap.Canvas.FillRect(Bitmap.Canvas.ClipRect); + LoadBitmap(Bitmap); + finally + Bitmap.Free; + end; +end; + +procedure TVMRBitmap.ResetBitmap; +begin + FCanvas.Handle := 0; + if FVMRALPHABITMAP.hdc <> 0 then + begin + DeleteObject(SelectObject(FVMRALPHABITMAP.hdc, FBMPOld)); + DeleteDC(FVMRALPHABITMAP.hdc); + FVMRALPHABITMAP.hdc := 0; + end; +end; + +procedure TVMRBitmap.SetAlpha(const Value: Single); +begin + FVMRALPHABITMAP.fAlpha := Value; +end; + +procedure TVMRBitmap.SetColorKey(const Value: COLORREF); +begin + FVMRALPHABITMAP.clrSrcKey := Value; +end; + +procedure TVMRBitmap.SetDest(const Value: TVMR9NormalizedRect); +begin + FVMRALPHABITMAP.rDest := Value; +end; + +procedure TVMRBitmap.SetDestBottom(const Value: Single); +begin + FVMRALPHABITMAP.rDest.bottom := Value; +end; + +procedure TVMRBitmap.SetDestLeft(const Value: Single); +begin + FVMRALPHABITMAP.rDest.Left := Value; +end; + +procedure TVMRBitmap.SetDestRight(const Value: Single); +begin + FVMRALPHABITMAP.rDest.right := Value; +end; + +procedure TVMRBitmap.SetDestTop(const Value: Single); +begin + FVMRALPHABITMAP.rDest.top := Value; +end; + +procedure TVMRBitmap.SetOptions(Options: TVMRBitmapOptions); +begin + FOptions := Options; + FVMRALPHABITMAP.dwFlags := VMR9AlphaBitmap_hDC; + if vmrbDisable in Options then FVMRALPHABITMAP.dwFlags := FVMRALPHABITMAP.dwFlags or VMR9AlphaBitmap_Disable; + if vmrbSrcColorKey in Options then FVMRALPHABITMAP.dwFlags := FVMRALPHABITMAP.dwFlags or VMR9AlphaBitmap_SrcColorKey; + if vmrbSrcRect in Options then FVMRALPHABITMAP.dwFlags := FVMRALPHABITMAP.dwFlags or VMR9AlphaBitmap_SrcRect; +end; + +procedure TVMRBitmap.SetSource(const Value: TRect); +begin + FVMRALPHABITMAP.rSrc := Value; +end; + +procedure TVMRBitmap.Update; + var VMRMixerBitmap: IVMRMixerBitmap9; + begin + if Succeeded(FVideoWindow.QueryInterface(IVMRMixerBitmap9, VMRMixerBitmap)) then + VMRMixerBitmap.UpdateAlphaBitmapParameters(@FVMRALPHABITMAP); + end; + +end. diff --git a/Game/Code/lib/DSPack/DSPack/DSUtil.pas b/Game/Code/lib/DSPack/DSPack/DSUtil.pas new file mode 100644 index 00000000..0646c6a6 --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/DSUtil.pas @@ -0,0 +1,5067 @@ + + (********************************************************************* + * DSPack 2.3.3 * + * * + * home page : http://www.progdigy.com * + * email : hgourvest@progdigy.com * + * Thanks to Michael Andersen. (DSVideoWindowEx) * + * * + * date : 21-02-2003 * + * * + * 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. * + * * + * Contributor(s) * + * Peter J. Haas * + * Andriy Nevhasymyy * + * Milenko Mitrovic * + * Michael Andersen * + * Martin Offenwanger * + * * + *********************************************************************) + +{ + @abstract(Methods & usefull Class for Direct Show programming.) + @author(Henri Gourvest: hgourvest@progdigy.com) + @created(Mar 14, 2002) + @lastmod(Oct 24, 2003) +} + +unit DSUtil; +{$B-} // needed at least for TSysDevEnum.FilterIndexOfFriendlyName +{$I jedi.inc} +{$IFDEF COMPILER7_UP} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} + +interface + +uses + {$IFDEF COMPILER6_UP} Variants, {$ENDIF} + Windows, Controls, SysUtils, ActiveX, Classes, MMSystem, DirectShow9, WMF9, + DirectDraw; + +const + IID_IPropertyBag : TGUID = '{55272A00-42CB-11CE-8135-00AA004BB851}'; + IID_ISpecifyPropertyPages : TGUID = '{B196B28B-BAB4-101A-B69C-00AA00341D07}'; + IID_IPersistStream : TGUID = '{00000109-0000-0000-C000-000000000046}'; + IID_IMoniker : TGUID = '{0000000F-0000-0000-C000-000000000046}'; + + // MS Mepg4 DMO + MEDIASUBTYPE_MP42 : TGUID = '{3234504D-0000-0010-8000-00AA00389B71}'; + // DIVX + MEDIASUBTYPE_DIVX : TGUID = '{58564944-0000-0010-8000-00AA00389B71}'; + // VoxWare MetaSound + MEDIASUBTYPE_VOXWARE : TGUID = '{00000075-0000-0010-8000-00AA00389B71}'; + + MiliSecPerDay : Cardinal = 86400000; + MAX_TIME : Int64 = $7FFFFFFFFFFFFFFF; + + bits555: array[0..2] of DWord = ($007C00, $0003E0, $00001F); + bits565: array[0..2] of DWord = ($00F800, $0007E0, $00001F); + bits888: array[0..2] of DWord = ($FF0000, $00FF00, $0000FF); + +//////////////////////////////////////////////////////////////////////////////// +// DIVX ressources translated from latest OpenDivx DirectX Codec + + // divx + CLSID_DIVX : TGUID = '{78766964-0000-0010-8000-00aa00389b71}'; + // DIVX + CLSID_DivX_U : TGUID = '{58564944-0000-0010-8000-00aa00389b71}'; + // dvx1 + CLSID_DivX_ : TGUID = '{31787664-0000-0010-8000-00aa00389b71}'; + // DVX1 + CLSID_DivX__U : TGUID = '{31585644-0000-0010-8000-00aa00389b71}'; + // dx50 + CLSID_dx50 : TGUID = '{30357864-0000-0010-8000-00aa00389b71}'; + // DX50 + CLSID_DX50_ : TGUID = '{30355844-0000-0010-8000-00aa00389b71}'; + // div6 + CLSID_div6 : TGUID = '{36766964-0000-0010-8000-00aa00389b71}'; + // DIV6 + CLSID_DIV6_ : TGUID = '{36564944-0000-0010-8000-00aa00389b71}'; + // div5 + CLSID_div5 : TGUID = '{35766964-0000-0010-8000-00aa00389b71}'; + // DIV5 + CLSID_DIV5_ : TGUID = '{35564944-0000-0010-8000-00aa00389b71}'; + // div4 + CLSID_div4 : TGUID = '{34766964-0000-0010-8000-00aa00389b71}'; + // DIV4 + CLSID_DIV4_ : TGUID = '{34564944-0000-0010-8000-00aa00389b71}'; + // div3 + CLSID_div3 : TGUID = '{33766964-0000-0010-8000-00aa00389b71}'; + // DIV3 + CLSID_DIV3_ : TGUID = '{33564944-0000-0010-8000-00aa00389b71}'; + + CLSID_DIVXCodec : TGUID = '{78766964-0000-0010-8000-00aa00389b71}'; + IID_IIDivXFilterInterface : TGUID = '{D132EE97-3E38-4030-8B17-59163B30A1F5}'; + CLSID_DivXPropertiesPage : TGUID = '{310e42a0-f913-11d4-887c-006008dc5c26}'; + +type +{$IFDEF VER130} + PPointer = ^Pointer; +{$ENDIF} + + { Interface to control the Divx Decoder filter. + TODO: discover the last function ... } + IDivXFilterInterface = interface(IUnknown) + ['{D132EE97-3E38-4030-8B17-59163B30A1F5}'] + { OpenDivx } + // current postprocessing level 0..100 + function get_PPLevel(out PPLevel: integer): HRESULT; stdcall; + // new postprocessing level 0..100 + function put_PPLevel(PPLevel: integer): HRESULT; stdcall; + // Put the default postprocessing = 0 + function put_DefaultPPLevel: HRESULT; stdcall; + { DIVX } + function put_MaxDelayAllowed(maxdelayallowed: integer): HRESULT; stdcall; + function put_Brightness(brightness: integer): HRESULT; stdcall; + function put_Contrast(contrast: integer): HRESULT; stdcall; + function put_Saturation(saturation: integer): HRESULT; stdcall; + function get_MaxDelayAllowed(out maxdelayallowed: integer): HRESULT; stdcall; + function get_Brightness(out brightness: integer): HRESULT; stdcall; + function get_Contrast(out contrast: integer): HRESULT; stdcall; + function get_Saturation(out saturation: integer): HRESULT; stdcall; + function put_AspectRatio(x, y: integer): HRESULT; stdcall; + function get_AspectRatio(out x, y: integer): HRESULT; stdcall; + end; + +//////////////////////////////////////////////////////////////////////////////// +// Ogg Vorbis + +type + TVORBISFORMAT = record + nChannels: WORD; + nSamplesPerSec: Longword; + nMinBitsPerSec: Longword; + nAvgBitsPerSec: Longword; + nMaxBitsPerSec: Longword; + fQuality: Double; + end; + +const + + // f07e245f-5a1f-4d1e-8bff-dc31d84a55ab + CLSID_OggSplitter: TGUID = '{f07e245f-5a1f-4d1e-8bff-dc31d84a55ab}'; + + // {078C3DAA-9E58-4d42-9E1C-7C8EE79539C5} + CLSID_OggSplitPropPage: TGUID = '{078C3DAA-9E58-4d42-9E1C-7C8EE79539C5}'; + + // 8cae96b7-85b1-4605-b23c-17ff5262b296 + CLSID_OggMux: TGUID = '{8cae96b7-85b1-4605-b23c-17ff5262b296}'; + + // {AB97AFC3-D08E-4e2d-98E0-AEE6D4634BA4} + CLSID_OggMuxPropPage: TGUID = '{AB97AFC3-D08E-4e2d-98E0-AEE6D4634BA4}'; + + // {889EF574-0656-4B52-9091-072E52BB1B80} + CLSID_VorbisEnc: TGUID = '{889EF574-0656-4B52-9091-072E52BB1B80}'; + + // {c5379125-fd36-4277-a7cd-fab469ef3a2f} + CLSID_VorbisEncPropPage: TGUID = '{c5379125-fd36-4277-a7cd-fab469ef3a2f}'; + + // 02391f44-2767-4e6a-a484-9b47b506f3a4 + CLSID_VorbisDec: TGUID = '{02391f44-2767-4e6a-a484-9b47b506f3a4}'; + + // 77983549-ffda-4a88-b48f-b924e8d1f01c + CLSID_OggDSAboutPage: TGUID = '{77983549-ffda-4a88-b48f-b924e8d1f01c}'; + + // {D2855FA9-61A7-4db0-B979-71F297C17A04} + MEDIASUBTYPE_Ogg: TGUID = '{D2855FA9-61A7-4db0-B979-71F297C17A04}'; + + // cddca2d5-6d75-4f98-840e-737bedd5c63b + MEDIASUBTYPE_Vorbis: TGUID = '{cddca2d5-6d75-4f98-840e-737bedd5c63b}'; + + // 6bddfa7e-9f22-46a9-ab5e-884eff294d9f + FORMAT_VorbisFormat: TGUID = '{6bddfa7e-9f22-46a9-ab5e-884eff294d9f}'; + + +//////////////////////////////////////////////////////////////////////////////// +// WMF9 Utils +type + TWMPofiles8 = ( + wmp_V80_255VideoPDA, + wmp_V80_150VideoPDA, + wmp_V80_28856VideoMBR, + wmp_V80_100768VideoMBR, + wmp_V80_288100VideoMBR, + wmp_V80_288Video, + wmp_V80_56Video, + wmp_V80_100Video, + wmp_V80_256Video, + wmp_V80_384Video, + wmp_V80_768Video, + wmp_V80_700NTSCVideo, + wmp_V80_1400NTSCVideo, + wmp_V80_384PALVideo, + wmp_V80_700PALVideo, + wmp_V80_288MonoAudio, + wmp_V80_288StereoAudio, + wmp_V80_32StereoAudio, + wmp_V80_48StereoAudio, + wmp_V80_64StereoAudio, + wmp_V80_96StereoAudio, + wmp_V80_128StereoAudio, + wmp_V80_288VideoOnly, + wmp_V80_56VideoOnly, + wmp_V80_FAIRVBRVideo, + wmp_V80_HIGHVBRVideo, + wmp_V80_BESTVBRVideo + ); + +const + WMProfiles8 : array[TWMPofiles8] of TGUID = + ('{FEEDBCDF-3FAC-4c93-AC0D-47941EC72C0B}', + '{AEE16DFA-2C14-4a2f-AD3F-A3034031784F}', + '{D66920C4-C21F-4ec8-A0B4-95CF2BD57FC4}', + '{5BDB5A0E-979E-47d3-9596-73B386392A55}', + '{D8722C69-2419-4b36-B4E0-6E17B60564E5}', + '{3DF678D9-1352-4186-BBF8-74F0C19B6AE2}', + '{254E8A96-2612-405c-8039-F0BF725CED7D}', + '{A2E300B4-C2D4-4fc0-B5DD-ECBD948DC0DF}', + '{BBC75500-33D2-4466-B86B-122B201CC9AE}', + '{29B00C2B-09A9-48bd-AD09-CDAE117D1DA7}', + '{74D01102-E71A-4820-8F0D-13D2EC1E4872}', + '{C8C2985F-E5D9-4538-9E23-9B21BF78F745}', + '{931D1BEE-617A-4bcd-9905-CCD0786683EE}', + '{9227C692-AE62-4f72-A7EA-736062D0E21E}', + '{EC298949-639B-45e2-96FD-4AB32D5919C2}', + '{7EA3126D-E1BA-4716-89AF-F65CEE0C0C67}', + '{7E4CAB5C-35DC-45bb-A7C0-19B28070D0CC}', + '{60907F9F-B352-47e5-B210-0EF1F47E9F9D}', + '{5EE06BE5-492B-480a-8A8F-12F373ECF9D4}', + '{09BB5BC4-3176-457f-8DD6-3CD919123E2D}', + '{1FC81930-61F2-436f-9D33-349F2A1C0F10}', + '{407B9450-8BDC-4ee5-88B8-6F527BD941F2}', + '{8C45B4C7-4AEB-4f78-A5EC-88420B9DADEF}', + '{6E2A6955-81DF-4943-BA50-68A986A708F6}', + '{3510A862-5850-4886-835F-D78EC6A64042}', + '{0F10D9D3-3B04-4fb0-A3D3-88D4AC854ACC}', + '{048439BA-309C-440e-9CB4-3DCCA3756423}'); + + + function ProfileFromGUID(const GUID: TGUID): TWMPofiles8; +//////////////////////////////////////////////////////////////////////////////// + + { Frees an object reference and replaces the reference with Nil. (Delphi4 compatibility)} + procedure FreeAndNil(var Obj); + + { Enable Graphedit to connect with a filter graph.
+ The application must register the filter graph instance in the Running Object + Table (ROT). The ROT is a globally accessible look-up table that keeps track + of running objects. Objects are registered in the ROT by moniker. To connect + to the graph, GraphEdit searches the ROT for monikers whose display name matches + a particular format: !FilterGraph X pid Y.
+ Graph: a graph interface (IGraphBuilder, IFilterGraph, IFilterGraph2).
+ ID: return the ROT identifier.} + function AddGraphToRot(Graph: IFilterGraph; out ID: integer): HRESULT; + + { Disable Graphedit to connect with your filter graph.
+ ID: identifier provided by the @link(AddGraphToRot) method.} + function RemoveGraphFromRot(ID: integer): HRESULT; + + { deprecated, convert a Time code event to TDVD_TimeCode record. } + function IntToTimeCode(x : longint): TDVDTimeCode; + + { Return a string explaining a filter graph event. } + function GetEventCodeDef(code: longint): string; + + { General purpose function to delete a heap allocated TAM_MEDIA_TYPE structure + which is useful when calling IEnumMediaTypes.Next as the interface + implementation allocates the structures which you must later delete + the format block may also be a pointer to an interface to release. } + procedure DeleteMediaType(pmt: PAMMediaType); + + { The CreateMediaType function allocates a new AM_MEDIA_TYPE structure, + including the format block. This also comes in useful when using the + IEnumMediaTypes interface so that you can copy a media type, you can do + nearly the same by creating a TMediaType class but as soon as it goes out + of scope the destructor will delete the memory it allocated + (this takes a copy of the memory). } + function CreateMediaType(pSrc: PAMMediaType): PAMMediaType; + + { The CopyMediaType function copies an AM_MEDIA_TYPE structure into another + structure, including the format block. This function allocates the memory + for the format block. If the pmtTarget parameter already contains an allocated + format block, a memory leak will occur. To avoid a memory leak, call + FreeMediaType before calling this function. } + procedure CopyMediaType(pmtTarget: PAMMediaType; pmtSource: PAMMediaType); + + { The FreeMediaType function frees the format block in an AM_MEDIA_TYPE structure. + Use this function to free just the format block. To delete the AM_MEDIA_TYPE + structure, call DeleteMediaType. } + procedure FreeMediaType(mt: PAMMediaType); + + { The CreateAudioMediaType function initializes a media type from a TWAVEFORMATEX structure. + If the bSetFormat parameter is TRUE, the method allocates the memory for the format + block. If the pmt parameter already contains an allocated format block, a memory + leak will occur. To avoid a memory leak, call FreeMediaType before calling this function. + After the method returns, call FreeMediaType again to free the format block. } + function CreateAudioMediaType(pwfx: PWaveFormatEx; pmt: PAMMediaType; bSetFormat: boolean): HRESULT; + + { The FOURCCMap function provides conversion between GUID media subtypes and + old-style FOURCC 32-bit media tags. In the original Microsoft® Windows® + multimedia APIs, media types were tagged with 32-bit values created from + four 8-bit characters and were known as FOURCCs. Microsoft DirectShow® media + types have GUIDs for the subtype, partly because these are simpler to create + (creation of a new FOURCC requires its registration with Microsoft). + Because FOURCCs are unique, a one-to-one mapping has been made possible by + allocating a range of 4,000 million GUIDs representing FOURCCs. This range + is all GUIDs of the form: XXXXXXXX-0000-0010-8000-00AA00389B71. } + function FOURCCMap(Fourcc: Cardinal): TGUID; + + { Find the four-character codes wich identifi a codec. } + function GetFOURCC(Fourcc: Cardinal): string; + + { Convert a FCC (Four Char Codes) to Cardinal. A FCC identifie a media type.} + function FCC(str: String): Cardinal; + + { Create the four-character codes from a Cardinal value. } + function MAKEFOURCC(ch0, ch1, ch2, ch3: char): Cardinal; + + { The GetErrorString function retrieves the error message for a given return + code, using the current language setting.} + function GetErrorString(hr: HRESULT): string; + + function GetMediaMajorTypeDescription(MediaType: PAMMediaType): string; + function GetMediaSubTypeDescription(MediaType: PAMMediaType): string; + function GetMediaFormatTypeDescription(MediaType: PAMMediaType): string; + + { This function examine a media type and return a short description like GraphEdit. } + function GetMediaTypeDescription(MediaType: PAMMediaType): string; + + { Retrieve the Size needed to store a bitmat } + function GetBitmapSize(Header: PBitmapInfoHeader): DWORD; + + function GetBitmapSubtype(bmiHeader: PBitmapInfoHeader): TGUID; stdcall; + + function GetTrueColorType(bmiHeader: PBitmapInfoHeader): TGUID; stdcall; + + function GetDXSDKMediaPath : String; + + function CopyScreenToBitmap(Rect : TRect; pData : PByte; pHeader : PBitmapInfo) : HBitmap; + + +type + { Property pages.
See also: @link(ShowFilterPropertyPage), @link:(HaveFilterPropertyPage).} + TPropertyPage = ( + ppDefault, // Simple property page. + ppVFWCapDisplay, // Capture Video source dialog box. + ppVFWCapFormat, // Capture Video format dialog box. + ppVFWCapSource, // Capture Video source dialog box. + ppVFWCompConfig, // Compress Configure dialog box. + ppVFWCompAbout // Compress About Dialog box. + ); + + { Show the property page associated with the Filter. + A property page is one way for a filter to support properties that the user can set. + Many of the filters provided with DirectShow support property pages, they are + intended for debugging purposes, and are not recommended for application use. + In most cases the equivalent functionality is provided through a custom interface + on the filter. An application should control these filters programatically, + rather than expose their property pages to users. } + function ShowFilterPropertyPage(parent: THandle; Filter: IBaseFilter; + PropertyPage: TPropertyPage = ppDefault): HRESULT; + + { Return true if the specified property page is provided by the Filter.} + function HaveFilterPropertyPage(Filter: IBaseFilter; + PropertyPage: TPropertyPage = ppDefault): boolean; + + { Show the property page associated with the Pin.
+ See also: @link:(ShowFilterPropertyPage).} + function ShowPinPropertyPage(parent: THandle; Pin: IPin): HRESULT; + + { Convert 100 nano sec unit to milisecondes. } + function RefTimeToMiliSec(RefTime: Int64): Cardinal; + + { Convert milisecondes to 100 nano sec unit} + function MiliSecToRefTime(Milisec: int64): Int64; + +{ The mechanism for describing a bitmap format is with the BITMAPINFOHEADER + This is really messy to deal with because it invariably has fields that + follow it holding bit fields, palettes and the rest. This function gives + the number of bytes required to hold a VIDEOINFO that represents it. This + count includes the prefix information (like the rcSource rectangle) the + BITMAPINFOHEADER field, and any other colour information on the end. + + WARNING If you want to copy a BITMAPINFOHEADER into a VIDEOINFO always make + sure that you use the HEADER macro because the BITMAPINFOHEADER field isn't + right at the start of the VIDEOINFO (there are a number of other fields), + + CopyMemory(HEADER(pVideoInfo),pbmi,sizeof(BITMAPINFOHEADER)); } + function GetBitmapFormatSize(const Header: TBitmapInfoHeader): Integer; + + { Retrieve original source rectangle from a TAM_Media_type record.} + function GetSourceRectFromMediaType(const MediaType: TAMMediaType): TRect; + + { TODO -oMichael Andersen: make documentation } + function StretchRect(R, IR: TRect): TRect; + + // raise @link(EDirectShowException) exception if failed. + function CheckDSError(HR: HRESULT): HRESULT; + +// milenko start (added functions from dshowutil.cpp) + function FindRenderer(pGB: IGraphBuilder; const mediatype: PGUID; out ppFilter: IBaseFilter): HRESULT; + function FindAudioRenderer(pGB: IGraphBuilder; out ppFilter: IBaseFilter): HRESULT; + function FindVideoRenderer(pGB: IGraphBuilder; out ppFilter: IBaseFilter): HRESULT; + function CountFilterPins(pFilter: IBaseFilter; out pulInPins: Cardinal; out pulOutPins: Cardinal): HRESULT; + function CountTotalFilterPins(pFilter: IBaseFilter; out pulPins: Cardinal): HRESULT; + function GetPin(pFilter: IBaseFilter; dirrequired: TPinDirection; iNum: integer; out ppPin: IPin): HRESULT; + function GetInPin(pFilter: IBaseFilter; nPin: integer): IPin; + function GetOutPin(pFilter: IBaseFilter; nPin: integer): IPin; + function FindOtherSplitterPin(pPinIn: IPin; guid: TGUID; nStream: integer; out ppSplitPin: IPin): HRESULT; + function SeekNextFrame(pSeeking: IMediaSeeking; FPS: Double; Frame: LongInt): HRESULT; + procedure ShowFilenameByCLSID(clsid: TGUID; out szFilename: WideString); + function GetFileDurationString(pMS: IMediaSeeking; out szDuration: WideString): HRESULT; + function CanFrameStep(pGB: IGraphBuilder): Boolean; + procedure UtilFreeMediaType(pmt: PAMMediaType); + procedure UtilDeleteMediaType(pmt: PAMMediaType); + function SaveGraphFile(pGraph: IGraphBuilder; wszPath: WideString): HRESULT; + function LoadGraphFile(pGraph: IGraphBuilder; const wszName: WideString): HRESULT; +// milenko end + + // Added by Michael. Used to Detect installed DirectX Version. (Source from getdxver.cpp) + function GetDXVersion(var pdwDirectXVersion : DWORD; out strDirectXVersion : String) : HResult; + +type + // DirectShow Exception class + EDirectShowException = class(Exception) + ErrorCode: Integer; + end; + + EDSPackException = class(Exception) + ErrorCode: Integer; + end; + +// ***************************************************************************** +// TSysDevEnum +// ***************************************************************************** + {@exclude} + PFilCatNode = ^TFilCatNode; + {@exclude} + TFilCatNode = record + FriendlyName : Shortstring; + CLSID : TGUID; + end; + + { Usefull class to enumerate availables filters. + See "Filter Enumerator" sample. } + TSysDevEnum = class + private + FGUID : TGUID; + FCategories : TList; + FFilters : TList; + ACategory : PFilCatNode; + procedure GetCat(catlist: TList; CatGUID: TGUID); + function GetCountCategories: integer; + function GetCountFilters: integer; + function GetCategory(item: integer): TFilCatNode; + function GetFilter(item: integer): TFilCatNode; + public + { Select the main category by GUID. For example CLSID_VideoCompressorCategory + to enumerate Video Compressors. } + procedure SelectGUIDCategory(GUID: TGUID); + { Select the main category by Index. } + procedure SelectIndexCategory(index: integer); + { Call CountCategories to retrieve categories count.} + property CountCategories: integer read GetCountCategories; + { Call CountFilters to retrieve the number of Filte within a Category. } + property CountFilters: integer read GetCountFilters; + { Call Categories to read Category Name and GUID. } + property Categories[item: integer]: TFilCatNode read GetCategory; + { Call Filters to read Filter Name and GUID. } + property Filters[item: integer]: TFilCatNode read GetFilter; + { Find filter index by FriendlyName; -1, if not found } + function FilterIndexOfFriendlyName(const FriendlyName: string): Integer; + { Call GetBaseFilter to retrieve the IBaseFilter interface corresponding to index. } + function GetBaseFilter(index: integer): IBaseFilter; overload; + { Call GetBaseFilter to retrieve the IBaseFilter interface corresponding to GUID. } + function GetBaseFilter(GUID: TGUID): IBaseFilter; overload; + { Call GetMoniker to retrieve the IMoniker interface corresponding to index. + This interface can be used to store a filter with the @link(TBaseFiter) class. } + function GetMoniker(index: integer): IMoniker; + { constructor } + constructor Create; overload; + { constructor. Create the class and initialize the main category with the GUID. } + constructor Create(guid: TGUID); overload; + { destructor } + destructor Destroy; override; + end; + +// ***************************************************************************** +// TFilterList +// ***************************************************************************** + + { This class can enumerate all filters in a FilterGraph. } + TFilterList = class(TInterfaceList) + private + Graph : IFilterGraph; + function GetFilter(Index: Integer): IBaseFilter; + procedure PutFilter(Index: Integer; Item: IBaseFilter); + function GetFilterInfo(index: integer): TFilterInfo; + public + { Create a list based on a FilterGraph. } + constructor Create(FilterGraph: IFilterGraph); overload; + { Destructor. } + destructor Destroy; override; + { Update the list. } + procedure Update; + { Reload the list from another FilterGraph.} + procedure Assign(FilterGraph: IFilterGraph); + { Call First to obtain the first interface in the list. } + function First: IBaseFilter; + { Call IndexOf to obtain the index of an interface. } + function IndexOf(Item: IBaseFilter): Integer; + { Call Add to add an interface to the list. } + function Add(Item: IBaseFilter): Integer; + { Call Insert to insert an interface into the list. Item is the interface to + insert, and Index indicates the position (zero-offset) where the interface + should be added. } + procedure Insert(Index: Integer; Item: IBaseFilter); + { Call Last to obtain the last interface in the list. } + function Last: IBaseFilter; + { Call Remove to remove an interface from the list. Remove returns the index + of the removed interface, or –1 if the interface was not found. } + function Remove(Item: IBaseFilter): Integer; + { Use Items to directly access an interface in the list. Index identifies each + interface by its position in the list. } + property Items[Index: Integer]: IBaseFilter read GetFilter write PutFilter; default; + { call FilterInfo to retrieve the Filer name and his FilterGraph. } + property FilterInfo[Index: Integer] : TFilterInfo read GetFilterInfo; + end; + +//****************************************************************************** +// TPinList +//****************************************************************************** + + {Helper class to enumerate pins on a filter. } + TPinList = class(TInterfaceList) + private + Filter: IBaseFilter; + function GetPin(Index: Integer): IPin; + procedure PutPin(Index: Integer; Item: IPin); + function GetPinInfo(index: integer): TPinInfo; + function GetConnected(Index: Integer): boolean; + public + { Create a Pin list from the IBaseFilter interface. } + constructor Create(BaseFilter: IBaseFilter); overload; + { Destructor. } + destructor Destroy; override; + { Update the Pin list. } + procedure Update; + { Load a Pin list from the IBaseFilter Interface. } + procedure Assign(BaseFilter: IBaseFilter); + { Return the First Pin from in the list. } + function First: IPin; + { Return the index of Pin in the list. } + function IndexOf(Item: IPin): Integer; + { Add A Pin to the list. } + function Add(Item: IPin): Integer; + { Insert a pin at the given position. } + procedure Insert(Index: Integer; Item: IPin); + { Return the last pin in the list. } + function Last: IPin; + { Remove a pin from the lis. } + function Remove(Item: IPin): Integer; + { Return the the pin interface at the defined position. } + property Items[Index: Integer]: IPin read GetPin write PutPin; default; + { Retrieve informations on a pin. } + property PinInfo[Index: Integer]: TPinInfo read GetPinInfo; + property Connected[Index: Integer]: boolean read GetConnected; + end; + +// ***************************************************************************** +// TMediaType +// ***************************************************************************** + + { Uses TMediaType to configure media types. This class have a special property editor. + See @link(TSampleGrabber)} + TMediaType = class(TPersistent) + private + function GetMajorType: TGUID; + procedure SetMajorType(MT: TGUID); + function GetSubType: TGUID; + procedure SetSubType(ST: TGUID); + procedure SetFormatType(const GUID: TGUID); + function GetFormatType: TGUID; + procedure ReadData(Stream: TStream); + procedure WriteData(Stream: TStream); + protected + { @exclude} + procedure DefineProperties(Filer: TFiler); override; + public + { Local copy of the Media Type. } + AMMediaType: PAMMediaType; + { Destructor method. } + destructor Destroy; override; + { Constructor method. } + constructor Create; overload; + { Constructor method. Initialised with majortype. } + constructor Create(majortype: TGUID); overload; + { Constructor method. Initialised with another media type. } + constructor Create(mediatype: PAMMediaType); overload; + { Constructor method. Initialised with another TMediaType} + constructor Create(MTClass: TMediaType); overload; + { Copy from another TMediaType. } + procedure Assign(Source: TPersistent); override; + { Copy from another PAM_MEDIA_TYPE. } + procedure Read(mediatype: PAMMediaType); + { Tests for equality between TMediaType objects.
+ rt: Reference to the TMediaType object to compare.
+ Returns TRUE if rt is equal to this object. Otherwise, returns FALSE. } + function Equal(MTClass: TMediaType): boolean; overload; + { Tests for inequality between TMediaType objects.
+ rt: Reference to the TMediaType object to compare.
+ Returns TRUE if rt is not equal to this object. Otherwise, returns FALSE. } + function NotEqual(MTClass: TMediaType): boolean; overload; + { The IsValid method determines whether a major type has been assigned to this object. + Returns TRUE if a major type has been assigned to this object. Otherwise, returns FALSE. + By default, TMediaType objects are initialized with a major type of GUID_NULL. + Call this method to determine whether the object has been correctly initialized.} + function IsValid: boolean; + { The IsFixedSize method determines if the samples have a fixed size or a variable size. + Returns the value of the bFixedSizeSamples member.} + function IsFixedSize: boolean; + { The IsTemporalCompressed method determines if the stream uses temporal compression. + Returns the value of the bTemporalCompression member. } + function IsTemporalCompressed: boolean; + { The GetSampleSize method retrieves the sample size. + If the sample size is fixed, returns the sample size in bytes. Otherwise, + returns zero. } + function GetSampleSize: ULONG; + { The SetSampleSize method specifies a fixed sample size, or specifies that + samples have a variable size. If value of sz is zero, the media type uses + variable sample sizes. Otherwise, the sample size is fixed at sz bytes. } + procedure SetSampleSize(SZ: ULONG); + { The SetVariableSize method specifies that samples do not have a fixed size. + This method sets the bFixedSizeSamples member to FALSE. Subsequent calls to the TMediaType.GetSampleSize method return zero. } + procedure SetVariableSize; + { The SetTemporalCompression method specifies whether samples are compressed + using temporal (interframe) compression. } + procedure SetTemporalCompression(bCompressed: boolean); + { read/write pointer to format - can't change length without + calling SetFormat, AllocFormatBuffer or ReallocFormatBuffer} + function Format: pointer; + { The FormatLength method retrieves the length of the format block. } + function FormatLength: ULONG; + { The SetFormat method specifies the format block.
+ pFormat: Pointer to a block of memory that contains the format block.
+ length: Length of the format block, in bytes. } + function SetFormat(pFormat: pointer; length: ULONG): boolean; + { The ResetFormatBuffer method deletes the format block. } + procedure ResetFormatBuffer; + { The AllocFormatBuffer method allocates memory for the format block.
+ length: Size required for the format block, in bytes.
+ Returns a pointer to the new block if successful. Otherwise, returns nil.
+ If the method successfully allocates a new format block, it frees the existing + format block. If the allocation fails, the method leaves the existing format block. } + function AllocFormatBuffer(length: ULONG): pointer; + { The ReallocFormatBuffer method reallocates the format block to a new size.
+ length: New size required for the format block, in bytes. Must be greater + than zero.
+ Returns a pointer to the new block if successful. Otherwise, returns either + a pointer to the old format block, or nil. + This method allocates a new format block. It copies as much of the existing + format block as possible into the new format block. If the new block is + smaller than the existing block, the existing format block is truncated. + If the new block is larger, the contents of the additional space are undefined. + They are not explicitly set to zero. } + function ReallocFormatBuffer(length: ULONG): pointer; + { The InitMediaType method initializes the media type. + This method zeroes the object's memory, sets the fixed-sample-size property + to TRUE, and sets the sample size to 1. } + procedure InitMediaType; + { The MatchesPartial method determines if this media type matches a partially + specified media type. The media type specified by ppartial can have a value + of GUID_NULL for the major type, subtype, or format type. Any members with + GUID_NULL values are not tested. (In effect, GUID_NULL acts as a wildcard.) + Members with values other than GUID_NULL must match for the media type to match.} + function MatchesPartial(ppartial: TMediaType): boolean; + { The IsPartiallySpecified method determines if the media type is partially + defined. A media type is partial if the major type, subtype, or format type + is GUID_NULL. The IPin.Connect method can accept partial media types. + The implementation does not actually test the subtype. If there is a specified + format type, the media type is not considered partial, even if the subtype is GUID_NULL. } + function IsPartiallySpecified: boolean; + { Set or retrieve the MajorType GUID. } + property MajorType: TGUID read GetMajorType write SetMajorType; + { Set or retrieve the SubType GUID. } + property SubType: TGUID read GetSubType write SetSubType; + { Set or retrieve the FormatType GUID. } + property FormatType: TGUID read GetFormatType write SetFormatType; + end; + +// ***************************************************************************** +// TEnumMediaType +// ***************************************************************************** + + { This class can retrieve all media types from a pin, a file or an IEnumMediaTypes interface. } + TEnumMediaType = class(TObject) + private + FList : TList; + function GetItem(Index: Integer): TMediaType; + procedure SetItem(Index: Integer; Item: TMediaType); + function GetMediaDescription(Index: Integer): string; + + function GetMediaMajorDescription(Index: Integer): string; + function GetMediaSubDescription(Index: Integer): string; + function GetMediaFormatDescription(Index: Integer): string; + function GetCount: integer; + public + { Constructor method.} + constructor Create; overload; + { Constructor method enumerating all media types on a pin. } + constructor Create(Pin: IPin); overload; + { Constructor method enumerating media types provided by a IEnumMediaType interface. } + constructor Create(EnumMT: IEnumMediaTypes); overload; + { Constructor method enumerating all media types availables in a media file. + Support WMF files. } + constructor Create(FileName: TFileName); overload; + { Destructor method. } + destructor Destroy; override; + { Enumerate all media types on a pin.} + procedure Assign(Pin: IPin); overload; + { Enumerate media types provided by a IEnumMediaType interface. } + procedure Assign(EnumMT: IEnumMediaTypes); overload; + { Enumerate all media types availables in a media file. Support WMF files. } + procedure Assign(FileName: TFileName); overload; + { Add a media type to the list. } + function Add(Item: TMediaType): Integer; + { Clear the list. } + procedure Clear; + { Remove a media type from the list. } + procedure Delete(Index: Integer); + { Retrieve a mediaa type. } + property Items[Index: Integer]: TMediaType read GetItem write SetItem; + { Return a string describing the media type. } + property MediaDescription[Index: Integer]: string read GetMediaDescription; + + property MediaMajorDescription[Index: Integer]: string read GetMediaMajorDescription; + property MediaSubDescription[Index: Integer]: string read GetMediaSubDescription; + property MediaFormatDescription[Index: Integer]: string read GetMediaFormatDescription; + { Number of items in the list. } + property Count: integer read GetCount; + end; + +// ***************************************************************************** +// TPersistentMemory +// ***************************************************************************** + + { For internal use. This class is designed to store a custom memory stream with + a form. It is the ancestor of @link(TBaseFilter).} + TPersistentMemory = class(TPersistent) + private + FData: pointer; + FDataLength: Cardinal; + procedure ReadData(Stream: TStream); + procedure WriteData(Stream: TStream); + function Equal(Memory: TPersistentMemory): boolean; + procedure AllocateMemory(ALength: Cardinal); + protected + { @exclude } + procedure AssignTo(Dest: TPersistent); override; + { @exclude } + procedure DefineProperties(Filer: TFiler); override; + public + { Set/Get the buffer length. } + property DataLength: Cardinal read FDataLength write AllocateMemory; + { Pointer to buffer. } + property Data: Pointer read FData; + { Constructor } + constructor Create; virtual; + { Destructor } + destructor Destroy; override; + { Call Assign to copy the properties or other attributes of one object from another. } + procedure Assign(Source: TPersistent); override; + end; + +// ***************************************************************************** +// TBaseFilter +// ***************************************************************************** + + { This class can store a custom filter as a moniker within the dfm file. } + TBaseFilter = class(TPersistentMemory) + private + procedure SetMoniker(Moniker: IMoniker); + function GetMoniker: IMoniker; + public + { Set or retrieve the moniker interface.} + property Moniker: IMoniker read GetMoniker write SetMoniker; + { Read a property bag. For example you can read the GUID identifier (PropertyBag('CLSID'))} + function PropertyBag(Name: WideString): OleVariant; + {Return the IBaseFilter interface corresponding to filter.} + function CreateFilter: IBaseFilter; + end; + +// ***************************************************************************** +// DxDiag.h +// ***************************************************************************** + +const + // This identifier is passed to IDxDiagProvider::Initialize 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, IDxDiagProvider::Initialize will fail. + // (The number itself has no meaning.) + DXDIAG_DX9_SDK_VERSION = 111; + + (**************************************************************************** + * + * DxDiag Errors + * + ****************************************************************************) + DXDIAG_E_INSUFFICIENT_BUFFER = HResult($8007007A); + + (**************************************************************************** + * + * DxDiag CLSIDs + * + ****************************************************************************) + CLSID_DxDiagProvider : TGUID = '{A65B8071-3BFE-4213-9A5B-491DA4461CA7}'; + + (**************************************************************************** + * + * DxDiag Interface IIDs + * + ****************************************************************************) + IID_IDxDiagProvider : TGUID = '{9C6B4CB0-23F8-49CC-A3ED-45A55000A6D2}'; + IID_IDxDiagContainer : TGUID = '{7D0F462F-4064-4862-BC7F-933E5058C10F}'; + +Type + (**************************************************************************** + * + * DxDiag Structures + * + ****************************************************************************) + + PDXDIAG_INIT_PARAMS = ^TDxDiagInitParams; + _DXDIAG_INIT_PARAMS = record + dwSize : DWORD; // Size of this structure. + dwDxDiagHeaderVersion : DWORD; // Pass in DXDIAG_DX9_SDK_VERSION. This verifies + // the header and dll are correctly matched. + bAllowWHQLChecks : Boolean; // If true, allow dxdiag to check if drivers are + // digital signed as logo'd by WHQL which may + // connect via internet to update WHQL certificates. + pReserved : Pointer; // Reserved. Must be NULL. + End; + + {$EXTERNALSYM _DXDIAG_INIT_PARAMS} + DXDIAG_INIT_PARAMS = _DXDIAG_INIT_PARAMS; + {$EXTERNALSYM DXDIAG_INIT_PARAMS} + TDxDiagInitParams = _DXDIAG_INIT_PARAMS; + + (**************************************************************************** + * + * DxDiag Application Interfaces + * + ****************************************************************************) + + IDxDiagProvider = interface; + IDxDiagContainer = interface; + + IDxDiagProvider = interface(IUnknown) + ['{9C6B4CB0-23F8-49CC-A3ED-45A55000A6D2}'] + // *** IDxDiagProvider methods *** // + function Initialize(pParams : PDXDIAG_INIT_PARAMS): HResult; stdcall; + function GetRootContainer(Out ppInstance : IDxDiagContainer): HResult; stdcall; + End; + + IDxDiagContainer = interface(IUnknown) + ['{7D0F462F-4064-4862-BC7F-933E5058C10F}'] + // *** IDxDiagContainer methods *** // + function GetNumberOfChildContainers(Out pdwCount : dword) : HResult; stdcall; + function EnumChildContainerNames(dwIndex : dword; pwszContainer : PWideChar; cchContainer : DWord) : HResult; stdcall; + function GetChildContainer(pwszContainer : PWideChar; Out ppInstance : IDxDiagContainer) : Hresult; stdcall; + function GetNumberOfProps(Out pdwCount : dword) : HResult; stdcall; + function EnumPropNames(dwIndex : dword; pwszPropName : PWideChar; cchPropName : dword) : HResult; stdcall; + function GetProp(pwszPropName : PWideChar; Out pvarProp : OleVariant) : HResult; stdcall; + End; + +// milenko start DMO TMediaBuffer implementation + TMediaBuffer = class(TObject, IMediaBuffer, IUnKnown) + private + FRefCount: integer; + FLength: DWORD; + FMaxLength: DWORD; + FData: PByte; + public + constructor Create(MaxLen: DWORD); + destructor Destroy; override; + class function CreateBuffer(MaxLen: DWORD; const IID: TGUID; out Obj): HRESULT; + // IUnknown + function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall; + function _AddRef: Integer; stdcall; + function _Release: Integer; stdcall; + // 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; +// milenko end + +// milenko start wxutil implementation +const + RESOLUTION = DWORD(1); // High resolution timer + ADVISE_CACHE = integer(4); // Default cache size + + MILLISECONDS = LONGLONG(1000); // 10 ^ 3 + NANOSECONDS = LONGLONG(1000000000); // 10 ^ 9 + UNITS = LONGLONG(NANOSECONDS div 100); // 10 ^ 7 + + TimeZero = LONGLONG(0); + +type + DWORDLONG = LONGLONG; // Should be unsigned Int64 !!! + ULONGLONG = DWORDLONG; // Should be unsigned Int64 !!! + + function UInt32x32To64(a, b: DWORD): ULONGLONG; + function Int64x32Div32(a: LONGLONG; b, c, d: LongInt): LONGLONG; + function Int32x32To64(a, b: integer): Int64; + function MILLISECONDS_TO_100NS_UNITS(Ms: LONGLONG): LONGLONG; + + function llMulDiv(a, b, c, d: LONGLONG): LONGLONG; + function AmGetLastErrorToHResult: HRESULT; + function IsEqualObject(pFirst, pSecond: IUnknown): Boolean; +// milenko end + +// milenko start namedguid implementation +const + IID_IDirectDrawKernel : TGUID = '{8D56C120-6A08-11D0-9B06-00A0C903A3B8}'; + IID_IDirectDrawSurfaceKernel: TGUID = '{60755DA0-6A40-11D0-9B06-00A0C903A3B8}'; + + function GetGUIDString(GUID: TGUID): String; +// milenko end + +// milenko start (usefull functions to get linear amplification) + function GetBasicAudioVolume(Value : integer) : integer; + function SetBasicAudioVolume(Value : integer) : integer; + function GetBasicAudioPan(Value : integer) : integer; + function SetBasicAudioPan(Value : integer) : integer; +// milenko end + +// milenok start (yet another delphi5 compatibility ...) +{$IFDEF VER130} + function GUIDToString(const GUID: TGUID): string; + function StringToGUID(const S: string): TGUID; + function EnsureRange(const AValue, AMin, AMax: Integer): Integer; +{$ENDIF} +// milenko end + +{$IFNDEF COMPILER6_UP} + procedure Set8087CW(NewCW: Word); + function Get8087CW: Word; +{$ENDIF} + +// previously TMPEGHeaderBitsWrapper + function MPEGHeaderBitsGetSectionLength(Header: PMPEGHeaderBits) : Word; + function MPEGHeaderBitsGetReserved(Header: PMPEGHeaderBits): WORD; + function MPEGHeaderBitsGetPrivateIndicator(Header: PMPEGHeaderBits): WORD; + function MPEGHeaderBitsGetSectionSyntaxIndicator(Header: PMPEGHeaderBits): WORD; + procedure MPEGHeaderBitsSetSectionLength(Header: PMPEGHeaderBits; AValue: WORD); + procedure MPEGHeaderBitsSetReserved(Header: PMPEGHeaderBits; AValue: WORD); + procedure MPEGHeaderBitsSetPrivateIndicator(Header: PMPEGHeaderBits; AValue: WORD); + procedure MPEGHeaderBitsSetSectionSyntaxIndicator(Header: PMPEGHeaderBits; AValue: WORD); + +// previously TPIDBitsWrapper + function PIDBitsGetReserved(PIDBits: PPIDBits): WORD; + function PIDBitsGetProgramId(PIDBits: PPIDBits): WORD; + procedure PIDBitsSetReserved(PIDBits: PPIDBits; AValue: WORD); + procedure PIDBitsSetProgramId(PIDBits: PPIDBits; AValue: WORD); + +// previously TPIDBitsWrapper + function MPEGHeaderVersionBitsGetCurrentNextIndicator(MPEGHeaderVersionBits: PMPEGHeaderVersionBits): Byte; + function MPEGHeaderVersionBitsGetVersionNumber(MPEGHeaderVersionBits: PMPEGHeaderVersionBits): Byte; + function MPEGHeaderVersionBitsGetReserved(MPEGHeaderVersionBits: PMPEGHeaderVersionBits): Byte; + procedure MPEGHeaderVersionBitsSetCurrentNextIndicator(MPEGHeaderVersionBits: PMPEGHeaderVersionBits; AValue: Byte); + procedure MPEGHeaderVersionBitsSetVersionNumber(MPEGHeaderVersionBits: PMPEGHeaderVersionBits; AValue: Byte); + procedure MPEGHeaderVersionBitsSetReserved(MPEGHeaderVersionBits: PMPEGHeaderVersionBits; AValue: Byte); + +implementation +uses + DirectSound, Math, ComObj, Registry; +{$IFNDEF COMPILER6_UP} +var + Default8087CW: Word = $1372; + + procedure Set8087CW(NewCW: Word); + begin + Default8087CW := NewCW; + asm + FNCLEX + FLDCW Default8087CW + end; + end; + + function Get8087CW: Word; + asm + PUSH 0 + FNSTCW [ESP].Word + POP EAX + end; +{$ENDIF} + + function ProfileFromGUID(const GUID: TGUID): TWMPofiles8; + begin + for result := low(TWMPofiles8) to high(TWMPofiles8) do + if IsEqualGUID(GUID, WMProfiles8[result]) then Exit; + Result := TWMPofiles8(-1); + end; + + //---------------------------------------------------------------------------- + // Retrieve the Size needed to store a bitmat + //---------------------------------------------------------------------------- + function GetBitmapSize(Header: PBitmapInfoHeader): DWORD; + + function WIDTHBYTES(bits: DWORD): DWORD; + begin + result := DWORD((bits+31) and (not 31)) div 8; + end; + + function DIBWIDTHBYTES(bi: PBITMAPINFOHEADER): DWORD; + begin + result := DWORD(WIDTHBYTES(DWORD(bi.biWidth) * DWORD(bi.biBitCount))); + end; + + function _DIBSIZE(bi: PBITMAPINFOHEADER): DWORD; + begin + result := DIBWIDTHBYTES(bi) * DWORD(bi.biHeight); + end; + + begin + if (Header.biHeight < 0) then result := -1 * _DIBSIZE(Header) + else result := _DIBSIZE(Header); + end; + + +// This is called if the header has a 16 bit colour depth and needs to work +// out the detailed type from the bit fields (either RGB 565 or RGB 555) + +function GetTrueColorType(bmiHeader: PBitmapInfoHeader): TGUID; stdcall; +var + bmInfo: PBitmapInfo; +begin + bmInfo := PBitmapInfo(bmiHeader); + ASSERT(bmiHeader.biBitCount = 16); + + // If its BI_RGB then it's RGB 555 by default + if (bmiHeader.biCompression = BI_RGB) then + begin + Result := MEDIASUBTYPE_RGB555; + Exit; + end; + + if CompareMem(@bmInfo.bmiColors, @bits555, SizeOf(bits555)) then + Result := MEDIASUBTYPE_RGB555 else + if CompareMem(@bmInfo.bmiColors, @bits565, SizeOf(bits565)) then + Result := MEDIASUBTYPE_RGB565 else + Result := GUID_NULL; +end; + +// Given a BITMAPINFOHEADER structure this returns the GUID sub type that is +// used to describe it in format negotiations. For example a video codec fills +// in the format block with a VIDEOINFO structure, it also fills in the major +// type with MEDIATYPE_VIDEO and the subtype with a GUID that matches the bit +// count, for example if it is an eight bit image then MEDIASUBTYPE_RGB8 + +function GetBitmapSubtype(bmiHeader: PBitmapInfoHeader): TGUID; stdcall; +begin + ASSERT(bmiHeader <> nil); + // If it's not RGB then create a GUID from the compression type + if (bmiHeader.biCompression <> BI_RGB) then + if (bmiHeader.biCompression <> BI_BITFIELDS) then + begin + Result := FourCCMap(bmiHeader.biCompression); + Exit; + end; + + // Map the RGB DIB bit depth to a image GUID + case (bmiHeader.biBitCount) of + 1 : result := MEDIASUBTYPE_RGB1; + 4 : result := MEDIASUBTYPE_RGB4; + 8 : result := MEDIASUBTYPE_RGB8; + 16 : result := GetTrueColorType(bmiHeader); + 24 : result := MEDIASUBTYPE_RGB24; + 32 : result := MEDIASUBTYPE_RGB32; + else + result := GUID_NULL; + end; + +end; + + //---------------------------------------------------------------------------- + // Frees an object reference and replaces the reference with Nil. + //---------------------------------------------------------------------------- + procedure FreeAndNil(var Obj); + var + Temp: TObject; + begin + Temp := TObject(Obj); + Pointer(Obj) := nil; + Temp.Free; + end; + + //---------------------------------------------------------------------------- + // Enable Graphedit to connect with your filter graph + //---------------------------------------------------------------------------- + function AddGraphToRot(Graph: IFilterGraph; out ID: integer): HRESULT; + var + Moniker: IMoniker; + ROT : IRunningObjectTable; + wsz : WideString; + begin + result := GetRunningObjectTable(0, ROT); + if (result <> S_OK) then exit; + wsz := format('FilterGraph %p pid %x',[pointer(graph),GetCurrentProcessId()]); + result := CreateItemMoniker('!', PWideChar(wsz), Moniker); + if (result <> S_OK) then exit; + result := ROT.Register(0, Graph, Moniker, ID); + Moniker := nil; + end; + + //---------------------------------------------------------------------------- + // Disable Graphedit to connect with your filter graph + //---------------------------------------------------------------------------- + function RemoveGraphFromRot(ID: integer): HRESULT; + var ROT: IRunningObjectTable; + begin + result := GetRunningObjectTable(0, ROT); + if (result <> S_OK) then exit; + result := ROT.Revoke(ID); + ROT := nil; + end; + + function IntToTimeCode(x : longint): TDVDTimeCode; + begin + Result.Hours1 := (x and $F0000000) shr 28; + Result.Hours10 := (x and $0F000000) shr 24; + Result.Minutes1 := (x and $00F00000) shr 20; + Result.Minutes10 := (x and $000F0000) shr 16; + Result.Seconds1 := (x and $0000F000) shr 12; + Result.Seconds10 := (x and $00000F00) shr 08; + Result.Frames1 := (x and $000000F0) shr 04; + Result.Frames10 := (x and $0000000C) shr 02; + Result.FrameRateCode := (x and $00000003) shr 00; + end; + + function GetEventCodeDef(code: longint): string; + begin + case code of + EC_ACTIVATE : result:= 'EC_ACTIVATE - A video window is being activated or deactivated.'; + EC_BUFFERING_DATA : result:= 'EC_BUFFERING_DATA - The graph is buffering data, or has stopped buffering data.'; + EC_CLOCK_CHANGED : result:= 'EC_CLOCK_CHANGED - The reference clock has changed.'; + EC_COMPLETE : result:= 'EC_COMPLETE - All data from a particular stream has been rendered.'; + EC_DEVICE_LOST : result:= 'EC_DEVICE_LOST - A Plug and Play device was removed or has become available again.'; + EC_DISPLAY_CHANGED : result:= 'EC_DISPLAY_CHANGED - The display mode has changed.'; + EC_END_OF_SEGMENT : result:= 'EC_END_OF_SEGMENT - The end of a segment has been reached.'; + EC_ERROR_STILLPLAYING : result:= 'EC_ERROR_STILLPLAYING - An asynchronous command to run the graph has failed.'; + EC_ERRORABORT : result:= 'EC_ERRORABORT - An operation was aborted because of an error.'; + EC_FULLSCREEN_LOST : result:= 'EC_FULLSCREEN_LOST - The video renderer is switching out of full-screen mode.'; + EC_GRAPH_CHANGED : result:= 'EC_GRAPH_CHANGED - The filter graph has changed.'; + EC_NEED_RESTART : result:= 'EC_NEED_RESTART - A filter is requesting that the graph be restarted.'; + EC_NOTIFY_WINDOW : result:= 'EC_NOTIFY_WINDOW - Notifies a filter of the video renderer''s window.'; + EC_OLE_EVENT : result:= 'EC_OLE_EVENT - A filter is passing a text string to the application.'; + EC_OPENING_FILE : result:= 'EC_OPENING_FILE - The graph is opening a file, or has finished opening a file.'; + EC_PALETTE_CHANGED : result:= 'EC_PALETTE_CHANGED - The video palette has changed.'; + EC_PAUSED : result:= 'EC_PAUSED - A pause request has completed.'; + EC_QUALITY_CHANGE : result:= 'EC_QUALITY_CHANGE - The graph is dropping samples, for quality control.'; + EC_REPAINT : result:= 'EC_REPAINT - A video renderer requires a repaint.'; + EC_SEGMENT_STARTED : result:= 'EC_SEGMENT_STARTED - A new segment has started.'; + EC_SHUTTING_DOWN : result:= 'EC_SHUTTING_DOWN - The filter graph is shutting down, prior to being destroyed.'; + EC_SNDDEV_IN_ERROR : result:= 'EC_SNDDEV_IN_ERROR - An audio device error has occurred on an input pin.'; + EC_SNDDEV_OUT_ERROR : result:= 'EC_SNDDEV_OUT_ERROR - An audio device error has occurred on an output pin.'; + EC_STARVATION : result:= 'EC_STARVATION - A filter is not receiving enough data.'; + EC_STEP_COMPLETE : result:= 'EC_STEP_COMPLETE - A filter performing frame stepping has stepped the specified number of frames.'; + EC_STREAM_CONTROL_STARTED : result:= 'EC_STREAM_CONTROL_STARTED - A stream-control start command has taken effect.'; + EC_STREAM_CONTROL_STOPPED : result:= 'EC_STREAM_CONTROL_STOPPED - A stream-control start command has taken effect.'; + EC_STREAM_ERROR_STILLPLAYING : result:= 'EC_STREAM_ERROR_STILLPLAYING - An error has occurred in a stream. The stream is still playing.'; + EC_STREAM_ERROR_STOPPED : result:= 'EC_STREAM_ERROR_STOPPED - A stream has stopped because of an error.'; + EC_USERABORT : result:= 'EC_USERABORT - The user has terminated playback.'; + EC_VIDEO_SIZE_CHANGED : result:= 'EC_VIDEO_SIZE_CHANGED - The native video size has changed.'; + EC_WINDOW_DESTROYED : result:= 'EC_WINDOW_DESTROYED - The video renderer was destroyed or removed from the graph.'; + EC_TIMECODE_AVAILABLE : result:= 'EC_TIMECODE_AVAILABLE- Sent by filter supporting timecode.'; + EC_EXTDEVICE_MODE_CHANGE : result:= 'EC_EXTDEVICE_MODE_CHANGE - Sent by filter supporting IAMExtDevice.'; + EC_CLOCK_UNSET : result:= 'EC_CLOCK_UNSET - notify the filter graph to unset the current graph clock.'; + EC_TIME : result:= 'EC_TIME - The requested reference time occurred (currently not used).'; + EC_VMR_RENDERDEVICE_SET : result:= 'EC_VMR_RENDERDEVICE_SET - Identifies the type of rendering mechanism the VMR is using to display video.'; + + EC_DVD_ANGLE_CHANGE : result:= 'EC_DVD_ANGLE_CHANGE - Signals that either the number of available angles changed or that the current angle number changed.'; + EC_DVD_ANGLES_AVAILABLE : result:= 'EC_DVD_ANGLES_AVAILABLE - Indicates whether an angle block is being played and angle changes can be performed.'; + EC_DVD_AUDIO_STREAM_CHANGE : result:= 'EC_DVD_AUDIO_STREAM_CHANGE - Signals that the current audio stream number changed for the main title.'; + EC_DVD_BUTTON_AUTO_ACTIVATED : result:= 'EC_DVD_BUTTON_AUTO_ACTIVATED - Signals that a menu button has been automatically activated per instructions on the disc.'; + EC_DVD_BUTTON_CHANGE : result:= 'EC_DVD_BUTTON_CHANGE - Signals that either the number of available buttons changed or that the currently selected button number changed.'; + EC_DVD_CHAPTER_AUTOSTOP : result:= 'EC_DVD_CHAPTER_AUTOSTOP - Indicates that playback stopped as the result of a call to the IDvdControl2::PlayChaptersAutoStop method.'; + EC_DVD_CHAPTER_START : result:= 'EC_DVD_CHAPTER_START - Signals that the DVD Navigator started playback of a new chapter in the current title.'; + EC_DVD_CMD_START : result:= 'EC_DVD_CMD_START - Signals that a particular command has begun.'; + EC_DVD_CMD_END : result:= 'EC_DVD_CMD_END - Signals that a particular command has completed.'; + EC_DVD_CURRENT_HMSF_TIME : result:= 'EC_DVD_CURRENT_HMSF_TIME - Signals the current time in DVD_HMSF_TIMECODE format at the beginning of every VOBU, which occurs every .4 to 1.0 sec.'; + EC_DVD_CURRENT_TIME : result:= 'EC_DVD_CURRENT_TIME - Signals the beginning of every video object unit (VOBU), a video segment which is 0.4 to 1.0 seconds in length.'; + EC_DVD_DISC_EJECTED : result:= 'EC_DVD_DISC_EJECTED - Signals that a disc has been ejected from the drive.'; + EC_DVD_DISC_INSERTED : result:= 'EC_DVD_DISC_INSERTED - Signals that a disc has been inserted into the drive.'; + EC_DVD_DOMAIN_CHANGE : result:= 'EC_DVD_DOMAIN_CHANGE - Indicates the DVD Navigator''s new domain.'; + EC_DVD_ERROR : result:= 'EC_DVD_ERROR - Signals a DVD error condition.'; + EC_DVD_KARAOKE_MODE : result:= 'EC_DVD_KARAOKE_MODE - Indicates that the Navigator has either begun playing or finished playing karaoke data.'; + EC_DVD_NO_FP_PGC : result:= 'EC_DVD_NO_FP_PGC - Indicates that the DVD disc does not have a FP_PGC (First Play Program Chain).'; + EC_DVD_PARENTAL_LEVEL_CHANGE : result:= 'EC_DVD_PARENTAL_LEVEL_CHANGE - Signals that the parental level of the authored content is about to change.'; + EC_DVD_PLAYBACK_RATE_CHANGE : result:= 'EC_DVD_PLAYBACK_RATE_CHANGE - Indicates that a playback rate change has been initiated and the new rate is in the parameter.'; + EC_DVD_PLAYBACK_STOPPED : result:= 'EC_DVD_PLAYBACK_STOPPED - Indicates that playback has been stopped. The DVD Navigator has completed playback of the title and did not find any other branching instruction for subsequent playback.'; + EC_DVD_PLAYPERIOD_AUTOSTOP : result:= 'EC_DVD_PLAYPERIOD_AUTOSTOP - Indicates that the Navigator has finished playing the segment specified in a call to PlayPeriodInTitleAutoStop.'; + EC_DVD_STILL_OFF : result:= 'EC_DVD_STILL_OFF - Signals the end of any still.'; + EC_DVD_STILL_ON : result:= 'EC_DVD_STILL_ON - Signals the beginning of any still.'; + EC_DVD_SUBPICTURE_STREAM_CHANGE : result:= 'EC_DVD_SUBPICTURE_STREAM_CHANGE - Signals that the current subpicture stream number changed for the main title.'; + EC_DVD_TITLE_CHANGE : result:= 'EC_DVD_TITLE_CHANGE - Indicates when the current title number changes.'; + EC_DVD_VALID_UOPS_CHANGE : result:= 'EC_DVD_VALID_UOPS_CHANGE - Signals that the available set of IDVDControl2 interface methods has changed.'; + EC_DVD_WARNING : result:= 'EC_DVD_WARNING - Signals a DVD warning condition.' + else + result := format('Unknow Graph Event ($%x)',[code]); + end; + end; + + // general purpose function to delete a heap allocated AM_MEDIA_TYPE structure + // which is useful when calling IEnumMediaTypes::Next as the interface + // implementation allocates the structures which you must later delete + // the format block may also be a pointer to an interface to release + procedure DeleteMediaType(pmt: PAMMediaType); + begin + // allow nil pointers for coding simplicity + if (pmt = nil) then exit; + FreeMediaType(pmt); + CoTaskMemFree(pmt); + end; + + // this also comes in useful when using the IEnumMediaTypes interface so + // that you can copy a media type, you can do nearly the same by creating + // a CMediaType object but as soon as it goes out of scope the destructor + // will delete the memory it allocated (this takes a copy of the memory) + function CreateMediaType(pSrc: PAMMediaType): PAMMediaType; + var pMediaType: PAMMediaType; + begin + ASSERT(pSrc<>nil); + + // Allocate a block of memory for the media type + pMediaType := CoTaskMemAlloc(sizeof(TAMMediaType)); + if (pMediaType = nil) then + begin + result := nil; + exit; + end; + + // Copy the variable length format block + CopyMediaType(pMediaType,pSrc); + result := pMediaType; + end; + + //---------------------------------------------------------------------------- + // Copies a task-allocated AM_MEDIA_TYPE structure. + //---------------------------------------------------------------------------- + procedure CopyMediaType(pmtTarget: PAMMediaType; pmtSource: PAMMediaType); + begin + // We'll leak if we copy onto one that already exists - there's one + // case we can check like that - copying to itself. + ASSERT(pmtSource <> pmtTarget); + //pmtTarget^ := pmtSource^; + move(pmtSource^, pmtTarget^, SizeOf(TAMMediaType)); + if (pmtSource.cbFormat <> 0) then + begin + ASSERT(pmtSource.pbFormat <> nil); + pmtTarget.pbFormat := CoTaskMemAlloc(pmtSource.cbFormat); + if (pmtTarget.pbFormat = nil) then + pmtTarget.cbFormat := 0 + else + CopyMemory(pmtTarget.pbFormat, pmtSource.pbFormat, pmtTarget.cbFormat); + end; + if (pmtTarget.pUnk <> nil) then pmtTarget.pUnk._AddRef; + end; + + procedure FreeMediaType(mt: PAMMediaType); + begin + if (mt^.cbFormat <> 0) then + begin + CoTaskMemFree(mt^.pbFormat); + // Strictly unnecessary but tidier + mt^.cbFormat := 0; + mt^.pbFormat := nil; + end; + if (mt^.pUnk <> nil) then mt^.pUnk := nil; + end; + + //---------------------------------------------------------------------------- + // Initializes a media type structure given a wave format structure. + //---------------------------------------------------------------------------- + function CreateAudioMediaType(pwfx: PWaveFormatEx; pmt: PAMMediaType; bSetFormat: boolean): HRESULT; + begin + pmt.majortype := MEDIATYPE_Audio; + if (pwfx.wFormatTag = WAVE_FORMAT_EXTENSIBLE) then + pmt.subtype := PWAVEFORMATEXTENSIBLE(pwfx).SubFormat + else + pmt.subtype := FOURCCMap(pwfx.wFormatTag); + pmt.formattype := FORMAT_WaveFormatEx; + pmt.bFixedSizeSamples := TRUE; + pmt.bTemporalCompression := FALSE; + pmt.lSampleSize := pwfx.nBlockAlign; + pmt.pUnk := nil; + if (bSetFormat) then + begin + if (pwfx.wFormatTag = WAVE_FORMAT_PCM) then + pmt.cbFormat := sizeof(TWAVEFORMATEX) + else + pmt.cbFormat := sizeof(TWAVEFORMATEX) + pwfx.cbSize; + pmt.pbFormat := CoTaskMemAlloc(pmt.cbFormat); + if (pmt.pbFormat = nil) then + begin + result := E_OUTOFMEMORY; + exit; + end; + if (pwfx.wFormatTag = WAVE_FORMAT_PCM) then + begin + CopyMemory(pmt.pbFormat, pwfx, sizeof(PCMWAVEFORMAT)); + PWAVEFORMATEX(pmt.pbFormat).cbSize := 0; + end + else + begin + CopyMemory(pmt.pbFormat, pwfx, pmt.cbFormat); + end; + end; + result := S_OK; + end; + + function FOURCCMap(Fourcc: Cardinal): TGUID; + const tmpguid : TGUID = '{00000000-0000-0010-8000-00AA00389B71}'; + begin + result := tmpguid; + result.D1 := Fourcc; + end; + + { Convert a FCC (Four Char Codes) to Cardinal. A FCC identifie a media type.} + {$NODEFINE FCC} + function FCC(str: String): Cardinal; + begin + Assert(Length(str) >= 4); + result := PDWORD(str)^; + end; + + function GetFOURCC(Fourcc: Cardinal): string; + type TFOURCC= array[0..3] of char; + var CC: TFOURCC; + begin + case Fourcc of + 0 : result := 'RGB'; + 1 : result := 'RLE8'; + 2 : result := 'RLE4'; + 3 : result := 'BITFIELDS'; + else + PDWORD(@CC)^ := Fourcc; // abracadabra + result := CC; + end; + end; + + {$NODEFINE MAKEFOURCC} + function MAKEFOURCC(ch0, ch1, ch2, ch3: char): Cardinal; + begin + result := Cardinal(BYTE(ch0)) or + (Cardinal(BYTE(ch1)) shl 8) or + (Cardinal(BYTE(ch2)) shl 16) or + (Cardinal(BYTE(ch3)) shl 24) + end; + + function GetErrorString(hr: HRESULT): string; + var buffer: array[0..254] of char; + begin + AMGetErrorText(hr,@buffer,255); + result := buffer; + end; + + function GetMediaMajorTypeDescription(MediaType: PAMMediaType): string; + begin + result := ''; + if IsEqualGUID(MediaType.majortype,MEDIATYPE_AnalogAudio) then result := result+'AnalogAudio' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_AnalogVideo) then result := result+'Analogvideo' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_Audio) then result := result+'Audio' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_AUXLine21Data) then result := result+'AUXLine21Data' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_File) then result := result+'File' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_Interleaved) then result := result+'Interleaved' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_LMRT) then result := result+'LMRT' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_Midi) then result := result+'Midi' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_MPEG2_PES) then result := result+'MPEG2_PES' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_ScriptCommand) then result := result+'ScriptCommand' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_Stream) then result := result+'Stream' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_Text) then result := result+'Text' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_Timecode) then result := result+'Timecode' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_URL_STREAM) then result := result+'URL_STREAM' else + if IsEqualGUID(MediaType.majortype,MEDIATYPE_Video) then result := result+'Video' else + result := result+'UnKnown '; + end; + + function GetMediaSubTypeDescription(MediaType: PAMMediaType): string; + begin + result := ''; + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_CLPL) then result := result+'CLPL' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_YUYV) then result := result+'YUYV' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_IYUV) then result := result+'IYUV' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_YVU9) then result := result+'YVU9' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Y411) then result := result+'Y411' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Y41P) then result := result+'Y41P' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_YUY2) then result := result+'YUY2' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_YVYU) then result := result+'YVYU' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_UYVY) then result := result+'UYVY' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Y211) then result := result+'Y211' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_YV12) then result := result+'YV12' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_CLJR) then result := result+'CLJR' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_IF09) then result := result+'IF09' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_CPLA) then result := result+'CPLA' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MJPG) then result := result+'MJPG' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_TVMJ) then result := result+'TVMJ' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_WAKE) then result := result+'WAKE' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_CFCC) then result := result+'CFCC' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_IJPG) then result := result+'IJPG' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Plum) then result := result+'Plum' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DVCS) then result := result+'DVCS' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DVSD) then result := result+'DVSD' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MDVF) then result := result+'MDVF' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_RGB1) then result := result+'RGB1' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_RGB4) then result := result+'RGB4' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_RGB8) then result := result+'RGB8' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_RGB565) then result := result+'RGB565' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_RGB555) then result := result+'RGB555' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_RGB24) then result := result+'RGB24' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_RGB32) then result := result+'RGB32' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_ARGB32) then result := result+'ARGB32' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Overlay) then result := result+'Overlay' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG1Packet) then result := result+'MPEG1Packet' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG1Payload) then result := result+'MPEG1Payload' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG1AudioPayload) then result := result+'MPEG1AudioPayload' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG1System) then result := result+'MPEG1System' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG1VideoCD) then result := result+'MPEG1VideoCD' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG1Video) then result := result+'MPEG1Video' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG1Audio) then result := result+'MPEG1Audio' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Avi) then result := result+'Avi' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Asf) then result := result+'Asf' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_QTMovie) then result := result+'QTMovie' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_QTRpza) then result := result+'QTRpza' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_QTSmc) then result := result+'QTSmc' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_QTRle) then result := result+'QTRle' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_QTJpeg) then result := result+'QTJpeg' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_PCMAudio_Obsolete) then result := result+'PCMAudio_Obsolete' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_PCM) then result := result+'PCM' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_WAVE) then result := result+'WAVE' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AU) then result := result+'AU' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AIFF) then result := result+'AIFF' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_dvsd_) then result := result+'dvsd_' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_dvhd) then result := result+'dvhd' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_dvsl) then result := result+'dvsl' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Line21_BytePair) then result := result+'Line21_BytePair' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Line21_GOPPacket) then result := result+'Line21_GOPPacket' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_Line21_VBIRawData) then result := result+'Line21_VBIRawData' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DRM_Audio) then result := result+'DRM_Audio' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_IEEE_FLOAT) then result := result+'IEEE_FLOAT' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DOLBY_AC3_SPDIF) then result := result+'DOLBY_AC3_SPDIF' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_RAW_SPORT) then result := result+'RAW_SPORT' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_SPDIF_TAG_241h) then result := result+'SPDIF_TAG_241h' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DssVideo) then result := result+'DssVideo' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DssAudio) then result := result+'DssAudio' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_VPVideo) then result := result+'VPVideo' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_VPVBI) then result := result+'VPVBI' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_NTSC_M) then result := result+'AnalogVideo_NTSC_M' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_PAL_B) then result := result+'AnalogVideo_PAL_B' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_PAL_D) then result := result+'AnalogVideo_PAL_D' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_PAL_G) then result := result+'AnalogVideo_PAL_G' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_PAL_H) then result := result+'AnalogVideo_PAL_H' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_PAL_I) then result := result+'AnalogVideo_PAL_I' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_PAL_M) then result := result+'AnalogVideo_PAL_M' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_PAL_N) then result := result+'AnalogVideo_PAL_N' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_PAL_N_COMBO) then result := result+'AnalogVideo_PAL_N_COMBO' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_SECAM_B) then result := result+'AnalogVideo_SECAM_B' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_SECAM_D) then result := result+'AnalogVideo_SECAM_D' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_SECAM_G) then result := result+'AnalogVideo_SECAM_G' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_SECAM_H) then result := result+'AnalogVideo_SECAM_H' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_SECAM_K) then result := result+'AnalogVideo_SECAM_K' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_SECAM_K1) then result := result+'AnalogVideo_SECAM_K1' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_AnalogVideo_SECAM_L) then result := result+'AnalogVideo_SECAM_L' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG2_VIDEO) then result := result+'MPEG2_VIDEO' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG2_PROGRAM) then result := result+'MPEG2_PROGRAM' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG2_TRANSPORT) then result := result+'MPEG2_TRANSPORT' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MPEG2_AUDIO) then result := result+'MPEG2_AUDIO' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DOLBY_AC3) then result := result+'DOLBY_AC3' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DVD_SUBPICTURE) then result := result+'DVD_SUBPICTURE' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DVD_LPCM_AUDIO) then result := result+'DVD_LPCM_AUDIO' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DTS) then result := result+'DTS' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_SDDS) then result := result+'SDDS' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DVD_NAVIGATION_PCI) then result := result+'PCI' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DVD_NAVIGATION_DSI) then result := result+'DSI' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER) then result := result+'PROVIDER' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_MP42) then result := result+'MS-MPEG4' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_DIVX) then result := result+'DIVX' else + if IsEqualGUID(MediaType.subtype,MEDIASUBTYPE_VOXWARE) then result := result+'VOXWARE_MetaSound' else + result := result+'UnKnown '; + end; + + function GetMediaFormatTypeDescription(MediaType: PAMMediaType): string; + begin + result := ''; + if IsEqualGUID(MediaType.formattype,FORMAT_VideoInfo) then + begin + result := result+'VideoInfo '; + if ((MediaType.cbFormat > 0) and assigned(MediaType.pbFormat)) then + with PVideoInfoHeader(MediaType.pbFormat)^.bmiHeader do + result := result + format('%s %dX%d, %d bits', + [GetFOURCC(biCompression), biWidth, biHeight, biBitCount]); + end + else + begin + if IsEqualGUID(MediaType.formattype,FORMAT_VideoInfo2) then + begin + result := result+'VideoInfo2 '; + if ((MediaType.cbFormat > 0) and assigned(MediaType.pbFormat)) then + with PVideoInfoHeader2(MediaType.pbFormat)^.bmiHeader do + result := result + format('%s %dX%d, %d bits', + [GetFOURCC(biCompression), biWidth, biHeight, biBitCount]); + end + else + begin + if IsEqualGUID(MediaType.formattype,FORMAT_WaveFormatEx) then + begin + result := result+'WaveFormatEx: '; + if ((MediaType.cbFormat > 0) and assigned(MediaType.pbFormat)) then + begin + case PWaveFormatEx(MediaType.pbFormat)^.wFormatTag of + $0001: result := result+'PCM'; // common + $0002: result := result+'ADPCM'; + $0003: result := result+'IEEE_FLOAT'; + $0005: result := result+'IBM_CVSD'; + $0006: result := result+'ALAW'; + $0007: result := result+'MULAW'; + $0010: result := result+'OKI_ADPCM'; + $0011: result := result+'DVI_ADPCM'; + $0012: result := result+'MEDIASPACE_ADPCM'; + $0013: result := result+'SIERRA_ADPCM'; + $0014: result := result+'G723_ADPCM'; + $0015: result := result+'DIGISTD'; + $0016: result := result+'DIGIFIX'; + $0017: result := result+'DIALOGIC_OKI_ADPCM'; + $0018: result := result+'MEDIAVISION_ADPCM'; + $0020: result := result+'YAMAHA_ADPCM'; + $0021: result := result+'SONARC'; + $0022: result := result+'DSPGROUP_TRUESPEECH'; + $0023: result := result+'ECHOSC1'; + $0024: result := result+'AUDIOFILE_AF36'; + $0025: result := result+'APTX'; + $0026: result := result+'AUDIOFILE_AF10'; + $0030: result := result+'DOLBY_AC2'; + $0031: result := result+'GSM610'; + $0032: result := result+'MSNAUDIO'; + $0033: result := result+'ANTEX_ADPCME'; + $0034: result := result+'CONTROL_RES_VQLPC'; + $0035: result := result+'DIGIREAL'; + $0036: result := result+'DIGIADPCM'; + $0037: result := result+'CONTROL_RES_CR10'; + $0038: result := result+'NMS_VBXADPCM'; + $0039: result := result+'CS_IMAADPCM'; + $003A: result := result+'ECHOSC3'; + $003B: result := result+'ROCKWELL_ADPCM'; + $003C: result := result+'ROCKWELL_DIGITALK'; + $003D: result := result+'XEBEC'; + $0040: result := result+'G721_ADPCM'; + $0041: result := result+'G728_CELP'; + $0050: result := result+'MPEG'; + $0055: result := result+'MPEGLAYER3'; + $0060: result := result+'CIRRUS'; + $0061: result := result+'ESPCM'; + $0062: result := result+'VOXWARE'; + $0063: result := result+'CANOPUS_ATRAC'; + $0064: result := result+'G726_ADPCM'; + $0065: result := result+'G722_ADPCM'; + $0066: result := result+'DSAT'; + $0067: result := result+'DSAT_DISPLAY'; + $0075: result := result+'VOXWARE'; // aditionnal ??? + $0080: result := result+'SOFTSOUND'; + $0100: result := result+'RHETOREX_ADPCM'; + $0200: result := result+'CREATIVE_ADPCM'; + $0202: result := result+'CREATIVE_FASTSPEECH8'; + $0203: result := result+'CREATIVE_FASTSPEECH10'; + $0220: result := result+'QUARTERDECK'; + $0300: result := result+'FM_TOWNS_SND'; + $0400: result := result+'BTV_DIGITAL'; + $1000: result := result+'OLIGSM'; + $1001: result := result+'OLIADPCM'; + $1002: result := result+'OLICELP'; + $1003: result := result+'OLISBC'; + $1004: result := result+'OLIOPR'; + $1100: result := result+'LH_CODEC'; + $1400: result := result+'NORRIS'; + else + result := result+'Unknown'; + end; + + with PWaveFormatEx(MediaType.pbFormat)^ do + result := result + format(', %d Hertz, %d Bits, %d Channels', + [nSamplesPerSec, wBitsPerSample, nChannels]); + end; + end + else + begin + if IsEqualGUID(MediaType.formattype,FORMAT_MPEGVideo) then + begin + result := result+'MPEGVideo '; + if ((MediaType.cbFormat > 0) and assigned(MediaType.pbFormat)) then + with PMPEG1VIDEOINFO(MediaType.pbFormat)^.hdr.bmiHeader do + result := result + format('%s %dX%d, %d bits', + [GetFOURCC(biCompression), biWidth, biHeight, biBitCount]); + + end + else + begin + if IsEqualGUID(MediaType.formattype,FORMAT_MPEG2Video) then + begin + result := result+'MPEGStreams '; + if ((MediaType.cbFormat > 0) and assigned(MediaType.pbFormat)) then + with PMPEG2VIDEOINFO(MediaType.pbFormat)^.hdr.bmiHeader do + result := result + format('%s %dX%d, %d bits', + [GetFOURCC(biCompression), biWidth, biHeight, biBitCount]); + end + else + begin // todo + if IsEqualGUID(MediaType.formattype,FORMAT_DvInfo) then result := result+'DvInfo' else + if IsEqualGUID(MediaType.formattype,FORMAT_MPEGStreams) then result := result+'MPEGStreams' else + if IsEqualGUID(MediaType.formattype,FORMAT_DolbyAC3) then result := result+'DolbyAC3' else + if IsEqualGUID(MediaType.formattype,FORMAT_MPEG2Audio) then result := result+'MPEG2Audio' else + if IsEqualGUID(MediaType.formattype,FORMAT_DVD_LPCMAudio) then result := result+'DVD_LPCMAudio' else + result := result+'Unknown'; + end; + end; + end; + end; + end; + end; + + function GetMediaTypeDescription(MediaType: PAMMediaType): string; + begin + // major types + result := 'Major Type: '; + result := result + GetMediaMajorTypeDescription(MediaType); + + // sub types + result := result + ' - Sub Type: '; + result := result + GetMediaSubTypeDescription(MediaType); + + // format + result := result+ ' Format: '; + result := result + GetMediaFormatTypeDescription(MediaType); + end; + + function ShowFilterPropertyPage(parent: THandle; Filter: IBaseFilter; + PropertyPage: TPropertyPage = ppDefault): HRESULT; + var + SpecifyPropertyPages : ISpecifyPropertyPages; + CaptureDialog : IAMVfwCaptureDialogs; + CompressDialog: IAMVfwCompressDialogs; + CAGUID :TCAGUID; + FilterInfo: TFilterInfo; + Code: Integer; + begin + result := S_FALSE; + code := 0; + if Filter = nil then exit; + + ZeroMemory(@FilterInfo, SizeOf(TFilterInfo)); + + case PropertyPage of + ppVFWCapDisplay: code := VfwCaptureDialog_Display; + ppVFWCapFormat : code := VfwCaptureDialog_Format; + ppVFWCapSource : code := VfwCaptureDialog_Source; + ppVFWCompConfig: code := VfwCompressDialog_Config; + ppVFWCompAbout : code := VfwCompressDialog_About; + end; + + case PropertyPage of + ppDefault: + begin + result := Filter.QueryInterface(IID_ISpecifyPropertyPages, SpecifyPropertyPages); + if result <> S_OK then exit; + result := SpecifyPropertyPages.GetPages(CAGUID); + if result <> S_OK then exit; + result := Filter.QueryFilterInfo(FilterInfo); + if result = S_OK then + begin + result := OleCreatePropertyFrame(parent, 0, 0, FilterInfo.achName, 1, @Filter, CAGUID.cElems, CAGUID.pElems, 0, 0, nil ); + FilterInfo.pGraph := nil; + end; + if Assigned(CAGUID.pElems) then CoTaskMemFree(CAGUID.pElems); + SpecifyPropertyPages := nil; + end; + ppVFWCapDisplay..ppVFWCapSource: + begin + result := Filter.QueryInterface(IID_IAMVfwCaptureDialogs,CaptureDialog); + if (result <> S_OK) then exit; + result := CaptureDialog.HasDialog(code); + if result <> S_OK then exit; + result := CaptureDialog.ShowDialog(code,parent); + CaptureDialog := nil; + end; + ppVFWCompConfig..ppVFWCompAbout: + begin + result := Filter.QueryInterface(IID_IAMVfwCompressDialogs, CompressDialog); + if (result <> S_OK) then exit; + case PropertyPage of + ppVFWCompConfig: result := CompressDialog.ShowDialog(VfwCompressDialog_QueryConfig, 0); + ppVFWCompAbout : result := CompressDialog.ShowDialog(VfwCompressDialog_QueryAbout, 0); + end; + if result = S_OK then result := CompressDialog.ShowDialog(code,parent); + CompressDialog := nil; + end; + end; + end; + + function HaveFilterPropertyPage(Filter: IBaseFilter; + PropertyPage: TPropertyPage = ppDefault): boolean; + var + SpecifyPropertyPages : ISpecifyPropertyPages; + CaptureDialog : IAMVfwCaptureDialogs; + CompressDialog: IAMVfwCompressDialogs; + Code: Integer; + HR: HRESULT; + begin + result := false; + code := 0; + if Filter = nil then exit; + + case PropertyPage of + ppVFWCapDisplay: code := VfwCaptureDialog_Display; + ppVFWCapFormat : code := VfwCaptureDialog_Format; + ppVFWCapSource : code := VfwCaptureDialog_Source; + ppVFWCompConfig: code := VfwCompressDialog_QueryConfig; + ppVFWCompAbout : code := VfwCompressDialog_QueryAbout; + end; + + case PropertyPage of + ppDefault: + begin + result := Succeeded(Filter.QueryInterface(IID_ISpecifyPropertyPages, SpecifyPropertyPages)); + SpecifyPropertyPages := nil; + end; + ppVFWCapDisplay..ppVFWCapSource: + begin + HR := Filter.QueryInterface(IID_IAMVfwCaptureDialogs,CaptureDialog); + if (HR <> S_OK) then exit; + result := Succeeded(CaptureDialog.HasDialog(code)); + CaptureDialog := nil; + end; + ppVFWCompConfig..ppVFWCompAbout: + begin + HR := Filter.QueryInterface(IID_IAMVfwCompressDialogs, CompressDialog); + if (HR <> S_OK) then exit; + result := Succeeded(CompressDialog.ShowDialog(code,0)); + CompressDialog := nil; + end; + end; + end; + + function ShowPinPropertyPage(parent: THandle; Pin: IPin): HRESULT; + var + SpecifyPropertyPages: ISpecifyPropertyPages; + CAGUID :TCAGUID; + PinInfo: TPinInfo; + begin + result := S_FALSE; + if Pin = nil then exit; + result := Pin.QueryInterface(IID_ISpecifyPropertyPages, SpecifyPropertyPages); + if result <> S_OK then exit; + result := SpecifyPropertyPages.GetPages(CAGUID); + if result <> S_OK then + begin + SpecifyPropertyPages := nil; + Exit; + end; + result := Pin.QueryPinInfo(PinInfo); + if result <> S_OK then exit; + try + result := OleCreatePropertyFrame(parent, 0, 0, PinInfo.achName, 1, @Pin, + CAGUID.cElems, CAGUID.pElems, 0, 0, nil); + finally + CoTaskMemFree(CAGUID.pElems); + PinInfo.pFilter := nil; + end; + SpecifyPropertyPages := nil; + end; + + function RefTimeToMiliSec(RefTime: int64): Cardinal; + begin + result := Cardinal(RefTime div 10000); + end; + + function MiliSecToRefTime(Milisec: int64): Int64; + begin + result := Milisec * 10000; + end; + +// The mechanism for describing a bitmap format is with the BITMAPINFOHEADER +// This is really messy to deal with because it invariably has fields that +// follow it holding bit fields, palettes and the rest. This function gives +// the number of bytes required to hold a VIDEOINFO that represents it. This +// count includes the prefix information (like the rcSource rectangle) the +// BITMAPINFOHEADER field, and any other colour information on the end. +// +// WARNING If you want to copy a BITMAPINFOHEADER into a VIDEOINFO always make +// sure that you use the HEADER macro because the BITMAPINFOHEADER field isn't +// right at the start of the VIDEOINFO (there are a number of other fields), +// +// CopyMemory(HEADER(pVideoInfo),pbmi,sizeof(BITMAPINFOHEADER)); +// + + function GetBitmapFormatSize(const Header: TBitmapInfoHeader): Integer; + var Size, Entries: Integer; + begin + // Everyone has this to start with this + Size := SIZE_PREHEADER + Header.biSize; + + ASSERT(Header.biSize >= sizeof(TBitmapInfoHeader)); + + // Does this format use a palette, if the number of colours actually used + // is zero then it is set to the maximum that are allowed for that colour + // depth (an example is 256 for eight bits). Truecolour formats may also + // pass a palette with them in which case the used count is non zero + + // This would scare me. + ASSERT((Header.biBitCount <= iPALETTE) or (Header.biClrUsed = 0)); + + if ((Header.biBitCount <= iPALETTE) or BOOL(Header.biClrUsed)) then + begin + Entries := DWORD(1) shl Header.biBitCount; + if BOOL(Header.biClrUsed) then Entries := Header.biClrUsed; + Size := Size + Entries * sizeof(RGBQUAD); + end; + + // Truecolour formats may have a BI_BITFIELDS specifier for compression + // type which means that room for three DWORDs should be allocated that + // specify where in each pixel the RGB colour components may be found + + if (Header.biCompression = BI_BITFIELDS) then Size := Size + SIZE_MASKS; + result := Size; + end; + + + function GetSourceRectFromMediaType(const MediaType: TAMMediaType): TRect; + function GetbmiHeader(const MediaType: TAMMediaType): PBitmapInfoHeader; + begin + result := nil; + if MediaType.pbFormat = nil then exit; + if (IsEqualGUID(MediaType.formattype, FORMAT_VideoInfo) and + (MediaType.cbFormat >= sizeof(TVIDEOINFOHEADER))) then + result := @PVIDEOINFOHEADER(MediaType.pbFormat)^.bmiHeader + else if (IsEqualGUID(MediaType.formattype, FORMAT_VideoInfo2) and + (MediaType.cbFormat >= sizeof(TVIDEOINFOHEADER2))) then + result := @PVIDEOINFOHEADER2(MediaType.pbFormat)^.bmiHeader; + end; + var bih: PBITMAPINFOHEADER; + begin + ZeroMemory(@Result,SizeOf(TRect)); + if MediaType.pbFormat = nil then exit; + if (IsEqualGUID(MediaType.formattype, FORMAT_VideoInfo) and + (MediaType.cbFormat >= sizeof(TVIDEOINFOHEADER))) then + result := PVideoInfoHeader(MediaType.pbFormat)^.rcSource + else if (IsEqualGUID(MediaType.formattype, FORMAT_VideoInfo2) and + (MediaType.cbFormat >= sizeof(TVIDEOINFOHEADER2))) then + result := PVIDEOINFOHEADER2(MediaType.pbFormat)^.rcSource; + if IsRectEmpty(result) then + begin + bih := GetbmiHeader(MediaType); + if bih <> nil then + SetRect(result, 0, 0, abs(bih.biWidth), abs(bih.biHeight)); + end; + end; + + function StretchRect(R, IR: TRect): TRect; + var + iW, iH: Integer; + rW, rH: Integer; + begin + iW := IR.Right - IR.Left; + iH := IR.Bottom - IR.Top; + rW := R.Right - R.Left; + rH := R.Bottom - R.Top; + if (rW / iW) < (rH / iH) then + begin + iH := MulDiv(iH, rW, iW); + iW := MulDiv(iW, rW, iW); + end + else + begin + iW := MulDiv(iW, rH, iH); + iH := MulDiv(iH, rH, iH); + end; + SetRect(Result, 0, 0, iW, iH); + OffsetRect(Result, R.Left + (rW - iW) div 2, R.Top + (rH - iH) div 2); + end; + + function CheckDSError(HR: HRESULT): HRESULT; + var Excep: EDirectShowException; + begin + Result := HR; + if Failed(HR) then + begin + Excep := EDirectShowException.Create(format(GetErrorString(HR)+' ($%x).',[HR])); + Excep.ErrorCode := HR; + raise Excep; + end; + end; + + + //----------------------------------------------------------------------------- + // Name: DXUtil_GetDXSDKMediaPath() + // Desc: Returns the DirectX SDK media path + //----------------------------------------------------------------------------- + function GetDXSDKMediaPath : String; + var + strPath : array[1..MAX_PATH+10] of Char; + Key : HKey; + dwType, dwSize : DWord; + lr : Longint; + + begin + Key := 0; + dwType := 0; + dwSize := MAX_PATH; + + // Initialize to NULL + strPath[1] := #0; + + // Open the appropriate registry key + lr := RegOpenKeyEx(HKEY_LOCAL_MACHINE, 'Software\Microsoft\DirectX SDK', + 0, KEY_READ, Key); + if(ERROR_SUCCESS <> lr) then + begin + Result := ''; + Exit; + end; + + lr := RegQueryValueEx(Key, 'DX9SDK Samples Path', nil, + @dwType, @strPath, @dwSize); + + if (ERROR_SUCCESS <> lr) then + begin + // Reset size field + dwSize := MAX_PATH; + lr := RegQueryValueEx(Key, 'DX81SDK Samples Path', nil, + @dwType, @strPath, @dwSize); + + if (ERROR_SUCCESS <> lr) then + begin + // Reset size field + dwSize := MAX_PATH; + lr := RegQueryValueEx(Key, 'DX8SDK Samples Path', nil, + @dwType, @strPath, @dwSize); + + if (ERROR_SUCCESS <> lr) then + begin + RegCloseKey(Key); + Result := ''; + Exit; + end; + end; + end; + + RegCloseKey(Key); + Result := PChar(@strPath); + Result := Result + '\Media\'; + end; + + function CopyScreenToBitmap(Rect : TRect; pData : PByte; + pHeader : PBitmapInfo) : HBitmap; + var + // screen DC and memory DC + hScrDC, hMemDC : HDC; + // handles to deice-dependent bitmaps + hBmp, hOldBmp : HBitmap; + // coordinates of rectangle to grab + nX, nY, nX2, nY2, + // DIB width and height + nWidth, nHeight, + // screen resolution + xScrn, yScrn : Integer; + + begin + // check for an empty rectangle + if IsRectEmpty(Rect) then + begin + Result := 0; + Exit; + end; + + // create a DC for the screen and create + // a memory DC compatible to screen DC + hScrDC := CreateDC('DISPLAY', nil, nil, nil); + hMemDC := CreateCompatibleDC(hScrDC); + + // get points of rectangle to grab + nX := Rect.Left; + nY := Rect.Top; + nX2:= Rect.Right; + nY2:= Rect.Bottom; + + // get screen resolution + xScrn := GetDeviceCaps(hScrDC, HORZRES); + yScrn := GetDeviceCaps(hScrDC, VERTRES); + + //make sure bitmap rectangle is visible + if (nX < 0) then + nX := 0; + if (nY < 0) then + nY := 0; + if (nX2 > xScrn) then + nX2 := xScrn; + if (nY2 > yScrn) then + nY2 := yScrn; + + nWidth := nX2 - nX; + nHeight := nY2 - nY; + + // create a bitmap compatible with the screen DC + hBmp := CreateCompatibleBitmap(hScrDC, nWidth, nHeight); + + // select new bitmap into memory DC + hOldBmp := SelectObject(hMemDC, hBmp); + + // bitblt screen DC to memory DC + BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY); + + // select old bitmap back into memory DC and get handle to + // bitmap of the screen + hBmp := SelectObject(hMemDC, hOldBmp); + + // Copy the bitmap data into the provided BYTE buffer + GetDIBits(hScrDC, hBmp, 0, nHeight, pData, pHeader^, DIB_RGB_COLORS); + + // clean up + DeleteDC(hScrDC); + DeleteDC(hMemDC); + + // return handle to the bitmap + Result := hBmp; + end; + + +// ***************************************************************************** +// TSysDevEnum +// ***************************************************************************** + + procedure TSysDevEnum.GetCat(catlist: TList; CatGUID: TGUID); + var + SysDevEnum : ICreateDevEnum; + EnumCat : IEnumMoniker; + Moniker : IMoniker; + Fetched : ULONG; + PropBag : IPropertyBag; + Name : olevariant; + hr : HRESULT; + i : integer; + begin + if catList.Count > 0 then + for i := 0 to (catList.Count - 1) do if assigned(catList.Items[i]) then Dispose(catList.Items[i]); + catList.Clear; + CocreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC, IID_ICreateDevEnum, SysDevEnum); + hr := SysDevEnum.CreateClassEnumerator(CatGUID, EnumCat, 0); + if (hr = S_OK) then + begin + while(EnumCat.Next(1, Moniker, @Fetched) = S_OK) do + begin + Moniker.BindToStorage(nil, nil, IID_IPropertyBag, PropBag); + new(ACategory); + PropBag.Read('FriendlyName', Name, nil); + ACategory^.FriendlyName := Name; + if (PropBag.Read('CLSID',Name,nil) = S_OK) then + ACategory^.CLSID := StringToGUID(Name) + else + ACategory^.CLSID := GUID_NULL; + catlist.Add(ACategory); + PropBag := nil; + Moniker := nil; + end; + end; + EnumCat :=nil; + SysDevEnum :=nil; + end; + + constructor TSysDevEnum.Create; + begin + FCategories := TList.Create; + FFilters := TList.Create; + getcat(FCategories,CLSID_ActiveMovieCategories); + end; + + constructor TSysDevEnum.create(guid: TGUID); + begin + FCategories := TList.Create; + FFilters := TList.Create; + getcat(FCategories,CLSID_ActiveMovieCategories); + SelectGUIDCategory(guid); + end; + + destructor TSysDevEnum.Destroy; + var i: integer; + begin + inherited Destroy; + if FCategories.Count > 0 then + for i := 0 to (FCategories.Count - 1) do + if assigned(FCategories.Items[i]) then Dispose(FCategories.items[i]); + FCategories.Clear; + FreeAndNil(FCategories); + if FFilters.Count > 0 then + for i := 0 to (FFilters.Count - 1) do + if assigned(FFilters.Items[i]) then Dispose(FFilters.Items[i]); + FFilters.Clear; + FreeAndNil(FFilters); + end; + + function TSysDevEnum.GetCategory(item: integer): TFilCatNode; + var PCategory: PFilCatNode; + begin + PCategory := FCategories.Items[item]; + result := PCategory^; + end; + + function TSysDevEnum.GetFilter(item: integer): TFilCatNode; + var PCategory: PFilCatNode; + begin + PCategory := FFilters.Items[item]; + result := PCategory^; + end; + + function TSysDevEnum.GetCountCategories: integer; + begin + result := FCategories.Count; + end; + + function TSysDevEnum.GetCountFilters: integer; + begin + result := FFilters.Count; + end; + + // Find filter index by FriendlyName; -1, if not found + function TSysDevEnum.FilterIndexOfFriendlyName(const FriendlyName: string): Integer; + begin + Result := FFilters.Count - 1; + while (Result >= 0) and + (AnsiCompareText(PFilCatNode(FFilters.Items[Result])^.FriendlyName, FriendlyName) <> 0) do + Dec(Result); + end; + + procedure TSysDevEnum.SelectGUIDCategory(GUID: TGUID); + begin + FGUID := GUID; + getcat(FFilters,FGUID); + end; + + procedure TSysDevEnum.SelectIndexCategory(index: integer); + begin + SelectGUIDCategory(Categories[index].CLSID); + end; + + function TSysDevEnum.GetMoniker(index: integer): IMoniker; + var + SysDevEnum : ICreateDevEnum; + EnumCat : IEnumMoniker; + begin + result := nil; + if ((index < CountFilters) and (index >= 0)) then + begin + CocreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC, IID_ICreateDevEnum, SysDevEnum); + SysDevEnum.CreateClassEnumerator(FGUID, EnumCat, 0); + EnumCat.Skip(index); + EnumCat.Next(1, Result, nil); + EnumCat.Reset; + SysDevEnum := nil; + EnumCat := nil; + end + end; + + function TSysDevEnum.GetBaseFilter(index: integer): IBaseFilter; + var + SysDevEnum : ICreateDevEnum; + EnumCat : IEnumMoniker; + Moniker : IMoniker; + begin + result := nil; + if ((index < CountFilters) and (index >= 0)) then + begin + CocreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC, IID_ICreateDevEnum, SysDevEnum); + SysDevEnum.CreateClassEnumerator(FGUID, EnumCat, 0); + EnumCat.Skip(index); + EnumCat.Next(1, Moniker, nil); + Moniker.BindToObject(nil, nil, IID_IBaseFilter, result); + EnumCat.Reset; + SysDevEnum := nil; + EnumCat := nil; + Moniker := nil; + end + end; + + function TSysDevEnum.GetBaseFilter(GUID: TGUID): IBaseFilter; + var + i: integer; + begin + result := nil; + if countFilters > 0 then + for i := 0 to CountFilters - 1 do + if IsEqualGUID(GUID,Filters[i].CLSID) then + begin + result := GetBaseFilter(i); + exit; + end; + end; + +//****************************************************************************** +// +// TMediaType implementation +// +//****************************************************************************** + + destructor TMediaType.Destroy; + begin + FreeMediaType(AMMediaType); + dispose(AMMediaType); + inherited Destroy; + end; + + // copy constructor does a deep copy of the format block + + constructor TMediaType.Create; + begin + InitMediaType; + end; + + constructor TMediaType.Create(majortype: TGUID); + begin + InitMediaType; + AMMediaType.majortype := majortype; + end; + + constructor TMediaType.Create(mediatype: PAMMediaType); + begin + InitMediaType; + CopyMediaType(AMMediaType, mediatype); + end; + + constructor TMediaType.Create(MTClass: TMediaType); + begin + InitMediaType; + CopyMediaType(AMMediaType, MTClass.AMMediaType); + end; + + procedure TMediaType.DefineProperties(Filer: TFiler); + function DoWrite: Boolean; + begin + result := true; + if Filer.Ancestor <> nil then + begin + Result := True; + if Filer.Ancestor is TMediaType then + Result := not Equal(TMediaType(Filer.Ancestor)) + end; + end; + begin + Filer.DefineBinaryProperty('data', ReadData, WriteData, DoWrite); + end; + + procedure TMediaType.ReadData(Stream: TStream); + begin + ResetFormatBuffer; + Stream.Read(AMMediaType^, SizeOf(TAMMediaType)); + if FormatLength > 0 then + begin + AMMediaType.pbFormat := CoTaskMemAlloc(FormatLength); + Stream.Read(AMMediaType.pbFormat^, FormatLength) + end; + end; + + procedure TMediaType.WriteData(Stream: TStream); + begin + Stream.Write(AMMediaType^, SizeOf(TAMMediaType)); + if FormatLength > 0 then + Stream.Write(AMMediaType.pbFormat^, FormatLength); + end; + + // copy MTClass.AMMediaType to current AMMediaType + procedure TMediaType.Assign(Source: TPersistent); + begin + if Source is TMediaType then + begin + if (Source <> self) then + begin + FreeMediaType(AMMediaType); + CopyMediaType(AMMediaType, TMediaType(Source).AMMediaType); + end; + end + else + inherited Assign(Source); + end; + + // this class inherits publicly from AM_MEDIA_TYPE so the compiler could generate + // the following assignment operator itself, however it could introduce some + // memory conflicts and leaks in the process because the structure contains + // a dynamically allocated block (pbFormat) which it will not copy correctly + procedure TMediaType.Read(mediatype: PAMMediaType); + begin + if (mediatype <> self.AMMediaType) then + begin + FreeMediaType(AMMediaType); + CopyMediaType(AMMediaType, mediatype); + end; + end; + + function TMediaType.Equal(MTClass: TMediaType): boolean; + begin + // I don't believe we need to check sample size or + // temporal compression flags, since I think these must + // be represented in the type, subtype and format somehow. They + // are pulled out as separate flags so that people who don't understand + // the particular format representation can still see them, but + // they should duplicate information in the format block. + result := ((IsEqualGUID(AMMediaType.majortype,MTClass.AMMediaType.majortype) = TRUE) and + (IsEqualGUID(AMMediaType.subtype,MTClass.AMMediaType.subtype) = TRUE) and + (IsEqualGUID(AMMediaType.formattype,MTClass.AMMediaType.formattype) = TRUE) and + (AMMediaType.cbFormat = MTClass.AMMediaType.cbFormat) and + ( (AMMediaType.cbFormat = 0) or + (CompareMem(AMMediaType.pbFormat, MTClass.AMMediaType.pbFormat, AMMediaType.cbFormat)))); + end; + + // Check to see if they are equal + function TMediaType.NotEqual(MTClass: TMediaType): boolean; + begin + if (self = MTClass) then + result := FALSE + else + result := TRUE; + end; + + // By default, TDSMediaType objects are initialized with a major type of GUID_NULL. + // Call this method to determine whether the object has been correctly initialized. + function TMediaType.IsValid: boolean; + begin + result := not IsEqualGUID(AMMediaType.majortype,GUID_NULL); + end; + + // Determines if the samples have a fixed size or a variable size. + function TMediaType.IsFixedSize: boolean; + begin + result := AMMediaType.bFixedSizeSamples; + end; + + // Determines if the stream uses temporal compression. + function TMediaType.IsTemporalCompressed: boolean; + begin + result := AMMediaType.bTemporalCompression; + end; + + // If the sample size is fixed, returns the sample size in bytes. Otherwise, + // returns zero. + function TMediaType.GetSampleSize: ULONG; + begin + if IsFixedSize then + result := AMMediaType.lSampleSize + else + result := 0; + end; + + // If value of sz is zero, the media type uses variable sample sizes. Otherwise, + // the sample size is fixed at sz bytes. + procedure TMediaType.SetSampleSize(SZ: ULONG); + begin + if (sz = 0) then + begin + SetVariableSize; + end + else + begin + AMMediaType.bFixedSizeSamples := TRUE; + AMMediaType.lSampleSize := sz; + end; + end; + + // Specifies that samples do not have a fixed size. + procedure TMediaType.SetVariableSize; + begin + AMMediaType.bFixedSizeSamples := FALSE; + end; + + // Specifies whether samples are compressed using temporal compression + procedure TMediaType.SetTemporalCompression(bCompressed: boolean); + begin + AMMediaType.bTemporalCompression := bCompressed; + end; + + // Retrieves a pointer to the format block. + function TMediaType.Format: pointer; + begin + result := AMMediaType.pbFormat; + end; + + //Retrieves the length of the format block. + function TMediaType.FormatLength: ULONG; + begin + result := AMMediaType.cbFormat; + end; + + function TMediaType.SetFormat(pFormat: pointer; length: ULONG): boolean; + begin + if (nil = AllocFormatBuffer(length)) then + begin + result := false; + exit; + end; + ASSERT(AMMediatype.pbFormat<>nil); + CopyMemory(AMMediatype.pbFormat,pFormat,length); + result := true; + end; + + // reset the format buffer + procedure TMediaType.ResetFormatBuffer; + begin + if (AMMediaType.cbFormat <> 0) then + CoTaskMemFree(AMMediaType.pbFormat); + AMMediaType.cbFormat := 0; + AMMediaType.pbFormat := nil; + end; + + // allocate length bytes for the format and return a read/write pointer + // If we cannot allocate the new block of memory we return NULL leaving + // the original block of memory untouched (as does ReallocFormatBuffer) + function TMediaType.AllocFormatBuffer(length: ULONG): pointer; + var pNewFormat : pointer; + begin + ASSERT(length<>0); + + // do the types have the same buffer size + if (AMMediaType.cbFormat = length) then + begin + result := AMMediaType.pbFormat; + exit; + end; + + // allocate the new format buffer + pNewFormat := CoTaskMemAlloc(length); + if (pNewFormat = nil) then + begin + if (length <= AMMediaType.cbFormat) then + begin + result := AMMediatype.pbFormat; //reuse the old block anyway. + exit; + end + else + begin + result := nil; + exit; + end; + end; + + // delete the old format + if (AMMediaType.cbFormat <> 0) then + begin + ASSERT(AMMediaType.pbFormat<>nil); + CoTaskMemFree(AMMediaType.pbFormat); + end; + + AMMediaType.cbFormat := length; + AMMediaType.pbFormat := pNewFormat; + result := AMMediaType.pbFormat; + end; + + // reallocate length bytes for the format and return a read/write pointer + // to it. We keep as much information as we can given the new buffer size + // if this fails the original format buffer is left untouched. The caller + // is responsible for ensuring the size of memory required is non zero + function TMediaType.ReallocFormatBuffer(length: ULONG): pointer; + var pNewFormat: pointer; + begin + ASSERT(length<>0); + + // do the types have the same buffer size + if (AMMediaType.cbFormat = length) then + begin + result := AMMediaType.pbFormat; + exit; + end; + + // allocate the new format buffer + pNewFormat := CoTaskMemAlloc(length); + if (pNewFormat = nil) then + begin + if (length <= AMMediaType.cbFormat) then + begin + result := AMMediaType.pbFormat; //reuse the old block anyway. + exit; + end + else + begin + result := nil; + exit; + end; + end; + + // copy any previous format (or part of if new is smaller) + // delete the old format and replace with the new one + if (AMMediaType.cbFormat <> 0) then + begin + ASSERT(AMMediaType.pbFormat<>nil); + CopyMemory(pNewFormat, AMMediaType.pbFormat, min(length,AMMediaType.cbFormat)); + CoTaskMemFree(AMMediaType.pbFormat); + end; + + AMMediaType.cbFormat := length; + AMMediaType.pbFormat := pNewFormat; + result := pNewFormat; + end; + + // initialise a media type structure + procedure TMediaType.InitMediaType; + begin + new(AMMediaType); + ZeroMemory(AMMediaType, sizeof(TAMMediaType)); + AMMediaType.lSampleSize := 1; + AMMediaType.bFixedSizeSamples := TRUE; + end; + + //Determines if this media type matches a partially specified media type. + function TMediaType.MatchesPartial(ppartial: TMediaType): boolean; + begin + if (not IsEqualGUID(ppartial.AMMediaType.majortype, GUID_NULL) and + not IsEqualGUID(AMMediaType.majortype, ppartial.AMMediaType.majortype)) then + begin + result := false; + exit; + end; + if (not IsEqualGUID(ppartial.AMMediaType.subtype, GUID_NULL) and + not IsEqualGUID(AMMediaType.subtype, ppartial.AMMediaType.subtype)) then + begin + result := false; + exit; + end; + + if not IsEqualGUID(ppartial.AMMediaType.formattype, GUID_NULL) then + begin + // if the format block is specified then it must match exactly + if not IsEqualGUID(AMMediaType.formattype, ppartial.AMMediaType.formattype) then + begin + result := FALSE; + exit; + end; + if (AMMediaType.cbFormat <> ppartial.AMMediaType.cbFormat) then + begin + result := FALSE; + exit; + end; + if ((AMMediaType.cbFormat <> 0) and + (CompareMem(AMMediaType.pbFormat, ppartial.AMMediaType.pbFormat, AMMediaType.cbFormat) <> false)) then + begin + result := FALSE; + exit; + end; + end; + result := TRUE; + end; + + // a partially specified media type can be passed to IPin::Connect + // as a constraint on the media type used in the connection. + // the type, subtype or format type can be null. + function TMediaType.IsPartiallySpecified: boolean; + begin + if (IsEqualGUID(AMMediaType.majortype, GUID_NULL) or + IsEqualGUID(AMMediaType.formattype, GUID_NULL)) then + begin + result := TRUE; + exit; + end + else + begin + result := FALSE; + exit; + end; + end; + + function TMediaType.GetMajorType: TGUID; + begin + result := AMMediaType.majortype; + end; + + procedure TMediaType.SetMajorType(MT: TGUID); + begin + AMMediaType.majortype := MT; + end; + + function TMediaType.GetSubType: TGUID; + begin + result := AMMediaType.subtype; + end; + + procedure TMediaType.SetSubType(ST: TGUID); + begin + AMMediaType.subtype := ST; + end; + + // set the type of the media type format block, this type defines what you + // will actually find in the format pointer. For example FORMAT_VideoInfo or + // FORMAT_WaveFormatEx. In the future this may be an interface pointer to a + // property set. Before sending out media types this should be filled in. + procedure TMediaType.SetFormatType(const GUID: TGUID); + begin + AMMediaType.formattype := GUID; + end; + + function TMediaType.GetFormatType: TGUID; + begin + result := AMMediaType.formattype; + end; + +//****************************************************************************** +// +// TDSEnumMediaType Implementation +// +//****************************************************************************** + + constructor TEnumMediaType.Create; + begin + FList := TList.Create; + end; + + constructor TEnumMediaType.Create(Pin: IPin); + var EnumMT : IEnumMediaTypes; + hr : HRESULT; + begin + FList := TList.Create; + assert(pin <> nil,'IPin not assigned'); + hr := pin.EnumMediaTypes(EnumMT); + if (hr <> S_OK) then exit; + Create(ENumMT); + end; + + constructor TEnumMediaType.Create(EnumMT: IEnumMediaTypes); + var pmt: PAMMediaType; + begin + if (FList = nil) then FList := TList.Create; + assert(EnumMT <> nil,'IEnumMediaType not assigned'); + while (EnumMT.Next(1,pmt,nil)= S_OK) do + begin + FList.Add(TMediaType.Create(pmt)); + end; + end; + + constructor TEnumMediaType.Create(FileName: TFileName); + begin + FList := TList.Create; + Assign(FileName); + end; + + destructor TEnumMediaType.Destroy; + begin + Clear; + FList.Free; + end; + + procedure TEnumMediaType.Assign(Pin: IPin); + var EnumMT : IEnumMediaTypes; + hr : HRESULT; + begin + Clear; + assert(pin <> nil,'IPin not assigned'); + hr := pin.EnumMediaTypes(EnumMT); + if (hr <> S_OK) then exit; + Assign(ENumMT); + end; + + procedure TEnumMediaType.Assign(EnumMT: IEnumMediaTypes); + var pmt: PAMMediaType; + begin + if (count <> 0) then Clear; + assert(EnumMT <> nil,'IEnumMediaType not assigned'); + while (EnumMT.Next(1,pmt,nil)= S_OK) do + begin + FList.Add(TMediaType.Create(pmt)); + end; + end; + + procedure TEnumMediaType.Assign(FileName: TFileName); + var + MediaDet: IMediaDet; + KeyProvider : IServiceProvider; + hr: HRESULT; + Streams: LongInt; + i: longint; + MediaType: TAMMediaType; + begin + Clear; + hr := CoCreateInstance(CLSID_MediaDet, nil, CLSCTX_INPROC, IID_IMediaDet, MediaDet); + // milenko start get rid of compiler warnings ... + if (hr = S_OK) then + begin + end; + // milenko end; + assert(hr = S_OK, 'Media Detector not available'); + hr := MediaDet.put_Filename(FileName); + if hr <> S_OK then + begin + MediaDet := nil; + Exit; + end; + MediaDet.get_OutputStreams(Streams); + if streams > 0 then + begin + for i := 0 to (streams - 1) do + begin + MediaDet.put_CurrentStream(i); + MediaDet.get_StreamMediaType(MediaType); + FList.Add(TMediaType.Create(@MediaType)); + end; + end; + KeyProvider := nil; + MediaDet := nil; + end; + + function TEnumMediaType.GetItem(Index: Integer): TMediaType; + begin + result := TMediaType(Flist.Items[index]); + end; + + function TEnumMediaType.GetMediaMajorDescription(Index: Integer): string; + begin + result := ''; + if ((index < count) and (index > -1)) then + result := GetMediaMajorTypeDescription(TMediaType(Flist.Items[index]).AMMediaType); + end; + + function TEnumMediaType.GetMediaSubDescription(Index: Integer): string; + begin + result := ''; + if ((index < count) and (index > -1)) then + result := GetMediaSubTypeDescription(TMediaType(Flist.Items[index]).AMMediaType); + end; + + function TEnumMediaType.GetMediaFormatDescription(Index: Integer): string; + begin + result := ''; + if ((index < count) and (index > -1)) then + result := GetMediaFormatTypeDescription(TMediaType(Flist.Items[index]).AMMediaType); + end; + + function TEnumMediaType.GetMediaDescription(Index: Integer): string; + begin + result := ''; + if ((index < count) and (index > -1)) then + result := GetMediaTypeDescription(TMediaType(Flist.Items[index]).AMMediaType); + end; + + procedure TEnumMediaType.SetItem(Index: Integer; Item: TMediaType); + begin + TMediaType(Flist.Items[index]).Assign(item); + end; + + function TEnumMediaType.GetCount: integer; + begin + assert(FList<>nil,'TDSEnumMediaType not created'); + if (FList <> nil) then + result := FList.Count + else + result := 0; + end; + + function TEnumMediaType.Add(Item: TMediaType): Integer; + begin + result := FList.Add(Item); + end; + + procedure TEnumMediaType.Clear; + var i: Integer; + begin + if count <> 0 then + for i := 0 to (count -1) do + begin + if (FList.Items[i]<>nil) then TMediaType(FList.Items[i]).Free; + end; + FList.Clear; + end; + + procedure TEnumMediaType.Delete(Index: Integer); + begin + if (FList.Items[index]<>nil) then TMediaType(FList.Items[index]).Free; + FList.Delete(index); + end; + +// ***************************************************************************** +// TDSFilterList implementation +// ***************************************************************************** + + constructor TFilterList.Create(FilterGraph: IFilterGraph); + begin + inherited Create; + Graph := FilterGraph; + Update; + end; + + destructor TFilterList.Destroy; + begin + inherited Destroy; + end; + + procedure TFilterList.Update; + var EnumFilters: IEnumFilters; + Filter: IBaseFilter; + begin + if assigned(Graph) then + Graph.EnumFilters(EnumFilters); + while (EnumFilters.Next(1, Filter, nil) = S_OK) do add(Filter); + EnumFilters := nil; + end; + + procedure TFilterList.Assign(FilterGraph: IFilterGraph); + begin + Clear; + Graph := FilterGraph; + Update; + end; + + function TFilterList.GetFilter(Index: Integer): IBaseFilter; + begin + result := get(index) as IBaseFilter; + end; + + procedure TFilterList.PutFilter(Index: Integer; Item: IBaseFilter); + begin + put(index,Item); + end; + + function TFilterList.First: IBaseFilter; + begin + result := GetFilter(0); + end; + + function TFilterList.IndexOf(Item: IBaseFilter): Integer; + begin + result := inherited IndexOf(Item); + end; + + function TFilterList.Add(Item: IBaseFilter): Integer; + begin + result := inherited Add(Item); + end; + + procedure TFilterList.Insert(Index: Integer; Item: IBaseFilter); + begin + inherited Insert(index,item); + end; + + function TFilterList.Last: IBaseFilter; + begin + result := inherited Last as IBaseFilter; + end; + + function TFilterList.Remove(Item: IBaseFilter): Integer; + begin + result := inherited Remove(Item); + end; + + function TFilterList.GetFilterInfo(index: integer): TFilterInfo; + begin + if assigned(items[index]) then items[index].QueryFilterInfo(result); + end; + +// ***************************************************************************** +// TPinList +// ***************************************************************************** + + constructor TPinList.Create(BaseFilter: IBaseFilter); + begin + inherited Create; + Filter := BaseFilter; + Update; + end; + + destructor TPinList.Destroy; + begin + Filter := nil; + inherited Destroy; + end; + + procedure TPinList.Update; + var + EnumPins : IEnumPins; + Pin : IPin; + begin + clear; + if assigned(Filter) then Filter.EnumPins(EnumPins) else exit; + while (EnumPins.Next(1, pin, nil) = S_OK) do add(Pin); + EnumPins := nil; + end; + + procedure TPinList.Assign(BaseFilter: IBaseFilter); + begin + Clear; + Filter := BaseFilter; + if Filter <> nil then Update; + end; + + function TPinList.GetConnected(Index: Integer): boolean; + var Pin: IPin; + begin + Items[Index].ConnectedTo(Pin); + Result := (Pin <> nil); + end; + + function TPinList.GetPin(Index: Integer): IPin; + begin + result := get(index) as IPin; + end; + + procedure TPinList.PutPin(Index: Integer; Item: IPin); + begin + put(index,Item); + end; + + function TPinList.First: IPin; + begin + result := GetPin(0); + end; + + function TPinList.IndexOf(Item: IPin): Integer; + begin + result := inherited IndexOf(Item); + end; + + function TPinList.Add(Item: IPin): Integer; + begin + result := inherited Add(Item); + end; + + procedure TPinList.Insert(Index: Integer; Item: IPin); + begin + inherited Insert(index,item); + end; + + function TPinList.Last: IPin; + begin + result := inherited Last as IPin; + end; + + function TPinList.Remove(Item: IPin): Integer; + begin + result := inherited Remove(Item); + end; + + function TPinList.GetPinInfo(index: integer): TPinInfo; + begin + if assigned(Items[index]) then Items[index].QueryPinInfo(result); + end; + +// ***************************************************************************** +// TPersistentMemory +// ***************************************************************************** + + constructor TPersistentMemory.Create; + begin + FData := nil; + FDataLength := 0; + end; + + destructor TPersistentMemory.Destroy; + begin + AllocateMemory(0); + inherited destroy; + end; + + procedure TPersistentMemory.AllocateMemory(ALength: Cardinal); + begin + if (FDataLength > 0) and (FData <> nil) then + begin + FreeMem(FData, FDataLength); + FData := nil; + FDataLength := 0; + end; + if ALength > 0 then + begin + GetMem(FData, ALength); + ZeroMemory(FData, ALength); + FDataLength := ALength; + end + end; + + procedure TPersistentMemory.ReadData(Stream: TStream); + var ALength: Cardinal; + begin + Stream.Read(ALength, SizeOf(Cardinal)); + AllocateMemory(ALength); + if ALength > 0 then + Stream.Read(FData^, ALength); + end; + + procedure TPersistentMemory.WriteData(Stream: TStream); + begin + Stream.Write(FDataLength, SizeOf(Cardinal)); + if FDataLength > 0 then + Stream.Write(FData^, FDataLength); + end; + + procedure TPersistentMemory.Assign(Source: TPersistent); + begin + if Source is TPersistentMemory then + begin + if (Source <> self) then + begin + AllocateMemory(TPersistentMemory(Source).FDataLength); + if FDataLength > 0 then + move(TPersistentMemory(Source).FData^, FData^, FDataLength); + end; + end + else + inherited Assign(Source); + end; + + procedure TPersistentMemory.AssignTo(Dest: TPersistent); + begin + Dest.Assign(self); + end; + + function TPersistentMemory.Equal(Memory: TPersistentMemory): boolean; + begin + result := false; + if (Memory.FDataLength > 0) and (Memory.FDataLength = FDataLength) and + (Memory.FData <> nil) and (FData <> nil) then + result := comparemem(Memory.FData, FData, FDataLength); + end; + + procedure TPersistentMemory.DefineProperties(Filer: TFiler); + function DoWrite: Boolean; + begin + result := true; + if Filer.Ancestor <> nil then + begin + Result := True; + if Filer.Ancestor is TPersistentMemory then + Result := not Equal(TPersistentMemory(Filer.Ancestor)) + end; + end; + + begin + Filer.DefineBinaryProperty('data', ReadData, WriteData, DoWrite); + end; + +// ***************************************************************************** +// TBaseFilter +// ***************************************************************************** + + procedure TBaseFilter.SetMoniker(Moniker: IMoniker); + var + MemStream : TMemoryStream; + AdaStream : TStreamAdapter; + begin + if Moniker = nil then + begin + DataLength := 0; + exit; + end; + MemStream := TMemoryStream.Create; + AdaStream := TStreamAdapter.Create(MemStream, soReference); + OleSaveToStream(Moniker, AdaStream); + DataLength := MemStream.Size; + move(MemStream.Memory^, Data^, DataLength); + AdaStream.Free; + MemStream.Free; + end; + + function TBaseFilter.GetMoniker: IMoniker; + var + MemStream : TMemoryStream; + AdaStream : TStreamAdapter; + begin + if DataLength > 0 then + begin + MemStream := TMemoryStream.Create; + MemStream.SetSize(DataLength); + move(Data^, MemStream.Memory^, DataLength); + AdaStream := TStreamAdapter.Create(MemStream, soReference); + OleLoadFromStream(AdaStream, IMoniker, result); + AdaStream.Free; + MemStream.Free; + end + else + result := nil; + end; + + function TBaseFilter.CreateFilter: IBaseFilter; + var + AMoniker : IMoniker; + begin + AMoniker := Moniker; + if AMoniker <> nil then + begin + AMoniker.BindToObject(nil, nil, IBaseFilter, result); + AMoniker := nil; + end + else + result := nil; + end; + + function TBaseFilter.PropertyBag(Name: WideString): OleVariant; + var + AMoniker : IMoniker; + PropBag : IPropertyBag; + begin + AMoniker := Moniker; + if AMoniker <> nil then + begin + AMoniker.BindToStorage(nil, nil, IID_IPropertyBag, PropBag); + if PropBag <> nil then PropBag.Read(PWideChar(Name), result, nil); + PropBag := nil; + AMoniker := nil; + end + else + result := NULL; + end; + +// milenko start (added functions from dshowutil.cpp) +function FindRenderer(pGB: IGraphBuilder; const mediatype: PGUID; out ppFilter: IBaseFilter): HRESULT; +var + Enum : IEnumFilters; + Filter: IBaseFilter; + Pin : IPin; + Fetched, + InPins, + OutPins: Cardinal; + Found: Boolean; + MediaType_: TAMMediaType; +begin + Found := False; + + // Verify graph builder interface + if not Assigned(pGB) then + begin + Result := E_NOINTERFACE; + Exit; + end; + + // Verify that a media type was passed + if not Assigned(mediatype) then + begin + Result := E_POINTER; + Exit; + end; + + // Clear the filter pointer in case there is no match + if Assigned(ppFilter) then ppFilter := nil; + + // Get filter enumerator + Result := pGB.EnumFilters(Enum); + if FAILED(Result) then Exit; + + Enum.Reset; + + // Enumerate all filters in the graph + while((not Found) and (Enum.Next(1, Filter, @Fetched) = S_OK)) do + begin + // Find a filter with one input and no output pins + Result := CountFilterPins(Filter, InPins, OutPins); + if FAILED(Result) then break; + + if ((InPins = 1) and (OutPins = 0)) then + begin + // Get the first pin on the filter + Pin := nil; + Pin := GetInPin(Filter, 0); + + // Read this pin's major media type + Result := Pin.ConnectionMediaType(MediaType_); + if FAILED(Result) then break; + + // Is this pin's media type the requested type? + // If so, then this is the renderer for which we are searching. + // Copy the interface pointer and return. + if IsEqualGUID(MediaType_.majortype,mediatype^) then + begin + // Found our filter + ppFilter := Filter; + Found := True; + end else + begin + // This is not the renderer, so release the interface. + Filter := nil; + end; + + // Delete memory allocated by ConnectionMediaType() + UtilFreeMediaType(@MediaType_); + end else + begin + // No match, so release the interface + Filter := nil; + end; + end; + + Enum := nil; +end; + +function FindAudioRenderer(pGB: IGraphBuilder; out ppFilter: IBaseFilter): HRESULT; +begin + Result := FindRenderer(pGB, @MEDIATYPE_Audio, ppFilter); +end; + +function FindVideoRenderer(pGB: IGraphBuilder; out ppFilter: IBaseFilter): HRESULT; +begin + Result := FindRenderer(pGB, @MEDIATYPE_Video, ppFilter); +end; + +function CountFilterPins(pFilter: IBaseFilter; out pulInPins: Cardinal; out pulOutPins: Cardinal): HRESULT; +var + Enum: IEnumPins; + Found: Cardinal; + Pin: IPin; + PinDir: TPinDirection; +begin + // Verify input + if (not Assigned(pFilter) or not Assigned(@pulInPins) or not Assigned(@pulOutPins)) then + begin + Result := E_POINTER; + Exit; + end; + + // Clear number of pins found + pulInPins := 0; + pulOutPins := 0; + + // Get pin enumerator + Result := pFilter.EnumPins(Enum); + if FAILED(Result) then Exit; + + Enum.Reset; + + // Count every pin on the filter + while(S_OK = Enum.Next(1, Pin, @Found)) do + begin + Result := Pin.QueryDirection(PinDir); + if (PinDir = PINDIR_INPUT) then inc(pulInPins) + else inc(pulOutPins); + Pin := nil; + end; + + Enum := nil; +end; + +function CountTotalFilterPins(pFilter: IBaseFilter; out pulPins: Cardinal): HRESULT; +var + Enum: IEnumPins; + Found: Cardinal; + Pin: IPin; +begin + // Verify input + if (not Assigned(pFilter) or not Assigned(@pulPins)) then + begin + Result := E_POINTER; + Exit; + end; + + // Clear number of pins found + pulPins := 0; + + // Get pin enumerator + Result := pFilter.EnumPins(Enum); + if FAILED(Result) then Exit; + + // Count every pin on the filter, ignoring direction + while(S_OK = Enum.Next(1, Pin, @Found)) do + begin + inc(pulPins); + Pin := nil; + end; + + Enum := nil; +end; + +function GetPin(pFilter: IBaseFilter; dirrequired: TPinDirection; iNum: integer; out ppPin: IPin): HRESULT; +var + Enum: IEnumPins; + Found: Cardinal; + Pin: IPin; + PinDir: TPinDirection; +begin + ppPin := nil; + + if not Assigned(pFilter) then + begin + Result := E_POINTER; + Exit; + end; + + Result := pFilter.EnumPins(Enum); + if FAILED(Result) then Exit; + + Result := E_FAIL; + + while(S_OK = Enum.Next(1, Pin, @Found)) do + begin + Pin.QueryDirection(PinDir); + if (PinDir = dirrequired) then + begin + if (iNum = 0) then + begin + ppPin := Pin; // Return the pin's interface + Result := S_OK; // Found requested pin, so clear error + break; + end; + inc(iNum); + end; + Pin := nil; + end; + Enum := nil; +end; + +function GetInPin(pFilter: IBaseFilter; nPin: integer): IPin; +begin + GetPin(pFilter, PINDIR_INPUT, nPin, Result); +end; + +function GetOutPin(pFilter: IBaseFilter; nPin: integer): IPin; +begin + GetPin(pFilter, PINDIR_OUTPUT, nPin, Result); +end; + +function FindOtherSplitterPin(pPinIn: IPin; guid: TGUID; nStream: integer; out ppSplitPin: IPin): HRESULT; +var + PinOut: IPin; + ThisPinInfo, + pi: TPinInfo; + EnumPins: IEnumPins; + Fetched: Cardinal; + Pin: IPin; + MediaEnum: IEnumMediaTypes; + MediaType: PAMMediaType; +begin + if not Assigned(ppSplitPin) then + begin + Result := E_POINTER; + Exit; + end; + + PinOut := pPinIn; + + while Assigned(PinOut) do + begin + PinOut.QueryPinInfo(ThisPinInfo); + if Assigned(ThisPinInfo.pFilter) then ThisPinInfo.pFilter := nil; + + PinOut := nil; + ThisPinInfo.pFilter.EnumPins(EnumPins); + if not Assigned(EnumPins) then + begin + // return NULL; ??? + Result := S_FALSE; + Exit; + end; + + // look at every pin on the current filter... + while True do + begin + Fetched := 0; + ASSERT(not Assigned(Pin)); // is it out of scope? + EnumPins.Next(1, Pin, @Fetched); + if not BOOL(Fetched) then break; + + Pin.QueryPinInfo(pi); + if Assigned(pi.pFilter) then pi.pFilter := nil; + + // if it's an input pin... + if (pi.dir = PINDIR_INPUT) then + begin + // continue searching upstream from this pin + Pin.ConnectedTo(PinOut); + + // a pin that supports the required media type is the + // splitter pin we are looking for! We are done + end else + begin + Pin.EnumMediaTypes(MediaEnum); + if Assigned(MediaEnum) then + begin + Fetched := 0; + MediaEnum.Next(1, MediaType, @Fetched); + if BOOL(Fetched) then + begin + if IsEqualGUID(MediaType.majortype,guid) then + begin + dec(nStream); + if(nStream = 0) then + begin + UtilDeleteMediaType(MediaType); + ppSplitPin := Pin; + Result := S_OK; + Exit; + end; + end; + UtilDeleteMediaType(MediaType); + end; + end; + end; + // go try the next pin + end; // while + end; + + ASSERT(False); + Result := E_FAIL; +end; + +function SeekNextFrame(pSeeking: IMediaSeeking; FPS: Double; Frame: LongInt): HRESULT; +var + Pos: TReferenceTime; +begin + // try seeking by frames first + Pos := 0; + Result := pSeeking.SetTimeFormat(TIME_FORMAT_FRAME); + if not FAILED(Result) then + begin + pSeeking.GetCurrentPosition(Pos); + inc(Pos); + end else + begin + // couldn't seek by frames, use Frame and FPS to calculate time + Pos := Round(Frame * UNITS / FPS); + // add a half-frame to seek to middle of the frame + Pos := Pos + Round(UNITS * 0.5 / FPS); + end; + + Result := pSeeking.SetPositions(Pos, AM_SEEKING_AbsolutePositioning, + Pos, AM_SEEKING_NoPositioning); +end; + +procedure ShowFilenameByCLSID(clsid: TGUID; out szFilename: WideString); +begin + szFilename := ''; + with TRegistry.Create do + begin + RootKey := HKEY_LOCAL_MACHINE; + if KeyExists('Software\Classes\CLSID\' + GUIDToString(clsid) + 'InprocServer32') then + begin + if OpenKeyReadOnly('Software\Classes\CLSID\' + GUIDToString(clsid) + 'InprocServer32') then + begin + szFilename := ReadString(''); + CloseKey; + end; + end; + Free; + end; +end; + +function GetFileDurationString(pMS: IMediaSeeking; out szDuration: WideString): HRESULT; +var + guidOriginalFormat: TGUID; + Duration: Int64; + TotalMS: Cardinal; + MS: integer; + Seconds: integer; + Minutes: integer; +begin + if not Assigned(pMS) then + begin + Result := E_NOINTERFACE; + Exit; + end; + + if not Assigned(@szDuration) then + begin + Result := E_POINTER; + Exit; + end; + + // Initialize the display in case we can't read the duration + szDuration := '<00:00.000>'; + + // Is media time supported for this file? + if (S_OK <> pMS.IsFormatSupported(TIME_FORMAT_MEDIA_TIME)) then + begin + Result := E_NOINTERFACE; + Exit; + end; + + // Read the time format to restore later + Result := pMS.GetTimeFormat(guidOriginalFormat); + if FAILED(Result) then Exit; + + // Ensure media time format for easy display + Result := pMS.SetTimeFormat(TIME_FORMAT_MEDIA_TIME); + if FAILED(Result) then Exit; + + // Read the file's duration + Result := pMS.GetDuration(Duration); + if FAILED(Result) then Exit; + + // Return to the original format + if not IsEqualGUID(guidOriginalFormat,TIME_FORMAT_MEDIA_TIME) then + begin + Result := pMS.SetTimeFormat(guidOriginalFormat); + if FAILED(Result) then Exit; + end; + + // Convert the LONGLONG duration into human-readable format + TotalMS := Cardinal(Duration div 10000); // 100ns -> ms + MS := TotalMS mod 1000; + Seconds := TotalMS div 1000; + Minutes := Seconds div 60; + Seconds := Seconds mod 60; + + // Update the string + szDuration := inttostr(Minutes) + 'm:' + inttostr(Seconds) + '.' + inttostr(MS) + 's'; +end; + +function CanFrameStep(pGB: IGraphBuilder): Boolean; +var + pFS: IVideoFrameStep; + hr: HRESULT; +begin + // Get frame step interface + hr := pGB.QueryInterface(IID_IVideoFrameStep, pFS); + if FAILED(hr) then + begin + Result := False; + Exit; + end; + + // Check if this decoder can step + hr := pFS.CanStep(0, nil); + + // Release frame step interface + pFS := nil; + + Result := hr = S_OK; +end; + +procedure UtilDeleteMediaType(pmt: PAMMediaType); +begin + // Allow NULL pointers for coding simplicity + if (pmt = nil) then Exit; + + // Free media type's format data + if (pmt.cbFormat <> 0) then + begin + CoTaskMemFree(pmt.pbFormat); + // Strictly unnecessary but tidier + pmt.cbFormat := 0; + pmt.pbFormat := nil; + end; + + // Release interface + if (pmt.pUnk <> nil) then pmt.pUnk := nil; + + // Free media type + CoTaskMemFree(pmt); +end; + +procedure UtilFreeMediaType(pmt: PAMMediaType); +begin + if (pmt.cbFormat <> 0) then + begin + CoTaskMemFree(pmt.pbFormat); + // Strictly unnecessary but tidier + pmt.cbFormat := 0; + pmt.pbFormat := nil; + end; + + if (pmt.pUnk <> nil) then pmt.pUnk := nil; +end; + +const + wszStreamName: WideString = 'ActiveMovieGraph'; + +function SaveGraphFile(pGraph: IGraphBuilder; wszPath: WideString): HRESULT; +var + Storage: IStorage; + Stream: IStream; + Persist: IPersistStream; +begin + Result := StgCreateDocfile( + PWideChar(wszPath), + STGM_CREATE or STGM_TRANSACTED or STGM_READWRITE or STGM_SHARE_EXCLUSIVE, + 0, Storage); + if FAILED(Result) then Exit; + + Result := Storage.CreateStream( + PWideChar(wszStreamName), + STGM_WRITE or STGM_CREATE or STGM_SHARE_EXCLUSIVE, + 0, 0, Stream); + if FAILED(Result) then Exit; + + pGraph.QueryInterface(IID_IPersistStream, Persist); + Result := Persist.Save(Stream, True); + Stream := nil; + Persist := nil; + if SUCCEEDED(Result) then Result := Storage.Commit(STGC_DEFAULT); + Storage := nil; +end; + +function LoadGraphFile(pGraph: IGraphBuilder; const wszName: WideString): HRESULT; +var + Storage: IStorage; + Stream: IStream; + PersistStream: IPersistStream; +begin + if (S_OK <> StgIsStorageFile(PWideChar(wszName))) then + begin + Result := E_FAIL; + Exit; + end; + + Result := StgOpenStorage(PWideChar(wszName), nil, + STGM_TRANSACTED or STGM_READ or STGM_SHARE_DENY_WRITE, + nil, 0, Storage); + + if FAILED(Result) then Exit; + + Result := pGraph.QueryInterface(IID_IPersistStream, PersistStream); + + if (SUCCEEDED(Result)) then + begin + Result := Storage.OpenStream(PWideChar(wszStreamName), nil, + STGM_READ or STGM_SHARE_EXCLUSIVE, 0, Stream); + if SUCCEEDED(Result) then + begin + Result := PersistStream.Load(Stream); + Stream := nil; + end; + PersistStream := nil; + end; + + Storage := nil; +end; +// milenko end + + +// Michael Start. +//----------------------------------------------------------------------------- +// Name: GetDXVersion() +// Desc: This function returns the DirectX version. +// Arguments: +// pdwDirectXVersion - This can be NULL. If non-NULL, the return value is: +// 0x00000000 = No DirectX installed +// 0x00010000 = DirectX 1.0 installed +// 0x00020000 = DirectX 2.0 installed +// 0x00030000 = DirectX 3.0 installed +// 0x00030001 = DirectX 3.0a installed +// 0x00050000 = DirectX 5.0 installed +// 0x00060000 = DirectX 6.0 installed +// 0x00060100 = DirectX 6.1 installed +// 0x00060101 = DirectX 6.1a installed +// 0x00070000 = DirectX 7.0 installed +// 0x00070001 = DirectX 7.0a installed +// 0x00080000 = DirectX 8.0 installed +// 0x00080100 = DirectX 8.1 installed +// 0x00080101 = DirectX 8.1a installed +// 0x00080102 = DirectX 8.1b installed +// 0x00080200 = DirectX 8.2 installed +// 0x00090000 = DirectX 9.0 installed +// 0x00090001 = DirectX 9.0a installed +// 0x00090002 = DirectX 9.0b installed +// strDirectXVersion - Destination string to receive a string name of the DirectX Version. Can be NULL. +// cchDirectXVersion - Size of destination buffer in characters. Length should be at least 10 chars. +// Returns: S_OK if the function succeeds. +// E_FAIL if the DirectX version info couldn't be determined. +// +// Please note that this code is intended as a general guideline. Your +// app will probably be able to simply query for functionality (via +// QueryInterface) for one or two components. +// +// Also please ensure your app will run on future releases of DirectX. +// For example: +// "if( dwDirectXVersion != 0x00080100 ) return false;" is VERY BAD. +// "if( dwDirectXVersion < 0x00080100 ) return false;" is MUCH BETTER. +//----------------------------------------------------------------------------- +function GetDXVersion(var pdwDirectXVersion : DWORD; out strDirectXVersion : String) : HResult; +function GetDirectXVersionViaDxDiag(var pdwDirectXVersionMajor : dword; + var pdwDirectXVersionMinor : dword; + var pcDirectXVersionLetter : char) : HResult; + +{$IFDEF VER130} +function FindVarData(const V: Variant): PVarData; +begin + Result := @TVarData(V); + while Result.VType = varByRef or varVariant do + Result := PVarData(Result.VPointer); +end; + +function VarIsType(const V: Variant; AVarType: TVarType): Boolean; +begin + Result := FindVarData(V)^.VType = AVarType; +end; +{$ENDIF} + +var + hr : HRESULT; + bCleanupCOM : Boolean; + bSuccessGettingMajor : Boolean; + bSuccessGettingMinor : Boolean; + bSuccessGettingLetter : Boolean; + bGotDirectXVersion : Boolean; + pDxDiagProvider : IDxDiagProvider; + dxDiagInitParam : TDXDIAGINITPARAMS; + pDxDiagRoot : IDxDiagContainer; + pDxDiagSystemInfo : IDxDiagContainer; + va : OleVariant; + strDestination : String; +Begin + bSuccessGettingMajor := false; + bSuccessGettingMinor := false; + bSuccessGettingLetter := false; + + // Init COM. COM may fail if its already been inited with a different + // concurrency model. And if it fails you shouldn't release it. + hr := CoInitialize(nil); + bCleanupCOM := SUCCEEDED(hr); + + // Get an IDxDiagProvider + bGotDirectXVersion := false; + + pDxDiagProvider := Nil; + + hr := CoCreateInstance(CLSID_DxDiagProvider, Nil, CLSCTX_INPROC_SERVER, IID_IDxDiagProvider, pDxDiagProvider); + if SUCCEEDED(hr) then + Begin + // Fill out a DXDIAG_INIT_PARAMS struct + dxDiagInitParam.dwSize := sizeof(TDXDIAGINITPARAMS); + dxDiagInitParam.dwDxDiagHeaderVersion := DXDIAG_DX9_SDK_VERSION; + dxDiagInitParam.bAllowWHQLChecks := false; + dxDiagInitParam.pReserved := Nil; + + // Init the m_pDxDiagProvider + hr := pDxDiagProvider.Initialize(@dxDiagInitParam); + if SUCCEEDED(hr) then + Begin + pDxDiagRoot := Nil; + pDxDiagSystemInfo := Nil; + + // Get the DxDiag root container + hr := pDxDiagProvider.GetRootContainer(pDxDiagRoot); + if SUCCEEDED(hr) then + Begin + // Get the object called DxDiag_SystemInfo + hr := pDxDiagRoot.GetChildContainer('DxDiag_SystemInfo', pDxDiagSystemInfo); + if SUCCEEDED(hr) then + Begin + // Get the "dwDirectXVersionMajor" property + VariantInit(Va); + hr := pDxDiagSystemInfo.GetProp('dwDirectXVersionMajor', va); + if (SUCCEEDED(hr)) and (VarIsType(va, VT_UI4)) then + Begin + pdwDirectXVersionMajor := Va; + bSuccessGettingMajor := true; + End; + VariantClear(va); + + // Get the "dwDirectXVersionMinor" property + hr := pDxDiagSystemInfo.GetProp('dwDirectXVersionMinor', va); + if (SUCCEEDED(hr)) and (VarIsType(va ,VT_UI4)) then + Begin + pdwDirectXVersionMinor := va; + bSuccessGettingMinor := true; + End; + VariantClear(va); + + // Get the "szDirectXVersionLetter" property + hr := pDxDiagSystemInfo.GetProp('szDirectXVersionLetter', va); + If (SUCCEEDED(hr)) and (VarIsType(va , VT_BSTR)) then + Begin + strDestination := WideCharToString(TVarData(va).VOleStr); + pcDirectXVersionLetter := StrDestination[1]; + bSuccessGettingLetter := true; + End; + VariantClear(va); + + // If it all worked right, then mark it down + bGotDirectXVersion := bSuccessGettingMajor and bSuccessGettingMinor and bSuccessGettingLetter; + pDxDiagSystemInfo := Nil; + end; + pDxDiagRoot := Nil; + End; + end; + pDxDiagProvider := Nil; + end; + + if bCleanupCOM then + CoUninitialize; + + if bGotDirectXVersion then + result := S_OK + else + result := E_FAIL; +end; + +//----------------------------------------------------------------------------- +// Name: GetDirectXVerionViaFileVersions() +// Desc: Tries to get the DirectX version by looking at DirectX file versions +//----------------------------------------------------------------------------- +function GetDirectXVerionViaFileVersions(var pdwDirectXVersionMajor : DWORD; + var pdwDirectXVersionMinor : DWORD; + var pcDirectXVersionLetter : Char) : HResult; +type + TFileVersion = record + Major : integer; + Minor : integer; + Release : integer; + Build : integer; + End; + +function CompareFileVersion(Version1, Version2 : TFileVersion) : Integer; +var + TmpStr1, + TmpStr2 : String; +Begin + TmpStr1 := Format('%4.4d%4.4d%8.8d%4.4d', [Version1.Major, Version1.Minor, Version1.Release, Version1.Build]); + TmpStr2 := Format('%4.4d%4.4d%8.8d%4.4d', [Version2.Major, Version2.Minor, Version2.Release, Version2.Build]); + // milenko start (delph 5 compatibility) + // Result := CompareValue(Strtoint64(TmpStr1),Strtoint64(TmpStr2)); + Result := Strtoint64(TmpStr1) - Strtoint64(TmpStr2); + if Result > 0 then Result := 1 + else if Result < 0 then Result := -1; + // milenko end +End; + +function ReadVersionInfo(Filename: string) : TFileVersion; +var + Info : PVSFixedFileInfo; +{$ifdef VER120} + InfoSize : Cardinal; +{$else} + InfoSize : UINT; +{$endif} + nHwnd : DWORD; + BufferSize : DWORD; + Buffer : Pointer; +begin + ZeroMemory(@Result, Sizeof(TFileVersion)); + If Not FileExists(Filename) then Exit; + BufferSize := GetFileVersionInfoSize(pchar(filename),nHWnd); // Get buffer size + if BufferSize <> 0 then // if zero, there is no version info + begin + GetMem( Buffer, BufferSize); // allocate buffer memory + try + if GetFileVersionInfo(PChar(filename),nHWnd,BufferSize,Buffer) then + begin + // got version info + if VerQueryValue(Buffer, '\', Pointer(Info), InfoSize) then + begin + // got root block version information + Result.Major := HiWord(Info^.dwFileVersionMS); // extract major version + Result.Minor := LoWord(Info^.dwFileVersionMS); // extract minor version + Result.Release := HiWord(Info^.dwFileVersionLS); // extract release version + Result.Build := LoWord(Info^.dwFileVersionLS); // extract build version + end; + end; + finally + FreeMem(Buffer, BufferSize); // release buffer memory + end; + end; +end; + +function FileVersion(Major, Minor, Release, Build : integer) : TFileVersion; +Begin + Result.Major := Major; + Result.Minor := Minor; + Result.Release := Release; + Result.Build := Build; +End; + +var + szPath : PChar; + Path : String; + + ddraw_Version, + d3drg8x_Version, + dplayx_Version, + dinput_Version, + d3d8_Version, + mpg2splt_Version, + dpnet_Version, + d3d9_Version : TFileVersion; +begin + pdwDirectXVersionMajor := 0; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + + Result := E_Fail; + szPath := GetMemory(MAX_PATH); + If GetSystemDirectory(szPath, MAX_PATH) = 0 then + Begin + FreeMemory(szPath); + Exit; + End; + Path := StrPas(szPath); + FreeMemory(szPath); + If Path[length(Path)] <> '\' then + Path := Path + '\'; + + ddraw_Version := ReadVersionInfo(Path+'ddraw.dll'); + d3drg8x_Version := ReadVersionInfo(Path+'d3drg8x.dll'); + dplayx_Version := ReadVersionInfo(Path+'dplayx.dll'); + dinput_Version := ReadVersionInfo(Path+'dinput.dll'); + d3d8_Version := ReadVersionInfo(Path+'d3d8.dll'); + mpg2splt_Version := ReadVersionInfo(Path+'mpg2splt.ax'); + dpnet_Version := ReadVersionInfo(Path+'dpnet.dll'); + d3d9_Version := ReadVersionInfo(Path+'d3d9.dll'); + + If CompareFileVersion(ddraw_Version, FileVersion(4,2,0,95)) >= 0 then // Win9x version + Begin + // ddraw.dll is >= DX1.0 version, so we must be at least DX1.0 + pdwDirectXVersionMajor := 1; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + End; + + If CompareFileVersion(ddraw_Version, FileVersion(4, 3, 0, 1096)) >= 0 then // Win9x version + Begin + // ddraw.dll is is >= DX2.0 version, so we must DX2.0 or DX2.0a (no redist change) + pdwDirectXVersionMajor := 2; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + End; + + If CompareFileVersion(ddraw_Version, FileVersion(4, 4, 0, 68)) >= 0 then // Win9x version + Begin + // ddraw.dll is >= DX3.0 version, so we must be at least DX3.0 + pdwDirectXVersionMajor := 3; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + End; + + If CompareFileVersion(d3drg8x_Version, FileVersion(4, 4, 0, 70)) >= 0 then // Win9x version + Begin + // d3drg8x.dll is the DX3.0a version, so we must be DX3.0a or DX3.0b (no redist change) + pdwDirectXVersionMajor := 3; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := 'a'; + End; + + If CompareFileVersion(ddraw_Version, FileVersion(4, 5, 0, 155)) >= 0 then // Win9x version + Begin + // ddraw.dll is the DX5.0 version, so we must be DX5.0 or DX5.2 (no redist change) + pdwDirectXVersionMajor := 5; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + End; + + If CompareFileVersion(ddraw_Version, FileVersion(4, 6, 0, 318)) >= 0 then // Win9x version + Begin + // ddraw.dll is the DX6.0 version, so we must be at least DX6.0 + pdwDirectXVersionMajor := 6; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + End; + + If CompareFileVersion(ddraw_Version, FileVersion(4, 6, 0, 436)) >= 0 then // Win9x version + Begin + // ddraw.dll is the DX6.1 version, so we must be at least DX6.1 + pdwDirectXVersionMajor := 6; + pdwDirectXVersionMinor := 1; + pcDirectXVersionLetter := ' '; + End; + + If CompareFileVersion(dplayx_Version, FileVersion(4, 6, 3, 518)) >= 0 then // Win9x version + Begin + // dplayx.dll is the DX6.1a version, so we must be at least DX6.1a + pdwDirectXVersionMajor := 6; + pdwDirectXVersionMinor := 1; + pcDirectXVersionLetter := 'a'; + End; + + If CompareFileVersion(ddraw_Version, FileVersion(4, 7, 0, 700)) >= 0 then // Win9x version + Begin + // TODO: find win2k version + + // ddraw.dll is the DX7.0 version, so we must be at least DX7.0 + pdwDirectXVersionMajor := 7; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + End; + + If CompareFileVersion(dinput_Version, FileVersion(4, 7, 0, 716)) >= 0 then // Win9x version + Begin + // TODO: find win2k version + + // dinput.dll is the DX7.0a version, so we must be at least DX7.0a + pdwDirectXVersionMajor := 7; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := 'a'; + End; + + If ((ddraw_Version.Major = 4) and (CompareFileVersion(ddraw_Version, FileVersion(4, 8, 0, 400)) >= 0)) or // Win9x version + ((ddraw_Version.Major = 5) and (CompareFileVersion(ddraw_Version, FileVersion(5, 1, 2258, 400)) >= 0)) then // Win2k/WinXP version + Begin + // ddraw.dll is the DX8.0 version, so we must be at least DX8.0 or DX8.0a (no redist change) + // + // DirectX 8.0a contains updates for issues with international installs on Windows 2000 and issues where + // input devices could have buttons disabled that were enabled with previous DirectX releases. + // There are no other changes. + pdwDirectXVersionMajor := 8; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + End; + + If ((d3d8_Version.Major = 4) and (CompareFileVersion(d3d8_Version, FileVersion(4, 8, 1, 881)) >= 0)) or // Win9x version + ((d3d8_Version.Major = 5) and (CompareFileVersion(d3d8_Version, FileVersion(5, 1, 2600, 881)) >= 0)) then // Win2k/WinXP version + Begin + // d3d8.dll is the DX8.1 version, so we must be at least DX8.1 + pdwDirectXVersionMajor := 8; + pdwDirectXVersionMinor := 1; + pcDirectXVersionLetter := ' '; + End; + + If ((d3d8_Version.Major = 4) and (CompareFileVersion(d3d8_Version, FileVersion(4, 8, 1, 901)) >= 0)) or // Win9x version + ((d3d8_Version.Major = 5) and (CompareFileVersion(d3d8_Version, FileVersion(5, 1, 2600, 901)) >= 0)) then // Win2k/WinXP version + Begin + // d3d8.dll is the DX8.1 version, so we must be at least DX8.1 + pdwDirectXVersionMajor := 8; + pdwDirectXVersionMinor := 1; + pcDirectXVersionLetter := 'a'; + End; + + If (CompareFileVersion(mpg2splt_Version, FileVersion(6, 3, 1, 885)) >= 0) then // Win9x/Win2k/WinXP version + Begin + // quartz.dll is the DX8.1b version, so we must be at least DX8.1b + pdwDirectXVersionMajor := 8; + pdwDirectXVersionMinor := 1; + pcDirectXVersionLetter := 'b'; + End; + + If ((dpnet_Version.Major = 4) and (CompareFileVersion(dpnet_Version, FileVersion(4, 9, 0, 134)) >= 0)) or // Win9x version + ((dpnet_Version.Major = 5) and (CompareFileVersion(dpnet_Version, FileVersion(5, 2, 3677, 134)) >= 0)) then // Win2k/WinXP version + Begin + // dpnet.dll is the DX8.2 version, so we must be at least DX8.2 + pdwDirectXVersionMajor := 8; + pdwDirectXVersionMinor := 2; + pcDirectXVersionLetter := ' '; + End; + + If ((d3d9_Version.Major = 4) and (CompareFileVersion(d3d9_Version, FileVersion(4, 9, 0, 900)) >= 0)) or // Win9x version + ((d3d9_Version.Major = 5) and (CompareFileVersion(d3d9_Version, FileVersion(5, 3, 0, 900)) >= 0)) then // Win2k/WinXP version + Begin + // d3d9.dll is the DX9.0 version, so we must be at least DX9.0 + pdwDirectXVersionMajor := 9; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := ' '; + End; + + If ((d3d9_Version.Major = 4) and (CompareFileVersion(d3d9_Version, FileVersion(4, 9, 0, 901)) >= 0)) or // Win9x version + ((d3d9_Version.Major = 5) and (CompareFileVersion(d3d9_Version, FileVersion(5, 3, 0, 901)) >= 0)) then // Win2k/WinXP version + Begin + // d3d9.dll is the DX9.0a version, so we must be at least DX9.0a + pdwDirectXVersionMajor := 9; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := 'a'; + End; + + If ((d3d9_Version.Major = 4) and (CompareFileVersion(d3d9_Version, FileVersion(4, 9, 0, 902)) >= 0)) or // Win9x version + ((d3d9_Version.Major = 5) and (CompareFileVersion(d3d9_Version, FileVersion(5, 3, 0, 902)) >= 0)) then // Win2k/WinXP version + Begin + // d3d9.dll is the DX9.0b version, so we must be at least DX9.0b + pdwDirectXVersionMajor := 9; + pdwDirectXVersionMinor := 0; + pcDirectXVersionLetter := 'b'; + End; + Result := s_OK; +end; + +var + dwDirectXVersionMajor : DWORD; + dwDirectXVersionMinor : DWORD; + cDirectXVersionLetter : CHAR; + + dwDirectXVersion : DWORD; +Begin + // Init values to unknown + pdwDirectXVersion := 0; + strDirectXVersion := ''; + + dwDirectXVersionMajor := 0; + dwDirectXVersionMinor := 0; + cDirectXVersionLetter := ' '; + + // First, try to use dxdiag's COM interface to get the DirectX version. + // The only downside is this will only work on DX9 or later. + Result := GetDirectXVersionViaDxDiag(dwDirectXVersionMajor, dwDirectXVersionMinor, cDirectXVersionLetter); + + If Result = E_Fail then + // Getting the DirectX version info from DxDiag failed, + // so most likely we are on DX8.x or earlier + Result := GetDirectXVerionViaFileVersions(dwDirectXVersionMajor, dwDirectXVersionMinor, cDirectXVersionLetter); + + // If both techniques failed, then return E_FAIL + If Result = E_Fail then + Exit; + + // Set the output values to what we got and return + // like 0x00080102 which would represent DX8.1b + dwDirectXVersion := dwDirectXVersionMajor; + dwDirectXVersion := dwDirectXVersion shl 8; + dwDirectXVersion := dwDirectXVersion + dwDirectXVersionMinor; + dwDirectXVersion := dwDirectXVersion shl 8; + if (Ord(cDirectXVersionLetter) >= 97) and (Ord(cDirectXVersionLetter) <= 122) then + dwDirectXVersion := dwDirectXVersion + int64(Ord(cDirectXVersionLetter) - 96); + pdwDirectXVersion := dwDirectXVersion; + + If dwDirectXVersion > 0 then + Begin + if cDirectXVersionLetter = ' ' then + strDirectXVersion := Format('%d.%d', [dwDirectXVersionMajor, dwDirectXVersionMinor]) + else + strDirectXVersion := Format('%d.%d%s', [dwDirectXVersionMajor, dwDirectXVersionMinor, cDirectXVersionLetter]); + End; + + Result := S_OK; +End; + +// Michael End. + +// milenko start DMO TMediaBuffer implementation +constructor TMediaBuffer.Create(MaxLen: DWORD); +begin + inherited Create; + FRefCount := 0; + FMaxLength := MaxLen; + FLength := 0; + FData := nil; + FData := AllocMem(MaxLen); + Assert(Assigned(FData)); +end; + +destructor TMediaBuffer.Destroy; +begin + if Assigned(FData) then + begin + FreeMem(FData); + FData := nil; + end; +end; + +class function TMediaBuffer.CreateBuffer(MaxLen: DWORD; const IID: TGUID; out Obj): HRESULT; +var + pBuffer: TMediaBuffer; +begin + try + pBuffer := TMediaBuffer.Create(MaxLen); + Result := pBuffer.QueryInterface(IID, Obj); + except + Result := E_OUTOFMEMORY; + end; +end; + +function TMediaBuffer.QueryInterface(const IID: TGUID; out Obj): HResult; stdcall; +begin + if not Assigned(@Obj) then + begin + Result := E_POINTER; + Exit; + end else + if IsEqualGUID(IID, IID_IMediaBuffer) or IsEqualGUID(IID, IUnknown) then + begin + if GetInterface(IID,Obj) then + begin + Result := S_OK; + Exit; + end + end; + Pointer(Obj) := nil; + Result := E_NOINTERFACE; +end; + +function TMediaBuffer._AddRef: Integer; stdcall; +begin + Result := InterlockedIncrement(FRefCount); +end; + +function TMediaBuffer._Release: Integer; stdcall; +begin + Result := InterlockedDecrement(FRefCount); + if (Result = 0) then Free; +end; + +function TMediaBuffer.SetLength(cbLength: DWORD): HResult; stdcall; +begin + if (cbLength > FMaxLength) then + begin + Result := E_INVALIDARG; + end else + begin + FLength := cbLength; + Result := S_OK; + end; +end; + +function TMediaBuffer.GetMaxLength(out pcbMaxLength: DWORD): HResult; stdcall; +begin + if not Assigned(@pcbMaxLength) then + begin + Result := E_POINTER; + Exit; + end else + begin + pcbMaxLength := FMaxLength; + Result := S_OK; + end; +end; + +function TMediaBuffer.GetBufferAndLength(out ppBuffer: PByte; // not filled if NULL + out pcbLength: DWORD // not filled if NULL + ): HResult; stdcall; +begin + if not Assigned(@ppBuffer) or not Assigned(@pcbLength) then + begin + Result := E_POINTER; + Exit; + end; + ppBuffer := FData; + pcbLength := FLength; + Result := S_OK; +end; +// milenko end + +// milenko start wxutil implementation +function EnlargedUnsignedDivide(Dividend: ULARGE_INTEGER; Divisor: ULONG; Remainder: PULONG): ULONG; stdcall; +asm + mov eax, Dividend.LowPart + mov edx, Dividend.HighPart + mov ecx, Remainder + div Divisor + or ecx,ecx + jz @@End + mov [ecx],edx +@@End: +end; + +function Int32x32To64(a, b: integer): Int64; +asm + imul b +end; + +function MILLISECONDS_TO_100NS_UNITS(Ms: LONGLONG): LONGLONG; +begin + Result := Int32x32To64((Ms), (UNITS div MILLISECONDS)) +end; + +function UInt32x32To64(a, b: DWORD): ULONGLONG; +asm + mul b +end; + +function llMulDiv(a, b, c, d: LONGLONG): LONGLONG; +var + ua, ub : ULARGE_INTEGER; + uc : DWORDLONG; + bSign : BOOL; + p, ud : array[0..1] of ULARGE_INTEGER; + x : ULARGE_INTEGER; + uliTotal : ULARGE_INTEGER; + ullResult : DWORDLONG; + ulic : ULARGE_INTEGER; + uliDividend : ULARGE_INTEGER; + uliResult : ULARGE_INTEGER; + dwDivisor : DWORD; + i : integer; +begin + if a >= 0 then ua.QuadPart := DWORDLONG(a) + else ua.QuadPart := DWORDLONG(-a); + if b >= 0 then ub.QuadPart := DWORDLONG(b) + else ua.QuadPart := DWORDLONG(-b); + if c >= 0 then uc := DWORDLONG(c) + else uc := DWORDLONG(-c); + bSign := (a < 0) xor (b < 0); + + p[0].QuadPart := UInt32x32To64(ua.LowPart, ub.LowPart); + + x.QuadPart := UInt32x32To64(ua.LowPart, ub.HighPart) + + UInt32x32To64(ua.HighPart, ub.LowPart) + + p[0].HighPart; + + p[0].HighPart := x.LowPart; + p[1].QuadPart := UInt32x32To64(ua.HighPart, ub.HighPart) + x.HighPart; + + if (d <> 0) then + begin + if (bSign) then + begin + ud[0].QuadPart := DWORDLONG(-d); + if (d > 0) then ud[1].QuadPart := DWORDLONG(LONGLONG(-1)) + else ud[1].QuadPart := DWORDLONG(0); + end else + begin + ud[0].QuadPart := DWORDLONG(d); + if (d < 0) then ud[1].QuadPart := DWORDLONG(LONGLONG(-1)) + else ud[1].QuadPart := DWORDLONG(0); + end; + + uliTotal.QuadPart := DWORDLONG(ud[0].LowPart) + p[0].LowPart; + p[0].LowPart := uliTotal.LowPart; + + uliTotal.LowPart := uliTotal.HighPart; + uliTotal.HighPart := 0; + + uliTotal.QuadPart := uliTotal.QuadPart + (DWORDLONG(ud[0].HighPart) + p[0].HighPart); + p[0].HighPart := uliTotal.LowPart; + + uliTotal.LowPart := uliTotal.HighPart; + uliTotal.HighPart := 0; + + p[1].QuadPart := p[1].QuadPart + ud[1].QuadPart + uliTotal.QuadPart; + + if (LongInt(p[1].HighPart) < 0) then + begin + bSign := not bSign; + p[0].QuadPart := not p[0].QuadPart; + p[1].QuadPart := not p[1].QuadPart; + p[0].QuadPart := p[0].QuadPart + 1; + p[1].QuadPart := p[1].QuadPart + LongInt(p[0].QuadPart = 0); + end; + end; + + if (c < 0) then bSign := not bSign; + + if (uc <= p[1].QuadPart) then + begin + if bSign then Result := LONGLONG($8000000000000000) + else Result := LONGLONG($7FFFFFFFFFFFFFFF); + Exit; + end; + + if (p[1].QuadPart = 0) then + begin + ullResult := p[0].QuadPart div uc; + if bSign then Result := -LONGLONG(ullResult) + else Result := LONGLONG(ullResult); + Exit; + end; + + ulic.QuadPart := uc; + if (ulic.HighPart = 0) then + begin + dwDivisor := DWORD(uc); + uliDividend.HighPart := p[1].LowPart; + uliDividend.LowPart := p[0].HighPart; + if (uliDividend.QuadPart >= DWORDLONG(dwDivisor)) + then uliResult.HighPart := EnlargedUnsignedDivide(uliDividend,dwDivisor,@p[0].HighPart) + else uliResult.HighPart := 0; + uliResult.LowPart := EnlargedUnsignedDivide(p[0],dwDivisor,nil); + if bSign then Result := -LONGLONG(uliResult.QuadPart) + else Result := LONGLONG(uliResult.QuadPart); + Exit; + end; + + ullResult := 0; + + for i := 0 to 63 do + begin + ullResult := ullResult shl 1; + p[1].QuadPart := p[1].QuadPart shl 1; + if ((p[0].HighPart and $80000000) <> 0) then p[1].LowPart := p[1].LowPart + 1; + p[0].QuadPart := p[0].QuadPart shl 1; + if (uc <= p[1].QuadPart) then + begin + p[1].QuadPart := p[1].QuadPart - uc; + ullResult := ullResult + 1; + end; + end; + + if bSign then Result := -LONGLONG(ullResult) + else Result := LONGLONG(ullResult); +end; + +function Int64x32Div32(a: LONGLONG; b, c, d: LongInt): LONGLONG; +var + ua : ULARGE_INTEGER; + ub : DWORD; + uc : DWORD; + bSign : BOOL; + p0 : ULARGE_INTEGER; + p1 : DWORD; + x : ULARGE_INTEGER; + ud0 : ULARGE_INTEGER; + ud1 : DWORD; + uliTotal : ULARGE_INTEGER; + uliDividend : ULARGE_INTEGER; + uliResult : ULARGE_INTEGER; + dwDivisor : DWORD; +begin + if a >= 0 then ua.QuadPart := DWORDLONG(a) + else ua.QuadPart := DWORDLONG(-a); + if b >= 0 then ub := DWORD(b) + else ub := DWORD(-b); + if c >= 0 then uc := DWORD(c) + else uc := DWORD(-c); + bSign := (a < 0) xor (b < 0); + + p0.QuadPart := UInt32x32To64(ua.LowPart, ub); + + if (ua.HighPart <> 0) then + begin + x.QuadPart := UInt32x32To64(ua.HighPart, ub) + p0.HighPart; + p0.HighPart := x.LowPart; + p1 := x.HighPart; + end else + begin + p1 := 0; + end; + + if (d <> 0) then + begin + if bSign then + begin + ud0.QuadPart := DWORDLONG(-(LONGLONG(d))); + if (d > 0) then ud1 := DWORD(-1) + else ud1 := DWORD(0); + end else + begin + ud0.QuadPart := DWORDLONG(d); + if (d < 0) then ud1 := DWORD(-1) + else ud1 := DWORD(0); + end; + uliTotal.QuadPart := DWORDLONG(ud0.LowPart) + p0.LowPart; + p0.LowPart := uliTotal.LowPart; + + uliTotal.LowPart := uliTotal.HighPart; + uliTotal.HighPart := 0; + + uliTotal.QuadPart := uliTotal.QuadPart + (DWORDLONG(ud0.HighPart) + p0.HighPart); + p0.HighPart := uliTotal.LowPart; + + p1 := p1 + ud1 + uliTotal.HighPart; + + if (LongInt(p1) < 0) then + begin + bSign := not bSign; + + p0.QuadPart := not p0.QuadPart; + p1 := not p1; + p0.QuadPart := p0.QuadPart + 1; + p1 := p1 + DWORD(p0.QuadPart = 0); + end; + end; + + dwDivisor := uc; + + if (c < 0) then bSign := not bSign; + + if (uc <= p1) then + begin + if bSign then Result := LONGLONG($8000000000000000) + else Result := LONGLONG($7FFFFFFFFFFFFFFF); + Exit; + end; + + uliDividend.HighPart := p1; + uliDividend.LowPart := p0.HighPart; + if (uliDividend.QuadPart >= DWORDLONG(dwDivisor)) then + begin + uliResult.HighPart := EnlargedUnsignedDivide(uliDividend, dwDivisor, @p0.HighPart); + end else + begin + uliResult.HighPart := 0; + end; + + uliResult.LowPart := EnlargedUnsignedDivide(p0, dwDivisor, nil); + + if bSign then Result := -LONGLONG(uliResult.QuadPart) + else Result := LONGLONG(uliResult.QuadPart); +end; + +function HRESULT_FROM_WIN32(x: DWORD): HRESULT; +begin + if HRESULT(x) <= 0 then + Result := HRESULT(x) + else + Result := HRESULT((x and $0000FFFF) or (FACILITY_WIN32 shl 16) or $80000000); +end; + +function AmGetLastErrorToHResult: HRESULT; +var + LastError: DWORD; +begin + LastError := GetLastError; + if(LastError <> 0) then Result := HRESULT_FROM_WIN32(LastError) + else Result := E_FAIL; +end; + +function IsEqualObject(pFirst, pSecond: IUnknown): Boolean; +var + pUnknown1, // Retrieve the IUnknown interface + pUnknown2: IUnknown; // Retrieve the other IUnknown interface +begin + // Different objects can't have the same interface pointer for + // any interface + + if (pFirst = pSecond) then + begin + Result := True; + Exit; + end; + + // OK - do it the hard way - check if they have the same + // IUnknown pointers - a single object can only have one of these + + ASSERT(pFirst <> nil); + ASSERT(pSecond <> nil); + + // See if the IUnknown pointers match + + Result := Succeeded(pFirst.QueryInterface(IUnknown,pUnknown1)); + if (Result) then + begin + end; + ASSERT(Result); + ASSERT(pUnknown1 <> nil); + + Result := Succeeded(pSecond.QueryInterface(IUnknown,pUnknown2)); + + // get rid of Delphi compiler warnings .. + if (Result) then + begin + end; + + ASSERT(Result); + ASSERT(pUnknown2 <> nil); + + // Release the extra interfaces we hold + + Result := (pUnknown1 = pUnknown2); + pUnknown1 := nil; + pUnknown2 := nil; +end; +// milenko end + +// milenko start namedguid implementation +function GetGUIDString(GUID: TGUID): String; +begin + if IsEqualGUID(GUID,MEDIASUBTYPE_AIFF) then Result := 'MEDIASUBTYPE_AIFF' + else if IsEqualGUID(GUID,MEDIASUBTYPE_AU) then Result := 'MEDIASUBTYPE_AU' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_NTSC_M) then Result := 'MEDIASUBTYPE_AnalogVideo_NTSC_M' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_PAL_B) then Result := 'MEDIASUBTYPE_AnalogVideo_PAL_B' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_PAL_D) then Result := 'MEDIASUBTYPE_AnalogVideo_PAL_D' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_PAL_G) then Result := 'MEDIASUBTYPE_AnalogVideo_PAL_G' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_PAL_H) then Result := 'MEDIASUBTYPE_AnalogVideo_PAL_H' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_PAL_I) then Result := 'MEDIASUBTYPE_AnalogVideo_PAL_I' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_PAL_M) then Result := 'MEDIASUBTYPE_AnalogVideo_PAL_M' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_PAL_N) then Result := 'MEDIASUBTYPE_AnalogVideo_PAL_N' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_SECAM_B) then Result := 'MEDIASUBTYPE_AnalogVideo_SECAM_B' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_SECAM_D) then Result := 'MEDIASUBTYPE_AnalogVideo_SECAM_D' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_SECAM_G) then Result := 'MEDIASUBTYPE_AnalogVideo_SECAM_G' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_SECAM_H) then Result := 'MEDIASUBTYPE_AnalogVideo_SECAM_H' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_SECAM_K) then Result := 'MEDIASUBTYPE_AnalogVideo_SECAM_K' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_SECAM_K1) then Result := 'MEDIASUBTYPE_AnalogVideo_SECAM_K1' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AnalogVideo_SECAM_L) then Result := 'MEDIASUBTYPE_AnalogVideo_SECAM_L' + + else if IsEqualGuid(GUID,MEDIASUBTYPE_ARGB1555) then Result := 'MEDIASUBTYPE_ARGB1555' + else if IsEqualGuid(GUID,MEDIASUBTYPE_ARGB4444) then Result := 'MEDIASUBTYPE_ARGB4444' + else if IsEqualGuid(GUID,MEDIASUBTYPE_ARGB32) then Result := 'MEDIASUBTYPE_ARGB32' + else if IsEqualGuid(GUID,MEDIASUBTYPE_A2R10G10B10) then Result := 'MEDIASUBTYPE_A2R10G10B10' + else if IsEqualGuid(GUID,MEDIASUBTYPE_A2B10G10R10) then Result := 'MEDIASUBTYPE_A2B10G10R10' + + else if IsEqualGuid(GUID,MEDIASUBTYPE_AYUV) then Result := 'MEDIASUBTYPE_AYUV' + else if IsEqualGuid(GUID,MEDIASUBTYPE_AI44) then Result := 'MEDIASUBTYPE_AI44' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IA44) then Result := 'MEDIASUBTYPE_IA44' + else if IsEqualGuid(GUID,MEDIASUBTYPE_NV12) then Result := 'MEDIASUBTYPE_NV12' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IMC1) then Result := 'MEDIASUBTYPE_IMC1' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IMC2) then Result := 'MEDIASUBTYPE_IMC2' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IMC3) then Result := 'MEDIASUBTYPE_IMC3' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IMC4) then Result := 'MEDIASUBTYPE_IMC4' + + else if IsEqualGuid(GUID,MEDIASUBTYPE_Asf) then Result := 'MEDIASUBTYPE_Asf' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Avi) then Result := 'MEDIASUBTYPE_Avi' + else if IsEqualGuid(GUID,MEDIASUBTYPE_CFCC) then Result := 'MEDIASUBTYPE_CFCC' + else if IsEqualGuid(GUID,MEDIASUBTYPE_CLJR) then Result := 'MEDIASUBTYPE_CLJR' + else if IsEqualGuid(GUID,MEDIASUBTYPE_CPLA) then Result := 'MEDIASUBTYPE_CPLA' + else if IsEqualGuid(GUID,MEDIASUBTYPE_CLPL) then Result := 'MEDIASUBTYPE_CLPL' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DOLBY_AC3) then Result := 'MEDIASUBTYPE_DOLBY_AC3' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DOLBY_AC3_SPDIF) then Result := 'MEDIASUBTYPE_DOLBY_AC3_SPDIF' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DVCS) then Result := 'MEDIASUBTYPE_DVCS' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DVD_LPCM_AUDIO) then Result := 'MEDIASUBTYPE_DVD_LPCM_AUDIO' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DVD_NAVIGATION_DSI) then Result := 'MEDIASUBTYPE_DVD_NAVIGATION_DSI' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DVD_NAVIGATION_PCI) then Result := 'MEDIASUBTYPE_DVD_NAVIGATION_PCI' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER) then Result := 'MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DVD_SUBPICTURE) then Result := 'MEDIASUBTYPE_DVD_SUBPICTURE' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DVSD) then Result := 'MEDIASUBTYPE_DVSD' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DRM_Audio) then Result := 'MEDIASUBTYPE_DRM_Audio' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DssAudio) then Result := 'MEDIASUBTYPE_DssAudio' + else if IsEqualGuid(GUID,MEDIASUBTYPE_DssVideo) then Result := 'MEDIASUBTYPE_DssVideo' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IF09) then Result := 'MEDIASUBTYPE_IF09' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IEEE_FLOAT) then Result := 'MEDIASUBTYPE_IEEE_FLOAT' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IJPG) then Result := 'MEDIASUBTYPE_IJPG' + else if IsEqualGuid(GUID,MEDIASUBTYPE_IYUV) then Result := 'MEDIASUBTYPE_IYUV' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Line21_BytePair) then Result := 'MEDIASUBTYPE_Line21_BytePair' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Line21_GOPPacket) then Result := 'MEDIASUBTYPE_Line21_GOPPacket' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Line21_VBIRawData) then Result := 'MEDIASUBTYPE_Line21_VBIRawData' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MDVF) then Result := 'MEDIASUBTYPE_MDVF' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MJPG) then Result := 'MEDIASUBTYPE_MJPG' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG1Audio) then Result := 'MEDIASUBTYPE_MPEG1Audio' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG1AudioPayload) then Result := 'MEDIASUBTYPE_MPEG1AudioPayload' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG1Packet) then Result := 'MEDIASUBTYPE_MPEG1Packet' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG1Payload) then Result := 'MEDIASUBTYPE_MPEG1Payload' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG1System) then Result := 'MEDIASUBTYPE_MPEG1System' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG1Video) then Result := 'MEDIASUBTYPE_MPEG1Video' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG1VideoCD) then Result := 'MEDIASUBTYPE_MPEG1VideoCD' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG2_AUDIO) then Result := 'MEDIASUBTYPE_MPEG2_AUDIO' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG2_PROGRAM) then Result := 'MEDIASUBTYPE_MPEG2_PROGRAM' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG2_TRANSPORT) then Result := 'MEDIASUBTYPE_MPEG2_TRANSPORT' + else if IsEqualGuid(GUID,MEDIASUBTYPE_MPEG2_VIDEO) then Result := 'MEDIASUBTYPE_MPEG2_VIDEO' + else if IsEqualGuid(GUID,MEDIASUBTYPE_None) then Result := 'MEDIASUBTYPE_None' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Overlay) then Result := 'MEDIASUBTYPE_Overlay' + else if IsEqualGuid(GUID,MEDIASUBTYPE_PCM) then Result := 'MEDIASUBTYPE_PCM' + else if IsEqualGuid(GUID,MEDIASUBTYPE_PCMAudio_Obsolete) then Result := 'MEDIASUBTYPE_PCMAudio_Obsolete' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Plum) then Result := 'MEDIASUBTYPE_Plum' + else if IsEqualGuid(GUID,MEDIASUBTYPE_QTJpeg) then Result := 'MEDIASUBTYPE_QTJpeg' + else if IsEqualGuid(GUID,MEDIASUBTYPE_QTMovie) then Result := 'MEDIASUBTYPE_QTMovie' + else if IsEqualGuid(GUID,MEDIASUBTYPE_QTRle) then Result := 'MEDIASUBTYPE_QTRle' + else if IsEqualGuid(GUID,MEDIASUBTYPE_QTRpza) then Result := 'MEDIASUBTYPE_QTRpza' + else if IsEqualGuid(GUID,MEDIASUBTYPE_QTSmc) then Result := 'MEDIASUBTYPE_QTSmc' + else if IsEqualGuid(GUID,MEDIASUBTYPE_RAW_SPORT) then Result := 'MEDIASUBTYPE_RAW_SPORT' + else if IsEqualGuid(GUID,MEDIASUBTYPE_RGB1) then Result := 'MEDIASUBTYPE_RGB1' + else if IsEqualGuid(GUID,MEDIASUBTYPE_RGB24) then Result := 'MEDIASUBTYPE_RGB24' + else if IsEqualGuid(GUID,MEDIASUBTYPE_RGB32) then Result := 'MEDIASUBTYPE_RGB32' + else if IsEqualGuid(GUID,MEDIASUBTYPE_RGB4) then Result := 'MEDIASUBTYPE_RGB4' + else if IsEqualGuid(GUID,MEDIASUBTYPE_RGB555) then Result := 'MEDIASUBTYPE_RGB555' + else if IsEqualGuid(GUID,MEDIASUBTYPE_RGB565) then Result := 'MEDIASUBTYPE_RGB565' + else if IsEqualGuid(GUID,MEDIASUBTYPE_RGB8) then Result := 'MEDIASUBTYPE_RGB8' + else if IsEqualGuid(GUID,MEDIASUBTYPE_SPDIF_TAG_241h) then Result := 'MEDIASUBTYPE_SPDIF_TAG_241h' + else if IsEqualGuid(GUID,MEDIASUBTYPE_TELETEXT) then Result := 'MEDIASUBTYPE_TELETEXT' + else if IsEqualGuid(GUID,MEDIASUBTYPE_TVMJ) then Result := 'MEDIASUBTYPE_TVMJ' + else if IsEqualGuid(GUID,MEDIASUBTYPE_UYVY) then Result := 'MEDIASUBTYPE_UYVY' + else if IsEqualGuid(GUID,MEDIASUBTYPE_VPVBI) then Result := 'MEDIASUBTYPE_VPVBI' + else if IsEqualGuid(GUID,MEDIASUBTYPE_VPVideo) then Result := 'MEDIASUBTYPE_VPVideo' + else if IsEqualGuid(GUID,MEDIASUBTYPE_WAKE) then Result := 'MEDIASUBTYPE_WAKE' + else if IsEqualGuid(GUID,MEDIASUBTYPE_WAVE) then Result := 'MEDIASUBTYPE_WAVE' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Y211) then Result := 'MEDIASUBTYPE_Y211' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Y411) then Result := 'MEDIASUBTYPE_Y411' + else if IsEqualGuid(GUID,MEDIASUBTYPE_Y41P) then Result := 'MEDIASUBTYPE_Y41P' + else if IsEqualGuid(GUID,MEDIASUBTYPE_YUY2) then Result := 'MEDIASUBTYPE_YUY2' + else if IsEqualGuid(GUID,MEDIASUBTYPE_YV12) then Result := 'MEDIASUBTYPE_YV12' + else if IsEqualGuid(GUID,MEDIASUBTYPE_YVU9) then Result := 'MEDIASUBTYPE_YVU9' + else if IsEqualGuid(GUID,MEDIASUBTYPE_YVYU) then Result := 'MEDIASUBTYPE_YVYU' + else if IsEqualGuid(GUID,MEDIASUBTYPE_YUYV) then Result := 'MEDIASUBTYPE_YUYV' + else if IsEqualGuid(GUID,MEDIASUBTYPE_dvhd) then Result := 'MEDIASUBTYPE_dvhd' + else if IsEqualGuid(GUID,MEDIASUBTYPE_dvsd) then Result := 'MEDIASUBTYPE_dvsd' + else if IsEqualGuid(GUID,MEDIASUBTYPE_dvsl) then Result := 'MEDIASUBTYPE_dvsl' + + else if IsEqualGuid(GUID,MEDIATYPE_AUXLine21Data) then Result := 'MEDIATYPE_AUXLine21Data' + else if IsEqualGuid(GUID,MEDIATYPE_AnalogAudio) then Result := 'MEDIATYPE_AnalogAudio' + else if IsEqualGuid(GUID,MEDIATYPE_AnalogVideo) then Result := 'MEDIATYPE_AnalogVideo' + else if IsEqualGuid(GUID,MEDIATYPE_Audio) then Result := 'MEDIATYPE_Audio' + else if IsEqualGuid(GUID,MEDIATYPE_DVD_ENCRYPTED_PACK) then Result := 'MEDIATYPE_DVD_ENCRYPTED_PACK' + else if IsEqualGuid(GUID,MEDIATYPE_DVD_NAVIGATION) then Result := 'MEDIATYPE_DVD_NAVIGATION' + else if IsEqualGuid(GUID,MEDIATYPE_File) then Result := 'MEDIATYPE_File' + else if IsEqualGuid(GUID,MEDIATYPE_Interleaved) then Result := 'MEDIATYPE_Interleaved' + else if IsEqualGuid(GUID,MEDIATYPE_LMRT) then Result := 'MEDIATYPE_LMRT' + else if IsEqualGuid(GUID,MEDIATYPE_MPEG1SystemStream) then Result := 'MEDIATYPE_MPEG1SystemStream' + else if IsEqualGuid(GUID,MEDIATYPE_MPEG2_PES) then Result := 'MEDIATYPE_MPEG2_PES' + else if IsEqualGuid(GUID,MEDIATYPE_Midi) then Result := 'MEDIATYPE_Midi' + else if IsEqualGuid(GUID,MEDIATYPE_ScriptCommand) then Result := 'MEDIATYPE_ScriptCommand' + else if IsEqualGuid(GUID,MEDIATYPE_Stream) then Result := 'MEDIATYPE_Stream' + else if IsEqualGuid(GUID,MEDIATYPE_Text) then Result := 'MEDIATYPE_Text' + else if IsEqualGuid(GUID,MEDIATYPE_Timecode) then Result := 'MEDIATYPE_Timecode' + else if IsEqualGuid(GUID,MEDIATYPE_URL_STREAM) then Result := 'MEDIATYPE_URL_STREAM' + else if IsEqualGuid(GUID,MEDIATYPE_VBI) then Result := 'MEDIATYPE_VBI' + else if IsEqualGuid(GUID,MEDIATYPE_Video) then Result := 'MEDIATYPE_Video' + + else if IsEqualGuid(GUID,WMMEDIATYPE_Audio) then Result := 'WMMEDIATYPE_Audio' + else if IsEqualGuid(GUID,WMMEDIATYPE_Video) then Result := 'WMMEDIATYPE_Video' + else if IsEqualGuid(GUID,WMMEDIATYPE_Script) then Result := 'WMMEDIATYPE_Script' + else if IsEqualGuid(GUID,WMMEDIATYPE_Image) then Result := 'WMMEDIATYPE_Image' + else if IsEqualGuid(GUID,WMMEDIATYPE_FileTransfer) then Result := 'WMMEDIATYPE_FileTransfer' + else if IsEqualGuid(GUID,WMMEDIATYPE_Text) then Result := 'WMMEDIATYPE_Text' + + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_Base) then Result := 'WMMEDIASUBTYPE_Base' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_RGB1) then Result := 'WMMEDIASUBTYPE_RGB1' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_RGB4) then Result := 'WMMEDIASUBTYPE_RGB4' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_RGB8) then Result := 'WMMEDIASUBTYPE_RGB8' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_RGB565) then Result := 'WMMEDIASUBTYPE_RGB565' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_RGB555) then Result := 'WMMEDIASUBTYPE_RGB555' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_RGB24) then Result := 'WMMEDIASUBTYPE_RGB24' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_RGB32) then Result := 'WMMEDIASUBTYPE_RGB32' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_I420) then Result := 'WMMEDIASUBTYPE_I420' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_IYUV) then Result := 'WMMEDIASUBTYPE_IYUV' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_YV12) then Result := 'WMMEDIASUBTYPE_YV12' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_YUY2) then Result := 'WMMEDIASUBTYPE_YUY2' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_UYVY) then Result := 'WMMEDIASUBTYPE_UYVY' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_YVYU) then Result := 'WMMEDIASUBTYPE_YVYU' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_YVU9) then Result := 'WMMEDIASUBTYPE_YVU9' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_MP43) then Result := 'WMMEDIASUBTYPE_MP43' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_MP4S) then Result := 'WMMEDIASUBTYPE_MP4S' + + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMV1) then Result := 'WMMEDIASUBTYPE_WMV1' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMV2) then Result := 'WMMEDIASUBTYPE_WMV2' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMV3) then Result := 'WMMEDIASUBTYPE_WMV3' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_MSS1) then Result := 'WMMEDIASUBTYPE_MSS1' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_MSS2) then Result := 'WMMEDIASUBTYPE_MSS2' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_MPEG2_VIDEO) then Result := 'WMMEDIASUBTYPE_MPEG2_VIDEO' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_PCM) then Result := 'WMMEDIASUBTYPE_PCM' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_DRM) then Result := 'WMMEDIASUBTYPE_DRM' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMAudioV9) then Result := 'WMMEDIASUBTYPE_WMAudioV9' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMAudio_Lossless) then Result := 'WMMEDIASUBTYPE_WMAudio_Lossless' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMAudioV8) then Result := 'WMMEDIASUBTYPE_WMAudioV8' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMAudioV7) then Result := 'WMMEDIASUBTYPE_WMAudioV7' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMAudioV2) then Result := 'WMMEDIASUBTYPE_WMAudioV2' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_ACELPnet) then Result := 'WMMEDIASUBTYPE_ACELPnet' + else if IsEqualGuid(GUID,WMMEDIASUBTYPE_WMSP1) then Result := 'WMMEDIASUBTYPE_WMSP1' + + else if IsEqualGuid(GUID,WMFORMAT_VideoInfo) then Result := 'WMFORMAT_VideoInfo' + else if IsEqualGuid(GUID,WMFORMAT_WaveFormatEx) then Result := 'WMFORMAT_WaveFormatEx' + else if IsEqualGuid(GUID,WMFORMAT_Script) then Result := 'WMFORMAT_Script' + else if IsEqualGuid(GUID,WMFORMAT_MPEG2Video) then Result := 'WMFORMAT_MPEG2Video' + + else if IsEqualGuid(GUID,WMSCRIPTTYPE_TwoStrings) then Result := 'WMSCRIPTTYPE_TwoStrings' + + else if IsEqualGuid(GUID,PIN_CATEGORY_ANALOGVIDEOIN) then Result := 'PIN_CATEGORY_ANALOGVIDEOIN' + else if IsEqualGuid(GUID,PIN_CATEGORY_CAPTURE) then Result := 'PIN_CATEGORY_CAPTURE' + else if IsEqualGuid(GUID,PIN_CATEGORY_CC) then Result := 'PIN_CATEGORY_CC' + else if IsEqualGuid(GUID,PIN_CATEGORY_EDS) then Result := 'PIN_CATEGORY_EDS' + else if IsEqualGuid(GUID,PIN_CATEGORY_NABTS) then Result := 'PIN_CATEGORY_NABTS' + else if IsEqualGuid(GUID,PIN_CATEGORY_PREVIEW) then Result := 'PIN_CATEGORY_PREVIEW' + else if IsEqualGuid(GUID,PIN_CATEGORY_STILL) then Result := 'PIN_CATEGORY_STILL' + else if IsEqualGuid(GUID,PIN_CATEGORY_TELETEXT) then Result := 'PIN_CATEGORY_TELETEXT' + else if IsEqualGuid(GUID,PIN_CATEGORY_TIMECODE) then Result := 'PIN_CATEGORY_TIMECODE' + else if IsEqualGuid(GUID,PIN_CATEGORY_VBI) then Result := 'PIN_CATEGORY_VBI' + else if IsEqualGuid(GUID,PIN_CATEGORY_VIDEOPORT) then Result := 'PIN_CATEGORY_VIDEOPORT' + else if IsEqualGuid(GUID,PIN_CATEGORY_VIDEOPORT_VBI) then Result := 'PIN_CATEGORY_VIDEOPORT_VBI' + + else if IsEqualGuid(GUID,CLSID_ACMWrapper) then Result := 'CLSID_ACMWrapper' + else if IsEqualGuid(GUID,CLSID_AVICo) then Result := 'CLSID_AVICo' + else if IsEqualGuid(GUID,CLSID_AVIDec) then Result := 'CLSID_AVIDec' + else if IsEqualGuid(GUID,CLSID_AVIDoc) then Result := 'CLSID_AVIDoc' + else if IsEqualGuid(GUID,CLSID_AVIDraw) then Result := 'CLSID_AVIDraw' + else if IsEqualGuid(GUID,CLSID_AVIMIDIRender) then Result := 'CLSID_AVIMIDIRender' + else if IsEqualGuid(GUID,CLSID_ActiveMovieCategories) then Result := 'CLSID_ActiveMovieCategories' + else if IsEqualGuid(GUID,CLSID_AnalogVideoDecoderPropertyPage) then Result := 'CLSID_AnalogVideoDecoderPropertyPage' + else if IsEqualGuid(GUID,CLSID_WMAsfReader) then Result := 'CLSID_WMAsfReader' + else if IsEqualGuid(GUID,CLSID_WMAsfWriter) then Result := 'CLSID_WMAsfWriter' + else if IsEqualGuid(GUID,CLSID_AsyncReader) then Result := 'CLSID_AsyncReader' + else if IsEqualGuid(GUID,CLSID_AudioCompressorCategory) then Result := 'CLSID_AudioCompressorCategory' + else if IsEqualGuid(GUID,CLSID_AudioInputDeviceCategory) then Result := 'CLSID_AudioInputDeviceCategory' + else if IsEqualGuid(GUID,CLSID_AudioProperties) then Result := 'CLSID_AudioProperties' + else if IsEqualGuid(GUID,CLSID_AudioRecord) then Result := 'CLSID_AudioRecord' + else if IsEqualGuid(GUID,CLSID_AudioRender) then Result := 'CLSID_AudioRender' + else if IsEqualGuid(GUID,CLSID_AudioRendererCategory) then Result := 'CLSID_AudioRendererCategory' + else if IsEqualGuid(GUID,CLSID_AviDest) then Result := 'CLSID_AviDest' + else if IsEqualGuid(GUID,CLSID_AviMuxProptyPage) then Result := 'CLSID_AviMuxProptyPage' + else if IsEqualGuid(GUID,CLSID_AviMuxProptyPage1) then Result := 'CLSID_AviMuxProptyPage1' + else if IsEqualGuid(GUID,CLSID_AviReader) then Result := 'CLSID_AviReader' + else if IsEqualGuid(GUID,CLSID_AviSplitter) then Result := 'CLSID_AviSplitter' + else if IsEqualGuid(GUID,CLSID_CAcmCoClassManager) then Result := 'CLSID_CAcmCoClassManager' + else if IsEqualGuid(GUID,CLSID_CDeviceMoniker) then Result := 'CLSID_CDeviceMoniker' + else if IsEqualGuid(GUID,CLSID_CIcmCoClassManager) then Result := 'CLSID_CIcmCoClassManager' + else if IsEqualGuid(GUID,CLSID_CMidiOutClassManager) then Result := 'CLSID_CMidiOutClassManager' + else if IsEqualGuid(GUID,CLSID_CMpegAudioCodec) then Result := 'CLSID_CMpegAudioCodec' + else if IsEqualGuid(GUID,CLSID_CMpegVideoCodec) then Result := 'CLSID_CMpegVideoCodec' + else if IsEqualGuid(GUID,CLSID_CQzFilterClassManager) then Result := 'CLSID_CQzFilterClassManager' + else if IsEqualGuid(GUID,CLSID_CVidCapClassManager) then Result := 'CLSID_CVidCapClassManager' + else if IsEqualGuid(GUID,CLSID_CWaveOutClassManager) then Result := 'CLSID_CWaveOutClassManager' + else if IsEqualGuid(GUID,CLSID_CWaveinClassManager) then Result := 'CLSID_CWaveinClassManager' + else if IsEqualGuid(GUID,CLSID_CameraControlPropertyPage) then Result := 'CLSID_CameraControlPropertyPage' + else if IsEqualGuid(GUID,CLSID_CaptureGraphBuilder) then Result := 'CLSID_CaptureGraphBuilder' + else if IsEqualGuid(GUID,CLSID_CaptureProperties) then Result := 'CLSID_CaptureProperties' + else if IsEqualGuid(GUID,CLSID_Colour) then Result := 'CLSID_Colour' + else if IsEqualGuid(GUID,CLSID_CrossbarFilterPropertyPage) then Result := 'CLSID_CrossbarFilterPropertyPage' + else if IsEqualGuid(GUID,CLSID_DSoundRender) then Result := 'CLSID_DSoundRender' + else if IsEqualGuid(GUID,CLSID_DVDHWDecodersCategory) then Result := 'CLSID_DVDHWDecodersCategory' + else if IsEqualGuid(GUID,CLSID_DVDNavigator) then Result := 'CLSID_DVDNavigator' + else if IsEqualGuid(GUID,CLSID_DVDecPropertiesPage) then Result := 'CLSID_DVDecPropertiesPage' + else if IsEqualGuid(GUID,CLSID_DVEncPropertiesPage) then Result := 'CLSID_DVEncPropertiesPage' + else if IsEqualGuid(GUID,CLSID_DVMux) then Result := 'CLSID_DVMux' + else if IsEqualGuid(GUID,CLSID_DVMuxPropertyPage) then Result := 'CLSID_DVMuxPropertyPage' + else if IsEqualGuid(GUID,CLSID_DVSplitter) then Result := 'CLSID_DVSplitter' + else if IsEqualGuid(GUID,CLSID_DVVideoCodec) then Result := 'CLSID_DVVideoCodec' + else if IsEqualGuid(GUID,CLSID_DVVideoEnc) then Result := 'CLSID_DVVideoEnc' + else if IsEqualGuid(GUID,CLSID_DirectDraw) then Result := 'CLSID_DirectDraw' + else if IsEqualGuid(GUID,CLSID_DirectDrawClipper) then Result := 'CLSID_DirectDrawClipper' + else if IsEqualGuid(GUID,CLSID_DirectDrawProperties) then Result := 'CLSID_DirectDrawProperties' + else if IsEqualGuid(GUID,CLSID_Dither) then Result := 'CLSID_Dither' + else if IsEqualGuid(GUID,CLSID_DvdGraphBuilder) then Result := 'CLSID_DvdGraphBuilder' + else if IsEqualGuid(GUID,CLSID_FGControl) then Result := 'CLSID_FGControl' + else if IsEqualGuid(GUID,CLSID_FileSource) then Result := 'CLSID_FileSource' + else if IsEqualGuid(GUID,CLSID_FileWriter) then Result := 'CLSID_FileWriter' + else if IsEqualGuid(GUID,CLSID_FilterGraph) then Result := 'CLSID_FilterGraph' + else if IsEqualGuid(GUID,CLSID_FilterGraphNoThread) then Result := 'CLSID_FilterGraphNoThread' + else if IsEqualGuid(GUID,CLSID_FilterMapper) then Result := 'CLSID_FilterMapper' + else if IsEqualGuid(GUID,CLSID_FilterMapper2) then Result := 'CLSID_FilterMapper2' + else if IsEqualGuid(GUID,CLSID_InfTee) then Result := 'CLSID_InfTee' + else if IsEqualGuid(GUID,CLSID_LegacyAmFilterCategory) then Result := 'CLSID_LegacyAmFilterCategory' + else if IsEqualGuid(GUID,CLSID_Line21Decoder) then Result := 'CLSID_Line21Decoder' + else if IsEqualGuid(GUID,CLSID_MOVReader) then Result := 'CLSID_MOVReader' + else if IsEqualGuid(GUID,CLSID_MPEG1Doc) then Result := 'CLSID_MPEG1Doc' + else if IsEqualGuid(GUID,CLSID_MPEG1PacketPlayer) then Result := 'CLSID_MPEG1PacketPlayer' + else if IsEqualGuid(GUID,CLSID_MPEG1Splitter) then Result := 'CLSID_MPEG1Splitter' + else if IsEqualGuid(GUID,CLSID_MediaPropertyBag) then Result := 'CLSID_MediaPropertyBag' + else if IsEqualGuid(GUID,CLSID_MemoryAllocator) then Result := 'CLSID_MemoryAllocator' + else if IsEqualGuid(GUID,CLSID_MidiRendererCategory) then Result := 'CLSID_MidiRendererCategory' + else if IsEqualGuid(GUID,CLSID_ModexProperties) then Result := 'CLSID_ModexProperties' + else if IsEqualGuid(GUID,CLSID_ModexRenderer) then Result := 'CLSID_ModexRenderer' + else if IsEqualGuid(GUID,CLSID_OverlayMixer) then Result := 'CLSID_OverlayMixer' + else if IsEqualGuid(GUID,CLSID_PerformanceProperties) then Result := 'CLSID_PerformanceProperties' + else if IsEqualGuid(GUID,CLSID_PersistMonikerPID) then Result := 'CLSID_PersistMonikerPID' + else if IsEqualGuid(GUID,CLSID_ProtoFilterGraph) then Result := 'CLSID_ProtoFilterGraph' + else if IsEqualGuid(GUID,CLSID_QualityProperties) then Result := 'CLSID_QualityProperties' + else if IsEqualGuid(GUID,CLSID_SeekingPassThru) then Result := 'CLSID_SeekingPassThru' + else if IsEqualGuid(GUID,CLSID_SmartTee) then Result := 'CLSID_SmartTee' + else if IsEqualGuid(GUID,CLSID_SystemClock) then Result := 'CLSID_SystemClock' + else if IsEqualGuid(GUID,CLSID_SystemDeviceEnum) then Result := 'CLSID_SystemDeviceEnum' + else if IsEqualGuid(GUID,CLSID_TVAudioFilterPropertyPage) then Result := 'CLSID_TVAudioFilterPropertyPage' + else if IsEqualGuid(GUID,CLSID_TVTunerFilterPropertyPage) then Result := 'CLSID_TVTunerFilterPropertyPage' + else if IsEqualGuid(GUID,CLSID_TextRender) then Result := 'CLSID_TextRender' + else if IsEqualGuid(GUID,CLSID_URLReader) then Result := 'CLSID_URLReader' + else if IsEqualGuid(GUID,CLSID_VBISurfaces) then Result := 'CLSID_VBISurfaces' + else if IsEqualGuid(GUID,CLSID_VPObject) then Result := 'CLSID_VPObject' + else if IsEqualGuid(GUID,CLSID_VPVBIObject) then Result := 'CLSID_VPVBIObject' + else if IsEqualGuid(GUID,CLSID_VfwCapture) then Result := 'CLSID_VfwCapture' + else if IsEqualGuid(GUID,CLSID_VideoCompressorCategory) then Result := 'CLSID_VideoCompressorCategory' + else if IsEqualGuid(GUID,CLSID_VideoInputDeviceCategory) then Result := 'CLSID_VideoInputDeviceCategory' + else if IsEqualGuid(GUID,CLSID_VideoProcAmpPropertyPage) then Result := 'CLSID_VideoProcAmpPropertyPage' + else if IsEqualGuid(GUID,CLSID_VideoRenderer) then Result := 'CLSID_VideoRenderer' + else if IsEqualGuid(GUID,CLSID_VideoStreamConfigPropertyPage) then Result := 'CLSID_VideoStreamConfigPropertyPage' + + else if IsEqualGuid(GUID,CLSID_WMMUTEX_Language) then Result := 'CLSID_WMMUTEX_Language' + else if IsEqualGuid(GUID,CLSID_WMMUTEX_Bitrate) then Result := 'CLSID_WMMUTEX_Bitrate' + else if IsEqualGuid(GUID,CLSID_WMMUTEX_Presentation) then Result := 'CLSID_WMMUTEX_Presentation' + else if IsEqualGuid(GUID,CLSID_WMMUTEX_Unknown) then Result := 'CLSID_WMMUTEX_Unknown' + + else if IsEqualGuid(GUID,CLSID_WMBandwidthSharing_Exclusive) then Result := 'CLSID_WMBandwidthSharing_Exclusive' + else if IsEqualGuid(GUID,CLSID_WMBandwidthSharing_Partial) then Result := 'CLSID_WMBandwidthSharing_Partial' + + else if IsEqualGuid(GUID,FORMAT_AnalogVideo) then Result := 'FORMAT_AnalogVideo' + else if IsEqualGuid(GUID,FORMAT_DVD_LPCMAudio) then Result := 'FORMAT_DVD_LPCMAudio' + else if IsEqualGuid(GUID,FORMAT_DolbyAC3) then Result := 'FORMAT_DolbyAC3' + else if IsEqualGuid(GUID,FORMAT_DvInfo) then Result := 'FORMAT_DvInfo' + else if IsEqualGuid(GUID,FORMAT_MPEG2Audio) then Result := 'FORMAT_MPEG2Audio' + else if IsEqualGuid(GUID,FORMAT_MPEG2Video) then Result := 'FORMAT_MPEG2Video' + else if IsEqualGuid(GUID,FORMAT_MPEG2_VIDEO) then Result := 'FORMAT_MPEG2_VIDEO' + else if IsEqualGuid(GUID,FORMAT_MPEGStreams) then Result := 'FORMAT_MPEGStreams' + else if IsEqualGuid(GUID,FORMAT_MPEGVideo) then Result := 'FORMAT_MPEGVideo' + else if IsEqualGuid(GUID,FORMAT_None) then Result := 'FORMAT_None' + else if IsEqualGuid(GUID,FORMAT_VIDEOINFO2) then Result := 'FORMAT_VIDEOINFO2' + else if IsEqualGuid(GUID,FORMAT_VideoInfo) then Result := 'FORMAT_VideoInfo' + else if IsEqualGuid(GUID,FORMAT_VideoInfo2) then Result := 'FORMAT_VideoInfo2' + else if IsEqualGuid(GUID,FORMAT_WaveFormatEx) then Result := 'FORMAT_WaveFormatEx' + + else if IsEqualGuid(GUID,TIME_FORMAT_BYTE) then Result := 'TIME_FORMAT_BYTE' + else if IsEqualGuid(GUID,TIME_FORMAT_FIELD) then Result := 'TIME_FORMAT_FIELD' + else if IsEqualGuid(GUID,TIME_FORMAT_FRAME) then Result := 'TIME_FORMAT_FRAME' + else if IsEqualGuid(GUID,TIME_FORMAT_MEDIA_TIME) then Result := 'TIME_FORMAT_MEDIA_TIME' + else if IsEqualGuid(GUID,TIME_FORMAT_SAMPLE) then Result := 'TIME_FORMAT_SAMPLE' + + else if IsEqualGuid(GUID,AMPROPSETID_Pin) then Result := 'AMPROPSETID_Pin' + else if IsEqualGuid(GUID,AM_INTERFACESETID_Standard) then Result := 'AM_INTERFACESETID_Standard' + else if IsEqualGuid(GUID,AM_KSCATEGORY_AUDIO) then Result := 'AM_KSCATEGORY_AUDIO' + else if IsEqualGuid(GUID,AM_KSCATEGORY_CAPTURE) then Result := 'AM_KSCATEGORY_CAPTURE' + else if IsEqualGuid(GUID,AM_KSCATEGORY_CROSSBAR) then Result := 'AM_KSCATEGORY_CROSSBAR' + else if IsEqualGuid(GUID,AM_KSCATEGORY_DATACOMPRESSOR) then Result := 'AM_KSCATEGORY_DATACOMPRESSOR' + else if IsEqualGuid(GUID,AM_KSCATEGORY_RENDER) then Result := 'AM_KSCATEGORY_RENDER' + else if IsEqualGuid(GUID,AM_KSCATEGORY_TVAUDIO) then Result := 'AM_KSCATEGORY_TVAUDIO' + else if IsEqualGuid(GUID,AM_KSCATEGORY_TVTUNER) then Result := 'AM_KSCATEGORY_TVTUNER' + else if IsEqualGuid(GUID,AM_KSCATEGORY_VIDEO) then Result := 'AM_KSCATEGORY_VIDEO' + else if IsEqualGuid(GUID,AM_KSPROPSETID_AC3) then Result := 'AM_KSPROPSETID_AC3' + else if IsEqualGuid(GUID,AM_KSPROPSETID_CopyProt) then Result := 'AM_KSPROPSETID_CopyProt' + else if IsEqualGuid(GUID,AM_KSPROPSETID_DvdSubPic) then Result := 'AM_KSPROPSETID_DvdSubPic' + else if IsEqualGuid(GUID,AM_KSPROPSETID_TSRateChange) then Result := 'AM_KSPROPSETID_TSRateChange' + + else if IsEqualGuid(GUID,IID_IAMDirectSound) then Result := 'IID_IAMDirectSound' + else if IsEqualGuid(GUID,IID_IAMLine21Decoder) then Result := 'IID_IAMLine21Decoder' + else if IsEqualGuid(GUID,IID_IBaseVideoMixer) then Result := 'IID_IBaseVideoMixer' + else if IsEqualGuid(GUID,IID_IDDVideoPortContainer) then Result := 'IID_IDDVideoPortContainer' + else if IsEqualGuid(GUID,IID_IDirectDraw) then Result := 'IID_IDirectDraw' + else if IsEqualGuid(GUID,IID_IDirectDraw2) then Result := 'IID_IDirectDraw2' + else if IsEqualGuid(GUID,IID_IDirectDrawClipper) then Result := 'IID_IDirectDrawClipper' + else if IsEqualGuid(GUID,IID_IDirectDrawColorControl) then Result := 'IID_IDirectDrawColorControl' + else if IsEqualGuid(GUID,IID_IDirectDrawKernel) then Result := 'IID_IDirectDrawKernel' + else if IsEqualGuid(GUID,IID_IDirectDrawPalette) then Result := 'IID_IDirectDrawPalette' + else if IsEqualGuid(GUID,IID_IDirectDrawSurface) then Result := 'IID_IDirectDrawSurface' + else if IsEqualGuid(GUID,IID_IDirectDrawSurface2) then Result := 'IID_IDirectDrawSurface2' + else if IsEqualGuid(GUID,IID_IDirectDrawSurface3) then Result := 'IID_IDirectDrawSurface3' + else if IsEqualGuid(GUID,IID_IDirectDrawSurfaceKernel) then Result := 'IID_IDirectDrawSurfaceKernel' + else if IsEqualGuid(GUID,IID_IDirectDrawVideo) then Result := 'IID_IDirectDrawVideo' + else if IsEqualGuid(GUID,IID_IFullScreenVideo) then Result := 'IID_IFullScreenVideo' + else if IsEqualGuid(GUID,IID_IFullScreenVideoEx) then Result := 'IID_IFullScreenVideoEx' + else if IsEqualGuid(GUID,IID_IKsDataTypeHandler) then Result := 'IID_IKsDataTypeHandler' + else if IsEqualGuid(GUID,IID_IKsInterfaceHandler) then Result := 'IID_IKsInterfaceHandler' + else if IsEqualGuid(GUID,IID_IKsPin) then Result := 'IID_IKsPin' + else if IsEqualGuid(GUID,IID_IMixerPinConfig) then Result := 'IID_IMixerPinConfig' + else if IsEqualGuid(GUID,IID_IMixerPinConfig2) then Result := 'IID_IMixerPinConfig2' + else if IsEqualGuid(GUID,IID_IMpegAudioDecoder) then Result := 'IID_IMpegAudioDecoder' + else if IsEqualGuid(GUID,IID_IQualProp) then Result := 'IID_IQualProp' + else if IsEqualGuid(GUID,IID_IVPConfig) then Result := 'IID_IVPConfig' + else if IsEqualGuid(GUID,IID_IVPControl) then Result := 'IID_IVPControl' + else if IsEqualGuid(GUID,IID_IVPNotify) then Result := 'IID_IVPNotify' + else if IsEqualGuid(GUID,IID_IVPNotify2) then Result := 'IID_IVPNotify2' + else if IsEqualGuid(GUID,IID_IVPObject) then Result := 'IID_IVPObject' + else if IsEqualGuid(GUID,IID_IVPVBIConfig) then Result := 'IID_IVPVBIConfig' + else if IsEqualGuid(GUID,IID_IVPVBINotify) then Result := 'IID_IVPVBINotify' + else if IsEqualGuid(GUID,IID_IVPVBIObject) then Result := 'IID_IVPVBIObject' + + else if IsEqualGuid(GUID,LOOK_DOWNSTREAM_ONLY) then Result := 'LOOK_DOWNSTREAM_ONLY' + else if IsEqualGuid(GUID,LOOK_UPSTREAM_ONLY) then Result := 'LOOK_UPSTREAM_ONLY' + else Result := ''; +end; +// milenko end + +// milenko start (usefull functions to get linear amplification) +// improved by XXX +function GetBasicAudioVolume(Value : integer) : integer; +begin + Inc(Value, 10000); + Result := Round(Exp(Value / 1085.73) - 1); +end; + +function SetBasicAudioVolume(Value : integer) : integer; +begin + Inc(Value); + Result := Round(1085.73*ln(Value)) - 10000; +end; + +function GetBasicAudioPan(Value : integer) : integer; +begin + Result := Round(Exp(abs(Value) / 1085.73) - 1); + if Value <= 0 then Result := -Result; +end; + +function SetBasicAudioPan(Value : integer) : integer; +begin + Result := Round(1085.73*ln(abs(Value)+1)); + if Value >= 0 then Result := -Result; +end; +// milenko end + +// milenok start (yet another delphi5 compatibility ...) +{$IFDEF VER130} +function StringToGUID(const S: string): TGUID; +begin + if not Succeeded(CLSIDFromString(PWideChar(WideString(S)), Result)) + then raise Exception.Create('StringToGUID: Error converting String'); +end; + +function GUIDToString(const GUID: TGUID): string; +var + P: PWideChar; +begin + if not Succeeded(StringFromCLSID(GUID, P)) + then raise Exception.Create('GUIDToString: Error converting GUID'); + Result := P; + CoTaskMemFree(P); +end; + +function EnsureRange(const AValue, AMin, AMax: Integer): Integer; +begin + Result := AValue; + assert(AMin <= AMax); + if Result < AMin then + Result := AMin; + if Result > AMax then + Result := AMax; +end; +{$ENDIF} +// milenko end + +const + SectionLengthMask = $FFF; // 0000111111111111 + ReservedMask = $3000; // 0011000000000000 + PrivateIndicatorMask = $4000; // 0100000000000000 + SectionSyntaxIndicatorMask = $8000; // 1000000000000000 + +function MPEGHeaderBitsGetSectionLength(Header: PMPEGHeaderBits): WORD; +begin + Result := Header.Bits and SectionLengthMask; +end; + +function MPEGHeaderBitsGetReserved(Header: PMPEGHeaderBits): WORD; +begin + Result := (Header.Bits and ReservedMask) shr 12; +end; + +function MPEGHeaderBitsGetPrivateIndicator(Header: PMPEGHeaderBits): WORD; +begin + Result := (Header.Bits and PrivateIndicatorMask) shr 14; +end; + +function MPEGHeaderBitsGetSectionSyntaxIndicator(Header: PMPEGHeaderBits): WORD; +begin + Result := (Header.Bits and SectionSyntaxIndicatorMask) shr 15; +end; + +procedure MPEGHeaderBitsSetSectionLength(Header: PMPEGHeaderBits; AValue: WORD); +begin + Header.Bits := Header.Bits or (AValue and SectionLengthMask); +end; + +procedure MPEGHeaderBitsSetReserved(Header: PMPEGHeaderBits; AValue: WORD); +begin + Header.Bits := Header.Bits or ((AValue shl 12) and ReservedMask); +end; + +procedure MPEGHeaderBitsSetPrivateIndicator(Header: PMPEGHeaderBits; AValue: WORD); +begin + Header.Bits := Header.Bits or ((AValue shl 14) and PrivateIndicatorMask); +end; + +procedure MPEGHeaderBitsSetSectionSyntaxIndicator(Header: PMPEGHeaderBits; AValue: WORD); +begin + Header.Bits := Header.Bits or ((AValue shl 15) and SectionSyntaxIndicatorMask); +end; + +const + PIDBitsReservedMask = $7; // 0000000000000111 + PIDBitsProgramId = $FFF8; // 1111111111111000 + +function PIDBitsGetReserved(PIDBits: PPIDBits): WORD; +begin + Result := PIDBits.Bits and PIDBitsReservedMask; +end; + +function PIDBitsGetProgramId(PIDBits: PPIDBits): WORD; +begin + Result := (PIDBits.Bits and PIDBitsProgramId) shr 3; +end; + +procedure PIDBitsSetReserved(PIDBits: PPIDBits; AValue: WORD); +begin + PIDBits.Bits := PIDBits.Bits or (AValue and PIDBitsReservedMask); +end; + +procedure PIDBitsSetProgramId(PIDBits: PPIDBits; AValue: WORD); +begin + PIDBits.Bits := PIDBits.Bits or ((AValue shl 3) and PIDBitsProgramId); +end; + +const + MHBCurrentNextIndicator = $1; // 00000001 + MHBVersionNumber = $3E; // 00111110 + MHBReserved = $C0; // 11000000 + +function MPEGHeaderVersionBitsGetCurrentNextIndicator(MPEGHeaderVersionBits: PMPEGHeaderVersionBits): Byte; +begin + Result := MPEGHeaderVersionBits.Bits and MHBCurrentNextIndicator; +end; + +function MPEGHeaderVersionBitsGetVersionNumber(MPEGHeaderVersionBits: PMPEGHeaderVersionBits): Byte; +begin + Result := (MPEGHeaderVersionBits.Bits and MHBVersionNumber) shr 1; +end; + +function MPEGHeaderVersionBitsGetReserved(MPEGHeaderVersionBits: PMPEGHeaderVersionBits): Byte; +begin + Result := (MPEGHeaderVersionBits.Bits and MHBReserved) shr 6; +end; + +procedure MPEGHeaderVersionBitsSetCurrentNextIndicator(MPEGHeaderVersionBits: PMPEGHeaderVersionBits; AValue: Byte); +begin + MPEGHeaderVersionBits.Bits := MPEGHeaderVersionBits.Bits or (AValue and MHBCurrentNextIndicator); +end; + +procedure MPEGHeaderVersionBitsSetVersionNumber(MPEGHeaderVersionBits: PMPEGHeaderVersionBits; AValue: Byte); +begin + MPEGHeaderVersionBits.Bits := MPEGHeaderVersionBits.Bits or ((AValue shl 1) and MHBVersionNumber); +end; + +procedure MPEGHeaderVersionBitsSetReserved(MPEGHeaderVersionBits: PMPEGHeaderVersionBits; AValue: Byte); +begin + MPEGHeaderVersionBits.Bits := MPEGHeaderVersionBits.Bits or ((AValue shl 6) and MHBReserved); +end; + +end. diff --git a/Game/Code/lib/DSPack/DSPack/MediaTypeEditor.dfm b/Game/Code/lib/DSPack/DSPack/MediaTypeEditor.dfm new file mode 100644 index 00000000..c4a738a6 --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/MediaTypeEditor.dfm @@ -0,0 +1,148 @@ +object FormMediaType: TFormMediaType + Left = 211 + Top = 142 + BorderStyle = bsToolWindow + Caption = ' MediaType Editor' + ClientHeight = 239 + ClientWidth = 311 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + Position = poDesktopCenter + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 8 + Top = 8 + Width = 53 + Height = 13 + Caption = 'Major Type' + end + object Label2: TLabel + Left = 160 + Top = 8 + Width = 46 + Height = 13 + Caption = 'Sub Type' + end + object Label3: TLabel + Left = 160 + Top = 48 + Width = 58 + Height = 13 + Caption = 'Sample Size' + end + object Label4: TLabel + Left = 160 + Top = 96 + Width = 59 + Height = 13 + Caption = 'Format Type' + end + object lblFormatSize: TLabel + Left = 8 + Top = 96 + Width = 55 + Height = 13 + Caption = 'Format Size' + end + object btOK: TButton + Left = 8 + Top = 208 + Width = 75 + Height = 25 + Caption = '&OK' + TabOrder = 0 + OnClick = btOKClick + end + object btCancel: TButton + Left = 232 + Top = 208 + Width = 75 + Height = 25 + Caption = '&Cancel' + ModalResult = 2 + TabOrder = 1 + end + object cbMajorTypes: TComboBox + Left = 8 + Top = 24 + Width = 145 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 2 + OnChange = cbMajorTypesChange + end + object cbSubTypes: TComboBox + Left = 160 + Top = 24 + Width = 145 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 3 + OnChange = cbSubTypesChange + end + object chkFixedSize: TCheckBox + Left = 8 + Top = 56 + Width = 145 + Height = 17 + Caption = 'Fixed Size Samples' + Ctl3D = True + ParentCtl3D = False + TabOrder = 4 + OnClick = chkFixedSizeClick + end + object chkTempCompress: TCheckBox + Left = 8 + Top = 72 + Width = 145 + Height = 17 + Caption = 'Temporal Compression' + TabOrder = 5 + OnClick = chkTempCompressClick + end + object edSampleSize: TEdit + Left = 160 + Top = 64 + Width = 145 + Height = 21 + TabOrder = 6 + Text = '0' + OnChange = edSampleSizeChange + end + object cbFormatType: TComboBox + Left = 160 + Top = 112 + Width = 145 + Height = 21 + Style = csDropDownList + ItemHeight = 13 + TabOrder = 7 + OnChange = cbFormatTypeChange + end + object Memo1: TMemo + Left = 8 + Top = 144 + Width = 297 + Height = 59 + ReadOnly = True + TabOrder = 8 + end + object edFormatSize: TEdit + Left = 8 + Top = 112 + Width = 145 + Height = 21 + Enabled = False + TabOrder = 9 + Text = '0' + end +end diff --git a/Game/Code/lib/DSPack/DSPack/MediaTypeEditor.pas b/Game/Code/lib/DSPack/DSPack/MediaTypeEditor.pas new file mode 100644 index 00000000..600e8517 --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/MediaTypeEditor.pas @@ -0,0 +1,328 @@ + + (********************************************************************* + * DSPack 2.3.3 * + * * + * home page : http://www.progdigy.com * + * email : hgourvest@progdigy.com * + * Thanks to Michael Andersen. (DSVideoWindowEx) * + * * + * date : 21-02-2003 * + * * + * 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. * + * * + *********************************************************************) + +unit MediaTypeEditor; + +interface + +{$IFDEF VER150} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, + Dialogs, DSUtil, StdCtrls, DirectShow9, Mask; + +type + TFormMediaType = class(TForm) + btOK: TButton; + btCancel: TButton; + cbMajorTypes: TComboBox; + cbSubTypes: TComboBox; + Label1: TLabel; + Label2: TLabel; + chkFixedSize: TCheckBox; + chkTempCompress: TCheckBox; + edSampleSize: TEdit; + Label3: TLabel; + cbFormatType: TComboBox; + Label4: TLabel; + Memo1: TMemo; + lblFormatSize: TLabel; + edFormatSize: TEdit; + procedure FormShow(Sender: TObject); + procedure cbMajorTypesChange(Sender: TObject); + procedure cbSubTypesChange(Sender: TObject); + procedure chkFixedSizeClick(Sender: TObject); + procedure chkTempCompressClick(Sender: TObject); + procedure btOKClick(Sender: TObject); + procedure cbFormatTypeChange(Sender: TObject); + procedure edSampleSizeChange(Sender: TObject); + public + MediaType: TMediaType; + procedure RefreshMediaType; + constructor create(AOwner: TComponent); override; + destructor Destroy; override; + end; + + TGUIDDescription = record + name: string; + GUID: TGUID; + end; + + +var + FormMediaType: TFormMediaType; + +const + MajorTypes : array[0..15] of TGUIDDescription = + ((name: '[Automatic]'; GUID: '{00000000-0000-0000-0000-000000000000}'), + (name: 'Video' ; GUID: '{73646976-0000-0010-8000-00AA00389B71}'), + (name: 'Audio' ; GUID: '{73647561-0000-0010-8000-00AA00389B71}'), + (name: 'AnalogAudio' ; GUID: '{0482DEE1-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo' ; GUID: '{0482DDE1-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AUXLine21Data' ; GUID: '{670AEA80-3A82-11D0-B79B-00AA003767A7}'), + (name: 'File' ; GUID: '{656C6966-0000-0010-8000-00AA00389B71}'), + (name: 'Interleaved' ; GUID: '{73766169-0000-0010-8000-00AA00389B71}'), + (name: 'LMRT' ; GUID: '{74726c6d-0000-0010-8000-00aa00389b71}'), + (name: 'Midi' ; GUID: '{7364696D-0000-0010-8000-00AA00389B71}'), + (name: 'MPEG2_PES' ; GUID: '{e06d8020-db46-11cf-b4d1-00805f6cbbea}'), + (name: 'ScriptCommand' ; GUID: '{73636D64-0000-0010-8000-00AA00389B71}'), + (name: 'Stream' ; GUID: '{E436EB83-524F-11CE-9F53-0020AF0BA770}'), + (name: 'Text' ; GUID: '{73747874-0000-0010-8000-00AA00389B71}'), + (name: 'Timecode' ; GUID: '{0482DEE3-7817-11CF-8A03-00AA006ECB65}'), + (name: 'URL_STREAM' ; GUID: '{736c7275-0000-0010-8000-00aa00389b71}')); + + SubTypes : array[0..97] of TGUIDDescription = + ((name: '[Automatic]'; GUID: '{00000000-0000-0000-0000-000000000000}'), + (name: 'MJPG'; GUID: '{47504A4D-0000-0010-8000-00AA00389B71}'), + (name: 'Avi'; GUID: '{E436EB88-524F-11CE-9F53-0020AF0BA770}'), + (name: 'Asf'; GUID: '{3DB80F90-9412-11D1-ADED-0000F8754B99}'), + (name: 'PCM'; GUID: '{00000001-0000-0010-8000-00AA00389B71}'), + (name: 'WAVE'; GUID: '{E436EB8B-524F-11CE-9F53-0020AF0BA770}'), + (name: 'AU'; GUID: '{E436EB8C-524F-11CE-9F53-0020AF0BA770}'), + (name: 'AIFF'; GUID: '{E436EB8D-524F-11CE-9F53-0020AF0BA770}'), + (name: 'DTS'; GUID: '{E06D8033-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'DOLBY_AC3'; GUID: '{E06D802C-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'RGB1'; GUID: '{E436EB78-524F-11CE-9F53-0020AF0BA770}'), + (name: 'RGB4'; GUID: '{E436EB79-524F-11CE-9F53-0020AF0BA770}'), + (name: 'RGB8'; GUID: '{E436EB7A-524F-11CE-9F53-0020AF0BA770}'), + (name: 'RGB565'; GUID: '{E436EB7B-524F-11CE-9F53-0020AF0BA770}'), + (name: 'RGB555'; GUID: '{E436EB7C-524F-11CE-9F53-0020AF0BA770}'), + (name: 'RGB24'; GUID: '{E436EB7D-524F-11CE-9F53-0020AF0BA770}'), + (name: 'RGB32'; GUID: '{E436EB7E-524F-11CE-9F53-0020AF0BA770}'), + (name: 'ARGB32'; GUID: '{773C9AC0-3274-11D0-B724-00AA006C1A01}'), + (name: 'YUYV'; GUID: '{56595559-0000-0010-8000-00AA00389B71}'), + (name: 'IYUV'; GUID: '{56555949-0000-0010-8000-00AA00389B71}'), + (name: 'YVU9'; GUID: '{39555659-0000-0010-8000-00AA00389B71}'), + (name: 'Y411'; GUID: '{31313459-0000-0010-8000-00AA00389B71}'), + (name: 'Y41P'; GUID: '{50313459-0000-0010-8000-00AA00389B71}'), + (name: 'YUY2'; GUID: '{32595559-0000-0010-8000-00AA00389B71}'), + (name: 'YVYU'; GUID: '{55595659-0000-0010-8000-00AA00389B71}'), + (name: 'UYVY'; GUID: '{59565955-0000-0010-8000-00AA00389B71}'), + (name: 'Y211'; GUID: '{31313259-0000-0010-8000-00AA00389B71}'), + (name: 'YV12'; GUID: '{32315659-0000-0010-8000-00AA00389B71}'), + (name: 'CLPL'; GUID: '{4C504C43-0000-0010-8000-00AA00389B71}'), + (name: 'CLJR'; GUID: '{524A4C43-0000-0010-8000-00AA00389B71}'), + (name: 'IF09'; GUID: '{39304649-0000-0010-8000-00AA00389B71}'), + (name: 'CPLA'; GUID: '{414C5043-0000-0010-8000-00AA00389B71}'), + (name: 'TVMJ'; GUID: '{4A4D5654-0000-0010-8000-00AA00389B71}'), + (name: 'WAKE'; GUID: '{454B4157-0000-0010-8000-00AA00389B71}'), + (name: 'CFCC'; GUID: '{43434643-0000-0010-8000-00AA00389B71}'), + (name: 'IJPG'; GUID: '{47504A49-0000-0010-8000-00AA00389B71}'), + (name: 'Plum'; GUID: '{6D756C50-0000-0010-8000-00AA00389B71}'), + (name: 'DVCS'; GUID: '{53435644-0000-0010-8000-00AA00389B71}'), + (name: 'DVSD'; GUID: '{44535644-0000-0010-8000-00AA00389B71}'), + (name: 'MDVF'; GUID: '{4656444D-0000-0010-8000-00AA00389B71}'), + (name: 'Overlay'; GUID: '{E436EB7F-524F-11CE-9F53-0020AF0BA770}'), + (name: 'MPEG1Packet'; GUID: '{E436EB80-524F-11CE-9F53-0020AF0BA770}'), + (name: 'MPEG1Payload'; GUID: '{E436EB81-524F-11CE-9F53-0020AF0BA770}'), + (name: 'MPEG1AudioPayload'; GUID: '{00000050-0000-0010-8000-00AA00389B71}'), + (name: 'MPEG1System'; GUID: '{E436EB84-524F-11CE-9F53-0020AF0BA770}'), + (name: 'MPEG1VideoCD'; GUID: '{E436EB85-524F-11CE-9F53-0020AF0BA770}'), + (name: 'MPEG1Video'; GUID: '{E436EB86-524F-11CE-9F53-0020AF0BA770}'), + (name: 'MPEG1Audio'; GUID: '{E436EB87-524F-11CE-9F53-0020AF0BA770}'), + (name: 'QTMovie'; GUID: '{E436EB89-524F-11CE-9F53-0020AF0BA770}'), + (name: 'QTRpza'; GUID: '{617A7072-0000-0010-8000-00AA00389B71}'), + (name: 'QTSmc'; GUID: '{20636D73-0000-0010-8000-00AA00389B71}'), + (name: 'QTRle'; GUID: '{20656C72-0000-0010-8000-00AA00389B71}'), + (name: 'QTJpeg'; GUID: '{6765706A-0000-0010-8000-00AA00389B71}'), + (name: 'PCMAudio_Obsolete'; GUID: '{E436EB8A-524F-11CE-9F53-0020AF0BA770}'), + (name: 'dvsd_'; GUID: '{64737664-0000-0010-8000-00AA00389B71}'), + (name: 'dvhd'; GUID: '{64687664-0000-0010-8000-00AA00389B71}'), + (name: 'dvsl'; GUID: '{6C737664-0000-0010-8000-00AA00389B71}'), + (name: 'Line21_BytePair'; GUID: '{6E8D4A22-310C-11D0-B79A-00AA003767A7}'), + (name: 'Line21_GOPPacket'; GUID: '{6E8D4A23-310C-11D0-B79A-00AA003767A7}'), + (name: 'Line21_VBIRawData'; GUID: '{6E8D4A24-310C-11D0-B79A-00AA003767A7}'), + (name: 'DRM_Audio'; GUID: '{00000009-0000-0010-8000-00AA00389B71}'), + (name: 'IEEE_FLOAT'; GUID: '{00000003-0000-0010-8000-00AA00389B71}'), + (name: 'DOLBY_AC3_SPDIF'; GUID: '{00000092-0000-0010-8000-00AA00389B71}'), + (name: 'RAW_SPORT'; GUID: '{00000240-0000-0010-8000-00AA00389B71}'), + (name: 'SPDIF_TAG_241h'; GUID: '{00000241-0000-0010-8000-00AA00389B71}'), + (name: 'DssVideo'; GUID: '{A0AF4F81-E163-11D0-BAD9-00609744111A}'), + (name: 'DssAudio'; GUID: '{A0AF4F82-E163-11D0-BAD9-00609744111A}'), + (name: 'VPVideo'; GUID: '{5A9B6A40-1A22-11D1-BAD9-00609744111A}'), + (name: 'VPVBI'; GUID: '{5A9B6A41-1A22-11D1-BAD9-00609744111A}'), + (name: 'AnalogVideo_NTSC_M'; GUID: '{0482DDE2-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_PAL_B'; GUID: '{0482DDE5-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_PAL_D'; GUID: '{0482DDE6-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_PAL_G'; GUID: '{0482DDE7-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_PAL_H'; GUID: '{0482DDE8-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_PAL_I'; GUID: '{0482DDE9-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_PAL_M'; GUID: '{0482DDEA-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_PAL_N'; GUID: '{0482DDEB-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_PAL_N_COMBO'; GUID: '{0482DDEC-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_SECAM_B'; GUID: '{0482DDF0-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_SECAM_D'; GUID: '{0482DDF1-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_SECAM_G'; GUID: '{0482DDF2-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_SECAM_H'; GUID: '{0482DDF3-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_SECAM_K'; GUID: '{0482DDF4-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_SECAM_K1'; GUID: '{0482DDF5-7817-11CF-8A03-00AA006ECB65}'), + (name: 'AnalogVideo_SECAM_L'; GUID: '{0482DDF6-7817-11CF-8A03-00AA006ECB65}'), + (name: 'MPEG2_VIDEO'; GUID: '{E06D8026-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'MPEG2_PROGRAM'; GUID: '{E06D8022-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'MPEG2_TRANSPORT'; GUID: '{E06D8023-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'MPEG2_AUDIO'; GUID: '{E06D802B-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'DVD_SUBPICTURE'; GUID: '{E06D802D-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'DVD_LPCM_AUDIO'; GUID: '{E06D8032-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'SDDS'; GUID: '{E06D8034-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'DVD_NAVIGATION_PCI'; GUID: '{E06D802F-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'DVD_NAVIGATION_DSI'; GUID: '{E06D8030-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'DVD_NAVIGATION_PROVIDER'; GUID: '{E06D8031-DB46-11CF-B4D1-00805F6CBBEA}'), + (name: 'MP42'; GUID: '{3234504D-0000-0010-8000-00AA00389B71}'), + (name: 'DIVX'; GUID: '{58564944-0000-0010-8000-00AA00389B71}'), + (name: 'VOXWARE'; GUID: '{00000075-0000-0010-8000-00AA00389B71}')); + + FormatTypes: array[0..4] of TGUIDDescription = + ((name: '[Automatic]'; GUID: '{00000000-0000-0000-0000-000000000000}'), + (name: 'None'; GUID: '{0F6417D6-C318-11D0-A43F-00A0C9223196}'), + (name: 'VideoInfo'; GUID: '{05589F80-C356-11CE-BF01-00AA0055595A}'), + (name: 'VideoInfo2'; GUID: '{F72A76A0-EB0A-11D0-ACE4-0000C0CC16BA}'), + (name: 'WaveFormatEx'; GUID: '{05589F81-C356-11CE-BF01-00AA0055595A}')); + +implementation + uses ActiveX; +{$R *.dfm} + + constructor TFormMediaType.create(AOwner: TComponent); + var i: byte; + begin + inherited Create(AOwner); + MediaType:= TMediaType.Create; + for i := 0 to 15 do cbMajorTypes.Items.Add(MajorTypes[i].name); + for i := 0 to 97 do cbSubTypes.Items.Add(SubTypes[i].name); + for i := 0 to 4 do cbFormatType.Items.Add(FormatTypes[i].name); + end; + + destructor TFormMediaType.Destroy; + begin + MediaType.Free; + + inherited Destroy; + end; + +// majortype : TGUID; +// subtype : TGUID; +// bFixedSizeSamples : BOOL; +// bTemporalCompression : BOOL; +// lSampleSize : ULONG; +// formattype : TGUID; +// pUnk : IUnknown; +// cbFormat : ULONG; +// pbFormat : Pointer; + + procedure TFormMediaType.FormShow(Sender: TObject); + begin + RefreshMediaType; + end; + + procedure TFormMediaType.RefreshMediaType; + var i: byte; + begin + for i := 0 to 15 do + if IsEqualGUID(MajorTypes[i].GUID, MediaType.MajorType) then + begin + cbMajorTypes.ItemIndex := i; + Break; + end; + for i := 0 to 97 do + if IsEqualGUID(SubTypes[i].GUID, MediaType.SubType) then + begin + cbSubTypes.ItemIndex := i; + Break; + end; + if cbMajorTypes.ItemIndex = -1 then cbMajorTypes.ItemIndex := 0; + if cbSubTypes.ItemIndex = -1 then cbSubTypes.ItemIndex := 0; + chkFixedSize.Checked := MediaType.IsFixedSize; + chkTempCompress.Checked := MediaType.IsTemporalCompressed; + edSampleSize.Text := inttostr(MediaType.GetSampleSize); + + for i := 0 to 4 do + if IsEqualGUID(FormatTypes[i].GUID, MediaType.FormatType) then + begin + cbFormatType.ItemIndex := i; + Break; + end; + edFormatSize.Text := inttostr(MediaType.FormatLength); + + + memo1.Clear; + memo1.lines.Add(GetMediaTypeDescription(MediaType.AMMediaType)); + + end; + + procedure TFormMediaType.btOKClick(Sender: TObject); + begin + try + MediaType.SetSampleSize(StrToInt(edSampleSize.Text)); + except + MessageBox(Handle,PChar('Invalid Sample Size.'), PChar('Error'), mb_ok); + exit; + end; + ModalResult := mrOK; + end; + + procedure TFormMediaType.cbMajorTypesChange(Sender: TObject); + begin + MediaType.MajorType := MajorTypes[cbMajorTypes.ItemIndex].GUID; + RefreshMediaType; + end; + + procedure TFormMediaType.cbSubTypesChange(Sender: TObject); + begin + MediaType.SubType := SubTypes[cbSubTypes.ItemIndex].GUID; + RefreshMediaType; + end; + + procedure TFormMediaType.chkFixedSizeClick(Sender: TObject); + begin + MediaType.AMMediaType.bFixedSizeSamples := chkFixedSize.Checked; + RefreshMediaType; + end; + + procedure TFormMediaType.chkTempCompressClick(Sender: TObject); + begin + MediaType.AMMediaType.bTemporalCompression := chkTempCompress.Checked; + RefreshMediaType; + end; + + + procedure TFormMediaType.cbFormatTypeChange(Sender: TObject); + begin + MediaType.FormatType := FormatTypes[cbFormatType.ItemIndex].GUID; + RefreshMediaType; + end; + + procedure TFormMediaType.edSampleSizeChange(Sender: TObject); + begin + try + if edSampleSize.Text = '' then MediaType.SetSampleSize(0) else + MediaType.SetSampleSize(StrToInt(edSampleSize.Text)); + finally + RefreshMediaType; + end; + end; + +end. diff --git a/Game/Code/lib/DSPack/DSPack/clean.bat b/Game/Code/lib/DSPack/DSPack/clean.bat new file mode 100644 index 00000000..19e26a92 --- /dev/null +++ b/Game/Code/lib/DSPack/DSPack/clean.bat @@ -0,0 +1,2 @@ +del *.~*;*.dcu;*.obj;*.hpp;*.ddp +exit \ No newline at end of file diff --git a/Game/Code/lib/DSPack/DirectX9/D3DX8.pas b/Game/Code/lib/DSPack/DirectX9/D3DX8.pas new file mode 100644 index 00000000..ebd67a77 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/D3DX8.pas @@ -0,0 +1,4951 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* File: d3dx8.h, d3dx8core.h, d3dx8math.h, d3dx8math.inl, *} +{* d3dx8effect.h, d3dx8mesh.h, d3dx8shape.h, d3dx8tex.h *} +{* Content: Direct3DX 8.1 headers *} +{* *} +{* Direct3DX 8.1 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 27-Apr-2003 *} +{* *} +{* Partly based upon : *} +{* Direct3DX 7.0 Delphi adaptation by *} +{* Arne Schäpers, e-Mail: [look at www.delphi-jedi.org/DelphiGraphics/] *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{* This File contains only Direct3DX 8.x Definitions. *} +{* If you want to use D3DX7 version of D3DX use translation by Arne Schäpers *} +{* *} +{******************************************************************************) +{ } +{ 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 } +{ } +{******************************************************************************} + +// Original source contained in "D3DX8.par" + +{$I DirectX.inc} + +unit D3DX8; + +interface + +// Remove "dot" below to link with debug version of D3DX8 +// (only in JEDI or TMT pascal version) +{.$DEFINE DEBUG} + +// Remove "dot" below to link with DirectXGraphics and Direct3D +{.$DEFINE DXG_COMPAT} + +(*$HPPEMIT '#include "d3dx8.h"' *) +(*$HPPEMIT '#include "dxfile.h"' *) + +// Do not emit to C++Builder +(*$NOINCLUDE DXFile *) + +(*$HPPEMIT 'namespace D3dx8' *) + +(*$HPPEMIT '{' *) + +uses + Windows, + ActiveX, + SysUtils, + {$I UseD3D8.inc}, + DXFile; + +const + //////////// DLL export definitions /////////////////////////////////////// + d3dx8dll ={$IFDEF DEBUG} 'd3dx8d.dll'{$ELSE} 'D3DX81ab.dll'{$ENDIF}; + + +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8.h +// Content: D3DX utility library +// +/////////////////////////////////////////////////////////////////////////// + +const + // #define D3DX_DEFAULT ULONG_MAX + D3DX_DEFAULT = $FFFFFFFF; + {$EXTERNALSYM D3DX_DEFAULT} + +var + // #define D3DX_DEFAULT_FLOAT FLT_MAX + // Forced to define as 'var' cos pascal compiler treats all consts as Double + D3DX_DEFAULT_FLOAT: Single = 3.402823466e+38; // max single value + {$EXTERNALSYM D3DX_DEFAULT_FLOAT} + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8math.h +// Content: D3DX math types and functions +// +////////////////////////////////////////////////////////////////////////////// + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== +const + D3DX_PI: Single = 3.141592654; + {$EXTERNALSYM D3DX_PI} + D3DX_1BYPI: Single = 0.318309886; + {$EXTERNALSYM D3DX_1BYPI} + +//#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f)) +function D3DXToRadian(Degree: Single): Single; +{$EXTERNALSYM D3DXToRadian} +//#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI)) +function D3DXToDegree(Radian: Single): Single; +{$EXTERNALSYM D3DXToDegree} + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + +//-------------------------- +// 2D Vector +//-------------------------- +type + {$HPPEMIT 'typedef D3DXVECTOR2 TD3DXVector2;'} + {$HPPEMIT 'typedef D3DXVECTOR2 *PD3DXVector2;'} + PD3DXVector2 = ^TD3DXVector2; + {$NODEFINE PD3DXVector2} + TD3DXVector2 = packed record + x, y: Single; + end; + {$NODEFINE TD3DXVector2} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector2Zero: TD3DXVector2 = (x:0; y:0); // (0,0) +function D3DXVector2(_x, _y: Single): TD3DXVector2; +function D3DXVector2Equal(const v1, v2: TD3DXVector2): Boolean; + + +//-------------------------- +// 3D Vector +//-------------------------- +type + {$HPPEMIT 'typedef D3DXVECTOR3 TD3DXVector3;'} + {$HPPEMIT 'typedef D3DXVECTOR3 *PD3DXVector3;'} + PD3DXVector3 = ^TD3DXVector3; + {$NODEFINE PD3DXVector3} + TD3DXVector3 = TD3DVector; + {$NODEFINE TD3DXVector3} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector3Zero: TD3DXVector3 = (x:0; y:0; z:0); // (0,0,0) +function D3DXVector3(_x, _y, _z: Single): TD3DXVector3; +function D3DXVector3Equal(const v1, v2: TD3DXVector3): Boolean; + + +//-------------------------- +// 4D Vector +//-------------------------- +type + {$HPPEMIT 'typedef D3DXVECTOR4 TD3DXVector4;'} + {$HPPEMIT 'typedef D3DXVECTOR4 *PD3DXVector4;'} + PD3DXVector4 = ^TD3DXVector4; + {$NODEFINE PD3DXVector4} + TD3DXVector4 = packed record + x, y, z, w: Single; + end; + {$NODEFINE TD3DXVector4} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector4Zero: TD3DXVector4 = (x:0; y:0; z:0; w:0); // (0,0,0,0) +function D3DXVector4(_x, _y, _z, _w: Single): TD3DXVector4; +function D3DXVector4Equal(const v1, v2: TD3DXVector4): Boolean; + +//=========================================================================== +// +// Matrices +// +//=========================================================================== +type + {$HPPEMIT 'typedef D3DXMATRIX TD3DXMatrix;'} + {$HPPEMIT 'typedef D3DXMATRIX *PD3DXMatrix;'} + PD3DXMatrix = ^TD3DXMatrix; + {$NODEFINE PD3DXMatrix} + TD3DXMatrix = TD3DMatrix; + {$NODEFINE TD3DXMatrix} + +// Some pascal equalents of C++ class functions & operators +function D3DXMatrix( + _m00, _m01, _m02, _m03, + _m10, _m11, _m12, _m13, + _m20, _m21, _m22, _m23, + _m30, _m31, _m32, _m33: Single): TD3DXMatrix; +function D3DXMatrixAdd(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; +function D3DXMatrixSubtract(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; +function D3DXMatrixMul(out mOut: TD3DXMatrix; const m: TD3DXMatrix; MulBy: Single): PD3DXMatrix; +function D3DXMatrixEqual(const m1, m2: TD3DXMatrix): Boolean; + + +//=========================================================================== +// +// Aligned Matrices +// +// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. +// It aligns matrices on the stack and on the heap or in global scope. +// It does this using __declspec(align(16)) which works on VC7 and on VC 6 +// with the processor pack. Unfortunately there is no way to detect the +// latter so this is turned on only on VC7. On other compilers this is the +// the same as D3DXMATRIX. +// Using this class on a compiler that does not actually do the alignment +// can be dangerous since it will not expose bugs that ignore alignment. +// E.g if an object of this class in inside a struct or class, and some code +// memcopys data in it assuming tight packing. This could break on a compiler +// that eventually start aligning the matrix. +// +//=========================================================================== + +// Translator comments: None of current pascal compilers can even align data +// inside records to 16 byte boundary, so we just leave aligned matrix +// declaration equal to standart matrix +type + PD3DXMatrixA16 = ^TD3DXMatrixA16; + TD3DXMatrixA16 = TD3DXMatrix; + + +//=========================================================================== +// +// Quaternions +// +//=========================================================================== +type + PD3DXQuaternion = ^TD3DXQuaternion; + TD3DXQuaternion = packed record + x, y, z, w: Single; + end; + {$NODEFINE TD3DXQuaternion} + {$HPPEMIT 'typedef D3DXQUATERNION TD3DXQuaternion;'} + +// Some pascal equalents of C++ class functions & operators +function D3DXQuaternion(_x, _y, _z, _w: Single): TD3DXQuaternion; +function D3DXQuaternionAdd(const q1, q2: TD3DXQuaternion): TD3DXQuaternion; +function D3DXQuaternionSubtract(const q1, q2: TD3DXQuaternion): TD3DXQuaternion; +function D3DXQuaternionEqual(const q1, q2: TD3DXQuaternion): Boolean; +function D3DXQuaternionScale(out qOut: TD3DXQuaternion; const q: TD3DXQuaternion; + s: Single): PD3DXQuaternion; + + +//=========================================================================== +// +// Planes +// +//=========================================================================== +type + PD3DXPlane = ^TD3DXPlane; + TD3DXPlane = packed record + a, b, c, d: Single; + end; + {$NODEFINE TD3DXPlane} + {$HPPEMIT 'typedef D3DXPLANE TD3DXPlane;'} + +// Some pascal equalents of C++ class functions & operators +const D3DXPlaneZero: TD3DXPlane = (a:0; b:0; c:0; d:0); // (0,0,0,0) +function D3DXPlane(_a, _b, _c, _d: Single): TD3DXPlane; +function D3DXPlaneEqual(const p1, p2: TD3DXPlane): Boolean; + + +//=========================================================================== +// +// Colors +// +//=========================================================================== +type + {$HPPEMIT 'typedef D3DXCOLOR TD3DXColor;'} + {$HPPEMIT 'typedef D3DXCOLOR *PD3DXColor;'} + PD3DXColor = PD3DColorValue; + {$NODEFINE PD3DXColor} + TD3DXColor = TD3DColorValue; + {$NODEFINE TD3DXColor} + +function D3DXColor(_r, _g, _b, _a: Single): TD3DXColor; +function D3DXColorToDWord(c: TD3DXColor): DWord; +function D3DXColorFromDWord(c: DWord): TD3DXColor; +function D3DXColorEqual(const c1, c2: TD3DXColor): Boolean; + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// 2D Vector +//-------------------------- + +// inline + +function D3DXVec2Length(const v: TD3DXVector2): Single; +{$EXTERNALSYM D3DXVec2Length} + +function D3DXVec2LengthSq(const v: TD3DXVector2): Single; +{$EXTERNALSYM D3DXVec2LengthSq} + +function D3DXVec2Dot(const v1, v2: TD3DXVector2): Single; +{$EXTERNALSYM D3DXVec2Dot} + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +function D3DXVec2CCW(const v1, v2: TD3DXVector2): Single; +{$EXTERNALSYM D3DXVec2CCW} + +function D3DXVec2Add(const v1, v2: TD3DXVector2): TD3DXVector2; +{$EXTERNALSYM D3DXVec2Add} + +function D3DXVec2Subtract(const v1, v2: TD3DXVector2): TD3DXVector2; +{$EXTERNALSYM D3DXVec2Subtract} + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +function D3DXVec2Minimize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2; +{$EXTERNALSYM D3DXVec2Minimize} + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +function D3DXVec2Maximize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2; +{$EXTERNALSYM D3DXVec2Maximize} + +function D3DXVec2Scale(out vOut: TD3DXVector2; const v: TD3DXVector2; s: Single): PD3DXVector2; +{$EXTERNALSYM D3DXVec2Scale} + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec2Lerp(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2; s: Single): PD3DXVector2; +{$EXTERNALSYM D3DXVec2Lerp} + +// non-inline +function D3DXVec2Normalize(out vOut: TD3DXVector2; const v: TD3DXVector2): PD3DXVector2; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec2Normalize} + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +function D3DXVec2Hermite(out vOut: TD3DXVector2; + const v1, t1, v2, t2: TD3DXVector2; s: Single): PD3DXVector2; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec2Hermite} + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +function D3DXVec2CatmullRom(out vOut: TD3DXVector2; + const v0, v1, v2: TD3DXVector2; s: Single): PD3DXVector2; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec2CatmullRom} + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +function D3DXVec2BaryCentric(out vOut: TD3DXVector2; + const v1, v2, v3: TD3DXVector2; f, g: Single): PD3DXVector2; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec2BaryCentric} + +// Transform (x, y, 0, 1) by matrix. +function D3DXVec2Transform(out vOut: TD3DXVector4; + const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec2Transform} + +// Transform (x, y, 0, 1) by matrix, project result back into w=1. +function D3DXVec2TransformCoord(out vOut: TD3DXVector2; + const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector2; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec2TransformCoord} + +// Transform (x, y, 0, 0) by matrix. +function D3DXVec2TransformNormal(out vOut: TD3DXVector2; + const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector2; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec2TransformNormal} + + +//-------------------------- +// 3D Vector +//-------------------------- + +// inline + +function D3DXVec3Length(const v: TD3DXVector3): Single; +{$EXTERNALSYM D3DXVec3Length} + +function D3DXVec3LengthSq(const v: TD3DXVector3): Single; +{$EXTERNALSYM D3DXVec3LengthSq} + +function D3DXVec3Dot(const v1, v2: TD3DXVector3): Single; +{$EXTERNALSYM D3DXVec3Dot} + +function D3DXVec3Cross(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Cross} + +function D3DXVec3Add(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Add} + +function D3DXVec3Subtract(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Subtract} + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +function D3DXVec3Minimize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Minimize} + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +function D3DXVec3Maximize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Maximize} + +function D3DXVec3Scale(out vOut: TD3DXVector3; const v: TD3DXVector3; s: Single): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Scale} + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec3Lerp(out vOut: TD3DXVector3; + const v1, v2: TD3DXVector3; s: Single): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Lerp} + +// non-inline + +function D3DXVec3Normalize(out vOut: TD3DXVector3; + const v: TD3DXVector3): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3Normalize} + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +function D3DXVec3Hermite(out vOut: TD3DXVector3; + const v1, t1, v2, t2: TD3DXVector3; s: Single): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3Hermite} + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +function D3DXVec3CatmullRom(out vOut: TD3DXVector3; + const v1, v2, v3: TD3DXVector3; s: Single): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3CatmullRom} + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +function D3DXVec3BaryCentric(out vOut: TD3DXVector3; + const v1, v2, v3: TD3DXVector3; f, g: Single): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3BaryCentric} + +// Transform (x, y, z, 1) by matrix. +function D3DXVec3Transform(out vOut: TD3DXVector4; + const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3Transform} + +// Transform (x, y, z, 1) by matrix, project result back into w=1. +function D3DXVec3TransformCoord(out vOut: TD3DXVector3; + const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3TransformCoord} + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +function D3DXVec3TransformNormal(out vOut: TD3DXVector3; + const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3TransformNormal} + +// Project vector from object space into screen space +function D3DXVec3Project(out vOut: TD3DXVector3; + const v: TD3DXVector3; const pViewport: TD3DViewport8; + const pProjection, pView, pWorld: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3Project} + +// Project vector from screen space into object space +function D3DXVec3Unproject(out vOut: TD3DXVector3; + const v: TD3DXVector3; const pViewport: TD3DViewport8; + const pProjection, pView, pWorld: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec3Unproject} + + +//-------------------------- +// 4D Vector +//-------------------------- + +// inline + +function D3DXVec4Length(const v: TD3DXVector4): Single; +{$EXTERNALSYM D3DXVec4Length} + +function D3DXVec4LengthSq(const v: TD3DXVector4): Single; +{$EXTERNALSYM D3DXVec4LengthSq} + +function D3DXVec4Dot(const v1, v2: TD3DXVector4): Single; +{$EXTERNALSYM D3DXVec4Dot} + +function D3DXVec4Add(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Add} + +function D3DXVec4Subtract(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Subtract} + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +function D3DXVec4Minimize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Minimize} + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +function D3DXVec4Maximize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Maximize} + +function D3DXVec4Scale(out vOut: TD3DXVector4; const v: TD3DXVector4; s: Single): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Scale} + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec4Lerp(out vOut: TD3DXVector4; + const v1, v2: TD3DXVector4; s: Single): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Lerp} + +// non-inline + +// Cross-product in 4 dimensions. +function D3DXVec4Cross(out vOut: TD3DXVector4; + const v1, v2, v3: TD3DXVector4): PD3DXVector4; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec4Cross} + +function D3DXVec4Normalize(out vOut: TD3DXVector4; + const v: TD3DXVector4): PD3DXVector4; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec4Normalize} + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +function D3DXVec4Hermite(out vOut: TD3DXVector4; + const v1, t1, v2, t2: TD3DXVector4; s: Single): PD3DXVector4; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec4Hermite} + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +function D3DXVec4CatmullRom(out vOut: TD3DXVector4; + const v0, v1, v2, v3: TD3DXVector4; s: Single): PD3DXVector4; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec4CatmullRom} + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +function D3DXVec4BaryCentric(out vOut: TD3DXVector4; + const v1, v2, v3: TD3DXVector4; f, g: Single): PD3DXVector4; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec4BaryCentric} + +// Transform vector by matrix. +function D3DXVec4Transform(out vOut: TD3DXVector4; + const v: TD3DXVector4; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXVec4Transform} + + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline + +function D3DXMatrixIdentity(out mOut: TD3DXMatrix): PD3DXMatrix; +{$EXTERNALSYM D3DXMatrixIdentity} + +function D3DXMatrixIsIdentity(const m: TD3DXMatrix): BOOL; +{$EXTERNALSYM D3DXMatrixIsIdentity} + +// non-inline + +function D3DXMatrixfDeterminant(const m: TD3DXMatrix): Single; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixfDeterminant} + +function D3DXMatrixTranspose(out pOut: TD3DXMatrix; const pM: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixTranspose} + +// Matrix multiplication. The result represents the transformation M2 +// followed by the transformation M1. (Out = M1 * M2) +function D3DXMatrixMultiply(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixMultiply} + +// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +function D3DXMatrixMultiplyTranspose(out pOut: TD3DXMatrix; const pM1, pM2: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixMultiplyTranspose} + +// Calculate inverse of matrix. Inversion my fail, in which case NULL will +// be returned. The determinant of pM is also returned it pfDeterminant +// is non-NULL. +function D3DXMatrixInverse(out mOut: TD3DXMatrix; pfDeterminant: PSingle; + const m: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixInverse} + +// Build a matrix which scales by (sx, sy, sz) +function D3DXMatrixScaling(out mOut: TD3DXMatrix; sx, sy, sz: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixScaling} + +// Build a matrix which translates by (x, y, z) +function D3DXMatrixTranslation(out mOut: TD3DXMatrix; x, y, z: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixTranslation} + +// Build a matrix which rotates around the X axis +function D3DXMatrixRotationX(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixRotationX} + +// Build a matrix which rotates around the Y axis +function D3DXMatrixRotationY(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixRotationY} + +// Build a matrix which rotates around the Z axis +function D3DXMatrixRotationZ(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixRotationZ} + +// Build a matrix which rotates around an arbitrary axis +function D3DXMatrixRotationAxis(out mOut: TD3DXMatrix; const v: TD3DXVector3; + angle: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixRotationAxis} + +// Build a matrix from a quaternion +function D3DXMatrixRotationQuaternion(out mOut: TD3DXMatrix; const Q: TD3DXQuaternion): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixRotationQuaternion} + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +function D3DXMatrixRotationYawPitchRoll(out mOut: TD3DXMatrix; yaw, pitch, roll: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixRotationYawPitchRoll} + + +// Build transformation matrix. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +function D3DXMatrixTransformation(out mOut: TD3DXMatrix; + pScalingCenter: PD3DXVector3; + pScalingRotation: PD3DXQuaternion; pScaling, pRotationCenter: PD3DXVector3; + pRotation: PD3DXQuaternion; pTranslation: PD3DXVector3): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixTransformation} + +// Build affine transformation matrix. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +function D3DXMatrixAffineTransformation(out mOut: TD3DXMatrix; + Scaling: Single; pRotationCenter: PD3DXVector3; + pRotation: PD3DXQuaternion; pTranslation: PD3DXVector3): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixAffineTransformation} + +// Build a lookat matrix. (right-handed) +function D3DXMatrixLookAtRH(out mOut: TD3DXMatrix; const Eye, At, Up: TD3DXVector3): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixLookAtRH} + +// Build a lookat matrix. (left-handed) +function D3DXMatrixLookAtLH(out mOut: TD3DXMatrix; const Eye, At, Up: TD3DXVector3): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixLookAtLH} + +// Build a perspective projection matrix. (right-handed) +function D3DXMatrixPerspectiveRH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixPerspectiveRH} + +// Build a perspective projection matrix. (left-handed) +function D3DXMatrixPerspectiveLH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixPerspectiveLH} + +// Build a perspective projection matrix. (right-handed) +function D3DXMatrixPerspectiveFovRH(out mOut: TD3DXMatrix; flovy, aspect, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixPerspectiveFovRH} + +// Build a perspective projection matrix. (left-handed) +function D3DXMatrixPerspectiveFovLH(out mOut: TD3DXMatrix; flovy, aspect, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixPerspectiveFovLH} + +// Build a perspective projection matrix. (right-handed) +function D3DXMatrixPerspectiveOffCenterRH(out mOut: TD3DXMatrix; + l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixPerspectiveOffCenterRH} + +// Build a perspective projection matrix. (left-handed) +function D3DXMatrixPerspectiveOffCenterLH(out mOut: TD3DXMatrix; + l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixPerspectiveOffCenterLH} + +// Build an ortho projection matrix. (right-handed) +function D3DXMatrixOrthoRH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixOrthoRH} + +// Build an ortho projection matrix. (left-handed) +function D3DXMatrixOrthoLH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixOrthoLH} + +// Build an ortho projection matrix. (right-handed) +function D3DXMatrixOrthoOffCenterRH(out mOut: TD3DXMatrix; + l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixOrthoOffCenterRH} + +// Build an ortho projection matrix. (left-handed) +function D3DXMatrixOrthoOffCenterLH(out mOut: TD3DXMatrix; + l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixOrthoOffCenterLH} + +// Build a matrix which flattens geometry into a plane, as if casting +// a shadow from a light. +function D3DXMatrixShadow(out mOut: TD3DXMatrix; + const Light: TD3DXVector4; const Plane: TD3DXPlane): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixShadow} + +// Build a matrix which reflects the coordinate system about a plane +function D3DXMatrixReflect(out mOut: TD3DXMatrix; + const Plane: TD3DXPlane): PD3DXMatrix; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXMatrixReflect} + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +function D3DXQuaternionLength(const q: TD3DXQuaternion): Single; +{$EXTERNALSYM D3DXQuaternionLength} + +// Length squared, or "norm" +function D3DXQuaternionLengthSq(const q: TD3DXQuaternion): Single; +{$EXTERNALSYM D3DXQuaternionLengthSq} + +function D3DXQuaternionDot(const q1, q2: TD3DXQuaternion): Single; +{$EXTERNALSYM D3DXQuaternionDot} + +// (0, 0, 0, 1) +function D3DXQuaternionIdentity(out qOut: TD3DXQuaternion): PD3DXQuaternion; +{$EXTERNALSYM D3DXQuaternionIdentity} + +function D3DXQuaternionIsIdentity (const q: TD3DXQuaternion): BOOL; +{$EXTERNALSYM D3DXQuaternionIsIdentity} + +// (-x, -y, -z, w) +function D3DXQuaternionConjugate(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; +{$EXTERNALSYM D3DXQuaternionConjugate} + + +// non-inline + +// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +procedure D3DXQuaternionToAxisAngle(const q: TD3DXQuaternion; + out Axis: TD3DXVector3; out Angle: Single); stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionToAxisAngle} + +// Build a quaternion from a rotation matrix. +function D3DXQuaternionRotationMatrix(out qOut: TD3DXQuaternion; + const m: TD3DXMatrix): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionRotationMatrix} + +// Rotation about arbitrary axis. +function D3DXQuaternionRotationAxis(out qOut: TD3DXQuaternion; + const v: TD3DXVector3; Angle: Single): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionRotationAxis} + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +function D3DXQuaternionRotationYawPitchRoll(out qOut: TD3DXQuaternion; + yaw, pitch, roll: Single): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionRotationYawPitchRoll} + +// Quaternion multiplication. The result represents the rotation Q2 +// followed by the rotation Q1. (Out = Q2 * Q1) +function D3DXQuaternionMultiply(out qOut: TD3DXQuaternion; + const q1, q2: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionMultiply} + +function D3DXQuaternionNormalize(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionNormalize} + +// Conjugate and re-norm +function D3DXQuaternionInverse(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionInverse} + +// Expects unit quaternions. +// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +function D3DXQuaternionLn(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionLn} + +// Expects pure quaternions. (w == 0) w is ignored in calculation. +// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +function D3DXQuaternionExp(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionExp} + +// Spherical linear interpolation between Q1 (s == 0) and Q2 (s == 1). +// Expects unit quaternions. +function D3DXQuaternionSlerp(out qOut: TD3DXQuaternion; + const q1, q2: TD3DXQuaternion; t: Single): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionSlerp} + +// Spherical quadrangle interpolation. +// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +function D3DXQuaternionSquad(out qOut: TD3DXQuaternion; + const pQ1, pA, pB, pC: TD3DXQuaternion; t: Single): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionSquad} + +// Setup control points for spherical quadrangle interpolation +// from Q1 to Q2. The control points are chosen in such a way +// to ensure the continuity of tangents with adjacent segments. +procedure D3DXQuaternionSquadSetup(out pAOut, pBOut, pCOut: TD3DXQuaternion; + const pQ0, pQ1, pQ2, pQ3: TD3DXQuaternion); stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionSquadSetup} + +// Barycentric interpolation. +// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +function D3DXQuaternionBaryCentric(out qOut: TD3DXQuaternion; + const q1, q2, q3: TD3DXQuaternion; f, g: Single): PD3DXQuaternion; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXQuaternionBaryCentric} + + +//-------------------------- +// Plane +//-------------------------- + +// inline + +// ax + by + cz + dw +function D3DXPlaneDot(const p: TD3DXPlane; const v: TD3DXVector4): Single; +{$EXTERNALSYM D3DXPlaneDot} + +// ax + by + cz + d +function D3DXPlaneDotCoord(const p: TD3DXPlane; const v: TD3DXVector3): Single; +{$EXTERNALSYM D3DXPlaneDotCoord} + +// ax + by + cz +function D3DXPlaneDotNormal(const p: TD3DXPlane; const v: TD3DXVector3): Single; +{$EXTERNALSYM D3DXPlaneDotNormal} + + +// non-inline + +// Normalize plane (so that |a,b,c| == 1) +function D3DXPlaneNormalize(out pOut: TD3DXPlane; const p: TD3DXPlane): PD3DXPlane; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXPlaneNormalize} + +// Find the intersection between a plane and a line. If the line is +// parallel to the plane, NULL is returned. +function D3DXPlaneIntersectLine(out vOut: TD3DXVector3; + const p: TD3DXPlane; const v1, v2: TD3DXVector3): PD3DXVector3; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXPlaneIntersectLine} + +// Construct a plane from a point and a normal +function D3DXPlaneFromPointNormal(out pOut: TD3DXPlane; + const vPoint, vNormal: TD3DXVector3): PD3DXPlane; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXPlaneFromPointNormal} + +// Construct a plane from 3 points +function D3DXPlaneFromPoints(out pOut: TD3DXPlane; + const v1, v2, v3: TD3DXVector3): PD3DXPlane; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXPlaneFromPoints} + +// Transform a plane by a matrix. The vector (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +function D3DXPlaneTransform(out pOut: TD3DXPlane; const m: TD3DXMatrix): PD3DXPlane; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXPlaneTransform} + + +//-------------------------- +// Color +//-------------------------- + +// inline + +// (1-r, 1-g, 1-b, a) +function D3DXColorNegative(out cOut: TD3DXColor; const c: TD3DXColor): PD3DXColor; +{$EXTERNALSYM D3DXColorNegative} + +function D3DXColorAdd(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor; +{$EXTERNALSYM D3DXColorAdd} + +function D3DXColorSubtract(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor; +{$EXTERNALSYM D3DXColorSubtract} + +function D3DXColorScale(out cOut: TD3DXColor; const c: TD3DXColor; s: Single): PD3DXColor; +{$EXTERNALSYM D3DXColorScale} + +// (r1*r2, g1*g2, b1*b2, a1*a2) +function D3DXColorModulate(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor; +{$EXTERNALSYM D3DXColorModulate} + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +function D3DXColorLerp(out cOut: TD3DXColor; const c1, c2: TD3DXColor; s: Single): PD3DXColor; +{$EXTERNALSYM D3DXColorLerp} + +// non-inline + +// Interpolate r,g,b between desaturated color and color. +// DesaturatedColor + s(Color - DesaturatedColor) +function D3DXColorAdjustSaturation(out cOut: TD3DXColor; + const pC: TD3DXColor; s: Single): PD3DXColor; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXColorAdjustSaturation} + +// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +function D3DXColorAdjustContrast(out cOut: TD3DXColor; + const pC: TD3DXColor; c: Single): PD3DXColor; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXColorAdjustContrast} + + +//-------------------------- +// Misc +//-------------------------- + +// Calculate Fresnel term given the cosine of theta (likely obtained by +// taking the dot of two normals), and the refraction index of the material. +function D3DXFresnelTerm(CosTheta, RefractionIndex: Single): Single; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXFresnelTerm} + + + +//=========================================================================== +// +// Matrix Stack +// +//=========================================================================== + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXMatrixStack);'} + {$EXTERNALSYM ID3DXMatrixStack} + ID3DXMatrixStack = interface(IUnknown) + ['{E3357330-CC5E-11d2-A434-00A0C90629A8}'] + // + // ID3DXMatrixStack methods + // + + // Pops the top of the stack, returns the current top + // *after* popping the top. + function Pop: HResult; stdcall; + + // Pushes the stack by one, duplicating the current matrix. + function Push: HResult; stdcall; + + // Loads identity in the current matrix. + function LoadIdentity: HResult; stdcall; + + // Loads the given matrix into the current matrix + function LoadMatrix(const M: TD3DXMatrix): HResult; stdcall; + + // Right-Multiplies the given matrix to the current matrix. + // (transformation is about the current world origin) + function MultMatrix(const M: TD3DXMatrix): HResult; stdcall; + + // Left-Multiplies the given matrix to the current matrix + // (transformation is about the local origin of the object) + function MultMatrixLocal(const M: TD3DXMatrix): HResult; stdcall; + + // Right multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the current world origin) + function RotateAxis(const V: TD3DXVector3; Angle: Single): HResult; stdcall; + + // Left multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the local origin of the object) + function RotateAxisLocal(const V: TD3DXVector3; Angle: Single): HResult; stdcall; + + // Right multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // current world origin) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + function RotateYawPitchRoll(yaw, pitch, roll: Single): HResult; stdcall; + + // Left multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // local origin of the object) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + function RotateYawPitchRollLocal(yaw, pitch, roll: Single): HResult; stdcall; + + // Right multiply the current matrix with the computed scale + // matrix. (transformation is about the current world origin) + function Scale(x, y, z: Single): HResult; stdcall; + + // Left multiply the current matrix with the computed scale + // matrix. (transformation is about the local origin of the object) + function ScaleLocal(x, y, z: Single): HResult; stdcall; + + // Right multiply the current matrix with the computed translation + // matrix. (transformation is about the current world origin) + function Translate(x, y, z: Single): HResult; stdcall; + + // Left multiply the current matrix with the computed translation + // matrix. (transformation is about the local origin of the object) + function TranslateLocal(x, y, z: Single): HResult; stdcall; + + // Obtain the current matrix at the top of the stack + function GetTop: PD3DXMatrix; stdcall; + end; + +type + IID_ID3DXMatrixStack = ID3DXMatrixStack; + {$EXTERNALSYM IID_ID3DXMatrixStack} + +function D3DXCreateMatrixStack(Flags: DWord; out Stack: ID3DXMatrixStack): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateMatrixStack} + + + + + + + +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8core.h +// Content: D3DX core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +type +/////////////////////////////////////////////////////////////////////////// +// ID3DXBuffer: +// ------------ +// The buffer object is used by D3DX to return arbitrary size data. +// +// GetBufferPointer - +// Returns a pointer to the beginning of the buffer. +// +// GetBufferSize - +// Returns the size of the buffer, in bytes. +/////////////////////////////////////////////////////////////////////////// + + PID3DXBuffer = ^ID3DXBuffer; + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBuffer);'} + {$EXTERNALSYM ID3DXBuffer} + ID3DXBuffer = interface(IUnknown) + ['{932E6A7E-C68E-45dd-A7BF-53D19C86DB1F}'] + // ID3DXBuffer + function GetBufferPointer: Pointer; stdcall; + function GetBufferSize: DWord; stdcall; + end; + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXFont: +// ---------- +// Font objects contain the textures and resources needed to render +// a specific font on a specific device. +// +// Begin - +// Prepartes device for drawing text. This is optional.. if DrawText +// is called outside of Begin/End, it will call Begin and End for you. +// +// DrawText - +// Draws formatted text on a D3D device. Some parameters are +// surprisingly similar to those of GDI's DrawText function. See GDI +// documentation for a detailed description of these parameters. +// +// End - +// Restores device state to how it was when Begin was called. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +// +/////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXFont);'} + {$EXTERNALSYM ID3DXFont} + ID3DXFont = interface(IUnknown) + ['{89FAD6A5-024D-49af-8FE7-F51123B85E25}'] + // ID3DXFont + function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall; + function GetLogFont(out pLogFont: TLogFont): HResult; stdcall; + + function _Begin: HResult; stdcall; + function DrawTextA(pString: PAnsiChar; Count: Integer; const pRect: TRect; Format: DWord; Color: TD3DColor): Integer; stdcall; + function DrawTextW(pString: PWideChar; Count: Integer; const pRect: TRect; Format: DWord; Color: TD3DColor): Integer; stdcall; + function _End: HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateFont(pDevice: IDirect3DDevice8; hFont: HFONT; + out ppFont: ID3DXFont): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateFont} + +function D3DXCreateFontIndirect(pDevice: IDirect3DDevice8; + const pLogFont: TLogFont; out ppFont: ID3DXFont): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateFontIndirect} + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXSprite: +// ------------ +// This object intends to provide an easy way to drawing sprites using D3D. +// +// Begin - +// Prepares device for drawing sprites +// +// Draw, DrawAffine, DrawTransform - +// Draws a sprite in screen-space. Before transformation, the sprite is +// the size of SrcRect, with its top-left corner at the origin (0,0). +// The color and alpha channels are modulated by Color. +// +// End - +// Restores device state to how it was when Begin was called. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// +type + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSprite);'} + {$EXTERNALSYM ID3DXSprite} + ID3DXSprite = interface(IUnknown) + ['{13D69D15-F9B0-4e0f-B39E-C91EB33F6CE7}'] + // ID3DXSprite + function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall; + + function _Begin: HResult; stdcall; + + function Draw(pSrcTexture: IDirect3DTexture8; pSrcRect: PRect; + pScaling, pRotationCenter: PD3DXVector2; Rotation: Single; + pTranslation: PD3DXVector2; Color: TD3DColor): HResult; stdcall; + + function DrawTransform(pSrcTexture: IDirect3DTexture8; pSrcRect: PRect; + const pTransform: TD3DXMatrix; Color: TD3DColor): HResult; stdcall; + + function _End: HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateSprite(ppDevice: IDirect3DDevice8; + out ppSprite: ID3DXSprite): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateSprite} + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToSurface: +// --------------------- +// This object abstracts rendering to surfaces. These surfaces do not +// necessarily need to be render targets. If they are not, a compatible +// render target is used, and the result copied into surface at end scene. +// +// BeginScene, EndScene - +// Call BeginScene() and EndScene() at the beginning and ending of your +// scene. These calls will setup and restore render targets, viewports, +// etc.. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// +type + + PD3DXRTSDesc = ^TD3DXRTSDesc; + _D3DXRTS_DESC = packed record + Width: LongWord; + Height: LongWord; + Format: TD3DFormat; + DepthStencil: BOOL; + DepthStencilFormat: TD3DFormat; + end {_D3DXRTS_DESC}; + {$EXTERNALSYM _D3DXRTS_DESC} + D3DXRTS_DESC = _D3DXRTS_DESC; + {$EXTERNALSYM D3DXRTS_DESC} + TD3DXRTSDesc = _D3DXRTS_DESC; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXRenderToSurface);'} + {$EXTERNALSYM ID3DXRenderToSurface} + ID3DXRenderToSurface = interface(IUnknown) + ['{82DF5B90-E34E-496e-AC1C-62117A6A5913}'] + // ID3DXRenderToSurface + function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall; + function GetDesc(out pDesc: TD3DXRTSDesc): HResult; stdcall; + + function BeginScene(pSurface: IDirect3DSurface8; pViewport: PD3DViewport8): HResult; stdcall; + function EndScene: HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateRenderToSurface(ppDevice: IDirect3DDevice8; + Width: LongWord; + Height: LongWord; + Format: TD3DFormat; + DepthStencil: BOOL; + DepthStencilFormat: TD3DFormat; + out ppRenderToSurface: ID3DXRenderToSurface): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateRenderToSurface} + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToEnvMap: +// -------------------- +// This object abstracts rendering to environment maps. These surfaces +// do not necessarily need to be render targets. If they are not, a +// compatible render target is used, and the result copied into the +// environment map at end scene. +// +// BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - +// This function initiates the rendering of the environment map. As +// parameters, you pass the textures in which will get filled in with +// the resulting environment map. +// +// Face - +// Call this function to initiate the drawing of each face. For each +// environment map, you will call this six times.. once for each face +// in D3DCUBEMAP_FACES. +// +// End - +// This will restore all render targets, and if needed compose all the +// rendered faces into the environment map surfaces. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// +type + + PD3DXRTEDesc = ^TD3DXRTEDesc; + _D3DXRTE_DESC = record + Size: LongWord; + Format: TD3DFormat; + DepthStencil: Bool; + DepthStencilFormat: TD3DFormat; + end {_D3DXRTE_DESC}; + {$EXTERNALSYM _D3DXRTE_DESC} + D3DXRTE_DESC = _D3DXRTE_DESC; + {$EXTERNALSYM D3DXRTE_DESC} + TD3DXRTEDesc = _D3DXRTE_DESC; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXRenderToEnvMap);'} + {$EXTERNALSYM ID3DXRenderToEnvMap} + ID3DXRenderToEnvMap = interface(IUnknown) + ['{4E42C623-9451-44b7-8C86-ABCCDE5D52C8}'] + // ID3DXRenderToEnvMap + function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall; + function GetDesc(out pDesc: TD3DXRTEDesc): HResult; stdcall; + + function BeginCube(pCubeTex: IDirect3DCubeTexture8): HResult; stdcall; + + function BeginSphere(pTex: IDirect3DTexture8): HResult; stdcall; + + function BeginHemisphere(pTexZPos, pTexZNeg: IDirect3DTexture8): HResult; stdcall; + + function BeginParabolic(pTexZPos, pTexZNeg: IDirect3DTexture8): HResult; stdcall; + + function Face(Face: TD3DCubemapFaces): HResult; stdcall; + function _End: HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateRenderToEnvMap(ppDevice: IDirect3DDevice8; + Size: LongWord; + Format: TD3DFormat; + DepthStencil: BOOL; + DepthStencilFormat: TD3DFormat; + out ppRenderToEnvMap: ID3DXRenderToEnvMap): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateRenderToEnvMap} + + + +/////////////////////////////////////////////////////////////////////////// +// Shader assemblers: +/////////////////////////////////////////////////////////////////////////// + +//------------------------------------------------------------------------- +// D3DXASM flags: +// -------------- +// +// D3DXASM_DEBUG +// Generate debug info. +// +// D3DXASM_SKIPVALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when assembling shaders +// you KNOW will work. (ie. have assembled before without this option.) +//------------------------------------------------------------------------- +const + D3DXASM_DEBUG = (1 shl 0); + {$EXTERNALSYM D3DXASM_DEBUG} + D3DXASM_SKIPVALIDATION = (1 shl 1); + {$EXTERNALSYM D3DXASM_SKIPVALIDATION} + + +//------------------------------------------------------------------------- +// D3DXAssembleShader: +// ------------------- +// Assembles an ascii description of a vertex or pixel shader into +// binary form. +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// Flags +// D3DXASM_xxx flags +// ppConstants +// Returns an ID3DXBuffer object containing constant declarations. +// ppCompiledShader +// Returns an ID3DXBuffer object containing the object code. +// ppCompilationErrors +// Returns an ID3DXBuffer object containing ascii error messages +//------------------------------------------------------------------------- + +function D3DXAssembleShaderFromFileA( + pSrcFile: PAnsiChar; + Flags: DWord; + ppConstants: PID3DXBuffer; + ppCompiledShader: PID3DXBuffer; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXAssembleShaderFromFileA'; +{$EXTERNALSYM D3DXAssembleShaderFromFileA} + +function D3DXAssembleShaderFromFileW( + pSrcFile: PWideChar; + Flags: DWord; + ppConstants: PID3DXBuffer; + ppCompiledShader: PID3DXBuffer; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXAssembleShaderFromFileW'; +{$EXTERNALSYM D3DXAssembleShaderFromFileW} + +function D3DXAssembleShaderFromFile( + pSrcFile: PChar; + Flags: DWord; + ppConstants: PID3DXBuffer; + ppCompiledShader: PID3DXBuffer; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXAssembleShaderFromFileA'; +{$EXTERNALSYM D3DXAssembleShaderFromFile} + + +function D3DXAssembleShaderFromResourceA( + hSrcModule: HModule; + pSrcResource: PAnsiChar; + Flags: DWord; + ppConstants: PID3DXBuffer; + ppCompiledShader: PID3DXBuffer; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXAssembleShaderFromResourceA'; +{$EXTERNALSYM D3DXAssembleShaderFromResourceA} + +function D3DXAssembleShaderFromResourceW( + hSrcModule: HModule; + pSrcResource: PWideChar; + Flags: DWord; + ppConstants: PID3DXBuffer; + ppCompiledShader: PID3DXBuffer; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXAssembleShaderFromResourceW'; +{$EXTERNALSYM D3DXAssembleShaderFromResourceW} + +function D3DXAssembleShaderFromResource( + hSrcModule: HModule; + pSrcResource: PChar; + Flags: DWord; + ppConstants: PID3DXBuffer; + ppCompiledShader: PID3DXBuffer; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXAssembleShaderFromResourceA'; +{$EXTERNALSYM D3DXAssembleShaderFromResource} + + +function D3DXAssembleShader( + const pSrcData; + SrcDataLen: LongWord; + Flags: DWord; + ppConstants: PID3DXBuffer; + ppCompiledShader: PID3DXBuffer; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXAssembleShader} + + +/////////////////////////////////////////////////////////////////////////// +// Misc APIs: +/////////////////////////////////////////////////////////////////////////// + + +//------------------------------------------------------------------------- +// D3DXGetErrorString: +// ------------------ +// Returns the error string for given an hresult. Interprets all D3DX and +// D3D hresults. +// +// Parameters: +// hr +// The error code to be deciphered. +// pBuffer +// Pointer to the buffer to be filled in. +// BufferLen +// Count of characters in buffer. Any error message longer than this +// length will be truncated to fit. +//------------------------------------------------------------------------- +function D3DXGetErrorStringA(hr: HResult; pBuffer: PAnsiChar; BufferLen: LongWord): HResult; stdcall; external d3dx8dll name 'D3DXGetErrorStringA'; overload; +{$EXTERNALSYM D3DXGetErrorStringA} +function D3DXGetErrorStringW(hr: HResult; pBuffer: PWideChar; BufferLen: LongWord): HResult; stdcall; external d3dx8dll name 'D3DXGetErrorStringW'; overload; +{$EXTERNALSYM D3DXGetErrorStringW} +function D3DXGetErrorString(hr: HResult; pBuffer: PChar; BufferLen: LongWord): HResult; stdcall; external d3dx8dll name 'D3DXGetErrorStringA'; overload; +{$EXTERNALSYM D3DXGetErrorString} + +// Object Pascal support functions for D3DXGetErrorString +function D3DXGetErrorStringA(hr: HResult): String; overload; +function D3DXGetErrorStringW(hr: HResult): WideString; overload; +{$IFNDEF UNICODE} +function D3DXGetErrorString(hr: HResult): String; overload; +{$ELSE} +function D3DXGetErrorString(hr: HResult): WideString; overload; +{$ENDIF} + + + +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8effect.h +// Content: D3DX effect types and functions +// +/////////////////////////////////////////////////////////////////////////// + +const + D3DXFX_DONOTSAVESTATE = (1 shl 0); + {$EXTERNALSYM D3DXFX_DONOTSAVESTATE} + +type + _D3DXPARAMETERTYPE = ( + D3DXPT_DWORD {= 0}, + D3DXPT_FLOAT {= 1}, + D3DXPT_VECTOR {= 2}, + D3DXPT_MATRIX {= 3}, + D3DXPT_TEXTURE {= 4}, + D3DXPT_VERTEXSHADER {= 5}, + D3DXPT_PIXELSHADER {= 6}, + D3DXPT_CONSTANT {= 7}, + D3DXPT_STRING {= 8} + ); {_D3DXPARAMETERTYPE} + {$EXTERNALSYM _D3DXPARAMETERTYPE} + D3DXPARAMETERTYPE = _D3DXPARAMETERTYPE; + {$EXTERNALSYM D3DXPARAMETERTYPE} + TD3DXParameterType = _D3DXPARAMETERTYPE; + +type + PD3DXEffectDesc = ^TD3DXEffectDesc; + _D3DXEFFECT_DESC = packed record + Parameters: LongWord; + Techniques: LongWord; + end; + {$EXTERNALSYM _D3DXEFFECT_DESC} + D3DXEFFECT_DESC = _D3DXEFFECT_DESC; + {$EXTERNALSYM D3DXEFFECT_DESC} + TD3DXEffectDesc = _D3DXEFFECT_DESC; + + + PD3DXParameterDesc = ^TD3DXParameterDesc; + _D3DXPARAMETER_DESC = packed record + Name: PAnsiChar; + Index: PAnsiChar; + _Type: TD3DXParameterType; + end; + {$EXTERNALSYM _D3DXPARAMETER_DESC} + D3DXPARAMETER_DESC = _D3DXPARAMETER_DESC; + {$EXTERNALSYM D3DXPARAMETER_DESC} + TD3DXParameterDesc = _D3DXPARAMETER_DESC; + + + PD3DXTechniqueDesc = ^TD3DXTechniqueDesc; + _D3DXTECHNIQUE_DESC = packed record + Name: PAnsiChar; + Index: PAnsiChar; + Passes: LongWord; + end; + {$EXTERNALSYM _D3DXTECHNIQUE_DESC} + D3DXTECHNIQUE_DESC = _D3DXTECHNIQUE_DESC; + {$EXTERNALSYM D3DXTECHNIQUE_DESC} + TD3DXTechniqueDesc = _D3DXTECHNIQUE_DESC; + + + PD3DXPassDesc = ^TD3DXPassDesc; + _D3DXPASS_DESC = packed record + Name: PAnsiChar; + Index: PAnsiChar; + end; + {$EXTERNALSYM _D3DXPASS_DESC} + D3DXPASS_DESC = _D3DXPASS_DESC; + {$EXTERNALSYM D3DXPASS_DESC} + TD3DXPassDesc = _D3DXPASS_DESC; + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffect /////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXEffect);'} + {$EXTERNALSYM ID3DXEffect} + ID3DXEffect = interface(IUnknown) + ['{648B1CEB-8D4E-4d66-B6FA-E44969E82E89}'] + // ID3DXEffect + function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall; + function GetDesc(out pDesc: TD3DXEffectDesc): HResult; stdcall; + function GetParameterDesc(pParameter: PAnsiChar; out pDesc: TD3DXParameterDesc): HResult; stdcall; + function GetTechniqueDesc(pTechnique: PAnsiChar; out pDesc: TD3DXTechniqueDesc): HResult; stdcall; + function GetPassDesc(pTechnique, pPass: PAnsiChar; out pDesc: TD3DXPassDesc): HResult; stdcall; + function FindNextValidTechnique(pTechnique: PAnsiChar; out pDesc: TD3DXTechniqueDesc): HResult; stdcall; + function CloneEffect(pDevice: IDirect3DDevice8; out ppEffect: ID3DXEffect): HResult; stdcall; + function GetCompiledEffect(out ppCompiledEffect: ID3DXBuffer): HResult; stdcall; + + function SetTechnique(pTechnique: PAnsiChar): HResult; stdcall; + function GetTechnique(out ppTechnique: PAnsiChar): HResult; stdcall; + + function SetDword(pParameter: PAnsiChar; dw: DWord): HResult; stdcall; + function GetDword(pParameter: PAnsiChar; out pdw: DWord): HResult; stdcall; + function SetFloat(pParameter: PAnsiChar; f: Single): HResult; stdcall; + function GetFloat(pParameter: PAnsiChar; out pf: Single): HResult; stdcall; + function SetVector(pParameter: PAnsiChar; const pVector: TD3DXVector4): HResult; stdcall; + function GetVector(pParameter: PAnsiChar; out pVector: TD3DXVector4): HResult; stdcall; + function SetMatrix(pParameter: PAnsiChar; const pMatrix: TD3DXMatrix): HResult; stdcall; + function GetMatrix(pParameter: PAnsiChar; out pMatrix: TD3DXMatrix): HResult; stdcall; + function SetTexture(pParameter: PAnsiChar; pTexture: IDirect3DBaseTexture8): HResult; stdcall; + function GetTexture(pParameter: PAnsiChar; out ppTexture: IDirect3DBaseTexture8): HResult; stdcall; + function SetVertexShader(pParameter: PAnsiChar; Handle: DWord): HResult; stdcall; + function GetVertexShader(pParameter: PAnsiChar; out Handle: DWord): HResult; stdcall; + function SetPixelShader(pParameter: PAnsiChar; Handle: DWord): HResult; stdcall; + function GetPixelShader(pParameter: PAnsiChar; out Handle: DWord): HResult; stdcall; + function SetString(pParameter: PAnsiChar; pString: PAnsiChar): HResult; stdcall; + function GetString(pParameter: PAnsiChar; out ppString: PAnsiChar): HResult; stdcall; + function IsParameterUsed(pParameter: PAnsiChar): BOOL; stdcall; + + function Validate: HResult; stdcall; + function _Begin(out pPasses: LongWord; Flags: DWord): HResult; stdcall; + function Pass(Pass: LongWord): HResult; stdcall; + function _End: HResult; stdcall; + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + + +//---------------------------------------------------------------------------- +// D3DXCreateEffect: +// ----------------- +// Creates an effect from an ascii or binaray effect description. +// +// Parameters: +// pDevice +// Pointer of the device on which to create the effect +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// ppEffect +// Returns a buffer containing created effect. +// ppCompilationErrors +// Returns a buffer containing any error messages which occurred during +// compile. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + + +function D3DXCreateEffectFromFileA( + pDevice: IDirect3DDevice8; + pSrcFile: PAnsiChar; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXCreateEffectFromFileA'; +{$EXTERNALSYM D3DXCreateEffectFromFileA} + +function D3DXCreateEffectFromFileW( + pDevice: IDirect3DDevice8; + pSrcFile: PWideChar; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXCreateEffectFromFileW'; +{$EXTERNALSYM D3DXCreateEffectFromFileW} + +function D3DXCreateEffectFromFile( + pDevice: IDirect3DDevice8; + pSrcFile: PChar; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXCreateEffectFromFileA'; +{$EXTERNALSYM D3DXCreateEffectFromFile} + +function D3DXCreateEffectFromResourceA( + pDevice: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXCreateEffectFromResourceA'; +{$EXTERNALSYM D3DXCreateEffectFromResourceA} + +function D3DXCreateEffectFromResourceW( + pDevice: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PWideChar; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXCreateEffectFromResourceW'; +{$EXTERNALSYM D3DXCreateEffectFromResourceW} + +function D3DXCreateEffectFromResource( + pDevice: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PChar; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll name 'D3DXCreateEffectFromResourceA'; +{$EXTERNALSYM D3DXCreateEffectFromResource} + + +function D3DXCreateEffect( + pDevice: IDirect3DDevice8; + const pSrcData; + SrcDataSize: LongWord; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateEffect} + + + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8mesh.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +type + _D3DXMESH = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DXMESH} + TD3DXMesh = _D3DXMESH; + +// Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags +const + D3DXMESH_32BIT = $001; // If set, then use 32 bit indices, if not set use 16 bit indices. + {$EXTERNALSYM D3DXMESH_32BIT} + D3DXMESH_DONOTCLIP = $002; // Use D3DUSAGE_DONOTCLIP for VB & IB. + {$EXTERNALSYM D3DXMESH_DONOTCLIP} + D3DXMESH_POINTS = $004; // Use D3DUSAGE_POINTS for VB & IB. + {$EXTERNALSYM D3DXMESH_POINTS} + D3DXMESH_RTPATCHES = $008; // Use D3DUSAGE_RTPATCHES for VB & IB. + {$EXTERNALSYM D3DXMESH_RTPATCHES} + D3DXMESH_NPATCHES = $4000;// Use D3DUSAGE_NPATCHES for VB & IB. + {$EXTERNALSYM D3DXMESH_NPATCHES} + D3DXMESH_VB_SYSTEMMEM = $010; // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER + {$EXTERNALSYM D3DXMESH_VB_SYSTEMMEM} + D3DXMESH_VB_MANAGED = $020; // Use D3DPOOL_MANAGED for VB. + {$EXTERNALSYM D3DXMESH_VB_MANAGED} + D3DXMESH_VB_WRITEONLY = $040; // Use D3DUSAGE_WRITEONLY for VB. + {$EXTERNALSYM D3DXMESH_VB_WRITEONLY} + D3DXMESH_VB_DYNAMIC = $080; // Use D3DUSAGE_DYNAMIC for VB. + {$EXTERNALSYM D3DXMESH_VB_DYNAMIC} + D3DXMESH_VB_SOFTWAREPROCESSING = $8000; // Use D3DUSAGE_SOFTWAREPROCESSING for VB. + {$EXTERNALSYM D3DXMESH_VB_SOFTWAREPROCESSING} + D3DXMESH_IB_SYSTEMMEM = $100; // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER + {$EXTERNALSYM D3DXMESH_IB_SYSTEMMEM} + D3DXMESH_IB_MANAGED = $200; // Use D3DPOOL_MANAGED for IB. + {$EXTERNALSYM D3DXMESH_IB_MANAGED} + D3DXMESH_IB_WRITEONLY = $400; // Use D3DUSAGE_WRITEONLY for IB. + {$EXTERNALSYM D3DXMESH_IB_WRITEONLY} + D3DXMESH_IB_DYNAMIC = $800; // Use D3DUSAGE_DYNAMIC for IB. + {$EXTERNALSYM D3DXMESH_IB_DYNAMIC} + D3DXMESH_IB_SOFTWAREPROCESSING= $10000; // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + {$EXTERNALSYM D3DXMESH_IB_SOFTWAREPROCESSING} + + D3DXMESH_VB_SHARE = $1000; // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + {$EXTERNALSYM D3DXMESH_VB_SHARE} + + D3DXMESH_USEHWONLY = $2000; // Valid for ID3DXSkinMesh::ConvertToBlendedMesh + {$EXTERNALSYM D3DXMESH_USEHWONLY} + + // Helper options + D3DXMESH_SYSTEMMEM = $110; // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM + {$EXTERNALSYM D3DXMESH_SYSTEMMEM} + D3DXMESH_MANAGED = $220; // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED + {$EXTERNALSYM D3DXMESH_MANAGED} + D3DXMESH_WRITEONLY = $440; // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY + {$EXTERNALSYM D3DXMESH_WRITEONLY} + D3DXMESH_DYNAMIC = $880; // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC + {$EXTERNALSYM D3DXMESH_DYNAMIC} + D3DXMESH_SOFTWAREPROCESSING = $18000; // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + {$EXTERNALSYM D3DXMESH_SOFTWAREPROCESSING} + +type + // option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh + _D3DXMESHSIMP = ( + {$IFNDEF COMPILER6_UP} + D3DXMESHSIMP_INVALID_0{= 0x0}, + D3DXMESHSIMP_VERTEX {= 0x1}, + D3DXMESHSIMP_FACE {= 0x2} + {$ELSE} + D3DXMESHSIMP_VERTEX = $1, + D3DXMESHSIMP_FACE = $2 + {$ENDIF} + ); + {$EXTERNALSYM _D3DXMESHSIMP} + TD3DMeshSimp = _D3DXMESHSIMP; + + _MAX_FVF_DECL_SIZE = DWord; + {$EXTERNALSYM _MAX_FVF_DECL_SIZE} +const + MAX_FVF_DECL_SIZE = 20; + {$EXTERNALSYM MAX_FVF_DECL_SIZE} + +type + TFVFDeclaration = array [0..MAX_FVF_DECL_SIZE-1] of DWord; + + PD3DXAttributeRange = ^TD3DXAttributeRange; + _D3DXATTRIBUTERANGE = packed record + AttribId: DWord; + FaceStart: DWord; + FaceCount: DWord; + VertexStart: DWord; + VertexCount: DWord; + end; + {$EXTERNALSYM _D3DXATTRIBUTERANGE} + D3DXATTRIBUTERANGE = _D3DXATTRIBUTERANGE; + {$EXTERNALSYM D3DXATTRIBUTERANGE} + TD3DXAttributeRange = _D3DXATTRIBUTERANGE; + + PD3DXMaterial = ^TD3DXMaterial; + D3DXMATERIAL = packed record + MatD3D: TD3Dmaterial8; + pTextureFilename: PAnsiChar; + end; + {$EXTERNALSYM D3DXMATERIAL} + TD3DXMaterial = D3DXMATERIAL; + + PD3DXAttributeWeights = ^TD3DXAttributeWeights; + _D3DXATTRIBUTEWEIGHTS = packed record + Position: Single; + Boundary: Single; + Normal: Single; + Diffuse: Single; + Specular: Single; + Tex: array[0..7] of Single; + end; + {$EXTERNALSYM _D3DXATTRIBUTEWEIGHTS} + D3DXATTRIBUTEWEIGHTS = _D3DXATTRIBUTEWEIGHTS; + {$EXTERNALSYM D3DXATTRIBUTEWEIGHTS} + TD3DXAttributeWeights = _D3DXATTRIBUTEWEIGHTS; + + _D3DXWELDEPSILONSFLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DXWELDEPSILONSFLAGS} + TD3DXWeldEpsilonsFlags = _D3DXWELDEPSILONSFLAGS; + +const + D3DXWELDEPSILONS_WELDALL = $1; // weld all vertices marked by adjacency as being overlapping + {$EXTERNALSYM D3DXWELDEPSILONS_WELDALL} + + D3DXWELDEPSILONS_WELDPARTIALMATCHES = $2; // if a given vertex component is within epsilon, modify partial matched + // vertices so that both components identical AND if all components "equal" + // remove one of the vertices + {$EXTERNALSYM D3DXWELDEPSILONS_WELDPARTIALMATCHES} + D3DXWELDEPSILONS_DONOTREMOVEVERTICES = $4; // instructs weld to only allow modifications to vertices and not removal + // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set + // useful to modify vertices to be equal, but not allow vertices to be removed + {$EXTERNALSYM D3DXWELDEPSILONS_DONOTREMOVEVERTICES} + +type + PD3DXWeldEpsilons = ^TD3DXWeldEpsilons; + _D3DXWELDEPSILONS = packed record + SkinWeights: Single; + Normal: Single; + Tex: array[0..7] of Single; + Flags: DWord; + end; + {$EXTERNALSYM _D3DXWELDEPSILONS} + D3DXWELDEPSILONS = _D3DXWELDEPSILONS; + {$EXTERNALSYM D3DXWELDEPSILONS} + TD3DXWeldEpsilons = _D3DXWELDEPSILONS; + + ID3DXMesh = interface; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBaseMesh);'} + {$EXTERNALSYM ID3DXBaseMesh} + ID3DXBaseMesh = interface(IUnknown) + ['{2A835771-BF4D-43f4-8E14-82A809F17D8A}'] + // ID3DXBaseMesh + function DrawSubset(AttribId: DWord): HResult; stdcall; + function GetNumFaces: DWord; stdcall; + function GetNumVertices: DWord; stdcall; + function GetFVF: DWord; stdcall; + function GetDeclaration(out Declaration: TFVFDeclaration): HResult; stdcall; + function GetOptions: DWord; stdcall; + function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall; + function CloneMeshFVF(Options, FVF: DWord; ppDevice: IDirect3DDevice8; + out ppCloneMesh: ID3DXMesh): HResult; stdcall; + function CloneMesh(Options: DWord; pDeclaration: PDWord; + ppDevice: IDirect3DDevice8; out ppCloneMesh: ID3DXMesh): HResult; stdcall; + function GetVertexBuffer(out ppVB: IDirect3DVertexBuffer8): HResult; stdcall; + function GetIndexBuffer(out ppIB: IDirect3DIndexBuffer8): HResult; stdcall; + function LockVertexBuffer(Flags: DWord; out ppData: PByte): HResult; stdcall; + function UnlockVertexBuffer: HResult; stdcall; + function LockIndexBuffer(Flags: DWord; out ppData: PByte): HResult; stdcall; + function UnlockIndexBuffer: HResult; stdcall; + function GetAttributeTable(pAttribTable: PD3DXAttributeRange; + pAttribTableSize: PDWord): HResult; stdcall; + + function ConvertPointRepsToAdjacency(pPRep: PDWord; pAdjacency: PDWord): HResult; stdcall; + function ConvertAdjacencyToPointReps(pAdjacency: PDWord; pPRep: PDWord): HResult; stdcall; + function GenerateAdjacency(Epsilon: Single; pAdjacency: PDWord): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXMesh);'} + {$EXTERNALSYM ID3DXMesh} + ID3DXMesh = interface(ID3DXBaseMesh) + ['{CCAE5C3B-4DD1-4d0f-997E-4684CA64557F}'] + // ID3DXMesh + function LockAttributeBuffer(Flags: DWord; out ppData: PByte): HResult; stdcall; + function UnlockAttributeBuffer: HResult; stdcall; + function Optimize(Flags: DWord; pAdjacencyIn, pAdjacencyOut: PDWord; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer; + out ppOptMesh: ID3DXMesh): HResult; stdcall; + function OptimizeInplace(Flags: DWord; pAdjacencyIn, pAdjacencyOut: PDWord; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXPMesh);'} + {$EXTERNALSYM ID3DXPMesh} + ID3DXPMesh = interface(ID3DXBaseMesh) + ['{19FBE386-C282-4659-97BD-CB869B084A6C}'] + // ID3DXPMesh + function ClonePMeshFVF(Options, FVF: DWord; ppDevice: IDirect3DDevice8; + out ppCloneMesh: ID3DXPMesh): HResult; stdcall; + function ClonePMesh(Options: DWord; pDeclaration: PDWord; + ppDevice: IDirect3DDevice8; out ppCloneMesh: ID3DXPMesh): HResult; stdcall; + function SetNumFaces(Faces: DWord): HResult; stdcall; + function SetNumVertices(Vertices: DWord): HResult; stdcall; + function GetMaxFaces: DWord; stdcall; + function GetMinFaces: DWord; stdcall; + function GetMaxVertices: DWord; stdcall; + function GetMinVertices: DWord; stdcall; + function Save(pStream: IStream; pMaterials: PD3DXMaterial; + NumMaterials: DWord): HResult; stdcall; + + function Optimize(Flags: DWord; pAdjacencyOut: PDWord; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer; + out ppOptMesh: ID3DXMesh): HResult; stdcall; + + function OptimizeBaseLOD(Flags: DWord; pFaceRemap: PDWord): HResult; stdcall; + function TrimByFaces(NewFacesMin, NewFacesMax: DWord; rgiFaceRemap, rgiVertRemap: PDWord): HResult; stdcall; + function TrimByVertices(NewVerticesMin, NewVerticesMax: DWord; rgiFaceRemap, rgiVertRemap: PDWord): HResult; stdcall; + + function GetAdjacency(pAdjacency: PDWord): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSPMesh);'} + {$EXTERNALSYM ID3DXSPMesh} + ID3DXSPMesh = interface(IUnknown) + ['{4E3CA05C-D4FF-4d11-8A02-16459E08F6F4}'] + // ID3DXSPMesh + function GetNumFaces: DWord; stdcall; + function GetNumVertices: DWord; stdcall; + function GetFVF: DWord; stdcall; + function GetDeclaration(out Declaration: TFVFDeclaration): HResult; stdcall; + function GetOptions: DWord; stdcall; + + function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall; + function CloneMeshFVF(Options, FVF: DWord; ppDevice: IDirect3DDevice8; + pAdjacencyOut, pVertexRemapOut: PDWord; + out ppCloneMesh: ID3DXMesh): HResult; stdcall; + function CloneMesh(Options: DWord; pDeclaration: PDWord; + ppDevice: IDirect3DDevice8; pAdjacencyOut, pVertexRemapOut: PDWord; + out ppCloneMesh: ID3DXMesh): HResult; stdcall; + + function ClonePMeshFVF(Options, FVF: DWord; ppDevice: IDirect3DDevice8; + pVertexRemapOut: PDWord; out ppCloneMesh: ID3DXPMesh): HResult; stdcall; + function ClonePMesh(Options: DWord; pDeclaration: PDWord; + ppDevice: IDirect3DDevice8; pVertexRemapOut: PDWord; + out ppCloneMesh: ID3DXPMesh): HResult; stdcall; + + function ReduceFaces(Faces: DWord): HResult; stdcall; + function ReduceVertices(Vertices: DWord): HResult; stdcall; + function GetMaxFaces: DWord; stdcall; + function GetMaxVertices: DWord; stdcall; + function GetVertexAttributeWeights(pVertexAttributeWeights: PD3DXAttributeWeights): HResult; stdcall; + function GetVertexWeights(pVertexWeights: PSingle): HResult; stdcall; + end; + +const + UNUSED16 = $ffff; + {$EXTERNALSYM UNUSED16} + UNUSED32 = $ffffffff; + {$EXTERNALSYM UNUSED32} + +// ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags +type + _D3DXMESHOPT = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DXMESHOPT} + TD3DXMeshOpt = _D3DXMESHOPT; + +const + D3DXMESHOPT_COMPACT = $01000000; + {$EXTERNALSYM D3DXMESHOPT_COMPACT} + D3DXMESHOPT_ATTRSORT = $02000000; + {$EXTERNALSYM D3DXMESHOPT_ATTRSORT} + D3DXMESHOPT_VERTEXCACHE = $04000000; + {$EXTERNALSYM D3DXMESHOPT_VERTEXCACHE} + D3DXMESHOPT_STRIPREORDER = $08000000; + {$EXTERNALSYM D3DXMESHOPT_STRIPREORDER} + D3DXMESHOPT_IGNOREVERTS = $10000000; // optimize faces only; don't touch vertices + {$EXTERNALSYM D3DXMESHOPT_IGNOREVERTS} + D3DXMESHOPT_SHAREVB = $1000; // same as D3DXMESH_VB_SHARE + {$EXTERNALSYM D3DXMESHOPT_SHAREVB} + +// Subset of the mesh that has the same attribute and bone combination. +// This subset can be rendered in a single draw call +type + PDWordArray = ^TDWordArray; + {$NODEFINE PDWordArray} + TDWordArray = array[0..8181] of DWord; + {$NODEFINE TDWordArray} + + PD3DXBoneCombination = ^TD3DXBoneCombination; + _D3DXBONECOMBINATION = packed record + AttribId: DWord; + FaceStart: DWord; + FaceCount: DWord; + VertexStart: DWord; + VertexCount: DWord; + BoneId: PDWordArray; // [ DWORD* ] in original d3dx8mesh.h + end; + {$EXTERNALSYM _D3DXBONECOMBINATION} + D3DXBONECOMBINATION = _D3DXBONECOMBINATION; + {$EXTERNALSYM D3DXBONECOMBINATION} + TD3DXBoneCombination = _D3DXBONECOMBINATION; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSkinMesh);'} + {$EXTERNALSYM ID3DXSkinMesh} + ID3DXSkinMesh = interface(IUnknown) + ['{8DB06ECC-EBFC-408a-9404-3074B4773515}'] + // close to ID3DXMesh + function GetNumFaces: DWord; stdcall; + function GetNumVertices: DWord; stdcall; + function GetFVF: DWord; stdcall; + function GetDeclaration(out Declaration: TFVFDeclaration): HResult; stdcall; + function GetOptions: DWord; stdcall; + function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall; + function GetVertexBuffer(out ppVB: IDirect3DVertexBuffer8): HResult; stdcall; + function GetIndexBuffer(out ppIB: IDirect3DIndexBuffer8): HResult; stdcall; + function LockVertexBuffer(Flags: DWord; out ppData: PByte): HResult; stdcall; + function UnlockVertexBuffer: HResult; stdcall; + function LockIndexBuffer(Flags: DWord; out ppData: PByte): HResult; stdcall; + function UnlockIndexBuffer: HResult; stdcall; + function LockAttributeBuffer(Flags: DWord; out ppData: PByte): HResult; stdcall; + function UnlockAttributeBuffer: HResult; stdcall; + // ID3DXSkinMesh + function GetNumBones: DWord; stdcall; + function GetOriginalMesh(out ppMesh: ID3DXMesh): HResult; stdcall; + function SetBoneInfluence(bone, numInfluences: DWord; vertices: PDWord; + weights: PSingle): HResult; stdcall; + function GetNumBoneInfluences(bone: DWord): DWord; stdcall; + function GetBoneInfluence(bone: DWord; vertices: PDWord; + weights: PSingle): HResult; stdcall; + function GetMaxVertexInfluences(out maxVertexInfluences: DWord): HResult; stdcall; + function GetMaxFaceInfluences(out maxFaceInfluences: DWord): HResult; stdcall; + + function ConvertToBlendedMesh(Options: DWord; + pAdjacencyIn, pAdjacencyOut: PDWord; + out pNumBoneCombinations: DWord; out ppBoneCombinationTable: ID3DXBuffer; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer; + out ppMesh: ID3DXMesh): HResult; stdcall; + + function ConvertToIndexedBlendedMesh(Options: DWord; + pAdjacencyIn: PDWord; paletteSize: DWord; pAdjacencyOut: PDWord; + out pNumBoneCombinations: DWord; out ppBoneCombinationTable: ID3DXBuffer; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer; + out ppMesh: ID3DXMesh): HResult; stdcall; + + function GenerateSkinnedMesh(Options: DWord; minWeight: Single; + pAdjacencyIn, pAdjacencyOut: PDWord; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer; + out ppMesh: ID3DXMesh): HResult; stdcall; + function UpdateSkinnedMesh( + const pBoneTransforms: TD3DXmatrix; pBoneInvTransforms: PD3DXmatrix; + ppMesh: ID3DXMesh): HResult; stdcall; + end; + +type + IID_ID3DXBaseMesh = ID3DXBaseMesh; + {$EXTERNALSYM IID_ID3DXBaseMesh} + IID_ID3DXMesh = ID3DXMesh; + {$EXTERNALSYM IID_ID3DXMesh} + IID_ID3DXPMesh = ID3DXPMesh; + {$EXTERNALSYM IID_ID3DXPMesh} + IID_ID3DXSPMesh = ID3DXSPMesh; + {$EXTERNALSYM IID_ID3DXSPMesh} + IID_ID3DXSkinMesh = ID3DXSkinMesh; + {$EXTERNALSYM IID_ID3DXSkinMesh} + + +function D3DXCreateMesh(NumFaces, NumVertices: DWord; Options: DWord; + pDeclaration: PDWord; pD3D: IDirect3DDevice8; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateMesh} + +function D3DXCreateMeshFVF(NumFaces, NumVertices: DWord; Options: DWord; + FVF: DWord; pD3D: IDirect3DDevice8; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateMeshFVF} + +function D3DXCreateSPMesh(pMesh: ID3DXMesh; pAdjacency: PDWord; + pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle; + out ppSMesh: ID3DXSPMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateSPMesh} + +// clean a mesh up for simplification, try to make manifold +function D3DXCleanMesh(pMeshIn: ID3DXMesh; pAdjacencyIn: PDWord; + out ppMeshOut: ID3DXMesh; pAdjacencyOut: PDWord; + ppErrorsAndWarnings: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCleanMesh} + +function D3DXValidMesh(pMeshIn: ID3DXMesh; pAdjacency: PDWord; + ppErrorsAndWarnings: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXValidMesh} + +function D3DXGeneratePMesh(pMesh: ID3DXMesh; pAdjacency: PDWord; + pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle; + MinValue: DWord; Options: TD3DMeshSimp; out ppPMesh: ID3DXPMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXGeneratePMesh} + +function D3DXSimplifyMesh(pMesh: ID3DXMesh; pAdjacency: PDWord; + pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle; + MinValue: DWord; Options: TD3DMeshSimp; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXSimplifyMesh} + +function D3DXComputeBoundingSphere(const pPointsFVF; NumVertices: DWord; + FVF: DWord; out pCenter: TD3DXVector3; out pRadius: Single): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXComputeBoundingSphere} + +function D3DXComputeBoundingBox(const pPointsFVF; NumVertices: DWord; + FVF: DWord; out pMin, pMax: TD3DXVector3): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXComputeBoundingBox} + +function D3DXComputeNormals(pMesh: ID3DXBaseMesh; pAdjacency: PDWord): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXComputeNormals} + +function D3DXCreateBuffer(NumBytes: DWord; out ppBuffer: ID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateBuffer} + +function D3DXLoadMeshFromX(pFilename: PAnsiChar; Options: DWord; + pD3D: IDirect3DDevice8; ppAdjacency, ppMaterials: PID3DXBuffer; + pNumMaterials: PDWord; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadMeshFromX} + +function D3DXLoadMeshFromXInMemory(Memory: PByte; SizeOfMemory: DWord; + Options: DWord; pD3D: IDirect3DDevice8; + ppAdjacency, ppMaterials: PID3DXBuffer; + pNumMaterials: PDWord; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadMeshFromXInMemory} + +function D3DXLoadMeshFromXResource(Module: HModule; Name: PAnsiChar; _Type: PAnsiChar; + Options: DWord; pD3D: IDirect3DDevice8; + ppAdjacency, ppMaterials: PID3DXBuffer; + pNumMaterials: PDWord; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadMeshFromXResource} + +function D3DXSaveMeshToX(pFilename: PAnsiChar; ppMesh: ID3DXMesh; + pAdjacency: PDWord; pMaterials: PD3DXMaterial; NumMaterials: DWord; + Format: DWord): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXSaveMeshToX} + +function D3DXCreatePMeshFromStream(pStream: IStream; Options: DWord; + pD3D: IDirect3DDevice8; ppMaterials: PID3DXBuffer; + pNumMaterials: PDWord; out ppPMesh: ID3DXPMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreatePMeshFromStream} + +function D3DXCreateSkinMesh(NumFaces, NumVertices, NumBones, Options: DWord; + pDeclaration: PDWord; pD3D: IDirect3DDevice8; + out ppSkinMesh: ID3DXSkinMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateSkinMesh} + +function D3DXCreateSkinMeshFVF(NumFaces, NumVertices, NumBones, Options: DWord; + FVF: DWord; pD3D: IDirect3DDevice8; + out ppSkinMesh: ID3DXSkinMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateSkinMeshFVF} + +function D3DXCreateSkinMeshFromMesh(pMesh: ID3DXMesh; numBones: DWord; + out ppSkinMesh: ID3DXSkinMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateSkinMeshFromMesh} + +function D3DXLoadMeshFromXof(pXofObjMesh: IDirectXFileData; + Options: DWord; pD3D: IDirect3DDevice8; + ppAdjacency, ppMaterials: PID3DXBuffer; + pNumMaterials: PDWord; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadMeshFromXof} + +function D3DXLoadSkinMeshFromXof(pXofObjMesh: IDirectXFileData; + Options: DWord; pD3D: IDirect3DDevice8; + ppAdjacency, ppMaterials: PID3DXBuffer; + pmMatOut: PDWord; ppBoneNames, ppBoneTransforms: PID3DXBuffer; + out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadSkinMeshFromXof} + +function D3DXTessellateNPatches(pMeshIn: ID3DXMesh; + pAdjacencyIn: PDWord; NumSegs: Single; + QuadraticInterpNormals: BOOL; // if false use linear intrep for normals, if true use quadratic + out ppMeshOut: ID3DXMesh; ppAdjacencyOut: PDWord): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXTessellateNPatches} + +function D3DXGetFVFVertexSize(FVF: DWord): LongWord; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXGetFVFVertexSize} + +function D3DXDeclaratorFromFVF(FVF: DWord; out Declaration: TFVFDeclaration): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXDeclaratorFromFVF} + +function D3DXFVFFromDeclarator(pDeclarator: PDWord; out pFVF: DWord): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXFVFFromDeclarator} + +function D3DXWeldVertices(pMesh: ID3DXMesh; pEpsilons: PD3DXWeldEpsilons; + rgdwAdjacencyIn, rgdwAdjacencyOut, pFaceRemap: PDWord; + ppVertexRemap: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXWeldVertices} + +type + PD3DXIntersectInfo = ^TD3DXIntersectInfo; + _D3DXINTERSECTINFO = packed record + FaceIndex: DWord; // index of face intersected + U: Single; // Barycentric Hit Coordinates + V: Single; // Barycentric Hit Coordinates + Dist: Single; // Ray-Intersection Parameter Distance + end; + {$EXTERNALSYM _D3DXINTERSECTINFO} + D3DXINTERSECTINFO = _D3DXINTERSECTINFO; + {$EXTERNALSYM D3DXINTERSECTINFO} + TD3DXIntersectInfo = _D3DXINTERSECTINFO; + +function D3DXIntersect(pMesh: ID3DXBaseMesh; + const pRayPos, pRayDir: TD3DXVector3; + out pHit: BOOL; // True if any faces were intersected + pFaceIndex: PDWord; // index of closest face intersected + pU: PSingle; // Barycentric Hit Coordinates + pV: PSingle; // Barycentric Hit Coordinates + pDist: PSingle; // Ray-Intersection Parameter Distance + ppAllHits: PID3DXBuffer; // Array of D3DXINTERSECTINFOs for all hits (not just closest) + pCountOfHits: PDWord // Number of entries in AllHits array + ): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXIntersect} + +function D3DXIntersectSubset(pMesh: ID3DXBaseMesh; AttribId: DWord; + const pRayPos, pRayDir: TD3DXVector3; + out pHit: BOOL; // True if any faces were intersected + pFaceIndex: PDWord; // index of closest face intersected + pU: PSingle; // Barycentric Hit Coordinates + pV: PSingle; // Barycentric Hit Coordinates + pDist: PSingle; // Ray-Intersection Parameter Distance + ppAllHits: PID3DXBuffer; // Array of D3DXINTERSECTINFOs for all hits (not just closest) + pCountOfHits: PDWord // Number of entries in AllHits array + ): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXIntersectSubset} + + +function D3DXSplitMesh(pMeshIn: ID3DXMesh; pAdjacencyIn: PDWord; + MaxSize, Options: DWord; + out pMeshesOut: DWord; out ppMeshArrayOut: ID3DXBuffer; + ppAdjacencyArrayOut, ppFaceRemapArrayOut, ppVertRemapArrayOut: PID3DXBuffer + ): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXSplitMesh} + +function D3DXIntersectTri( + const p0: TD3DXVector3; // Triangle vertex 0 position + const p1: TD3DXVector3; // Triangle vertex 1 position + const p2: TD3DXVector3; // Triangle vertex 2 position + const pRayPos: TD3DXVector3; // Ray origin + const pRayDir: TD3DXVector3; // Ray direction + out pU: Single; // Barycentric Hit Coordinates + out pV: Single; // Barycentric Hit Coordinates + out pDist: Single // Ray-Intersection Parameter Distance + ): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXIntersectTri} + +function D3DXSphereBoundProbe(const pCenter: TD3DXVector3; Radius: Single; + out pRayPosition, pRayDirection: TD3DXVector3): BOOL; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXSphereBoundProbe} + +function D3DXBoxBoundProbe(const pMin, pMax: TD3DXVector3; + out pRayPosition, pRayDirection: TD3DXVector3): BOOL; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXBoxBoundProbe} + +type + _D3DXERR = HResult; + {$EXTERNALSYM _D3DXERR} + +{$IFDEF DXG_COMPAT} +const + MAKE_D3DHRESULT_R = MAKE_D3DHRESULT; +{$ENDIF} + +const + D3DXERR_CANNOTMODIFYINDEXBUFFER = HResult(MAKE_D3DHRESULT_R or 2900); + {$EXTERNALSYM D3DXERR_CANNOTMODIFYINDEXBUFFER} + D3DXERR_INVALIDMESH = HResult(MAKE_D3DHRESULT_R or 2901); + {$EXTERNALSYM D3DXERR_INVALIDMESH} + D3DXERR_CANNOTATTRSORT = HResult(MAKE_D3DHRESULT_R or 2902); + {$EXTERNALSYM D3DXERR_CANNOTATTRSORT} + D3DXERR_SKINNINGNOTSUPPORTED = HResult(MAKE_D3DHRESULT_R or 2903); + {$EXTERNALSYM D3DXERR_SKINNINGNOTSUPPORTED} + D3DXERR_TOOMANYINFLUENCES = HResult(MAKE_D3DHRESULT_R or 2904); + {$EXTERNALSYM D3DXERR_TOOMANYINFLUENCES} + D3DXERR_INVALIDDATA = HResult(MAKE_D3DHRESULT_R or 2905); + {$EXTERNALSYM D3DXERR_INVALIDDATA} + D3DXERR_LOADEDMESHASNODATA = HResult(MAKE_D3DHRESULT_R or 2906); + {$EXTERNALSYM D3DXERR_LOADEDMESHASNODATA} + +const + D3DX_COMP_TANGENT_NONE = $FFFFFFFF; + {$EXTERNALSYM D3DX_COMP_TANGENT_NONE} + +function D3DXComputeTangent(InMesh: ID3DXMesh; TexStage: DWord; + OutMesh: ID3DXMesh; TexStageUVec, TexStageVVec: DWord; + Wrap: DWord; Adjacency: PDWord): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXComputeTangent} + +function D3DXConvertMeshSubsetToSingleStrip(MeshIn: ID3DXBaseMesh; + AttribId: DWord; IBOptions: DWord; + out ppIndexBuffer: IDirect3DIndexBuffer8; pNumIndices: PDWord + ): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXConvertMeshSubsetToSingleStrip} + +function D3DXConvertMeshSubsetToStrips(MeshIn: ID3DXBaseMesh; + AttribId: DWord; IBOptions: DWord; + out ppIndexBuffer: IDirect3DIndexBuffer8; pNumIndices: PDWord; + ppStripLengths: PID3DXBuffer; pNumStrips: PDWord): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXConvertMeshSubsetToStrips} + + + + + + + +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8shapes.h +// Content: D3DX simple shapes +// +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////// +// Functions: +/////////////////////////////////////////////////////////////////////////// + + +//------------------------------------------------------------------------- +// D3DXCreatePolygon: +// ------------------ +// Creates a mesh containing an n-sided polygon. The polygon is centered +// at the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Length Length of each side. +// Sides Number of sides the polygon has. (Must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreatePolygon(ppDevice: IDirect3DDevice8; + Length: Single; + Sides: LongWord; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreatePolygon} + + +//------------------------------------------------------------------------- +// D3DXCreateBox: +// -------------- +// Creates a mesh containing an axis-aligned box. The box is centered at +// the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Width Width of box (along X-axis) +// Height Height of box (along Y-axis) +// Depth Depth of box (along Z-axis) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateBox(ppDevice: IDirect3DDevice8; + Width, + Height, + Depth: Single; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateBox} + + +//------------------------------------------------------------------------- +// D3DXCreateCylinder: +// ------------------- +// Creates a mesh containing a cylinder. The generated cylinder is +// centered at the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius1 Radius at -Z end (should be >= 0.0f) +// Radius2 Radius at +Z end (should be >= 0.0f) +// Length Length of cylinder (along Z-axis) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateCylinder(ppDevice: IDirect3DDevice8; + Radius1, + Radius2, + Length: Single; + Slices, + Stacks: LongWord; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateCylinder} + + +//------------------------------------------------------------------------- +// D3DXCreateSphere: +// ----------------- +// Creates a mesh containing a sphere. The sphere is centered at the +// origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius Radius of the sphere (should be >= 0.0f) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateSphere(ppDevice: IDirect3DDevice8; + Radius: Single; + Slices, + Stacks: LongWord; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateSphere} + + +//------------------------------------------------------------------------- +// D3DXCreateTorus: +// ---------------- +// Creates a mesh containing a torus. The generated torus is centered at +// the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// InnerRadius Inner radius of the torus (should be >= 0.0f) +// OuterRadius Outer radius of the torue (should be >= 0.0f) +// Sides Number of sides in a cross-section (must be >= 3) +// Rings Number of rings making up the torus (must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateTorus(ppDevice: IDirect3DDevice8; + InnerRadius, + OuterRadius: Single; + Sides, + Rings: LongWord; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateTorus} + + +//------------------------------------------------------------------------- +// D3DXCreateTeapot: +// ----------------- +// Creates a mesh containing a teapot. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateTeapot(ppDevice: IDirect3DDevice8; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateTeapot} + + +//------------------------------------------------------------------------- +// D3DXCreateText: +// --------------- +// Creates a mesh containing the specified text using the font associated +// with the device context. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// hDC Device context, with desired font selected +// pText Text to generate +// Deviation Maximum chordal deviation from true font outlines +// Extrusion Amount to extrude text in -Z direction +// ppMesh The mesh object which will be created +// pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) +//------------------------------------------------------------------------- + +function D3DXCreateTextA(ppDevice: IDirect3DDevice8; + hDC: HDC; + pText: PAnsiChar; + Deviation: Single; + Extrusion: Single; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer; + pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextA'; +{$EXTERNALSYM D3DXCreateTextA} + +function D3DXCreateTextW(ppDevice: IDirect3DDevice8; + hDC: HDC; + pText: PWideChar; + Deviation: Single; + Extrusion: Single; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer; + pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextW'; +{$EXTERNALSYM D3DXCreateTextW} + +function D3DXCreateText(ppDevice: IDirect3DDevice8; + hDC: HDC; + pText: PChar; + Deviation: Single; + Extrusion: Single; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer; + pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextA'; +{$EXTERNALSYM D3DXCreateText} + + + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8tex.h +// Content: D3DX texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR +// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | +// D3DX_FILTER_MIRROR_V +// D3DX_FILTER_DITHER +// Dithers the resulting image. +// +//---------------------------------------------------------------------------- + +const + D3DX_FILTER_NONE = (1 shl 0); + {$EXTERNALSYM D3DX_FILTER_NONE} + D3DX_FILTER_POINT = (2 shl 0); + {$EXTERNALSYM D3DX_FILTER_POINT} + D3DX_FILTER_LINEAR = (3 shl 0); + {$EXTERNALSYM D3DX_FILTER_LINEAR} + D3DX_FILTER_TRIANGLE = (4 shl 0); + {$EXTERNALSYM D3DX_FILTER_TRIANGLE} + D3DX_FILTER_BOX = (5 shl 0); + {$EXTERNALSYM D3DX_FILTER_BOX} + + D3DX_FILTER_MIRROR_U = (1 shl 16); + {$EXTERNALSYM D3DX_FILTER_MIRROR_U} + D3DX_FILTER_MIRROR_V = (2 shl 16); + {$EXTERNALSYM D3DX_FILTER_MIRROR_V} + D3DX_FILTER_MIRROR_W = (4 shl 16); + {$EXTERNALSYM D3DX_FILTER_MIRROR_W} + D3DX_FILTER_MIRROR = (7 shl 16); + {$EXTERNALSYM D3DX_FILTER_MIRROR} + D3DX_FILTER_DITHER = (8 shl 16); + {$EXTERNALSYM D3DX_FILTER_DITHER} + + +//---------------------------------------------------------------------------- +// D3DX_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DXComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR +// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V +// D3DX_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- + +const + D3DX_NORMALMAP_MIRROR_U = (1 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_MIRROR_U} + D3DX_NORMALMAP_MIRROR_V = (2 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_MIRROR_V} + D3DX_NORMALMAP_MIRROR = (3 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_MIRROR} + D3DX_NORMALMAP_INVERTSIGN = (8 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_INVERTSIGN} + D3DX_NORMALMAP_COMPUTE_OCCLUSION = (16 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_COMPUTE_OCCLUSION} + + +//---------------------------------------------------------------------------- +// D3DX_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX_CHANNEL_RED +// Indicates the red channel should be used +// D3DX_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +const + D3DX_CHANNEL_RED = (1 shl 0); + {$EXTERNALSYM D3DX_CHANNEL_RED} + D3DX_CHANNEL_BLUE = (1 shl 1); + {$EXTERNALSYM D3DX_CHANNEL_BLUE} + D3DX_CHANNEL_GREEN = (1 shl 2); + {$EXTERNALSYM D3DX_CHANNEL_GREEN} + D3DX_CHANNEL_ALPHA = (1 shl 3); + {$EXTERNALSYM D3DX_CHANNEL_ALPHA} + D3DX_CHANNEL_LUMINANCE = (1 shl 4); + {$EXTERNALSYM D3DX_CHANNEL_LUMINANCE} + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_FILEFORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +type + PD3DXImageFileFormat = ^TD3DXImageFileFormat; + _D3DXIMAGE_FILEFORMAT = ( + D3DXIFF_BMP {= 0}, + D3DXIFF_JPG {= 1}, + D3DXIFF_TGA {= 2}, + D3DXIFF_PNG {= 3}, + D3DXIFF_DDS {= 4}, + D3DXIFF_PPM {= 5}, + D3DXIFF_DIB {= 6} + ); + {$EXTERNALSYM _D3DXIMAGE_FILEFORMAT} + D3DXIMAGE_FILEFORMAT = _D3DXIMAGE_FILEFORMAT; + {$EXTERNALSYM D3DXIMAGE_FILEFORMAT} + TD3DXImageFileFormat = _D3DXIMAGE_FILEFORMAT; + + +//---------------------------------------------------------------------------- +// LPD3DXFILL2D and LPD3DXFILL3D: +// ------------------------------ +// Function types used by the texture fill functions. +// +// Parameters: +// pOut +// Pointer to a vector which the function uses to return its result. +// X,Y,Z,W will be mapped to R,G,B,A respectivly. +// pTexCoord +// Pointer to a vector containing the coordinates of the texel currently +// being evaluated. Textures and VolumeTexture texcoord components +// range from 0 to 1. CubeTexture texcoord component range from -1 to 1. +// pTexelSize +// Pointer to a vector containing the dimensions of the current texel. +// pData +// Pointer to user data. +// +//---------------------------------------------------------------------------- + +type + // typedef VOID (*LPD3DXFILL2D)(D3DXVECTOR4 *pOut, D3DXVECTOR2 *pTexCoord, D3DXVECTOR2 *pTexelSize, LPVOID pData); + LPD3DXFILL2D = procedure (out pOut: TD3DXVector4; const pTexCoord, pTexelSize: TD3DXVector2; var pData); + {$EXTERNALSYM LPD3DXFILL2D} + TD3DXFill2D = LPD3DXFILL2D; + // typedef VOID (*LPD3DXFILL3D)(D3DXVECTOR4 *pOut, D3DXVECTOR3 *pTexCoord, D3DXVECTOR3 *pTexelSize, LPVOID pData); + LPD3DXFILL3D = procedure (out pOut: TD3DXVector4; const pTexCoord, pTexelSize: TD3DXVector3; var pData); + {$EXTERNALSYM LPD3DXFILL3D} + TD3DXFill3D = LPD3DXFILL3D; + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// MipLevels +// Number of mip levels in original image +// Format +// D3D format which most closely describes the data in original image +// ResourceType +// D3DRESOURCETYPE representing the type of texture stored in the file. +// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. +// ImageFileFormat +// D3DXIMAGE_FILEFORMAT representing the format of the image file. +// +//---------------------------------------------------------------------------- + +type + PD3DXImageInfo = ^TD3DXImageInfo; + _D3DXIMAGE_INFO = packed record + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Format: TD3DFormat; + ResourceType: TD3DResourceType; + ImageFileFormat: TD3DXImageFileFormat; + end; + {$EXTERNALSYM _D3DXIMAGE_INFO} + D3DXIMAGE_INFO = _D3DXIMAGE_INFO; + {$EXTERNALSYM D3DXIMAGE_INFO} + TD3DXImageInfo = _D3DXIMAGE_INFO; + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource: +// ------------------------------ +// Fills in a D3DXIMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// +//---------------------------------------------------------------------------- + +function D3DXGetImageInfoFromFileA( + pSrcFile: PAnsiChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXGetImageInfoFromFileA'; +{$EXTERNALSYM D3DXGetImageInfoFromFileA} + +function D3DXGetImageInfoFromFileW( + pSrcFile: PWideChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXGetImageInfoFromFileW'; +{$EXTERNALSYM D3DXGetImageInfoFromFileW} + +function D3DXGetImageInfoFromFile( + pSrcFile: PChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXGetImageInfoFromFileA'; +{$EXTERNALSYM D3DXGetImageInfoFromFile} + + +function D3DXGetImageInfoFromResourceA( + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXGetImageInfoFromResourceA'; +{$EXTERNALSYM D3DXGetImageInfoFromResourceA} + +function D3DXGetImageInfoFromResourceW( + hSrcModule: HModule; + pSrcResource: PWideChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXGetImageInfoFromResourceW'; +{$EXTERNALSYM D3DXGetImageInfoFromResourceW} + +function D3DXGetImageInfoFromResource( + hSrcModule: HModule; + pSrcResource: PChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXGetImageInfoFromResourceA'; +{$EXTERNALSYM D3DXGetImageInfoFromResource} + + +function D3DXGetImageInfoFromFileInMemory( + const pSrcData; + SrcDataSize: LongWord; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXGetImageInfoFromFileInMemory} + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Surface APIs //////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromFile/Resource: +// --------------------------------- +// Load surface from a file or resource +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcRect +// Source rectangle, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- +function D3DXLoadSurfaceFromFileA( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + pSrcFile: PAnsiChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadSurfaceFromFileA'; +{$EXTERNALSYM D3DXLoadSurfaceFromFileA} + +function D3DXLoadSurfaceFromFileW( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + pSrcFile: PWideChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadSurfaceFromFileW'; +{$EXTERNALSYM D3DXLoadSurfaceFromFileW} + +function D3DXLoadSurfaceFromFile( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + pSrcFile: PChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadSurfaceFromFileA'; +{$EXTERNALSYM D3DXLoadSurfaceFromFile} + + + +function D3DXLoadSurfaceFromResourceA( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadSurfaceFromResourceA'; +{$EXTERNALSYM D3DXLoadSurfaceFromResourceA} + +function D3DXLoadSurfaceFromResourceW( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + hSrcModule: HModule; + pSrcResource: PWideChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadSurfaceFromResourceW'; +{$EXTERNALSYM D3DXLoadSurfaceFromResourceW} + +function D3DXLoadSurfaceFromResource( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + hSrcModule: HModule; + pSrcResource: PChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadSurfaceFromResourceA'; +{$EXTERNALSYM D3DXLoadSurfaceFromResource} + + + +function D3DXLoadSurfaceFromFileInMemory( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + const pSrcData; + SrcDataSize: LongWord; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadSurfaceFromFileInMemory} + + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromSurface: +// --------------------------- +// Load surface from another surface (with color conversion) +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcSurface +// Source surface +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for entire surface +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +function D3DXLoadSurfaceFromSurface( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + pSrcSurface: IDirect3DSurface8; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadSurfaceFromSurface} + + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromMemory: +// --------------------------- +// Load surface from memory. +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcMemory +// Pointer to the top-left corner of the source image in memory +// SrcFormat +// Pixel format of the source image. +// SrcPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the width of one row of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +function D3DXLoadSurfaceFromMemory( + pDestSurface: IDirect3DSurface8; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + const pSrcMemory; + SrcFormat: TD3DFormat; + SrcPitch: LongWord; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadSurfaceFromMemory} + + + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFile: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +function D3DXSaveSurfaceToFileA( + pDestFile: PAnsiChar; + DestFormat: TD3DXImageFileFormat; + pSrcSurface: IDirect3DSurface8; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect): HResult; stdcall; external d3dx8dll name 'D3DXSaveSurfaceToFileA'; +{$EXTERNALSYM D3DXSaveSurfaceToFileA} + +function D3DXSaveSurfaceToFileW( + pDestFile: PWideChar; + DestFormat: TD3DXImageFileFormat; + pSrcSurface: IDirect3DSurface8; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect): HResult; stdcall; external d3dx8dll name 'D3DXSaveSurfaceToFileW'; +{$EXTERNALSYM D3DXSaveSurfaceToFileW} + +function D3DXSaveSurfaceToFile( + pDestFile: PChar; + DestFormat: TD3DXImageFileFormat; + pSrcSurface: IDirect3DSurface8; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect): HResult; stdcall; external d3dx8dll name 'D3DXSaveSurfaceToFileA'; +{$EXTERNALSYM D3DXSaveSurfaceToFile} + + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Volume APIs ///////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromFile/Resource: +// -------------------------------- +// Load volume from a file or resource +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcBox +// Source box, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +function D3DXLoadVolumeFromFileA( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + pSrcFile: PAnsiChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadVolumeFromFileA'; +{$EXTERNALSYM D3DXLoadVolumeFromFileA} + +function D3DXLoadVolumeFromFileW( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + pSrcFile: PWideChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadVolumeFromFileW'; +{$EXTERNALSYM D3DXLoadVolumeFromFileW} + +function D3DXLoadVolumeFromFile( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + pSrcFile: PChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadVolumeFromFileA'; +{$EXTERNALSYM D3DXLoadVolumeFromFile} + + +function D3DXLoadVolumeFromResourceA( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadVolumeFromResourceA'; +{$EXTERNALSYM D3DXLoadVolumeFromResourceA} + +function D3DXLoadVolumeFromResourceW( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + hSrcModule: HModule; + pSrcResource: PWideChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadVolumeFromResourceW'; +{$EXTERNALSYM D3DXLoadVolumeFromResourceW} + +function D3DXLoadVolumeFromResource( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + hSrcModule: HModule; + pSrcResource: PChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll name 'D3DXLoadVolumeFromResourceA'; +{$EXTERNALSYM D3DXLoadVolumeFromResource} + + +function D3DXLoadVolumeFromFileInMemory( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + const pSrcData; + SrcDataSize: LongWord; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadVolumeFromFileInMemory} + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromVolume: +// --------------------------- +// Load volume from another volume (with color conversion) +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcVolume +// Source volume +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for entire volume +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +function D3DXLoadVolumeFromVolume( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + pSrcVolume: IDirect3DVolume8; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadVolumeFromVolume} + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromMemory: +// --------------------------- +// Load volume from memory. +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcMemory +// Pointer to the top-left corner of the source volume in memory +// SrcFormat +// Pixel format of the source volume. +// SrcRowPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one row of cells, in bytes. +// SrcSlicePitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one slice of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +function D3DXLoadVolumeFromMemory( + pDestVolume: IDirect3DVolume8; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + const pSrcMemory; + SrcFormat: TD3DFormat; + SrcRowPitch: LongWord; + SrcSlicePitch: LongWord; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXLoadVolumeFromMemory} + + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFile: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +function D3DXSaveVolumeToFileA( + pDestFile: PAnsiChar; + DestFormat: TD3DXImageFileFormat; + pSrcVolume: IDirect3DVolume8; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox): HResult; stdcall; external d3dx8dll name 'D3DXSaveVolumeToFileA'; +{$EXTERNALSYM D3DXSaveVolumeToFileA} + +function D3DXSaveVolumeToFileW( + pDestFile: PWideChar; + DestFormat: TD3DXImageFileFormat; + pSrcVolume: IDirect3DVolume8; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox): HResult; stdcall; external d3dx8dll name 'D3DXSaveVolumeToFileW'; +{$EXTERNALSYM D3DXSaveVolumeToFileW} + +function D3DXSaveVolumeToFile( + pDestFile: PChar; + DestFormat: TD3DXImageFileFormat; + pSrcVolume: IDirect3DVolume8; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox): HResult; stdcall; external d3dx8dll name 'D3DXSaveVolumeToFileA'; +{$EXTERNALSYM D3DXSaveVolumeToFile} + + + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +//---------------------------------------------------------------------------- +// D3DXCheckTextureRequirements: +// ----------------------------- +// Checks texture creation parameters. If parameters are invalid, this +// function returns corrected parameters. +// +// Parameters: +// +// pDevice +// The D3D device to be used +// pWidth, pHeight, pDepth, pSize +// Desired size in pixels, or NULL. Returns corrected size. +// pNumMipLevels +// Number of desired mipmap levels, or NULL. Returns corrected number. +// Usage +// Texture usage flags +// pFormat +// Desired pixel format, or NULL. Returns corrected format. +// Pool +// Memory pool to be used to create texture +// +//---------------------------------------------------------------------------- +function D3DXCheckTextureRequirements( + pDevice: IDirect3DDevice8; + pWidth: PLongWord; + pHeight: PLongWord; + pNumMipLevels: PLongWord; + Usage: DWord; + pFormat: PD3DFormat; + Pool: TD3DPool): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCheckTextureRequirements} + +function D3DXCheckCubeTextureRequirements( + pDevice: IDirect3DDevice8; + pSize: PLongWord; + pNumMipLevels: PLongWord; + Usage: DWord; + pFormat: PD3DFormat; + Pool: TD3DPool): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCheckCubeTextureRequirements} + +function D3DXCheckVolumeTextureRequirements( + pDevice: IDirect3DDevice8; + pWidth: PLongWord; + pHeight: PLongWord; + pDepth: PLongWord; + pNumMipLevels: PLongWord; + Usage: DWord; + pFormat: PD3DFormat; + Pool: TD3DPool): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCheckVolumeTextureRequirements} + + +//---------------------------------------------------------------------------- +// D3DXCreateTexture: +// ------------------ +// Create an empty texture +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// Width, Height, Depth, Size +// size in pixels; these must be non-zero +// MipLevels +// number of mip levels desired; if zero or D3DX_DEFAULT, a complete +// mipmap chain will be created. +// Usage +// Texture usage flags +// Format +// Pixel format. +// Pool +// Memory pool to be used to create texture +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + +function D3DXCreateTexture( + Device: IDirect3DDevice8; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateTexture} + +function D3DXCreateCubeTexture( + Device: IDirect3DDevice8; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateCubeTexture} + +function D3DXCreateVolumeTexture( + Device: IDirect3DDevice8; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateVolumeTexture} + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureFromFile/Resource: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// Width, Height, Depth, Size +// Size in pixels; if zero or D3DX_DEFAULT, the size will be taken +// from the file. +// MipLevels +// Number of mip levels; if zero or D3DX_DEFAULT, a complete mipmap +// chain will be created. +// Usage +// Texture usage flags +// Format +// Desired pixel format. If D3DFMT_UNKNOWN, the format will be +// taken from the file. +// Pool +// Memory pool to be used to create texture +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// MipFilter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// pPalette +// 256 color palette to be filled in, or NULL +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + + +// FromFile + +function D3DXCreateTextureFromFileA( + Device: IDirect3DDevice8; + pSrcFile: PAnsiChar; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromFileA'; +{$EXTERNALSYM D3DXCreateTextureFromFileA} + +function D3DXCreateTextureFromFileW( + Device: IDirect3DDevice8; + pSrcFile: PWideChar; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromFileW'; +{$EXTERNALSYM D3DXCreateTextureFromFileW} + +function D3DXCreateTextureFromFile( + Device: IDirect3DDevice8; + pSrcFile: PChar; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromFileA'; +{$EXTERNALSYM D3DXCreateTextureFromFile} + + +function D3DXCreateCubeTextureFromFileA( + Device: IDirect3DDevice8; + pSrcFile: PAnsiChar; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromFileA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileA} + +function D3DXCreateCubeTextureFromFileW( + Device: IDirect3DDevice8; + pSrcFile: PWideChar; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromFileW'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileW} + +function D3DXCreateCubeTextureFromFile( + Device: IDirect3DDevice8; + pSrcFile: PChar; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromFileA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFile} + + +function D3DXCreateVolumeTextureFromFileA( + Device: IDirect3DDevice8; + pSrcFile: PAnsiChar; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromFileA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileA} + +function D3DXCreateVolumeTextureFromFileW( + Device: IDirect3DDevice8; + pSrcFile: PWideChar; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromFileW'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileW} + +function D3DXCreateVolumeTextureFromFile( + Device: IDirect3DDevice8; + pSrcFile: PChar; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromFileA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFile} + + +// FromResource + +function D3DXCreateTextureFromResourceA( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateTextureFromResourceA} + +function D3DXCreateTextureFromResourceW( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PWideChar; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromResourceW'; +{$EXTERNALSYM D3DXCreateTextureFromResourceW} + +function D3DXCreateTextureFromResource( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PChar; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateTextureFromResource} + + +function D3DXCreateCubeTextureFromResourceA( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceA} + +function D3DXCreateCubeTextureFromResourceW( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PWideChar; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromResourceW'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceW} + +function D3DXCreateCubeTextureFromResource( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PChar; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResource} + + +function D3DXCreateVolumeTextureFromResourceA( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceA} + +function D3DXCreateVolumeTextureFromResourceW( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PWideChar; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromResourceW'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceW} + +function D3DXCreateVolumeTextureFromResource( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PChar; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResource} + + +// FromFileEx + +function D3DXCreateTextureFromFileExA( + Device: IDirect3DDevice8; + pSrcFile: PAnsiChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateTextureFromFileExA} + +function D3DXCreateTextureFromFileExW( + Device: IDirect3DDevice8; + pSrcFile: PWideChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromFileExW'; +{$EXTERNALSYM D3DXCreateTextureFromFileExW} + +function D3DXCreateTextureFromFileEx( + Device: IDirect3DDevice8; + pSrcFile: PChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateTextureFromFileEx} + + +function D3DXCreateCubeTextureFromFileExA( + Device: IDirect3DDevice8; + pSrcFile: PAnsiChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileExA} + +function D3DXCreateCubeTextureFromFileExW( + Device: IDirect3DDevice8; + pSrcFile: PWideChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromFileExW'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileExW} + +function D3DXCreateCubeTextureFromFileEx( + Device: IDirect3DDevice8; + pSrcFile: PChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileEx} + + +function D3DXCreateVolumeTextureFromFileExA( + Device: IDirect3DDevice8; + pSrcFile: PAnsiChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileExA} + +function D3DXCreateVolumeTextureFromFileExW( + Device: IDirect3DDevice8; + pSrcFile: PWideChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromFileExW'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileExW} + +function D3DXCreateVolumeTextureFromFileEx( + Device: IDirect3DDevice8; + pSrcFile: PChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileEx} + + +// FromResourceEx + +function D3DXCreateTextureFromResourceExA( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateTextureFromResourceExA} + +function D3DXCreateTextureFromResourceExW( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PWideChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromResourceExW'; +{$EXTERNALSYM D3DXCreateTextureFromResourceExW} + +function D3DXCreateTextureFromResourceEx( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateTextureFromResourceEx} + + +function D3DXCreateCubeTextureFromResourceExA( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceExA} + +function D3DXCreateCubeTextureFromResourceExW( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PWideChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromResourceExW'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceExW} + +function D3DXCreateCubeTextureFromResourceEx( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateCubeTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceEx} + + +function D3DXCreateVolumeTextureFromResourceExA( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceExA} + +function D3DXCreateVolumeTextureFromResourceExW( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PWideChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromResourceExW'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceExW} + +function D3DXCreateVolumeTextureFromResourceEx( + Device: IDirect3DDevice8; + hSrcModule: HModule; + pSrcResource: PChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll name 'D3DXCreateVolumeTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceEx} + + +// FromFileInMemory + +function D3DXCreateTextureFromFileInMemory( + Device: IDirect3DDevice8; + const pSrcData; + SrcDataSize: LongWord; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateTextureFromFileInMemory} + +function D3DXCreateCubeTextureFromFileInMemory( + Device: IDirect3DDevice8; + const pSrcData; + SrcDataSize: LongWord; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileInMemory} + +function D3DXCreateVolumeTextureFromFileInMemory( + Device: IDirect3DDevice8; + const pSrcData; + SrcDataSize: LongWord; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileInMemory} + + +// FromFileInMemoryEx + +function D3DXCreateTextureFromFileInMemoryEx( + Device: IDirect3DDevice8; + const pSrcData; + SrcDataSize: LongWord; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateTextureFromFileInMemoryEx} + +function D3DXCreateCubeTextureFromFileInMemoryEx( + Device: IDirect3DDevice8; + const pSrcData; + SrcDataSize: LongWord; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileInMemoryEx} + +function D3DXCreateVolumeTextureFromFileInMemoryEx( + Device: IDirect3DDevice8; + const pSrcData; + SrcDataSize: LongWord; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileInMemoryEx} + + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + + +function D3DXSaveTextureToFileA( + pDestFile: PAnsiChar; + DestFormat: TD3DXImageFileFormat; + pSrcTexture: IDirect3DBaseTexture8; + pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx8dll name 'D3DXSaveTextureToFileA'; +{$EXTERNALSYM D3DXSaveTextureToFileA} + +function D3DXSaveTextureToFileW( + pDestFile: PWideChar; + DestFormat: TD3DXImageFileFormat; + pSrcTexture: IDirect3DBaseTexture8; + pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx8dll name 'D3DXSaveTextureToFileW'; +{$EXTERNALSYM D3DXSaveTextureToFileW} + +function D3DXSaveTextureToFile( + pDestFile: PChar; + DestFormat: TD3DXImageFileFormat; + pSrcTexture: IDirect3DBaseTexture8; + pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx8dll name 'D3DXSaveTextureToFileA'; +{$EXTERNALSYM D3DXSaveTextureToFile} + + + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXFilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// pPalette +// 256 color palette to be used, or NULL for non-palettized formats +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// Filter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// +//------------------------------------------------------------------------- + +function D3DXFilterTexture( + pTexture: IDirect3DTexture8; + pPalette: PPaletteEntry; + SrcLevel: LongWord; + Filter: DWord): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXFilterTexture} + +// #define D3DXFilterCubeTexture D3DXFilterTexture +// In Pascal this mapped to DLL-exported "D3DXFilterTexture" function +function D3DXFilterCubeTexture( + pTexture: IDirect3DCubeTexture8; + pPalette: PPaletteEntry; + SrcLevel: LongWord; + Filter: DWord): HResult; stdcall; external d3dx8dll name 'D3DXFilterTexture'; +{$EXTERNALSYM D3DXFilterCubeTexture} + +// #define D3DXFilterVolumeTexture D3DXFilterTexture +// In Pascal this mapped to DLL-exported "D3DXFilterTexture" function +function D3DXFilterVolumeTexture( + pTexture: IDirect3DVolumeTexture8; + pPalette: PPaletteEntry; + SrcLevel: LongWord; + Filter: DWord): HResult; stdcall; external d3dx8dll name 'D3DXFilterTexture'; +{$EXTERNALSYM D3DXFilterVolumeTexture} + + + +//---------------------------------------------------------------------------- +// D3DXFillTexture: +// ---------------- +// Uses a user provided function to fill each texel of each mip level of a +// given texture. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pFunction +// Pointer to user provided evalutor function which will be used to +// compute the value of each texel. +// pData +// Pointer to an arbitrary block of user defined data. This pointer +// will be passed to the function provided in pFunction +//----------------------------------------------------------------------------- + +function D3DXFillTexture( + pTexture: IDirect3DTexture8; + pFunction: TD3DXFill2D; + const pData): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXFillTexture} + +function D3DXFillCubeTexture( + pCubeTexture: IDirect3DCubeTexture8; + pFunction: TD3DXFill2D; + const pData): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXFillCubeTexture} + +function D3DXFillVolumeTexture( + pVolumeTexture: IDirect3DVolumeTexture8; + pFunction: TD3DXFill3D; + const pData): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXFillVolumeTexture} + + + +//---------------------------------------------------------------------------- +// D3DXComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pTexture +// Pointer to the destination texture +// pSrcTexture +// Pointer to the source heightmap texture +// pSrcPalette +// Source palette of 256 colors, or NULL +// Flags +// D3DX_NORMALMAP flags +// Channel +// D3DX_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +//--------------------------------------------------------------------------- + +function D3DXComputeNormalMap( + pTexture: IDirect3DTexture8; + pSrcTexture: IDirect3DTexture8; + pSrcPalette: PPaletteEntry; + Flags: DWord; + Channel: DWord; + Amplitude: Single): HResult; stdcall; external d3dx8dll; +{$EXTERNALSYM D3DXComputeNormalMap} + + + +//******************************************************************** +// Introduced types for compatibility with "REVISED" D3DX8.pas translation +// by Ampaze (Tim Baumgarten) from www.Delphi-Jedi.org/DelphiGraphics +type + PD3DXEffect_Desc = PD3DXEffectDesc; + PD3DXImage_Info = PD3DXImageInfo; + PD3DXParameter_Desc = PD3DXParameterDesc; + PD3DXPass_Desc = PD3DXPassDesc; + PD3DXRTE_Desc = PD3DXRTEDesc; + PD3DXRTS_Desc = PD3DXRTSDesc; + PD3DXTechnique_Desc = PD3DXTechniqueDesc; + + TD3DXEffect_Desc = TD3DXEffectDesc; + TD3DXImage_Info = TD3DXImageInfo; + TD3DXParameter_Desc = TD3DXParameterDesc; + TD3DXPass_Desc = TD3DXPassDesc; + TD3DXRTE_Desc = TD3DXRTEDesc; + TD3DXRTS_Desc = TD3DXRTSDesc; + TD3DXTechnique_Desc = TD3DXTechniqueDesc; + + PD3DXImage_FileFormat = PD3DXImageFileFormat; + TD3DXImage_FileFormat = TD3DXImageFileFormat; + +(*$HPPEMIT '} /* namespace D3dx8 */' *) + +//***************************************************************************// +//***************************************************************************// +//***************************************************************************// +implementation +//***************************************************************************// +//***************************************************************************// +//***************************************************************************// + + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8math.h +// Content: D3DX math types and functions +// +////////////////////////////////////////////////////////////////////////////// + + + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== + + +function D3DXToRadian(Degree: Single): Single; +begin + Result:= Degree * (D3DX_PI / 180.0); +end; + +function D3DXToDegree(Radian: Single): Single; +begin + Result:= Radian * (180.0 / D3DX_PI); +end; + + +//-------------------------- +// 2D Vector +//-------------------------- + +function D3DXVector2(_x, _y: Single): TD3DXVector2; +begin + Result.x:= _x; Result.y:= _y; +end; + +function D3DXVector2Equal(const v1, v2: TD3DXVector2): Boolean; +begin + Result:= (v1.x = v2.x) and (v1.y = v2.y); +end; + + +//-------------------------- +// 3D Vector +//-------------------------- +function D3DXVector3(_x, _y, _z: Single): TD3DXVector3; +begin + Result.x:= _x; Result.y:= _y; Result.z:=_z; +end; + +function D3DXVector3Equal(const v1, v2: TD3DXVector3): Boolean; +begin + Result:= (v1.x = v2.x) and (v1.y = v2.y) and (v1.z = v2.z); +end; + + +//-------------------------- +// 4D Vector +//-------------------------- + +function D3DXVector4(_x, _y, _z, _w: Single): TD3DXVector4; +begin + with Result do + begin + x:= _x; y:= _y; z:= _z; w:= _w; + end; +end; + +function D3DXVector4Equal(const v1, v2: TD3DXVector4): Boolean; +begin + Result:= (v1.x = v2.x) and (v1.y = v2.y) and + (v1.z = v2.z) and (v1.w = v2.w); +end; + + +//-------------------------- +// 4D Matrix +//-------------------------- +function D3DXMatrix( + _m00, _m01, _m02, _m03, + _m10, _m11, _m12, _m13, + _m20, _m21, _m22, _m23, + _m30, _m31, _m32, _m33: Single): TD3DXMatrix; +begin + with Result do + begin + m[0,0]:= _m00; m[0,1]:= _m01; m[0,2]:= _m02; m[0,3]:= _m03; + m[1,0]:= _m10; m[1,1]:= _m11; m[1,2]:= _m12; m[1,3]:= _m13; + m[2,0]:= _m20; m[2,1]:= _m21; m[2,2]:= _m22; m[2,3]:= _m23; + m[3,0]:= _m30; m[3,1]:= _m31; m[3,2]:= _m32; m[3,3]:= _m33; + end; +end; + +function D3DXMatrixAdd(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; +var + pOut, p1, p2: PSingle; x: Integer; +begin + pOut:= @mOut._11; p1:= @m1._11; p2:= @m2._11; + for x:= 0 to 15 do + begin + pOut^:= p1^+p2^; + Inc(pOut); Inc(p1); Inc(p2); + end; + Result:= @mOut; +end; + +function D3DXMatrixSubtract(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; +var + pOut, p1, p2: PSingle; x: Integer; +begin + pOut:= @mOut._11; p1:= @m1._11; p2:= @m2._11; + for x:= 0 to 15 do + begin + pOut^:= p1^-p2^; + Inc(pOut); Inc(p1); Inc(p2); + end; + Result:= @mOut; +end; + +function D3DXMatrixMul(out mOut: TD3DXMatrix; const m: TD3DXMatrix; MulBy: Single): PD3DXMatrix; +var + pOut, p: PSingle; x: Integer; +begin + pOut:= @mOut._11; p:= @m._11; + for x:= 0 to 15 do + begin + pOut^:= p^* MulBy; + Inc(pOut); Inc(p); + end; + Result:= @mOut; +end; + +function D3DXMatrixEqual(const m1, m2: TD3DXMatrix): Boolean; +begin + Result:= CompareMem(@m1, @m2, SizeOf(TD3DXMatrix)); +end; + +//-------------------------- +// Quaternion +//-------------------------- +function D3DXQuaternion(_x, _y, _z, _w: Single): TD3DXQuaternion; +begin + with Result do + begin + x:= _x; y:= _y; z:= _z; w:= _w; + end; +end; + +function D3DXQuaternionAdd(const q1, q2: TD3DXQuaternion): TD3DXQuaternion; +begin + with Result do + begin + x:= q1.x+q2.x; y:= q1.y+q2.y; z:= q1.z+q2.z; w:= q1.w+q2.w; + end; +end; + +function D3DXQuaternionSubtract(const q1, q2: TD3DXQuaternion): TD3DXQuaternion; +begin + with Result do + begin + x:= q1.x-q2.x; y:= q1.y-q2.y; z:= q1.z-q2.z; w:= q1.w-q2.w; + end; +end; + +function D3DXQuaternionEqual(const q1, q2: TD3DXQuaternion): Boolean; +begin + Result:= (q1.x = q2.x) and (q1.y = q2.y) and + (q1.z = q2.z) and (q1.w = q2.w); +end; + +function D3DXQuaternionScale(out qOut: TD3DXQuaternion; const q: TD3DXQuaternion; + s: Single): PD3DXQuaternion; +begin + with qOut do + begin + x:= q.x*s; y:= q.y*s; z:= q.z*s; w:= q.w*s; + end; + Result:= @qOut; +end; + + +//-------------------------- +// Plane +//-------------------------- + +function D3DXPlane(_a, _b, _c, _d: Single): TD3DXPlane; +begin + with Result do + begin + a:= _a; b:= _b; c:= _c; d:= _d; + end; +end; + +function D3DXPlaneEqual(const p1, p2: TD3DXPlane): Boolean; +begin + Result:= + (p1.a = p2.a) and (p1.b = p2.b) and + (p1.c = p2.c) and (p1.d = p2.d); +end; + + +//-------------------------- +// Color +//-------------------------- + +function D3DXColor(_r, _g, _b, _a: Single): TD3DXColor; +begin + with Result do + begin + r:= _r; g:= _g; b:= _b; a:= _a; + end; +end; + +function D3DXColorToDWord(c: TD3DXColor): DWord; + + function ColorLimit(const x: Single): DWord; + begin + if x > 1.0 then Result:= 255 + else if x < 0 then Result:= 0 + else Result:= Trunc(x * 255.0 + 0.5); + end; +begin + Result:= ColorLimit(c.a) shl 24 or ColorLimit(c.r) shl 16 + or ColorLimit(c.g) shl 8 or ColorLimit(c.b); +end; + +function D3DXColorFromDWord(c: DWord): TD3DXColor; +const + f: Single = 1/255; +begin + with Result do + begin + r:= f * Byte(c shr 16); + g:= f * Byte(c shr 8); + b:= f * Byte(c shr 0); + a:= f * Byte(c shr 24); + end; +end; + +function D3DXColorEqual(const c1, c2: TD3DXColor): Boolean; +begin + Result:= (c1.r = c2.r) and (c1.g = c2.g) and (c1.b = c2.b) and (c1.a = c2.a); +end; + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// 2D Vector +//-------------------------- + +// "inline" +function D3DXVec2Length(const v: TD3DXVector2): Single; +begin + with v do Result:= Sqrt(x*x + y*y); +end; + +function D3DXVec2LengthSq(const v: TD3DXVector2): Single; +begin + with v do Result:= x*x + y*y; +end; + +function D3DXVec2Dot(const v1, v2: TD3DXVector2): Single; +begin + Result:= v1.x*v2.x + v1.y*v2.y; +end; + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +function D3DXVec2CCW(const v1, v2: TD3DXVector2): Single; +begin + Result:= v1.x*v2.y - v1.y*v2.x; +end; + +function D3DXVec2Add(const v1, v2: TD3DXVector2): TD3DXVector2; +begin + Result.x:= v1.x + v2.x; + Result.y:= v1.y + v2.y; +end; + +function D3DXVec2Subtract(const v1, v2: TD3DXVector2): TD3DXVector2; +begin + Result.x:= v1.x - v2.x; + Result.y:= v1.y - v2.y; +end; + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +function D3DXVec2Minimize(out vOut: TD3DXVector2; const v1, v2: TD3DXVEctor2): PD3DXVector2; +begin + if v1.x < v2.x then vOut.x:= v1.x else vOut.y:= v2.x; + if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + Result:= @vOut; +end; + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +function D3DXVec2Maximize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2; +begin + if v1.x > v2.x then vOut.x:= v1.x else vOut.y:= v2.x; + if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + Result:= @vOut; +end; + +function D3DXVec2Scale(out vOut: TD3DXVector2; const v: TD3DXVector2; s: Single): PD3DXVector2; +begin + vOut.x:= v.x*s; vOut.y:= v.y*s; + Result:= @vOut; +end; + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec2Lerp(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2; s: Single): PD3DXVector2; +begin + vOut.x:= v1.x + s * (v2.x-v1.x); + vOut.y:= v1.y + s * (v2.y-v1.y); + Result:= @vOut; +end; + + +//-------------------------- +// 3D Vector +//-------------------------- +function D3DXVec3Length(const v: TD3DXVector3): Single; +begin + with v do Result:= Sqrt(x*x + y*y + z*z); +end; + +function D3DXVec3LengthSq(const v: TD3DXVector3): Single; +begin + with v do Result:= x*x + y*y + z*z; +end; + +function D3DXVec3Dot(const v1, v2: TD3DXVector3): Single; +begin + Result:= v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; +end; + +function D3DXVec3Cross(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + vOut.x:= v1.y * v2.z - v1.z * v2.y; + vOut.y:= v1.z * v2.x - v1.x * v2.z; + vOut.z:= v1.x * v2.y - v1.y * v2.x; + Result:= @vOut; +end; + +function D3DXVec3Add(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + with vOut do + begin + x:= v1.x + v2.x; + y:= v1.y + v2.y; + z:= v1.z + v2.z; + end; + Result:= @vOut; +end; + +function D3DXVec3Subtract(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + with vOut do + begin + x:= v1.x - v2.x; + y:= v1.y - v2.y; + z:= v1.z - v2.z; + end; + Result:= @vOut; +end; + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +function D3DXVec3Minimize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + if v1.x < v2.x then vOut.x:= v1.x else vOut.x:= v2.x; + if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + if v1.z < v2.z then vOut.z:= v1.z else vOut.z:= v2.z; + Result:= @vOut; +end; + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +function D3DXVec3Maximize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + if v1.x > v2.x then vOut.x:= v1.x else vOut.x:= v2.x; + if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + if v1.z > v2.z then vOut.z:= v1.z else vOut.z:= v2.z; + Result:= @vOut; +end; + +function D3DXVec3Scale(out vOut: TD3DXVector3; const v: TD3DXVector3; s: Single): PD3DXVector3; +begin + with vOut do + begin + x:= v.x * s; y:= v.y * s; z:= v.z * s; + end; + Result:= @vOut; +end; + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec3Lerp(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3; s: Single): PD3DXVector3; +begin + vOut.x:= v1.x + s * (v2.x-v1.x); + vOut.y:= v1.y + s * (v2.y-v1.y); + vOut.z:= v1.z + s * (v2.z-v1.z); + Result:= @vOut; +end; + + +//-------------------------- +// 4D Vector +//-------------------------- + +function D3DXVec4Length(const v: TD3DXVector4): Single; +begin + with v do Result:= Sqrt(x*x + y*y + z*z + w*w); +end; + +function D3DXVec4LengthSq(const v: TD3DXVector4): Single; +begin + with v do Result:= x*x + y*y + z*z + w*w +end; + +function D3DXVec4Dot(const v1, v2: TD3DXVector4): Single; +begin + Result:= v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w; +end; + +function D3DXVec4Add(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +begin + with vOut do + begin + x:= v1.x + v2.x; + y:= v1.y + v2.y; + z:= v1.z + v2.z; + w:= v1.w + v2.w; + end; + Result:= @vOut; +end; + +function D3DXVec4Subtract(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +begin + with vOut do + begin + x:= v1.x - v2.x; + y:= v1.y - v2.y; + z:= v1.z - v2.z; + w:= v1.w - v2.w; + end; + Result:= @vOut; +end; + + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +function D3DXVec4Minimize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +begin + if v1.x < v2.x then vOut.x:= v1.x else vOut.x:= v2.x; + if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + if v1.z < v2.z then vOut.z:= v1.z else vOut.z:= v2.z; + if v1.w < v2.w then vOut.w:= v1.w else vOut.w:= v2.w; + Result:= @vOut; +end; + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +function D3DXVec4Maximize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +begin + if v1.x > v2.x then vOut.x:= v1.x else vOut.x:= v2.x; + if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + if v1.z > v2.z then vOut.z:= v1.z else vOut.z:= v2.z; + if v1.w > v2.w then vOut.w:= v1.w else vOut.w:= v2.w; + Result:= @vOut; +end; + +function D3DXVec4Scale(out vOut: TD3DXVector4; const v: TD3DXVector4; s: Single): PD3DXVector4; +begin + with vOut do + begin + x:= v.x * s; y:= v.y * s; z:= v.z * s; w:= v.w * s; + end; + Result:= @vOut; +end; + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec4Lerp(out vOut: TD3DXVector4; + const v1, v2: TD3DXVector4; s: Single): PD3DXVector4; +begin + with vOut do + begin + x:= v1.x + s * (v2.x - v1.x); + y:= v1.y + s * (v2.y - v1.y); + z:= v1.z + s * (v2.z - v1.z); + w:= v1.w + s * (v2.w - v1.w); + end; + Result:= @vOut; +end; + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline +function D3DXMatrixIdentity(out mOut: TD3DXMatrix): PD3DXMatrix; +begin + FillChar(mOut, SizeOf(mOut), 0); + mOut._11:= 1; mOut._22:= 1; mOut._33:= 1; mOut._44:= 1; + Result:= @mOut; +end; + +function D3DXMatrixIsIdentity(const m: TD3DXMatrix): BOOL; +begin + with m do Result:= + (_11 = 1) and (_12 = 0) and (_13 = 0) and (_14 = 0) and + (_21 = 0) and (_22 = 1) and (_23 = 0) and (_24 = 0) and + (_31 = 0) and (_32 = 0) and (_33 = 1) and (_34 = 0) and + (_41 = 0) and (_42 = 0) and (_43 = 0) and (_44 = 1); +end; + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +function D3DXQuaternionLength(const q: TD3DXQuaternion): Single; +begin + with q do Result:= Sqrt(x*x + y*y + z*z + w*w); +end; + +// Length squared, or "norm" +function D3DXQuaternionLengthSq(const q: TD3DXQuaternion): Single; +begin + with q do Result:= x*x + y*y + z*z + w*w; +end; + +function D3DXQuaternionDot(const q1, q2: TD3DXQuaternion): Single; +begin + Result:= q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; +end; + +function D3DXQuaternionIdentity(out qOut: TD3DXQuaternion): PD3DXQuaternion; +begin + with qOut do + begin + x:= 0; y:= 0; z:= 0; w:= 1.0; + end; + Result:= @qOut; +end; + +function D3DXQuaternionIsIdentity(const q: TD3DXQuaternion): BOOL; +begin + with q do Result:= (x = 0) and (y = 0) and (z = 0) and (w = 1); +end; + +// (-x, -y, -z, w) +function D3DXQuaternionConjugate(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; +begin + with qOut do + begin + x:= -q.x; y:= -q.y; z:= -q.z; w:= q.w; + end; + Result:= @qOut; +end; + + +//-------------------------- +// Plane +//-------------------------- + +// ax + by + cz + dw +function D3DXPlaneDot(const p: TD3DXPlane; const v: TD3DXVector4): Single; +begin + with p,v do Result:= a*x + b*y + c*z + d*w; +end; + +// ax + by + cz + d +function D3DXPlaneDotCoord(const p: TD3DXPlane; const v: TD3DXVector3): Single; +begin + with p,v do Result:= a*x + b*y + c*z + d; +end; + +// ax + by + cz +function D3DXPlaneDotNormal(const p: TD3DXPlane; const v: TD3DXVector3): Single; +begin + with p,v do Result:= a*x + b*y + c*z; +end; + + +//-------------------------- +// Color +//-------------------------- + +// inline + +function D3DXColorNegative(out cOut: TD3DXColor; const c: TD3DXColor): PD3DXColor; +begin + with cOut do + begin + r:= 1.0 - c.r; g:= 1.0 - c.g; b:= 1.0 - c.b; + a:= c.a; + end; + Result:= @cOut; +end; + +function D3DXColorAdd(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor; +begin + with cOut do + begin + r:= c1.r + c2.r; g:= c1.g + c2.g; b:= c1.b + c2.b; + a:= c1.a + c2.a; + end; + Result:= @cOut; +end; + +function D3DXColorSubtract(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor; +begin + with cOut do + begin + r:= c1.r - c2.r; g:= c1.g - c2.g; b:= c1.b - c2.b; + a:= c1.a - c2.a; + end; + Result:= @cOut; +end; + +function D3DXColorScale(out cOut: TD3DXColor; const c: TD3DXColor; s: Single): PD3DXColor; +begin + with cOut do + begin + r:= c.r * s; g:= c.g * s; + b:= c.b * s; a:= c.a * s; + end; + Result:= @cOut; +end; + +// (r1*r2, g1*g2, b1*b2, a1*a2) +function D3DXColorModulate(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor; +begin + with cOut do + begin + r:= c1.r * c2.r; g:= c1.g * c2.g; + b:= c1.b * c2.b; a:= c1.a * c2.a; + end; + Result:= @cOut; +end; + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +function D3DXColorLerp(out cOut: TD3DXColor; const c1,c2: TD3DXColor; s: Single): PD3DXColor; +begin + with cOut do + begin + r:= c1.r + s * (c2.r - c1.r); + g:= c1.g + s * (c2.g - c1.g); + b:= c1.b + s * (c2.b - c1.b); + a:= c1.a + s * (c2.a - c1.a); + end; + Result:= @cOut; +end; + + + + +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8core.h +// Content: D3DX core types and functions +// +/////////////////////////////////////////////////////////////////////////// + + +// Object Pascal support functions for D3DXGetErrorString +function D3DXGetErrorStringA(hr: HResult): String; +var + Buffer: array [0..254] of Char; +begin + D3DXGetErrorString(hr, PAnsiChar(@Buffer), 255); + SetLength(Result, StrLen(PAnsiChar(@Buffer))); + Move(Buffer, Result[1], Length(Result)); +end; + +function D3DXGetErrorStringW(hr: HResult): WideString; + function WStrLen(Str: PWideChar): Integer; + begin + Result := 0; + while Str[Result] <> #0 do Inc(Result); + end; +begin + SetLength(Result, 255); + D3DXGetErrorStringW(hr, PWideChar(Result), Length(Result)); + SetLength(Result, WStrLen(PWideChar(Result))); +end; + + +{$IFNDEF UNICODE} +function D3DXGetErrorString(hr: HResult): String; +var + Buffer: array [0..254] of Char; +begin + D3DXGetErrorString(hr, PAnsiChar(@Buffer), 255); + SetLength(Result, StrLen(PAnsiChar(@Buffer))); + Move(Buffer, Result[1], Length(Result)); +end; +{$ELSE} +function D3DXGetErrorString(hr: HResult): WideString; + function WStrLen(Str: PWideChar): Integer; + begin + Result := 0; + while Str[Result] <> #0 do Inc(Result); + end; +begin + SetLength(Result, 255); + D3DXGetErrorStringW(hr, PWideChar(Result), Length(Result)); + SetLength(Result, WStrLen(PWideChar(Result))); +end; +{$ENDIF} + +end. + diff --git a/Game/Code/lib/DSPack/DirectX9/D3DX9.pas b/Game/Code/lib/DSPack/DirectX9/D3DX9.pas new file mode 100644 index 00000000..ca959df8 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/D3DX9.pas @@ -0,0 +1,7972 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* File: d3dx9.h, d3dx9anim.h, d3dx9core.h, d3dx9effect.h, *} +{* d3dx9math.h, d3dx9math.inl, d3dx9mesh.h, d3dx9shader.h, *} +{* d3dx9shape.h, d3dx9tex.h *} +{* *} +{* Content: Direct3DX 9.0 headers *} +{* *} +{* Direct3DX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 27-Apr-2003 *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{* This File contains only Direct3DX 9.0 Definitions. *} +{* If you want to use previous versions - use D3DX.pas and D3DX8.pas *} +{* *} +{******************************************************************************) +{ } +{ 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 } +{ } +{******************************************************************************} + +// Original source contained in "D3DX9.par" + +{$I DirectX.inc} + +unit D3DX9; + +interface + +// Remove "dot" below to link with debug version of D3DX9 +// (only in JEDI or TMT pascal version) +{.$DEFINE DEBUG} + +// Remove "dot" below to link with separate DLL's (one DLL per part of D3DX9 API) +// instead of monolithic "all-in-one" version of D3DX9 +{.$DEFINE D3DX_SEPARATE} + +// Remove "dot" below to link with Tim Baumgarten D3D9.pas +// note: it currently has bugged definition of D3DMATRIX (on 27-Apr-2003) +{.$DEFINE DXG_COMPAT} + +(*$HPPEMIT '#include "d3dx9.h"' *) +(*$HPPEMIT '#include "dxfile.h"' *) + +// Do not emit "hpp" files to C++Builder +{$NOINCLUDE DXFile} + +(*$HPPEMIT 'namespace D3dx9' *) + +(*$HPPEMIT '{' *) + +uses + Windows, + ActiveX, + SysUtils, + {$IFDEF DXG_COMPAT}D3D9{$ELSE}Direct3D9{$ENDIF}, + DXFile; + +const + //////////// DLL export definitions /////////////////////////////////////// + d3dx9dll ={$IFDEF DEBUG} 'd3dx9d.dll'{$ELSE} 'D3DX9ab.dll'{$ENDIF}; + {$IFDEF DEBUG}{$UNDEF D3DX_SEPARATE}{$ENDIF} + d3dx9mathDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abMath.dll'{$ELSE}d3dx9dll{$ENDIF}; + d3dx9coreDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abCore.dll'{$ELSE}d3dx9dll{$ENDIF}; + d3dx9shaderDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abShader.dll'{$ELSE}d3dx9dll{$ENDIF}; + d3dx9effectDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abEffect.dll'{$ELSE}d3dx9dll{$ENDIF}; + d3dx9meshDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abMesh.dll'{$ELSE}d3dx9dll{$ENDIF}; + d3dx9shapesDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abShapes.dll'{$ELSE}d3dx9dll{$ENDIF}; + d3dx9texDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abTex.dll'{$ELSE}d3dx9dll{$ENDIF}; + d3dx9animDLL = {$IFDEF D3DX_SEPARATE}'d3dx9abAnim.dll'{$ELSE}d3dx9dll{$ENDIF}; + + +{$IFNDEF COMPILER6_UP} +type + PPointer = ^Pointer; + PPAnsiChar = ^PAnsiChar; + +{$ENDIF} +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9.h +// Content: D3DX utility library +// +////////////////////////////////////////////////////////////////////////////// + +const + // #define D3DX_DEFAULT ULONG_MAX + // #define D3DX_DEFAULT ((UINT) -1) + D3DX_DEFAULT = Cardinal(-1); + {$EXTERNALSYM D3DX_DEFAULT} + // #define D3DX_DEFAULT_NONPOW2 ((UINT) -2) + D3DX_DEFAULT_NONPOW2 = Cardinal(-2); + {$EXTERNALSYM D3DX_DEFAULT_NONPOW2} + +var + // #define D3DX_DEFAULT_FLOAT FLT_MAX + // Forced to define as 'var' cos pascal compiler treats all consts as Double + D3DX_DEFAULT_FLOAT: Single = 3.402823466e+38; // max single value + {$EXTERNALSYM D3DX_DEFAULT_FLOAT} + +type + _D3DXERR = HResult; + {$EXTERNALSYM _D3DXERR} + +{$IFDEF DXG_COMPAT} +const + MAKE_D3DHRESULT_R = MAKE_D3DHRESULT; +{$ENDIF} + +const + D3DXERR_CANNOTMODIFYINDEXBUFFER = HResult(MAKE_D3DHRESULT_R or 2900); + {$EXTERNALSYM D3DXERR_CANNOTMODIFYINDEXBUFFER} + D3DXERR_INVALIDMESH = HResult(MAKE_D3DHRESULT_R or 2901); + {$EXTERNALSYM D3DXERR_INVALIDMESH} + D3DXERR_CANNOTATTRSORT = HResult(MAKE_D3DHRESULT_R or 2902); + {$EXTERNALSYM D3DXERR_CANNOTATTRSORT} + D3DXERR_SKINNINGNOTSUPPORTED = HResult(MAKE_D3DHRESULT_R or 2903); + {$EXTERNALSYM D3DXERR_SKINNINGNOTSUPPORTED} + D3DXERR_TOOMANYINFLUENCES = HResult(MAKE_D3DHRESULT_R or 2904); + {$EXTERNALSYM D3DXERR_TOOMANYINFLUENCES} + D3DXERR_INVALIDDATA = HResult(MAKE_D3DHRESULT_R or 2905); + {$EXTERNALSYM D3DXERR_INVALIDDATA} + D3DXERR_LOADEDMESHASNODATA = HResult(MAKE_D3DHRESULT_R or 2906); + {$EXTERNALSYM D3DXERR_LOADEDMESHASNODATA} + D3DXERR_DUPLICATENAMEDFRAGMENT = HResult(MAKE_D3DHRESULT_R or 2907); + {$EXTERNALSYM D3DXERR_DUPLICATENAMEDFRAGMENT} + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9math.h +// Content: D3DX math types and functions +// +////////////////////////////////////////////////////////////////////////////// + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== +const + D3DX_PI: Single = 3.141592654; + {$EXTERNALSYM D3DX_PI} + D3DX_1BYPI: Single = 0.318309886; + {$EXTERNALSYM D3DX_1BYPI} + +//#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f)) +function D3DXToRadian(Degree: Single): Single; +{$EXTERNALSYM D3DXToRadian} +//#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI)) +function D3DXToDegree(Radian: Single): Single; +{$EXTERNALSYM D3DXToDegree} + + + +//=========================================================================== +// +// 16 bit floating point numbers +// +//=========================================================================== + +const + D3DX_16F_DIG = 3; // # of decimal digits of precision + {$EXTERNALSYM D3DX_16F_DIG} + D3DX_16F_EPSILON = 4.8875809e-4; // smallest such that 1.0 + epsilon <> 1.0 + {$EXTERNALSYM D3DX_16F_EPSILON} + D3DX_16F_MANT_DIG = 11; // # of bits in mantissa + {$EXTERNALSYM D3DX_16F_MANT_DIG} + D3DX_16F_MAX = 6.550400e+004; // max value + {$EXTERNALSYM D3DX_16F_MAX} + D3DX_16F_MAX_10_EXP = 4; // max decimal exponent + {$EXTERNALSYM D3DX_16F_MAX_10_EXP} + D3DX_16F_MAX_EXP = 15; // max binary exponent + {$EXTERNALSYM D3DX_16F_MAX_EXP} + D3DX_16F_MIN = 6.1035156e-5; // min positive value + {$EXTERNALSYM D3DX_16F_MIN} + D3DX_16F_MIN_10_EXP = -4; // min decimal exponent + {$EXTERNALSYM D3DX_16F_MIN_10_EXP} + D3DX_16F_MIN_EXP = -12; // min binary exponent + {$EXTERNALSYM D3DX_16F_MIN_EXP} + D3DX_16F_RADIX = 2; // exponent radix + {$EXTERNALSYM D3DX_16F_RADIX} + D3DX_16F_ROUNDS = 1; // addition rounding: near + {$EXTERNALSYM D3DX_16F_ROUNDS} + + +type + (*$HPPEMIT 'typedef D3DXFLOAT16 TD3DXFloat16;' *) + (*$HPPEMIT 'typedef D3DXFLOAT16 *PD3DXFloat16;' *) + PD3DXFloat16 = ^TD3DXFloat16; + {$EXTERNALSYM PD3DXFloat16} + TD3DXFloat16 = packed record + value: Word; + end; + {$NODEFINE TD3DXFloat16} + +// Some pascal equalents of C++ class functions & operators +const D3DXFloat16Zero: TD3DXFloat16 = (value:0); // 0 +function D3DXFloat16(value: Single): TD3DXFloat16; +function D3DXFloat16Equal(const v1, v2: TD3DXFloat16): Boolean; +function D3DXFloat16ToFloat(value: TD3DXFloat16): Single; + + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- +type + (*$HPPEMIT 'typedef D3DXVECTOR2 TD3DXVector2;' *) + (*$HPPEMIT 'typedef D3DXVECTOR2 *PD3DXVector2;' *) + PD3DXVector2 = ^TD3DXVector2; + {$EXTERNALSYM PD3DXVector2} + TD3DXVector2 = packed record + x, y: Single; + end; + {$NODEFINE TD3DXVector2} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector2Zero: TD3DXVector2 = (x:0; y:0); // (0,0) +function D3DXVector2(_x, _y: Single): TD3DXVector2; +function D3DXVector2Equal(const v1, v2: TD3DXVector2): Boolean; + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- +type + (*$HPPEMIT 'typedef D3DXVECTOR2_16F TD3DXVector2_16F;' *) + (*$HPPEMIT 'typedef D3DXVECTOR2_16F *PD3DXVector2_16F;' *) + PD3DXVector2_16F = ^TD3DXVector2_16F; + {$EXTERNALSYM PD3DXVector2_16F} + TD3DXVector2_16F = packed record + x, y: TD3DXFloat16; + end; + {$NODEFINE TD3DXVector2_16F} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector2_16fZero: TD3DXVector2_16F = (x:(value:0); y:(value:0)); // (0,0) +function D3DXVector2_16F(_x, _y: TD3DXFloat16): TD3DXVector2_16F; +function D3DXVector2_16fEqual(const v1, v2: TD3DXVector2_16F): Boolean; +function D3DXVector2_16fFromVector2(const v: TD3DXVector2): TD3DXVector2_16f; +function D3DXVector2FromVector2_16f(const v: TD3DXVector2_16f): TD3DXVector2; + + + +//-------------------------- +// 3D Vector +//-------------------------- +type + (*$HPPEMIT 'typedef D3DXVECTOR3 TD3DXVector3;' *) + (*$HPPEMIT 'typedef D3DXVECTOR3 *PD3DXVector3;' *) + PD3DXVector3 = ^TD3DXVector3; + {$EXTERNALSYM PD3DXVector3} + TD3DXVector3 = TD3DVector; + {$NODEFINE TD3DXVector3} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector3Zero: TD3DXVector3 = (x:0; y:0; z:0); // (0,0,0) +function D3DXVector3(_x, _y, _z: Single): TD3DXVector3; +function D3DXVector3Equal(const v1, v2: TD3DXVector3): Boolean; + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- +type + (*$HPPEMIT 'typedef D3DXVECTOR3_16F TD3DXVector3_16F;' *) + (*$HPPEMIT 'typedef D3DXVECTOR3_16F *PD3DXVector3_16F;' *) + PD3DXVector3_16F = ^TD3DXVector3_16F; + {$EXTERNALSYM PD3DXVector3} + TD3DXVector3_16F = packed record + x, y, z: TD3DXFloat16; + end; + {$NODEFINE TD3DXVector3_16F} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector3_16fZero: TD3DXVector3_16F = (x:(value:0); y:(value:0); z:(value:0)); // (0,0,0) +function D3DXVector3_16F(_x, _y, _z: TD3DXFloat16): TD3DXVector3_16F; +function D3DXVector3_16fEqual(const v1, v2: TD3DXVector3_16F): Boolean; +function D3DXVector3_16fFromVector3(const v: TD3DXVector3): TD3DXVector3_16f; +function D3DXVector3FromVector3_16f(const v: TD3DXVector3_16f): TD3DXVector3; + + + +//-------------------------- +// 4D Vector +//-------------------------- +type + (*$HPPEMIT 'typedef D3DXVECTOR4 TD3DXVector4;' *) + (*$HPPEMIT 'typedef D3DXVECTOR4 *PD3DXVector4;' *) + PD3DXVector4 = ^TD3DXVector4; + {$EXTERNALSYM PD3DXVector4} + TD3DXVector4 = packed record + x, y, z, w: Single; + end; + {$NODEFINE TD3DXVector4} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector4Zero: TD3DXVector4 = (x:0; y:0; z:0; w:0); // (0,0,0,0) +function D3DXVector4(_x, _y, _z, _w: Single): TD3DXVector4; +function D3DXVector4Equal(const v1, v2: TD3DXVector4): Boolean; + + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- +type + (*$HPPEMIT 'typedef D3DXVECTOR4_16F TD3DXVector4_16F;' *) + (*$HPPEMIT 'typedef D3DXVECTOR4_16F *PD3DXVector4_16F;' *) + PD3DXVector4_16F = ^TD3DXVector4_16F; + {$EXTERNALSYM PD3DXVector4_16F} + TD3DXVector4_16F = packed record + x, y, z, w: TD3DXFloat16; + end; + {$NODEFINE TD3DXVector4_16F} + +// Some pascal equalents of C++ class functions & operators +const D3DXVector4_16fZero: TD3DXVector4_16F = (x:(value:0); y:(value:0); z:(value:0); w:(value:0)); // (0,0,0,0) +function D3DXVector4_16F(_x, _y, _z, _w: TD3DXFloat16): TD3DXVector4_16F; +function D3DXVector4_16fEqual(const v1, v2: TD3DXVector4_16F): Boolean; +function D3DXVector4_16fFromVector4(const v: TD3DXVector4): TD3DXVector4_16f; +function D3DXVector4FromVector4_16f(const v: TD3DXVector4_16f): TD3DXVector4; + + + +//=========================================================================== +// +// Matrices +// +//=========================================================================== +type + (*$HPPEMIT 'typedef D3DXMATRIX TD3DXMatrix;' *) + (*$HPPEMIT 'typedef D3DXMATRIX *PD3DXMatrix;' *) + (*$HPPEMIT 'typedef D3DXMATRIX **PPD3DXMatrix;' *) + PPD3DXMatrix = ^PD3DXMatrix; + PD3DXMatrix = ^TD3DXMatrix; + {$EXTERNALSYM PD3DXMatrix} + TD3DXMatrix = TD3DMatrix; + {$NODEFINE TD3DXMatrix} + +// Some pascal equalents of C++ class functions & operators +function D3DXMatrix( + _m00, _m01, _m02, _m03, + _m10, _m11, _m12, _m13, + _m20, _m21, _m22, _m23, + _m30, _m31, _m32, _m33: Single): TD3DXMatrix; +function D3DXMatrixAdd(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; +function D3DXMatrixSubtract(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; +function D3DXMatrixMul(out mOut: TD3DXMatrix; const m: TD3DXMatrix; MulBy: Single): PD3DXMatrix; +function D3DXMatrixEqual(const m1, m2: TD3DXMatrix): Boolean; + + +//--------------------------------------------------------------------------- +// Aligned Matrices +// +// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. +// It aligns matrices on the stack and on the heap or in global scope. +// It does this using __declspec(align(16)) which works on VC7 and on VC 6 +// with the processor pack. Unfortunately there is no way to detect the +// latter so this is turned on only on VC7. On other compilers this is the +// the same as D3DXMATRIX. +// +// Using this class on a compiler that does not actually do the alignment +// can be dangerous since it will not expose bugs that ignore alignment. +// E.g if an object of this class in inside a struct or class, and some code +// memcopys data in it assuming tight packing. This could break on a compiler +// that eventually start aligning the matrix. +//--------------------------------------------------------------------------- + +// Translator comments: None of current pascal compilers can even align data +// inside records to 16 byte boundary, so we just leave aligned matrix +// declaration equal to standart matrix +type + PD3DXMatrixA16 = ^TD3DXMatrixA16; + TD3DXMatrixA16 = TD3DXMatrix; + + +//=========================================================================== +// +// Quaternions +// +//=========================================================================== +type + (*$HPPEMIT 'typedef D3DXQUATERNION TD3DXQuaternion;' *) + PD3DXQuaternion = ^TD3DXQuaternion; + TD3DXQuaternion = packed record + x, y, z, w: Single; + end; + {$NODEFINE TD3DXQuaternion} + +// Some pascal equalents of C++ class functions & operators +function D3DXQuaternion(_x, _y, _z, _w: Single): TD3DXQuaternion; +function D3DXQuaternionAdd(const q1, q2: TD3DXQuaternion): TD3DXQuaternion; +function D3DXQuaternionSubtract(const q1, q2: TD3DXQuaternion): TD3DXQuaternion; +function D3DXQuaternionEqual(const q1, q2: TD3DXQuaternion): Boolean; +function D3DXQuaternionScale(out qOut: TD3DXQuaternion; const q: TD3DXQuaternion; + s: Single): PD3DXQuaternion; + + + +//=========================================================================== +// +// Planes +// +//=========================================================================== +type + (*$HPPEMIT 'typedef D3DXPLANE TD3DXPlane;' *) + PD3DXPlane = ^TD3DXPlane; + TD3DXPlane = packed record + a, b, c, d: Single; + end; + {$NODEFINE TD3DXPlane} + +// Some pascal equalents of C++ class functions & operators +const D3DXPlaneZero: TD3DXPlane = (a:0; b:0; c:0; d:0); // (0,0,0,0) +function D3DXPlane(_a, _b, _c, _d: Single): TD3DXPlane; +function D3DXPlaneEqual(const p1, p2: TD3DXPlane): Boolean; + + +//=========================================================================== +// +// Colors +// +//=========================================================================== +type + (*$HPPEMIT 'typedef D3DXCOLOR TD3DXColor;' *) + (*$HPPEMIT 'typedef D3DXCOLOR *PD3DXColor;' *) + PD3DXColor = PD3DColorValue; + {$EXTERNALSYM PD3DXColor} + TD3DXColor = TD3DColorValue; + {$EXTERNALSYM TD3DXColor} + +function D3DXColor(_r, _g, _b, _a: Single): TD3DXColor; +function D3DXColorToDWord(c: TD3DXColor): DWord; +function D3DXColorFromDWord(c: DWord): TD3DXColor; +function D3DXColorEqual(const c1, c2: TD3DXColor): Boolean; + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// Float16 +//-------------------------- + +// non-inline + +// Converts an array 32-bit floats to 16-bit floats +function D3DXFloat32To16Array(pOut: PD3DXFloat16; pIn: PSingle; n: LongWord): PD3DXFloat16; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXFloat32To16Array} + +// Converts an array 16-bit floats to 32-bit floats +function D3DXFloat16To32Array(pOut: PSingle; pIn: PD3DXFloat16; n: LongWord): PSingle; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXFloat16To32Array} + + +//-------------------------- +// 2D Vector +//-------------------------- + +// inline + +function D3DXVec2Length(const v: TD3DXVector2): Single; +{$EXTERNALSYM D3DXVec2Length} + +function D3DXVec2LengthSq(const v: TD3DXVector2): Single; +{$EXTERNALSYM D3DXVec2LengthSq} + +function D3DXVec2Dot(const v1, v2: TD3DXVector2): Single; +{$EXTERNALSYM D3DXVec2Dot} + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +function D3DXVec2CCW(const v1, v2: TD3DXVector2): Single; +{$EXTERNALSYM D3DXVec2CCW} + +function D3DXVec2Add(const v1, v2: TD3DXVector2): TD3DXVector2; +{$EXTERNALSYM D3DXVec2Add} + +function D3DXVec2Subtract(const v1, v2: TD3DXVector2): TD3DXVector2; +{$EXTERNALSYM D3DXVec2Subtract} + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +function D3DXVec2Minimize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2; +{$EXTERNALSYM D3DXVec2Minimize} + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +function D3DXVec2Maximize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2; +{$EXTERNALSYM D3DXVec2Maximize} + +function D3DXVec2Scale(out vOut: TD3DXVector2; const v: TD3DXVector2; s: Single): PD3DXVector2; +{$EXTERNALSYM D3DXVec2Scale} + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec2Lerp(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2; s: Single): PD3DXVector2; +{$EXTERNALSYM D3DXVec2Lerp} + +// non-inline +function D3DXVec2Normalize(out vOut: TD3DXVector2; const v: TD3DXVector2): PD3DXVector2; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2Normalize} + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +function D3DXVec2Hermite(out vOut: TD3DXVector2; + const v1, t1, v2, t2: TD3DXVector2; s: Single): PD3DXVector2; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2Hermite} + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +function D3DXVec2CatmullRom(out vOut: TD3DXVector2; + const v0, v1, v2: TD3DXVector2; s: Single): PD3DXVector2; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2CatmullRom} + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +function D3DXVec2BaryCentric(out vOut: TD3DXVector2; + const v1, v2, v3: TD3DXVector2; f, g: Single): PD3DXVector2; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2BaryCentric} + +// Transform (x, y, 0, 1) by matrix. +function D3DXVec2Transform(out vOut: TD3DXVector4; + const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2Transform} + +// Transform (x, y, 0, 1) by matrix, project result back into w=1. +function D3DXVec2TransformCoord(out vOut: TD3DXVector2; + const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector2; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2TransformCoord} + +// Transform (x, y, 0, 0) by matrix. +function D3DXVec2TransformNormal(out vOut: TD3DXVector2; + const v: TD3DXVector2; const m: TD3DXMatrix): PD3DXVector2; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2TransformNormal} + + +// Transform Array (x, y, 0, 1) by matrix. +function D3DXVec2TransformArray(pOut: PD3DXVector4; OutStride: LongWord; + pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2TransformArray} + +// Transform Array (x, y, 0, 1) by matrix, project result back into w=1. +function D3DXVec2TransformCoordArray(pOut: PD3DXVector2; OutStride: LongWord; + pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector2; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2TransformCoordArray} + +// Transform Array (x, y, 0, 0) by matrix. +function D3DXVec2TransformNormalArray(pOut: PD3DXVector2; OutStride: LongWord; + pV: PD3DXVector2; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector2; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec2TransformNormalArray} + + +//-------------------------- +// 3D Vector +//-------------------------- + +// inline + +function D3DXVec3Length(const v: TD3DXVector3): Single; +{$EXTERNALSYM D3DXVec3Length} + +function D3DXVec3LengthSq(const v: TD3DXVector3): Single; +{$EXTERNALSYM D3DXVec3LengthSq} + +function D3DXVec3Dot(const v1, v2: TD3DXVector3): Single; +{$EXTERNALSYM D3DXVec3Dot} + +function D3DXVec3Cross(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Cross} + +function D3DXVec3Add(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Add} + +function D3DXVec3Subtract(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Subtract} + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +function D3DXVec3Minimize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Minimize} + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +function D3DXVec3Maximize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Maximize} + +function D3DXVec3Scale(out vOut: TD3DXVector3; const v: TD3DXVector3; s: Single): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Scale} + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec3Lerp(out vOut: TD3DXVector3; + const v1, v2: TD3DXVector3; s: Single): PD3DXVector3; +{$EXTERNALSYM D3DXVec3Lerp} + +// non-inline + +function D3DXVec3Normalize(out vOut: TD3DXVector3; + const v: TD3DXVector3): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3Normalize} + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +function D3DXVec3Hermite(out vOut: TD3DXVector3; + const v1, t1, v2, t2: TD3DXVector3; s: Single): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3Hermite} + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +function D3DXVec3CatmullRom(out vOut: TD3DXVector3; + const v1, v2, v3: TD3DXVector3; s: Single): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3CatmullRom} + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +function D3DXVec3BaryCentric(out vOut: TD3DXVector3; + const v1, v2, v3: TD3DXVector3; f, g: Single): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3BaryCentric} + +// Transform (x, y, z, 1) by matrix. +function D3DXVec3Transform(out vOut: TD3DXVector4; + const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3Transform} + +// Transform (x, y, z, 1) by matrix, project result back into w=1. +function D3DXVec3TransformCoord(out vOut: TD3DXVector3; + const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3TransformCoord} + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +function D3DXVec3TransformNormal(out vOut: TD3DXVector3; + const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3TransformNormal} + + +// Transform Array (x, y, z, 1) by matrix. +function D3DXVec3TransformArray(pOut: PD3DXVector4; OutStride: LongWord; + pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3TransformArray} + +// Transform Array (x, y, z, 1) by matrix, project result back into w=1. +function D3DXVec3TransformCoordArray(pOut: PD3DXVector3; OutStride: LongWord; + pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3TransformCoordArray} + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +function D3DXVec3TransformNormalArray(pOut: PD3DXVector3; OutStride: LongWord; + pV: PD3DXVector3; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3TransformNormalArray} + +// Project vector from object space into screen space +function D3DXVec3Project(out vOut: TD3DXVector3; + const v: TD3DXVector3; const pViewport: TD3DViewport9; + const pProjection, pView, pWorld: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3Project} + +// Project vector from screen space into object space +function D3DXVec3Unproject(out vOut: TD3DXVector3; + const v: TD3DXVector3; const pViewport: TD3DViewport9; + const pProjection, pView, pWorld: TD3DXMatrix): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3Unproject} + +// Project vector Array from object space into screen space +function D3DXVec3ProjectArray(pOut: PD3DXVector3; OutStride: LongWord; + pV: PD3DXVector3; VStride: LongWord; const pViewport: TD3DViewport9; + const pProjection, pView, pWorld: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3ProjectArray} + +// Project vector Array from screen space into object space +function D3DXVec3UnprojectArray(pOut: PD3DXVector3; OutStride: LongWord; + pV: PD3DXVector3; VStride: LongWord; const pViewport: TD3DViewport9; + const pProjection, pView, pWorld: TD3DXMatrix; n: LongWord): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec3UnprojectArray} + + +//-------------------------- +// 4D Vector +//-------------------------- + +// inline + +function D3DXVec4Length(const v: TD3DXVector4): Single; +{$EXTERNALSYM D3DXVec4Length} + +function D3DXVec4LengthSq(const v: TD3DXVector4): Single; +{$EXTERNALSYM D3DXVec4LengthSq} + +function D3DXVec4Dot(const v1, v2: TD3DXVector4): Single; +{$EXTERNALSYM D3DXVec4Dot} + +function D3DXVec4Add(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Add} + +function D3DXVec4Subtract(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Subtract} + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +function D3DXVec4Minimize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Minimize} + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +function D3DXVec4Maximize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Maximize} + +function D3DXVec4Scale(out vOut: TD3DXVector4; const v: TD3DXVector4; s: Single): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Scale} + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec4Lerp(out vOut: TD3DXVector4; + const v1, v2: TD3DXVector4; s: Single): PD3DXVector4; +{$EXTERNALSYM D3DXVec4Lerp} + +// non-inline + +// Cross-product in 4 dimensions. +function D3DXVec4Cross(out vOut: TD3DXVector4; + const v1, v2, v3: TD3DXVector4): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec4Cross} + +function D3DXVec4Normalize(out vOut: TD3DXVector4; + const v: TD3DXVector4): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec4Normalize} + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +function D3DXVec4Hermite(out vOut: TD3DXVector4; + const v1, t1, v2, t2: TD3DXVector4; s: Single): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec4Hermite} + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +function D3DXVec4CatmullRom(out vOut: TD3DXVector4; + const v0, v1, v2, v3: TD3DXVector4; s: Single): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec4CatmullRom} + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +function D3DXVec4BaryCentric(out vOut: TD3DXVector4; + const v1, v2, v3: TD3DXVector4; f, g: Single): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec4BaryCentric} + +// Transform vector by matrix. +function D3DXVec4Transform(out vOut: TD3DXVector4; + const v: TD3DXVector4; const m: TD3DXMatrix): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec4Transform} + +// Transform vector array by matrix. +function D3DXVec4TransformArray(pOut: PD3DXVector4; OutStride: LongWord; + pV: PD3DXVector4; VStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXVector4; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXVec4TransformArray} + + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline + +function D3DXMatrixIdentity(out mOut: TD3DXMatrix): PD3DXMatrix; +{$EXTERNALSYM D3DXMatrixIdentity} + +function D3DXMatrixIsIdentity(const m: TD3DXMatrix): BOOL; +{$EXTERNALSYM D3DXMatrixIsIdentity} + +// non-inline + +function D3DXMatrixDeterminant(const m: TD3DXMatrix): Single; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixDeterminant} + +function D3DXMatrixTranspose(out pOut: TD3DXMatrix; const pM: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixTranspose} + +// Matrix multiplication. The result represents the transformation M2 +// followed by the transformation M1. (Out = M1 * M2) +function D3DXMatrixMultiply(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixMultiply} + +// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +function D3DXMatrixMultiplyTranspose(out pOut: TD3DXMatrix; const pM1, pM2: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixMultiplyTranspose} + +// Calculate inverse of matrix. Inversion my fail, in which case NULL will +// be returned. The determinant of pM is also returned it pfDeterminant +// is non-NULL. +function D3DXMatrixInverse(out mOut: TD3DXMatrix; pfDeterminant: PSingle; + const m: TD3DXMatrix): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixInverse} + +// Build a matrix which scales by (sx, sy, sz) +function D3DXMatrixScaling(out mOut: TD3DXMatrix; sx, sy, sz: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixScaling} + +// Build a matrix which translates by (x, y, z) +function D3DXMatrixTranslation(out mOut: TD3DXMatrix; x, y, z: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixTranslation} + +// Build a matrix which rotates around the X axis +function D3DXMatrixRotationX(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixRotationX} + +// Build a matrix which rotates around the Y axis +function D3DXMatrixRotationY(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixRotationY} + +// Build a matrix which rotates around the Z axis +function D3DXMatrixRotationZ(out mOut: TD3DXMatrix; angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixRotationZ} + +// Build a matrix which rotates around an arbitrary axis +function D3DXMatrixRotationAxis(out mOut: TD3DXMatrix; const v: TD3DXVector3; + angle: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixRotationAxis} + +// Build a matrix from a quaternion +function D3DXMatrixRotationQuaternion(out mOut: TD3DXMatrix; const Q: TD3DXQuaternion): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixRotationQuaternion} + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +function D3DXMatrixRotationYawPitchRoll(out mOut: TD3DXMatrix; yaw, pitch, roll: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixRotationYawPitchRoll} + + +// Build transformation matrix. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +function D3DXMatrixTransformation(out mOut: TD3DXMatrix; + pScalingCenter: PD3DXVector3; + pScalingRotation: PD3DXQuaternion; pScaling, pRotationCenter: PD3DXVector3; + pRotation: PD3DXQuaternion; pTranslation: PD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixTransformation} + +// Build affine transformation matrix. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +function D3DXMatrixAffineTransformation(out mOut: TD3DXMatrix; + Scaling: Single; pRotationCenter: PD3DXVector3; + pRotation: PD3DXQuaternion; pTranslation: PD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixAffineTransformation} + +// Build a lookat matrix. (right-handed) +function D3DXMatrixLookAtRH(out mOut: TD3DXMatrix; const Eye, At, Up: TD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixLookAtRH} + +// Build a lookat matrix. (left-handed) +function D3DXMatrixLookAtLH(out mOut: TD3DXMatrix; const Eye, At, Up: TD3DXVector3): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixLookAtLH} + +// Build a perspective projection matrix. (right-handed) +function D3DXMatrixPerspectiveRH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixPerspectiveRH} + +// Build a perspective projection matrix. (left-handed) +function D3DXMatrixPerspectiveLH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixPerspectiveLH} + +// Build a perspective projection matrix. (right-handed) +function D3DXMatrixPerspectiveFovRH(out mOut: TD3DXMatrix; flovy, aspect, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixPerspectiveFovRH} + +// Build a perspective projection matrix. (left-handed) +function D3DXMatrixPerspectiveFovLH(out mOut: TD3DXMatrix; flovy, aspect, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixPerspectiveFovLH} + +// Build a perspective projection matrix. (right-handed) +function D3DXMatrixPerspectiveOffCenterRH(out mOut: TD3DXMatrix; + l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixPerspectiveOffCenterRH} + +// Build a perspective projection matrix. (left-handed) +function D3DXMatrixPerspectiveOffCenterLH(out mOut: TD3DXMatrix; + l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixPerspectiveOffCenterLH} + +// Build an ortho projection matrix. (right-handed) +function D3DXMatrixOrthoRH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixOrthoRH} + +// Build an ortho projection matrix. (left-handed) +function D3DXMatrixOrthoLH(out mOut: TD3DXMatrix; w, h, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixOrthoLH} + +// Build an ortho projection matrix. (right-handed) +function D3DXMatrixOrthoOffCenterRH(out mOut: TD3DXMatrix; + l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixOrthoOffCenterRH} + +// Build an ortho projection matrix. (left-handed) +function D3DXMatrixOrthoOffCenterLH(out mOut: TD3DXMatrix; + l, r, b, t, zn, zf: Single): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixOrthoOffCenterLH} + +// Build a matrix which flattens geometry into a plane, as if casting +// a shadow from a light. +function D3DXMatrixShadow(out mOut: TD3DXMatrix; + const Light: TD3DXVector4; const Plane: TD3DXPlane): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixShadow} + +// Build a matrix which reflects the coordinate system about a plane +function D3DXMatrixReflect(out mOut: TD3DXMatrix; + const Plane: TD3DXPlane): PD3DXMatrix; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXMatrixReflect} + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +function D3DXQuaternionLength(const q: TD3DXQuaternion): Single; +{$EXTERNALSYM D3DXQuaternionLength} + +// Length squared, or "norm" +function D3DXQuaternionLengthSq(const q: TD3DXQuaternion): Single; +{$EXTERNALSYM D3DXQuaternionLengthSq} + +function D3DXQuaternionDot(const q1, q2: TD3DXQuaternion): Single; +{$EXTERNALSYM D3DXQuaternionDot} + +// (0, 0, 0, 1) +function D3DXQuaternionIdentity(out qOut: TD3DXQuaternion): PD3DXQuaternion; +{$EXTERNALSYM D3DXQuaternionIdentity} + +function D3DXQuaternionIsIdentity (const q: TD3DXQuaternion): BOOL; +{$EXTERNALSYM D3DXQuaternionIsIdentity} + +// (-x, -y, -z, w) +function D3DXQuaternionConjugate(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; +{$EXTERNALSYM D3DXQuaternionConjugate} + + +// non-inline + +// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +procedure D3DXQuaternionToAxisAngle(const q: TD3DXQuaternion; + out Axis: TD3DXVector3; out Angle: Single); stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionToAxisAngle} + +// Build a quaternion from a rotation matrix. +function D3DXQuaternionRotationMatrix(out qOut: TD3DXQuaternion; + const m: TD3DXMatrix): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionRotationMatrix} + +// Rotation about arbitrary axis. +function D3DXQuaternionRotationAxis(out qOut: TD3DXQuaternion; + const v: TD3DXVector3; Angle: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionRotationAxis} + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +function D3DXQuaternionRotationYawPitchRoll(out qOut: TD3DXQuaternion; + yaw, pitch, roll: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionRotationYawPitchRoll} + +// Quaternion multiplication. The result represents the rotation Q2 +// followed by the rotation Q1. (Out = Q2 * Q1) +function D3DXQuaternionMultiply(out qOut: TD3DXQuaternion; + const q1, q2: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionMultiply} + +function D3DXQuaternionNormalize(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionNormalize} + +// Conjugate and re-norm +function D3DXQuaternionInverse(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionInverse} + +// Expects unit quaternions. +// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +function D3DXQuaternionLn(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionLn} + +// Expects pure quaternions. (w == 0) w is ignored in calculation. +// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +function D3DXQuaternionExp(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionExp} + +// Spherical linear interpolation between Q1 (s == 0) and Q2 (s == 1). +// Expects unit quaternions. +function D3DXQuaternionSlerp(out qOut: TD3DXQuaternion; + const q1, q2: TD3DXQuaternion; t: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionSlerp} + +// Spherical quadrangle interpolation. +// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +function D3DXQuaternionSquad(out qOut: TD3DXQuaternion; + const pQ1, pA, pB, pC: TD3DXQuaternion; t: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionSquad} + +// Setup control points for spherical quadrangle interpolation +// from Q1 to Q2. The control points are chosen in such a way +// to ensure the continuity of tangents with adjacent segments. +procedure D3DXQuaternionSquadSetup(out pAOut, pBOut, pCOut: TD3DXQuaternion; + const pQ0, pQ1, pQ2, pQ3: TD3DXQuaternion); stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionSquadSetup} + +// Barycentric interpolation. +// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +function D3DXQuaternionBaryCentric(out qOut: TD3DXQuaternion; + const q1, q2, q3: TD3DXQuaternion; f, g: Single): PD3DXQuaternion; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXQuaternionBaryCentric} + + +//-------------------------- +// Plane +//-------------------------- + +// inline + +// ax + by + cz + dw +function D3DXPlaneDot(const p: TD3DXPlane; const v: TD3DXVector4): Single; +{$EXTERNALSYM D3DXPlaneDot} + +// ax + by + cz + d +function D3DXPlaneDotCoord(const p: TD3DXPlane; const v: TD3DXVector3): Single; +{$EXTERNALSYM D3DXPlaneDotCoord} + +// ax + by + cz +function D3DXPlaneDotNormal(const p: TD3DXPlane; const v: TD3DXVector3): Single; +{$EXTERNALSYM D3DXPlaneDotNormal} + + +// non-inline + +// Normalize plane (so that |a,b,c| == 1) +function D3DXPlaneNormalize(out pOut: TD3DXPlane; const p: TD3DXPlane): PD3DXPlane; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXPlaneNormalize} + +// Find the intersection between a plane and a line. If the line is +// parallel to the plane, NULL is returned. +function D3DXPlaneIntersectLine(out vOut: TD3DXVector3; + const p: TD3DXPlane; const v1, v2: TD3DXVector3): PD3DXVector3; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXPlaneIntersectLine} + +// Construct a plane from a point and a normal +function D3DXPlaneFromPointNormal(out pOut: TD3DXPlane; + const vPoint, vNormal: TD3DXVector3): PD3DXPlane; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXPlaneFromPointNormal} + +// Construct a plane from 3 points +function D3DXPlaneFromPoints(out pOut: TD3DXPlane; + const v1, v2, v3: TD3DXVector3): PD3DXPlane; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXPlaneFromPoints} + +// Transform a plane by a matrix. The vector (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +function D3DXPlaneTransform(out pOut: TD3DXPlane; const m: TD3DXMatrix): PD3DXPlane; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXPlaneTransform} + +// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +function D3DXPlaneTransformArray(pOut: PD3DXPlane; OutStride: LongWord; + pP: PD3DXPlane; PStride: LongWord; const m: TD3DXMatrix; n: LongWord): PD3DXPlane; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXPlaneTransformArray} + + +//-------------------------- +// Color +//-------------------------- + +// inline + +// (1-r, 1-g, 1-b, a) +function D3DXColorNegative(out cOut: TD3DXColor; const c: TD3DXColor): PD3DXColor; +{$EXTERNALSYM D3DXColorNegative} + +function D3DXColorAdd(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor; +{$EXTERNALSYM D3DXColorAdd} + +function D3DXColorSubtract(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor; +{$EXTERNALSYM D3DXColorSubtract} + +function D3DXColorScale(out cOut: TD3DXColor; const c: TD3DXColor; s: Single): PD3DXColor; +{$EXTERNALSYM D3DXColorScale} + +// (r1*r2, g1*g2, b1*b2, a1*a2) +function D3DXColorModulate(out cOut: TD3DXColor; const c1, c2: TD3DXColor): PD3DXColor; +{$EXTERNALSYM D3DXColorModulate} + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +function D3DXColorLerp(out cOut: TD3DXColor; const c1, c2: TD3DXColor; s: Single): PD3DXColor; +{$EXTERNALSYM D3DXColorLerp} + +// non-inline + +// Interpolate r,g,b between desaturated color and color. +// DesaturatedColor + s(Color - DesaturatedColor) +function D3DXColorAdjustSaturation(out cOut: TD3DXColor; + const pC: TD3DXColor; s: Single): PD3DXColor; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXColorAdjustSaturation} + +// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +function D3DXColorAdjustContrast(out cOut: TD3DXColor; + const pC: TD3DXColor; c: Single): PD3DXColor; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXColorAdjustContrast} + + +//-------------------------- +// Misc +//-------------------------- + +// Calculate Fresnel term given the cosine of theta (likely obtained by +// taking the dot of two normals), and the refraction index of the material. +function D3DXFresnelTerm(CosTheta, RefractionIndex: Single): Single; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXFresnelTerm} + + + +//=========================================================================== +// +// Matrix Stack +// +//=========================================================================== + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXMatrixStack);'} + {$EXTERNALSYM ID3DXMatrixStack} + ID3DXMatrixStack = interface(IUnknown) + ['{E3357330-CC5E-11d2-A434-00A0C90629A8}'] + // + // ID3DXMatrixStack methods + // + + // Pops the top of the stack, returns the current top + // *after* popping the top. + function Pop: HResult; stdcall; + + // Pushes the stack by one, duplicating the current matrix. + function Push: HResult; stdcall; + + // Loads identity in the current matrix. + function LoadIdentity: HResult; stdcall; + + // Loads the given matrix into the current matrix + function LoadMatrix(const M: TD3DXMatrix): HResult; stdcall; + + // Right-Multiplies the given matrix to the current matrix. + // (transformation is about the current world origin) + function MultMatrix(const M: TD3DXMatrix): HResult; stdcall; + + // Left-Multiplies the given matrix to the current matrix + // (transformation is about the local origin of the object) + function MultMatrixLocal(const M: TD3DXMatrix): HResult; stdcall; + + // Right multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the current world origin) + function RotateAxis(const V: TD3DXVector3; Angle: Single): HResult; stdcall; + + // Left multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the local origin of the object) + function RotateAxisLocal(const V: TD3DXVector3; Angle: Single): HResult; stdcall; + + // Right multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // current world origin) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + function RotateYawPitchRoll(yaw, pitch, roll: Single): HResult; stdcall; + + // Left multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // local origin of the object) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + function RotateYawPitchRollLocal(yaw, pitch, roll: Single): HResult; stdcall; + + // Right multiply the current matrix with the computed scale + // matrix. (transformation is about the current world origin) + function Scale(x, y, z: Single): HResult; stdcall; + + // Left multiply the current matrix with the computed scale + // matrix. (transformation is about the local origin of the object) + function ScaleLocal(x, y, z: Single): HResult; stdcall; + + // Right multiply the current matrix with the computed translation + // matrix. (transformation is about the current world origin) + function Translate(x, y, z: Single): HResult; stdcall; + + // Left multiply the current matrix with the computed translation + // matrix. (transformation is about the local origin of the object) + function TranslateLocal(x, y, z: Single): HResult; stdcall; + + // Obtain the current matrix at the top of the stack + function GetTop: PD3DXMatrix; stdcall; + end; + +type + IID_ID3DXMatrixStack = ID3DXMatrixStack; + {$EXTERNALSYM IID_ID3DXMatrixStack} + +function D3DXCreateMatrixStack(Flags: DWord; out Stack: ID3DXMatrixStack): HResult; stdcall; external d3dx9mathDLL; +{$EXTERNALSYM D3DXCreateMatrixStack} + + + + + + + +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9core.h +// Content: D3DX core types and functions +// +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////// +// D3DX_SDK_VERSION: +// ----------------- +// This identifier is passed to D3DXCheckVersion in order to ensure that an +// application was built against the correct header files and lib files. +// This number is incremented whenever a header (or other) change would +// require applications to be rebuilt. If the version doesn't match, +// D3DXCreateVersion will return FALSE. (The number itself has no meaning.) +/////////////////////////////////////////////////////////////////////////// + +const + D3DX_VERSION = 0900; + {$EXTERNALSYM D3DX_VERSION} + D3DX_SDK_VERSION = 9; + {$EXTERNALSYM D3DX_SDK_VERSION} + +function D3DXCheckVersion(D3DSdkVersion, D3DXSdkVersion: LongWord): BOOL; stdcall; external d3dx9coreDLL; +{$EXTERNALSYM D3DXCheckVersion} + + + +/////////////////////////////////////////////////////////////////////////// +// D3DXGetDriverLevel: +// Returns driver version information: +// +// 700 - DX7 level driver +// 800 - DX8 level driver +// 900 - DX9 level driver +/////////////////////////////////////////////////////////////////////////// + +function D3DXGetDriverLevel(pDevice: IDirect3DDevice9): LongWord; stdcall; external d3dx9coreDLL; +{$EXTERNALSYM D3DXGetDriverLevel} + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXBuffer: +// ------------ +// The buffer object is used by D3DX to return arbitrary size data. +// +// GetBufferPointer - +// Returns a pointer to the beginning of the buffer. +// +// GetBufferSize - +// Returns the size of the buffer, in bytes. +/////////////////////////////////////////////////////////////////////////// + +type + PID3DXBuffer = ^ID3DXBuffer; + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBuffer);'} + {$EXTERNALSYM ID3DXBuffer} + ID3DXBuffer = interface(IUnknown) + ['{932E6A7E-C68E-45dd-A7BF-53D19C86DB1F}'] + // ID3DXBuffer + function GetBufferPointer: Pointer; stdcall; + function GetBufferSize: DWord; stdcall; + end; + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXFont: +// ---------- +// Font objects contain the textures and resources needed to render +// a specific font on a specific device. +// +// Begin - +// Prepartes device for drawing text. This is optional.. if DrawText +// is called outside of Begin/End, it will call Begin and End for you. +// +// DrawText - +// Draws formatted text on a D3D device. Some parameters are +// surprisingly similar to those of GDI's DrawText function. See GDI +// documentation for a detailed description of these parameters. +// +// End - +// Restores device state to how it was when Begin was called. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +// +/////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXFont);'} + {$EXTERNALSYM ID3DXFont} + ID3DXFont = interface(IUnknown) + ['{4AAE6B4D-D15F-4909-B09F-8D6AA34AC06B}'] + // ID3DXFont + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetLogFont(out pLogFont: TLogFont): HResult; stdcall; + + function _Begin: HResult; stdcall; + function DrawTextA(pString: PAnsiChar; Count: Integer; const pRect: TRect; Format: DWord; Color: TD3DColor): Integer; stdcall; + function DrawTextW(pString: PWideChar; Count: Integer; const pRect: TRect; Format: DWord; Color: TD3DColor): Integer; stdcall; + function _End: HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateFont(pDevice: IDirect3DDevice9; hFont: HFONT; + out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL; +{$EXTERNALSYM D3DXCreateFont} + +function D3DXCreateFontIndirect(pDevice: IDirect3DDevice9; + const pLogFont: TLogFont; out ppFont: ID3DXFont): HResult; stdcall; external d3dx9coreDLL; +{$EXTERNALSYM D3DXCreateFontIndirect} + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXSprite: +// ------------ +// This object intends to provide an easy way to drawing sprites using D3D. +// +// Begin - +// Prepares device for drawing sprites +// +// Draw, DrawAffine, DrawTransform - +// Draws a sprite in screen-space. Before transformation, the sprite is +// the size of SrcRect, with its top-left corner at the origin (0,0). +// The color and alpha channels are modulated by Color. +// +// End - +// Restores device state to how it was when Begin was called. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// +type + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSprite);'} + {$EXTERNALSYM ID3DXSprite} + ID3DXSprite = interface(IUnknown) + ['{B07EC84A-8D35-4e86-A9A0-8DFF21D71075}'] + // ID3DXSprite + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + + function _Begin: HResult; stdcall; + + function Draw(pSrcTexture: IDirect3DTexture9; pSrcRect: PRect; + pScaling, pRotationCenter: PD3DXVector2; Rotation: Single; + pTranslation: PD3DXVector2; Color: TD3DColor): HResult; stdcall; + + function DrawTransform(pSrcTexture: IDirect3DTexture9; pSrcRect: PRect; + const pTransform: TD3DXMatrix; Color: TD3DColor): HResult; stdcall; + + function _End: HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateSprite(ppDevice: IDirect3DDevice9; + out ppSprite: ID3DXSprite): HResult; stdcall; external d3dx9coreDLL; +{$EXTERNALSYM D3DXCreateSprite} + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToSurface: +// --------------------- +// This object abstracts rendering to surfaces. These surfaces do not +// necessarily need to be render targets. If they are not, a compatible +// render target is used, and the result copied into surface at end scene. +// +// BeginScene, EndScene - +// Call BeginScene() and EndScene() at the beginning and ending of your +// scene. These calls will setup and restore render targets, viewports, +// etc.. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// +type + + PD3DXRTSDesc = ^TD3DXRTSDesc; + _D3DXRTS_DESC = packed record + Width: LongWord; + Height: LongWord; + Format: TD3DFormat; + DepthStencil: BOOL; + DepthStencilFormat: TD3DFormat; + end {_D3DXRTS_DESC}; + {$EXTERNALSYM _D3DXRTS_DESC} + D3DXRTS_DESC = _D3DXRTS_DESC; + {$EXTERNALSYM D3DXRTS_DESC} + TD3DXRTSDesc = _D3DXRTS_DESC; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXRenderToSurface);'} + {$EXTERNALSYM ID3DXRenderToSurface} + ID3DXRenderToSurface = interface(IUnknown) + ['{0D014791-8863-4c2c-A1C0-02F3E0C0B653}'] + // ID3DXRenderToSurface + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetDesc(out pDesc: TD3DXRTSDesc): HResult; stdcall; + + function BeginScene(pSurface: IDirect3DSurface9; pViewport: PD3DViewport9): HResult; stdcall; + function EndScene(MipFilter: DWORD): HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateRenderToSurface(ppDevice: IDirect3DDevice9; + Width: LongWord; + Height: LongWord; + Format: TD3DFormat; + DepthStencil: BOOL; + DepthStencilFormat: TD3DFormat; + out ppRenderToSurface: ID3DXRenderToSurface): HResult; stdcall; external d3dx9coreDLL; +{$EXTERNALSYM D3DXCreateRenderToSurface} + + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToEnvMap: +// -------------------- +// This object abstracts rendering to environment maps. These surfaces +// do not necessarily need to be render targets. If they are not, a +// compatible render target is used, and the result copied into the +// environment map at end scene. +// +// BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - +// This function initiates the rendering of the environment map. As +// parameters, you pass the textures in which will get filled in with +// the resulting environment map. +// +// Face - +// Call this function to initiate the drawing of each face. For each +// environment map, you will call this six times.. once for each face +// in D3DCUBEMAP_FACES. +// +// End - +// This will restore all render targets, and if needed compose all the +// rendered faces into the environment map surfaces. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// +type + + PD3DXRTEDesc = ^TD3DXRTEDesc; + _D3DXRTE_DESC = record + Size: LongWord; + MipLevels: LongWord; + Format: TD3DFormat; + DepthStencil: Bool; + DepthStencilFormat: TD3DFormat; + end {_D3DXRTE_DESC}; + {$EXTERNALSYM _D3DXRTE_DESC} + D3DXRTE_DESC = _D3DXRTE_DESC; + {$EXTERNALSYM D3DXRTE_DESC} + TD3DXRTEDesc = _D3DXRTE_DESC; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXRenderToEnvMap);'} + {$EXTERNALSYM ID3DXRenderToEnvMap} + ID3DXRenderToEnvMap = interface(IUnknown) + ['{1561135E-BC78-495b-8586-94EA537BD557}'] + // ID3DXRenderToEnvMap + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetDesc(out pDesc: TD3DXRTEDesc): HResult; stdcall; + + function BeginCube(pCubeTex: IDirect3DCubeTexture9): HResult; stdcall; + + function BeginSphere(pTex: IDirect3DTexture9): HResult; stdcall; + + function BeginHemisphere(pTexZPos, pTexZNeg: IDirect3DTexture9): HResult; stdcall; + + function BeginParabolic(pTexZPos, pTexZNeg: IDirect3DTexture9): HResult; stdcall; + + function Face(Face: TD3DCubemapFaces; MipFilter: DWORD): HResult; stdcall; + function _End(MipFilter: DWORD): HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateRenderToEnvMap(ppDevice: IDirect3DDevice9; + Size: LongWord; + MipLevels: LongWord; + Format: TD3DFormat; + DepthStencil: BOOL; + DepthStencilFormat: TD3DFormat; + out ppRenderToEnvMap: ID3DXRenderToEnvMap): HResult; stdcall; external d3dx9coreDLL; +{$EXTERNALSYM D3DXCreateRenderToEnvMap} + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXLine: +// ------------ +// This object intends to provide an easy way to draw lines using D3D. +// +// Begin - +// Prepares device for drawing lines +// +// Draw - +// Draws a line strip in screen-space. +// Input is in the form of a array defining points on the line strip. of D3DXVECTOR2 +// +// DrawTransform - +// Draws a line in screen-space with a specified input transformation matrix. +// +// End - +// Restores device state to how it was when Begin was called. +// +// SetPattern - +// Applies a stipple pattern to the line. Input is one 32-bit +// DWORD which describes the stipple pattern. 1 is opaque, 0 is +// transparent. +// +// SetPatternScale - +// Stretches the stipple pattern in the u direction. Input is one +// floating-point value. 0.0f is no scaling, whereas 1.0f doubles +// the length of the stipple pattern. +// +// SetWidth - +// Specifies the thickness of the line in the v direction. Input is +// one floating-point value. +// +// SetAntialias - +// Toggles line antialiasing. Input is a BOOL. +// TRUE = Antialiasing on. +// FALSE = Antialiasing off. +// +// SetGLLines - +// Toggles non-antialiased OpenGL line emulation. Input is a BOOL. +// TRUE = OpenGL line emulation on. +// FALSE = OpenGL line emulation off. +// +// OpenGL line: Regular line: +// *\ *\ +// | \ / \ +// | \ *\ \ +// *\ \ \ \ +// \ \ \ \ +// \ * \ * +// \ | \ / +// \| * +// * +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// +type + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXLine);'} + {$EXTERNALSYM ID3DXLine} + ID3DXLine = interface(IUnknown) + ['{72CE4D70-CC40-4143-A896-32E50AD2EF35}'] + // ID3DXLine + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + + function _Begin: HResult; stdcall; + + function Draw(pVertexList: PD3DXVector2; dwVertexListCount: DWORD; Color: TD3DColor): HResult; stdcall; + + function DrawTransform(pVertexList: PD3DXVector3; dwVertexListCount: DWORD; + const pTransform: TD3DXMatrix; Color: TD3DColor): HResult; stdcall; + + function SetPattern(dwPattern: DWORD): HResult; stdcall; + function GetPattern: DWORD; stdcall; + + function SetPatternScale(fPatternScale: Single): HResult; stdcall; + function GetPatternScale: Single; stdcall; + + function SetWidth(fWidth: Single): HResult; stdcall; + function GetWidth: Single; stdcall; + + function SetAntialias(bAntialias: BOOL): HResult; stdcall; + function GetAntialias: BOOL; stdcall; + + function SetGLLines(bGLLines: BOOL): HResult; stdcall; + function GetGLLines: BOOL; stdcall; + + function _End: HResult; stdcall; + + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + end; + + +function D3DXCreateLine(ppDevice: IDirect3DDevice9; + out ppLine: ID3DXLine): HResult; stdcall; external d3dx9coreDLL; +{$EXTERNALSYM D3DXCreateLine} + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9shader.h +// Content: D3DX Shader APIs +// +////////////////////////////////////////////////////////////////////////////// + + +//--------------------------------------------------------------------------- +// D3DXTX_VERSION: +// -------------- +// Version token used to create a procedural texture filler in effects +// Used by D3DXFill[]TX functions +//--------------------------------------------------------------------------- +// #define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) +function D3DXTX_VERSION(_Major, _Minor: Byte): DWORD; +{$EXTERNALSYM D3DXTX_VERSION} + + + +//---------------------------------------------------------------------------- +// D3DXSHADER flags: +// ----------------- +// D3DXSHADER_DEBUG +// Insert debug file/line/type/symbol information. +// +// D3DXSHADER_SKIPVALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when compiling shaders +// you KNOW will work. (ie. have compiled before without this option.) +// Shaders are always validated by D3D before they are set to the device. +// +// D3DXSHADER_SKIPOPTIMIZATION (valid for D3DXCompileShader calls only) +// Instructs the compiler to skip optimization steps during code generation. +// Unless you are trying to isolate a problem in your code, and suspect the +// compiler, using this option is not recommended. +// +// D3DXSHADER_PACKMATRIX_ROWMAJOR +// Unless explicitly specified, matrices will be packed in row-major order +// on input and output from the shader. +// +// D3DXSHADER_PACKMATRIX_COLUMNMAJOR +// Unless explicitly specified, matrices will be packed in column-major +// order on input and output from the shader. This is generally more +// efficient, since it allows vector-matrix multiplication to be performed +// using a series of dot-products. +//---------------------------------------------------------------------------- +const + D3DXSHADER_DEBUG = (1 shl 0); + {$EXTERNALSYM D3DXSHADER_DEBUG} + D3DXSHADER_SKIPVALIDATION = (1 shl 2); + {$EXTERNALSYM D3DXSHADER_SKIPVALIDATION} + D3DXSHADER_SKIPOPTIMIZATION = (1 shl 3); + {$EXTERNALSYM D3DXSHADER_SKIPOPTIMIZATION} + D3DXSHADER_PACKMATRIX_ROWMAJOR = (1 shl 4); + {$EXTERNALSYM D3DXSHADER_PACKMATRIX_ROWMAJOR} + D3DXSHADER_PACKMATRIX_COLUMNMAJOR = (1 shl 5); + {$EXTERNALSYM D3DXSHADER_PACKMATRIX_COLUMNMAJOR} + + + +//---------------------------------------------------------------------------- +// D3DXHANDLE: +// ----------- +// Handle values used to efficiently reference shader and effect parameters. +// Strings can be used as handles. However, handles are not always strings. +//---------------------------------------------------------------------------- + +type + {$HPPEMIT 'typedef D3DXHANDLE TD3DXHandle;'} + {$HPPEMIT 'typedef D3DXHANDLE *PD3DXHandle;'} + PD3DXHandle = ^TD3DXHandle; + {$EXTERNALSYM PD3DXHandle} + TD3DXHandle = {$IFDEF TYPE_IDENTITY}type {$ENDIF}PAnsiChar; + {$NODEFINE TD3DXHandle} + + +//---------------------------------------------------------------------------- +// D3DXMACRO: +// ---------- +// Preprocessor macro definition. The application pass in a NULL-terminated +// array of this structure to various D3DX APIs. This enables the application +// to #define tokens at runtime, before the file is parsed. +//---------------------------------------------------------------------------- + + PD3DXMacro = ^TD3DXMacro; + _D3DXMACRO = packed record + Name: PAnsiChar; + Definition: PAnsiChar; + end; + {$EXTERNALSYM _D3DXMACRO} + D3DXMACRO = _D3DXMACRO; + {$EXTERNALSYM D3DXMACRO} + TD3DXMacro = _D3DXMACRO; + + +//---------------------------------------------------------------------------- +// D3DXSEMANTIC: +//---------------------------------------------------------------------------- + + PD3DXSemantic = ^TD3DXSemantic; + _D3DXSEMANTIC = packed record + Usage: LongWord; + UsageIndex: LongWord; + end; + {$EXTERNALSYM _D3DXSEMANTIC} + D3DXSEMANTIC = _D3DXSEMANTIC; + {$EXTERNALSYM D3DXSEMANTIC} + TD3DXSemantic = _D3DXSEMANTIC; + + + +//---------------------------------------------------------------------------- +// D3DXFRAGMENT_DESC: +//---------------------------------------------------------------------------- + + PD3DXFragmentDesc = ^TD3DXFragmentDesc; + _D3DXFRAGMENT_DESC = packed record + Name: PAnsiChar; + Target: DWORD; + end; + {$EXTERNALSYM _D3DXFRAGMENT_DESC} + D3DXFRAGMENT_DESC = _D3DXFRAGMENT_DESC; + {$EXTERNALSYM D3DXFRAGMENT_DESC} + TD3DXFragmentDesc = _D3DXFRAGMENT_DESC; + + +//---------------------------------------------------------------------------- +// D3DXREGISTER_SET: +//---------------------------------------------------------------------------- + + _D3DXREGISTER_SET = ( + D3DXRS_BOOL, + D3DXRS_INT4, + D3DXRS_FLOAT4, + D3DXRS_SAMPLER + ); + {$EXTERNALSYM _D3DXREGISTER_SET} + D3DXREGISTER_SET = _D3DXREGISTER_SET; + {$EXTERNALSYM D3DXREGISTER_SET} + TD3DXRegisterSet = _D3DXREGISTER_SET; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_CLASS: +//---------------------------------------------------------------------------- + + _D3DXPARAMETER_CLASS = ( + D3DXPC_SCALAR, + D3DXPC_VECTOR, + D3DXPC_MATRIX_ROWS, + D3DXPC_MATRIX_COLUMNS, + D3DXPC_OBJECT, + D3DXPC_STRUCT + ); + {$EXTERNALSYM _D3DXPARAMETER_CLASS} + D3DXPARAMETER_CLASS = _D3DXPARAMETER_CLASS; + {$EXTERNALSYM D3DXPARAMETER_CLASS} + TD3DXParameterClass = _D3DXPARAMETER_CLASS; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_TYPE: +//---------------------------------------------------------------------------- + + _D3DXPARAMETER_TYPE = ( + D3DXPT_VOID, + D3DXPT_BOOL, + D3DXPT_INT, + D3DXPT_FLOAT, + D3DXPT_STRING, + D3DXPT_TEXTURE, + D3DXPT_TEXTURE1D, + D3DXPT_TEXTURE2D, + D3DXPT_TEXTURE3D, + D3DXPT_TEXTURECUBE, + D3DXPT_SAMPLER, + D3DXPT_SAMPLER1D, + D3DXPT_SAMPLER2D, + D3DXPT_SAMPLER3D, + D3DXPT_SAMPLERCUBE, + D3DXPT_PIXELSHADER, + D3DXPT_VERTEXSHADER, + D3DXPT_PIXELFRAGMENT, + D3DXPT_VERTEXFRAGMENT + ); + {$EXTERNALSYM _D3DXPARAMETER_TYPE} + D3DXPARAMETER_TYPE = _D3DXPARAMETER_TYPE; + {$EXTERNALSYM D3DXPARAMETER_TYPE} + TD3DXParameterType = _D3DXPARAMETER_TYPE; + + + +//---------------------------------------------------------------------------- +// D3DXCONSTANTTABLE_DESC: +//---------------------------------------------------------------------------- + + PD3DXConstantTableDesc = ^TD3DXConstantTableDesc; + _D3DXCONSTANTTABLE_DESC = packed record + Creator: PAnsiChar; // Creator string + Version: DWORD; // Shader version + Constants: LongWord; // Number of constants + end; + {$EXTERNALSYM _D3DXCONSTANTTABLE_DESC} + D3DXCONSTANTTABLE_DESC = _D3DXCONSTANTTABLE_DESC; + {$EXTERNALSYM D3DXCONSTANTTABLE_DESC} + TD3DXConstantTableDesc = _D3DXCONSTANTTABLE_DESC; + + +//---------------------------------------------------------------------------- +// D3DXCONSTANT_DESC: +//---------------------------------------------------------------------------- + + PD3DXConstantDesc = ^TD3DXConstantDesc; + _D3DXCONSTANT_DESC = packed record + Name: PAnsiChar; // Constant name + + RegisterSet: TD3DXRegisterSet; // Register set + RegisterIndex: LongWord; // Register index + RegisterCount: LongWord; // Number of registers occupied + + _Class: TD3DXParameterClass; // Class + _Type: TD3DXParameterType; // Component type + + Rows: LongWord; // Number of rows + Columns: LongWord; // Number of columns + Elements: LongWord; // Number of array elements + StructMembers: LongWord; // Number of structure member sub-parameters + + Bytes: LongWord; // Data size, in bytes + DefaultValue: Pointer; // Pointer to default value + end; + {$EXTERNALSYM _D3DXCONSTANT_DESC} + D3DXCONSTANT_DESC = _D3DXCONSTANT_DESC; + {$EXTERNALSYM D3DXCONSTANT_DESC} + TD3DXConstantDesc = _D3DXCONSTANT_DESC; + + + +//---------------------------------------------------------------------------- +// ID3DXConstantTable: +//---------------------------------------------------------------------------- + + + PID3DXConstantTable = ^ID3DXConstantTable; + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXConstantTable);'} + {$EXTERNALSYM ID3DXConstantTable} + ID3DXConstantTable = interface(ID3DXBuffer) + ['{9DCA3190-38B9-4fc3-92E3-39C6DDFB358B}'] + // Descs + function GetDesc(out pDesc: TD3DXConstantTableDesc): HResult; stdcall; + function GetConstantDesc(hConstant: TD3DXHandle; pConstantDesc: PD3DXConstantDesc; var pCount: LongWord): HResult; stdcall; + + // Handle operations + function GetConstant(hConstant: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall; + function GetConstantByName(hConstant: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall; + function GetConstantElement(hConstant: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall; + + // Set Constants + function SetDefaults(pDevice: IDirect3DDevice9): HResult; stdcall; + function SetValue(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pData: Pointer; Bytes: LongWord): HResult; stdcall; + function SetBool(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; b: BOOL): HResult; stdcall; + function SetBoolArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pb: PBOOL; Count: LongWord): HResult; stdcall; + function SetInt(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; n: Integer): HResult; stdcall; + function SetIntArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pn: PInteger; Count: LongWord): HResult; stdcall; + function SetFloat(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; f: Single): HResult; stdcall; + function SetFloatArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pf: PSingle; Count: LongWord): HResult; stdcall; + function SetVector(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pVector: TD3DXVector4): HResult; stdcall; + function SetVectorArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pVector: PD3DXVector4; Count: LongWord): HResult; stdcall; + function SetMatrix(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall; + function SetMatrixArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall; + function SetMatrixPointerArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall; + function SetMatrixTranspose(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall; + function SetMatrixTransposeArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall; + function SetMatrixTransposePointerArray(pDevice: IDirect3DDevice9; hConstant: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall; + end; + + +//---------------------------------------------------------------------------- +// ID3DXFragmentLinker +//---------------------------------------------------------------------------- + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXFragmentLinker);'} + {$EXTERNALSYM ID3DXFragmentLinker} + ID3DXFragmentLinker = interface(IUnknown) + ['{D59D3777-C973-4a3c-B4B0-2A62CD3D8B40}'] + // ID3DXFragmentLinker + + // fragment access and information retrieval functions + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetNumberOfFragments: LongWord; stdcall; + + function GetFragmentHandleByIndex(Index: LongWord): TD3DXHandle; stdcall; + function GetFragmentHandleByName(Name: PAnsiChar): TD3DXHandle; stdcall; + function GetFragmentDesc(Name: TD3DXHandle; out FragDesc: TD3DXFragmentDesc): HResult; stdcall; + + // add the fragments in the buffer to the linker + function AddFragments(Fragments: PDWORD): HResult; stdcall; + + // Create a buffer containing the fragments. Suitable for saving to disk + function GetAllFragments(out ppBuffer: ID3DXBuffer): HResult; stdcall; + function GetFragment(Name: TD3DXHandle; out ppBuffer: ID3DXBuffer): HResult; stdcall; + + function LinkShader(pTarget: PAnsiChar; Flags: DWORD; rgFragmentHandles: PD3DXHandle; cFragments: LongWord; out ppBuffer: ID3DXBuffer; ppErrorMsgs: PID3DXBuffer): HResult; stdcall; + function LinkVertexShader(pTarget: PAnsiChar; Flags: DWORD; rgFragmentHandles: PD3DXHandle; cFragments: LongWord; out pVShader: IDirect3DVertexShader9; ppErrorMsgs: PID3DXBuffer): HResult; stdcall; + + function ClearCache: HResult; stdcall; + end; + + +//---------------------------------------------------------------------------- +// D3DXINCLUDE_TYPE: +//---------------------------------------------------------------------------- +type + PD3DXIncludeType = ^TD3DXIncludeType; + _D3DXINCLUDE_TYPE = ( + D3DXINC_LOCAL, + D3DXINC_SYSTEM + ); + {$EXTERNALSYM _D3DXINCLUDE_TYPE} + D3DXINCLUDE_TYPE = _D3DXINCLUDE_TYPE; + {$EXTERNALSYM D3DXINCLUDE_TYPE} + TD3DXIncludeType = _D3DXINCLUDE_TYPE; + + +//---------------------------------------------------------------------------- +// ID3DXInclude: +// ------------- +// This interface is intended to be implemented by the application, and can +// be used by various D3DX APIs. This enables application-specific handling +// of #include directives in source files. +// +// Open() +// Opens an include file. If successful, it should fill in ppData and +// pBytes. The data pointer returned must remain valid until Close is +// subsequently called. +// Close() +// Closes an include file. If Open was successful, Close is guaranteed +// to be called before the API using this interface returns. +//---------------------------------------------------------------------------- + + PID3DXInclude = ^ID3DXInclude; + {$EXTERNALSYM ID3DXInclude} + ID3DXInclude = class + function Open(IncludeType: TD3DXIncludeType; pFileName: PAnsiChar; pParentData: Pointer; out ppData: Pointer; out pBytes: LongWord): HResult; virtual; stdcall; abstract; + function Close(pData: Pointer): HResult; virtual; stdcall; abstract; + end; + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + + +//---------------------------------------------------------------------------- +// D3DXAssembleShader: +// ------------------- +// Assembles a shader. +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// Flags +// See D3DXSHADER_xxx flags +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the assembled shader code, as well as any embedded debug info. +// (See D3DXGetShaderDebugInfo) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + +function D3DXAssembleShaderFromFileA( + pSrcFile: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileA'; +{$EXTERNALSYM D3DXAssembleShaderFromFileA} + +function D3DXAssembleShaderFromFileW( + pSrcFile: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileW'; +{$EXTERNALSYM D3DXAssembleShaderFromFileW} + +function D3DXAssembleShaderFromFile( + pSrcFile: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromFileA'; +{$EXTERNALSYM D3DXAssembleShaderFromFile} + + +function D3DXAssembleShaderFromResourceA( + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWord; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceA'; +{$EXTERNALSYM D3DXAssembleShaderFromResourceA} + +function D3DXAssembleShaderFromResourceW( + hSrcModule: HModule; + pSrcResource: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWord; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceW'; +{$EXTERNALSYM D3DXAssembleShaderFromResourceW} + +function D3DXAssembleShaderFromResource( + hSrcModule: HModule; + pSrcResource: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWord; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXAssembleShaderFromResourceA'; +{$EXTERNALSYM D3DXAssembleShaderFromResource} + + +function D3DXAssembleShader( + pSrcData: PAnsiChar; + SrcDataLen: LongWord; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWord; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXAssembleShader} + + + +//---------------------------------------------------------------------------- +// D3DXCompileShader: +// ------------------ +// Compiles a shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pTarget +// Instruction set to be used when generating code. Currently supported +// targets are "vs_1_1", "vs_2_0", "vs_2_sw", "ps_1_1", "ps_1_2", "ps_1_3", +// "ps_1_4", "ps_2_0", "ps_2_sw", "tx_1_0" +// Flags +// See D3DXSHADER_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3DXGetShaderDebugInfo, D3DXGetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +// ppConstantTable +// Returns a ID3DXConstantTable object which can be used to set +// shader constants to the device. Alternatively, an application can +// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within +// the shader. +//---------------------------------------------------------------------------- + +function D3DXCompileShaderFromFileA( + pSrcFile: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + pFunctionName: PAnsiChar; + pTarget: PAnsiChar; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer; + ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromFileA'; +{$EXTERNALSYM D3DXCompileShaderFromFileA} + +function D3DXCompileShaderFromFileW( + pSrcFile: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + pFunctionName: PAnsiChar; + pTarget: PAnsiChar; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer; + ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromFileW'; +{$EXTERNALSYM D3DXCompileShaderFromFileW} + +function D3DXCompileShaderFromFile( + pSrcFile: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + pFunctionName: PAnsiChar; + pTarget: PAnsiChar; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer; + ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromFileA'; +{$EXTERNALSYM D3DXCompileShaderFromFile} + + +function D3DXCompileShaderFromResourceA( + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + pFunctionName: PAnsiChar; + pTarget: PAnsiChar; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer; + ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromResourceA'; +{$EXTERNALSYM D3DXCompileShaderFromResourceA} + +function D3DXCompileShaderFromResourceW( + hSrcModule: HModule; + pSrcResource: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + pFunctionName: PAnsiChar; + pTarget: PAnsiChar; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer; + ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromResourceW'; +{$EXTERNALSYM D3DXCompileShaderFromResourceW} + +function D3DXCompileShaderFromResource( + hSrcModule: HModule; + pSrcResource: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + pFunctionName: PAnsiChar; + pTarget: PAnsiChar; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer; + ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL name 'D3DXCompileShaderFromResourceA'; +{$EXTERNALSYM D3DXCompileShaderFromResource} + + +function D3DXCompileShader( + pSrcData: PAnsiChar; + SrcDataLen: LongWord; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + pFunctionName: PAnsiChar; + pTarget: PAnsiChar; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer; + ppConstantTable: PID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXCompileShader} + +//---------------------------------------------------------------------------- +// D3DXFindShaderComment: +// ---------------------- +// Searches through a shader for a particular comment, denoted by a FourCC in +// the first DWORD of the comment. If the comment is not found, and no other +// error has occurred, S_FALSE is returned. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// FourCC +// FourCC used to identify the desired comment block. +// ppData +// Returns a pointer to the comment data (not including comment token +// and FourCC). Can be NULL. +// pSizeInBytes +// Returns the size of the comment data in bytes. Can be NULL. +//---------------------------------------------------------------------------- + +function D3DXFindShaderComment( + pFunction: PDWORD; + FourCC: DWORD; + ppData: PPointer; + pSizeInBytes: PLongWord): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXFindShaderComment} + + +//---------------------------------------------------------------------------- +// D3DXGetShaderSemantics: +// ----------------------- +// Gets semantics for all input elements referenced inside a given shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// pSemantics +// Pointer to an array of D3DXSEMANTIC structures. The function will +// fill this array with the semantics for each input element referenced +// inside the shader. This array is assumed to contain at least +// MAXD3DDECLLENGTH elements. +// pCount +// Returns the number of elements referenced by the shader +//---------------------------------------------------------------------------- + +function D3DXGetShaderInputSemantics( + pFunction: PDWORD; + pSemantics: PD3DXSemantic; + pCount: PLongWord): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXGetShaderInputSemantics} + +function D3DXGetShaderOutputSemantics( + pFunction: PDWORD; + pSemantics: PD3DXSemantic; + pCount: PLongWord): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXGetShaderOutputSemantics} + + +//---------------------------------------------------------------------------- +// D3DXGetShaderSamplers: +// ---------------------- +// Gets semantics for all input elements referenced inside a given shader. +// +// pFunction +// Pointer to the function DWORD stream +// pSamplers +// Pointer to an array of LPCSTRs. The function will fill this array +// with pointers to the sampler names contained within pFunction, for +// each sampler referenced inside the shader. This array is assumed to +// contain at least 16 elements. +// pCount +// Returns the number of samplers referenced by the shader +//---------------------------------------------------------------------------- + +function D3DXGetShaderSamplers( + pFunction: PDWORD; + pSamplers: PPAnsiChar; + pCount: PLongWord): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXGetShaderSamplers} + + +//---------------------------------------------------------------------------- +// D3DXGetShaderConstantTable: +// --------------------------- +// Gets shader constant table embedded inside shader. A constant table is +// generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in +// the body of the shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// ppConstantTable +// Returns a ID3DXConstantTable object which can be used to set +// shader constants to the device. Alternatively, an application can +// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within +// the shader. +//---------------------------------------------------------------------------- + +function D3DXGetShaderConstantTable( + pFunction: PDWORD; + out ppConstantTable: ID3DXConstantTable): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXGetShaderConstantTable} + + +//---------------------------------------------------------------------------- +// D3DXGetShaderDebugInfo: +// ----------------------- +// Gets shader debug info. Debug info is generated D3DXAssembleShader and +// D3DXCompileShader and is embedded the body of the shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// ppDebugInfo +// Buffer used to return debug info. For information about the layout +// of this buffer, see definition of D3DXSHADER_DEBUGINFO above. +//---------------------------------------------------------------------------- + +function D3DXGetShaderDebugInfo( + pFunction: PDWORD; + out ppDebugInfo: ID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXGetShaderDebugInfo} + + + +//---------------------------------------------------------------------------- +// D3DXGatherFragments: +// ------------------- +// Assembles shader fragments into a buffer to be passed to a fragment linker. +// will generate shader fragments for all fragments in the file +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// Flags +// See D3DXSHADER_xxx flags +// ppShader +// Returns a buffer containing the created shader fragments. This buffer contains +// the assembled shader code, as well as any embedded debug info. +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + + +function D3DXGatherFragmentsFromFileA( + pSrcFile: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromFileA'; +{$EXTERNALSYM D3DXGatherFragmentsFromFileA} + +function D3DXGatherFragmentsFromFileW( + pSrcFile: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromFileW'; +{$EXTERNALSYM D3DXGatherFragmentsFromFileW} + +function D3DXGatherFragmentsFromFile( + pSrcFile: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromFileA'; +{$EXTERNALSYM D3DXGatherFragmentsFromFile} + + +function D3DXGatherFragmentsFromResourceA( + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWord; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromResourceA'; +{$EXTERNALSYM D3DXGatherFragmentsFromResourceA} + +function D3DXGatherFragmentsFromResourceW( + hSrcModule: HModule; + pSrcResource: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWord; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromResourceW'; +{$EXTERNALSYM D3DXGatherFragmentsFromResourceW} + +function D3DXGatherFragmentsFromResource( + hSrcModule: HModule; + pSrcResource: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWord; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL name 'D3DXGatherFragmentsFromResourceA'; +{$EXTERNALSYM D3DXGatherFragmentsFromResource} + + +function D3DXGatherFragments( + pSrcData: PAnsiChar; + SrcDataLen: LongWord; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWord; + ppShader: PID3DXBuffer; + ppErrorMsgs: PID3DXBuffer): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXGatherFragments} + + +//---------------------------------------------------------------------------- +// D3DXCreateFragmentLinker: +// ------------------------- +// Creates a fragment linker with a given cache size. The interface returned +// can be used to link together shader fragments. (both HLSL & ASM fragements) +// +// Parameters: +// pDevice +// Pointer of the device on which to create the effect +// ShaderCacheSize +// Size of the shader cache +// ppFragmentLinker +// pointer to a memory location to put the created interface pointer +// +//---------------------------------------------------------------------------- + +function D3DXCreateFragmentLinker( + pDevice: IDirect3DDevice9; + ShaderCacheSize: LongWord; + out ppFragmentLinker: ID3DXFragmentLinker): HResult; stdcall; external d3dx9shaderDLL; +{$EXTERNALSYM D3DXCreateFragmentLinker} + + + +////////////////////////////////////////////////////////////////////////////// +// Shader comment block layouts ////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXSHADER_CONSTANTTABLE: +// ------------------------- +// Shader constant information; included as an CTAB comment block inside +// shaders. All offsets are BYTE offsets from start of CONSTANTTABLE struct. +// Entries in the table are sorted by Name in ascending order. +//---------------------------------------------------------------------------- + +type + PD3DXShaderConstantTable = ^TD3DXShaderConstantTable; + _D3DXSHADER_CONSTANTTABLE = packed record + Size: DWORD; // sizeof(D3DXSHADER_CONSTANTTABLE) + Creator: DWORD; // LPCSTR offset + Version: DWORD; // shader version + Constants: DWORD; // number of constants + ConstantInfo: DWORD; // D3DXSHADER_CONSTANTINFO[Constants] offset + end; + {$EXTERNALSYM _D3DXSHADER_CONSTANTTABLE} + D3DXSHADER_CONSTANTTABLE = _D3DXSHADER_CONSTANTTABLE; + {$EXTERNALSYM D3DXSHADER_CONSTANTTABLE} + TD3DXShaderConstantTable = _D3DXSHADER_CONSTANTTABLE; + + + PD3DXShaderConstantInfo = ^TD3DXShaderConstantInfo; + _D3DXSHADER_CONSTANTINFO = packed record + Name: DWORD; // LPCSTR offset + RegisterSet: Word; // D3DXREGISTER_SET + RegisterIndex: Word; // register number + RegisterCount: Word; // number of registers + Reserved: Word; // reserved + TypeInfo: DWORD; // D3DXSHADER_TYPEINFO offset + DefaultValue: DWORD; // offset of default value + end; + {$EXTERNALSYM _D3DXSHADER_CONSTANTINFO} + D3DXSHADER_CONSTANTINFO = _D3DXSHADER_CONSTANTINFO; + {$EXTERNALSYM D3DXSHADER_CONSTANTINFO} + TD3DXShaderConstantInfo = _D3DXSHADER_CONSTANTINFO; + + + PD3DXShaderTypeInfo = ^TD3DXShaderTypeInfo; + _D3DXSHADER_TYPEINFO = packed record + _Class: Word; // D3DXPARAMETER_CLASS + _Type: Word; // D3DXPARAMETER_TYPE + Rows: Word; // number of rows (matrices) + Columns: Word; // number of columns (vectors and matrices) + Elements: Word; // array dimension + StructMembers: Word; // number of struct members + StructMemberInfo: DWORD; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset + end; + {$EXTERNALSYM _D3DXSHADER_TYPEINFO} + D3DXSHADER_TYPEINFO = _D3DXSHADER_TYPEINFO; + {$EXTERNALSYM D3DXSHADER_TYPEINFO} + TD3DXShaderTypeInfo = _D3DXSHADER_TYPEINFO; + + + PD3DXShaderStructMemberInfo = ^TD3DXShaderStructMemberInfo; + _D3DXSHADER_STRUCTMEMBERINFO = packed record + Name: DWORD; // LPCSTR offset + TypeInfo: DWORD; // D3DXSHADER_TYPEINFO offset + end; + {$EXTERNALSYM _D3DXSHADER_STRUCTMEMBERINFO} + D3DXSHADER_STRUCTMEMBERINFO = _D3DXSHADER_STRUCTMEMBERINFO; + {$EXTERNALSYM D3DXSHADER_STRUCTMEMBERINFO} + TD3DXShaderStructMemberInfo = _D3DXSHADER_STRUCTMEMBERINFO; + + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9effect.h +// Content: D3DX effect types and Shaders +// +////////////////////////////////////////////////////////////////////////////// + + +//---------------------------------------------------------------------------- +// D3DXFX_DONOTSAVESTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, device state is not saved and restored in Begin/End. +// D3DXFX_DONOTSAVESHADERSTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, shader device state is not saved and restored in Begin/End. +// This includes pixel/vertex shaders and shader constants +//---------------------------------------------------------------------------- +const + D3DXFX_DONOTSAVESTATE = (1 shl 0); + {$EXTERNALSYM D3DXFX_DONOTSAVESTATE} + D3DXFX_DONOTSAVESHADERSTATE = (1 shl 1); + {$EXTERNALSYM D3DXFX_DONOTSAVESHADERSTATE} + + +//---------------------------------------------------------------------------- +// D3DX_PARAMETER_SHARED +// Indicates that the value of a parameter will be shared with all effects +// which share the same namespace. Changing the value in one effect will +// change it in all. +// +// D3DX_PARAMETER_LITERAL +// Indicates that the value of this parameter can be treated as literal. +// Literal parameters can be marked when the effect is compiled, and their +// cannot be changed after the effect is compiled. Shared parameters cannot +// be literal. +//---------------------------------------------------------------------------- +const + D3DX_PARAMETER_SHARED = (1 shl 0); + {$EXTERNALSYM D3DX_PARAMETER_SHARED} + D3DX_PARAMETER_LITERAL = (1 shl 1); + {$EXTERNALSYM D3DX_PARAMETER_LITERAL} + D3DX_PARAMETER_ANNOTATION = (1 shl 2); + {$EXTERNALSYM D3DX_PARAMETER_ANNOTATION} + + +//---------------------------------------------------------------------------- +// D3DXEFFECT_DESC: +//---------------------------------------------------------------------------- + +type + _D3DXEFFECT_DESC = packed record + Creator: PAnsiChar; // Creator string + Parameters: LongWord; // Number of parameters + Techniques: LongWord; // Number of techniques + Functions: LongWord; // Number of function entrypoints + end; + {$EXTERNALSYM _D3DXEFFECT_DESC} + D3DXEFFECT_DESC = _D3DXEFFECT_DESC; + {$EXTERNALSYM D3DXEFFECT_DESC} + TD3DXEffectDesc = _D3DXEFFECT_DESC; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_DESC: +//---------------------------------------------------------------------------- + + PD3DXParameterDesc = ^TD3DXParameterDesc; + _D3DXPARAMETER_DESC = packed record + Name: PAnsiChar; // Parameter name + Semantic: PAnsiChar; // Parameter semantic + _Class: TD3DXParameterClass; // Class + _Type: TD3DXParameterType; // Component type + Rows: LongWord; // Number of rows + Columns: LongWord; // Number of columns + Elements: LongWord; // Number of array elements + Annotations: LongWord; // Number of annotations + StructMembers: LongWord; // Number of structure member sub-parameters + Flags: DWORD; // D3DX_PARAMETER_* flags + Bytes: LongWord; // Parameter size, in bytes + end; + {$EXTERNALSYM _D3DXPARAMETER_DESC} + D3DXPARAMETER_DESC = _D3DXPARAMETER_DESC; + {$EXTERNALSYM D3DXPARAMETER_DESC} + TD3DXParameterDesc = _D3DXPARAMETER_DESC; + + +//---------------------------------------------------------------------------- +// D3DXTECHNIQUE_DESC: +//---------------------------------------------------------------------------- + + PD3DXTechniqueDesc = ^TD3DXTechniqueDesc; + _D3DXTECHNIQUE_DESC = packed record + Name: PAnsiChar; // Technique name + Passes: LongWord; // Number of passes + Annotations: LongWord; // Number of annotations + end; + {$EXTERNALSYM _D3DXTECHNIQUE_DESC} + D3DXTECHNIQUE_DESC = _D3DXTECHNIQUE_DESC; + {$EXTERNALSYM D3DXTECHNIQUE_DESC} + TD3DXTechniqueDesc = _D3DXTECHNIQUE_DESC; + + +//---------------------------------------------------------------------------- +// D3DXPASS_DESC: +//---------------------------------------------------------------------------- + + PD3DXPassDesc = ^TD3DXPassDesc; + _D3DXPASS_DESC = packed record + Name: PAnsiChar; // Pass name + Annotations: LongWord; // Number of annotations + + VSVersion: DWORD; // Vertex shader version (0 in case of NULL shader) + PSVersion: DWORD; // Pixel shader version (0 in case of NULL shader) + + VSSemanticsUsed: LongWord; + VSSemantics: array [0..MAXD3DDECLLENGTH-1] of TD3DXSemantic; + + PSSemanticsUsed: LongWord; + PSSemantics: array [0..MAXD3DDECLLENGTH-1]of TD3DXSemantic; + + PSSamplersUsed: LongWord; + PSSamplers: array [0..15] of PAnsiChar; + end; + {$EXTERNALSYM _D3DXPASS_DESC} + D3DXPASS_DESC = _D3DXPASS_DESC; + {$EXTERNALSYM D3DXPASS_DESC} + TD3DXPassDesc = _D3DXPASS_DESC; + + +//---------------------------------------------------------------------------- +// D3DXFUNCTION_DESC: +//---------------------------------------------------------------------------- + + PD3DXFunctionDesc = ^TD3DXFunctionDesc; + _D3DXFUNCTION_DESC = packed record + Name: PAnsiChar; // Function name + Annotations: LongWord; // Number of annotations + end; + {$EXTERNALSYM _D3DXFUNCTION_DESC} + D3DXFUNCTION_DESC = _D3DXFUNCTION_DESC; + {$EXTERNALSYM D3DXFUNCTION_DESC} + TD3DXFunctionDesc = _D3DXFUNCTION_DESC; + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffectPool /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXEffectPool);'} + {$EXTERNALSYM ID3DXEffectPool} + ID3DXEffectPool = interface(IUnknown) + ['{53CA7768-C0D0-4664-8E79-D156E4F5B7E0}'] + // No public methods + end; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXBaseEffect /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBaseEffect);'} + {$EXTERNALSYM ID3DXBaseEffect} + ID3DXBaseEffect = interface(IUnknown) + ['{804EF574-CCC1-4bf6-B06A-B1404ABDEADE}'] + // Descs + function GetDesc(out pDesc: TD3DXEffectDesc): HResult; stdcall; + function GetParameterDesc(hParameter: TD3DXHandle; out pDesc: TD3DXParameterDesc): HResult; stdcall; + + function GetTechniqueDesc(hTechnique: TD3DXHandle; out pDesc: TD3DXTechniqueDesc): HResult; stdcall; + function GetPassDesc(hPass: TD3DXHandle; out pDesc: TD3DXPassDesc): HResult; stdcall; + function GetFunctionDesc(hShader: TD3DXHandle; out pDesc: TD3DXFunctionDesc): HResult; stdcall; + + // Handle operations + function GetParameter(hParameter: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall; + function GetParameterByName(hParameter: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall; + function GetParameterBySemantic(hParameter: TD3DXHandle; pSemantic: PAnsiChar): TD3DXHandle; stdcall; + function GetParameterElement(hParameter: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall; + function GetTechnique(Index: LongWord): TD3DXHandle; stdcall; + function GetTechniqueByName(pName: PAnsiChar): TD3DXHandle; stdcall; + function GetPass(hTechnique: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall; + function GetPassByName(hTechnique: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall; + function GetFunction(Index: LongWord): TD3DXHandle; stdcall; + function GetFunctionByName(pName: PAnsiChar): TD3DXHandle; stdcall; + function GetAnnotation(hObject: TD3DXHandle; Index: LongWord): TD3DXHandle; stdcall; + function GetAnnotationByName(hObject: TD3DXHandle; pName: PAnsiChar): TD3DXHandle; stdcall; + + // Get/Set Parameters + function SetValue(hParameter: TD3DXHandle; pData: Pointer; Bytes: LongWord): HResult; stdcall; + function GetValue(hParameter: TD3DXHandle; pData: Pointer; Bytes: LongWord): HResult; stdcall; + function SetBool(hParameter: TD3DXHandle; b: BOOL): HResult; stdcall; + function GetBool(hParameter: TD3DXHandle; out pb: BOOL): HResult; stdcall; + function SetBoolArray(hParameter: TD3DXHandle; pb: PBOOL; Count: LongWord): HResult; stdcall; + function GetBoolArray(hParameter: TD3DXHandle; pb: PBOOL; Count: LongWord): HResult; stdcall; + function SetInt(hParameter: TD3DXHandle; n: Integer): HResult; stdcall; + function GetInt(hParameter: TD3DXHandle; out pn: Integer): HResult; stdcall; + function SetIntArray(hParameter: TD3DXHandle; pn: PInteger; Count: LongWord): HResult; stdcall; + function GetIntArray(hParameter: TD3DXHandle; pn: PInteger; Count: LongWord): HResult; stdcall; + function SetFloat(hParameter: TD3DXHandle; f: Single): HResult; stdcall; + function GetFloat(hParameter: TD3DXHandle; out pf: Single): HResult; stdcall; + function SetFloatArray(hParameter: TD3DXHandle; pf: PSingle; Count: LongWord): HResult; stdcall; + function GetFloatArray(hParameter: TD3DXHandle; pf: PSingle; Count: LongWord): HResult; stdcall; + function SetVector(hParameter: TD3DXHandle; const pVector: TD3DXVector4): HResult; stdcall; + function GetVector(hParameter: TD3DXHandle; out pVector: TD3DXVector4): HResult; stdcall; + function SetVectorArray(hParameter: TD3DXHandle; pVector: PD3DXVector4; Count: LongWord): HResult; stdcall; + function GetVectorArray(hParameter: TD3DXHandle; pVector: PD3DXVector4; Count: LongWord): HResult; stdcall; + function SetMatrix(hParameter: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall; + function GetMatrix(hParameter: TD3DXHandle; out pMatrix: TD3DXMatrix): HResult; stdcall; + function SetMatrixArray(hParameter: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall; + function GetMatrixArray(hParameter: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall; + function SetMatrixPointerArray(hParameter: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall; + function GetMatrixPointerArray(hParameter: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall; + function SetMatrixTranspose(hParameter: TD3DXHandle; const pMatrix: TD3DXMatrix): HResult; stdcall; + function GetMatrixTranspose(hParameter: TD3DXHandle; out pMatrix: TD3DXMatrix): HResult; stdcall; + function SetMatrixTransposeArray(hParameter: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall; + function GetMatrixTransposeArray(hParameter: TD3DXHandle; pMatrix: PD3DXMatrix; Count: LongWord): HResult; stdcall; + function SetMatrixTransposePointerArray(hParameter: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall; + function GetMatrixTransposePointerArray(hParameter: TD3DXHandle; ppMatrix: PPD3DXMatrix; Count: LongWord): HResult; stdcall; + function SetString(hParameter: TD3DXHandle; pString: PAnsiChar): HResult; stdcall; + function GetString(hParameter: TD3DXHandle; out ppString: PAnsiChar): HResult; stdcall; + function SetTexture(hParameter: TD3DXHandle; pTexture: IDirect3DBaseTexture9): HResult; stdcall; + function GetTexture(hParameter: TD3DXHandle; out ppTexture: IDirect3DBaseTexture9): HResult; stdcall; + function SetPixelShader(hParameter: TD3DXHandle; pPShader: IDirect3DPixelShader9): HResult; stdcall; + function GetPixelShader(hParameter: TD3DXHandle; out ppPShader: IDirect3DPixelShader9): HResult; stdcall; + function SetVertexShader(hParameter: TD3DXHandle; pVShader: IDirect3DVertexShader9): HResult; stdcall; + function GetVertexShader(hParameter: TD3DXHandle; out ppVShader: IDirect3DVertexShader9): HResult; stdcall; + end; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffect /////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXEffect);'} + {$EXTERNALSYM ID3DXEffect} + ID3DXEffect = interface(ID3DXBaseEffect) + ['{B589B04A-293D-4516-AF0B-3D7DBCF5AC54}'] + // Pool + function GetPool(out ppPool: ID3DXEffectPool): HResult; stdcall; + + // Selecting and setting a technique + function SetTechnique(hTechnique: TD3DXHandle): HResult; stdcall; + function GetCurrentTechnique: TD3DXHandle; stdcall; + function ValidateTechnique(hTechnique: TD3DXHandle): HResult; stdcall; + function FindNextValidTechnique(hTechnique: TD3DXHandle; out pTechnique: TD3DXHandle): HResult; stdcall; + function IsParameterUsed(hParameter: TD3DXHandle; hTechnique: TD3DXHandle): BOOL; stdcall; + + // Using current technique + function _Begin(pPasses: PLongWord; Flags: DWORD): HResult; stdcall; + function Pass(Pass: LongWord): HResult; stdcall; + function _End: HResult; stdcall; + + // Managing D3D Device + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function OnLostDevice: HResult; stdcall; + function OnResetDevice: HResult; stdcall; + + // Cloning + function CloneEffect(pDevice: IDirect3DDevice9; out ppEffect: ID3DXEffect): HResult; stdcall; + end; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffectCompiler /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXEffectCompiler);'} + {$EXTERNALSYM ID3DXEffectCompiler} + ID3DXEffectCompiler = interface(ID3DXBaseEffect) + ['{F8EE90D3-FCC6-4f14-8AE8-6374AE968E33}'] + // Parameter sharing, specialization, and information + function SetLiteral(hParameter: TD3DXHandle; Literal: BOOL): HResult; stdcall; + function GetLiteral(hParameter: TD3DXHandle; out pLiteral: BOOL): HResult; stdcall; + + // Compilation + function CompileEffect(Flags: DWORD; ppEffect, ppErrorMsgs: PID3DXBuffer): HResult; stdcall; + + function CompileShader(hFunction: TD3DXHandle; pTarget: PAnsiChar; Flags: DWORD; + ppShader, ppErrorMsgs: PID3DXBuffer; ppConstantTable: PID3DXConstantTable): HResult; stdcall; + end; + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +//---------------------------------------------------------------------------- +// D3DXCreateEffectPool: +// --------------------- +// Creates an effect pool. Pools are used for sharing parameters between +// multiple effects. For all effects within a pool, shared parameters of the +// same name all share the same value. +// +// Parameters: +// ppPool +// Returns the created pool. +//---------------------------------------------------------------------------- + +function D3DXCreateEffectPool( + out ppPool: ID3DXEffectPool): HResult; stdcall; external d3dx9effectDLL; +{$EXTERNALSYM D3DXCreateEffectPool} + + +//---------------------------------------------------------------------------- +// D3DXCreateEffect: +// ----------------- +// Creates an effect from an ascii or binary effect description. +// +// Parameters: +// pDevice +// Pointer of the device on which to create the effect +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pPool +// Pointer to ID3DXEffectPool object to use for shared parameters. +// If NULL, no parameters will be shared. +// ppEffect +// Returns a buffer containing created effect. +// ppCompilationErrors +// Returns a buffer containing any error messages which occurred during +// compile. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + +function D3DXCreateEffectFromFileA( + pDevice: IDirect3DDevice9; + pSrcFile: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + pPool: ID3DXEffectPool; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromFileA'; +{$EXTERNALSYM D3DXCreateEffectFromFileA} + +function D3DXCreateEffectFromFileW( + pDevice: IDirect3DDevice9; + pSrcFile: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + pPool: ID3DXEffectPool; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromFileW'; +{$EXTERNALSYM D3DXCreateEffectFromFileW} + +function D3DXCreateEffectFromFile( + pDevice: IDirect3DDevice9; + pSrcFile: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + pPool: ID3DXEffectPool; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromFileA'; +{$EXTERNALSYM D3DXCreateEffectFromFile} + + +function D3DXCreateEffectFromResourceA( + pDevice: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + pPool: ID3DXEffectPool; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromResourceA'; +{$EXTERNALSYM D3DXCreateEffectFromResourceA} + +function D3DXCreateEffectFromResourceW( + pDevice: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + pPool: ID3DXEffectPool; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromResourceW'; +{$EXTERNALSYM D3DXCreateEffectFromResourceW} + +function D3DXCreateEffectFromResource( + pDevice: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + pPool: ID3DXEffectPool; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectFromResourceA'; +{$EXTERNALSYM D3DXCreateEffectFromResource} + + +function D3DXCreateEffect( + pDevice: IDirect3DDevice9; + pSrcData: Pointer; + SrcDataLen: LongWord; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + pPool: ID3DXEffectPool; + out ppEffect: ID3DXEffect; + ppCompilationErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL; +{$EXTERNALSYM D3DXCreateEffect} + + + +//---------------------------------------------------------------------------- +// D3DXCreateEffectCompiler: +// ------------------------- +// Creates an effect from an ascii or binary effect description. +// +// Parameters: +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pPool +// Pointer to ID3DXEffectPool object to use for shared parameters. +// If NULL, no parameters will be shared. +// ppCompiler +// Returns a buffer containing created effect compiler. +// ppParseErrors +// Returns a buffer containing any error messages which occurred during +// parse. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + +function D3DXCreateEffectCompilerFromFileA( + pSrcFile: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + out ppCompiler: ID3DXEffectCompiler; + ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromFileA'; +{$EXTERNALSYM D3DXCreateEffectCompilerFromFileA} + +function D3DXCreateEffectCompilerFromFileW( + pSrcFile: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + out ppCompiler: ID3DXEffectCompiler; + ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromFileW'; +{$EXTERNALSYM D3DXCreateEffectCompilerFromFileW} + +function D3DXCreateEffectCompilerFromFile( + pSrcFile: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + out ppCompiler: ID3DXEffectCompiler; + ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromFileA'; +{$EXTERNALSYM D3DXCreateEffectCompilerFromFile} + + +function D3DXCreateEffectCompilerFromResourceA( + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + out ppCompiler: ID3DXEffectCompiler; + ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromResourceA'; +{$EXTERNALSYM D3DXCreateEffectCompilerFromResourceA} + +function D3DXCreateEffectCompilerFromResourceW( + hSrcModule: HModule; + pSrcResource: PWideChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + out ppCompiler: ID3DXEffectCompiler; + ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromResourceW'; +{$EXTERNALSYM D3DXCreateEffectCompilerFromResourceW} + +function D3DXCreateEffectCompilerFromResource( + hSrcModule: HModule; + pSrcResource: PChar; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + out ppCompiler: ID3DXEffectCompiler; + ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL name 'D3DXCreateEffectCompilerFromResourceA'; +{$EXTERNALSYM D3DXCreateEffectCompilerFromResource} + + +function D3DXCreateEffectCompiler( + pSrcData: Pointer; + SrcDataLen: LongWord; + pDefines: PD3DXMacro; + pInclude: ID3DXInclude; + Flags: DWORD; + out ppCompiler: ID3DXEffectCompiler; + ppParseErrors: PID3DXBuffer): HResult; stdcall; external d3dx9effectDLL; +{$EXTERNALSYM D3DXCreateEffectCompiler} + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9mesh.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +type + //patch mesh can be quads or tris + _D3DXPATCHMESHTYPE = ( + {$IFNDEF COMPILER6_UP} + D3DXPATCHMESH_invalid_0, + D3DXPATCHMESH_RECT {= $001}, + D3DXPATCHMESH_TRI {= $002}, + D3DXPATCHMESH_NPATCH {= $003} + {$ELSE} + D3DXPATCHMESH_RECT = $001, + D3DXPATCHMESH_TRI = $002, + D3DXPATCHMESH_NPATCH = $003 + {$ENDIF} + ); + {$EXTERNALSYM _D3DXPATCHMESHTYPE} + D3DXPATCHMESHTYPE = _D3DXPATCHMESHTYPE; + {$EXTERNALSYM D3DXPATCHMESHTYPE} + TD3DXPatchMeshType = _D3DXPATCHMESHTYPE; + +type + _D3DXMESH = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DXMESH} + TD3DXMesh = _D3DXMESH; + +// Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags +const + D3DXMESH_32BIT = $001; // If set, then use 32 bit indices, if not set use 16 bit indices. + {$EXTERNALSYM D3DXMESH_32BIT} + D3DXMESH_DONOTCLIP = $002; // Use D3DUSAGE_DONOTCLIP for VB & IB. + {$EXTERNALSYM D3DXMESH_DONOTCLIP} + D3DXMESH_POINTS = $004; // Use D3DUSAGE_POINTS for VB & IB. + {$EXTERNALSYM D3DXMESH_POINTS} + D3DXMESH_RTPATCHES = $008; // Use D3DUSAGE_RTPATCHES for VB & IB. + {$EXTERNALSYM D3DXMESH_RTPATCHES} + D3DXMESH_NPATCHES = $4000;// Use D3DUSAGE_NPATCHES for VB & IB. + {$EXTERNALSYM D3DXMESH_NPATCHES} + D3DXMESH_VB_SYSTEMMEM = $010; // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER + {$EXTERNALSYM D3DXMESH_VB_SYSTEMMEM} + D3DXMESH_VB_MANAGED = $020; // Use D3DPOOL_MANAGED for VB. + {$EXTERNALSYM D3DXMESH_VB_MANAGED} + D3DXMESH_VB_WRITEONLY = $040; // Use D3DUSAGE_WRITEONLY for VB. + {$EXTERNALSYM D3DXMESH_VB_WRITEONLY} + D3DXMESH_VB_DYNAMIC = $080; // Use D3DUSAGE_DYNAMIC for VB. + {$EXTERNALSYM D3DXMESH_VB_DYNAMIC} + D3DXMESH_VB_SOFTWAREPROCESSING = $8000; // Use D3DUSAGE_SOFTWAREPROCESSING for VB. + {$EXTERNALSYM D3DXMESH_VB_SOFTWAREPROCESSING} + D3DXMESH_IB_SYSTEMMEM = $100; // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER + {$EXTERNALSYM D3DXMESH_IB_SYSTEMMEM} + D3DXMESH_IB_MANAGED = $200; // Use D3DPOOL_MANAGED for IB. + {$EXTERNALSYM D3DXMESH_IB_MANAGED} + D3DXMESH_IB_WRITEONLY = $400; // Use D3DUSAGE_WRITEONLY for IB. + {$EXTERNALSYM D3DXMESH_IB_WRITEONLY} + D3DXMESH_IB_DYNAMIC = $800; // Use D3DUSAGE_DYNAMIC for IB. + {$EXTERNALSYM D3DXMESH_IB_DYNAMIC} + D3DXMESH_IB_SOFTWAREPROCESSING= $10000; // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + {$EXTERNALSYM D3DXMESH_IB_SOFTWAREPROCESSING} + + D3DXMESH_VB_SHARE = $1000; // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + {$EXTERNALSYM D3DXMESH_VB_SHARE} + + D3DXMESH_USEHWONLY = $2000; // Valid for ID3DXSkinMesh::ConvertToBlendedMesh + {$EXTERNALSYM D3DXMESH_USEHWONLY} + + // Helper options + D3DXMESH_SYSTEMMEM = $110; // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM + {$EXTERNALSYM D3DXMESH_SYSTEMMEM} + D3DXMESH_MANAGED = $220; // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED + {$EXTERNALSYM D3DXMESH_MANAGED} + D3DXMESH_WRITEONLY = $440; // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY + {$EXTERNALSYM D3DXMESH_WRITEONLY} + D3DXMESH_DYNAMIC = $880; // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC + {$EXTERNALSYM D3DXMESH_DYNAMIC} + D3DXMESH_SOFTWAREPROCESSING = $18000; // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + {$EXTERNALSYM D3DXMESH_SOFTWAREPROCESSING} + +type + //patch mesh options + _D3DXPATCHMESH = ( + D3DXPATCHMESH_DEFAULT {= 000,} + ); + {$EXTERNALSYM _D3DXPATCHMESH} + D3DXPATCHMESH = _D3DXPATCHMESH; + {$EXTERNALSYM D3DXPATCHMESH} + TD3DXPatchMesh = _D3DXPATCHMESH; + + // option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh + _D3DXMESHSIMP = ( + {$IFNDEF COMPILER6_UP} + D3DXMESHSIMP_invalid_0{= 0x0}, + D3DXMESHSIMP_VERTEX {= 0x1}, + D3DXMESHSIMP_FACE {= 0x2} + {$ELSE} + D3DXMESHSIMP_VERTEX = $1, + D3DXMESHSIMP_FACE = $2 + {$ENDIF} + ); + {$EXTERNALSYM _D3DXMESHSIMP} + TD3DMeshSimp = _D3DXMESHSIMP; + + _MAX_FVF_DECL_SIZE = DWord; + {$EXTERNALSYM _MAX_FVF_DECL_SIZE} +const + MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1; // +1 for END + {$EXTERNALSYM MAX_FVF_DECL_SIZE} + +type + TFVFDeclaration = array [0..MAX_FVF_DECL_SIZE-1] of TD3DVertexElement9; + + PD3DXAttributeRange = ^TD3DXAttributeRange; + _D3DXATTRIBUTERANGE = packed record + AttribId: DWord; + FaceStart: DWord; + FaceCount: DWord; + VertexStart: DWord; + VertexCount: DWord; + end; + {$EXTERNALSYM _D3DXATTRIBUTERANGE} + D3DXATTRIBUTERANGE = _D3DXATTRIBUTERANGE; + {$EXTERNALSYM D3DXATTRIBUTERANGE} + TD3DXAttributeRange = _D3DXATTRIBUTERANGE; + + PD3DXMaterial = ^TD3DXMaterial; + _D3DXMATERIAL = packed record + MatD3D: TD3Dmaterial9; + pTextureFilename: PAnsiChar; + end; + {$EXTERNALSYM _D3DXMATERIAL} + D3DXMATERIAL = _D3DXMATERIAL; + {$EXTERNALSYM D3DXMATERIAL} + TD3DXMaterial = _D3DXMATERIAL; + + _D3DXEFFECTDEFAULTTYPE = ( + {$IFNDEF COMPILER6_UP} + D3DXEDT_invalid_0, + D3DXEDT_STRING {= $1}, // pValue points to a null terminated ASCII string + D3DXEDT_FLOATS {= $2}, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float) + D3DXEDT_DWORD {= $3} // pValue points to a DWORD + {$ELSE} + D3DXEDT_STRING = $1, // pValue points to a null terminated ASCII string + D3DXEDT_FLOATS = $2, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float) + D3DXEDT_DWORD = $3 // pValue points to a DWORD + {$ENDIF} + ); + {$EXTERNALSYM _D3DXEFFECTDEFAULTTYPE} + D3DXEFFECTDEFAULTTYPE = _D3DXEFFECTDEFAULTTYPE; + {$EXTERNALSYM D3DXEFFECTDEFAULTTYPE} + TD3DXEffectDefaultType = _D3DXEFFECTDEFAULTTYPE; + + PD3DXEffectDefault = ^TD3DXEffectDefault; + _D3DXEFFECTDEFAULT = packed record + pParamName: PAnsiChar; + _Type: TD3DXEffectDefaultType; // type of the data pointed to by pValue + NumBytes: DWORD; // size in bytes of the data pointed to by pValue + pValue: Pointer; // data for the default of the effect + end; + {$EXTERNALSYM _D3DXEFFECTDEFAULT} + D3DXEFFECTDEFAULT = _D3DXEFFECTDEFAULT; + {$EXTERNALSYM D3DXEFFECTDEFAULT} + TD3DXEffectDefault = _D3DXEFFECTDEFAULT; + + PD3DXEffectInstance = ^TD3DXEffectInstance; + _D3DXEFFECTINSTANCE = packed record + pEffectFilename: PAnsiChar; + NumDefaults: DWORD; + pDefaults: PD3DXEffectDefault; + end; + {$EXTERNALSYM _D3DXEFFECTINSTANCE} + D3DXEFFECTINSTANCE = _D3DXEFFECTINSTANCE; + {$EXTERNALSYM D3DXEFFECTINSTANCE} + TD3DXEffectInstance = _D3DXEFFECTINSTANCE; + + PD3DXAttributeWeights = ^TD3DXAttributeWeights; + _D3DXATTRIBUTEWEIGHTS = packed record + Position: Single; + Boundary: Single; + Normal: Single; + Diffuse: Single; + Specular: Single; + Texcoord: array[0..7] of Single; + Tangent: Single; + Binormal: Single; + end; + {$EXTERNALSYM _D3DXATTRIBUTEWEIGHTS} + D3DXATTRIBUTEWEIGHTS = _D3DXATTRIBUTEWEIGHTS; + {$EXTERNALSYM D3DXATTRIBUTEWEIGHTS} + TD3DXAttributeWeights = _D3DXATTRIBUTEWEIGHTS; + + _D3DXWELDEPSILONSFLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DXWELDEPSILONSFLAGS} + TD3DXWeldEpsilonsFlags = _D3DXWELDEPSILONSFLAGS; + +const + D3DXWELDEPSILONS_WELDALL = $1; // weld all vertices marked by adjacency as being overlapping + {$EXTERNALSYM D3DXWELDEPSILONS_WELDALL} + + D3DXWELDEPSILONS_WELDPARTIALMATCHES = $2; // if a given vertex component is within epsilon, modify partial matched + // vertices so that both components identical AND if all components "equal" + // remove one of the vertices + {$EXTERNALSYM D3DXWELDEPSILONS_WELDPARTIALMATCHES} + D3DXWELDEPSILONS_DONOTREMOVEVERTICES = $4; // instructs weld to only allow modifications to vertices and not removal + // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set + // useful to modify vertices to be equal, but not allow vertices to be removed + {$EXTERNALSYM D3DXWELDEPSILONS_DONOTREMOVEVERTICES} + D3DXWELDEPSILONS_DONOTSPLIT = $8; // instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT) + // if this flag is not set, all vertices that are in separate attribute groups + // will remain split and not welded. Setting this flag can slow down software vertex processing + {$EXTERNALSYM D3DXWELDEPSILONS_DONOTSPLIT} + +type + PD3DXWeldEpsilons = ^TD3DXWeldEpsilons; + _D3DXWELDEPSILONS = packed record + Position: Single; // NOTE: This does NOT replace the epsilon in GenerateAdjacency + // in general, it should be the same value or greater than the one passed to GeneratedAdjacency + BlendWeights: Single; + Normal: Single; + PSize: Single; + Specular: Single; + Diffuse: Single; + Texcoord: array[0..7] of Single; + Tangent: Single; + Binormal: Single; + TessFactor: Single; + end; + {$EXTERNALSYM _D3DXWELDEPSILONS} + D3DXWELDEPSILONS = _D3DXWELDEPSILONS; + {$EXTERNALSYM D3DXWELDEPSILONS} + TD3DXWeldEpsilons = _D3DXWELDEPSILONS; + + ID3DXMesh = interface; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXBaseMesh);'} + {$EXTERNALSYM ID3DXBaseMesh} + ID3DXBaseMesh = interface(IUnknown) + ['{2A835771-BF4D-43f4-8E14-82A809F17D8A}'] + // ID3DXBaseMesh + function DrawSubset(AttribId: DWord): HResult; stdcall; + function GetNumFaces: DWord; stdcall; + function GetNumVertices: DWord; stdcall; + function GetFVF: DWord; stdcall; + function GetDeclaration(out Declaration: TFVFDeclaration): HResult; stdcall; + function GetNumBytesPerVertex: DWORD; + function GetOptions: DWord; stdcall; + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function CloneMeshFVF(Options, FVF: DWord; pD3DDevice: IDirect3DDevice9; + out ppCloneMesh: ID3DXMesh): HResult; stdcall; + function CloneMesh(Options: DWORD; pDeclaration: PD3DVertexElement9; + pD3DDevice: IDirect3DDevice9; out ppCloneMesh: ID3DXMesh): HResult; stdcall; + function GetVertexBuffer(out ppVB: IDirect3DVertexBuffer9): HResult; stdcall; + function GetIndexBuffer(out ppIB: IDirect3DIndexBuffer9): HResult; stdcall; + function LockVertexBuffer(Flags: DWord; out ppData: Pointer): HResult; stdcall; + function UnlockVertexBuffer: HResult; stdcall; + function LockIndexBuffer(Flags: DWord; out ppData: Pointer): HResult; stdcall; + function UnlockIndexBuffer: HResult; stdcall; + function GetAttributeTable(pAttribTable: PD3DXAttributeRange; + pAttribTableSize: PDWord): HResult; stdcall; + + function ConvertPointRepsToAdjacency(pPRep: PDWord; pAdjacency: PDWord): HResult; stdcall; + function ConvertAdjacencyToPointReps(pAdjacency: PDWord; pPRep: PDWord): HResult; stdcall; + function GenerateAdjacency(Epsilon: Single; pAdjacency: PDWord): HResult; stdcall; + + function UpdateSemantics(const Declaration: TFVFDeclaration): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXMesh);'} + {$EXTERNALSYM ID3DXMesh} + ID3DXMesh = interface(ID3DXBaseMesh) + ['{CCAE5C3B-4DD1-4d0f-997E-4684CA64557F}'] + // ID3DXMesh + function LockAttributeBuffer(Flags: DWord; out ppData: PByte): HResult; stdcall; + function UnlockAttributeBuffer: HResult; stdcall; + function Optimize(Flags: DWord; pAdjacencyIn, pAdjacencyOut: PDWord; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer; + out ppOptMesh: ID3DXMesh): HResult; stdcall; + function OptimizeInplace(Flags: DWord; pAdjacencyIn, pAdjacencyOut: PDWord; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer): HResult; stdcall; + function SetAttributeTable(pAttribTable: PD3DXAttributeRange; cAttribTableSize: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXPMesh);'} + {$EXTERNALSYM ID3DXPMesh} + ID3DXPMesh = interface(ID3DXBaseMesh) + ['{19FBE386-C282-4659-97BD-CB869B084A6C}'] + // ID3DXPMesh + function ClonePMeshFVF(Options, FVF: DWord; ppDevice: IDirect3DDevice9; + out ppCloneMesh: ID3DXPMesh): HResult; stdcall; + function ClonePMesh(Options: DWORD; pDeclaration: PD3DVertexElement9; + pD3D: IDirect3DDevice9; out ppCloneMesh: ID3DXPMesh): HResult; stdcall; + function SetNumFaces(Faces: DWord): HResult; stdcall; + function SetNumVertices(Vertices: DWord): HResult; stdcall; + function GetMaxFaces: DWord; stdcall; + function GetMinFaces: DWord; stdcall; + function GetMaxVertices: DWord; stdcall; + function GetMinVertices: DWord; stdcall; + function Save(pStream: IStream; pMaterials: PD3DXMaterial; + pEffectInstances: PD3DXEffectInstance; NumMaterials: DWORD): HResult; stdcall; + + function Optimize(Flags: DWord; pAdjacencyOut: PDWord; + pFaceRemap: PDWord; ppVertexRemap: PID3DXBuffer; + out ppOptMesh: ID3DXMesh): HResult; stdcall; + + function OptimizeBaseLOD(Flags: DWord; pFaceRemap: PDWord): HResult; stdcall; + function TrimByFaces(NewFacesMin, NewFacesMax: DWord; rgiFaceRemap, rgiVertRemap: PDWord): HResult; stdcall; + function TrimByVertices(NewVerticesMin, NewVerticesMax: DWord; rgiFaceRemap, rgiVertRemap: PDWord): HResult; stdcall; + + function GetAdjacency(pAdjacency: PDWord): HResult; stdcall; + + // Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs + // Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh + function GenerateVertexHistory(pVertexHistory: PDWORD): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSPMesh);'} + {$EXTERNALSYM ID3DXSPMesh} + ID3DXSPMesh = interface(IUnknown) + ['{4E3CA05C-D4FF-4d11-8A02-16459E08F6F4}'] + // ID3DXSPMesh + function GetNumFaces: DWord; stdcall; + function GetNumVertices: DWord; stdcall; + function GetFVF: DWord; stdcall; + function GetDeclaration(out Declaration: TFVFDeclaration): HResult; stdcall; + function GetOptions: DWord; stdcall; + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function CloneMeshFVF(Options, FVF: DWord; ppDevice: IDirect3DDevice9; + pAdjacencyOut, pVertexRemapOut: PDWord; + out ppCloneMesh: ID3DXMesh): HResult; stdcall; + function CloneMesh(Options: DWORD; pDeclaration: PD3DVertexElement9; + pD3DDevice: IDirect3DDevice9; pAdjacencyOut, pVertexRemapOut: PDWORD; + out ppCloneMesh: ID3DXMesh): HResult; stdcall; + function ClonePMeshFVF(Options, FVF: DWORD; pD3D: IDirect3DDevice9; + pVertexRemapOut: PDWORD; pErrorsByFace: PSingle; out ppCloneMesh: ID3DXPMesh): HResult; stdcall; + function ClonePMesh(Options: DWORD; pDeclaration: PD3DVertexElement9; + pD3D: IDirect3DDevice9; pVertexRemapOut: PDWORD; pErrorsbyFace: PSingle; + out ppCloneMesh: ID3DXPMesh): HResult; stdcall; + function ReduceFaces(Faces: DWord): HResult; stdcall; + function ReduceVertices(Vertices: DWord): HResult; stdcall; + function GetMaxFaces: DWord; stdcall; + function GetMaxVertices: DWord; stdcall; + function GetVertexAttributeWeights(pVertexAttributeWeights: PD3DXAttributeWeights): HResult; stdcall; + function GetVertexWeights(pVertexWeights: PSingle): HResult; stdcall; + end; + +const + UNUSED16 = $ffff; + {$EXTERNALSYM UNUSED16} + UNUSED32 = $ffffffff; + {$EXTERNALSYM UNUSED32} + +// ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags +type + _D3DXMESHOPT = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DXMESHOPT} + TD3DXMeshOpt = _D3DXMESHOPT; + +const + D3DXMESHOPT_COMPACT = $01000000; + {$EXTERNALSYM D3DXMESHOPT_COMPACT} + D3DXMESHOPT_ATTRSORT = $02000000; + {$EXTERNALSYM D3DXMESHOPT_ATTRSORT} + D3DXMESHOPT_VERTEXCACHE = $04000000; + {$EXTERNALSYM D3DXMESHOPT_VERTEXCACHE} + D3DXMESHOPT_STRIPREORDER = $08000000; + {$EXTERNALSYM D3DXMESHOPT_STRIPREORDER} + D3DXMESHOPT_IGNOREVERTS = $10000000; // optimize faces only; don't touch vertices + {$EXTERNALSYM D3DXMESHOPT_IGNOREVERTS} + D3DXMESHOPT_DONOTSPLIT = $20000000; // do not split vertices shared between attribute groups when attribute sorting + {$EXTERNALSYM D3DXMESHOPT_DONOTSPLIT} + D3DXMESHOPT_DEVICEINDEPENDENT = $00400000; // Only affects VCache. uses a static known good cache size for all cards + {$EXTERNALSYM D3DXMESHOPT_DEVICEINDEPENDENT} + + // D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead + +// Subset of the mesh that has the same attribute and bone combination. +// This subset can be rendered in a single draw call +type + PDWordArray = ^TDWordArray; + {$NODEFINE PDWordArray} + TDWordArray = array[0..MaxInt div SizeOf(DWORD) - 1] of DWord; + {$NODEFINE TDWordArray} + + PD3DXBoneCombination = ^TD3DXBoneCombination; + _D3DXBONECOMBINATION = packed record + AttribId: DWord; + FaceStart: DWord; + FaceCount: DWord; + VertexStart: DWord; + VertexCount: DWord; + BoneId: PDWordArray; // [ DWORD* ] in original d3dx8mesh.h + end; + {$EXTERNALSYM _D3DXBONECOMBINATION} + D3DXBONECOMBINATION = _D3DXBONECOMBINATION; + {$EXTERNALSYM D3DXBONECOMBINATION} + TD3DXBoneCombination = _D3DXBONECOMBINATION; + +// The following types of patch combinations are supported: +// Patch type Basis Degree +// Rect Bezier 2,3,5 +// Rect B-Spline 2,3,5 +// Rect Catmull-Rom 3 +// Tri Bezier 2,3,5 +// N-Patch N/A 3 + + PD3DXPatchInfo = ^TD3DXPatchInfo; + _D3DXPATCHINFO = packed record + PatchType: TD3DXPatchMeshType; + Degree: TD3DDegreeType; + Basis: TD3DBasisType; + end; + {$EXTERNALSYM _D3DXPATCHINFO} + D3DXPATCHINFO = _D3DXPATCHINFO; + {$EXTERNALSYM D3DXPATCHINFO} + TD3DXPatchInfo = _D3DXPATCHINFO; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXPatchMesh);'} + {$EXTERNALSYM ID3DXPatchMesh} + ID3DXPatchMesh = interface(IUnknown) + ['{0AD3E8BC-290D-4dc7-91AB-73A82755B13E}'] + // ID3DXPatchMesh + + // Return creation parameters + function GetNumPatches: DWORD; stdcall; + function GetNumVertices: DWORD; stdcall; + function GetDeclaration(pDeclaration: PD3DVertexElement9): HResult; stdcall; + function GetControlVerticesPerPatch: DWORD; stdcall; + function GetOptions: DWORD; stdcall; + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetPatchInfo(out PatchInfo: TD3DXPatchInfo): HResult; stdcall; + + // Control mesh access + function GetVertexBuffer(out ppVB: IDirect3DVertexBuffer9): HResult; stdcall; + function GetIndexBuffer(out ppIB: IDirect3DIndexBuffer9): HResult; stdcall; + function LockVertexBuffer(flags: DWORD; out ppData: Pointer): HResult; stdcall; + function UnlockVertexBuffer: HResult; stdcall; + function LockIndexBuffer(flags: DWORD; out ppData: Pointer): HResult; stdcall; + function UnlockIndexBuffer: HResult; stdcall; + function LockAttributeBuffer(flags: DWORD; out ppData: PDWORD): HResult; stdcall; + function UnlockAttributeBuffer: HResult; stdcall; + + // This function returns the size of the tessellated mesh given a tessellation level. + // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must + // be set to TRUE and TessellationLevel should be the max tessellation. + // This will result in the max mesh size necessary for adaptive tessellation. + function GetTessSize(fTessLevel: Single; Adaptive: LongBool; out NumTriangles, NumVertices: DWORD): HResult; stdcall; + + //GenerateAdjacency determines which patches are adjacent with provided tolerance + //this information is used internally to optimize tessellation + function GenerateAdjacency(Tolerance: Single): HResult; stdcall; + + //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer + //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh + //has adjacency, the new mesh will also have adjacency + function CloneMesh(Options: DWORD; pDecl: PD3DVertexElement9; out pMesh: ID3DXPatchMesh): HResult; stdcall; + + // Optimizes the patchmesh for efficient tessellation. This function is designed + // to perform one time optimization for patch meshes that need to be tessellated + // repeatedly by calling the Tessellate() method. The optimization performed is + // independent of the actual tessellation level used. + // Currently Flags is unused. + // If vertices are changed, Optimize must be called again + function Optimize(flags: DWORD): HResult; stdcall; + + //gets and sets displacement parameters + //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation + function SetDisplaceParam(Texture: IDirect3DBaseTexture9; + MinFilter: TD3DTextureFilterType; + MagFilter: TD3DTextureFilterType; + MipFilter: TD3DTextureFilterType; + Wrap: TD3DTextureAddress; + dwLODBias: DWORD): HResult; stdcall; + + function GetDisplaceParam(out Texture: IDirect3DBaseTexture9; + out MinFilter: TD3DTextureFilterType; + out MagFilter: TD3DTextureFilterType; + out MipFilter: TD3DTextureFilterType; + out Wrap: TD3DTextureAddress; + out dwLODBias: DWORD): HResult; stdcall; + + // Performs the uniform tessellation based on the tessellation level. + // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + function Tessellate(fTessLevel: Single; pMesh: ID3DXMesh): HResult; stdcall; + + // Performs adaptive tessellation based on the Z based adaptive tessellation criterion. + // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex + // adaptive tessellation amount. Each edge is tessellated to the average of the criterion + // at the 2 vertices it connects. + // MaxTessLevel specifies the upper limit for adaptive tesselation. + // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + function TessellateAdaptive(const pTrans: TD3DXVector4; dwMaxTessLevel, dwMinTessLevel: DWORD; pMesh: ID3DXMesh): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXSkinInfo);'} + {$EXTERNALSYM ID3DXSkinInfo} + ID3DXSkinInfo = interface(IUnknown) + ['{0E7DBBF3-421A-4dd8-B738-A5DAC3A48767}'] + // Specify the which vertices do each bones influence and by how much + function SetBoneInfluence(bone, numInfluences: DWORD; vertices: PDWORD; weights: PSingle): HResult; stdcall; + function GetNumBoneInfluences(bone: DWORD): DWORD; stdcall; + function GetBoneInfluence(bone: DWORD; vertices: PDWORD; weights: PSingle): HResult; stdcall; + function GetMaxVertexInfluences(out maxVertexInfluences: DWORD): HResult; stdcall; + function GetNumBones: DWORD; stdcall; + + // This gets the max face influences based on a triangle mesh with the specified index buffer + function GetMaxFaceInfluences(pIB: IDirect3DIndexBuffer9; NumFaces: DWORD; out maxFaceInfluences:DWORD): HResult; stdcall; + + // Set min bone influence. Bone influences that are smaller than this are ignored + function SetMinBoneInfluence(MinInfl: Single): HResult; stdcall; + // Get min bone influence. + function GetMinBoneInfluence: Single; stdcall; + + // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object + function SetBoneName(Bone: DWORD; pName: PAnsiChar): HResult; stdcall; // pName is copied to an internal string buffer + function GetBoneName(Bone: DWORD): PAnsiChar; stdcall; // A pointer to an internal string buffer is returned. Do not free this. + + // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object + function SetBoneOffsetMatrix(Bone: DWORD; const pBoneTransform: TD3DXMatrix): HResult; stdcall; // pBoneTransform is copied to an internal buffer + function GetBoneOffsetMatrix(Bone: DWORD): PD3DXMatrix; stdcall; // A pointer to an internal matrix is returned. Do not free this. + + // Clone a skin info object + function Clone(out ppSkinInfo: ID3DXSkinInfo): HResult; stdcall; + + // Update bone influence information to match vertices after they are reordered. This should be called + // if the target vertex buffer has been reordered externally. + function Remap(NumVertices: DWORD; pVertexRemap: PDWORD): HResult; stdcall; + + // These methods enable the modification of the vertex layout of the vertices that will be skinned + function SetFVF(FVF: DWORD): HResult; stdcall; + function SetDeclaration(pDeclaration: PD3DVertexElement9): HResult; stdcall; + function GetFVF: DWORD; stdcall; + function GetDeclaration(Declaration: TFVFDeclaration): HResult; stdcall; + + // Apply SW skinning based on current pose matrices to the target vertices. + function UpdateSkinnedMesh( + pBoneTransforms: PD3DXMatrix; + pBoneInvTransposeTransforms: PD3DXMatrix; + pVerticesSrc: Pointer; + pVerticesDst: Pointer): HResult; stdcall; + + // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination + // table that describes which bones affect which subsets of the mesh + function ConvertToBlendedMesh( + pMesh: ID3DXMesh; + Options: DWORD; + pAdjacencyIn: PDWORD; + pAdjacencyOut: PDWORD; + pFaceRemap: PDWORD; + ppVertexRemap: PID3DXBuffer; + pMaxFaceInfl: PDWORD; + out pNumBoneCombinations: DWORD; + out ppBoneCombinationTable: ID3DXBuffer; + out ppMesh: ID3DXMesh): HResult; stdcall; + + // Takes a mesh and returns a new mesh with per vertex blend weights and indices + // and a bone combination table that describes which bones palettes affect which subsets of the mesh + function ConvertToIndexedBlendedMesh( + pMesh: ID3DXMesh; + Options: DWORD; + paletteSize: DWORD; + pAdjacencyIn: PDWORD; + pAdjacencyOut: PDWORD; + pFaceRemap: PDWORD; + ppVertexRemap: PID3DXBuffer; + pMaxVertexInfl: PDWORD; + out pNumBoneCombinations: DWORD; + out ppBoneCombinationTable: ID3DXBuffer; + out ppMesh: ID3DXMesh): HResult; stdcall; + end; + +type + IID_ID3DXBaseMesh = ID3DXBaseMesh; + {$EXTERNALSYM IID_ID3DXBaseMesh} + IID_ID3DXMesh = ID3DXMesh; + {$EXTERNALSYM IID_ID3DXMesh} + IID_ID3DXPMesh = ID3DXPMesh; + {$EXTERNALSYM IID_ID3DXPMesh} + IID_ID3DXSPMesh = ID3DXSPMesh; + {$EXTERNALSYM IID_ID3DXSPMesh} + IID_ID3DXSkinInfo = ID3DXSkinInfo; + {$EXTERNALSYM IID_ID3DXSkinInfo} + IID_ID3DXPatchMesh = ID3DXPatchMesh; + {$EXTERNALSYM IID_ID3DXPatchMesh} + + +function D3DXCreateMesh(NumFaces, NumVertices: DWord; Options: DWord; + pDeclaration: PD3DVertexElement9; + pD3D: IDirect3DDevice9; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreateMesh} + +function D3DXCreateMeshFVF(NumFaces, NumVertices: DWord; Options: DWord; + FVF: DWord; pD3D: IDirect3DDevice9; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreateMeshFVF} + +function D3DXCreateSPMesh(pMesh: ID3DXMesh; pAdjacency: PDWord; + pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle; + out ppSMesh: ID3DXSPMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreateSPMesh} + +// clean a mesh up for simplification, try to make manifold +function D3DXCleanMesh(pMeshIn: ID3DXMesh; pAdjacencyIn: PDWord; + out ppMeshOut: ID3DXMesh; pAdjacencyOut: PDWord; + ppErrorsAndWarnings: PID3DXBuffer): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCleanMesh} + +function D3DXValidMesh(pMeshIn: ID3DXMesh; pAdjacency: PDWord; + ppErrorsAndWarnings: PID3DXBuffer): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXValidMesh} + +function D3DXGeneratePMesh(pMesh: ID3DXMesh; pAdjacency: PDWord; + pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle; + MinValue: DWord; Options: TD3DMeshSimp; out ppPMesh: ID3DXPMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXGeneratePMesh} + +function D3DXSimplifyMesh(pMesh: ID3DXMesh; pAdjacency: PDWord; + pVertexAttributeWeights: PD3DXAttributeWeights; pVertexWeights: PSingle; + MinValue: DWord; Options: TD3DMeshSimp; out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXSimplifyMesh} + +function D3DXComputeBoundingSphere( + pFirstPosition: PD3DXVector3; // pointer to first position + NumVertices: DWORD; + dwStride: DWORD; // count in bytes to subsequent position vectors + out pCenter: TD3DXVector3; + out pRadius: Single): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXComputeBoundingSphere} + +function D3DXComputeBoundingBox( + pFirstPosition: PD3DXVector3; // pointer to first position + NumVertices: DWORD; + dwStride: DWORD; // count in bytes to subsequent position vectors + out pMin, pMax: TD3DXVector3): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXComputeBoundingBox} + +function D3DXComputeNormals(pMesh: ID3DXBaseMesh; pAdjacency: PDWord): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXComputeNormals} + +function D3DXCreateBuffer(NumBytes: DWord; out ppBuffer: ID3DXBuffer): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreateBuffer} + +function D3DXLoadMeshFromXA( + pFilename: PAnsiChar; + Options: DWord; + pD3D: IDirect3DDevice9; + ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer; + pNumMaterials: PDWORD; + out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL name 'D3DXLoadMeshFromXA'; +{$EXTERNALSYM D3DXLoadMeshFromXA} + +function D3DXLoadMeshFromXW( + pFilename: PWideChar; + Options: DWord; + pD3D: IDirect3DDevice9; + ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer; + pNumMaterials: PDWORD; + out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL name 'D3DXLoadMeshFromXW'; +{$EXTERNALSYM D3DXLoadMeshFromXW} + +function D3DXLoadMeshFromX( + pFilename: PChar; + Options: DWord; + pD3D: IDirect3DDevice9; + ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer; + pNumMaterials: PDWORD; + out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL name 'D3DXLoadMeshFromXA'; +{$EXTERNALSYM D3DXLoadMeshFromX} + + +function D3DXLoadMeshFromXInMemory( + Memory: Pointer; + SizeOfMemory: DWORD; + Options: DWORD; + pD3D: IDirect3DDevice9; + ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer; + pNumMaterials: PDWORD; + out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXLoadMeshFromXInMemory} + +function D3DXLoadMeshFromXResource( + Module: HModule; + Name: PAnsiChar; + _Type: PAnsiChar; + Options: DWORD; + pD3D: IDirect3DDevice9; + ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer; + pNumMaterials: PDWORD; + out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXLoadMeshFromXResource} + +function D3DXSaveMeshToXA( + pFilename: PAnsiChar; + pMesh: ID3DXMesh; + pAdjacency: PDWORD; + pMaterials: PD3DXMaterial; + pEffectInstances: PD3DXEffectInstance; + NumMaterials: DWORD; + Format: DWORD): HResult; stdcall; external d3dx9meshDLL name 'D3DXSaveMeshToXA'; +{$EXTERNALSYM D3DXSaveMeshToXA} + +function D3DXSaveMeshToXW( + pFilename: PWideChar; + pMesh: ID3DXMesh; + pAdjacency: PDWORD; + pMaterials: PD3DXMaterial; + pEffectInstances: PD3DXEffectInstance; + NumMaterials: DWORD; + Format: DWORD): HResult; stdcall; external d3dx9meshDLL name 'D3DXSaveMeshToXW'; +{$EXTERNALSYM D3DXSaveMeshToXW} + +function D3DXSaveMeshToX( + pFilename: PChar; + pMesh: ID3DXMesh; + pAdjacency: PDWORD; + pMaterials: PD3DXMaterial; + pEffectInstances: PD3DXEffectInstance; + NumMaterials: DWORD; + Format: DWORD): HResult; stdcall; external d3dx9meshDLL name 'D3DXSaveMeshToXA'; +{$EXTERNALSYM D3DXSaveMeshToX} + + +function D3DXCreatePMeshFromStream( + pStream: IStream; + Options: DWORD; + pD3DDevice: IDirect3DDevice9; + ppMaterials: PID3DXBuffer; + ppEffectInstances: PID3DXBuffer; + pNumMaterials: PDWORD; + out ppPMesh: ID3DXPMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreatePMeshFromStream} + +// Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices +// The bone names and initial bone transforms are not filled in the skin info object by this method. +function D3DXCreateSkinInfo( + NumVertices: DWORD; + pDeclaration: PD3DVertexElement9; + NumBones: DWORD; + out ppSkinInfo: ID3DXSkinInfo): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreateSkinInfo} + +// Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices +// The bone names and initial bone transforms are not filled in the skin info object by this method. +function D3DXCreateSkinInfoFVF( + NumVertices: DWORD; + FVF: DWORD; + NumBones: DWORD; + out ppSkinInfo: ID3DXSkinInfo): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreateSkinInfoFVF} + +function D3DXLoadMeshFromXof( + pXofObjMesh: IDirectXFileData; + Options: DWord; + pD3D: IDirect3DDevice9; + ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer; + pNumMaterials: PDWord; + out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXLoadMeshFromXof} + +// This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file +// If skinning info is not present, ppSkinInfo will be NULL +function D3DXLoadSkinMeshFromXof( + pXofObjMesh: IDirectXFileData; + Options: DWORD; + pD3D: IDirect3DDevice9; + ppAdjacency, ppMaterials, ppEffectInstances: PID3DXBuffer; + pMatOut: PDWORD; + out ppSkinInfo: ID3DXSkinInfo; + out ppMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXLoadSkinMeshFromXof} + +// The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from +// the mesh and the bone combination table and populates a skin info object with that data. The bone +// names and initial bone transforms are not filled in the skin info object by this method. This works +// with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to +// determine what type it is. +function D3DXCreateSkinInfoFromBlendedMesh( + pMesh: ID3DXBaseMesh; + NumBoneCombinations: DWORD; + pBoneCombinationTable: PD3DXBoneCombination; + out ppSkinInfo: ID3DXSkinInfo): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreateSkinInfoFromBlendedMesh} + +function D3DXTessellateNPatches(pMeshIn: ID3DXMesh; + pAdjacencyIn: PDWord; NumSegs: Single; + QuadraticInterpNormals: BOOL; // if false use linear intrep for normals, if true use quadratic + out ppMeshOut: ID3DXMesh; ppAdjacencyOut: PDWord): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXTessellateNPatches} + + +//generates implied outputdecl from input decl +//the decl generated from this should be used to generate the output decl for +//the tessellator subroutines. + +function D3DXGenerateOutputDecl( + pOutput: PD3DVertexElement9; + pInput: PD3DVertexElement9): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXGenerateOutputDecl} + +//loads patches from an XFileData +//since an X file can have up to 6 different patch meshes in it, +//returns them in an array - pNumPatches will contain the number of +//meshes in the actual file. +function D3DXLoadPatchMeshFromXof( + pXofObjMesh: IDirectXFileData; + Options: DWORD; + pDevice: IDirect3DDevice9; + ppMaterials: PID3DXBuffer; + ppEffectInstances: PID3DXBuffer; + pNumMaterials: PDWORD; + out ppMesh: ID3DXPatchMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXLoadPatchMeshFromXof} + +//computes the size a single rect patch. +function D3DXRectPatchSize( + pfNumSegs: PSingle; //segments for each edge (4) + pdwTriangles: PDWORD; //output number of triangles + pdwVertices: PDWORD //output number of vertices + ): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXRectPatchSize} + +//computes the size of a single triangle patch +function D3DXTriPatchSize( + pfNumSegs: PSingle; //segments for each edge (3) + pdwTriangles: PDWORD; //output number of triangles + pdwVertices: PDWORD //output number of vertices + ): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXTriPatchSize} + + +//tessellates a patch into a created mesh +//similar to D3D RT patch +function D3DXTessellateRectPatch( + pVB: IDirect3DVertexBuffer9; + pNumSegs: PSingle; + pdwInDecl: PD3DVertexElement9; + const pRectPatchInfo: TD3DRectPatchInfo; + pMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXTessellateRectPatch} + + +function D3DXTessellateTriPatch( + pVB: IDirect3DVertexBuffer9; + pNumSegs: PSingle; + pInDecl: PD3DVertexElement9; + pTriPatchInfo: TD3DTriPatchInfo; + pMesh: ID3DXMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXTessellateTriPatch} + + + +//creates an NPatch PatchMesh from a D3DXMESH +function D3DXCreateNPatchMesh( + pMeshSysMem: ID3DXMesh; + out pPatchMesh: ID3DXPatchMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreateNPatchMesh} + + +//creates a patch mesh +function D3DXCreatePatchMesh( + const pInfo: TD3DXPatchInfo; //patch type + dwNumPatches: DWORD; //number of patches + dwNumVertices: DWORD; //number of control vertices + dwOptions: DWORD; //options + pDecl: PD3DVertexElement9; //format of control vertices + pDevice: IDirect3DDevice9; + out pPatchMesh: ID3DXPatchMesh): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXCreatePatchMesh} + + +//returns the number of degenerates in a patch mesh - +//text output put in string. +function D3DXValidPatchMesh( + pMesh: ID3DXPatchMesh; + dwcDegenerateVertices: PDWORD; + dwcDegeneratePatches: PDWORD; + ppErrorsAndWarnings: PID3DXBuffer): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXValidPatchMesh} + +function D3DXGetFVFVertexSize(FVF: DWord): LongWord; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXGetFVFVertexSize} + +function D3DXGetDeclVertexSize(pDecl: PD3DVertexElement9; Stream: DWORD): LongWord; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXGetDeclVertexSize} + +function D3DXGetDeclLength(pDecl: PD3DVertexElement9): LongWord; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXGetDeclLength} + +function D3DXDeclaratorFromFVF(FVF: DWord; out Declaration: TFVFDeclaration): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXDeclaratorFromFVF} + +function D3DXFVFFromDeclarator(pDeclarator: PD3DVertexElement9; out pFVF: DWord): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXFVFFromDeclarator} + +function D3DXWeldVertices( + pMesh: ID3DXMesh; + Flags: DWORD; + pEpsilons: PD3DXWeldEpsilons; + rgdwAdjacencyIn, rgdwAdjacencyOut, pFaceRemap: PDWord; + ppVertexRemap: PID3DXBuffer): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXWeldVertices} + +type + PD3DXIntersectInfo = ^TD3DXIntersectInfo; + _D3DXINTERSECTINFO = packed record + FaceIndex: DWord; // index of face intersected + U: Single; // Barycentric Hit Coordinates + V: Single; // Barycentric Hit Coordinates + Dist: Single; // Ray-Intersection Parameter Distance + end; + {$EXTERNALSYM _D3DXINTERSECTINFO} + D3DXINTERSECTINFO = _D3DXINTERSECTINFO; + {$EXTERNALSYM D3DXINTERSECTINFO} + TD3DXIntersectInfo = _D3DXINTERSECTINFO; + +function D3DXIntersect(pMesh: ID3DXBaseMesh; + const pRayPos, pRayDir: TD3DXVector3; + out pHit: BOOL; // True if any faces were intersected + pFaceIndex: PDWord; // index of closest face intersected + pU: PSingle; // Barycentric Hit Coordinates + pV: PSingle; // Barycentric Hit Coordinates + pDist: PSingle; // Ray-Intersection Parameter Distance + ppAllHits: PID3DXBuffer; // Array of D3DXINTERSECTINFOs for all hits (not just closest) + pCountOfHits: PDWord // Number of entries in AllHits array + ): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXIntersect} + +function D3DXIntersectSubset(pMesh: ID3DXBaseMesh; AttribId: DWord; + const pRayPos, pRayDir: TD3DXVector3; + out pHit: BOOL; // True if any faces were intersected + pFaceIndex: PDWord; // index of closest face intersected + pU: PSingle; // Barycentric Hit Coordinates + pV: PSingle; // Barycentric Hit Coordinates + pDist: PSingle; // Ray-Intersection Parameter Distance + ppAllHits: PID3DXBuffer; // Array of D3DXINTERSECTINFOs for all hits (not just closest) + pCountOfHits: PDWord // Number of entries in AllHits array + ): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXIntersectSubset} + + +function D3DXSplitMesh(pMeshIn: ID3DXMesh; pAdjacencyIn: PDWord; + MaxSize, Options: DWord; + out pMeshesOut: DWord; out ppMeshArrayOut: ID3DXBuffer; + ppAdjacencyArrayOut, ppFaceRemapArrayOut, ppVertRemapArrayOut: PID3DXBuffer + ): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXSplitMesh} + +function D3DXIntersectTri( + const p0: TD3DXVector3; // Triangle vertex 0 position + const p1: TD3DXVector3; // Triangle vertex 1 position + const p2: TD3DXVector3; // Triangle vertex 2 position + const pRayPos: TD3DXVector3; // Ray origin + const pRayDir: TD3DXVector3; // Ray direction + out pU: Single; // Barycentric Hit Coordinates + out pV: Single; // Barycentric Hit Coordinates + out pDist: Single // Ray-Intersection Parameter Distance + ): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXIntersectTri} + +function D3DXSphereBoundProbe(const pCenter: TD3DXVector3; Radius: Single; + out pRayPosition, pRayDirection: TD3DXVector3): BOOL; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXSphereBoundProbe} + +function D3DXBoxBoundProbe(const pMin, pMax: TD3DXVector3; + out pRayPosition, pRayDirection: TD3DXVector3): BOOL; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXBoxBoundProbe} + + + +//D3DXComputeTangent +// +//Computes the Tangent vectors for the TexStage texture coordinates +//and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL +//puts the binorm in BINORM[BinormIndex] also specified in the decl. +// +//If neither the binorm or the tangnet are in the meshes declaration, +//the function will fail. +// +//If a tangent or Binorm field is in the Decl, but the user does not +//wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified +//in the TangentIndex or BinormIndex will cause it to ignore the specified +//semantic. +// +//Wrap should be specified if the texture coordinates wrap. + +function D3DXComputeTangent( + Mesh: ID3DXMesh; + TexStage: DWORD; + TangentIndex: DWORD; + BinormIndex: DWORD; + Wrap: DWORD; + Adjacency: PDWORD): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXComputeTangent} + +function D3DXConvertMeshSubsetToSingleStrip( + MeshIn: ID3DXBaseMesh; + AttribId: DWord; + IBOptions: DWord; + out ppIndexBuffer: IDirect3DIndexBuffer9; + pNumIndices: PDWord): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXConvertMeshSubsetToSingleStrip} + +function D3DXConvertMeshSubsetToStrips( + MeshIn: ID3DXBaseMesh; + AttribId: DWord; + IBOptions: DWord; + out ppIndexBuffer: IDirect3DIndexBuffer9; + pNumIndices: PDWord; + ppStripLengths: PID3DXBuffer; + pNumStrips: PDWord): HResult; stdcall; external d3dx9meshDLL; +{$EXTERNALSYM D3DXConvertMeshSubsetToStrips} + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Definitions of .X file templates used by mesh load/save functions +// that are not RM standard +// +////////////////////////////////////////////////////////////////////////////// + +const + DXFILEOBJ_XSkinMeshHeader: TGUID = '{3CF169CE-FF7C-44ab-93C0-F78F62D172E2}'; + {$EXTERNALSYM DXFILEOBJ_XSkinMeshHeader} + DXFILEOBJ_VertexDuplicationIndices: TGUID = '{B8D65549-D7C9-4995-89CF-53A9A8B031E3}'; + {$EXTERNALSYM DXFILEOBJ_VertexDuplicationIndices} + DXFILEOBJ_FaceAdjacency: TGUID = '{A64C844A-E282-4756-8B80-250CDE04398C}'; + {$EXTERNALSYM DXFILEOBJ_FaceAdjacency} + DXFILEOBJ_SkinWeights: TGUID = '{6F0D123B-BAD2-4167-A0D0-80224F25FABB}'; + {$EXTERNALSYM DXFILEOBJ_SkinWeights} + DXFILEOBJ_Patch: TGUID = '{A3EB5D44-FC22-429d-9AFB-3221CB9719A6}'; + {$EXTERNALSYM DXFILEOBJ_Patch} + DXFILEOBJ_PatchMesh: TGUID = '{D02C95CC-EDBA-4305-9B5D-1820D7704BBF}'; + {$EXTERNALSYM DXFILEOBJ_PatchMesh} + DXFILEOBJ_PatchMesh9: TGUID = '{B9EC94E1-B9A6-4251-BA18-94893F02C0EA}'; + {$EXTERNALSYM DXFILEOBJ_PatchMesh9} + DXFILEOBJ_PMInfo: TGUID = '{B6C3E656-EC8B-4b92-9B62-681659522947}'; + {$EXTERNALSYM DXFILEOBJ_PMInfo} + DXFILEOBJ_PMAttributeRange: TGUID = '{917E0427-C61E-4a14-9C64-AFE65F9E9844}'; + {$EXTERNALSYM DXFILEOBJ_PMAttributeRange} + DXFILEOBJ_PMVSplitRecord: TGUID = '{574CCC14-F0B3-4333-822D-93E8A8A08E4C}'; + {$EXTERNALSYM DXFILEOBJ_PMVSplitRecord} + DXFILEOBJ_FVFData: TGUID = '{B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897}'; + {$EXTERNALSYM DXFILEOBJ_FVFData} + DXFILEOBJ_VertexElement: TGUID = '{F752461C-1E23-48f6-B9F8-8350850F336F}'; + {$EXTERNALSYM DXFILEOBJ_VertexElement} + DXFILEOBJ_DeclData: TGUID = '{BF22E553-292C-4781-9FEA-62BD554BDD93}'; + {$EXTERNALSYM DXFILEOBJ_DeclData} + DXFILEOBJ_EffectFloats: TGUID = '{F1CFE2B3-0DE3-4e28-AFA1-155A750A282D}'; + {$EXTERNALSYM DXFILEOBJ_EffectFloats} + DXFILEOBJ_EffectString: TGUID = '{D55B097E-BDB6-4c52-B03D-6051C89D0E42}'; + {$EXTERNALSYM DXFILEOBJ_EffectString} + DXFILEOBJ_EffectDWord: TGUID = '{622C0ED0-956E-4da9-908A-2AF94F3CE716}'; + {$EXTERNALSYM DXFILEOBJ_EffectDWord} + DXFILEOBJ_EffectParamFloats: TGUID = '{3014B9A0-62F5-478c-9B86-E4AC9F4E418B}'; + {$EXTERNALSYM DXFILEOBJ_EffectParamFloats} + DXFILEOBJ_EffectParamString: TGUID = '{1DBC4C88-94C1-46ee-9076-2C28818C9481}'; + {$EXTERNALSYM DXFILEOBJ_EffectParamString} + DXFILEOBJ_EffectParamDWord: TGUID = '{E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5}'; + {$EXTERNALSYM DXFILEOBJ_EffectParamDWord} + DXFILEOBJ_EffectInstance: TGUID = '{E331F7E4-0559-4cc2-8E99-1CEC1657928F}'; + {$EXTERNALSYM DXFILEOBJ_EffectInstance} + DXFILEOBJ_AnimTicksPerSecond: TGUID = '{9E415A43-7BA6-4a73-8743-B73D47E88476}'; + {$EXTERNALSYM DXFILEOBJ_AnimTicksPerSecond} + +const + XSKINEXP_TEMPLATES = + 'xof 0303txt 0032' + + 'template XSkinMeshHeader ' + + '{ ' + + ' <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> ' + + ' WORD nMaxSkinWeightsPerVertex; ' + + ' WORD nMaxSkinWeightsPerFace; ' + + ' WORD nBones; ' + + '} ' + + 'template VertexDuplicationIndices ' + + '{ ' + + ' ' + + ' DWORD nIndices; ' + + ' DWORD nOriginalVertices; ' + + ' array DWORD indices[nIndices]; ' + + '} ' + + 'template FaceAdjacency ' + + '{ ' + + ' ' + + ' DWORD nIndices; ' + + ' array DWORD indices[nIndices]; ' + + '} ' + + 'template SkinWeights ' + + '{ ' + + ' <6F0D123B-BAD2-4167-A0D0-80224F25FABB> ' + + ' STRING transformNodeName; ' + + ' DWORD nWeights; ' + + ' array DWORD vertexIndices[nWeights]; ' + + ' array float weights[nWeights]; ' + + ' Matrix4x4 matrixOffset; ' + + '} ' + + 'template Patch ' + + '{ ' + + ' ' + + ' DWORD nControlIndices; ' + + ' array DWORD controlIndices[nControlIndices]; ' + + '} ' + + 'template PatchMesh ' + + '{ ' + + ' ' + + ' DWORD nVertices; ' + + ' array Vector vertices[nVertices]; ' + + ' DWORD nPatches; ' + + ' array Patch patches[nPatches]; ' + + ' [ ... ] ' + + '} ' + + 'template PatchMesh9 ' + + '{ ' + + ' ' + + ' DWORD Type; ' + + ' DWORD Degree; ' + + ' DWORD Basis; ' + + ' DWORD nVertices; ' + + ' array Vector vertices[nVertices]; ' + + ' DWORD nPatches; ' + + ' array Patch patches[nPatches]; ' + + ' [ ... ] ' + + '} ' + + 'template EffectFloats ' + + '{ ' + + ' ' + + ' DWORD nFloats; ' + + ' array float Floats[nFloats]; ' + + '} ' + + 'template EffectString ' + + '{ ' + + ' ' + + ' STRING Value; ' + + '} ' + + 'template EffectDWord ' + + '{ ' + + ' <622C0ED0-956E-4da9-908A-2AF94F3CE716> ' + + ' DWORD Value; ' + + '} ' + + 'template EffectParamFloats ' + + '{ ' + + ' <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> ' + + ' STRING ParamName; ' + + ' DWORD nFloats; ' + + ' array float Floats[nFloats]; ' + + '} ' + + 'template EffectParamString ' + + '{ ' + + ' <1DBC4C88-94C1-46ee-9076-2C28818C9481> ' + + ' STRING ParamName; ' + + ' STRING Value; ' + + '} ' + + 'template EffectParamDWord ' + + '{ ' + + ' ' + + ' STRING ParamName; ' + + ' DWORD Value; ' + + '} ' + + 'template EffectInstance ' + + '{ ' + + ' ' + + ' STRING EffectFilename; ' + + ' [ ... ] ' + + '} ' + + 'template AnimTicksPerSecond ' + + '{ ' + + ' <9E415A43-7BA6-4a73-8743-B73D47E88476> ' + + ' DWORD AnimTicksPerSecond; ' + + '} '; + {$EXTERNALSYM XSKINEXP_TEMPLATES} + + XEXTENSIONS_TEMPLATES = + 'xof 0303txt 0032' + + 'template FVFData ' + + '{ ' + + ' ' + + ' DWORD dwFVF; ' + + ' DWORD nDWords; ' + + ' array DWORD data[nDWords]; ' + + '} ' + + 'template VertexElement ' + + '{ ' + + ' ' + + ' DWORD Type; ' + + ' DWORD Method; ' + + ' DWORD Usage; ' + + ' DWORD UsageIndex; ' + + '} ' + + 'template DeclData ' + + '{ ' + + ' ' + + ' DWORD nElements; ' + + ' array VertexElement Elements[nElements]; ' + + ' DWORD nDWords; ' + + ' array DWORD data[nDWords]; ' + + '} ' + + 'template PMAttributeRange ' + + '{ ' + + ' <917E0427-C61E-4a14-9C64-AFE65F9E9844> ' + + ' DWORD iFaceOffset; ' + + ' DWORD nFacesMin; ' + + ' DWORD nFacesMax; ' + + ' DWORD iVertexOffset; ' + + ' DWORD nVerticesMin; ' + + ' DWORD nVerticesMax; ' + + '} ' + + 'template PMVSplitRecord ' + + '{ ' + + ' <574CCC14-F0B3-4333-822D-93E8A8A08E4C> ' + + ' DWORD iFaceCLW; ' + + ' DWORD iVlrOffset; ' + + ' DWORD iCode; ' + + '} ' + + 'template PMInfo ' + + '{ ' + + ' ' + + ' DWORD nAttributes; ' + + ' array PMAttributeRange attributeRanges[nAttributes]; ' + + ' DWORD nMaxValence; ' + + ' DWORD nMinLogicalVertices; ' + + ' DWORD nMaxLogicalVertices; ' + + ' DWORD nVSplits; ' + + ' array PMVSplitRecord splitRecords[nVSplits]; ' + + ' DWORD nAttributeMispredicts; ' + + ' array DWORD attributeMispredicts[nAttributeMispredicts]; ' + + '} '; + {$EXTERNALSYM XEXTENSIONS_TEMPLATES} + + + + + +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9shapes.h +// Content: D3DX simple shapes +// +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////// +// Functions: +/////////////////////////////////////////////////////////////////////////// + + +//------------------------------------------------------------------------- +// D3DXCreatePolygon: +// ------------------ +// Creates a mesh containing an n-sided polygon. The polygon is centered +// at the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Length Length of each side. +// Sides Number of sides the polygon has. (Must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreatePolygon(ppDevice: IDirect3DDevice9; + Length: Single; + Sides: LongWord; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL; +{$EXTERNALSYM D3DXCreatePolygon} + + +//------------------------------------------------------------------------- +// D3DXCreateBox: +// -------------- +// Creates a mesh containing an axis-aligned box. The box is centered at +// the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Width Width of box (along X-axis) +// Height Height of box (along Y-axis) +// Depth Depth of box (along Z-axis) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateBox(ppDevice: IDirect3DDevice9; + Width, + Height, + Depth: Single; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL; +{$EXTERNALSYM D3DXCreateBox} + + +//------------------------------------------------------------------------- +// D3DXCreateCylinder: +// ------------------- +// Creates a mesh containing a cylinder. The generated cylinder is +// centered at the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius1 Radius at -Z end (should be >= 0.0f) +// Radius2 Radius at +Z end (should be >= 0.0f) +// Length Length of cylinder (along Z-axis) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateCylinder(ppDevice: IDirect3DDevice9; + Radius1, + Radius2, + Length: Single; + Slices, + Stacks: LongWord; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL; +{$EXTERNALSYM D3DXCreateCylinder} + + +//------------------------------------------------------------------------- +// D3DXCreateSphere: +// ----------------- +// Creates a mesh containing a sphere. The sphere is centered at the +// origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius Radius of the sphere (should be >= 0.0f) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateSphere(ppDevice: IDirect3DDevice9; + Radius: Single; + Slices, + Stacks: LongWord; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL; +{$EXTERNALSYM D3DXCreateSphere} + + +//------------------------------------------------------------------------- +// D3DXCreateTorus: +// ---------------- +// Creates a mesh containing a torus. The generated torus is centered at +// the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// InnerRadius Inner radius of the torus (should be >= 0.0f) +// OuterRadius Outer radius of the torue (should be >= 0.0f) +// Sides Number of sides in a cross-section (must be >= 3) +// Rings Number of rings making up the torus (must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateTorus(ppDevice: IDirect3DDevice9; + InnerRadius, + OuterRadius: Single; + Sides, + Rings: LongWord; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL; +{$EXTERNALSYM D3DXCreateTorus} + + +//------------------------------------------------------------------------- +// D3DXCreateTeapot: +// ----------------- +// Creates a mesh containing a teapot. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +function D3DXCreateTeapot(ppDevice: IDirect3DDevice9; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer): HResult; stdcall; external d3dx9shapesDLL; +{$EXTERNALSYM D3DXCreateTeapot} + + +//------------------------------------------------------------------------- +// D3DXCreateText: +// --------------- +// Creates a mesh containing the specified text using the font associated +// with the device context. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// hDC Device context, with desired font selected +// pText Text to generate +// Deviation Maximum chordal deviation from true font outlines +// Extrusion Amount to extrude text in -Z direction +// ppMesh The mesh object which will be created +// pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) +//------------------------------------------------------------------------- + +function D3DXCreateTextA(ppDevice: IDirect3DDevice9; + hDC: HDC; + pText: PAnsiChar; + Deviation: Single; + Extrusion: Single; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer; + pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx9shapesDLL name 'D3DXCreateTextA'; +{$EXTERNALSYM D3DXCreateTextA} + +function D3DXCreateTextW(ppDevice: IDirect3DDevice9; + hDC: HDC; + pText: PWideChar; + Deviation: Single; + Extrusion: Single; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer; + pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx9shapesDLL name 'D3DXCreateTextW'; +{$EXTERNALSYM D3DXCreateTextW} + +function D3DXCreateText(ppDevice: IDirect3DDevice9; + hDC: HDC; + pText: PChar; + Deviation: Single; + Extrusion: Single; + out ppMesh: ID3DXMesh; + ppAdjacency: PID3DXBuffer; + pGlyphMetrics: PGlyphMetricsFloat): HResult; stdcall; external d3dx9shapesDLL name 'D3DXCreateTextA'; +{$EXTERNALSYM D3DXCreateText} + + + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9tex.h +// Content: D3DX texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR +// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | +// D3DX_FILTER_MIRROR_V +// D3DX_FILTER_DITHER +// Dithers the resulting image using a 4x4 order dither pattern. +// D3DX_FILTER_SRGB_IN +// Denotes that the input data is in sRGB (gamma 2.2) colorspace. +// D3DX_FILTER_SRGB_OUT +// Denotes that the output data is in sRGB (gamma 2.2) colorspace. +// D3DX_FILTER_SRGB +// Same as specifying D3DX_FILTER_SRGB_IN | D3DX_FILTER_SRGB_OUT +// +//---------------------------------------------------------------------------- + +const + D3DX_FILTER_NONE = (1 shl 0); + {$EXTERNALSYM D3DX_FILTER_NONE} + D3DX_FILTER_POINT = (2 shl 0); + {$EXTERNALSYM D3DX_FILTER_POINT} + D3DX_FILTER_LINEAR = (3 shl 0); + {$EXTERNALSYM D3DX_FILTER_LINEAR} + D3DX_FILTER_TRIANGLE = (4 shl 0); + {$EXTERNALSYM D3DX_FILTER_TRIANGLE} + D3DX_FILTER_BOX = (5 shl 0); + {$EXTERNALSYM D3DX_FILTER_BOX} + + D3DX_FILTER_MIRROR_U = (1 shl 16); + {$EXTERNALSYM D3DX_FILTER_MIRROR_U} + D3DX_FILTER_MIRROR_V = (2 shl 16); + {$EXTERNALSYM D3DX_FILTER_MIRROR_V} + D3DX_FILTER_MIRROR_W = (4 shl 16); + {$EXTERNALSYM D3DX_FILTER_MIRROR_W} + D3DX_FILTER_MIRROR = (7 shl 16); + {$EXTERNALSYM D3DX_FILTER_MIRROR} + D3DX_FILTER_DITHER = (1 shl 19); + {$EXTERNALSYM D3DX_FILTER_DITHER} + D3DX_FILTER_SRGB_IN = (1 shl 20); + {$EXTERNALSYM D3DX_FILTER_SRGB_IN} + D3DX_FILTER_SRGB_OUT = (2 shl 20); + {$EXTERNALSYM D3DX_FILTER_SRGB_OUT} + D3DX_FILTER_SRGB = (3 shl 20); + {$EXTERNALSYM D3DX_FILTER_SRGB} + + +//---------------------------------------------------------------------------- +// D3DX_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DXComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR +// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V +// D3DX_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- + +const + D3DX_NORMALMAP_MIRROR_U = (1 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_MIRROR_U} + D3DX_NORMALMAP_MIRROR_V = (2 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_MIRROR_V} + D3DX_NORMALMAP_MIRROR = (3 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_MIRROR} + D3DX_NORMALMAP_INVERTSIGN = (8 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_INVERTSIGN} + D3DX_NORMALMAP_COMPUTE_OCCLUSION = (16 shl 16); + {$EXTERNALSYM D3DX_NORMALMAP_COMPUTE_OCCLUSION} + + +//---------------------------------------------------------------------------- +// D3DX_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX_CHANNEL_RED +// Indicates the red channel should be used +// D3DX_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +const + D3DX_CHANNEL_RED = (1 shl 0); + {$EXTERNALSYM D3DX_CHANNEL_RED} + D3DX_CHANNEL_BLUE = (1 shl 1); + {$EXTERNALSYM D3DX_CHANNEL_BLUE} + D3DX_CHANNEL_GREEN = (1 shl 2); + {$EXTERNALSYM D3DX_CHANNEL_GREEN} + D3DX_CHANNEL_ALPHA = (1 shl 3); + {$EXTERNALSYM D3DX_CHANNEL_ALPHA} + D3DX_CHANNEL_LUMINANCE = (1 shl 4); + {$EXTERNALSYM D3DX_CHANNEL_LUMINANCE} + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_FILEFORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +type + PD3DXImageFileFormat = ^TD3DXImageFileFormat; + _D3DXIMAGE_FILEFORMAT = ( + D3DXIFF_BMP {= 0}, + D3DXIFF_JPG {= 1}, + D3DXIFF_TGA {= 2}, + D3DXIFF_PNG {= 3}, + D3DXIFF_DDS {= 4}, + D3DXIFF_PPM {= 5}, + D3DXIFF_DIB {= 6} + ); + {$EXTERNALSYM _D3DXIMAGE_FILEFORMAT} + D3DXIMAGE_FILEFORMAT = _D3DXIMAGE_FILEFORMAT; + {$EXTERNALSYM D3DXIMAGE_FILEFORMAT} + TD3DXImageFileFormat = _D3DXIMAGE_FILEFORMAT; + + +//---------------------------------------------------------------------------- +// LPD3DXFILL2D and LPD3DXFILL3D: +// ------------------------------ +// Function types used by the texture fill functions. +// +// Parameters: +// pOut +// Pointer to a vector which the function uses to return its result. +// X,Y,Z,W will be mapped to R,G,B,A respectivly. +// pTexCoord +// Pointer to a vector containing the coordinates of the texel currently +// being evaluated. Textures and VolumeTexture texcoord components +// range from 0 to 1. CubeTexture texcoord component range from -1 to 1. +// pTexelSize +// Pointer to a vector containing the dimensions of the current texel. +// pData +// Pointer to user data. +// +//---------------------------------------------------------------------------- + +type + //typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *pOut, + // CONST D3DXVECTOR2 *pTexCoord, CONST D3DXVECTOR2 *pTexelSize, LPVOID pData); + TD3DXFill2D = procedure (out pOut: TD3DXVector4; const pTexCoord, pTexelSize: TD3DXVector2; var pData); + {$NODEFINE TD3DXFill2D} + {$HPPEMIT 'typedef LPD3DXFILL2D TD3DXFill2D;'} + + //typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *pOut, + // CONST D3DXVECTOR3 *pTexCoord, CONST D3DXVECTOR3 *pTexelSize, LPVOID pData); + TD3DXFill3D = procedure (out pOut: TD3DXVector4; const pTexCoord, pTexelSize: TD3DXVector3; var pData); + {$NODEFINE TD3DXFill3D} + {$HPPEMIT 'typedef LPD3DXFILL3D TD3DXFill3D;'} + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// MipLevels +// Number of mip levels in original image +// Format +// D3D format which most closely describes the data in original image +// ResourceType +// D3DRESOURCETYPE representing the type of texture stored in the file. +// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. +// ImageFileFormat +// D3DXIMAGE_FILEFORMAT representing the format of the image file. +// +//---------------------------------------------------------------------------- + +type + PD3DXImageInfo = ^TD3DXImageInfo; + _D3DXIMAGE_INFO = packed record + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Format: TD3DFormat; + ResourceType: TD3DResourceType; + ImageFileFormat: TD3DXImageFileFormat; + end; + {$EXTERNALSYM _D3DXIMAGE_INFO} + D3DXIMAGE_INFO = _D3DXIMAGE_INFO; + {$EXTERNALSYM D3DXIMAGE_INFO} + TD3DXImageInfo = _D3DXIMAGE_INFO; + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource: +// ------------------------------ +// Fills in a D3DXIMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// +//---------------------------------------------------------------------------- + +function D3DXGetImageInfoFromFileA( + pSrcFile: PAnsiChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromFileA'; +{$EXTERNALSYM D3DXGetImageInfoFromFileA} + +function D3DXGetImageInfoFromFileW( + pSrcFile: PWideChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromFileW'; +{$EXTERNALSYM D3DXGetImageInfoFromFileW} + +function D3DXGetImageInfoFromFile( + pSrcFile: PChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromFileA'; +{$EXTERNALSYM D3DXGetImageInfoFromFile} + + +function D3DXGetImageInfoFromResourceA( + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromResourceA'; +{$EXTERNALSYM D3DXGetImageInfoFromResourceA} + +function D3DXGetImageInfoFromResourceW( + hSrcModule: HModule; + pSrcResource: PWideChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromResourceW'; +{$EXTERNALSYM D3DXGetImageInfoFromResourceW} + +function D3DXGetImageInfoFromResource( + hSrcModule: HModule; + pSrcResource: PChar; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXGetImageInfoFromResourceA'; +{$EXTERNALSYM D3DXGetImageInfoFromResource} + + +function D3DXGetImageInfoFromFileInMemory( + const pSrcData; + SrcDataSize: LongWord; + out pSrcInfo: TD3DXImageInfo): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXGetImageInfoFromFileInMemory} + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Surface APIs //////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromFile/Resource: +// --------------------------------- +// Load surface from a file or resource +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcRect +// Source rectangle, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- +function D3DXLoadSurfaceFromFileA( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + pSrcFile: PAnsiChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromFileA'; +{$EXTERNALSYM D3DXLoadSurfaceFromFileA} + +function D3DXLoadSurfaceFromFileW( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + pSrcFile: PWideChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromFileW'; +{$EXTERNALSYM D3DXLoadSurfaceFromFileW} + +function D3DXLoadSurfaceFromFile( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + pSrcFile: PChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromFileA'; +{$EXTERNALSYM D3DXLoadSurfaceFromFile} + + + +function D3DXLoadSurfaceFromResourceA( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromResourceA'; +{$EXTERNALSYM D3DXLoadSurfaceFromResourceA} + +function D3DXLoadSurfaceFromResourceW( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + hSrcModule: HModule; + pSrcResource: PWideChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromResourceW'; +{$EXTERNALSYM D3DXLoadSurfaceFromResourceW} + +function D3DXLoadSurfaceFromResource( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + hSrcModule: HModule; + pSrcResource: PChar; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadSurfaceFromResourceA'; +{$EXTERNALSYM D3DXLoadSurfaceFromResource} + + + +function D3DXLoadSurfaceFromFileInMemory( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + const pSrcData; + SrcDataSize: LongWord; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXLoadSurfaceFromFileInMemory} + + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromSurface: +// --------------------------- +// Load surface from another surface (with color conversion) +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcSurface +// Source surface +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for entire surface +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +function D3DXLoadSurfaceFromSurface( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + pSrcSurface: IDirect3DSurface9; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXLoadSurfaceFromSurface} + + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromMemory: +// --------------------------- +// Load surface from memory. +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcMemory +// Pointer to the top-left corner of the source image in memory +// SrcFormat +// Pixel format of the source image. +// SrcPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the width of one row of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +function D3DXLoadSurfaceFromMemory( + pDestSurface: IDirect3DSurface9; + pDestPalette: PPaletteEntry; + pDestRect: PRect; + const pSrcMemory; + SrcFormat: TD3DFormat; + SrcPitch: LongWord; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect; + Filter: DWord; + ColorKey: TD3DColor): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXLoadSurfaceFromMemory} + + + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFile: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +function D3DXSaveSurfaceToFileA( + pDestFile: PAnsiChar; + DestFormat: TD3DXImageFileFormat; + pSrcSurface: IDirect3DSurface9; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveSurfaceToFileA'; +{$EXTERNALSYM D3DXSaveSurfaceToFileA} + +function D3DXSaveSurfaceToFileW( + pDestFile: PWideChar; + DestFormat: TD3DXImageFileFormat; + pSrcSurface: IDirect3DSurface9; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveSurfaceToFileW'; +{$EXTERNALSYM D3DXSaveSurfaceToFileW} + +function D3DXSaveSurfaceToFile( + pDestFile: PChar; + DestFormat: TD3DXImageFileFormat; + pSrcSurface: IDirect3DSurface9; + pSrcPalette: PPaletteEntry; + pSrcRect: PRect): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveSurfaceToFileA'; +{$EXTERNALSYM D3DXSaveSurfaceToFile} + + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Volume APIs ///////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromFile/Resource: +// -------------------------------- +// Load volume from a file or resource +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcBox +// Source box, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +function D3DXLoadVolumeFromFileA( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + pSrcFile: PAnsiChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromFileA'; +{$EXTERNALSYM D3DXLoadVolumeFromFileA} + +function D3DXLoadVolumeFromFileW( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + pSrcFile: PWideChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromFileW'; +{$EXTERNALSYM D3DXLoadVolumeFromFileW} + +function D3DXLoadVolumeFromFile( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + pSrcFile: PChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromFileA'; +{$EXTERNALSYM D3DXLoadVolumeFromFile} + + +function D3DXLoadVolumeFromResourceA( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromResourceA'; +{$EXTERNALSYM D3DXLoadVolumeFromResourceA} + +function D3DXLoadVolumeFromResourceW( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + hSrcModule: HModule; + pSrcResource: PWideChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromResourceW'; +{$EXTERNALSYM D3DXLoadVolumeFromResourceW} + +function D3DXLoadVolumeFromResource( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + hSrcModule: HModule; + pSrcResource: PChar; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL name 'D3DXLoadVolumeFromResourceA'; +{$EXTERNALSYM D3DXLoadVolumeFromResource} + + +function D3DXLoadVolumeFromFileInMemory( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + const pSrcData; + SrcDataSize: LongWord; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXLoadVolumeFromFileInMemory} + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromVolume: +// --------------------------- +// Load volume from another volume (with color conversion) +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcVolume +// Source volume +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for entire volume +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +function D3DXLoadVolumeFromVolume( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + pSrcVolume: IDirect3DVolume9; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXLoadVolumeFromVolume} + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromMemory: +// --------------------------- +// Load volume from memory. +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcMemory +// Pointer to the top-left corner of the source volume in memory +// SrcFormat +// Pixel format of the source volume. +// SrcRowPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one row of cells, in bytes. +// SrcSlicePitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one slice of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +function D3DXLoadVolumeFromMemory( + pDestVolume: IDirect3DVolume9; + pDestPalette: PPaletteEntry; + pDestBox: TD3DBox; + const pSrcMemory; + SrcFormat: TD3DFormat; + SrcRowPitch: LongWord; + SrcSlicePitch: LongWord; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox; + Filter: DWord; + ColorKey: TD3DColor): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXLoadVolumeFromMemory} + + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFile: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +function D3DXSaveVolumeToFileA( + pDestFile: PAnsiChar; + DestFormat: TD3DXImageFileFormat; + pSrcVolume: IDirect3DVolume9; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveVolumeToFileA'; +{$EXTERNALSYM D3DXSaveVolumeToFileA} + +function D3DXSaveVolumeToFileW( + pDestFile: PWideChar; + DestFormat: TD3DXImageFileFormat; + pSrcVolume: IDirect3DVolume9; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveVolumeToFileW'; +{$EXTERNALSYM D3DXSaveVolumeToFileW} + +function D3DXSaveVolumeToFile( + pDestFile: PChar; + DestFormat: TD3DXImageFileFormat; + pSrcVolume: IDirect3DVolume9; + pSrcPalette: PPaletteEntry; + pSrcBox: TD3DBox): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveVolumeToFileA'; +{$EXTERNALSYM D3DXSaveVolumeToFile} + + + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +//---------------------------------------------------------------------------- +// D3DXCheckTextureRequirements: +// ----------------------------- +// Checks texture creation parameters. If parameters are invalid, this +// function returns corrected parameters. +// +// Parameters: +// +// pDevice +// The D3D device to be used +// pWidth, pHeight, pDepth, pSize +// Desired size in pixels, or NULL. Returns corrected size. +// pNumMipLevels +// Number of desired mipmap levels, or NULL. Returns corrected number. +// Usage +// Texture usage flags +// pFormat +// Desired pixel format, or NULL. Returns corrected format. +// Pool +// Memory pool to be used to create texture +// +//---------------------------------------------------------------------------- +function D3DXCheckTextureRequirements( + pDevice: IDirect3DDevice9; + pWidth: PLongWord; + pHeight: PLongWord; + pNumMipLevels: PLongWord; + Usage: DWord; + pFormat: PD3DFormat; + Pool: TD3DPool): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCheckTextureRequirements} + +function D3DXCheckCubeTextureRequirements( + pDevice: IDirect3DDevice9; + pSize: PLongWord; + pNumMipLevels: PLongWord; + Usage: DWord; + pFormat: PD3DFormat; + Pool: TD3DPool): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCheckCubeTextureRequirements} + +function D3DXCheckVolumeTextureRequirements( + pDevice: IDirect3DDevice9; + pWidth: PLongWord; + pHeight: PLongWord; + pDepth: PLongWord; + pNumMipLevels: PLongWord; + Usage: DWord; + pFormat: PD3DFormat; + Pool: TD3DPool): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCheckVolumeTextureRequirements} + + +//---------------------------------------------------------------------------- +// D3DXCreateTexture: +// ------------------ +// Create an empty texture +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// Width, Height, Depth, Size +// size in pixels. these must be non-zero +// MipLevels +// number of mip levels desired. if zero or D3DX_DEFAULT, a complete +// mipmap chain will be created. +// Usage +// Texture usage flags +// Format +// Pixel format. +// Pool +// Memory pool to be used to create texture +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + +function D3DXCreateTexture( + Device: IDirect3DDevice9; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateTexture} + +function D3DXCreateCubeTexture( + Device: IDirect3DDevice9; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateCubeTexture} + +function D3DXCreateVolumeTexture( + Device: IDirect3DDevice9; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateVolumeTexture} + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureFromFile/Resource: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// Width, Height, Depth, Size +// Size in pixels. If zero or D3DX_DEFAULT, the size will be taken from +// the file and rounded up to a power of two. If D3DX_DEFAULT_NONPOW2, +// the size will be not be rounded, if the device supports NONPOW2 textures. +// MipLevels +// Number of mip levels. If zero or D3DX_DEFAULT, a complete mipmap +// chain will be created. +// Usage +// Texture usage flags +// Format +// Desired pixel format. If D3DFMT_UNKNOWN, the format will be +// taken from the file. +// Pool +// Memory pool to be used to create texture +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// MipFilter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// pPalette +// 256 color palette to be filled in, or NULL +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + + +// FromFile + +function D3DXCreateTextureFromFileA( + Device: IDirect3DDevice9; + pSrcFile: PAnsiChar; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileA'; +{$EXTERNALSYM D3DXCreateTextureFromFileA} + +function D3DXCreateTextureFromFileW( + Device: IDirect3DDevice9; + pSrcFile: PWideChar; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileW'; +{$EXTERNALSYM D3DXCreateTextureFromFileW} + +function D3DXCreateTextureFromFile( + Device: IDirect3DDevice9; + pSrcFile: PChar; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileA'; +{$EXTERNALSYM D3DXCreateTextureFromFile} + + +function D3DXCreateCubeTextureFromFileA( + Device: IDirect3DDevice9; + pSrcFile: PAnsiChar; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileA} + +function D3DXCreateCubeTextureFromFileW( + Device: IDirect3DDevice9; + pSrcFile: PWideChar; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileW'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileW} + +function D3DXCreateCubeTextureFromFile( + Device: IDirect3DDevice9; + pSrcFile: PChar; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFile} + + +function D3DXCreateVolumeTextureFromFileA( + Device: IDirect3DDevice9; + pSrcFile: PAnsiChar; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileA} + +function D3DXCreateVolumeTextureFromFileW( + Device: IDirect3DDevice9; + pSrcFile: PWideChar; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileW'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileW} + +function D3DXCreateVolumeTextureFromFile( + Device: IDirect3DDevice9; + pSrcFile: PChar; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFile} + + +// FromResource + +function D3DXCreateTextureFromResourceA( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateTextureFromResourceA} + +function D3DXCreateTextureFromResourceW( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PWideChar; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceW'; +{$EXTERNALSYM D3DXCreateTextureFromResourceW} + +function D3DXCreateTextureFromResource( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PChar; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateTextureFromResource} + + +function D3DXCreateCubeTextureFromResourceA( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceA} + +function D3DXCreateCubeTextureFromResourceW( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PWideChar; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceW'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceW} + +function D3DXCreateCubeTextureFromResource( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PChar; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResource} + + +function D3DXCreateVolumeTextureFromResourceA( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceA} + +function D3DXCreateVolumeTextureFromResourceW( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PWideChar; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceW'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceW} + +function D3DXCreateVolumeTextureFromResource( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PChar; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResource} + + +// FromFileEx + +function D3DXCreateTextureFromFileExA( + Device: IDirect3DDevice9; + pSrcFile: PAnsiChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateTextureFromFileExA} + +function D3DXCreateTextureFromFileExW( + Device: IDirect3DDevice9; + pSrcFile: PWideChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileExW'; +{$EXTERNALSYM D3DXCreateTextureFromFileExW} + +function D3DXCreateTextureFromFileEx( + Device: IDirect3DDevice9; + pSrcFile: PChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateTextureFromFileEx} + + +function D3DXCreateCubeTextureFromFileExA( + Device: IDirect3DDevice9; + pSrcFile: PAnsiChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileExA} + +function D3DXCreateCubeTextureFromFileExW( + Device: IDirect3DDevice9; + pSrcFile: PWideChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileExW'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileExW} + +function D3DXCreateCubeTextureFromFileEx( + Device: IDirect3DDevice9; + pSrcFile: PChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileEx} + + +function D3DXCreateVolumeTextureFromFileExA( + Device: IDirect3DDevice9; + pSrcFile: PAnsiChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileExA} + +function D3DXCreateVolumeTextureFromFileExW( + Device: IDirect3DDevice9; + pSrcFile: PWideChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileExW'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileExW} + +function D3DXCreateVolumeTextureFromFileEx( + Device: IDirect3DDevice9; + pSrcFile: PChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromFileExA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileEx} + + +// FromResourceEx + +function D3DXCreateTextureFromResourceExA( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateTextureFromResourceExA} + +function D3DXCreateTextureFromResourceExW( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PWideChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceExW'; +{$EXTERNALSYM D3DXCreateTextureFromResourceExW} + +function D3DXCreateTextureFromResourceEx( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PChar; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateTextureFromResourceEx} + + +function D3DXCreateCubeTextureFromResourceExA( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceExA} + +function D3DXCreateCubeTextureFromResourceExW( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PWideChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceExW'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceExW} + +function D3DXCreateCubeTextureFromResourceEx( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PChar; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateCubeTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateCubeTextureFromResourceEx} + + +function D3DXCreateVolumeTextureFromResourceExA( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PAnsiChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceExA} + +function D3DXCreateVolumeTextureFromResourceExW( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PWideChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceExW'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceExW} + +function D3DXCreateVolumeTextureFromResourceEx( + Device: IDirect3DDevice9; + hSrcModule: HModule; + pSrcResource: PChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL name 'D3DXCreateVolumeTextureFromResourceExA'; +{$EXTERNALSYM D3DXCreateVolumeTextureFromResourceEx} + + +// FromFileInMemory + +function D3DXCreateTextureFromFileInMemory( + Device: IDirect3DDevice9; + const pSrcData; + SrcDataSize: LongWord; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateTextureFromFileInMemory} + +function D3DXCreateCubeTextureFromFileInMemory( + Device: IDirect3DDevice9; + const pSrcData; + SrcDataSize: LongWord; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileInMemory} + +function D3DXCreateVolumeTextureFromFileInMemory( + Device: IDirect3DDevice9; + const pSrcData; + SrcDataSize: LongWord; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileInMemory} + + +// FromFileInMemoryEx + +function D3DXCreateTextureFromFileInMemoryEx( + Device: IDirect3DDevice9; + const pSrcData; + SrcDataSize: LongWord; + Width: LongWord; + Height: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppTexture: IDirect3DTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateTextureFromFileInMemoryEx} + +function D3DXCreateCubeTextureFromFileInMemoryEx( + Device: IDirect3DDevice9; + const pSrcData; + SrcDataSize: LongWord; + Size: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppCubeTexture: IDirect3DCubeTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateCubeTextureFromFileInMemoryEx} + +function D3DXCreateVolumeTextureFromFileInMemoryEx( + Device: IDirect3DDevice9; + const pSrcData; + SrcDataSize: LongWord; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + MipLevels: LongWord; + Usage: DWord; + Format: TD3DFormat; + Pool: TD3DPool; + Filter: DWord; + MipFilter: DWord; + ColorKey: TD3DColor; + pSrcInfo: PD3DXImageInfo; + pPalette: PPaletteEntry; + out ppVolumeTexture: IDirect3DVolumeTexture9): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXCreateVolumeTextureFromFileInMemoryEx} + + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + + +function D3DXSaveTextureToFileA( + pDestFile: PAnsiChar; + DestFormat: TD3DXImageFileFormat; + pSrcTexture: IDirect3DBaseTexture9; + pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveTextureToFileA'; +{$EXTERNALSYM D3DXSaveTextureToFileA} + +function D3DXSaveTextureToFileW( + pDestFile: PWideChar; + DestFormat: TD3DXImageFileFormat; + pSrcTexture: IDirect3DBaseTexture9; + pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveTextureToFileW'; +{$EXTERNALSYM D3DXSaveTextureToFileW} + +function D3DXSaveTextureToFile( + pDestFile: PChar; + DestFormat: TD3DXImageFileFormat; + pSrcTexture: IDirect3DBaseTexture9; + pSrcPalette: PPaletteEntry): HResult; stdcall; external d3dx9texDLL name 'D3DXSaveTextureToFileA'; +{$EXTERNALSYM D3DXSaveTextureToFile} + + + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXFilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// pPalette +// 256 color palette to be used, or NULL for non-palettized formats +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// Filter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// +//------------------------------------------------------------------------- + +function D3DXFilterTexture( + pTexture: IDirect3DTexture9; + pPalette: PPaletteEntry; + SrcLevel: LongWord; + Filter: DWord): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXFilterTexture} + +// #define D3DXFilterCubeTexture D3DXFilterTexture +// In Pascal this mapped to DLL-exported "D3DXFilterTexture" function +function D3DXFilterCubeTexture( + pTexture: IDirect3DCubeTexture9; + pPalette: PPaletteEntry; + SrcLevel: LongWord; + Filter: DWord): HResult; stdcall; external d3dx9texDLL name 'D3DXFilterTexture'; +{$EXTERNALSYM D3DXFilterCubeTexture} + +// #define D3DXFilterVolumeTexture D3DXFilterTexture +// In Pascal this mapped to DLL-exported "D3DXFilterTexture" function +function D3DXFilterVolumeTexture( + pTexture: IDirect3DVolumeTexture9; + pPalette: PPaletteEntry; + SrcLevel: LongWord; + Filter: DWord): HResult; stdcall; external d3dx9texDLL name 'D3DXFilterTexture'; +{$EXTERNALSYM D3DXFilterVolumeTexture} + + + +//---------------------------------------------------------------------------- +// D3DXFillTexture: +// ---------------- +// Uses a user provided function to fill each texel of each mip level of a +// given texture. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pFunction +// Pointer to user provided evalutor function which will be used to +// compute the value of each texel. +// pData +// Pointer to an arbitrary block of user defined data. This pointer +// will be passed to the function provided in pFunction +//----------------------------------------------------------------------------- + +function D3DXFillTexture( + pTexture: IDirect3DTexture9; + pFunction: TD3DXFill2D; + const pData): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXFillTexture} + +function D3DXFillCubeTexture( + pCubeTexture: IDirect3DCubeTexture9; + pFunction: TD3DXFill2D; + const pData): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXFillCubeTexture} + +function D3DXFillVolumeTexture( + pVolumeTexture: IDirect3DVolumeTexture9; + pFunction: TD3DXFill3D; + const pData): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXFillVolumeTexture} + +//---------------------------------------------------------------------------- +// D3DXFillTextureTX: +// ---------------- +// Uses a TX Shader target to function to fill each texel of each mip level of a +// given texture. The TX Shader target should be a compiled function taking 2 +// 2 paramters and returning a float4 color. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pFunction: +// Pointer to the compiled function returned by D3DX +// pConstants +// Constants used by program. Should be filled by user by parsing constant +// Table information +// Constants +// Number of Constants +//----------------------------------------------------------------------------- + +function D3DXFillTextureTX( + pTexture: IDirect3DTexture9; + pFunction: PDWORD; + pConstants: PD3DXVector4; + Constants: LongWord): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXFillTextureTX} + + +function D3DXFillCubeTextureTX( + pCubeTexture: IDirect3DCubeTexture9; + pFunction: PDWORD; + pConstants: PD3DXVector4; + Constants: LongWord): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXFillCubeTextureTX} + + +function D3DXFillVolumeTextureTX( + pVolumeTexture: IDirect3DVolumeTexture9; + pFunction: PDWORD; + pConstants: PD3DXVector4; + Constants: LongWord): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXFillVolumeTextureTX} + + +//---------------------------------------------------------------------------- +// D3DXComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pTexture +// Pointer to the destination texture +// pSrcTexture +// Pointer to the source heightmap texture +// pSrcPalette +// Source palette of 256 colors, or NULL +// Flags +// D3DX_NORMALMAP flags +// Channel +// D3DX_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +//--------------------------------------------------------------------------- + +function D3DXComputeNormalMap( + pTexture: IDirect3DTexture9; + pSrcTexture: IDirect3DTexture9; + pSrcPalette: PPaletteEntry; + Flags: DWord; + Channel: DWord; + Amplitude: Single): HResult; stdcall; external d3dx9texDLL; +{$EXTERNALSYM D3DXComputeNormalMap} + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9anim.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +type +//---------------------------------------------------------------------------- +// This enum defines the type of mesh data present in a MeshData structure +//---------------------------------------------------------------------------- + _D3DXMESHDATATYPE = ( + {$IFNDEF COMPILER6_UP} + D3DXMESHTYPE_invalid_0, + D3DXMESHTYPE_MESH {= $001}, // normal ID3DXMesh data + D3DXMESHTYPE_PMESH {= $002}, // Progressive Mesh - ID3DXPMesh + D3DXMESHTYPE_PATCHMESH {= $003} // Patch MEsh - ID3DXPatchMesh + {$ELSE} + D3DXMESHTYPE_MESH = $001, // normal ID3DXMesh data + D3DXMESHTYPE_PMESH = $002, // Progressive Mesh - ID3DXPMesh + D3DXMESHTYPE_PATCHMESH = $003 // Patch MEsh - ID3DXPatchMesh + {$ENDIF} + ); + {$EXTERNALSYM _D3DXMESHDATATYPE} + D3DXMESHDATATYPE = _D3DXMESHDATATYPE; + {$EXTERNALSYM D3DXMESHDATATYPE} + TD3DXMeshDataType = _D3DXMESHDATATYPE; + +//---------------------------------------------------------------------------- +// This struct encapsulates a the mesh data that can be present in a mesh +// container. The supported mesh types are pMesh, pPMesh, pPatchMesh +// The valid way to access this is determined by the MeshType enum +//---------------------------------------------------------------------------- + PD3DXMeshData = ^TD3DXMeshData; + _D3DXMESHDATA = packed record + _Type: TD3DXMeshDataType; + + // current mesh data interface + // *** Translator ***: Delphi doesn't allow interfaces in variant records + // so I declare only one field that can be casted in code, for examples, as: + // either "mesh := ID3DXPatchMesh(pPatchMesh)" + // or "mesh := pPatchMesh as ID3DXPatchMesh" + pMesh: IUnknown; +{ case Byte of // In Delphi use pMesh record item as defined above + 0: (pMesh: ID3DXMesh); + 1: (pPMesh: ID3DXPMesh); + 2: (pPatchMesh: ID3DXPatchMesh); } + end; + {$EXTERNALSYM _D3DXMESHDATA} + D3DXMESHDATA = _D3DXMESHDATA; + {$EXTERNALSYM D3DXMESHDATA} + TD3DXMeshData = _D3DXMESHDATA; + +//---------------------------------------------------------------------------- +// This struct encapsulates a mesh object in a transformation frame +// hierarchy. The app can derive from this structure to add other app specific +// data to this +//---------------------------------------------------------------------------- + PD3DXMeshContainer = ^TD3DXMeshContainer; + _D3DXMESHCONTAINER = packed record + Name: PAnsiChar; + + MeshData: TD3DXMeshData; + + pMaterials: PD3DXMaterial; + pEffects: PD3DXEffectInstance; + NumMaterials: DWORD; + pAdjacency: PDWORD; + + pSkinInfo: ID3DXSkinInfo; + + pNextMeshContainer: PD3DXMeshContainer; + end; + {$EXTERNALSYM _D3DXMESHCONTAINER} + D3DXMESHCONTAINER = _D3DXMESHCONTAINER; + {$EXTERNALSYM D3DXMESHCONTAINER} + TD3DXMeshContainer = _D3DXMESHCONTAINER; + +//---------------------------------------------------------------------------- +// This struct is the encapsulates a transform frame in a transformation frame +// hierarchy. The app can derive from this structure to add other app specific +// data to this +//---------------------------------------------------------------------------- + PD3DXFrame = ^TD3DXFrame; + _D3DXFRAME = packed record + Name: PAnsiChar; + TransformationMatrix: TD3DXMatrix; + + pMeshContainer: PD3DXMeshContainer; + + pFrameSibling: PD3DXFrame; + pFrameFirstChild: PD3DXFrame; + end; + {$EXTERNALSYM _D3DXFRAME} + D3DXFRAME = _D3DXFRAME; + {$EXTERNALSYM D3DXFRAME} + TD3DXFrame = _D3DXFRAME; + + +//---------------------------------------------------------------------------- +// This interface is implemented by the application to allocate/free frame and +// mesh container objects. Methods on this are called during loading and +// destroying frame hierarchies +//---------------------------------------------------------------------------- +////////////////////////////////////////////////////////////////////////////// +// ID3DXAllocateHierarchy //////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +type + {$EXTERNALSYM ID3DXAllocateHierarchy} + ID3DXAllocateHierarchy = class + // ID3DXAllocateHierarchy + + //------------------------------------------------------------------------ + // CreateFrame: + // ------------ + // Requests allocation of a frame object. + // + // Parameters: + // Name + // Name of the frame to be created + // ppNewFrame + // Returns returns the created frame object + // + //------------------------------------------------------------------------ + function CreateFrame(Name: PAnsiChar; out ppNewFrame: PD3DXFrame): HResult; virtual; stdcall; abstract; + + //------------------------------------------------------------------------ + // CreateMeshContainer: + // -------------------- + // Requests allocation of a mesh container object. + // + // Parameters: + // Name + // Name of the mesh + // pMesh + // Pointer to the mesh object if basic polygon data found + // pPMesh + // Pointer to the progressive mesh object if progressive mesh data found + // pPatchMesh + // Pointer to the patch mesh object if patch data found + // pMaterials + // Array of materials used in the mesh + // pEffectInstances + // Array of effect instances used in the mesh + // NumMaterials + // Num elements in the pMaterials array + // pAdjacency + // Adjacency array for the mesh + // pSkinInfo + // Pointer to the skininfo object if the mesh is skinned + // pBoneNames + // Array of names, one for each bone in the skinned mesh. + // The numberof bones can be found from the pSkinMesh object + // pBoneOffsetMatrices + // Array of matrices, one for each bone in the skinned mesh. + // + //------------------------------------------------------------------------ + function CreateMeshContainer(Name: PAnsiChar; const pMeshData: TD3DXMeshData; + pMaterials: PD3DXMaterial; pEffectInstances: PD3DXEffectInstance; + NumMaterials: DWORD; pAdjacency: PDWORD; pSkinInfo: ID3DXSkinInfo; + out ppNewMeshContainer: PD3DXMeshContainer): HResult; virtual; stdcall; abstract; + + //------------------------------------------------------------------------ + // DestroyFrame: + // ------------- + // Requests de-allocation of a frame object. + // + // Parameters: + // pFrameToFree + // Pointer to the frame to be de-allocated + // + //------------------------------------------------------------------------ + function DestroyFrame(pFrameToFree: PD3DXFrame): HResult; virtual; stdcall; abstract; + + //------------------------------------------------------------------------ + // DestroyMeshContainer: + // --------------------- + // Requests de-allocation of a mesh container object. + // + // Parameters: + // pMeshContainerToFree + // Pointer to the mesh container object to be de-allocated + // + //------------------------------------------------------------------------ + function DestroyMeshContainer(pMeshContainerToFree: PD3DXMeshContainer): HResult; virtual; stdcall; abstract; + end; + +//---------------------------------------------------------------------------- +// This interface is implemented by the application to load user data in a .X file +// When user data is found, these callbacks will be used to allow the application +// to load the data +//---------------------------------------------------------------------------- +////////////////////////////////////////////////////////////////////////////// +// ID3DXLoadUserData //////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +type + {$EXTERNALSYM ID3DXLoadUserData} + ID3DXLoadUserData = class + function LoadTopLevelData(pXofChildData: IDirectXFileData): HResult; virtual; stdcall; abstract; + + function LoadFrameChildData(pFrame: PD3DXFrame; + pXofChildData: IDirectXFileData): HResult; virtual; stdcall; abstract; + + function LoadMeshChildData(pMeshContainer: PD3DXMeshContainer; + pXofChildData: IDirectXFileData): HResult; virtual; stdcall; abstract; + end; + +//---------------------------------------------------------------------------- +// This interface is implemented by the application to save user data in a .X file +// The callbacks are called for all data saved. The user can then add any +// child data objects to the object provided to the callback +//---------------------------------------------------------------------------- +////////////////////////////////////////////////////////////////////////////// +// ID3DXSaveUserData ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +type + {$EXTERNALSYM ID3DXSaveUserData} + ID3DXSaveUserData = class + function AddFrameChildData(pFrame: PD3DXFrame; + pXofSave: IDirectXFileSaveObject; pXofFrameData: IDirectXFileData): HResult; virtual; stdcall; abstract; + + function AddMeshChildData(pMeshContainer: PD3DXMeshContainer; + pXofSave: IDirectXFileSaveObject; pXofMeshData: IDirectXFileData): HResult; virtual; stdcall; abstract; + + // NOTE: this is called once per Save. All top level objects should be added using the + // provided interface. One call adds objects before the frame hierarchy, the other after + function AddTopLevelDataObjectsPre(pXofSave: IDirectXFileSaveObject): HResult; virtual; stdcall; abstract; + function AddTopLevelDataObjectsPost(pXofSave: IDirectXFileSaveObject): HResult; virtual; stdcall; abstract; + + // callbacks for the user to register and then save templates to the XFile + function RegisterTemplates(pXFileApi: IDirectXFile): HResult; virtual; stdcall; abstract; + function SaveTemplates(pXofSave: IDirectXFileSaveObject): HResult; virtual; stdcall; abstract; + end; + + + +//---------------------------------------------------------------------------- +// This interface defines a SRT (scale/rotate/translate) interpolator. This +// is an abstract interface. ID3DXKeyFrameInterpolator inherits from this. +// An application can implement this for custom SRT interpolator +//---------------------------------------------------------------------------- +////////////////////////////////////////////////////////////////////////////// +// ID3DXInterpolator ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +type + PID3DXInterpolator = ^ID3DXInterpolator; + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXInterpolator);'} + {$EXTERNALSYM ID3DXInterpolator} + ID3DXInterpolator = interface(IUnknown) + ['{ADE2C06D-3747-4b9f-A514-3440B8284980}'] + // ID3DXInterpolator + function GetName: PAnsiChar; stdcall; + function GetPeriod: Double; stdcall; + + //---------------------------------------------------------------------------- + // GetSRT: + // ------- + // Returns the scale, rotation and translation at a given time + // + // Parameters: + // Time + // Time at which the interpolator should be queried + // pScale + // Returns the scale vector + // pRotate + // Returns the rotation qaternion + // pTranslate + // Returns the translate vector + // + //---------------------------------------------------------------------------- + function GetSRT(Time: Double; pScale: PD3DXVector3; pRotate: PD3DXQuaternion; pTranslate: PD3DXVector3): HResult; stdcall; + function GetLastSRT(pScale: PD3DXVector3; pRotate: PD3DXQuaternion; pTranslate: PD3DXVector3): HResult; stdcall; + end; + + + + +//---------------------------------------------------------------------------- +// This structure describes a vector key for use in keyframe animation. +// It specifies a vector Value at a given Time. This is used for scale and +// translation keys +//---------------------------------------------------------------------------- +type + PD3DXKeyVector3 = ^TD3DXKeyVector3; + _D3DXKEY_VECTOR3 = packed record + Time: Single; + Value: TD3DXVector3; + end; + {$EXTERNALSYM _D3DXKEY_VECTOR3} + D3DXKEY_VECTOR3 = _D3DXKEY_VECTOR3; + {$EXTERNALSYM D3DXKEY_VECTOR3} + TD3DXKeyVector3 = _D3DXKEY_VECTOR3; + + +//---------------------------------------------------------------------------- +// This structure describes a quaternion key for use in keyframe animation. +// It specifies a quaternion Value at a given Time. This is used for rotation +// keys +//---------------------------------------------------------------------------- +type + PD3DXKeyQuaternion = ^TD3DXKeyQuaternion; + _D3DXKEY_QUATERNION = packed record + Time: Single; + Value: TD3DXQuaternion; + end; + {$EXTERNALSYM _D3DXKEY_QUATERNION} + D3DXKEY_QUATERNION = _D3DXKEY_QUATERNION; + {$EXTERNALSYM D3DXKEY_QUATERNION} + TD3DXKeyQuaternion = _D3DXKEY_QUATERNION; + + +//---------------------------------------------------------------------------- +// This interface implements an SRT (scale/rotate/translate) interpolator +// It takes a scattered set of keys and interpolates the transform for any +// given time +//---------------------------------------------------------------------------- +////////////////////////////////////////////////////////////////////////////// +// ID3DXKeyFrameInterpolator ///////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXKeyFrameInterpolator);'} + {$EXTERNALSYM ID3DXKeyFrameInterpolator} + ID3DXKeyFrameInterpolator = interface(ID3DXInterpolator) + ['{6CAA71F8-0972-4cdb-A55B-43B968997515}'] + // ID3DXKeyFrameInterpolator + function GetNumScaleKeys: LongWord; stdcall; + function GetScaleKeys(pKeys: PD3DXKeyVector3): HResult; stdcall; + + function GetNumRotationKeys: LongWord; stdcall; + function GetRotationKeys(pKeys: PD3DXKeyQuaternion): HResult; stdcall; + + function GetNumTranslationKeys: LongWord; stdcall; + function GetTranslationKeys(pKeys: PD3DXKeyVector3): HResult; stdcall; + + // the value passed to D3DXCreateKeyFrameInterpolator to scale from the times in LPD3DXKEY_VECTOR3 to global/anim time. + function GetSourceTicksPerSecond: Double; stdcall; + end; + + + +//---------------------------------------------------------------------------- +// This interface implements an set of interpolators. The set consists of +// interpolators for many nodes for the same animation. +//---------------------------------------------------------------------------- +////////////////////////////////////////////////////////////////////////////// +// ID3DXAnimationSet ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXAnimationSet);'} + {$EXTERNALSYM ID3DXAnimationSet} + ID3DXAnimationSet = interface(IUnknown) + ['{54B569AC-0AEF-473e-9704-3FEF317F64AB}'] + // ID3DXAnimationSet + function GetName: PAnsiChar; stdcall; + function GetPeriod: Double; stdcall; + + function GetNumInterpolators: LongWord; stdcall; + function GetInterpolatorByIndex(Index: LongWord; out ppInterpolator: ID3DXInterpolator): HResult; stdcall; + function GetInterpolatorByName(pName: PAnsiChar; out ppInterpolator: ID3DXInterpolator): HResult; stdcall; + end; + +//---------------------------------------------------------------------------- +// This structure describes an animation track. A track is a combination +// of an animation set (stored separately) and mixing information. +// the mixing information consists of the current position, speed, and blending +// weight for the track. The Flags field also specifies whether the track +// is low or high priority. Tracks with the same priority are blended together +// and then the two resulting values are blended using the priority blend factor. +//---------------------------------------------------------------------------- +type + PD3DXTrackDesc = ^TD3DXTrackDesc; + _D3DXTRACK_DESC = packed record + Flags: DWORD; + Weight: Single; + Speed: Single; + Enable: BOOL; + AnimTime: Double; + end; + {$EXTERNALSYM _D3DXTRACK_DESC} + D3DXTRACK_DESC = _D3DXTRACK_DESC; + {$EXTERNALSYM D3DXTRACK_DESC} + TD3DXTrackDesc = _D3DXTRACK_DESC; + +//---------------------------------------------------------------------------- +// This enum defines the type of transtion performed on a event that transitions from one value to another +//---------------------------------------------------------------------------- +type + PD3DXTrackFlag = ^TD3DXTrackFlag; + _D3DXTRACKFLAG = ( + D3DXTF_LOWPRIORITY {= $000}, // This track should be blended with all low priority tracks before mixed with the high priority result + D3DXTF_HIGHPRIORITY {= $001} // This track should be blended with all high priority tracks before mixed with the low priority result + ); + {$EXTERNALSYM _D3DXTRACKFLAG} + D3DXTRACKFLAG = _D3DXTRACKFLAG; + {$EXTERNALSYM D3DXTRACKFLAG} + TD3DXTrackFlag = _D3DXTRACKFLAG; + + +//---------------------------------------------------------------------------- +// This interface implements the main animation functionality. It connects +// animation sets with the transform frames that are being animated. Allows +// mixing multiple animations for blended animations or for transistions +// It adds also has methods to modify blending parameters over time to +// enable smooth transistions and other effects. +//---------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------- +// This enum defines the type of transtion performed on a event that transitions from one value to another +//---------------------------------------------------------------------------- +type + PD3DXTransitionType = ^TD3DXTransitionType; + _D3DXTRANSITIONTYPE = ( + D3DXTRANSITION_LINEAR {= $000}, // Linear transition from one value to the next + D3DXTRANSITION_EASEINEASEOUT {= $001} // Ease-In Ease-Out spline transtion from one value to the next + ); + {$EXTERNALSYM _D3DXTRANSITIONTYPE} + D3DXTRANSITIONTYPE = _D3DXTRANSITIONTYPE; + {$EXTERNALSYM D3DXTRANSITIONTYPE} + TD3DXTransitionType = _D3DXTRANSITIONTYPE; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXAnimationController ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DXAnimationController);'} + {$EXTERNALSYM ID3DXAnimationController} + ID3DXAnimationController = interface(IUnknown) + ['{3A714D34-FF61-421e-909F-639F38356708}'] + // mixing functionality + // register outputs of SetTime + function RegisterMatrix(Name: PAnsiChar; const pMatrix: TD3DXMatrix): HResult; stdcall; + + + // AnimationSets + function GetNumAnimationSets: LongWord; stdcall; + function GetAnimationSet(iAnimationSet: DWORD; out ppAnimSet: ID3DXAnimationSet): HResult; stdcall; + + function RegisterAnimationSet(pAnimSet: ID3DXAnimationSet): HResult; stdcall; + function UnregisterAnimationSet(pAnimSet: ID3DXAnimationSet): HResult; stdcall; + + + // Tracks + function GetMaxNumTracks: LongWord; stdcall; + function GetTrackDesc(Track: DWORD; out pDesc: TD3DXTrackDesc): HResult; stdcall; + function SetTrackDesc(Track: DWORD; const pDesc: TD3DXTrackDesc): HResult; stdcall; + + function GetTrackAnimationSet(Track: DWORD; out ppAnimSet: ID3DXAnimationSet): HResult; stdcall; + function SetTrackAnimationSet(Track: DWORD; pAnimSet: ID3DXAnimationSet): HResult; stdcall; + + // Individual track field access + function SetTrackSpeed(Track: DWORD; Speed: Single): HResult; stdcall; + function SetTrackWeight(Track: DWORD; Weight: Single): HResult; stdcall; + function SetTrackAnimTime(Track: DWORD; AnimTime: Double): HResult; stdcall; + function SetTrackEnable(Track: DWORD; Enable: BOOL): HResult; stdcall; + + // Time + function GetTime: Double; stdcall; + function SetTime(Time: Double): HResult; stdcall; + + function CloneAnimationController(MaxNumMatrices, MaxNumAnimationSets, MaxNumTracks, MaxNumEvents: LongWord; out ppAnimController: ID3DXAnimationController): HResult; stdcall; + + function GetMaxNumMatrices: LongWord; stdcall; + function GetMaxNumEvents: LongWord; stdcall; + function GetMaxNumAnimationSets: LongWord; stdcall; + + // Sequencing abilities + function KeyTrackSpeed(Track: DWORD; NewSpeed: Single; StartTime, Duration: Double; Method: DWORD): HResult; stdcall; + function KeyTrackWeight(Track: DWORD; NewWeight: Single; StartTime, Duration: Double; Method: DWORD): HResult; stdcall; + function KeyTrackAnimTime(Track: DWORD; NewAnimTime, StartTime: Double): HResult; stdcall; + function KeyTrackEnable(Track: DWORD; NewEnable: BOOL; StartTime: Double): HResult; stdcall; + + // this functions sets the blend weight to be used to blend high and low priority tracks together. + // NOTE: this has no effect unless there are active animations on tracks for a given matrix that have both high and low results + function GetPriorityBlend: Single; stdcall; + function SetPriorityBlend(BlendWeight: Single): HResult; stdcall; + + function KeyPriorityBlend(NewBlendWeight: Single; StartTime, Duration: Double; Method: DWORD): HResult; stdcall; + end; + +type + IID_ID3DXInterpolator = ID3DXInterpolator; + {$EXTERNALSYM IID_ID3DXInterpolator} + IID_ID3DXKeyFrameInterpolator = ID3DXKeyFrameInterpolator; + {$EXTERNALSYM IID_ID3DXKeyFrameInterpolator} + IID_ID3DXAnimationSet = ID3DXAnimationSet; + {$EXTERNALSYM IID_ID3DXAnimationSet} + IID_ID3DXAnimationController = ID3DXAnimationController; + {$EXTERNALSYM IID_ID3DXAnimationController} + + +//---------------------------------------------------------------------------- +// D3DXLoadMeshHierarchyFromX: +// --------------------------- +// Loads the first frame hierarchy in a .X file. +// +// Parameters: +// Filename +// Name of the .X file +// MeshOptions +// Mesh creation options for meshes in the file (see d3dx9mesh.h) +// pD3DDevice +// D3D9 device on which meshes in the file are created in +// pAlloc +// Allocation interface used to allocate nodes of the frame hierarchy +// pUserDataLoader +// Application provided interface to allow loading of user data +// ppFrameHierarchy +// Returns root node pointer of the loaded frame hierarchy +// ppAnimController +// Returns pointer to an animation controller corresponding to animation +// in the .X file. This is created with default max tracks and events +// +//---------------------------------------------------------------------------- + +function D3DXLoadMeshHierarchyFromXA( + Filename: PAnsiChar; + MeshOptions: DWORD; + pD3DDevice: IDirect3DDevice9; + pAlloc: ID3DXAllocateHierarchy; + pUserDataLoader: ID3DXLoadUserData; + out ppFrameHierarchy: PD3DXFrame; + out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL name 'D3DXLoadMeshHierarchyFromXA'; +{$EXTERNALSYM D3DXLoadMeshHierarchyFromXA} + +function D3DXLoadMeshHierarchyFromXW( + Filename: PWideChar; + MeshOptions: DWORD; + pD3DDevice: IDirect3DDevice9; + pAlloc: ID3DXAllocateHierarchy; + pUserDataLoader: ID3DXLoadUserData; + out ppFrameHierarchy: PD3DXFrame; + out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL name 'D3DXLoadMeshHierarchyFromXW'; +{$EXTERNALSYM D3DXLoadMeshHierarchyFromXW} + +function D3DXLoadMeshHierarchyFromX( + Filename: PChar; + MeshOptions: DWORD; + pD3DDevice: IDirect3DDevice9; + pAlloc: ID3DXAllocateHierarchy; + pUserDataLoader: ID3DXLoadUserData; + out ppFrameHierarchy: PD3DXFrame; + out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL name 'D3DXLoadMeshHierarchyFromXA'; +{$EXTERNALSYM D3DXLoadMeshHierarchyFromX} + + +function D3DXLoadMeshHierarchyFromXInMemory( + Memory: Pointer; + SizeOfMemory: DWORD; + MeshOptions: DWORD; + pD3DDevice: IDirect3DDevice9; + pAlloc: ID3DXAllocateHierarchy; + pUserDataLoader: ID3DXLoadUserData; + out ppFrameHierarchy: PD3DXFrame; + out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXLoadMeshHierarchyFromXInMemory} + +//---------------------------------------------------------------------------- +// D3DXSaveMeshHierarchyToFile: +// --------------------------- +// Creates a .X file and saves the mesh hierarchy and corresponding animations +// in it +// +// Parameters: +// Filename +// Name of the .X file +// XFormat +// Format of the .X file (text or binary, compressed or not, etc) +// pFrameRoot +// Root node of the hierarchy to be saved +// pAnimController +// The animation mixer whose animation sets are to be stored +// pUserDataSaver +// Application provided interface to allow adding of user data to +// data objects saved to .X file +// +//---------------------------------------------------------------------------- + +function D3DXSaveMeshHierarchyToFileA( + Filename: PAnsiChar; + XFormat: TDXFileFormat; + pFrameRoot: PD3DXFrame; + pAnimMixer: ID3DXAnimationController; + pUserDataSaver: ID3DXSaveUserData): HResult; stdcall; external d3dx9animDLL name 'D3DXSaveMeshHierarchyToFileA'; +{$EXTERNALSYM D3DXSaveMeshHierarchyToFileA} + +function D3DXSaveMeshHierarchyToFileW( + Filename: PWideChar; + XFormat: TDXFileFormat; + pFrameRoot: PD3DXFrame; + pAnimMixer: ID3DXAnimationController; + pUserDataSaver: ID3DXSaveUserData): HResult; stdcall; external d3dx9animDLL name 'D3DXSaveMeshHierarchyToFileW'; +{$EXTERNALSYM D3DXSaveMeshHierarchyToFileW} + +function D3DXSaveMeshHierarchyToFile( + Filename: PChar; + XFormat: TDXFileFormat; + pFrameRoot: PD3DXFrame; + pAnimMixer: ID3DXAnimationController; + pUserDataSaver: ID3DXSaveUserData): HResult; stdcall; external d3dx9animDLL name 'D3DXSaveMeshHierarchyToFileA'; +{$EXTERNALSYM D3DXSaveMeshHierarchyToFile} + + +//---------------------------------------------------------------------------- +// D3DXFrameDestroy: +// ----------------- +// Destroys the subtree of frames under the root, including the root +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pAlloc +// Allocation interface used to de-allocate nodes of the frame hierarchy +// +//---------------------------------------------------------------------------- + +function D3DXFrameDestroy( + pFrameRoot: PD3DXFrame; + pAlloc: ID3DXAllocateHierarchy): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXFrameDestroy} + +//---------------------------------------------------------------------------- +// D3DXFrameAppendChild: +// --------------------- +// Add a child frame to a frame +// +// Parameters: +// pFrameParent +// Pointer to the parent node +// pFrameChild +// Pointer to the child node +// +//---------------------------------------------------------------------------- + +function D3DXFrameAppendChild( + pFrameParent: PD3DXFrame; + pFrameChild: PD3DXFrame): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXFrameAppendChild} + +//---------------------------------------------------------------------------- +// D3DXFrameFind: +// -------------- +// Finds a frame with the given name. Returns NULL if no frame found. +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// Name +// Name of frame to find +// +//---------------------------------------------------------------------------- + +function D3DXFrameFind( + pFrameRoot: PD3DXFrame; + Name: PAnsiChar): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXFrameFind} + +//---------------------------------------------------------------------------- +// D3DXFrameRegisterNamedMatrices: +// -------------------------- +// Finds all frames that have non-null names and registers each of those frame +// matrices to the given animation mixer +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pAnimMixer +// Pointer to the animation mixer where the matrices are registered +// +//---------------------------------------------------------------------------- + +function D3DXFrameRegisterNamedMatrices( + pFrameRoot: PD3DXFrame; + pAnimMixer: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXFrameRegisterNamedMatrices} + +//---------------------------------------------------------------------------- +// D3DXFrameNumNamedMatrices: +// -------------------------- +// Counts number of frames in a subtree that have non-null names +// +// Parameters: +// pFrameRoot +// Pointer to the root node of the subtree +// Return Value: +// Count of frames +// +//---------------------------------------------------------------------------- + +function D3DXFrameNumNamedMatrices( + pFrameRoot: PD3DXFrame): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXFrameNumNamedMatrices} + +//---------------------------------------------------------------------------- +// D3DXFrameCalculateBoundingSphere: +// --------------------------------- +// Computes the bounding sphere of all the meshes in the frame hierarchy +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pObjectCenter +// Returns the center of the bounding sphere +// pObjectRadius +// Returns the radius of the bounding sphere +// +//---------------------------------------------------------------------------- + +function D3DXFrameCalculateBoundingSphere( + pFrameRoot: PD3DXFrame; + out pObjectCenter: TD3DXVector3; + out pObjectRadius: Single): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXFrameCalculateBoundingSphere} + + +//---------------------------------------------------------------------------- +// D3DXCreateKeyFrameInterpolator: +// ------------------------------- +// Creates a SRT key frame interpolator object from the given set of keys +// +// Parameters: +// ScaleKeys +// Array of scale key vectors +// NumScaleKeys +// Num elements in ScaleKeys array +// RotationKeys +// Array of rotation key quternions +// NumRotationKeys +// Num elements in RotationKeys array +// TranslateKeys +// Array of translation key vectors +// NumTranslateKeys +// Num elements in TranslateKeys array +// ScaleInputTimeBy +// All key times are scaled by this factor +// ppNewInterpolator +// Returns the keyframe interpolator interface +// +//---------------------------------------------------------------------------- + +function D3DXCreateKeyFrameInterpolator(Name: PAnsiChar; + ScaleKeys: PD3DXKeyVector3; NumScaleKeys: LongWord; + RotationKeys: PD3DXKeyQuaternion; NumRotationKeys: LongWord; + TranslateKeys: PD3DXKeyVector3; NumTranslateKeys: LongWord; + ScaleInputTimeBy: Double; out ppNewInterpolator: ID3DXKeyFrameInterpolator): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXCreateKeyFrameInterpolator} + +//---------------------------------------------------------------------------- +// D3DXCreateAnimationSet: +// ----------------------- +// Creates an animtions set interface given a set of interpolators +// +// Parameters: +// Name +// Name of the animation set +// pInterpolators +// Array of interpolators +// NumInterpolators +// Num elements in the pInterpolators array +// ppAnimSet +// Returns the animation set interface +// +//----------------------------------------------------------------------------- + +function D3DXCreateAnimationSet(Name: PAnsiChar; + ppInterpolators: PID3DXInterpolator; NumInterpolators: LongWord; + out ppAnimSet: ID3DXAnimationSet): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXCreateAnimationSet} + +//---------------------------------------------------------------------------- +// D3DXCreateAnimationController: +// ------------------------- +// Creates an animtion mixer object +// +// Parameters: +// MaxNumMatrices +// The upper limit for the number of matrices that can be animated by the +// the object +// MaxNumAnimationSets +// The upper limit of the number of animation sets that can be played by +// the object +// MaxNumTracks +// The upper limit of the number of animation sets that can be blended at +// any time. +// MaxNumEvents +// The upper limit of the number of outstanding events that can be +// scheduled at once. +// ppAnimController +// Returns the animation controller interface +// +//----------------------------------------------------------------------------- + +function D3DXCreateAnimationController( + MaxNumMatrices, MaxNumAnimationSets, MaxNumTracks, MaxNumEvents: LongWord; + out ppAnimController: ID3DXAnimationController): HResult; stdcall; external d3dx9animDLL; +{$EXTERNALSYM D3DXCreateAnimationController} + + + + + +(*$HPPEMIT '} /* namespace D3dx9 */' *) + +//***************************************************************************// +//***************************************************************************// +//***************************************************************************// +implementation +//***************************************************************************// +//***************************************************************************// +//***************************************************************************// + + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx8math.h +// Content: D3DX math types and functions +// +////////////////////////////////////////////////////////////////////////////// + + + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== + +function D3DXToRadian(Degree: Single): Single; +begin + Result:= Degree * (D3DX_PI / 180.0); +end; + +function D3DXToDegree(Radian: Single): Single; +begin + Result:= Radian * (180.0 / D3DX_PI); +end; + + + +//=========================================================================== +// +// 16 bit floating point numbers +// +//=========================================================================== + +function D3DXFloat16(value: Single): TD3DXFloat16; +begin + D3DXFloat32To16Array(@Result, @value, 1); +end; + +function D3DXFloat16Equal(const v1, v2: TD3DXFloat16): Boolean; +begin + Result:= (v1.value = v2.value); +end; + +function D3DXFloat16ToFloat(value: TD3DXFloat16): Single; +begin + D3DXFloat16To32Array(@Result, @value, 1); +end; + + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + +//-------------------------- +// 2D Vector +//-------------------------- + +function D3DXVector2(_x, _y: Single): TD3DXVector2; +begin + Result.x:= _x; Result.y:= _y; +end; + +function D3DXVector2Equal(const v1, v2: TD3DXVector2): Boolean; +begin + Result:= (v1.x = v2.x) and (v1.y = v2.y); +end; + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- +function D3DXVector2_16F(_x, _y: TD3DXFloat16): TD3DXVector2_16F; +begin + with Result do + begin + x:= _x; + y:= _y; + end; +end; + +function D3DXVector2_16fEqual(const v1, v2: TD3DXVector2_16F): Boolean; +begin + Result:= (DWORD(v1) = DWORD(v2)); +end; + +function D3DXVector2_16fFromVector2(const v: TD3DXVector2): TD3DXVector2_16f; +begin + D3DXFloat32To16Array(@Result.x, @v.x, 2); +end; + +function D3DXVector2FromVector2_16f(const v: TD3DXVector2_16f): TD3DXVector2; +begin + D3DXFloat16To32Array(@Result.x, @v.x, 2); +end; + + +//-------------------------- +// 3D Vector +//-------------------------- + +function D3DXVector3(_x, _y, _z: Single): TD3DXVector3; +begin + with Result do + begin + x:= _x; y:= _y; z:=_z; + end; +end; + +function D3DXVector3Equal(const v1, v2: TD3DXVector3): Boolean; +begin + Result:= (v1.x = v2.x) and (v1.y = v2.y) and (v1.z = v2.z); +end; + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- + +function D3DXVector3_16F(_x, _y, _z: TD3DXFloat16): TD3DXVector3_16F; +begin + with Result do + begin + x:= _x; y:= _y; z:= _z; + end; +end; + +function D3DXVector3_16fEqual(const v1, v2: TD3DXVector3_16F): Boolean; +begin + Result:= (PDWORD(@v1.x)^ = PDWORD(@v2.x)^) and + (Word (v1.z) = Word (v2.z)); +end; + +function D3DXVector3_16fFromVector3(const v: TD3DXVector3): TD3DXVector3_16f; +begin + D3DXFloat32To16Array(@Result.x, @v.x, 3); +end; + +function D3DXVector3FromVector3_16f(const v: TD3DXVector3_16f): TD3DXVector3; +begin + D3DXFloat16To32Array(@Result.x, @v.x, 3); +end; + + +//-------------------------- +// 4D Vector +//-------------------------- + +function D3DXVector4(_x, _y, _z, _w: Single): TD3DXVector4; +begin + with Result do + begin + x:= _x; y:= _y; z:= _z; w:= _w; + end; +end; + +function D3DXVector4Equal(const v1, v2: TD3DXVector4): Boolean; +begin + Result:= (v1.x = v2.x) and (v1.y = v2.y) and + (v1.z = v2.z) and (v1.w = v2.w); +end; + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- +function D3DXVector4_16F(_x, _y, _z, _w: TD3DXFloat16): TD3DXVector4_16F; +begin + with Result do + begin + x:= _x; y:= _y; z:= _z; w:= _w; + end; +end; + +function D3DXVector4_16fEqual(const v1, v2: TD3DXVector4_16F): Boolean; +begin + Result:= (PDWORD(@v1.x)^ = PDWORD(@v2.x)^) and + (PDWORD(@v1.z)^ = PDWORD(@v2.z)^); +end; + +function D3DXVector4_16fFromVector4(const v: TD3DXVector4): TD3DXVector4_16f; +begin + D3DXFloat32To16Array(@Result.x, @v.x, 4); +end; + +function D3DXVector4FromVector4_16f(const v: TD3DXVector4_16f): TD3DXVector4; +begin + D3DXFloat16To32Array(@Result.x, @v.x, 4); +end; + + +//-------------------------- +// 4D Matrix +//-------------------------- +function D3DXMatrix( + _m00, _m01, _m02, _m03, + _m10, _m11, _m12, _m13, + _m20, _m21, _m22, _m23, + _m30, _m31, _m32, _m33: Single): TD3DXMatrix; +begin + with Result do + begin + m[0,0]:= _m00; m[0,1]:= _m01; m[0,2]:= _m02; m[0,3]:= _m03; + m[1,0]:= _m10; m[1,1]:= _m11; m[1,2]:= _m12; m[1,3]:= _m13; + m[2,0]:= _m20; m[2,1]:= _m21; m[2,2]:= _m22; m[2,3]:= _m23; + m[3,0]:= _m30; m[3,1]:= _m31; m[3,2]:= _m32; m[3,3]:= _m33; + end; +end; + +function D3DXMatrixAdd(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; +var + pOut, p1, p2: PSingle; x: Integer; +begin + pOut:= @mOut._11; p1:= @m1._11; p2:= @m2._11; + for x:= 0 to 15 do + begin + pOut^:= p1^+p2^; + Inc(pOut); Inc(p1); Inc(p2); + end; + Result:= @mOut; +end; + +function D3DXMatrixSubtract(out mOut: TD3DXMatrix; const m1, m2: TD3DXMatrix): PD3DXMatrix; +var + pOut, p1, p2: PSingle; x: Integer; +begin + pOut:= @mOut._11; p1:= @m1._11; p2:= @m2._11; + for x:= 0 to 15 do + begin + pOut^:= p1^-p2^; + Inc(pOut); Inc(p1); Inc(p2); + end; + Result:= @mOut; +end; + +function D3DXMatrixMul(out mOut: TD3DXMatrix; const m: TD3DXMatrix; MulBy: Single): PD3DXMatrix; +var + pOut, p: PSingle; x: Integer; +begin + pOut:= @mOut._11; p:= @m._11; + for x:= 0 to 15 do + begin + pOut^:= p^* MulBy; + Inc(pOut); Inc(p); + end; + Result:= @mOut; +end; + +function D3DXMatrixEqual(const m1, m2: TD3DXMatrix): Boolean; +begin + Result:= CompareMem(@m1, @m2, SizeOf(TD3DXMatrix)); +end; + +//-------------------------- +// Quaternion +//-------------------------- +function D3DXQuaternion(_x, _y, _z, _w: Single): TD3DXQuaternion; +begin + with Result do + begin + x:= _x; y:= _y; z:= _z; w:= _w; + end; +end; + +function D3DXQuaternionAdd(const q1, q2: TD3DXQuaternion): TD3DXQuaternion; +begin + with Result do + begin + x:= q1.x+q2.x; y:= q1.y+q2.y; z:= q1.z+q2.z; w:= q1.w+q2.w; + end; +end; + +function D3DXQuaternionSubtract(const q1, q2: TD3DXQuaternion): TD3DXQuaternion; +begin + with Result do + begin + x:= q1.x-q2.x; y:= q1.y-q2.y; z:= q1.z-q2.z; w:= q1.w-q2.w; + end; +end; + +function D3DXQuaternionEqual(const q1, q2: TD3DXQuaternion): Boolean; +begin + Result:= (q1.x = q2.x) and (q1.y = q2.y) and + (q1.z = q2.z) and (q1.w = q2.w); +end; + +function D3DXQuaternionScale(out qOut: TD3DXQuaternion; const q: TD3DXQuaternion; + s: Single): PD3DXQuaternion; +begin + with qOut do + begin + x:= q.x*s; y:= q.y*s; z:= q.z*s; w:= q.w*s; + end; + Result:= @qOut; +end; + + +//-------------------------- +// Plane +//-------------------------- + +function D3DXPlane(_a, _b, _c, _d: Single): TD3DXPlane; +begin + with Result do + begin + a:= _a; b:= _b; c:= _c; d:= _d; + end; +end; + +function D3DXPlaneEqual(const p1, p2: TD3DXPlane): Boolean; +begin + Result:= + (p1.a = p2.a) and (p1.b = p2.b) and + (p1.c = p2.c) and (p1.d = p2.d); +end; + + +//-------------------------- +// Color +//-------------------------- + +function D3DXColor(_r, _g, _b, _a: Single): TD3DXColor; +begin + with Result do + begin + r:= _r; g:= _g; b:= _b; a:= _a; + end; +end; + +function D3DXColorToDWord(c: TD3DXColor): DWord; + + function ColorLimit(const x: Single): DWord; + begin + if x > 1.0 then Result:= 255 + else if x < 0 then Result:= 0 + else Result:= Trunc(x * 255.0 + 0.5); + end; +begin + Result:= ColorLimit(c.a) shl 24 or ColorLimit(c.r) shl 16 + or ColorLimit(c.g) shl 8 or ColorLimit(c.b); +end; + +function D3DXColorFromDWord(c: DWord): TD3DXColor; +const + f: Single = 1/255; +begin + with Result do + begin + r:= f * Byte(c shr 16); + g:= f * Byte(c shr 8); + b:= f * Byte(c shr 0); + a:= f * Byte(c shr 24); + end; +end; + +function D3DXColorEqual(const c1, c2: TD3DXColor): Boolean; +begin + Result:= (c1.r = c2.r) and (c1.g = c2.g) and (c1.b = c2.b) and (c1.a = c2.a); +end; + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// 2D Vector +//-------------------------- + +// "inline" +function D3DXVec2Length(const v: TD3DXVector2): Single; +begin + with v do Result:= Sqrt(x*x + y*y); +end; + +function D3DXVec2LengthSq(const v: TD3DXVector2): Single; +begin + with v do Result:= x*x + y*y; +end; + +function D3DXVec2Dot(const v1, v2: TD3DXVector2): Single; +begin + Result:= v1.x*v2.x + v1.y*v2.y; +end; + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +function D3DXVec2CCW(const v1, v2: TD3DXVector2): Single; +begin + Result:= v1.x*v2.y - v1.y*v2.x; +end; + +function D3DXVec2Add(const v1, v2: TD3DXVector2): TD3DXVector2; +begin + Result.x:= v1.x + v2.x; + Result.y:= v1.y + v2.y; +end; + +function D3DXVec2Subtract(const v1, v2: TD3DXVector2): TD3DXVector2; +begin + Result.x:= v1.x - v2.x; + Result.y:= v1.y - v2.y; +end; + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +function D3DXVec2Minimize(out vOut: TD3DXVector2; const v1, v2: TD3DXVEctor2): PD3DXVector2; +begin + if v1.x < v2.x then vOut.x:= v1.x else vOut.y:= v2.x; + if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + Result:= @vOut; +end; + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +function D3DXVec2Maximize(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2): PD3DXVector2; +begin + if v1.x > v2.x then vOut.x:= v1.x else vOut.y:= v2.x; + if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + Result:= @vOut; +end; + +function D3DXVec2Scale(out vOut: TD3DXVector2; const v: TD3DXVector2; s: Single): PD3DXVector2; +begin + vOut.x:= v.x*s; vOut.y:= v.y*s; + Result:= @vOut; +end; + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec2Lerp(out vOut: TD3DXVector2; const v1, v2: TD3DXVector2; s: Single): PD3DXVector2; +begin + vOut.x:= v1.x + s * (v2.x-v1.x); + vOut.y:= v1.y + s * (v2.y-v1.y); + Result:= @vOut; +end; + + +//-------------------------- +// 3D Vector +//-------------------------- +function D3DXVec3Length(const v: TD3DXVector3): Single; +begin + with v do Result:= Sqrt(x*x + y*y + z*z); +end; + +function D3DXVec3LengthSq(const v: TD3DXVector3): Single; +begin + with v do Result:= x*x + y*y + z*z; +end; + +function D3DXVec3Dot(const v1, v2: TD3DXVector3): Single; +begin + Result:= v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; +end; + +function D3DXVec3Cross(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + vOut.x:= v1.y * v2.z - v1.z * v2.y; + vOut.y:= v1.z * v2.x - v1.x * v2.z; + vOut.z:= v1.x * v2.y - v1.y * v2.x; + Result:= @vOut; +end; + +function D3DXVec3Add(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + with vOut do + begin + x:= v1.x + v2.x; + y:= v1.y + v2.y; + z:= v1.z + v2.z; + end; + Result:= @vOut; +end; + +function D3DXVec3Subtract(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + with vOut do + begin + x:= v1.x - v2.x; + y:= v1.y - v2.y; + z:= v1.z - v2.z; + end; + Result:= @vOut; +end; + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +function D3DXVec3Minimize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + if v1.x < v2.x then vOut.x:= v1.x else vOut.x:= v2.x; + if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + if v1.z < v2.z then vOut.z:= v1.z else vOut.z:= v2.z; + Result:= @vOut; +end; + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +function D3DXVec3Maximize(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3): PD3DXVector3; +begin + if v1.x > v2.x then vOut.x:= v1.x else vOut.x:= v2.x; + if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + if v1.z > v2.z then vOut.z:= v1.z else vOut.z:= v2.z; + Result:= @vOut; +end; + +function D3DXVec3Scale(out vOut: TD3DXVector3; const v: TD3DXVector3; s: Single): PD3DXVector3; +begin + with vOut do + begin + x:= v.x * s; y:= v.y * s; z:= v.z * s; + end; + Result:= @vOut; +end; + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec3Lerp(out vOut: TD3DXVector3; const v1, v2: TD3DXVector3; s: Single): PD3DXVector3; +begin + vOut.x:= v1.x + s * (v2.x-v1.x); + vOut.y:= v1.y + s * (v2.y-v1.y); + vOut.z:= v1.z + s * (v2.z-v1.z); + Result:= @vOut; +end; + + +//-------------------------- +// 4D Vector +//-------------------------- + +function D3DXVec4Length(const v: TD3DXVector4): Single; +begin + with v do Result:= Sqrt(x*x + y*y + z*z + w*w); +end; + +function D3DXVec4LengthSq(const v: TD3DXVector4): Single; +begin + with v do Result:= x*x + y*y + z*z + w*w +end; + +function D3DXVec4Dot(const v1, v2: TD3DXVector4): Single; +begin + Result:= v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w; +end; + +function D3DXVec4Add(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +begin + with vOut do + begin + x:= v1.x + v2.x; + y:= v1.y + v2.y; + z:= v1.z + v2.z; + w:= v1.w + v2.w; + end; + Result:= @vOut; +end; + +function D3DXVec4Subtract(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +begin + with vOut do + begin + x:= v1.x - v2.x; + y:= v1.y - v2.y; + z:= v1.z - v2.z; + w:= v1.w - v2.w; + end; + Result:= @vOut; +end; + + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +function D3DXVec4Minimize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +begin + if v1.x < v2.x then vOut.x:= v1.x else vOut.x:= v2.x; + if v1.y < v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + if v1.z < v2.z then vOut.z:= v1.z else vOut.z:= v2.z; + if v1.w < v2.w then vOut.w:= v1.w else vOut.w:= v2.w; + Result:= @vOut; +end; + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +function D3DXVec4Maximize(out vOut: TD3DXVector4; const v1, v2: TD3DXVector4): PD3DXVector4; +begin + if v1.x > v2.x then vOut.x:= v1.x else vOut.x:= v2.x; + if v1.y > v2.y then vOut.y:= v1.y else vOut.y:= v2.y; + if v1.z > v2.z then vOut.z:= v1.z else vOut.z:= v2.z; + if v1.w > v2.w then vOut.w:= v1.w else vOut.w:= v2.w; + Result:= @vOut; +end; + +function D3DXVec4Scale(out vOut: TD3DXVector4; const v: TD3DXVector4; s: Single): PD3DXVector4; +begin + with vOut do + begin + x:= v.x * s; y:= v.y * s; z:= v.z * s; w:= v.w * s; + end; + Result:= @vOut; +end; + +// Linear interpolation. V1 + s(V2-V1) +function D3DXVec4Lerp(out vOut: TD3DXVector4; + const v1, v2: TD3DXVector4; s: Single): PD3DXVector4; +begin + with vOut do + begin + x:= v1.x + s * (v2.x - v1.x); + y:= v1.y + s * (v2.y - v1.y); + z:= v1.z + s * (v2.z - v1.z); + w:= v1.w + s * (v2.w - v1.w); + end; + Result:= @vOut; +end; + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline +function D3DXMatrixIdentity(out mOut: TD3DXMatrix): PD3DXMatrix; +begin + FillChar(mOut, SizeOf(mOut), 0); + mOut._11:= 1; mOut._22:= 1; mOut._33:= 1; mOut._44:= 1; + Result:= @mOut; +end; + +function D3DXMatrixIsIdentity(const m: TD3DXMatrix): BOOL; +begin + with m do Result:= + (_11 = 1) and (_12 = 0) and (_13 = 0) and (_14 = 0) and + (_21 = 0) and (_22 = 1) and (_23 = 0) and (_24 = 0) and + (_31 = 0) and (_32 = 0) and (_33 = 1) and (_34 = 0) and + (_41 = 0) and (_42 = 0) and (_43 = 0) and (_44 = 1); +end; + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +function D3DXQuaternionLength(const q: TD3DXQuaternion): Single; +begin + with q do Result:= Sqrt(x*x + y*y + z*z + w*w); +end; + +// Length squared, or "norm" +function D3DXQuaternionLengthSq(const q: TD3DXQuaternion): Single; +begin + with q do Result:= x*x + y*y + z*z + w*w; +end; + +function D3DXQuaternionDot(const q1, q2: TD3DXQuaternion): Single; +begin + Result:= q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; +end; + +function D3DXQuaternionIdentity(out qOut: TD3DXQuaternion): PD3DXQuaternion; +begin + with qOut do + begin + x:= 0; y:= 0; z:= 0; w:= 1.0; + end; + Result:= @qOut; +end; + +function D3DXQuaternionIsIdentity(const q: TD3DXQuaternion): BOOL; +begin + with q do Result:= (x = 0) and (y = 0) and (z = 0) and (w = 1); +end; + +// (-x, -y, -z, w) +function D3DXQuaternionConjugate(out qOut: TD3DXQuaternion; + const q: TD3DXQuaternion): PD3DXQuaternion; +begin + with qOut do + begin + x:= -q.x; y:= -q.y; z:= -q.z; w:= q.w; + end; + Result:= @qOut; +end; + + +//-------------------------- +// Plane +//-------------------------- + +// ax + by + cz + dw +function D3DXPlaneDot(const p: TD3DXPlane; const v: TD3DXVector4): Single; +begin + with p,v do Result:= a*x + b*y + c*z + d*w; +end; + +// ax + by + cz + d +function D3DXPlaneDotCoord(const p: TD3DXPlane; const v: TD3DXVector3): Single; +begin + with p,v do Result:= a*x + b*y + c*z + d; +end; + +// ax + by + cz +function D3DXPlaneDotNormal(const p: TD3DXPlane; const v: TD3DXVector3): Single; +begin + with p,v do Result:= a*x + b*y + c*z; +end; + + +//-------------------------- +// Color +//-------------------------- + +// inline + +function D3DXColorNegative(out cOut: TD3DXColor; const c: TD3DXColor): PD3DXColor; +begin + with cOut do + begin + r:= 1.0 - c.r; g:= 1.0 - c.g; b:= 1.0 - c.b; + a:= c.a; + end; + Result:= @cOut; +end; + +function D3DXColorAdd(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor; +begin + with cOut do + begin + r:= c1.r + c2.r; g:= c1.g + c2.g; b:= c1.b + c2.b; + a:= c1.a + c2.a; + end; + Result:= @cOut; +end; + +function D3DXColorSubtract(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor; +begin + with cOut do + begin + r:= c1.r - c2.r; g:= c1.g - c2.g; b:= c1.b - c2.b; + a:= c1.a - c2.a; + end; + Result:= @cOut; +end; + +function D3DXColorScale(out cOut: TD3DXColor; const c: TD3DXColor; s: Single): PD3DXColor; +begin + with cOut do + begin + r:= c.r * s; g:= c.g * s; + b:= c.b * s; a:= c.a * s; + end; + Result:= @cOut; +end; + +// (r1*r2, g1*g2, b1*b2, a1*a2) +function D3DXColorModulate(out cOut: TD3DXColor; const c1,c2: TD3DXColor): PD3DXColor; +begin + with cOut do + begin + r:= c1.r * c2.r; g:= c1.g * c2.g; + b:= c1.b * c2.b; a:= c1.a * c2.a; + end; + Result:= @cOut; +end; + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +function D3DXColorLerp(out cOut: TD3DXColor; const c1,c2: TD3DXColor; s: Single): PD3DXColor; +begin + with cOut do + begin + r:= c1.r + s * (c2.r - c1.r); + g:= c1.g + s * (c2.g - c1.g); + b:= c1.b + s * (c2.b - c1.b); + a:= c1.a + s * (c2.a - c1.a); + end; + Result:= @cOut; +end; + + + + + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9shader.h +// Content: D3DX Shader APIs +// +////////////////////////////////////////////////////////////////////////////// + + +//--------------------------------------------------------------------------- +// D3DXTX_VERSION: +// -------------- +// Version token used to create a procedural texture filler in effects +// Used by D3DXFill[]TX functions +//--------------------------------------------------------------------------- +// #define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) +function D3DXTX_VERSION(_Major, _Minor: Byte): DWORD; +begin + Result := (Ord('T') shl 24) or (Ord('X') shl 16) or (_Major shl 8) or (_Minor); +end; + +end. + diff --git a/Game/Code/lib/DSPack/DirectX9/DX7toDX8.pas b/Game/Code/lib/DSPack/DirectX9/DX7toDX8.pas new file mode 100644 index 00000000..42068756 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DX7toDX8.pas @@ -0,0 +1,261 @@ +{******************************************************************************} +{* *} +{* Copyright (C) 1999 Microsoft Corporation. All Rights Reserved. *} +{* *} +{* File: dx7todx8.h *} +{* Content: DX7 to DX8 Direct3D aliases to aid porting DX7 apps to DX8 *} +{* *} +{* Direct3D 8.x Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 16-Feb-2001 *} +{* *} +{* Partly based upon : *} +{* Direct3DX 7.0 Delphi adaptation by *} +{* Arne Schäpers, e-Mail: [look at www.delphi-jedi.org/DelphiGraphics/] *} +{* *} +{* Lastest version can be downloaded from: *} +{* http://clootie.narod.ru/DelphiGraphics/index.html *} +{* http://delphi-jedi.org *} +{* *} +{******************************************************************************} +{ } +{ 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 } +{ } +{******************************************************************************} + +unit DX7toDX8; + +interface + +uses + Windows, {$I UseD3D8.inc}; + +{$NOINCLUDE System} +{$NOINCLUDE SysInit} +{$NOINCLUDE Windows} +{$NOINCLUDE Direct3D8} +{$HPPEMIT '#include '} + +/////////////////////////////////////////////////////////////////////////////// +// +// d3d8types.h +// +/////////////////////////////////////////////////////////////////////////////// + + +const + D3DTRANSFORMSTATE_WORLD = D3DTS_WORLD; + {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD} + D3DTRANSFORMSTATE_VIEW = D3DTS_VIEW; + {$EXTERNALSYM D3DTRANSFORMSTATE_VIEW} + D3DTRANSFORMSTATE_PROJECTION = D3DTS_PROJECTION; + {$EXTERNALSYM D3DTRANSFORMSTATE_PROJECTION} + D3DTRANSFORMSTATE_WORLD1 = D3DTS_WORLD1; + {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD1} + D3DTRANSFORMSTATE_WORLD2 = D3DTS_WORLD2; + {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD2} + D3DTRANSFORMSTATE_WORLD3 = D3DTS_WORLD3; + {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD3} + D3DTRANSFORMSTATE_TEXTURE0 = D3DTS_TEXTURE0; + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE0} + D3DTRANSFORMSTATE_TEXTURE1 = D3DTS_TEXTURE1; + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE1} + D3DTRANSFORMSTATE_TEXTURE2 = D3DTS_TEXTURE2; + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE2} + D3DTRANSFORMSTATE_TEXTURE3 = D3DTS_TEXTURE3; + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE3} + D3DTRANSFORMSTATE_TEXTURE4 = D3DTS_TEXTURE4; + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE4} + D3DTRANSFORMSTATE_TEXTURE5 = D3DTS_TEXTURE5; + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE5} + D3DTRANSFORMSTATE_TEXTURE6 = D3DTS_TEXTURE6; + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE6} + D3DTRANSFORMSTATE_TEXTURE7 = D3DTS_TEXTURE7; + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE7} + D3DTRANSFORMSTATE_FORCE_DWORD = D3DTS_FORCE_DWORD; + {$EXTERNALSYM D3DTRANSFORMSTATE_FORCE_DWORD} + + D3DRENDERSTATE_ZENABLE = D3DRS_ZENABLE; + {$EXTERNALSYM D3DRENDERSTATE_ZENABLE} + D3DRENDERSTATE_FILLMODE = D3DRS_FILLMODE; + {$EXTERNALSYM D3DRENDERSTATE_FILLMODE} + D3DRENDERSTATE_SHADEMODE = D3DRS_SHADEMODE; + {$EXTERNALSYM D3DRENDERSTATE_SHADEMODE} + D3DRENDERSTATE_LINEPATTERN = D3DRS_LINEPATTERN; + {$EXTERNALSYM D3DRENDERSTATE_LINEPATTERN} + D3DRENDERSTATE_ZWRITEENABLE = D3DRS_ZWRITEENABLE; + {$EXTERNALSYM D3DRENDERSTATE_ZWRITEENABLE} + D3DRENDERSTATE_ALPHATESTENABLE = D3DRS_ALPHATESTENABLE; + {$EXTERNALSYM D3DRENDERSTATE_ALPHATESTENABLE} + D3DRENDERSTATE_LASTPIXEL = D3DRS_LASTPIXEL; + {$EXTERNALSYM D3DRENDERSTATE_LASTPIXEL} + D3DRENDERSTATE_SRCBLEND = D3DRS_SRCBLEND; + {$EXTERNALSYM D3DRENDERSTATE_SRCBLEND} + D3DRENDERSTATE_DESTBLEND = D3DRS_DESTBLEND; + {$EXTERNALSYM D3DRENDERSTATE_DESTBLEND} + D3DRENDERSTATE_CULLMODE = D3DRS_CULLMODE; + {$EXTERNALSYM D3DRENDERSTATE_CULLMODE} + D3DRENDERSTATE_ZFUNC = D3DRS_ZFUNC; + {$EXTERNALSYM D3DRENDERSTATE_ZFUNC} + D3DRENDERSTATE_ALPHAREF = D3DRS_ALPHAREF; + {$EXTERNALSYM D3DRENDERSTATE_ALPHAREF} + D3DRENDERSTATE_ALPHAFUNC = D3DRS_ALPHAFUNC; + {$EXTERNALSYM D3DRENDERSTATE_ALPHAFUNC} + D3DRENDERSTATE_DITHERENABLE = D3DRS_DITHERENABLE; + {$EXTERNALSYM D3DRENDERSTATE_DITHERENABLE} + D3DRENDERSTATE_ALPHABLENDENABLE = D3DRS_ALPHABLENDENABLE; + {$EXTERNALSYM D3DRENDERSTATE_ALPHABLENDENABLE} + D3DRENDERSTATE_FOGENABLE = D3DRS_FOGENABLE; + {$EXTERNALSYM D3DRENDERSTATE_FOGENABLE} + D3DRENDERSTATE_SPECULARENABLE = D3DRS_SPECULARENABLE; + {$EXTERNALSYM D3DRENDERSTATE_SPECULARENABLE} + D3DRENDERSTATE_ZVISIBLE = D3DRS_ZVISIBLE; + {$EXTERNALSYM D3DRENDERSTATE_ZVISIBLE} + D3DRENDERSTATE_FOGCOLOR = D3DRS_FOGCOLOR; + {$EXTERNALSYM D3DRENDERSTATE_FOGCOLOR} + D3DRENDERSTATE_FOGTABLEMODE = D3DRS_FOGTABLEMODE; + {$EXTERNALSYM D3DRENDERSTATE_FOGTABLEMODE} + D3DRENDERSTATE_FOGSTART = D3DRS_FOGSTART; + {$EXTERNALSYM D3DRENDERSTATE_FOGSTART} + D3DRENDERSTATE_FOGEND = D3DRS_FOGEND; + {$EXTERNALSYM D3DRENDERSTATE_FOGEND} + D3DRENDERSTATE_FOGDENSITY = D3DRS_FOGDENSITY; + {$EXTERNALSYM D3DRENDERSTATE_FOGDENSITY} + D3DRENDERSTATE_EDGEANTIALIAS = D3DRS_EDGEANTIALIAS; + {$EXTERNALSYM D3DRENDERSTATE_EDGEANTIALIAS} + D3DRENDERSTATE_ZBIAS = D3DRS_ZBIAS; + {$EXTERNALSYM D3DRENDERSTATE_ZBIAS} + D3DRENDERSTATE_RANGEFOGENABLE = D3DRS_RANGEFOGENABLE; + {$EXTERNALSYM D3DRENDERSTATE_RANGEFOGENABLE} + D3DRENDERSTATE_STENCILENABLE = D3DRS_STENCILENABLE; + {$EXTERNALSYM D3DRENDERSTATE_STENCILENABLE} + D3DRENDERSTATE_STENCILFAIL = D3DRS_STENCILFAIL; + {$EXTERNALSYM D3DRENDERSTATE_STENCILFAIL} + D3DRENDERSTATE_STENCILZFAIL = D3DRS_STENCILZFAIL; + {$EXTERNALSYM D3DRENDERSTATE_STENCILZFAIL} + D3DRENDERSTATE_STENCILPASS = D3DRS_STENCILPASS; + {$EXTERNALSYM D3DRENDERSTATE_STENCILPASS} + D3DRENDERSTATE_STENCILFUNC = D3DRS_STENCILFUNC; + {$EXTERNALSYM D3DRENDERSTATE_STENCILFUNC} + D3DRENDERSTATE_STENCILREF = D3DRS_STENCILREF; + {$EXTERNALSYM D3DRENDERSTATE_STENCILREF} + D3DRENDERSTATE_STENCILMASK = D3DRS_STENCILMASK; + {$EXTERNALSYM D3DRENDERSTATE_STENCILMASK} + D3DRENDERSTATE_STENCILWRITEMASK = D3DRS_STENCILWRITEMASK; + {$EXTERNALSYM D3DRENDERSTATE_STENCILWRITEMASK} + D3DRENDERSTATE_TEXTUREFACTOR = D3DRS_TEXTUREFACTOR; + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREFACTOR} + D3DRENDERSTATE_WRAP0 = D3DRS_WRAP0; + {$EXTERNALSYM D3DRENDERSTATE_WRAP0} + D3DRENDERSTATE_WRAP1 = D3DRS_WRAP1; + {$EXTERNALSYM D3DRENDERSTATE_WRAP1} + D3DRENDERSTATE_WRAP2 = D3DRS_WRAP2; + {$EXTERNALSYM D3DRENDERSTATE_WRAP2} + D3DRENDERSTATE_WRAP3 = D3DRS_WRAP3; + {$EXTERNALSYM D3DRENDERSTATE_WRAP3} + D3DRENDERSTATE_WRAP4 = D3DRS_WRAP4; + {$EXTERNALSYM D3DRENDERSTATE_WRAP4} + D3DRENDERSTATE_WRAP5 = D3DRS_WRAP5; + {$EXTERNALSYM D3DRENDERSTATE_WRAP5} + D3DRENDERSTATE_WRAP6 = D3DRS_WRAP6; + {$EXTERNALSYM D3DRENDERSTATE_WRAP6} + D3DRENDERSTATE_WRAP7 = D3DRS_WRAP7; + {$EXTERNALSYM D3DRENDERSTATE_WRAP7} + D3DRENDERSTATE_CLIPPING = D3DRS_CLIPPING; + {$EXTERNALSYM D3DRENDERSTATE_CLIPPING} + D3DRENDERSTATE_LIGHTING = D3DRS_LIGHTING; + {$EXTERNALSYM D3DRENDERSTATE_LIGHTING} +// D3DRENDERSTATE_EXTENTS = D3DRS_EXTENTS; //BAA: Not found in SDK + D3DRENDERSTATE_AMBIENT = D3DRS_AMBIENT; + {$EXTERNALSYM D3DRENDERSTATE_AMBIENT} + D3DRENDERSTATE_FOGVERTEXMODE = D3DRS_FOGVERTEXMODE; + {$EXTERNALSYM D3DRENDERSTATE_FOGVERTEXMODE} + D3DRENDERSTATE_COLORVERTEX = D3DRS_COLORVERTEX; + {$EXTERNALSYM D3DRENDERSTATE_COLORVERTEX} + D3DRENDERSTATE_LOCALVIEWER = D3DRS_LOCALVIEWER; + {$EXTERNALSYM D3DRENDERSTATE_LOCALVIEWER} + D3DRENDERSTATE_NORMALIZENORMALS = D3DRS_NORMALIZENORMALS; + {$EXTERNALSYM D3DRENDERSTATE_NORMALIZENORMALS} + D3DRENDERSTATE_DIFFUSEMATERIALSOURCE = D3DRS_DIFFUSEMATERIALSOURCE; + {$EXTERNALSYM D3DRENDERSTATE_DIFFUSEMATERIALSOURCE} + D3DRENDERSTATE_SPECULARMATERIALSOURCE = D3DRS_SPECULARMATERIALSOURCE; + {$EXTERNALSYM D3DRENDERSTATE_SPECULARMATERIALSOURCE} + D3DRENDERSTATE_AMBIENTMATERIALSOURCE = D3DRS_AMBIENTMATERIALSOURCE; + {$EXTERNALSYM D3DRENDERSTATE_AMBIENTMATERIALSOURCE} + D3DRENDERSTATE_EMISSIVEMATERIALSOURCE = D3DRS_EMISSIVEMATERIALSOURCE; + {$EXTERNALSYM D3DRENDERSTATE_EMISSIVEMATERIALSOURCE} + D3DRENDERSTATE_VERTEXBLEND = D3DRS_VERTEXBLEND; + {$EXTERNALSYM D3DRENDERSTATE_VERTEXBLEND} + D3DRENDERSTATE_CLIPPLANEENABLE = D3DRS_CLIPPLANEENABLE; + {$EXTERNALSYM D3DRENDERSTATE_CLIPPLANEENABLE} + +//#define RGBA_MAKE D3DCOLOR_RGBA +function RGBA_MAKE(r, g, b, a: DWORD): TD3DColor; +{$EXTERNALSYM RGBA_MAKE} +//#define RGB_MAKE D3DCOLOR_XRGB +function RGB_MAKE(r, g, b: DWORD): TD3DColor; +{$EXTERNALSYM RGB_MAKE} +//#define D3DRGBA D3DCOLOR_COLORVALUE +function D3DRGBA(r, g, b, a: Single): TD3DColor; +{$EXTERNALSYM D3DRGBA} +//#define D3DRGB(_r,_g,_b) D3DCOLOR_COLORVALUE(_r,_g,_b,1.f) +function D3DRGB(r, g, b: Single): TD3DColor; +{$EXTERNALSYM D3DRGB} + +implementation + +// #define RGBA_MAKE(r, g, b, a) ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))) +function RGBA_MAKE(r, g, b, a: DWORD): TD3DColor; +begin + Result := (a shl 24) or (r shl 16) or (g shl 8) or b; +end; + +// #define RGB_MAKE(r, g, b) ((TD3DColor) (((r) << 16) | ((g) << 8) | (b))) +function RGB_MAKE(r, g, b: DWORD): TD3DColor; +begin + Result := (r shl 16) or (g shl 8) or b; +end; + +// #define D3DRGBA(r, g, b, a) \ +// ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \ +// | (((long)((g) * 255)) << 8) | (long)((b) * 255) \ +// ) +function D3DRGBA(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 D3DRGB(r, g, b) \ +// (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255)) +function D3DRGB(r, g, b: Single): TD3DColor; +begin + Result := $ff000000 or (round(r * 255) shl 16) + or (round(g * 255) shl 8) + or round(b * 255); +end; + +end. \ No newline at end of file diff --git a/Game/Code/lib/DSPack/DirectX9/DXFile.pas b/Game/Code/lib/DSPack/DirectX9/DXFile.pas new file mode 100644 index 00000000..6288fcd7 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DXFile.pas @@ -0,0 +1,654 @@ +{******************************************************************************} +{* *} +{* Copyright (C) 1999 Microsoft Corporation. All Rights Reserved. *} +{* *} +{* File: dxfile.h, rmxfguid.h, rmxftmpl.h *} +{* Content: Interfaces to access Rendermorthics eXtensible file format *} +{* *} +{* XFile Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 10-Dec-2002 *} +{* *} +{* Partly based upon : *} +{* DirectX 7.0 Delphi adaptation by *} +{* Erik Unger, e-Mail: DelphiDirectX@next-reality.com *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi/ *} +{* *} +{* This File contains interfaces to access Rendermorthics eXtensible file *} +{* known as 'X-file'. Also this file contains GUID's and templates from *} +{* Direct3D Retained mode "rmxfguid.h" and "rmxftmpl.h" (they are used by *} +{* Direct3D8 Immediate mode samples). *} +{* *} +{******************************************************************************} +{ } +{ 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 DXFile; + +interface + +(*$HPPEMIT '#include "dxfile.h"'{*) +(*$HPPEMIT '#include "rmxfguid.h"'{*) +(*$HPPEMIT '#include "rmxftmpl.h"'{*) + +uses Windows; + +(*************************************************************************** +{* +{* Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. +{* +{* File: dxfile.h +{* +{* Content: DirectX File public header file +{* +{***************************************************************************) + +type + DXFILEFORMAT = DWORD; + {$EXTERNALSYM DXFILEFORMAT} + TDXFileFormat = DXFILEFORMAT; + +const + DXFILEFORMAT_BINARY = 0; + {$EXTERNALSYM DXFILEFORMAT_BINARY} + DXFILEFORMAT_TEXT = 1; + {$EXTERNALSYM DXFILEFORMAT_TEXT} + DXFILEFORMAT_COMPRESSED = 2; + {$EXTERNALSYM DXFILEFORMAT_COMPRESSED} + +type + DXFILELOADOPTIONS = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM DXFILELOADOPTIONS} + TDXFileLoadOptions = DXFILELOADOPTIONS; + +const + DXFILELOAD_FROMFILE = $00; + {$EXTERNALSYM DXFILELOAD_FROMFILE} + DXFILELOAD_FROMRESOURCE = $01; + {$EXTERNALSYM DXFILELOAD_FROMRESOURCE} + DXFILELOAD_FROMMEMORY = $02; + {$EXTERNALSYM DXFILELOAD_FROMMEMORY} + DXFILELOAD_FROMSTREAM = $04; + {$EXTERNALSYM DXFILELOAD_FROMSTREAM} + DXFILELOAD_FROMURL = $08; + {$EXTERNALSYM DXFILELOAD_FROMURL} + +type + PDXFileLoadResource = ^TDXFileLoadResource; + _DXFILELOADRESOURCE = packed record + hModule: HModule; + lpName: PChar; + lpType: PChar; + end; + {$EXTERNALSYM _DXFILELOADRESOURCE} + DXFILELOADRESOURCE = _DXFILELOADRESOURCE; + {$EXTERNALSYM DXFILELOADRESOURCE} + TDXFileLoadResource = _DXFILELOADRESOURCE; + + PDXFileLoadMemory = ^TDXFileLoadMemory; + _DXFILELOADMEMORY = packed record + lpMemory: Pointer; + dSize: DWord; + end; + {$EXTERNALSYM _DXFILELOADMEMORY} + DXFILELOADMEMORY = _DXFILELOADMEMORY; + {$EXTERNALSYM DXFILELOADMEMORY} + TDXFileLoadMemory = _DXFILELOADMEMORY; + +(* +{* DirectX File object types. +{*) + +type + IDirectXFile = interface; + {$EXTERNALSYM IDirectXFile} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectXFile;'} + IDirectXFileEnumObject = interface; + {$EXTERNALSYM IDirectXFileEnumObject} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectXFileEnumObject;'} + IDirectXFileSaveObject = interface; + {$EXTERNALSYM IDirectXFileSaveObject} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectXFileSaveObject;'} + IDirectXFileObject = interface; + {$EXTERNALSYM IDirectXFileObject} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectXFileObject;'} + IDirectXFileData = interface; + {$EXTERNALSYM IDirectXFileData} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectXFileData;'} + IDirectXFileDataReference = interface; + {$EXTERNALSYM IDirectXFileDataReference} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectXFileDataReference;'} + IDirectXFileBinary = interface; + {$EXTERNALSYM IDirectXFileBinary} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectXFileBinary;'} + +(* +{* DirectX File interfaces. +{*) + + IDirectXFile = interface(IUnknown) + ['{3d82ab40-62da-11cf-ab39-0020af71e433}'] + function CreateEnumObject (pvSource: Pointer; + dwLoadOptions: TDXFileLoadOptions; + var ppEnumObj: IDirectXFileEnumObject): HResult; stdcall; + function CreateSaveObject (szFileName: PChar; dwFileFormat: TDXFileFormat; + var ppSaveObj: IDirectXFileSaveObject): HResult; stdcall; + function RegisterTemplates (pvData: Pointer; cbSize: DWORD): HResult; stdcall; + end; + + IDirectXFileEnumObject = interface (IUnknown) + ['{3d82ab41-62da-11cf-ab39-0020af71e433}'] + function GetNextDataObject (var ppDataObj: IDirectXFileData) : HResult; stdcall; + function GetDataObjectById + (const rguid: TGUID; var ppDataObj: IDirectXFileData) : HResult; stdcall; + function GetDataObjectByName + (szName: PChar; var ppDataObj: IDirectXFileData) : HResult; stdcall; + end; + + IDirectXFileSaveObject = interface (IUnknown) + ['{3d82ab42-62da-11cf-ab39-0020af71e433}'] + function SaveTemplates + (cTemplates: DWORD; var ppguidTemplates: PGUID) : HResult; stdcall; + function CreateDataObject (const rguidTemplate: TGUID; szName: PChar; + pguid: PGUID; cbSize: DWORD; pvData: Pointer; + var ppDataObj: IDirectXFileData) : HResult; stdcall; + function SaveData (pDataObj: IDirectXFileData) : HResult; stdcall; + end; + + IDirectXFileObject = interface (IUnknown) + ['{3d82ab43-62da-11cf-ab39-0020af71e433}'] + function GetName (pstrNameBuf: PChar; var dwBufLen: DWORD) : HResult; stdcall; + function GetId (var pGuidBuf: TGUID) : HResult; stdcall; + end; + + IDirectXFileData = interface (IDirectXFileObject) + ['{3d82ab44-62da-11cf-ab39-0020af71e433}'] + function GetData + (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer) : HResult; stdcall; + function GetType (var ppguid: PGUID) : HResult; stdcall; + function GetNextObject (var ppChildObj: IDirectXFileObject) : HResult; stdcall; + function AddDataObject (pDataObj: IDirectXFileData) : HResult; stdcall; + function AddDataReference (szRef: PChar; pguidRef: PGUID) : HResult; stdcall; + function AddBinaryObject (szName: PChar; pguid: PGUID; szMimeType: PChar; + pvData: Pointer; cbSize: DWORD) : HResult; stdcall; + end; + + IDirectXFileDataReference = interface (IDirectXFileObject) + ['{3d82ab45-62da-11cf-ab39-0020af71e433}'] + function Resolve (var ppDataObj: IDirectXFileData) : HResult; stdcall; + end; + + IDirectXFileBinary = interface (IDirectXFileObject) + ['{3d82ab46-62da-11cf-ab39-0020af71e433}'] + function GetSize (var pcbSize: DWORD) : HResult; stdcall; + function GetMimeType (var pszMimeType: PChar) : HResult; stdcall; + function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}) : HResult; stdcall; + end; + + +(* +{* DirectXFile Object Class Id (for CoCreateInstance()) +{*) + +const + CLSID_CDirectXFile: TGUID = + (D1:$4516ec43;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3)); + {$EXTERNALSYM CLSID_CDirectXFile} + +(* +{* DirectX File Interface GUIDs. +{*) + +type + IID_IDirectXFile = IDirectXFile; + {$EXTERNALSYM IID_IDirectXFile} + IID_IDirectXFileEnumObject = IDirectXFileEnumObject; + {$EXTERNALSYM IID_IDirectXFileEnumObject} + IID_IDirectXFileSaveObject = IDirectXFileSaveObject; + {$EXTERNALSYM IID_IDirectXFileSaveObject} + IID_IDirectXFileObject = IDirectXFileObject; + {$EXTERNALSYM IID_IDirectXFileObject} + IID_IDirectXFileData = IDirectXFileData; + {$EXTERNALSYM IID_IDirectXFileData} + IID_IDirectXFileDataReference = IDirectXFileDataReference; + {$EXTERNALSYM IID_IDirectXFileDataReference} + IID_IDirectXFileBinary = IDirectXFileBinary; + {$EXTERNALSYM IID_IDirectXFileBinary} + +(* +{* DirectX File Header template's GUID. +{*) + +const + TID_DXFILEHeader: TGUID = + (D1:$3d82ab43;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33)); + {$EXTERNALSYM TID_DXFILEHeader} + +(* +{* DirectX File errors. +{*) + +const + _FACD3D = $876; + {$EXTERNALSYM _FACD3D} + +// #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) +function MAKE_DDHRESULT(Code: DWord): DWord; +{$EXTERNALSYM MAKE_DDHRESULT} + +const + MAKE_DDHRESULT_D = (1 shl 31) or (_FACD3D shl 16); + + DXFILE_OK = 0; + {$EXTERNALSYM DXFILE_OK} + + DXFILEERR_BADOBJECT = HResult(MAKE_DDHRESULT_D or 850); + {$EXTERNALSYM DXFILEERR_BADOBJECT} + DXFILEERR_BADVALUE = HResult(MAKE_DDHRESULT_D or 851); + {$EXTERNALSYM DXFILEERR_BADVALUE} + DXFILEERR_BADTYPE = HResult(MAKE_DDHRESULT_D or 852); + {$EXTERNALSYM DXFILEERR_BADTYPE} + DXFILEERR_BADSTREAMHANDLE = HResult(MAKE_DDHRESULT_D or 853); + {$EXTERNALSYM DXFILEERR_BADSTREAMHANDLE} + DXFILEERR_BADALLOC = HResult(MAKE_DDHRESULT_D or 854); + {$EXTERNALSYM DXFILEERR_BADALLOC} + DXFILEERR_NOTFOUND = HResult(MAKE_DDHRESULT_D or 855); + {$EXTERNALSYM DXFILEERR_NOTFOUND} + DXFILEERR_NOTDONEYET = HResult(MAKE_DDHRESULT_D or 856); + {$EXTERNALSYM DXFILEERR_NOTDONEYET} + DXFILEERR_FILENOTFOUND = HResult(MAKE_DDHRESULT_D or 857); + {$EXTERNALSYM DXFILEERR_FILENOTFOUND} + DXFILEERR_RESOURCENOTFOUND = HResult(MAKE_DDHRESULT_D or 858); + {$EXTERNALSYM DXFILEERR_RESOURCENOTFOUND} + DXFILEERR_URLNOTFOUND = HResult(MAKE_DDHRESULT_D or 859); + {$EXTERNALSYM DXFILEERR_URLNOTFOUND} + DXFILEERR_BADRESOURCE = HResult(MAKE_DDHRESULT_D or 860); + {$EXTERNALSYM DXFILEERR_BADRESOURCE} + DXFILEERR_BADFILETYPE = HResult(MAKE_DDHRESULT_D or 861); + {$EXTERNALSYM DXFILEERR_BADFILETYPE} + DXFILEERR_BADFILEVERSION = HResult(MAKE_DDHRESULT_D or 862); + {$EXTERNALSYM DXFILEERR_BADFILEVERSION} + DXFILEERR_BADFILEFLOATSIZE = HResult(MAKE_DDHRESULT_D or 863); + {$EXTERNALSYM DXFILEERR_BADFILEFLOATSIZE} + DXFILEERR_BADFILECOMPRESSIONTYPE = HResult(MAKE_DDHRESULT_D or 864); + {$EXTERNALSYM DXFILEERR_BADFILECOMPRESSIONTYPE} + DXFILEERR_BADFILE = HResult(MAKE_DDHRESULT_D or 865); + {$EXTERNALSYM DXFILEERR_BADFILE} + DXFILEERR_PARSEERROR = HResult(MAKE_DDHRESULT_D or 866); + {$EXTERNALSYM DXFILEERR_PARSEERROR} + DXFILEERR_NOTEMPLATE = HResult(MAKE_DDHRESULT_D or 867); + {$EXTERNALSYM DXFILEERR_NOTEMPLATE} + DXFILEERR_BADARRAYSIZE = HResult(MAKE_DDHRESULT_D or 868); + {$EXTERNALSYM DXFILEERR_BADARRAYSIZE} + DXFILEERR_BADDATAREFERENCE = HResult(MAKE_DDHRESULT_D or 869); + {$EXTERNALSYM DXFILEERR_BADDATAREFERENCE} + DXFILEERR_INTERNALERROR = HResult(MAKE_DDHRESULT_D or 870); + {$EXTERNALSYM DXFILEERR_INTERNALERROR} + DXFILEERR_NOMOREOBJECTS = HResult(MAKE_DDHRESULT_D or 871); + {$EXTERNALSYM DXFILEERR_NOMOREOBJECTS} + DXFILEERR_BADINTRINSICS = HResult(MAKE_DDHRESULT_D or 872); + {$EXTERNALSYM DXFILEERR_BADINTRINSICS} + DXFILEERR_NOMORESTREAMHANDLES = HResult(MAKE_DDHRESULT_D or 873); + {$EXTERNALSYM DXFILEERR_NOMORESTREAMHANDLES} + DXFILEERR_NOMOREDATA = HResult(MAKE_DDHRESULT_D or 874); + {$EXTERNALSYM DXFILEERR_NOMOREDATA} + DXFILEERR_BADCACHEFILE = HResult(MAKE_DDHRESULT_D or 875); + {$EXTERNALSYM DXFILEERR_BADCACHEFILE} + DXFILEERR_NOINTERNET = HResult(MAKE_DDHRESULT_D or 876); + {$EXTERNALSYM DXFILEERR_NOINTERNET} + +(* +{* API for creating IDirectXFile interface. +{*) + +function DirectXFileCreate(out lplpDirectXFile: IDirectXFile): HResult; stdcall; +{$EXTERNALSYM DirectXFileCreate} + + + +(*************************************************************************** +{* +{* Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. +{* +{* File: rmxfguid.h +{* +{* Content: Defines GUIDs of D3DRM's templates. +{* +{***************************************************************************) + +const + TID_D3DRMInfo: TGUID = '{2B957100-9E9A-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMInfo} + TID_D3DRMMesh: TGUID = '{3D82AB44-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMMesh} + TID_D3DRMVector: TGUID = '{3D82AB5E-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMVector} + TID_D3DRMMeshFace: TGUID = '{3D82AB5F-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMMeshFace} + TID_D3DRMMaterial: TGUID = '{3D82AB4D-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMMaterial} + TID_D3DRMMaterialArray: TGUID = '{35FF44E1-6C7C-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMaterialArray} + TID_D3DRMFrame: TGUID = '{3D82AB46-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMFrame} + TID_D3DRMFrameTransformMatrix: TGUID = '{F6F23F41-7686-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMFrameTransformMatrix} + TID_D3DRMMeshMaterialList: TGUID = '{F6F23F42-7686-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMeshMaterialList} + TID_D3DRMMeshTextureCoords: TGUID = '{F6F23F40-7686-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMeshTextureCoords} + TID_D3DRMMeshNormals: TGUID = '{F6F23F43-7686-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMeshNormals} + TID_D3DRMCoords2d: TGUID = '{F6F23F44-7686-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMCoords2d} + TID_D3DRMMatrix4x4: TGUID = '{F6F23F45-7686-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMatrix4x4} + TID_D3DRMAnimation: TGUID = '{3D82AB4F-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMAnimation} + TID_D3DRMAnimationSet: TGUID = '{3D82AB50-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMAnimationSet} + TID_D3DRMAnimationKey: TGUID = '{10DD46A8-775B-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMAnimationKey} + TID_D3DRMFloatKeys: TGUID = '{10DD46A9-775B-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMFloatKeys} + TID_D3DRMMaterialAmbientColor: TGUID = '{01411840-7786-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMaterialAmbientColor} + TID_D3DRMMaterialDiffuseColor: TGUID = '{01411841-7786-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMaterialDiffuseColor} + TID_D3DRMMaterialSpecularColor: TGUID = '{01411842-7786-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMaterialSpecularColor} + TID_D3DRMMaterialEmissiveColor: TGUID = '{D3E16E80-7835-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMaterialEmissiveColor} + TID_D3DRMMaterialPower: TGUID = '{01411843-7786-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMaterialPower} + TID_D3DRMColorRGBA: TGUID = '{35FF44E0-6C7C-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMColorRGBA} + TID_D3DRMColorRGB: TGUID = '{D3E16E81-7835-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMColorRGB} + TID_D3DRMGuid: TGUID = '{A42790E0-7810-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMGuid} + TID_D3DRMTextureFilename: TGUID = '{A42790E1-7810-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMTextureFilename} + TID_D3DRMTextureReference: TGUID = '{A42790E2-7810-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMTextureReference} + TID_D3DRMIndexedColor: TGUID = '{1630B820-7842-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMIndexedColor} + TID_D3DRMMeshVertexColors: TGUID = '{1630B821-7842-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMeshVertexColors} + TID_D3DRMMaterialWrap: TGUID = '{4885AE60-78E8-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMMaterialWrap} + TID_D3DRMBoolean: TGUID = '{537DA6A0-CA37-11d0-941C-0080C80CFA7B}'; + {$EXTERNALSYM TID_D3DRMBoolean} + TID_D3DRMMeshFaceWraps: TGUID = '{ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B}'; + {$EXTERNALSYM TID_D3DRMMeshFaceWraps} + TID_D3DRMBoolean2d: TGUID = '{4885AE63-78E8-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMBoolean2d} + TID_D3DRMTimedFloatKeys: TGUID = '{F406B180-7B3B-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMTimedFloatKeys} + TID_D3DRMAnimationOptions: TGUID = '{E2BF56C0-840F-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMAnimationOptions} + TID_D3DRMFramePosition: TGUID = '{E2BF56C1-840F-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMFramePosition} + TID_D3DRMFrameVelocity: TGUID = '{E2BF56C2-840F-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMFrameVelocity} + TID_D3DRMFrameRotation: TGUID = '{E2BF56C3-840F-11cf-8F52-0040333594A3}'; + {$EXTERNALSYM TID_D3DRMFrameRotation} + TID_D3DRMLight: TGUID = '{3D82AB4A-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMLight} + TID_D3DRMCamera: TGUID = '{3D82AB51-62DA-11cf-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMCamera} + TID_D3DRMAppData: TGUID = '{E5745280-B24F-11cf-9DD5-00AA00A71A2F}'; + {$EXTERNALSYM TID_D3DRMAppData} + TID_D3DRMLightUmbra: TGUID = '{AED22740-B31F-11cf-9DD5-00AA00A71A2F}'; + {$EXTERNALSYM TID_D3DRMLightUmbra} + TID_D3DRMLightRange: TGUID = '{AED22742-B31F-11cf-9DD5-00AA00A71A2F}'; + {$EXTERNALSYM TID_D3DRMLightRange} + TID_D3DRMLightPenumbra: TGUID = '{AED22741-B31F-11cf-9DD5-00AA00A71A2F}'; + {$EXTERNALSYM TID_D3DRMLightPenumbra} + TID_D3DRMLightAttenuation: TGUID = '{A8A98BA0-C5E5-11cf-B941-0080C80CFA7B}'; + {$EXTERNALSYM TID_D3DRMLightAttenuation} + TID_D3DRMInlineData: TGUID = '{3A23EEA0-94B1-11d0-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMInlineData} + TID_D3DRMUrl: TGUID = '{3A23EEA1-94B1-11d0-AB39-0020AF71E433}'; + {$EXTERNALSYM TID_D3DRMUrl} + TID_D3DRMProgressiveMesh: TGUID = '{8A63C360-997D-11d0-941C-0080C80CFA7B}'; + {$EXTERNALSYM TID_D3DRMProgressiveMesh} + TID_D3DRMExternalVisual: TGUID = '{98116AA0-BDBA-11d1-82C0-00A0C9697271}'; + {$EXTERNALSYM TID_D3DRMExternalVisual} + TID_D3DRMStringProperty: TGUID = '{7F0F21E0-BFE1-11d1-82C0-00A0C9697271}'; + {$EXTERNALSYM TID_D3DRMStringProperty} + TID_D3DRMPropertyBag: TGUID = '{7F0F21E1-BFE1-11d1-82C0-00A0C9697271}'; + {$EXTERNALSYM TID_D3DRMPropertyBag} + TID_D3DRMRightHanded: TGUID = '{7F5D5EA0-D53A-11d1-82C0-00A0C9697271}'; + {$EXTERNALSYM TID_D3DRMRightHanded} + + + +(*==========================================================================; +{* +{* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved. +{* +{* File: rmxftmpl.h +{* Content: D3DRM XFile templates in binary form +{* +{***************************************************************************) + +const + D3DRM_XTEMPLATE_BYTES = 3278; + {$EXTERNALSYM D3DRM_XTEMPLATE_BYTES} + + {$EXTERNALSYM D3DRM_XTEMPLATES} + D3DRM_XTEMPLATES: array [0..D3DRM_XTEMPLATE_BYTES-1] of byte = ( + $78, $6f, $66, $20, $30, $33, $30, $32, $62, $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1, + 0, $6, 0, 0, 0, $48, $65, $61, $64, $65, $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da, + $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d, + $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14, + 0, $29, 0, $1, 0, $5, 0, 0, 0, $66, $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0, + $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d, + $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0, + $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0, 0, $79, $14, 0, $2a, 0, $1, 0, $1, 0, + 0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, + $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, + $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0, 0, $75, $14, 0, $2a, 0, $1, 0, $1, 0, + 0, 0, $76, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69, + $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, + $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78, + $e, 0, $3, 0, $10, 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, + 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c, + $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, + $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, + 0, $1, 0, $4, 0, 0, 0, $62, $6c, $75, $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0, + 0, $61, $6c, $70, $68, $61, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, + $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0, $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52, + 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a, + 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0, + 0, 0, $62, $6c, $75, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e, + $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72, $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78, + $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e, + $64, $65, $78, $14, 0, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, + $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65, $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0, + $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0, + $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9, + 0, 0, 0, $74, $72, $75, $65, $66, $61, $6c, $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0, + $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85, + $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42, + $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, 0, $1, 0, $7, 0, 0, + 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f, + 0, $1, 0, $c, 0, 0, 0, $4d, $61, $74, $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a, + 0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, + 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, + 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, + $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $54, $65, $78, $74, $75, $72, $65, + $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0, $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11, + $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0, $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65, + $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65, + $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, + $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1, + 0, $9, 0, 0, 0, $66, $61, $63, $65, $43, $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0, + $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, + $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0, 0, $73, $70, $65, $63, $75, $6c, $61, $72, $43, + $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, + $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73, $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14, + 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, + 0, $4d, $65, $73, $68, $46, $61, $63, $65, $a, 0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf, + $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, + $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $14, 0, $34, 0, $29, + 0, $1, 0, $11, 0, 0, 0, $66, $61, $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, + $69, $63, $65, $73, $e, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, $63, $65, $56, $65, $72, + $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, + $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $57, $72, $61, $70, $73, $a, 0, $5, + 0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, + 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, + $14, 0, $34, 0, $1, 0, $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1, + 0, $e, 0, 0, 0, $66, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e, + 0, $1, 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, + $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68, + $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2, + $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0, + 0, $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1, + 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, $73, $32, $64, $1, 0, $d, 0, 0, 0, $74, + $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $e, 0, $1, 0, $e, 0, 0, 0, + $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0, + $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65, $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c, + $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, + $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0, 0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61, + $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64, + $65, $78, $65, $73, $14, 0, $34, 0, $29, 0, $1, 0, $b, 0, 0, 0, $66, $61, $63, $65, + $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, + $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14, 0, $e, 0, $1, 0, $8, 0, 0, 0, $4d, + $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b, 0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d, + $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73, $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76, + $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e, + $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, + $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8, + 0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $29, 0, $1, 0, $c, + 0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, + 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $1, 0, $b, 0, 0, 0, $66, + $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, + $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, + $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73, + $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, + $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, + $73, $14, 0, $34, 0, $1, 0, $c, 0, 0, 0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f, + $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, + $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, + $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68, + $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, + $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, $69, $63, $65, $73, $14, 0, $34, + 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76, + $65, $72, $74, $69, $63, $65, $73, $e, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, + $69, $63, $65, $73, $f, 0, $14, 0, $29, 0, $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63, + $65, $73, $14, 0, $34, 0, $1, 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, + $1, 0, $5, 0, 0, 0, $66, $61, $63, $65, $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e, + $46, $61, $63, $65, $73, $f, 0, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, + 0, $1f, 0, $1, 0, $14, 0, 0, 0, $46, $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66, + $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a, 0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf, + $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69, + $78, $34, $78, $34, $1, 0, $b, 0, 0, 0, $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69, + $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5, 0, 0, 0, $46, $72, $61, $6d, $65, $a, 0, + $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, + $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c, + $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5, 0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f, + $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, + $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73, + $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b, + 0, $1f, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, + $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6, $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33, + $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0, 0, $74, $69, $6d, $65, $14, 0, $1, 0, $9, + 0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65, $79, $73, $1, 0, $6, 0, 0, 0, $74, $66, + $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d, + $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0, $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11, + $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54, + $79, $70, $65, $14, 0, $29, 0, $1, 0, $5, 0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0, + $34, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65, + $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65, $79, $73, $e, 0, $1, 0, $5, 0, 0, 0, + $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $10, 0, 0, 0, $41, + $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70, $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0, + $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a, + 0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f, $73, $65, $64, $14, 0, $29, 0, $1, 0, $f, + 0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f, $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0, + $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a, + 0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, + 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, + $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65, $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da, + $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $9, 0, 0, 0, $41, + $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0, $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0, + $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94, + $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $6, 0, 0, 0, $42, $49, + $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0, $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a, + 0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, + 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0, + $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, + $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $50, $72, $6f, $67, $72, + $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68, $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99, + $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $e, 0, $1, 0, $3, 0, 0, 0, $55, $72, + $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f, + 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $a, 0, $5, 0, $e0, + $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, + 0, 0, 0, $64, $61, $74, $61, $31, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, + $74, $61, $32, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $33, $14, 0, + $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $34, $e, 0, $3, 0, $8, + 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, + $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74, $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1, + $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b, + $65, $79, $14, 0, $31, 0, $1, 0, $5, 0, 0, 0, $76, $61, $6c, $75, $65, $14, 0, $b, + 0, $1f, 0, $1, 0, $b, 0, 0, 0, $50, $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67, + $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, + $e, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72, + $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e, + $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0, $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11, + $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $1, 0, + $12, 0, 0, 0, $67, $75, $69, $64, $45, $78, $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75, + $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, + $b, 0, 0, 0, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $a, 0, $5, 0, $a0, + $5e, $5d, $7f, $3a, $d5, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $29, 0, $1, 0, $c, + 0, 0, 0, $62, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $14, 0, $b, 0); + + + +implementation + +// #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) +function MAKE_DDHRESULT(Code: DWord): DWord; +begin + Result:= DWord((1 shl 31) or (_FACD3D shl 16)) or Code; +end; + +(* +{* API for creating IDirectXFile interface. +{*) + +const + DXFileDLL = 'D3DXOF.DLL'; + +function DirectXFileCreate; external DXFileDLL; + +end. diff --git a/Game/Code/lib/DSPack/DirectX9/DXTypes.pas b/Game/Code/lib/DSPack/DirectX9/DXTypes.pas new file mode 100644 index 00000000..03d9a33d --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DXTypes.pas @@ -0,0 +1,68 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* File: extracted from various DirectX SDK include files *} +{* *} +{* Content: DirectX 9.0 headers common types *} +{* *} +{* Direct3DX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 26-Jan-2003 *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{******************************************************************************) +{ } +{ 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 DXTypes.pas. } +{ } +{******************************************************************************} +unit DXTypes; + +interface + +uses Windows; + +type + // TD3DValue is the fundamental Direct3D fractional data type + D3DVALUE = Single; + TD3DValue = D3DVALUE; + PD3DValue = ^TD3DValue; + {$NODEFINE D3DVALUE} + {$NODEFINE TD3DValue} + {$NODEFINE PD3DValue} + + D3DCOLOR = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + TD3DColor = D3DCOLOR; + PD3DColor = ^TD3DColor; + {$NODEFINE D3DCOLOR} + {$NODEFINE TD3DColor} + {$NODEFINE PD3DColor} + + _D3DVECTOR = packed record + x: Single; + y: Single; + z: Single; + end {_D3DVECTOR}; + D3DVECTOR = _D3DVECTOR; + TD3DVector = _D3DVECTOR; + PD3DVector = ^TD3DVector; + {$NODEFINE _D3DVECTOR} + {$NODEFINE D3DVECTOR} + {$NODEFINE TD3DVector} + {$NODEFINE PD3DVector} + +implementation + +end. + diff --git a/Game/Code/lib/DSPack/DirectX9/Direct3D.pas b/Game/Code/lib/DSPack/DirectX9/Direct3D.pas new file mode 100644 index 00000000..629a03fe --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/Direct3D.pas @@ -0,0 +1,5609 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: d3dtypes.h d3dcaps.h d3d.h *} +{* Content: Direct3D8 include files *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 26-Jan-2003 *} +{* *} +{* Partly based upon : *} +{* DirectX 7.0 Object Pascal adaptation by *} +{* Erik Unger, e-Mail: DelphiDirectX@next-reality.com *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi/ *} +{* *} +{******************************************************************************} +{ } +{ 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: +// DIRECT3D_VERSION_8 : DIRECT3D_VERSION = 0x0800, +// DIRECT3D_VERSION_7 : DIRECT3D_VERSION = 0x0700, +// DIRECT3D_VERSION_6 : DIRECT3D_VERSION = 0x0600, +// DIRECT3D_VERSION_5 : DIRECT3D_VERSION = 0x0500, +// DIRECT3D_VERSION_LESS_5 : DIRECT3D_VERSION < 0x0500, +// +// By default DIRECT3D_VERSION_7 (DIRECT3D_VERSION = 0x0700) is assumed +/////////////////////////////////////////////////////////////////////////////// + +unit Direct3D; + +{$I DirectX.inc} + +// Remove "dots" below to exclude DXFile interfaces - these interfaces +// are included for compatibility with original Erik Unger translation +{$DEFINE EXCLUDE_DXFILE_FROM_DIRECT3D} + +// Assume for what Direct3D version we will compile headers +{$IFNDEF DIRECT3D_VERSION_8} + {$IFNDEF DIRECT3D_VERSION_7} + {$IFNDEF DIRECT3D_VERSION_6} + {$IFNDEF DIRECT3D_VERSION_5} + {$IFNDEF DIRECT3D_VERSION_LESS_5} + {$DEFINE DIRECT3D_VERSION_7} // Compiling for Direct3D7 by default + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +// Emit conditionals to C++Builder compiler +{$IFDEF DIRECT3D_VERSION_8} + {$HPPEMIT '#define DIRECT3D_VERSION 0x0800'} +{$ENDIF} +{$IFDEF DIRECT3D_VERSION_7} + {$HPPEMIT '#define DIRECT3D_VERSION 0x0700'} +{$ENDIF} +{$IFDEF DIRECT3D_VERSION_6} + {$HPPEMIT '#define DIRECT3D_VERSION 0x0600'} +{$ENDIF} +{$IFDEF DIRECT3D_VERSION_5} + {$HPPEMIT '#define DIRECT3D_VERSION 0x0500'} +{$ENDIF} +{$IFDEF DIRECT3D_VERSION_LESS_5} + {$HPPEMIT '#define DIRECT3D_VERSION 0x0300'} +{$ENDIF} + +// Define symbols for '>=' comparision +{$IFDEF DIRECT3D_VERSION_8} + {$DEFINE DIRECT3D_VERSION_7} +{$ENDIF} +{$IFDEF DIRECT3D_VERSION_7} + {$DEFINE DIRECT3D_VERSION_6} +{$ENDIF} +{$IFDEF DIRECT3D_VERSION_6} + {$DEFINE DIRECT3D_VERSION_5} +{$ENDIF} + +// Define symbols for '<' comparision +{$IFNDEF DIRECT3D_VERSION_8} + {$DEFINE DIRECT3D_VERSION_LESS_8} +{$ENDIF} +{$IFNDEF DIRECT3D_VERSION_7} + {$DEFINE DIRECT3D_VERSION_LESS_7} +{$ENDIF} +{$IFNDEF DIRECT3D_VERSION_6} + {$DEFINE DIRECT3D_VERSION_LESS_6} +{$ENDIF} +{$IFNDEF DIRECT3D_VERSION_5} + {$DEFINE DIRECT3D_VERSION_LESS_5} +{$ENDIF} + +interface + +uses + Windows, DXTypes, DirectDraw{$IFDEF DIRECT3D_VERSION_8}, Direct3D8{$ENDIF}; + +{$NOINCLUDE Windows} +{$NOINCLUDE DXTypes} +{$NOINCLUDE DirectDraw} +{$IFDEF DIRECT3D_VERSION_8} + {$NOINCLUDE Direct3D8} +{$ENDIF} + +{$HPPEMIT '#include "d3d.h"'} +{$HPPEMIT '#include "d3dtypes.h"'} +{$HPPEMIT '#include "d3dcaps.h"'} + +(* TD3DValue is the fundamental Direct3D fractional data type *) + +type + TRefClsID = TGUID; + +type + D3DVALUE = DXTypes.D3DVALUE; + {$EXTERNALSYM D3DVALUE} + TD3DValue = DXTypes.TD3DValue; + {$NODEFINE TD3DValue} + PD3DValue = DXTypes.PD3DValue; + {$NODEFINE PD3DValue} + + D3DFIXED = Longint; + {$EXTERNALSYM D3DFIXED} + TD3DFixed = D3DFIXED; + + float = TD3DValue; + {$EXTERNALSYM float} + + D3DCOLOR = DXTypes.D3DCOLOR; + {$EXTERNALSYM D3DCOLOR} + TD3DColor = DXTypes.TD3DColor; + {$NODEFINE TD3DColor} + PD3DColor = DXTypes.PD3DColor; + {$NODEFINE PD3DColor} + +function D3DVal(val: Variant): Single; +{$EXTERNALSYM D3DVal} +function D3DDivide(a, b: Double): Single; +{$EXTERNALSYM D3DDivide} +function D3DMultiply(a, b: Double): Single; +{$EXTERNALSYM D3DMultiply} + +(* + * Format of CI colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | alpha | color index | fraction | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + *) + +// #define CI_GETALPHA(ci) ((ci) >> 24) +function CI_GETALPHA(ci: DWORD): DWORD; +{$EXTERNALSYM CI_GETALPHA} + +// #define CI_GETINDEX(ci) (((ci) >> 8) & 0xffff) +function CI_GETINDEX(ci: DWORD): DWORD; +{$EXTERNALSYM CI_GETINDEX} + +// #define CI_GETFRACTION(ci) ((ci) & 0xff) +function CI_GETFRACTION(ci: DWORD): DWORD; +{$EXTERNALSYM CI_GETFRACTION} + +// #define CI_ROUNDINDEX(ci) CI_GETINDEX((ci) + 0x80) +function CI_ROUNDINDEX(ci: DWORD): DWORD; +{$EXTERNALSYM CI_ROUNDINDEX} + +// #define CI_MASKALPHA(ci) ((ci) & 0xffffff) +function CI_MASKALPHA(ci: DWORD): DWORD; +{$EXTERNALSYM CI_MASKALPHA} + +// #define CI_MAKE(a, i, f) (((a) << 24) | ((i) << 8) | (f)) +function CI_MAKE(a,i,f: DWORD): DWORD; +{$EXTERNALSYM CI_MAKE} + +(* + * Format of RGBA colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | alpha | red | green | blue | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + *) + +// #define RGBA_GETALPHA(rgb) ((rgb) >> 24) +function RGBA_GETALPHA(rgb: TD3DColor): DWORD; +{$EXTERNALSYM RGBA_GETALPHA} + +// #define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff) +function RGBA_GETRED(rgb: TD3DColor): DWORD; +{$EXTERNALSYM RGBA_GETRED} + +// #define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +function RGBA_GETGREEN(rgb: TD3DColor): DWORD; +{$EXTERNALSYM RGBA_GETGREEN} + +// #define RGBA_GETBLUE(rgb) ((rgb) & 0xff) +function RGBA_GETBLUE(rgb: TD3DColor): DWORD; +{$EXTERNALSYM RGBA_GETBLUE} + +// #define RGBA_MAKE(r, g, b, a) ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))) +function RGBA_MAKE(r, g, b, a: DWORD): TD3DColor; +{$EXTERNALSYM RGBA_MAKE} + +(* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs + * The float values must be in the range 0..1 + *) + +// #define D3DRGB(r, g, b) \ +// (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255)) +function D3DRGB(r, g, b: Single): TD3DColor; +{$EXTERNALSYM D3DRGB} + +// #define D3DRGBA(r, g, b, a) \ +// ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \ +// | (((long)((g) * 255)) << 8) | (long)((b) * 255) \ +// ) +function D3DRGBA(r, g, b, a: Single): TD3DColor; +{$EXTERNALSYM D3DRGBA} + +(* + * Format of RGB colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ignored | red | green | blue | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + *) + +// #define RGB_GETRED(rgb) (((rgb) >> 16) & 0xff) +function RGB_GETRED(rgb: TD3DColor): DWORD; +{$EXTERNALSYM RGB_GETRED} + +// #define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +function RGB_GETGREEN(rgb: TD3DColor): DWORD; +{$EXTERNALSYM RGB_GETGREEN} + +// #define RGB_GETBLUE(rgb) ((rgb) & 0xff) +function RGB_GETBLUE(rgb: TD3DColor): DWORD; +{$EXTERNALSYM RGB_GETBLUE} + +// #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff)) +function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD): TD3DColor; +{$EXTERNALSYM RGBA_SETALPHA} + +// #define RGB_MAKE(r, g, b) ((TD3DColor) (((r) << 16) | ((g) << 8) | (b))) +function RGB_MAKE(r, g, b: DWORD): TD3DColor; +{$EXTERNALSYM RGB_MAKE} + +// #define RGBA_TORGB(rgba) ((TD3DColor) ((rgba) & 0xffffff)) +function RGBA_TORGB(rgba: TD3DColor): TD3DColor; +{$EXTERNALSYM RGBA_TORGB} + +// #define RGB_TORGBA(rgb) ((TD3DColor) ((rgb) | 0xff000000)) +function RGB_TORGBA(rgb: TD3DColor): TD3DColor; +{$EXTERNALSYM RGB_TORGBA} + +(* + * Flags for Enumerate functions + *) +const + +(* + * Stop the enumeration + *) + + D3DENUMRET_CANCEL = DDENUMRET_CANCEL; + {$EXTERNALSYM D3DENUMRET_CANCEL} + +(* + * Continue the enumeration + *) + + D3DENUMRET_OK = DDENUMRET_OK; + {$EXTERNALSYM D3DENUMRET_OK} + +type + TD3DValidateCallback = function (lpUserArg: Pointer; + dwOffset: DWORD): HResult; stdcall; + {$NODEFINE TD3DValidateCallback} + {$HPPEMIT 'typedef LPD3DVALIDATECALLBACK TD3DValidateCallback;'} + + TD3DEnumTextureFormatsCallback = function (var lpDdsd: TDDSurfaceDesc; + lpContext: Pointer): HResult; stdcall; + {$NODEFINE TD3DEnumTextureFormatsCallback} + {$HPPEMIT 'typedef LPD3DENUMTEXTUREFORMATSCALLBACK TD3DEnumTextureFormatsCallback;'} + + TD3DEnumPixelFormatsCallback = function (var lpDDPixFmt: TDDPixelFormat; + lpContext: Pointer): HResult; stdcall; + {$NODEFINE TD3DEnumPixelFormatsCallback} + {$HPPEMIT 'typedef LPD3DENUMPIXELFORMATSCALLBACK TD3DEnumPixelFormatsCallback;'} + + PD3DMaterialHandle = ^TD3DMaterialHandle; + TD3DMaterialHandle = DWORD; + + PD3DTextureHandle = ^TD3DTextureHandle; + TD3DTextureHandle = DWORD; + + PD3DMatrixHandle = ^TD3DMatrixHandle; + TD3DMatrixHandle = DWORD; + + + PD3DColorValue = ^TD3DColorValue; + _D3DCOLORVALUE = packed record + case Integer of + 0: ( + r: TD3DValue; + g: TD3DValue; + b: TD3DValue; + a: TD3DValue; + ); + 1: ( + dvR: TD3DValue; + dvG: TD3DValue; + dvB: TD3DValue; + dvA: TD3DValue; + ); + end {_D3DCOLORVALUE}; + {$EXTERNALSYM _D3DCOLORVALUE} + D3DCOLORVALUE = _D3DCOLORVALUE; + {$EXTERNALSYM D3DCOLORVALUE} + TD3DColorValue = _D3DCOLORVALUE; + + + PD3DRect = ^TD3DRect; + _D3DRECT = packed record + case Integer of + 0: ( + x1: LongInt; + y1: LongInt; + x2: LongInt; + y2: LongInt; + ); + 1: ( + lX1: LongInt; + lY1: LongInt; + lX2: LongInt; + lY2: LongInt; + ); + 2: ( + a: array[0..3] of LongInt; + ); + end {_D3DRECT}; + {$EXTERNALSYM _D3DRECT} + D3DRECT = _D3DRECT; + {$EXTERNALSYM D3DRECT} + TD3DRect = _D3DRECT; + + + PD3DVector = ^TD3DVector; + _D3DVECTOR = packed record + case Integer of + 0: ( + x: TD3DValue; + y: TD3DValue; + z: TD3DValue; + ); + 1: ( + dvX: TD3DValue; + dvY: TD3DValue; + dvZ: TD3DValue; + ); + end {_D3DVECTOR}; + {$EXTERNALSYM _D3DVECTOR} + D3DVECTOR = _D3DVECTOR; + {$EXTERNALSYM D3DVECTOR} + TD3DVector = _D3DVECTOR; + +{$HPPEMIT ''} +{$HPPEMIT '#ifndef DX_SHARED_DEFINES_BCB'} +{$HPPEMIT ''} +{$HPPEMIT 'typedef D3DVALUE TD3DValue;'} +{$HPPEMIT 'typedef D3DVALUE *PD3DValue;'} +{$HPPEMIT ''} +{$HPPEMIT '#ifndef D3DCOLOR_DEFINED_BCB'} +{$HPPEMIT 'typedef D3DCOLOR TD3DColor;'} +{$HPPEMIT 'typedef D3DCOLOR *PD3DColor;'} +{$HPPEMIT '#define D3DCOLOR_DEFINED_BCB'} +{$HPPEMIT '#endif'} +{$HPPEMIT ''} +{$HPPEMIT '#define D3DVECTOR_DEFINED_BCB'} +{$HPPEMIT ''} +{$HPPEMIT '#define DX_SHARED_DEFINES_BCB'} +{$HPPEMIT '#endif // DX_SHARED_DEFINES_BCB'} +{$HPPEMIT ''} + + +(****************************************************************** + * * + * D3DVec.inl * + * * + * float-valued 3D vector class for Direct3D. * + * * + * Copyright (c) 1996-1998 Microsoft Corp. All rights reserved. * + * * + ******************************************************************) + + // Addition and subtraction + function VectorAdd(const v1, v2: TD3DVector): TD3DVector; + function VectorSub(const v1, v2: TD3DVector): TD3DVector; + // Scalar multiplication and division + function VectorMulS(const v: TD3DVector; s: TD3DValue): TD3DVector; + function VectorDivS(const v: TD3DVector; s: TD3DValue): TD3DVector; + // Memberwise multiplication and division + function VectorMul(const v1, v2: TD3DVector): TD3DVector; + function VectorDiv(const v1, v2: TD3DVector): TD3DVector; + // Vector dominance + function VectorSmaller(v1, v2: TD3DVector): Boolean; + function VectorSmallerEqual(v1, v2: TD3DVector): Boolean; + // Bitwise equality + function VectorEqual(v1, v2: TD3DVector): Boolean; + // Length-related functions + function VectorSquareMagnitude(v: TD3DVector): TD3DValue; + function VectorMagnitude(v: TD3DVector): TD3DValue; + // Returns vector with same direction and unit length + function VectorNormalize(const v: TD3DVector): TD3DVector; + // Return min/max component of the input vector + function VectorMin(v: TD3DVector): TD3DValue; + function VectorMax(v: TD3DVector): TD3DValue; + // Return memberwise min/max of input vectors + function VectorMinimize(const v1, v2: TD3DVector): TD3DVector; + function VectorMaximize(const v1, v2: TD3DVector): TD3DVector; + // Dot and cross product + function VectorDotProduct(v1, v2: TD3DVector): TD3DValue; + function VectorCrossProduct(const v1, v2: TD3DVector): TD3DVector; + +type +(* + * Vertex data types supported in an ExecuteBuffer. + *) + +(* + * Homogeneous vertices + *) + + PD3DHVertex = ^TD3DHVertex; + _D3DHVERTEX = packed record + dwFlags: DWORD; (* Homogeneous clipping flags *) + case Integer of + 0: ( + hx: TD3DValue; + hy: TD3DValue; + hz: TD3DValue; + ); + 1: ( + dvHX: TD3DValue; + dvHY: TD3DValue; + dvHZ: TD3DValue; + ); + end; + {$EXTERNALSYM _D3DHVERTEX} + D3DHVERTEX = _D3DHVERTEX; + {$EXTERNALSYM D3DHVERTEX} + TD3DHVertex = _D3DHVERTEX; + + +(* + * Transformed/lit vertices + *) + + PD3DTLVertex = ^TD3DTLVertex; + _D3DTLVERTEX = packed record + case Integer of + 0: ( + sx: TD3DValue; (* Screen coordinates *) + sy: TD3DValue; + sz: TD3DValue; + rhw: TD3DValue; (* Reciprocal of homogeneous w *) + color: TD3DColor; (* Vertex color *) + specular: TD3DColor; (* Specular component of vertex *) + tu: TD3DValue; (* Texture coordinates *) + tv: TD3DValue; + ); + 1: ( + dvSX: TD3DValue; + dvSY: TD3DValue; + dvSZ: TD3DValue; + dvRHW: TD3DValue; + dcColor: TD3DColor; + dcSpecular: TD3DColor; + dvTU: TD3DValue; + dvTV: TD3DValue; + ); + end; + {$EXTERNALSYM _D3DTLVERTEX} + D3DTLVERTEX = _D3DTLVERTEX; + {$EXTERNALSYM D3DTLVERTEX} + TD3DTLVertex = _D3DTLVERTEX; + +(* + * Untransformed/lit vertices + *) + + PD3DLVertex = ^TD3DLVertex; + _D3DLVERTEX = packed record + case Integer of + 0: ( + x: TD3DValue; (* Homogeneous coordinates *) + y: TD3DValue; + z: TD3DValue; + dwReserved: DWORD; + color: TD3DColor; (* Vertex color *) + specular: TD3DColor; (* Specular component of vertex *) + tu: TD3DValue; (* Texture coordinates *) + tv: TD3DValue; + ); + 1: ( + dvX: TD3DValue; + dvY: TD3DValue; + dvZ: TD3DValue; + UNIONFILLER1d: DWORD; + dcColor: TD3DColor; + dcSpecular: TD3DColor; + dvTU: TD3DValue; + dvTV: TD3DValue; + ); + end; + {$EXTERNALSYM _D3DLVERTEX} + D3DLVERTEX = _D3DLVERTEX; + {$EXTERNALSYM D3DLVERTEX} + TD3DLVertex = _D3DLVERTEX; + + +(* + * Untransformed/unlit vertices + *) + + PD3DVertex = ^TD3DVertex; + _D3DVERTEX = packed record + case Integer of + 0: ( + x: TD3DValue; (* Homogeneous coordinates *) + y: TD3DValue; + z: TD3DValue; + nx: TD3DValue; (* Normal *) + ny: TD3DValue; + nz: TD3DValue; + tu: TD3DValue; (* Texture coordinates *) + tv: TD3DValue; + ); + 1: ( + dvX: TD3DValue; + dvY: TD3DValue; + dvZ: TD3DValue; + dvNX: TD3DValue; + dvNY: TD3DValue; + dvNZ: TD3DValue; + dvTU: TD3DValue; + dvTV: TD3DValue; + ); + end; + {$EXTERNALSYM _D3DVERTEX} + D3DVERTEX = _D3DVERTEX; + {$EXTERNALSYM D3DVERTEX} + TD3DVertex = _D3DVERTEX; + +(* + * Matrix, viewport, and tranformation structures and definitions. + *) + + PD3DMatrix = ^TD3DMatrix; + _D3DMATRIX = packed record + case integer of + 0 : (_11, _12, _13, _14: TD3DValue; + _21, _22, _23, _24: TD3DValue; + _31, _32, _33, _34: TD3DValue; + _41, _42, _43, _44: TD3DValue); + 1 : (m : array [0..3, 0..3] of TD3DValue); + end {_D3DMATRIX}; + {$EXTERNALSYM _D3DMATRIX} + D3DMATRIX = _D3DMATRIX; + {$EXTERNALSYM D3DMATRIX} + TD3DMatrix = _D3DMATRIX; + + PD3DViewport = ^TD3DViewport; + _D3DVIEWPORT = packed record + dwSize: DWORD; + dwX: DWORD; + dwY: DWORD; (* Top left *) + dwWidth: DWORD; + dwHeight: DWORD; (* Dimensions *) + dvScaleX: TD3DValue; (* Scale homogeneous to screen *) + dvScaleY: TD3DValue; (* Scale homogeneous to screen *) + dvMaxX: TD3DValue; (* Min/max homogeneous x coord *) + dvMaxY: TD3DValue; (* Min/max homogeneous y coord *) + dvMinZ: TD3DValue; + dvMaxZ: TD3DValue; (* Min/max homogeneous z coord *) + end {_D3DVIEWPORT}; + {$EXTERNALSYM _D3DVIEWPORT} + D3DVIEWPORT = _D3DVIEWPORT; + {$EXTERNALSYM D3DVIEWPORT} + TD3DViewport = _D3DVIEWPORT; + + +{$IFDEF DIRECT3D_VERSION_5} + PD3DViewport2 = ^TD3DViewport2; + _D3DVIEWPORT2 = packed record + dwSize: DWORD; + dwX: DWORD; + dwY: DWORD; (* Viewport Top left *) + dwWidth: DWORD; + dwHeight: DWORD; (* Viewport Dimensions *) + dvClipX: TD3DValue; (* Top left of clip volume *) + dvClipY: TD3DValue; + dvClipWidth: TD3DValue; (* Clip Volume Dimensions *) + dvClipHeight: TD3DValue; + dvMinZ: TD3DValue; (* Min/max of clip Volume *) + dvMaxZ: TD3DValue; + end; + {$EXTERNALSYM _D3DVIEWPORT2} + D3DVIEWPORT2 = _D3DVIEWPORT2; + {$EXTERNALSYM D3DVIEWPORT2} + TD3DViewport2 = _D3DVIEWPORT2; +{$ENDIF} // DIRECT3D_VERSION_5 + + +{$IFDEF DIRECT3D_VERSION_7} + PD3DViewport7 = ^TD3DViewport7; + _D3DVIEWPORT7 = packed record + dwX: DWORD; + dwY: DWORD; (* Viewport Top left *) + dwWidth: DWORD; + dwHeight: DWORD; (* Viewport Dimensions *) + dvMinZ: TD3DValue; (* Min/max of clip Volume *) + dvMaxZ: TD3DValue; + end; + {$EXTERNALSYM _D3DVIEWPORT7} + D3DVIEWPORT7 = _D3DVIEWPORT7; + {$EXTERNALSYM D3DVIEWPORT7} + TD3DViewport7 = _D3DVIEWPORT7; +{$ENDIF} // DIRECT3D_VERSION_7 + +(* + * Values for clip fields. + *) + +{$IFDEF DIRECT3D_VERSION_7} + +const +// Max number of user clipping planes, supported in D3D. + D3DMAXUSERCLIPPLANES = 32; + {$EXTERNALSYM D3DMAXUSERCLIPPLANES} + +// These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE +// + D3DCLIPPLANE0 = (1 shl 0); + {$EXTERNALSYM D3DCLIPPLANE0} + D3DCLIPPLANE1 = (1 shl 1); + {$EXTERNALSYM D3DCLIPPLANE1} + D3DCLIPPLANE2 = (1 shl 2); + {$EXTERNALSYM D3DCLIPPLANE2} + D3DCLIPPLANE3 = (1 shl 3); + {$EXTERNALSYM D3DCLIPPLANE3} + D3DCLIPPLANE4 = (1 shl 4); + {$EXTERNALSYM D3DCLIPPLANE4} + D3DCLIPPLANE5 = (1 shl 5); + {$EXTERNALSYM D3DCLIPPLANE5} + +{$ENDIF} // DIRECT3D_VERSION_7 + +const + D3DCLIP_LEFT = $00000001; + {$EXTERNALSYM D3DCLIP_LEFT} + D3DCLIP_RIGHT = $00000002; + {$EXTERNALSYM D3DCLIP_RIGHT} + D3DCLIP_TOP = $00000004; + {$EXTERNALSYM D3DCLIP_TOP} + D3DCLIP_BOTTOM = $00000008; + {$EXTERNALSYM D3DCLIP_BOTTOM} + D3DCLIP_FRONT = $00000010; + {$EXTERNALSYM D3DCLIP_FRONT} + D3DCLIP_BACK = $00000020; + {$EXTERNALSYM D3DCLIP_BACK} + D3DCLIP_GEN0 = $00000040; + {$EXTERNALSYM D3DCLIP_GEN0} + D3DCLIP_GEN1 = $00000080; + {$EXTERNALSYM D3DCLIP_GEN1} + D3DCLIP_GEN2 = $00000100; + {$EXTERNALSYM D3DCLIP_GEN2} + D3DCLIP_GEN3 = $00000200; + {$EXTERNALSYM D3DCLIP_GEN3} + D3DCLIP_GEN4 = $00000400; + {$EXTERNALSYM D3DCLIP_GEN4} + D3DCLIP_GEN5 = $00000800; + {$EXTERNALSYM D3DCLIP_GEN5} + +(* + * Values for d3d status. + *) + + D3DSTATUS_CLIPUNIONLEFT = D3DCLIP_LEFT; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONLEFT} + D3DSTATUS_CLIPUNIONRIGHT = D3DCLIP_RIGHT; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONRIGHT} + D3DSTATUS_CLIPUNIONTOP = D3DCLIP_TOP; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONTOP} + D3DSTATUS_CLIPUNIONBOTTOM = D3DCLIP_BOTTOM; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONBOTTOM} + D3DSTATUS_CLIPUNIONFRONT = D3DCLIP_FRONT; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONFRONT} + D3DSTATUS_CLIPUNIONBACK = D3DCLIP_BACK; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONBACK} + D3DSTATUS_CLIPUNIONGEN0 = D3DCLIP_GEN0; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN0} + D3DSTATUS_CLIPUNIONGEN1 = D3DCLIP_GEN1; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN1} + D3DSTATUS_CLIPUNIONGEN2 = D3DCLIP_GEN2; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN2} + D3DSTATUS_CLIPUNIONGEN3 = D3DCLIP_GEN3; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN3} + D3DSTATUS_CLIPUNIONGEN4 = D3DCLIP_GEN4; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN4} + D3DSTATUS_CLIPUNIONGEN5 = D3DCLIP_GEN5; + {$EXTERNALSYM D3DSTATUS_CLIPUNIONGEN5} + + D3DSTATUS_CLIPINTERSECTIONLEFT = $00001000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONLEFT} + D3DSTATUS_CLIPINTERSECTIONRIGHT = $00002000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONRIGHT} + D3DSTATUS_CLIPINTERSECTIONTOP = $00004000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONTOP} + D3DSTATUS_CLIPINTERSECTIONBOTTOM = $00008000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONBOTTOM} + D3DSTATUS_CLIPINTERSECTIONFRONT = $00010000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONFRONT} + D3DSTATUS_CLIPINTERSECTIONBACK = $00020000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONBACK} + D3DSTATUS_CLIPINTERSECTIONGEN0 = $00040000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN0} + D3DSTATUS_CLIPINTERSECTIONGEN1 = $00080000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN1} + D3DSTATUS_CLIPINTERSECTIONGEN2 = $00100000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN2} + D3DSTATUS_CLIPINTERSECTIONGEN3 = $00200000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN3} + D3DSTATUS_CLIPINTERSECTIONGEN4 = $00400000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN4} + D3DSTATUS_CLIPINTERSECTIONGEN5 = $00800000; + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONGEN5} + D3DSTATUS_ZNOTVISIBLE = $01000000; + {$EXTERNALSYM D3DSTATUS_ZNOTVISIBLE} +(* Do not use 0x80000000 for any status flags in future as it is reserved *) + + D3DSTATUS_CLIPUNIONALL = ( + D3DSTATUS_CLIPUNIONLEFT or + D3DSTATUS_CLIPUNIONRIGHT or + D3DSTATUS_CLIPUNIONTOP or + D3DSTATUS_CLIPUNIONBOTTOM or + D3DSTATUS_CLIPUNIONFRONT or + D3DSTATUS_CLIPUNIONBACK or + D3DSTATUS_CLIPUNIONGEN0 or + D3DSTATUS_CLIPUNIONGEN1 or + D3DSTATUS_CLIPUNIONGEN2 or + D3DSTATUS_CLIPUNIONGEN3 or + D3DSTATUS_CLIPUNIONGEN4 or + D3DSTATUS_CLIPUNIONGEN5); + {$EXTERNALSYM D3DSTATUS_CLIPUNIONALL} + + D3DSTATUS_CLIPINTERSECTIONALL = ( + D3DSTATUS_CLIPINTERSECTIONLEFT or + D3DSTATUS_CLIPINTERSECTIONRIGHT or + D3DSTATUS_CLIPINTERSECTIONTOP or + D3DSTATUS_CLIPINTERSECTIONBOTTOM or + D3DSTATUS_CLIPINTERSECTIONFRONT or + D3DSTATUS_CLIPINTERSECTIONBACK or + D3DSTATUS_CLIPINTERSECTIONGEN0 or + D3DSTATUS_CLIPINTERSECTIONGEN1 or + D3DSTATUS_CLIPINTERSECTIONGEN2 or + D3DSTATUS_CLIPINTERSECTIONGEN3 or + D3DSTATUS_CLIPINTERSECTIONGEN4 or + D3DSTATUS_CLIPINTERSECTIONGEN5); + {$EXTERNALSYM D3DSTATUS_CLIPINTERSECTIONALL} + + D3DSTATUS_DEFAULT = ( + D3DSTATUS_CLIPINTERSECTIONALL or + D3DSTATUS_ZNOTVISIBLE); + {$EXTERNALSYM D3DSTATUS_DEFAULT} + +(* + * Options for direct transform calls + *) + + D3DTRANSFORM_CLIPPED = $00000001; + {$EXTERNALSYM D3DTRANSFORM_CLIPPED} + D3DTRANSFORM_UNCLIPPED = $00000002; + {$EXTERNALSYM D3DTRANSFORM_UNCLIPPED} + +type + PD3DTransformData = ^TD3DTransformData; + _D3DTRANSFORMDATA = packed record + dwSize: DWORD; + lpIn: Pointer; (* Input vertices *) + dwInSize: DWORD; (* Stride of input vertices *) + lpOut: Pointer; (* Output vertices *) + dwOutSize: DWORD; (* Stride of output vertices *) + lpHOut: ^TD3DHVertex; (* Output homogeneous vertices *) + dwClip: DWORD; (* Clipping hint *) + dwClipIntersection: DWORD; + dwClipUnion: DWORD; (* Union of all clip flags *) + drExtent: TD3DRect; (* Extent of transformed vertices *) + end; + {$EXTERNALSYM _D3DTRANSFORMDATA} + D3DTRANSFORMDATA = _D3DTRANSFORMDATA; + {$EXTERNALSYM D3DTRANSFORMDATA} + TD3DTransformData = _D3DTRANSFORMDATA; + +(* + * Structure defining position and direction properties for lighting. + *) + + PD3DLightingElement = ^TD3DLightingElement; + _D3DLIGHTINGELEMENT = packed record + dvPosition: TD3DVector; (* Lightable point in model space *) + dvNormal: TD3DVector; (* Normalised unit vector *) + end; + {$EXTERNALSYM _D3DLIGHTINGELEMENT} + D3DLIGHTINGELEMENT = _D3DLIGHTINGELEMENT; + {$EXTERNALSYM D3DLIGHTINGELEMENT} + TD3DLightingElement = _D3DLIGHTINGELEMENT; + +(* + * Structure defining material properties for lighting. + *) + + PD3DMaterial = ^TD3DMaterial; + _D3DMATERIAL = packed record + dwSize: DWORD; + case Integer of + 0: ( + diffuse: TD3DColorValue; (* Diffuse color RGBA *) + ambient: TD3DColorValue; (* Ambient color RGB *) + specular: TD3DColorValue; (* Specular 'shininess' *) + emissive: TD3DColorValue; (* Emissive color RGB *) + power: TD3DValue; (* Sharpness if specular highlight *) + hTexture: TD3DTextureHandle; (* Handle to texture map *) + dwRampSize: DWORD; + ); + 1: ( + dcvDiffuse: TD3DColorValue; + dcvAmbient: TD3DColorValue; + dcvSpecular: TD3DColorValue; + dcvEmissive: TD3DColorValue; + dvPower: TD3DValue; + ); + end; + {$EXTERNALSYM _D3DMATERIAL} + D3DMATERIAL = _D3DMATERIAL; + {$EXTERNALSYM D3DMATERIAL} + TD3DMaterial = _D3DMATERIAL; + +{$IFDEF DIRECT3D_VERSION_7} + + PD3DMaterial7 = ^TD3DMaterial7; + _D3DMATERIAL7 = packed record + case Integer of + 0: ( + diffuse: TD3DColorValue; (* Diffuse color RGBA *) + ambient: TD3DColorValue; (* Ambient color RGB *) + specular: TD3DColorValue; (* Specular 'shininess' *) + emissive: TD3DColorValue; (* Emissive color RGB *) + power: TD3DValue; (* Sharpness if specular highlight *) + ); + 1: ( + dcvDiffuse: TD3DColorValue; + dcvAmbient: TD3DColorValue; + dcvSpecular: TD3DColorValue; + dcvEmissive: TD3DColorValue; + dvPower: TD3DValue; + ); + end; + {$EXTERNALSYM _D3DMATERIAL7} + D3DMATERIAL7 = _D3DMATERIAL7; + {$EXTERNALSYM D3DMATERIAL7} + TD3DMaterial7 = _D3DMATERIAL7; + +{$ENDIF} // DIRECT3D_VERSION_7 + +{$IFDEF DIRECT3D_VERSION_LESS_8} + + PD3DLightType = ^TD3DLightType; + _D3DLIGHTTYPE = ( + D3DLIGHT_INVALID_0, + D3DLIGHT_POINT, + D3DLIGHT_SPOT, + D3DLIGHT_DIRECTIONAL, +// Note: The following light type (D3DLIGHT_PARALLELPOINT) +// is no longer supported from D3D for DX7 onwards. + D3DLIGHT_PARALLELPOINT +{$IFDEF DIRECT3D_VERSION_LESS_5}, // For backward compatible headers + D3DLIGHT_GLSPOT +{$ENDIF} // DIRECT3D_VERSION_LESS_5 + ); + {$EXTERNALSYM _D3DLIGHTTYPE} + D3DLIGHTTYPE = _D3DLIGHTTYPE; + {$EXTERNALSYM D3DLIGHTTYPE} + TD3DLightType = _D3DLIGHTTYPE; + +{$ELSE} +const + D3DLIGHT_PARALLELPOINT = TD3DLightType(4); + {$EXTERNALSYM D3DLIGHT_PARALLELPOINT} + D3DLIGHT_GLSPOT = TD3DLightType(5); + {$EXTERNALSYM D3DLIGHT_GLSPOT} + +type +{$ENDIF} //(DIRECT3D_VERSION < 0x0800) + +(* + * Structure defining a light source and its properties. + *) + + PD3DLight = ^TD3DLight; + _D3DLIGHT = packed record + dwSize: DWORD; + dltType: TD3DLightType; (* Type of light source *) + dcvColor: TD3DColorValue; (* Color of light *) + dvPosition: TD3DVector; (* Position in world space *) + dvDirection: TD3DVector; (* Direction in world space *) + dvRange: TD3DValue; (* Cutoff range *) + dvFalloff: TD3DValue; (* Falloff *) + dvAttenuation0: TD3DValue; (* Constant attenuation *) + dvAttenuation1: TD3DValue; (* Linear attenuation *) + dvAttenuation2: TD3DValue; (* Quadratic attenuation *) + dvTheta: TD3DValue; (* Inner angle of spotlight cone *) + dvPhi: TD3DValue; (* Outer angle of spotlight cone *) + end; + {$EXTERNALSYM _D3DLIGHT} + D3DLIGHT = _D3DLIGHT; + {$EXTERNALSYM D3DLIGHT} + TD3DLight = _D3DLIGHT; + +{$IFDEF DIRECT3D_VERSION_7} + + PD3DLight7 = ^TD3DLight7; + _D3DLIGHT7 = packed record + dltType: TD3DLightType; (* Type of light source *) + dcvDiffuse: TD3DColorValue; (* Diffuse color of light *) + dcvSpecular: TD3DColorValue;(* Specular color of light *) + dcvAmbient: TD3DColorValue; (* Ambient color of light *) + dvPosition: TD3DVector; (* Position in world space *) + dvDirection: TD3DVector; (* Direction in world space *) + dvRange: TD3DValue; (* Cutoff range *) + dvFalloff: TD3DValue; (* Falloff *) + dvAttenuation0: TD3DValue; (* Constant attenuation *) + dvAttenuation1: TD3DValue; (* Linear attenuation *) + dvAttenuation2: TD3DValue; (* Quadratic attenuation *) + dvTheta: TD3DValue; (* Inner angle of spotlight cone *) + dvPhi: TD3DValue; (* Outer angle of spotlight cone *) + end; + {$EXTERNALSYM _D3DLIGHT7} + D3DLIGHT7 = _D3DLIGHT7; + {$EXTERNALSYM D3DLIGHT7} + TD3DLight7 = _D3DLIGHT7; + +{$ENDIF} // DIRECT3D_VERSION_7 + +{$IFDEF DIRECT3D_VERSION_5} + +(* + * Structure defining a light source and its properties. + *) + +(* flags bits *) +const + D3DLIGHT_ACTIVE = $00000001; + {$EXTERNALSYM D3DLIGHT_ACTIVE} + D3DLIGHT_NO_SPECULAR = $00000002; + {$EXTERNALSYM D3DLIGHT_NO_SPECULAR} + D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE; + {$EXTERNALSYM D3DLIGHT_ALL} + +(* maximum valid light range *) + D3DLIGHT_RANGE_MAX = 1.8439088915e+18; //sqrt(FLT_MAX); + {$EXTERNALSYM D3DLIGHT_RANGE_MAX} + +type + PD3DLight2 = ^TD3DLight2; + _D3DLIGHT2 = packed record + dwSize: DWORD; + dltType: TD3DLightType; (* Type of light source *) + dcvColor: TD3DColorValue; (* Color of light *) + dvPosition: TD3DVector; (* Position in world space *) + dvDirection: TD3DVector; (* Direction in world space *) + dvRange: TD3DValue; (* Cutoff range *) + dvFalloff: TD3DValue; (* Falloff *) + dvAttenuation0: TD3DValue; (* Constant attenuation *) + dvAttenuation1: TD3DValue; (* Linear attenuation *) + dvAttenuation2: TD3DValue; (* Quadratic attenuation *) + dvTheta: TD3DValue; (* Inner angle of spotlight cone *) + dvPhi: TD3DValue; (* Outer angle of spotlight cone *) + dwFlags: DWORD; + end; + {$EXTERNALSYM _D3DLIGHT2} + D3DLIGHT2 = _D3DLIGHT2; + {$EXTERNALSYM D3DLIGHT2} + TD3DLight2 = _D3DLIGHT2; + +{$ELSE} + PD3DLight2 = PD3DLight; + TD3DLight2 = TD3DLight; + +{$ENDIF} // DIRECT3D_VERSION_5 + PD3DLightData = ^TD3DLightData; + _D3DLIGHTDATA = packed record + dwSize: DWORD; + lpIn: ^TD3DLightingElement; (* Input positions and normals *) + dwInSize: DWORD; (* Stride of input elements *) + lpOut: ^TD3DTLVertex; (* Output colors *) + dwOutSize: DWORD; (* Stride of output colors *) + end; + {$EXTERNALSYM _D3DLIGHTDATA} + D3DLIGHTDATA = _D3DLIGHTDATA; + {$EXTERNALSYM D3DLIGHTDATA} + TD3DLightData = _D3DLIGHTDATA; + +(* + * Before DX5, these values were in an enum called + * TD3DColorModel. This was not correct, since they are + * bit flags. A driver can surface either or both flags + * in the dcmColorModel member of D3DDEVICEDESC. + *) + +type + TD3DColorModel = DWORD; + +const + D3DCOLOR_MONO = 1; + {$EXTERNALSYM D3DCOLOR_MONO} + D3DCOLOR_RGB = 2; + {$EXTERNALSYM D3DCOLOR_RGB} + +(* + * Options for clearing + *) + +const + D3DCLEAR_TARGET = $00000001; (* Clear target surface *) + {$EXTERNALSYM D3DCLEAR_TARGET} + D3DCLEAR_ZBUFFER = $00000002; (* Clear target z buffer *) + {$EXTERNALSYM D3DCLEAR_ZBUFFER} +{$IFDEF DIRECT3D_VERSION_6} + D3DCLEAR_STENCIL = $00000004; (* Clear stencil planes *) + {$EXTERNALSYM D3DCLEAR_STENCIL} +{$ENDIF} // DIRECT3D_VERSION_6 + +(* + * Execute buffers are allocated via Direct3D. These buffers may then + * be filled by the application with instructions to execute along with + * vertex data. + *) + +(* + * Supported op codes for execute instructions. + *) + +type + PD3DOpcode = ^TD3DOpcode; + _D3DOPCODE = ( + D3DOP_INVALID_0, + D3DOP_POINT, + D3DOP_LINE, + D3DOP_TRIANGLE, + D3DOP_MATRIXLOAD, + D3DOP_MATRIXMULTIPLY, + D3DOP_STATETRANSFORM, + D3DOP_STATELIGHT, + D3DOP_STATERENDER, + D3DOP_PROCESSVERTICES, + D3DOP_TEXTURELOAD, + D3DOP_EXIT, + D3DOP_BRANCHFORWARD, + D3DOP_SPAN, + D3DOP_SETSTATUS); + {$EXTERNALSYM _D3DOPCODE} + D3DOPCODE = _D3DOPCODE; + {$EXTERNALSYM D3DOPCODE} + TD3DOpcode = _D3DOPCODE; + + PD3DInstruction = ^TD3DInstruction; + _D3DINSTRUCTION = packed record + bOpcode: Byte; (* Instruction opcode *) + bSize: Byte; (* Size of each instruction data unit *) + wCount: Word; (* Count of instruction data units to follow *) + end; + {$EXTERNALSYM _D3DINSTRUCTION} + D3DINSTRUCTION = _D3DINSTRUCTION; + {$EXTERNALSYM D3DINSTRUCTION} + TD3DInstruction = _D3DINSTRUCTION; + +(* + * Structure for texture loads + *) + + PD3DTextureLoad = ^TD3DTextureLoad; + _D3DTEXTURELOAD = packed record + hDestTexture: TD3DTextureHandle; + hSrcTexture: TD3DTextureHandle; + end; + {$EXTERNALSYM _D3DTEXTURELOAD} + D3DTEXTURELOAD = _D3DTEXTURELOAD; + {$EXTERNALSYM D3DTEXTURELOAD} + TD3DTextureLoad = _D3DTEXTURELOAD; + +(* + * Structure for picking + *) + + PD3DPickRecord = ^TD3DPickRecord; + _D3DPICKRECORD = packed record + bOpcode: Byte; + bPad: Byte; + dwOffset: DWORD; + dvZ: TD3DValue; + end; + {$EXTERNALSYM _D3DPICKRECORD} + D3DPICKRECORD = _D3DPICKRECORD; + {$EXTERNALSYM D3DPICKRECORD} + TD3DPickRecord = _D3DPICKRECORD; + +(* + * The following defines the rendering states which can be set in the + * execute buffer. + *) + +{$IFDEF DIRECT3D_VERSION_LESS_8} + + PD3DShadeMode = ^TD3DShadeMode; + _D3DSHADEMODE = ( + D3DSHADE_INVALID_0, + D3DSHADE_FLAT, + D3DSHADE_GOURAUD, + D3DSHADE_PHONG); + {$EXTERNALSYM _D3DSHADEMODE} + D3DSHADEMODE = _D3DSHADEMODE; + {$EXTERNALSYM D3DSHADEMODE} + TD3DShadeMode = _D3DSHADEMODE; + + PD3DFillMode = ^TD3DFillMode; + _D3DFILLMODE = ( + D3DFILL_INVALID_0, + D3DFILL_POINT, + D3DFILL_WIREFRAME, + D3DFILL_SOLID); + {$EXTERNALSYM _D3DFILLMODE} + D3DFILLMODE = _D3DFILLMODE; + {$EXTERNALSYM D3DFILLMODE} + TD3DFillMode = _D3DFILLMODE; + + PD3DLinePattern = ^TD3DLinePattern; + _D3DLINEPATTERN = packed record + wRepeatFactor: WORD; + wLinePattern: WORD; + end; + {$EXTERNALSYM _D3DLINEPATTERN} + D3DLINEPATTERN = _D3DLINEPATTERN; + {$EXTERNALSYM D3DLINEPATTERN} + TD3DLinePattern = _D3DLINEPATTERN; + +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + + PD3DTextureFilter = ^TD3DTextureFilter; + _D3DTEXTUREFILTER = ( + D3DFILTER_INVALID_0, + D3DFILTER_NEAREST, + D3DFILTER_LINEAR, + D3DFILTER_MIPNEAREST, + D3DFILTER_MIPLINEAR, + D3DFILTER_LINEARMIPNEAREST, + D3DFILTER_LINEARMIPLINEAR); + {$EXTERNALSYM _D3DTEXTUREFILTER} + D3DTEXTUREFILTER = _D3DTEXTUREFILTER; + {$EXTERNALSYM D3DTEXTUREFILTER} + TD3DTextureFilter = _D3DTEXTUREFILTER; + +{$IFDEF DIRECT3D_VERSION_LESS_8} + + PD3DBlend = ^TD3DBlend; + _D3DBLEND = ( + D3DBLEND_INVALID_0, + D3DBLEND_ZERO, + D3DBLEND_ONE, + D3DBLEND_SRCCOLOR, + D3DBLEND_INVSRCCOLOR, + D3DBLEND_SRCALPHA, + D3DBLEND_INVSRCALPHA, + D3DBLEND_DESTALPHA, + D3DBLEND_INVDESTALPHA, + D3DBLEND_DESTCOLOR, + D3DBLEND_INVDESTCOLOR, + D3DBLEND_SRCALPHASAT, + D3DBLEND_BOTHSRCALPHA, + D3DBLEND_BOTHINVSRCALPHA); + {$EXTERNALSYM _D3DBLEND} + D3DBLEND = _D3DBLEND; + {$EXTERNALSYM D3DBLEND} + TD3DBlend = _D3DBLEND; + +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + + PD3DTextureBlend = ^TD3DTextureBlend; + _D3DTEXTUREBLEND = ( + D3DTBLEND_INVALID_0, + D3DTBLEND_DECAL, + D3DTBLEND_MODULATE, + D3DTBLEND_DECALALPHA, + D3DTBLEND_MODULATEALPHA, + D3DTBLEND_DECALMASK, + D3DTBLEND_MODULATEMASK, + D3DTBLEND_COPY +{$IFDEF DIRECT3D_VERSION_5}, + D3DTBLEND_ADD +{$ENDIF} // DIRECT3D_VERSION_5 + ); + {$EXTERNALSYM _D3DTEXTUREBLEND} + D3DTEXTUREBLEND = _D3DTEXTUREBLEND; + {$EXTERNALSYM D3DTEXTUREBLEND} + TD3DTextureBlend = _D3DTEXTUREBLEND; + +{$IFDEF DIRECT3D_VERSION_LESS_8} + + PD3DTextureAddress = ^TD3DTextureAddress; + _D3DTEXTUREADDRESS = ( + D3DTADDRESS_INVALID_0, + D3DTADDRESS_WRAP, + D3DTADDRESS_MIRROR, + D3DTADDRESS_CLAMP +{$IFDEF DIRECT3D_VERSION_5}, + D3DTADDRESS_BORDER +{$ENDIF} // DIRECT3D_VERSION_5 + ); + {$EXTERNALSYM _D3DTEXTUREADDRESS} + D3DTEXTUREADDRESS = _D3DTEXTUREADDRESS; + {$EXTERNALSYM D3DTEXTUREADDRESS} + TD3DTextureAddress = _D3DTEXTUREADDRESS; + + PD3DCull = ^TD3DCull; + _D3DCULL = ( + D3DCULL_INVALID_0, + D3DCULL_NONE, + D3DCULL_CW, + D3DCULL_CCW); + {$EXTERNALSYM _D3DCULL} + D3DCULL = _D3DCULL; + {$EXTERNALSYM D3DCULL} + TD3DCull = _D3DCULL; + + PD3DCmpFunc = ^TD3DCmpFunc; + _D3DCMPFUNC = ( + D3DCMP_INVALID_0, + D3DCMP_NEVER, + D3DCMP_LESS, + D3DCMP_EQUAL, + D3DCMP_LESSEQUAL, + D3DCMP_GREATER, + D3DCMP_NOTEQUAL, + D3DCMP_GREATEREQUAL, + D3DCMP_ALWAYS); + {$EXTERNALSYM _D3DCMPFUNC} + D3DCMPFUNC = _D3DCMPFUNC; + {$EXTERNALSYM D3DCMPFUNC} + TD3DCmpFunc = _D3DCMPFUNC; + +{$IFDEF DIRECT3D_VERSION_6} + PD3DStencilOp = ^TD3DStencilOp; + _D3DSTENCILOP = ( + D3DSTENCILOP_INVALID_0, + D3DSTENCILOP_KEEP, + D3DSTENCILOP_ZERO, + D3DSTENCILOP_REPLACE, + D3DSTENCILOP_INCRSAT, + D3DSTENCILOP_DECRSAT, + D3DSTENCILOP_INVERT, + D3DSTENCILOP_INCR, + D3DSTENCILOP_DECR); + {$EXTERNALSYM _D3DSTENCILOP} + D3DSTENCILOP = _D3DSTENCILOP; + {$EXTERNALSYM D3DSTENCILOP} + TD3DStencilOp = _D3DSTENCILOP; +{$ENDIF} // DIRECT3D_VERSION_6 + + PD3DFogMode = ^TD3DFogMode; + _D3DFOGMODE = ( + D3DFOG_NONE, + D3DFOG_EXP, + D3DFOG_EXP2 +{$IFDEF DIRECT3D_VERSION_5}, + D3DFOG_LINEAR +{$ENDIF} // DIRECT3D_VERSION_5 + ); + {$EXTERNALSYM _D3DFOGMODE} + D3DFOGMODE = _D3DFOGMODE; + {$EXTERNALSYM D3DFOGMODE} + TD3DFogMode = _D3DFOGMODE; + +{$IFDEF DIRECT3D_VERSION_6} + PD3DZBufferType = ^TD3DZBufferType; + _D3DZBUFFERTYPE = ( + D3DZB_FALSE, + D3DZB_TRUE, // Z buffering + D3DZB_USEW); // W buffering + {$EXTERNALSYM _D3DZBUFFERTYPE} + D3DZBUFFERTYPE = _D3DZBUFFERTYPE; + {$EXTERNALSYM D3DZBUFFERTYPE} + TD3DZBufferType = _D3DZBUFFERTYPE; +{$ENDIF} // DIRECT3D_VERSION_6 + +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + +{$IFDEF DIRECT3D_VERSION_5} + PD3DAntialiasMode = ^TD3DAntialiasMode; + _D3DANTIALIASMODE = ( + D3DANTIALIAS_NONE, + D3DANTIALIAS_SORTDEPENDENT, + D3DANTIALIAS_SORTINDEPENDENT); + {$EXTERNALSYM _D3DANTIALIASMODE} + D3DANTIALIASMODE = _D3DANTIALIASMODE; + {$EXTERNALSYM D3DANTIALIASMODE} + TD3DAntialiasMode = _D3DANTIALIASMODE; + +// Vertex types supported by Direct3D + PD3DVertexType = ^TD3DVertexType; + _D3DVERTEXTYPE = ( + D3DVT_INVALID_0, + D3DVT_VERTEX, + D3DVT_LVERTEX, + D3DVT_TLVERTEX); + {$EXTERNALSYM _D3DVERTEXTYPE} + D3DVERTEXTYPE = _D3DVERTEXTYPE; + {$EXTERNALSYM D3DVERTEXTYPE} + TD3DVertexType = _D3DVERTEXTYPE; + +{$IFDEF DIRECT3D_VERSION_LESS_8} + +// Primitives supported by draw-primitive API + PD3DPrimitiveType = ^TD3DPrimitiveType; + _D3DPRIMITIVETYPE = ( + D3DPT_INVALID_0, + D3DPT_POINTLIST, + D3DPT_LINELIST, + D3DPT_LINESTRIP, + D3DPT_TRIANGLELIST, + D3DPT_TRIANGLESTRIP, + D3DPT_TRIANGLEFAN); + {$EXTERNALSYM _D3DPRIMITIVETYPE} + D3DPRIMITIVETYPE = _D3DPRIMITIVETYPE; + {$EXTERNALSYM D3DPRIMITIVETYPE} + TD3DPrimitiveType = _D3DPRIMITIVETYPE; + +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + +{$ENDIF} // DIRECT3D_VERSION_5 + +(* + * Amount to add to a state to generate the override for that state. + *) + +const + D3DSTATE_OVERRIDE_BIAS = 256; + {$EXTERNALSYM D3DSTATE_OVERRIDE_BIAS} + +(* + * A state which sets the override flag for the specified state type. + *) + +function D3DSTATE_OVERRIDE(StateType: DWORD): DWORD; +{$EXTERNALSYM D3DSTATE_OVERRIDE} + +{$IFDEF DIRECT3D_VERSION_8} +// +// legacy transform state names +// +{$ENDIF} // DIRECT3D_VERSION_8 +type + PD3DTransformStateType = ^TD3DTransformStateType; + TD3DTransformStateType = DWORD; +const + D3DTRANSFORMSTATE_WORLD = TD3DTransformStateType(1); + {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD} + D3DTRANSFORMSTATE_VIEW = TD3DTransformStateType(2); + {$EXTERNALSYM D3DTRANSFORMSTATE_VIEW} + D3DTRANSFORMSTATE_PROJECTION = TD3DTransformStateType(3); + {$EXTERNALSYM D3DTRANSFORMSTATE_PROJECTION} +{$IFDEF DIRECT3D_VERSION_7} + D3DTRANSFORMSTATE_WORLD1 = TD3DTransformStateType(4); // 2nd matrix to blend + {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD1} + D3DTRANSFORMSTATE_WORLD2 = TD3DTransformStateType(5); // 3rd matrix to blend + {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD2} + D3DTRANSFORMSTATE_WORLD3 = TD3DTransformStateType(6); // 4th matrix to blend + {$EXTERNALSYM D3DTRANSFORMSTATE_WORLD3} + D3DTRANSFORMSTATE_TEXTURE0 = TD3DTransformStateType(16); + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE0} + D3DTRANSFORMSTATE_TEXTURE1 = TD3DTransformStateType(17); + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE1} + D3DTRANSFORMSTATE_TEXTURE2 = TD3DTransformStateType(18); + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE2} + D3DTRANSFORMSTATE_TEXTURE3 = TD3DTransformStateType(19); + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE3} + D3DTRANSFORMSTATE_TEXTURE4 = TD3DTransformStateType(20); + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE4} + D3DTRANSFORMSTATE_TEXTURE5 = TD3DTransformStateType(21); + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE5} + D3DTRANSFORMSTATE_TEXTURE6 = TD3DTransformStateType(22); + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE6} + D3DTRANSFORMSTATE_TEXTURE7 = TD3DTransformStateType(23); + {$EXTERNALSYM D3DTRANSFORMSTATE_TEXTURE7} +{$ENDIF} // DIRECT3D_VERSION_7 + + +type + PD3DLightStateType = ^TD3DLightStateType; + _D3DLIGHTSTATETYPE = ( + D3DLIGHTSTATE_INVALID_0, + D3DLIGHTSTATE_MATERIAL, + D3DLIGHTSTATE_AMBIENT, + D3DLIGHTSTATE_COLORMODEL, + D3DLIGHTSTATE_FOGMODE, + D3DLIGHTSTATE_FOGSTART, + D3DLIGHTSTATE_FOGEND, + D3DLIGHTSTATE_FOGDENSITY +{$IFDEF DIRECT3D_VERSION_6}, + D3DLIGHTSTATE_COLORVERTEX + {$EXTERNALSYM _D3DLIGHTSTATETYPE} +{$ENDIF} // DIRECT3D_VERSION_6 + ); + D3DLIGHTSTATETYPE = _D3DLIGHTSTATETYPE; + {$EXTERNALSYM D3DLIGHTSTATETYPE} + TD3DLightStateType = _D3DLIGHTSTATETYPE; + +type + PD3DRenderStateType = ^TD3DRenderStateType; + TD3DRenderStateType = DWORD; + +const + D3DRENDERSTATE_ANTIALIAS = 2; (* D3DANTIALIASMODE *) + {$EXTERNALSYM D3DRENDERSTATE_ANTIALIAS} + D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4; (* TRUE for perspective correction *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREPERSPECTIVE} + D3DRENDERSTATE_ZENABLE = 7; (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *) + {$EXTERNALSYM D3DRENDERSTATE_ZENABLE} + D3DRENDERSTATE_FILLMODE = 8; (* D3DFILL_MODE *) + {$EXTERNALSYM D3DRENDERSTATE_FILLMODE} + D3DRENDERSTATE_SHADEMODE = 9; (* D3DSHADEMODE *) + {$EXTERNALSYM D3DRENDERSTATE_SHADEMODE} + D3DRENDERSTATE_LINEPATTERN = 10; (* D3DLINEPATTERN *) + {$EXTERNALSYM D3DRENDERSTATE_LINEPATTERN} + D3DRENDERSTATE_ZWRITEENABLE = 14; (* TRUE to enable z writes *) + {$EXTERNALSYM D3DRENDERSTATE_ZWRITEENABLE} + D3DRENDERSTATE_ALPHATESTENABLE = 15; (* TRUE to enable alpha tests *) + {$EXTERNALSYM D3DRENDERSTATE_ALPHATESTENABLE} + D3DRENDERSTATE_LASTPIXEL = 16; (* TRUE for last-pixel on lines *) + {$EXTERNALSYM D3DRENDERSTATE_LASTPIXEL} + D3DRENDERSTATE_SRCBLEND = 19; (* D3DBLEND *) + {$EXTERNALSYM D3DRENDERSTATE_SRCBLEND} + D3DRENDERSTATE_DESTBLEND = 20; (* D3DBLEND *) + {$EXTERNALSYM D3DRENDERSTATE_DESTBLEND} + D3DRENDERSTATE_CULLMODE = 22; (* D3DCULL *) + {$EXTERNALSYM D3DRENDERSTATE_CULLMODE} + D3DRENDERSTATE_ZFUNC = 23; (* D3DCMPFUNC *) + {$EXTERNALSYM D3DRENDERSTATE_ZFUNC} + D3DRENDERSTATE_ALPHAREF = 24; (* D3DFIXED *) + {$EXTERNALSYM D3DRENDERSTATE_ALPHAREF} + D3DRENDERSTATE_ALPHAFUNC = 25; (* D3DCMPFUNC *) + {$EXTERNALSYM D3DRENDERSTATE_ALPHAFUNC} + D3DRENDERSTATE_DITHERENABLE = 26; (* TRUE to enable dithering *) + {$EXTERNALSYM D3DRENDERSTATE_DITHERENABLE} +{$IFDEF DIRECT3D_VERSION_5} + D3DRENDERSTATE_ALPHABLENDENABLE = 27; (* TRUE to enable alpha blending *) + {$EXTERNALSYM D3DRENDERSTATE_ALPHABLENDENABLE} +{$ENDIF} // DIRECT3D_VERSION_5 + D3DRENDERSTATE_FOGENABLE = 28; (* TRUE to enable fog blending *) + {$EXTERNALSYM D3DRENDERSTATE_FOGENABLE} + D3DRENDERSTATE_SPECULARENABLE = 29; (* TRUE to enable specular *) + {$EXTERNALSYM D3DRENDERSTATE_SPECULARENABLE} + D3DRENDERSTATE_ZVISIBLE = 30; (* TRUE to enable z checking *) + {$EXTERNALSYM D3DRENDERSTATE_ZVISIBLE} + D3DRENDERSTATE_STIPPLEDALPHA = 33; (* TRUE to enable stippled alpha (RGB device only) *) + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEDALPHA} + D3DRENDERSTATE_FOGCOLOR = 34; (* D3DCOLOR *) + {$EXTERNALSYM D3DRENDERSTATE_FOGCOLOR} + D3DRENDERSTATE_FOGTABLEMODE = 35; (* D3DFOGMODE *) + {$EXTERNALSYM D3DRENDERSTATE_FOGTABLEMODE} +{$IFDEF DIRECT3D_VERSION_7} + D3DRENDERSTATE_FOGSTART = 36; (* Fog start (for both vertex and pixel fog) *) + {$EXTERNALSYM D3DRENDERSTATE_FOGSTART} + D3DRENDERSTATE_FOGEND = 37; (* Fog end *) + {$EXTERNALSYM D3DRENDERSTATE_FOGEND} + D3DRENDERSTATE_FOGDENSITY = 38; (* Fog density *) + {$EXTERNALSYM D3DRENDERSTATE_FOGDENSITY} +{$ENDIF} // DIRECT3D_VERSION_7 +{$IFDEF DIRECT3D_VERSION_5} + D3DRENDERSTATE_EDGEANTIALIAS = 40; (* TRUE to enable edge antialiasing *) + {$EXTERNALSYM D3DRENDERSTATE_EDGEANTIALIAS} + D3DRENDERSTATE_COLORKEYENABLE = 41; (* TRUE to enable source colorkeyed textures *) + {$EXTERNALSYM D3DRENDERSTATE_COLORKEYENABLE} + D3DRENDERSTATE_ZBIAS = 47; (* LONG Z bias *) + {$EXTERNALSYM D3DRENDERSTATE_ZBIAS} + D3DRENDERSTATE_RANGEFOGENABLE = 48; (* Enables range-based fog *) + {$EXTERNALSYM D3DRENDERSTATE_RANGEFOGENABLE} +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + D3DRENDERSTATE_STENCILENABLE = 52; (* BOOL enable/disable stenciling *) + {$EXTERNALSYM D3DRENDERSTATE_STENCILENABLE} + D3DRENDERSTATE_STENCILFAIL = 53; (* D3DSTENCILOP to do if stencil test fails *) + {$EXTERNALSYM D3DRENDERSTATE_STENCILFAIL} + D3DRENDERSTATE_STENCILZFAIL = 54; (* D3DSTENCILOP to do if stencil test passes and Z test fails *) + {$EXTERNALSYM D3DRENDERSTATE_STENCILZFAIL} + D3DRENDERSTATE_STENCILPASS = 55; (* D3DSTENCILOP to do if both stencil and Z tests pass *) + {$EXTERNALSYM D3DRENDERSTATE_STENCILPASS} + D3DRENDERSTATE_STENCILFUNC = 56; (* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *) + {$EXTERNALSYM D3DRENDERSTATE_STENCILFUNC} + D3DRENDERSTATE_STENCILREF = 57; (* Reference value used in stencil test *) + {$EXTERNALSYM D3DRENDERSTATE_STENCILREF} + D3DRENDERSTATE_STENCILMASK = 58; (* Mask value used in stencil test *) + {$EXTERNALSYM D3DRENDERSTATE_STENCILMASK} + D3DRENDERSTATE_STENCILWRITEMASK = 59; (* Write mask applied to values written to stencil buffer *) + {$EXTERNALSYM D3DRENDERSTATE_STENCILWRITEMASK} + D3DRENDERSTATE_TEXTUREFACTOR = 60; (* D3DCOLOR used for multi-texture blend *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREFACTOR} +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_6} + + (* + * 128 values [128; 255] are reserved for texture coordinate wrap flags. + * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using + * a flags word preserves forward compatibility with texture coordinates + * that are >2D. + *) + D3DRENDERSTATE_WRAP0 = 128; (* wrap for 1st texture coord. set *) + {$EXTERNALSYM D3DRENDERSTATE_WRAP0} + D3DRENDERSTATE_WRAP1 = 129; (* wrap for 2nd texture coord. set *) + {$EXTERNALSYM D3DRENDERSTATE_WRAP1} + D3DRENDERSTATE_WRAP2 = 130; (* wrap for 3rd texture coord. set *) + {$EXTERNALSYM D3DRENDERSTATE_WRAP2} + D3DRENDERSTATE_WRAP3 = 131; (* wrap for 4th texture coord. set *) + {$EXTERNALSYM D3DRENDERSTATE_WRAP3} + D3DRENDERSTATE_WRAP4 = 132; (* wrap for 5th texture coord. set *) + {$EXTERNALSYM D3DRENDERSTATE_WRAP4} + D3DRENDERSTATE_WRAP5 = 133; (* wrap for 6th texture coord. set *) + {$EXTERNALSYM D3DRENDERSTATE_WRAP5} + D3DRENDERSTATE_WRAP6 = 134; (* wrap for 7th texture coord. set *) + {$EXTERNALSYM D3DRENDERSTATE_WRAP6} + D3DRENDERSTATE_WRAP7 = 135; (* wrap for 8th texture coord. set *) + {$EXTERNALSYM D3DRENDERSTATE_WRAP7} +{$ENDIF} // DIRECT3D_VERSION_6 +{$IFDEF DIRECT3D_VERSION_7} + D3DRENDERSTATE_CLIPPING = 136; + {$EXTERNALSYM D3DRENDERSTATE_CLIPPING} + D3DRENDERSTATE_LIGHTING = 137; + {$EXTERNALSYM D3DRENDERSTATE_LIGHTING} + D3DRENDERSTATE_EXTENTS = 138; + {$EXTERNALSYM D3DRENDERSTATE_EXTENTS} + D3DRENDERSTATE_AMBIENT = 139; + {$EXTERNALSYM D3DRENDERSTATE_AMBIENT} + D3DRENDERSTATE_FOGVERTEXMODE = 140; + {$EXTERNALSYM D3DRENDERSTATE_FOGVERTEXMODE} + D3DRENDERSTATE_COLORVERTEX = 141; + {$EXTERNALSYM D3DRENDERSTATE_COLORVERTEX} + D3DRENDERSTATE_LOCALVIEWER = 142; + {$EXTERNALSYM D3DRENDERSTATE_LOCALVIEWER} + D3DRENDERSTATE_NORMALIZENORMALS = 143; + {$EXTERNALSYM D3DRENDERSTATE_NORMALIZENORMALS} + D3DRENDERSTATE_COLORKEYBLENDENABLE = 144; + {$EXTERNALSYM D3DRENDERSTATE_COLORKEYBLENDENABLE} + D3DRENDERSTATE_DIFFUSEMATERIALSOURCE = 145; + {$EXTERNALSYM D3DRENDERSTATE_DIFFUSEMATERIALSOURCE} + D3DRENDERSTATE_SPECULARMATERIALSOURCE = 146; + {$EXTERNALSYM D3DRENDERSTATE_SPECULARMATERIALSOURCE} + D3DRENDERSTATE_AMBIENTMATERIALSOURCE = 147; + {$EXTERNALSYM D3DRENDERSTATE_AMBIENTMATERIALSOURCE} + D3DRENDERSTATE_EMISSIVEMATERIALSOURCE = 148; + {$EXTERNALSYM D3DRENDERSTATE_EMISSIVEMATERIALSOURCE} + D3DRENDERSTATE_VERTEXBLEND = 151; + {$EXTERNALSYM D3DRENDERSTATE_VERTEXBLEND} + D3DRENDERSTATE_CLIPPLANEENABLE = 152; + {$EXTERNALSYM D3DRENDERSTATE_CLIPPLANEENABLE} + +{$ENDIF} // DIRECT3D_VERSION_7 + +// +// retired renderstates - not supported for DX7 interfaces +// + D3DRENDERSTATE_TEXTUREHANDLE = 1; (* Texture handle for legacy interfaces (Texture;Texture2) *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREHANDLE} + D3DRENDERSTATE_TEXTUREADDRESS = 3; (* D3DTEXTUREADDRESS *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREADDRESS} + D3DRENDERSTATE_WRAPU = 5; (* TRUE for wrapping in u *) + {$EXTERNALSYM D3DRENDERSTATE_WRAPU} + D3DRENDERSTATE_WRAPV = 6; (* TRUE for wrapping in v *) + {$EXTERNALSYM D3DRENDERSTATE_WRAPV} + D3DRENDERSTATE_MONOENABLE = 11; (* TRUE to enable mono rasterization *) + {$EXTERNALSYM D3DRENDERSTATE_MONOENABLE} + D3DRENDERSTATE_ROP2 = 12; (* ROP2 *) + {$EXTERNALSYM D3DRENDERSTATE_ROP2} + D3DRENDERSTATE_PLANEMASK = 13; (* DWORD physical plane mask *) + {$EXTERNALSYM D3DRENDERSTATE_PLANEMASK} + D3DRENDERSTATE_TEXTUREMAG = 17; (* D3DTEXTUREFILTER *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREMAG} + D3DRENDERSTATE_TEXTUREMIN = 18; (* D3DTEXTUREFILTER *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREMIN} + D3DRENDERSTATE_TEXTUREMAPBLEND = 21; (* D3DTEXTUREBLEND *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREMAPBLEND} + D3DRENDERSTATE_SUBPIXEL = 31; (* TRUE to enable subpixel correction *) + {$EXTERNALSYM D3DRENDERSTATE_SUBPIXEL} + D3DRENDERSTATE_SUBPIXELX = 32; (* TRUE to enable correction in X only *) + {$EXTERNALSYM D3DRENDERSTATE_SUBPIXELX} + D3DRENDERSTATE_STIPPLEENABLE = 39; (* TRUE to enable stippling *) + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEENABLE} +{$IFDEF DIRECT3D_VERSION_5} + D3DRENDERSTATE_BORDERCOLOR = 43; (* Border color for texturing w/border *) + {$EXTERNALSYM D3DRENDERSTATE_BORDERCOLOR} + D3DRENDERSTATE_TEXTUREADDRESSU = 44; (* Texture addressing mode for U coordinate *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREADDRESSU} + D3DRENDERSTATE_TEXTUREADDRESSV = 45; (* Texture addressing mode for V coordinate *) + {$EXTERNALSYM D3DRENDERSTATE_TEXTUREADDRESSV} + D3DRENDERSTATE_MIPMAPLODBIAS = 46; (* D3DVALUE Mipmap LOD bias *) + {$EXTERNALSYM D3DRENDERSTATE_MIPMAPLODBIAS} + D3DRENDERSTATE_ANISOTROPY = 49; (* Max. anisotropy. 1 = no anisotropy *) + {$EXTERNALSYM D3DRENDERSTATE_ANISOTROPY} +{$ENDIF} // DIRECT3D_VERSION_5 + D3DRENDERSTATE_FLUSHBATCH = 50; (* Explicit flush for DP batching (DX5 Only) *) + {$EXTERNALSYM D3DRENDERSTATE_FLUSHBATCH} +{$IFDEF DIRECT3D_VERSION_6} + D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51; (* BOOL enable sort-independent transparency *) + {$EXTERNALSYM D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT} +{$ENDIF} // DIRECT3D_VERSION_6 + D3DRENDERSTATE_STIPPLEPATTERN00 = 64; (* Stipple pattern 01... *) + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN00} + D3DRENDERSTATE_STIPPLEPATTERN01 = 65; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN01} + D3DRENDERSTATE_STIPPLEPATTERN02 = 66; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN02} + D3DRENDERSTATE_STIPPLEPATTERN03 = 67; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN03} + D3DRENDERSTATE_STIPPLEPATTERN04 = 68; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN04} + D3DRENDERSTATE_STIPPLEPATTERN05 = 69; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN05} + D3DRENDERSTATE_STIPPLEPATTERN06 = 70; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN06} + D3DRENDERSTATE_STIPPLEPATTERN07 = 71; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN07} + D3DRENDERSTATE_STIPPLEPATTERN08 = 72; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN08} + D3DRENDERSTATE_STIPPLEPATTERN09 = 73; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN09} + D3DRENDERSTATE_STIPPLEPATTERN10 = 74; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN10} + D3DRENDERSTATE_STIPPLEPATTERN11 = 75; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN11} + D3DRENDERSTATE_STIPPLEPATTERN12 = 76; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN12} + D3DRENDERSTATE_STIPPLEPATTERN13 = 77; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN13} + D3DRENDERSTATE_STIPPLEPATTERN14 = 78; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN14} + D3DRENDERSTATE_STIPPLEPATTERN15 = 79; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN15} + D3DRENDERSTATE_STIPPLEPATTERN16 = 80; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN16} + D3DRENDERSTATE_STIPPLEPATTERN17 = 81; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN17} + D3DRENDERSTATE_STIPPLEPATTERN18 = 82; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN18} + D3DRENDERSTATE_STIPPLEPATTERN19 = 83; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN19} + D3DRENDERSTATE_STIPPLEPATTERN20 = 84; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN20} + D3DRENDERSTATE_STIPPLEPATTERN21 = 85; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN21} + D3DRENDERSTATE_STIPPLEPATTERN22 = 86; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN22} + D3DRENDERSTATE_STIPPLEPATTERN23 = 87; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN23} + D3DRENDERSTATE_STIPPLEPATTERN24 = 88; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN24} + D3DRENDERSTATE_STIPPLEPATTERN25 = 89; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN25} + D3DRENDERSTATE_STIPPLEPATTERN26 = 90; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN26} + D3DRENDERSTATE_STIPPLEPATTERN27 = 91; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN27} + D3DRENDERSTATE_STIPPLEPATTERN28 = 92; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN28} + D3DRENDERSTATE_STIPPLEPATTERN29 = 93; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN29} + D3DRENDERSTATE_STIPPLEPATTERN30 = 94; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN30} + D3DRENDERSTATE_STIPPLEPATTERN31 = 95; + {$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN31} + +// +// retired renderstate names - the values are still used under new naming conventions +// + D3DRENDERSTATE_FOGTABLESTART = 36; (* Fog table start *) + {$EXTERNALSYM D3DRENDERSTATE_FOGTABLESTART} + D3DRENDERSTATE_FOGTABLEEND = 37; (* Fog table end *) + {$EXTERNALSYM D3DRENDERSTATE_FOGTABLEEND} + D3DRENDERSTATE_FOGTABLEDENSITY = 38; (* Fog table density *) + {$EXTERNALSYM D3DRENDERSTATE_FOGTABLEDENSITY} + + +{$IFDEF DIRECT3D_VERSION_LESS_8} + +type +// Values for material source + PD3DMateralColorSource = ^TD3DMateralColorSource; + _D3DMATERIALCOLORSOURCE = ( + D3DMCS_MATERIAL, // Color from material is used + D3DMCS_COLOR1, // Diffuse vertex color is used + D3DMCS_COLOR2 // Specular vertex color is used + ); + {$EXTERNALSYM _D3DMATERIALCOLORSOURCE} + D3DMATERIALCOLORSOURCE = _D3DMATERIALCOLORSOURCE; + {$EXTERNALSYM D3DMATERIALCOLORSOURCE} + TD3DMateralColorSource = _D3DMATERIALCOLORSOURCE; + +{$IFDEF DIRECT3D_VERSION_5} +const + // For back-compatibility with legacy compilations + D3DRENDERSTATE_BLENDENABLE = D3DRENDERSTATE_ALPHABLENDENABLE; + {$EXTERNALSYM D3DRENDERSTATE_BLENDENABLE} +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + +// Bias to apply to the texture coordinate set to apply a wrap to. + D3DRENDERSTATE_WRAPBIAS = 128; + {$EXTERNALSYM D3DRENDERSTATE_WRAPBIAS} + +(* Flags to construct the WRAP render states *) + D3DWRAP_U = $00000001; + {$EXTERNALSYM D3DWRAP_U} + D3DWRAP_V = $00000002; + {$EXTERNALSYM D3DWRAP_V} + +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_7} + +(* Flags to construct the WRAP render states for 1D thru 4D texture coordinates *) + D3DWRAPCOORD_0 = $00000001; // same as D3DWRAP_U + {$EXTERNALSYM D3DWRAPCOORD_0} + D3DWRAPCOORD_1 = $00000002; // same as D3DWRAP_V + {$EXTERNALSYM D3DWRAPCOORD_1} + D3DWRAPCOORD_2 = $00000004; + {$EXTERNALSYM D3DWRAPCOORD_2} + D3DWRAPCOORD_3 = $00000008; + {$EXTERNALSYM D3DWRAPCOORD_3} + +{$ENDIF} // DIRECT3D_VERSION_7 + +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + +function D3DRENDERSTATE_STIPPLEPATTERN(y: Integer): TD3DRenderStateType; +{$EXTERNALSYM D3DRENDERSTATE_STIPPLEPATTERN} + +type + PD3DState = ^TD3DState; + _D3DSTATE = packed record + case Integer of + {$IFDEF DIRECT3D_VERSION_LESS_8} + 0: ( + dtstTransformStateType: TD3DTransformStateType; + ); + {$ENDIF} // DIRECT3D_VERSION_LESS_8 + 1: ( + dlstLightStateType: TD3DLightStateType; + dwArg: array [0..0] of DWORD; + ); + 2: ( + drstRenderStateType: TD3DRenderStateType; + dvArg: array [0..0] of TD3DValue; + ); + end; + {$EXTERNALSYM _D3DSTATE} + D3DSTATE = _D3DSTATE; + {$EXTERNALSYM D3DSTATE} + TD3DState = _D3DSTATE; + +(* + * Operation used to load matrices + * hDstMat = hSrcMat + *) + PD3DMatrixLoad = ^TD3DMatrixLoad; + _D3DMATRIXLOAD = packed record + hDestMatrix: TD3DMatrixHandle; (* Destination matrix *) + hSrcMatrix: TD3DMatrixHandle; (* Source matrix *) + end; + {$EXTERNALSYM _D3DMATRIXLOAD} + D3DMATRIXLOAD = _D3DMATRIXLOAD; + {$EXTERNALSYM D3DMATRIXLOAD} + TD3DMatrixLoad = _D3DMATRIXLOAD; + +(* + * Operation used to multiply matrices + * hDstMat = hSrcMat1 * hSrcMat2 + *) + PD3DMatrixMultiply = ^TD3DMatrixMultiply; + _D3DMATRIXMULTIPLY = packed record + hDestMatrix: TD3DMatrixHandle; (* Destination matrix *) + hSrcMatrix1: TD3DMatrixHandle; (* First source matrix *) + hSrcMatrix2: TD3DMatrixHandle; (* Second source matrix *) + end; + {$EXTERNALSYM _D3DMATRIXMULTIPLY} + D3DMATRIXMULTIPLY = _D3DMATRIXMULTIPLY; + {$EXTERNALSYM D3DMATRIXMULTIPLY} + TD3DMatrixMultiply = _D3DMATRIXMULTIPLY; + +(* + * Operation used to transform and light vertices. + *) + PD3DProcessVertices = ^TD3DProcessVertices; + _D3DPROCESSVERTICES = packed record + dwFlags: DWORD; (* Do we transform or light or just copy? *) + wStart: WORD; (* Index to first vertex in source *) + wDest: WORD; (* Index to first vertex in local buffer *) + dwCount: DWORD; (* Number of vertices to be processed *) + dwReserved: DWORD; (* Must be zero *) + end; + {$EXTERNALSYM _D3DPROCESSVERTICES} + D3DPROCESSVERTICES = _D3DPROCESSVERTICES; + {$EXTERNALSYM D3DPROCESSVERTICES} + TD3DProcessVertices = _D3DPROCESSVERTICES; + +const + D3DPROCESSVERTICES_TRANSFORMLIGHT = $00000000; + {$EXTERNALSYM D3DPROCESSVERTICES_TRANSFORMLIGHT} + D3DPROCESSVERTICES_TRANSFORM = $00000001; + {$EXTERNALSYM D3DPROCESSVERTICES_TRANSFORM} + D3DPROCESSVERTICES_COPY = $00000002; + {$EXTERNALSYM D3DPROCESSVERTICES_COPY} + D3DPROCESSVERTICES_OPMASK = $00000007; + {$EXTERNALSYM D3DPROCESSVERTICES_OPMASK} + + D3DPROCESSVERTICES_UPDATEEXTENTS = $00000008; + {$EXTERNALSYM D3DPROCESSVERTICES_UPDATEEXTENTS} + D3DPROCESSVERTICES_NOCOLOR = $00000010; + {$EXTERNALSYM D3DPROCESSVERTICES_NOCOLOR} + +{$IFDEF DIRECT3D_VERSION_6} +{$IFDEF DIRECT3D_VERSION_LESS_8} + +(* + * State enumerants for per-stage texture processing. + *) +type + PD3DTextureStageStateType = ^TD3DTextureStageStateType; + TD3DTextureStageStateType = DWORD; +const + D3DTSS_COLOROP = 1; (* D3DTEXTUREOP - per-stage blending controls for color channels *) + {$EXTERNALSYM D3DTSS_COLOROP} + D3DTSS_COLORARG1 = 2; (* D3DTA_* (texture arg) *) + {$EXTERNALSYM D3DTSS_COLORARG1} + D3DTSS_COLORARG2 = 3; (* D3DTA_* (texture arg) *) + {$EXTERNALSYM D3DTSS_COLORARG2} + D3DTSS_ALPHAOP = 4; (* D3DTEXTUREOP - per-stage blending controls for alpha channel *) + {$EXTERNALSYM D3DTSS_ALPHAOP} + D3DTSS_ALPHAARG1 = 5; (* D3DTA_* (texture arg) *) + {$EXTERNALSYM D3DTSS_ALPHAARG1} + D3DTSS_ALPHAARG2 = 6; (* D3DTA_* (texture arg) *) + {$EXTERNALSYM D3DTSS_ALPHAARG2} + D3DTSS_BUMPENVMAT00 = 7; (* D3DVALUE (bump mapping matrix) *) + {$EXTERNALSYM D3DTSS_BUMPENVMAT00} + D3DTSS_BUMPENVMAT01 = 8; (* D3DVALUE (bump mapping matrix) *) + {$EXTERNALSYM D3DTSS_BUMPENVMAT01} + D3DTSS_BUMPENVMAT10 = 9; (* D3DVALUE (bump mapping matrix) *) + {$EXTERNALSYM D3DTSS_BUMPENVMAT10} + D3DTSS_BUMPENVMAT11 = 10; (* D3DVALUE (bump mapping matrix) *) + {$EXTERNALSYM D3DTSS_BUMPENVMAT11} + D3DTSS_TEXCOORDINDEX = 11; (* identifies which set of texture coordinates index this texture *) + {$EXTERNALSYM D3DTSS_TEXCOORDINDEX} + D3DTSS_ADDRESS = 12; (* D3DTEXTUREADDRESS for both coordinates *) + {$EXTERNALSYM D3DTSS_ADDRESS} + D3DTSS_ADDRESSU = 13; (* D3DTEXTUREADDRESS for U coordinate *) + {$EXTERNALSYM D3DTSS_ADDRESSU} + D3DTSS_ADDRESSV = 14; (* D3DTEXTUREADDRESS for V coordinate *) + {$EXTERNALSYM D3DTSS_ADDRESSV} + D3DTSS_BORDERCOLOR = 15; (* D3DCOLOR *) + {$EXTERNALSYM D3DTSS_BORDERCOLOR} + D3DTSS_MAGFILTER = 16; (* D3DTEXTUREMAGFILTER filter to use for magnification *) + {$EXTERNALSYM D3DTSS_MAGFILTER} + D3DTSS_MINFILTER = 17; (* D3DTEXTUREMINFILTER filter to use for minification *) + {$EXTERNALSYM D3DTSS_MINFILTER} + D3DTSS_MIPFILTER = 18; (* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification *) + {$EXTERNALSYM D3DTSS_MIPFILTER} + D3DTSS_MIPMAPLODBIAS = 19; (* D3DVALUE Mipmap LOD bias *) + {$EXTERNALSYM D3DTSS_MIPMAPLODBIAS} + D3DTSS_MAXMIPLEVEL = 20; (* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) *) + {$EXTERNALSYM D3DTSS_MAXMIPLEVEL} + D3DTSS_MAXANISOTROPY = 21; (* DWORD maximum anisotropy *) + {$EXTERNALSYM D3DTSS_MAXANISOTROPY} + D3DTSS_BUMPENVLSCALE = 22; (* D3DVALUE scale for bump map luminance *) + {$EXTERNALSYM D3DTSS_BUMPENVLSCALE} + D3DTSS_BUMPENVLOFFSET = 23; (* D3DVALUE offset for bump map luminance *) + {$EXTERNALSYM D3DTSS_BUMPENVLOFFSET} +{$IFDEF DIRECT3D_VERSION_7} + D3DTSS_TEXTURETRANSFORMFLAGS = 24; (* D3DTEXTURETRANSFORMFLAGS controls texture transform *) + {$EXTERNALSYM D3DTSS_TEXTURETRANSFORMFLAGS} +{$ENDIF} + +{$IFDEF DIRECT3D_VERSION_7} +// 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; + {$EXTERNALSYM D3DTSS_TCI_PASSTHRU} + D3DTSS_TCI_CAMERASPACENORMAL = $00010000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACENORMAL} + D3DTSS_TCI_CAMERASPACEPOSITION = $00020000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACEPOSITION} + D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR = $00030000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR} +{$ENDIF} + +type +(* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DRENDERSTATE. + *) + PD3DTextureOp = ^TD3DTextureOp; + _D3DTEXTUREOP = ( + D3DTOP_INVALID_0, +// Control + D3DTOP_DISABLE , // disables stage + D3DTOP_SELECTARG1, // the default + D3DTOP_SELECTARG2, + +// Modulate + D3DTOP_MODULATE , // multiply args together + D3DTOP_MODULATE2X, // multiply and 1 bit + D3DTOP_MODULATE4X, // multiply and 2 bits + +// Add + D3DTOP_ADD , // add arguments together + D3DTOP_ADDSIGNED , // add with -0.5 bias + D3DTOP_ADDSIGNED2X, // as above but left 1 bit + D3DTOP_SUBTRACT , // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH , // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + +// Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA , // iterated alpha + D3DTOP_BLENDTEXTUREALPHA , // texture alpha + D3DTOP_BLENDFACTORALPHA , // alpha from D3DRENDERSTATE_TEXTUREFACTOR + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM, // texture alpha + D3DTOP_BLENDCURRENTALPHA , // by alpha of current color + +// Specular mapping + D3DTOP_PREMODULATE , // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR, // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA, // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + +// Bump mapping + D3DTOP_BUMPENVMAP , // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE, // 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 + ); + {$EXTERNALSYM _D3DTEXTUREOP} + D3DTEXTUREOP = _D3DTEXTUREOP; + {$EXTERNALSYM D3DTEXTUREOP} + TD3DTextureOp = _D3DTEXTUREOP; + +(* + * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations + * set in texture processing stage controls in D3DRENDERSTATE. + *) +const + D3DTA_SELECTMASK = $0000000f; // mask for arg selector + {$EXTERNALSYM D3DTA_SELECTMASK} + D3DTA_DIFFUSE = $00000000; // select diffuse color + {$EXTERNALSYM D3DTA_DIFFUSE} + D3DTA_CURRENT = $00000001; // select result of previous stage + {$EXTERNALSYM D3DTA_CURRENT} + D3DTA_TEXTURE = $00000002; // select texture color + {$EXTERNALSYM D3DTA_TEXTURE} + D3DTA_TFACTOR = $00000003; // select RENDERSTATE_TEXTUREFACTOR + {$EXTERNALSYM D3DTA_TFACTOR} +{$IFDEF DIRECT3D_VERSION_7} + D3DTA_SPECULAR = $00000004; // select specular color + {$EXTERNALSYM D3DTA_SPECULAR} +{$ENDIF} + D3DTA_COMPLEMENT = $00000010; // take 1.0 - x + {$EXTERNALSYM D3DTA_COMPLEMENT} + D3DTA_ALPHAREPLICATE = $00000020; // replicate alpha to color components + {$EXTERNALSYM D3DTA_ALPHAREPLICATE} + +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + +(* + * IDirect3DTexture2 State Filter Types + *) +type + PD3DTextureMagFilter = ^TD3DTextureMagFilter; + _D3DTEXTUREMAGFILTER = ( + D3DTFG_INVALID_0, + D3DTFG_POINT , // nearest + D3DTFG_LINEAR , // linear interpolation + D3DTFG_FLATCUBIC , // cubic + D3DTFG_GAUSSIANCUBIC, // different cubic kernel + D3DTFG_ANISOTROPIC + ); + {$EXTERNALSYM _D3DTEXTUREMAGFILTER} + D3DTEXTUREMAGFILTER = _D3DTEXTUREMAGFILTER; + {$EXTERNALSYM D3DTEXTUREMAGFILTER} + TD3DTextureMagFilter = _D3DTEXTUREMAGFILTER; + + PD3DTextureMinFilter = ^TD3DTextureMinFilter; + _D3DTEXTUREMINFILTER = ( + D3DTFN_INVALID_0, + D3DTFN_POINT , // nearest + D3DTFN_LINEAR , // linear interpolation + D3DTFN_ANISOTROPIC + ); + {$EXTERNALSYM _D3DTEXTUREMINFILTER} + D3DTEXTUREMINFILTER = _D3DTEXTUREMINFILTER; + {$EXTERNALSYM D3DTEXTUREMINFILTER} + TD3DTextureMinFilter = _D3DTEXTUREMINFILTER; + + PD3DTextureMipFilter = ^TD3DTextureMipFilter; + _D3DTEXTUREMIPFILTER = ( + D3DTFP_INVALID_0, + D3DTFP_NONE , // mipmapping disabled (use MAG filter) + D3DTFP_POINT , // nearest + D3DTFP_LINEAR // linear interpolation + ); + {$EXTERNALSYM _D3DTEXTUREMIPFILTER} + D3DTEXTUREMIPFILTER = _D3DTEXTUREMIPFILTER; + {$EXTERNALSYM D3DTEXTUREMIPFILTER} + TD3DTextureMipFilter = _D3DTEXTUREMIPFILTER; + +{$ENDIF} // DIRECT3D_VERSION_6 + + +(* + * Triangle flags + *) + +(* + * Tri strip and fan flags. + * START loads all three vertices + * EVEN and ODD load just v3 with even or odd culling + * START_FLAT contains a count from 0 to 29 that allows the + * whole strip or fan to be culled in one hit. + * e.g. for a quad len = 1 + *) +const + D3DTRIFLAG_START = $00000000; + {$EXTERNALSYM D3DTRIFLAG_START} +// #define D3DTRIFLAG_STARTFLAT(len) (len) (* 0 < len < 30 *) +function D3DTRIFLAG_STARTFLAT(len: DWORD): DWORD; +{$EXTERNALSYM D3DTRIFLAG_STARTFLAT} + +const + D3DTRIFLAG_ODD = $0000001e; + {$EXTERNALSYM D3DTRIFLAG_ODD} + D3DTRIFLAG_EVEN = $0000001f; + {$EXTERNALSYM D3DTRIFLAG_EVEN} + +(* + * Triangle edge flags + * enable edges for wireframe or antialiasing + *) + D3DTRIFLAG_EDGEENABLE1 = $00000100; (* v0-v1 edge *) + {$EXTERNALSYM D3DTRIFLAG_EDGEENABLE1} + D3DTRIFLAG_EDGEENABLE2 = $00000200; (* v1-v2 edge *) + {$EXTERNALSYM D3DTRIFLAG_EDGEENABLE2} + D3DTRIFLAG_EDGEENABLE3 = $00000400; (* v2-v0 edge *) + {$EXTERNALSYM D3DTRIFLAG_EDGEENABLE3} + D3DTRIFLAG_EDGEENABLETRIANGLE = ( + D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3); + {$EXTERNALSYM D3DTRIFLAG_EDGEENABLETRIANGLE} + +(* + * Primitive structures and related defines. Vertex offsets are to types + * TD3DVertex, TD3DLVertex, or TD3DTLVertex. + *) + +(* + * Triangle list primitive structure + *) +type + PD3DTriangle = ^TD3DTriangle; + _D3DTRIANGLE = packed record + case Integer of + 0: ( + v1: WORD; (* Vertex indices *) + v2: WORD; + v3: WORD; + wFlags: WORD; (* Edge (and other) flags *) + ); + 1: ( + wV1: WORD; + wV2: WORD; + wV3: WORD; + ); + end; + {$EXTERNALSYM _D3DTRIANGLE} + D3DTRIANGLE = _D3DTRIANGLE; + {$EXTERNALSYM D3DTRIANGLE} + TD3DTriangle = _D3DTRIANGLE; + +(* + * Line strip structure. + * The instruction count - 1 defines the number of line segments. + *) + PD3DLine = ^TD3DLine; + _D3DLINE = packed record + case Integer of + 0: ( + v1: WORD; (* Vertex indices *) + v2: WORD; + ); + 1: ( + wV1: WORD; + wV2: WORD; + ); + end; + {$EXTERNALSYM _D3DLINE} + D3DLINE = _D3DLINE; + {$EXTERNALSYM D3DLINE} + TD3DLine = _D3DLINE; + +(* + * Span structure + * Spans join a list of points with the same y value. + * If the y value changes, a new span is started. + *) + PD3DSpan = ^TD3DSpan; + _D3DSPAN = packed record + wCount: WORD; (* Number of spans *) + wFirst: WORD; (* Index to first vertex *) + end; + {$EXTERNALSYM _D3DSPAN} + D3DSPAN = _D3DSPAN; + {$EXTERNALSYM D3DSPAN} + TD3DSpan = _D3DSPAN; + +(* + * Point structure + *) + PD3DPoint = ^TD3DPoint; + _D3DPOINT = packed record + wCount: WORD; (* number of points *) + wFirst: WORD; (* index to first vertex *) + end; + {$EXTERNALSYM _D3DPOINT} + D3DPOINT = _D3DPOINT; + {$EXTERNALSYM D3DPOINT} + TD3DPoint = _D3DPOINT; + +(* + * Forward branch structure. + * Mask is logically anded with the driver status mask + * if the result equals 'value', the branch is taken. + *) + PD3DBranch = ^TD3DBranch; + _D3DBRANCH = packed record + dwMask: DWORD; (* Bitmask against D3D status *) + dwValue: DWORD; + bNegate: BOOL; (* TRUE to negate comparison *) + dwOffset: DWORD; (* How far to branch forward (0 for exit)*) + end; + {$EXTERNALSYM _D3DBRANCH} + D3DBRANCH = _D3DBRANCH; + {$EXTERNALSYM D3DBRANCH} + TD3DBranch = _D3DBRANCH; + +(* + * Status used for set status instruction. + * The D3D status is initialised on device creation + * and is modified by all execute calls. + *) + PD3DStatus = ^TD3DStatus; + _D3DSTATUS = packed record + dwFlags: DWORD; (* Do we set extents or status *) + dwStatus: DWORD; (* D3D status *) + drExtent: TD3DRect; + end; + {$EXTERNALSYM _D3DSTATUS} + D3DSTATUS = _D3DSTATUS; + {$EXTERNALSYM D3DSTATUS} + TD3DStatus = _D3DSTATUS; + +const + D3DSETSTATUS_STATUS = $00000001; + {$EXTERNALSYM D3DSETSTATUS_STATUS} + D3DSETSTATUS_EXTENTS = $00000002; + {$EXTERNALSYM D3DSETSTATUS_EXTENTS} + D3DSETSTATUS_ALL = (D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS); + {$EXTERNALSYM D3DSETSTATUS_ALL} + +{$IFDEF DIRECT3D_VERSION_5} +type + PD3DClipStatus = ^TD3DClipStatus; + _D3DCLIPSTATUS = packed record + dwFlags : DWORD; (* Do we set 2d extents, 3D extents or status *) + dwStatus : DWORD; (* Clip status *) + minx, maxx : Single; (* X extents *) + miny, maxy : Single; (* Y extents *) + minz, maxz : Single; (* Z extents *) + end; + {$EXTERNALSYM _D3DCLIPSTATUS} + D3DCLIPSTATUS = _D3DCLIPSTATUS; + {$EXTERNALSYM D3DCLIPSTATUS} + TD3DClipStatus = _D3DCLIPSTATUS; + +const + D3DCLIPSTATUS_STATUS = $00000001; + {$EXTERNALSYM D3DCLIPSTATUS_STATUS} + D3DCLIPSTATUS_EXTENTS2 = $00000002; + {$EXTERNALSYM D3DCLIPSTATUS_EXTENTS2} + D3DCLIPSTATUS_EXTENTS3 = $00000004; + {$EXTERNALSYM D3DCLIPSTATUS_EXTENTS3} +{$ENDIF} // DIRECT3D_VERSION_5 + +(* + * Statistics structure + *) +type + PD3DStats = ^TD3DStats; + _D3DSTATS = packed record + dwSize: DWORD; + dwTrianglesDrawn: DWORD; + dwLinesDrawn: DWORD; + dwPointsDrawn: DWORD; + dwSpansDrawn: DWORD; + dwVerticesProcessed: DWORD; + end; + {$EXTERNALSYM _D3DSTATS} + D3DSTATS = _D3DSTATS; + {$EXTERNALSYM D3DSTATS} + TD3DStats = _D3DSTATS; + +(* + * Execute options. + * When calling using D3DEXECUTE_UNCLIPPED all the primitives + * inside the buffer must be contained within the viewport. + *) +const + D3DEXECUTE_CLIPPED = $00000001; + {$EXTERNALSYM D3DEXECUTE_CLIPPED} + D3DEXECUTE_UNCLIPPED = $00000002; + {$EXTERNALSYM D3DEXECUTE_UNCLIPPED} + +type + PD3DExecuteData = ^TD3DExecuteData; + _D3DEXECUTEDATA = packed record + dwSize: DWORD; + dwVertexOffset: DWORD; + dwVertexCount: DWORD; + dwInstructionOffset: DWORD; + dwInstructionLength: DWORD; + dwHVertexOffset: DWORD; + dsStatus: TD3DStatus; (* Status after execute *) + end; + {$EXTERNALSYM _D3DEXECUTEDATA} + D3DEXECUTEDATA = _D3DEXECUTEDATA; + {$EXTERNALSYM D3DEXECUTEDATA} + TD3DExecuteData = _D3DEXECUTEDATA; + +(* + * Palette flags. + * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw. + *) + +const + D3DPAL_FREE = $00; (* Renderer may use this entry freely *) + {$EXTERNALSYM D3DPAL_FREE} + D3DPAL_READONLY = $40; (* Renderer may not set this entry *) + {$EXTERNALSYM D3DPAL_READONLY} + D3DPAL_RESERVED = $80; (* Renderer may not use this entry *) + {$EXTERNALSYM D3DPAL_RESERVED} + +{$IFDEF DIRECT3D_VERSION_6} + +type + PD3DVertexBufferDesc = ^TD3DVertexBufferDesc; + _D3DVERTEXBUFFERDESC = packed record + dwSize : DWORD; + dwCaps : DWORD; + dwFVF : DWORD; + dwNumVertices : DWORD; + end; + {$EXTERNALSYM _D3DVERTEXBUFFERDESC} + D3DVERTEXBUFFERDESC = _D3DVERTEXBUFFERDESC; + {$EXTERNALSYM D3DVERTEXBUFFERDESC} + TD3DVertexBufferDesc = _D3DVERTEXBUFFERDESC; + +const +(* These correspond to DDSCAPS_* flags *) + D3DVBCAPS_SYSTEMMEMORY = $00000800; + {$EXTERNALSYM D3DVBCAPS_SYSTEMMEMORY} + D3DVBCAPS_WRITEONLY = $00010000; + {$EXTERNALSYM D3DVBCAPS_WRITEONLY} + D3DVBCAPS_OPTIMIZED = $80000000; + {$EXTERNALSYM D3DVBCAPS_OPTIMIZED} + D3DVBCAPS_DONOTCLIP = $00000001; + {$EXTERNALSYM D3DVBCAPS_DONOTCLIP} + +(* Vertex Operations for ProcessVertices *) + D3DVOP_LIGHT = (1 shl 10); + {$EXTERNALSYM D3DVOP_LIGHT} + D3DVOP_TRANSFORM = (1 shl 0); + {$EXTERNALSYM D3DVOP_TRANSFORM} + D3DVOP_CLIP = (1 shl 2); + {$EXTERNALSYM D3DVOP_CLIP} + D3DVOP_EXTENTS = (1 shl 3); + {$EXTERNALSYM D3DVOP_EXTENTS} + +{$IFDEF DIRECT3D_VERSION_LESS_8} + +(* The maximum number of vertices user can pass to any d3d + drawing function or to create vertex buffer with +*) + D3DMAXNUMVERTICES = ((1 shl 16) - 1); + {$EXTERNALSYM D3DMAXNUMVERTICES} +(* The maximum number of primitives user can pass to any d3d + drawing function. +*) + D3DMAXNUMPRIMITIVES = ((1 shl 16) - 1); + {$EXTERNALSYM D3DMAXNUMPRIMITIVES} + +{$IFDEF DIRECT3D_VERSION_7} + +(* Bits for dwFlags in ProcessVertices call *) + D3DPV_DONOTCOPYDATA = (1 shl 0); + {$EXTERNALSYM D3DPV_DONOTCOPYDATA} + +{$ENDIF} // DIRECT3D_VERSION_7 +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + +//------------------------------------------------------------------- + +{$IFDEF DIRECT3D_VERSION_LESS_8} + +// Flexible vertex format bits +// + D3DFVF_RESERVED0 = $001; + {$EXTERNALSYM D3DFVF_RESERVED0} + D3DFVF_POSITION_MASK = $00E; + {$EXTERNALSYM D3DFVF_POSITION_MASK} + D3DFVF_XYZ = $002; + {$EXTERNALSYM D3DFVF_XYZ} + D3DFVF_XYZRHW = $004; + {$EXTERNALSYM D3DFVF_XYZRHW} +{$IFDEF DIRECT3D_VERSION_7} + D3DFVF_XYZB1 = $006; + {$EXTERNALSYM D3DFVF_XYZB1} + D3DFVF_XYZB2 = $008; + {$EXTERNALSYM D3DFVF_XYZB2} + D3DFVF_XYZB3 = $00a; + {$EXTERNALSYM D3DFVF_XYZB3} + D3DFVF_XYZB4 = $00c; + {$EXTERNALSYM D3DFVF_XYZB4} + D3DFVF_XYZB5 = $00e; + {$EXTERNALSYM D3DFVF_XYZB5} + +{$ENDIF} // DIRECT3D_VERSION_7 + D3DFVF_NORMAL = $010; + {$EXTERNALSYM D3DFVF_NORMAL} + D3DFVF_RESERVED1 = $020; + {$EXTERNALSYM D3DFVF_RESERVED1} + D3DFVF_DIFFUSE = $040; + {$EXTERNALSYM D3DFVF_DIFFUSE} + D3DFVF_SPECULAR = $080; + {$EXTERNALSYM D3DFVF_SPECULAR} + + D3DFVF_TEXCOUNT_MASK = $f00; + {$EXTERNALSYM D3DFVF_TEXCOUNT_MASK} + D3DFVF_TEXCOUNT_SHIFT = 8; + {$EXTERNALSYM D3DFVF_TEXCOUNT_SHIFT} + D3DFVF_TEX0 = $000; + {$EXTERNALSYM D3DFVF_TEX0} + D3DFVF_TEX1 = $100; + {$EXTERNALSYM D3DFVF_TEX1} + D3DFVF_TEX2 = $200; + {$EXTERNALSYM D3DFVF_TEX2} + D3DFVF_TEX3 = $300; + {$EXTERNALSYM D3DFVF_TEX3} + D3DFVF_TEX4 = $400; + {$EXTERNALSYM D3DFVF_TEX4} + D3DFVF_TEX5 = $500; + {$EXTERNALSYM D3DFVF_TEX5} + D3DFVF_TEX6 = $600; + {$EXTERNALSYM D3DFVF_TEX6} + D3DFVF_TEX7 = $700; + {$EXTERNALSYM D3DFVF_TEX7} + D3DFVF_TEX8 = $800; + {$EXTERNALSYM D3DFVF_TEX8} + + D3DFVF_RESERVED2 = $f000; // 4 reserved bits + {$EXTERNALSYM D3DFVF_RESERVED2} + +{$ELSE} + D3DFVF_RESERVED1 = $020; + {$EXTERNALSYM D3DFVF_RESERVED1} +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + + D3DFVF_VERTEX = ( D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1 ); + {$EXTERNALSYM D3DFVF_VERTEX} + D3DFVF_LVERTEX = ( D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or + D3DFVF_SPECULAR or D3DFVF_TEX1 ); + {$EXTERNALSYM D3DFVF_LVERTEX} + D3DFVF_TLVERTEX = ( D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or + D3DFVF_TEX1 ); + {$EXTERNALSYM D3DFVF_TLVERTEX} + +type + PD3DDP_PtrStride = ^TD3DDP_PtrStride; + _D3DDP_PTRSTRIDE = packed record + lpvData : pointer; + dwStride : DWORD; + end; + {$EXTERNALSYM _D3DDP_PTRSTRIDE} + D3DDP_PTRSTRIDE = _D3DDP_PTRSTRIDE; + {$EXTERNALSYM D3DDP_PTRSTRIDE} + TD3DDP_PtrStride = _D3DDP_PTRSTRIDE; + TD3DDPPtrStride = _D3DDP_PTRSTRIDE; + PD3DDPPtrStride = ^TD3DDPPtrStride; + +const + D3DDP_MAXTEXCOORD = 8; + {$EXTERNALSYM D3DDP_MAXTEXCOORD} + +type + PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData; + _D3DDRAWPRIMITIVESTRIDEDDATA = packed record + position : TD3DDP_PtrStride; + normal : TD3DDP_PtrStride; + diffuse : TD3DDP_PtrStride; + specular : TD3DDP_PtrStride; + textureCoords : array [0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride; + end; + {$EXTERNALSYM _D3DDRAWPRIMITIVESTRIDEDDATA} + D3DDRAWPRIMITIVESTRIDEDDATA = _D3DDRAWPRIMITIVESTRIDEDDATA; + {$EXTERNALSYM D3DDRAWPRIMITIVESTRIDEDDATA} + TD3DDrawPrimitiveStridedData = _D3DDRAWPRIMITIVESTRIDEDDATA; + +//--------------------------------------------------------------------- +// ComputeSphereVisibility return values +// +const + D3DVIS_INSIDE_FRUSTUM = 0; + {$EXTERNALSYM D3DVIS_INSIDE_FRUSTUM} + D3DVIS_INTERSECT_FRUSTUM = 1; + {$EXTERNALSYM D3DVIS_INTERSECT_FRUSTUM} + D3DVIS_OUTSIDE_FRUSTUM = 2; + {$EXTERNALSYM D3DVIS_OUTSIDE_FRUSTUM} + D3DVIS_INSIDE_LEFT = 0; + {$EXTERNALSYM D3DVIS_INSIDE_LEFT} + D3DVIS_INTERSECT_LEFT = (1 shl 2); + {$EXTERNALSYM D3DVIS_INTERSECT_LEFT} + D3DVIS_OUTSIDE_LEFT = (2 shl 2); + {$EXTERNALSYM D3DVIS_OUTSIDE_LEFT} + D3DVIS_INSIDE_RIGHT = 0; + {$EXTERNALSYM D3DVIS_INSIDE_RIGHT} + D3DVIS_INTERSECT_RIGHT = (1 shl 4); + {$EXTERNALSYM D3DVIS_INTERSECT_RIGHT} + D3DVIS_OUTSIDE_RIGHT = (2 shl 4); + {$EXTERNALSYM D3DVIS_OUTSIDE_RIGHT} + D3DVIS_INSIDE_TOP = 0; + {$EXTERNALSYM D3DVIS_INSIDE_TOP} + D3DVIS_INTERSECT_TOP = (1 shl 6); + {$EXTERNALSYM D3DVIS_INTERSECT_TOP} + D3DVIS_OUTSIDE_TOP = (2 shl 6); + {$EXTERNALSYM D3DVIS_OUTSIDE_TOP} + D3DVIS_INSIDE_BOTTOM = 0; + {$EXTERNALSYM D3DVIS_INSIDE_BOTTOM} + D3DVIS_INTERSECT_BOTTOM = (1 shl 8); + {$EXTERNALSYM D3DVIS_INTERSECT_BOTTOM} + D3DVIS_OUTSIDE_BOTTOM = (2 shl 8); + {$EXTERNALSYM D3DVIS_OUTSIDE_BOTTOM} + D3DVIS_INSIDE_NEAR = 0; + {$EXTERNALSYM D3DVIS_INSIDE_NEAR} + D3DVIS_INTERSECT_NEAR = (1 shl 10); + {$EXTERNALSYM D3DVIS_INTERSECT_NEAR} + D3DVIS_OUTSIDE_NEAR = (2 shl 10); + {$EXTERNALSYM D3DVIS_OUTSIDE_NEAR} + D3DVIS_INSIDE_FAR = 0; + {$EXTERNALSYM D3DVIS_INSIDE_FAR} + D3DVIS_INTERSECT_FAR = (1 shl 12); + {$EXTERNALSYM D3DVIS_INTERSECT_FAR} + D3DVIS_OUTSIDE_FAR = (2 shl 12); + {$EXTERNALSYM D3DVIS_OUTSIDE_FAR} + + D3DVIS_MASK_FRUSTUM = (3 shl 0); + {$EXTERNALSYM D3DVIS_MASK_FRUSTUM} + D3DVIS_MASK_LEFT = (3 shl 2); + {$EXTERNALSYM D3DVIS_MASK_LEFT} + D3DVIS_MASK_RIGHT = (3 shl 4); + {$EXTERNALSYM D3DVIS_MASK_RIGHT} + D3DVIS_MASK_TOP = (3 shl 6); + {$EXTERNALSYM D3DVIS_MASK_TOP} + D3DVIS_MASK_BOTTOM = (3 shl 8); + {$EXTERNALSYM D3DVIS_MASK_BOTTOM} + D3DVIS_MASK_NEAR = (3 shl 10); + {$EXTERNALSYM D3DVIS_MASK_NEAR} + D3DVIS_MASK_FAR = (3 shl 12); + {$EXTERNALSYM D3DVIS_MASK_FAR} + +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_LESS_8} +{$IFDEF DIRECT3D_VERSION_7} + +// To be used with GetInfo() + D3DDEVINFOID_TEXTUREMANAGER = 1; + {$EXTERNALSYM D3DDEVINFOID_TEXTUREMANAGER} + D3DDEVINFOID_D3DTEXTUREMANAGER = 2; + {$EXTERNALSYM D3DDEVINFOID_D3DTEXTUREMANAGER} + D3DDEVINFOID_TEXTURING = 3; + {$EXTERNALSYM D3DDEVINFOID_TEXTURING} + +type + PD3DStateBlockType = ^TD3DStateBlockType; + _D3DSTATEBLOCKTYPE = ( + D3DSBT_INVALID_0 , + D3DSBT_ALL , // capture all state + D3DSBT_PIXELSTATE , // capture pixel state + D3DSBT_VERTEXSTATE // capture vertex state + ); + {$EXTERNALSYM _D3DSTATEBLOCKTYPE} + D3DSTATEBLOCKTYPE = _D3DSTATEBLOCKTYPE; + {$EXTERNALSYM D3DSTATEBLOCKTYPE} + TD3DStateBlockType = _D3DSTATEBLOCKTYPE; + +// The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state. +// + PD3DVertexBlendFlags = ^TD3DVertexBlendFlags; + _D3DVERTEXBLENDFLAGS = ( + D3DVBLEND_DISABLE , // Disable vertex blending + D3DVBLEND_1WEIGHT , // blend between 2 matrices + D3DVBLEND_2WEIGHTS, // blend between 3 matrices + D3DVBLEND_3WEIGHTS // blend between 4 matrices + ); + {$EXTERNALSYM _D3DVERTEXBLENDFLAGS} + D3DVERTEXBLENDFLAGS = _D3DVERTEXBLENDFLAGS; + {$EXTERNALSYM D3DVERTEXBLENDFLAGS} + TD3DVertexBlendFlags = _D3DVERTEXBLENDFLAGS; + + PD3DTextureTransformFlags = ^TD3DTextureTransformFlags; + _D3DTEXTURETRANSFORMFLAGS = ( + D3DTTFF_DISABLE , // texture coordinates are passed directly + D3DTTFF_COUNT1 , // rasterizer should expect 1-D texture coords + D3DTTFF_COUNT2 , // rasterizer should expect 2-D texture coords + D3DTTFF_COUNT3 , // rasterizer should expect 3-D texture coords + D3DTTFF_COUNT4 // rasterizer should expect 4-D texture coords + ); + {$EXTERNALSYM _D3DTEXTURETRANSFORMFLAGS} + D3DTEXTURETRANSFORMFLAGS = _D3DTEXTURETRANSFORMFLAGS; + {$EXTERNALSYM D3DTEXTURETRANSFORMFLAGS} + TD3DTextureTransformFlags = _D3DTEXTURETRANSFORMFLAGS; + +const + D3DTTFF_PROJECTED = TD3DTextureTransformFlags(256); // texcoords to be divided by COUNTth element + {$EXTERNALSYM D3DTTFF_PROJECTED} + +// Macros to set texture coordinate format bits in the FVF id + + D3DFVF_TEXTUREFORMAT2 = 0; // Two floating point values + {$EXTERNALSYM D3DFVF_TEXTUREFORMAT2} + D3DFVF_TEXTUREFORMAT1 = 3; // One floating point value + {$EXTERNALSYM D3DFVF_TEXTUREFORMAT1} + D3DFVF_TEXTUREFORMAT3 = 1; // Three floating point values + {$EXTERNALSYM D3DFVF_TEXTUREFORMAT3} + D3DFVF_TEXTUREFORMAT4 = 2; // Four floating point values + {$EXTERNALSYM D3DFVF_TEXTUREFORMAT4} + +function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD): DWORD; +{$EXTERNALSYM D3DFVF_TEXCOORDSIZE3} +function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD): DWORD; +{$EXTERNALSYM D3DFVF_TEXCOORDSIZE2} +function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD): DWORD; +{$EXTERNALSYM D3DFVF_TEXCOORDSIZE4} +function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD): DWORD; +{$EXTERNALSYM D3DFVF_TEXCOORDSIZE1} + +{$ENDIF} // DIRECT3D_VERSION_7 +{$ELSE} +// +// legacy vertex blend names +// +type + PD3DVertexBlendFlags = ^TD3DVertexBlendFlags; + TD3DVertexBlendFlags = Direct3D8.TD3DVertexBlendFlags; + D3DVERTEXBLENDFLAGS = Direct3D8.D3DVERTEXBLENDFLAGS; + _D3DVERTEXBLENDFLAGS = Direct3D8._D3DVERTEXBLENDFLAGS; + +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + + +(*==========================================================================; + * + * + * File: d3dcaps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************) + +(* Description of capabilities of transform *) + +type + PD3DTransformCaps = ^TD3DTransformCaps; + _D3DTRANSFORMCAPS = packed record + dwSize: DWORD; + dwCaps: DWORD; + end; + {$EXTERNALSYM _D3DTRANSFORMCAPS} + D3DTRANSFORMCAPS = _D3DTRANSFORMCAPS; + {$EXTERNALSYM D3DTRANSFORMCAPS} + TD3DTransformCaps = _D3DTRANSFORMCAPS; + +const + D3DTRANSFORMCAPS_CLIP = $00000001; (* Will clip whilst transforming *) + {$EXTERNALSYM D3DTRANSFORMCAPS_CLIP} + +(* Description of capabilities of lighting *) + +type + PD3DLightingCaps = ^TD3DLightingCaps; + _D3DLIGHTINGCAPS = packed record + dwSize: DWORD; + dwCaps: DWORD; (* Lighting caps *) + dwLightingModel: DWORD; (* Lighting model - RGB or mono *) + dwNumLights: DWORD; (* Number of lights that can be handled *) + end; + {$EXTERNALSYM _D3DLIGHTINGCAPS} + D3DLIGHTINGCAPS = _D3DLIGHTINGCAPS; + {$EXTERNALSYM D3DLIGHTINGCAPS} + TD3DLightingCaps = _D3DLIGHTINGCAPS; + +const + D3DLIGHTINGMODEL_RGB = $00000001; + {$EXTERNALSYM D3DLIGHTINGMODEL_RGB} + D3DLIGHTINGMODEL_MONO = $00000002; + {$EXTERNALSYM D3DLIGHTINGMODEL_MONO} + + D3DLIGHTCAPS_POINT = $00000001; (* Point lights supported *) + {$EXTERNALSYM D3DLIGHTCAPS_POINT} + D3DLIGHTCAPS_SPOT = $00000002; (* Spot lights supported *) + {$EXTERNALSYM D3DLIGHTCAPS_SPOT} + D3DLIGHTCAPS_DIRECTIONAL = $00000004; (* Directional lights supported *) + {$EXTERNALSYM D3DLIGHTCAPS_DIRECTIONAL} +{$IFDEF DIRECT3D_VERSION_LESS_7} + D3DLIGHTCAPS_PARALLELPOINT = $00000008; (* Parallel point lights supported *) + {$EXTERNALSYM D3DLIGHTCAPS_PARALLELPOINT} +{$ENDIF} // DIRECT3D_VERSION_LESS_7 +{$IFDEF DIRECT3D_VERSION_LESS_5} + D3DLIGHTCAPS_GLSPOT = $00000010; (* GL syle spot lights supported *) + {$EXTERNALSYM D3DLIGHTCAPS_GLSPOT} +{$ENDIF} // DIRECT3D_VERSION_LESS_5 + +(* Description of capabilities for each primitive type *) + +type + PD3DPrimCaps = ^TD3DPrimCaps; + _D3DPrimCaps = packed record + dwSize: DWORD; + dwMiscCaps: DWORD; (* Capability flags *) + dwRasterCaps: DWORD; + dwZCmpCaps: DWORD; + dwSrcBlendCaps: DWORD; + dwDestBlendCaps: DWORD; + dwAlphaCmpCaps: DWORD; + dwShadeCaps: DWORD; + dwTextureCaps: DWORD; + dwTextureFilterCaps: DWORD; + dwTextureBlendCaps: DWORD; + dwTextureAddressCaps: DWORD; + dwStippleWidth: DWORD; (* maximum width and height of *) + dwStippleHeight: DWORD; (* of supported stipple (up to 32x32) *) + end; + {$EXTERNALSYM _D3DPrimCaps} + D3DPrimCaps = _D3DPrimCaps; + {$EXTERNALSYM D3DPrimCaps} + TD3DPrimCaps = _D3DPrimCaps; + +const +(* TD3DPrimCaps dwMiscCaps *) + + D3DPMISCCAPS_MASKPLANES = $00000001; + {$EXTERNALSYM D3DPMISCCAPS_MASKPLANES} + D3DPMISCCAPS_MASKZ = $00000002; + {$EXTERNALSYM D3DPMISCCAPS_MASKZ} + D3DPMISCCAPS_LINEPATTERNREP = $00000004; + {$EXTERNALSYM D3DPMISCCAPS_LINEPATTERNREP} + D3DPMISCCAPS_CONFORMANT = $00000008; + {$EXTERNALSYM D3DPMISCCAPS_CONFORMANT} + D3DPMISCCAPS_CULLNONE = $00000010; + {$EXTERNALSYM D3DPMISCCAPS_CULLNONE} + D3DPMISCCAPS_CULLCW = $00000020; + {$EXTERNALSYM D3DPMISCCAPS_CULLCW} + D3DPMISCCAPS_CULLCCW = $00000040; + {$EXTERNALSYM D3DPMISCCAPS_CULLCCW} + +(* TD3DPrimCaps dwRasterCaps *) + + D3DPRASTERCAPS_DITHER = $00000001; + {$EXTERNALSYM D3DPRASTERCAPS_DITHER} + D3DPRASTERCAPS_ROP2 = $00000002; + {$EXTERNALSYM D3DPRASTERCAPS_ROP2} + D3DPRASTERCAPS_XOR = $00000004; + {$EXTERNALSYM D3DPRASTERCAPS_XOR} + D3DPRASTERCAPS_PAT = $00000008; + {$EXTERNALSYM D3DPRASTERCAPS_PAT} + D3DPRASTERCAPS_ZTEST = $00000010; + {$EXTERNALSYM D3DPRASTERCAPS_ZTEST} + D3DPRASTERCAPS_SUBPIXEL = $00000020; + {$EXTERNALSYM D3DPRASTERCAPS_SUBPIXEL} + D3DPRASTERCAPS_SUBPIXELX = $00000040; + {$EXTERNALSYM D3DPRASTERCAPS_SUBPIXELX} + D3DPRASTERCAPS_FOGVERTEX = $00000080; + {$EXTERNALSYM D3DPRASTERCAPS_FOGVERTEX} + D3DPRASTERCAPS_FOGTABLE = $00000100; + {$EXTERNALSYM D3DPRASTERCAPS_FOGTABLE} + D3DPRASTERCAPS_STIPPLE = $00000200; + {$EXTERNALSYM D3DPRASTERCAPS_STIPPLE} +{$IFDEF DIRECT3D_VERSION_5} + D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT = $00000400; + {$EXTERNALSYM D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT} + D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = $00000800; + {$EXTERNALSYM D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT} + D3DPRASTERCAPS_ANTIALIASEDGES = $00001000; + {$EXTERNALSYM D3DPRASTERCAPS_ANTIALIASEDGES} + D3DPRASTERCAPS_MIPMAPLODBIAS = $00002000; + {$EXTERNALSYM D3DPRASTERCAPS_MIPMAPLODBIAS} + D3DPRASTERCAPS_ZBIAS = $00004000; + {$EXTERNALSYM D3DPRASTERCAPS_ZBIAS} + D3DPRASTERCAPS_ZBUFFERLESSHSR = $00008000; + {$EXTERNALSYM D3DPRASTERCAPS_ZBUFFERLESSHSR} + D3DPRASTERCAPS_FOGRANGE = $00010000; + {$EXTERNALSYM D3DPRASTERCAPS_FOGRANGE} + D3DPRASTERCAPS_ANISOTROPY = $00020000; + {$EXTERNALSYM D3DPRASTERCAPS_ANISOTROPY} +{$ENDIF} // DIRECT3D_VERSION_5 +{$IFDEF DIRECT3D_VERSION_6} + D3DPRASTERCAPS_WBUFFER = $00040000; + {$EXTERNALSYM D3DPRASTERCAPS_WBUFFER} + D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT = $00080000; + {$EXTERNALSYM D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT} + D3DPRASTERCAPS_WFOG = $00100000; + {$EXTERNALSYM D3DPRASTERCAPS_WFOG} + D3DPRASTERCAPS_ZFOG = $00200000; + {$EXTERNALSYM D3DPRASTERCAPS_ZFOG} +{$ENDIF} // DIRECT3D_VERSION_6 + +(* TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps *) + +const + D3DPCMPCAPS_NEVER = $00000001; + {$EXTERNALSYM D3DPCMPCAPS_NEVER} + D3DPCMPCAPS_LESS = $00000002; + {$EXTERNALSYM D3DPCMPCAPS_LESS} + D3DPCMPCAPS_EQUAL = $00000004; + {$EXTERNALSYM D3DPCMPCAPS_EQUAL} + D3DPCMPCAPS_LESSEQUAL = $00000008; + {$EXTERNALSYM D3DPCMPCAPS_LESSEQUAL} + D3DPCMPCAPS_GREATER = $00000010; + {$EXTERNALSYM D3DPCMPCAPS_GREATER} + D3DPCMPCAPS_NOTEQUAL = $00000020; + {$EXTERNALSYM D3DPCMPCAPS_NOTEQUAL} + D3DPCMPCAPS_GREATEREQUAL = $00000040; + {$EXTERNALSYM D3DPCMPCAPS_GREATEREQUAL} + D3DPCMPCAPS_ALWAYS = $00000080; + {$EXTERNALSYM D3DPCMPCAPS_ALWAYS} + +(* TD3DPrimCaps dwSourceBlendCaps, dwDestBlendCaps *) + + D3DPBLENDCAPS_ZERO = $00000001; + {$EXTERNALSYM D3DPBLENDCAPS_ZERO} + D3DPBLENDCAPS_ONE = $00000002; + {$EXTERNALSYM D3DPBLENDCAPS_ONE} + D3DPBLENDCAPS_SRCCOLOR = $00000004; + {$EXTERNALSYM D3DPBLENDCAPS_SRCCOLOR} + D3DPBLENDCAPS_INVSRCCOLOR = $00000008; + {$EXTERNALSYM D3DPBLENDCAPS_INVSRCCOLOR} + D3DPBLENDCAPS_SRCALPHA = $00000010; + {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHA} + D3DPBLENDCAPS_INVSRCALPHA = $00000020; + {$EXTERNALSYM D3DPBLENDCAPS_INVSRCALPHA} + D3DPBLENDCAPS_DESTALPHA = $00000040; + {$EXTERNALSYM D3DPBLENDCAPS_DESTALPHA} + D3DPBLENDCAPS_INVDESTALPHA = $00000080; + {$EXTERNALSYM D3DPBLENDCAPS_INVDESTALPHA} + D3DPBLENDCAPS_DESTCOLOR = $00000100; + {$EXTERNALSYM D3DPBLENDCAPS_DESTCOLOR} + D3DPBLENDCAPS_INVDESTCOLOR = $00000200; + {$EXTERNALSYM D3DPBLENDCAPS_INVDESTCOLOR} + D3DPBLENDCAPS_SRCALPHASAT = $00000400; + {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHASAT} + D3DPBLENDCAPS_BOTHSRCALPHA = $00000800; + {$EXTERNALSYM D3DPBLENDCAPS_BOTHSRCALPHA} + D3DPBLENDCAPS_BOTHINVSRCALPHA = $00001000; + {$EXTERNALSYM D3DPBLENDCAPS_BOTHINVSRCALPHA} + +(* TD3DPrimCaps dwShadeCaps *) + + D3DPSHADECAPS_COLORFLATMONO = $00000001; + {$EXTERNALSYM D3DPSHADECAPS_COLORFLATMONO} + D3DPSHADECAPS_COLORFLATRGB = $00000002; + {$EXTERNALSYM D3DPSHADECAPS_COLORFLATRGB} + D3DPSHADECAPS_COLORGOURAUDMONO = $00000004; + {$EXTERNALSYM D3DPSHADECAPS_COLORGOURAUDMONO} + D3DPSHADECAPS_COLORGOURAUDRGB = $00000008; + {$EXTERNALSYM D3DPSHADECAPS_COLORGOURAUDRGB} + D3DPSHADECAPS_COLORPHONGMONO = $00000010; + {$EXTERNALSYM D3DPSHADECAPS_COLORPHONGMONO} + D3DPSHADECAPS_COLORPHONGRGB = $00000020; + {$EXTERNALSYM D3DPSHADECAPS_COLORPHONGRGB} + + D3DPSHADECAPS_SPECULARFLATMONO = $00000040; + {$EXTERNALSYM D3DPSHADECAPS_SPECULARFLATMONO} + D3DPSHADECAPS_SPECULARFLATRGB = $00000080; + {$EXTERNALSYM D3DPSHADECAPS_SPECULARFLATRGB} + D3DPSHADECAPS_SPECULARGOURAUDMONO = $00000100; + {$EXTERNALSYM D3DPSHADECAPS_SPECULARGOURAUDMONO} + D3DPSHADECAPS_SPECULARGOURAUDRGB = $00000200; + {$EXTERNALSYM D3DPSHADECAPS_SPECULARGOURAUDRGB} + D3DPSHADECAPS_SPECULARPHONGMONO = $00000400; + {$EXTERNALSYM D3DPSHADECAPS_SPECULARPHONGMONO} + D3DPSHADECAPS_SPECULARPHONGRGB = $00000800; + {$EXTERNALSYM D3DPSHADECAPS_SPECULARPHONGRGB} + + D3DPSHADECAPS_ALPHAFLATBLEND = $00001000; + {$EXTERNALSYM D3DPSHADECAPS_ALPHAFLATBLEND} + D3DPSHADECAPS_ALPHAFLATSTIPPLED = $00002000; + {$EXTERNALSYM D3DPSHADECAPS_ALPHAFLATSTIPPLED} + D3DPSHADECAPS_ALPHAGOURAUDBLEND = $00004000; + {$EXTERNALSYM D3DPSHADECAPS_ALPHAGOURAUDBLEND} + D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED = $00008000; + {$EXTERNALSYM D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED} + D3DPSHADECAPS_ALPHAPHONGBLEND = $00010000; + {$EXTERNALSYM D3DPSHADECAPS_ALPHAPHONGBLEND} + D3DPSHADECAPS_ALPHAPHONGSTIPPLED = $00020000; + {$EXTERNALSYM D3DPSHADECAPS_ALPHAPHONGSTIPPLED} + + D3DPSHADECAPS_FOGFLAT = $00040000; + {$EXTERNALSYM D3DPSHADECAPS_FOGFLAT} + D3DPSHADECAPS_FOGGOURAUD = $00080000; + {$EXTERNALSYM D3DPSHADECAPS_FOGGOURAUD} + D3DPSHADECAPS_FOGPHONG = $00100000; + {$EXTERNALSYM D3DPSHADECAPS_FOGPHONG} + +(* TD3DPrimCaps dwTextureCaps *) + +(* + * Perspective-correct texturing is supported + *) + D3DPTEXTURECAPS_PERSPECTIVE = $00000001; + {$EXTERNALSYM D3DPTEXTURECAPS_PERSPECTIVE} + +(* + * Power-of-2 texture dimensions are required + *) + D3DPTEXTURECAPS_POW2 = $00000002; + {$EXTERNALSYM D3DPTEXTURECAPS_POW2} + +(* + * Alpha in texture pixels is supported + *) + D3DPTEXTURECAPS_ALPHA = $00000004; + {$EXTERNALSYM D3DPTEXTURECAPS_ALPHA} + +(* + * Color-keyed textures are supported + *) + D3DPTEXTURECAPS_TRANSPARENCY = $00000008; + {$EXTERNALSYM D3DPTEXTURECAPS_TRANSPARENCY} + +(* + * obsolete, see D3DPTADDRESSCAPS_BORDER + *) + D3DPTEXTURECAPS_BORDER = $00000010; + {$EXTERNALSYM D3DPTEXTURECAPS_BORDER} + +(* + * Only square textures are supported + *) + D3DPTEXTURECAPS_SQUAREONLY = $00000020; + {$EXTERNALSYM D3DPTEXTURECAPS_SQUAREONLY} + +{$IFDEF DIRECT3D_VERSION_6} +(* + * Texture indices are not scaled by the texture size prior + * to interpolation. + *) + D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040; + {$EXTERNALSYM D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE} + +(* + * Device can draw alpha from texture palettes + *) + D3DPTEXTURECAPS_ALPHAPALETTE = $00000080; + {$EXTERNALSYM D3DPTEXTURECAPS_ALPHAPALETTE} + +(* + * 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; + {$EXTERNALSYM D3DPTEXTURECAPS_NONPOW2CONDITIONAL} +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_7} +// 0x00000200L unused + +(* + * Device can divide transformed texture coordinates by the + * COUNTth texture coordinate (can do D3DTTFF_PROJECTED) + *) + D3DPTEXTURECAPS_PROJECTED = $00000400; + {$EXTERNALSYM D3DPTEXTURECAPS_PROJECTED} + +(* + * Device can do cubemap textures + *) + D3DPTEXTURECAPS_CUBEMAP = $00000800; + {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP} + + D3DPTEXTURECAPS_COLORKEYBLEND = $00001000; + {$EXTERNALSYM D3DPTEXTURECAPS_COLORKEYBLEND} +{$ENDIF} // DIRECT3D_VERSION_7 + + +(* TD3DPrimCaps dwTextureFilterCaps *) + + D3DPTFILTERCAPS_NEAREST = $00000001; + {$EXTERNALSYM D3DPTFILTERCAPS_NEAREST} + D3DPTFILTERCAPS_LINEAR = $00000002; + {$EXTERNALSYM D3DPTFILTERCAPS_LINEAR} + D3DPTFILTERCAPS_MIPNEAREST = $00000004; + {$EXTERNALSYM D3DPTFILTERCAPS_MIPNEAREST} + D3DPTFILTERCAPS_MIPLINEAR = $00000008; + {$EXTERNALSYM D3DPTFILTERCAPS_MIPLINEAR} + D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010; + {$EXTERNALSYM D3DPTFILTERCAPS_LINEARMIPNEAREST} + D3DPTFILTERCAPS_LINEARMIPLINEAR = $00000020; + {$EXTERNALSYM D3DPTFILTERCAPS_LINEARMIPLINEAR} + +{$IFDEF DIRECT3D_VERSION_6} +(* Device3 Min Filter *) + D3DPTFILTERCAPS_MINFPOINT = $00000100; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFPOINT} + D3DPTFILTERCAPS_MINFLINEAR = $00000200; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFLINEAR} + D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFANISOTROPIC} + +(* Device3 Mip Filter *) + D3DPTFILTERCAPS_MIPFPOINT = $00010000; + {$EXTERNALSYM D3DPTFILTERCAPS_MIPFPOINT} + D3DPTFILTERCAPS_MIPFLINEAR = $00020000; + {$EXTERNALSYM D3DPTFILTERCAPS_MIPFLINEAR} + +(* Device3 Mag Filter *) + D3DPTFILTERCAPS_MAGFPOINT = $01000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFPOINT} + D3DPTFILTERCAPS_MAGFLINEAR = $02000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFLINEAR} + D3DPTFILTERCAPS_MAGFANISOTROPIC = $04000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFANISOTROPIC} + D3DPTFILTERCAPS_MAGFAFLATCUBIC = $08000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFAFLATCUBIC} + D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC} +{$ENDIF} // DIRECT3D_VERSION_6 + +(* TD3DPrimCaps dwTextureBlendCaps *) + + D3DPTBLENDCAPS_DECAL = $00000001; + {$EXTERNALSYM D3DPTBLENDCAPS_DECAL} + D3DPTBLENDCAPS_MODULATE = $00000002; + {$EXTERNALSYM D3DPTBLENDCAPS_MODULATE} + D3DPTBLENDCAPS_DECALALPHA = $00000004; + {$EXTERNALSYM D3DPTBLENDCAPS_DECALALPHA} + D3DPTBLENDCAPS_MODULATEALPHA = $00000008; + {$EXTERNALSYM D3DPTBLENDCAPS_MODULATEALPHA} + D3DPTBLENDCAPS_DECALMASK = $00000010; + {$EXTERNALSYM D3DPTBLENDCAPS_DECALMASK} + D3DPTBLENDCAPS_MODULATEMASK = $00000020; + {$EXTERNALSYM D3DPTBLENDCAPS_MODULATEMASK} + D3DPTBLENDCAPS_COPY = $00000040; + {$EXTERNALSYM D3DPTBLENDCAPS_COPY} +{$IFDEF DIRECT3D_VERSION_5} + D3DPTBLENDCAPS_ADD = $00000080; + {$EXTERNALSYM D3DPTBLENDCAPS_ADD} +{$ENDIF} // DIRECT3D_VERSION_5 + +(* TD3DPrimCaps dwTextureAddressCaps *) + D3DPTADDRESSCAPS_WRAP = $00000001; + {$EXTERNALSYM D3DPTADDRESSCAPS_WRAP} + D3DPTADDRESSCAPS_MIRROR = $00000002; + {$EXTERNALSYM D3DPTADDRESSCAPS_MIRROR} + D3DPTADDRESSCAPS_CLAMP = $00000004; + {$EXTERNALSYM D3DPTADDRESSCAPS_CLAMP} +{$IFDEF DIRECT3D_VERSION_5} + D3DPTADDRESSCAPS_BORDER = $00000008; + {$EXTERNALSYM D3DPTADDRESSCAPS_BORDER} + D3DPTADDRESSCAPS_INDEPENDENTUV = $00000010; + {$EXTERNALSYM D3DPTADDRESSCAPS_INDEPENDENTUV} +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + +(* D3DDEVICEDESC dwStencilCaps *) + + D3DSTENCILCAPS_KEEP = $00000001; + {$EXTERNALSYM D3DSTENCILCAPS_KEEP} + D3DSTENCILCAPS_ZERO = $00000002; + {$EXTERNALSYM D3DSTENCILCAPS_ZERO} + D3DSTENCILCAPS_REPLACE = $00000004; + {$EXTERNALSYM D3DSTENCILCAPS_REPLACE} + D3DSTENCILCAPS_INCRSAT = $00000008; + {$EXTERNALSYM D3DSTENCILCAPS_INCRSAT} + D3DSTENCILCAPS_DECRSAT = $00000010; + {$EXTERNALSYM D3DSTENCILCAPS_DECRSAT} + D3DSTENCILCAPS_INVERT = $00000020; + {$EXTERNALSYM D3DSTENCILCAPS_INVERT} + D3DSTENCILCAPS_INCR = $00000040; + {$EXTERNALSYM D3DSTENCILCAPS_INCR} + D3DSTENCILCAPS_DECR = $00000080; + {$EXTERNALSYM D3DSTENCILCAPS_DECR} + +(* D3DDEVICEDESC dwTextureOpCaps *) + + D3DTEXOPCAPS_DISABLE = $00000001; + {$EXTERNALSYM D3DTEXOPCAPS_DISABLE} + D3DTEXOPCAPS_SELECTARG1 = $00000002; + {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG1} + D3DTEXOPCAPS_SELECTARG2 = $00000004; + {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG2} + D3DTEXOPCAPS_MODULATE = $00000008; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE} + D3DTEXOPCAPS_MODULATE2X = $00000010; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE2X} + D3DTEXOPCAPS_MODULATE4X = $00000020; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE4X} + D3DTEXOPCAPS_ADD = $00000040; + {$EXTERNALSYM D3DTEXOPCAPS_ADD} + D3DTEXOPCAPS_ADDSIGNED = $00000080; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED} + D3DTEXOPCAPS_ADDSIGNED2X = $00000100; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED2X} + D3DTEXOPCAPS_SUBTRACT = $00000200; + {$EXTERNALSYM D3DTEXOPCAPS_SUBTRACT} + D3DTEXOPCAPS_ADDSMOOTH = $00000400; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSMOOTH} + D3DTEXOPCAPS_BLENDDIFFUSEALPHA = $00000800; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDDIFFUSEALPHA} + D3DTEXOPCAPS_BLENDTEXTUREALPHA = $00001000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHA} + D3DTEXOPCAPS_BLENDFACTORALPHA = $00002000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDFACTORALPHA} + D3DTEXOPCAPS_BLENDTEXTUREALPHAPM = $00004000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHAPM} + D3DTEXOPCAPS_BLENDCURRENTALPHA = $00008000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDCURRENTALPHA} + D3DTEXOPCAPS_PREMODULATE = $00010000; + {$EXTERNALSYM D3DTEXOPCAPS_PREMODULATE} + D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR = $00020000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR} + D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA = $00040000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA} + D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR = $00080000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR} + D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA = $00100000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA} + D3DTEXOPCAPS_BUMPENVMAP = $00200000; + {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAP} + D3DTEXOPCAPS_BUMPENVMAPLUMINANCE = $00400000; + {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAPLUMINANCE} + D3DTEXOPCAPS_DOTPRODUCT3 = $00800000; + {$EXTERNALSYM D3DTEXOPCAPS_DOTPRODUCT3} + +(* D3DDEVICEDESC dwFVFCaps flags *) + + D3DFVFCAPS_TEXCOORDCOUNTMASK = $0000ffff; (* mask for texture coordinate count field *) + {$EXTERNALSYM D3DFVFCAPS_TEXCOORDCOUNTMASK} + D3DFVFCAPS_DONOTSTRIPELEMENTS = $00080000; (* Device prefers that vertex elements not be stripped *) + {$EXTERNALSYM D3DFVFCAPS_DONOTSTRIPELEMENTS} + +{$ENDIF} // DIRECT3D_VERSION_6 + +(* + * Description for a device. + * This is used to describe a device that is to be created or to query + * the current device. + *) + +type + PD3DDeviceDesc = ^TD3DDeviceDesc; + _D3DDeviceDesc = packed record + dwSize: DWORD; (* Size of TD3DDeviceDesc structure *) + dwFlags: DWORD; (* Indicates which fields have valid data *) + dcmColorModel: TD3DColorModel; (* Color model of device *) + dwDevCaps: DWORD; (* Capabilities of device *) + dtcTransformCaps: TD3DTransformCaps; (* Capabilities of transform *) + bClipping: BOOL; (* Device can do 3D clipping *) + dlcLightingCaps: TD3DLightingCaps; (* Capabilities of lighting *) + dpcLineCaps: TD3DPrimCaps; + dpcTriCaps: TD3DPrimCaps; + dwDeviceRenderBitDepth: DWORD; (* One of DDBB_8, 16, etc.. *) + dwDeviceZBufferBitDepth: DWORD; (* One of DDBD_16, 32, etc.. *) + dwMaxBufferSize: DWORD; (* Maximum execute buffer size *) + dwMaxVertexCount: DWORD; (* Maximum vertex count *) +{$IFDEF DIRECT3D_VERSION_5} + // *** New fields for DX5 *** // + + // Width and height caps are 0 for legacy HALs. + dwMinTextureWidth, dwMinTextureHeight : DWORD; + dwMaxTextureWidth, dwMaxTextureHeight : DWORD; + dwMinStippleWidth, dwMaxStippleWidth : DWORD; + dwMinStippleHeight, dwMaxStippleHeight : DWORD; +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + // New fields for DX6 + dwMaxTextureRepeat : DWORD; + dwMaxTextureAspectRatio : DWORD; + dwMaxAnisotropy : DWORD; + + // Guard band that the rasterizer can accommodate + // Screen-space vertices inside this space but outside the viewport + // will get clipped properly. + dvGuardBandLeft : TD3DValue; + dvGuardBandTop : TD3DValue; + dvGuardBandRight : TD3DValue; + dvGuardBandBottom : TD3DValue; + + dvExtentsAdjust : TD3DValue; + dwStencilCaps : DWORD; + + dwFVFCaps : DWORD; (* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware *) + dwTextureOpCaps : DWORD; + wMaxTextureBlendStages : WORD; + wMaxSimultaneousTextures : WORD; +{$ENDIF} // DIRECT3D_VERSION_6 + end; + {$EXTERNALSYM _D3DDeviceDesc} + D3DDeviceDesc = _D3DDeviceDesc; + {$EXTERNALSYM D3DDeviceDesc} + TD3DDeviceDesc = _D3DDeviceDesc; + +{$IFDEF DIRECT3D_VERSION_7} + PD3DDeviceDesc7 = ^TD3DDeviceDesc7; + _D3DDeviceDesc7 = packed record + dwDevCaps: DWORD; (* Capabilities of device *) + dpcLineCaps: TD3DPrimCaps; + dpcTriCaps: TD3DPrimCaps; + dwDeviceRenderBitDepth: DWORD; (* One of DDBB_8, 16, etc.. *) + dwDeviceZBufferBitDepth: DWORD; (* One of DDBD_16, 32, etc.. *) + + dwMinTextureWidth, dwMinTextureHeight: DWORD; + dwMaxTextureWidth, dwMaxTextureHeight: DWORD; + + dwMaxTextureRepeat: DWORD; + dwMaxTextureAspectRatio: DWORD; + dwMaxAnisotropy: DWORD; + + dvGuardBandLeft: TD3DValue; + dvGuardBandTop: TD3DValue; + dvGuardBandRight: TD3DValue; + dvGuardBandBottom: TD3DValue; + + dvExtentsAdjust: TD3DValue; + dwStencilCaps: DWORD; + + dwFVFCaps: DWORD; + dwTextureOpCaps: DWORD; + wMaxTextureBlendStages: WORD; + wMaxSimultaneousTextures: WORD; + + dwMaxActiveLights: DWORD; + dvMaxVertexW: TD3DValue; + deviceGUID: TGUID; + + wMaxUserClipPlanes: WORD; + wMaxVertexBlendMatrices: WORD; + + dwVertexProcessingCaps: DWORD; + + dwReserved1: DWORD; + dwReserved2: DWORD; + dwReserved3: DWORD; + dwReserved4: DWORD; + end; + {$EXTERNALSYM _D3DDeviceDesc7} + D3DDeviceDesc7 = _D3DDeviceDesc7; + {$EXTERNALSYM D3DDeviceDesc7} + TD3DDeviceDesc7 = _D3DDeviceDesc7; +{$ENDIF} // DIRECT3D_VERSION_7 + +const + D3DDEVICEDESCSIZE = SizeOf(TD3DDeviceDesc); + {$EXTERNALSYM D3DDEVICEDESCSIZE} +{$IFDEF DIRECT3D_VERSION_7} // There is the BUG in C++Headers + D3DDEVICEDESC7SIZE = SizeOf(TD3DDeviceDesc7); + {$EXTERNALSYM D3DDEVICEDESC7SIZE} +{$ENDIF} // DIRECT3D_VERSION_7 + +type + TD3DEnumDevicesCallbackA = function (lpGuid: PGUID; // nil for the default device + lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar; + var lpD3DHWDeviceDesc: TD3DDeviceDesc; + var lpD3DHELDeviceDesc: TD3DDeviceDesc; + lpContext: Pointer): HResult; stdcall; + TD3DEnumDevicesCallback = TD3DEnumDevicesCallbackA; + {$NODEFINE TD3DEnumDevicesCallbackA} + {$NODEFINE TD3DEnumDevicesCallback} + +{$IFDEF DIRECT3D_VERSION_7} + TD3DEnumDevicesCallback7A = function ( + lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar; + const lpD3DDeviceDesc: TD3DDeviceDesc7; lpContext: Pointer): HResult; stdcall; + TD3DEnumDevicesCallback7 = TD3DEnumDevicesCallback7A; + {$NODEFINE TD3DEnumDevicesCallback7A} + {$NODEFINE TD3DEnumDevicesCallback7} +{$ENDIF} // DIRECT3D_VERSION_7 + +(* TD3DDeviceDesc dwFlags indicating valid fields *) + +const + D3DDD_COLORMODEL = $00000001; (* dcmColorModel is valid *) + {$EXTERNALSYM D3DDD_COLORMODEL} + D3DDD_DEVCAPS = $00000002; (* dwDevCaps is valid *) + {$EXTERNALSYM D3DDD_DEVCAPS} + D3DDD_TRANSFORMCAPS = $00000004; (* dtcTransformCaps is valid *) + {$EXTERNALSYM D3DDD_TRANSFORMCAPS} + D3DDD_LIGHTINGCAPS = $00000008; (* dlcLightingCaps is valid *) + {$EXTERNALSYM D3DDD_LIGHTINGCAPS} + D3DDD_BCLIPPING = $00000010; (* bClipping is valid *) + {$EXTERNALSYM D3DDD_BCLIPPING} + D3DDD_LINECAPS = $00000020; (* dpcLineCaps is valid *) + {$EXTERNALSYM D3DDD_LINECAPS} + D3DDD_TRICAPS = $00000040; (* dpcTriCaps is valid *) + {$EXTERNALSYM D3DDD_TRICAPS} + D3DDD_DEVICERENDERBITDEPTH = $00000080; (* dwDeviceRenderBitDepth is valid *) + {$EXTERNALSYM D3DDD_DEVICERENDERBITDEPTH} + D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; (* dwDeviceZBufferBitDepth is valid *) + {$EXTERNALSYM D3DDD_DEVICEZBUFFERBITDEPTH} + D3DDD_MAXBUFFERSIZE = $00000200; (* dwMaxBufferSize is valid *) + {$EXTERNALSYM D3DDD_MAXBUFFERSIZE} + D3DDD_MAXVERTEXCOUNT = $00000400; (* dwMaxVertexCount is valid *) + {$EXTERNALSYM D3DDD_MAXVERTEXCOUNT} + +(* TD3DDeviceDesc dwDevCaps flags *) + + D3DDEVCAPS_FLOATTLVERTEX = $00000001; (* Device accepts floating point *) + (* for post-transform vertex data *) + {$EXTERNALSYM D3DDEVCAPS_FLOATTLVERTEX} + D3DDEVCAPS_SORTINCREASINGZ = $00000002; (* Device needs data sorted for increasing Z*) + {$EXTERNALSYM D3DDEVCAPS_SORTINCREASINGZ} + D3DDEVCAPS_SORTDECREASINGZ = $00000004; (* Device needs data sorted for decreasing Z*) + {$EXTERNALSYM D3DDEVCAPS_SORTDECREASINGZ} + D3DDEVCAPS_SORTEXACT = $00000008; (* Device needs data sorted exactly *) + {$EXTERNALSYM D3DDEVCAPS_SORTEXACT} + + D3DDEVCAPS_EXECUTESYSTEMMEMORY = $00000010; (* Device can use execute buffers from system memory *) + {$EXTERNALSYM D3DDEVCAPS_EXECUTESYSTEMMEMORY} + D3DDEVCAPS_EXECUTEVIDEOMEMORY = $00000020; (* Device can use execute buffers from video memory *) + {$EXTERNALSYM D3DDEVCAPS_EXECUTEVIDEOMEMORY} + D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; (* Device can use TL buffers from system memory *) + {$EXTERNALSYM D3DDEVCAPS_TLVERTEXSYSTEMMEMORY} + D3DDEVCAPS_TLVERTEXVIDEOMEMORY = $00000080; (* Device can use TL buffers from video memory *) + {$EXTERNALSYM D3DDEVCAPS_TLVERTEXVIDEOMEMORY} + D3DDEVCAPS_TEXTURESYSTEMMEMORY = $00000100; (* Device can texture from system memory *) + {$EXTERNALSYM D3DDEVCAPS_TEXTURESYSTEMMEMORY} + D3DDEVCAPS_TEXTUREVIDEOMEMORY = $00000200; (* Device can texture from device memory *) + {$EXTERNALSYM D3DDEVCAPS_TEXTUREVIDEOMEMORY} +{$IFDEF DIRECT3D_VERSION_5} + D3DDEVCAPS_DRAWPRIMTLVERTEX = $00000400; (* Device can draw TLVERTEX primitives *) + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMTLVERTEX} + D3DDEVCAPS_CANRENDERAFTERFLIP = $00000800; (* Device can render without waiting for flip to complete *) + {$EXTERNALSYM D3DDEVCAPS_CANRENDERAFTERFLIP} + D3DDEVCAPS_TEXTURENONLOCALVIDMEM = $00001000; (* Device can texture from nonlocal video memory *) + {$EXTERNALSYM D3DDEVCAPS_TEXTURENONLOCALVIDMEM} +{$ENDIF} // DIRECT3D_VERSION_5 +{$IFDEF DIRECT3D_VERSION_6} + D3DDEVCAPS_DRAWPRIMITIVES2 = $00002000; (* Device can support DrawPrimitives2 *) + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2} + D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; (* Device is texturing from separate memory pools *) + {$EXTERNALSYM D3DDEVCAPS_SEPARATETEXTUREMEMORIES} + D3DDEVCAPS_DRAWPRIMITIVES2EX = $00008000; (* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*) + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2EX} +{$ENDIF} // DIRECT3D_VERSION_6 +{$IFDEF DIRECT3D_VERSION_7} + D3DDEVCAPS_HWTRANSFORMANDLIGHT = $00010000; (* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also *) + {$EXTERNALSYM D3DDEVCAPS_HWTRANSFORMANDLIGHT} + D3DDEVCAPS_CANBLTSYSTONONLOCAL = $00020000; (* Device supports a Tex Blt from system memory to non-local vidmem *) + {$EXTERNALSYM D3DDEVCAPS_CANBLTSYSTONONLOCAL} + D3DDEVCAPS_HWRASTERIZATION = $00080000; (* Device has HW acceleration for rasterization *) + {$EXTERNALSYM D3DDEVCAPS_HWRASTERIZATION} + +(* + * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field + *) + +(* device can do texgen *) + D3DVTXPCAPS_TEXGEN = $00000001; + {$EXTERNALSYM D3DVTXPCAPS_TEXGEN} +(* device can do IDirect3DDevice7 colormaterialsource ops *) + D3DVTXPCAPS_MATERIALSOURCE7 = $00000002; + {$EXTERNALSYM D3DVTXPCAPS_MATERIALSOURCE7} +(* device can do vertex fog *) + D3DVTXPCAPS_VERTEXFOG = $00000004; + {$EXTERNALSYM D3DVTXPCAPS_VERTEXFOG} +(* device can do directional lights *) + D3DVTXPCAPS_DIRECTIONALLIGHTS = $00000008; + {$EXTERNALSYM D3DVTXPCAPS_DIRECTIONALLIGHTS} +(* device can do positional lights (includes point and spot) *) + D3DVTXPCAPS_POSITIONALLIGHTS = $00000010; + {$EXTERNALSYM D3DVTXPCAPS_POSITIONALLIGHTS} +(* device can do local viewer *) + D3DVTXPCAPS_LOCALVIEWER = $00000020; + {$EXTERNALSYM D3DVTXPCAPS_LOCALVIEWER} +{$ENDIF} // DIRECT3D_VERSION_7 + + D3DFDS_COLORMODEL = $00000001; (* Match color model *) + {$EXTERNALSYM D3DFDS_COLORMODEL} + D3DFDS_GUID = $00000002; (* Match guid *) + {$EXTERNALSYM D3DFDS_GUID} + D3DFDS_HARDWARE = $00000004; (* Match hardware/software *) + {$EXTERNALSYM D3DFDS_HARDWARE} + D3DFDS_TRIANGLES = $00000008; (* Match in triCaps *) + {$EXTERNALSYM D3DFDS_TRIANGLES} + D3DFDS_LINES = $00000010; (* Match in lineCaps *) + {$EXTERNALSYM D3DFDS_LINES} + D3DFDS_MISCCAPS = $00000020; (* Match primCaps.dwMiscCaps *) + {$EXTERNALSYM D3DFDS_MISCCAPS} + D3DFDS_RASTERCAPS = $00000040; (* Match primCaps.dwRasterCaps *) + {$EXTERNALSYM D3DFDS_RASTERCAPS} + D3DFDS_ZCMPCAPS = $00000080; (* Match primCaps.dwZCmpCaps *) + {$EXTERNALSYM D3DFDS_ZCMPCAPS} + D3DFDS_ALPHACMPCAPS = $00000100; (* Match primCaps.dwAlphaCmpCaps *) + {$EXTERNALSYM D3DFDS_ALPHACMPCAPS} + D3DFDS_SRCBLENDCAPS = $00000200; (* Match primCaps.dwSourceBlendCaps *) + {$EXTERNALSYM D3DFDS_SRCBLENDCAPS} + D3DFDS_DSTBLENDCAPS = $00000400; (* Match primCaps.dwDestBlendCaps *) + {$EXTERNALSYM D3DFDS_DSTBLENDCAPS} + D3DFDS_SHADECAPS = $00000800; (* Match primCaps.dwShadeCaps *) + {$EXTERNALSYM D3DFDS_SHADECAPS} + D3DFDS_TEXTURECAPS = $00001000; (* Match primCaps.dwTextureCaps *) + {$EXTERNALSYM D3DFDS_TEXTURECAPS} + D3DFDS_TEXTUREFILTERCAPS = $00002000; (* Match primCaps.dwTextureFilterCaps *) + {$EXTERNALSYM D3DFDS_TEXTUREFILTERCAPS} + D3DFDS_TEXTUREBLENDCAPS = $00004000; (* Match primCaps.dwTextureBlendCaps *) + {$EXTERNALSYM D3DFDS_TEXTUREBLENDCAPS} + D3DFDS_TEXTUREADDRESSCAPS = $00008000; (* Match primCaps.dwTextureBlendCaps *) + {$EXTERNALSYM D3DFDS_TEXTUREADDRESSCAPS} + +(* + * FindDevice arguments + *) +type + PD3DFindDeviceSearch = ^TD3DFindDeviceSearch; + _D3DFINDDEVICESEARCH = packed record + dwSize: DWORD; + dwFlags: DWORD; + bHardware: BOOL; + dcmColorModel: TD3DColorModel; + guid: TGUID; + dwCaps: DWORD; + dpcPrimCaps: TD3DPrimCaps; + end; + {$EXTERNALSYM _D3DFINDDEVICESEARCH} + D3DFINDDEVICESEARCH = _D3DFINDDEVICESEARCH; + {$EXTERNALSYM D3DFINDDEVICESEARCH} + TD3DFindDeviceSearch = _D3DFINDDEVICESEARCH; + + PD3DFindDeviceResult = ^TD3DFindDeviceResult; + _D3DFINDDEVICERESULT = packed record + dwSize: DWORD; + guid: TGUID; (* guid which matched *) + ddHwDesc: TD3DDeviceDesc; (* hardware TD3DDeviceDesc *) + ddSwDesc: TD3DDeviceDesc; (* software TD3DDeviceDesc *) + end; + {$EXTERNALSYM _D3DFINDDEVICERESULT} + D3DFINDDEVICERESULT = _D3DFINDDEVICERESULT; + {$EXTERNALSYM D3DFINDDEVICERESULT} + TD3DFindDeviceResult = _D3DFINDDEVICERESULT; + +(* + * Description of execute buffer. + *) + PD3DExecuteBufferDesc = ^TD3DExecuteBufferDesc; + _D3DExecuteBufferDesc = packed record + dwSize: DWORD; (* size of this structure *) + dwFlags: DWORD; (* flags indicating which fields are valid *) + dwCaps: DWORD; (* capabilities of execute buffer *) + dwBufferSize: DWORD; (* size of execute buffer data *) + lpData: Pointer; (* pointer to actual data *) + end; + {$EXTERNALSYM _D3DExecuteBufferDesc} + D3DExecuteBufferDesc = _D3DExecuteBufferDesc; + {$EXTERNALSYM D3DExecuteBufferDesc} + TD3DExecuteBufferDesc = _D3DExecuteBufferDesc; + +(* D3DEXECUTEBUFFER dwFlags indicating valid fields *) + +const + D3DDEB_BUFSIZE = $00000001; (* buffer size valid *) + {$EXTERNALSYM D3DDEB_BUFSIZE} + D3DDEB_CAPS = $00000002; (* caps valid *) + {$EXTERNALSYM D3DDEB_CAPS} + D3DDEB_LPDATA = $00000004; (* lpData valid *) + {$EXTERNALSYM D3DDEB_LPDATA} + +(* D3DEXECUTEBUFFER dwCaps *) + + D3DDEBCAPS_SYSTEMMEMORY = $00000001; (* buffer in system memory *) + {$EXTERNALSYM D3DDEBCAPS_SYSTEMMEMORY} + D3DDEBCAPS_VIDEOMEMORY = $00000002; (* buffer in device memory *) + {$EXTERNALSYM D3DDEBCAPS_VIDEOMEMORY} + D3DDEBCAPS_MEM = (D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY); + {$EXTERNALSYM D3DDEBCAPS_MEM} + +{$IFDEF DIRECT3D_VERSION_LESS_8} +{$IFDEF DIRECT3D_VERSION_7} +type + PD3DDevInfo_TextureManager = ^TD3DDevInfo_TextureManager; + _D3DDEVINFO_TEXTUREMANAGER = packed record + bThrashing: BOOL; (* indicates if thrashing *) + dwApproxBytesDownloaded: DWORD; (* Approximate number of bytes downloaded by texture manager *) + dwNumEvicts: DWORD; (* number of textures evicted *) + dwNumVidCreates: DWORD; (* number of textures created in video memory *) + dwNumTexturesUsed: DWORD; (* number of textures used *) + dwNumUsedTexInVid: DWORD; (* number of used textures present in video memory *) + dwWorkingSet: DWORD; (* number of textures in video memory *) + dwWorkingSetBytes: DWORD; (* number of bytes in video memory *) + dwTotalManaged: DWORD; (* total number of managed textures *) + dwTotalBytes: DWORD; (* total number of bytes of managed textures *) + dwLastPri: DWORD; (* priority of last texture evicted *) + end; + {$EXTERNALSYM _D3DDEVINFO_TEXTUREMANAGER} + D3DDEVINFO_TEXTUREMANAGER = _D3DDEVINFO_TEXTUREMANAGER; + {$EXTERNALSYM D3DDEVINFO_TEXTUREMANAGER} + TD3DDevInfo_TextureManager = _D3DDEVINFO_TEXTUREMANAGER; + PD3DDevInfoTextureManager = PD3DDevInfo_TextureManager; + TD3DDevInfoTextureManager = _D3DDEVINFO_TEXTUREMANAGER; + + PD3DDevInfo_Texturing = ^TD3DDevInfo_Texturing; + _D3DDEVINFO_TEXTURING = packed record + dwNumLoads: DWORD; (* counts Load() API calls *) + dwApproxBytesLoaded: DWORD; (* Approximate number bytes loaded via Load() *) + dwNumPreLoads: DWORD; (* counts PreLoad() API calls *) + dwNumSet: DWORD; (* counts SetTexture() API calls *) + dwNumCreates: DWORD; (* counts texture creates *) + dwNumDestroys: DWORD; (* counts texture destroys *) + dwNumSetPriorities: DWORD; (* counts SetPriority() API calls *) + dwNumSetLODs: DWORD; (* counts SetLOD() API calls *) + dwNumLocks: DWORD; (* counts number of texture locks *) + dwNumGetDCs: DWORD; (* counts number of GetDCs to textures *) + end; + {$EXTERNALSYM _D3DDEVINFO_TEXTURING} + D3DDEVINFO_TEXTURING = _D3DDEVINFO_TEXTURING; + {$EXTERNALSYM D3DDEVINFO_TEXTURING} + TD3DDevInfo_Texturing = _D3DDEVINFO_TEXTURING; + PD3DDevInfoTexturing = PD3DDevInfo_Texturing; + TD3DDevInfoTexturing = TD3DDevInfo_Texturing; +{$ENDIF} // DIRECT3D_VERSION_7 +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + + + +(*==========================================================================; + * + * + * File: d3d.h + * Content: Direct3D include file + * + ****************************************************************************) + +// include this file content only if compiling for <=DX7 interfaces +{$IFDEF DIRECT3D_VERSION_LESS_8} + +function D3DErrorString(Value: HResult): String; + + +{$IFDEF DIRECT3D_VERSION_5} +const + IID_IDirect3DRampDevice: TGUID = + (D1:$F2086B20;D2:$259F;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56)); + {$EXTERNALSYM IID_IDirect3DRampDevice} + IID_IDirect3DRGBDevice: TGUID = + (D1:$A4665C60;D2:$2673;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56)); + {$EXTERNALSYM IID_IDirect3DRGBDevice} + IID_IDirect3DHALDevice: TGUID = + (D1:$84E63dE0;D2:$46AA;D3:$11CF;D4:($81,$6F,$00,$00,$C0,$20,$15,$6E)); + {$EXTERNALSYM IID_IDirect3DHALDevice} + IID_IDirect3DMMXDevice: TGUID = + (D1:$881949a1;D2:$d6f3;D3:$11d0;D4:($89,$ab,$00,$a0,$c9,$05,$41,$29)); + {$EXTERNALSYM IID_IDirect3DMMXDevice} +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + IID_IDirect3DRefDevice: TGUID = + (D1:$50936643;D2:$13e9;D3:$11d1;D4:($89,$aa,$00,$a0,$c9,$05,$41,$29)); + {$EXTERNALSYM IID_IDirect3DRefDevice} + IID_IDirect3DNullDevice: TGUID = + (D1:$8767df22;D2:$bacc;D3:$11d1;D4:($89,$69,$00,$a0,$c9,$06,$29,$a8)); + {$EXTERNALSYM IID_IDirect3DNullDevice} +{$ENDIF} // DIRECT3D_VERSION_6 +{$IFDEF DIRECT3D_VERSION_7} + IID_IDirect3DTnLHalDevice: TGUID = '{f5049e78-4861-11d2-a407-00a0c90629a8}'; + {$EXTERNALSYM IID_IDirect3DTnLHalDevice} +{$ENDIF} // DIRECT3D_VERSION_7 + +type + IDirect3D = interface; + {$EXTERNALSYM IDirect3D} + {$IFDEF DIRECT3D_VERSION_5} + IDirect3D2 = interface; + {$ENDIF} // DIRECT3D_VERSION_5 + {$IFDEF DIRECT3D_VERSION_6} + IDirect3D3 = interface; + {$ENDIF} // DIRECT3D_VERSION_5 + {$IFDEF DIRECT3D_VERSION_7} + IDirect3D7 = interface; + {$ENDIF} // DIRECT3D_VERSION_5 + IDirect3DDevice = interface; + {$IFDEF DIRECT3D_VERSION_5} + IDirect3DDevice2 = interface; + {$ENDIF} // DIRECT3D_VERSION_5 + {$IFDEF DIRECT3D_VERSION_6} + IDirect3DDevice3 = interface; + {$ENDIF} // DIRECT3D_VERSION_6 + {$IFDEF DIRECT3D_VERSION_7} + IDirect3DDevice7 = interface; + {$ENDIF} // DIRECT3D_VERSION_7 + IDirect3DExecuteBuffer = interface; + IDirect3DLight = interface; + IDirect3DMaterial = interface; + {$IFDEF DIRECT3D_VERSION_5} + IDirect3DMaterial2 = interface; + {$ENDIF} // DIRECT3D_VERSION_5 + {$IFDEF DIRECT3D_VERSION_6} + IDirect3DMaterial3 = interface; + {$ENDIF} // DIRECT3D_VERSION_6 + IDirect3DTexture = interface; + {$IFDEF DIRECT3D_VERSION_5} + IDirect3DTexture2 = interface; + {$ENDIF} // DIRECT3D_VERSION_5 + IDirect3DViewport = interface; + {$IFDEF DIRECT3D_VERSION_5} + IDirect3DViewport2 = interface; + {$ENDIF} // DIRECT3D_VERSION_5 + {$IFDEF DIRECT3D_VERSION_6} + IDirect3DViewport3 = interface; + IDirect3DVertexBuffer = interface; + {$ENDIF} // DIRECT3D_VERSION_6 + {$IFDEF DIRECT3D_VERSION_7} + IDirect3DVertexBuffer7 = interface; + {$ENDIF} // DIRECT3D_VERSION_7 + + +(* + * Interface IID's + *) + IID_IDirect3D = IDirect3D; + {$EXTERNALSYM IID_IDirect3D} + {$IFDEF DIRECT3D_VERSION_5} + IID_IDirect3D2 = IDirect3D2; + {$EXTERNALSYM IID_IDirect3D2} + {$ENDIF} // DIRECT3D_VERSION_5 + {$IFDEF DIRECT3D_VERSION_6} + IID_IDirect3D3 = IDirect3D3; + {$EXTERNALSYM IID_IDirect3D3} + {$ENDIF} // DIRECT3D_VERSION_6 + {$IFDEF DIRECT3D_VERSION_7} + IID_IDirect3D7 = IDirect3D7; + {$EXTERNALSYM IID_IDirect3D7} + {$ENDIF} // DIRECT3D_VERSION_7 + + +(* + * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer + *) + + IID_IDirect3DDevice = IDirect3DDevice; + {$EXTERNALSYM IID_IDirect3DDevice} + {$IFDEF DIRECT3D_VERSION_5} + IID_IDirect3DDevice2 = IDirect3DDevice2; + {$EXTERNALSYM IID_IDirect3DDevice2} + {$ENDIF} + {$IFDEF DIRECT3D_VERSION_6} + IID_IDirect3DDevice3 = IDirect3DDevice3; + {$EXTERNALSYM IID_IDirect3DDevice3} + {$ENDIF} + {$IFDEF DIRECT3D_VERSION_7} + IID_IDirect3DDevice7 = IDirect3DDevice7; + {$EXTERNALSYM IID_IDirect3DDevice7} + {$ENDIF} + + IID_IDirect3DTexture = IDirect3DTexture; + {$EXTERNALSYM IID_IDirect3DTexture} + {$IFDEF DIRECT3D_VERSION_5} + IID_IDirect3DTexture2 = IDirect3DTexture2; + {$EXTERNALSYM IID_IDirect3DTexture2} + {$ENDIF} + + IID_IDirect3DLight = IDirect3DLight; + {$EXTERNALSYM IID_IDirect3DLight} + + IID_IDirect3DMaterial = IDirect3DMaterial; + {$EXTERNALSYM IID_IDirect3DMaterial} + {$IFDEF DIRECT3D_VERSION_5} + IID_IDirect3DMaterial2 = IDirect3DMaterial2; + {$EXTERNALSYM IID_IDirect3DMaterial2} + {$ENDIF} + {$IFDEF DIRECT3D_VERSION_6} + IID_IDirect3DMaterial3 = IDirect3DMaterial3; + {$EXTERNALSYM IID_IDirect3DMaterial3} + {$ENDIF} + + IID_IDirect3DExecuteBuffer = IDirect3DExecuteBuffer; + {$EXTERNALSYM IID_IDirect3DExecuteBuffer} + IID_IDirect3DViewport = IDirect3DViewport; + {$EXTERNALSYM IID_IDirect3DViewport} + {$IFDEF DIRECT3D_VERSION_5} + IID_IDirect3DViewport2 = IDirect3DViewport2; + {$EXTERNALSYM IID_IDirect3DViewport2} + {$ENDIF} + {$IFDEF DIRECT3D_VERSION_6} + IID_IDirect3DViewport3 = IDirect3DViewport3; + {$EXTERNALSYM IID_IDirect3DViewport3} + {$ENDIF} + {$IFDEF DIRECT3D_VERSION_6} + IID_IDirect3DVertexBuffer = IDirect3DVertexBuffer; + {$EXTERNALSYM IID_IDirect3DVertexBuffer} + {$ENDIF} + {$IFDEF DIRECT3D_VERSION_7} + IID_IDirect3DVertexBuffer7 = IDirect3DVertexBuffer7; + {$EXTERNALSYM IID_IDirect3DVertexBuffer7} + {$ENDIF} + + + +(* + * Direct3D interfaces + *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D);'} + IDirect3D = interface(IUnknown) + ['{3BBA0080-2421-11CF-A31A-00AA00B93356}'] + (*** IDirect3D methods ***) + function Initialize(lpREFIID: {REFIID} PGUID): HResult; stdcall; + function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback; + lpUserArg: Pointer): HResult; stdcall; + function CreateLight(var lplpDirect3Dlight: IDirect3DLight; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateMaterial(var lplpDirect3DMaterial: IDirect3DMaterial; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateViewport(var lplpD3DViewport: IDirect3DViewport; + pUnkOuter: IUnknown): HResult; stdcall; + function FindDevice(var lpD3DFDS: TD3DFindDeviceSearch; + var lpD3DFDR: TD3DFindDeviceResult): HResult; stdcall; + end; + +{$IFDEF DIRECT3D_VERSION_5} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D2);'} + {$EXTERNALSYM IDirect3D2} + IDirect3D2 = interface(IUnknown) + ['{6aae1ec1-662a-11d0-889d-00aa00bbb76a}'] + (*** IDirect3D2 methods ***) + function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback; + lpUserArg: Pointer): HResult; stdcall; + function CreateLight(var lplpDirect3Dlight: IDirect3DLight; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateMaterial(var lplpDirect3DMaterial2: IDirect3DMaterial2; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateViewport(var lplpD3DViewport2: IDirect3DViewport2; + pUnkOuter: IUnknown): HResult; stdcall; + function FindDevice(var lpD3DFDS: TD3DFindDeviceSearch; + var lpD3DFDR: TD3DFindDeviceResult): HResult; stdcall; + function CreateDevice(const rclsid: TRefClsID; lpDDS: IDirectDrawSurface; + out lplpD3DDevice2: IDirect3DDevice2): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D3);'} + {$EXTERNALSYM IDirect3D3} + IDirect3D3 = interface(IUnknown) + ['{bb223240-e72b-11d0-a9b4-00aa00c0993e}'] + (*** IDirect3D3 methods ***) + function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback; + lpUserArg: pointer): HResult; stdcall; + function CreateLight(var lplpDirect3Dlight: IDirect3DLight; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateMaterial(var lplpDirect3DMaterial3: IDirect3DMaterial3; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateViewport(var lplpD3DViewport3: IDirect3DViewport3; + pUnkOuter: IUnknown): HResult; stdcall; + function FindDevice(var lpD3DFDS: TD3DFindDeviceSearch; + var lpD3DFDR: TD3DFindDeviceResult): HResult; stdcall; + function CreateDevice(const rclsid: TRefClsID; lpDDS: IDirectDrawSurface4; + out lplpD3DDevice: IDirect3DDevice3; pUnkOuter: IUnknown): HResult; stdcall; + function CreateVertexBuffer(var lpVBDesc: TD3DVertexBufferDesc; + var lpD3DVertexBuffer: IDirect3DVertexBuffer; + dwFlags: DWORD; pUnkOuter: IUnknown): HResult; stdcall; + function EnumZBufferFormats(const riidDevice: TRefClsID; lpEnumCallback: + TD3DEnumPixelFormatsCallback; lpContext: Pointer): HResult; stdcall; + function EvictManagedTextures : HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_7} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D7);'} + {$EXTERNALSYM IDirect3D7} + IDirect3D7 = interface(IUnknown) + ['{f5049e77-4861-11d2-a407-00a0c90629a8}'] + (*** IDirect3D7 methods ***) + function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback7; + lpUserArg: pointer): HResult; stdcall; + function CreateDevice(const rclsid: TGUID; lpDDS: IDirectDrawSurface7; + out lplpD3DDevice: IDirect3DDevice7): HResult; stdcall; + function CreateVertexBuffer(const lpVBDesc: TD3DVertexBufferDesc; + out lplpD3DVertexBuffer: IDirect3DVertexBuffer7; + dwFlags: DWORD): HResult; stdcall; + function EnumZBufferFormats(const riidDevice: TGUID; lpEnumCallback: + TD3DEnumPixelFormatsCallback; lpContext: pointer): HResult; stdcall; + function EvictManagedTextures : HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_7 + +(* + * Direct3D Device interfaces + *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice);'} + {$EXTERNALSYM IDirect3DDevice} + IDirect3DDevice = interface(IUnknown) + ['{64108800-957d-11d0-89ab-00a0c9054129}'] + (*** IDirect3DDevice methods ***) + function Initialize(lpd3d: IDirect3D; lpGUID: PGUID; + var lpd3ddvdesc: TD3DDeviceDesc): HResult; stdcall; + function GetCaps(var lpD3DHWDevDesc: TD3DDeviceDesc; + var lpD3DHELDevDesc: TD3DDeviceDesc): HResult; stdcall; + function SwapTextureHandles(lpD3DTex1: IDirect3DTexture; + lpD3DTex2: IDirect3DTexture): HResult; stdcall; + function CreateExecuteBuffer(var lpDesc: TD3DExecuteBufferDesc ; + var lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer; + pUnkOuter: IUnknown): HResult; stdcall; + function GetStats(var lpD3DStats: TD3DStats): HResult; stdcall; + function Execute(lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer; + lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD): HResult; stdcall; + function AddViewport(lpDirect3DViewport: IDirect3DViewport): HResult; stdcall; + function DeleteViewport(lpDirect3DViewport: IDirect3DViewport): HResult; stdcall; + function NextViewport(lpDirect3DViewport: IDirect3DViewport; + var lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD): HResult; stdcall; + function Pick(lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer; + lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD; + var lpRect: TD3DRect): HResult; stdcall; + function GetPickRecords(var lpCount: DWORD; + var lpD3DPickRec: TD3DPickRecord): HResult; stdcall; + function EnumTextureFormats(lpd3dEnumTextureProc: + TD3DEnumTextureFormatsCallback; lpArg: Pointer): + HResult; stdcall; + function CreateMatrix(var lpD3DMatHandle: TD3DMatrixHandle): HResult; stdcall; + function SetMatrix(d3dMatHandle: TD3DMatrixHandle; + var lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function GetMatrix(var lpD3DMatHandle: TD3DMatrixHandle; + var lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function DeleteMatrix(d3dMatHandle: TD3DMatrixHandle): HResult; stdcall; + function BeginScene: HResult; stdcall; + function EndScene: HResult; stdcall; + function GetDirect3D(var lpD3D: IDirect3D): HResult; stdcall; + end; + +{$IFDEF DIRECT3D_VERSION_5} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice2);'} + {$EXTERNALSYM IDirect3DDevice2} + IDirect3DDevice2 = interface(IUnknown) + ['{93281501-8cf8-11d0-89ab-00a0c9054129}'] + (*** IDirect3DDevice2 methods ***) + function GetCaps(var lpD3DHWDevDesc: TD3DDeviceDesc; + var lpD3DHELDevDesc: TD3DDeviceDesc): HResult; stdcall; + function SwapTextureHandles(lpD3DTex1: IDirect3DTexture2; + lpD3DTex2: IDirect3DTexture2): HResult; stdcall; + function GetStats(var lpD3DStats: TD3DStats): HResult; stdcall; + function AddViewport(lpDirect3DViewport2: IDirect3DViewport2): HResult; stdcall; + function DeleteViewport(lpDirect3DViewport: IDirect3DViewport2): HResult; stdcall; + function NextViewport(lpDirect3DViewport: IDirect3DViewport2; + var lplpDirect3DViewport: IDirect3DViewport2; dwFlags: DWORD): + HResult; stdcall; + function EnumTextureFormats( + lpd3dEnumTextureProc: TD3DEnumTextureFormatsCallback; lpArg: Pointer): + HResult; stdcall; + function BeginScene: HResult; stdcall; + function EndScene: HResult; stdcall; + function GetDirect3D(var lpD3D: IDirect3D2): HResult; stdcall; + + (*** DrawPrimitive API ***) + function SetCurrentViewport(lpd3dViewport2: IDirect3DViewport2) + : HResult; stdcall; + function GetCurrentViewport(var lplpd3dViewport2: IDirect3DViewport2) + : HResult; stdcall; + + function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface) + : HResult; stdcall; + function GetRenderTarget(var lplpNewRenderTarget: IDirectDrawSurface) + : HResult; stdcall; + + function Begin_(d3dpt: TD3DPrimitiveType; d3dvt: TD3DVertexType; + dwFlags: DWORD): HResult; stdcall; + function BeginIndexed(dptPrimitiveType: TD3DPrimitiveType; dvtVertexType: + TD3DVertexType; lpvVertices: pointer; dwNumVertices: DWORD; + dwFlags: DWORD): HResult; stdcall; + function Vertex(lpVertexType: pointer): HResult; stdcall; + function Index(wVertexIndex: WORD): HResult; stdcall; + function End_(dwFlags: DWORD): HResult; stdcall; + + function GetRenderState(dwRenderStateType: TD3DRenderStateType; + var lpdwRenderState): HResult; stdcall; + function SetRenderState(dwRenderStateType: TD3DRenderStateType; + dwRenderState: DWORD): HResult; stdcall; + function GetLightState(dwLightStateType: TD3DLightStateType; + var lpdwLightState): HResult; stdcall; + function SetLightState(dwLightStateType: TD3DLightStateType; + dwLightState: DWORD): HResult; stdcall; + function SetTransform(dtstTransformStateType: TD3DTransformStateType; + var lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function GetTransform(dtstTransformStateType: TD3DTransformStateType; + var lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType; + var lpD3DMatrix: TD3DMatrix): HResult; stdcall; + + function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType; + dvtVertexType: TD3DVertexType; var lpvVertices; dwVertexCount, + dwFlags: DWORD): HResult; stdcall; + function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwVertexCount: DWORD; + var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD): HResult; stdcall; + function SetClipStatus(var lpD3DClipStatus: TD3DClipStatus): HResult; stdcall; + function GetClipStatus(var lpD3DClipStatus: TD3DClipStatus): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice3);'} + {$EXTERNALSYM IDirect3DDevice3} + IDirect3DDevice3 = interface(IUnknown) + ['{b0ab3b60-33d7-11d1-a981-00c04fd7b174}'] + (*** IDirect3DDevice2 methods ***) + function GetCaps(var lpD3DHWDevDesc: TD3DDeviceDesc; + var lpD3DHELDevDesc: TD3DDeviceDesc): HResult; stdcall; + function GetStats(var lpD3DStats: TD3DStats): HResult; stdcall; + function AddViewport(lpDirect3DViewport: IDirect3DViewport3): HResult; stdcall; + function DeleteViewport(lpDirect3DViewport: IDirect3DViewport3): HResult; stdcall; + function NextViewport(lpDirect3DViewport: IDirect3DViewport3; + var lplpAnotherViewport: IDirect3DViewport3; dwFlags: DWORD): HResult; stdcall; + function EnumTextureFormats( + lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer): + HResult; stdcall; + function BeginScene: HResult; stdcall; + function EndScene: HResult; stdcall; + function GetDirect3D(var lpD3D: IDirect3D3): HResult; stdcall; + function SetCurrentViewport(lpd3dViewport: IDirect3DViewport3) + : HResult; stdcall; + function GetCurrentViewport(var lplpd3dViewport: IDirect3DViewport3) + : HResult; stdcall; + function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface4) + : HResult; stdcall; + function GetRenderTarget(var lplpNewRenderTarget: IDirectDrawSurface4) + : HResult; stdcall; + function Begin_(d3dpt: TD3DPrimitiveType; dwVertexTypeDesc: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BeginIndexed(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwNumVertices: DWORD; + dwFlags: DWORD): HResult; stdcall; + function Vertex(lpVertex: pointer): HResult; stdcall; + function Index(wVertexIndex: WORD): HResult; stdcall; + function End_(dwFlags: DWORD): HResult; stdcall; + function GetRenderState(dwRenderStateType: TD3DRenderStateType; + var lpdwRenderState): HResult; stdcall; + function SetRenderState(dwRenderStateType: TD3DRenderStateType; + dwRenderState: DWORD): HResult; stdcall; + function GetLightState(dwLightStateType: TD3DLightStateType; + var lpdwLightState): HResult; stdcall; + function SetLightState(dwLightStateType: TD3DLightStateType; + dwLightState: DWORD): HResult; stdcall; + function SetTransform(dtstTransformStateType: TD3DTransformStateType; + var lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function GetTransform(dtstTransformStateType: TD3DTransformStateType; + var lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType; + var lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc: DWORD; const lpvVertices; + dwVertexCount, dwFlags: DWORD): HResult; stdcall; + function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD; + var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD): HResult; stdcall; + function SetClipStatus(var lpD3DClipStatus: TD3DClipStatus): HResult; stdcall; + function GetClipStatus(var lpD3DClipStatus: TD3DClipStatus): HResult; stdcall; + function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc : DWORD; + var lpVertexArray: TD3DDrawPrimitiveStridedData; + dwVertexCount, dwFlags: DWORD): HResult; stdcall; + function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc : DWORD; + var lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD; + var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD): HResult; stdcall; + function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType; + lpd3dVertexBuffer: IDirect3DVertexBuffer; + dwStartVertex, dwNumVertices, dwFlags: DWORD): HResult; stdcall; + function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType; + lpd3dVertexBuffer: IDirect3DVertexBuffer; var lpwIndices: WORD; + dwIndexCount, dwFlags: DWORD): HResult; stdcall; + function ComputeSphereVisibility(var lpCenters: TD3DVector; + var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD; + var lpdwReturnValues: DWORD): HResult; stdcall; + function GetTexture(dwStage: DWORD; var lplpTexture: IDirect3DTexture2) + : HResult; stdcall; + function SetTexture(dwStage: DWORD; lplpTexture: IDirect3DTexture2) + : HResult; stdcall; + function GetTextureStageState(dwStage: DWORD; + dwState: TD3DTextureStageStateType; var lpdwValue: DWORD): HResult; stdcall; + function SetTextureStageState(dwStage: DWORD; + dwState: TD3DTextureStageStateType; lpdwValue: DWORD): HResult; stdcall; + function ValidateDevice(var lpdwExtraPasses: DWORD): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_7} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice7);'} + {$EXTERNALSYM IDirect3DDevice7} + IDirect3DDevice7 = interface(IUnknown) + ['{f5049e79-4861-11d2-a407-00a0c90629a8}'] + (*** IDirect3DDevice7 methods ***) + function GetCaps(out lpD3DDevDesc: TD3DDeviceDesc7): HResult; stdcall; + function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer): HResult; stdcall; + function BeginScene: HResult; stdcall; + function EndScene: HResult; stdcall; + function GetDirect3D(out lpD3D: IDirect3D7): HResult; stdcall; + function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface7; dwFlags: DWORD): HResult; stdcall; + function GetRenderTarget(out lplpRenderTarget: IDirectDrawSurface7): HResult; stdcall; + function Clear(dwCount: DWORD; lpRects: PD3DRect; dwFlags, dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD): HResult; stdcall; + function SetTransform(dtstTransformStateType: TD3DTransformStateType; + const lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function GetTransform(dtstTransformStateType: TD3DTransformStateType; + out lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function SetViewport(const lpViewport: TD3DViewport7): HResult; stdcall; + function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType; + const lpD3DMatrix: TD3DMatrix): HResult; stdcall; + function GetViewport(out lpViewport: TD3DViewport7): HResult; stdcall; + function SetMaterial(const lpMaterial: TD3DMaterial7): HResult; stdcall; + function GetMaterial(out lpMaterial: TD3DMaterial7): HResult; stdcall; + function SetLight(dwLightIndex: DWORD; const lpLight: TD3DLight7): HResult; stdcall; + function GetLight(dwLightIndex: DWORD; out lpLight: TD3DLight7): HResult; stdcall; + function SetRenderState(dwRenderStateType: TD3DRenderStateType; dwRenderState: DWORD): HResult; stdcall; + function GetRenderState(dwRenderStateType: TD3DRenderStateType; out dwRenderState: DWORD): HResult; stdcall; + function BeginStateBlock : HResult; stdcall; + function EndStateBlock(out lpdwBlockHandle: DWORD): HResult; stdcall; + function PreLoad(lpddsTexture: IDirectDrawSurface7): HResult; stdcall; + function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc: DWORD; const lpvVertices; + dwVertexCount, dwFlags: DWORD): HResult; stdcall; + function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD; + const lpwIndices; dwIndexCount, dwFlags: DWORD): HResult; stdcall; + function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus): HResult; stdcall; + function GetClipStatus(out lpD3DClipStatus: TD3DClipStatus): HResult; stdcall; + function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc : DWORD; + const lpVertexArray: TD3DDrawPrimitiveStridedData; + dwVertexCount, dwFlags: DWORD): HResult; stdcall; + function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType; + dwVertexTypeDesc : DWORD; + const lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD; + var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD): HResult; stdcall; + function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType; + lpd3dVertexBuffer: IDirect3DVertexBuffer7; + dwStartVertex, dwNumVertices, dwFlags: DWORD): HResult; stdcall; + function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType; + lpd3dVertexBuffer: IDirect3DVertexBuffer7; dwStartVertex, dwNumVertices: DWORD; + var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD): HResult; stdcall; + function ComputeSphereVisibility(const lpCenters: TD3DVector; + var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD; + var lpdwReturnValues: DWORD): HResult; stdcall; + function GetTexture(dwStage: DWORD; out lplpTexture: IDirectDrawSurface7): HResult; stdcall; + function SetTexture(dwStage: DWORD; lpTexture: IDirectDrawSurface7): HResult; stdcall; + function GetTextureStageState(dwStage: DWORD; + dwState: TD3DTextureStageStateType; out lpdwValue: DWORD): HResult; stdcall; + function SetTextureStageState(dwStage: DWORD; + dwState: TD3DTextureStageStateType; lpdwValue: DWORD): HResult; stdcall; + function ValidateDevice(out lpdwExtraPasses: DWORD): HResult; stdcall; + function ApplyStateBlock(dwBlockHandle: DWORD): HResult; stdcall; + function CaptureStateBlock(dwBlockHandle: DWORD): HResult; stdcall; + function DeleteStateBlock(dwBlockHandle: DWORD): HResult; stdcall; + function CreateStateBlock(d3dsbType: TD3DStateBlockType; out lpdwBlockHandle: DWORD): HResult; stdcall; + function Load(lpDestTex: IDirectDrawSurface7; lpDestPoint: PPoint; + lpSrcTex: IDirectDrawSurface7; lprcSrcRect: PRect; dwFlags: DWORD): HResult; stdcall; + function LightEnable(dwLightIndex: DWORD; bEnable: BOOL): HResult; stdcall; + function GetLightEnable(dwLightIndex: DWORD; out bEnable: BOOL): HResult; stdcall; + function SetClipPlane(dwIndex: DWORD; pPlaneEquation: PD3DValue): HResult; stdcall; + function GetClipPlane(dwIndex: DWORD; pPlaneEquation: PD3DValue): HResult; stdcall; + function GetInfo(dwDevInfoID: DWORD; pDevInfoStruct: Pointer; dwSize: DWORD): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_7 + +(* + * Execute Buffer interface + *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DExecuteBuffer);'} + {$EXTERNALSYM IDirect3DExecuteBuffer} + IDirect3DExecuteBuffer = interface(IUnknown) + ['{4417C145-33AD-11CF-816F-0000C020156E}'] + (*** IDirect3DExecuteBuffer methods ***) + function Initialize(lpDirect3DDevice: IDirect3DDevice; + var lpDesc: TD3DExecuteBufferDesc): HResult; stdcall; + function Lock(var lpDesc: TD3DExecuteBufferDesc): HResult; stdcall; + function Unlock: HResult; stdcall; + function SetExecuteData(var lpData: TD3DExecuteData): HResult; stdcall; + function GetExecuteData(var lpData: TD3DExecuteData): HResult; stdcall; + function Validate(var lpdwOffset: DWORD; lpFunc: TD3DValidateCallback; + lpUserArg: Pointer; dwReserved: DWORD): HResult; stdcall; + (*** Warning! Optimize is defined differently in the header files + and the online documentation ***) + function Optimize(dwFlags: DWORD): HResult; stdcall; + end; + +(* + * Light interfaces + *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DLight);'} + {$EXTERNALSYM IDirect3DLight} + IDirect3DLight = interface(IUnknown) + ['{4417C142-33AD-11CF-816F-0000C020156E}'] + (*** IDirect3DLight methods ***) + function Initialize(lpDirect3D: IDirect3D): HResult; stdcall; + function SetLight(var lpLight: TD3DLight2): HResult; stdcall; + function GetLight(var lpLight: TD3DLight2): HResult; stdcall; + end; + +(* + * Material interfaces + *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DMaterial);'} + {$EXTERNALSYM IDirect3DMaterial} + IDirect3DMaterial = interface(IUnknown) + ['{4417C144-33AD-11CF-816F-0000C020156E}'] + (*** IDirect3DMaterial methods ***) + function Initialize(lpDirect3D: IDirect3D): HResult; stdcall; + function SetMaterial(var lpMat: TD3DMaterial): HResult; stdcall; + function GetMaterial(var lpMat: TD3DMaterial): HResult; stdcall; + function GetHandle(lpDirect3DDevice: IDirect3DDevice; + var lpHandle: TD3DMaterialHandle): HResult; stdcall; + function Reserve: HResult; stdcall; + function Unreserve: HResult; stdcall; + end; + +{$IFDEF DIRECT3D_VERSION_5} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DMaterial2);'} + {$EXTERNALSYM IDirect3DMaterial2} + IDirect3DMaterial2 = interface(IUnknown) + ['{93281503-8cf8-11d0-89ab-00a0c9054129}'] + (*** IDirect3DMaterial2 methods ***) + function SetMaterial(var lpMat: TD3DMaterial): HResult; stdcall; + function GetMaterial(var lpMat: TD3DMaterial): HResult; stdcall; + function GetHandle(lpDirect3DDevice: IDirect3DDevice2; + var lpHandle: TD3DMaterialHandle): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DMaterial3);'} + {$EXTERNALSYM IDirect3DMaterial3} + IDirect3DMaterial3 = interface(IUnknown) + ['{ca9c46f4-d3c5-11d1-b75a-00600852b312}'] + (*** IDirect3DMaterial2 methods ***) + function SetMaterial(var lpMat: TD3DMaterial): HResult; stdcall; + function GetMaterial(var lpMat: TD3DMaterial): HResult; stdcall; + function GetHandle(lpDirect3DDevice: IDirect3DDevice3; + var lpHandle: TD3DMaterialHandle): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_6 + +(* + * Texture interfaces + *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DTexture);'} + {$EXTERNALSYM IDirect3DTexture} + IDirect3DTexture = interface(IUnknown) + ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}'] + (*** IDirect3DTexture methods ***) + function Initialize(lpD3DDevice: IDirect3DDevice; + lpDDSurface: IDirectDrawSurface): HResult; stdcall; + function GetHandle(lpDirect3DDevice: IDirect3DDevice; + var lpHandle: TD3DTextureHandle): HResult; stdcall; + function PaletteChanged(dwStart: DWORD; dwCount: DWORD): HResult; stdcall; + function Load(lpD3DTexture: IDirect3DTexture): HResult; stdcall; + function Unload: HResult; stdcall; + end; + +{$IFDEF DIRECT3D_VERSION_5} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DTexture2);'} + {$EXTERNALSYM IDirect3DTexture2} + IDirect3DTexture2 = interface(IUnknown) + ['{93281502-8cf8-11d0-89ab-00a0c9054129}'] + (*** IDirect3DTexture2 methods ***) + function GetHandle(lpDirect3DDevice: IDirect3DDevice2; + var lpHandle: TD3DTextureHandle): HResult; stdcall; + function PaletteChanged(dwStart: DWORD; dwCount: DWORD): HResult; stdcall; + function Load(lpD3DTexture: IDirect3DTexture2): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_5 + +(* + * Viewport interfaces + *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DViewport);'} + {$EXTERNALSYM IDirect3DViewport} + IDirect3DViewport = interface(IUnknown) + ['{4417C146-33AD-11CF-816F-0000C020156E}'] + (*** IDirect3DViewport methods ***) + function Initialize(lpDirect3D: IDirect3D): HResult; stdcall; + function GetViewport(out lpData: TD3DViewport): HResult; stdcall; + function SetViewport(const lpData: TD3DViewport): HResult; stdcall; + function TransformVertices(dwVertexCount: DWORD; + const lpData: TD3DTransformData; dwFlags: DWORD; + out lpOffscreen: DWORD): HResult; stdcall; + function LightElements(dwElementCount: DWORD; + var lpData: TD3DLightData): HResult; stdcall; + function SetBackground(hMat: TD3DMaterialHandle): HResult; stdcall; + function GetBackground(out hMat: TD3DMaterialHandle): HResult; stdcall; + function SetBackgroundDepth(lpDDSurface: IDirectDrawSurface): + HResult; stdcall; + function GetBackgroundDepth(out lplpDDSurface: IDirectDrawSurface; + out lpValid: BOOL): HResult; stdcall; + function Clear(dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD): + HResult; stdcall; + function AddLight(lpDirect3DLight: IDirect3DLight): HResult; stdcall; + function DeleteLight(lpDirect3DLight: IDirect3DLight): HResult; stdcall; + function NextLight(lpDirect3DLight: IDirect3DLight; + out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD): HResult; stdcall; + end; + +{$IFDEF DIRECT3D_VERSION_5} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DViewport2);'} + {$EXTERNALSYM IDirect3DViewport2} + IDirect3DViewport2 = interface(IUnknown) + ['{93281500-8cf8-11d0-89ab-00a0c9054129}'] + (*** IDirect3DViewport2 methods ***) + function Initialize(lpDirect3D: IDirect3D): HResult; stdcall; + function GetViewport(out lpData: TD3DViewport): HResult; stdcall; + function SetViewport(const lpData: TD3DViewport): HResult; stdcall; + function TransformVertices(dwVertexCount: DWORD; + const lpData: TD3DTransformData; dwFlags: DWORD; + out lpOffscreen: DWORD): HResult; stdcall; + function LightElements(dwElementCount: DWORD; + var lpData: TD3DLightData): HResult; stdcall; + function SetBackground(hMat: TD3DMaterialHandle): HResult; stdcall; + function GetBackground(out hMat: TD3DMaterialHandle): HResult; stdcall; + function SetBackgroundDepth(lpDDSurface: IDirectDrawSurface): + HResult; stdcall; + function GetBackgroundDepth(out lplpDDSurface: IDirectDrawSurface; + out lpValid: BOOL): HResult; stdcall; + function Clear(dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD): + HResult; stdcall; + function AddLight(lpDirect3DLight: IDirect3DLight): HResult; stdcall; + function DeleteLight(lpDirect3DLight: IDirect3DLight): HResult; stdcall; + function NextLight(lpDirect3DLight: IDirect3DLight; + out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD): HResult; stdcall; + (*** IDirect3DViewport2 methods ***) + function GetViewport2(out lpData: TD3DViewport2): HResult; stdcall; + function SetViewport2(const lpData: TD3DViewport2): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DViewport3);'} + {$EXTERNALSYM IDirect3DViewport3} + IDirect3DViewport3 = interface(IUnknown) + ['{b0ab3b61-33d7-11d1-a981-00c04fd7b174}'] + (*** IDirect3DViewport3 methods ***) + function Initialize(lpDirect3D: IDirect3D): HResult; stdcall; + function GetViewport(out lpData: TD3DViewport): HResult; stdcall; + function SetViewport(const lpData: TD3DViewport): HResult; stdcall; + function TransformVertices(dwVertexCount: DWORD; + const lpData: TD3DTransformData; dwFlags: DWORD; + out lpOffscreen: DWORD): HResult; stdcall; + function LightElements(dwElementCount: DWORD; + var lpData: TD3DLightData): HResult; stdcall; + function SetBackground(hMat: TD3DMaterialHandle): HResult; stdcall; + function GetBackground(var hMat: TD3DMaterialHandle): HResult; stdcall; + function SetBackgroundDepth( + lpDDSurface: IDirectDrawSurface): HResult; stdcall; + function GetBackgroundDepth(out lplpDDSurface: IDirectDrawSurface; + out lpValid: BOOL): HResult; stdcall; + function Clear(dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD): + HResult; stdcall; + function AddLight(lpDirect3DLight: IDirect3DLight): HResult; stdcall; + function DeleteLight(lpDirect3DLight: IDirect3DLight): HResult; stdcall; + function NextLight(lpDirect3DLight: IDirect3DLight; + out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD): HResult; stdcall; + function GetViewport2(out lpData: TD3DViewport2): HResult; stdcall; + function SetViewport2(const lpData: TD3DViewport2): HResult; stdcall; + function SetBackgroundDepth2( + lpDDSurface: IDirectDrawSurface4): HResult; stdcall; + function GetBackgroundDepth2(out lplpDDSurface: IDirectDrawSurface4; + out lpValid: BOOL): HResult; stdcall; + function Clear2(dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD; + dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_6} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexBuffer);'} + {$EXTERNALSYM IDirect3DVertexBuffer} + IDirect3DVertexBuffer = interface(IUnknown) + ['{7a503555-4a83-11d1-a5db-00a0c90367f8}'] + (*** IDirect3DVertexBuffer methods ***) + function Lock(dwFlags: DWORD; var lplpData: pointer; var lpdwSize: DWORD) + : HResult; stdcall; + function Unlock : HResult; stdcall; + function ProcessVertices(dwVertexOp, dwDestIndex, dwCount: DWORD; + lpSrcBuffer: IDirect3DVertexBuffer; dwSrcIndex: DWORD; + lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD): HResult; stdcall; + function GetVertexBufferDesc(var lpVBDesc: TD3DVertexBufferDesc): HResult; stdcall; + function Optimize(lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_7} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexBuffer7);'} + {$EXTERNALSYM IDirect3DVertexBuffer7} + IDirect3DVertexBuffer7 = interface(IUnknown) + ['{f5049e7d-4861-11d2-a407-00a0c90629a8}'] + (*** IDirect3DVertexBuffer methods ***) + function Lock(dwFlags: DWORD; out lplpData: Pointer; out lpdwSize: DWORD): HResult; stdcall; + function Unlock : HResult; stdcall; + function ProcessVertices(dwVertexOp, dwDestIndex, dwCount: DWORD; + lpSrcBuffer: IDirect3DVertexBuffer7; dwSrcIndex: DWORD; + lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD): HResult; stdcall; + function GetVertexBufferDesc(out lpVBDesc: TD3DVertexBufferDesc): HResult; stdcall; + function Optimize(lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD): HResult; stdcall; + function ProcessVerticesStrided(dwVertexOp, dwDestIndex, dwCount: DWORD; + lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexTypeDesc: DWORD; + lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD): HResult; stdcall; + end; +{$ENDIF} // DIRECT3D_VERSION_7 + +{$IFDEF DIRECT3D_VERSION_5} +const +(**************************************************************************** + * + * Flags for IDirect3DDevice::NextViewport + * + ****************************************************************************) + +(* + * Return the next viewport + *) + D3DNEXT_NEXT = $00000001; + {$EXTERNALSYM D3DNEXT_NEXT} + +(* + * Return the first viewport + *) + D3DNEXT_HEAD = $00000002; + {$EXTERNALSYM D3DNEXT_HEAD} + +(* + * Return the last viewport + *) + D3DNEXT_TAIL = $00000004; + {$EXTERNALSYM D3DNEXT_TAIL} + + +(**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************) + +(* + * Wait until the device is ready to draw the primitive + * This will cause DP to not return DDERR_WASSTILLDRAWING + *) + D3DDP_WAIT = $00000001; + {$EXTERNALSYM D3DDP_WAIT} + +{$IFDEF DIRECT3D_VERSION_LESS_6} +(* + * Hint that it is acceptable to render the primitive out of order. + *) + D3DDP_OUTOFORDER = $00000002; + {$EXTERNALSYM D3DDP_OUTOFORDER} +{$ENDIF} // DIRECT3D_VERSION_LESS_6 + +(* + * Hint that the primitives have been clipped by the application. + *) + D3DDP_DONOTCLIP = $00000004; + {$EXTERNALSYM D3DDP_DONOTCLIP} + +(* + * Hint that the extents need not be updated. + *) + D3DDP_DONOTUPDATEEXTENTS = $00000008; + {$EXTERNALSYM D3DDP_DONOTUPDATEEXTENTS} +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + +(* + * Hint that the lighting should not be applied on vertices. + *) + + D3DDP_DONOTLIGHT = $00000010; + {$EXTERNALSYM D3DDP_DONOTLIGHT} + +{$ENDIF} // DIRECT3D_VERSION_6 + + +(* + * Direct3D Errors + * DirectDraw error codes are used when errors not specified here. + *) + +const + MAKE_DDHRESULT = HResult($88760000); + {$EXTERNALSYM MAKE_DDHRESULT} + + D3D_OK = DD_OK; + {$EXTERNALSYM D3D_OK} + D3DERR_BADMAJORVERSION = MAKE_DDHRESULT + 700; + {$EXTERNALSYM D3DERR_BADMAJORVERSION} + D3DERR_BADMINORVERSION = MAKE_DDHRESULT + 701; + {$EXTERNALSYM D3DERR_BADMINORVERSION} + +{$IFDEF DIRECT3D_VERSION_5} +(* + * An invalid device was requested by the application. + *) + D3DERR_INVALID_DEVICE = MAKE_DDHRESULT + 705; + {$EXTERNALSYM D3DERR_INVALID_DEVICE} + D3DERR_INITFAILED = MAKE_DDHRESULT + 706; + {$EXTERNALSYM D3DERR_INITFAILED} + +(* + * SetRenderTarget attempted on a device that was + * QI'd off the render target. + *) + D3DERR_DEVICEAGGREGATED = MAKE_DDHRESULT + 707; + {$EXTERNALSYM D3DERR_DEVICEAGGREGATED} +{$ENDIF} // DIRECT3D_VERSION_5 + + D3DERR_EXECUTE_CREATE_FAILED = MAKE_DDHRESULT + 710; + {$EXTERNALSYM D3DERR_EXECUTE_CREATE_FAILED} + D3DERR_EXECUTE_DESTROY_FAILED = MAKE_DDHRESULT + 711; + {$EXTERNALSYM D3DERR_EXECUTE_DESTROY_FAILED} + D3DERR_EXECUTE_LOCK_FAILED = MAKE_DDHRESULT + 712; + {$EXTERNALSYM D3DERR_EXECUTE_LOCK_FAILED} + D3DERR_EXECUTE_UNLOCK_FAILED = MAKE_DDHRESULT + 713; + {$EXTERNALSYM D3DERR_EXECUTE_UNLOCK_FAILED} + D3DERR_EXECUTE_LOCKED = MAKE_DDHRESULT + 714; + {$EXTERNALSYM D3DERR_EXECUTE_LOCKED} + D3DERR_EXECUTE_NOT_LOCKED = MAKE_DDHRESULT + 715; + {$EXTERNALSYM D3DERR_EXECUTE_NOT_LOCKED} + + D3DERR_EXECUTE_FAILED = MAKE_DDHRESULT + 716; + {$EXTERNALSYM D3DERR_EXECUTE_FAILED} + D3DERR_EXECUTE_CLIPPED_FAILED = MAKE_DDHRESULT + 717; + {$EXTERNALSYM D3DERR_EXECUTE_CLIPPED_FAILED} + + D3DERR_TEXTURE_NO_SUPPORT = MAKE_DDHRESULT + 720; + {$EXTERNALSYM D3DERR_TEXTURE_NO_SUPPORT} + D3DERR_TEXTURE_CREATE_FAILED = MAKE_DDHRESULT + 721; + {$EXTERNALSYM D3DERR_TEXTURE_CREATE_FAILED} + D3DERR_TEXTURE_DESTROY_FAILED = MAKE_DDHRESULT + 722; + {$EXTERNALSYM D3DERR_TEXTURE_DESTROY_FAILED} + D3DERR_TEXTURE_LOCK_FAILED = MAKE_DDHRESULT + 723; + {$EXTERNALSYM D3DERR_TEXTURE_LOCK_FAILED} + D3DERR_TEXTURE_UNLOCK_FAILED = MAKE_DDHRESULT + 724; + {$EXTERNALSYM D3DERR_TEXTURE_UNLOCK_FAILED} + D3DERR_TEXTURE_LOAD_FAILED = MAKE_DDHRESULT + 725; + {$EXTERNALSYM D3DERR_TEXTURE_LOAD_FAILED} + D3DERR_TEXTURE_SWAP_FAILED = MAKE_DDHRESULT + 726; + {$EXTERNALSYM D3DERR_TEXTURE_SWAP_FAILED} + D3DERR_TEXTURE_LOCKED = MAKE_DDHRESULT + 727; + {$EXTERNALSYM D3DERR_TEXTURE_LOCKED} + D3DERR_TEXTURE_NOT_LOCKED = MAKE_DDHRESULT + 728; + {$EXTERNALSYM D3DERR_TEXTURE_NOT_LOCKED} + D3DERR_TEXTURE_GETSURF_FAILED = MAKE_DDHRESULT + 729; + {$EXTERNALSYM D3DERR_TEXTURE_GETSURF_FAILED} + + D3DERR_MATRIX_CREATE_FAILED = MAKE_DDHRESULT + 730; + {$EXTERNALSYM D3DERR_MATRIX_CREATE_FAILED} + D3DERR_MATRIX_DESTROY_FAILED = MAKE_DDHRESULT + 731; + {$EXTERNALSYM D3DERR_MATRIX_DESTROY_FAILED} + D3DERR_MATRIX_SETDATA_FAILED = MAKE_DDHRESULT + 732; + {$EXTERNALSYM D3DERR_MATRIX_SETDATA_FAILED} + D3DERR_MATRIX_GETDATA_FAILED = MAKE_DDHRESULT + 733; + {$EXTERNALSYM D3DERR_MATRIX_GETDATA_FAILED} + D3DERR_SETVIEWPORTDATA_FAILED = MAKE_DDHRESULT + 734; + {$EXTERNALSYM D3DERR_SETVIEWPORTDATA_FAILED} + +{$IFDEF DIRECT3D_VERSION_5} + D3DERR_INVALIDCURRENTVIEWPORT = MAKE_DDHRESULT + 735; + {$EXTERNALSYM D3DERR_INVALIDCURRENTVIEWPORT} + D3DERR_INVALIDPRIMITIVETYPE = MAKE_DDHRESULT + 736; + {$EXTERNALSYM D3DERR_INVALIDPRIMITIVETYPE} + D3DERR_INVALIDVERTEXTYPE = MAKE_DDHRESULT + 737; + {$EXTERNALSYM D3DERR_INVALIDVERTEXTYPE} + D3DERR_TEXTURE_BADSIZE = MAKE_DDHRESULT + 738; + {$EXTERNALSYM D3DERR_TEXTURE_BADSIZE} + D3DERR_INVALIDRAMPTEXTURE = MAKE_DDHRESULT + 739; + {$EXTERNALSYM D3DERR_INVALIDRAMPTEXTURE} +{$ENDIF} // DIRECT3D_VERSION_5 + + D3DERR_MATERIAL_CREATE_FAILED = MAKE_DDHRESULT + 740; + {$EXTERNALSYM D3DERR_MATERIAL_CREATE_FAILED} + D3DERR_MATERIAL_DESTROY_FAILED = MAKE_DDHRESULT + 741; + {$EXTERNALSYM D3DERR_MATERIAL_DESTROY_FAILED} + D3DERR_MATERIAL_SETDATA_FAILED = MAKE_DDHRESULT + 742; + {$EXTERNALSYM D3DERR_MATERIAL_SETDATA_FAILED} + D3DERR_MATERIAL_GETDATA_FAILED = MAKE_DDHRESULT + 743; + {$EXTERNALSYM D3DERR_MATERIAL_GETDATA_FAILED} + +{$IFDEF DIRECT3D_VERSION_5} + D3DERR_INVALIDPALETTE = MAKE_DDHRESULT + 744; + {$EXTERNALSYM D3DERR_INVALIDPALETTE} + + D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY = MAKE_DDHRESULT + 745; + {$EXTERNALSYM D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY} + D3DERR_ZBUFF_NEEDS_VIDEOMEMORY = MAKE_DDHRESULT + 746; + {$EXTERNALSYM D3DERR_ZBUFF_NEEDS_VIDEOMEMORY} + D3DERR_SURFACENOTINVIDMEM = MAKE_DDHRESULT + 747; + {$EXTERNALSYM D3DERR_SURFACENOTINVIDMEM} +{$ENDIF} // DIRECT3D_VERSION_5 + + D3DERR_LIGHT_SET_FAILED = MAKE_DDHRESULT + 750; + {$EXTERNALSYM D3DERR_LIGHT_SET_FAILED} +{$IFDEF DIRECT3D_VERSION_5} + D3DERR_LIGHTHASVIEWPORT = MAKE_DDHRESULT + 751; + {$EXTERNALSYM D3DERR_LIGHTHASVIEWPORT} + D3DERR_LIGHTNOTINTHISVIEWPORT = MAKE_DDHRESULT + 752; + {$EXTERNALSYM D3DERR_LIGHTNOTINTHISVIEWPORT} +{$ENDIF} // DIRECT3D_VERSION_5 + + D3DERR_SCENE_IN_SCENE = MAKE_DDHRESULT + 760; + {$EXTERNALSYM D3DERR_SCENE_IN_SCENE} + D3DERR_SCENE_NOT_IN_SCENE = MAKE_DDHRESULT + 761; + {$EXTERNALSYM D3DERR_SCENE_NOT_IN_SCENE} + D3DERR_SCENE_BEGIN_FAILED = MAKE_DDHRESULT + 762; + {$EXTERNALSYM D3DERR_SCENE_BEGIN_FAILED} + D3DERR_SCENE_END_FAILED = MAKE_DDHRESULT + 763; + {$EXTERNALSYM D3DERR_SCENE_END_FAILED} + +{$IFDEF DIRECT3D_VERSION_5} + D3DERR_INBEGIN = MAKE_DDHRESULT + 770; + {$EXTERNALSYM D3DERR_INBEGIN} + D3DERR_NOTINBEGIN = MAKE_DDHRESULT + 771; + {$EXTERNALSYM D3DERR_NOTINBEGIN} + D3DERR_NOVIEWPORTS = MAKE_DDHRESULT + 772; + {$EXTERNALSYM D3DERR_NOVIEWPORTS} + D3DERR_VIEWPORTDATANOTSET = MAKE_DDHRESULT + 773; + {$EXTERNALSYM D3DERR_VIEWPORTDATANOTSET} + D3DERR_VIEWPORTHASNODEVICE = MAKE_DDHRESULT + 774; + {$EXTERNALSYM D3DERR_VIEWPORTHASNODEVICE} + D3DERR_NOCURRENTVIEWPORT = MAKE_DDHRESULT + 775; + {$EXTERNALSYM D3DERR_NOCURRENTVIEWPORT} +{$ENDIF} // DIRECT3D_VERSION_5 + +{$IFDEF DIRECT3D_VERSION_6} + D3DERR_INVALIDVERTEXFORMAT = MAKE_DDHRESULT + 2048; + {$EXTERNALSYM D3DERR_INVALIDVERTEXFORMAT} + +(* + * Attempted to CreateTexture on a surface that had a color key + *) + D3DERR_COLORKEYATTACHED = MAKE_DDHRESULT + 2050; + {$EXTERNALSYM D3DERR_COLORKEYATTACHED} + + D3DERR_VERTEXBUFFEROPTIMIZED = MAKE_DDHRESULT + 2060; + {$EXTERNALSYM D3DERR_VERTEXBUFFEROPTIMIZED} + D3DERR_VBUF_CREATE_FAILED = MAKE_DDHRESULT + 2061; + {$EXTERNALSYM D3DERR_VBUF_CREATE_FAILED} + D3DERR_VERTEXBUFFERLOCKED = MAKE_DDHRESULT + 2062; + {$EXTERNALSYM D3DERR_VERTEXBUFFERLOCKED} + + D3DERR_ZBUFFER_NOTPRESENT = MAKE_DDHRESULT + 2070; + {$EXTERNALSYM D3DERR_ZBUFFER_NOTPRESENT} + D3DERR_STENCILBUFFER_NOTPRESENT = MAKE_DDHRESULT + 2071; + {$EXTERNALSYM D3DERR_STENCILBUFFER_NOTPRESENT} + + D3DERR_WRONGTEXTUREFORMAT = MAKE_DDHRESULT + 2072; + {$EXTERNALSYM D3DERR_WRONGTEXTUREFORMAT} + D3DERR_UNSUPPORTEDCOLOROPERATION = MAKE_DDHRESULT + 2073; + {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLOROPERATION} + D3DERR_UNSUPPORTEDCOLORARG = MAKE_DDHRESULT + 2074; + {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLORARG} + D3DERR_UNSUPPORTEDALPHAOPERATION = MAKE_DDHRESULT + 2075; + {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAOPERATION} + D3DERR_UNSUPPORTEDALPHAARG = MAKE_DDHRESULT + 2076; + {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAARG} + D3DERR_TOOMANYOPERATIONS = MAKE_DDHRESULT + 2077; + {$EXTERNALSYM D3DERR_TOOMANYOPERATIONS} + D3DERR_CONFLICTINGTEXTUREFILTER = MAKE_DDHRESULT + 2078; + {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREFILTER} + D3DERR_UNSUPPORTEDFACTORVALUE = MAKE_DDHRESULT + 2079; + {$EXTERNALSYM D3DERR_UNSUPPORTEDFACTORVALUE} + D3DERR_CONFLICTINGRENDERSTATE = MAKE_DDHRESULT + 2081; + {$EXTERNALSYM D3DERR_CONFLICTINGRENDERSTATE} + D3DERR_UNSUPPORTEDTEXTUREFILTER = MAKE_DDHRESULT + 2082; + {$EXTERNALSYM D3DERR_UNSUPPORTEDTEXTUREFILTER} + D3DERR_TOOMANYPRIMITIVES = MAKE_DDHRESULT + 2083; + {$EXTERNALSYM D3DERR_TOOMANYPRIMITIVES} + D3DERR_INVALIDMATRIX = MAKE_DDHRESULT + 2084; + {$EXTERNALSYM D3DERR_INVALIDMATRIX} + D3DERR_TOOMANYVERTICES = MAKE_DDHRESULT + 2085; + {$EXTERNALSYM D3DERR_TOOMANYVERTICES} + D3DERR_CONFLICTINGTEXTUREPALETTE = MAKE_DDHRESULT + 2086; + {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREPALETTE} + +{$ENDIF} // DIRECT3D_VERSION_6 + +{$IFDEF DIRECT3D_VERSION_7} + D3DERR_INVALIDSTATEBLOCK = MAKE_DDHRESULT + 2100; + {$EXTERNALSYM D3DERR_INVALIDSTATEBLOCK} + D3DERR_INBEGINSTATEBLOCK = MAKE_DDHRESULT + 2101; + {$EXTERNALSYM D3DERR_INBEGINSTATEBLOCK} + D3DERR_NOTINBEGINSTATEBLOCK = MAKE_DDHRESULT + 2102; + {$EXTERNALSYM D3DERR_NOTINBEGINSTATEBLOCK} +{$ENDIF} // DIRECT3D_VERSION_7 + +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + +procedure DisableFPUExceptions; +procedure EnableFPUExceptions; + +{$IFNDEF EXCLUDE_DXFILE_FROM_DIRECT3D} +(*************************************************************************** + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: dxfile.h + * + * Content: DirectX File public header file + * + ***************************************************************************) + +var + DXFileDLL : HMODULE; + +function DXFileErrorString(Value: HResult): string; + +type + TDXFileFormat = ( + DXFILEFORMAT_BINARY, + DXFILEFORMAT_TEXT, + DXFILEFORMAT_COMPRESSED + ); + + TDXFileLoadOptions = ( + DXFILELOAD_FROMFILE, + DXFILELOAD_FROMRESOURCE, + DXFILELOAD_FROMMEMORY, + DXFILELOAD_INVALID_3, + DXFILELOAD_FROMSTREAM, + DXFILELOAD_INVALID_5, + DXFILELOAD_INVALID_6, + DXFILELOAD_INVALID_7, + DXFILELOAD_FROMURL + ); + + PDXFileLoadResource = ^TDXFileLoadResource; + TDXFileLoadResource = packed record + hModule: HModule; + lpName: PAnsiChar; + lpType: PAnsiChar; + end; + + PDXFileLoadMemory = ^TDXFileLoadMemory; + TDXFileLoadMemory = packed record + lpMemory: Pointer; + dSize: DWORD; + end; + +(* + * DirectX File object types. + *) + + IDirectXFile = interface; + IDirectXFileEnumObject = interface; + IDirectXFileSaveObject = interface; + IDirectXFileObject = interface; + IDirectXFileData = interface; + IDirectXFileDataReference = interface; + IDirectXFileBinary = interface; + +(* + * DirectX File interfaces. + *) + + IDirectXFile = interface(IUnknown) + ['{3d82ab40-62da-11cf-ab39-0020af71e433}'] + function CreateEnumObject(pvSource: Pointer; + dwLoadOptions: TDXFileLoadOptions; + var ppEnumObj: IDirectXFileEnumObject): HResult; stdcall; + function CreateSaveObject(szFileName: PChar; dwFileFormat: TDXFileFormat; + var ppSaveObj: IDirectXFileSaveObject): HResult; stdcall; + function RegisterTemplates(pvData: Pointer; cbSize: DWORD): HResult; stdcall; + end; + + IDirectXFileEnumObject = interface(IUnknown) + ['{3d82ab41-62da-11cf-ab39-0020af71e433}'] + function GetNextDataObject(var ppDataObj: IDirectXFileData): HResult; stdcall; + function GetDataObjectById + (const rguid: TGUID; var ppDataObj: IDirectXFileData): HResult; stdcall; + function GetDataObjectByName + (szName: PChar; var ppDataObj: IDirectXFileData): HResult; stdcall; + end; + + IDirectXFileSaveObject = interface(IUnknown) + ['{3d82ab42-62da-11cf-ab39-0020af71e433}'] + function SaveTemplates + (cTemplates: DWORD; var ppguidTemplates: PGUID): HResult; stdcall; + function CreateDataObject(const rguidTemplate: TGUID; szName: PChar; + pguid: PGUID; cbSize: DWORD; pvData: Pointer; + var ppDataObj: IDirectXFileData): HResult; stdcall; + function SaveData(pDataObj: IDirectXFileData): HResult; stdcall; + end; + + IDirectXFileObject = interface(IUnknown) + ['{3d82ab43-62da-11cf-ab39-0020af71e433}'] + function GetName(pstrNameBuf: PChar; var dwBufLen: DWORD): HResult; stdcall; + function GetId(var pGuidBuf: TGUID): HResult; stdcall; + end; + + IDirectXFileData = interface(IDirectXFileObject) + ['{3d82ab44-62da-11cf-ab39-0020af71e433}'] + function GetData + (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer): HResult; stdcall; + function GetType(var ppguid: PGUID): HResult; stdcall; + function GetNextObject(var ppChildObj: IDirectXFileObject): HResult; stdcall; + function AddDataObject(pDataObj: IDirectXFileData): HResult; stdcall; + function AddDataReference(szRef: PChar; pguidRef: PGUID): HResult; stdcall; + function AddBinaryObject(szName: PChar; pguid: PGUID; szMimeType: PChar; + pvData: Pointer; cbSize: DWORD): HResult; stdcall; + end; + + IDirectXFileDataReference = interface(IDirectXFileObject) + ['{3d82ab45-62da-11cf-ab39-0020af71e433}'] + function Resolve(var ppDataObj: IDirectXFileData): HResult; stdcall; + end; + + IDirectXFileBinary = interface(IDirectXFileObject) + ['{3d82ab46-62da-11cf-ab39-0020af71e433}'] + function GetSize(var pcbSize: DWORD): HResult; stdcall; + function GetMimeType(var pszMimeType: PChar): HResult; stdcall; + function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}): HResult; stdcall; + end; + +const + +(* + * DirectXFile Object Class Id (for CoCreateInstance()) + *) + + CLSID_CDirectXFile: TGUID = + (D1:$4516ec43;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3)); + +(* + * DirectX File Interface GUIDs. + *) + +type + IID_IDirectXFile = IDirectXFile; + IID_IDirectXFileEnumObject = IDirectXFileEnumObject; + IID_IDirectXFileSaveObject = IDirectXFileSaveObject; + IID_IDirectXFileObject = IDirectXFileObject; + IID_IDirectXFileData = IDirectXFileData; + IID_IDirectXFileDataReference = IDirectXFileDataReference; + IID_IDirectXFileBinary = IDirectXFileBinary; + +(* + * DirectX File Header template's GUID. + *) +const + TID_DXFILEHeader: TGUID = + (D1:$3d82ab43;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33)); + +(* + * DirectX File errors. + *) + +const + DXFILE_OK = 0; + + DXFILEERR_BADOBJECT = MAKE_DDHRESULT or 850; + DXFILEERR_BADVALUE = MAKE_DDHRESULT or 851; + DXFILEERR_BADTYPE = MAKE_DDHRESULT or 852; + DXFILEERR_BADSTREAMHANDLE = MAKE_DDHRESULT or 853; + DXFILEERR_BADALLOC = MAKE_DDHRESULT or 854; + DXFILEERR_NOTFOUND = MAKE_DDHRESULT or 855; + DXFILEERR_NOTDONEYET = MAKE_DDHRESULT or 856; + DXFILEERR_FILENOTFOUND = MAKE_DDHRESULT or 857; + DXFILEERR_RESOURCENOTFOUND = MAKE_DDHRESULT or 858; + DXFILEERR_URLNOTFOUND = MAKE_DDHRESULT or 859; + DXFILEERR_BADRESOURCE = MAKE_DDHRESULT or 860; + DXFILEERR_BADFILETYPE = MAKE_DDHRESULT or 861; + DXFILEERR_BADFILEVERSION = MAKE_DDHRESULT or 862; + DXFILEERR_BADFILEFLOATSIZE = MAKE_DDHRESULT or 863; + DXFILEERR_BADFILECOMPRESSIONTYPE = MAKE_DDHRESULT or 864; + DXFILEERR_BADFILE = MAKE_DDHRESULT or 865; + DXFILEERR_PARSEERROR = MAKE_DDHRESULT or 866; + DXFILEERR_NOTEMPLATE = MAKE_DDHRESULT or 867; + DXFILEERR_BADARRAYSIZE = MAKE_DDHRESULT or 868; + DXFILEERR_BADDATAREFERENCE = MAKE_DDHRESULT or 869; + DXFILEERR_INTERNALERROR = MAKE_DDHRESULT or 870; + DXFILEERR_NOMOREOBJECTS = MAKE_DDHRESULT or 871; + DXFILEERR_BADINTRINSICS = MAKE_DDHRESULT or 872; + DXFILEERR_NOMORESTREAMHANDLES = MAKE_DDHRESULT or 873; + DXFILEERR_NOMOREDATA = MAKE_DDHRESULT or 874; + DXFILEERR_BADCACHEFILE = MAKE_DDHRESULT or 875; + DXFILEERR_NOINTERNET = MAKE_DDHRESULT or 876; + + +(* + * API for creating IDirectXFile interface. + *) + +var + DirectXFileCreate : function + (out lplpDirectXFile: IDirectXFile): HResult; stdcall; + +(* D3DRM XFile templates in binary form *) +const + D3DRM_XTEMPLATES: array [0..3214] of Byte = ( + $78, $6f, $66, $20, $30, $33, $30, $32, $62, + $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1, + 0, $6, 0, 0, 0, $48, $65, $61, $64, $65, + $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da, + $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, + $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d, + $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0, + $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14, + 0, $29, 0, $1, 0, $5, 0, 0, 0, $66, + $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0, + $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, + $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d, + $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, + $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0, + $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0, + 0, $79, $14, 0, $2a, 0, $1, 0, $1, 0, + 0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1, + 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, + $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2, + $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, + $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0, + 0, $75, $14, 0, $2a, 0, $1, 0, $1, 0, + 0, 0, $76, $14, 0, $b, 0, $1f, 0, $1, + 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69, + $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f, + $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, + $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0, + $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78, + $e, 0, $3, 0, $10, 0, 0, 0, $f, 0, + $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, + 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, + $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c, + $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, + $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, + $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0, + 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, + 0, $1, 0, $4, 0, 0, 0, $62, $6c, $75, + $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0, + 0, $61, $6c, $70, $68, $61, $14, 0, $b, 0, + $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, + $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0, + $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52, + 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, + $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a, + 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, + $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0, + 0, 0, $62, $6c, $75, $65, $14, 0, $b, 0, + $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e, + $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72, + $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78, + $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, + $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e, + $64, $65, $78, $14, 0, $1, 0, $9, 0, 0, + 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, + $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65, + $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0, + $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f, + $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0, + $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0, + $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9, + 0, 0, 0, $74, $72, $75, $65, $66, $61, $6c, + $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0, + $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, + $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85, + $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, + $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42, + $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, + 0, 0, $75, $14, 0, $1, 0, $7, 0, 0, + 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, + $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f, + 0, $1, 0, $c, 0, 0, 0, $4d, $61, $74, + $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a, + 0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf, + $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, + 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, + $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, + 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, + $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, + $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f, + 0, 0, 0, $54, $65, $78, $74, $75, $72, $65, + $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0, + $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11, + $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0, + $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65, + $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0, + $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65, + $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab, + $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, + $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0, + $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1, + 0, $9, 0, 0, 0, $66, $61, $63, $65, $43, + $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0, + $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14, + 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, + $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0, + 0, $73, $70, $65, $63, $75, $6c, $61, $72, $43, + $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0, + 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, + $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73, + $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14, + 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, + 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, + 0, $4d, $65, $73, $68, $46, $61, $63, $65, $a, + 0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf, + $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, + 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, + $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, + $64, $69, $63, $65, $73, $14, 0, $34, 0, $29, + 0, $1, 0, $11, 0, 0, 0, $66, $61, $63, + $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, + $69, $63, $65, $73, $e, 0, $1, 0, $12, 0, + 0, 0, $6e, $46, $61, $63, $65, $56, $65, $72, + $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, + $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, + $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61, + $63, $65, $57, $72, $61, $70, $73, $a, 0, $5, + 0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94, + $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, + 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, + $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, + $14, 0, $34, 0, $1, 0, $9, 0, 0, 0, + $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1, + 0, $e, 0, 0, 0, $66, $61, $63, $65, $57, + $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e, + 0, $1, 0, $f, 0, 0, 0, $6e, $46, $61, + $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, + $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, + $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68, + $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, + $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2, + $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, + $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0, + 0, $6e, $54, $65, $78, $74, $75, $72, $65, $43, + $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1, + 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, + $73, $32, $64, $1, 0, $d, 0, 0, 0, $74, + $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, + $64, $73, $e, 0, $1, 0, $e, 0, 0, 0, + $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, + $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0, + $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65, + $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c, + $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f, + $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, + $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0, + 0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61, + $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0, + 0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64, + $65, $78, $65, $73, $14, 0, $34, 0, $29, 0, + $1, 0, $b, 0, 0, 0, $66, $61, $63, $65, + $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1, + 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, + $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14, + 0, $e, 0, $1, 0, $8, 0, 0, 0, $4d, + $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b, + 0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d, + $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73, + $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76, + $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, + $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e, + $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, + $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, + $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f, + $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8, + 0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c, + $73, $f, 0, $14, 0, $29, 0, $1, 0, $c, + 0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f, + $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, + 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, + $61, $63, $65, $1, 0, $b, 0, 0, 0, $66, + $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, + $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, + $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, + $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, + $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65, + $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73, + $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78, + $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, + $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56, + $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, + $73, $14, 0, $34, 0, $1, 0, $c, 0, 0, + 0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f, + $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76, + $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, + $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e, + $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, + $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0, + $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68, + $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62, + $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, + $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56, + $65, $72, $74, $69, $63, $65, $73, $14, 0, $34, + 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, + $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76, + $65, $72, $74, $69, $63, $65, $73, $e, 0, $1, + 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, + $69, $63, $65, $73, $f, 0, $14, 0, $29, 0, + $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63, + $65, $73, $14, 0, $34, 0, $1, 0, $8, 0, + 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, + $1, 0, $5, 0, 0, 0, $66, $61, $63, $65, + $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e, + $46, $61, $63, $65, $73, $f, 0, $14, 0, $e, + 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, + 0, $1f, 0, $1, 0, $14, 0, 0, 0, $46, + $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66, + $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a, + 0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf, + $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, + 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69, + $78, $34, $78, $34, $1, 0, $b, 0, 0, 0, + $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69, + $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5, + 0, 0, 0, $46, $72, $61, $6d, $65, $a, 0, + $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11, + $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, + $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, + $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c, + $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5, + 0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f, + $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, + 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, + $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0, + $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73, + $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56, + $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b, + 0, $1f, 0, $1, 0, $e, 0, 0, 0, $54, + $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, + $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6, + $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33, + $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0, + 0, $74, $69, $6d, $65, $14, 0, $1, 0, $9, + 0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65, + $79, $73, $1, 0, $6, 0, 0, 0, $74, $66, + $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0, + $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d, + $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0, + $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11, + $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, + $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54, + $79, $70, $65, $14, 0, $29, 0, $1, 0, $5, + 0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0, + $34, 0, $1, 0, $e, 0, 0, 0, $54, $69, + $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65, + $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65, + $79, $73, $e, 0, $1, 0, $5, 0, 0, 0, + $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b, + 0, $1f, 0, $1, 0, $10, 0, 0, 0, $41, + $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70, + $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0, + $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0, + $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a, + 0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f, + $73, $65, $64, $14, 0, $29, 0, $1, 0, $f, + 0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f, + $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0, + $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, + $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a, + 0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf, + $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, + 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, + 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, + $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65, + $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da, + $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, + $33, $e, 0, $1, 0, $9, 0, 0, 0, $41, + $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0, + $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0, + $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, + $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94, + $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, + $e, 0, $1, 0, $6, 0, 0, 0, $42, $49, + $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0, + $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a, + 0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0, + $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, + 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, + $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0, + $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0, + $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, + $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, + 0, $f, 0, 0, 0, $50, $72, $6f, $67, $72, + $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68, + $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99, + $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, + $e, 0, $1, 0, $3, 0, 0, 0, $55, $72, + $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49, + $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f, + 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, + 0, $47, $75, $69, $64, $a, 0, $5, 0, $e0, + $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0, + $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, + 0, 0, 0, $64, $61, $74, $61, $31, $14, 0, + $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, + $74, $61, $32, $14, 0, $28, 0, $1, 0, $5, + 0, 0, 0, $64, $61, $74, $61, $33, $14, 0, + $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0, + $64, $61, $74, $61, $34, $e, 0, $3, 0, $8, + 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, + 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, + $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74, + $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1, + $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, + $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b, + $65, $79, $14, 0, $31, 0, $1, 0, $5, 0, + 0, 0, $76, $61, $6c, $75, $65, $14, 0, $b, + 0, $1f, 0, $1, 0, $b, 0, 0, 0, $50, + $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67, + $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf, + $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, + $e, 0, $1, 0, $e, 0, 0, 0, $53, $74, + $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72, + $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0, + $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e, + $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0, + $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11, + $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0, + $4, 0, 0, 0, $47, $75, $69, $64, $1, 0, + $12, 0, 0, 0, $67, $75, $69, $64, $45, $78, + $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75, + $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0, + $12, 0, $f, 0, $b, 0); +{$ENDIF} + +implementation + +{$IFDEF DIRECT3D_VERSION_LESS_8} +{$IFDEF DIRECT3D_VERSION_7} + +function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD): DWORD; +begin + Result := (D3DFVF_TEXTUREFORMAT3 shl (CoordIndex*2 + 16)); +end; + +function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD): DWORD; +begin + Result := (D3DFVF_TEXTUREFORMAT2); +end; + +function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD): DWORD; +begin + Result := (D3DFVF_TEXTUREFORMAT4 shl (CoordIndex*2 + 16)); +end; + +function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD): DWORD; +begin + Result := (D3DFVF_TEXTUREFORMAT1 shl (CoordIndex*2 + 16)); +end; + +{$ENDIF} // DIRECT3D_VERSION_7 +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + +function D3DVal(val: variant): Single; +begin + Result := val; +end; + +function D3DDivide(a, b: double): Single; +begin + Result := a / b; +end; + +function D3DMultiply(a, b: double): Single; +begin + Result := a * b; +end; + +// #define CI_GETALPHA(ci) ((ci) >> 24) +function CI_GETALPHA(ci: DWORD): DWORD; +begin + Result := ci shr 24; +end; + +// #define CI_GETINDEX(ci) (((ci) >> 8) & 0xffff) +function CI_GETINDEX(ci: DWORD): DWORD; +begin + Result := (ci shr 8) and $ffff; +end; + +// #define CI_GETFRACTION(ci) ((ci) & 0xff) +function CI_GETFRACTION(ci: DWORD): DWORD; +begin + Result := ci and $ff; +end; + +// #define CI_ROUNDINDEX(ci) CI_GETINDEX((ci) + 0x80) +function CI_ROUNDINDEX(ci: DWORD): DWORD; +begin + Result := CI_GETINDEX(ci + $80); +end; + +// #define CI_MASKALPHA(ci) ((ci) & 0xffffff) +function CI_MASKALPHA(ci: DWORD): DWORD; +begin + Result := ci and $ffffff; +end; + +// #define CI_MAKE(a, i, f) (((a) << 24) | ((i) << 8) | (f)) +function CI_MAKE(a,i,f: DWORD): DWORD; +begin + Result := (a shl 24) or (i shl 8) or f; +end; + +// #define RGBA_GETALPHA(rgb) ((rgb) >> 24) +function RGBA_GETALPHA(rgb: TD3DColor): DWORD; +begin + Result := rgb shr 24; +end; + +// #define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff) +function RGBA_GETRED(rgb: TD3DColor): DWORD; +begin + Result := (rgb shr 16) and $ff; +end; + +// #define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +function RGBA_GETGREEN(rgb: TD3DColor): DWORD; +begin + Result := (rgb shr 8) and $ff; +end; + +// #define RGBA_GETBLUE(rgb) ((rgb) & 0xff) +function RGBA_GETBLUE(rgb: TD3DColor): DWORD; +begin + Result := rgb and $ff; +end; + +// #define RGBA_MAKE(r, g, b, a) ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))) +function RGBA_MAKE(r, g, b, a: DWORD): TD3DColor; +begin + Result := (a shl 24) or (r shl 16) or (g shl 8) or b; +end; + +// #define D3DRGB(r, g, b) \ +// (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255)) +function D3DRGB(r, g, b: Single): TD3DColor; +begin + Result := $ff000000 or DWORD(Round(r * 255) shl 16) + or DWORD(Round(g * 255) shl 8) + or DWORD(Round(b * 255)); +end; + +// #define D3DRGBA(r, g, b, a) \ +// ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \ +// | (((long)((g) * 255)) << 8) | (long)((b) * 255) \ +// ) +function D3DRGBA(r, g, b, a: Single): TD3DColor; +begin + Result := DWORD(Round(a * 255) shl 24) or DWORD(Round(r * 255) shl 16) + or DWORD(Round(g * 255) shl 8) + or DWORD(Round(b * 255)); +end; + +// #define RGB_GETRED(rgb) (((rgb) >> 16) & 0xff) +function RGB_GETRED(rgb: TD3DColor): DWORD; +begin + Result := (rgb shr 16) and $ff; +end; + +// #define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +function RGB_GETGREEN(rgb: TD3DColor): DWORD; +begin + Result := (rgb shr 8) and $ff; +end; + +// #define RGB_GETBLUE(rgb) ((rgb) & 0xff) +function RGB_GETBLUE(rgb: TD3DColor): DWORD; +begin + Result := rgb and $ff; +end; + +// #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff)) +function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD): TD3DColor; +begin + Result := (x shl 24) or (rgba and $00ffffff); +end; + +// #define RGB_MAKE(r, g, b) ((TD3DColor) (((r) << 16) | ((g) << 8) | (b))) +function RGB_MAKE(r, g, b: DWORD): TD3DColor; +begin + Result := (r shl 16) or (g shl 8) or b; +end; + +// #define RGBA_TORGB(rgba) ((TD3DColor) ((rgba) & 0xffffff)) +function RGBA_TORGB(rgba: TD3DColor): TD3DColor; +begin + Result := rgba and $00ffffff; +end; + +// #define RGB_TORGBA(rgb) ((TD3DColor) ((rgb) | 0xff000000)) +function RGB_TORGBA(rgb: TD3DColor): TD3DColor; +begin + Result := rgb or $ff000000; +end; + + +function D3DSTATE_OVERRIDE(StateType: DWORD): DWORD; +begin + Result := StateType + D3DSTATE_OVERRIDE_BIAS; +end; + +function D3DTRIFLAG_STARTFLAT(len: DWORD): DWORD; +begin + if not (len in [1..29]) then len := 0; + Result := len; +end; + +// #define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y)) +function D3DRENDERSTATE_STIPPLEPATTERN(y: Integer): TD3DRenderStateType; +begin + Result := TD3DRenderStateType(Ord(D3DRENDERSTATE_STIPPLEPATTERN00) + y); +end; + + + + + // Addition and subtraction +function VectorAdd(const v1, v2: TD3DVector): TD3DVector; +begin + Result.x := v1.x+v2.x; + Result.y := v1.y+v2.y; + Result.z := v1.z+v2.z; +end; + +function VectorSub(const v1, v2: TD3DVector): TD3DVector; +begin + Result.x := v1.x-v2.x; + Result.y := v1.y-v2.y; + Result.z := v1.z-v2.z; +end; + + // Scalar multiplication and division +function VectorMulS(const v: TD3DVector; s: TD3DValue): TD3DVector; +begin + Result.x := v.x*s; + Result.y := v.y*s; + Result.z := v.z*s; +end; + +function VectorDivS(const v: TD3DVector; s: TD3DValue): TD3DVector; +begin + Result.x := v.x/s; + Result.y := v.y/s; + Result.z := v.z/s; +end; + + // Memberwise multiplication and division +function VectorMul(const v1, v2: TD3DVector): TD3DVector; +begin + Result.x := v1.x*v2.x; + Result.y := v1.y*v2.y; + Result.z := v1.z*v2.z; +end; + +function VectorDiv(const v1, v2: TD3DVector): TD3DVector; +begin + Result.x := v1.x/v2.x; + Result.y := v1.y/v2.y; + Result.z := v1.z/v2.z; +end; + + // Vector dominance +function VectorSmaller(v1, v2: TD3DVector): boolean; +begin + result := (v1.x < v2.x) and (v1.y < v2.y) and (v1.z < v2.z); +end; + +function VectorSmallerEqual(v1, v2: TD3DVector): boolean; +begin + result := (v1.x <= v2.x) and (v1.y <= v2.y) and (v1.z <= v2.z); +end; + + // Bitwise equality +function VectorEqual(v1, v2: TD3DVector): boolean; +begin + result := (v1.x = v2.x) and (v1.y = v2.y) and (v1.z = v2.z); +end; + + // Length-related functions +function VectorSquareMagnitude(v: TD3DVector): TD3DValue; +begin + result := (v.x*v.x) + (v.y*v.y) + (v.z*v.z); +end; + +function VectorMagnitude(v: TD3DVector): TD3DValue; +begin + result := sqrt((v.x*v.x) + (v.y*v.y) + (v.z*v.z)); +end; + + // Returns vector with same direction and unit length +function VectorNormalize(const v: TD3DVector): TD3DVector; +begin + result := VectorDivS(v,VectorMagnitude(v)); +end; + + // Return min/max component of the input vector +function VectorMin(v: TD3DVector): TD3DValue; +var + ret : TD3DValue; +begin + ret := v.x; + if (v.y < ret) then ret := v.y; + if (v.z < ret) then ret := v.z; + Result := ret; +end; + +function VectorMax(v: TD3DVector): TD3DValue; +var + ret : TD3DValue; +begin + ret := v.x; + if (ret < v.y) then ret := v.y; + if (ret < v.z) then ret := v.z; + Result := ret; +end; + + // Return memberwise min/max of input vectors +function VectorMinimize(const v1, v2: TD3DVector): TD3DVector; +begin + if v1.x < v2.x then Result.x := v1.x else Result.x := v2.x; + if v1.y < v2.y then Result.y := v1.y else Result.y := v2.y; + if v1.z < v2.z then Result.z := v1.z else Result.z := v2.z; +end; + +function VectorMaximize(const v1, v2: TD3DVector): TD3DVector; +begin + if v1.x > v2.x then Result.x := v1.x else Result.x := v2.x; + if v1.y > v2.y then Result.y := v1.y else Result.y := v2.y; + if v1.z > v2.z then Result.z := v1.z else Result.z := v2.z; +end; + + // Dot and cross product +function VectorDotProduct(v1, v2: TD3DVector): TD3DValue; +begin + Result := (v1.x*v2.x) + (v1.y * v2.y) + (v1.z*v2.z); +end; + +function VectorCrossProduct(const v1, v2: TD3DVector): TD3DVector; +begin + Result.x := (v1.y*v2.z) - (v1.z*v2.y); + Result.y := (v1.z*v2.x) - (v1.x*v2.z); + Result.z := (v1.x*v2.y) - (v1.y*v2.x); +end; + +procedure DisableFPUExceptions; +var + FPUControlWord: Word; +asm + FSTCW FPUControlWord; + OR FPUControlWord, $4 + $1; { Divide by zero + invalid operation } + FLDCW FPUControlWord; +end; + +procedure EnableFPUExceptions; +var + FPUControlWord: Word; +asm + FSTCW FPUControlWord; + AND FPUControlWord, $FFFF - $4 - $1; { Divide by zero + invalid operation } + FLDCW FPUControlWord; +end; + +{$IFDEF DIRECT3D_VERSION_LESS_8} +function D3DErrorString(Value: HResult): String; //Full description not available yet +begin + case Value of + D3D_OK: Result := 'No error'; + + D3DERR_BADMAJORVERSION: Result := 'D3DERR_BADMAJORVERSION'; + D3DERR_BADMINORVERSION: Result := 'D3DERR_BADMINORVERSION'; + + {$IFDEF DIRECT3D_VERSION_5} + D3DERR_INVALID_DEVICE: Result := 'D3DERR_INITFAILED'; + D3DERR_INITFAILED: Result := 'D3DERR_INITFAILED'; + + D3DERR_DEVICEAGGREGATED: Result := 'D3DERR_DEVICEAGGREGATED'; + {$ENDIF} // DIRECT3D_VERSION_5 + + D3DERR_EXECUTE_CREATE_FAILED: Result := 'D3DERR_EXECUTE_CREATE_FAILED'; + D3DERR_EXECUTE_DESTROY_FAILED: Result := 'D3DERR_EXECUTE_DESTROY_FAILED'; + D3DERR_EXECUTE_LOCK_FAILED: Result := 'D3DERR_EXECUTE_LOCK_FAILED'; + D3DERR_EXECUTE_UNLOCK_FAILED: Result := 'D3DERR_EXECUTE_UNLOCK_FAILED'; + D3DERR_EXECUTE_LOCKED: Result := 'D3DERR_EXECUTE_LOCKED'; + D3DERR_EXECUTE_NOT_LOCKED: Result := 'D3DERR_EXECUTE_NOT_LOCKED'; + + D3DERR_EXECUTE_FAILED: Result := 'D3DERR_EXECUTE_FAILED'; + D3DERR_EXECUTE_CLIPPED_FAILED: Result := 'D3DERR_EXECUTE_CLIPPED_FAILED'; + + D3DERR_TEXTURE_NO_SUPPORT: Result := 'D3DERR_TEXTURE_NO_SUPPORT'; + D3DERR_TEXTURE_CREATE_FAILED: Result := 'D3DERR_TEXTURE_CREATE_FAILED'; + D3DERR_TEXTURE_DESTROY_FAILED: Result := 'D3DERR_TEXTURE_DESTROY_FAILED'; + D3DERR_TEXTURE_LOCK_FAILED: Result := 'D3DERR_TEXTURE_LOCK_FAILED'; + D3DERR_TEXTURE_UNLOCK_FAILED: Result := 'D3DERR_TEXTURE_UNLOCK_FAILED'; + D3DERR_TEXTURE_LOAD_FAILED: Result := 'D3DERR_TEXTURE_LOAD_FAILED'; + D3DERR_TEXTURE_SWAP_FAILED: Result := 'D3DERR_TEXTURE_SWAP_FAILED'; + D3DERR_TEXTURE_LOCKED: Result := 'D3DERR_TEXTURELOCKED'; + D3DERR_TEXTURE_NOT_LOCKED: Result := 'D3DERR_TEXTURE_NOT_LOCKED'; + D3DERR_TEXTURE_GETSURF_FAILED: Result := 'D3DERR_TEXTURE_GETSURF_FAILED'; + + D3DERR_MATRIX_CREATE_FAILED: Result := 'D3DERR_MATRIX_CREATE_FAILED'; + D3DERR_MATRIX_DESTROY_FAILED: Result := 'D3DERR_MATRIX_DESTROY_FAILED'; + D3DERR_MATRIX_SETDATA_FAILED: Result := 'D3DERR_MATRIX_SETDATA_FAILED'; + D3DERR_MATRIX_GETDATA_FAILED: Result := 'D3DERR_MATRIX_GETDATA_FAILED'; + D3DERR_SETVIEWPORTDATA_FAILED: Result := 'D3DERR_SETVIEWPORTDATA_FAILED'; + + {$IFDEF DIRECT3D_VERSION_5} + D3DERR_INVALIDCURRENTVIEWPORT: Result := 'D3DERR_INVALIDCURRENTVIEWPORT'; + D3DERR_INVALIDPRIMITIVETYPE: Result := 'D3DERR_INVALIDPRIMITIVETYPE'; + D3DERR_INVALIDVERTEXTYPE: Result := 'D3DERR_INVALIDVERTEXTYPE'; + D3DERR_TEXTURE_BADSIZE: Result := 'D3DERR_TEXTURE_BADSIZE'; + D3DERR_INVALIDRAMPTEXTURE: Result := 'D3DERR_INVALIDRAMPTEXTURE'; + {$ENDIF} // DIRECT3D_VERSION_5 + + D3DERR_MATERIAL_CREATE_FAILED: Result := 'D3DERR_MATERIAL_CREATE_FAILED'; + D3DERR_MATERIAL_DESTROY_FAILED: Result := 'D3DERR_MATERIAL_DESTROY_FAILED'; + D3DERR_MATERIAL_SETDATA_FAILED: Result := 'D3DERR_MATERIAL_SETDATA_FAILED'; + D3DERR_MATERIAL_GETDATA_FAILED: Result := 'D3DERR_MATERIAL_GETDATA_FAILED'; + + {$IFDEF DIRECT3D_VERSION_5} + D3DERR_INVALIDPALETTE: Result := 'D3DERR_INVALIDPALETTE'; + + D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY: Result := 'D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY'; + D3DERR_ZBUFF_NEEDS_VIDEOMEMORY: Result := 'D3DERR_ZBUFF_NEEDS_VIDEOMEMORY'; + D3DERR_SURFACENOTINVIDMEM: Result := 'D3DERR_SURFACENOTINVIDMEM'; + {$ENDIF} // DIRECT3D_VERSION_5 + + D3DERR_LIGHT_SET_FAILED: Result := 'D3DERR_LIGHT_SET_FAILED'; + {$IFDEF DIRECT3D_VERSION_5} + D3DERR_LIGHTHASVIEWPORT: Result := 'D3DERR_LIGHTHASVIEWPORT'; + D3DERR_LIGHTNOTINTHISVIEWPORT: Result := 'D3DERR_LIGHTNOTINTHISVIEWPORT'; + {$ENDIF} // DIRECT3D_VERSION_5 + + D3DERR_SCENE_IN_SCENE: Result := 'D3DERR_SCENE_IN_SCENE'; + D3DERR_SCENE_NOT_IN_SCENE: Result := 'D3DERR_SCENE_NOT_IN_SCENE'; + D3DERR_SCENE_BEGIN_FAILED: Result := 'D3DERR_SCENE_BEGIN_FAILED'; + D3DERR_SCENE_END_FAILED: Result := 'D3DERR_SCENE_END_FAILED'; + + {$IFDEF DIRECT3D_VERSION_5} + D3DERR_INBEGIN: Result := 'D3DERR_INBEGIN'; + D3DERR_NOTINBEGIN: Result := 'D3DERR_NOTINBEGIN'; + D3DERR_NOVIEWPORTS: Result := 'D3DERR_NOVIEWPORTS'; + D3DERR_VIEWPORTDATANOTSET: Result := 'D3DERR_VIEWPORTDATANOTSET'; + D3DERR_VIEWPORTHASNODEVICE: Result := 'D3DERR_VIEWPORTHASNODEVICE'; + D3DERR_NOCURRENTVIEWPORT: Result := 'D3DERR_NOCURRENTVIEWPORT'; + {$ENDIF} // DIRECT3D_VERSION_5 + + {$IFDEF DIRECT3D_VERSION_6} + D3DERR_INVALIDVERTEXFORMAT: Result := 'D3DERR_INVALIDVERTEXFORMAT'; + + D3DERR_COLORKEYATTACHED: Result := 'D3DERR_COLORKEYATTACHED'; + + D3DERR_VERTEXBUFFEROPTIMIZED: Result := 'D3DERR_VERTEXBUFFEROPTIMIZED'; + D3DERR_VBUF_CREATE_FAILED: Result := 'D3DERR_VBUF_CREATE_FAILED'; + D3DERR_VERTEXBUFFERLOCKED: Result := 'D3DERR_VERTEXBUFFERLOCKED'; + + D3DERR_ZBUFFER_NOTPRESENT: Result := 'D3DERR_ZBUFFER_NOTPRESENT'; + D3DERR_STENCILBUFFER_NOTPRESENT: Result := 'D3DERR_STENCILBUFFER_NOTPRESENT'; + + D3DERR_WRONGTEXTUREFORMAT: Result := 'D3DERR_WRONGTEXTUREFORMAT'; + D3DERR_UNSUPPORTEDCOLOROPERATION: Result := 'D3DERR_UNSUPPORTEDCOLOROPERATION'; + D3DERR_UNSUPPORTEDCOLORARG: Result := 'D3DERR_UNSUPPORTEDCOLORARG'; + D3DERR_UNSUPPORTEDALPHAOPERATION: Result := 'D3DERR_UNSUPPORTEDALPHAOPERATION'; + D3DERR_UNSUPPORTEDALPHAARG: Result := 'D3DERR_UNSUPPORTEDALPHAARG'; + D3DERR_TOOMANYOPERATIONS: Result := 'D3DERR_TOOMANYOPERATIONS'; + D3DERR_CONFLICTINGTEXTUREFILTER: Result := 'D3DERR_CONFLICTINGTEXTUREFILTER'; + D3DERR_UNSUPPORTEDFACTORVALUE: Result := 'D3DERR_UNSUPPORTEDFACTORVALUE'; + + D3DERR_CONFLICTINGRENDERSTATE: Result := 'D3DERR_CONFLICTINGRENDERSTATE'; + D3DERR_UNSUPPORTEDTEXTUREFILTER: Result := 'D3DERR_UNSUPPORTEDTEXTUREFILTER'; + D3DERR_TOOMANYPRIMITIVES: Result := 'D3DERR_TOOMANYPRIMITIVES'; + D3DERR_INVALIDMATRIX: Result := 'D3DERR_INVALIDMATRIX'; + D3DERR_TOOMANYVERTICES: Result := 'D3DERR_TOOMANYVERTICES'; + D3DERR_CONFLICTINGTEXTUREPALETTE: Result := 'D3DERR_CONFLICTINGTEXTUREPALETTE'; + {$ENDIF} // DIRECT3D_VERSION_6 + + {$IFDEF DIRECT3D_VERSION_7} + D3DERR_INVALIDSTATEBLOCK: Result := 'D3DERR_INVALIDSTATEBLOCK'; + D3DERR_INBEGINSTATEBLOCK: Result := 'D3DERR_INBEGINSTATEBLOCK'; + D3DERR_NOTINBEGINSTATEBLOCK: Result := 'D3DERR_NOTINBEGINSTATEBLOCK'; + {$ENDIF} // DIRECT3D_VERSION_7 + + else Result := 'Unrecognized Error'; + end; +end; +{$ENDIF} // DIRECT3D_VERSION_LESS_8 + +{$IFNDEF EXCLUDE_DXFILE_FROM_DIRECT3D} + +function DXFileErrorString(Value: HResult): string; +begin + case Value of + DXFILE_OK: Result := 'Command completed successfully. Equivalent to DD_OK.'; + DXFILEERR_BADVALUE: Result := 'Parameter is invalid.'; + DXFILEERR_BADTYPE: Result := 'Object type is invalid.'; + DXFILEERR_BADALLOC: Result := 'Memory allocation failed.'; + DXFILEERR_NOTFOUND: Result := 'Object could not be found.'; + DXFILEERR_FILENOTFOUND: Result := 'File could not be found.'; + DXFILEERR_RESOURCENOTFOUND: Result := 'Resource could not be found.'; + DXFILEERR_URLNOTFOUND: Result := 'URL could not be found.'; + DXFILEERR_BADRESOURCE: Result := 'Resource is invalid.'; + DXFILEERR_BADFILETYPE: Result := 'File is not a DirectX file.'; + DXFILEERR_BADFILEVERSION: Result := 'File version is not valid.'; + DXFILEERR_BADFILEFLOATSIZE: Result := 'Floating-point size is invalid.'; + DXFILEERR_BADFILE: Result := 'File is invalid.'; + DXFILEERR_PARSEERROR: Result := 'File could not be parsed.'; + DXFILEERR_BADARRAYSIZE: Result := 'Array size is invalid.'; + DXFILEERR_BADDATAREFERENCE: Result := 'Data reference is invalid.'; + DXFILEERR_NOMOREOBJECTS: Result := 'All objects have been enumerated.'; + DXFILEERR_NOMOREDATA: Result := 'No further data is available.'; + else Result := 'Unrecognized Error'; + end; +end; + + +initialization +begin + DisableFPUExceptions; + DXFileDLL := LoadLibrary('D3DXOF.DLL'); + DirectXFileCreate := GetProcAddress(DXFileDLL,'DirectXFileCreate'); +end; + +finalization +begin + FreeLibrary(DXFileDLL); +end; + +{$ENDIF} +end. + diff --git a/Game/Code/lib/DSPack/DirectX9/Direct3D8.pas b/Game/Code/lib/DSPack/DirectX9/Direct3D8.pas new file mode 100644 index 00000000..da03d670 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/Direct3D8.pas @@ -0,0 +1,4256 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: d3d8types.h d3d8caps.h d3d8.h *} +{* Content: Direct3D8 include files *} +{* *} +{* DirectX 8.1 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 27-Apr-2003 *} +{* *} +{* Partly based upon : *} +{* DirectX 7.0 Object Pascal adaptation by *} +{* Erik Unger, e-Mail: DelphiDirectX@next-reality.com *} +{* DirectXGraphics 8.0 ObjectPascal adaptation by *} +{* Tim Baumgarten, e-Mail: ampaze@gmx.net *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{* This File contains only Direct3D 8.x definitions. *} +{* If you want to use older versions of D3D use Direct3D.pas from Erik Unger *} +{* *} +{******************************************************************************} +{ } +{ 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 Direct3D8; + +interface + +// Global level dynamic loading support +{$IFDEF DYNAMIC_LINK_ALL} + {$DEFINE DIRECT3D8_DYNAMIC_LINK} +{$ENDIF} +{$IFDEF DYNAMIC_LINK_EXPLICIT_ALL} + {$DEFINE DIRECT3D8_DYNAMIC_LINK_EXPLICIT} +{$ENDIF} + +// Remove "dots" below to force some kind of dynamic linking +{.$DEFINE DIRECT3D8_DYNAMIC_LINK} +{.$DEFINE DIRECT3D8_DYNAMIC_LINK_EXPLICIT} + +{$NOINCLUDE DXTypes} +(*$HPPEMIT '#include ' *) +(*$HPPEMIT '#include ' *) +(*$HPPEMIT '#include ' *) + +uses Windows, DXTypes; + +///// Helper constants (for use in SetRenderState) ///// +const + iTrue = DWORD(True); + iFalse = DWORD(False); + +(*==========================================================================; + * + * Copyright (C) 1995-2000 Microsoft Corporation. All Rights Reserved. + * + * File: d3d8types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************) + +type + // D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 + D3DCOLOR = DXTypes.D3DCOLOR; + {$EXTERNALSYM D3DCOLOR} + TD3DColor = DXTypes.TD3DColor; + {$NODEFINE TD3DColor} + {$HPPEMIT 'typedef D3DCOLOR 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; +{$EXTERNALSYM D3DCOLOR_ARGB} +// #define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +function D3DCOLOR_RGBA(r,g,b,a: DWord): TD3DColor; +{$EXTERNALSYM D3DCOLOR_RGBA} +// #define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) +function D3DCOLOR_XRGB(r,g,b: DWord): TD3DColor; +{$EXTERNALSYM D3DCOLOR_XRGB} + +// 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; +{$EXTERNALSYM D3DCOLOR_COLORVALUE} + +type + _D3DVECTOR = DXTypes._D3DVECTOR; + {$EXTERNALSYM _D3DVECTOR} + D3DVECTOR = DXTypes.D3DVECTOR; + {$EXTERNALSYM D3DVECTOR} + TD3DVector = DXTypes.TD3DVector; + {$NODEFINE TD3DVector} + PD3DVector = DXTypes.PD3DVector; + {$NODEFINE PD3DVector} + {$HPPEMIT 'typedef _D3DVECTOR TD3DVector;'} + {$HPPEMIT 'typedef _D3DVECTOR *PD3DVector;'} + + PD3DColorValue = ^TD3DColorValue; + _D3DCOLORVALUE = packed record + r: Single; + g: Single; + b: Single; + a: Single; + end {_D3DCOLORVALUE}; + {$EXTERNALSYM _D3DCOLORVALUE} + D3DCOLORVALUE = _D3DCOLORVALUE; + {$EXTERNALSYM D3DCOLORVALUE} + TD3DColorValue = _D3DCOLORVALUE; + + PD3DRect = ^TD3DRect; + _D3DRECT = packed record + x1: LongInt; + y1: LongInt; + x2: LongInt; + y2: LongInt; + end {_D3DRECT}; + {$EXTERNALSYM _D3DRECT} + D3DRECT = _D3DRECT; + {$EXTERNALSYM 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}; + {$EXTERNALSYM _D3DMATRIX} + D3DMATRIX = _D3DMATRIX; + {$EXTERNALSYM D3DMATRIX} + TD3DMatrix = _D3DMATRIX; + + PD3DViewport8 = ^TD3DViewport8; + _D3DVIEWPORT8 = 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 {_D3DVIEWPORT8}; + {$EXTERNALSYM _D3DVIEWPORT8} + D3DVIEWPORT8 = _D3DVIEWPORT8; + {$EXTERNALSYM D3DVIEWPORT8} + TD3DViewport8 = _D3DVIEWPORT8; + +(* + * Values for clip fields. + *) + +const + // Max number of user clipping planes, supported in D3D. + D3DMAXUSERCLIPPLANES = 32; + {$EXTERNALSYM D3DMAXUSERCLIPPLANES} + + // These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE + // + D3DCLIPPLANE0 = (1 shl 0); + {$EXTERNALSYM D3DCLIPPLANE0} + D3DCLIPPLANE1 = (1 shl 1); + {$EXTERNALSYM D3DCLIPPLANE1} + D3DCLIPPLANE2 = (1 shl 2); + {$EXTERNALSYM D3DCLIPPLANE2} + D3DCLIPPLANE3 = (1 shl 3); + {$EXTERNALSYM D3DCLIPPLANE3} + D3DCLIPPLANE4 = (1 shl 4); + {$EXTERNALSYM D3DCLIPPLANE4} + D3DCLIPPLANE5 = (1 shl 5); + {$EXTERNALSYM D3DCLIPPLANE5} + + // The following bits are used in the ClipUnion and ClipIntersection + // members of the D3DCLIPSTATUS8 + // + D3DCS_LEFT = $00000001; + {$EXTERNALSYM D3DCS_LEFT} + D3DCS_RIGHT = $00000002; + {$EXTERNALSYM D3DCS_RIGHT} + D3DCS_TOP = $00000004; + {$EXTERNALSYM D3DCS_TOP} + D3DCS_BOTTOM = $00000008; + {$EXTERNALSYM D3DCS_BOTTOM} + D3DCS_FRONT = $00000010; + {$EXTERNALSYM D3DCS_FRONT} + D3DCS_BACK = $00000020; + {$EXTERNALSYM D3DCS_BACK} + D3DCS_PLANE0 = $00000040; + {$EXTERNALSYM D3DCS_PLANE0} + D3DCS_PLANE1 = $00000080; + {$EXTERNALSYM D3DCS_PLANE1} + D3DCS_PLANE2 = $00000100; + {$EXTERNALSYM D3DCS_PLANE2} + D3DCS_PLANE3 = $00000200; + {$EXTERNALSYM D3DCS_PLANE3} + D3DCS_PLANE4 = $00000400; + {$EXTERNALSYM D3DCS_PLANE4} + D3DCS_PLANE5 = $00000800; + {$EXTERNALSYM D3DCS_PLANE5} + + 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; + {$EXTERNALSYM D3DCS_ALL} + +type + PD3DClipStatus8 = ^TD3DClipStatus8; + _D3DCLIPSTATUS8 = packed record + ClipUnion: DWord; + ClipIntersection: DWord; + end {_D3DCLIPSTATUS8}; + {$EXTERNALSYM _D3DCLIPSTATUS8} + D3DCLIPSTATUS8 = _D3DCLIPSTATUS8; + {$EXTERNALSYM D3DCLIPSTATUS8} + TD3DClipStatus8 = _D3DCLIPSTATUS8; + + PD3DMaterial8 = ^TD3DMaterial8; + _D3DMATERIAL8 = 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 {_D3DMATERIAL8}; + {$EXTERNALSYM _D3DMATERIAL8} + D3DMATERIAL8 = _D3DMATERIAL8; + {$EXTERNALSYM D3DMATERIAL8} + TD3DMaterial8 = _D3DMATERIAL8; + + _D3DLIGHTTYPE = ( + {$IFNDEF COMPILER6_UP} + D3DLIGHT_INVALID_0, {= 0} + D3DLIGHT_POINT, {= 1} + D3DLIGHT_SPOT, {= 2} + D3DLIGHT_DIRECTIONAL{= 3} + {$ELSE} + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3 + {$ENDIF} + ); + {$EXTERNALSYM _D3DLIGHTTYPE} + D3DLIGHTTYPE = _D3DLIGHTTYPE; + {$EXTERNALSYM D3DLIGHTTYPE} + TD3DLightType = _D3DLIGHTTYPE; + + PD3DLight8 = ^TD3DLight8; + _D3DLIGHT8 = 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 {_D3DLIGHT8}; + {$EXTERNALSYM _D3DLIGHT8} + D3DLIGHT8 = _D3DLIGHT8; + {$EXTERNALSYM D3DLIGHT8} + TD3DLight8 = _D3DLIGHT8; + +(* + * Options for clearing + *) +const + D3DCLEAR_TARGET = $00000001; { Clear target surface } + {$EXTERNALSYM D3DCLEAR_TARGET} + D3DCLEAR_ZBUFFER = $00000002; { Clear target z buffer } + {$EXTERNALSYM D3DCLEAR_ZBUFFER} + D3DCLEAR_STENCIL = $00000004; { Clear stencil planes } + {$EXTERNALSYM D3DCLEAR_STENCIL} + +(* + * The following defines the rendering states + *) +type + _D3DSHADEMODE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADEMODE} + D3DSHADEMODE = _D3DSHADEMODE; + {$EXTERNALSYM D3DSHADEMODE} + TD3DShadeMode = _D3DSHADEMODE; + +const + D3DSHADE_FLAT = 1; + {$EXTERNALSYM D3DSHADE_FLAT} + D3DSHADE_GOURAUD = 2; + {$EXTERNALSYM D3DSHADE_GOURAUD} + D3DSHADE_PHONG = 3; + {$EXTERNALSYM D3DSHADE_PHONG} + +type + _D3DFILLMODE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DFILLMODE} + D3DFILLMODE = _D3DFILLMODE; + {$EXTERNALSYM D3DFILLMODE} + TD3DFillMode = _D3DFILLMODE; + +const + D3DFILL_POINT = 1; + {$EXTERNALSYM D3DFILL_POINT} + D3DFILL_WIREFRAME = 2; + {$EXTERNALSYM D3DFILL_WIREFRAME} + D3DFILL_SOLID = 3; + {$EXTERNALSYM D3DFILL_SOLID} + +type + PD3DLinePattern = ^TD3DLinePattern; + _D3DLINEPATTERN = packed record + wRepeatFactor: Word; + wLinePattern: Word; + end {_D3DLINEPATTERN}; + {$EXTERNALSYM _D3DLINEPATTERN} + D3DLINEPATTERN = _D3DLINEPATTERN; + {$EXTERNALSYM D3DLINEPATTERN} + TD3DLinePattern = _D3DLINEPATTERN; + +type + _D3DBLEND = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DBLEND} + D3DBLEND = _D3DBLEND; + {$EXTERNALSYM D3DBLEND} + TD3DBlend = _D3DBLEND; + +const + D3DBLEND_ZERO = 1; + {$EXTERNALSYM D3DBLEND_ZERO} + D3DBLEND_ONE = 2; + {$EXTERNALSYM D3DBLEND_ONE} + D3DBLEND_SRCCOLOR = 3; + {$EXTERNALSYM D3DBLEND_SRCCOLOR} + D3DBLEND_INVSRCCOLOR = 4; + {$EXTERNALSYM D3DBLEND_INVSRCCOLOR} + D3DBLEND_SRCALPHA = 5; + {$EXTERNALSYM D3DBLEND_SRCALPHA} + D3DBLEND_INVSRCALPHA = 6; + {$EXTERNALSYM D3DBLEND_INVSRCALPHA} + D3DBLEND_DESTALPHA = 7; + {$EXTERNALSYM D3DBLEND_DESTALPHA} + D3DBLEND_INVDESTALPHA = 8; + {$EXTERNALSYM D3DBLEND_INVDESTALPHA} + D3DBLEND_DESTCOLOR = 9; + {$EXTERNALSYM D3DBLEND_DESTCOLOR} + D3DBLEND_INVDESTCOLOR = 10; + {$EXTERNALSYM D3DBLEND_INVDESTCOLOR} + D3DBLEND_SRCALPHASAT = 11; + {$EXTERNALSYM D3DBLEND_SRCALPHASAT} + D3DBLEND_BOTHSRCALPHA = 12; + {$EXTERNALSYM D3DBLEND_BOTHSRCALPHA} + D3DBLEND_BOTHINVSRCALPHA = 13; + {$EXTERNALSYM D3DBLEND_BOTHINVSRCALPHA} + +type + _D3DBLENDOP = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DBLENDOP} + D3DBLENDOP = _D3DBLENDOP; + {$EXTERNALSYM D3DBLENDOP} + TD3DBlendOp = _D3DBLENDOP; + +const + D3DBLENDOP_ADD = 1; + {$EXTERNALSYM D3DBLENDOP_ADD} + D3DBLENDOP_SUBTRACT = 2; + {$EXTERNALSYM D3DBLENDOP_SUBTRACT} + D3DBLENDOP_REVSUBTRACT = 3; + {$EXTERNALSYM D3DBLENDOP_REVSUBTRACT} + D3DBLENDOP_MIN = 4; + {$EXTERNALSYM D3DBLENDOP_MIN} + D3DBLENDOP_MAX = 5; + {$EXTERNALSYM D3DBLENDOP_MAX} + +type + _D3DTEXTUREADDRESS = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DTEXTUREADDRESS} + D3DTEXTUREADDRESS = _D3DTEXTUREADDRESS; + {$EXTERNALSYM D3DTEXTUREADDRESS} + TD3DTextureAddress = _D3DTEXTUREADDRESS; + +const + D3DTADDRESS_WRAP = 1; + {$EXTERNALSYM D3DTADDRESS_WRAP} + D3DTADDRESS_MIRROR = 2; + {$EXTERNALSYM D3DTADDRESS_MIRROR} + D3DTADDRESS_CLAMP = 3; + {$EXTERNALSYM D3DTADDRESS_CLAMP} + D3DTADDRESS_BORDER = 4; + {$EXTERNALSYM D3DTADDRESS_BORDER} + D3DTADDRESS_MIRRORONCE = 5; + {$EXTERNALSYM D3DTADDRESS_MIRRORONCE} + +type + _D3DCULL = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DCULL} + D3DCULL = _D3DCULL; + {$EXTERNALSYM D3DCULL} + TD3DCull = _D3DCULL; + +const + D3DCULL_NONE = 1; + {$EXTERNALSYM D3DCULL_NONE} + D3DCULL_CW = 2; + {$EXTERNALSYM D3DCULL_CW} + D3DCULL_CCW = 3; + {$EXTERNALSYM D3DCULL_CCW} + +type + _D3DCMPFUNC = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DCMPFUNC} + D3DCMPFUNC = _D3DCMPFUNC; + {$EXTERNALSYM D3DCMPFUNC} + TD3DCmpFunc = _D3DCMPFUNC; + +const + D3DCMP_NEVER = 1; + {$EXTERNALSYM D3DCMP_NEVER} + D3DCMP_LESS = 2; + {$EXTERNALSYM D3DCMP_LESS} + D3DCMP_EQUAL = 3; + {$EXTERNALSYM D3DCMP_EQUAL} + D3DCMP_LESSEQUAL = 4; + {$EXTERNALSYM D3DCMP_LESSEQUAL} + D3DCMP_GREATER = 5; + {$EXTERNALSYM D3DCMP_GREATER} + D3DCMP_NOTEQUAL = 6; + {$EXTERNALSYM D3DCMP_NOTEQUAL} + D3DCMP_GREATEREQUAL = 7; + {$EXTERNALSYM D3DCMP_GREATEREQUAL} + D3DCMP_ALWAYS = 8; + {$EXTERNALSYM D3DCMP_ALWAYS} + +type + _D3DSTENCILOP = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSTENCILOP} + D3DSTENCILOP = _D3DSTENCILOP; + {$EXTERNALSYM D3DSTENCILOP} + TD3DStencilOp = _D3DSTENCILOP; + +const + D3DSTENCILOP_KEEP = 1; + {$EXTERNALSYM D3DSTENCILOP_KEEP} + D3DSTENCILOP_ZERO = 2; + {$EXTERNALSYM D3DSTENCILOP_ZERO} + D3DSTENCILOP_REPLACE = 3; + {$EXTERNALSYM D3DSTENCILOP_REPLACE} + D3DSTENCILOP_INCRSAT = 4; + {$EXTERNALSYM D3DSTENCILOP_INCRSAT} + D3DSTENCILOP_DECRSAT = 5; + {$EXTERNALSYM D3DSTENCILOP_DECRSAT} + D3DSTENCILOP_INVERT = 6; + {$EXTERNALSYM D3DSTENCILOP_INVERT} + D3DSTENCILOP_INCR = 7; + {$EXTERNALSYM D3DSTENCILOP_INCR} + D3DSTENCILOP_DECR = 8; + {$EXTERNALSYM D3DSTENCILOP_DECR} + +type + _D3DFOGMODE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DFOGMODE} + D3DFOGMODE = _D3DFOGMODE; + {$EXTERNALSYM D3DFOGMODE} + TD3DFogMode = _D3DFOGMODE; + +const + D3DFOG_NONE = 0; + {$EXTERNALSYM D3DFOG_NONE} + D3DFOG_EXP = 1; + {$EXTERNALSYM D3DFOG_EXP} + D3DFOG_EXP2 = 2; + {$EXTERNALSYM D3DFOG_EXP2} + D3DFOG_LINEAR = 3; + {$EXTERNALSYM D3DFOG_LINEAR} + +type + _D3DZBUFFERTYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DZBUFFERTYPE} + D3DZBUFFERTYPE = _D3DZBUFFERTYPE; + {$EXTERNALSYM D3DZBUFFERTYPE} + TD3DZBufferType = _D3DZBUFFERTYPE; + +const + D3DZB_FALSE = 0; + {$EXTERNALSYM D3DZB_FALSE} + D3DZB_TRUE = 1; + {$EXTERNALSYM D3DZB_TRUE} + D3DZB_USEW = 2; + {$EXTERNALSYM D3DZB_USEW} + +type + // Primitives supported by draw-primitive API + _D3DPRIMITIVETYPE = ( + {$IFNDEF COMPILER6_UP} + D3DPT_INVALID_0 {= 0}, + D3DPT_POINTLIST {= 1}, + D3DPT_LINELIST {= 2}, + D3DPT_LINESTRIP {= 3}, + D3DPT_TRIANGLELIST {= 4}, + D3DPT_TRIANGLESTRIP{= 5}, + D3DPT_TRIANGLEFAN {= 6} + {$ELSE} + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6 + {$ENDIF} + ); + {$EXTERNALSYM _D3DPRIMITIVETYPE} + D3DPRIMITIVETYPE = _D3DPRIMITIVETYPE; + {$EXTERNALSYM D3DPRIMITIVETYPE} + TD3DPrimitiveType = _D3DPRIMITIVETYPE; + +{$IFNDEF COMPILER6_UP} +const + D3DTS_VIEW = 2; + {$EXTERNALSYM D3DTS_VIEW} + D3DTS_PROJECTION = 3; + {$EXTERNALSYM D3DTS_PROJECTION} + D3DTS_TEXTURE0 = 16; + {$EXTERNALSYM D3DTS_TEXTURE0} + D3DTS_TEXTURE1 = 17; + {$EXTERNALSYM D3DTS_TEXTURE1} + D3DTS_TEXTURE2 = 18; + {$EXTERNALSYM D3DTS_TEXTURE2} + D3DTS_TEXTURE3 = 19; + {$EXTERNALSYM D3DTS_TEXTURE3} + D3DTS_TEXTURE4 = 20; + {$EXTERNALSYM D3DTS_TEXTURE4} + D3DTS_TEXTURE5 = 21; + {$EXTERNALSYM D3DTS_TEXTURE5} + D3DTS_TEXTURE6 = 22; + {$EXTERNALSYM D3DTS_TEXTURE6} + D3DTS_TEXTURE7 = 23; + {$EXTERNALSYM D3DTS_TEXTURE7} + D3DTS_FORCE_DWORD = $7fffffff; (* force 32-bit size enum *) + {$EXTERNALSYM D3DTS_FORCE_DWORD} + +type + _D3DTRANSFORMSTATETYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; +{$ELSE} +type + _D3DTRANSFORMSTATETYPE = ( + {$IFDEF BCB} + D3DTS_DUMMY + {$ELSE} + 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 *) + {$ENDIF} + ); +{$ENDIF} + {$EXTERNALSYM _D3DTRANSFORMSTATETYPE} + D3DTRANSFORMSTATETYPE = _D3DTRANSFORMSTATETYPE; + {$EXTERNALSYM D3DTRANSFORMSTATETYPE} + TD3DTransformStateType = _D3DTRANSFORMSTATETYPE; + +// #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +function D3DTS_WORLDMATRIX(index: Byte): TD3DTransformStateType; +{$EXTERNALSYM D3DTS_WORLDMATRIX} + +const + D3DTS_WORLD = TD3DTransformStateType(0 + 256); // #define D3DTS_WORLD D3DTS_WORLDMATRIX(0) + {$EXTERNALSYM D3DTS_WORLD} + D3DTS_WORLD1 = TD3DTransformStateType(1 + 256); // #define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) + {$EXTERNALSYM D3DTS_WORLD1} + D3DTS_WORLD2 = TD3DTransformStateType(2 + 256); // #define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) + {$EXTERNALSYM D3DTS_WORLD2} + D3DTS_WORLD3 = TD3DTransformStateType(3 + 256); // #define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + {$EXTERNALSYM D3DTS_WORLD3} + +{$IFNDEF COMPILER6_UP} +type + _D3DRENDERSTATETYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DRENDERSTATETYPE} + D3DRENDERSTATETYPE = _D3DRENDERSTATETYPE; + {$EXTERNALSYM D3DRENDERSTATETYPE} + TD3DRenderStateType = _D3DRENDERSTATETYPE; + +const + D3DRS_ZENABLE = TD3DRenderStateType(7); { D3DZBUFFERTYPE (or TRUE/FALSE for legacy) } + {$EXTERNALSYM D3DRS_ZENABLE} + D3DRS_FILLMODE = TD3DRenderStateType(8); { D3DFILLMODE } + {$EXTERNALSYM D3DRS_FILLMODE} + D3DRS_SHADEMODE = TD3DRenderStateType(9); { D3DSHADEMODE } + {$EXTERNALSYM D3DRS_SHADEMODE} + D3DRS_LINEPATTERN = TD3DRenderStateType(10); { D3DLINEPATTERN } + {$EXTERNALSYM D3DRS_LINEPATTERN} + D3DRS_ZWRITEENABLE = TD3DRenderStateType(14); { TRUE to enable z writes } + {$EXTERNALSYM D3DRS_ZWRITEENABLE} + D3DRS_ALPHATESTENABLE = TD3DRenderStateType(15); { TRUE to enable alpha tests } + {$EXTERNALSYM D3DRS_ALPHATESTENABLE} + D3DRS_LASTPIXEL = TD3DRenderStateType(16); { TRUE for last-pixel on lines } + {$EXTERNALSYM D3DRS_LASTPIXEL} + D3DRS_SRCBLEND = TD3DRenderStateType(19); { D3DBLEND } + {$EXTERNALSYM D3DRS_SRCBLEND} + D3DRS_DESTBLEND = TD3DRenderStateType(20); { D3DBLEND } + {$EXTERNALSYM D3DRS_DESTBLEND} + D3DRS_CULLMODE = TD3DRenderStateType(22); { D3DCULL } + {$EXTERNALSYM D3DRS_CULLMODE} + D3DRS_ZFUNC = TD3DRenderStateType(23); { D3DCMPFUNC } + {$EXTERNALSYM D3DRS_ZFUNC} + D3DRS_ALPHAREF = TD3DRenderStateType(24); { D3DFIXED } + {$EXTERNALSYM D3DRS_ALPHAREF} + D3DRS_ALPHAFUNC = TD3DRenderStateType(25); { D3DCMPFUNC } + {$EXTERNALSYM D3DRS_ALPHAFUNC} + D3DRS_DITHERENABLE = TD3DRenderStateType(26); { TRUE to enable dithering } + {$EXTERNALSYM D3DRS_DITHERENABLE} + D3DRS_ALPHABLENDENABLE = TD3DRenderStateType(27); { TRUE to enable alpha blending } + {$EXTERNALSYM D3DRS_ALPHABLENDENABLE} + D3DRS_FOGENABLE = TD3DRenderStateType(28); { TRUE to enable fog blending } + {$EXTERNALSYM D3DRS_FOGENABLE} + D3DRS_SPECULARENABLE = TD3DRenderStateType(29); { TRUE to enable specular } + {$EXTERNALSYM D3DRS_SPECULARENABLE} + D3DRS_ZVISIBLE = TD3DRenderStateType(30); { TRUE to enable z checking } + {$EXTERNALSYM D3DRS_ZVISIBLE} + D3DRS_FOGCOLOR = TD3DRenderStateType(34); { D3DCOLOR } + {$EXTERNALSYM D3DRS_FOGCOLOR} + D3DRS_FOGTABLEMODE = TD3DRenderStateType(35); { D3DFOGMODE } + {$EXTERNALSYM D3DRS_FOGTABLEMODE} + D3DRS_FOGSTART = TD3DRenderStateType(36); { Fog start (for both vertex and pixel fog) } + {$EXTERNALSYM D3DRS_FOGSTART} + D3DRS_FOGEND = TD3DRenderStateType(37); { Fog end } + {$EXTERNALSYM D3DRS_FOGEND} + D3DRS_FOGDENSITY = TD3DRenderStateType(38); { Fog density } + {$EXTERNALSYM D3DRS_FOGDENSITY} + D3DRS_EDGEANTIALIAS = TD3DRenderStateType(40); { TRUE to enable edge antialiasing } + {$EXTERNALSYM D3DRS_EDGEANTIALIAS} + D3DRS_ZBIAS = TD3DRenderStateType(47); { LONG Z bias } + {$EXTERNALSYM D3DRS_ZBIAS} + D3DRS_RANGEFOGENABLE = TD3DRenderStateType(48); { Enables range-based fog } + {$EXTERNALSYM D3DRS_RANGEFOGENABLE} + D3DRS_STENCILENABLE = TD3DRenderStateType(52); { BOOL enable/disable stenciling } + {$EXTERNALSYM D3DRS_STENCILENABLE} + D3DRS_STENCILFAIL = TD3DRenderStateType(53); { D3DSTENCILOP to do if stencil test fails } + {$EXTERNALSYM D3DRS_STENCILFAIL} + D3DRS_STENCILZFAIL = TD3DRenderStateType(54); { D3DSTENCILOP to do if stencil test passes and Z test fails } + {$EXTERNALSYM D3DRS_STENCILZFAIL} + D3DRS_STENCILPASS = TD3DRenderStateType(55); { D3DSTENCILOP to do if both stencil and Z tests pass } + {$EXTERNALSYM D3DRS_STENCILPASS} + D3DRS_STENCILFUNC = TD3DRenderStateType(56); { D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true } + {$EXTERNALSYM D3DRS_STENCILFUNC} + D3DRS_STENCILREF = TD3DRenderStateType(57); { Reference value used in stencil test } + {$EXTERNALSYM D3DRS_STENCILREF} + D3DRS_STENCILMASK = TD3DRenderStateType(58); { Mask value used in stencil test } + {$EXTERNALSYM D3DRS_STENCILMASK} + D3DRS_STENCILWRITEMASK = TD3DRenderStateType(59); { Write mask applied to values written to stencil buffer } + {$EXTERNALSYM D3DRS_STENCILWRITEMASK} + D3DRS_TEXTUREFACTOR = TD3DRenderStateType(60); { D3DCOLOR used for multi-texture blend } + {$EXTERNALSYM D3DRS_TEXTUREFACTOR} + D3DRS_WRAP0 = TD3DRenderStateType(128); { wrap for 1st texture coord. set } + {$EXTERNALSYM D3DRS_WRAP0} + D3DRS_WRAP1 = TD3DRenderStateType(129); { wrap for 2nd texture coord. set } + {$EXTERNALSYM D3DRS_WRAP1} + D3DRS_WRAP2 = TD3DRenderStateType(130); { wrap for 3rd texture coord. set } + {$EXTERNALSYM D3DRS_WRAP2} + D3DRS_WRAP3 = TD3DRenderStateType(131); { wrap for 4th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP3} + D3DRS_WRAP4 = TD3DRenderStateType(132); { wrap for 5th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP4} + D3DRS_WRAP5 = TD3DRenderStateType(133); { wrap for 6th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP5} + D3DRS_WRAP6 = TD3DRenderStateType(134); { wrap for 7th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP6} + D3DRS_WRAP7 = TD3DRenderStateType(135); { wrap for 8th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP7} + D3DRS_CLIPPING = TD3DRenderStateType(136); + {$EXTERNALSYM D3DRS_CLIPPING} + D3DRS_LIGHTING = TD3DRenderStateType(137); + {$EXTERNALSYM D3DRS_LIGHTING} + D3DRS_AMBIENT = TD3DRenderStateType(139); + {$EXTERNALSYM D3DRS_AMBIENT} + D3DRS_FOGVERTEXMODE = TD3DRenderStateType(140); + {$EXTERNALSYM D3DRS_FOGVERTEXMODE} + D3DRS_COLORVERTEX = TD3DRenderStateType(141); + {$EXTERNALSYM D3DRS_COLORVERTEX} + D3DRS_LOCALVIEWER = TD3DRenderStateType(142); + {$EXTERNALSYM D3DRS_LOCALVIEWER} + D3DRS_NORMALIZENORMALS = TD3DRenderStateType(143); + {$EXTERNALSYM D3DRS_NORMALIZENORMALS} + D3DRS_DIFFUSEMATERIALSOURCE = TD3DRenderStateType(145); + {$EXTERNALSYM D3DRS_DIFFUSEMATERIALSOURCE} + D3DRS_SPECULARMATERIALSOURCE = TD3DRenderStateType(146); + {$EXTERNALSYM D3DRS_SPECULARMATERIALSOURCE} + D3DRS_AMBIENTMATERIALSOURCE = TD3DRenderStateType(147); + {$EXTERNALSYM D3DRS_AMBIENTMATERIALSOURCE} + D3DRS_EMISSIVEMATERIALSOURCE = TD3DRenderStateType(148); + {$EXTERNALSYM D3DRS_EMISSIVEMATERIALSOURCE} + D3DRS_VERTEXBLEND = TD3DRenderStateType(151); + {$EXTERNALSYM D3DRS_VERTEXBLEND} + D3DRS_CLIPPLANEENABLE = TD3DRenderStateType(152); + {$EXTERNALSYM D3DRS_CLIPPLANEENABLE} + D3DRS_SOFTWAREVERTEXPROCESSING = TD3DRenderStateType(153); + {$EXTERNALSYM D3DRS_SOFTWAREVERTEXPROCESSING} + D3DRS_POINTSIZE = TD3DRenderStateType(154); { float point size } + {$EXTERNALSYM D3DRS_POINTSIZE} + D3DRS_POINTSIZE_MIN = TD3DRenderStateType(155); { float point size min threshold } + {$EXTERNALSYM D3DRS_POINTSIZE_MIN} + D3DRS_POINTSPRITEENABLE = TD3DRenderStateType(156); { BOOL point texture coord control } + {$EXTERNALSYM D3DRS_POINTSPRITEENABLE} + D3DRS_POINTSCALEENABLE = TD3DRenderStateType(157); { BOOL point size scale enable } + {$EXTERNALSYM D3DRS_POINTSCALEENABLE} + D3DRS_POINTSCALE_A = TD3DRenderStateType(158); { float point attenuation A value } + {$EXTERNALSYM D3DRS_POINTSCALE_A} + D3DRS_POINTSCALE_B = TD3DRenderStateType(159); { float point attenuation B value } + {$EXTERNALSYM D3DRS_POINTSCALE_B} + D3DRS_POINTSCALE_C = TD3DRenderStateType(160); { float point attenuation C value } + {$EXTERNALSYM D3DRS_POINTSCALE_C} + D3DRS_MULTISAMPLEANTIALIAS = TD3DRenderStateType(161); // BOOL - set to do FSAA with multisample buffer + {$EXTERNALSYM D3DRS_MULTISAMPLEANTIALIAS} + D3DRS_MULTISAMPLEMASK = TD3DRenderStateType(162); // DWORD - per-sample enable/disable + {$EXTERNALSYM D3DRS_MULTISAMPLEMASK} + D3DRS_PATCHEDGESTYLE = TD3DRenderStateType(163); // Sets whether patch edges will use float style tessellation + {$EXTERNALSYM D3DRS_PATCHEDGESTYLE} + D3DRS_PATCHSEGMENTS = TD3DRenderStateType(164); // Number of segments per edge when drawing patches + {$EXTERNALSYM D3DRS_PATCHSEGMENTS} + D3DRS_DEBUGMONITORTOKEN = TD3DRenderStateType(165); // DEBUG ONLY - token to debug monitor + {$EXTERNALSYM D3DRS_DEBUGMONITORTOKEN} + D3DRS_POINTSIZE_MAX = TD3DRenderStateType(166); { float point size max threshold } + {$EXTERNALSYM D3DRS_POINTSIZE_MAX} + D3DRS_INDEXEDVERTEXBLENDENABLE = TD3DRenderStateType(167); + {$EXTERNALSYM D3DRS_INDEXEDVERTEXBLENDENABLE} + D3DRS_COLORWRITEENABLE = TD3DRenderStateType(168); // per-channel write enable + {$EXTERNALSYM D3DRS_COLORWRITEENABLE} + D3DRS_TWEENFACTOR = TD3DRenderStateType(170); // float tween factor + {$EXTERNALSYM D3DRS_TWEENFACTOR} + D3DRS_BLENDOP = TD3DRenderStateType(171); // D3DBLENDOP setting + {$EXTERNALSYM D3DRS_BLENDOP} + D3DRS_POSITIONORDER = TD3DRenderStateType(172); // NPatch position interpolation order. D3DORDER_LINEAR or D3DORDER_CUBIC (default) + {$EXTERNALSYM D3DRS_POSITIONORDER} + D3DRS_NORMALORDER = TD3DRenderStateType(173); // NPatch normal interpolation order. D3DORDER_LINEAR (default) or D3DORDER_QUADRATIC + {$EXTERNALSYM D3DRS_NORMALORDER} + + D3DRS_FORCE_DWORD = TD3DRenderStateType($7fffffff); { force 32-bit size enum } + {$EXTERNALSYM D3DRS_FORCE_DWORD} +{$ELSE} +type + _D3DRENDERSTATETYPE = ( + {$IFDEF BCB} + D3DRS_DUMMY + {$ELSE} + D3DRS_ZENABLE = 7, (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *) + D3DRS_FILLMODE = 8, (* D3DFILLMODE *) + D3DRS_SHADEMODE = 9, (* D3DSHADEMODE *) + D3DRS_LINEPATTERN = 10, (* D3DLINEPATTERN *) + D3DRS_ZWRITEENABLE = 14, (* TRUE to enable z writes *) + D3DRS_ALPHATESTENABLE = 15, (* TRUE to enable alpha tests *) + D3DRS_LASTPIXEL = 16, (* TRUE for last-pixel on lines *) + D3DRS_SRCBLEND = 19, (* D3DBLEND *) + D3DRS_DESTBLEND = 20, (* D3DBLEND *) + D3DRS_CULLMODE = 22, (* D3DCULL *) + D3DRS_ZFUNC = 23, (* D3DCMPFUNC *) + D3DRS_ALPHAREF = 24, (* D3DFIXED *) + D3DRS_ALPHAFUNC = 25, (* D3DCMPFUNC *) + D3DRS_DITHERENABLE = 26, (* TRUE to enable dithering *) + D3DRS_ALPHABLENDENABLE = 27, (* TRUE to enable alpha blending *) + D3DRS_FOGENABLE = 28, (* TRUE to enable fog blending *) + D3DRS_SPECULARENABLE = 29, (* TRUE to enable specular *) + D3DRS_ZVISIBLE = 30, (* TRUE to enable z checking *) + D3DRS_FOGCOLOR = 34, (* D3DCOLOR *) + D3DRS_FOGTABLEMODE = 35, (* D3DFOGMODE *) + D3DRS_FOGSTART = 36, (* Fog start (for both vertex and pixel fog) *) + D3DRS_FOGEND = 37, (* Fog end *) + D3DRS_FOGDENSITY = 38, (* Fog density *) + D3DRS_EDGEANTIALIAS = 40, (* TRUE to enable edge antialiasing *) + D3DRS_ZBIAS = 47, (* LONG Z bias *) + D3DRS_RANGEFOGENABLE = 48, (* Enables range-based fog *) + D3DRS_STENCILENABLE = 52, (* BOOL enable/disable stenciling *) + D3DRS_STENCILFAIL = 53, (* D3DSTENCILOP to do if stencil test fails *) + D3DRS_STENCILZFAIL = 54, (* D3DSTENCILOP to do if stencil test passes and Z test fails *) + D3DRS_STENCILPASS = 55, (* D3DSTENCILOP to do if both stencil and Z tests pass *) + D3DRS_STENCILFUNC = 56, (* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *) + D3DRS_STENCILREF = 57, (* Reference value used in stencil test *) + D3DRS_STENCILMASK = 58, (* Mask value used in stencil test *) + D3DRS_STENCILWRITEMASK = 59, (* Write mask applied to values written to stencil buffer *) + D3DRS_TEXTUREFACTOR = 60, (* D3DCOLOR used for multi-texture blend *) + D3DRS_WRAP0 = 128, (* wrap for 1st texture coord. set *) + D3DRS_WRAP1 = 129, (* wrap for 2nd texture coord. set *) + D3DRS_WRAP2 = 130, (* wrap for 3rd texture coord. set *) + D3DRS_WRAP3 = 131, (* wrap for 4th texture coord. set *) + D3DRS_WRAP4 = 132, (* wrap for 5th texture coord. set *) + D3DRS_WRAP5 = 133, (* wrap for 6th texture coord. set *) + D3DRS_WRAP6 = 134, (* wrap for 7th texture coord. set *) + D3DRS_WRAP7 = 135, (* wrap for 8th texture coord. set *) + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_SOFTWAREVERTEXPROCESSING = 153, + D3DRS_POINTSIZE = 154, (* float point size *) + D3DRS_POINTSIZE_MIN = 155, (* float point size min threshold *) + D3DRS_POINTSPRITEENABLE = 156, (* BOOL point texture coord control *) + D3DRS_POINTSCALEENABLE = 157, (* BOOL point size scale enable *) + D3DRS_POINTSCALE_A = 158, (* float point attenuation A value *) + D3DRS_POINTSCALE_B = 159, (* float point attenuation B value *) + D3DRS_POINTSCALE_C = 160, (* float point attenuation C value *) + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_PATCHSEGMENTS = 164, // Number of segments per edge when drawing patches + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, (* float point size max threshold *) + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONORDER = 172, // NPatch position interpolation order. D3DORDER_LINEAR or D3DORDER_CUBIC (default) + D3DRS_NORMALORDER = 173, // NPatch normal interpolation order. D3DORDER_LINEAR (default) or D3DORDER_QUADRATIC + + D3DRS_FORCE_DWORD = $7fffffff (* force 32-bit size enum *) + {$ENDIF} + ); + {$EXTERNALSYM _D3DRENDERSTATETYPE} + D3DRENDERSTATETYPE = _D3DRENDERSTATETYPE; + {$EXTERNALSYM D3DRENDERSTATETYPE} + TD3DRenderStateType = _D3DRENDERSTATETYPE; +{$ENDIF} + +type + // Values for material source + _D3DMATERIALCOLORSOURCE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DMATERIALCOLORSOURCE} + D3DMATERIALCOLORSOURCE = _D3DMATERIALCOLORSOURCE; + {$EXTERNALSYM D3DMATERIALCOLORSOURCE} + TD3DMaterialSource = _D3DMATERIALCOLORSOURCE; + +const + D3DMCS_MATERIAL = TD3DMaterialSource(0); // Color from material is used + {$EXTERNALSYM D3DMCS_MATERIAL} + D3DMCS_COLOR1 = TD3DMaterialSource(1); // Diffuse vertex color is used + {$EXTERNALSYM D3DMCS_COLOR1} + D3DMCS_COLOR2 = TD3DMaterialSource(2); // Specular vertex color is used + {$EXTERNALSYM D3DMCS_COLOR2} + D3DMCS_FORCE_DWORD = TD3DMaterialSource($7fffffff); // force 32-bit size enum + {$EXTERNALSYM D3DMCS_FORCE_DWORD} + + // Bias to apply to the texture coordinate set to apply a wrap to. + D3DRENDERSTATE_WRAPBIAS = DWORD(128); + {$EXTERNALSYM D3DRENDERSTATE_WRAPBIAS} + + { Flags to construct the WRAP render states } + D3DWRAP_U = $00000001; + {$EXTERNALSYM D3DWRAP_U} + D3DWRAP_V = $00000002; + {$EXTERNALSYM D3DWRAP_V} + D3DWRAP_W = $00000004; + {$EXTERNALSYM D3DWRAP_W} + + { Flags to construct the WRAP render states for 1D thru 4D texture coordinates } + D3DWRAPCOORD_0 = $00000001; // same as D3DWRAP_U + {$EXTERNALSYM D3DWRAPCOORD_0} + D3DWRAPCOORD_1 = $00000002; // same as D3DWRAP_V + {$EXTERNALSYM D3DWRAPCOORD_1} + D3DWRAPCOORD_2 = $00000004; // same as D3DWRAP_W + {$EXTERNALSYM D3DWRAPCOORD_2} + D3DWRAPCOORD_3 = $00000008; + {$EXTERNALSYM D3DWRAPCOORD_3} + + { Flags to construct D3DRS_COLORWRITEENABLE } + D3DCOLORWRITEENABLE_RED = (1 shl 0); + {$EXTERNALSYM D3DCOLORWRITEENABLE_RED} + D3DCOLORWRITEENABLE_GREEN = (1 shl 1); + {$EXTERNALSYM D3DCOLORWRITEENABLE_GREEN} + D3DCOLORWRITEENABLE_BLUE = (1 shl 2); + {$EXTERNALSYM D3DCOLORWRITEENABLE_BLUE} + D3DCOLORWRITEENABLE_ALPHA = (1 shl 3); + {$EXTERNALSYM D3DCOLORWRITEENABLE_ALPHA} + +(* + * State enumerants for per-stage texture processing. + *) +type + _D3DTEXTURESTAGESTATETYPE = ( + {$IFNDEF COMPILER6_UP} + D3DTSS_INVALID_0 {= 0 }, // Invalid value + D3DTSS_COLOROP {= 1}, { D3DTEXTUREOP - per-stage blending controls for color channels } + D3DTSS_COLORARG1 {= 2}, { D3DTA_* (texture arg) } + D3DTSS_COLORARG2 {= 3}, { D3DTA_* (texture arg) } + D3DTSS_ALPHAOP {= 4}, { D3DTEXTUREOP - per-stage blending controls for alpha channel } + D3DTSS_ALPHAARG1 {= 5}, { D3DTA_* (texture arg) } + D3DTSS_ALPHAARG2 {= 6}, { D3DTA_* (texture arg) } + D3DTSS_BUMPENVMAT00 {= 7}, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT01 {= 8}, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT10 {= 9}, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT11 {= 10}, { float (bump mapping matrix) } + D3DTSS_TEXCOORDINDEX {= 11}, { identifies which set of texture coordinates index this texture } + D3DTSS_invalid_12 , // invalid value of 12 + D3DTSS_ADDRESSU {= 13}, { D3DTEXTUREADDRESS for U coordinate } + D3DTSS_ADDRESSV {= 14}, { D3DTEXTUREADDRESS for V coordinate } + D3DTSS_BORDERCOLOR {= 15}, { D3DCOLOR } + D3DTSS_MAGFILTER {= 16}, { D3DTEXTUREFILTER filter to use for magnification } + D3DTSS_MINFILTER {= 17}, { D3DTEXTUREFILTER filter to use for minification } + D3DTSS_MIPFILTER {= 18}, { D3DTEXTUREFILTER filter to use between mipmaps during minification } + D3DTSS_MIPMAPLODBIAS {= 19}, { float Mipmap LOD bias } + D3DTSS_MAXMIPLEVEL {= 20}, { DWORD 0..(n-1) LOD index of largest map to use (0 == largest) } + D3DTSS_MAXANISOTROPY {= 21}, { DWORD maximum anisotropy } + D3DTSS_BUMPENVLSCALE {= 22}, { float scale for bump map luminance } + D3DTSS_BUMPENVLOFFSET {= 23}, { float offset for bump map luminance } + D3DTSS_TEXTURETRANSFORMFLAGS {= 24}, { D3DTEXTURETRANSFORMFLAGS controls texture transform } + D3DTSS_ADDRESSW {= 25}, { D3DTEXTUREADDRESS for W coordinate } + D3DTSS_COLORARG0 {= 26}, { D3DTA_* third arg for triadic ops } + D3DTSS_ALPHAARG0 {= 27}, { D3DTA_* third arg for triadic ops } + D3DTSS_RESULTARG {= 28} { D3DTA_* arg for result (CURRENT or TEMP) } + {$ELSE} + D3DTSS_COLOROP = 1, { D3DTEXTUREOP - per-stage blending controls for color channels } + D3DTSS_COLORARG1 = 2, { D3DTA_* (texture arg) } + D3DTSS_COLORARG2 = 3, { D3DTA_* (texture arg) } + D3DTSS_ALPHAOP = 4, { D3DTEXTUREOP - per-stage blending controls for alpha channel } + D3DTSS_ALPHAARG1 = 5, { D3DTA_* (texture arg) } + D3DTSS_ALPHAARG2 = 6, { D3DTA_* (texture arg) } + D3DTSS_BUMPENVMAT00 = 7, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT01 = 8, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT10 = 9, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT11 = 10, { float (bump mapping matrix) } + D3DTSS_TEXCOORDINDEX = 11, { identifies which set of texture coordinates index this texture } + D3DTSS_ADDRESSU = 13, { D3DTEXTUREADDRESS for U coordinate } + D3DTSS_ADDRESSV = 14, { D3DTEXTUREADDRESS for V coordinate } + D3DTSS_BORDERCOLOR = 15, { D3DCOLOR } + D3DTSS_MAGFILTER = 16, { D3DTEXTUREFILTER filter to use for magnification } + D3DTSS_MINFILTER = 17, { D3DTEXTUREFILTER filter to use for minification } + D3DTSS_MIPFILTER = 18, { D3DTEXTUREFILTER filter to use between mipmaps during minification } + D3DTSS_MIPMAPLODBIAS = 19, { float Mipmap LOD bias } + D3DTSS_MAXMIPLEVEL = 20, { DWORD 0..(n-1) LOD index of largest map to use (0 == largest) } + D3DTSS_MAXANISOTROPY = 21, { DWORD maximum anisotropy } + D3DTSS_BUMPENVLSCALE = 22, { float scale for bump map luminance } + D3DTSS_BUMPENVLOFFSET = 23, { float offset for bump map luminance } + D3DTSS_TEXTURETRANSFORMFLAGS = 24, { D3DTEXTURETRANSFORMFLAGS controls texture transform } + D3DTSS_ADDRESSW = 25, { D3DTEXTUREADDRESS for W coordinate } + D3DTSS_COLORARG0 = 26, { D3DTA_* third arg for triadic ops } + D3DTSS_ALPHAARG0 = 27, { D3DTA_* third arg for triadic ops } + D3DTSS_RESULTARG = 28 { D3DTA_* arg for result (CURRENT or TEMP) } + {$ENDIF} + ); + {$EXTERNALSYM _D3DTEXTURESTAGESTATETYPE} + D3DTEXTURESTAGESTATETYPE = _D3DTEXTURESTAGESTATETYPE; + {$EXTERNALSYM D3DTEXTURESTAGESTATETYPE} + TD3DTextureStageStateType = _D3DTEXTURESTAGESTATETYPE; + +const + // 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; + {$EXTERNALSYM D3DTSS_TCI_PASSTHRU} + D3DTSS_TCI_CAMERASPACENORMAL = $00010000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACENORMAL} + D3DTSS_TCI_CAMERASPACEPOSITION = $00020000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACEPOSITION} + D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR = $00030000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR} + +(* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + *) +type + _D3DTEXTUREOP = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DTEXTUREOP} + D3DTEXTUREOP = _D3DTEXTUREOP; + {$EXTERNALSYM D3DTEXTUREOP} + TD3DTextureOp = _D3DTEXTUREOP; + +const + // Control + D3DTOP_DISABLE = 1; // disables stage + {$EXTERNALSYM D3DTOP_DISABLE} + D3DTOP_SELECTARG1 = 2; // the default + {$EXTERNALSYM D3DTOP_SELECTARG1} + D3DTOP_SELECTARG2 = 3; + {$EXTERNALSYM D3DTOP_SELECTARG2} + + // Modulate + D3DTOP_MODULATE = 4; // multiply args together + {$EXTERNALSYM D3DTOP_MODULATE} + D3DTOP_MODULATE2X = 5; // multiply and 1 bit + {$EXTERNALSYM D3DTOP_MODULATE2X} + D3DTOP_MODULATE4X = 6; // multiply and 2 bits + {$EXTERNALSYM D3DTOP_MODULATE4X} + + // Add + D3DTOP_ADD = 7; // add arguments together + {$EXTERNALSYM D3DTOP_ADD} + D3DTOP_ADDSIGNED = 8; // add with -0.5 bias + {$EXTERNALSYM D3DTOP_ADDSIGNED} + D3DTOP_ADDSIGNED2X = 9; // as above but left 1 bit + {$EXTERNALSYM D3DTOP_ADDSIGNED2X} + D3DTOP_SUBTRACT = 10; // Arg1 - Arg2, with no saturation + {$EXTERNALSYM D3DTOP_SUBTRACT} + D3DTOP_ADDSMOOTH = 11; // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + {$EXTERNALSYM D3DTOP_ADDSMOOTH} + + // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12; // iterated alpha + {$EXTERNALSYM D3DTOP_BLENDDIFFUSEALPHA} + D3DTOP_BLENDTEXTUREALPHA = 13; // texture alpha + {$EXTERNALSYM D3DTOP_BLENDTEXTUREALPHA} + D3DTOP_BLENDFACTORALPHA = 14; // alpha from D3DRS_TEXTUREFACTOR + {$EXTERNALSYM D3DTOP_BLENDFACTORALPHA} + + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15; // texture alpha + {$EXTERNALSYM D3DTOP_BLENDTEXTUREALPHAPM} + D3DTOP_BLENDCURRENTALPHA = 16; // by alpha of current color + {$EXTERNALSYM D3DTOP_BLENDCURRENTALPHA} + + // Specular mapping + D3DTOP_PREMODULATE = 17; // modulate with next texture before use + {$EXTERNALSYM D3DTOP_PREMODULATE} + D3DTOP_MODULATEALPHA_ADDCOLOR = 18; // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + {$EXTERNALSYM D3DTOP_MODULATEALPHA_ADDCOLOR} + D3DTOP_MODULATECOLOR_ADDALPHA = 19; // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + {$EXTERNALSYM D3DTOP_MODULATECOLOR_ADDALPHA} + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20; // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + {$EXTERNALSYM D3DTOP_MODULATEINVALPHA_ADDCOLOR} + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21; // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + {$EXTERNALSYM D3DTOP_MODULATEINVCOLOR_ADDALPHA} + + // Bump mapping + D3DTOP_BUMPENVMAP = 22; // per pixel env map perturbation + {$EXTERNALSYM D3DTOP_BUMPENVMAP} + D3DTOP_BUMPENVMAPLUMINANCE = 23; // with luminance channel + {$EXTERNALSYM D3DTOP_BUMPENVMAPLUMINANCE} + + // 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; + {$EXTERNALSYM D3DTOP_DOTPRODUCT3} + + // Triadic ops + D3DTOP_MULTIPLYADD = 25; // Arg0 + Arg1*Arg2 + {$EXTERNALSYM D3DTOP_MULTIPLYADD} + D3DTOP_LERP = 26; // (Arg0)*Arg1 + (1-Arg0)*Arg2 + {$EXTERNALSYM D3DTOP_LERP} + +(* + * 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 + {$EXTERNALSYM D3DTA_SELECTMASK} + D3DTA_DIFFUSE = $00000000; // select diffuse color (read only) + {$EXTERNALSYM D3DTA_DIFFUSE} + D3DTA_CURRENT = $00000001; // select stage destination register (read/write) + {$EXTERNALSYM D3DTA_CURRENT} + D3DTA_TEXTURE = $00000002; // select texture color (read only) + {$EXTERNALSYM D3DTA_TEXTURE} + D3DTA_TFACTOR = $00000003; // select D3DRS_TEXTUREFACTOR (read only) + {$EXTERNALSYM D3DTA_TFACTOR} + D3DTA_SPECULAR = $00000004; // select specular color (read only) + {$EXTERNALSYM D3DTA_SPECULAR} + D3DTA_TEMP = $00000005; // select temporary register color (read/write) + {$EXTERNALSYM D3DTA_TEMP} + D3DTA_COMPLEMENT = $00000010; // take 1.0 - x (read modifier) + {$EXTERNALSYM D3DTA_COMPLEMENT} + D3DTA_ALPHAREPLICATE = $00000020; // replicate alpha to color components (read modifier) + {$EXTERNALSYM D3DTA_ALPHAREPLICATE} + +type + // + // Values for D3DTSS_***FILTER texture stage states + // + _D3DTEXTUREFILTERTYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DTEXTUREFILTERTYPE} + D3DTEXTUREFILTERTYPE = _D3DTEXTUREFILTERTYPE; + {$EXTERNALSYM D3DTEXTUREFILTERTYPE} + TD3DTextureFilterType = _D3DTEXTUREFILTERTYPE; + +const + D3DTEXF_NONE = 0; // filtering disabled (valid for mip filter only) + {$EXTERNALSYM D3DTEXF_NONE} + D3DTEXF_POINT = 1; // nearest + {$EXTERNALSYM D3DTEXF_POINT} + D3DTEXF_LINEAR = 2; // linear interpolation + {$EXTERNALSYM D3DTEXF_LINEAR} + D3DTEXF_ANISOTROPIC = 3; // anisotropic + {$EXTERNALSYM D3DTEXF_ANISOTROPIC} + D3DTEXF_FLATCUBIC = 4; // cubic + {$EXTERNALSYM D3DTEXF_FLATCUBIC} + D3DTEXF_GAUSSIANCUBIC = 5; // different cubic kernel + {$EXTERNALSYM D3DTEXF_GAUSSIANCUBIC} + +const + { Bits for Flags in ProcessVertices call } + D3DPV_DONOTCOPYDATA = (1 shl 0); + {$EXTERNALSYM D3DPV_DONOTCOPYDATA} + +//------------------------------------------------------------------- + + // Flexible vertex format bits + // + D3DFVF_RESERVED0 = $001; + {$EXTERNALSYM D3DFVF_RESERVED0} + D3DFVF_POSITION_MASK = $00E; + {$EXTERNALSYM D3DFVF_POSITION_MASK} + D3DFVF_XYZ = $002; + {$EXTERNALSYM D3DFVF_XYZ} + D3DFVF_XYZRHW = $004; + {$EXTERNALSYM D3DFVF_XYZRHW} + D3DFVF_XYZB1 = $006; + {$EXTERNALSYM D3DFVF_XYZB1} + D3DFVF_XYZB2 = $008; + {$EXTERNALSYM D3DFVF_XYZB2} + D3DFVF_XYZB3 = $00a; + {$EXTERNALSYM D3DFVF_XYZB3} + D3DFVF_XYZB4 = $00c; + {$EXTERNALSYM D3DFVF_XYZB4} + D3DFVF_XYZB5 = $00e; + {$EXTERNALSYM D3DFVF_XYZB5} + + D3DFVF_NORMAL = $010; + {$EXTERNALSYM D3DFVF_NORMAL} + D3DFVF_PSIZE = $020; + {$EXTERNALSYM D3DFVF_PSIZE} + D3DFVF_DIFFUSE = $040; + {$EXTERNALSYM D3DFVF_DIFFUSE} + D3DFVF_SPECULAR = $080; + {$EXTERNALSYM D3DFVF_SPECULAR} + + D3DFVF_TEXCOUNT_MASK = $f00; + {$EXTERNALSYM D3DFVF_TEXCOUNT_MASK} + D3DFVF_TEXCOUNT_SHIFT = 8; + {$EXTERNALSYM D3DFVF_TEXCOUNT_SHIFT} + D3DFVF_TEX0 = $000; + {$EXTERNALSYM D3DFVF_TEX0} + D3DFVF_TEX1 = $100; + {$EXTERNALSYM D3DFVF_TEX1} + D3DFVF_TEX2 = $200; + {$EXTERNALSYM D3DFVF_TEX2} + D3DFVF_TEX3 = $300; + {$EXTERNALSYM D3DFVF_TEX3} + D3DFVF_TEX4 = $400; + {$EXTERNALSYM D3DFVF_TEX4} + D3DFVF_TEX5 = $500; + {$EXTERNALSYM D3DFVF_TEX5} + D3DFVF_TEX6 = $600; + {$EXTERNALSYM D3DFVF_TEX6} + D3DFVF_TEX7 = $700; + {$EXTERNALSYM D3DFVF_TEX7} + D3DFVF_TEX8 = $800; + {$EXTERNALSYM D3DFVF_TEX8} + + D3DFVF_LASTBETA_UBYTE4 = $1000; + {$EXTERNALSYM D3DFVF_LASTBETA_UBYTE4} + + D3DFVF_RESERVED2 = $E000; // 4 reserved bits + {$EXTERNALSYM D3DFVF_RESERVED2} + + //--------------------------------------------------------------------- + // Vertex Shaders + // + +{ + +Vertex Shader Declaration + +The declaration portion of a vertex shader defines the static external +interface of the shader. The information in the declaration includes: + +- Assignments of vertex shader input registers to data streams. These +assignments bind a specific vertex register to a single component within a +vertex stream. A vertex stream element is identified by a byte offset +within the stream and a type. The type specifies the arithmetic data type +plus the dimensionality (1, 2, 3, or 4 values). Stream data which is +less than 4 values are always expanded out to 4 values with zero or more +0.F values and one 1.F value. + +- Assignment of vertex shader input registers to implicit data from the +primitive tessellator. This controls the loading of vertex data which is +not loaded from a stream, but rather is generated during primitive +tessellation prior to the vertex shader. + +- Loading data into the constant memory at the time a shader is set as the +current shader. Each token specifies values for one or more contiguous 4 +DWORD constant registers. This allows the shader to update an arbitrary +subset of the constant memory, overwriting the device state (which +contains the current values of the constant memory). Note that these +values can be subsequently overwritten (between DrawPrimitive calls) +during the time a shader is bound to a device via the +SetVertexShaderConstant method. + + +Declaration arrays are single-dimensional arrays of DWORDs composed of +multiple tokens each of which is one or more DWORDs. The single-DWORD +token value 0xFFFFFFFF is a special token used to indicate the end of the +declaration array. The single DWORD token value 0x00000000 is a NOP token +with is ignored during the declaration parsing. Note that 0x00000000 is a +valid value for DWORDs following the first DWORD for multiple word tokens. + +[31:29] TokenType + 0x0 - NOP (requires all DWORD bits to be zero) + 0x1 - stream selector + 0x2 - stream data definition (map to vertex input memory) + 0x3 - vertex input memory from tessellator + 0x4 - constant memory from shader + 0x5 - extension + 0x6 - reserved + 0x7 - end-of-array (requires all DWORD bits to be 1) + +NOP Token (single DWORD token) + [31:29] 0x0 + [28:00] 0x0 + +Stream Selector (single DWORD token) + [31:29] 0x1 + [28] indicates whether this is a tessellator stream + [27:04] 0x0 + [03:00] stream selector (0..15) + +Stream Data Definition (single DWORD token) + Vertex Input Register Load + [31:29] 0x2 + [28] 0x0 + [27:20] 0x0 + [19:16] type (dimensionality and data type) + [15:04] 0x0 + [03:00] vertex register address (0..15) + Data Skip (no register load) + [31:29] 0x2 + [28] 0x1 + [27:20] 0x0 + [19:16] count of DWORDS to skip over (0..15) + [15:00] 0x0 + Vertex Input Memory from Tessellator Data (single DWORD token) + [31:29] 0x3 + [28] indicates whether data is normals or u/v + [27:24] 0x0 + [23:20] vertex register address (0..15) + [19:16] type (dimensionality) + [15:04] 0x0 + [03:00] vertex register address (0..15) + +Constant Memory from Shader (multiple DWORD token) + [31:29] 0x4 + [28:25] count of 4*DWORD constants to load (0..15) + [24:07] 0x0 + [06:00] constant memory address (0..95) + +Extension Token (single or multiple DWORD token) + [31:29] 0x5 + [28:24] count of additional DWORDs in token (0..31) + [23:00] extension-specific information + +End-of-array token (single DWORD token) + [31:29] 0x7 + [28:00] 0x1fffffff + +The stream selector token must be immediately followed by a contiguous set of stream data definition tokens. This token sequence fully defines that stream, including the set of elements within the stream, the order in which the elements appear, the type of each element, and the vertex register into which to load an element. +Streams are allowed to include data which is not loaded into a vertex register, thus allowing data which is not used for this shader to exist in the vertex stream. This skipped data is defined only by a count of DWORDs to skip over, since the type information is irrelevant. +The token sequence: +Stream Select: stream=0 +Stream Data Definition (Load): type=FLOAT3; register=3 +Stream Data Definition (Load): type=FLOAT3; register=4 +Stream Data Definition (Skip): count=2 +Stream Data Definition (Load): type=FLOAT2; register=7 + +defines stream zero to consist of 4 elements, 3 of which are loaded into registers and the fourth skipped over. Register 3 is loaded with the first three DWORDs in each vertex interpreted as FLOAT data. Register 4 is loaded with the 4th, 5th, and 6th DWORDs interpreted as FLOAT data. The next two DWORDs (7th and 8th) are skipped over and not loaded into any vertex input register. Register 7 is loaded with the 9th and 10th DWORDS interpreted as FLOAT data. +Placing of tokens other than NOPs between the Stream Selector and Stream Data Definition tokens is disallowed. + +} + +type + _D3DVSD_TOKENTYPE = ( + {$IFNDEF COMPILER6_UP} + D3DVSD_TOKEN_NOP {= 0}, // NOP or extension + D3DVSD_TOKEN_STREAM, // stream selector + D3DVSD_TOKEN_STREAMDATA, // stream data definition (map to vertex input memory) + D3DVSD_TOKEN_TESSELLATOR, // vertex input memory from tessellator + D3DVSD_TOKEN_CONSTMEM, // constant memory from shader + D3DVSD_TOKEN_EXT, // extension + D3DVSD_INVALID_6, // Invalid token inserted to fill the gap (in Object Pascal translation) + D3DVSD_TOKEN_END {= 7} // end-of-array (requires all DWORD bits to be 1) + {$ELSE} + D3DVSD_TOKEN_NOP = 0, // NOP or extension + D3DVSD_TOKEN_STREAM, // stream selector + D3DVSD_TOKEN_STREAMDATA, // stream data definition (map to vertex input memory) + D3DVSD_TOKEN_TESSELLATOR, // vertex input memory from tessellator + D3DVSD_TOKEN_CONSTMEM, // constant memory from shader + D3DVSD_TOKEN_EXT, // extension + D3DVSD_TOKEN_END = 7 // end-of-array (requires all DWORD bits to be 1) + {$ENDIF} + ); + {$EXTERNALSYM _D3DVSD_TOKENTYPE} + D3DVSD_TOKENTYPE = _D3DVSD_TOKENTYPE; + {$EXTERNALSYM D3DVSD_TOKENTYPE} + TD3DVSDTokenType = _D3DVSD_TOKENTYPE; + +const + D3DVSD_TOKENTYPESHIFT = 29; + {$EXTERNALSYM D3DVSD_TOKENTYPESHIFT} + D3DVSD_TOKENTYPEMASK = (7 shl D3DVSD_TOKENTYPESHIFT); + {$EXTERNALSYM D3DVSD_TOKENTYPEMASK} + + D3DVSD_STREAMNUMBERSHIFT = 0; + {$EXTERNALSYM D3DVSD_STREAMNUMBERSHIFT} + D3DVSD_STREAMNUMBERMASK = ($F shl D3DVSD_STREAMNUMBERSHIFT); + {$EXTERNALSYM D3DVSD_STREAMNUMBERMASK} + + D3DVSD_DATALOADTYPESHIFT = 28; + {$EXTERNALSYM D3DVSD_DATALOADTYPESHIFT} + D3DVSD_DATALOADTYPEMASK = ($1 shl D3DVSD_DATALOADTYPESHIFT); + {$EXTERNALSYM D3DVSD_DATALOADTYPEMASK} + + D3DVSD_DATATYPESHIFT = 16; + {$EXTERNALSYM D3DVSD_DATATYPESHIFT} + D3DVSD_DATATYPEMASK = ($F shl D3DVSD_DATATYPESHIFT); + {$EXTERNALSYM D3DVSD_DATATYPEMASK} + + D3DVSD_SKIPCOUNTSHIFT = 16; + {$EXTERNALSYM D3DVSD_SKIPCOUNTSHIFT} + D3DVSD_SKIPCOUNTMASK = ($F shl D3DVSD_SKIPCOUNTSHIFT); + {$EXTERNALSYM D3DVSD_SKIPCOUNTMASK} + + D3DVSD_VERTEXREGSHIFT = 0; + {$EXTERNALSYM D3DVSD_VERTEXREGSHIFT} + D3DVSD_VERTEXREGMASK = ($1F shl D3DVSD_VERTEXREGSHIFT); + {$EXTERNALSYM D3DVSD_VERTEXREGMASK} + + {$EXTERNALSYM D3DVSD_VERTEXREGMASK} + D3DVSD_VERTEXREGINSHIFT = 20; + {$EXTERNALSYM D3DVSD_VERTEXREGINSHIFT} + D3DVSD_VERTEXREGINMASK = ($F shl D3DVSD_VERTEXREGINSHIFT); + {$EXTERNALSYM D3DVSD_VERTEXREGINMASK} + + D3DVSD_CONSTCOUNTSHIFT = 25; + {$EXTERNALSYM D3DVSD_CONSTCOUNTSHIFT} + D3DVSD_CONSTCOUNTMASK = ($F shl D3DVSD_CONSTCOUNTSHIFT); + {$EXTERNALSYM D3DVSD_CONSTCOUNTMASK} + + D3DVSD_CONSTADDRESSSHIFT = 0; + {$EXTERNALSYM D3DVSD_CONSTADDRESSSHIFT} + D3DVSD_CONSTADDRESSMASK = ($7F shl D3DVSD_CONSTADDRESSSHIFT); + {$EXTERNALSYM D3DVSD_CONSTADDRESSMASK} + + D3DVSD_CONSTRSSHIFT = 16; + {$EXTERNALSYM D3DVSD_CONSTRSSHIFT} + D3DVSD_CONSTRSMASK = ($1FFF shl D3DVSD_CONSTRSSHIFT); + {$EXTERNALSYM D3DVSD_CONSTRSMASK} + + D3DVSD_EXTCOUNTSHIFT = 24; + {$EXTERNALSYM D3DVSD_EXTCOUNTSHIFT} + D3DVSD_EXTCOUNTMASK = ($1F shl D3DVSD_EXTCOUNTSHIFT); + {$EXTERNALSYM D3DVSD_EXTCOUNTMASK} + + D3DVSD_EXTINFOSHIFT = 0; + {$EXTERNALSYM D3DVSD_EXTINFOSHIFT} + D3DVSD_EXTINFOMASK = ($FFFFFF shl D3DVSD_EXTINFOSHIFT); + {$EXTERNALSYM D3DVSD_EXTINFOMASK} + +// D3DVSD_MAKETOKENTYPE(tokenType) ((tokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK) +function D3DVSD_MAKETOKENTYPE(tokenType: TD3DVSDTokenType): DWord; +{$EXTERNALSYM D3DVSD_MAKETOKENTYPE} + +// macros for generation of CreateVertexShader Declaration token array + +// Set current stream +// _StreamNumber [0..(MaxStreams-1)] stream to get data from +// +//#define D3DVSD_STREAM( _StreamNumber ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (_StreamNumber)) +function D3DVSD_STREAM(_StreamNumber: DWord): DWord; +{$EXTERNALSYM D3DVSD_STREAM} + +const + // Set tessellator stream + // + D3DVSD_STREAMTESSSHIFT = 28; + {$EXTERNALSYM D3DVSD_STREAMTESSSHIFT} + D3DVSD_STREAMTESSMASK = (1 shl D3DVSD_STREAMTESSSHIFT); + {$EXTERNALSYM D3DVSD_STREAMTESSMASK} + + // #define D3DVSD_STREAM_TESS( ) \ + // (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (D3DVSD_STREAMTESSMASK)) + // !!! - macro just rolled out in pascal (not converted to function) + D3DVSD_STREAM_TESS = ((DWord(D3DVSD_TOKEN_STREAM) shl D3DVSD_TOKENTYPESHIFT) and + D3DVSD_TOKENTYPEMASK) or D3DVSD_STREAMTESSMASK; + {$EXTERNALSYM D3DVSD_STREAM_TESS} + +// bind single vertex register to vertex element from vertex stream +// +// _VertexRegister [0..15] address of the vertex register +// _Type [D3DVSDT_*] dimensionality and arithmetic data type + +//#define D3DVSD_REG( _VertexRegister, _Type ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | \ +// ((_Type) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) +function D3DVSD_REG(_VertexRegister, _Type: DWord): DWord; +{$EXTERNALSYM D3DVSD_REG} + +// Skip _DWORDCount DWORDs in vertex +// +//#define D3DVSD_SKIP( _DWORDCount ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | \ +// ((_DWORDCount) << D3DVSD_SKIPCOUNTSHIFT)) +function D3DVSD_SKIP(_DWORDCount: DWord): DWord; +{$EXTERNALSYM D3DVSD_SKIP} + +// load data into vertex shader constant memory +// +// _ConstantAddress [0..95] - address of constant array to begin filling data +// _Count [0..15] - number of constant vectors to load (4 DWORDs each) +// followed by 4*_Count DWORDS of data +// +//#define D3DVSD_CONST( _ConstantAddress, _Count ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | \ +// ((_Count) << D3DVSD_CONSTCOUNTSHIFT) | (_ConstantAddress)) +function D3DVSD_CONST(_ConstantAddress, _Count: DWord): DWord; +{$EXTERNALSYM D3DVSD_CONST} + +// enable tessellator generated normals +// +// _VertexRegisterIn [0..15] address of vertex register whose input stream +// will be used in normal computation +// _VertexRegisterOut [0..15] address of vertex register to output the normal to +// +//#define D3DVSD_TESSNORMAL( _VertexRegisterIn, _VertexRegisterOut ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | \ +// ((_VertexRegisterIn) << D3DVSD_VERTEXREGINSHIFT) | \ +// ((0x02) << D3DVSD_DATATYPESHIFT) | (_VertexRegisterOut)) +function D3DVSD_TESSNORMAL(_VertexRegisterIn, _VertexRegisterOut: DWord): DWord; +{$EXTERNALSYM D3DVSD_TESSNORMAL} + +// enable tessellator generated surface parameters +// +// _VertexRegister [0..15] address of vertex register to output parameters +// +//#define D3DVSD_TESSUV( _VertexRegister ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | \ +// ((0x01) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) +function D3DVSD_TESSUV(_VertexRegister: DWord): DWord; +{$EXTERNALSYM D3DVSD_TESSUV} + +const + // Generates END token + // + D3DVSD_END = $FFFFFFFF; + {$EXTERNALSYM D3DVSD_END} + + // Generates NOP token + D3DVSD_NOP = $00000000; + {$EXTERNALSYM D3DVSD_NOP} + + // bit declarations for _Type fields + D3DVSDT_FLOAT1 = $00; // 1D float expanded to (value; 0.; 0.; 1.) + {$EXTERNALSYM D3DVSDT_FLOAT1} + D3DVSDT_FLOAT2 = $01; // 2D float expanded to (value; value; 0.; 1.) + {$EXTERNALSYM D3DVSDT_FLOAT2} + D3DVSDT_FLOAT3 = $02; // 3D float expanded to (value; value; value; 1.) + {$EXTERNALSYM D3DVSDT_FLOAT3} + D3DVSDT_FLOAT4 = $03; // 4D float + {$EXTERNALSYM D3DVSDT_FLOAT4} + D3DVSDT_D3DCOLOR = $04; // 4D packed unsigned bytes mapped to 0. to 1. range + {$EXTERNALSYM D3DVSDT_D3DCOLOR} + // Input is in D3DCOLOR format (ARGB) expanded to (R; G; B; A) + D3DVSDT_UBYTE4 = $05; // 4D unsigned byte + {$EXTERNALSYM D3DVSDT_UBYTE4} + D3DVSDT_SHORT2 = $06; // 2D signed short expanded to (value; value; 0.; 1.) + {$EXTERNALSYM D3DVSDT_SHORT2} + D3DVSDT_SHORT4 = $07; // 4D signed short + {$EXTERNALSYM D3DVSDT_SHORT4} + + // assignments of vertex input registers for fixed function vertex shader + // + D3DVSDE_POSITION = 0; + {$EXTERNALSYM D3DVSDE_POSITION} + D3DVSDE_BLENDWEIGHT = 1; + {$EXTERNALSYM D3DVSDE_BLENDWEIGHT} + D3DVSDE_BLENDINDICES = 2; + {$EXTERNALSYM D3DVSDE_BLENDINDICES} + D3DVSDE_NORMAL = 3; + {$EXTERNALSYM D3DVSDE_NORMAL} + D3DVSDE_PSIZE = 4; + {$EXTERNALSYM D3DVSDE_PSIZE} + D3DVSDE_DIFFUSE = 5; + {$EXTERNALSYM D3DVSDE_DIFFUSE} + D3DVSDE_SPECULAR = 6; + {$EXTERNALSYM D3DVSDE_SPECULAR} + D3DVSDE_TEXCOORD0 = 7; + {$EXTERNALSYM D3DVSDE_TEXCOORD0} + D3DVSDE_TEXCOORD1 = 8; + {$EXTERNALSYM D3DVSDE_TEXCOORD1} + D3DVSDE_TEXCOORD2 = 9; + {$EXTERNALSYM D3DVSDE_TEXCOORD2} + D3DVSDE_TEXCOORD3 = 10; + {$EXTERNALSYM D3DVSDE_TEXCOORD3} + D3DVSDE_TEXCOORD4 = 11; + {$EXTERNALSYM D3DVSDE_TEXCOORD4} + D3DVSDE_TEXCOORD5 = 12; + {$EXTERNALSYM D3DVSDE_TEXCOORD5} + D3DVSDE_TEXCOORD6 = 13; + {$EXTERNALSYM D3DVSDE_TEXCOORD6} + D3DVSDE_TEXCOORD7 = 14; + {$EXTERNALSYM D3DVSDE_TEXCOORD7} + D3DVSDE_POSITION2 = 15; + {$EXTERNALSYM D3DVSDE_POSITION2} + D3DVSDE_NORMAL2 = 16; + {$EXTERNALSYM D3DVSDE_NORMAL2} + + // Maximum supported number of texture coordinate sets + D3DDP_MAXTEXCOORD = 8; + {$EXTERNALSYM D3DDP_MAXTEXCOORD} + + // + // Instruction Token Bit Definitions + // + D3DSI_OPCODE_MASK = $0000FFFF; + {$EXTERNALSYM D3DSI_OPCODE_MASK} + +type + _D3DSHADER_INSTRUCTION_OPCODE_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADER_INSTRUCTION_OPCODE_TYPE} + D3DSHADER_INSTRUCTION_OPCODE_TYPE = _D3DSHADER_INSTRUCTION_OPCODE_TYPE; + {$EXTERNALSYM D3DSHADER_INSTRUCTION_OPCODE_TYPE} + TD3DShaderInstructionOpcodeType = _D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +const + D3DSIO_NOP = 0; // PS/VS + {$EXTERNALSYM D3DSIO_NOP} + D3DSIO_MOV = 1; // PS/VS + {$EXTERNALSYM D3DSIO_MOV} + D3DSIO_ADD = 2; // PS/VS + {$EXTERNALSYM D3DSIO_ADD} + D3DSIO_SUB = 3; // PS + {$EXTERNALSYM D3DSIO_SUB} + D3DSIO_MAD = 4; // PS/VS + {$EXTERNALSYM D3DSIO_MAD} + D3DSIO_MUL = 5; // PS/VS + {$EXTERNALSYM D3DSIO_MUL} + D3DSIO_RCP = 6; // VS + {$EXTERNALSYM D3DSIO_RCP} + D3DSIO_RSQ = 7; // VS + {$EXTERNALSYM D3DSIO_RSQ} + D3DSIO_DP3 = 8; // PS/VS + {$EXTERNALSYM D3DSIO_DP3} + D3DSIO_DP4 = 9; // PS/VS + {$EXTERNALSYM D3DSIO_DP4} + D3DSIO_MIN = 10; // VS + {$EXTERNALSYM D3DSIO_MIN} + D3DSIO_MAX = 11; // VS + {$EXTERNALSYM D3DSIO_MAX} + D3DSIO_SLT = 12; // VS + {$EXTERNALSYM D3DSIO_SLT} + D3DSIO_SGE = 13; // VS + {$EXTERNALSYM D3DSIO_SGE} + D3DSIO_EXP = 14; // VS + {$EXTERNALSYM D3DSIO_EXP} + D3DSIO_LOG = 15; // VS + {$EXTERNALSYM D3DSIO_LOG} + D3DSIO_LIT = 16; // VS + {$EXTERNALSYM D3DSIO_LIT} + D3DSIO_DST = 17; // VS + {$EXTERNALSYM D3DSIO_DST} + D3DSIO_LRP = 18; // PS + {$EXTERNALSYM D3DSIO_LRP} + D3DSIO_FRC = 19; // VS + {$EXTERNALSYM D3DSIO_FRC} + D3DSIO_M4x4 = 20; // VS + {$EXTERNALSYM D3DSIO_M4x4} + D3DSIO_M4x3 = 21; // VS + {$EXTERNALSYM D3DSIO_M4x3} + D3DSIO_M3x4 = 22; // VS + {$EXTERNALSYM D3DSIO_M3x4} + D3DSIO_M3x3 = 23; // VS + {$EXTERNALSYM D3DSIO_M3x3} + D3DSIO_M3x2 = 24; // VS + {$EXTERNALSYM D3DSIO_M3x2} + + D3DSIO_TEXCOORD = 64; // PS + {$EXTERNALSYM D3DSIO_TEXCOORD} + D3DSIO_TEXKILL = 65; // PS + {$EXTERNALSYM D3DSIO_TEXKILL} + D3DSIO_TEX = 66; // PS + {$EXTERNALSYM D3DSIO_TEX} + D3DSIO_TEXBEM = 67; // PS + {$EXTERNALSYM D3DSIO_TEXBEM} + D3DSIO_TEXBEML = 68; // PS + {$EXTERNALSYM D3DSIO_TEXBEML} + D3DSIO_TEXREG2AR = 69; // PS + {$EXTERNALSYM D3DSIO_TEXREG2AR} + D3DSIO_TEXREG2GB = 70; // PS + {$EXTERNALSYM D3DSIO_TEXREG2GB} + D3DSIO_TEXM3x2PAD = 71; // PS + {$EXTERNALSYM D3DSIO_TEXM3x2PAD} + D3DSIO_TEXM3x2TEX = 72; // PS + {$EXTERNALSYM D3DSIO_TEXM3x2TEX} + D3DSIO_TEXM3x3PAD = 73; // PS + {$EXTERNALSYM D3DSIO_TEXM3x3PAD} + D3DSIO_TEXM3x3TEX = 74; // PS + {$EXTERNALSYM D3DSIO_TEXM3x3TEX} + D3DSIO_TEXM3x3DIFF = 75; // PS + {$EXTERNALSYM D3DSIO_TEXM3x3DIFF} + D3DSIO_TEXM3x3SPEC = 76; // PS + {$EXTERNALSYM D3DSIO_TEXM3x3SPEC} + D3DSIO_TEXM3x3VSPEC = 77; // PS + {$EXTERNALSYM D3DSIO_TEXM3x3VSPEC} + D3DSIO_EXPP = 78; // VS + {$EXTERNALSYM D3DSIO_EXPP} + D3DSIO_LOGP = 79; // VS + {$EXTERNALSYM D3DSIO_LOGP} + D3DSIO_CND = 80; // PS + {$EXTERNALSYM D3DSIO_CND} + D3DSIO_DEF = 81; // PS + {$EXTERNALSYM D3DSIO_DEF} + D3DSIO_TEXREG2RGB = 82; // PS + {$EXTERNALSYM D3DSIO_TEXREG2RGB} + D3DSIO_TEXDP3TEX = 83; // PS + {$EXTERNALSYM D3DSIO_TEXDP3TEX} + D3DSIO_TEXM3x2DEPTH = 84; // PS + {$EXTERNALSYM D3DSIO_TEXM3x2DEPTH} + D3DSIO_TEXDP3 = 85; // PS + {$EXTERNALSYM D3DSIO_TEXDP3} + D3DSIO_TEXM3x3 = 86; // PS + {$EXTERNALSYM D3DSIO_TEXM3x3} + D3DSIO_TEXDEPTH = 87; // PS + {$EXTERNALSYM D3DSIO_TEXDEPTH} + D3DSIO_CMP = 88; // PS + {$EXTERNALSYM D3DSIO_CMP} + D3DSIO_BEM = 89; // PS + {$EXTERNALSYM D3DSIO_BEM} + + D3DSIO_PHASE = $FFFD; + {$EXTERNALSYM D3DSIO_PHASE} + D3DSIO_COMMENT = $FFFE; + {$EXTERNALSYM D3DSIO_COMMENT} + D3DSIO_END = $FFFF; + {$EXTERNALSYM D3DSIO_END} + + // + // 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; + {$EXTERNALSYM D3DSI_COISSUE} + + // + // Parameter Token Bit Definitions + // + D3DSP_REGNUM_MASK = $00001FFF; + {$EXTERNALSYM D3DSP_REGNUM_MASK} + + // destination parameter write mask + D3DSP_WRITEMASK_0 = $00010000; // Component 0 (X;Red) + {$EXTERNALSYM D3DSP_WRITEMASK_0} + D3DSP_WRITEMASK_1 = $00020000; // Component 1 (Y;Green) + {$EXTERNALSYM D3DSP_WRITEMASK_1} + D3DSP_WRITEMASK_2 = $00040000; // Component 2 (Z;Blue) + {$EXTERNALSYM D3DSP_WRITEMASK_2} + D3DSP_WRITEMASK_3 = $00080000; // Component 3 (W;Alpha) + {$EXTERNALSYM D3DSP_WRITEMASK_3} + D3DSP_WRITEMASK_ALL = $000F0000; // All Components + {$EXTERNALSYM D3DSP_WRITEMASK_ALL} + + // destination parameter modifiers + D3DSP_DSTMOD_SHIFT = 20; + {$EXTERNALSYM D3DSP_DSTMOD_SHIFT} + D3DSP_DSTMOD_MASK = $00F00000; + {$EXTERNALSYM D3DSP_DSTMOD_MASK} + +type + _D3DSHADER_PARAM_DSTMOD_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADER_PARAM_DSTMOD_TYPE} + D3DSHADER_PARAM_DSTMOD_TYPE = _D3DSHADER_PARAM_DSTMOD_TYPE; + {$EXTERNALSYM D3DSHADER_PARAM_DSTMOD_TYPE} + TD3DShaderParamDSTModType = _D3DSHADER_PARAM_DSTMOD_TYPE; + +const + D3DSPDM_NONE = 0 shl D3DSP_DSTMOD_SHIFT; // nop + {$EXTERNALSYM D3DSPDM_NONE} + D3DSPDM_SATURATE = 1 shl D3DSP_DSTMOD_SHIFT; // clamp to 0. to 1. range + {$EXTERNALSYM D3DSPDM_SATURATE} + D3DSPDM_FORCE_DWORD = $7fffffff; // force 32-bit size enum + {$EXTERNALSYM D3DSPDM_FORCE_DWORD} + + // destination parameter + D3DSP_DSTSHIFT_SHIFT = 24; + {$EXTERNALSYM D3DSP_DSTSHIFT_SHIFT} + D3DSP_DSTSHIFT_MASK = $0F000000; + {$EXTERNALSYM D3DSP_DSTSHIFT_MASK} + + // destination/source parameter register type + D3DSP_REGTYPE_SHIFT = 28; + {$EXTERNALSYM D3DSP_REGTYPE_SHIFT} + D3DSP_REGTYPE_MASK = $70000000; + {$EXTERNALSYM D3DSP_REGTYPE_MASK} + +type + _D3DSHADER_PARAM_REGISTER_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADER_PARAM_REGISTER_TYPE} + D3DSHADER_PARAM_REGISTER_TYPE = _D3DSHADER_PARAM_REGISTER_TYPE; + {$EXTERNALSYM D3DSHADER_PARAM_REGISTER_TYPE} + TD3DShaderParamRegisterType = _D3DSHADER_PARAM_REGISTER_TYPE; + +const + D3DSPR_TEMP = 0 shl D3DSP_REGTYPE_SHIFT; // Temporary Register File + {$EXTERNALSYM D3DSPR_TEMP} + D3DSPR_INPUT = 1 shl D3DSP_REGTYPE_SHIFT; // Input Register File + {$EXTERNALSYM D3DSPR_INPUT} + D3DSPR_CONST = 2 shl D3DSP_REGTYPE_SHIFT; // Constant Register File + {$EXTERNALSYM D3DSPR_CONST} + D3DSPR_ADDR = 3 shl D3DSP_REGTYPE_SHIFT; // Address Register (VS) + {$EXTERNALSYM D3DSPR_ADDR} + D3DSPR_TEXTURE = 3 shl D3DSP_REGTYPE_SHIFT; // Texture Register File (PS) + {$EXTERNALSYM D3DSPR_TEXTURE} + D3DSPR_RASTOUT = 4 shl D3DSP_REGTYPE_SHIFT; // Rasterizer Register File + {$EXTERNALSYM D3DSPR_RASTOUT} + D3DSPR_ATTROUT = 5 shl D3DSP_REGTYPE_SHIFT; // Attribute Output Register File + {$EXTERNALSYM D3DSPR_ATTROUT} + D3DSPR_TEXCRDOUT = 6 shl D3DSP_REGTYPE_SHIFT; // Texture Coordinate Output Register File + {$EXTERNALSYM D3DSPR_TEXCRDOUT} + D3DSPR_FORCE_DWORD = $7fffffff; // force 32-bit size enum + {$EXTERNALSYM D3DSPR_FORCE_DWORD} + + +type + // Register offsets in the Rasterizer Register File + // + _D3DVS_RASTOUT_OFFSETS = ( + D3DSRO_POSITION {= 0}, + D3DSRO_FOG, + D3DSRO_POINT_SIZE + ); + {$EXTERNALSYM _D3DVS_RASTOUT_OFFSETS} + D3DVS_RASTOUT_OFFSETS = _D3DVS_RASTOUT_OFFSETS; + {$EXTERNALSYM D3DVS_RASTOUT_OFFSETS} + TD3DVSRastOutOffsets = _D3DVS_RASTOUT_OFFSETS; + +// Source operand addressing modes + +const + D3DVS_ADDRESSMODE_SHIFT = 13; + {$EXTERNALSYM D3DVS_ADDRESSMODE_SHIFT} + D3DVS_ADDRESSMODE_MASK = 1 shl D3DVS_ADDRESSMODE_SHIFT; + {$EXTERNALSYM D3DVS_ADDRESSMODE_MASK} + +type + _D3DVS_ADDRESSMODE_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DVS_ADDRESSMODE_TYPE} + D3DVS_ADDRESSMODE_TYPE = _D3DVS_ADDRESSMODE_TYPE; + {$EXTERNALSYM D3DVS_ADDRESSMODE_TYPE} + TD3DVSAddressModeType = _D3DVS_ADDRESSMODE_TYPE; + +const + D3DVS_ADDRMODE_ABSOLUTE = 0 shl D3DVS_ADDRESSMODE_SHIFT; + {$EXTERNALSYM D3DVS_ADDRMODE_ABSOLUTE} + D3DVS_ADDRMODE_RELATIVE = 1 shl D3DVS_ADDRESSMODE_SHIFT; // Relative to register A0 + {$EXTERNALSYM D3DVS_ADDRMODE_RELATIVE} + D3DVS_ADDRMODE_FORCE_DWORD = $7fffffff; // force 32-bit size enum + {$EXTERNALSYM D3DVS_ADDRMODE_FORCE_DWORD} + + // Source operand swizzle definitions + // + D3DVS_SWIZZLE_SHIFT = 16; + {$EXTERNALSYM D3DVS_SWIZZLE_SHIFT} + D3DVS_SWIZZLE_MASK = $00FF0000; + {$EXTERNALSYM D3DVS_SWIZZLE_MASK} + + // The following bits define where to take component X from: + + D3DVS_X_X = 0 shl D3DVS_SWIZZLE_SHIFT; + {$EXTERNALSYM D3DVS_X_X} + D3DVS_X_Y = 1 shl D3DVS_SWIZZLE_SHIFT; + {$EXTERNALSYM D3DVS_X_Y} + D3DVS_X_Z = 2 shl D3DVS_SWIZZLE_SHIFT; + {$EXTERNALSYM D3DVS_X_Z} + D3DVS_X_W = 3 shl D3DVS_SWIZZLE_SHIFT; + {$EXTERNALSYM D3DVS_X_W} + + // The following bits define where to take component Y from: + + D3DVS_Y_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 2); + {$EXTERNALSYM D3DVS_Y_X} + D3DVS_Y_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 2); + {$EXTERNALSYM D3DVS_Y_Y} + D3DVS_Y_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 2); + {$EXTERNALSYM D3DVS_Y_Z} + D3DVS_Y_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 2); + {$EXTERNALSYM D3DVS_Y_W} + + // The following bits define where to take component Z from: + + D3DVS_Z_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 4); + {$EXTERNALSYM D3DVS_Z_X} + D3DVS_Z_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 4); + {$EXTERNALSYM D3DVS_Z_Y} + D3DVS_Z_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 4); + {$EXTERNALSYM D3DVS_Z_Z} + D3DVS_Z_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 4); + {$EXTERNALSYM D3DVS_Z_W} + + // The following bits define where to take component W from: + + D3DVS_W_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 6); + {$EXTERNALSYM D3DVS_W_X} + D3DVS_W_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 6); + {$EXTERNALSYM D3DVS_W_Y} + D3DVS_W_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 6); + {$EXTERNALSYM D3DVS_W_Z} + D3DVS_W_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 6); + {$EXTERNALSYM D3DVS_W_W} + + // 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; + {$EXTERNALSYM D3DVS_NOSWIZZLE} + + // source parameter swizzle + D3DSP_SWIZZLE_SHIFT = 16; + {$EXTERNALSYM D3DSP_SWIZZLE_SHIFT} + D3DSP_SWIZZLE_MASK = $00FF0000; + {$EXTERNALSYM D3DSP_SWIZZLE_MASK} + + 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)); + {$EXTERNALSYM D3DSP_NOSWIZZLE} + + // 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)); + {$EXTERNALSYM D3DSP_REPLICATERED} + + 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)); + {$EXTERNALSYM D3DSP_REPLICATEGREEN} + + 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)); + {$EXTERNALSYM D3DSP_REPLICATEBLUE} + + 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)); + {$EXTERNALSYM D3DSP_REPLICATEALPHA} + + // source parameter modifiers + D3DSP_SRCMOD_SHIFT = 24; + {$EXTERNALSYM D3DSP_SRCMOD_SHIFT} + D3DSP_SRCMOD_MASK = $0F000000; + {$EXTERNALSYM D3DSP_SRCMOD_MASK} + +type + _D3DSHADER_PARAM_SRCMOD_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADER_PARAM_SRCMOD_TYPE} + D3DSHADER_PARAM_SRCMOD_TYPE = _D3DSHADER_PARAM_SRCMOD_TYPE; + {$EXTERNALSYM D3DSHADER_PARAM_SRCMOD_TYPE} + TD3DShaderParamSRCModType = _D3DSHADER_PARAM_SRCMOD_TYPE; + +const + D3DSPSM_NONE = 0 shl D3DSP_SRCMOD_SHIFT; // nop + {$EXTERNALSYM D3DSPSM_NONE} + D3DSPSM_NEG = 1 shl D3DSP_SRCMOD_SHIFT; // negate + {$EXTERNALSYM D3DSPSM_NEG} + D3DSPSM_BIAS = 2 shl D3DSP_SRCMOD_SHIFT; // bias + {$EXTERNALSYM D3DSPSM_BIAS} + D3DSPSM_BIASNEG = 3 shl D3DSP_SRCMOD_SHIFT; // bias and negate + {$EXTERNALSYM D3DSPSM_BIASNEG} + D3DSPSM_SIGN = 4 shl D3DSP_SRCMOD_SHIFT; // sign + {$EXTERNALSYM D3DSPSM_SIGN} + D3DSPSM_SIGNNEG = 5 shl D3DSP_SRCMOD_SHIFT; // sign and negate + {$EXTERNALSYM D3DSPSM_SIGNNEG} + D3DSPSM_COMP = 6 shl D3DSP_SRCMOD_SHIFT; // complement + {$EXTERNALSYM D3DSPSM_COMP} + D3DSPSM_X2 = 7 shl D3DSP_SRCMOD_SHIFT; // *2 + {$EXTERNALSYM D3DSPSM_X2} + D3DSPSM_X2NEG = 8 shl D3DSP_SRCMOD_SHIFT; // *2 and negate + {$EXTERNALSYM D3DSPSM_X2NEG} + D3DSPSM_DZ = 9 shl D3DSP_SRCMOD_SHIFT; // divide through by z component + {$EXTERNALSYM D3DSPSM_DZ} + D3DSPSM_DW = 10 shl D3DSP_SRCMOD_SHIFT; // divide through by w component + {$EXTERNALSYM D3DSPSM_DW} + D3DSPSM_FORCE_DWORD = $7fffffff; // force 32-bit size enum + {$EXTERNALSYM D3DSPSM_FORCE_DWORD} + +// pixel shader version token +//#define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor)) +function D3DPS_VERSION(_Major, _Minor: DWord): DWord; +{$EXTERNALSYM D3DPS_VERSION} + +// vertex shader version token +//#define D3DVS_VERSION(_Major,_Minor) (0xFFFE0000|((_Major)<<8)|(_Minor)) +function D3DVS_VERSION(_Major, _Minor: DWord): DWord; +{$EXTERNALSYM D3DVS_VERSION} + +// extract major/minor from version cap +//#define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF) +function D3DSHADER_VERSION_MAJOR(_Version: DWord): DWord; +{$EXTERNALSYM D3DSHADER_VERSION_MAJOR} +//#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) +function D3DSHADER_VERSION_MINOR(_Version: DWord): DWord; +{$EXTERNALSYM D3DSHADER_VERSION_MINOR} + +const + // destination/source parameter register type + D3DSI_COMMENTSIZE_SHIFT = 16; + {$EXTERNALSYM D3DSI_COMMENTSIZE_SHIFT} + D3DSI_COMMENTSIZE_MASK = $7FFF0000; + {$EXTERNALSYM D3DSI_COMMENTSIZE_MASK} + +//#define D3DSHADER_COMMENT(_DWordSize) \ +// ((((_DWordSize)<=400) + D3DCURSORCAPS_COLOR = $00000001; + {$EXTERNALSYM D3DCURSORCAPS_COLOR} + // Driver supports HW cursor also in low-res modes(height < 400) + D3DCURSORCAPS_LOWRES = $00000002; + {$EXTERNALSYM D3DCURSORCAPS_LOWRES} + + // + // DevCaps + // + D3DDEVCAPS_EXECUTESYSTEMMEMORY = $00000010; { Device can use execute buffers from system memory } + {$EXTERNALSYM D3DDEVCAPS_EXECUTESYSTEMMEMORY} + D3DDEVCAPS_EXECUTEVIDEOMEMORY = $00000020; { Device can use execute buffers from video memory } + {$EXTERNALSYM D3DDEVCAPS_EXECUTEVIDEOMEMORY} + D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; { Device can use TL buffers from system memory } + {$EXTERNALSYM D3DDEVCAPS_TLVERTEXSYSTEMMEMORY} + D3DDEVCAPS_TLVERTEXVIDEOMEMORY = $00000080; { Device can use TL buffers from video memory } + {$EXTERNALSYM D3DDEVCAPS_TLVERTEXVIDEOMEMORY} + D3DDEVCAPS_TEXTURESYSTEMMEMORY = $00000100; { Device can texture from system memory } + {$EXTERNALSYM D3DDEVCAPS_TEXTURESYSTEMMEMORY} + D3DDEVCAPS_TEXTUREVIDEOMEMORY = $00000200; { Device can texture from device memory } + {$EXTERNALSYM D3DDEVCAPS_TEXTUREVIDEOMEMORY} + D3DDEVCAPS_DRAWPRIMTLVERTEX = $00000400; { Device can draw TLVERTEX primitives } + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMTLVERTEX} + D3DDEVCAPS_CANRENDERAFTERFLIP = $00000800; { Device can render without waiting for flip to complete } + {$EXTERNALSYM D3DDEVCAPS_CANRENDERAFTERFLIP} + D3DDEVCAPS_TEXTURENONLOCALVIDMEM = $00001000; { Device can texture from nonlocal video memory } + {$EXTERNALSYM D3DDEVCAPS_TEXTURENONLOCALVIDMEM} + D3DDEVCAPS_DRAWPRIMITIVES2 = $00002000; { Device can support DrawPrimitives2 } + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2} + D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; { Device is texturing from separate memory pools } + {$EXTERNALSYM D3DDEVCAPS_SEPARATETEXTUREMEMORIES} + D3DDEVCAPS_DRAWPRIMITIVES2EX = $00008000; { Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver } + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2EX} + D3DDEVCAPS_HWTRANSFORMANDLIGHT = $00010000; { Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also } + {$EXTERNALSYM D3DDEVCAPS_HWTRANSFORMANDLIGHT} + D3DDEVCAPS_CANBLTSYSTONONLOCAL = $00020000; { Device supports a Tex Blt from system memory to non-local vidmem } + {$EXTERNALSYM D3DDEVCAPS_CANBLTSYSTONONLOCAL} + D3DDEVCAPS_HWRASTERIZATION = $00080000; { Device has HW acceleration for rasterization } + {$EXTERNALSYM D3DDEVCAPS_HWRASTERIZATION} + D3DDEVCAPS_PUREDEVICE = $00100000; { Device supports D3DCREATE_PUREDEVICE } + {$EXTERNALSYM D3DDEVCAPS_PUREDEVICE} + D3DDEVCAPS_QUINTICRTPATCHES = $00200000; { Device supports quintic Beziers and BSplines } + {$EXTERNALSYM D3DDEVCAPS_QUINTICRTPATCHES} + D3DDEVCAPS_RTPATCHES = $00400000; { Device supports Rect and Tri patches } + {$EXTERNALSYM D3DDEVCAPS_RTPATCHES} + D3DDEVCAPS_RTPATCHHANDLEZERO = $00800000; { Indicates that RT Patches may be drawn efficiently using handle 0 } + {$EXTERNALSYM D3DDEVCAPS_RTPATCHHANDLEZERO} + D3DDEVCAPS_NPATCHES = $01000000; { Device supports N-Patches } + {$EXTERNALSYM D3DDEVCAPS_NPATCHES} + + // + // PrimitiveMiscCaps + // + D3DPMISCCAPS_MASKZ = $00000002; + {$EXTERNALSYM D3DPMISCCAPS_MASKZ} + D3DPMISCCAPS_LINEPATTERNREP = $00000004; + {$EXTERNALSYM D3DPMISCCAPS_LINEPATTERNREP} + D3DPMISCCAPS_CULLNONE = $00000010; + {$EXTERNALSYM D3DPMISCCAPS_CULLNONE} + D3DPMISCCAPS_CULLCW = $00000020; + {$EXTERNALSYM D3DPMISCCAPS_CULLCW} + D3DPMISCCAPS_CULLCCW = $00000040; + {$EXTERNALSYM D3DPMISCCAPS_CULLCCW} + D3DPMISCCAPS_COLORWRITEENABLE = $00000080; + {$EXTERNALSYM D3DPMISCCAPS_COLORWRITEENABLE} + D3DPMISCCAPS_CLIPPLANESCALEDPOINTS = $00000100; { Device correctly clips scaled points to clip planes } + {$EXTERNALSYM D3DPMISCCAPS_CLIPPLANESCALEDPOINTS} + D3DPMISCCAPS_CLIPTLVERTS = $00000200; { device will clip post-transformed vertex primitives } + {$EXTERNALSYM D3DPMISCCAPS_CLIPTLVERTS} + D3DPMISCCAPS_TSSARGTEMP = $00000400; { device supports D3DTA_TEMP for temporary register } + {$EXTERNALSYM D3DPMISCCAPS_TSSARGTEMP} + D3DPMISCCAPS_BLENDOP = $00000800; { device supports D3DRS_BLENDOP } + {$EXTERNALSYM D3DPMISCCAPS_BLENDOP} + D3DPMISCCAPS_NULLREFERENCE = $00001000; { Reference Device that doesnt render } + {$EXTERNALSYM D3DPMISCCAPS_NULLREFERENCE} + + // + // LineCaps + // + D3DLINECAPS_TEXTURE = $00000001; + {$EXTERNALSYM D3DLINECAPS_TEXTURE} + D3DLINECAPS_ZTEST = $00000002; + {$EXTERNALSYM D3DLINECAPS_ZTEST} + D3DLINECAPS_BLEND = $00000004; + {$EXTERNALSYM D3DLINECAPS_BLEND} + D3DLINECAPS_ALPHACMP = $00000008; + {$EXTERNALSYM D3DLINECAPS_ALPHACMP} + D3DLINECAPS_FOG = $00000010; + {$EXTERNALSYM D3DLINECAPS_FOG} + + // + // RasterCaps + // + D3DPRASTERCAPS_DITHER = $00000001; + {$EXTERNALSYM D3DPRASTERCAPS_DITHER} + D3DPRASTERCAPS_PAT = $00000008; + {$EXTERNALSYM D3DPRASTERCAPS_PAT} + D3DPRASTERCAPS_ZTEST = $00000010; + {$EXTERNALSYM D3DPRASTERCAPS_ZTEST} + D3DPRASTERCAPS_FOGVERTEX = $00000080; + {$EXTERNALSYM D3DPRASTERCAPS_FOGVERTEX} + D3DPRASTERCAPS_FOGTABLE = $00000100; + {$EXTERNALSYM D3DPRASTERCAPS_FOGTABLE} + D3DPRASTERCAPS_ANTIALIASEDGES = $00001000; + {$EXTERNALSYM D3DPRASTERCAPS_ANTIALIASEDGES} + D3DPRASTERCAPS_MIPMAPLODBIAS = $00002000; + {$EXTERNALSYM D3DPRASTERCAPS_MIPMAPLODBIAS} + D3DPRASTERCAPS_ZBIAS = $00004000; + {$EXTERNALSYM D3DPRASTERCAPS_ZBIAS} + D3DPRASTERCAPS_ZBUFFERLESSHSR = $00008000; + {$EXTERNALSYM D3DPRASTERCAPS_ZBUFFERLESSHSR} + D3DPRASTERCAPS_FOGRANGE = $00010000; + {$EXTERNALSYM D3DPRASTERCAPS_FOGRANGE} + D3DPRASTERCAPS_ANISOTROPY = $00020000; + {$EXTERNALSYM D3DPRASTERCAPS_ANISOTROPY} + D3DPRASTERCAPS_WBUFFER = $00040000; + {$EXTERNALSYM D3DPRASTERCAPS_WBUFFER} + D3DPRASTERCAPS_WFOG = $00100000; + {$EXTERNALSYM D3DPRASTERCAPS_WFOG} + D3DPRASTERCAPS_ZFOG = $00200000; + {$EXTERNALSYM D3DPRASTERCAPS_ZFOG} + D3DPRASTERCAPS_COLORPERSPECTIVE = $00400000; { Device iterates colors perspective correct } + {$EXTERNALSYM D3DPRASTERCAPS_COLORPERSPECTIVE} + D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE = $00800000; + {$EXTERNALSYM D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE} + + // + // ZCmpCaps, AlphaCmpCaps + // + D3DPCMPCAPS_NEVER = $00000001; + {$EXTERNALSYM D3DPCMPCAPS_NEVER} + D3DPCMPCAPS_LESS = $00000002; + {$EXTERNALSYM D3DPCMPCAPS_LESS} + D3DPCMPCAPS_EQUAL = $00000004; + {$EXTERNALSYM D3DPCMPCAPS_EQUAL} + D3DPCMPCAPS_LESSEQUAL = $00000008; + {$EXTERNALSYM D3DPCMPCAPS_LESSEQUAL} + D3DPCMPCAPS_GREATER = $00000010; + {$EXTERNALSYM D3DPCMPCAPS_GREATER} + D3DPCMPCAPS_NOTEQUAL = $00000020; + {$EXTERNALSYM D3DPCMPCAPS_NOTEQUAL} + D3DPCMPCAPS_GREATEREQUAL = $00000040; + {$EXTERNALSYM D3DPCMPCAPS_GREATEREQUAL} + D3DPCMPCAPS_ALWAYS = $00000080; + {$EXTERNALSYM D3DPCMPCAPS_ALWAYS} + + // + // SourceBlendCaps, DestBlendCaps + // + D3DPBLENDCAPS_ZERO = $00000001; + {$EXTERNALSYM D3DPBLENDCAPS_ZERO} + D3DPBLENDCAPS_ONE = $00000002; + {$EXTERNALSYM D3DPBLENDCAPS_ONE} + D3DPBLENDCAPS_SRCCOLOR = $00000004; + {$EXTERNALSYM D3DPBLENDCAPS_SRCCOLOR} + D3DPBLENDCAPS_INVSRCCOLOR = $00000008; + {$EXTERNALSYM D3DPBLENDCAPS_INVSRCCOLOR} + D3DPBLENDCAPS_SRCALPHA = $00000010; + {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHA} + D3DPBLENDCAPS_INVSRCALPHA = $00000020; + {$EXTERNALSYM D3DPBLENDCAPS_INVSRCALPHA} + D3DPBLENDCAPS_DESTALPHA = $00000040; + {$EXTERNALSYM D3DPBLENDCAPS_DESTALPHA} + D3DPBLENDCAPS_INVDESTALPHA = $00000080; + {$EXTERNALSYM D3DPBLENDCAPS_INVDESTALPHA} + D3DPBLENDCAPS_DESTCOLOR = $00000100; + {$EXTERNALSYM D3DPBLENDCAPS_DESTCOLOR} + D3DPBLENDCAPS_INVDESTCOLOR = $00000200; + {$EXTERNALSYM D3DPBLENDCAPS_INVDESTCOLOR} + D3DPBLENDCAPS_SRCALPHASAT = $00000400; + {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHASAT} + D3DPBLENDCAPS_BOTHSRCALPHA = $00000800; + {$EXTERNALSYM D3DPBLENDCAPS_BOTHSRCALPHA} + D3DPBLENDCAPS_BOTHINVSRCALPHA = $00001000; + {$EXTERNALSYM D3DPBLENDCAPS_BOTHINVSRCALPHA} + + // + // ShadeCaps + // + D3DPSHADECAPS_COLORGOURAUDRGB = $00000008; + {$EXTERNALSYM D3DPSHADECAPS_COLORGOURAUDRGB} + D3DPSHADECAPS_SPECULARGOURAUDRGB = $00000200; + {$EXTERNALSYM D3DPSHADECAPS_SPECULARGOURAUDRGB} + D3DPSHADECAPS_ALPHAGOURAUDBLEND = $00004000; + {$EXTERNALSYM D3DPSHADECAPS_ALPHAGOURAUDBLEND} + D3DPSHADECAPS_FOGGOURAUD = $00080000; + {$EXTERNALSYM D3DPSHADECAPS_FOGGOURAUD} + + // + // TextureCaps + // + D3DPTEXTURECAPS_PERSPECTIVE = $00000001; { Perspective-correct texturing is supported } + {$EXTERNALSYM D3DPTEXTURECAPS_PERSPECTIVE} + D3DPTEXTURECAPS_POW2 = $00000002; { Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. } + {$EXTERNALSYM D3DPTEXTURECAPS_POW2} + D3DPTEXTURECAPS_ALPHA = $00000004; { Alpha in texture pixels is supported } + {$EXTERNALSYM D3DPTEXTURECAPS_ALPHA} + D3DPTEXTURECAPS_SQUAREONLY = $00000020; { Only square textures are supported } + {$EXTERNALSYM D3DPTEXTURECAPS_SQUAREONLY} + D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040; { Texture indices are not scaled by the texture size prior to interpolation } + {$EXTERNALSYM D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE} + D3DPTEXTURECAPS_ALPHAPALETTE = $00000080; { Device can draw alpha from texture palettes } + {$EXTERNALSYM D3DPTEXTURECAPS_ALPHAPALETTE} + // 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; + {$EXTERNALSYM D3DPTEXTURECAPS_NONPOW2CONDITIONAL} + D3DPTEXTURECAPS_PROJECTED = $00000400; { Device can do D3DTTFF_PROJECTED } + {$EXTERNALSYM D3DPTEXTURECAPS_PROJECTED} + D3DPTEXTURECAPS_CUBEMAP = $00000800; { Device can do cubemap textures } + {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP} + D3DPTEXTURECAPS_VOLUMEMAP = $00002000; { Device can do volume textures } + {$EXTERNALSYM D3DPTEXTURECAPS_VOLUMEMAP} + D3DPTEXTURECAPS_MIPMAP = $00004000; { Device can do mipmapped textures } + {$EXTERNALSYM D3DPTEXTURECAPS_MIPMAP} + D3DPTEXTURECAPS_MIPVOLUMEMAP = $00008000; { Device can do mipmapped volume textures } + {$EXTERNALSYM D3DPTEXTURECAPS_MIPVOLUMEMAP} + D3DPTEXTURECAPS_MIPCUBEMAP = $00010000; { Device can do mipmapped cube maps } + {$EXTERNALSYM D3DPTEXTURECAPS_MIPCUBEMAP} + D3DPTEXTURECAPS_CUBEMAP_POW2 = $00020000; { Device requires that cubemaps be power-of-2 dimension } + {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP_POW2} + D3DPTEXTURECAPS_VOLUMEMAP_POW2 = $00040000; { Device requires that volume maps be power-of-2 dimension } + {$EXTERNALSYM D3DPTEXTURECAPS_VOLUMEMAP_POW2} + + // + // TextureFilterCaps + // + D3DPTFILTERCAPS_MINFPOINT = $00000100; { Min Filter } + {$EXTERNALSYM D3DPTFILTERCAPS_MINFPOINT} + D3DPTFILTERCAPS_MINFLINEAR = $00000200; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFLINEAR} + D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFANISOTROPIC} + D3DPTFILTERCAPS_MIPFPOINT = $00010000; { Mip Filter } + {$EXTERNALSYM D3DPTFILTERCAPS_MIPFPOINT} + D3DPTFILTERCAPS_MIPFLINEAR = $00020000; + {$EXTERNALSYM D3DPTFILTERCAPS_MIPFLINEAR} + D3DPTFILTERCAPS_MAGFPOINT = $01000000; { Mag Filter } + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFPOINT} + D3DPTFILTERCAPS_MAGFLINEAR = $02000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFLINEAR} + D3DPTFILTERCAPS_MAGFANISOTROPIC = $04000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFANISOTROPIC} + D3DPTFILTERCAPS_MAGFAFLATCUBIC = $08000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFAFLATCUBIC} + D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC} + + // + // TextureAddressCaps + // + D3DPTADDRESSCAPS_WRAP = $00000001; + {$EXTERNALSYM D3DPTADDRESSCAPS_WRAP} + D3DPTADDRESSCAPS_MIRROR = $00000002; + {$EXTERNALSYM D3DPTADDRESSCAPS_MIRROR} + D3DPTADDRESSCAPS_CLAMP = $00000004; + {$EXTERNALSYM D3DPTADDRESSCAPS_CLAMP} + D3DPTADDRESSCAPS_BORDER = $00000008; + {$EXTERNALSYM D3DPTADDRESSCAPS_BORDER} + D3DPTADDRESSCAPS_INDEPENDENTUV = $00000010; + {$EXTERNALSYM D3DPTADDRESSCAPS_INDEPENDENTUV} + D3DPTADDRESSCAPS_MIRRORONCE = $00000020; + {$EXTERNALSYM D3DPTADDRESSCAPS_MIRRORONCE} + + // + // StencilCaps + // + D3DSTENCILCAPS_KEEP = $00000001; + {$EXTERNALSYM D3DSTENCILCAPS_KEEP} + D3DSTENCILCAPS_ZERO = $00000002; + {$EXTERNALSYM D3DSTENCILCAPS_ZERO} + D3DSTENCILCAPS_REPLACE = $00000004; + {$EXTERNALSYM D3DSTENCILCAPS_REPLACE} + D3DSTENCILCAPS_INCRSAT = $00000008; + {$EXTERNALSYM D3DSTENCILCAPS_INCRSAT} + D3DSTENCILCAPS_DECRSAT = $00000010; + {$EXTERNALSYM D3DSTENCILCAPS_DECRSAT} + D3DSTENCILCAPS_INVERT = $00000020; + {$EXTERNALSYM D3DSTENCILCAPS_INVERT} + D3DSTENCILCAPS_INCR = $00000040; + {$EXTERNALSYM D3DSTENCILCAPS_INCR} + D3DSTENCILCAPS_DECR = $00000080; + {$EXTERNALSYM D3DSTENCILCAPS_DECR} + + // + // TextureOpCaps + // + D3DTEXOPCAPS_DISABLE = $00000001; + {$EXTERNALSYM D3DTEXOPCAPS_DISABLE} + D3DTEXOPCAPS_SELECTARG1 = $00000002; + {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG1} + D3DTEXOPCAPS_SELECTARG2 = $00000004; + {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG2} + D3DTEXOPCAPS_MODULATE = $00000008; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE} + D3DTEXOPCAPS_MODULATE2X = $00000010; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE2X} + D3DTEXOPCAPS_MODULATE4X = $00000020; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE4X} + D3DTEXOPCAPS_ADD = $00000040; + {$EXTERNALSYM D3DTEXOPCAPS_ADD} + D3DTEXOPCAPS_ADDSIGNED = $00000080; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED} + D3DTEXOPCAPS_ADDSIGNED2X = $00000100; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED2X} + D3DTEXOPCAPS_SUBTRACT = $00000200; + {$EXTERNALSYM D3DTEXOPCAPS_SUBTRACT} + D3DTEXOPCAPS_ADDSMOOTH = $00000400; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSMOOTH} + D3DTEXOPCAPS_BLENDDIFFUSEALPHA = $00000800; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDDIFFUSEALPHA} + D3DTEXOPCAPS_BLENDTEXTUREALPHA = $00001000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHA} + D3DTEXOPCAPS_BLENDFACTORALPHA = $00002000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDFACTORALPHA} + D3DTEXOPCAPS_BLENDTEXTUREALPHAPM = $00004000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHAPM} + D3DTEXOPCAPS_BLENDCURRENTALPHA = $00008000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDCURRENTALPHA} + D3DTEXOPCAPS_PREMODULATE = $00010000; + {$EXTERNALSYM D3DTEXOPCAPS_PREMODULATE} + D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR = $00020000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR} + D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA = $00040000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA} + D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR = $00080000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR} + D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA = $00100000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA} + D3DTEXOPCAPS_BUMPENVMAP = $00200000; + {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAP} + D3DTEXOPCAPS_BUMPENVMAPLUMINANCE = $00400000; + {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAPLUMINANCE} + D3DTEXOPCAPS_DOTPRODUCT3 = $00800000; + {$EXTERNALSYM D3DTEXOPCAPS_DOTPRODUCT3} + D3DTEXOPCAPS_MULTIPLYADD = $01000000; + {$EXTERNALSYM D3DTEXOPCAPS_MULTIPLYADD} + D3DTEXOPCAPS_LERP = $02000000; + {$EXTERNALSYM D3DTEXOPCAPS_LERP} + + // + // FVFCaps + // + D3DFVFCAPS_TEXCOORDCOUNTMASK = $0000ffff; { mask for texture coordinate count field } + {$EXTERNALSYM D3DFVFCAPS_TEXCOORDCOUNTMASK} + D3DFVFCAPS_DONOTSTRIPELEMENTS = $00080000; { Device prefers that vertex elements not be stripped } + {$EXTERNALSYM D3DFVFCAPS_DONOTSTRIPELEMENTS} + D3DFVFCAPS_PSIZE = $00100000; { Device can receive point size } + {$EXTERNALSYM D3DFVFCAPS_PSIZE} + + // + // VertexProcessingCaps + // + D3DVTXPCAPS_TEXGEN = $00000001; { device can do texgen } + {$EXTERNALSYM D3DVTXPCAPS_TEXGEN} + D3DVTXPCAPS_MATERIALSOURCE7 = $00000002; { device can do DX7-level colormaterialsource ops } + {$EXTERNALSYM D3DVTXPCAPS_MATERIALSOURCE7} + D3DVTXPCAPS_DIRECTIONALLIGHTS = $00000008; { device can do directional lights } + {$EXTERNALSYM D3DVTXPCAPS_DIRECTIONALLIGHTS} + D3DVTXPCAPS_POSITIONALLIGHTS = $00000010; { device can do positional lights (includes point and spot) } + {$EXTERNALSYM D3DVTXPCAPS_POSITIONALLIGHTS} + D3DVTXPCAPS_LOCALVIEWER = $00000020; { device can do local viewer } + {$EXTERNALSYM D3DVTXPCAPS_LOCALVIEWER} + D3DVTXPCAPS_TWEENING = $00000040; { device can do vertex tweening } + {$EXTERNALSYM D3DVTXPCAPS_TWEENING} + D3DVTXPCAPS_NO_VSDT_UBYTE4 = $00000080; { device does not support D3DVSDT_UBYTE4 } + {$EXTERNALSYM D3DVTXPCAPS_NO_VSDT_UBYTE4} + + + + +(*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8.h + * Content: Direct3D include file + * + ****************************************************************************) + +(* This identifier is passed to Direct3DCreate8 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, Direct3DCreate8 will fail. + * (The number itself has no meaning.)*) + +const + D3D_SDK_VERSION = DWord(220); + {$EXTERNALSYM D3D_SDK_VERSION} + +type + HMONITOR = THandle; + {$EXTERNALSYM HMONITOR} + + + +(* + * Direct3D interfaces + *) + + + // forward interfaces declaration + IDirect3D8 = interface; + IDirect3DDevice8 = interface; + IDirect3DResource8 = interface; + IDirect3DBaseTexture8 = interface; + IDirect3DTexture8 = interface; + IDirect3DVolumeTexture8 = interface; + IDirect3DCubeTexture8 = interface; + IDirect3DVertexBuffer8 = interface; + IDirect3DIndexBuffer8 = interface; + IDirect3DSurface8 = interface; + IDirect3DVolume8 = interface; + IDirect3DSwapChain8 = interface; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D8);'} + {$EXTERNALSYM IDirect3D8} + IDirect3D8 = interface(IUnknown) + ['{1DD9E8DA-1C77-4d40-B0CF-98FEFDFF9512}'] + (*** IDirect3D8 methods ***) + function RegisterSoftwareDevice(pInitializeFunction: Pointer): HResult; stdcall; + function GetAdapterCount: LongWord; stdcall; + function GetAdapterIdentifier(Adapter: LongWord; Flags: DWord; out pIdentifier: TD3DAdapterIdentifier8): HResult; stdcall; + function GetAdapterModeCount (Adapter: LongWord): LongWord; stdcall; + function EnumAdapterModes(Adapter, Mode: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall; + function GetAdapterDisplayMode(Adapter: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall; + function CheckDeviceType(Adapter: LongWord; CheckType: TD3DDevType; DisplayFormat, 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): HResult; stdcall; + function CheckDepthStencilMatch(Adapter: LongWord; DeviceType: TD3DDevType; AdapterFormat, RenderTargetFormat, DepthStencilFormat: TD3DFormat): HResult; stdcall; + function GetDeviceCaps(Adapter: LongWord; DeviceType: TD3DDevType; out pCaps: TD3DCaps8): HResult; stdcall; + function GetAdapterMonitor(Adapter: LongWord): HMONITOR; stdcall; + function CreateDevice(Adapter: LongWord; DeviceType: TD3DDevType; hFocusWindow: HWND; BehaviorFlags: DWord; var pPresentationParameters: TD3DPresentParameters; out ppReturnedDeviceInterface: IDirect3DDevice8): HResult; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice8);'} + {$EXTERNALSYM IDirect3DDevice8} + IDirect3DDevice8 = interface(IUnknown) + ['{7385E5DF-8FE8-41D5-86B6-D7B48547B6CF}'] + (*** IDirect3DDevice8 methods ***) + function TestCooperativeLevel: HResult; stdcall; + function GetAvailableTextureMem: LongWord; stdcall; + function ResourceManagerDiscardBytes(Bytes: DWord): HResult; stdcall; + function GetDirect3D(out ppD3D8: IDirect3D8): HResult; stdcall; + function GetDeviceCaps(out pCaps: TD3DCaps8): HResult; stdcall; + function GetDisplayMode(out pMode: TD3DDisplayMode): HResult; stdcall; + function GetCreationParameters(out pParameters: TD3DDeviceCreationParameters): HResult; stdcall; + function SetCursorProperties(XHotSpot, YHotSpot: LongWord; pCursorBitmap: IDirect3DSurface8): HResult; stdcall; + procedure SetCursorPosition(XScreenSpace, YScreenSpace: Integer; Flags: DWord); stdcall; + function ShowCursor(bShow: BOOL): BOOL; stdcall; + function CreateAdditionalSwapChain(const pPresentationParameters: TD3DPresentParameters; out pSwapChain: IDirect3DSwapChain8): HResult; stdcall; + function Reset(const pPresentationParameters: TD3DPresentParameters): HResult; stdcall; + function Present(pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall; + function GetBackBuffer(BackBuffer: LongWord; _Type: TD3DBackBufferType; out ppBackBuffer: IDirect3DSurface8): HResult; stdcall; + function GetRasterStatus(out pRasterStatus: TD3DRasterStatus): HResult; stdcall; + procedure SetGammaRamp(Flags: DWord; const pRamp: TD3DGammaRamp); stdcall; + procedure GetGammaRamp(out pRamp: TD3DGammaRamp); stdcall; + function CreateTexture(Width, Height, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppTexture: IDirect3DTexture8): HResult; stdcall; + function CreateVolumeTexture(Width, Height, Depth, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall; + function CreateCubeTexture(EdgeLength, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall; + function CreateVertexBuffer(Length: LongWord; Usage, FVF: DWord; Pool: TD3DPool; out ppVertexBuffer: IDirect3DVertexBuffer8): HResult; stdcall; + function CreateIndexBuffer(Length: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppIndexBuffer: IDirect3DIndexBuffer8): HResult; stdcall; + function CreateRenderTarget(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; Lockable: BOOL; out ppSurface: IDirect3DSurface8): HResult; stdcall; + function CreateDepthStencilSurface(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; out ppSurface: IDirect3DSurface8): HResult; stdcall; + function CreateImageSurface(Width, Height: LongWord; Format: TD3DFormat; out ppSurface: IDirect3DSurface8): HResult; stdcall; + function CopyRects(pSourceSurface: IDirect3DSurface8; pSourceRectsArray: PRect; cRects: LongWord; pDestinationSurface: IDirect3DSurface8; pDestPointsArray: PPoint): HResult; stdcall; + function UpdateTexture(pSourceTexture, pDestinationTexture: IDirect3DBaseTexture8): HResult; stdcall; + function GetFrontBuffer(pDestSurface: IDirect3DSurface8): HResult; stdcall; + function SetRenderTarget(pRenderTarget, pNewZStencil: IDirect3DSurface8): HResult; stdcall; + function GetRenderTarget(out ppRenderTarget: IDirect3DSurface8): HResult; stdcall; + function GetDepthStencilSurface(out ppZStencilSurface: IDirect3DSurface8): 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: TD3DViewport8): HResult; stdcall; + function GetViewport(out pViewport: TD3DViewport8): HResult; stdcall; + function SetMaterial(const pMaterial: TD3DMaterial8): HResult; stdcall; + function GetMaterial(out pMaterial: TD3DMaterial8): HResult; stdcall; + function SetLight(Index: DWord; const pLight: TD3DLight8): HResult; stdcall; + function GetLight(Index: DWord; out pLight: TD3DLight8): 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 BeginStateBlock: HResult; stdcall; + function EndStateBlock(out pToken: DWord): HResult; stdcall; + function ApplyStateBlock(Token: DWord): HResult; stdcall; + function CaptureStateBlock(Token: DWord): HResult; stdcall; + function DeleteStateBlock(Token: DWord): HResult; stdcall; + function CreateStateBlock(_Type: TD3DStateBlockType; out Token: DWord): HResult; stdcall; + function SetClipStatus(const pClipStatus: TD3DClipStatus8): HResult; stdcall; + function GetClipStatus(out pClipStatus: TD3DClipStatus8): HResult; stdcall; + function GetTexture(Stage: DWord; out ppTexture: IDirect3DBaseTexture8): HResult; stdcall; + function SetTexture(Stage: DWord; pTexture: IDirect3DBaseTexture8): HResult; stdcall; + function GetTextureStageState(Stage: DWord; _Type: TD3DTextureStageStateType; out pValue: DWord): HResult; stdcall; + function SetTextureStageState(Stage: DWord; _Type: TD3DTextureStageStateType; Value: DWord): HResult; stdcall; + function ValidateDevice(out pNumPasses: DWord): HResult; stdcall; + function GetInfo(DevInfoID: DWord; out pDevInfoStruct; DevInfoStructSize: 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 DrawPrimitive(PrimitiveType: TD3DPrimitiveType; StartVertex, PrimitiveCount: LongWord): HResult; stdcall; + function DrawIndexedPrimitive(_Type: TD3DPrimitiveType; minIndex, NumVertices, startIndex, primCount: LongWord): HResult; stdcall; + function DrawPrimitiveUP(PrimitiveType: TD3DPrimitiveType; PrimitiveCount: LongWord; const pVertexStreamZeroData; VertexStreamZeroStride: LongWord): HResult; stdcall; + function DrawIndexedPrimitiveUP(PrimitiveType: TD3DPrimitiveType; MinVertexIndex, NumVertexIndices, PrimitiveCount: LongWord; const pIndexData; IndexDataFormat: TD3DFormat; const pVertexStreamZeroData; VertexStreamZeroStride: LongWord): HResult; stdcall; + function ProcessVertices(SrcStartIndex, DestIndex, VertexCount: LongWord; pDestBuffer: IDirect3DVertexBuffer8; Flags: DWord): HResult; stdcall; + function CreateVertexShader(pDeclaration, pFunction: PDWord; out pHandle: DWord; Usage: DWord): HResult; stdcall; + function SetVertexShader(Handle: DWord): HResult; stdcall; + function GetVertexShader(out pHandle: DWord): HResult; stdcall; + function DeleteVertexShader(Handle: DWord): HResult; stdcall; + function SetVertexShaderConstant(_Register: DWord; const pConstantData; ConstantCount: DWord): HResult; stdcall; + function GetVertexShaderConstant(_Register: DWord; out pConstantData; ConstantCount: DWord): HResult; stdcall; + function GetVertexShaderDeclaration(Handle: DWord; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall; + function GetVertexShaderFunction(Handle: DWord; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall; + function SetStreamSource(StreamNumber: LongWord; pStreamData: IDirect3DVertexBuffer8; Stride: LongWord): HResult; stdcall; + function GetStreamSource(StreamNumber: LongWord; out ppStreamData: IDirect3DVertexBuffer8; out pStride: LongWord): HResult; stdcall; + function SetIndices(pIndexData: IDirect3DIndexBuffer8; BaseVertexIndex: LongWord): HResult; stdcall; + function GetIndices(out ppIndexData: IDirect3DIndexBuffer8; out pBaseVertexIndex: LongWord): HResult; stdcall; + function CreatePixelShader(pFunction: PDWord; out pHandle: DWord): HResult; stdcall; + function SetPixelShader(Handle: DWord): HResult; stdcall; + function GetPixelShader(out Handle: DWord): HResult; stdcall; + function DeletePixelShader(Handle: DWord): HResult; stdcall; + function SetPixelShaderConstant(_Register: DWord; const pConstantData; ConstantCount: DWord): HResult; stdcall; + function GetPixelShaderConstant(_Register: DWord; out pConstantData; ConstantCount: DWord): HResult; stdcall; + function GetPixelShaderFunction(Handle: DWord; pData: Pointer; var pSizeOfData: DWord): 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; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSwapChain8);'} + {$EXTERNALSYM IDirect3DSwapChain8} + IDirect3DSwapChain8 = interface(IUnknown) + ['{928C088B-76B9-4C6B-A536-A590853876CD}'] + (*** IDirect3DSwapChain8 methods ***) + function Present(pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall; + function GetBackBuffer(BackBuffer: LongWord; _Type: TD3DBackBufferType; out ppBackBuffer: IDirect3DSurface8): HResult; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DResource8);'} + {$EXTERNALSYM IDirect3DResource8} + IDirect3DResource8 = interface(IUnknown) + ['{1B36BB7B-09B7-410a-B445-7D1430D7B33F}'] + (*** IDirect3DResource8 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice8): 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 SetPriority(PriorityNew: DWord): DWord; stdcall; + function GetPriority: DWord; stdcall; + procedure PreLoad; stdcall; + function GetType: TD3DResourceType; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DBaseTexture8);'} + {$EXTERNALSYM IDirect3DBaseTexture8} + IDirect3DBaseTexture8 = interface(IDirect3DResource8) + ['{B4211CFA-51B9-4a9f-AB78-DB99B2BB678E}'] + (*** IDirect3DBaseTexture8 methods ***) + function SetLOD(LODNew: DWord): DWord; stdcall; + function GetLOD: DWord; stdcall; + function GetLevelCount: DWord; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DTexture8);'} + {$EXTERNALSYM IDirect3DTexture8} + IDirect3DTexture8 = interface(IDirect3DBaseTexture8) + ['{E4CDD575-2866-4f01-B12E-7EECE1EC9358}'] + (*** IDirect3DTexture8 methods ***) + function GetLevelDesc(Level: LongWord; out pDesc: TD3DSurfaceDesc): HResult; stdcall; + function GetSurfaceLevel(Level: LongWord; out ppSurfaceLevel: IDirect3DSurface8): 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVolumeTexture8);'} + {$EXTERNALSYM IDirect3DVolumeTexture8} + IDirect3DVolumeTexture8 = interface(IDirect3DBaseTexture8) + ['{E4CDD575-2866-4f01-B12E-7EECE1EC9358}'] + (*** IDirect3DVolumeTexture8 methods ***) + function GetLevelDesc(Level: LongWord; out pDesc: TD3DVolumeDesc): HResult; stdcall; + function GetVolumeLevel(Level: LongWord; out ppVolumeLevel: IDirect3DVolume8): 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DCubeTexture8);'} + {$EXTERNALSYM IDirect3DCubeTexture8} + IDirect3DCubeTexture8 = interface(IDirect3DBaseTexture8) + ['{3EE5B968-2ACA-4c34-8BB5-7E0C3D19B750}'] + (*** IDirect3DCubeTexture8 methods ***) + function GetLevelDesc(Level: LongWord; out pDesc: TD3DSurfaceDesc): HResult; stdcall; + function GetCubeMapSurface(FaceType: TD3DCubeMapFaces; Level: LongWord; out ppCubeMapSurface: IDirect3DSurface8): 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexBuffer8);'} + {$EXTERNALSYM IDirect3DVertexBuffer8} + IDirect3DVertexBuffer8 = interface(IDirect3DResource8) + ['{8AEEEAC7-05F9-44d4-B591-000B0DF1CB95}'] + (*** IDirect3DVertexBuffer8 methods ***) + function Lock(OffsetToLock, SizeToLock: LongWord; out ppbData: PByte; Flags: DWord): HResult; stdcall; + function Unlock: HResult; stdcall; + function GetDesc(out pDesc: TD3DVertexBufferDesc): HResult; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DIndexBuffer8);'} + {$EXTERNALSYM IDirect3DIndexBuffer8} + IDirect3DIndexBuffer8 = interface(IDirect3DResource8) + ['{0E689C9A-053D-44a0-9D92-DB0E3D750F86}'] + (*** IDirect3DIndexBuffer8 methods ***) + function Lock(OffsetToLock, SizeToLock: DWord; out ppbData: PByte; Flags: DWord): HResult; stdcall; + function Unlock: HResult; stdcall; + function GetDesc(out pDesc: TD3DIndexBufferDesc): HResult; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSurface8);'} + {$EXTERNALSYM IDirect3DSurface8} + IDirect3DSurface8 = interface(IUnknown) + ['{B96EEBCA-B326-4ea5-882F-2FF5BAE021DD}'] + (*** IDirect3DSurface8 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice8): 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; 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; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVolume8);'} + {$EXTERNALSYM IDirect3DVolume8} + IDirect3DVolume8 = interface(IUnknown) + ['{BD7349F5-14F1-42e4-9C79-972380DB40C0}'] + (*** IDirect3DVolume8 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice8): 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; + + + +(* + * Interface IID's + *) +type + IID_IDirect3D8 = IDirect3D8; + {$EXTERNALSYM IID_IDirect3D8} + IID_IDirect3DDevice8 = IDirect3DDevice8; + {$EXTERNALSYM IID_IDirect3DDevice8} + IID_IDirect3DResource8 = IDirect3DResource8; + {$EXTERNALSYM IID_IDirect3DResource8} + IID_IDirect3DBaseTexture8 = IDirect3DBaseTexture8; + {$EXTERNALSYM IID_IDirect3DBaseTexture8} + IID_IDirect3DTexture8 = IDirect3DTexture8; + {$EXTERNALSYM IID_IDirect3DTexture8} + IID_IDirect3DCubeTexture8 = IDirect3DCubeTexture8; + {$EXTERNALSYM IID_IDirect3DCubeTexture8} + IID_IDirect3DVolumeTexture8 = IDirect3DVolumeTexture8; + {$EXTERNALSYM IID_IDirect3DVolumeTexture8} + IID_IDirect3DVertexBuffer8 = IDirect3DVertexBuffer8; + {$EXTERNALSYM IID_IDirect3DVertexBuffer8} + IID_IDirect3DIndexBuffer8 = IDirect3DIndexBuffer8; + {$EXTERNALSYM IID_IDirect3DIndexBuffer8} + IID_IDirect3DSurface8 = IDirect3DSurface8; + {$EXTERNALSYM IID_IDirect3DSurface8} + IID_IDirect3DVolume8 = IDirect3DVolume8; + {$EXTERNALSYM IID_IDirect3DVolume8} + IID_IDirect3DSwapChain8 = IDirect3DSwapChain8; + {$EXTERNALSYM IID_IDirect3DSwapChain8} + + +const +{**************************************************************************** + * Flags for SetPrivateData method on all D3D8 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 D3D8 object is freed. + ****************************************************************************} + D3DSPD_IUNKNOWN = $00000001; + {$EXTERNALSYM D3DSPD_IUNKNOWN} + +(**************************************************************************** + * + * Parameter for IDirect3D8 Enum and GetCaps8 functions to get the info for + * the current mode only. + * + ****************************************************************************) + + D3DCURRENT_DISPLAY_MODE = $00EFFFFF; + {$EXTERNALSYM D3DCURRENT_DISPLAY_MODE} + +(**************************************************************************** + * + * Flags for IDirect3D8::CreateDevice's BehaviorFlags + * + ****************************************************************************) + + D3DCREATE_FPU_PRESERVE = $00000002; + {$EXTERNALSYM D3DCREATE_FPU_PRESERVE} + D3DCREATE_MULTITHREADED = $00000004; + {$EXTERNALSYM D3DCREATE_MULTITHREADED} + + D3DCREATE_PUREDEVICE = $00000010; + {$EXTERNALSYM D3DCREATE_PUREDEVICE} + D3DCREATE_SOFTWARE_VERTEXPROCESSING = $00000020; + {$EXTERNALSYM D3DCREATE_SOFTWARE_VERTEXPROCESSING} + D3DCREATE_HARDWARE_VERTEXPROCESSING = $00000040; + {$EXTERNALSYM D3DCREATE_HARDWARE_VERTEXPROCESSING} + D3DCREATE_MIXED_VERTEXPROCESSING = $00000080; + {$EXTERNALSYM D3DCREATE_MIXED_VERTEXPROCESSING} + + D3DCREATE_DISABLE_DRIVER_MANAGEMENT = $00000100; + {$EXTERNALSYM D3DCREATE_DISABLE_DRIVER_MANAGEMENT} + + +(**************************************************************************** + * + * Parameter for IDirect3D8::CreateDevice's iAdapter + * + ****************************************************************************) + + D3DADAPTER_DEFAULT = 0; + {$EXTERNALSYM D3DADAPTER_DEFAULT} + +(**************************************************************************** + * + * Flags for IDirect3D8::EnumAdapters + * + ****************************************************************************) + + D3DENUM_NO_WHQL_LEVEL = $00000002; + {$EXTERNALSYM D3DENUM_NO_WHQL_LEVEL} + +(**************************************************************************** + * + * Maximum number of back-buffers supported in DX8 + * + ****************************************************************************) + + D3DPRESENT_BACK_BUFFERS_MAX = 3; + {$EXTERNALSYM D3DPRESENT_BACK_BUFFERS_MAX} + +(**************************************************************************** + * + * Flags for IDirect3DDevice8::SetGammaRamp + * + ****************************************************************************) + + D3DSGR_NO_CALIBRATION = $00000000; + {$EXTERNALSYM D3DSGR_NO_CALIBRATION} + D3DSGR_CALIBRATE = $00000001; + {$EXTERNALSYM D3DSGR_CALIBRATE} + +(**************************************************************************** + * + * Flags for IDirect3DDevice8::SetCursorPosition + * + ****************************************************************************) + + D3DCURSOR_IMMEDIATE_UPDATE = $00000001; + {$EXTERNALSYM D3DCURSOR_IMMEDIATE_UPDATE} + +(**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************) + + +(* + * DirectDraw error codes + *) + _FACD3D = $876; + {$EXTERNALSYM _FACD3D} + +//#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +function MAKE_D3DHRESULT(Code: DWord): DWord; +{$EXTERNALSYM MAKE_D3DHRESULT} + +const + MAKE_D3DHRESULT_R = (1 shl 31) or (_FACD3D shl 16); + +(* + * Direct3D Errors + *) + D3D_OK = S_OK; + {$EXTERNALSYM D3D_OK} + + D3DERR_WRONGTEXTUREFORMAT = HResult(MAKE_D3DHRESULT_R or 2072); + {$EXTERNALSYM D3DERR_WRONGTEXTUREFORMAT} + D3DERR_UNSUPPORTEDCOLOROPERATION = HResult(MAKE_D3DHRESULT_R or 2073); + {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLOROPERATION} + D3DERR_UNSUPPORTEDCOLORARG = HResult(MAKE_D3DHRESULT_R or 2074); + {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLORARG} + D3DERR_UNSUPPORTEDALPHAOPERATION = HResult(MAKE_D3DHRESULT_R or 2075); + {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAOPERATION} + D3DERR_UNSUPPORTEDALPHAARG = HResult(MAKE_D3DHRESULT_R or 2076); + {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAARG} + D3DERR_TOOMANYOPERATIONS = HResult(MAKE_D3DHRESULT_R or 2077); + {$EXTERNALSYM D3DERR_TOOMANYOPERATIONS} + D3DERR_CONFLICTINGTEXTUREFILTER = HResult(MAKE_D3DHRESULT_R or 2078); + {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREFILTER} + D3DERR_UNSUPPORTEDFACTORVALUE = HResult(MAKE_D3DHRESULT_R or 2079); + {$EXTERNALSYM D3DERR_UNSUPPORTEDFACTORVALUE} + D3DERR_CONFLICTINGRENDERSTATE = HResult(MAKE_D3DHRESULT_R or 2081); + {$EXTERNALSYM D3DERR_CONFLICTINGRENDERSTATE} + D3DERR_UNSUPPORTEDTEXTUREFILTER = HResult(MAKE_D3DHRESULT_R or 2082); + {$EXTERNALSYM D3DERR_UNSUPPORTEDTEXTUREFILTER} + D3DERR_CONFLICTINGTEXTUREPALETTE = HResult(MAKE_D3DHRESULT_R or 2086); + {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREPALETTE} + D3DERR_DRIVERINTERNALERROR = HResult(MAKE_D3DHRESULT_R or 2087); + {$EXTERNALSYM D3DERR_DRIVERINTERNALERROR} + + D3DERR_NOTFOUND = HResult(MAKE_D3DHRESULT_R or 2150); + {$EXTERNALSYM D3DERR_NOTFOUND} + D3DERR_MOREDATA = HResult(MAKE_D3DHRESULT_R or 2151); + {$EXTERNALSYM D3DERR_MOREDATA} + D3DERR_DEVICELOST = HResult(MAKE_D3DHRESULT_R or 2152); + {$EXTERNALSYM D3DERR_DEVICELOST} + D3DERR_DEVICENOTRESET = HResult(MAKE_D3DHRESULT_R or 2153); + {$EXTERNALSYM D3DERR_DEVICENOTRESET} + D3DERR_NOTAVAILABLE = HResult(MAKE_D3DHRESULT_R or 2154); + {$EXTERNALSYM D3DERR_NOTAVAILABLE} + D3DERR_OUTOFVIDEOMEMORY = HResult(MAKE_D3DHRESULT_R or 380); + {$EXTERNALSYM D3DERR_OUTOFVIDEOMEMORY} + D3DERR_INVALIDDEVICE = HResult(MAKE_D3DHRESULT_R or 2155); + {$EXTERNALSYM D3DERR_INVALIDDEVICE} + D3DERR_INVALIDCALL = HResult(MAKE_D3DHRESULT_R or 2156); + {$EXTERNALSYM D3DERR_INVALIDCALL} + D3DERR_DRIVERINVALIDCALL = HResult(MAKE_D3DHRESULT_R or 2157); + {$EXTERNALSYM D3DERR_DRIVERINVALIDCALL} + + + +(* + * DLL Function for creating a Direct3D8 object. This object supports + * enumeration and allows the creation of Direct3DDevice8 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 Direct3D8Loaded: Boolean; +function LoadDirect3D8: Boolean; +function UnLoadDirect3D8: Boolean; + +// 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 DIRECT3D8_DYNAMIC_LINK} +type + TDirect3DCreate8 = function (SDKVersion: LongWord): Pointer; stdcall; + +var + _Direct3DCreate8: TDirect3DCreate8 = nil; + +{$ELSE} +function _Direct3DCreate8(SDKVersion: LongWord): Pointer; stdcall; +{$ENDIF} + +function Direct3DCreate8(SDKVersion: LongWord): IDirect3D8; stdcall; +{$EXTERNALSYM Direct3DCreate8} + + +//******************************************************************** +// Introduced types for compatibility with DirectXGraphics.pas translation +// by Ampaze (Tim Baumgarten) from http://www.crazyentertainment.net +type + PD3DAdapter_Identifier8 = PD3DAdapterIdentifier8; + PD3DDevice_Creation_Parameters = PD3DDeviceCreationParameters; + 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_Identifier8 = TD3DAdapterIdentifier8; + TD3DBackBuffer_Type = TD3DBackBufferType; + TD3DCubeMap_Faces = TD3DCubeMapFaces; + TD3DDevice_Creation_Parameters = TD3DDeviceCreationParameters; + TD3DIndexBuffer_Desc = TD3DIndexBufferDesc; + TD3DLocked_Box = TD3DLockedBox; + TD3DLocked_Rect = TD3DLockedRect; + TD3DMultiSample_Type = TD3DMultiSampleType; + TD3DPresent_Parameters = TD3DPresentParameters; + TD3DRaster_Status = TD3DRasterStatus; + TD3DRectPatch_Info = TD3DRectPatchInfo; + TD3DShader_Instruction_Opcode_Type = TD3DShaderInstructionOpcodeType; + TD3DShader_Param_DSTMod_Type = TD3DShaderParamDSTModType; + TD3DShader_Param_Register_Type = TD3DShaderParamRegisterType; + TD3DShader_Param_SRCMod_Type = TD3DShaderParamSRCModType; + TD3DSurface_Desc = TD3DSurfaceDesc; + TD3DTriPatch_Info = TD3DTriPatchInfo; + TD3DVertexBuffer_Desc = TD3DVertexBufferDesc; + TD3DVolume_Desc = TD3DVolumeDesc; + TD3DVSD_TokenType = TD3DVSDTokenType; + TD3DVS_AddressMode_Type = TD3DVSAddressModeType; + TD3DVS_RastOut_Offsets = TD3DVSRastOutOffsets; + + TD3DDevInfo_ResourceManager = TD3DDevInfoResourceManager; + TD3DDevInfo_D3DVertexStats = TD3DDevInfoD3DVertexStats; + + PD3DDevInfo_ResourceManager = PD3DDevInfoResourceManager; + PD3DDevInfo_D3DVertexStats = PD3DDevInfoD3DVertexStats; + + +implementation + + +(*==========================================================================; + * File: d3d8types.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_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; + +// D3DVSD_MAKETOKENTYPE(tokenType) ((tokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK) +function D3DVSD_MAKETOKENTYPE(tokenType: TD3DVSDTokenType): DWord; +begin + Result:= ((DWord(tokenType) shl D3DVSD_TOKENTYPESHIFT) and D3DVSD_TOKENTYPEMASK); +end; + +//#define D3DVSD_STREAM( _StreamNumber ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (_StreamNumber)) +function D3DVSD_STREAM(_StreamNumber: DWord): DWord; +begin + Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) or _StreamNumber; +end; + +//#define D3DVSD_REG( _VertexRegister, _Type ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | \ +// ((_Type) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) +function D3DVSD_REG( _VertexRegister, _Type: DWord): DWord; +begin + Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) or ((_Type shl D3DVSD_DATATYPESHIFT) or _VertexRegister); +end; + +//#define D3DVSD_SKIP( _DWORDCount ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | \ +// ((_DWORDCount) << D3DVSD_SKIPCOUNTSHIFT)) +function D3DVSD_SKIP(_DWORDCount: DWord): DWord; +begin + Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) or $10000000 or (_DWORDCount shl D3DVSD_SKIPCOUNTSHIFT); +end; + +//#define D3DVSD_CONST( _ConstantAddress, _Count ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | \ +// ((_Count) << D3DVSD_CONSTCOUNTSHIFT) | (_ConstantAddress)) +function D3DVSD_CONST(_ConstantAddress, _Count: DWord): DWord; +begin + Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) or (_Count shl D3DVSD_CONSTCOUNTSHIFT) or _ConstantAddress; +end; + +//#define D3DVSD_TESSNORMAL( _VertexRegisterIn, _VertexRegisterOut ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | \ +// ((_VertexRegisterIn) << D3DVSD_VERTEXREGINSHIFT) | \ +// ((0x02) << D3DVSD_DATATYPESHIFT) | (_VertexRegisterOut)) +function D3DVSD_TESSNORMAL(_VertexRegisterIn, _VertexRegisterOut: DWord): DWord; +begin + Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) or + (_VertexRegisterIn shl D3DVSD_VERTEXREGINSHIFT) or + ($02 shl D3DVSD_DATATYPESHIFT) or _VertexRegisterOut; +end; + +//#define D3DVSD_TESSUV( _VertexRegister ) \ +// (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | \ +// ((0x01) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) +function D3DVSD_TESSUV(_VertexRegister: DWord): DWord; +begin + Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) or $10000000 or + ($01 shl D3DVSD_DATATYPESHIFT) or _VertexRegister; +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 UnLoadDirect3D8: Boolean; +begin + Result:= True; + if Direct3D8Loaded then + begin + Result:= FreeLibrary(Direct3D8Lib); + _Direct3DCreate8:= nil; + Direct3D8Lib:= 0; + end; +end; + +function LoadDirect3D8: Boolean; +const + ProcName = 'Direct3DCreate8'; +begin + Result:= Direct3D8Loaded; + if (not Result) then + begin + Direct3D8Lib:= LoadLibrary(Direct3D8dll); + if Direct3D8Loaded then + begin + _Direct3DCreate8:= GetProcAddress(Direct3D8Lib, ProcName); + Result:= Assigned(_Direct3DCreate8); + if not Result then UnLoadDirect3D8; + end; + end; +end; +{$ELSE} +function Direct3D8Loaded: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +function UnLoadDirect3D8: Boolean; +begin // Stub function for static linking + Result:= True; // should emulate "normal" behaviour +end; + +function LoadDirect3D8: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +function _Direct3DCreate8(SDKVersion: LongWord): Pointer; external Direct3D8dll name 'Direct3DCreate8'; +{$ENDIF} + +function Direct3DCreate8(SDKVersion: LongWord): IDirect3D8; +begin +{$IFDEF DIRECT3D8_DYNAMIC_LINK} +{$IFDEF DIRECT3D8_DYNAMIC_LINK_EXPLICIT} + LoadDirect3D8; + +{$ENDIF} +{$ENDIF} + Result:= IDirect3D8(_Direct3DCreate8(SDKVersion)); + if Assigned(Result) then Result._Release; // Delphi autoincrement reference count +end; + +{$IFDEF DIRECT3D8_DYNAMIC_LINK} +initialization +{$IFNDEF DIRECT3D8_DYNAMIC_LINK_EXPLICIT} + LoadDirect3D8; +{$ENDIF} +finalization + UnLoadDirect3D8; +{$ENDIF} +end. diff --git a/Game/Code/lib/DSPack/DirectX9/Direct3D9.pas b/Game/Code/lib/DSPack/DirectX9/Direct3D9.pas new file mode 100644 index 00000000..fa50c448 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/Direct3D9.pas @@ -0,0 +1,4943 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: d3d9types.h d3d9caps.h d3d9.h *} +{* Content: Direct3D9 include files *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 26-Jan-2003 *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{* This File contains only Direct3D 9.0 definitions. *} +{* If you want to use previous versions - use Direct3D.pas and Direct3D8.pas *} +{* *} +{******************************************************************************} +{ } +{ 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} + +{$NOINCLUDE DXTypes} +(*$HPPEMIT '#include "d3d9.h"' *) +(*$HPPEMIT '#include "d3d9types.h"' *) +(*$HPPEMIT '#include "d3d9caps.h"' *) + +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; + {$EXTERNALSYM D3DCOLOR} + TD3DColor = DXTypes.TD3DColor; + {$NODEFINE TD3DColor} + {$HPPEMIT 'typedef D3DCOLOR 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; +{$EXTERNALSYM D3DCOLOR_ARGB} +// #define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +function D3DCOLOR_RGBA(r,g,b,a: DWord): TD3DColor; +{$EXTERNALSYM D3DCOLOR_RGBA} +// #define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) +function D3DCOLOR_XRGB(r,g,b: DWord): TD3DColor; +{$EXTERNALSYM D3DCOLOR_XRGB} + +// #define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xff,y,u,v) +function D3DCOLOR_XYUV(y,u,v: DWord): TD3DColor; +{$EXTERNALSYM D3DCOLOR_XYUV} +// #define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) +function D3DCOLOR_AYUV(a,y,u,v: DWord): TD3DColor; +{$EXTERNALSYM D3DCOLOR_AYUV} + +// 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; +{$EXTERNALSYM D3DCOLOR_COLORVALUE} + +type + _D3DVECTOR = DXTypes._D3DVECTOR; + {$EXTERNALSYM _D3DVECTOR} + D3DVECTOR = DXTypes.D3DVECTOR; + {$EXTERNALSYM D3DVECTOR} + TD3DVector = DXTypes.TD3DVector; + {$NODEFINE TD3DVector} + PD3DVector = DXTypes.PD3DVector; + {$NODEFINE PD3DVector} + {$HPPEMIT 'typedef _D3DVECTOR TD3DVector;'} + {$HPPEMIT 'typedef _D3DVECTOR *PD3DVector;'} + + PD3DColorValue = ^TD3DColorValue; + _D3DCOLORVALUE = packed record + r: Single; + g: Single; + b: Single; + a: Single; + end {_D3DCOLORVALUE}; + {$EXTERNALSYM _D3DCOLORVALUE} + D3DCOLORVALUE = _D3DCOLORVALUE; + {$EXTERNALSYM D3DCOLORVALUE} + TD3DColorValue = _D3DCOLORVALUE; + + PD3DRect = ^TD3DRect; + _D3DRECT = packed record + x1: LongInt; + y1: LongInt; + x2: LongInt; + y2: LongInt; + end {_D3DRECT}; + {$EXTERNALSYM _D3DRECT} + D3DRECT = _D3DRECT; + {$EXTERNALSYM 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}; + {$EXTERNALSYM _D3DMATRIX} + D3DMATRIX = _D3DMATRIX; + {$EXTERNALSYM 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}; + {$EXTERNALSYM _D3DVIEWPORT9} + D3DVIEWPORT9 = _D3DVIEWPORT9; + {$EXTERNALSYM D3DVIEWPORT9} + TD3DViewport9 = _D3DVIEWPORT9; + +(* + * Values for clip fields. + *) + +const + // Max number of user clipping planes, supported in D3D. + D3DMAXUSERCLIPPLANES = 32; + {$EXTERNALSYM D3DMAXUSERCLIPPLANES} + + // These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE + // + D3DCLIPPLANE0 = (1 shl 0); + {$EXTERNALSYM D3DCLIPPLANE0} + D3DCLIPPLANE1 = (1 shl 1); + {$EXTERNALSYM D3DCLIPPLANE1} + D3DCLIPPLANE2 = (1 shl 2); + {$EXTERNALSYM D3DCLIPPLANE2} + D3DCLIPPLANE3 = (1 shl 3); + {$EXTERNALSYM D3DCLIPPLANE3} + D3DCLIPPLANE4 = (1 shl 4); + {$EXTERNALSYM D3DCLIPPLANE4} + D3DCLIPPLANE5 = (1 shl 5); + {$EXTERNALSYM D3DCLIPPLANE5} + + // The following bits are used in the ClipUnion and ClipIntersection + // members of the D3DCLIPSTATUS9 + // + D3DCS_LEFT = $00000001; + {$EXTERNALSYM D3DCS_LEFT} + D3DCS_RIGHT = $00000002; + {$EXTERNALSYM D3DCS_RIGHT} + D3DCS_TOP = $00000004; + {$EXTERNALSYM D3DCS_TOP} + D3DCS_BOTTOM = $00000008; + {$EXTERNALSYM D3DCS_BOTTOM} + D3DCS_FRONT = $00000010; + {$EXTERNALSYM D3DCS_FRONT} + D3DCS_BACK = $00000020; + {$EXTERNALSYM D3DCS_BACK} + D3DCS_PLANE0 = $00000040; + {$EXTERNALSYM D3DCS_PLANE0} + D3DCS_PLANE1 = $00000080; + {$EXTERNALSYM D3DCS_PLANE1} + D3DCS_PLANE2 = $00000100; + {$EXTERNALSYM D3DCS_PLANE2} + D3DCS_PLANE3 = $00000200; + {$EXTERNALSYM D3DCS_PLANE3} + D3DCS_PLANE4 = $00000400; + {$EXTERNALSYM D3DCS_PLANE4} + D3DCS_PLANE5 = $00000800; + {$EXTERNALSYM D3DCS_PLANE5} + + 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; + {$EXTERNALSYM D3DCS_ALL} + +type + PD3DClipStatus9 = ^TD3DClipStatus9; + _D3DCLIPSTATUS9 = packed record + ClipUnion: DWord; + ClipIntersection: DWord; + end {_D3DCLIPSTATUS9}; + {$EXTERNALSYM _D3DCLIPSTATUS9} + D3DCLIPSTATUS9 = _D3DCLIPSTATUS9; + {$EXTERNALSYM 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}; + {$EXTERNALSYM _D3DMATERIAL9} + D3DMATERIAL9 = _D3DMATERIAL9; + {$EXTERNALSYM D3DMATERIAL9} + TD3DMaterial9 = _D3DMATERIAL9; + + _D3DLIGHTTYPE = ( + {$IFNDEF COMPILER6_UP} + D3DLIGHT_INVALID_0, {= 0} + D3DLIGHT_POINT, {= 1} + D3DLIGHT_SPOT, {= 2} + D3DLIGHT_DIRECTIONAL{= 3} + {$ELSE} + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3 + {$ENDIF} + ); + {$EXTERNALSYM _D3DLIGHTTYPE} + D3DLIGHTTYPE = _D3DLIGHTTYPE; + {$EXTERNALSYM 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}; + {$EXTERNALSYM _D3DLIGHT9} + D3DLIGHT9 = _D3DLIGHT9; + {$EXTERNALSYM D3DLIGHT9} + TD3DLight9 = _D3DLIGHT9; + +(* + * Options for clearing + *) +const + D3DCLEAR_TARGET = $00000001; { Clear target surface } + {$EXTERNALSYM D3DCLEAR_TARGET} + D3DCLEAR_ZBUFFER = $00000002; { Clear target z buffer } + {$EXTERNALSYM D3DCLEAR_ZBUFFER} + D3DCLEAR_STENCIL = $00000004; { Clear stencil planes } + {$EXTERNALSYM D3DCLEAR_STENCIL} + +(* + * The following defines the rendering states + *) +type + _D3DSHADEMODE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADEMODE} + D3DSHADEMODE = _D3DSHADEMODE; + {$EXTERNALSYM D3DSHADEMODE} + TD3DShadeMode = _D3DSHADEMODE; + +const + D3DSHADE_FLAT = 1; + {$EXTERNALSYM D3DSHADE_FLAT} + D3DSHADE_GOURAUD = 2; + {$EXTERNALSYM D3DSHADE_GOURAUD} + D3DSHADE_PHONG = 3; + {$EXTERNALSYM D3DSHADE_PHONG} + +type + _D3DFILLMODE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DFILLMODE} + D3DFILLMODE = _D3DFILLMODE; + {$EXTERNALSYM D3DFILLMODE} + TD3DFillMode = _D3DFILLMODE; + +const + D3DFILL_POINT = 1; + {$EXTERNALSYM D3DFILL_POINT} + D3DFILL_WIREFRAME = 2; + {$EXTERNALSYM D3DFILL_WIREFRAME} + D3DFILL_SOLID = 3; + {$EXTERNALSYM D3DFILL_SOLID} + +type + _D3DBLEND = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DBLEND} + D3DBLEND = _D3DBLEND; + {$EXTERNALSYM D3DBLEND} + TD3DBlend = _D3DBLEND; + +const + D3DBLEND_ZERO = 1; + {$EXTERNALSYM D3DBLEND_ZERO} + D3DBLEND_ONE = 2; + {$EXTERNALSYM D3DBLEND_ONE} + D3DBLEND_SRCCOLOR = 3; + {$EXTERNALSYM D3DBLEND_SRCCOLOR} + D3DBLEND_INVSRCCOLOR = 4; + {$EXTERNALSYM D3DBLEND_INVSRCCOLOR} + D3DBLEND_SRCALPHA = 5; + {$EXTERNALSYM D3DBLEND_SRCALPHA} + D3DBLEND_INVSRCALPHA = 6; + {$EXTERNALSYM D3DBLEND_INVSRCALPHA} + D3DBLEND_DESTALPHA = 7; + {$EXTERNALSYM D3DBLEND_DESTALPHA} + D3DBLEND_INVDESTALPHA = 8; + {$EXTERNALSYM D3DBLEND_INVDESTALPHA} + D3DBLEND_DESTCOLOR = 9; + {$EXTERNALSYM D3DBLEND_DESTCOLOR} + D3DBLEND_INVDESTCOLOR = 10; + {$EXTERNALSYM D3DBLEND_INVDESTCOLOR} + D3DBLEND_SRCALPHASAT = 11; + {$EXTERNALSYM D3DBLEND_SRCALPHASAT} + D3DBLEND_BOTHSRCALPHA = 12; + {$EXTERNALSYM D3DBLEND_BOTHSRCALPHA} + D3DBLEND_BOTHINVSRCALPHA = 13; + {$EXTERNALSYM D3DBLEND_BOTHINVSRCALPHA} + D3DBLEND_BLENDFACTOR = 14; (* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on *) + {$EXTERNALSYM D3DBLEND_BLENDFACTOR} + D3DBLEND_INVBLENDFACTOR = 15; (* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on *) + {$EXTERNALSYM D3DBLEND_INVBLENDFACTOR} + +type + _D3DBLENDOP = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DBLENDOP} + D3DBLENDOP = _D3DBLENDOP; + {$EXTERNALSYM D3DBLENDOP} + TD3DBlendOp = _D3DBLENDOP; + +const + D3DBLENDOP_ADD = 1; + {$EXTERNALSYM D3DBLENDOP_ADD} + D3DBLENDOP_SUBTRACT = 2; + {$EXTERNALSYM D3DBLENDOP_SUBTRACT} + D3DBLENDOP_REVSUBTRACT = 3; + {$EXTERNALSYM D3DBLENDOP_REVSUBTRACT} + D3DBLENDOP_MIN = 4; + {$EXTERNALSYM D3DBLENDOP_MIN} + D3DBLENDOP_MAX = 5; + {$EXTERNALSYM D3DBLENDOP_MAX} + +type + _D3DTEXTUREADDRESS = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DTEXTUREADDRESS} + D3DTEXTUREADDRESS = _D3DTEXTUREADDRESS; + {$EXTERNALSYM D3DTEXTUREADDRESS} + TD3DTextureAddress = _D3DTEXTUREADDRESS; + +const + D3DTADDRESS_WRAP = 1; + {$EXTERNALSYM D3DTADDRESS_WRAP} + D3DTADDRESS_MIRROR = 2; + {$EXTERNALSYM D3DTADDRESS_MIRROR} + D3DTADDRESS_CLAMP = 3; + {$EXTERNALSYM D3DTADDRESS_CLAMP} + D3DTADDRESS_BORDER = 4; + {$EXTERNALSYM D3DTADDRESS_BORDER} + D3DTADDRESS_MIRRORONCE = 5; + {$EXTERNALSYM D3DTADDRESS_MIRRORONCE} + +type + _D3DCULL = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DCULL} + D3DCULL = _D3DCULL; + {$EXTERNALSYM D3DCULL} + TD3DCull = _D3DCULL; + +const + D3DCULL_NONE = 1; + {$EXTERNALSYM D3DCULL_NONE} + D3DCULL_CW = 2; + {$EXTERNALSYM D3DCULL_CW} + D3DCULL_CCW = 3; + {$EXTERNALSYM D3DCULL_CCW} + +type + _D3DCMPFUNC = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DCMPFUNC} + D3DCMPFUNC = _D3DCMPFUNC; + {$EXTERNALSYM D3DCMPFUNC} + TD3DCmpFunc = _D3DCMPFUNC; + +const + D3DCMP_NEVER = 1; + {$EXTERNALSYM D3DCMP_NEVER} + D3DCMP_LESS = 2; + {$EXTERNALSYM D3DCMP_LESS} + D3DCMP_EQUAL = 3; + {$EXTERNALSYM D3DCMP_EQUAL} + D3DCMP_LESSEQUAL = 4; + {$EXTERNALSYM D3DCMP_LESSEQUAL} + D3DCMP_GREATER = 5; + {$EXTERNALSYM D3DCMP_GREATER} + D3DCMP_NOTEQUAL = 6; + {$EXTERNALSYM D3DCMP_NOTEQUAL} + D3DCMP_GREATEREQUAL = 7; + {$EXTERNALSYM D3DCMP_GREATEREQUAL} + D3DCMP_ALWAYS = 8; + {$EXTERNALSYM D3DCMP_ALWAYS} + +type + _D3DSTENCILOP = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSTENCILOP} + D3DSTENCILOP = _D3DSTENCILOP; + {$EXTERNALSYM D3DSTENCILOP} + TD3DStencilOp = _D3DSTENCILOP; + +const + D3DSTENCILOP_KEEP = 1; + {$EXTERNALSYM D3DSTENCILOP_KEEP} + D3DSTENCILOP_ZERO = 2; + {$EXTERNALSYM D3DSTENCILOP_ZERO} + D3DSTENCILOP_REPLACE = 3; + {$EXTERNALSYM D3DSTENCILOP_REPLACE} + D3DSTENCILOP_INCRSAT = 4; + {$EXTERNALSYM D3DSTENCILOP_INCRSAT} + D3DSTENCILOP_DECRSAT = 5; + {$EXTERNALSYM D3DSTENCILOP_DECRSAT} + D3DSTENCILOP_INVERT = 6; + {$EXTERNALSYM D3DSTENCILOP_INVERT} + D3DSTENCILOP_INCR = 7; + {$EXTERNALSYM D3DSTENCILOP_INCR} + D3DSTENCILOP_DECR = 8; + {$EXTERNALSYM D3DSTENCILOP_DECR} + +type + _D3DFOGMODE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DFOGMODE} + D3DFOGMODE = _D3DFOGMODE; + {$EXTERNALSYM D3DFOGMODE} + TD3DFogMode = _D3DFOGMODE; + +const + D3DFOG_NONE = 0; + {$EXTERNALSYM D3DFOG_NONE} + D3DFOG_EXP = 1; + {$EXTERNALSYM D3DFOG_EXP} + D3DFOG_EXP2 = 2; + {$EXTERNALSYM D3DFOG_EXP2} + D3DFOG_LINEAR = 3; + {$EXTERNALSYM D3DFOG_LINEAR} + +type + _D3DZBUFFERTYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DZBUFFERTYPE} + D3DZBUFFERTYPE = _D3DZBUFFERTYPE; + {$EXTERNALSYM D3DZBUFFERTYPE} + TD3DZBufferType = _D3DZBUFFERTYPE; + +const + D3DZB_FALSE = 0; + {$EXTERNALSYM D3DZB_FALSE} + D3DZB_TRUE = 1; + {$EXTERNALSYM D3DZB_TRUE} + D3DZB_USEW = 2; + {$EXTERNALSYM D3DZB_USEW} + +type + // Primitives supported by draw-primitive API + _D3DPRIMITIVETYPE = ( + {$IFNDEF COMPILER6_UP} + D3DPT_INVALID_0 {= 0}, + D3DPT_POINTLIST {= 1}, + D3DPT_LINELIST {= 2}, + D3DPT_LINESTRIP {= 3}, + D3DPT_TRIANGLELIST {= 4}, + D3DPT_TRIANGLESTRIP{= 5}, + D3DPT_TRIANGLEFAN {= 6} + {$ELSE} + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6 + {$ENDIF} + ); + {$EXTERNALSYM _D3DPRIMITIVETYPE} + D3DPRIMITIVETYPE = _D3DPRIMITIVETYPE; + {$EXTERNALSYM D3DPRIMITIVETYPE} + TD3DPrimitiveType = _D3DPRIMITIVETYPE; + +{$IFNDEF COMPILER6_UP} +const + D3DTS_VIEW = 2; + {$EXTERNALSYM D3DTS_VIEW} + D3DTS_PROJECTION = 3; + {$EXTERNALSYM D3DTS_PROJECTION} + D3DTS_TEXTURE0 = 16; + {$EXTERNALSYM D3DTS_TEXTURE0} + D3DTS_TEXTURE1 = 17; + {$EXTERNALSYM D3DTS_TEXTURE1} + D3DTS_TEXTURE2 = 18; + {$EXTERNALSYM D3DTS_TEXTURE2} + D3DTS_TEXTURE3 = 19; + {$EXTERNALSYM D3DTS_TEXTURE3} + D3DTS_TEXTURE4 = 20; + {$EXTERNALSYM D3DTS_TEXTURE4} + D3DTS_TEXTURE5 = 21; + {$EXTERNALSYM D3DTS_TEXTURE5} + D3DTS_TEXTURE6 = 22; + {$EXTERNALSYM D3DTS_TEXTURE6} + D3DTS_TEXTURE7 = 23; + {$EXTERNALSYM D3DTS_TEXTURE7} + D3DTS_FORCE_DWORD = $7fffffff; (* force 32-bit size enum *) + {$EXTERNALSYM D3DTS_FORCE_DWORD} + +type + _D3DTRANSFORMSTATETYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; +{$ELSE} +type + _D3DTRANSFORMSTATETYPE = ( + 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 + ); +{$ENDIF} + {$EXTERNALSYM _D3DTRANSFORMSTATETYPE} + D3DTRANSFORMSTATETYPE = _D3DTRANSFORMSTATETYPE; + {$EXTERNALSYM D3DTRANSFORMSTATETYPE} + TD3DTransformStateType = _D3DTRANSFORMSTATETYPE; + +// #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +function D3DTS_WORLDMATRIX(index: Byte): TD3DTransformStateType; +{$EXTERNALSYM D3DTS_WORLDMATRIX} + +const + D3DTS_WORLD = TD3DTransformStateType(0 + 256); // #define D3DTS_WORLD D3DTS_WORLDMATRIX(0) + {$EXTERNALSYM D3DTS_WORLD} + D3DTS_WORLD1 = TD3DTransformStateType(1 + 256); // #define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) + {$EXTERNALSYM D3DTS_WORLD1} + D3DTS_WORLD2 = TD3DTransformStateType(2 + 256); // #define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) + {$EXTERNALSYM D3DTS_WORLD2} + D3DTS_WORLD3 = TD3DTransformStateType(3 + 256); // #define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + {$EXTERNALSYM D3DTS_WORLD3} + +{$IFNDEF COMPILER6_UP} +type + _D3DRENDERSTATETYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DRENDERSTATETYPE} + D3DRENDERSTATETYPE = _D3DRENDERSTATETYPE; + {$EXTERNALSYM D3DRENDERSTATETYPE} + TD3DRenderStateType = _D3DRENDERSTATETYPE; + +const + D3DRS_ZENABLE = TD3DRenderStateType(7); { D3DZBUFFERTYPE (or TRUE/FALSE for legacy) } + {$EXTERNALSYM D3DRS_ZENABLE} + D3DRS_FILLMODE = TD3DRenderStateType(8); { D3DFILLMODE } + {$EXTERNALSYM D3DRS_FILLMODE} + D3DRS_SHADEMODE = TD3DRenderStateType(9); { D3DSHADEMODE } + {$EXTERNALSYM D3DRS_SHADEMODE} + D3DRS_ZWRITEENABLE = TD3DRenderStateType(14); { TRUE to enable z writes } + {$EXTERNALSYM D3DRS_ZWRITEENABLE} + D3DRS_ALPHATESTENABLE = TD3DRenderStateType(15); { TRUE to enable alpha tests } + {$EXTERNALSYM D3DRS_ALPHATESTENABLE} + D3DRS_LASTPIXEL = TD3DRenderStateType(16); { TRUE for last-pixel on lines } + {$EXTERNALSYM D3DRS_LASTPIXEL} + D3DRS_SRCBLEND = TD3DRenderStateType(19); { D3DBLEND } + {$EXTERNALSYM D3DRS_SRCBLEND} + D3DRS_DESTBLEND = TD3DRenderStateType(20); { D3DBLEND } + {$EXTERNALSYM D3DRS_DESTBLEND} + D3DRS_CULLMODE = TD3DRenderStateType(22); { D3DCULL } + {$EXTERNALSYM D3DRS_CULLMODE} + D3DRS_ZFUNC = TD3DRenderStateType(23); { D3DCMPFUNC } + {$EXTERNALSYM D3DRS_ZFUNC} + D3DRS_ALPHAREF = TD3DRenderStateType(24); { D3DFIXED } + {$EXTERNALSYM D3DRS_ALPHAREF} + D3DRS_ALPHAFUNC = TD3DRenderStateType(25); { D3DCMPFUNC } + {$EXTERNALSYM D3DRS_ALPHAFUNC} + D3DRS_DITHERENABLE = TD3DRenderStateType(26); { TRUE to enable dithering } + {$EXTERNALSYM D3DRS_DITHERENABLE} + D3DRS_ALPHABLENDENABLE = TD3DRenderStateType(27); { TRUE to enable alpha blending } + {$EXTERNALSYM D3DRS_ALPHABLENDENABLE} + D3DRS_FOGENABLE = TD3DRenderStateType(28); { TRUE to enable fog blending } + {$EXTERNALSYM D3DRS_FOGENABLE} + D3DRS_SPECULARENABLE = TD3DRenderStateType(29); { TRUE to enable specular } + {$EXTERNALSYM D3DRS_SPECULARENABLE} + D3DRS_FOGCOLOR = TD3DRenderStateType(34); { D3DCOLOR } + {$EXTERNALSYM D3DRS_FOGCOLOR} + D3DRS_FOGTABLEMODE = TD3DRenderStateType(35); { D3DFOGMODE } + {$EXTERNALSYM D3DRS_FOGTABLEMODE} + D3DRS_FOGSTART = TD3DRenderStateType(36); { Fog start (for both vertex and pixel fog) } + {$EXTERNALSYM D3DRS_FOGSTART} + D3DRS_FOGEND = TD3DRenderStateType(37); { Fog end } + {$EXTERNALSYM D3DRS_FOGEND} + D3DRS_FOGDENSITY = TD3DRenderStateType(38); { Fog density } + {$EXTERNALSYM D3DRS_FOGDENSITY} + D3DRS_RANGEFOGENABLE = TD3DRenderStateType(48); { Enables range-based fog } + {$EXTERNALSYM D3DRS_RANGEFOGENABLE} + D3DRS_STENCILENABLE = TD3DRenderStateType(52); { BOOL enable/disable stenciling } + {$EXTERNALSYM D3DRS_STENCILENABLE} + D3DRS_STENCILFAIL = TD3DRenderStateType(53); { D3DSTENCILOP to do if stencil test fails } + {$EXTERNALSYM D3DRS_STENCILFAIL} + D3DRS_STENCILZFAIL = TD3DRenderStateType(54); { D3DSTENCILOP to do if stencil test passes and Z test fails } + {$EXTERNALSYM D3DRS_STENCILZFAIL} + D3DRS_STENCILPASS = TD3DRenderStateType(55); { D3DSTENCILOP to do if both stencil and Z tests pass } + {$EXTERNALSYM D3DRS_STENCILPASS} + D3DRS_STENCILFUNC = TD3DRenderStateType(56); { D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true } + {$EXTERNALSYM D3DRS_STENCILFUNC} + D3DRS_STENCILREF = TD3DRenderStateType(57); { Reference value used in stencil test } + {$EXTERNALSYM D3DRS_STENCILREF} + D3DRS_STENCILMASK = TD3DRenderStateType(58); { Mask value used in stencil test } + {$EXTERNALSYM D3DRS_STENCILMASK} + D3DRS_STENCILWRITEMASK = TD3DRenderStateType(59); { Write mask applied to values written to stencil buffer } + {$EXTERNALSYM D3DRS_STENCILWRITEMASK} + D3DRS_TEXTUREFACTOR = TD3DRenderStateType(60); { D3DCOLOR used for multi-texture blend } + {$EXTERNALSYM D3DRS_TEXTUREFACTOR} + D3DRS_WRAP0 = TD3DRenderStateType(128); { wrap for 1st texture coord. set } + {$EXTERNALSYM D3DRS_WRAP0} + D3DRS_WRAP1 = TD3DRenderStateType(129); { wrap for 2nd texture coord. set } + {$EXTERNALSYM D3DRS_WRAP1} + D3DRS_WRAP2 = TD3DRenderStateType(130); { wrap for 3rd texture coord. set } + {$EXTERNALSYM D3DRS_WRAP2} + D3DRS_WRAP3 = TD3DRenderStateType(131); { wrap for 4th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP3} + D3DRS_WRAP4 = TD3DRenderStateType(132); { wrap for 5th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP4} + D3DRS_WRAP5 = TD3DRenderStateType(133); { wrap for 6th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP5} + D3DRS_WRAP6 = TD3DRenderStateType(134); { wrap for 7th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP6} + D3DRS_WRAP7 = TD3DRenderStateType(135); { wrap for 8th texture coord. set } + {$EXTERNALSYM D3DRS_WRAP7} + D3DRS_CLIPPING = TD3DRenderStateType(136); + {$EXTERNALSYM D3DRS_CLIPPING} + D3DRS_LIGHTING = TD3DRenderStateType(137); + {$EXTERNALSYM D3DRS_LIGHTING} + D3DRS_AMBIENT = TD3DRenderStateType(139); + {$EXTERNALSYM D3DRS_AMBIENT} + D3DRS_FOGVERTEXMODE = TD3DRenderStateType(140); + {$EXTERNALSYM D3DRS_FOGVERTEXMODE} + D3DRS_COLORVERTEX = TD3DRenderStateType(141); + {$EXTERNALSYM D3DRS_COLORVERTEX} + D3DRS_LOCALVIEWER = TD3DRenderStateType(142); + {$EXTERNALSYM D3DRS_LOCALVIEWER} + D3DRS_NORMALIZENORMALS = TD3DRenderStateType(143); + {$EXTERNALSYM D3DRS_NORMALIZENORMALS} + D3DRS_DIFFUSEMATERIALSOURCE = TD3DRenderStateType(145); + {$EXTERNALSYM D3DRS_DIFFUSEMATERIALSOURCE} + D3DRS_SPECULARMATERIALSOURCE = TD3DRenderStateType(146); + {$EXTERNALSYM D3DRS_SPECULARMATERIALSOURCE} + D3DRS_AMBIENTMATERIALSOURCE = TD3DRenderStateType(147); + {$EXTERNALSYM D3DRS_AMBIENTMATERIALSOURCE} + D3DRS_EMISSIVEMATERIALSOURCE = TD3DRenderStateType(148); + {$EXTERNALSYM D3DRS_EMISSIVEMATERIALSOURCE} + D3DRS_VERTEXBLEND = TD3DRenderStateType(151); + {$EXTERNALSYM D3DRS_VERTEXBLEND} + D3DRS_CLIPPLANEENABLE = TD3DRenderStateType(152); + {$EXTERNALSYM D3DRS_CLIPPLANEENABLE} + D3DRS_POINTSIZE = TD3DRenderStateType(154); { float point size } + {$EXTERNALSYM D3DRS_POINTSIZE} + D3DRS_POINTSIZE_MIN = TD3DRenderStateType(155); { float point size min threshold } + {$EXTERNALSYM D3DRS_POINTSIZE_MIN} + D3DRS_POINTSPRITEENABLE = TD3DRenderStateType(156); { BOOL point texture coord control } + {$EXTERNALSYM D3DRS_POINTSPRITEENABLE} + D3DRS_POINTSCALEENABLE = TD3DRenderStateType(157); { BOOL point size scale enable } + {$EXTERNALSYM D3DRS_POINTSCALEENABLE} + D3DRS_POINTSCALE_A = TD3DRenderStateType(158); { float point attenuation A value } + {$EXTERNALSYM D3DRS_POINTSCALE_A} + D3DRS_POINTSCALE_B = TD3DRenderStateType(159); { float point attenuation B value } + {$EXTERNALSYM D3DRS_POINTSCALE_B} + D3DRS_POINTSCALE_C = TD3DRenderStateType(160); { float point attenuation C value } + {$EXTERNALSYM D3DRS_POINTSCALE_C} + D3DRS_MULTISAMPLEANTIALIAS = TD3DRenderStateType(161); // BOOL - set to do FSAA with multisample buffer + {$EXTERNALSYM D3DRS_MULTISAMPLEANTIALIAS} + D3DRS_MULTISAMPLEMASK = TD3DRenderStateType(162); // DWORD - per-sample enable/disable + {$EXTERNALSYM D3DRS_MULTISAMPLEMASK} + D3DRS_PATCHEDGESTYLE = TD3DRenderStateType(163); // Sets whether patch edges will use float style tessellation + {$EXTERNALSYM D3DRS_PATCHEDGESTYLE} + D3DRS_DEBUGMONITORTOKEN = TD3DRenderStateType(165); // DEBUG ONLY - token to debug monitor + {$EXTERNALSYM D3DRS_DEBUGMONITORTOKEN} + D3DRS_POINTSIZE_MAX = TD3DRenderStateType(166); { float point size max threshold } + {$EXTERNALSYM D3DRS_POINTSIZE_MAX} + D3DRS_INDEXEDVERTEXBLENDENABLE = TD3DRenderStateType(167); + {$EXTERNALSYM D3DRS_INDEXEDVERTEXBLENDENABLE} + D3DRS_COLORWRITEENABLE = TD3DRenderStateType(168); // per-channel write enable + {$EXTERNALSYM D3DRS_COLORWRITEENABLE} + D3DRS_TWEENFACTOR = TD3DRenderStateType(170); // float tween factor + {$EXTERNALSYM D3DRS_TWEENFACTOR} + D3DRS_BLENDOP = TD3DRenderStateType(171); // D3DBLENDOP setting + {$EXTERNALSYM D3DRS_BLENDOP} + D3DRS_POSITIONDEGREE = TD3DRenderStateType(172); // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default) + {$EXTERNALSYM D3DRS_POSITIONDEGREE} + D3DRS_NORMALDEGREE = TD3DRenderStateType(173); // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC + {$EXTERNALSYM D3DRS_NORMALDEGREE} + D3DRS_SCISSORTESTENABLE = TD3DRenderStateType(174); + {$EXTERNALSYM D3DRS_SCISSORTESTENABLE} + D3DRS_SLOPESCALEDEPTHBIAS = TD3DRenderStateType(175); + {$EXTERNALSYM D3DRS_SLOPESCALEDEPTHBIAS} + D3DRS_ANTIALIASEDLINEENABLE = TD3DRenderStateType(176); + {$EXTERNALSYM D3DRS_ANTIALIASEDLINEENABLE} + D3DRS_MINTESSELLATIONLEVEL = TD3DRenderStateType(178); + {$EXTERNALSYM D3DRS_MINTESSELLATIONLEVEL} + D3DRS_MAXTESSELLATIONLEVEL = TD3DRenderStateType(179); + {$EXTERNALSYM D3DRS_MAXTESSELLATIONLEVEL} + D3DRS_ADAPTIVETESS_X = TD3DRenderStateType(180); + {$EXTERNALSYM D3DRS_ADAPTIVETESS_X} + D3DRS_ADAPTIVETESS_Y = TD3DRenderStateType(181); + {$EXTERNALSYM D3DRS_ADAPTIVETESS_Y} + D3DRS_ADAPTIVETESS_Z = TD3DRenderStateType(182); + {$EXTERNALSYM D3DRS_ADAPTIVETESS_Z} + D3DRS_ADAPTIVETESS_W = TD3DRenderStateType(183); + {$EXTERNALSYM D3DRS_ADAPTIVETESS_W} + D3DRS_ENABLEADAPTIVETESSELLATION = TD3DRenderStateType(184); + {$EXTERNALSYM D3DRS_ENABLEADAPTIVETESSELLATION} + D3DRS_TWOSIDEDSTENCILMODE = TD3DRenderStateType(185); (* BOOL enable/disable 2 sided stenciling *) + {$EXTERNALSYM D3DRS_TWOSIDEDSTENCILMODE} + D3DRS_CCW_STENCILFAIL = TD3DRenderStateType(186); (* D3DSTENCILOP to do if ccw stencil test fails *) + {$EXTERNALSYM D3DRS_CCW_STENCILFAIL} + D3DRS_CCW_STENCILZFAIL = TD3DRenderStateType(187); (* D3DSTENCILOP to do if ccw stencil test passes and Z test fails *) + {$EXTERNALSYM D3DRS_CCW_STENCILZFAIL} + D3DRS_CCW_STENCILPASS = TD3DRenderStateType(188); (* D3DSTENCILOP to do if both ccw stencil and Z tests pass *) + {$EXTERNALSYM D3DRS_CCW_STENCILPASS} + D3DRS_CCW_STENCILFUNC = TD3DRenderStateType(189); (* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *) + {$EXTERNALSYM D3DRS_CCW_STENCILFUNC} + D3DRS_COLORWRITEENABLE1 = TD3DRenderStateType(190); (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + {$EXTERNALSYM D3DRS_COLORWRITEENABLE1} + D3DRS_COLORWRITEENABLE2 = TD3DRenderStateType(191); (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + {$EXTERNALSYM D3DRS_COLORWRITEENABLE2} + D3DRS_COLORWRITEENABLE3 = TD3DRenderStateType(192); (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + {$EXTERNALSYM D3DRS_COLORWRITEENABLE3} + D3DRS_BLENDFACTOR = TD3DRenderStateType(193); (* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR *) + {$EXTERNALSYM D3DRS_BLENDFACTOR} + D3DRS_SRGBWRITEENABLE = TD3DRenderStateType(194); (* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) *) + {$EXTERNALSYM D3DRS_SRGBWRITEENABLE} + D3DRS_DEPTHBIAS = TD3DRenderStateType(195); + {$EXTERNALSYM D3DRS_DEPTHBIAS} + D3DRS_WRAP8 = TD3DRenderStateType(198); (* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD *) + {$EXTERNALSYM D3DRS_WRAP8} + D3DRS_WRAP9 = TD3DRenderStateType(199); + {$EXTERNALSYM D3DRS_WRAP9} + D3DRS_WRAP10 = TD3DRenderStateType(200); + {$EXTERNALSYM D3DRS_WRAP10} + D3DRS_WRAP11 = TD3DRenderStateType(201); + {$EXTERNALSYM D3DRS_WRAP11} + D3DRS_WRAP12 = TD3DRenderStateType(202); + {$EXTERNALSYM D3DRS_WRAP12} + D3DRS_WRAP13 = TD3DRenderStateType(203); + {$EXTERNALSYM D3DRS_WRAP13} + D3DRS_WRAP14 = TD3DRenderStateType(204); + {$EXTERNALSYM D3DRS_WRAP14} + D3DRS_WRAP15 = TD3DRenderStateType(205); + {$EXTERNALSYM D3DRS_WRAP15} + D3DRS_SEPARATEALPHABLENDENABLE = TD3DRenderStateType(206); (* TRUE to enable a separate blending function for the alpha channel *) + {$EXTERNALSYM D3DRS_SEPARATEALPHABLENDENABLE} + D3DRS_SRCBLENDALPHA = TD3DRenderStateType(207); (* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + {$EXTERNALSYM D3DRS_SRCBLENDALPHA} + D3DRS_DESTBLENDALPHA = TD3DRenderStateType(208); (* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + {$EXTERNALSYM D3DRS_DESTBLENDALPHA} + D3DRS_BLENDOPALPHA = TD3DRenderStateType(209); (* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + {$EXTERNALSYM D3DRS_BLENDOPALPHA} + + + D3DRS_FORCE_DWORD = TD3DRenderStateType($7fffffff); { force 32-bit size enum } + {$EXTERNALSYM D3DRS_FORCE_DWORD} +{$ELSE} +type + _D3DRENDERSTATETYPE = ( + D3DRS_ZENABLE = 7, (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *) + D3DRS_FILLMODE = 8, (* D3DFILLMODE *) + D3DRS_SHADEMODE = 9, (* D3DSHADEMODE *) + D3DRS_ZWRITEENABLE = 14, (* TRUE to enable z writes *) + D3DRS_ALPHATESTENABLE = 15, (* TRUE to enable alpha tests *) + D3DRS_LASTPIXEL = 16, (* TRUE for last-pixel on lines *) + D3DRS_SRCBLEND = 19, (* D3DBLEND *) + D3DRS_DESTBLEND = 20, (* D3DBLEND *) + D3DRS_CULLMODE = 22, (* D3DCULL *) + D3DRS_ZFUNC = 23, (* D3DCMPFUNC *) + D3DRS_ALPHAREF = 24, (* D3DFIXED *) + D3DRS_ALPHAFUNC = 25, (* D3DCMPFUNC *) + D3DRS_DITHERENABLE = 26, (* TRUE to enable dithering *) + D3DRS_ALPHABLENDENABLE = 27, (* TRUE to enable alpha blending *) + D3DRS_FOGENABLE = 28, (* TRUE to enable fog blending *) + D3DRS_SPECULARENABLE = 29, (* TRUE to enable specular *) + D3DRS_FOGCOLOR = 34, (* D3DCOLOR *) + D3DRS_FOGTABLEMODE = 35, (* D3DFOGMODE *) + D3DRS_FOGSTART = 36, (* Fog start (for both vertex and pixel fog) *) + D3DRS_FOGEND = 37, (* Fog end *) + D3DRS_FOGDENSITY = 38, (* Fog density *) + D3DRS_RANGEFOGENABLE = 48, (* Enables range-based fog *) + D3DRS_STENCILENABLE = 52, (* BOOL enable/disable stenciling *) + D3DRS_STENCILFAIL = 53, (* D3DSTENCILOP to do if stencil test fails *) + D3DRS_STENCILZFAIL = 54, (* D3DSTENCILOP to do if stencil test passes and Z test fails *) + D3DRS_STENCILPASS = 55, (* D3DSTENCILOP to do if both stencil and Z tests pass *) + D3DRS_STENCILFUNC = 56, (* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *) + D3DRS_STENCILREF = 57, (* Reference value used in stencil test *) + D3DRS_STENCILMASK = 58, (* Mask value used in stencil test *) + D3DRS_STENCILWRITEMASK = 59, (* Write mask applied to values written to stencil buffer *) + D3DRS_TEXTUREFACTOR = 60, (* D3DCOLOR used for multi-texture blend *) + D3DRS_WRAP0 = 128, (* wrap for 1st texture coord. set *) + D3DRS_WRAP1 = 129, (* wrap for 2nd texture coord. set *) + D3DRS_WRAP2 = 130, (* wrap for 3rd texture coord. set *) + D3DRS_WRAP3 = 131, (* wrap for 4th texture coord. set *) + D3DRS_WRAP4 = 132, (* wrap for 5th texture coord. set *) + D3DRS_WRAP5 = 133, (* wrap for 6th texture coord. set *) + D3DRS_WRAP6 = 134, (* wrap for 7th texture coord. set *) + D3DRS_WRAP7 = 135, (* wrap for 8th texture coord. set *) + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_POINTSIZE = 154, (* float point size *) + D3DRS_POINTSIZE_MIN = 155, (* float point size min threshold *) + D3DRS_POINTSPRITEENABLE = 156, (* BOOL point texture coord control *) + D3DRS_POINTSCALEENABLE = 157, (* BOOL point size scale enable *) + D3DRS_POINTSCALE_A = 158, (* float point attenuation A value *) + D3DRS_POINTSCALE_B = 159, (* float point attenuation B value *) + D3DRS_POINTSCALE_C = 160, (* float point attenuation C value *) + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, (* float point size max threshold *) + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONDEGREE = 172, // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default) + D3DRS_NORMALDEGREE = 173, // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC + D3DRS_SCISSORTESTENABLE = 174, + D3DRS_SLOPESCALEDEPTHBIAS = 175, + D3DRS_ANTIALIASEDLINEENABLE = 176, + + D3DRS_MINTESSELLATIONLEVEL = 178, + D3DRS_MAXTESSELLATIONLEVEL = 179, + D3DRS_ADAPTIVETESS_X = 180, + D3DRS_ADAPTIVETESS_Y = 181, + D3DRS_ADAPTIVETESS_Z = 182, + D3DRS_ADAPTIVETESS_W = 183, + D3DRS_ENABLEADAPTIVETESSELLATION = 184, + D3DRS_TWOSIDEDSTENCILMODE = 185, (* BOOL enable/disable 2 sided stenciling *) + D3DRS_CCW_STENCILFAIL = 186, (* D3DSTENCILOP to do if ccw stencil test fails *) + D3DRS_CCW_STENCILZFAIL = 187, (* D3DSTENCILOP to do if ccw stencil test passes and Z test fails *) + D3DRS_CCW_STENCILPASS = 188, (* D3DSTENCILOP to do if both ccw stencil and Z tests pass *) + D3DRS_CCW_STENCILFUNC = 189, (* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *) + D3DRS_COLORWRITEENABLE1 = 190, (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + D3DRS_COLORWRITEENABLE2 = 191, (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + D3DRS_COLORWRITEENABLE3 = 192, (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + D3DRS_BLENDFACTOR = 193, (* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR *) + D3DRS_SRGBWRITEENABLE = 194, (* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) *) + D3DRS_DEPTHBIAS = 195, + D3DRS_WRAP8 = 198, (* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD *) + D3DRS_WRAP9 = 199, + D3DRS_WRAP10 = 200, + D3DRS_WRAP11 = 201, + D3DRS_WRAP12 = 202, + D3DRS_WRAP13 = 203, + D3DRS_WRAP14 = 204, + D3DRS_WRAP15 = 205, + D3DRS_SEPARATEALPHABLENDENABLE = 206, (* TRUE to enable a separate blending function for the alpha channel *) + D3DRS_SRCBLENDALPHA = 207, (* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + D3DRS_DESTBLENDALPHA = 208, (* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + D3DRS_BLENDOPALPHA = 209 (* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + ); + {$EXTERNALSYM _D3DRENDERSTATETYPE} + D3DRENDERSTATETYPE = _D3DRENDERSTATETYPE; + {$EXTERNALSYM D3DRENDERSTATETYPE} + TD3DRenderStateType = _D3DRENDERSTATETYPE; +{$ENDIF} + +const + // Maximum number of simultaneous render targets D3D supports + D3D_MAX_SIMULTANEOUS_RENDERTARGETS = 4; + {$EXTERNALSYM D3D_MAX_SIMULTANEOUS_RENDERTARGETS} + +type + // Values for material source + _D3DMATERIALCOLORSOURCE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DMATERIALCOLORSOURCE} + D3DMATERIALCOLORSOURCE = _D3DMATERIALCOLORSOURCE; + {$EXTERNALSYM D3DMATERIALCOLORSOURCE} + TD3DMaterialSource = _D3DMATERIALCOLORSOURCE; + +const + D3DMCS_MATERIAL = TD3DMaterialSource(0); // Color from material is used + {$EXTERNALSYM D3DMCS_MATERIAL} + D3DMCS_COLOR1 = TD3DMaterialSource(1); // Diffuse vertex color is used + {$EXTERNALSYM D3DMCS_COLOR1} + D3DMCS_COLOR2 = TD3DMaterialSource(2); // Specular vertex color is used + {$EXTERNALSYM D3DMCS_COLOR2} + D3DMCS_FORCE_DWORD = TD3DMaterialSource($7fffffff); // force 32-bit size enum + {$EXTERNALSYM D3DMCS_FORCE_DWORD} + + // Bias to apply to the texture coordinate set to apply a wrap to. + D3DRENDERSTATE_WRAPBIAS = DWORD(128); + {$EXTERNALSYM D3DRENDERSTATE_WRAPBIAS} + + { Flags to construct the WRAP render states } + D3DWRAP_U = $00000001; + {$EXTERNALSYM D3DWRAP_U} + D3DWRAP_V = $00000002; + {$EXTERNALSYM D3DWRAP_V} + D3DWRAP_W = $00000004; + {$EXTERNALSYM D3DWRAP_W} + + { Flags to construct the WRAP render states for 1D thru 4D texture coordinates } + D3DWRAPCOORD_0 = $00000001; // same as D3DWRAP_U + {$EXTERNALSYM D3DWRAPCOORD_0} + D3DWRAPCOORD_1 = $00000002; // same as D3DWRAP_V + {$EXTERNALSYM D3DWRAPCOORD_1} + D3DWRAPCOORD_2 = $00000004; // same as D3DWRAP_W + {$EXTERNALSYM D3DWRAPCOORD_2} + D3DWRAPCOORD_3 = $00000008; + {$EXTERNALSYM D3DWRAPCOORD_3} + + { Flags to construct D3DRS_COLORWRITEENABLE } + D3DCOLORWRITEENABLE_RED = (1 shl 0); + {$EXTERNALSYM D3DCOLORWRITEENABLE_RED} + D3DCOLORWRITEENABLE_GREEN = (1 shl 1); + {$EXTERNALSYM D3DCOLORWRITEENABLE_GREEN} + D3DCOLORWRITEENABLE_BLUE = (1 shl 2); + {$EXTERNALSYM D3DCOLORWRITEENABLE_BLUE} + D3DCOLORWRITEENABLE_ALPHA = (1 shl 3); + {$EXTERNALSYM D3DCOLORWRITEENABLE_ALPHA} + +(* + * State enumerants for per-stage processing of fixed function pixel processing + * Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX. + *) +{$IFNDEF COMPILER6_UP} +type + _D3DTEXTURESTAGESTATETYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DTEXTURESTAGESTATETYPE} + D3DTEXTURESTAGESTATETYPE = _D3DTEXTURESTAGESTATETYPE; + {$EXTERNALSYM D3DTEXTURESTAGESTATETYPE} + TD3DTextureStageStateType = _D3DTEXTURESTAGESTATETYPE; + +const + D3DTSS_COLOROP = TD3DTextureStageStateType( 1); { D3DTEXTUREOP - per-stage blending controls for color channels } + {$EXTERNALSYM D3DTSS_COLOROP} + D3DTSS_COLORARG1 = TD3DTextureStageStateType( 2); { D3DTA_* (texture arg) } + {$EXTERNALSYM D3DTSS_COLORARG1} + D3DTSS_COLORARG2 = TD3DTextureStageStateType( 3); { D3DTA_* (texture arg) } + {$EXTERNALSYM D3DTSS_COLORARG2} + D3DTSS_ALPHAOP = TD3DTextureStageStateType( 4); { D3DTEXTUREOP - per-stage blending controls for alpha channel } + {$EXTERNALSYM D3DTSS_ALPHAOP} + D3DTSS_ALPHAARG1 = TD3DTextureStageStateType( 5); { D3DTA_* (texture arg) } + {$EXTERNALSYM D3DTSS_ALPHAARG1} + D3DTSS_ALPHAARG2 = TD3DTextureStageStateType( 6); { D3DTA_* (texture arg) } + {$EXTERNALSYM D3DTSS_ALPHAARG2} + D3DTSS_BUMPENVMAT00 = TD3DTextureStageStateType( 7); { float (bump mapping matrix) } + {$EXTERNALSYM D3DTSS_BUMPENVMAT00} + D3DTSS_BUMPENVMAT01 = TD3DTextureStageStateType( 8); { float (bump mapping matrix) } + {$EXTERNALSYM D3DTSS_BUMPENVMAT01} + D3DTSS_BUMPENVMAT10 = TD3DTextureStageStateType( 9); { float (bump mapping matrix) } + {$EXTERNALSYM D3DTSS_BUMPENVMAT10} + D3DTSS_BUMPENVMAT11 = TD3DTextureStageStateType(10); { float (bump mapping matrix) } + {$EXTERNALSYM D3DTSS_BUMPENVMAT11} + D3DTSS_TEXCOORDINDEX = TD3DTextureStageStateType(11); { identifies which set of texture coordinates index this texture } + {$EXTERNALSYM D3DTSS_TEXCOORDINDEX} + D3DTSS_BUMPENVLSCALE = TD3DTextureStageStateType(22); { float scale for bump map luminance } + {$EXTERNALSYM D3DTSS_BUMPENVLSCALE} + D3DTSS_BUMPENVLOFFSET = TD3DTextureStageStateType(23); { float offset for bump map luminance } + {$EXTERNALSYM D3DTSS_BUMPENVLOFFSET} + D3DTSS_TEXTURETRANSFORMFLAGS = TD3DTextureStageStateType(24); { D3DTEXTURETRANSFORMFLAGS controls texture transform } + {$EXTERNALSYM D3DTSS_TEXTURETRANSFORMFLAGS} + D3DTSS_COLORARG0 = TD3DTextureStageStateType(26); { D3DTA_* third arg for triadic ops } + {$EXTERNALSYM D3DTSS_COLORARG0} + D3DTSS_ALPHAARG0 = TD3DTextureStageStateType(27); { D3DTA_* third arg for triadic ops } + {$EXTERNALSYM D3DTSS_ALPHAARG0} + D3DTSS_RESULTARG = TD3DTextureStageStateType(28); { D3DTA_* arg for result (CURRENT or TEMP) } + {$EXTERNALSYM D3DTSS_RESULTARG} + D3DTSS_CONSTANT = TD3DTextureStageStateType(32); { Per-stage constant D3DTA_CONSTANT } + {$EXTERNALSYM D3DTSS_CONSTANT} + + D3DTSS_FORCE_DWORD = TD3DTextureStageStateType($7fffffff); { force 32-bit size enum } + {$EXTERNALSYM D3DTSS_FORCE_DWORD} +{$ELSE} +type + _D3DTEXTURESTAGESTATETYPE = ( + D3DTSS_COLOROP = 1, { D3DTEXTUREOP - per-stage blending controls for color channels } + D3DTSS_COLORARG1 = 2, { D3DTA_* (texture arg) } + D3DTSS_COLORARG2 = 3, { D3DTA_* (texture arg) } + D3DTSS_ALPHAOP = 4, { D3DTEXTUREOP - per-stage blending controls for alpha channel } + D3DTSS_ALPHAARG1 = 5, { D3DTA_* (texture arg) } + D3DTSS_ALPHAARG2 = 6, { D3DTA_* (texture arg) } + D3DTSS_BUMPENVMAT00 = 7, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT01 = 8, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT10 = 9, { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT11 = 10, { float (bump mapping matrix) } + D3DTSS_TEXCOORDINDEX = 11, { identifies which set of texture coordinates index this texture } + D3DTSS_BUMPENVLSCALE = 22, { float scale for bump map luminance } + D3DTSS_BUMPENVLOFFSET = 23, { float offset for bump map luminance } + D3DTSS_TEXTURETRANSFORMFLAGS = 24, { D3DTEXTURETRANSFORMFLAGS controls texture transform } + D3DTSS_COLORARG0 = 26, { D3DTA_* third arg for triadic ops } + D3DTSS_ALPHAARG0 = 27, { D3DTA_* third arg for triadic ops } + D3DTSS_RESULTARG = 28, { D3DTA_* arg for result (CURRENT or TEMP) } + D3DTSS_CONSTANT = 32 { Per-stage constant D3DTA_CONSTANT } + ); + {$EXTERNALSYM _D3DTEXTURESTAGESTATETYPE} + D3DTEXTURESTAGESTATETYPE = _D3DTEXTURESTAGESTATETYPE; + {$EXTERNALSYM D3DTEXTURESTAGESTATETYPE} + TD3DTextureStageStateType = _D3DTEXTURESTAGESTATETYPE; +{$ENDIF} + +type +(* + * State enumerants for per-sampler texture processing. + *) + _D3DSAMPLERSTATETYPE = ( + {$IFNDEF COMPILER6_UP} + 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 } + {$ELSE} + 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 } + {$ENDIF} + ); + {$EXTERNALSYM _D3DSAMPLERSTATETYPE} + D3DSAMPLERSTATETYPE = _D3DSAMPLERSTATETYPE; + {$EXTERNALSYM D3DSAMPLERSTATETYPE} + TD3DSamplerStateType = _D3DSAMPLERSTATETYPE; + +const + { Special sampler which is used in the tesselator } + D3DDMAPSAMPLER = 256; + {$EXTERNALSYM D3DDMAPSAMPLER} + + // Samplers used in vertex shaders + D3DVERTEXTEXTURESAMPLER0 = (D3DDMAPSAMPLER+1); + {$EXTERNALSYM D3DVERTEXTEXTURESAMPLER0} + D3DVERTEXTEXTURESAMPLER1 = (D3DDMAPSAMPLER+2); + {$EXTERNALSYM D3DVERTEXTEXTURESAMPLER1} + D3DVERTEXTEXTURESAMPLER2 = (D3DDMAPSAMPLER+3); + {$EXTERNALSYM D3DVERTEXTEXTURESAMPLER2} + D3DVERTEXTEXTURESAMPLER3 = (D3DDMAPSAMPLER+4); + {$EXTERNALSYM D3DVERTEXTEXTURESAMPLER3} + + // 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; + {$EXTERNALSYM D3DTSS_TCI_PASSTHRU} + D3DTSS_TCI_CAMERASPACENORMAL = $00010000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACENORMAL} + D3DTSS_TCI_CAMERASPACEPOSITION = $00020000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACEPOSITION} + D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR = $00030000; + {$EXTERNALSYM D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR} + D3DTSS_TCI_SPHEREMAP = $00040000; + {$EXTERNALSYM D3DTSS_TCI_SPHEREMAP} + +(* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + *) +type + _D3DTEXTUREOP = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DTEXTUREOP} + D3DTEXTUREOP = _D3DTEXTUREOP; + {$EXTERNALSYM D3DTEXTUREOP} + TD3DTextureOp = _D3DTEXTUREOP; + +const + // Control + D3DTOP_DISABLE = 1; // disables stage + {$EXTERNALSYM D3DTOP_DISABLE} + D3DTOP_SELECTARG1 = 2; // the default + {$EXTERNALSYM D3DTOP_SELECTARG1} + D3DTOP_SELECTARG2 = 3; + {$EXTERNALSYM D3DTOP_SELECTARG2} + + // Modulate + D3DTOP_MODULATE = 4; // multiply args together + {$EXTERNALSYM D3DTOP_MODULATE} + D3DTOP_MODULATE2X = 5; // multiply and 1 bit + {$EXTERNALSYM D3DTOP_MODULATE2X} + D3DTOP_MODULATE4X = 6; // multiply and 2 bits + {$EXTERNALSYM D3DTOP_MODULATE4X} + + // Add + D3DTOP_ADD = 7; // add arguments together + {$EXTERNALSYM D3DTOP_ADD} + D3DTOP_ADDSIGNED = 8; // add with -0.5 bias + {$EXTERNALSYM D3DTOP_ADDSIGNED} + D3DTOP_ADDSIGNED2X = 9; // as above but left 1 bit + {$EXTERNALSYM D3DTOP_ADDSIGNED2X} + D3DTOP_SUBTRACT = 10; // Arg1 - Arg2, with no saturation + {$EXTERNALSYM D3DTOP_SUBTRACT} + D3DTOP_ADDSMOOTH = 11; // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + {$EXTERNALSYM D3DTOP_ADDSMOOTH} + + // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12; // iterated alpha + {$EXTERNALSYM D3DTOP_BLENDDIFFUSEALPHA} + D3DTOP_BLENDTEXTUREALPHA = 13; // texture alpha + {$EXTERNALSYM D3DTOP_BLENDTEXTUREALPHA} + D3DTOP_BLENDFACTORALPHA = 14; // alpha from D3DRS_TEXTUREFACTOR + {$EXTERNALSYM D3DTOP_BLENDFACTORALPHA} + + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15; // texture alpha + {$EXTERNALSYM D3DTOP_BLENDTEXTUREALPHAPM} + D3DTOP_BLENDCURRENTALPHA = 16; // by alpha of current color + {$EXTERNALSYM D3DTOP_BLENDCURRENTALPHA} + + // Specular mapping + D3DTOP_PREMODULATE = 17; // modulate with next texture before use + {$EXTERNALSYM D3DTOP_PREMODULATE} + D3DTOP_MODULATEALPHA_ADDCOLOR = 18; // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + {$EXTERNALSYM D3DTOP_MODULATEALPHA_ADDCOLOR} + D3DTOP_MODULATECOLOR_ADDALPHA = 19; // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + {$EXTERNALSYM D3DTOP_MODULATECOLOR_ADDALPHA} + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20; // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + {$EXTERNALSYM D3DTOP_MODULATEINVALPHA_ADDCOLOR} + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21; // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + {$EXTERNALSYM D3DTOP_MODULATEINVCOLOR_ADDALPHA} + + // Bump mapping + D3DTOP_BUMPENVMAP = 22; // per pixel env map perturbation + {$EXTERNALSYM D3DTOP_BUMPENVMAP} + D3DTOP_BUMPENVMAPLUMINANCE = 23; // with luminance channel + {$EXTERNALSYM D3DTOP_BUMPENVMAPLUMINANCE} + + // 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; + {$EXTERNALSYM D3DTOP_DOTPRODUCT3} + + // Triadic ops + D3DTOP_MULTIPLYADD = 25; // Arg0 + Arg1*Arg2 + {$EXTERNALSYM D3DTOP_MULTIPLYADD} + D3DTOP_LERP = 26; // (Arg0)*Arg1 + (1-Arg0)*Arg2 + {$EXTERNALSYM D3DTOP_LERP} + +(* + * 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 + {$EXTERNALSYM D3DTA_SELECTMASK} + D3DTA_DIFFUSE = $00000000; // select diffuse color (read only) + {$EXTERNALSYM D3DTA_DIFFUSE} + D3DTA_CURRENT = $00000001; // select stage destination register (read/write) + {$EXTERNALSYM D3DTA_CURRENT} + D3DTA_TEXTURE = $00000002; // select texture color (read only) + {$EXTERNALSYM D3DTA_TEXTURE} + D3DTA_TFACTOR = $00000003; // select D3DRS_TEXTUREFACTOR (read only) + {$EXTERNALSYM D3DTA_TFACTOR} + D3DTA_SPECULAR = $00000004; // select specular color (read only) + {$EXTERNALSYM D3DTA_SPECULAR} + D3DTA_TEMP = $00000005; // select temporary register color (read/write) + {$EXTERNALSYM D3DTA_TEMP} + D3DTA_CONSTANT = $00000006; // select texture stage constant + {$EXTERNALSYM D3DTA_CONSTANT} + D3DTA_COMPLEMENT = $00000010; // take 1.0 - x (read modifier) + {$EXTERNALSYM D3DTA_COMPLEMENT} + D3DTA_ALPHAREPLICATE = $00000020; // replicate alpha to color components (read modifier) + {$EXTERNALSYM D3DTA_ALPHAREPLICATE} + +type + // + // Values for D3DSAMP_***FILTER texture stage states + // + _D3DTEXTUREFILTERTYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DTEXTUREFILTERTYPE} + D3DTEXTUREFILTERTYPE = _D3DTEXTUREFILTERTYPE; + {$EXTERNALSYM D3DTEXTUREFILTERTYPE} + TD3DTextureFilterType = _D3DTEXTUREFILTERTYPE; + +const + D3DTEXF_NONE = 0; // filtering disabled (valid for mip filter only) + {$EXTERNALSYM D3DTEXF_NONE} + D3DTEXF_POINT = 1; // nearest + {$EXTERNALSYM D3DTEXF_POINT} + D3DTEXF_LINEAR = 2; // linear interpolation + {$EXTERNALSYM D3DTEXF_LINEAR} + D3DTEXF_ANISOTROPIC = 3; // anisotropic + {$EXTERNALSYM D3DTEXF_ANISOTROPIC} + D3DTEXF_PYRAMIDALQUAD = 6; // 4-sample tent + {$EXTERNALSYM D3DTEXF_PYRAMIDALQUAD} + D3DTEXF_GAUSSIANQUAD = 7; // 4-sample gaussian + {$EXTERNALSYM D3DTEXF_GAUSSIANQUAD} + +const + { Bits for Flags in ProcessVertices call } + D3DPV_DONOTCOPYDATA = (1 shl 0); + {$EXTERNALSYM D3DPV_DONOTCOPYDATA} + +//------------------------------------------------------------------- + + // Flexible vertex format bits + // + D3DFVF_RESERVED0 = $001; + {$EXTERNALSYM D3DFVF_RESERVED0} + D3DFVF_POSITION_MASK = $400E; + {$EXTERNALSYM D3DFVF_POSITION_MASK} + D3DFVF_XYZ = $002; + {$EXTERNALSYM D3DFVF_XYZ} + D3DFVF_XYZRHW = $004; + {$EXTERNALSYM D3DFVF_XYZRHW} + D3DFVF_XYZB1 = $006; + {$EXTERNALSYM D3DFVF_XYZB1} + D3DFVF_XYZB2 = $008; + {$EXTERNALSYM D3DFVF_XYZB2} + D3DFVF_XYZB3 = $00a; + {$EXTERNALSYM D3DFVF_XYZB3} + D3DFVF_XYZB4 = $00c; + {$EXTERNALSYM D3DFVF_XYZB4} + D3DFVF_XYZB5 = $00e; + {$EXTERNALSYM D3DFVF_XYZB5} + D3DFVF_XYZW = $4002; + {$EXTERNALSYM D3DFVF_XYZW} + + D3DFVF_NORMAL = $010; + {$EXTERNALSYM D3DFVF_NORMAL} + D3DFVF_PSIZE = $020; + {$EXTERNALSYM D3DFVF_PSIZE} + D3DFVF_DIFFUSE = $040; + {$EXTERNALSYM D3DFVF_DIFFUSE} + D3DFVF_SPECULAR = $080; + {$EXTERNALSYM D3DFVF_SPECULAR} + + D3DFVF_TEXCOUNT_MASK = $f00; + {$EXTERNALSYM D3DFVF_TEXCOUNT_MASK} + D3DFVF_TEXCOUNT_SHIFT = 8; + {$EXTERNALSYM D3DFVF_TEXCOUNT_SHIFT} + D3DFVF_TEX0 = $000; + {$EXTERNALSYM D3DFVF_TEX0} + D3DFVF_TEX1 = $100; + {$EXTERNALSYM D3DFVF_TEX1} + D3DFVF_TEX2 = $200; + {$EXTERNALSYM D3DFVF_TEX2} + D3DFVF_TEX3 = $300; + {$EXTERNALSYM D3DFVF_TEX3} + D3DFVF_TEX4 = $400; + {$EXTERNALSYM D3DFVF_TEX4} + D3DFVF_TEX5 = $500; + {$EXTERNALSYM D3DFVF_TEX5} + D3DFVF_TEX6 = $600; + {$EXTERNALSYM D3DFVF_TEX6} + D3DFVF_TEX7 = $700; + {$EXTERNALSYM D3DFVF_TEX7} + D3DFVF_TEX8 = $800; + {$EXTERNALSYM D3DFVF_TEX8} + + D3DFVF_LASTBETA_UBYTE4 = $1000; + {$EXTERNALSYM D3DFVF_LASTBETA_UBYTE4} + D3DFVF_LASTBETA_D3DCOLOR = $8000; + {$EXTERNALSYM D3DFVF_LASTBETA_D3DCOLOR} + + D3DFVF_RESERVED2 = $6000; // 2 reserved bits + {$EXTERNALSYM D3DFVF_RESERVED2} + +//--------------------------------------------------------------------- +// 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 + ); + {$EXTERNALSYM _D3DDECLUSAGE} + D3DDECLUSAGE = _D3DDECLUSAGE; + {$EXTERNALSYM D3DDECLUSAGE} + TD3DDeclUsage = _D3DDECLUSAGE; + +const + MAXD3DDECLUSAGE = DWORD(D3DDECLUSAGE_SAMPLE); + {$EXTERNALSYM MAXD3DDECLUSAGE} + MAXD3DDECLUSAGEINDEX = 15; + {$EXTERNALSYM MAXD3DDECLUSAGEINDEX} + MAXD3DDECLLENGTH = 64; // does not include "end" marker vertex element + {$EXTERNALSYM MAXD3DDECLLENGTH} + +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 + ); + {$EXTERNALSYM _D3DDECLMETHOD} + D3DDECLMETHOD = _D3DDECLMETHOD; + {$EXTERNALSYM D3DDECLMETHOD} + TD3DDeclMethod = _D3DDECLMETHOD; + +const + MAXD3DDECLMETHOD = DWORD(D3DDECLMETHOD_LOOKUPPRESAMPLED); + {$EXTERNALSYM MAXD3DDECLMETHOD} + +type + // Declarations for _Type fields + // + _D3DDECLTYPE = ( + {$IFNDEF COMPILER6_UP} + 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. + {$ELSE} + 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. + {$ENDIF} + ); + {$EXTERNALSYM _D3DDECLTYPE} + D3DDECLTYPE = _D3DDECLTYPE; + {$EXTERNALSYM D3DDECLTYPE} + TD3DDeclType = _D3DDECLTYPE; + +// Restores enums to be 4 byte in size +{$MINENUMSIZE 4} + +const + MAXD3DDECLTYPE = DWORD(D3DDECLTYPE_UNUSED); + {$EXTERNALSYM MAXD3DDECLTYPE} + +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; + {$EXTERNALSYM _D3DVERTEXELEMENT9} + D3DVERTEXELEMENT9 = _D3DVERTEXELEMENT9; + {$EXTERNALSYM 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); + {$EXTERNALSYM D3DDECL_END} + +// Maximum supported number of texture coordinate sets +const + D3DDP_MAXTEXCOORD = 8; + {$EXTERNALSYM D3DDP_MAXTEXCOORD} + + +//--------------------------------------------------------------------- +// +// 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; + {$EXTERNALSYM D3DSI_OPCODE_MASK} + + D3DSI_INSTLENGTH_MASK = $0F000000; + {$EXTERNALSYM D3DSI_INSTLENGTH_MASK} + D3DSI_INSTLENGTH_SHIFT = 24; + {$EXTERNALSYM D3DSI_INSTLENGTH_SHIFT} + +type + _D3DSHADER_INSTRUCTION_OPCODE_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADER_INSTRUCTION_OPCODE_TYPE} + D3DSHADER_INSTRUCTION_OPCODE_TYPE = _D3DSHADER_INSTRUCTION_OPCODE_TYPE; + {$EXTERNALSYM D3DSHADER_INSTRUCTION_OPCODE_TYPE} + TD3DShaderInstructionOpcodeType = _D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +const + D3DSIO_NOP = 0; + {$EXTERNALSYM D3DSIO_NOP} + D3DSIO_MOV = 1; + {$EXTERNALSYM D3DSIO_MOV} + D3DSIO_ADD = 2; + {$EXTERNALSYM D3DSIO_ADD} + D3DSIO_SUB = 3; + {$EXTERNALSYM D3DSIO_SUB} + D3DSIO_MAD = 4; + {$EXTERNALSYM D3DSIO_MAD} + D3DSIO_MUL = 5; + {$EXTERNALSYM D3DSIO_MUL} + D3DSIO_RCP = 6; + {$EXTERNALSYM D3DSIO_RCP} + D3DSIO_RSQ = 7; + {$EXTERNALSYM D3DSIO_RSQ} + D3DSIO_DP3 = 8; + {$EXTERNALSYM D3DSIO_DP3} + D3DSIO_DP4 = 9; + {$EXTERNALSYM D3DSIO_DP4} + D3DSIO_MIN = 10; + {$EXTERNALSYM D3DSIO_MIN} + D3DSIO_MAX = 11; + {$EXTERNALSYM D3DSIO_MAX} + D3DSIO_SLT = 12; + {$EXTERNALSYM D3DSIO_SLT} + D3DSIO_SGE = 13; + {$EXTERNALSYM D3DSIO_SGE} + D3DSIO_EXP = 14; + {$EXTERNALSYM D3DSIO_EXP} + D3DSIO_LOG = 15; + {$EXTERNALSYM D3DSIO_LOG} + D3DSIO_LIT = 16; + {$EXTERNALSYM D3DSIO_LIT} + D3DSIO_DST = 17; + {$EXTERNALSYM D3DSIO_DST} + D3DSIO_LRP = 18; + {$EXTERNALSYM D3DSIO_LRP} + D3DSIO_FRC = 19; + {$EXTERNALSYM D3DSIO_FRC} + D3DSIO_M4x4 = 20; + {$EXTERNALSYM D3DSIO_M4x4} + D3DSIO_M4x3 = 21; + {$EXTERNALSYM D3DSIO_M4x3} + D3DSIO_M3x4 = 22; + {$EXTERNALSYM D3DSIO_M3x4} + D3DSIO_M3x3 = 23; + {$EXTERNALSYM D3DSIO_M3x3} + D3DSIO_M3x2 = 24; + {$EXTERNALSYM D3DSIO_M3x2} + D3DSIO_CALL = 25; + {$EXTERNALSYM D3DSIO_CALL} + D3DSIO_CALLNZ = 26; + {$EXTERNALSYM D3DSIO_CALLNZ} + D3DSIO_LOOP = 27; + {$EXTERNALSYM D3DSIO_LOOP} + D3DSIO_RET = 28; + {$EXTERNALSYM D3DSIO_RET} + D3DSIO_ENDLOOP = 29; + {$EXTERNALSYM D3DSIO_ENDLOOP} + D3DSIO_LABEL = 30; + {$EXTERNALSYM D3DSIO_LABEL} + D3DSIO_DCL = 31; + {$EXTERNALSYM D3DSIO_DCL} + D3DSIO_POW = 32; + {$EXTERNALSYM D3DSIO_POW} + D3DSIO_CRS = 33; + {$EXTERNALSYM D3DSIO_CRS} + D3DSIO_SGN = 34; + {$EXTERNALSYM D3DSIO_SGN} + D3DSIO_ABS = 35; + {$EXTERNALSYM D3DSIO_ABS} + D3DSIO_NRM = 36; + {$EXTERNALSYM D3DSIO_NRM} + D3DSIO_SINCOS = 37; + {$EXTERNALSYM D3DSIO_SINCOS} + D3DSIO_REP = 38; + {$EXTERNALSYM D3DSIO_REP} + D3DSIO_ENDREP = 39; + {$EXTERNALSYM D3DSIO_ENDREP} + D3DSIO_IF = 40; + {$EXTERNALSYM D3DSIO_IF} + D3DSIO_IFC = 41; + {$EXTERNALSYM D3DSIO_IFC} + D3DSIO_ELSE = 42; + {$EXTERNALSYM D3DSIO_ELSE} + D3DSIO_ENDIF = 43; + {$EXTERNALSYM D3DSIO_ENDIF} + D3DSIO_BREAK = 44; + {$EXTERNALSYM D3DSIO_BREAK} + D3DSIO_BREAKC = 45; + {$EXTERNALSYM D3DSIO_BREAKC} + D3DSIO_MOVA = 46; + {$EXTERNALSYM D3DSIO_MOVA} + D3DSIO_DEFB = 47; + {$EXTERNALSYM D3DSIO_DEFB} + D3DSIO_DEFI = 48; + {$EXTERNALSYM D3DSIO_DEFI} + + D3DSIO_TEXCOORD = 64; + {$EXTERNALSYM D3DSIO_TEXCOORD} + D3DSIO_TEXKILL = 65; + {$EXTERNALSYM D3DSIO_TEXKILL} + D3DSIO_TEX = 66; + {$EXTERNALSYM D3DSIO_TEX} + D3DSIO_TEXBEM = 67; + {$EXTERNALSYM D3DSIO_TEXBEM} + D3DSIO_TEXBEML = 68; + {$EXTERNALSYM D3DSIO_TEXBEML} + D3DSIO_TEXREG2AR = 69; + {$EXTERNALSYM D3DSIO_TEXREG2AR} + D3DSIO_TEXREG2GB = 70; + {$EXTERNALSYM D3DSIO_TEXREG2GB} + D3DSIO_TEXM3x2PAD = 71; + {$EXTERNALSYM D3DSIO_TEXM3x2PAD} + D3DSIO_TEXM3x2TEX = 72; + {$EXTERNALSYM D3DSIO_TEXM3x2TEX} + D3DSIO_TEXM3x3PAD = 73; + {$EXTERNALSYM D3DSIO_TEXM3x3PAD} + D3DSIO_TEXM3x3TEX = 74; + {$EXTERNALSYM D3DSIO_TEXM3x3TEX} + D3DSIO_RESERVED0 = 75; + {$EXTERNALSYM D3DSIO_RESERVED0} + D3DSIO_TEXM3x3SPEC = 76; + {$EXTERNALSYM D3DSIO_TEXM3x3SPEC} + D3DSIO_TEXM3x3VSPEC = 77; + {$EXTERNALSYM D3DSIO_TEXM3x3VSPEC} + D3DSIO_EXPP = 78; + {$EXTERNALSYM D3DSIO_EXPP} + D3DSIO_LOGP = 79; + {$EXTERNALSYM D3DSIO_LOGP} + D3DSIO_CND = 80; + {$EXTERNALSYM D3DSIO_CND} + D3DSIO_DEF = 81; + {$EXTERNALSYM D3DSIO_DEF} + D3DSIO_TEXREG2RGB = 82; + {$EXTERNALSYM D3DSIO_TEXREG2RGB} + D3DSIO_TEXDP3TEX = 83; + {$EXTERNALSYM D3DSIO_TEXDP3TEX} + D3DSIO_TEXM3x2DEPTH = 84; + {$EXTERNALSYM D3DSIO_TEXM3x2DEPTH} + D3DSIO_TEXDP3 = 85; + {$EXTERNALSYM D3DSIO_TEXDP3} + D3DSIO_TEXM3x3 = 86; + {$EXTERNALSYM D3DSIO_TEXM3x3} + D3DSIO_TEXDEPTH = 87; + {$EXTERNALSYM D3DSIO_TEXDEPTH} + D3DSIO_CMP = 88; + {$EXTERNALSYM D3DSIO_CMP} + D3DSIO_BEM = 89; + {$EXTERNALSYM D3DSIO_BEM} + + D3DSIO_DP2ADD = 90; + {$EXTERNALSYM D3DSIO_DP2ADD} + D3DSIO_DSX = 91; + {$EXTERNALSYM D3DSIO_DSX} + D3DSIO_DSY = 92; + {$EXTERNALSYM D3DSIO_DSY} + D3DSIO_TEXLDD = 93; + {$EXTERNALSYM D3DSIO_TEXLDD} + D3DSIO_SETP = 94; + {$EXTERNALSYM D3DSIO_SETP} + D3DSIO_TEXLDL = 95; + {$EXTERNALSYM D3DSIO_TEXLDL} + D3DSIO_BREAKP = 96; + {$EXTERNALSYM D3DSIO_BREAKP} + + + D3DSIO_PHASE = $FFFD; + {$EXTERNALSYM D3DSIO_PHASE} + D3DSIO_COMMENT = $FFFE; + {$EXTERNALSYM D3DSIO_COMMENT} + D3DSIO_END = $FFFF; + {$EXTERNALSYM D3DSIO_END} + + //--------------------------------------------------------------------- + // 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; + {$EXTERNALSYM D3DSI_COISSUE} + + //--------------------------------------------------------------------- + // Opcode specific controls + + D3DSP_OPCODESPECIFICCONTROL_MASK = $00ff0000; + {$EXTERNALSYM D3DSP_OPCODESPECIFICCONTROL_MASK} + D3DSP_OPCODESPECIFICCONTROL_SHIFT = 16; + {$EXTERNALSYM D3DSP_OPCODESPECIFICCONTROL_SHIFT} + + // ps_2_0 texld controls + D3DSI_TEXLD_PROJECT = ($01 shl D3DSP_OPCODESPECIFICCONTROL_SHIFT); + {$EXTERNALSYM D3DSI_TEXLD_PROJECT} + D3DSI_TEXLD_BIAS = ($02 shl D3DSP_OPCODESPECIFICCONTROL_SHIFT); + {$EXTERNALSYM D3DSI_TEXLD_BIAS} + +type + // Comparison for dynamic conditional instruction opcodes (i.e. if, breakc) + {$MINENUMSIZE 1} // Forces TD3DShaderComparison be 1 byte enum + _D3DSHADER_COMPARISON = ( + // < = > + {$IFNDEF COMPILER6_UP} + 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 + {$ELSE} + 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 + {$ENDIF} + ); + {$EXTERNALSYM _D3DSHADER_COMPARISON} + D3DSHADER_COMPARISON = _D3DSHADER_COMPARISON; + {$EXTERNALSYM 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; + {$EXTERNALSYM D3DSHADER_COMPARISON_SHIFT} + D3DSHADER_COMPARISON_MASK = ($7 shl D3DSHADER_COMPARISON_SHIFT); + {$EXTERNALSYM D3DSHADER_COMPARISON_MASK} + + //--------------------------------------------------------------------- + // Predication flags on instruction token + D3DSHADER_INSTRUCTION_PREDICATED = ($1 shl 28); + {$EXTERNALSYM D3DSHADER_INSTRUCTION_PREDICATED} + + //--------------------------------------------------------------------- + // DCL Info Token Controls + + // For dcl info tokens requiring a semantic (usage + index) + D3DSP_DCL_USAGE_SHIFT = 0; + {$EXTERNALSYM D3DSP_DCL_USAGE_SHIFT} + D3DSP_DCL_USAGE_MASK = $0000000f; + {$EXTERNALSYM D3DSP_DCL_USAGE_MASK} + + D3DSP_DCL_USAGEINDEX_SHIFT = 16; + {$EXTERNALSYM D3DSP_DCL_USAGEINDEX_SHIFT} + D3DSP_DCL_USAGEINDEX_MASK = $000f0000; + {$EXTERNALSYM D3DSP_DCL_USAGEINDEX_MASK} + + // DCL pixel shader sampler info token. + D3DSP_TEXTURETYPE_SHIFT = 27; + {$EXTERNALSYM D3DSP_TEXTURETYPE_SHIFT} + D3DSP_TEXTURETYPE_MASK = $78000000; + {$EXTERNALSYM D3DSP_TEXTURETYPE_MASK} + +{$IFNDEF COMPILER6_UP} +type + _D3DSAMPLER_TEXTURE_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSAMPLER_TEXTURE_TYPE} + D3DSAMPLER_TEXTURE_TYPE = _D3DSAMPLER_TEXTURE_TYPE; + {$EXTERNALSYM D3DSAMPLER_TEXTURE_TYPE} + TD3DSamplerTextureType = _D3DSAMPLER_TEXTURE_TYPE; + +const + D3DSTT_UNKNOWN = 0 shl D3DSP_TEXTURETYPE_SHIFT; // uninitialized value + {$EXTERNALSYM D3DSTT_UNKNOWN} + D3DSTT_2D = 2 shl D3DSP_TEXTURETYPE_SHIFT; // dcl_2d s# (for declaring a 2-D texture) + {$EXTERNALSYM D3DSTT_2D} + D3DSTT_CUBE = 3 shl D3DSP_TEXTURETYPE_SHIFT; // dcl_cube s# (for declaring a cube texture) + {$EXTERNALSYM D3DSTT_CUBE} + D3DSTT_VOLUME = 4 shl D3DSP_TEXTURETYPE_SHIFT; // dcl_volume s# (for declaring a volume texture) + {$EXTERNALSYM D3DSTT_VOLUME} + D3DSTT_FORCE_DWORD = $7fffffff; // force 32-bit size enum + {$EXTERNALSYM D3DSTT_FORCE_DWORD} +{$ELSE} +type + _D3DSAMPLER_TEXTURE_TYPE = ( + {$IFDEF BCB} + D3DSTT_DUMMY + {$ELSE} + 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 + {$ENDIF} + ); + {$EXTERNALSYM _D3DSAMPLER_TEXTURE_TYPE} + D3DSAMPLER_TEXTURE_TYPE = _D3DSAMPLER_TEXTURE_TYPE; + {$EXTERNALSYM D3DSAMPLER_TEXTURE_TYPE} + TD3DSamplerTextureType = _D3DSAMPLER_TEXTURE_TYPE; +{$ENDIF} + +const + //--------------------------------------------------------------------- + // Parameter Token Bit Definitions + // + D3DSP_REGNUM_MASK = $000007FF; + {$EXTERNALSYM D3DSP_REGNUM_MASK} + + // destination parameter write mask + D3DSP_WRITEMASK_0 = $00010000; // Component 0 (X;Red) + {$EXTERNALSYM D3DSP_WRITEMASK_0} + D3DSP_WRITEMASK_1 = $00020000; // Component 1 (Y;Green) + {$EXTERNALSYM D3DSP_WRITEMASK_1} + D3DSP_WRITEMASK_2 = $00040000; // Component 2 (Z;Blue) + {$EXTERNALSYM D3DSP_WRITEMASK_2} + D3DSP_WRITEMASK_3 = $00080000; // Component 3 (W;Alpha) + {$EXTERNALSYM D3DSP_WRITEMASK_3} + D3DSP_WRITEMASK_ALL = $000F0000; // All Components + {$EXTERNALSYM D3DSP_WRITEMASK_ALL} + + // destination parameter modifiers + D3DSP_DSTMOD_SHIFT = 20; + {$EXTERNALSYM D3DSP_DSTMOD_SHIFT} + D3DSP_DSTMOD_MASK = $00F00000; + {$EXTERNALSYM D3DSP_DSTMOD_MASK} + + // Bit masks for destination parameter modifiers + D3DSPDM_NONE = (0 shl D3DSP_DSTMOD_SHIFT); // nop + {$EXTERNALSYM D3DSPDM_NONE} + D3DSPDM_SATURATE = (1 shl D3DSP_DSTMOD_SHIFT); // clamp to 0. to 1. range + {$EXTERNALSYM D3DSPDM_SATURATE} + D3DSPDM_PARTIALPRECISION = (2 shl D3DSP_DSTMOD_SHIFT); // Partial precision hint + {$EXTERNALSYM D3DSPDM_PARTIALPRECISION} + D3DSPDM_MSAMPCENTROID = (4 shl D3DSP_DSTMOD_SHIFT); // Relevant to multisampling only: + {$EXTERNALSYM D3DSPDM_MSAMPCENTROID} + // 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; + {$EXTERNALSYM D3DSP_DSTSHIFT_SHIFT} + D3DSP_DSTSHIFT_MASK = $0F000000; + {$EXTERNALSYM D3DSP_DSTSHIFT_MASK} + + // destination/source parameter register type + D3DSP_REGTYPE_SHIFT = 28; + {$EXTERNALSYM D3DSP_REGTYPE_SHIFT} + D3DSP_REGTYPE_SHIFT2 = 8; + {$EXTERNALSYM D3DSP_REGTYPE_SHIFT2} + D3DSP_REGTYPE_MASK = $70000000; + {$EXTERNALSYM D3DSP_REGTYPE_MASK} + D3DSP_REGTYPE_MASK2 = $00001800; + {$EXTERNALSYM D3DSP_REGTYPE_MASK2} + + +{$IFNDEF COMPILER6_UP} +const + D3DSPR_TEMP = 0; // Temporary Register File + {$EXTERNALSYM D3DSPR_TEMP} + D3DSPR_INPUT = 1; // Input Register File + {$EXTERNALSYM D3DSPR_INPUT} + D3DSPR_CONST = 2; // Constant Register File + {$EXTERNALSYM D3DSPR_CONST} + D3DSPR_ADDR = 3; // Address Register (VS) + {$EXTERNALSYM D3DSPR_ADDR} + D3DSPR_TEXTURE = 3; // Texture Register File (PS) + {$EXTERNALSYM D3DSPR_TEXTURE} + D3DSPR_RASTOUT = 4; // Rasterizer Register File + {$EXTERNALSYM D3DSPR_RASTOUT} + D3DSPR_ATTROUT = 5; // Attribute Output Register File + {$EXTERNALSYM D3DSPR_ATTROUT} + D3DSPR_TEXCRDOUT = 6; // Texture Coordinate Output Register File + {$EXTERNALSYM D3DSPR_TEXCRDOUT} + D3DSPR_OUTPUT = 6; // Output register file for VS3.0+ + {$EXTERNALSYM D3DSPR_OUTPUT} + D3DSPR_CONSTINT = 7; // Constant Integer Vector Register File + {$EXTERNALSYM D3DSPR_CONSTINT} + D3DSPR_COLOROUT = 8; // Color Output Register File + {$EXTERNALSYM D3DSPR_COLOROUT} + D3DSPR_DEPTHOUT = 9; // Depth Output Register File + {$EXTERNALSYM D3DSPR_DEPTHOUT} + D3DSPR_SAMPLER = 10; // Sampler State Register File + {$EXTERNALSYM D3DSPR_SAMPLER} + D3DSPR_CONST2 = 11; // Constant Register File 2048 - 4095 + {$EXTERNALSYM D3DSPR_CONST2} + D3DSPR_CONST3 = 12; // Constant Register File 4096 - 6143 + {$EXTERNALSYM D3DSPR_CONST3} + D3DSPR_CONST4 = 13; // Constant Register File 6144 - 8191 + {$EXTERNALSYM D3DSPR_CONST4} + D3DSPR_CONSTBOOL = 14; // Constant Boolean register file + {$EXTERNALSYM D3DSPR_CONSTBOOL} + D3DSPR_LOOP = 15; // Loop counter register file + {$EXTERNALSYM D3DSPR_LOOP} + D3DSPR_TEMPFLOAT16 = 16; // 16-bit float temp register file + {$EXTERNALSYM D3DSPR_TEMPFLOAT16} + D3DSPR_MISCTYPE = 17; // Miscellaneous (single) registers. + {$EXTERNALSYM D3DSPR_MISCTYPE} + D3DSPR_LABEL = 18; // Label + {$EXTERNALSYM D3DSPR_LABEL} + D3DSPR_PREDICATE = 19; // Predicate register + {$EXTERNALSYM D3DSPR_PREDICATE} + +type + _D3DSHADER_PARAM_REGISTER_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; +{$ELSE} +type + _D3DSHADER_PARAM_REGISTER_TYPE = ( + 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 + ); +{$ENDIF} + {$EXTERNALSYM _D3DSHADER_PARAM_REGISTER_TYPE} + D3DSHADER_PARAM_REGISTER_TYPE = _D3DSHADER_PARAM_REGISTER_TYPE; + {$EXTERNALSYM 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 = ( + {$IFNDEF COMPILER6_UP} + D3DSMO_POSITION {= 0}, // Input position x,y,z,rhw (PS) + D3DSMO_FACE {= 1} // Floating point primitive area (PS) + {$ELSE} + D3DSMO_POSITION = 0, // Input position x,y,z,rhw (PS) + D3DSMO_FACE = 1 // Floating point primitive area (PS) + {$ENDIF} + ); + {$EXTERNALSYM _D3DSHADER_MISCTYPE_OFFSETS} + D3DSHADER_MISCTYPE_OFFSETS = _D3DSHADER_MISCTYPE_OFFSETS; + {$EXTERNALSYM 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 + ); + {$EXTERNALSYM _D3DVS_RASTOUT_OFFSETS} + D3DVS_RASTOUT_OFFSETS = _D3DVS_RASTOUT_OFFSETS; + {$EXTERNALSYM D3DVS_RASTOUT_OFFSETS} + TD3DVSRastoutOffsets = _D3DVS_RASTOUT_OFFSETS; + +// Source operand addressing modes + +const + D3DVS_ADDRESSMODE_SHIFT = 13; + {$EXTERNALSYM D3DVS_ADDRESSMODE_SHIFT} + D3DVS_ADDRESSMODE_MASK = 1 shl D3DVS_ADDRESSMODE_SHIFT; + {$EXTERNALSYM D3DVS_ADDRESSMODE_MASK} + +type + _D3DVS_ADDRESSMODE_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DVS_ADDRESSMODE_TYPE} + D3DVS_ADDRESSMODE_TYPE = _D3DVS_ADDRESSMODE_TYPE; + {$EXTERNALSYM D3DVS_ADDRESSMODE_TYPE} + TD3DVSAddressModeType = _D3DVS_ADDRESSMODE_TYPE; + +const + D3DVS_ADDRMODE_ABSOLUTE = 0 shl D3DVS_ADDRESSMODE_SHIFT; + {$EXTERNALSYM D3DVS_ADDRMODE_ABSOLUTE} + D3DVS_ADDRMODE_RELATIVE = 1 shl D3DVS_ADDRESSMODE_SHIFT; + {$EXTERNALSYM D3DVS_ADDRMODE_RELATIVE} + D3DVS_ADDRMODE_FORCE_DWORD = $7fffffff; // force 32-bit size enum + {$EXTERNALSYM D3DVS_ADDRMODE_FORCE_DWORD} + +const + D3DSHADER_ADDRESSMODE_SHIFT = 13; + {$EXTERNALSYM D3DSHADER_ADDRESSMODE_SHIFT} + D3DSHADER_ADDRESSMODE_MASK = (1 shl D3DSHADER_ADDRESSMODE_SHIFT); + {$EXTERNALSYM D3DSHADER_ADDRESSMODE_MASK} + +type + _D3DSHADER_ADDRESSMODE_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADER_ADDRESSMODE_TYPE} + D3DSHADER_ADDRESSMODE_TYPE = _D3DSHADER_ADDRESSMODE_TYPE; + {$EXTERNALSYM D3DSHADER_ADDRESSMODE_TYPE} + TD3DShaderAddressModeType = _D3DSHADER_ADDRESSMODE_TYPE; + +const + D3DSHADER_ADDRMODE_ABSOLUTE = (0 shl D3DSHADER_ADDRESSMODE_SHIFT); + {$EXTERNALSYM D3DSHADER_ADDRMODE_ABSOLUTE} + D3DSHADER_ADDRMODE_RELATIVE = (1 shl D3DSHADER_ADDRESSMODE_SHIFT); + {$EXTERNALSYM D3DSHADER_ADDRMODE_RELATIVE} + D3DSHADER_ADDRMODE_FORCE_DWORD = $7fffffff; // force 32-bit size enum + {$EXTERNALSYM D3DSHADER_ADDRMODE_FORCE_DWORD} + + // Source operand swizzle definitions + // + D3DVS_SWIZZLE_SHIFT = 16; + {$EXTERNALSYM D3DVS_SWIZZLE_SHIFT} + D3DVS_SWIZZLE_MASK = $00FF0000; + {$EXTERNALSYM D3DVS_SWIZZLE_MASK} + + // The following bits define where to take component X from: + + D3DVS_X_X = 0 shl D3DVS_SWIZZLE_SHIFT; + {$EXTERNALSYM D3DVS_X_X} + D3DVS_X_Y = 1 shl D3DVS_SWIZZLE_SHIFT; + {$EXTERNALSYM D3DVS_X_Y} + D3DVS_X_Z = 2 shl D3DVS_SWIZZLE_SHIFT; + {$EXTERNALSYM D3DVS_X_Z} + D3DVS_X_W = 3 shl D3DVS_SWIZZLE_SHIFT; + {$EXTERNALSYM D3DVS_X_W} + + // The following bits define where to take component Y from: + + D3DVS_Y_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 2); + {$EXTERNALSYM D3DVS_Y_X} + D3DVS_Y_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 2); + {$EXTERNALSYM D3DVS_Y_Y} + D3DVS_Y_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 2); + {$EXTERNALSYM D3DVS_Y_Z} + D3DVS_Y_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 2); + {$EXTERNALSYM D3DVS_Y_W} + + // The following bits define where to take component Z from: + + D3DVS_Z_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 4); + {$EXTERNALSYM D3DVS_Z_X} + D3DVS_Z_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 4); + {$EXTERNALSYM D3DVS_Z_Y} + D3DVS_Z_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 4); + {$EXTERNALSYM D3DVS_Z_Z} + D3DVS_Z_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 4); + {$EXTERNALSYM D3DVS_Z_W} + + // The following bits define where to take component W from: + + D3DVS_W_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 6); + {$EXTERNALSYM D3DVS_W_X} + D3DVS_W_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 6); + {$EXTERNALSYM D3DVS_W_Y} + D3DVS_W_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 6); + {$EXTERNALSYM D3DVS_W_Z} + D3DVS_W_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 6); + {$EXTERNALSYM D3DVS_W_W} + + // 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; + {$EXTERNALSYM D3DVS_NOSWIZZLE} + + // source parameter swizzle + D3DSP_SWIZZLE_SHIFT = 16; + {$EXTERNALSYM D3DSP_SWIZZLE_SHIFT} + D3DSP_SWIZZLE_MASK = $00FF0000; + {$EXTERNALSYM D3DSP_SWIZZLE_MASK} + + 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)); + {$EXTERNALSYM D3DSP_NOSWIZZLE} + + // 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)); + {$EXTERNALSYM D3DSP_REPLICATERED} + + 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)); + {$EXTERNALSYM D3DSP_REPLICATEGREEN} + + 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)); + {$EXTERNALSYM D3DSP_REPLICATEBLUE} + + 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)); + {$EXTERNALSYM D3DSP_REPLICATEALPHA} + + // source parameter modifiers + D3DSP_SRCMOD_SHIFT = 24; + {$EXTERNALSYM D3DSP_SRCMOD_SHIFT} + D3DSP_SRCMOD_MASK = $0F000000; + {$EXTERNALSYM D3DSP_SRCMOD_MASK} + +type + _D3DSHADER_PARAM_SRCMOD_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM _D3DSHADER_PARAM_SRCMOD_TYPE} + D3DSHADER_PARAM_SRCMOD_TYPE = _D3DSHADER_PARAM_SRCMOD_TYPE; + {$EXTERNALSYM D3DSHADER_PARAM_SRCMOD_TYPE} + TD3DShaderParamSRCModType = _D3DSHADER_PARAM_SRCMOD_TYPE; + +const + D3DSPSM_NONE = 0 shl D3DSP_SRCMOD_SHIFT; // nop + {$EXTERNALSYM D3DSPSM_NONE} + D3DSPSM_NEG = 1 shl D3DSP_SRCMOD_SHIFT; // negate + {$EXTERNALSYM D3DSPSM_NEG} + D3DSPSM_BIAS = 2 shl D3DSP_SRCMOD_SHIFT; // bias + {$EXTERNALSYM D3DSPSM_BIAS} + D3DSPSM_BIASNEG = 3 shl D3DSP_SRCMOD_SHIFT; // bias and negate + {$EXTERNALSYM D3DSPSM_BIASNEG} + D3DSPSM_SIGN = 4 shl D3DSP_SRCMOD_SHIFT; // sign + {$EXTERNALSYM D3DSPSM_SIGN} + D3DSPSM_SIGNNEG = 5 shl D3DSP_SRCMOD_SHIFT; // sign and negate + {$EXTERNALSYM D3DSPSM_SIGNNEG} + D3DSPSM_COMP = 6 shl D3DSP_SRCMOD_SHIFT; // complement + {$EXTERNALSYM D3DSPSM_COMP} + D3DSPSM_X2 = 7 shl D3DSP_SRCMOD_SHIFT; // *2 + {$EXTERNALSYM D3DSPSM_X2} + D3DSPSM_X2NEG = 8 shl D3DSP_SRCMOD_SHIFT; // *2 and negate + {$EXTERNALSYM D3DSPSM_X2NEG} + D3DSPSM_DZ = 9 shl D3DSP_SRCMOD_SHIFT; // divide through by z component + {$EXTERNALSYM D3DSPSM_DZ} + D3DSPSM_DW = 10 shl D3DSP_SRCMOD_SHIFT; // divide through by w component + {$EXTERNALSYM D3DSPSM_DW} + D3DSPSM_ABS = 11 shl D3DSP_SRCMOD_SHIFT; // abs() + {$EXTERNALSYM D3DSPSM_ABS} + D3DSPSM_ABSNEG = 12 shl D3DSP_SRCMOD_SHIFT; // -abs() + {$EXTERNALSYM D3DSPSM_ABSNEG} + D3DSPSM_NOT = 13 shl D3DSP_SRCMOD_SHIFT; // for predicate register: "!p0" + {$EXTERNALSYM D3DSPSM_NOT} + D3DSPSM_FORCE_DWORD = $7fffffff; // force 32-bit size enum + {$EXTERNALSYM D3DSPSM_FORCE_DWORD} + +// pixel shader version token +//#define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor)) +function D3DPS_VERSION(_Major, _Minor: DWord): DWord; +{$EXTERNALSYM D3DPS_VERSION} + +// vertex shader version token +//#define D3DVS_VERSION(_Major,_Minor) (0xFFFE0000|((_Major)<<8)|(_Minor)) +function D3DVS_VERSION(_Major, _Minor: DWord): DWord; +{$EXTERNALSYM D3DVS_VERSION} + +// extract major/minor from version cap +//#define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF) +function D3DSHADER_VERSION_MAJOR(_Version: DWord): DWord; +{$EXTERNALSYM D3DSHADER_VERSION_MAJOR} +//#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) +function D3DSHADER_VERSION_MINOR(_Version: DWord): DWord; +{$EXTERNALSYM D3DSHADER_VERSION_MINOR} + +const + // destination/source parameter register type + D3DSI_COMMENTSIZE_SHIFT = 16; + {$EXTERNALSYM D3DSI_COMMENTSIZE_SHIFT} + D3DSI_COMMENTSIZE_MASK = $7FFF0000; + {$EXTERNALSYM D3DSI_COMMENTSIZE_MASK} + +//#define D3DSHADER_COMMENT(_DWordSize) \ +// ((((_DWordSize)<=400) + D3DCURSORCAPS_COLOR = $00000001; + {$EXTERNALSYM D3DCURSORCAPS_COLOR} + // Driver supports HW cursor also in low-res modes(height < 400) + D3DCURSORCAPS_LOWRES = $00000002; + {$EXTERNALSYM D3DCURSORCAPS_LOWRES} + + // + // DevCaps + // + D3DDEVCAPS_EXECUTESYSTEMMEMORY = $00000010; { Device can use execute buffers from system memory } + {$EXTERNALSYM D3DDEVCAPS_EXECUTESYSTEMMEMORY} + D3DDEVCAPS_EXECUTEVIDEOMEMORY = $00000020; { Device can use execute buffers from video memory } + {$EXTERNALSYM D3DDEVCAPS_EXECUTEVIDEOMEMORY} + D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; { Device can use TL buffers from system memory } + {$EXTERNALSYM D3DDEVCAPS_TLVERTEXSYSTEMMEMORY} + D3DDEVCAPS_TLVERTEXVIDEOMEMORY = $00000080; { Device can use TL buffers from video memory } + {$EXTERNALSYM D3DDEVCAPS_TLVERTEXVIDEOMEMORY} + D3DDEVCAPS_TEXTURESYSTEMMEMORY = $00000100; { Device can texture from system memory } + {$EXTERNALSYM D3DDEVCAPS_TEXTURESYSTEMMEMORY} + D3DDEVCAPS_TEXTUREVIDEOMEMORY = $00000200; { Device can texture from device memory } + {$EXTERNALSYM D3DDEVCAPS_TEXTUREVIDEOMEMORY} + D3DDEVCAPS_DRAWPRIMTLVERTEX = $00000400; { Device can draw TLVERTEX primitives } + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMTLVERTEX} + D3DDEVCAPS_CANRENDERAFTERFLIP = $00000800; { Device can render without waiting for flip to complete } + {$EXTERNALSYM D3DDEVCAPS_CANRENDERAFTERFLIP} + D3DDEVCAPS_TEXTURENONLOCALVIDMEM = $00001000; { Device can texture from nonlocal video memory } + {$EXTERNALSYM D3DDEVCAPS_TEXTURENONLOCALVIDMEM} + D3DDEVCAPS_DRAWPRIMITIVES2 = $00002000; { Device can support DrawPrimitives2 } + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2} + D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; { Device is texturing from separate memory pools } + {$EXTERNALSYM D3DDEVCAPS_SEPARATETEXTUREMEMORIES} + D3DDEVCAPS_DRAWPRIMITIVES2EX = $00008000; { Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver } + {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2EX} + D3DDEVCAPS_HWTRANSFORMANDLIGHT = $00010000; { Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also } + {$EXTERNALSYM D3DDEVCAPS_HWTRANSFORMANDLIGHT} + D3DDEVCAPS_CANBLTSYSTONONLOCAL = $00020000; { Device supports a Tex Blt from system memory to non-local vidmem } + {$EXTERNALSYM D3DDEVCAPS_CANBLTSYSTONONLOCAL} + D3DDEVCAPS_HWRASTERIZATION = $00080000; { Device has HW acceleration for rasterization } + {$EXTERNALSYM D3DDEVCAPS_HWRASTERIZATION} + D3DDEVCAPS_PUREDEVICE = $00100000; { Device supports D3DCREATE_PUREDEVICE } + {$EXTERNALSYM D3DDEVCAPS_PUREDEVICE} + D3DDEVCAPS_QUINTICRTPATCHES = $00200000; { Device supports quintic Beziers and BSplines } + {$EXTERNALSYM D3DDEVCAPS_QUINTICRTPATCHES} + D3DDEVCAPS_RTPATCHES = $00400000; { Device supports Rect and Tri patches } + {$EXTERNALSYM D3DDEVCAPS_RTPATCHES} + D3DDEVCAPS_RTPATCHHANDLEZERO = $00800000; { Indicates that RT Patches may be drawn efficiently using handle 0 } + {$EXTERNALSYM D3DDEVCAPS_RTPATCHHANDLEZERO} + D3DDEVCAPS_NPATCHES = $01000000; { Device supports N-Patches } + {$EXTERNALSYM D3DDEVCAPS_NPATCHES} + + // + // PrimitiveMiscCaps + // + D3DPMISCCAPS_MASKZ = $00000002; + {$EXTERNALSYM D3DPMISCCAPS_MASKZ} + D3DPMISCCAPS_CULLNONE = $00000010; + {$EXTERNALSYM D3DPMISCCAPS_CULLNONE} + D3DPMISCCAPS_CULLCW = $00000020; + {$EXTERNALSYM D3DPMISCCAPS_CULLCW} + D3DPMISCCAPS_CULLCCW = $00000040; + {$EXTERNALSYM D3DPMISCCAPS_CULLCCW} + D3DPMISCCAPS_COLORWRITEENABLE = $00000080; + {$EXTERNALSYM D3DPMISCCAPS_COLORWRITEENABLE} + D3DPMISCCAPS_CLIPPLANESCALEDPOINTS = $00000100; { Device correctly clips scaled points to clip planes } + {$EXTERNALSYM D3DPMISCCAPS_CLIPPLANESCALEDPOINTS} + D3DPMISCCAPS_CLIPTLVERTS = $00000200; { device will clip post-transformed vertex primitives } + {$EXTERNALSYM D3DPMISCCAPS_CLIPTLVERTS} + D3DPMISCCAPS_TSSARGTEMP = $00000400; { device supports D3DTA_TEMP for temporary register } + {$EXTERNALSYM D3DPMISCCAPS_TSSARGTEMP} + D3DPMISCCAPS_BLENDOP = $00000800; { device supports D3DRS_BLENDOP } + {$EXTERNALSYM D3DPMISCCAPS_BLENDOP} + D3DPMISCCAPS_NULLREFERENCE = $00001000; { Reference Device that doesnt render } + {$EXTERNALSYM D3DPMISCCAPS_NULLREFERENCE} + D3DPMISCCAPS_INDEPENDENTWRITEMASKS = $00004000; { Device supports independent write masks for MET or MRT } + {$EXTERNALSYM D3DPMISCCAPS_INDEPENDENTWRITEMASKS} + D3DPMISCCAPS_PERSTAGECONSTANT = $00008000; { Device supports per-stage constants } + {$EXTERNALSYM D3DPMISCCAPS_PERSTAGECONSTANT} + D3DPMISCCAPS_FOGANDSPECULARALPHA = $00010000; { Device supports separate fog and specular alpha (many devices + use the specular alpha channel to store fog factor) } + {$EXTERNALSYM D3DPMISCCAPS_FOGANDSPECULARALPHA} + D3DPMISCCAPS_SEPARATEALPHABLEND = $00020000; { Device supports separate blend settings for the alpha channel } + {$EXTERNALSYM D3DPMISCCAPS_SEPARATEALPHABLEND} + D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS = $00040000; { Device supports different bit depths for MRT } + {$EXTERNALSYM D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS} + D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING = $00080000; { Device supports post-pixel shader operations for MRT } + {$EXTERNALSYM D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING} + D3DPMISCCAPS_FOGVERTEXCLAMPED = $00100000; { Device clamps fog blend factor per vertex } + {$EXTERNALSYM D3DPMISCCAPS_FOGVERTEXCLAMPED} + + // + // LineCaps + // + D3DLINECAPS_TEXTURE = $00000001; + {$EXTERNALSYM D3DLINECAPS_TEXTURE} + D3DLINECAPS_ZTEST = $00000002; + {$EXTERNALSYM D3DLINECAPS_ZTEST} + D3DLINECAPS_BLEND = $00000004; + {$EXTERNALSYM D3DLINECAPS_BLEND} + D3DLINECAPS_ALPHACMP = $00000008; + {$EXTERNALSYM D3DLINECAPS_ALPHACMP} + D3DLINECAPS_FOG = $00000010; + {$EXTERNALSYM D3DLINECAPS_FOG} + D3DLINECAPS_ANTIALIAS = $00000020; + {$EXTERNALSYM D3DLINECAPS_ANTIALIAS} + + // + // RasterCaps + // + D3DPRASTERCAPS_DITHER = $00000001; + {$EXTERNALSYM D3DPRASTERCAPS_DITHER} + D3DPRASTERCAPS_ZTEST = $00000010; + {$EXTERNALSYM D3DPRASTERCAPS_ZTEST} + D3DPRASTERCAPS_FOGVERTEX = $00000080; + {$EXTERNALSYM D3DPRASTERCAPS_FOGVERTEX} + D3DPRASTERCAPS_FOGTABLE = $00000100; + {$EXTERNALSYM D3DPRASTERCAPS_FOGTABLE} + D3DPRASTERCAPS_MIPMAPLODBIAS = $00002000; + {$EXTERNALSYM D3DPRASTERCAPS_MIPMAPLODBIAS} + D3DPRASTERCAPS_ZBUFFERLESSHSR = $00008000; + {$EXTERNALSYM D3DPRASTERCAPS_ZBUFFERLESSHSR} + D3DPRASTERCAPS_FOGRANGE = $00010000; + {$EXTERNALSYM D3DPRASTERCAPS_FOGRANGE} + D3DPRASTERCAPS_ANISOTROPY = $00020000; + {$EXTERNALSYM D3DPRASTERCAPS_ANISOTROPY} + D3DPRASTERCAPS_WBUFFER = $00040000; + {$EXTERNALSYM D3DPRASTERCAPS_WBUFFER} + D3DPRASTERCAPS_WFOG = $00100000; + {$EXTERNALSYM D3DPRASTERCAPS_WFOG} + D3DPRASTERCAPS_ZFOG = $00200000; + {$EXTERNALSYM D3DPRASTERCAPS_ZFOG} + D3DPRASTERCAPS_COLORPERSPECTIVE = $00400000; { Device iterates colors perspective correct } + {$EXTERNALSYM D3DPRASTERCAPS_COLORPERSPECTIVE} + D3DPRASTERCAPS_SCISSORTEST = $01000000; + {$EXTERNALSYM D3DPRASTERCAPS_SCISSORTEST} + D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS = $02000000; + {$EXTERNALSYM D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS} + D3DPRASTERCAPS_DEPTHBIAS = $04000000; + {$EXTERNALSYM D3DPRASTERCAPS_DEPTHBIAS} + D3DPRASTERCAPS_MULTISAMPLE_TOGGLE = $08000000; + {$EXTERNALSYM D3DPRASTERCAPS_MULTISAMPLE_TOGGLE} + + // + // ZCmpCaps, AlphaCmpCaps + // + D3DPCMPCAPS_NEVER = $00000001; + {$EXTERNALSYM D3DPCMPCAPS_NEVER} + D3DPCMPCAPS_LESS = $00000002; + {$EXTERNALSYM D3DPCMPCAPS_LESS} + D3DPCMPCAPS_EQUAL = $00000004; + {$EXTERNALSYM D3DPCMPCAPS_EQUAL} + D3DPCMPCAPS_LESSEQUAL = $00000008; + {$EXTERNALSYM D3DPCMPCAPS_LESSEQUAL} + D3DPCMPCAPS_GREATER = $00000010; + {$EXTERNALSYM D3DPCMPCAPS_GREATER} + D3DPCMPCAPS_NOTEQUAL = $00000020; + {$EXTERNALSYM D3DPCMPCAPS_NOTEQUAL} + D3DPCMPCAPS_GREATEREQUAL = $00000040; + {$EXTERNALSYM D3DPCMPCAPS_GREATEREQUAL} + D3DPCMPCAPS_ALWAYS = $00000080; + {$EXTERNALSYM D3DPCMPCAPS_ALWAYS} + + // + // SourceBlendCaps, DestBlendCaps + // + D3DPBLENDCAPS_ZERO = $00000001; + {$EXTERNALSYM D3DPBLENDCAPS_ZERO} + D3DPBLENDCAPS_ONE = $00000002; + {$EXTERNALSYM D3DPBLENDCAPS_ONE} + D3DPBLENDCAPS_SRCCOLOR = $00000004; + {$EXTERNALSYM D3DPBLENDCAPS_SRCCOLOR} + D3DPBLENDCAPS_INVSRCCOLOR = $00000008; + {$EXTERNALSYM D3DPBLENDCAPS_INVSRCCOLOR} + D3DPBLENDCAPS_SRCALPHA = $00000010; + {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHA} + D3DPBLENDCAPS_INVSRCALPHA = $00000020; + {$EXTERNALSYM D3DPBLENDCAPS_INVSRCALPHA} + D3DPBLENDCAPS_DESTALPHA = $00000040; + {$EXTERNALSYM D3DPBLENDCAPS_DESTALPHA} + D3DPBLENDCAPS_INVDESTALPHA = $00000080; + {$EXTERNALSYM D3DPBLENDCAPS_INVDESTALPHA} + D3DPBLENDCAPS_DESTCOLOR = $00000100; + {$EXTERNALSYM D3DPBLENDCAPS_DESTCOLOR} + D3DPBLENDCAPS_INVDESTCOLOR = $00000200; + {$EXTERNALSYM D3DPBLENDCAPS_INVDESTCOLOR} + D3DPBLENDCAPS_SRCALPHASAT = $00000400; + {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHASAT} + D3DPBLENDCAPS_BOTHSRCALPHA = $00000800; + {$EXTERNALSYM D3DPBLENDCAPS_BOTHSRCALPHA} + D3DPBLENDCAPS_BOTHINVSRCALPHA = $00001000; + {$EXTERNALSYM D3DPBLENDCAPS_BOTHINVSRCALPHA} + D3DPBLENDCAPS_BLENDFACTOR = $00002000; { Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR } + {$EXTERNALSYM D3DPBLENDCAPS_BLENDFACTOR} + + // + // ShadeCaps + // + D3DPSHADECAPS_COLORGOURAUDRGB = $00000008; + {$EXTERNALSYM D3DPSHADECAPS_COLORGOURAUDRGB} + D3DPSHADECAPS_SPECULARGOURAUDRGB = $00000200; + {$EXTERNALSYM D3DPSHADECAPS_SPECULARGOURAUDRGB} + D3DPSHADECAPS_ALPHAGOURAUDBLEND = $00004000; + {$EXTERNALSYM D3DPSHADECAPS_ALPHAGOURAUDBLEND} + D3DPSHADECAPS_FOGGOURAUD = $00080000; + {$EXTERNALSYM D3DPSHADECAPS_FOGGOURAUD} + + // + // TextureCaps + // + D3DPTEXTURECAPS_PERSPECTIVE = $00000001; { Perspective-correct texturing is supported } + {$EXTERNALSYM D3DPTEXTURECAPS_PERSPECTIVE} + D3DPTEXTURECAPS_POW2 = $00000002; { Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. } + {$EXTERNALSYM D3DPTEXTURECAPS_POW2} + D3DPTEXTURECAPS_ALPHA = $00000004; { Alpha in texture pixels is supported } + {$EXTERNALSYM D3DPTEXTURECAPS_ALPHA} + D3DPTEXTURECAPS_SQUAREONLY = $00000020; { Only square textures are supported } + {$EXTERNALSYM D3DPTEXTURECAPS_SQUAREONLY} + D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040; { Texture indices are not scaled by the texture size prior to interpolation } + {$EXTERNALSYM D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE} + D3DPTEXTURECAPS_ALPHAPALETTE = $00000080; { Device can draw alpha from texture palettes } + {$EXTERNALSYM D3DPTEXTURECAPS_ALPHAPALETTE} + // 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; + {$EXTERNALSYM D3DPTEXTURECAPS_NONPOW2CONDITIONAL} + D3DPTEXTURECAPS_PROJECTED = $00000400; { Device can do D3DTTFF_PROJECTED } + {$EXTERNALSYM D3DPTEXTURECAPS_PROJECTED} + D3DPTEXTURECAPS_CUBEMAP = $00000800; { Device can do cubemap textures } + {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP} + D3DPTEXTURECAPS_VOLUMEMAP = $00002000; { Device can do volume textures } + {$EXTERNALSYM D3DPTEXTURECAPS_VOLUMEMAP} + D3DPTEXTURECAPS_MIPMAP = $00004000; { Device can do mipmapped textures } + {$EXTERNALSYM D3DPTEXTURECAPS_MIPMAP} + D3DPTEXTURECAPS_MIPVOLUMEMAP = $00008000; { Device can do mipmapped volume textures } + {$EXTERNALSYM D3DPTEXTURECAPS_MIPVOLUMEMAP} + D3DPTEXTURECAPS_MIPCUBEMAP = $00010000; { Device can do mipmapped cube maps } + {$EXTERNALSYM D3DPTEXTURECAPS_MIPCUBEMAP} + D3DPTEXTURECAPS_CUBEMAP_POW2 = $00020000; { Device requires that cubemaps be power-of-2 dimension } + {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP_POW2} + D3DPTEXTURECAPS_VOLUMEMAP_POW2 = $00040000; { Device requires that volume maps be power-of-2 dimension } + {$EXTERNALSYM D3DPTEXTURECAPS_VOLUMEMAP_POW2} + D3DPTEXTURECAPS_NOPROJECTEDBUMPENV = $00200000; { Device does not support projected bump env lookup operation + in programmable and fixed function pixel shaders } + {$EXTERNALSYM D3DPTEXTURECAPS_NOPROJECTEDBUMPENV} + + // + // TextureFilterCaps, StretchRectFilterCaps + // + D3DPTFILTERCAPS_MINFPOINT = $00000100; { Min Filter } + {$EXTERNALSYM D3DPTFILTERCAPS_MINFPOINT} + D3DPTFILTERCAPS_MINFLINEAR = $00000200; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFLINEAR} + D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFANISOTROPIC} + D3DPTFILTERCAPS_MINFPYRAMIDALQUAD = $00000800; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFPYRAMIDALQUAD} + D3DPTFILTERCAPS_MINFGAUSSIANQUAD = $00001000; + {$EXTERNALSYM D3DPTFILTERCAPS_MINFGAUSSIANQUAD} + D3DPTFILTERCAPS_MIPFPOINT = $00010000; { Mip Filter } + {$EXTERNALSYM D3DPTFILTERCAPS_MIPFPOINT} + D3DPTFILTERCAPS_MIPFLINEAR = $00020000; + {$EXTERNALSYM D3DPTFILTERCAPS_MIPFLINEAR} + D3DPTFILTERCAPS_MAGFPOINT = $01000000; { Mag Filter } + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFPOINT} + D3DPTFILTERCAPS_MAGFLINEAR = $02000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFLINEAR} + D3DPTFILTERCAPS_MAGFANISOTROPIC = $04000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFANISOTROPIC} + D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD = $08000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD} + D3DPTFILTERCAPS_MAGFGAUSSIANQUAD = $10000000; + {$EXTERNALSYM D3DPTFILTERCAPS_MAGFGAUSSIANQUAD} + + // + // TextureAddressCaps + // + D3DPTADDRESSCAPS_WRAP = $00000001; + {$EXTERNALSYM D3DPTADDRESSCAPS_WRAP} + D3DPTADDRESSCAPS_MIRROR = $00000002; + {$EXTERNALSYM D3DPTADDRESSCAPS_MIRROR} + D3DPTADDRESSCAPS_CLAMP = $00000004; + {$EXTERNALSYM D3DPTADDRESSCAPS_CLAMP} + D3DPTADDRESSCAPS_BORDER = $00000008; + {$EXTERNALSYM D3DPTADDRESSCAPS_BORDER} + D3DPTADDRESSCAPS_INDEPENDENTUV = $00000010; + {$EXTERNALSYM D3DPTADDRESSCAPS_INDEPENDENTUV} + D3DPTADDRESSCAPS_MIRRORONCE = $00000020; + {$EXTERNALSYM D3DPTADDRESSCAPS_MIRRORONCE} + + // + // StencilCaps + // + D3DSTENCILCAPS_KEEP = $00000001; + {$EXTERNALSYM D3DSTENCILCAPS_KEEP} + D3DSTENCILCAPS_ZERO = $00000002; + {$EXTERNALSYM D3DSTENCILCAPS_ZERO} + D3DSTENCILCAPS_REPLACE = $00000004; + {$EXTERNALSYM D3DSTENCILCAPS_REPLACE} + D3DSTENCILCAPS_INCRSAT = $00000008; + {$EXTERNALSYM D3DSTENCILCAPS_INCRSAT} + D3DSTENCILCAPS_DECRSAT = $00000010; + {$EXTERNALSYM D3DSTENCILCAPS_DECRSAT} + D3DSTENCILCAPS_INVERT = $00000020; + {$EXTERNALSYM D3DSTENCILCAPS_INVERT} + D3DSTENCILCAPS_INCR = $00000040; + {$EXTERNALSYM D3DSTENCILCAPS_INCR} + D3DSTENCILCAPS_DECR = $00000080; + {$EXTERNALSYM D3DSTENCILCAPS_DECR} + D3DSTENCILCAPS_TWOSIDED = $00000100; + {$EXTERNALSYM D3DSTENCILCAPS_TWOSIDED} + + // + // TextureOpCaps + // + D3DTEXOPCAPS_DISABLE = $00000001; + {$EXTERNALSYM D3DTEXOPCAPS_DISABLE} + D3DTEXOPCAPS_SELECTARG1 = $00000002; + {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG1} + D3DTEXOPCAPS_SELECTARG2 = $00000004; + {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG2} + D3DTEXOPCAPS_MODULATE = $00000008; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE} + D3DTEXOPCAPS_MODULATE2X = $00000010; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE2X} + D3DTEXOPCAPS_MODULATE4X = $00000020; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATE4X} + D3DTEXOPCAPS_ADD = $00000040; + {$EXTERNALSYM D3DTEXOPCAPS_ADD} + D3DTEXOPCAPS_ADDSIGNED = $00000080; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED} + D3DTEXOPCAPS_ADDSIGNED2X = $00000100; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED2X} + D3DTEXOPCAPS_SUBTRACT = $00000200; + {$EXTERNALSYM D3DTEXOPCAPS_SUBTRACT} + D3DTEXOPCAPS_ADDSMOOTH = $00000400; + {$EXTERNALSYM D3DTEXOPCAPS_ADDSMOOTH} + D3DTEXOPCAPS_BLENDDIFFUSEALPHA = $00000800; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDDIFFUSEALPHA} + D3DTEXOPCAPS_BLENDTEXTUREALPHA = $00001000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHA} + D3DTEXOPCAPS_BLENDFACTORALPHA = $00002000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDFACTORALPHA} + D3DTEXOPCAPS_BLENDTEXTUREALPHAPM = $00004000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHAPM} + D3DTEXOPCAPS_BLENDCURRENTALPHA = $00008000; + {$EXTERNALSYM D3DTEXOPCAPS_BLENDCURRENTALPHA} + D3DTEXOPCAPS_PREMODULATE = $00010000; + {$EXTERNALSYM D3DTEXOPCAPS_PREMODULATE} + D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR = $00020000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR} + D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA = $00040000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA} + D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR = $00080000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR} + D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA = $00100000; + {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA} + D3DTEXOPCAPS_BUMPENVMAP = $00200000; + {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAP} + D3DTEXOPCAPS_BUMPENVMAPLUMINANCE = $00400000; + {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAPLUMINANCE} + D3DTEXOPCAPS_DOTPRODUCT3 = $00800000; + {$EXTERNALSYM D3DTEXOPCAPS_DOTPRODUCT3} + D3DTEXOPCAPS_MULTIPLYADD = $01000000; + {$EXTERNALSYM D3DTEXOPCAPS_MULTIPLYADD} + D3DTEXOPCAPS_LERP = $02000000; + {$EXTERNALSYM D3DTEXOPCAPS_LERP} + + // + // FVFCaps + // + D3DFVFCAPS_TEXCOORDCOUNTMASK = $0000ffff; { mask for texture coordinate count field } + {$EXTERNALSYM D3DFVFCAPS_TEXCOORDCOUNTMASK} + D3DFVFCAPS_DONOTSTRIPELEMENTS = $00080000; { Device prefers that vertex elements not be stripped } + {$EXTERNALSYM D3DFVFCAPS_DONOTSTRIPELEMENTS} + D3DFVFCAPS_PSIZE = $00100000; { Device can receive point size } + {$EXTERNALSYM D3DFVFCAPS_PSIZE} + + // + // VertexProcessingCaps + // + D3DVTXPCAPS_TEXGEN = $00000001; { device can do texgen } + {$EXTERNALSYM D3DVTXPCAPS_TEXGEN} + D3DVTXPCAPS_MATERIALSOURCE7 = $00000002; { device can do DX7-level colormaterialsource ops } + {$EXTERNALSYM D3DVTXPCAPS_MATERIALSOURCE7} + D3DVTXPCAPS_DIRECTIONALLIGHTS = $00000008; { device can do directional lights } + {$EXTERNALSYM D3DVTXPCAPS_DIRECTIONALLIGHTS} + D3DVTXPCAPS_POSITIONALLIGHTS = $00000010; { device can do positional lights (includes point and spot) } + {$EXTERNALSYM D3DVTXPCAPS_POSITIONALLIGHTS} + D3DVTXPCAPS_LOCALVIEWER = $00000020; { device can do local viewer } + {$EXTERNALSYM D3DVTXPCAPS_LOCALVIEWER} + D3DVTXPCAPS_TWEENING = $00000040; { device can do vertex tweening } + {$EXTERNALSYM D3DVTXPCAPS_TWEENING} + D3DVTXPCAPS_TEXGEN_SPHEREMAP = $00000100; { device supports D3DTSS_TCI_SPHEREMAP } + {$EXTERNALSYM D3DVTXPCAPS_TEXGEN_SPHEREMAP} + D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER = $00000200; { device does not support TexGen in non-local + viewer mode } + {$EXTERNALSYM D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER} + + // + // DevCaps2 + // + D3DDEVCAPS2_STREAMOFFSET = $00000001; { Device supports offsets in streams. Must be set by DX9 drivers } + {$EXTERNALSYM D3DDEVCAPS2_STREAMOFFSET} + D3DDEVCAPS2_DMAPNPATCH = $00000002; { Device supports displacement maps for N-Patches} + {$EXTERNALSYM D3DDEVCAPS2_DMAPNPATCH} + D3DDEVCAPS2_ADAPTIVETESSRTPATCH = $00000004; { Device supports adaptive tesselation of RT-patches} + {$EXTERNALSYM D3DDEVCAPS2_ADAPTIVETESSRTPATCH} + D3DDEVCAPS2_ADAPTIVETESSNPATCH = $00000008; { Device supports adaptive tesselation of N-patches} + {$EXTERNALSYM D3DDEVCAPS2_ADAPTIVETESSNPATCH} + D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES = $00000010; { Device supports StretchRect calls with a texture as the source} + {$EXTERNALSYM D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES} + D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH = $00000020; { Device supports presampled displacement maps for N-Patches } + {$EXTERNALSYM D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH} + D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET = $00000040; { Vertex elements in a vertex declaration can share the same stream offset } + {$EXTERNALSYM D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET} + + // + // DeclTypes + // + D3DDTCAPS_UBYTE4 = $00000001; + {$EXTERNALSYM D3DDTCAPS_UBYTE4} + D3DDTCAPS_UBYTE4N = $00000002; + {$EXTERNALSYM D3DDTCAPS_UBYTE4N} + D3DDTCAPS_SHORT2N = $00000004; + {$EXTERNALSYM D3DDTCAPS_SHORT2N} + D3DDTCAPS_SHORT4N = $00000008; + {$EXTERNALSYM D3DDTCAPS_SHORT4N} + D3DDTCAPS_USHORT2N = $00000010; + {$EXTERNALSYM D3DDTCAPS_USHORT2N} + D3DDTCAPS_USHORT4N = $00000020; + {$EXTERNALSYM D3DDTCAPS_USHORT4N} + D3DDTCAPS_UDEC3 = $00000040; + {$EXTERNALSYM D3DDTCAPS_UDEC3} + D3DDTCAPS_DEC3N = $00000080; + {$EXTERNALSYM D3DDTCAPS_DEC3N} + D3DDTCAPS_FLOAT16_2 = $00000100; + {$EXTERNALSYM D3DDTCAPS_FLOAT16_2} + D3DDTCAPS_FLOAT16_4 = $00000200; + {$EXTERNALSYM D3DDTCAPS_FLOAT16_4} + + + + +(*==========================================================================; + * + * 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 = DWORD(31); + {$EXTERNALSYM D3D_SDK_VERSION} + +type + HMONITOR = THandle; + {$EXTERNALSYM HMONITOR} + +(* + * 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D9);'} + {$EXTERNALSYM IDirect3D9} + 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; DisplayFormat, 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; + + + +{ SwapChain } + + + + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice9);'} + {$EXTERNALSYM IDirect3DDevice9} + 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 OffsetInBytes, pStride: LongWord): HResult; stdcall; + function SetStreamSourceFreq(StreamNumber: LongWord; Divider: LongWord): HResult; stdcall; + function GetStreamSourceFreq(StreamNumber: LongWord; out Divider: 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DStateBlock9);'} + {$EXTERNALSYM IDirect3DStateBlock9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSwapChain9);'} + {$EXTERNALSYM IDirect3DSwapChain9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DResource9);'} + {$EXTERNALSYM IDirect3DResource9} + IDirect3DResource9 = interface(IUnknown) + ['{05EEC05D-8F7D-4362-B999-D1BAF357C704}'] + (*** IDirect3DResource9 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 SetPriority(PriorityNew: DWord): DWord; stdcall; + function GetPriority: DWord; stdcall; + procedure PreLoad; stdcall; + function GetType: TD3DResourceType; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexDeclaration9);'} + {$EXTERNALSYM IDirect3DVertexDeclaration9} + IDirect3DVertexDeclaration9 = interface(IUnknown) + ['{DD13C59C-36FA-4098-A8FB-C7ED39DC8546}'] + (*** IDirect3DVertexDeclaration9 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetDeclaration(pDecl: PD3DVertexElement9; out pNumElements: LongWord): HResult; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexShader9);'} + {$EXTERNALSYM IDirect3DVertexShader9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DPixelShader9);'} + {$EXTERNALSYM IDirect3DPixelShader9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DBaseTexture9);'} + {$EXTERNALSYM IDirect3DBaseTexture9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DTexture9);'} + {$EXTERNALSYM IDirect3DTexture9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVolumeTexture9);'} + {$EXTERNALSYM IDirect3DVolumeTexture9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DCubeTexture9);'} + {$EXTERNALSYM IDirect3DCubeTexture9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexBuffer9);'} + {$EXTERNALSYM IDirect3DVertexBuffer9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DIndexBuffer9);'} + {$EXTERNALSYM IDirect3DIndexBuffer9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSurface9);'} + {$EXTERNALSYM IDirect3DSurface9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVolume9);'} + {$EXTERNALSYM IDirect3DVolume9} + 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; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DQuery9);'} + {$EXTERNALSYM IDirect3DQuery9} + 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; + + + +(* + * Interface IID's + *) +type + IID_IDirect3D9 = IDirect3D9; + {$EXTERNALSYM IID_IDirect3D9} + IID_IDirect3DDevice9 = IDirect3DDevice9; + {$EXTERNALSYM IID_IDirect3DDevice9} + IID_IDirect3DResource9 = IDirect3DResource9; + {$EXTERNALSYM IID_IDirect3DResource9} + IID_IDirect3DBaseTexture9 = IDirect3DBaseTexture9; + {$EXTERNALSYM IID_IDirect3DBaseTexture9} + IID_IDirect3DTexture9 = IDirect3DTexture9; + {$EXTERNALSYM IID_IDirect3DTexture9} + IID_IDirect3DCubeTexture9 = IDirect3DCubeTexture9; + {$EXTERNALSYM IID_IDirect3DCubeTexture9} + IID_IDirect3DVolumeTexture9 = IDirect3DVolumeTexture9; + {$EXTERNALSYM IID_IDirect3DVolumeTexture9} + IID_IDirect3DVertexBuffer9 = IDirect3DVertexBuffer9; + {$EXTERNALSYM IID_IDirect3DVertexBuffer9} + IID_IDirect3DIndexBuffer9 = IDirect3DIndexBuffer9; + {$EXTERNALSYM IID_IDirect3DIndexBuffer9} + IID_IDirect3DSurface9 = IDirect3DSurface9; + {$EXTERNALSYM IID_IDirect3DSurface9} + IID_IDirect3DVolume9 = IDirect3DVolume9; + {$EXTERNALSYM IID_IDirect3DVolume9} + IID_IDirect3DSwapChain9 = IDirect3DSwapChain9; + {$EXTERNALSYM IID_IDirect3DSwapChain9} + IID_IDirect3DVertexDeclaration9 = IDirect3DVertexDeclaration9; + {$EXTERNALSYM IID_IDirect3DVertexDeclaration9} + IID_IDirect3DVertexShader9 = IDirect3DVertexShader9; + {$EXTERNALSYM IID_IDirect3DVertexShader9} + IID_IDirect3DPixelShader9 = IDirect3DPixelShader9; + {$EXTERNALSYM IID_IDirect3DPixelShader9} + IID_IDirect3DStateBlock9 = IDirect3DStateBlock9; + {$EXTERNALSYM IID_IDirect3DStateBlock9} + IID_IDirect3DQuery9 = IDirect3DQuery9; + {$EXTERNALSYM IID_IDirect3DQuery9} + + + +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; + {$EXTERNALSYM D3DSPD_IUNKNOWN} + +(**************************************************************************** + * + * Flags for IDirect3D9::CreateDevice's BehaviorFlags + * + ****************************************************************************) + + D3DCREATE_FPU_PRESERVE = $00000002; + {$EXTERNALSYM D3DCREATE_FPU_PRESERVE} + D3DCREATE_MULTITHREADED = $00000004; + {$EXTERNALSYM D3DCREATE_MULTITHREADED} + + D3DCREATE_PUREDEVICE = $00000010; + {$EXTERNALSYM D3DCREATE_PUREDEVICE} + D3DCREATE_SOFTWARE_VERTEXPROCESSING = $00000020; + {$EXTERNALSYM D3DCREATE_SOFTWARE_VERTEXPROCESSING} + D3DCREATE_HARDWARE_VERTEXPROCESSING = $00000040; + {$EXTERNALSYM D3DCREATE_HARDWARE_VERTEXPROCESSING} + D3DCREATE_MIXED_VERTEXPROCESSING = $00000080; + {$EXTERNALSYM D3DCREATE_MIXED_VERTEXPROCESSING} + + D3DCREATE_DISABLE_DRIVER_MANAGEMENT = $00000100; + {$EXTERNALSYM D3DCREATE_DISABLE_DRIVER_MANAGEMENT} + D3DCREATE_ADAPTERGROUP_DEVICE = $00000200; + {$EXTERNALSYM D3DCREATE_ADAPTERGROUP_DEVICE} + + +(**************************************************************************** + * + * Parameter for IDirect3D9::CreateDevice's iAdapter + * + ****************************************************************************) + + D3DADAPTER_DEFAULT = 0; + {$EXTERNALSYM D3DADAPTER_DEFAULT} + +(**************************************************************************** + * + * Flags for IDirect3D9::EnumAdapters + * + ****************************************************************************) + + D3DENUM_WHQL_LEVEL = $00000002; + {$EXTERNALSYM D3DENUM_WHQL_LEVEL} + +(**************************************************************************** + * + * Maximum number of back-buffers supported in DX8 + * + ****************************************************************************) + + D3DPRESENT_BACK_BUFFERS_MAX = 3; + {$EXTERNALSYM D3DPRESENT_BACK_BUFFERS_MAX} + +(**************************************************************************** + * + * Flags for IDirect3DDevice9::SetGammaRamp + * + ****************************************************************************) + + D3DSGR_NO_CALIBRATION = $00000000; + {$EXTERNALSYM D3DSGR_NO_CALIBRATION} + D3DSGR_CALIBRATE = $00000001; + {$EXTERNALSYM D3DSGR_CALIBRATE} + +(**************************************************************************** + * + * Flags for IDirect3DDevice9::SetCursorPosition + * + ****************************************************************************) + + D3DCURSOR_IMMEDIATE_UPDATE = $00000001; + {$EXTERNALSYM D3DCURSOR_IMMEDIATE_UPDATE} + +(**************************************************************************** + * + * Flags for IDirect3DSwapChain9::Present + * + ****************************************************************************) + + D3DPRESENT_DONOTWAIT = $00000001; + {$EXTERNALSYM D3DPRESENT_DONOTWAIT} + D3DPRESENT_LINEAR_CONTENT = $00000002; + {$EXTERNALSYM D3DPRESENT_LINEAR_CONTENT} + +(**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************) + + +(* + * DirectDraw error codes + *) + _FACD3D = $876; + {$EXTERNALSYM _FACD3D} + +//#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +function MAKE_D3DHRESULT(Code: DWord): DWord; +{$EXTERNALSYM MAKE_D3DHRESULT} +//#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) +function MAKE_D3DSTATUS(Code: DWord): DWord; +{$EXTERNALSYM MAKE_D3DSTATUS} + +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; + {$EXTERNALSYM D3D_OK} + + D3DERR_WRONGTEXTUREFORMAT = HResult(MAKE_D3DHRESULT_R or 2072); + {$EXTERNALSYM D3DERR_WRONGTEXTUREFORMAT} + D3DERR_UNSUPPORTEDCOLOROPERATION = HResult(MAKE_D3DHRESULT_R or 2073); + {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLOROPERATION} + D3DERR_UNSUPPORTEDCOLORARG = HResult(MAKE_D3DHRESULT_R or 2074); + {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLORARG} + D3DERR_UNSUPPORTEDALPHAOPERATION = HResult(MAKE_D3DHRESULT_R or 2075); + {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAOPERATION} + D3DERR_UNSUPPORTEDALPHAARG = HResult(MAKE_D3DHRESULT_R or 2076); + {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAARG} + D3DERR_TOOMANYOPERATIONS = HResult(MAKE_D3DHRESULT_R or 2077); + {$EXTERNALSYM D3DERR_TOOMANYOPERATIONS} + D3DERR_CONFLICTINGTEXTUREFILTER = HResult(MAKE_D3DHRESULT_R or 2078); + {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREFILTER} + D3DERR_UNSUPPORTEDFACTORVALUE = HResult(MAKE_D3DHRESULT_R or 2079); + {$EXTERNALSYM D3DERR_UNSUPPORTEDFACTORVALUE} + D3DERR_CONFLICTINGRENDERSTATE = HResult(MAKE_D3DHRESULT_R or 2081); + {$EXTERNALSYM D3DERR_CONFLICTINGRENDERSTATE} + D3DERR_UNSUPPORTEDTEXTUREFILTER = HResult(MAKE_D3DHRESULT_R or 2082); + {$EXTERNALSYM D3DERR_UNSUPPORTEDTEXTUREFILTER} + D3DERR_CONFLICTINGTEXTUREPALETTE = HResult(MAKE_D3DHRESULT_R or 2086); + {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREPALETTE} + D3DERR_DRIVERINTERNALERROR = HResult(MAKE_D3DHRESULT_R or 2087); + {$EXTERNALSYM D3DERR_DRIVERINTERNALERROR} + + D3DERR_NOTFOUND = HResult(MAKE_D3DHRESULT_R or 2150); + {$EXTERNALSYM D3DERR_NOTFOUND} + D3DERR_MOREDATA = HResult(MAKE_D3DHRESULT_R or 2151); + {$EXTERNALSYM D3DERR_MOREDATA} + D3DERR_DEVICELOST = HResult(MAKE_D3DHRESULT_R or 2152); + {$EXTERNALSYM D3DERR_DEVICELOST} + D3DERR_DEVICENOTRESET = HResult(MAKE_D3DHRESULT_R or 2153); + {$EXTERNALSYM D3DERR_DEVICENOTRESET} + D3DERR_NOTAVAILABLE = HResult(MAKE_D3DHRESULT_R or 2154); + {$EXTERNALSYM D3DERR_NOTAVAILABLE} + D3DERR_OUTOFVIDEOMEMORY = HResult(MAKE_D3DHRESULT_R or 380); + {$EXTERNALSYM D3DERR_OUTOFVIDEOMEMORY} + D3DERR_INVALIDDEVICE = HResult(MAKE_D3DHRESULT_R or 2155); + {$EXTERNALSYM D3DERR_INVALIDDEVICE} + D3DERR_INVALIDCALL = HResult(MAKE_D3DHRESULT_R or 2156); + {$EXTERNALSYM D3DERR_INVALIDCALL} + D3DERR_DRIVERINVALIDCALL = HResult(MAKE_D3DHRESULT_R or 2157); + {$EXTERNALSYM D3DERR_DRIVERINVALIDCALL} + D3DERR_WASSTILLDRAWING = HResult(MAKE_D3DHRESULT_R or 540); + {$EXTERNALSYM D3DERR_WASSTILLDRAWING} + D3DOK_NOAUTOGEN = HResult(MAKE_D3DSTATUS_R or 2159); + {$EXTERNALSYM D3DOK_NOAUTOGEN} + + + +(* + * 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; + +// 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; +{$EXTERNALSYM Direct3DCreate9} + + +//******************************************************************** +// 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; external Direct3D9dll name 'Direct3DCreate9'; +{$ENDIF} + +function Direct3DCreate9(SDKVersion: LongWord): IDirect3D9; +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/Game/Code/lib/DSPack/DirectX9/DirectDraw.pas b/Game/Code/lib/DSPack/DirectX9/DirectDraw.pas new file mode 100644 index 00000000..df6bdcba --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DirectDraw.pas @@ -0,0 +1,7162 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: ddraw.h dvp.h *} +{* Content: DirectDraw and DirectDrawVideoPort include files *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 26-Jan-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://clootie.narod.ru/delphi/ *} +{* *} +{******************************************************************************} +{ } +{ 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} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0100'} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_3} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0300'} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_5} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0500'} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_6} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0600'} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_7} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0700'} +{$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} + +(*$HPPEMIT '#include "ddraw.h"' *) +(*$HPPEMIT '#include "dvp.h"' *) + +uses + Windows; + + +(*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: ddraw.h + * Content: DirectDraw include file + * + ***************************************************************************) + +function MAKEFOURCC(ch0, ch1, ch2, ch3: Char): DWORD; +{$EXTERNALSYM MAKEFOURCC} + +(* + * 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)); + {$EXTERNALSYM FOURCC_DXT1} + //#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)); + {$EXTERNALSYM FOURCC_DXT2} + //#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)); + {$EXTERNALSYM FOURCC_DXT3} + //#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)); + {$EXTERNALSYM FOURCC_DXT4} + //#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)); + {$EXTERNALSYM FOURCC_DXT5} + +(* + * GUIDS used by DirectDraw objects + *) +const + CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}'; + {$EXTERNALSYM CLSID_DirectDraw} + CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}'; + {$EXTERNALSYM CLSID_DirectDraw7} + CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}'; + {$EXTERNALSYM CLSID_DirectDrawClipper} + (* 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 + {$EXTERNALSYM DD_ROP_SPACE} + + MAX_DDDEVICEID_STRING = 512; + {$EXTERNALSYM MAX_DDDEVICEID_STRING} + + +(*============================================================================ + * + * 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; + {$EXTERNALSYM REFGUID} + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDraw);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDraw2);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDraw4);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDraw7);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawSurface);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawSurface2);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawSurface3);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawSurface4);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawSurface7);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawPalette);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawClipper);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawColorControl);'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawGammaControl);'} + + IDirectDraw = interface; + {$EXTERNALSYM IDirectDraw} + IDirectDraw2 = interface; + {$EXTERNALSYM IDirectDraw2} + IDirectDraw4 = interface; + {$EXTERNALSYM IDirectDraw4} + IDirectDraw7 = interface; + {$EXTERNALSYM IDirectDraw7} + IDirectDrawSurface = interface; + {$EXTERNALSYM IDirectDrawSurface} + IDirectDrawSurface2 = interface; + {$EXTERNALSYM IDirectDrawSurface2} + IDirectDrawSurface3 = interface; + {$EXTERNALSYM IDirectDrawSurface3} + IDirectDrawSurface4 = interface; + {$EXTERNALSYM IDirectDrawSurface4} + IDirectDrawSurface7 = interface; + {$EXTERNALSYM IDirectDrawSurface7} + + IDirectDrawPalette = interface; + {$EXTERNALSYM IDirectDrawPalette} + IDirectDrawClipper = interface; + {$EXTERNALSYM IDirectDrawClipper} + IDirectDrawColorControl = interface; + {$EXTERNALSYM IDirectDrawColorControl} + IDirectDrawGammaControl = interface; + {$EXTERNALSYM IDirectDrawGammaControl} + +(* + * Generic pixel format with 8-bit RGB and alpha components + *) + PDDARGB = ^TDDARGB; + _DDARGB = packed record + blue: Byte; + green: Byte; + red: Byte; + alpha: Byte; + end; + {$EXTERNALSYM _DDARGB} + DDARGB = _DDARGB; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDRGBA} + DDRGBA = _DDRGBA; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDCOLORKEY} + DDCOLORKEY = _DDCOLORKEY; + {$EXTERNALSYM 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): + +{$IFDEF COMPILER5_UP} + PDirectDrawSurface = Pointer; +{$ELSE} + PDirectDrawSurface = IDirectDrawSurface; +{$ENDIF} + +(* + * 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; + {$EXTERNALSYM _DDBLTFX} + DDBLTFX = _DDBLTFX; + {$EXTERNALSYM DDBLTFX} + TDDBltFX = _DDBLTFX; + +(* + * TDDSCaps + *) + PDDSCaps = ^TDDSCaps; + _DDSCAPS = packed record + dwCaps: DWORD; // capabilities of surface wanted + end; + {$EXTERNALSYM _DDSCAPS} + DDSCAPS = _DDSCAPS; + {$EXTERNALSYM DDSCAPS} + TDDSCaps = _DDSCAPS; + +(* + * TDDOSCaps + *) + PDDOSCaps = ^TDDOSCaps; + _DDOSCAPS = packed record + dwCaps: DWORD; // capabilities of surface wanted + end; + {$EXTERNALSYM _DDOSCAPS} + DDOSCAPS = _DDOSCAPS; + {$EXTERNALSYM DDOSCAPS} + TDDOSCaps = _DDOSCAPS; + +(* + * This structure is used internally by DirectDraw. + *) + PDDSCapsEx = ^TDDSCapsEx; + _DDSCAPSEX = packed record + dwCaps2 : DWORD; + dwCaps3 : DWORD; + dwCaps4 : DWORD; + end; + {$EXTERNALSYM _DDSCAPSEX} + DDSCAPSEX = _DDSCAPSEX; + {$EXTERNALSYM DDSCAPSEX} + TDDSCapsEx = _DDSCAPSEX; + +(* + * TDDSCaps2 + *) + PDDSCaps2 = ^TDDSCaps2; + _DDSCAPS2 = packed record + dwCaps: DWORD; // capabilities of surface wanted + dwCaps2 : DWORD; + dwCaps3 : DWORD; + dwCaps4 : DWORD; + end; + {$EXTERNALSYM _DDSCAPS2} + DDSCAPS2 = _DDSCAPS2; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDCAPS_DX1} + DDCAPS_DX1 = _DDCAPS_DX1; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDCAPS_DX3} + DDCAPS_DX3 = _DDCAPS_DX3; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDCAPS_DX5} + DDCAPS_DX5 = _DDCAPS_DX5; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDCAPS_DX6} + DDCAPS_DX6 = _DDCAPS_DX6; + {$EXTERNALSYM DDCAPS_DX6} + TDDCaps_DX6 = _DDCAPS_DX6; + + _DDCAPS_DX7 = TDDCaps_DX6; + {$EXTERNALSYM _DDCAPS_DX7} + DDCAPS_DX7 = _DDCAPS_DX7; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDPIXELFORMAT} + DDPIXELFORMAT = _DDPIXELFORMAT; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDOVERLAYFX} + DDOVERLAYFX = _DDOVERLAYFX; + {$EXTERNALSYM DDOVERLAYFX} + TDDOverlayFX = _DDOVERLAYFX; + +(* + * TDDBltBatch: BltBatch entry structure + *) + PDDBltBatch = ^TDDBltBatch; + _DDBLTBATCH = packed record + lprDest: PRect; + lpDDSSrc: IDirectDrawSurface; + lprSrc: PRect; + dwFlags: DWORD; + lpDDBltFx: TDDBltFX; + end; + {$EXTERNALSYM _DDBLTBATCH} + DDBLTBATCH = _DDBLTBATCH; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDGAMMARAMP} + DDGAMMARAMP = _DDGAMMARAMP; + {$EXTERNALSYM 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; + {$EXTERNALSYM tagDDDEVICEIDENTIFIER} + DDDEVICEIDENTIFIER = tagDDDEVICEIDENTIFIER; + {$EXTERNALSYM DDDEVICEIDENTIFIER} + 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; + {$EXTERNALSYM tagDDDEVICEIDENTIFIER2} + DDDEVICEIDENTIFIER2 = tagDDDEVICEIDENTIFIER2; + {$EXTERNALSYM DDDEVICEIDENTIFIER2} + TDDDeviceIdentifier2 = tagDDDEVICEIDENTIFIER2; + +(* + * callbacks + *) + TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND; + Code: DWORD; lpContext: Pointer): HResult; stdcall; + {$NODEFINE TClipperCallback} + {$HPPEMIT 'typedef LPCLIPPERCALLBACK TClipperCallback;'} + TSurfacesStreamingCallback = function(arg: DWORD): HResult; stdcall; + {$NODEFINE TSurfacesStreamingCallback} + +(* + * 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; + {$EXTERNALSYM _DDSURFACEDESC} + DDSURFACEDESC = _DDSURFACEDESC; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDSURFACEDESC2} + DDSURFACEDESC2 = _DDSURFACEDESC2; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDOPTSURFACEDESC} + DDOPTSURFACEDESC = _DDOPTSURFACEDESC; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDCOLORCONTROL} + DDCOLORCONTROL = _DDCOLORCONTROL; + {$EXTERNALSYM DDCOLORCONTROL} + TDDColorControl = _DDCOLORCONTROL; + +(* + * callbacks + *) + +//{$IFNDEF WINNT} + TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc; + lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumModesCallback} + {$HPPEMIT 'typedef LPCLIPPERCALLBACK TDDEnumModesCallback;'} + TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2; + lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumModesCallback2} + {$HPPEMIT 'typedef LPDDENUMMODESCALLBACK2 TDDEnumModesCallback2;'} + TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface; + const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumSurfacesCallback} + {$HPPEMIT 'typedef LPDDENUMSURFACESCALLBACK TDDEnumSurfacesCallback;'} + TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4; + const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumSurfacesCallback2} + {$HPPEMIT 'typedef LPDDENUMSURFACESCALLBACK2 TDDEnumSurfacesCallback2;'} + TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7; + const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumSurfacesCallback7} + {$HPPEMIT 'typedef LPDDENUMSURFACESCALLBACK7 TDDEnumSurfacesCallback7;'} +//{$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; + {$EXTERNALSYM IID_IDirectDraw} + IID_IDirectDraw2 = IDirectDraw2; + {$EXTERNALSYM IID_IDirectDraw2} + IID_IDirectDraw4 = IDirectDraw4; + {$EXTERNALSYM IID_IDirectDraw4} + IID_IDirectDraw7 = IDirectDraw7; + {$EXTERNALSYM IID_IDirectDraw7} + IID_IDirectDrawSurface = IDirectDrawSurface; + {$EXTERNALSYM IID_IDirectDrawSurface} + IID_IDirectDrawSurface2 = IDirectDrawSurface2; + {$EXTERNALSYM IID_IDirectDrawSurface2} + IID_IDirectDrawSurface3 = IDirectDrawSurface3; + {$EXTERNALSYM IID_IDirectDrawSurface3} + IID_IDirectDrawSurface4 = IDirectDrawSurface4; + {$EXTERNALSYM IID_IDirectDrawSurface4} + IID_IDirectDrawSurface7 = IDirectDrawSurface7; + {$EXTERNALSYM IID_IDirectDrawSurface7} + + IID_IDirectDrawPalette = IDirectDrawPalette; + {$EXTERNALSYM IID_IDirectDrawPalette} + IID_IDirectDrawClipper = IDirectDrawClipper; + {$EXTERNALSYM IID_IDirectDrawClipper} + IID_IDirectDrawColorControl = IDirectDrawColorControl; + {$EXTERNALSYM IID_IDirectDrawColorControl} + IID_IDirectDrawGammaControl = IDirectDrawGammaControl; + {$EXTERNALSYM IID_IDirectDrawGammaControl} + +const +(* + * ddsCaps field is valid. + *) + DDSD_CAPS = $00000001; // default + {$EXTERNALSYM DDSD_CAPS} + +(* + * dwHeight field is valid. + *) + DDSD_HEIGHT = $00000002; + {$EXTERNALSYM DDSD_HEIGHT} + +(* + * dwWidth field is valid. + *) + DDSD_WIDTH = $00000004; + {$EXTERNALSYM DDSD_WIDTH} + +(* + * lPitch is valid. + *) + DDSD_PITCH = $00000008; + {$EXTERNALSYM DDSD_PITCH} + +(* + * dwBackBufferCount is valid. + *) + DDSD_BACKBUFFERCOUNT = $00000020; + {$EXTERNALSYM DDSD_BACKBUFFERCOUNT} + +(* + * dwZBufferBitDepth is valid. (shouldnt be used in DDSURFACEDESC2) + *) + DDSD_ZBUFFERBITDEPTH = $00000040; + {$EXTERNALSYM DDSD_ZBUFFERBITDEPTH} + +(* + * dwAlphaBitDepth is valid. + *) + DDSD_ALPHABITDEPTH = $00000080; + {$EXTERNALSYM DDSD_ALPHABITDEPTH} + +(* + * lpSurface is valid. + *) + DDSD_LPSURFACE = $00000800; + {$EXTERNALSYM DDSD_LPSURFACE} + +(* + * ddpfPixelFormat is valid. + *) + DDSD_PIXELFORMAT = $00001000; + {$EXTERNALSYM DDSD_PIXELFORMAT} + +(* + * ddckCKDestOverlay is valid. + *) + DDSD_CKDESTOVERLAY = $00002000; + {$EXTERNALSYM DDSD_CKDESTOVERLAY} + +(* + * ddckCKDestBlt is valid. + *) + DDSD_CKDESTBLT = $00004000; + {$EXTERNALSYM DDSD_CKDESTBLT} + +(* + * ddckCKSrcOverlay is valid. + *) + DDSD_CKSRCOVERLAY = $00008000; + {$EXTERNALSYM DDSD_CKSRCOVERLAY} + +(* + * ddckCKSrcBlt is valid. + *) + DDSD_CKSRCBLT = $00010000; + {$EXTERNALSYM DDSD_CKSRCBLT} + +(* + * dwMipMapCount is valid. + *) + DDSD_MIPMAPCOUNT = $00020000; + {$EXTERNALSYM DDSD_MIPMAPCOUNT} + + (* + * dwRefreshRate is valid + *) + DDSD_REFRESHRATE = $00040000; + {$EXTERNALSYM DDSD_REFRESHRATE} + +(* + * dwLinearSize is valid + *) + DDSD_LINEARSIZE = $00080000; + {$EXTERNALSYM DDSD_LINEARSIZE} + +(* + * dwTextureStage is valid + *) + DDSD_TEXTURESTAGE = $00100000; + {$EXTERNALSYM DDSD_TEXTURESTAGE} + +(* + * dwFVF is valid + *) + DDSD_FVF = $00200000; + {$EXTERNALSYM DDSD_FVF} + +(* + * dwSrcVBHandle is valid + *) + DDSD_SRCVBHANDLE = $00400000; + {$EXTERNALSYM DDSD_SRCVBHANDLE} + +(* + * dwDepth is valid + *) + DDSD_DEPTH = $00800000; + {$EXTERNALSYM DDSD_DEPTH} + +(* + * All input fields are valid. + *) + DDSD_ALL = $00fff9ee; + {$EXTERNALSYM DDSD_ALL} + + +(* + * guid field is valid. + *) + DDOSD_GUID = $00000001; + {$EXTERNALSYM DDOSD_GUID} + +(* + * dwCompressionRatio field is valid. + *) + DDOSD_COMPRESSION_RATIO = $00000002; + {$EXTERNALSYM DDOSD_COMPRESSION_RATIO} + +(* + * ddSCaps field is valid. + *) + DDOSD_SCAPS = $00000004; + {$EXTERNALSYM DDOSD_SCAPS} + +(* + * ddOSCaps field is valid. + *) + DDOSD_OSCAPS = $00000008; + {$EXTERNALSYM DDOSD_OSCAPS} + +(* + * All input fields are valid. + *) + DDOSD_ALL = $0000000f; + {$EXTERNALSYM DDOSD_ALL} + +(* + * The surface's optimized pixelformat is compressed + *) + DDOSDCAPS_OPTCOMPRESSED = $00000001; + {$EXTERNALSYM DDOSDCAPS_OPTCOMPRESSED} + +(* + * The surface's optimized pixelformat is reordered + *) + DDOSDCAPS_OPTREORDERED = $00000002; + {$EXTERNALSYM DDOSDCAPS_OPTREORDERED} + +(* + * The opt surface is a monolithic mipmap + *) + DDOSDCAPS_MONOLITHICMIPMAP = $00000004; + {$EXTERNALSYM DDOSDCAPS_MONOLITHICMIPMAP} + +(* + * The valid Surf caps: + * DDSCAPS_SYSTEMMEMORY = $00000800; + * DDSCAPS_VIDEOMEMORY = $00004000; + * DDSCAPS_LOCALVIDMEM = $10000000; + * DDSCAPS_NONLOCALVIDMEM = $20000000; + *) + DDOSDCAPS_VALIDSCAPS = $30004800; + {$EXTERNALSYM DDOSDCAPS_VALIDSCAPS} + +(* + * The valid OptSurf caps + *) + DDOSDCAPS_VALIDOSCAPS = $00000007; + {$EXTERNALSYM DDOSDCAPS_VALIDOSCAPS} + + +(* + * DDCOLORCONTROL + *) + +(* + * lBrightness field is valid. + *) + DDCOLOR_BRIGHTNESS = $00000001; + {$EXTERNALSYM DDCOLOR_BRIGHTNESS} + +(* + * lContrast field is valid. + *) + DDCOLOR_CONTRAST = $00000002; + {$EXTERNALSYM DDCOLOR_CONTRAST} + +(* + * lHue field is valid. + *) + DDCOLOR_HUE = $00000004; + {$EXTERNALSYM DDCOLOR_HUE} + +(* + * lSaturation field is valid. + *) + DDCOLOR_SATURATION = $00000008; + {$EXTERNALSYM DDCOLOR_SATURATION} + +(* + * lSharpness field is valid. + *) + DDCOLOR_SHARPNESS = $00000010; + {$EXTERNALSYM DDCOLOR_SHARPNESS} + +(* + * lGamma field is valid. + *) + DDCOLOR_GAMMA = $00000020; + {$EXTERNALSYM DDCOLOR_GAMMA} + +(* + * lColorEnable field is valid. + *) + DDCOLOR_COLORENABLE = $00000040; + {$EXTERNALSYM DDCOLOR_COLORENABLE} + + + +(*============================================================================ + * + * 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; + {$EXTERNALSYM DDSCAPS_RESERVED1} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_ALPHA} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_BACKBUFFER} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_COMPLEX} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_FLIP} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_FRONTBUFFER} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_OFFSCREENPLAIN} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_OVERLAY} + +(* + * Indicates that unique DirectDrawPalette objects can be created and + * attached to this surface. + *) + DDSCAPS_PALETTE = $00000100; + {$EXTERNALSYM DDSCAPS_PALETTE} + +(* + * Indicates that this surface is the primary surface. The primary + * surface represents what the user is seeing at the moment. + *) + DDSCAPS_PRIMARYSURFACE = $00000200; + {$EXTERNALSYM DDSCAPS_PRIMARYSURFACE} + +(* + * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now + * obsolete. + *) + DDSCAPS_RESERVED3 = $00000400; + {$EXTERNALSYM DDSCAPS_RESERVED3} + DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3; + {$EXTERNALSYM DDSCAPS_PRIMARYSURFACELEFT} + +(* + * Indicates that this surface memory was allocated in system memory + *) + DDSCAPS_SYSTEMMEMORY = $00000800; + {$EXTERNALSYM DDSCAPS_SYSTEMMEMORY} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_TEXTURE} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_3DDEVICE} + +(* + * Indicates that this surface exists in video memory. + *) + DDSCAPS_VIDEOMEMORY = $00004000; + {$EXTERNALSYM DDSCAPS_VIDEOMEMORY} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_VISIBLE} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_WRITEONLY} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_ZBUFFER} + +(* + * Indicates surface will have a DC associated long term + *) + DDSCAPS_OWNDC = $00040000; + {$EXTERNALSYM DDSCAPS_OWNDC} + +(* + * Indicates surface should be able to receive live video + *) + DDSCAPS_LIVEVIDEO = $00080000; + {$EXTERNALSYM DDSCAPS_LIVEVIDEO} + +(* + * Indicates surface should be able to have a stream decompressed + * to it by the hardware. + *) + DDSCAPS_HWCODEC = $00100000; + {$EXTERNALSYM DDSCAPS_HWCODEC} + +(* + * Surface is a ModeX surface. + * + *) + DDSCAPS_MODEX = $00200000; + {$EXTERNALSYM DDSCAPS_MODEX} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_MIPMAP} + +(* + * This bit is reserved. It should not be specified. + *) + DDSCAPS_RESERVED2 = $00800000; + {$EXTERNALSYM DDSCAPS_RESERVED2} + +(* + * Indicates that memory for the surface is not allocated until the surface + * is loaded (via the Direct3D texture Load() function). + *) + DDSCAPS_ALLOCONLOAD = $04000000; + {$EXTERNALSYM DDSCAPS_ALLOCONLOAD} + +(* + * Indicates that the surface will recieve data from a video port. + *) + DDSCAPS_VIDEOPORT = $08000000; + {$EXTERNALSYM DDSCAPS_VIDEOPORT} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_LOCALVIDMEM} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_NONLOCALVIDMEM} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_STANDARDVGAMODE} + +(* + * 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; + {$EXTERNALSYM DDSCAPS_OPTIMIZED} + + + +(* + * This bit is reserved + *) + DDSCAPS2_RESERVED4 = $00000002; + {$EXTERNALSYM DDSCAPS2_RESERVED4} + DDSCAPS2_HARDWAREDEINTERLACE = $00000000; + {$EXTERNALSYM DDSCAPS2_HARDWAREDEINTERLACE} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_HINTDYNAMIC} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_HINTSTATIC} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_TEXTUREMANAGE} + +(* + * These bits are reserved for internal use *) + DDSCAPS2_RESERVED1 = $00000020; + {$EXTERNALSYM DDSCAPS2_RESERVED1} + DDSCAPS2_RESERVED2 = $00000040; + {$EXTERNALSYM DDSCAPS2_RESERVED2} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_OPAQUE} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_HINTANTIALIASING} + +(* + * This flag is used at CreateSurface time to indicate that this set of + * surfaces is a cubic environment map + *) + DDSCAPS2_CUBEMAP = $00000200; + {$EXTERNALSYM DDSCAPS2_CUBEMAP} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_POSITIVEX} + DDSCAPS2_CUBEMAP_NEGATIVEX = $00000800; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_NEGATIVEX} + DDSCAPS2_CUBEMAP_POSITIVEY = $00001000; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_POSITIVEY} + DDSCAPS2_CUBEMAP_NEGATIVEY = $00002000; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_NEGATIVEY} + DDSCAPS2_CUBEMAP_POSITIVEZ = $00004000; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_POSITIVEZ} + DDSCAPS2_CUBEMAP_NEGATIVEZ = $00008000; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_NEGATIVEZ} + +(* + * 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 ); + {$EXTERNALSYM DDSCAPS2_CUBEMAP_ALLFACES} + + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_MIPMAPSUBLEVEL} + +(* This flag indicates that the texture should be managed by D3D only *) + DDSCAPS2_D3DTEXTUREMANAGE = $00020000; + {$EXTERNALSYM DDSCAPS2_D3DTEXTUREMANAGE} + +(* This flag indicates that the managed surface can be safely lost *) + DDSCAPS2_DONOTPERSIST = $00040000; + {$EXTERNALSYM DDSCAPS2_DONOTPERSIST} + +(* indicates that this surface is part of a stereo flipping chain *) + DDSCAPS2_STEREOSURFACELEFT = $00080000; + {$EXTERNALSYM DDSCAPS2_STEREOSURFACELEFT} + + +(* + * Indicates that the surface is a volume. + * Can be combined with DDSCAPS_MIPMAP to indicate a multi-level volume + *) + DDSCAPS2_VOLUME = $00200000; + {$EXTERNALSYM DDSCAPS2_VOLUME} + +(* + * Indicates that the surface may be locked multiple times by the application. + * This cap cannot be used with DDSCAPS2_OPAQUE. + *) + DDSCAPS2_NOTUSERLOCKABLE = $00400000; + {$EXTERNALSYM DDSCAPS2_NOTUSERLOCKABLE} + +(* + * Indicates that the vertex buffer data can be used to render points and + * point sprites. + *) + DDSCAPS2_POINTS = $00800000; + {$EXTERNALSYM DDSCAPS2_POINTS} + +(* + * Indicates that the vertex buffer data can be used to render rt pactches. + *) + DDSCAPS2_RTPATCHES = $01000000; + {$EXTERNALSYM DDSCAPS2_RTPATCHES} + +(* + * Indicates that the vertex buffer data can be used to render n patches. + *) + DDSCAPS2_NPATCHES = $02000000; + {$EXTERNALSYM DDSCAPS2_NPATCHES} + +(* + * This bit is reserved for internal use + *) + DDSCAPS2_RESERVED3 = $04000000; + {$EXTERNALSYM DDSCAPS2_RESERVED3} + + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_DISCARDBACKBUFFER} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_ENABLEALPHACHANNEL} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_EXTENDEDFORMATPRIMARY} + +(* + * 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; + {$EXTERNALSYM DDSCAPS2_ADDITIONALPRIMARY} + +(* + * 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; + {$EXTERNALSYM DDSCAPS3_MULTISAMPLE_MASK} + +(* + * 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; + {$EXTERNALSYM DDSCAPS3_MULTISAMPLE_QUALITY_MASK} + DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT = 5; + {$EXTERNALSYM DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT} + +(* + * This bit is reserved for internal use + *) + DDSCAPS3_RESERVED1 = $00000100; + {$EXTERNALSYM DDSCAPS3_RESERVED1} + +(* + * This bit is reserved for internal use + *) + DDSCAPS3_RESERVED2 = $00000200; + {$EXTERNALSYM DDSCAPS3_RESERVED2} + +(* + * This indicates whether this surface has light-weight miplevels + *) + DDSCAPS3_LIGHTWEIGHTMIPMAP = $00000400; + {$EXTERNALSYM DDSCAPS3_LIGHTWEIGHTMIPMAP} + +(* + * This indicates that the mipsublevels for this surface are auto-generated + *) + DDSCAPS3_AUTOGENMIPMAP = $00000800; + {$EXTERNALSYM DDSCAPS3_AUTOGENMIPMAP} + +(* + * This indicates that the mipsublevels for this surface are auto-generated + *) + DDSCAPS3_DMAP = $00001000; + {$EXTERNALSYM DDSCAPS3_DMAP} + + + (**************************************************************************** + * + * DIRECTDRAW DRIVER CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Display hardware has 3D acceleration. + *) + DDCAPS_3D = $00000001; + {$EXTERNALSYM DDCAPS_3D} + +(* + * Indicates that DirectDraw will support only dest rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively. + * READ ONLY. + *) + DDCAPS_ALIGNBOUNDARYDEST = $00000002; + {$EXTERNALSYM DDCAPS_ALIGNBOUNDARYDEST} + +(* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively. READ ONLY. + *) + DDCAPS_ALIGNSIZEDEST = $00000004; + {$EXTERNALSYM DDCAPS_ALIGNSIZEDEST} +(* + * Indicates that DirectDraw will support only source rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively. + * READ ONLY. + *) + DDCAPS_ALIGNBOUNDARYSRC = $00000008; + {$EXTERNALSYM DDCAPS_ALIGNBOUNDARYSRC} + +(* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively. READ ONLY. + *) + DDCAPS_ALIGNSIZESRC = $00000010; + {$EXTERNALSYM DDCAPS_ALIGNSIZESRC} + +(* + * Indicates that DirectDraw will create video memory surfaces that have a stride + * alignment equal to DIRECTDRAWCAPS.dwAlignStride. READ ONLY. + *) + DDCAPS_ALIGNSTRIDE = $00000020; + {$EXTERNALSYM DDCAPS_ALIGNSTRIDE} + +(* + * Display hardware is capable of blt operations. + *) + DDCAPS_BLT = $00000040; + {$EXTERNALSYM DDCAPS_BLT} + +(* + * Display hardware is capable of asynchronous blt operations. + *) + DDCAPS_BLTQUEUE = $00000080; + {$EXTERNALSYM DDCAPS_BLTQUEUE} + +(* + * Display hardware is capable of color space conversions during the blt operation. + *) + DDCAPS_BLTFOURCC = $00000100; + {$EXTERNALSYM DDCAPS_BLTFOURCC} + +(* + * Display hardware is capable of stretching during blt operations. + *) + DDCAPS_BLTSTRETCH = $00000200; + {$EXTERNALSYM DDCAPS_BLTSTRETCH} + +(* + * Display hardware is shared with GDI. + *) + DDCAPS_GDI = $00000400; + {$EXTERNALSYM DDCAPS_GDI} + +(* + * Display hardware can overlay. + *) + DDCAPS_OVERLAY = $00000800; + {$EXTERNALSYM DDCAPS_OVERLAY} + +(* + * Set if display hardware supports overlays but can not clip them. + *) + DDCAPS_OVERLAYCANTCLIP = $00001000; + {$EXTERNALSYM DDCAPS_OVERLAYCANTCLIP} + +(* + * Indicates that overlay hardware is capable of color space conversions during + * the overlay operation. + *) + DDCAPS_OVERLAYFOURCC = $00002000; + {$EXTERNALSYM DDCAPS_OVERLAYFOURCC} + +(* + * Indicates that stretching can be done by the overlay hardware. + *) + DDCAPS_OVERLAYSTRETCH = $00004000; + {$EXTERNALSYM DDCAPS_OVERLAYSTRETCH} + +(* + * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces + * other than the primary surface. + *) + DDCAPS_PALETTE = $00008000; + {$EXTERNALSYM DDCAPS_PALETTE} + +(* + * Indicates that palette changes can be syncd with the veritcal refresh. + *) + DDCAPS_PALETTEVSYNC = $00010000; + {$EXTERNALSYM DDCAPS_PALETTEVSYNC} + +(* + * Display hardware can return the current scan line. + *) + DDCAPS_READSCANLINE = $00020000; + {$EXTERNALSYM DDCAPS_READSCANLINE} + +(* + * This flag used to bo DDCAPS_STEREOVIEW, which is now obsolete + *) + DDCAPS_RESERVED1 = $00040000; + {$EXTERNALSYM DDCAPS_RESERVED1} + +(* + * Display hardware is capable of generating a vertical blank interrupt. + *) + DDCAPS_VBI = $00080000; + {$EXTERNALSYM DDCAPS_VBI} + +(* + * Supports the use of z buffers with blt operations. + *) + DDCAPS_ZBLTS = $00100000; + {$EXTERNALSYM DDCAPS_ZBLTS} + +(* + * Supports Z Ordering of overlays. + *) + DDCAPS_ZOVERLAYS = $00200000; + {$EXTERNALSYM DDCAPS_ZOVERLAYS} + +(* + * Supports color key + *) + DDCAPS_COLORKEY = $00400000; + {$EXTERNALSYM DDCAPS_COLORKEY} + +(* + * Supports alpha surfaces + *) + DDCAPS_ALPHA = $00800000; + {$EXTERNALSYM DDCAPS_ALPHA} + +(* + * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set) + *) + DDCAPS_COLORKEYHWASSIST = $01000000; + {$EXTERNALSYM DDCAPS_COLORKEYHWASSIST} + +(* + * no hardware support at all + *) + DDCAPS_NOHARDWARE = $02000000; + {$EXTERNALSYM DDCAPS_NOHARDWARE} + +(* + * Display hardware is capable of color fill with bltter + *) + DDCAPS_BLTCOLORFILL = $04000000; + {$EXTERNALSYM DDCAPS_BLTCOLORFILL} + +(* + * Display hardware is bank switched, and potentially very slow at + * random access to VRAM. + *) + DDCAPS_BANKSWITCHED = $08000000; + {$EXTERNALSYM DDCAPS_BANKSWITCHED} + +(* + * Display hardware is capable of depth filling Z-buffers with bltter + *) + DDCAPS_BLTDEPTHFILL = $10000000; + {$EXTERNALSYM DDCAPS_BLTDEPTHFILL} + +(* + * Display hardware is capable of clipping while bltting. + *) + DDCAPS_CANCLIP = $20000000; + {$EXTERNALSYM DDCAPS_CANCLIP} + +(* + * Display hardware is capable of clipping while stretch bltting. + *) + DDCAPS_CANCLIPSTRETCHED = $40000000; + {$EXTERNALSYM DDCAPS_CANCLIPSTRETCHED} + +(* + * Display hardware is capable of bltting to or from system memory + *) + DDCAPS_CANBLTSYSMEM = $80000000; + {$EXTERNALSYM DDCAPS_CANBLTSYSMEM} + + + (**************************************************************************** + * + * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2) + * + ****************************************************************************) + +(* + * Display hardware is certified + *) + DDCAPS2_CERTIFIED = $00000001; + {$EXTERNALSYM DDCAPS2_CERTIFIED} + +(* + * Driver cannot interleave 2D operations (lock and blt) to surfaces with + * Direct3D rendering operations between calls to BeginScene() and EndScene() + *) + DDCAPS2_NO2DDURING3DSCENE = $00000002; + {$EXTERNALSYM DDCAPS2_NO2DDURING3DSCENE} + +(* + * Display hardware contains a video port + *) + DDCAPS2_VIDEOPORT = $00000004; + {$EXTERNALSYM DDCAPS2_VIDEOPORT} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_AUTOFLIPOVERLAY} + +(* + * Overlay can display each field of interlaced data individually while + * it is interleaved in memory without causing jittery artifacts. + *) + DDCAPS2_CANBOBINTERLEAVED = $00000010; + {$EXTERNALSYM DDCAPS2_CANBOBINTERLEAVED} + +(* + * Overlay can display each field of interlaced data individually while + * it is not interleaved in memory without causing jittery artifacts. + *) + DDCAPS2_CANBOBNONINTERLEAVED = $00000020; + {$EXTERNALSYM DDCAPS2_CANBOBNONINTERLEAVED} + +(* + * The overlay surface contains color controls (brightness, sharpness, etc.) + *) + DDCAPS2_COLORCONTROLOVERLAY = $00000040; + {$EXTERNALSYM DDCAPS2_COLORCONTROLOVERLAY} + +(* + * The primary surface contains color controls (gamma, etc.) + *) + DDCAPS2_COLORCONTROLPRIMARY = $00000080; + {$EXTERNALSYM DDCAPS2_COLORCONTROLPRIMARY} + +(* + * RGBZ -> RGB supported for 16:16 RGB:Z + *) + DDCAPS2_CANDROPZ16BIT = $00000100; + {$EXTERNALSYM DDCAPS2_CANDROPZ16BIT} + +(* + * Driver supports non-local video memory. + *) + DDCAPS2_NONLOCALVIDMEM = $00000200; + {$EXTERNALSYM DDCAPS2_NONLOCALVIDMEM} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_NONLOCALVIDMEMCAPS} + +(* + * Driver neither requires nor prefers surfaces to be pagelocked when performing + * blts involving system memory surfaces + *) + DDCAPS2_NOPAGELOCKREQUIRED = $00000800; + {$EXTERNALSYM DDCAPS2_NOPAGELOCKREQUIRED} + +(* + * Driver can create surfaces which are wider than the primary surface + *) + DDCAPS2_WIDESURFACES = $00001000; + {$EXTERNALSYM DDCAPS2_WIDESURFACES} + +(* + * Driver supports bob without using a video port by handling the + * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip. + *) + DDCAPS2_CANFLIPODDEVEN = $00002000; + {$EXTERNALSYM DDCAPS2_CANFLIPODDEVEN} + +(* + * Driver supports bob using hardware + *) + DDCAPS2_CANBOBHARDWARE = $00004000; + {$EXTERNALSYM DDCAPS2_CANBOBHARDWARE} + +(* + * Driver supports bltting any FOURCC surface to another surface of the same FOURCC + *) + DDCAPS2_COPYFOURCC = $00008000; + {$EXTERNALSYM DDCAPS2_COPYFOURCC} + + +(* + * Driver supports loadable gamma ramps for the primary surface + *) + DDCAPS2_PRIMARYGAMMA = $00020000; + {$EXTERNALSYM DDCAPS2_PRIMARYGAMMA} + +(* + * Driver can render in windowed mode. + *) + DDCAPS2_CANRENDERWINDOWED = $00080000; + {$EXTERNALSYM DDCAPS2_CANRENDERWINDOWED} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_CANCALIBRATEGAMMA} + +(* + * Indicates that the driver will respond to DDFLIP_INTERVALn flags + *) + DDCAPS2_FLIPINTERVAL = $00200000; + {$EXTERNALSYM DDCAPS2_FLIPINTERVAL} + +(* + * Indicates that the driver will respond to DDFLIP_NOVSYNC + *) + DDCAPS2_FLIPNOVSYNC = $00400000; + {$EXTERNALSYM DDCAPS2_FLIPNOVSYNC} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_CANMANAGETEXTURE} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_TEXMANINNONLOCALVIDMEM} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_STEREO} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL} + +(* + * was DDCAPS2_PUREHAL + *) + DDCAPS2_RESERVED1 = $08000000; + {$EXTERNALSYM DDCAPS2_RESERVED1} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_CANMANAGERESOURCE} + +(* + * 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; + {$EXTERNALSYM DDCAPS2_DYNAMICTEXTURES} + +(* + * Driver supports auto-generation of mipmaps. + *) + DDCAPS2_CANAUTOGENMIPMAP = $40000000; + {$EXTERNALSYM DDCAPS2_CANAUTOGENMIPMAP} + + +(**************************************************************************** + * + * DIRECTDRAW FX ALPHA CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Supports alpha blending around the edge of a source color keyed surface. + * For Blt. + *) + DDFXALPHACAPS_BLTALPHAEDGEBLEND = $00000001; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHAEDGEBLEND} + +(* + * 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; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHAPIXELS} + +(* + * 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; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHAPIXELSNEG} + +(* + * 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; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHASURFACES} + +(* + * 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; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHASURFACESNEG} + +(* + * Supports alpha blending around the edge of a source color keyed surface. + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND = $00000020; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND} + +(* + * 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; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHAPIXELS} + +(* + * 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; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG} + +(* + * 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; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHASURFACES} + +(* + * 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; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHASURFACESNEG} + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDFXCAPS_BLTARITHSTRETCHY} + +(* + * 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; + {$EXTERNALSYM DDFXCAPS_BLTARITHSTRETCHYN} + +(* + * Supports mirroring left to right in blt. + *) + DDFXCAPS_BLTMIRRORLEFTRIGHT = $00000040; + {$EXTERNALSYM DDFXCAPS_BLTMIRRORLEFTRIGHT} + +(* + * Supports mirroring top to bottom in blt. + *) + DDFXCAPS_BLTMIRRORUPDOWN = $00000080; + {$EXTERNALSYM DDFXCAPS_BLTMIRRORUPDOWN} + +(* + * Supports arbitrary rotation for blts. + *) + DDFXCAPS_BLTROTATION = $00000100; + {$EXTERNALSYM DDFXCAPS_BLTROTATION} + +(* + * Supports 90 degree rotations for blts. + *) + DDFXCAPS_BLTROTATION90 = $00000200; + {$EXTERNALSYM DDFXCAPS_BLTROTATION90} + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKX = $00000400; + {$EXTERNALSYM DDFXCAPS_BLTSHRINKX} + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKXN = $00000800; + {$EXTERNALSYM DDFXCAPS_BLTSHRINKXN} + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKY = $00001000; + {$EXTERNALSYM DDFXCAPS_BLTSHRINKY} + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + *) + DDFXCAPS_BLTSHRINKYN = $00002000; + {$EXTERNALSYM DDFXCAPS_BLTSHRINKYN} + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHX = $00004000; + {$EXTERNALSYM DDFXCAPS_BLTSTRETCHX} + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHXN = $00008000; + {$EXTERNALSYM DDFXCAPS_BLTSTRETCHXN} + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHY = $00010000; + {$EXTERNALSYM DDFXCAPS_BLTSTRETCHY} + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + *) + DDFXCAPS_BLTSTRETCHYN = $00020000; + {$EXTERNALSYM DDFXCAPS_BLTSTRETCHYN} + +(* + * Uses arithmetic operations to stretch and shrink surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. + *) + DDFXCAPS_OVERLAYARITHSTRETCHY = $00040000; + {$EXTERNALSYM DDFXCAPS_OVERLAYARITHSTRETCHY} + +(* + * 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; + {$EXTERNALSYM DDFXCAPS_OVERLAYARITHSTRETCHYN} + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKX = $00080000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSHRINKX} + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKXN = $00100000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSHRINKXN} + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKY = $00200000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSHRINKY} + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKYN = $00400000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSHRINKYN} + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHX = $00800000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSTRETCHX} + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHXN = $01000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSTRETCHXN} + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHY = $02000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSTRETCHY} + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHYN = $04000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSTRETCHYN} + +(* + * DirectDraw supports mirroring of overlays across the vertical axis + *) + DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYMIRRORLEFTRIGHT} + +(* + * DirectDraw supports mirroring of overlays across the horizontal axis + *) + DDFXCAPS_OVERLAYMIRRORUPDOWN = $10000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYMIRRORUPDOWN} + +(* + * DirectDraw supports deinterlacing of overlay surfaces + *) + DDFXCAPS_OVERLAYDEINTERLACE = $20000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYDEINTERLACE} + + +(* + * Driver can do alpha blending for blits. + *) + DDFXCAPS_BLTALPHA = $00000001; + {$EXTERNALSYM DDFXCAPS_BLTALPHA} + +(* + * Driver can do geometric transformations (or warps) for blits. + *) + DDFXCAPS_BLTTRANSFORM = $00000002; + {$EXTERNALSYM DDFXCAPS_BLTTRANSFORM} + +(* + * Driver can do surface-reconstruction filtering for warped blits. + *) + DDFXCAPS_BLTFILTER = DDFXCAPS_BLTARITHSTRETCHY; + {$EXTERNALSYM DDFXCAPS_BLTFILTER} + +(* + * Driver can do alpha blending for overlays. + *) + DDFXCAPS_OVERLAYALPHA = $00000004; + {$EXTERNALSYM DDFXCAPS_OVERLAYALPHA} + +(* + * Driver can do geometric transformations (or warps) for overlays. + *) + DDFXCAPS_OVERLAYTRANSFORM = $20000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYTRANSFORM} + +(* + * Driver can do surface-reconstruction filtering for warped overlays. + *) + DDFXCAPS_OVERLAYFILTER = DDFXCAPS_OVERLAYARITHSTRETCHY; + {$EXTERNALSYM DDFXCAPS_OVERLAYFILTER} + +(**************************************************************************** + * + * DIRECTDRAW STEREO VIEW CAPABILITIES + * + ****************************************************************************) + +(* + * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete + *) + DDSVCAPS_RESERVED1 = $00000001; + {$EXTERNALSYM DDSVCAPS_RESERVED1} + +(* + * This flag used to be DDSVCAPS_FLICKER, which is now obsolete + *) + DDSVCAPS_RESERVED2 = $00000002; + {$EXTERNALSYM DDSVCAPS_RESERVED2} + +(* + * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete + *) + DDSVCAPS_RESERVED3 = $00000004; + {$EXTERNALSYM DDSVCAPS_RESERVED3} + +(* + * This flag used to be DDSVCAPS_SPLIT, which is now obsolete + *) + DDSVCAPS_RESERVED4 = $00000008; + {$EXTERNALSYM DDSVCAPS_RESERVED4} + +(* + * The stereo view is accomplished with switching technology + *) + DDSVCAPS_STEREOSEQUENTIAL = $00000010; + {$EXTERNALSYM DDSVCAPS_STEREOSEQUENTIAL} + +(**************************************************************************** + * + * DIRECTDRAWPALETTE CAPABILITIES + * + ****************************************************************************) + +(* + * Index is 4 bits. There are sixteen color entries in the palette table. + *) + DDPCAPS_4BIT = $00000001; + {$EXTERNALSYM DDPCAPS_4BIT} + +(* + * 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; + {$EXTERNALSYM DDPCAPS_8BITENTRIES} + +(* + * Index is 8 bits. There are 256 color entries in the palette table. + *) + DDPCAPS_8BIT = $00000004; + {$EXTERNALSYM DDPCAPS_8BIT} + +(* + * 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; + {$EXTERNALSYM DDPCAPS_INITIALIZE} + +(* + * 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; + {$EXTERNALSYM DDPCAPS_PRIMARYSURFACE} + +(* + * 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; + {$EXTERNALSYM DDPCAPS_PRIMARYSURFACELEFT} + +(* + * This palette can have all 256 entries defined + *) + DDPCAPS_ALLOW256 = $00000040; + {$EXTERNALSYM DDPCAPS_ALLOW256} + +(* + * This palette can have modifications to it synced with the monitors + * refresh rate. + *) + DDPCAPS_VSYNC = $00000080; + {$EXTERNALSYM DDPCAPS_VSYNC} + +(* + * Index is 1 bit. There are two color entries in the palette table. + *) + DDPCAPS_1BIT = $00000100; + {$EXTERNALSYM DDPCAPS_1BIT} + +(* + * Index is 2 bit. There are four color entries in the palette table. + *) + DDPCAPS_2BIT = $00000200; + {$EXTERNALSYM DDPCAPS_2BIT} + +(* + * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value + *) + DDPCAPS_ALPHA = $00000400; + {$EXTERNALSYM DDPCAPS_ALPHA} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDSPD_IUNKNOWNPOINTER} + +(* + * Private data is only valid for the current state of the object, + * as determined by the uniqueness value. + *) + DDSPD_VOLATILE = $00000002; + {$EXTERNALSYM DDSPD_VOLATILE} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDBD_1} + +(* + * 2 bits per pixel. + *) + DDBD_2 = $00002000; + {$EXTERNALSYM DDBD_2} + +(* + * 4 bits per pixel. + *) + DDBD_4 = $00001000; + {$EXTERNALSYM DDBD_4} + +(* + * 8 bits per pixel. + *) + DDBD_8 = $00000800; + {$EXTERNALSYM DDBD_8} + +(* + * 16 bits per pixel. + *) + DDBD_16 = $00000400; + {$EXTERNALSYM DDBD_16} + +(* + * 24 bits per pixel. + *) + DDBD_24 = $00000200; + {$EXTERNALSYM DDBD_24} + +(* + * 32 bits per pixel. + *) + DDBD_32 = $00000100; + {$EXTERNALSYM DDBD_32} + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDCKEY_COLORSPACE} + +(* + * 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; + {$EXTERNALSYM DDCKEY_DESTBLT} + +(* + * 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; + {$EXTERNALSYM DDCKEY_DESTOVERLAY} + +(* + * 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; + {$EXTERNALSYM DDCKEY_SRCBLT} + +(* + * 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; + {$EXTERNALSYM DDCKEY_SRCOVERLAY} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDCKEYCAPS_DESTBLT} + +(* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for RGB colors. + *) + DDCKEYCAPS_DESTBLTCLRSPACE = $00000002; + {$EXTERNALSYM DDCKEYCAPS_DESTBLTCLRSPACE} + +(* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for YUV colors. + *) + DDCKEYCAPS_DESTBLTCLRSPACEYUV = $00000004; + {$EXTERNALSYM DDCKEYCAPS_DESTBLTCLRSPACEYUV} + +(* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for YUV colors. + *) + DDCKEYCAPS_DESTBLTYUV = $00000008; + {$EXTERNALSYM DDCKEYCAPS_DESTBLTYUV} + +(* + * Supports overlaying using colorkeying of the replaceable bits of the surface + * being overlayed for RGB colors. + *) + DDCKEYCAPS_DESTOVERLAY = $00000010; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAY} + +(* + * Supports a color space as the color key for the destination for RGB colors. + *) + DDCKEYCAPS_DESTOVERLAYCLRSPACE = $00000020; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAYCLRSPACE} + +(* + * Supports a color space as the color key for the destination for YUV colors. + *) + DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV = $00000040; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV} + +(* + * Supports only one active destination color key value for visible overlay + * surfaces. + *) + DDCKEYCAPS_DESTOVERLAYONEACTIVE = $00000080; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAYONEACTIVE} + +(* + * Supports overlaying using colorkeying of the replaceable bits of the + * surface being overlayed for YUV colors. + *) + DDCKEYCAPS_DESTOVERLAYYUV = $00000100; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAYYUV} + +(* + * Supports transparent blting using the color key for the source with + * this surface for RGB colors. + *) + DDCKEYCAPS_SRCBLT = $00000200; + {$EXTERNALSYM DDCKEYCAPS_SRCBLT} + +(* + * Supports transparent blting using a color space for the source with + * this surface for RGB colors. + *) + DDCKEYCAPS_SRCBLTCLRSPACE = $00000400; + {$EXTERNALSYM DDCKEYCAPS_SRCBLTCLRSPACE} + +(* + * Supports transparent blting using a color space for the source with + * this surface for YUV colors. + *) + DDCKEYCAPS_SRCBLTCLRSPACEYUV = $00000800; + {$EXTERNALSYM DDCKEYCAPS_SRCBLTCLRSPACEYUV} + +(* + * Supports transparent blting using the color key for the source with + * this surface for YUV colors. + *) + DDCKEYCAPS_SRCBLTYUV = $00001000; + {$EXTERNALSYM DDCKEYCAPS_SRCBLTYUV} + +(* + * Supports overlays using the color key for the source with this + * overlay surface for RGB colors. + *) + DDCKEYCAPS_SRCOVERLAY = $00002000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAY} + +(* + * Supports overlays using a color space as the source color key for + * the overlay surface for RGB colors. + *) + DDCKEYCAPS_SRCOVERLAYCLRSPACE = $00004000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAYCLRSPACE} + +(* + * Supports overlays using a color space as the source color key for + * the overlay surface for YUV colors. + *) + DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV = $00008000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV} + +(* + * Supports only one active source color key value for visible + * overlay surfaces. + *) + DDCKEYCAPS_SRCOVERLAYONEACTIVE = $00010000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAYONEACTIVE} + +(* + * Supports overlays using the color key for the source with this + * overlay surface for YUV colors. + *) + DDCKEYCAPS_SRCOVERLAYYUV = $00020000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAYYUV} + +(* + * there are no bandwidth trade-offs for using colorkey with an overlay + *) + DDCKEYCAPS_NOCOSTOVERLAY = $00040000; + {$EXTERNALSYM DDCKEYCAPS_NOCOSTOVERLAY} + + +(**************************************************************************** + * + * DIRECTDRAW PIXELFORMAT FLAGS + * + ****************************************************************************) + +(* + * The surface has alpha channel information in the pixel format. + *) + DDPF_ALPHAPIXELS = $00000001; + {$EXTERNALSYM DDPF_ALPHAPIXELS} + +(* + * The pixel format contains alpha only information + *) + DDPF_ALPHA = $00000002; + {$EXTERNALSYM DDPF_ALPHA} + +(* + * The FourCC code is valid. + *) + DDPF_FOURCC = $00000004; + {$EXTERNALSYM DDPF_FOURCC} + +(* + * The surface is 4-bit color indexed. + *) + DDPF_PALETTEINDEXED4 = $00000008; + {$EXTERNALSYM DDPF_PALETTEINDEXED4} + +(* + * The surface is indexed into a palette which stores indices + * into the destination surface's 8-bit palette. + *) + DDPF_PALETTEINDEXEDTO8 = $00000010; + {$EXTERNALSYM DDPF_PALETTEINDEXEDTO8} + +(* + * The surface is 8-bit color indexed. + *) + DDPF_PALETTEINDEXED8 = $00000020; + {$EXTERNALSYM DDPF_PALETTEINDEXED8} + +(* + * The RGB data in the pixel format structure is valid. + *) + DDPF_RGB = $00000040; + {$EXTERNALSYM DDPF_RGB} + +(* + * The surface will accept pixel data in the format specified + * and compress it during the write. + *) + DDPF_COMPRESSED = $00000080; + {$EXTERNALSYM DDPF_COMPRESSED} + +(* + * 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; + {$EXTERNALSYM DDPF_RGBTOYUV} + +(* + * pixel format is YUV - YUV data in pixel format struct is valid + *) + DDPF_YUV = $00000200; + {$EXTERNALSYM DDPF_YUV} + +(* + * pixel format is a z buffer only surface + *) + DDPF_ZBUFFER = $00000400; + {$EXTERNALSYM DDPF_ZBUFFER} + +(* + * The surface is 1-bit color indexed. + *) + DDPF_PALETTEINDEXED1 = $00000800; + {$EXTERNALSYM DDPF_PALETTEINDEXED1} + +(* + * The surface is 2-bit color indexed. + *) + DDPF_PALETTEINDEXED2 = $00001000; + {$EXTERNALSYM DDPF_PALETTEINDEXED2} + +(* + * The surface contains Z information in the pixels + *) + DDPF_ZPIXELS = $00002000; + {$EXTERNALSYM DDPF_ZPIXELS} + +(* + * The surface contains stencil information along with Z + *) + DDPF_STENCILBUFFER = $00004000; + {$EXTERNALSYM DDPF_STENCILBUFFER} + +(* + * Premultiplied alpha format -- the color components have been + * premultiplied by the alpha component. + *) + DDPF_ALPHAPREMULT = $00008000; + {$EXTERNALSYM DDPF_ALPHAPREMULT} + + +(* + * 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; + {$EXTERNALSYM DDPF_LUMINANCE} + +(* + * 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; + {$EXTERNALSYM DDPF_BUMPLUMINANCE} + +(* + * Bump map dUdV data in the pixel format is valid. + *) + DDPF_BUMPDUDV = $00080000; + {$EXTERNALSYM DDPF_BUMPDUDV} + + +(*=========================================================================== + * + * + * DIRECTDRAW CALLBACK FLAGS + * + * + *==========================================================================*) + +(**************************************************************************** + * + * DIRECTDRAW ENUMSURFACES FLAGS + * + ****************************************************************************) + +(* + * Enumerate all of the surfaces that meet the search criterion. + *) + DDENUMSURFACES_ALL = $00000001; + {$EXTERNALSYM DDENUMSURFACES_ALL} + {$EXTERNALSYM DDENUMSURFACES_ALL} + +(* + * A search hit is a surface that matches the surface description. + *) + DDENUMSURFACES_MATCH = $00000002; + {$EXTERNALSYM DDENUMSURFACES_MATCH} + +(* + * A search hit is a surface that does not match the surface description. + *) + DDENUMSURFACES_NOMATCH = $00000004; + {$EXTERNALSYM DDENUMSURFACES_NOMATCH} + +(* + * Enumerate the first surface that can be created which meets the search criterion. + *) + DDENUMSURFACES_CANBECREATED = $00000008; + {$EXTERNALSYM DDENUMSURFACES_CANBECREATED} + +(* + * Enumerate the surfaces that already exist that meet the search criterion. + *) + DDENUMSURFACES_DOESEXIST = $00000010; + {$EXTERNALSYM DDENUMSURFACES_DOESEXIST} + + +(**************************************************************************** + * + * DIRECTDRAW SETDISPLAYMODE FLAGS + * + ****************************************************************************) + +(* + * The desired mode is a standard VGA mode + *) + DDSDM_STANDARDVGAMODE = $00000001; + {$EXTERNALSYM DDSDM_STANDARDVGAMODE} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDEDM_REFRESHRATES} + +(* + * 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; + {$EXTERNALSYM DDEDM_STANDARDVGAMODES} + + +(**************************************************************************** + * + * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS + * + ****************************************************************************) + +(* + * Exclusive mode owner will be responsible for the entire primary surface. + * GDI can be ignored. used with DD + *) + DDSCL_FULLSCREEN = $00000001; + {$EXTERNALSYM DDSCL_FULLSCREEN} + +(* + * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode + *) + DDSCL_ALLOWREBOOT = $00000002; + {$EXTERNALSYM DDSCL_ALLOWREBOOT} + +(* + * prevents DDRAW from modifying the application window. + * prevents DDRAW from minimize/restore the application window on activation. + *) + DDSCL_NOWINDOWCHANGES = $00000004; + {$EXTERNALSYM DDSCL_NOWINDOWCHANGES} + +(* + * app wants to work as a regular Windows application + *) + DDSCL_NORMAL = $00000008; + {$EXTERNALSYM DDSCL_NORMAL} + +(* + * app wants exclusive access + *) + DDSCL_EXCLUSIVE = $00000010; + {$EXTERNALSYM DDSCL_EXCLUSIVE} + + +(* + * app can deal with non-windows display modes + *) + DDSCL_ALLOWMODEX = $00000040; + {$EXTERNALSYM DDSCL_ALLOWMODEX} + +(* + * this window will receive the focus messages + *) + DDSCL_SETFOCUSWINDOW = $00000080; + {$EXTERNALSYM DDSCL_SETFOCUSWINDOW} + +(* + * this window is associated with the DDRAW object and will + * cover the screen in fullscreen mode + *) + DDSCL_SETDEVICEWINDOW = $00000100; + {$EXTERNALSYM DDSCL_SETDEVICEWINDOW} + +(* + * app wants DDRAW to create a window to be associated with the + * DDRAW object + *) + DDSCL_CREATEDEVICEWINDOW = $00000200; + {$EXTERNALSYM DDSCL_CREATEDEVICEWINDOW} + +(* + * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D + * take the global crtisec more frequently. + *) + DDSCL_MULTITHREADED = $00000400; + {$EXTERNALSYM DDSCL_MULTITHREADED} + +(* + * 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; + {$EXTERNALSYM DDSCL_FPUSETUP} + +(* + * 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; + {$EXTERNALSYM DDSCL_FPUPRESERVE} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDBLT_ALPHADEST} + +(* + * Use the dwConstAlphaDest field in the DDBLTFX structure as the alpha channel + * for the destination surface for this blt. + *) + DDBLT_ALPHADESTCONSTOVERRIDE = $00000002; + {$EXTERNALSYM DDBLT_ALPHADESTCONSTOVERRIDE} + +(* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. (0 is opaque) + *) + DDBLT_ALPHADESTNEG = $00000004; + {$EXTERNALSYM DDBLT_ALPHADESTNEG} + +(* + * Use the lpDDSAlphaDest field in the DDBLTFX structure as the alpha + * channel for the destination for this blt. + *) + DDBLT_ALPHADESTSURFACEOVERRIDE = $00000008; + {$EXTERNALSYM DDBLT_ALPHADESTSURFACEOVERRIDE} + +(* + * 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; + {$EXTERNALSYM DDBLT_ALPHAEDGEBLEND} + +(* + * 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; + {$EXTERNALSYM DDBLT_ALPHASRC} + +(* + * Use the dwConstAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + *) + DDBLT_ALPHASRCCONSTOVERRIDE = $00000040; + {$EXTERNALSYM DDBLT_ALPHASRCCONSTOVERRIDE} + +(* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. (0 is opaque) + *) + DDBLT_ALPHASRCNEG = $00000080; + {$EXTERNALSYM DDBLT_ALPHASRCNEG} + +(* + * Use the lpDDSAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + *) + DDBLT_ALPHASRCSURFACEOVERRIDE = $00000100; + {$EXTERNALSYM DDBLT_ALPHASRCSURFACEOVERRIDE} + +(* + * 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; + {$EXTERNALSYM DDBLT_ASYNC} + +(* + * 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; + {$EXTERNALSYM DDBLT_COLORFILL} + +(* + * Uses the dwDDFX field in the DDBLTFX structure to specify the effects + * to use for the blt. + *) + DDBLT_DDFX = $00000800; + {$EXTERNALSYM DDBLT_DDFX} + +(* + * Uses the dwDDROPS field in the DDBLTFX structure to specify the ROPS + * that are not part of the Win32 API. + *) + DDBLT_DDROPS = $00001000; + {$EXTERNALSYM DDBLT_DDROPS} + +(* + * Use the color key associated with the destination surface. + *) + DDBLT_KEYDEST = $00002000; + {$EXTERNALSYM DDBLT_KEYDEST} + +(* + * Use the dckDestColorkey field in the DDBLTFX structure as the color key + * for the destination surface. + *) + DDBLT_KEYDESTOVERRIDE = $00004000; + {$EXTERNALSYM DDBLT_KEYDESTOVERRIDE} + +(* + * Use the color key associated with the source surface. + *) + DDBLT_KEYSRC = $00008000; + {$EXTERNALSYM DDBLT_KEYSRC} + +(* + * Use the dckSrcColorkey field in the DDBLTFX structure as the color key + * for the source surface. + *) + DDBLT_KEYSRCOVERRIDE = $00010000; + {$EXTERNALSYM DDBLT_KEYSRCOVERRIDE} + +(* + * 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; + {$EXTERNALSYM DDBLT_ROP} + +(* + * 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; + {$EXTERNALSYM DDBLT_ROTATIONANGLE} + +(* + * 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; + {$EXTERNALSYM DDBLT_ZBUFFER} + +(* + * 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; + {$EXTERNALSYM DDBLT_ZBUFFERDESTCONSTOVERRIDE} + +(* + * 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; + {$EXTERNALSYM DDBLT_ZBUFFERDESTOVERRIDE} + +(* + * 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; + {$EXTERNALSYM DDBLT_ZBUFFERSRCCONSTOVERRIDE} + +(* + * 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; + {$EXTERNALSYM DDBLT_ZBUFFERSRCOVERRIDE} + +(* + * wait until the device is ready to handle the blt + * this will cause blt to not return DDERR_WASSTILLDRAWING + *) + DDBLT_WAIT = $01000000; + {$EXTERNALSYM DDBLT_WAIT} + +(* + * 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; + {$EXTERNALSYM DDBLT_DEPTHFILL} + + +(* + * Return immediately (with DDERR_WASSTILLDRAWING) if the device is not + * ready to schedule the blt at the time Blt() is called. + *) + DDBLT_DONOTWAIT = $08000000; + {$EXTERNALSYM DDBLT_DONOTWAIT} + +(* + * 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; + {$EXTERNALSYM DDBLT_PRESENTATION} + DDBLT_LAST_PRESENTATION = $20000000; + {$EXTERNALSYM DDBLT_LAST_PRESENTATION} + +(* + * 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; + {$EXTERNALSYM DDBLT_EXTENDED_FLAGS} + +(* + * 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; + {$EXTERNALSYM DDBLT_EXTENDED_LINEAR_CONTENT} + + +(**************************************************************************** + * + * BLTFAST FLAGS + * + ****************************************************************************) + + DDBLTFAST_NOCOLORKEY = $00000000; + {$EXTERNALSYM DDBLTFAST_NOCOLORKEY} + DDBLTFAST_SRCCOLORKEY = $00000001; + {$EXTERNALSYM DDBLTFAST_SRCCOLORKEY} + DDBLTFAST_DESTCOLORKEY = $00000002; + {$EXTERNALSYM DDBLTFAST_DESTCOLORKEY} + DDBLTFAST_WAIT = $00000010; + {$EXTERNALSYM DDBLTFAST_WAIT} + DDBLTFAST_DONOTWAIT = $00000020; + {$EXTERNALSYM DDBLTFAST_DONOTWAIT} + +(**************************************************************************** + * + * FLIP FLAGS + * + ****************************************************************************) + + DDFLIP_WAIT = $00000001; + {$EXTERNALSYM DDFLIP_WAIT} + +(* + * Indicates that the target surface contains the even field of video data. + * This flag is only valid with an overlay surface. + *) + DDFLIP_EVEN = $00000002; + {$EXTERNALSYM DDFLIP_EVEN} + +(* + * Indicates that the target surface contains the odd field of video data. + * This flag is only valid with an overlay surface. + *) + DDFLIP_ODD = $00000004; + {$EXTERNALSYM DDFLIP_ODD} + +(* + * 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; + {$EXTERNALSYM DDFLIP_NOVSYNC} + + +(* + * 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; + {$EXTERNALSYM DDFLIP_INTERVAL2} + + +(* + * DirectDraw will flip on every third vertical sync + *) + DDFLIP_INTERVAL3 = $03000000; + {$EXTERNALSYM DDFLIP_INTERVAL3} + + +(* + * DirectDraw will flip on every fourth vertical sync + *) + DDFLIP_INTERVAL4 = $04000000; + {$EXTERNALSYM DDFLIP_INTERVAL4} + +(* + * DirectDraw will flip and display a main stereo surface + *) + DDFLIP_STEREO = $00000010; + {$EXTERNALSYM DDFLIP_STEREO} + +(* + * 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; + {$EXTERNALSYM DDFLIP_DONOTWAIT} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDOVER_ALPHADEST} + +(* + * Use the dwConstAlphaDest field in the DDOVERLAYFX structure as the + * destination alpha channel for this overlay. + *) + DDOVER_ALPHADESTCONSTOVERRIDE = $00000002; + {$EXTERNALSYM DDOVER_ALPHADESTCONSTOVERRIDE} + +(* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. + *) + DDOVER_ALPHADESTNEG = $00000004; + {$EXTERNALSYM DDOVER_ALPHADESTNEG} + +(* + * Use the lpDDSAlphaDest field in the DDOVERLAYFX structure as the alpha + * channel destination for this overlay. + *) + DDOVER_ALPHADESTSURFACEOVERRIDE = $00000008; + {$EXTERNALSYM DDOVER_ALPHADESTSURFACEOVERRIDE} + +(* + * 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; + {$EXTERNALSYM DDOVER_ALPHAEDGEBLEND} + +(* + * 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; + {$EXTERNALSYM DDOVER_ALPHASRC} + +(* + * Use the dwConstAlphaSrc field in the DDOVERLAYFX structure as the source + * alpha channel for this overlay. + *) + DDOVER_ALPHASRCCONSTOVERRIDE = $00000040; + {$EXTERNALSYM DDOVER_ALPHASRCCONSTOVERRIDE} + +(* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. + *) + DDOVER_ALPHASRCNEG = $00000080; + {$EXTERNALSYM DDOVER_ALPHASRCNEG} + +(* + * Use the lpDDSAlphaSrc field in the DDOVERLAYFX structure as the alpha channel + * source for this overlay. + *) + DDOVER_ALPHASRCSURFACEOVERRIDE = $00000100; + {$EXTERNALSYM DDOVER_ALPHASRCSURFACEOVERRIDE} + +(* + * Turn this overlay off. + *) + DDOVER_HIDE = $00000200; + {$EXTERNALSYM DDOVER_HIDE} + +(* + * Use the color key associated with the destination surface. + *) + DDOVER_KEYDEST = $00000400; + {$EXTERNALSYM DDOVER_KEYDEST} + +(* + * Use the dckDestColorkey field in the DDOVERLAYFX structure as the color key + * for the destination surface + *) + DDOVER_KEYDESTOVERRIDE = $00000800; + {$EXTERNALSYM DDOVER_KEYDESTOVERRIDE} + +(* + * Use the color key associated with the source surface. + *) + DDOVER_KEYSRC = $00001000; + {$EXTERNALSYM DDOVER_KEYSRC} + +(* + * Use the dckSrcColorkey field in the DDOVERLAYFX structure as the color key + * for the source surface. + *) + DDOVER_KEYSRCOVERRIDE = $00002000; + {$EXTERNALSYM DDOVER_KEYSRCOVERRIDE} + +(* + * Turn this overlay on. + *) + DDOVER_SHOW = $00004000; + {$EXTERNALSYM DDOVER_SHOW} + +(* + * Add a dirty rect to an emulated overlayed surface. + *) + DDOVER_ADDDIRTYRECT = $00008000; + {$EXTERNALSYM DDOVER_ADDDIRTYRECT} + +(* + * Redraw all dirty rects on an emulated overlayed surface. + *) + DDOVER_REFRESHDIRTYRECTS = $00010000; + {$EXTERNALSYM DDOVER_REFRESHDIRTYRECTS} + +(* + * Redraw the entire surface on an emulated overlayed surface. + *) + DDOVER_REFRESHALL = $00020000; + {$EXTERNALSYM DDOVER_REFRESHALL} + + +(* + * Use the overlay FX flags to define special overlay FX + *) + DDOVER_DDFX = $00080000; + {$EXTERNALSYM DDOVER_DDFX} + +(* + * Autoflip the overlay when ever the video port autoflips + *) + DDOVER_AUTOFLIP = $00100000; + {$EXTERNALSYM DDOVER_AUTOFLIP} + +(* + * Display each field of video port data individually without + * causing any jittery artifacts + *) + DDOVER_BOB = $00200000; + {$EXTERNALSYM DDOVER_BOB} + +(* + * Indicates that bob/weave decisions should not be overridden by other + * interfaces. + *) + DDOVER_OVERRIDEBOBWEAVE = $00400000; + {$EXTERNALSYM DDOVER_OVERRIDEBOBWEAVE} + +(* + * Indicates that the surface memory is composed of interleaved fields. + *) + DDOVER_INTERLEAVED = $00800000; + {$EXTERNALSYM DDOVER_INTERLEAVED} + +(* + * Indicates that bob will be performed using hardware rather than + * software or emulated. + *) + DDOVER_BOBHARDWARE = $01000000; + {$EXTERNALSYM DDOVER_BOBHARDWARE} + +(* + * Indicates that overlay FX structure contains valid ARGB scaling factors. + *) + DDOVER_ARGBSCALEFACTORS = $02000000; + {$EXTERNALSYM DDOVER_ARGBSCALEFACTORS} + +(* + * Indicates that ARGB scaling factors can be degraded to fit driver capabilities. + *) + DDOVER_DEGRADEARGBSCALING = $04000000; + {$EXTERNALSYM DDOVER_DEGRADEARGBSCALING} + + +(**************************************************************************** + * + * 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 + {$EXTERNALSYM DDLOCK_SURFACEMEMORYPTR} + +(* + * 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; + {$EXTERNALSYM DDLOCK_WAIT} + +(* + * 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; + {$EXTERNALSYM DDLOCK_EVENT} + +(* + * Indicates that the surface being locked will only be read from. + *) + DDLOCK_READONLY = $00000010; + {$EXTERNALSYM DDLOCK_READONLY} + +(* + * Indicates that the surface being locked will only be written to + *) + DDLOCK_WRITEONLY = $00000020; + {$EXTERNALSYM DDLOCK_WRITEONLY} + + +(* + * 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; + {$EXTERNALSYM DDLOCK_NOSYSLOCK} + +(* + * 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; + {$EXTERNALSYM DDLOCK_NOOVERWRITE} + +(* + * 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; + {$EXTERNALSYM DDLOCK_DISCARDCONTENTS} + (* + * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS + *) + DDLOCK_OKTOSWAP = $00002000; + {$EXTERNALSYM DDLOCK_OKTOSWAP} + +(* + * 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; + {$EXTERNALSYM DDLOCK_DONOTWAIT} + +(* + * This indicates volume texture lock with front and back specified. + *) + DDLOCK_HASVOLUMETEXTUREBOXRECT = $00008000; + {$EXTERNALSYM DDLOCK_HASVOLUMETEXTUREBOXRECT} + +(* + * This indicates that the driver should not update dirty rect information for this lock. + *) + DDLOCK_NODIRTYUPDATE = $00010000; + {$EXTERNALSYM DDLOCK_NODIRTYUPDATE} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDBLTFX_ARITHSTRETCHY} + +(* + * Do this blt mirroring the surface left to right. Spin the + * surface around its y-axis. + *) + DDBLTFX_MIRRORLEFTRIGHT = $00000002; + {$EXTERNALSYM DDBLTFX_MIRRORLEFTRIGHT} + +(* + * Do this blt mirroring the surface up and down. Spin the surface + * around its x-axis. + *) + DDBLTFX_MIRRORUPDOWN = $00000004; + {$EXTERNALSYM DDBLTFX_MIRRORUPDOWN} + +(* + * Schedule this blt to avoid tearing. + *) + DDBLTFX_NOTEARING = $00000008; + {$EXTERNALSYM DDBLTFX_NOTEARING} + +(* + * Do this blt rotating the surface one hundred and eighty degrees. + *) + DDBLTFX_ROTATE180 = $00000010; + {$EXTERNALSYM DDBLTFX_ROTATE180} + +(* + * Do this blt rotating the surface two hundred and seventy degrees. + *) + DDBLTFX_ROTATE270 = $00000020; + {$EXTERNALSYM DDBLTFX_ROTATE270} + +(* + * Do this blt rotating the surface ninety degrees. + *) + DDBLTFX_ROTATE90 = $00000040; + {$EXTERNALSYM DDBLTFX_ROTATE90} + +(* + * Do this z blt using dwZBufferLow and dwZBufferHigh as range values + * specified to limit the bits copied from the source surface. + *) + DDBLTFX_ZBUFFERRANGE = $00000080; + {$EXTERNALSYM DDBLTFX_ZBUFFERRANGE} + +(* + * 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; + {$EXTERNALSYM DDBLTFX_ZBUFFERBASEDEST} + +(**************************************************************************** + * + * DIRECTDRAWSURFACE OVERLAY FX FLAGS + * + ****************************************************************************) + +(* + * If stretching, use arithmetic stretching along the Y axis for this overlay. + *) + DDOVERFX_ARITHSTRETCHY = $00000001; + {$EXTERNALSYM DDOVERFX_ARITHSTRETCHY} + +(* + * Mirror the overlay across the vertical axis + *) + DDOVERFX_MIRRORLEFTRIGHT = $00000002; + {$EXTERNALSYM DDOVERFX_MIRRORLEFTRIGHT} + +(* + * Mirror the overlay across the horizontal axis + *) + DDOVERFX_MIRRORUPDOWN = $00000004; + {$EXTERNALSYM DDOVERFX_MIRRORUPDOWN} + +(* + * Deinterlace the overlay, if possible + *) + DDOVERFX_DEINTERLACE = $00000008; + {$EXTERNALSYM DDOVERFX_DEINTERLACE} + + +(**************************************************************************** + * + * DIRECTDRAW WAITFORVERTICALBLANK FLAGS + * + ****************************************************************************) + +(* + * return when the vertical blank interval begins + *) + DDWAITVB_BLOCKBEGIN = $00000001; + {$EXTERNALSYM DDWAITVB_BLOCKBEGIN} + +(* + * set up an event to trigger when the vertical blank begins + *) + DDWAITVB_BLOCKBEGINEVENT = $00000002; + {$EXTERNALSYM DDWAITVB_BLOCKBEGINEVENT} + +(* + * return when the vertical blank interval ends and display begins + *) + DDWAITVB_BLOCKEND = $00000004; + {$EXTERNALSYM DDWAITVB_BLOCKEND} + +(**************************************************************************** + * + * DIRECTDRAW GETFLIPSTATUS FLAGS + * + ****************************************************************************) + +(* + * is it OK to flip now? + *) + DDGFS_CANFLIP = $00000001; + {$EXTERNALSYM DDGFS_CANFLIP} + +(* + * is the last flip finished? + *) + DDGFS_ISFLIPDONE = $00000002; + {$EXTERNALSYM DDGFS_ISFLIPDONE} + +(**************************************************************************** + * + * DIRECTDRAW GETBLTSTATUS FLAGS + * + ****************************************************************************) + +(* + * is it OK to blt now? + *) + DDGBS_CANBLT = $00000001; + {$EXTERNALSYM DDGBS_CANBLT} + +(* + * is the blt to the surface finished? + *) + DDGBS_ISBLTDONE = $00000002; + {$EXTERNALSYM DDGBS_ISBLTDONE} + + +(**************************************************************************** + * + * DIRECTDRAW ENUMOVERLAYZORDER FLAGS + * + ****************************************************************************) + +(* + * Enumerate overlays back to front. + *) + DDENUMOVERLAYZ_BACKTOFRONT = $00000000; + {$EXTERNALSYM DDENUMOVERLAYZ_BACKTOFRONT} + +(* + * Enumerate overlays front to back + *) + DDENUMOVERLAYZ_FRONTTOBACK = $00000001; + {$EXTERNALSYM DDENUMOVERLAYZ_FRONTTOBACK} + +(**************************************************************************** + * + * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS + * + ****************************************************************************) + +(* + * Send overlay to front + *) + DDOVERZ_SENDTOFRONT = $00000000; + {$EXTERNALSYM DDOVERZ_SENDTOFRONT} + +(* + * Send overlay to back + *) + DDOVERZ_SENDTOBACK = $00000001; + {$EXTERNALSYM DDOVERZ_SENDTOBACK} + +(* + * Move Overlay forward + *) + DDOVERZ_MOVEFORWARD = $00000002; + {$EXTERNALSYM DDOVERZ_MOVEFORWARD} + +(* + * Move Overlay backward + *) + DDOVERZ_MOVEBACKWARD = $00000003; + {$EXTERNALSYM DDOVERZ_MOVEBACKWARD} + +(* + * Move Overlay in front of relative surface + *) + DDOVERZ_INSERTINFRONTOF = $00000004; + {$EXTERNALSYM DDOVERZ_INSERTINFRONTOF} + +(* + * Move Overlay in back of relative surface + *) + DDOVERZ_INSERTINBACKOF = $00000005; + {$EXTERNALSYM DDOVERZ_INSERTINBACKOF} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDSGR_CALIBRATE} + + +(**************************************************************************** + * + * DIRECTDRAW STARTMODETEST FLAGS + * + ****************************************************************************) + +(* + * Indicates that the mode being tested has passed + *) + DDSMT_ISTESTREQUIRED = $00000001; + {$EXTERNALSYM DDSMT_ISTESTREQUIRED} + + +(**************************************************************************** + * + * DIRECTDRAW EVALUATEMODE FLAGS + * + ****************************************************************************) + +(* + * Indicates that the mode being tested has passed + *) + DDEM_MODEPASSED = $00000001; + {$EXTERNALSYM DDEM_MODEPASSED} + +(* + * Indicates that the mode being tested has failed + *) + DDEM_MODEFAILED = $00000002; + {$EXTERNALSYM DDEM_MODEFAILED} + + +(*=========================================================================== + * + * + * 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; + {$EXTERNALSYM DD_OK} + DD_FALSE = S_FALSE; + {$EXTERNALSYM DD_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; + {$EXTERNALSYM DDENUMRET_CANCEL} + +(* + * continue the enumeration + *) + DDENUMRET_OK = 1; + {$EXTERNALSYM DDENUMRET_OK} + +(**************************************************************************** + * + * DIRECTDRAW ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************) + +const + _FACDD = $876; + {$EXTERNALSYM _FACDD} + _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; +{$EXTERNALSYM MAKE_DDHRESULT} + +const +(* + * This object is already initialized + *) + DDERR_ALREADYINITIALIZED = HResult(_MAKE_DDHRESULT + 5); + {$EXTERNALSYM DDERR_ALREADYINITIALIZED} + +(* + * This surface can not be attached to the requested surface. + *) + DDERR_CANNOTATTACHSURFACE = HResult(_MAKE_DDHRESULT + 10); + {$EXTERNALSYM DDERR_CANNOTATTACHSURFACE} + +(* + * This surface can not be detached from the requested surface. + *) + DDERR_CANNOTDETACHSURFACE = HResult(_MAKE_DDHRESULT + 20); + {$EXTERNALSYM DDERR_CANNOTDETACHSURFACE} + +(* + * Support is currently not available. + *) + DDERR_CURRENTLYNOTAVAIL = HResult(_MAKE_DDHRESULT + 40); + {$EXTERNALSYM DDERR_CURRENTLYNOTAVAIL} + +(* + * An exception was encountered while performing the requested operation + *) + DDERR_EXCEPTION = HResult(_MAKE_DDHRESULT + 55); + {$EXTERNALSYM DDERR_EXCEPTION} + +(* + * Generic failure. + *) + DDERR_GENERIC = E_FAIL; + {$EXTERNALSYM DDERR_GENERIC} + +(* + * Height of rectangle provided is not a multiple of reqd alignment + *) + DDERR_HEIGHTALIGN = HResult(_MAKE_DDHRESULT + 90); + {$EXTERNALSYM DDERR_HEIGHTALIGN} + +(* + * Unable to match primary surface creation request with existing + * primary surface. + *) + DDERR_INCOMPATIBLEPRIMARY = HResult(_MAKE_DDHRESULT + 95); + {$EXTERNALSYM DDERR_INCOMPATIBLEPRIMARY} + +(* + * One or more of the caps bits passed to the callback are incorrect. + *) + DDERR_INVALIDCAPS = HResult(_MAKE_DDHRESULT + 100); + {$EXTERNALSYM DDERR_INVALIDCAPS} + +(* + * DirectDraw does not support provided Cliplist. + *) + DDERR_INVALIDCLIPLIST = HResult(_MAKE_DDHRESULT + 110); + {$EXTERNALSYM DDERR_INVALIDCLIPLIST} + +(* + * DirectDraw does not support the requested mode + *) + DDERR_INVALIDMODE = HResult(_MAKE_DDHRESULT + 120); + {$EXTERNALSYM DDERR_INVALIDMODE} + +(* + * DirectDraw received a pointer that was an invalid DIRECTDRAW object. + *) + DDERR_INVALIDOBJECT = HResult(_MAKE_DDHRESULT + 130); + {$EXTERNALSYM DDERR_INVALIDOBJECT} + +(* + * One or more of the parameters passed to the callback function are + * incorrect. + *) + DDERR_INVALIDPARAMS = E_INVALIDARG; + {$EXTERNALSYM DDERR_INVALIDPARAMS} + +(* + * pixel format was invalid as specified + *) + DDERR_INVALIDPIXELFORMAT = HResult(_MAKE_DDHRESULT + 145); + {$EXTERNALSYM DDERR_INVALIDPIXELFORMAT} + +(* + * Rectangle provided was invalid. + *) + DDERR_INVALIDRECT = HResult(_MAKE_DDHRESULT + 150); + {$EXTERNALSYM DDERR_INVALIDRECT} + +(* + * Operation could not be carried out because one or more surfaces are locked + *) + DDERR_LOCKEDSURFACES = HResult(_MAKE_DDHRESULT + 160); + {$EXTERNALSYM DDERR_LOCKEDSURFACES} + +(* + * There is no 3D present. + *) + DDERR_NO3D = HResult(_MAKE_DDHRESULT + 170); + {$EXTERNALSYM DDERR_NO3D} + +(* + * Operation could not be carried out because there is no alpha accleration + * hardware present or available. + *) + DDERR_NOALPHAHW = HResult(_MAKE_DDHRESULT + 180); + {$EXTERNALSYM DDERR_NOALPHAHW} + +(* + * Operation could not be carried out because there is no stereo + * hardware present or available. + *) + DDERR_NOSTEREOHARDWARE = HResult(_MAKE_DDHRESULT + 181); + {$EXTERNALSYM DDERR_NOSTEREOHARDWARE} + +(* + * Operation could not be carried out because there is no hardware + * present which supports stereo surfaces + *) + DDERR_NOSURFACELEFT = HResult(_MAKE_DDHRESULT + 182); + {$EXTERNALSYM DDERR_NOSURFACELEFT} + + + +(* + * no clip list available + *) + DDERR_NOCLIPLIST = HResult(_MAKE_DDHRESULT + 205); + {$EXTERNALSYM DDERR_NOCLIPLIST} + +(* + * Operation could not be carried out because there is no color conversion + * hardware present or available. + *) + DDERR_NOCOLORCONVHW = HResult(_MAKE_DDHRESULT + 210); + {$EXTERNALSYM DDERR_NOCOLORCONVHW} + +(* + * Create function called without DirectDraw object method SetCooperativeLevel + * being called. + *) + DDERR_NOCOOPERATIVELEVELSET = HResult(_MAKE_DDHRESULT + 212); + {$EXTERNALSYM DDERR_NOCOOPERATIVELEVELSET} + +(* + * Surface doesn't currently have a color key + *) + DDERR_NOCOLORKEY = HResult(_MAKE_DDHRESULT + 215); + {$EXTERNALSYM DDERR_NOCOLORKEY} + +(* + * Operation could not be carried out because there is no hardware support + * of the dest color key. + *) + DDERR_NOCOLORKEYHW = HResult(_MAKE_DDHRESULT + 220); + {$EXTERNALSYM DDERR_NOCOLORKEYHW} + +(* + * No DirectDraw support possible with current display driver + *) + DDERR_NODIRECTDRAWSUPPORT = HResult(_MAKE_DDHRESULT + 222); + {$EXTERNALSYM DDERR_NODIRECTDRAWSUPPORT} + +(* + * Operation requires the application to have exclusive mode but the + * application does not have exclusive mode. + *) + DDERR_NOEXCLUSIVEMODE = HResult(_MAKE_DDHRESULT + 225); + {$EXTERNALSYM DDERR_NOEXCLUSIVEMODE} + +(* + * Flipping visible surfaces is not supported. + *) + DDERR_NOFLIPHW = HResult(_MAKE_DDHRESULT + 230); + {$EXTERNALSYM DDERR_NOFLIPHW} + +(* + * There is no GDI present. + *) + DDERR_NOGDI = HResult(_MAKE_DDHRESULT + 240); + {$EXTERNALSYM DDERR_NOGDI} + +(* + * Operation could not be carried out because there is no hardware present + * or available. + *) + DDERR_NOMIRRORHW = HResult(_MAKE_DDHRESULT + 250); + {$EXTERNALSYM DDERR_NOMIRRORHW} + +(* + * Requested item was not found + *) + DDERR_NOTFOUND = HResult(_MAKE_DDHRESULT + 255); + {$EXTERNALSYM DDERR_NOTFOUND} + +(* + * Operation could not be carried out because there is no overlay hardware + * present or available. + *) + DDERR_NOOVERLAYHW = HResult(_MAKE_DDHRESULT + 260); + {$EXTERNALSYM DDERR_NOOVERLAYHW} + +(* + * 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); + {$EXTERNALSYM DDERR_OVERLAPPINGRECTS} + +(* + * Operation could not be carried out because there is no appropriate raster + * op hardware present or available. + *) + DDERR_NORASTEROPHW = HResult(_MAKE_DDHRESULT + 280); + {$EXTERNALSYM DDERR_NORASTEROPHW} + +(* + * Operation could not be carried out because there is no rotation hardware + * present or available. + *) + DDERR_NOROTATIONHW = HResult(_MAKE_DDHRESULT + 290); + {$EXTERNALSYM DDERR_NOROTATIONHW} + +(* + * Operation could not be carried out because there is no hardware support + * for stretching + *) + DDERR_NOSTRETCHHW = HResult(_MAKE_DDHRESULT + 310); + {$EXTERNALSYM DDERR_NOSTRETCHHW} + +(* + * DirectDrawSurface is not in 4 bit color palette and the requested operation + * requires 4 bit color palette. + *) + DDERR_NOT4BITCOLOR = HResult(_MAKE_DDHRESULT + 316); + {$EXTERNALSYM DDERR_NOT4BITCOLOR} + +(* + * 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); + {$EXTERNALSYM DDERR_NOT4BITCOLORINDEX} + +(* + * DirectDraw Surface is not in 8 bit color mode and the requested operation + * requires 8 bit color. + *) + DDERR_NOT8BITCOLOR = HResult(_MAKE_DDHRESULT + 320); + {$EXTERNALSYM DDERR_NOT8BITCOLOR} + +(* + * Operation could not be carried out because there is no texture mapping + * hardware present or available. + *) + DDERR_NOTEXTUREHW = HResult(_MAKE_DDHRESULT + 330); + {$EXTERNALSYM DDERR_NOTEXTUREHW} + +(* + * Operation could not be carried out because there is no hardware support + * for vertical blank synchronized operations. + *) + DDERR_NOVSYNCHW = HResult(_MAKE_DDHRESULT + 335); + {$EXTERNALSYM DDERR_NOVSYNCHW} + +(* + * Operation could not be carried out because there is no hardware support + * for zbuffer blting. + *) + DDERR_NOZBUFFERHW = HResult(_MAKE_DDHRESULT + 340); + {$EXTERNALSYM DDERR_NOZBUFFERHW} + +(* + * 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); + {$EXTERNALSYM DDERR_NOZOVERLAYHW} + +(* + * The hardware needed for the requested operation has already been + * allocated. + *) + DDERR_OUTOFCAPS = HResult(_MAKE_DDHRESULT + 360); + {$EXTERNALSYM DDERR_OUTOFCAPS} + +(* + * DirectDraw does not have enough memory to perform the operation. + *) + DDERR_OUTOFMEMORY = E_OUTOFMEMORY; + {$EXTERNALSYM DDERR_OUTOFMEMORY} + +(* + * DirectDraw does not have enough memory to perform the operation. + *) + DDERR_OUTOFVIDEOMEMORY = HResult(_MAKE_DDHRESULT + 380); + {$EXTERNALSYM DDERR_OUTOFVIDEOMEMORY} + +(* + * hardware does not support clipped overlays + *) + DDERR_OVERLAYCANTCLIP = HResult(_MAKE_DDHRESULT + 382); + {$EXTERNALSYM DDERR_OVERLAYCANTCLIP} + +(* + * Can only have ony color key active at one time for overlays + *) + DDERR_OVERLAYCOLORKEYONLYONEACTIVE = HResult(_MAKE_DDHRESULT + 384); + {$EXTERNALSYM DDERR_OVERLAYCOLORKEYONLYONEACTIVE} + +(* + * Access to this palette is being refused because the palette is already + * locked by another thread. + *) + DDERR_PALETTEBUSY = HResult(_MAKE_DDHRESULT + 387); + {$EXTERNALSYM DDERR_PALETTEBUSY} + +(* + * No src color key specified for this operation. + *) + DDERR_COLORKEYNOTSET = HResult(_MAKE_DDHRESULT + 400); + {$EXTERNALSYM DDERR_COLORKEYNOTSET} + +(* + * This surface is already attached to the surface it is being attached to. + *) + DDERR_SURFACEALREADYATTACHED = HResult(_MAKE_DDHRESULT + 410); + {$EXTERNALSYM DDERR_SURFACEALREADYATTACHED} + +(* + * This surface is already a dependency of the surface it is being made a + * dependency of. + *) + DDERR_SURFACEALREADYDEPENDENT = HResult(_MAKE_DDHRESULT + 420); + {$EXTERNALSYM DDERR_SURFACEALREADYDEPENDENT} + +(* + * Access to this surface is being refused because the surface is already + * locked by another thread. + *) + DDERR_SURFACEBUSY = HResult(_MAKE_DDHRESULT + 430); + {$EXTERNALSYM DDERR_SURFACEBUSY} + +(* + * 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); + {$EXTERNALSYM DDERR_CANTLOCKSURFACE} + +(* + * Access to Surface refused because Surface is obscured. + *) + DDERR_SURFACEISOBSCURED = HResult(_MAKE_DDHRESULT + 440); + {$EXTERNALSYM DDERR_SURFACEISOBSCURED} + +(* + * 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); + {$EXTERNALSYM DDERR_SURFACELOST} + +(* + * The requested surface is not attached. + *) + DDERR_SURFACENOTATTACHED = HResult(_MAKE_DDHRESULT + 460); + {$EXTERNALSYM DDERR_SURFACENOTATTACHED} + +(* + * Height requested by DirectDraw is too large. + *) + DDERR_TOOBIGHEIGHT = HResult(_MAKE_DDHRESULT + 470); + {$EXTERNALSYM DDERR_TOOBIGHEIGHT} + +(* + * Size requested by DirectDraw is too large -- The individual height and + * width are OK. + *) + DDERR_TOOBIGSIZE = HResult(_MAKE_DDHRESULT + 480); + {$EXTERNALSYM DDERR_TOOBIGSIZE} + +(* + * Width requested by DirectDraw is too large. + *) + DDERR_TOOBIGWIDTH = HResult(_MAKE_DDHRESULT + 490); + {$EXTERNALSYM DDERR_TOOBIGWIDTH} + +(* + * Action not supported. + *) + DDERR_UNSUPPORTED = E_NOTIMPL; + {$EXTERNALSYM DDERR_UNSUPPORTED} + +(* + * FOURCC format requested is unsupported by DirectDraw + *) + DDERR_UNSUPPORTEDFORMAT = HResult(_MAKE_DDHRESULT + 510); + {$EXTERNALSYM DDERR_UNSUPPORTEDFORMAT} + +(* + * Bitmask in the pixel format requested is unsupported by DirectDraw + *) + DDERR_UNSUPPORTEDMASK = HResult(_MAKE_DDHRESULT + 520); + {$EXTERNALSYM DDERR_UNSUPPORTEDMASK} + +(* + * The specified stream contains invalid data + *) + DDERR_INVALIDSTREAM = HResult(_MAKE_DDHRESULT + 521); + {$EXTERNALSYM DDERR_INVALIDSTREAM} + +(* + * vertical blank is in progress + *) + DDERR_VERTICALBLANKINPROGRESS = HResult(_MAKE_DDHRESULT + 537); + {$EXTERNALSYM DDERR_VERTICALBLANKINPROGRESS} + +(* + * Informs DirectDraw that the previous Blt which is transfering information + * to or from this Surface is incomplete. + *) + DDERR_WASSTILLDRAWING = HResult(_MAKE_DDHRESULT + 540); + {$EXTERNALSYM DDERR_WASSTILLDRAWING} + + +(* + * The specified surface type requires specification of the COMPLEX flag + *) + DDERR_DDSCAPSCOMPLEXREQUIRED = HResult(_MAKE_DDHRESULT + 542); + {$EXTERNALSYM DDERR_DDSCAPSCOMPLEXREQUIRED} + + +(* + * Rectangle provided was not horizontally aligned on reqd. boundary + *) + DDERR_XALIGN = HResult(_MAKE_DDHRESULT + 560); + {$EXTERNALSYM DDERR_XALIGN} + +(* + * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver + * identifier. + *) + DDERR_INVALIDDIRECTDRAWGUID = HResult(_MAKE_DDHRESULT + 561); + {$EXTERNALSYM DDERR_INVALIDDIRECTDRAWGUID} + +(* + * A DirectDraw object representing this driver has already been created + * for this process. + *) + DDERR_DIRECTDRAWALREADYCREATED = HResult(_MAKE_DDHRESULT + 562); + {$EXTERNALSYM DDERR_DIRECTDRAWALREADYCREATED} + +(* + * A hardware only DirectDraw object creation was attempted but the driver + * did not support any hardware. + *) + DDERR_NODIRECTDRAWHW = HResult(_MAKE_DDHRESULT + 563); + {$EXTERNALSYM DDERR_NODIRECTDRAWHW} + +(* + * this process already has created a primary surface + *) + DDERR_PRIMARYSURFACEALREADYEXISTS = HResult(_MAKE_DDHRESULT + 564); + {$EXTERNALSYM DDERR_PRIMARYSURFACEALREADYEXISTS} + +(* + * software emulation not available. + *) + DDERR_NOEMULATION = HResult(_MAKE_DDHRESULT + 565); + {$EXTERNALSYM DDERR_NOEMULATION} + +(* + * region passed to Clipper::GetClipList is too small. + *) + DDERR_REGIONTOOSMALL = HResult(_MAKE_DDHRESULT + 566); + {$EXTERNALSYM DDERR_REGIONTOOSMALL} + +(* + * 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); + {$EXTERNALSYM DDERR_CLIPPERISUSINGHWND} + +(* + * No clipper object attached to surface object + *) + DDERR_NOCLIPPERATTACHED = HResult(_MAKE_DDHRESULT + 568); + {$EXTERNALSYM DDERR_NOCLIPPERATTACHED} + +(* + * Clipper notification requires an HWND or + * no HWND has previously been set as the CooperativeLevel HWND. + *) + DDERR_NOHWND = HResult(_MAKE_DDHRESULT + 569); + {$EXTERNALSYM DDERR_NOHWND} + +(* + * HWND used by DirectDraw CooperativeLevel has been subclassed, + * this prevents DirectDraw from restoring state. + *) + DDERR_HWNDSUBCLASSED = HResult(_MAKE_DDHRESULT + 570); + {$EXTERNALSYM DDERR_HWNDSUBCLASSED} + +(* + * 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); + {$EXTERNALSYM DDERR_HWNDALREADYSET} + +(* + * No palette object attached to this surface. + *) + DDERR_NOPALETTEATTACHED = HResult(_MAKE_DDHRESULT + 572); + {$EXTERNALSYM DDERR_NOPALETTEATTACHED} + +(* + * No hardware support for 16 or 256 color palettes. + *) + DDERR_NOPALETTEHW = HResult(_MAKE_DDHRESULT + 573); + {$EXTERNALSYM DDERR_NOPALETTEHW} + +(* + * If a clipper object is attached to the source surface passed into a + * BltFast call. + *) + DDERR_BLTFASTCANTCLIP = HResult(_MAKE_DDHRESULT + 574); + {$EXTERNALSYM DDERR_BLTFASTCANTCLIP} + +(* + * No blter. + *) + DDERR_NOBLTHW = HResult(_MAKE_DDHRESULT + 575); + {$EXTERNALSYM DDERR_NOBLTHW} + +(* + * No DirectDraw ROP hardware. + *) + DDERR_NODDROPSHW = HResult(_MAKE_DDHRESULT + 576); + {$EXTERNALSYM DDERR_NODDROPSHW} + +(* + * returned when GetOverlayPosition is called on a hidden overlay + *) + DDERR_OVERLAYNOTVISIBLE = HResult(_MAKE_DDHRESULT + 577); + {$EXTERNALSYM DDERR_OVERLAYNOTVISIBLE} + +(* + * 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); + {$EXTERNALSYM DDERR_NOOVERLAYDEST} + +(* + * returned when the position of the overlay on the destionation is no longer + * legal for that destionation. + *) + DDERR_INVALIDPOSITION = HResult(_MAKE_DDHRESULT + 579); + {$EXTERNALSYM DDERR_INVALIDPOSITION} + +(* + * returned when an overlay member is called for a non-overlay surface + *) + DDERR_NOTAOVERLAYSURFACE = HResult(_MAKE_DDHRESULT + 580); + {$EXTERNALSYM DDERR_NOTAOVERLAYSURFACE} + +(* + * An attempt was made to set the cooperative level when it was already + * set to exclusive. + *) + DDERR_EXCLUSIVEMODEALREADYSET = HResult(_MAKE_DDHRESULT + 581); + {$EXTERNALSYM DDERR_EXCLUSIVEMODEALREADYSET} + +(* + * An attempt has been made to flip a surface that is not flippable. + *) + DDERR_NOTFLIPPABLE = HResult(_MAKE_DDHRESULT + 582); + {$EXTERNALSYM DDERR_NOTFLIPPABLE} + +(* + * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly + * created. + *) + DDERR_CANTDUPLICATE = HResult(_MAKE_DDHRESULT + 583); + {$EXTERNALSYM DDERR_CANTDUPLICATE} + +(* + * 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); + {$EXTERNALSYM DDERR_NOTLOCKED} + +(* + * 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); + {$EXTERNALSYM DDERR_CANTCREATEDC} + +(* + * No DC was ever created for this surface. + *) + DDERR_NODC = HResult(_MAKE_DDHRESULT + 586); + {$EXTERNALSYM DDERR_NODC} + +(* + * This surface can not be restored because it was created in a different + * mode. + *) + DDERR_WRONGMODE = HResult(_MAKE_DDHRESULT + 587); + {$EXTERNALSYM DDERR_WRONGMODE} + +(* + * This surface can not be restored because it is an implicitly created + * surface. + *) + DDERR_IMPLICITLYCREATED = HResult(_MAKE_DDHRESULT + 588); + {$EXTERNALSYM DDERR_IMPLICITLYCREATED} + +(* + * The surface being used is not a palette-based surface + *) + DDERR_NOTPALETTIZED = HResult(_MAKE_DDHRESULT + 589); + {$EXTERNALSYM DDERR_NOTPALETTIZED} + + +(* + * The display is currently in an unsupported mode + *) + DDERR_UNSUPPORTEDMODE = HResult(_MAKE_DDHRESULT + 590); + {$EXTERNALSYM DDERR_UNSUPPORTEDMODE} + +(* + * Operation could not be carried out because there is no mip-map + * texture mapping hardware present or available. + *) + DDERR_NOMIPMAPHW = HResult(_MAKE_DDHRESULT + 591); + {$EXTERNALSYM DDERR_NOMIPMAPHW} + +(* + * The requested action could not be performed because the surface was of + * the wrong type. + *) + DDERR_INVALIDSURFACETYPE = HResult(_MAKE_DDHRESULT + 592); + {$EXTERNALSYM DDERR_INVALIDSURFACETYPE} + + +(* + * Device does not support optimized surfaces, therefore no video memory optimized surfaces + *) + DDERR_NOOPTIMIZEHW = HResult(_MAKE_DDHRESULT + 600); + {$EXTERNALSYM DDERR_NOOPTIMIZEHW} + +(* + * Surface is an optimized surface, but has not yet been allocated any memory + *) + DDERR_NOTLOADED = HResult(_MAKE_DDHRESULT + 601); + {$EXTERNALSYM DDERR_NOTLOADED} + +(* + * Attempt was made to create or set a device window without first setting + * the focus window + *) + DDERR_NOFOCUSWINDOW = HResult(_MAKE_DDHRESULT + 602); + {$EXTERNALSYM DDERR_NOFOCUSWINDOW} + +(* + * Attempt was made to set a palette on a mipmap sublevel + *) + DDERR_NOTONMIPMAPSUBLEVEL = HResult(_MAKE_DDHRESULT + 603); + {$EXTERNALSYM DDERR_NOTONMIPMAPSUBLEVEL} + +(* + * A DC has already been returned for this surface. Only one DC can be + * retrieved per surface. + *) + DDERR_DCALREADYCREATED = HResult(_MAKE_DDHRESULT + 620); + {$EXTERNALSYM DDERR_DCALREADYCREATED} + +(* + * 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); + {$EXTERNALSYM DDERR_NONONLOCALVIDMEM} + +(* + * The attempt to page lock a surface failed. + *) + DDERR_CANTPAGELOCK = HResult(_MAKE_DDHRESULT + 640); + {$EXTERNALSYM DDERR_CANTPAGELOCK} + + +(* + * The attempt to page unlock a surface failed. + *) + DDERR_CANTPAGEUNLOCK = HResult(_MAKE_DDHRESULT + 660); + {$EXTERNALSYM DDERR_CANTPAGEUNLOCK} + +(* + * An attempt was made to page unlock a surface with no outstanding page locks. + *) + DDERR_NOTPAGELOCKED = HResult(_MAKE_DDHRESULT + 680); + {$EXTERNALSYM DDERR_NOTPAGELOCKED} + +(* + * There is more data available than the specified buffer size could hold + *) + DDERR_MOREDATA = HResult(_MAKE_DDHRESULT + 690); + {$EXTERNALSYM DDERR_MOREDATA} + +(* + * The data has expired and is therefore no longer valid. + *) + DDERR_EXPIRED = HResult(_MAKE_DDHRESULT + 691); + {$EXTERNALSYM DDERR_EXPIRED} + +(* + * The mode test has finished executing. + *) + DDERR_TESTFINISHED = HResult(_MAKE_DDHRESULT + 692); + {$EXTERNALSYM DDERR_TESTFINISHED} + +(* + * The mode test has switched to a new mode. + *) + DDERR_NEWMODE = HResult(_MAKE_DDHRESULT + 693); + {$EXTERNALSYM DDERR_NEWMODE} + +(* + * D3D has not yet been initialized. + *) + DDERR_D3DNOTINITIALIZED = HResult(_MAKE_DDHRESULT + 694); + {$EXTERNALSYM DDERR_D3DNOTINITIALIZED} + +(* + * The video port is not active + *) + DDERR_VIDEONOTACTIVE = HResult(_MAKE_DDHRESULT + 695); + {$EXTERNALSYM DDERR_VIDEONOTACTIVE} + +(* + * The monitor does not have EDID data. + *) + DDERR_NOMONITORINFORMATION = HResult(_MAKE_DDHRESULT + 696); + {$EXTERNALSYM DDERR_NOMONITORINFORMATION} + +(* + * The driver does not enumerate display mode refresh rates. + *) + DDERR_NODRIVERSUPPORT = HResult(_MAKE_DDHRESULT + 697); + {$EXTERNALSYM DDERR_NODRIVERSUPPORT} + +(* + * Surfaces created by one direct draw device cannot be used directly by + * another direct draw device. + *) + DDERR_DEVICEDOESNTOWNSURFACE = HResult(_MAKE_DDHRESULT + 699); + {$EXTERNALSYM DDERR_DEVICEDOESNTOWNSURFACE} + + + +(* + * 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; + {$EXTERNALSYM DDERR_NOTINITIALIZED} + +(* Alpha bit depth constants *) + + + +(* + * API's + *) + +const + DirectDrawDll = 'ddraw.dll'; + +type + HMonitor = THandle; + {$EXTERNALSYM HMonitor} + + TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar; + lpDriverName: PAnsiChar; lpContext: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDDEnumCallbackA} + TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar; + lpDriverName: PWideChar; lpContext: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDDEnumCallbackW} + TDDEnumCallback = function (lpGUID: PGUID; lpDriverDescription: PChar; + lpDriverName: PChar; lpContext: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDDEnumCallback} + + TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar; + lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + {$EXTERNALSYM TDDEnumCallbackExA} + TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar; + lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + {$EXTERNALSYM TDDEnumCallbackExW} + TDDEnumCallbackEx = function (lpGUID: PGUID; lpDriverDescription: PChar; + lpDriverName: PChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + {$EXTERNALSYM TDDEnumCallbackEx} + +function DirectDrawLoaded: Boolean; +function UnLoadDirectDraw: Boolean; +function LoadDirectDraw: Boolean; + +{$IFDEF DIRECTDRAW_DYNAMIC_LINK} +var + DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA; + lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateA} + DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW; + lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateW} + DirectDrawEnumerate : function (lpCallback: TDDEnumCallback; + lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerate} + + DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateExA} + DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateExW} + DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateEx} + + DirectDrawCreate : function (lpGUID: PGUID; + out lplpDD: IDirectDraw; + pUnkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectDrawCreate} + DirectDrawCreateEx : function (lpGUID: PGUID; + out lplpDD: IDirectDraw7; const iid: TGUID; + pUnkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectDrawCreateEx} + DirectDrawCreateClipper : function (dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectDrawCreateClipper} +{$ELSE} + +function DirectDrawEnumerateA(lpCallback: TDDEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawEnumerateA} +function DirectDrawEnumerateW(lpCallback: TDDEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawEnumerateW} +function DirectDrawEnumerate(lpCallback: TDDEnumCallback; lpContext: Pointer): HResult; stdcall; + external DirectDrawDll name {$IFDEF UNICODE}'DirectDrawEnumerateW'{$ELSE}'DirectDrawEnumerateA'{$ENDIF}; +{$EXTERNALSYM DirectDrawEnumerate} + +function DirectDrawEnumerateExA(lpCallback: TDDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawEnumerateExA} +function DirectDrawEnumerateExW(lpCallback: TDDEnumCallbackExW; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawEnumerateExW} +function DirectDrawEnumerateEx(lpCallback: TDDEnumCallbackEx; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + external DirectDrawDll name {$IFDEF UNICODE}'DirectDrawEnumerateExW'{$ELSE}'DirectDrawEnumerateExA'{$ENDIF}; +{$EXTERNALSYM DirectDrawEnumerateEx} + +function DirectDrawCreate(lpGUID: PGUID; out lplpDD: IDirectDraw; + pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawCreate} + +function DirectDrawCreateEx(lpGUID: PGUID; out lplpDD: IDirectDraw7; + const iid: TGUID; pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawCreateEx} + +function DirectDrawCreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawCreateClipper} + +{$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; + {$EXTERNALSYM DDENUM_ATTACHEDSECONDARYDEVICES} + +(* + * This flag causes enumeration of any GDI display devices which are not + * part of the Windows Desktop + *) + DDENUM_DETACHEDSECONDARYDEVICES = $00000002; + {$EXTERNALSYM DDENUM_DETACHEDSECONDARYDEVICES} + +(* + * This flag causes enumeration of non-display devices + *) + DDENUM_NONDISPLAYDEVICES = $00000004; + {$EXTERNALSYM DDENUM_NONDISPLAYDEVICES} + + + REGSTR_KEY_DDHW_DESCRIPTION = 'Description'; + {$EXTERNALSYM REGSTR_KEY_DDHW_DESCRIPTION} + REGSTR_KEY_DDHW_DRIVERNAME = 'DriverName'; + {$EXTERNALSYM REGSTR_KEY_DDHW_DRIVERNAME} + REGSTR_PATH_DDHW = 'Hardware\DirectDrawDrivers'; + {$EXTERNALSYM REGSTR_PATH_DDHW} + + DDCREATE_HARDWAREONLY = $00000001; + {$EXTERNALSYM DDCREATE_HARDWAREONLY} + DDCREATE_EMULATIONONLY = $00000002; + {$EXTERNALSYM DDCREATE_EMULATIONONLY} + +(* + * 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; + {$EXTERNALSYM DDGDI_GETHOSTIDENTIFIER} + +(* + * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel + *) +function GET_WHQL_YEAR(dwWHQLLevel: DWORD): DWORD; +{$EXTERNALSYM GET_WHQL_YEAR} +function GET_WHQL_MONTH(dwWHQLLevel: DWORD): DWORD; +{$EXTERNALSYM GET_WHQL_MONTH} +function GET_WHQL_DAY(dwWHQLLevel: DWORD): DWORD; +{$EXTERNALSYM GET_WHQL_DAY} + + +(*==========================================================================; + * + * 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)); + {$EXTERNALSYM DDVPTYPE_E_HREFH_VREFH} + DDVPTYPE_E_HREFH_VREFL: TGUID = (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_E_HREFH_VREFL} + DDVPTYPE_E_HREFL_VREFH: TGUID = (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_E_HREFL_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} + DDVPTYPE_CCIR656: TGUID = (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_CCIR656} + DDVPTYPE_BROOKTREE: TGUID = (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_BROOKTREE} + DDVPTYPE_PHILIPS: TGUID = (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_PHILIPS} + + +(* + * 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; + {$EXTERNALSYM ULONG_PTR} + +(*============================================================================ + * + * 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; + {$EXTERNALSYM _DDVIDEOPORTCONNECT} + DDVIDEOPORTCONNECT = _DDVIDEOPORTCONNECT; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDVIDEOPORTCAPS} + DDVIDEOPORTCAPS = _DDVIDEOPORTCAPS; + {$EXTERNALSYM DDVIDEOPORTCAPS} + TDDVideoPortCaps = _DDVIDEOPORTCAPS; + +const +(* + * The dwMaxWidth and dwMaxVBIWidth members are valid + *) + DDVPD_WIDTH = $00000001; + {$EXTERNALSYM DDVPD_WIDTH} + +(* + * The dwMaxHeight member is valid + *) + DDVPD_HEIGHT = $00000002; + {$EXTERNALSYM DDVPD_HEIGHT} + +(* + * The dwVideoPortID member is valid + *) + DDVPD_ID = $00000004; + {$EXTERNALSYM DDVPD_ID} + +(* + * The dwCaps member is valid + *) + DDVPD_CAPS = $00000008; + {$EXTERNALSYM DDVPD_CAPS} + +(* + * The dwFX member is valid + *) + DDVPD_FX = $00000010; + {$EXTERNALSYM DDVPD_FX} + +(* + * The dwNumAutoFlipSurfaces member is valid + *) + DDVPD_AUTOFLIP = $00000020; + {$EXTERNALSYM DDVPD_AUTOFLIP} + +(* + * All of the alignment members are valid + *) + DDVPD_ALIGN = $00000040; + {$EXTERNALSYM DDVPD_ALIGN} + +(* + * The dwNumPreferredAutoflip member is valid + *) + DDVPD_PREFERREDAUTOFLIP = $00000080; + {$EXTERNALSYM DDVPD_PREFERREDAUTOFLIP} + +(* + * The wNumFilterTapsX and wNumFilterTapsY fields are valid + *) + DDVPD_FILTERQUALITY = $00000100; + {$EXTERNALSYM DDVPD_FILTERQUALITY} + +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; + {$EXTERNALSYM _DDVIDEOPORTDESC} + DDVIDEOPORTDESC = _DDVIDEOPORTDESC; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDVIDEOPORTINFO} + DDVIDEOPORTINFO = _DDVIDEOPORTINFO; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDVIDEOPORTBANDWIDTH} + DDVIDEOPORTBANDWIDTH = _DDVIDEOPORTBANDWIDTH; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDVIDEOPORTSTATUS} + DDVIDEOPORTSTATUS = _DDVIDEOPORTSTATUS; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DDVIDEOPORTNOTIFY} + DDVIDEOPORTNOTIFY = _DDVIDEOPORTNOTIFY; + {$EXTERNALSYM 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; + {$EXTERNALSYM DDVPCONNECT_DOUBLECLOCK} + +(* + * 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; + {$EXTERNALSYM DDVPCONNECT_VACT} + +(* + * 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; + {$EXTERNALSYM DDVPCONNECT_INVERTPOLARITY} + +(* + * 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; + {$EXTERNALSYM DDVPCONNECT_DISCARDSVREFDATA} + +(* + * 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; + {$EXTERNALSYM DDVPCONNECT_HALFLINE} + +(* + * Indicates that the signal is interlaced. This flag is only + * set by the client. + *) + DDVPCONNECT_INTERLACED = $00000020; + {$EXTERNALSYM DDVPCONNECT_INTERLACED} + +(* + * 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; + {$EXTERNALSYM DDVPCONNECT_SHAREEVEN} + +(* + * 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; + {$EXTERNALSYM DDVPCONNECT_SHAREODD} + +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC / TDDVideoPortDesc CAPS + * + ****************************************************************************) + +(* + * Flip can be performed automatically to avoid tearing. + *) + DDVPCAPS_AUTOFLIP = $00000001; + {$EXTERNALSYM DDVPCAPS_AUTOFLIP} + +(* + * Supports interlaced video + *) + DDVPCAPS_INTERLACED = $00000002; + {$EXTERNALSYM DDVPCAPS_INTERLACED} + +(* + * Supports non-interlaced video + *) + DDVPCAPS_NONINTERLACED = $00000004; + {$EXTERNALSYM DDVPCAPS_NONINTERLACED} + +(* + * Indicates that the device can return whether the current field + * of an interlaced signal is even or odd. + *) + DDVPCAPS_READBACKFIELD = $00000008; + {$EXTERNALSYM DDVPCAPS_READBACKFIELD} + +(* + * Indicates that the device can return the current line of video + * being written into the frame buffer. + *) + DDVPCAPS_READBACKLINE = $00000010; + {$EXTERNALSYM DDVPCAPS_READBACKLINE} + +(* + * 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; + {$EXTERNALSYM DDVPCAPS_SHAREABLE} + +(* + * Even fields of video can be automatically discarded. + *) + DDVPCAPS_SKIPEVENFIELDS = $00000040; + {$EXTERNALSYM DDVPCAPS_SKIPEVENFIELDS} + +(* + * Odd fields of video can be automatically discarded. + *) + DDVPCAPS_SKIPODDFIELDS = $00000080; + {$EXTERNALSYM DDVPCAPS_SKIPODDFIELDS} + +(* + * Indicates that the device is capable of driving the graphics + * VSYNC with the video port VSYNC. + *) + DDVPCAPS_SYNCMASTER = $00000100; + {$EXTERNALSYM DDVPCAPS_SYNCMASTER} + +(* + * Indicates that data within the vertical blanking interval can + * be written to a different surface. + *) + DDVPCAPS_VBISURFACE = $00000200; + {$EXTERNALSYM DDVPCAPS_VBISURFACE} + +(* + * Indicates that the video port can perform color operations + * on the incoming data before it is written to the frame buffer. + *) + DDVPCAPS_COLORCONTROL = $00000400; + {$EXTERNALSYM DDVPCAPS_COLORCONTROL} + +(* + * Indicates that the video port can accept VBI data in a different + * width or format than the regular video data. + *) + DDVPCAPS_OVERSAMPLEDVBI = $00000800; + {$EXTERNALSYM DDVPCAPS_OVERSAMPLEDVBI} + +(* + * Indicates that the video port can write data directly to system memory + *) + DDVPCAPS_SYSTEMMEMORY = $00001000; + {$EXTERNALSYM DDVPCAPS_SYSTEMMEMORY} + +(* + * Indicates that the VBI and video portions of the video stream can + * be controlled by an independent processes. + *) + DDVPCAPS_VBIANDVIDEOINDEPENDENT = $00002000; + {$EXTERNALSYM DDVPCAPS_VBIANDVIDEOINDEPENDENT} + +(* + * 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; + {$EXTERNALSYM DDVPCAPS_HARDWAREDEINTERLACE} + + +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC / TDDVideoPortDesc FX + * + ****************************************************************************) + +(* + * Limited cropping is available to crop out the vertical interval data. + *) + DDVPFX_CROPTOPDATA = $00000001; + {$EXTERNALSYM DDVPFX_CROPTOPDATA} + +(* + * Incoming data can be cropped in the X direction before it is written + * to the surface. + *) + DDVPFX_CROPX = $00000002; + {$EXTERNALSYM DDVPFX_CROPX} + +(* + * Incoming data can be cropped in the Y direction before it is written + * to the surface. + *) + DDVPFX_CROPY = $00000004; + {$EXTERNALSYM DDVPFX_CROPY} + +(* + * Supports interleaving interlaced fields in memory. + *) + DDVPFX_INTERLEAVE = $00000008; + {$EXTERNALSYM DDVPFX_INTERLEAVE} + +(* + * Supports mirroring left to right as the video data is written + * into the frame buffer. + *) + DDVPFX_MIRRORLEFTRIGHT = $00000010; + {$EXTERNALSYM DDVPFX_MIRRORLEFTRIGHT} + +(* + * Supports mirroring top to bottom as the video data is written + * into the frame buffer. + *) + DDVPFX_MIRRORUPDOWN = $00000020; + {$EXTERNALSYM DDVPFX_MIRRORUPDOWN} + +(* + * Data can be arbitrarily shrunk in the X direction before it + * is written to the surface. + *) + DDVPFX_PRESHRINKX = $00000040; + {$EXTERNALSYM DDVPFX_PRESHRINKX} + +(* + * Data can be arbitrarily shrunk in the Y direction before it + * is written to the surface. + *) + DDVPFX_PRESHRINKY = $00000080; + {$EXTERNALSYM DDVPFX_PRESHRINKY} + +(* + * 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; + {$EXTERNALSYM DDVPFX_PRESHRINKXB} + +(* + * 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; + {$EXTERNALSYM DDVPFX_PRESHRINKYB} + +(* + * 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; + {$EXTERNALSYM DDVPFX_PRESHRINKXS} + +(* + * 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; + {$EXTERNALSYM DDVPFX_PRESHRINKYS} + +(* + * Data can be arbitrarily stretched in the X direction before + * it is written to the surface. + *) + DDVPFX_PRESTRETCHX = $00001000; + {$EXTERNALSYM DDVPFX_PRESTRETCHX} + +(* + * Data can be arbitrarily stretched in the Y direction before + * it is written to the surface. + *) + DDVPFX_PRESTRETCHY = $00002000; + {$EXTERNALSYM DDVPFX_PRESTRETCHY} + +(* + * Data can be integer stretched in the X direction before it is + * written to the surface. + *) + DDVPFX_PRESTRETCHXN = $00004000; + {$EXTERNALSYM DDVPFX_PRESTRETCHXN} + +(* + * Data can be integer stretched in the Y direction before it is + * written to the surface. + *) + DDVPFX_PRESTRETCHYN = $00008000; + {$EXTERNALSYM DDVPFX_PRESTRETCHYN} + +(* + * Indicates that data within the vertical blanking interval can + * be converted independently of the remaining video data. + *) + DDVPFX_VBICONVERT = $00010000; + {$EXTERNALSYM DDVPFX_VBICONVERT} + +(* + * Indicates that scaling can be disabled for data within the + * vertical blanking interval. + *) + DDVPFX_VBINOSCALE = $00020000; + {$EXTERNALSYM DDVPFX_VBINOSCALE} + +(* + * Indicates that the video data can ignore the left and right + * cropping coordinates when cropping oversampled VBI data. + *) + DDVPFX_IGNOREVBIXCROP = $00040000; + {$EXTERNALSYM DDVPFX_IGNOREVBIXCROP} + +(* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + *) + DDVPFX_VBINOINTERLEAVE = $00080000; + {$EXTERNALSYM DDVPFX_VBINOINTERLEAVE} + + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDVP_AUTOFLIP} + +(* + * Perform conversion using the ddpfOutputFormat information. + *) + DDVP_CONVERT = $00000002; + {$EXTERNALSYM DDVP_CONVERT} + +(* + * Perform cropping using the specified rectangle. + *) + DDVP_CROP = $00000004; + {$EXTERNALSYM DDVP_CROP} + +(* + * Indicates that interlaced fields should be interleaved in memory. + *) + DDVP_INTERLEAVE = $00000008; + {$EXTERNALSYM DDVP_INTERLEAVE} + +(* + * Indicates that the data should be mirrored left to right as it's + * written into the frame buffer. + *) + DDVP_MIRRORLEFTRIGHT = $00000010; + {$EXTERNALSYM DDVP_MIRRORLEFTRIGHT} + +(* + * Indicates that the data should be mirrored top to bottom as it's + * written into the frame buffer. + *) + DDVP_MIRRORUPDOWN = $00000020; + {$EXTERNALSYM DDVP_MIRRORUPDOWN} + +(* + * Perform pre-scaling/zooming based on the pre-scale parameters. + *) + DDVP_PRESCALE = $00000040; + {$EXTERNALSYM DDVP_PRESCALE} + +(* + * Ignore input of even fields. + *) + DDVP_SKIPEVENFIELDS = $00000080; + {$EXTERNALSYM DDVP_SKIPEVENFIELDS} + +(* + * Ignore input of odd fields. + *) + DDVP_SKIPODDFIELDS = $00000100; + {$EXTERNALSYM DDVP_SKIPODDFIELDS} + +(* + * Drive the graphics VSYNCs using the video port VYSNCs. + *) + DDVP_SYNCMASTER = $00000200; + {$EXTERNALSYM DDVP_SYNCMASTER} + +(* + * The ddpfVBIOutputFormatFormat member contains data that should be used + * to convert the data within the vertical blanking interval. + *) + DDVP_VBICONVERT = $00000400; + {$EXTERNALSYM DDVP_VBICONVERT} + +(* + * Indicates that data within the vertical blanking interval + * should not be scaled. + *) + DDVP_VBINOSCALE = $00000800; + {$EXTERNALSYM DDVP_VBINOSCALE} + +(* + * Indicates that these bob/weave decisions should not be + * overriden by other interfaces. + *) + DDVP_OVERRIDEBOBWEAVE = $00001000; + {$EXTERNALSYM DDVP_OVERRIDEBOBWEAVE} + +(* + * Indicates that the video data should ignore the left and right + * cropping coordinates when cropping the VBI data. + *) + DDVP_IGNOREVBIXCROP = $00002000; + {$EXTERNALSYM DDVP_IGNOREVBIXCROP} + +(* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + *) + DDVP_VBINOINTERLEAVE = $00004000; + {$EXTERNALSYM DDVP_VBINOINTERLEAVE} + +(* + * Indicates that the video port should use the hardware + * de-interlacing hardware. + *) + DDVP_HARDWAREDEINTERLACE = $00008000; + {$EXTERNALSYM DDVP_HARDWAREDEINTERLACE} + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS + * + ****************************************************************************) + +(* + * Return formats for the video data + *) + DDVPFORMAT_VIDEO = $00000001; + {$EXTERNALSYM DDVPFORMAT_VIDEO} + +(* + * Return formats for the VBI data + *) + DDVPFORMAT_VBI = $00000002; + {$EXTERNALSYM DDVPFORMAT_VBI} + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS + * + ****************************************************************************) + +(* + * Surface should receive video data (and VBI data if a surface + * is not explicitly attached for that purpose) + *) + DDVPTARGET_VIDEO = $00000001; + {$EXTERNALSYM DDVPTARGET_VIDEO} + +(* + * Surface should receive VBI data + *) + DDVPTARGET_VBI = $00000002; + {$EXTERNALSYM DDVPTARGET_VBI} + + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS + * + ****************************************************************************) + +(* + * Waits until the beginning of the next VSYNC + *) + DDVPWAIT_BEGIN = $00000001; + {$EXTERNALSYM DDVPWAIT_BEGIN} + +(* + * Waits until the end of the next/current VSYNC + *) + DDVPWAIT_END = $00000002; + {$EXTERNALSYM DDVPWAIT_END} + +(* + * Waits until the beginning of the specified line + *) + DDVPWAIT_LINE = $00000003; + {$EXTERNALSYM DDVPWAIT_LINE} + +(**************************************************************************** + * + * DIRECTDRAWVIDEOPORT FLIP FLAGS + * + ****************************************************************************) + +(* + * Flips the normal video surface + *) + DDVPFLIP_VIDEO = $00000001; + {$EXTERNALSYM DDVPFLIP_VIDEO} + +(* + * Flips the VBI surface + *) + DDVPFLIP_VBI = $00000002; + {$EXTERNALSYM DDVPFLIP_VBI} + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES + * + ****************************************************************************) + +(* + * No video signal is present at the video port + *) + DDVPSQ_NOSIGNAL = $00000001; + {$EXTERNALSYM DDVPSQ_NOSIGNAL} + +(* + * A valid video signal is present at the video port + *) + DDVPSQ_SIGNALOK = $00000002; + {$EXTERNALSYM DDVPSQ_SIGNALOK} + +(**************************************************************************** + * + * 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; + {$EXTERNALSYM DDVPB_VIDEOPORT} + +(* + * The specified height/width refer to the source size of the overlay. + *) + DDVPB_OVERLAY = $00000002; + {$EXTERNALSYM DDVPB_OVERLAY} + +(* + * This is a query for the device to return which caps this device requires. + *) + DDVPB_TYPE = $00000004; + {$EXTERNALSYM DDVPB_TYPE} + +(**************************************************************************** + * + * VIDEOPORTBANDWIDTH Caps + * + ****************************************************************************) + +(* + * The bandwidth for this device is dependant on the overlay source size. + *) + DDVPBCAPS_SOURCE = $00000001; + {$EXTERNALSYM DDVPBCAPS_SOURCE} + +(* + * The bandwidth for this device is dependant on the overlay destination + * size. + *) + DDVPBCAPS_DESTINATION = $00000002; + {$EXTERNALSYM DDVPBCAPS_DESTINATION} + +(**************************************************************************** + * + * DDVIDEOPORTCONTAINER CreateVideoPort flags + * + ****************************************************************************) + +(* + * The process only wants to control the VBI portion of the video stream. + *) + DDVPCREATE_VBIONLY = $00000001; + {$EXTERNALSYM DDVPCREATE_VBIONLY} + +(* + * The process only wants to control the non-VBI (video) portion of + * the video stream. + *) + DDVPCREATE_VIDEOONLY = $00000002; + {$EXTERNALSYM DDVPCREATE_VIDEOONLY} + +(**************************************************************************** + * + * DDVIDEOPORTSTATUS flags + * + ****************************************************************************) + +(* + * The video port interface is only controlling the VBI portion of the + * video stream + *) + DDVPSTATUS_VBIONLY = $00000001; + {$EXTERNALSYM DDVPSTATUS_VBIONLY} + +(* + * The video port interface is only controlling the video portion of the + * video stream + *) + DDVPSTATUS_VIDEOONLY = $00000002; + {$EXTERNALSYM DDVPSTATUS_VIDEOONLY} + + +type +(* + * API's + *) + + TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps; + lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM TDDEnumVideoCallback} + +(* + * INTERACES FOLLOW: + * IDirectDrawVideoPort + * IVideoPort + *) + IDirectDrawVideoPort = interface; + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawVideoPort);'} + {$EXTERNALSYM IDirectDrawVideoPort} + +(* + * IDirectDrawVideoPortContainer + *) + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDDVideoPortContainer);'} + {$EXTERNALSYM IDDVideoPortContainer} + 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; + {$EXTERNALSYM IID_IDDVideoPortContainer} + IID_IDirectDrawVideoPort = IDirectDrawVideoPort; + {$EXTERNALSYM IID_IDirectDrawVideoPort} + +(* + * IDirectDrawVideoPort + *) + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectDrawVideoPortNotify);'} + {$EXTERNALSYM IDirectDrawVideoPortNotify} + 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; + + +var + DDrawDLL : HMODULE = 0; + +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(DDrawDLL,'DirectDrawCreate'); + DirectDrawCreateEx := GetProcAddress(DDrawDLL,'DirectDrawCreateEx'); + DirectDrawCreateClipper := GetProcAddress(DDrawDLL,'DirectDrawCreateClipper'); + {$IFDEF WINNT} + NtDirectDrawCreate := GetProcAddress(DDrawDLL,'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/Game/Code/lib/DSPack/DirectX9/DirectInput.pas b/Game/Code/lib/DSPack/DirectX9/DirectInput.pas new file mode 100644 index 00000000..145432ec --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DirectInput.pas @@ -0,0 +1,6524 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: dinput.h *} +{* Content: DirectInput include file *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 26-Jan-2003 *} +{* *} +{* 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.narod.ru/delphi *} +{* *} +{******************************************************************************} +{ } +{ 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 } +{ } +{******************************************************************************} + +// Original source contained in "DirectInput.par" + +/////////////////////////////////////////////////////////////////////////////// +// Notes: +//---------------------------------------------------------------------------- +// Possible input defines for this file, mapped to original C values: +// DIRECTINPUT_VERSION_8 : DIRECTINPUT_VERSION = 0x0800, +// DIRECTINPUT_VERSION_7 : DIRECTINPUT_VERSION = 0x0700, +// DIRECTINPUT_VERSION_5b : DIRECTINPUT_VERSION = 0x05b2, +// - in this translation we don't support DirectInput 5.0a (0x050a) version +// - just straight 5.0b (0x05b2) one. +// DIRECTINPUT_VERSION_5 : DIRECTINPUT_VERSION = 0x0500, +// DIRECTINPUT_VERSION_3 : DIRECTINPUT_VERSION = 0x0300, +// +// By default DIRECTINPUT_VERSION_8 (DIRECTINPUT_VERSION = 0x0800) is assumed +// +// Also you can use generic DIRECTXx defines, so: +// DIRECTX9 equal to DIRECTINPUT_VERSION_8; +// DIRECTX8 equal to DIRECTINPUT_VERSION_8; +// DIRECTX7 equal to DIRECTINPUT_VERSION_7; +// DIRECTX6 equal to DIRECTINPUT_VERSION_5; +// DIRECTX5 equal to DIRECTINPUT_VERSION_5; +// DIRECTX3 equal to DIRECTINPUT_VERSION_3 +/////////////////////////////////////////////////////////////////////////////// + +unit DirectInput; + +interface + +uses + Windows, MMSystem, DXTypes; + +{$I DirectX.inc} + +//////////////////////////////////////////////////////////////////////// +// Global level dynamic loading support +{$IFDEF DYNAMIC_LINK_ALL} + {$DEFINE DIRECTINPUT_DYNAMIC_LINK} +{$ENDIF} +{$IFDEF DYNAMIC_LINK_EXPLICIT_ALL} + {$DEFINE DIRECTINPUT_DYNAMIC_LINK_EXPLICIT} +{$ENDIF} + +// Remove "dots" below to force some kind of dynamic linking +{.$DEFINE DIRECTINPUT_DYNAMIC_LINK} +{.$DEFINE DIRECTINPUT_DYNAMIC_LINK_EXPLICIT} + +//////////////////////////////////////////////////////////////////////// +// Assume for what DirectInput version we will compile headers +{$IFDEF DIRECTX9} + {$DEFINE DIRECTINPUT_VERSION_8} +{$ENDIF} +{$IFDEF DIRECTX8} + {$DEFINE DIRECTINPUT_VERSION_8} +{$ENDIF} +{$IFDEF DIRECTX7} + {$DEFINE DIRECTINPUT_VERSION_7} +{$ENDIF} +{$IFDEF DIRECTX6} + {$DEFINE DIRECTINPUT_VERSION_5} +{$ENDIF} +{$IFDEF DIRECTX5} + {$DEFINE DIRECTINPUT_VERSION_5} +{$ENDIF} +{$IFDEF DIRECTX3} + {$DEFINE DIRECTINPUT_VERSION_3} +{$ENDIF} + +{$IFNDEF DIRECTINPUT_VERSION_8} + {$IFNDEF DIRECTINPUT_VERSION_7} + {$IFNDEF DIRECTINPUT_VERSION_5b} + {$IFNDEF DIRECTINPUT_VERSION_5} + {$IFNDEF DIRECTINPUT_VERSION_3} +// Compiling for DirectInput8 by default +{$DEFINE DIRECTINPUT_VERSION_8} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +//////////////////////////////////////////////////////////////////////// +// Define DirectInputVerrsion constant +const +{$IFDEF DIRECTINPUT_VERSION_8} + DIRECTINPUT_VERSION = $0800; +{$ELSE}{$IFDEF DIRECTINPUT_VERSION_7} + DIRECTINPUT_VERSION = $0700; +{$ELSE}{$IFDEF DIRECTINPUT_VERSION_5b} + DIRECTINPUT_VERSION = $05b2; +{$ELSE}{$IFDEF DIRECTINPUT_VERSION_5} + DIRECTINPUT_VERSION = $0500; +{$ELSE}{$IFDEF DIRECTINPUT_VERSION_3} + DIRECTINPUT_VERSION = $0300; +{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF} + {$EXTERNALSYM DIRECTINPUT_VERSION} + +//////////////////////////////////////////////////////////////////////// +// Emit conditionals to C++Builder compiler +{$IFDEF DIRECTINPUT_VERSION_3} + {$HPPEMIT '#define DIRECTINPUT_VERSION 0x0300'} +{$ENDIF} +{$IFDEF DIRECTINPUT_VERSION_5} + {$HPPEMIT '#define DIRECTINPUT_VERSION 0x0500'} +{$ENDIF} +{$IFDEF DIRECTINPUT_VERSION_5b} + {$HPPEMIT '#define DIRECTINPUT_VERSION 0x05b2'} +{$ENDIF} +{$IFDEF DIRECTINPUT_VERSION_7} + {$HPPEMIT '#define DIRECTINPUT_VERSION 0x0700'} +{$ENDIF} +{$IFDEF DIRECTINPUT_VERSION_8} + {$HPPEMIT '#define DIRECTINPUT_VERSION 0x0800'} +{$ENDIF} + +(*$NOINCLUDE DXTypes*) +(*$HPPEMIT '#include "dinput.h"' *) +(*$HPPEMIT '' *) + +//////////////////////////////////////////////////////////////////////// +// Define symbols for '<=' comparision +{$IFDEF DIRECTINPUT_VERSION_8} + {$DEFINE DIRECTINPUT_VERSION_7} +{$ENDIF} +{$IFDEF DIRECTINPUT_VERSION_7} + {$DEFINE DIRECTINPUT_VERSION_5b} +{$ENDIF} +{$IFDEF DIRECTINPUT_VERSION_5b} + {$DEFINE DIRECTINPUT_VERSION_5} +{$ENDIF} +{$IFDEF DIRECTINPUT_VERSION_5} + {$DEFINE DIRECTINPUT_VERSION_3} +{$ENDIF} + +(**************************************************************************** + * + * Copyright (C) 1996-2000 Microsoft Corporation. All Rights Reserved. + * + * File: dinput.h + * Content: DirectInput include file + * + ****************************************************************************) + + +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputEffect);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDeviceA);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDeviceW);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputA);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputW);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput2A);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput2W);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput7A);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput7W);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput8A);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput8W);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDeviceA);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDeviceW);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice2A);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice2W);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice7A);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice7W);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice8A);'} +{$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice8W);'} +{$HPPEMIT '#ifdef UNICODE'} +{$HPPEMIT 'typedef _di_IDirectInputW _di_IDirectInput;'} +{$HPPEMIT 'typedef _di_IDirectInput2W _di_IDirectInput2;'} +{$HPPEMIT 'typedef _di_IDirectInput7W _di_IDirectInput7;'} +{$HPPEMIT 'typedef _di_IDirectInput8W _di_IDirectInput8;'} +{$HPPEMIT 'typedef _di_IDirectInputDeviceW _di_IDirectInputDevice;'} +{$HPPEMIT 'typedef _di_IDirectInputDevice2W _di_IDirectInputDevice2;'} +{$HPPEMIT 'typedef _di_IDirectInputDevice7W _di_IDirectInputDevice7;'} +{$HPPEMIT 'typedef _di_IDirectInputDevice8W _di_IDirectInputDevice8;'} +{$HPPEMIT '#else'} +{$HPPEMIT 'typedef _di_IDirectInputA _di_IDirectInput;'} +{$HPPEMIT 'typedef _di_IDirectInput2A _di_IDirectInput2;'} +{$HPPEMIT 'typedef _di_IDirectInput7A _di_IDirectInput7;'} +{$HPPEMIT 'typedef _di_IDirectInput8A _di_IDirectInput8;'} +{$HPPEMIT 'typedef _di_IDirectInputDeviceA _di_IDirectInputDevice;'} +{$HPPEMIT 'typedef _di_IDirectInputDevice2A _di_IDirectInputDevice2;'} +{$HPPEMIT 'typedef _di_IDirectInputDevice7A _di_IDirectInputDevice7;'} +{$HPPEMIT 'typedef _di_IDirectInputDevice8A _di_IDirectInputDevice8;'} +{$HPPEMIT '#endif'} + + +(**************************************************************************** + * + * Class IDs + * + ****************************************************************************) + +const + CLSID_DirectInput : TGUID = '{25E609E0-B259-11CF-BFC7-444553540000}'; + {$EXTERNALSYM CLSID_DirectInput} + CLSID_DirectInputDevice : TGUID = '{25E609E1-B259-11CF-BFC7-444553540000}'; + {$EXTERNALSYM CLSID_DirectInputDevice} + + CLSID_DirectInput8 : TGUID = '{25E609E4-B259-11CF-BFC7-444553540000}'; + {$EXTERNALSYM CLSID_DirectInput8} + CLSID_DirectInputDevice8 : TGUID = '{25E609E5-B259-11CF-BFC7-444553540000}'; + {$EXTERNALSYM CLSID_DirectInputDevice8} + +(**************************************************************************** + * + * Interfaces + * + ****************************************************************************) + +const + IID_IDirectInputA : TGUID = '{89521360-AA8A-11CF-BFC7-444553540000}'; + {$EXTERNALSYM IID_IDirectInputA} + IID_IDirectInputW : TGUID = '{89521361-AA8A-11CF-BFC7-444553540000}'; + {$EXTERNALSYM IID_IDirectInputW} + IID_IDirectInput2A : TGUID = '{5944E662-AA8A-11CF-BFC7-444553540000}'; + {$EXTERNALSYM IID_IDirectInput2A} + IID_IDirectInput2W : TGUID = '{5944E663-AA8A-11CF-BFC7-444553540000}'; + {$EXTERNALSYM IID_IDirectInput2W} + IID_IDirectInput7A : TGUID = '{9A4CB684-236D-11D3-8E9D-00C04F6844AE}'; + {$EXTERNALSYM IID_IDirectInput7A} + IID_IDirectInput7W : TGUID = '{9A4CB685-236D-11D3-8E9D-00C04F6844AE}'; + {$EXTERNALSYM IID_IDirectInput7W} + IID_IDirectInput8A : TGUID = '{BF798030-483A-4DA2-AA99-5D64ED369700}'; + {$EXTERNALSYM IID_IDirectInput8A} + IID_IDirectInput8W : TGUID = '{BF798031-483A-4DA2-AA99-5D64ED369700}'; + {$EXTERNALSYM IID_IDirectInput8W} + IID_IDirectInputDeviceA : TGUID = '{5944E680-C92E-11CF-BFC7-444553540000}'; + {$EXTERNALSYM IID_IDirectInputDeviceA} + IID_IDirectInputDeviceW : TGUID = '{5944E681-C92E-11CF-BFC7-444553540000}'; + {$EXTERNALSYM IID_IDirectInputDeviceW} + IID_IDirectInputDevice2A : TGUID = '{5944E682-C92E-11CF-BFC7-444553540000}'; + {$EXTERNALSYM IID_IDirectInputDevice2A} + IID_IDirectInputDevice2W : TGUID = '{5944E683-C92E-11CF-BFC7-444553540000}'; + {$EXTERNALSYM IID_IDirectInputDevice2W} + IID_IDirectInputDevice7A : TGUID = '{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}'; + {$EXTERNALSYM IID_IDirectInputDevice7A} + IID_IDirectInputDevice7W : TGUID = '{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}'; + {$EXTERNALSYM IID_IDirectInputDevice7W} + IID_IDirectInputDevice8A : TGUID = '{54D41080-DC15-4833-A41B-748F73A38179}'; + {$EXTERNALSYM IID_IDirectInputDevice8A} + IID_IDirectInputDevice8W : TGUID = '{54D41081-DC15-4833-A41B-748F73A38179}'; + {$EXTERNALSYM IID_IDirectInputDevice8W} + IID_IDirectInputEffect : TGUID = '{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM IID_IDirectInputEffect} + + // String constants for Interface IDs + SID_IDirectInputA = '{89521360-AA8A-11CF-BFC7-444553540000}'; + SID_IDirectInputW = '{89521361-AA8A-11CF-BFC7-444553540000}'; + SID_IDirectInput2A = '{5944E662-AA8A-11CF-BFC7-444553540000}'; + SID_IDirectInput2W = '{5944E663-AA8A-11CF-BFC7-444553540000}'; + SID_IDirectInput7A = '{9A4CB684-236D-11D3-8E9D-00C04F6844AE}'; + SID_IDirectInput7W = '{9A4CB685-236D-11D3-8E9D-00C04F6844AE}'; + SID_IDirectInput8A = '{BF798030-483A-4DA2-AA99-5D64ED369700}'; + SID_IDirectInput8W = '{BF798031-483A-4DA2-AA99-5D64ED369700}'; + SID_IDirectInputDeviceA = '{5944E680-C92E-11CF-BFC7-444553540000}'; + SID_IDirectInputDeviceW = '{5944E681-C92E-11CF-BFC7-444553540000}'; + SID_IDirectInputDevice2A = '{5944E682-C92E-11CF-BFC7-444553540000}'; + SID_IDirectInputDevice2W = '{5944E683-C92E-11CF-BFC7-444553540000}'; + SID_IDirectInputDevice7A = '{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}'; + SID_IDirectInputDevice7W = '{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}'; + SID_IDirectInputDevice8A = '{54D41080-DC15-4833-A41B-748F73A38179}'; + SID_IDirectInputDevice8W = '{54D41081-DC15-4833-A41B-748F73A38179}'; + SID_IDirectInputEffect = '{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}'; + +(**************************************************************************** + * + * Predefined object types + * + ****************************************************************************) + +const + GUID_XAxis : TGUID = '{A36D02E0-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_XAxis} + GUID_YAxis : TGUID = '{A36D02E1-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_YAxis} + GUID_ZAxis : TGUID = '{A36D02E2-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_ZAxis} + GUID_RxAxis : TGUID = '{A36D02F4-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_RxAxis} + GUID_RyAxis : TGUID = '{A36D02F5-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_RyAxis} + GUID_RzAxis : TGUID = '{A36D02E3-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_RzAxis} + GUID_Slider : TGUID = '{A36D02E4-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_Slider} + + GUID_Button : TGUID = '{A36D02F0-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_Button} + GUID_Key : TGUID = '{55728220-D33C-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_Key} + + GUID_POV : TGUID = '{A36D02F2-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_POV} + + GUID_Unknown : TGUID = '{A36D02F3-C9F3-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_Unknown} + +(**************************************************************************** + * + * Predefined product GUIDs + * + ****************************************************************************) + +const + GUID_SysMouse : TGUID = '{6F1D2B60-D5A0-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_SysMouse} + GUID_SysKeyboard : TGUID = '{6F1D2B61-D5A0-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_SysKeyboard} + GUID_Joystick : TGUID = '{6F1D2B70-D5A0-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_Joystick} + GUID_SysMouseEm : TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_SysMouseEm} + GUID_SysMouseEm2 : TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_SysMouseEm2} + GUID_SysKeyboardEm : TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_SysKeyboardEm} + GUID_SysKeyboardEm2 : TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}'; + {$EXTERNALSYM GUID_SysKeyboardEm2} + +(**************************************************************************** + * + * Predefined force feedback effects + * + ****************************************************************************) + +const + GUID_ConstantForce : TGUID = '{13541C20-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_ConstantForce} + GUID_RampForce : TGUID = '{13541C21-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_RampForce} + GUID_Square : TGUID = '{13541C22-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_Square} + GUID_Sine : TGUID = '{13541C23-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_Sine} + GUID_Triangle : TGUID = '{13541C24-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_Triangle} + GUID_SawtoothUp : TGUID = '{13541C25-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_SawtoothUp} + GUID_SawtoothDown : TGUID = '{13541C26-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_SawtoothDown} + GUID_Spring : TGUID = '{13541C27-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_Spring} + GUID_Damper : TGUID = '{13541C28-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_Damper} + GUID_Inertia : TGUID = '{13541C29-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_Inertia} + GUID_Friction : TGUID = '{13541C2A-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_Friction} + GUID_CustomForce : TGUID = '{13541C2B-8E33-11D0-9AD0-00A0C9A06E35}'; + {$EXTERNALSYM GUID_CustomForce} + + +(**************************************************************************** + * + * Interfaces and Structures... + * + ****************************************************************************) + +{$IFDEF DIRECTINPUT_VERSION_5} + +(**************************************************************************** + * + * IDirectInputEffect + * + ****************************************************************************) + +const + DIEFT_ALL = $00000000; + {$EXTERNALSYM DIEFT_ALL} + + DIEFT_CONSTANTFORCE = $00000001; + {$EXTERNALSYM DIEFT_CONSTANTFORCE} + DIEFT_RAMPFORCE = $00000002; + {$EXTERNALSYM DIEFT_RAMPFORCE} + DIEFT_PERIODIC = $00000003; + {$EXTERNALSYM DIEFT_PERIODIC} + DIEFT_CONDITION = $00000004; + {$EXTERNALSYM DIEFT_CONDITION} + DIEFT_CUSTOMFORCE = $00000005; + {$EXTERNALSYM DIEFT_CUSTOMFORCE} + DIEFT_HARDWARE = $000000FF; + {$EXTERNALSYM DIEFT_HARDWARE} + DIEFT_FFATTACK = $00000200; + {$EXTERNALSYM DIEFT_FFATTACK} + DIEFT_FFFADE = $00000400; + {$EXTERNALSYM DIEFT_FFFADE} + DIEFT_SATURATION = $00000800; + {$EXTERNALSYM DIEFT_SATURATION} + DIEFT_POSNEGCOEFFICIENTS = $00001000; + {$EXTERNALSYM DIEFT_POSNEGCOEFFICIENTS} + DIEFT_POSNEGSATURATION = $00002000; + {$EXTERNALSYM DIEFT_POSNEGSATURATION} + DIEFT_DEADBAND = $00004000; + {$EXTERNALSYM DIEFT_DEADBAND} + DIEFT_STARTDELAY = $00008000; + {$EXTERNALSYM DIEFT_STARTDELAY} + +//#define DIEFT_GETTYPE(n) LOBYTE(n) +function DIEFT_GETTYPE(n: Cardinal): Byte; +{$EXTERNALSYM DIEFT_GETTYPE} + +const + DI_DEGREES = 100; + {$EXTERNALSYM DI_DEGREES} + DI_FFNOMINALMAX = 10000; + {$EXTERNALSYM DI_FFNOMINALMAX} + DI_SECONDS = 1000000; + {$EXTERNALSYM DI_SECONDS} + +type + PDIConstantForce = ^TDIConstantForce; + DICONSTANTFORCE = packed record + lMagnitude: Longint; + end; + {$EXTERNALSYM DICONSTANTFORCE} + TDIConstantForce = DICONSTANTFORCE; + + PDIRampForce = ^TDIRampForce; + DIRAMPFORCE = packed record + lStart: Longint; + lEnd: Longint; + end; + {$EXTERNALSYM DIRAMPFORCE} + TDIRampForce = DIRAMPFORCE; + + PDIPeriodic = ^TDIPeriodic; + DIPERIODIC = packed record + dwMagnitude: DWORD; + lOffset: Longint; + dwPhase: DWORD; + dwPeriod: DWORD; + end; + {$EXTERNALSYM DIPERIODIC} + TDIPeriodic = DIPERIODIC; + + PDICondition = ^TDICondition; + DICONDITION = packed record + lOffset: Longint; + lPositiveCoefficient: Longint; + lNegativeCoefficient: Longint; + dwPositiveSaturation: DWORD; + dwNegativeSaturation: DWORD; + lDeadBand: Longint; + end; + {$EXTERNALSYM DICONDITION} + TDICondition = DICONDITION; + + PDICustomForce = ^TDICustomForce; + DICUSTOMFORCE = packed record + cChannels: DWORD; + dwSamplePeriod: DWORD; + cSamples: DWORD; + rglForceData: PLongint; + end; + {$EXTERNALSYM DICUSTOMFORCE} + TDICustomForce = DICUSTOMFORCE; + + PDIEnvelope = ^TDIEnvelope; + DIENVELOPE = packed record + dwSize: DWORD; (* sizeof(DIENVELOPE) *) + dwAttackLevel: DWORD; + dwAttackTime: DWORD; (* Microseconds *) + dwFadeLevel: DWORD; + dwFadeTime: DWORD; (* Microseconds *) + end; + {$EXTERNALSYM DIENVELOPE} + TDIEnvelope = DIENVELOPE; + + +(* This structure is defined for DirectX 5.0 compatibility *) + PDIEffectDX5 = ^TDIEffectDX5; + DIEFFECT_DX5 = packed record + dwSize: DWORD; (* sizeof(DIEFFECT_DX5) *) + dwFlags: DWORD; (* DIEFF_* *) + dwDuration: DWORD; (* Microseconds *) + dwSamplePeriod: DWORD; (* Microseconds *) + dwGain: DWORD; + dwTriggerButton: DWORD; (* or DIEB_NOTRIGGER *) + dwTriggerRepeatInterval: DWORD; (* Microseconds *) + cAxes: DWORD; (* Number of axes *) + rgdwAxes: PDWORD; (* Array of axes *) + rglDirection: PLongint; (* Array of directions *) + lpEnvelope: PDIEnvelope; (* Optional *) + cbTypeSpecificParams: DWORD; (* Size of params *) + lpvTypeSpecificParams: Pointer; (* Pointer to params *) + end; + {$EXTERNALSYM DIEFFECT_DX5} + TDIEffectDX5 = DIEFFECT_DX5; + + PDIEffect = ^TDIEffect; + DIEFFECT = packed record + dwSize: DWORD; (* sizeof(DIEFFECT) *) + dwFlags: DWORD; (* DIEFF_* *) + dwDuration: DWORD; (* Microseconds *) + dwSamplePeriod: DWORD; (* Microseconds *) + dwGain: DWORD; + dwTriggerButton: DWORD; (* or DIEB_NOTRIGGER *) + dwTriggerRepeatInterval: DWORD; (* Microseconds *) + cAxes: DWORD; (* Number of axes *) + rgdwAxes: PDWORD; (* Array of axes *) + rglDirection: PLongint; (* Array of directions *) + lpEnvelope: PDIEnvelope; (* Optional *) + cbTypeSpecificParams: DWORD; (* Size of params *) + lpvTypeSpecificParams: Pointer; (* Pointer to params *) +{$IFDEF DIRECTINPUT_VERSION_6} + dwStartDelay: DWORD; (* Microseconds *) +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0600 *) + end; + {$EXTERNALSYM DIEFFECT} + TDIEffect = DIEFFECT; + + DIEFFECT_DX6 = DIEFFECT; + {$EXTERNALSYM DIEFFECT_DX6} + TDIEffectDX6 = DIEFFECT_DX6; + PDIEffectDX6 = ^TDIEffectDX6; + +{$IFDEF DIRECTINPUT_VERSION_7} + PDIFileEffect = ^TDIFileEffect; + DIFILEEFFECT = packed record + dwSize: DWORD; + GuidEffect: TGUID; + lpDiEffect: PDIEffect; + szFriendlyName: array [0..MAX_PATH-1] of Char; + end; + {$EXTERNALSYM DIFILEEFFECT} + TDIFileEffect = DIFILEEFFECT; + + TDIEnumEffectsInFileCallback = function (const Effect: TDIFileEffect; Data: Pointer): BOOL; stdcall; + {$NODEFINE TDIEnumEffectsInFileCallback} + {$HPPEMIT 'typedef LPDIENUMEFFECTSINFILECALLBACK TDIEnumEffectsInFileCallback;'} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *) + +const + DIEFF_OBJECTIDS = $00000001; + {$EXTERNALSYM DIEFF_OBJECTIDS} + DIEFF_OBJECTOFFSETS = $00000002; + {$EXTERNALSYM DIEFF_OBJECTOFFSETS} + DIEFF_CARTESIAN = $00000010; + {$EXTERNALSYM DIEFF_CARTESIAN} + DIEFF_POLAR = $00000020; + {$EXTERNALSYM DIEFF_POLAR} + DIEFF_SPHERICAL = $00000040; + {$EXTERNALSYM DIEFF_SPHERICAL} + + DIEP_DURATION = $00000001; + {$EXTERNALSYM DIEP_DURATION} + DIEP_SAMPLEPERIOD = $00000002; + {$EXTERNALSYM DIEP_SAMPLEPERIOD} + DIEP_GAIN = $00000004; + {$EXTERNALSYM DIEP_GAIN} + DIEP_TRIGGERBUTTON = $00000008; + {$EXTERNALSYM DIEP_TRIGGERBUTTON} + DIEP_TRIGGERREPEATINTERVAL = $00000010; + {$EXTERNALSYM DIEP_TRIGGERREPEATINTERVAL} + DIEP_AXES = $00000020; + {$EXTERNALSYM DIEP_AXES} + DIEP_DIRECTION = $00000040; + {$EXTERNALSYM DIEP_DIRECTION} + DIEP_ENVELOPE = $00000080; + {$EXTERNALSYM DIEP_ENVELOPE} + DIEP_TYPESPECIFICPARAMS = $00000100; + {$EXTERNALSYM DIEP_TYPESPECIFICPARAMS} +{$IFDEF DIRECTINPUT_VERSION_6} + DIEP_STARTDELAY = $00000200; + {$EXTERNALSYM DIEP_STARTDELAY} + DIEP_ALLPARAMS_DX5 = $000001FF; + {$EXTERNALSYM DIEP_ALLPARAMS_DX5} + DIEP_ALLPARAMS = $000003FF; + {$EXTERNALSYM DIEP_ALLPARAMS} +{$ELSE} (* DIRECTINPUT_VERSION < 0x0600 *) + DIEP_ALLPARAMS = $000001FF; + {$EXTERNALSYM DIEP_ALLPARAMS} +{$ENDIF} (* DIRECTINPUT_VERSION ? 0x0600 *) + DIEP_START = $20000000; + {$EXTERNALSYM DIEP_START} + DIEP_NORESTART = $40000000; + {$EXTERNALSYM DIEP_NORESTART} + DIEP_NODOWNLOAD = $80000000; + {$EXTERNALSYM DIEP_NODOWNLOAD} + DIEB_NOTRIGGER = $FFFFFFFF; + {$EXTERNALSYM DIEB_NOTRIGGER} + + DIES_SOLO = $00000001; + {$EXTERNALSYM DIES_SOLO} + DIES_NODOWNLOAD = $80000000; + {$EXTERNALSYM DIES_NODOWNLOAD} + + DIEGES_PLAYING = $00000001; + {$EXTERNALSYM DIEGES_PLAYING} + DIEGES_EMULATED = $00000002; + {$EXTERNALSYM DIEGES_EMULATED} + +type + PDIEffEscape = ^TDIEffEscape; + DIEFFESCAPE = packed record + dwSize: DWORD; + dwCommand: DWORD; + lpvInBuffer: Pointer; + cbInBuffer: DWORD; + lpvOutBuffer: Pointer; + cbOutBuffer: DWORD; + end; + {$EXTERNALSYM DIEFFESCAPE} + TDIEffEscape = DIEFFESCAPE; + + +type + {$EXTERNALSYM IDirectInputEffect} + IDirectInputEffect = interface(IUnknown) + [SID_IDirectInputEffect] + (*** IDirectInputEffect methods ***) + function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall; + function GetEffectGuid(out pguid: TGUID): HResult; stdcall; + function GetParameters(var peff: TDIEffect; dwFlags: DWORD): HResult; stdcall; + function SetParameters(const peff: TDIEffect; dwFlags: DWORD): HResult; stdcall; + function Start(dwIterations, dwFlags: DWORD): HResult; stdcall; + function Stop: HResult; stdcall; + function GetEffectStatus(out pdwFlags: DWORD): HResult; stdcall; + function Download: HResult; stdcall; + function Unload: HResult; stdcall; + function Escape(var pesc: PDIEffEscape): HResult; stdcall; + end; + +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + +(**************************************************************************** + * + * IDirectInputDevice + * + ****************************************************************************) + +const +{$IFNDEF DIRECTINPUT_VERSION_8} (* #if DIRECTINPUT_VERSION <= 0x700 *) + DIDEVTYPE_DEVICE = 1; + {$EXTERNALSYM DIDEVTYPE_DEVICE} + DIDEVTYPE_MOUSE = 2; + {$EXTERNALSYM DIDEVTYPE_MOUSE} + DIDEVTYPE_KEYBOARD = 3; + {$EXTERNALSYM DIDEVTYPE_KEYBOARD} + DIDEVTYPE_JOYSTICK = 4; + {$EXTERNALSYM DIDEVTYPE_JOYSTICK} +{$ELSE} + DI8DEVCLASS_ALL = 0; + {$EXTERNALSYM DI8DEVCLASS_ALL} + DI8DEVCLASS_DEVICE = 1; + {$EXTERNALSYM DI8DEVCLASS_DEVICE} + DI8DEVCLASS_POINTER = 2; + {$EXTERNALSYM DI8DEVCLASS_POINTER} + DI8DEVCLASS_KEYBOARD = 3; + {$EXTERNALSYM DI8DEVCLASS_KEYBOARD} + DI8DEVCLASS_GAMECTRL = 4; + {$EXTERNALSYM DI8DEVCLASS_GAMECTRL} + + DI8DEVTYPE_DEVICE = $11; + {$EXTERNALSYM DI8DEVTYPE_DEVICE} + DI8DEVTYPE_MOUSE = $12; + {$EXTERNALSYM DI8DEVTYPE_MOUSE} + DI8DEVTYPE_KEYBOARD = $13; + {$EXTERNALSYM DI8DEVTYPE_KEYBOARD} + DI8DEVTYPE_JOYSTICK = $14; + {$EXTERNALSYM DI8DEVTYPE_JOYSTICK} + DI8DEVTYPE_GAMEPAD = $15; + {$EXTERNALSYM DI8DEVTYPE_GAMEPAD} + DI8DEVTYPE_DRIVING = $16; + {$EXTERNALSYM DI8DEVTYPE_DRIVING} + DI8DEVTYPE_FLIGHT = $17; + {$EXTERNALSYM DI8DEVTYPE_FLIGHT} + DI8DEVTYPE_1STPERSON = $18; + {$EXTERNALSYM DI8DEVTYPE_1STPERSON} + DI8DEVTYPE_DEVICECTRL = $19; + {$EXTERNALSYM DI8DEVTYPE_DEVICECTRL} + DI8DEVTYPE_SCREENPOINTER = $1A; + {$EXTERNALSYM DI8DEVTYPE_SCREENPOINTER} + DI8DEVTYPE_REMOTE = $1B; + {$EXTERNALSYM DI8DEVTYPE_REMOTE} + DI8DEVTYPE_SUPPLEMENTAL = $1C; + {$EXTERNALSYM DI8DEVTYPE_SUPPLEMENTAL} +{$ENDIF} (* DIRECTINPUT_VERSION <= 0x700 *) + + DIDEVTYPE_HID = $00010000; + {$EXTERNALSYM DIDEVTYPE_HID} + +{$IFNDEF DIRECTINPUT_VERSION_8} (* #if DIRECTINPUT_VERSION <= 0x700 *) + DIDEVTYPEMOUSE_UNKNOWN = 1; + {$EXTERNALSYM DIDEVTYPEMOUSE_UNKNOWN} + DIDEVTYPEMOUSE_TRADITIONAL = 2; + {$EXTERNALSYM DIDEVTYPEMOUSE_TRADITIONAL} + DIDEVTYPEMOUSE_FINGERSTICK = 3; + {$EXTERNALSYM DIDEVTYPEMOUSE_FINGERSTICK} + DIDEVTYPEMOUSE_TOUCHPAD = 4; + {$EXTERNALSYM DIDEVTYPEMOUSE_TOUCHPAD} + DIDEVTYPEMOUSE_TRACKBALL = 5; + {$EXTERNALSYM DIDEVTYPEMOUSE_TRACKBALL} + + DIDEVTYPEKEYBOARD_UNKNOWN = 0; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_UNKNOWN} + DIDEVTYPEKEYBOARD_PCXT = 1; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_PCXT} + DIDEVTYPEKEYBOARD_OLIVETTI = 2; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_OLIVETTI} + DIDEVTYPEKEYBOARD_PCAT = 3; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_PCAT} + DIDEVTYPEKEYBOARD_PCENH = 4; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_PCENH} + DIDEVTYPEKEYBOARD_NOKIA1050 = 5; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_NOKIA1050} + DIDEVTYPEKEYBOARD_NOKIA9140 = 6; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_NOKIA9140} + DIDEVTYPEKEYBOARD_NEC98 = 7; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_NEC98} + DIDEVTYPEKEYBOARD_NEC98LAPTOP = 8; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_NEC98LAPTOP} + DIDEVTYPEKEYBOARD_NEC98106 = 9; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_NEC98106} + DIDEVTYPEKEYBOARD_JAPAN106 = 10; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_JAPAN106} + DIDEVTYPEKEYBOARD_JAPANAX = 11; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_JAPANAX} + DIDEVTYPEKEYBOARD_J3100 = 12; + {$EXTERNALSYM DIDEVTYPEKEYBOARD_J3100} + + DIDEVTYPEJOYSTICK_UNKNOWN = 1; + {$EXTERNALSYM DIDEVTYPEJOYSTICK_UNKNOWN} + DIDEVTYPEJOYSTICK_TRADITIONAL = 2; + {$EXTERNALSYM DIDEVTYPEJOYSTICK_TRADITIONAL} + DIDEVTYPEJOYSTICK_FLIGHTSTICK = 3; + {$EXTERNALSYM DIDEVTYPEJOYSTICK_FLIGHTSTICK} + DIDEVTYPEJOYSTICK_GAMEPAD = 4; + {$EXTERNALSYM DIDEVTYPEJOYSTICK_GAMEPAD} + DIDEVTYPEJOYSTICK_RUDDER = 5; + {$EXTERNALSYM DIDEVTYPEJOYSTICK_RUDDER} + DIDEVTYPEJOYSTICK_WHEEL = 6; + {$EXTERNALSYM DIDEVTYPEJOYSTICK_WHEEL} + DIDEVTYPEJOYSTICK_HEADTRACKER = 7; + {$EXTERNALSYM DIDEVTYPEJOYSTICK_HEADTRACKER} +{$ELSE} + DI8DEVTYPEMOUSE_UNKNOWN = 1; + {$EXTERNALSYM DI8DEVTYPEMOUSE_UNKNOWN} + DI8DEVTYPEMOUSE_TRADITIONAL = 2; + {$EXTERNALSYM DI8DEVTYPEMOUSE_TRADITIONAL} + DI8DEVTYPEMOUSE_FINGERSTICK = 3; + {$EXTERNALSYM DI8DEVTYPEMOUSE_FINGERSTICK} + DI8DEVTYPEMOUSE_TOUCHPAD = 4; + {$EXTERNALSYM DI8DEVTYPEMOUSE_TOUCHPAD} + DI8DEVTYPEMOUSE_TRACKBALL = 5; + {$EXTERNALSYM DI8DEVTYPEMOUSE_TRACKBALL} + DI8DEVTYPEMOUSE_ABSOLUTE = 6; + {$EXTERNALSYM DI8DEVTYPEMOUSE_ABSOLUTE} + + DI8DEVTYPEKEYBOARD_UNKNOWN = 0; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_UNKNOWN} + DI8DEVTYPEKEYBOARD_PCXT = 1; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_PCXT} + DI8DEVTYPEKEYBOARD_OLIVETTI = 2; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_OLIVETTI} + DI8DEVTYPEKEYBOARD_PCAT = 3; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_PCAT} + DI8DEVTYPEKEYBOARD_PCENH = 4; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_PCENH} + DI8DEVTYPEKEYBOARD_NOKIA1050 = 5; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NOKIA1050} + DI8DEVTYPEKEYBOARD_NOKIA9140 = 6; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NOKIA9140} + DI8DEVTYPEKEYBOARD_NEC98 = 7; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NEC98} + DI8DEVTYPEKEYBOARD_NEC98LAPTOP = 8; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NEC98LAPTOP} + DI8DEVTYPEKEYBOARD_NEC98106 = 9; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NEC98106} + DI8DEVTYPEKEYBOARD_JAPAN106 = 10; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_JAPAN106} + DI8DEVTYPEKEYBOARD_JAPANAX = 11; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_JAPANAX} + DI8DEVTYPEKEYBOARD_J3100 = 12; + {$EXTERNALSYM DI8DEVTYPEKEYBOARD_J3100} + + DI8DEVTYPE_LIMITEDGAMESUBTYPE = 1; + {$EXTERNALSYM DI8DEVTYPE_LIMITEDGAMESUBTYPE} + + DI8DEVTYPEJOYSTICK_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE; + {$EXTERNALSYM DI8DEVTYPEJOYSTICK_LIMITED} + DI8DEVTYPEJOYSTICK_STANDARD = 2; + {$EXTERNALSYM DI8DEVTYPEJOYSTICK_STANDARD} + + DI8DEVTYPEGAMEPAD_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE; + {$EXTERNALSYM DI8DEVTYPEGAMEPAD_LIMITED} + DI8DEVTYPEGAMEPAD_STANDARD = 2; + {$EXTERNALSYM DI8DEVTYPEGAMEPAD_STANDARD} + DI8DEVTYPEGAMEPAD_TILT = 3; + {$EXTERNALSYM DI8DEVTYPEGAMEPAD_TILT} + + DI8DEVTYPEDRIVING_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE; + {$EXTERNALSYM DI8DEVTYPEDRIVING_LIMITED} + DI8DEVTYPEDRIVING_COMBINEDPEDALS = 2; + {$EXTERNALSYM DI8DEVTYPEDRIVING_COMBINEDPEDALS} + DI8DEVTYPEDRIVING_DUALPEDALS = 3; + {$EXTERNALSYM DI8DEVTYPEDRIVING_DUALPEDALS} + DI8DEVTYPEDRIVING_THREEPEDALS = 4; + {$EXTERNALSYM DI8DEVTYPEDRIVING_THREEPEDALS} + DI8DEVTYPEDRIVING_HANDHELD = 5; + {$EXTERNALSYM DI8DEVTYPEDRIVING_HANDHELD} + + DI8DEVTYPEFLIGHT_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE; + {$EXTERNALSYM DI8DEVTYPEFLIGHT_LIMITED} + DI8DEVTYPEFLIGHT_STICK = 2; + {$EXTERNALSYM DI8DEVTYPEFLIGHT_STICK} + DI8DEVTYPEFLIGHT_YOKE = 3; + {$EXTERNALSYM DI8DEVTYPEFLIGHT_YOKE} + DI8DEVTYPEFLIGHT_RC = 4; + {$EXTERNALSYM DI8DEVTYPEFLIGHT_RC} + + DI8DEVTYPE1STPERSON_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE; + {$EXTERNALSYM DI8DEVTYPE1STPERSON_LIMITED} + DI8DEVTYPE1STPERSON_UNKNOWN = 2; + {$EXTERNALSYM DI8DEVTYPE1STPERSON_UNKNOWN} + DI8DEVTYPE1STPERSON_SIXDOF = 3; + {$EXTERNALSYM DI8DEVTYPE1STPERSON_SIXDOF} + DI8DEVTYPE1STPERSON_SHOOTER = 4; + {$EXTERNALSYM DI8DEVTYPE1STPERSON_SHOOTER} + + DI8DEVTYPESCREENPTR_UNKNOWN = 2; + {$EXTERNALSYM DI8DEVTYPESCREENPTR_UNKNOWN} + DI8DEVTYPESCREENPTR_LIGHTGUN = 3; + {$EXTERNALSYM DI8DEVTYPESCREENPTR_LIGHTGUN} + DI8DEVTYPESCREENPTR_LIGHTPEN = 4; + {$EXTERNALSYM DI8DEVTYPESCREENPTR_LIGHTPEN} + DI8DEVTYPESCREENPTR_TOUCH = 5; + {$EXTERNALSYM DI8DEVTYPESCREENPTR_TOUCH} + + DI8DEVTYPEREMOTE_UNKNOWN = 2; + {$EXTERNALSYM DI8DEVTYPEREMOTE_UNKNOWN} + + DI8DEVTYPEDEVICECTRL_UNKNOWN = 2; + {$EXTERNALSYM DI8DEVTYPEDEVICECTRL_UNKNOWN} + DI8DEVTYPEDEVICECTRL_COMMSSELECTION = 3; + {$EXTERNALSYM DI8DEVTYPEDEVICECTRL_COMMSSELECTION} + DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED = 4; + {$EXTERNALSYM DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED} + + DI8DEVTYPESUPPLEMENTAL_UNKNOWN = 2; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_UNKNOWN} + DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER = 3; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER} + DI8DEVTYPESUPPLEMENTAL_HEADTRACKER = 4; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_HEADTRACKER} + DI8DEVTYPESUPPLEMENTAL_HANDTRACKER = 5; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_HANDTRACKER} + DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE = 6; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE} + DI8DEVTYPESUPPLEMENTAL_SHIFTER = 7; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_SHIFTER} + DI8DEVTYPESUPPLEMENTAL_THROTTLE = 8; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_THROTTLE} + DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE = 9; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE} + DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS = 10; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS} + DI8DEVTYPESUPPLEMENTAL_DUALPEDALS = 11; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_DUALPEDALS} + DI8DEVTYPESUPPLEMENTAL_THREEPEDALS = 12; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_THREEPEDALS} + DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS = 13; + {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS} +{$ENDIF} (* DIRECTINPUT_VERSION <= 0x700 *) + +// #define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) +function GET_DIDEVICE_TYPE(dwDevType: DWORD): Byte; +{$EXTERNALSYM GET_DIDEVICE_TYPE} +// #define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) +function GET_DIDEVICE_SUBTYPE(dwDevType: DWORD): Byte; +{$EXTERNALSYM GET_DIDEVICE_SUBTYPE} + +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) +(* This structure is defined for DirectX 3.0 compatibility *) +type + PDIDevCapsDX3 = ^TDIDevCapsDX3; + DIDEVCAPS_DX3 = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwDevType: DWORD; + dwAxes: DWORD; + dwButtons: DWORD; + dwPOVs: DWORD; + end; + {$EXTERNALSYM DIDEVCAPS_DX3} + TDIDevCapsDX3 = DIDEVCAPS_DX3; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + + PDIDevCaps = ^TDIDevCaps; + DIDEVCAPS = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwDevType: DWORD; + dwAxes: DWORD; + dwButtons: DWORD; + dwPOVs: DWORD; +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + dwFFSamplePeriod: DWORD; + dwFFMinTimeResolution: DWORD; + dwFirmwareRevision: DWORD; + dwHardwareRevision: DWORD; + dwFFDriverVersion: DWORD; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + end; + {$EXTERNALSYM DIDEVCAPS} + TDIDevCaps = DIDEVCAPS; + +const + DIDC_ATTACHED = $00000001; + {$EXTERNALSYM DIDC_ATTACHED} + DIDC_POLLEDDEVICE = $00000002; + {$EXTERNALSYM DIDC_POLLEDDEVICE} + DIDC_EMULATED = $00000004; + {$EXTERNALSYM DIDC_EMULATED} + DIDC_POLLEDDATAFORMAT = $00000008; + {$EXTERNALSYM DIDC_POLLEDDATAFORMAT} +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + DIDC_FORCEFEEDBACK = $00000100; + {$EXTERNALSYM DIDC_FORCEFEEDBACK} + DIDC_FFATTACK = $00000200; + {$EXTERNALSYM DIDC_FFATTACK} + DIDC_FFFADE = $00000400; + {$EXTERNALSYM DIDC_FFFADE} + DIDC_SATURATION = $00000800; + {$EXTERNALSYM DIDC_SATURATION} + DIDC_POSNEGCOEFFICIENTS = $00001000; + {$EXTERNALSYM DIDC_POSNEGCOEFFICIENTS} + DIDC_POSNEGSATURATION = $00002000; + {$EXTERNALSYM DIDC_POSNEGSATURATION} + DIDC_DEADBAND = $00004000; + {$EXTERNALSYM DIDC_DEADBAND} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + DIDC_STARTDELAY = $00008000; + {$EXTERNALSYM DIDC_STARTDELAY} +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) + DIDC_ALIAS = $00010000; + {$EXTERNALSYM DIDC_ALIAS} + DIDC_PHANTOM = $00020000; + {$EXTERNALSYM DIDC_PHANTOM} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) + DIDC_HIDDEN = $00040000; + {$EXTERNALSYM DIDC_HIDDEN} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + + DIDFT_ALL = $00000000; + {$EXTERNALSYM DIDFT_ALL} + + DIDFT_RELAXIS = $00000001; + {$EXTERNALSYM DIDFT_RELAXIS} + DIDFT_ABSAXIS = $00000002; + {$EXTERNALSYM DIDFT_ABSAXIS} + DIDFT_AXIS = $00000003; + {$EXTERNALSYM DIDFT_AXIS} + + DIDFT_PSHBUTTON = $00000004; + {$EXTERNALSYM DIDFT_PSHBUTTON} + DIDFT_TGLBUTTON = $00000008; + {$EXTERNALSYM DIDFT_TGLBUTTON} + DIDFT_BUTTON = $0000000C; + {$EXTERNALSYM DIDFT_BUTTON} + + DIDFT_POV = $00000010; + {$EXTERNALSYM DIDFT_POV} + DIDFT_COLLECTION = $00000040; + {$EXTERNALSYM DIDFT_COLLECTION} + DIDFT_NODATA = $00000080; + {$EXTERNALSYM DIDFT_NODATA} + + DIDFT_ANYINSTANCE = $00FFFF00; + {$EXTERNALSYM DIDFT_ANYINSTANCE} + DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE; + {$EXTERNALSYM DIDFT_INSTANCEMASK} + +// #define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8) +function DIDFT_MAKEINSTANCE(n: Cardinal): Cardinal; +{$EXTERNALSYM DIDFT_MAKEINSTANCE} +// #define DIDFT_GETTYPE(n) LOBYTE(n) +function DIDFT_GETTYPE(n: Cardinal): Byte; +{$EXTERNALSYM DIDFT_GETTYPE} +// #define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8) +function DIDFT_GETINSTANCE(n: Cardinal): Cardinal; +{$EXTERNALSYM DIDFT_GETINSTANCE} + +const + DIDFT_FFACTUATOR = $01000000; + {$EXTERNALSYM DIDFT_FFACTUATOR} + DIDFT_FFEFFECTTRIGGER = $02000000; + {$EXTERNALSYM DIDFT_FFEFFECTTRIGGER} +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) + DIDFT_OUTPUT = $10000000; + {$EXTERNALSYM DIDFT_OUTPUT} + DIDFT_VENDORDEFINED = $04000000; + {$EXTERNALSYM DIDFT_VENDORDEFINED} + DIDFT_ALIAS = $08000000; + {$EXTERNALSYM DIDFT_ALIAS} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) + +// #define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8) +function DIDFT_ENUMCOLLECTION(n: Cardinal): Cardinal; +{$EXTERNALSYM DIDFT_ENUMCOLLECTION} + +const + DIDFT_NOCOLLECTION = $00FFFF00; + {$EXTERNALSYM DIDFT_NOCOLLECTION} + +type + PDIObjectDataFormat = ^TDIObjectDataFormat; + _DIOBJECTDATAFORMAT = packed record + pguid: PGUID; + dwOfs: DWORD; + dwType: DWORD; + dwFlags: DWORD; + end; + {$EXTERNALSYM _DIOBJECTDATAFORMAT} + DIOBJECTDATAFORMAT = _DIOBJECTDATAFORMAT; + {$EXTERNALSYM DIOBJECTDATAFORMAT} + TDIObjectDataFormat = _DIOBJECTDATAFORMAT; + + PDIDataFormat = ^TDIDataFormat; + _DIDATAFORMAT = packed record + dwSize: DWORD; + dwObjSize: DWORD; + dwFlags: DWORD; + dwDataSize: DWORD; + dwNumObjs: DWORD; + rgodf: PDIObjectDataFormat; + end; + {$EXTERNALSYM _DIDATAFORMAT} + DIDATAFORMAT = _DIDATAFORMAT; + {$EXTERNALSYM DIDATAFORMAT} + TDIDataFormat = _DIDATAFORMAT; + +const + DIDF_ABSAXIS = $00000001; + {$EXTERNALSYM DIDF_ABSAXIS} + DIDF_RELAXIS = $00000002; + {$EXTERNALSYM DIDF_RELAXIS} + + +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION > 0x0700) *) + +type + PDIActionA = ^TDIActionA; + PDIActionW = ^TDIActionW; + PDIAction = PDIActionA; + _DIACTIONA = packed record + uAppData: Pointer; + dwSemantic: DWORD; + dwFlags: DWORD; + case Byte of + 0: ( + lptszActionName: PAnsiChar; + guidInstance: TGUID; + dwObjID: DWORD; + dwHow: DWORD; + ); + 1: ( + uResIdString: LongWord; + ); + end; + {$EXTERNALSYM _DIACTIONA} + _DIACTIONW = packed record + uAppData: Pointer; + dwSemantic: DWORD; + dwFlags: DWORD; + case Byte of + 0: ( + lptszActionName: PWideChar; + guidInstance: TGUID; + dwObjID: DWORD; + dwHow: DWORD; + ); + 1: ( + uResIdString: LongWord; + ); + end; + {$EXTERNALSYM _DIACTIONW} + _DIACTION = _DIACTIONA; + {$EXTERNALSYM _DIACTION} + DIACTIONA = _DIACTIONA; + {$EXTERNALSYM DIACTIONA} + DIACTIONW = _DIACTIONW; + {$EXTERNALSYM DIACTIONW} + DIACTION = DIACTIONA; + {$EXTERNALSYM DIACTION} + TDIActionA = _DIACTIONA; + TDIActionW = _DIACTIONW; + TDIAction = TDIActionA; + +const + DIA_FORCEFEEDBACK = $00000001; + {$EXTERNALSYM DIA_FORCEFEEDBACK} + DIA_APPMAPPED = $00000002; + {$EXTERNALSYM DIA_APPMAPPED} + DIA_APPNOMAP = $00000004; + {$EXTERNALSYM DIA_APPNOMAP} + DIA_NORANGE = $00000008; + {$EXTERNALSYM DIA_NORANGE} + DIA_APPFIXED = $00000010; + {$EXTERNALSYM DIA_APPFIXED} + + DIAH_UNMAPPED = $00000000; + {$EXTERNALSYM DIAH_UNMAPPED} + DIAH_USERCONFIG = $00000001; + {$EXTERNALSYM DIAH_USERCONFIG} + DIAH_APPREQUESTED = $00000002; + {$EXTERNALSYM DIAH_APPREQUESTED} + DIAH_HWAPP = $00000004; + {$EXTERNALSYM DIAH_HWAPP} + DIAH_HWDEFAULT = $00000008; + {$EXTERNALSYM DIAH_HWDEFAULT} + DIAH_DEFAULT = $00000020; + {$EXTERNALSYM DIAH_DEFAULT} + DIAH_ERROR = $80000000; + {$EXTERNALSYM DIAH_ERROR} + +type + PDIActionFormatA = ^TDIActionFormatA; + PDIActionFormatW = ^TDIActionFormatW; + PDIActionFormat = PDIActionFormatA; + _DIACTIONFORMATA = packed record + dwSize : DWORD; + dwActionSize : DWORD; + dwDataSize : DWORD; + dwNumActions : DWORD; + rgoAction : PDIActionA; + guidActionMap : TGUID; + dwGenre : DWORD; + dwBufferSize : DWORD; + lAxisMin : Longint; + lAxisMax : Longint; + hInstString : THandle; + ftTimeStamp : TFileTime; + dwCRC : DWORD; + tszActionMap : array [0..MAX_PATH-1] of AnsiChar; + end; + {$EXTERNALSYM _DIACTIONFORMATA} + _DIACTIONFORMATW = packed record + dwSize : DWORD; + dwActionSize : DWORD; + dwDataSize : DWORD; + dwNumActions : DWORD; + rgoAction : PDIActionW; + guidActionMap : TGUID; + dwGenre : DWORD; + dwBufferSize : DWORD; + lAxisMin : Longint; + lAxisMax : Longint; + hInstString : THandle; + ftTimeStamp : TFileTime; + dwCRC : DWORD; + tszActionMap : array [0..MAX_PATH-1] of WideChar; + end; + {$EXTERNALSYM _DIACTIONFORMATW} + _DIACTIONFORMAT = _DIACTIONFORMATA; + {$EXTERNALSYM _DIACTIONFORMAT} + DIACTIONFORMATA = _DIACTIONFORMATA; + {$EXTERNALSYM DIACTIONFORMATA} + DIACTIONFORMATW = _DIACTIONFORMATW; + {$EXTERNALSYM DIACTIONFORMATW} + DIACTIONFORMAT = DIACTIONFORMATA; + {$EXTERNALSYM DIACTIONFORMAT} + TDIActionFormatA = _DIACTIONFORMATA; + TDIActionFormatW = _DIACTIONFORMATW; + TDIActionFormat = TDIActionFormatA; + +const + DIAFTS_NEWDEVICELOW = $FFFFFFFF; + {$EXTERNALSYM DIAFTS_NEWDEVICELOW} + DIAFTS_NEWDEVICEHIGH = $FFFFFFFF; + {$EXTERNALSYM DIAFTS_NEWDEVICEHIGH} + DIAFTS_UNUSEDDEVICELOW = $00000000; + {$EXTERNALSYM DIAFTS_UNUSEDDEVICELOW} + DIAFTS_UNUSEDDEVICEHIGH = $00000000; + {$EXTERNALSYM DIAFTS_UNUSEDDEVICEHIGH} + + DIDBAM_DEFAULT = $00000000; + {$EXTERNALSYM DIDBAM_DEFAULT} + DIDBAM_PRESERVE = $00000001; + {$EXTERNALSYM DIDBAM_PRESERVE} + DIDBAM_INITIALIZE = $00000002; + {$EXTERNALSYM DIDBAM_INITIALIZE} + DIDBAM_HWDEFAULTS = $00000004; + {$EXTERNALSYM DIDBAM_HWDEFAULTS} + + DIDSAM_DEFAULT = $00000000; + {$EXTERNALSYM DIDSAM_DEFAULT} + DIDSAM_NOUSER = $00000001; + {$EXTERNALSYM DIDSAM_NOUSER} + DIDSAM_FORCESAVE = $00000002; + {$EXTERNALSYM DIDSAM_FORCESAVE} + + DICD_DEFAULT = $00000000; + {$EXTERNALSYM DICD_DEFAULT} + DICD_EDIT = $00000001; + {$EXTERNALSYM DICD_EDIT} + +(* + * The following definition is normally defined in d3dtypes.h + *) +type + TD3DColor = DXTypes.TD3DColor; + {$NODEFINE TD3DColor} + +{$HPPEMIT ''} +{$HPPEMIT '#ifndef D3DCOLOR_DEFINED_BCB'} +{$HPPEMIT 'typedef D3DCOLOR TD3DColor;'} +{$HPPEMIT '#define D3DCOLOR_DEFINED_BCB'} +{$HPPEMIT '#endif'} +{$HPPEMIT ''} + +type + PDIColorSet = ^TDIColorSet; + _DICOLORSET = packed record + dwSize: DWORD; + cTextFore: TD3DColor; + cTextHighlight: TD3DColor; + cCalloutLine: TD3DColor; + cCalloutHighlight: TD3DColor; + cBorder: TD3DColor; + cControlFill: TD3DColor; + cHighlightFill: TD3DColor; + cAreaFill: TD3DColor; + end; + {$EXTERNALSYM _DICOLORSET} + DICOLORSET = _DICOLORSET; + {$EXTERNALSYM DICOLORSET} + TDIColorSet = _DICOLORSET; + + PDIConfigureDevicesParamsA = ^TDIConfigureDevicesParamsA; + PDIConfigureDevicesParamsW = ^TDIConfigureDevicesParamsW; + PDIConfigureDevicesParams = PDIConfigureDevicesParamsA; + _DICONFIGUREDEVICESPARAMSA = packed record + dwSize: DWORD; + dwcUsers: DWORD; + lptszUserNames: PAnsiChar; + dwcFormats: DWORD; + lprgFormats: PDIActionFormatA; + hwnd: HWND; + dics: TDIColorSet; + lpUnkDDSTarget: IUnknown; + end; + {$EXTERNALSYM _DICONFIGUREDEVICESPARAMSA} + _DICONFIGUREDEVICESPARAMSW = packed record + dwSize: DWORD; + dwcUsers: DWORD; + lptszUserNames: PWideChar; + dwcFormats: DWORD; + lprgFormats: PDIActionFormatW; + hwnd: HWND; + dics: TDIColorSet; + lpUnkDDSTarget: IUnknown; + end; + {$EXTERNALSYM _DICONFIGUREDEVICESPARAMSW} + _DICONFIGUREDEVICESPARAMS = _DICONFIGUREDEVICESPARAMSA; + {$EXTERNALSYM _DICONFIGUREDEVICESPARAMS} + DICONFIGUREDEVICESPARAMSA = _DICONFIGUREDEVICESPARAMSA; + {$EXTERNALSYM DICONFIGUREDEVICESPARAMSA} + DICONFIGUREDEVICESPARAMSW = _DICONFIGUREDEVICESPARAMSW; + {$EXTERNALSYM DICONFIGUREDEVICESPARAMSW} + DICONFIGUREDEVICESPARAMS = DICONFIGUREDEVICESPARAMSA; + {$EXTERNALSYM DICONFIGUREDEVICESPARAMS} + TDIConfigureDevicesParamsA = _DICONFIGUREDEVICESPARAMSA; + TDIConfigureDevicesParamsW = _DICONFIGUREDEVICESPARAMSW; + TDIConfigureDevicesParams = TDIConfigureDevicesParamsA; + +const + DIDIFT_CONFIGURATION = $00000001; + {$EXTERNALSYM DIDIFT_CONFIGURATION} + DIDIFT_OVERLAY = $00000002; + {$EXTERNALSYM DIDIFT_OVERLAY} + + DIDAL_CENTERED = $00000000; + {$EXTERNALSYM DIDAL_CENTERED} + DIDAL_LEFTALIGNED = $00000001; + {$EXTERNALSYM DIDAL_LEFTALIGNED} + DIDAL_RIGHTALIGNED = $00000002; + {$EXTERNALSYM DIDAL_RIGHTALIGNED} + DIDAL_MIDDLE = $00000000; + {$EXTERNALSYM DIDAL_MIDDLE} + DIDAL_TOPALIGNED = $00000004; + {$EXTERNALSYM DIDAL_TOPALIGNED} + DIDAL_BOTTOMALIGNED = $00000008; + {$EXTERNALSYM DIDAL_BOTTOMALIGNED} + +type + PDIDeviceImageInfoA = ^TDIDeviceImageInfoA; + PDIDeviceImageInfoW = ^TDIDeviceImageInfoW; + PDIDeviceImageInfo = PDIDeviceImageInfoA; + _DIDEVICEIMAGEINFOA = packed record + tszImagePath: array [0..MAX_PATH-1] of AnsiChar; + dwFlags: DWORD; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + dwViewID: DWORD; + rcOverlay: TRect; + dwObjID: DWORD; + dwcValidPts: DWORD; + rgptCalloutLine: array [0..4] of TPoint; + rcCalloutRect: TRect; + dwTextAlign: DWORD; + end; + {$EXTERNALSYM _DIDEVICEIMAGEINFOA} + _DIDEVICEIMAGEINFOW = packed record + tszImagePath: array [0..MAX_PATH-1] of WideChar; + dwFlags: DWORD; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + dwViewID: DWORD; + rcOverlay: TRect; + dwObjID: DWORD; + dwcValidPts: DWORD; + rgptCalloutLine: array [0..4] of TPoint; + rcCalloutRect: TRect; + dwTextAlign: DWORD; + end; + {$EXTERNALSYM _DIDEVICEIMAGEINFOW} + _DIDEVICEIMAGEINFO = _DIDEVICEIMAGEINFOA; + {$EXTERNALSYM _DIDEVICEIMAGEINFO} + DIDEVICEIMAGEINFOA = _DIDEVICEIMAGEINFOA; + {$EXTERNALSYM DIDEVICEIMAGEINFOA} + DIDEVICEIMAGEINFOW = _DIDEVICEIMAGEINFOW; + {$EXTERNALSYM DIDEVICEIMAGEINFOW} + DIDEVICEIMAGEINFO = DIDEVICEIMAGEINFOA; + {$EXTERNALSYM DIDEVICEIMAGEINFO} + TDIDeviceImageInfoA = _DIDEVICEIMAGEINFOA; + TDIDeviceImageInfoW = _DIDEVICEIMAGEINFOW; + TDIDeviceImageInfo = TDIDeviceImageInfoA; + + PDIDeviceImageInfoHeaderA = ^TDIDeviceImageInfoHeaderA; + PDIDeviceImageInfoHeaderW = ^TDIDeviceImageInfoHeaderW; + PDIDeviceImageInfoHeader = PDIDeviceImageInfoHeaderA; + _DIDEVICEIMAGEINFOHEADERA = packed record + dwSize: DWORD; + dwSizeImageInfo: DWORD; + dwcViews: DWORD; + dwcButtons: DWORD; + dwcAxes: DWORD; + dwcPOVs: DWORD; + dwBufferSize: DWORD; + dwBufferUsed: DWORD; + lprgImageInfoArray: PDIDeviceImageInfoA; + end; + {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADERA} + _DIDEVICEIMAGEINFOHEADERW = packed record + dwSize: DWORD; + dwSizeImageInfo: DWORD; + dwcViews: DWORD; + dwcButtons: DWORD; + dwcAxes: DWORD; + dwcPOVs: DWORD; + dwBufferSize: DWORD; + dwBufferUsed: DWORD; + lprgImageInfoArray: PDIDeviceImageInfoW; + end; + {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADERW} + _DIDEVICEIMAGEINFOHEADER = _DIDEVICEIMAGEINFOHEADERA; + {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADER} + DIDEVICEIMAGEINFOHEADERA = _DIDEVICEIMAGEINFOHEADERA; + {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADERA} + DIDEVICEIMAGEINFOHEADERW = _DIDEVICEIMAGEINFOHEADERW; + {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADERW} + DIDEVICEIMAGEINFOHEADER = DIDEVICEIMAGEINFOHEADERA; + {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADER} + TDIDeviceImageInfoHeaderA = _DIDEVICEIMAGEINFOHEADERA; + TDIDeviceImageInfoHeaderW = _DIDEVICEIMAGEINFOHEADERW; + TDIDeviceImageInfoHeader = TDIDeviceImageInfoHeaderA; + +{$ENDIF} (* DIRECTINPUT_VERSION > 0x0700 *) + +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) +(* These structures are defined for DirectX 3.0 compatibility *) + +type + PDIDeviceObjectInstanceDX3A = ^TDIDeviceObjectInstanceDX3A; + PDIDeviceObjectInstanceDX3W = ^TDIDeviceObjectInstanceDX3W; + PDIDeviceObjectInstanceDX3 = PDIDeviceObjectInstanceDX3A; + DIDEVICEOBJECTINSTANCE_DX3A = packed record + dwSize: DWORD; + guidType: TGUID; + dwOfs: DWORD; + dwType: DWORD; + dwFlags: DWORD; + tszName: array [0..MAX_PATH-1] of AnsiChar; + end; + {$EXTERNALSYM DIDEVICEOBJECTINSTANCE_DX3A} + DIDEVICEOBJECTINSTANCE_DX3W = packed record + dwSize: DWORD; + guidType: TGUID; + dwOfs: DWORD; + dwType: DWORD; + dwFlags: DWORD; + tszName: array [0..MAX_PATH-1] of WideChar; + end; + {$EXTERNALSYM DIDEVICEOBJECTINSTANCE_DX3W} + DIDEVICEOBJECTINSTANCE_DX3 = DIDEVICEOBJECTINSTANCE_DX3A; + {$EXTERNALSYM DIDEVICEOBJECTINSTANCE_DX3} + TDIDeviceObjectInstanceDX3A = DIDEVICEOBJECTINSTANCE_DX3A; + TDIDeviceObjectInstanceDX3W = DIDEVICEOBJECTINSTANCE_DX3W; + TDIDeviceObjectInstanceDX3 = TDIDeviceObjectInstanceDX3A; + +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + +type + PDIDeviceObjectInstanceA = ^TDIDeviceObjectInstanceA; + PDIDeviceObjectInstanceW = ^TDIDeviceObjectInstanceW; + PDIDeviceObjectInstance = PDIDeviceObjectInstanceA; + DIDEVICEOBJECTINSTANCEA = packed record + dwSize: DWORD; + guidType: TGUID; + dwOfs: DWORD; + dwType: DWORD; + dwFlags: DWORD; + tszName: array[0..MAX_PATH-1] of AnsiChar; +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + dwFFMaxForce: DWORD; + dwFFForceResolution: DWORD; + wCollectionNumber: Word; + wDesignatorIndex: Word; + wUsagePage: Word; + wUsage: Word; + dwDimension: DWORD; + wExponent: Word; + wReportId: Word; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + end; + {$EXTERNALSYM DIDEVICEOBJECTINSTANCEA} + DIDEVICEOBJECTINSTANCEW = packed record + dwSize: DWORD; + guidType: TGUID; + dwOfs: DWORD; + dwType: DWORD; + dwFlags: DWORD; + tszName: array[0..MAX_PATH-1] of WideChar; +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + dwFFMaxForce: DWORD; + dwFFForceResolution: DWORD; + wCollectionNumber: Word; + wDesignatorIndex: Word; + wUsagePage: Word; + wUsage: Word; + dwDimension: DWORD; + wExponent: Word; + wReportId: Word; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + end; + {$EXTERNALSYM DIDEVICEOBJECTINSTANCEW} + DIDEVICEOBJECTINSTANCE = DIDEVICEOBJECTINSTANCEA; + {$EXTERNALSYM DIDEVICEOBJECTINSTANCE} + TDIDeviceObjectInstanceA = DIDEVICEOBJECTINSTANCEA; + TDIDeviceObjectInstanceW = DIDEVICEOBJECTINSTANCEW; + TDIDeviceObjectInstance = TDIDeviceObjectInstanceA; + + +type + TDIEnumDeviceObjectsCallbackA = function (var lpddoi: TDIDeviceObjectInstanceA; pvRef : Pointer): BOOL; stdcall; + {$EXTERNALSYM TDIEnumDeviceObjectsCallbackA} + TDIEnumDeviceObjectsCallbackW = function (var lpddoi: TDIDeviceObjectInstanceW; pvRef : Pointer): BOOL; stdcall; + {$EXTERNALSYM TDIEnumDeviceObjectsCallbackW} + TDIEnumDeviceObjectsCallback = TDIEnumDeviceObjectsCallbackA; + {$EXTERNALSYM TDIEnumDeviceObjectsCallback} + + +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) +const + DIDOI_FFACTUATOR = $00000001; + {$EXTERNALSYM DIDOI_FFACTUATOR} + DIDOI_FFEFFECTTRIGGER = $00000002; + {$EXTERNALSYM DIDOI_FFEFFECTTRIGGER} + DIDOI_POLLED = $00008000; + {$EXTERNALSYM DIDOI_POLLED} + DIDOI_ASPECTPOSITION = $00000100; + {$EXTERNALSYM DIDOI_ASPECTPOSITION} + DIDOI_ASPECTVELOCITY = $00000200; + {$EXTERNALSYM DIDOI_ASPECTVELOCITY} + DIDOI_ASPECTACCEL = $00000300; + {$EXTERNALSYM DIDOI_ASPECTACCEL} + DIDOI_ASPECTFORCE = $00000400; + {$EXTERNALSYM DIDOI_ASPECTFORCE} + DIDOI_ASPECTMASK = $00000F00; + {$EXTERNALSYM DIDOI_ASPECTMASK} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) + DIDOI_GUIDISUSAGE = $00010000; + {$EXTERNALSYM DIDOI_GUIDISUSAGE} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) + +type + PDIPropHeader = ^TDIPropHeader; + DIPROPHEADER = packed record + dwSize: DWORD; + dwHeaderSize: DWORD; + dwObj: DWORD; + dwHow: DWORD; + end; + {$EXTERNALSYM DIPROPHEADER} + TDIPropHeader = DIPROPHEADER; + +const + DIPH_DEVICE = 0; + {$EXTERNALSYM DIPH_DEVICE} + DIPH_BYOFFSET = 1; + {$EXTERNALSYM DIPH_BYOFFSET} + DIPH_BYID = 2; + {$EXTERNALSYM DIPH_BYID} +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) + DIPH_BYUSAGE = 3; + {$EXTERNALSYM DIPH_BYUSAGE} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) + +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) +// #define DIMAKEUSAGEDWORD(UsagePage, Usage) \ +// (DWORD)MAKELONG(Usage, UsagePage) +function DIMAKEUSAGEDWORD(UsagePage, Usage: Word): DWORD; +{$EXTERNALSYM DIMAKEUSAGEDWORD} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) + +type + PDIPropDWord = ^TDIPropDWord; + DIPROPDWORD = packed record + diph: TDIPropHeader; + dwData: DWORD; + end; + {$EXTERNALSYM DIPROPDWORD} + TDIPropDWord = DIPROPDWORD; + +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) + PDIPropPointer = ^TDIPropPointer; + DIPROPPOINTER = packed record + diph: TDIPropHeader; + uData: Pointer; + end; + {$EXTERNALSYM DIPROPPOINTER} + TDIPropPointer = DIPROPPOINTER; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + + PDIPropRange = ^TDIPropRange; + DIPROPRANGE = packed record + diph: TDIPropHeader; + lMin: Longint; + lMax: Longint; + end; + {$EXTERNALSYM DIPROPRANGE} + TDIPropRange = DIPROPRANGE; + +const + DIPROPRANGE_NOMIN = $80000000; + {$EXTERNALSYM DIPROPRANGE_NOMIN} + DIPROPRANGE_NOMAX = $7FFFFFFF; + {$EXTERNALSYM DIPROPRANGE_NOMAX} + +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) +type + PDIPropCal = ^TDIPropCal; + DIPROPCAL = packed record + diph: TDIPropHeader; + lMin: Longint; + lCenter: Longint; + lMax: Longint; + end; + {$EXTERNALSYM DIPROPCAL} + TDIPropCal = DIPROPCAL; + + PDIPropCalPov = ^TDIPropCalPov; + DIPROPCALPOV = packed record + diph: TDIPropHeader; + lMin: array[0..4] of Longint; + lMax: array[0..4] of Longint; + end; + {$EXTERNALSYM DIPROPCALPOV} + TDIPropCalPov = DIPROPCALPOV; + + PDIPropGuidAndPath = ^TDIPropGuidAndPath; + DIPROPGUIDANDPATH = packed record + diph: TDIPropHeader; + guidClass: TGUID; + wszPath: array[0..MAX_PATH-1] of WideChar; + end; + {$EXTERNALSYM DIPROPGUIDANDPATH} + TDIPropGuidAndPath = DIPROPGUIDANDPATH; + + PDIPropString = ^TDIPropString; + DIPROPSTRING = packed record + diph: TDIPropHeader; + wsz: array[0..MAX_PATH-1] of WideChar; + end; + {$EXTERNALSYM DIPROPSTRING} + TDIPropString = DIPROPSTRING; + +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) + +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) +const + MAXCPOINTSNUM = 8; + {$EXTERNALSYM MAXCPOINTSNUM} + +type + PCPoint = ^TCPoint; + _CPOINT = packed record + lP: Longint; // raw value + dwLog: DWORD; // logical_value / max_logical_value * 10000 + end; + {$EXTERNALSYM _CPOINT} + CPOINT = _CPOINT; + {$EXTERNALSYM CPOINT} + TCPoint = _CPOINT; + + PDIPropCPoints = ^TDIPropCPoints; + DIPROPCPOINTS = packed record + diph: TDIPropHeader; + dwCPointsNum: DWORD; + cp: array[0..MAXCPOINTSNUM-1] of TCPoint; + end; + {$EXTERNALSYM DIPROPCPOINTS} + TDIPropCPoints = DIPROPCPOINTS; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + + +// #define MAKEDIPROP(prop) (*(const GUID *)(prop)) + +type + MAKEDIPROP = PGUID; + {$EXTERNALSYM MAKEDIPROP} + +const + DIPROP_BUFFERSIZE = MAKEDIPROP(1); + {$EXTERNALSYM DIPROP_BUFFERSIZE} + + DIPROP_AXISMODE = MAKEDIPROP(2); + {$EXTERNALSYM DIPROP_AXISMODE} + + DIPROPAXISMODE_ABS = 0; + {$EXTERNALSYM DIPROPAXISMODE_ABS} + DIPROPAXISMODE_REL = 1; + {$EXTERNALSYM DIPROPAXISMODE_REL} + + DIPROP_GRANULARITY = MAKEDIPROP(3); + {$EXTERNALSYM DIPROP_GRANULARITY} + + DIPROP_RANGE = MAKEDIPROP(4); + {$EXTERNALSYM DIPROP_RANGE} + + DIPROP_DEADZONE = MAKEDIPROP(5); + {$EXTERNALSYM DIPROP_DEADZONE} + + DIPROP_SATURATION = MAKEDIPROP(6); + {$EXTERNALSYM DIPROP_SATURATION} + + DIPROP_FFGAIN = MAKEDIPROP(7); + {$EXTERNALSYM DIPROP_FFGAIN} + + DIPROP_FFLOAD = MAKEDIPROP(8); + {$EXTERNALSYM DIPROP_FFLOAD} + + DIPROP_AUTOCENTER = MAKEDIPROP(9); + {$EXTERNALSYM DIPROP_AUTOCENTER} + + DIPROPAUTOCENTER_OFF = 0; + {$EXTERNALSYM DIPROPAUTOCENTER_OFF} + DIPROPAUTOCENTER_ON = 1; + {$EXTERNALSYM DIPROPAUTOCENTER_ON} + + DIPROP_CALIBRATIONMODE = MAKEDIPROP(10); + {$EXTERNALSYM DIPROP_CALIBRATIONMODE} + + DIPROPCALIBRATIONMODE_COOKED = 0; + {$EXTERNALSYM DIPROPCALIBRATIONMODE_COOKED} + DIPROPCALIBRATIONMODE_RAW = 1; + {$EXTERNALSYM DIPROPCALIBRATIONMODE_RAW} + +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) + DIPROP_CALIBRATION = MAKEDIPROP(11); + {$EXTERNALSYM DIPROP_CALIBRATION} + + DIPROP_GUIDANDPATH = MAKEDIPROP(12); + {$EXTERNALSYM DIPROP_GUIDANDPATH} + + DIPROP_INSTANCENAME = MAKEDIPROP(13); + {$EXTERNALSYM DIPROP_INSTANCENAME} + + DIPROP_PRODUCTNAME = MAKEDIPROP(14); + {$EXTERNALSYM DIPROP_PRODUCTNAME} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) + +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x05b2) *) + DIPROP_JOYSTICKID = MAKEDIPROP(15); + {$EXTERNALSYM DIPROP_JOYSTICKID} + + DIPROP_GETPORTDISPLAYNAME = MAKEDIPROP(16); + {$EXTERNALSYM DIPROP_GETPORTDISPLAYNAME} + +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x05b2 *) + +{$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *) + DIPROP_PHYSICALRANGE = MAKEDIPROP(18); + {$EXTERNALSYM DIPROP_PHYSICALRANGE} + + DIPROP_LOGICALRANGE = MAKEDIPROP(19); + {$EXTERNALSYM DIPROP_LOGICALRANGE} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *) + +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) + DIPROP_KEYNAME = MAKEDIPROP(20); + {$EXTERNALSYM DIPROP_KEYNAME} + + DIPROP_CPOINTS = MAKEDIPROP(21); + {$EXTERNALSYM DIPROP_CPOINTS} + + DIPROP_APPDATA = MAKEDIPROP(22); + {$EXTERNALSYM DIPROP_APPDATA} + + DIPROP_SCANCODE = MAKEDIPROP(23); + {$EXTERNALSYM DIPROP_SCANCODE} + + DIPROP_VIDPID = MAKEDIPROP(24); + {$EXTERNALSYM DIPROP_VIDPID} + + DIPROP_USERNAME = MAKEDIPROP(25); + {$EXTERNALSYM DIPROP_USERNAME} + + DIPROP_TYPENAME = MAKEDIPROP(26); + {$EXTERNALSYM DIPROP_TYPENAME} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + + +type + PDIDeviceObjectDataDX3 = ^TDIDeviceObjectDataDX3; + DIDEVICEOBJECTDATA_DX3 = packed record + dwOfs: DWORD; + dwData: DWORD; + dwTimeStamp: DWORD; + dwSequence: DWORD; + end; + {$EXTERNALSYM DIDEVICEOBJECTDATA_DX3} + TDIDeviceObjectDataDX3 = DIDEVICEOBJECTDATA_DX3; + + PDIDeviceObjectData = ^TDIDeviceObjectData; + DIDEVICEOBJECTDATA = packed record + dwOfs: DWORD; + dwData: DWORD; + dwTimeStamp: DWORD; + dwSequence: DWORD; +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) + uAppData: Pointer; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + end; + {$EXTERNALSYM DIDEVICEOBJECTDATA} + TDIDeviceObjectData = DIDEVICEOBJECTDATA; + +const + DIGDD_PEEK = $00000001; + {$EXTERNALSYM DIGDD_PEEK} + +// #define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \ +// ((int)((dwSequence1) - (dwSequence2)) cmp 0) +// Translator: This is not convertable to pascal + +const + DISCL_EXCLUSIVE = $00000001; + {$EXTERNALSYM DISCL_EXCLUSIVE} + DISCL_NONEXCLUSIVE = $00000002; + {$EXTERNALSYM DISCL_NONEXCLUSIVE} + DISCL_FOREGROUND = $00000004; + {$EXTERNALSYM DISCL_FOREGROUND} + DISCL_BACKGROUND = $00000008; + {$EXTERNALSYM DISCL_BACKGROUND} + DISCL_NOWINKEY = $00000010; + {$EXTERNALSYM DISCL_NOWINKEY} + +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) +(* These structures are defined for DirectX 3.0 compatibility *) + +type + PDIDeviceInstanceDX3A = ^TDIDeviceInstanceDX3A; + PDIDeviceInstanceDX3W = ^TDIDeviceInstanceDX3W; + PDIDeviceInstanceDX3 = PDIDeviceInstanceDX3A; + DIDEVICEINSTANCE_DX3A = packed record + dwSize: DWORD; + guidInstance: TGUID; + guidProduct: TGUID; + dwDevType: DWORD; + tszInstanceName: array[0..MAX_PATH-1] of AnsiChar; + tszProductName: array[0..MAX_PATH-1] of AnsiChar; + end; + {$EXTERNALSYM DIDEVICEINSTANCE_DX3A} + DIDEVICEINSTANCE_DX3W = packed record + dwSize: DWORD; + guidInstance: TGUID; + guidProduct: TGUID; + dwDevType: DWORD; + tszInstanceName: array[0..MAX_PATH-1] of WideChar; + tszProductName: array[0..MAX_PATH-1] of WideChar; + end; + {$EXTERNALSYM DIDEVICEINSTANCE_DX3W} + DIDEVICEINSTANCE_DX3 = DIDEVICEINSTANCE_DX3A; + {$EXTERNALSYM DIDEVICEINSTANCE_DX3} + TDIDeviceInstanceDX3A = DIDEVICEINSTANCE_DX3A; + TDIDeviceInstanceDX3W = DIDEVICEINSTANCE_DX3W; + TDIDeviceInstanceDX3 = TDIDeviceInstanceDX3A; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + +type + PDIDeviceInstanceA = ^TDIDeviceInstanceA; + PDIDeviceInstanceW = ^TDIDeviceInstanceW; + PDIDeviceInstance = PDIDeviceInstanceA; + DIDEVICEINSTANCEA = packed record + dwSize: DWORD; + guidInstance: TGUID; + guidProduct: TGUID; + dwDevType: DWORD; + tszInstanceName: array[0..MAX_PATH-1] of AnsiChar; + tszProductName: array[0..MAX_PATH-1] of AnsiChar; +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + guidFFDriver: TGUID; + wUsagePage: Word; + wUsage: Word; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + end; + {$EXTERNALSYM DIDEVICEINSTANCEA} + DIDEVICEINSTANCEW = packed record + dwSize: DWORD; + guidInstance: TGUID; + guidProduct: TGUID; + dwDevType: DWORD; + tszInstanceName: array[0..MAX_PATH-1] of WideChar; + tszProductName: array[0..MAX_PATH-1] of WideChar; +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + guidFFDriver: TGUID; + wUsagePage: Word; + wUsage: Word; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + end; + {$EXTERNALSYM DIDEVICEINSTANCEW} + DIDEVICEINSTANCE = DIDEVICEINSTANCEA; + {$EXTERNALSYM DIDEVICEINSTANCE} + TDIDeviceInstanceA = DIDEVICEINSTANCEA; + TDIDeviceInstanceW = DIDEVICEINSTANCEW; + TDIDeviceInstance = TDIDeviceInstanceA; + + +type + {$EXTERNALSYM IDirectInputDeviceA} + IDirectInputDeviceA = interface(IUnknown) + [SID_IDirectInputDeviceA] + (*** IDirectInputDeviceA methods ***) + function GetCapabilities(var lpDIDevCaps: TDIDevCaps): HResult; stdcall; + function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader): HResult; stdcall; + function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader): HResult; stdcall; + function Acquire: HResult; stdcall; + function Unacquire: HResult; stdcall; + function GetDeviceState(cbData: DWORD; lpvData: Pointer): HResult; stdcall; + function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData; out pdwInOut: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetDataFormat(var lpdf: TDIDataFormat): HResult; stdcall; + function SetEventNotification(hEvent: THandle): HResult; stdcall; + function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD): HResult; stdcall; + function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj, dwHow: DWORD): HResult; stdcall; + function GetDeviceInfo(var pdidi: TDIDeviceInstanceA): HResult; stdcall; + function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall; + function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputDeviceW} + IDirectInputDeviceW = interface(IUnknown) + [SID_IDirectInputDeviceW] + (*** IDirectInputDeviceW methods ***) + function GetCapabilities(var lpDIDevCaps: TDIDevCaps): HResult; stdcall; + function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader): HResult; stdcall; + function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader): HResult; stdcall; + function Acquire: HResult; stdcall; + function Unacquire: HResult; stdcall; + function GetDeviceState(cbData: DWORD; lpvData: Pointer): HResult; stdcall; + function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData; out pdwInOut: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetDataFormat(var lpdf: TDIDataFormat): HResult; stdcall; + function SetEventNotification(hEvent: THandle): HResult; stdcall; + function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD): HResult; stdcall; + function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj, dwHow: DWORD): HResult; stdcall; + function GetDeviceInfo(var pdidi: TDIDeviceInstanceW): HResult; stdcall; + function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall; + function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputDevice} + IDirectInputDevice = IDirectInputDeviceA; +type + IID_IDirectInputDevice = IDirectInputDevice; + {$EXTERNALSYM IID_IDirectInputDevice} + +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + +const + DISFFC_RESET = $00000001; + {$EXTERNALSYM DISFFC_RESET} + DISFFC_STOPALL = $00000002; + {$EXTERNALSYM DISFFC_STOPALL} + DISFFC_PAUSE = $00000004; + {$EXTERNALSYM DISFFC_PAUSE} + DISFFC_CONTINUE = $00000008; + {$EXTERNALSYM DISFFC_CONTINUE} + DISFFC_SETACTUATORSON = $00000010; + {$EXTERNALSYM DISFFC_SETACTUATORSON} + DISFFC_SETACTUATORSOFF = $00000020; + {$EXTERNALSYM DISFFC_SETACTUATORSOFF} + + DIGFFS_EMPTY = $00000001; + {$EXTERNALSYM DIGFFS_EMPTY} + DIGFFS_STOPPED = $00000002; + {$EXTERNALSYM DIGFFS_STOPPED} + DIGFFS_PAUSED = $00000004; + {$EXTERNALSYM DIGFFS_PAUSED} + DIGFFS_ACTUATORSON = $00000010; + {$EXTERNALSYM DIGFFS_ACTUATORSON} + DIGFFS_ACTUATORSOFF = $00000020; + {$EXTERNALSYM DIGFFS_ACTUATORSOFF} + DIGFFS_POWERON = $00000040; + {$EXTERNALSYM DIGFFS_POWERON} + DIGFFS_POWEROFF = $00000080; + {$EXTERNALSYM DIGFFS_POWEROFF} + DIGFFS_SAFETYSWITCHON = $00000100; + {$EXTERNALSYM DIGFFS_SAFETYSWITCHON} + DIGFFS_SAFETYSWITCHOFF = $00000200; + {$EXTERNALSYM DIGFFS_SAFETYSWITCHOFF} + DIGFFS_USERFFSWITCHON = $00000400; + {$EXTERNALSYM DIGFFS_USERFFSWITCHON} + DIGFFS_USERFFSWITCHOFF = $00000800; + {$EXTERNALSYM DIGFFS_USERFFSWITCHOFF} + DIGFFS_DEVICELOST = $80000000; + {$EXTERNALSYM DIGFFS_DEVICELOST} + +type + PDIEffectInfoA = ^TDIEffectInfoA; + PDIEffectInfoW = ^TDIEffectInfoW; + PDIEffectInfo = PDIEffectInfoA; + DIEFFECTINFOA = packed record + dwSize: DWORD; + guid: TGUID; + dwEffType: DWORD; + dwStaticParams: DWORD; + dwDynamicParams: DWORD; + tszName: array[0..MAX_PATH-1] of AnsiChar; + end; + {$EXTERNALSYM DIEFFECTINFOA} + DIEFFECTINFOW = packed record + dwSize: DWORD; + guid: TGUID; + dwEffType: DWORD; + dwStaticParams: DWORD; + dwDynamicParams: DWORD; + tszName: array[0..MAX_PATH-1] of WideChar; + end; + {$EXTERNALSYM DIEFFECTINFOW} + DIEFFECTINFO = DIEFFECTINFOA; + {$EXTERNALSYM DIEFFECTINFO} + TDIEffectInfoA = DIEFFECTINFOA; + TDIEffectInfoW = DIEFFECTINFOW; + TDIEffectInfo = TDIEffectInfoA; + +const + DISDD_CONTINUE = $00000001; + {$EXTERNALSYM DISDD_CONTINUE} + +type + TDIEnumEffectsCallbackA = function (var pdei: TDIEffectInfoA; pvRef: Pointer): BOOL; stdcall; + {$NODEFINE TDIEnumEffectsCallbackA} + (*$HPPEMIT 'typedef LPDIENUMEFFECTSCALLBACKA TDIEnumEffectsCallbackA;'*) + TDIEnumEffectsCallbackW = function (var pdei: TDIEffectInfoW; pvRef: Pointer): BOOL; stdcall; + {$NODEFINE TDIEnumEffectsCallbackW} + (*$HPPEMIT 'typedef LPDIENUMEFFECTSCALLBACKW TDIEnumEffectsCallbackW;'*) + TDIEnumEffectsCallback = TDIEnumEffectsCallbackA; + {$NODEFINE TDIEnumEffectsCallback} + {$HPPEMIT 'typedef LPDIENUMEFFECTSINFILECALLBACK TDIEnumEffectsInFileCallback;'} + TDIEnumCreatedEffectObjectsCallback = function (peff : IDirectInputEffect; pvRev: Pointer): BOOL; stdcall; + {$NODEFINE TDIEnumCreatedEffectObjectsCallback} + {$HPPEMIT 'typedef LPDIENUMCREATEDEFFECTOBJECTSCALLBACK TDIEnumCreatedEffectObjectsCallback;'} + + {$EXTERNALSYM IDirectInputDevice2A} + IDirectInputDevice2A = interface(IDirectInputDeviceA) + [SID_IDirectInputDevice2A] + (*** IDirectInputDevice2A methods ***) + function CreateEffect(const rguid: TGUID; lpeff: PDIEffect; out ppdeff: IDirectInputEffect; punkOuter: IUnknown): HResult; stdcall; + function EnumEffects(lpCallback: TDIEnumEffectsCallbackA; pvRef: Pointer; dwEffType: DWORD): HResult; stdcall; + function GetEffectInfo(var pdei: TDIEffectInfoA; const rguid: TGUID): HResult; stdcall; + function GetForceFeedbackState(out pdwOut: DWORD): HResult; stdcall; + function SendForceFeedbackCommand(dwFlags: DWORD): HResult; stdcall; + function EnumCreatedEffectObjects(lpCallback: TDIEnumCreatedEffectObjectsCallback; pvRef: Pointer; fl: DWORD): HResult; stdcall; + function Escape(var pesc: TDIEffEscape): HResult; stdcall; + function Poll: HResult; stdcall; + function SendDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData; var pdwInOut: DWORD; fl: DWORD): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputDevice2W} + IDirectInputDevice2W = interface(IDirectInputDeviceW) + [SID_IDirectInputDevice2W] + (*** IDirectInputDevice2W methods ***) + function CreateEffect(const rguid: TGUID; lpeff: PDIEffect; out ppdeff: IDirectInputEffect; punkOuter: IUnknown): HResult; stdcall; + function EnumEffects(lpCallback: TDIEnumEffectsCallbackW; pvRef: Pointer; dwEffType: DWORD): HResult; stdcall; + function GetEffectInfo(var pdei: TDIEffectInfoW; const rguid: TGUID): HResult; stdcall; + function GetForceFeedbackState(out pdwOut: DWORD): HResult; stdcall; + function SendForceFeedbackCommand(dwFlags: DWORD): HResult; stdcall; + function EnumCreatedEffectObjects(lpCallback: TDIEnumCreatedEffectObjectsCallback; pvRef: Pointer; fl: DWORD): HResult; stdcall; + function Escape(var pesc: TDIEffEscape): HResult; stdcall; + function Poll: HResult; stdcall; + function SendDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData; var pdwInOut: DWORD; fl: DWORD): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputDevice2} + IDirectInputDevice2 = IDirectInputDevice2A; +type + IID_IDirectInputDevice2 = IDirectInputDevice2; + {$EXTERNALSYM IID_IDirectInputDevice2} + +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + +{$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *) +const + DIFEF_DEFAULT = $00000000; + {$EXTERNALSYM DIFEF_DEFAULT} + DIFEF_INCLUDENONSTANDARD = $00000001; + {$EXTERNALSYM DIFEF_INCLUDENONSTANDARD} + DIFEF_MODIFYIFNEEDED = $00000010; + {$EXTERNALSYM DIFEF_MODIFYIFNEEDED} + +type + {$EXTERNALSYM IDirectInputDevice7A} + IDirectInputDevice7A = interface(IDirectInputDevice2A) + [SID_IDirectInputDevice7A] + (*** IDirectInputDevice7A methods ***) + function EnumEffectsInFile(lpszFileName: PAnsiChar; pec: TDIEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function WriteEffectToFile(lpszFileName: PAnsiChar; dwEntries: DWORD; rgDiFileEft: PDIFileEffect; dwFlags: DWORD): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputDevice7W} + IDirectInputDevice7W = interface(IDirectInputDevice2W) + [SID_IDirectInputDevice7W] + (*** IDirectInputDevice7W methods ***) + function EnumEffectsInFile(lpszFileName: PWideChar; pec: TDIEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function WriteEffectToFile(lpszFileName: PWideChar; dwEntries: DWORD; rgDiFileEft: PDIFileEffect; dwFlags: DWORD): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputDevice7} + IDirectInputDevice7 = IDirectInputDevice7A; +type + IID_IDirectInputDevice7 = IDirectInputDevice7; + {$EXTERNALSYM IID_IDirectInputDevice7} + +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *) + +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) +type + {$EXTERNALSYM IDirectInputDevice8A} + IDirectInputDevice8A = interface(IDirectInputDevice7A) + [SID_IDirectInputDevice8A] + (*** IDirectInputDevice8A methods ***) + function BuildActionMap(lpdiaf: TDIActionFormatA; lpszUserName: PAnsiChar; dwFlags: DWORD): HResult; stdcall; + function SetActionMap(var lpdiActionFormat: TDIActionFormatA; lptszUserName: PAnsiChar; dwFlags: DWORD): HResult; stdcall; + function GetImageInfo(var lpdiDevImageInfoHeader: TDIDeviceImageInfoHeaderA): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputDevice8W} + IDirectInputDevice8W = interface(IDirectInputDevice7W) + [SID_IDirectInputDevice8W] + (*** IDirectInputDevice8W methods ***) + function BuildActionMap(lpdiaf: TDIActionFormatW; lpszUserName: PWideChar; dwFlags: DWORD): HResult; stdcall; + function SetActionMap(var lpdiActionFormat: TDIActionFormatW; lptszUserName: PWideChar; dwFlags: DWORD): HResult; stdcall; + function GetImageInfo(var lpdiDevImageInfoHeader: TDIDeviceImageInfoHeaderW): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputDevice8} + IDirectInputDevice8 = IDirectInputDevice8A; +type + IID_IDirectInputDevice8 = IDirectInputDevice8; + {$EXTERNALSYM IID_IDirectInputDevice8} + +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + +(**************************************************************************** + * + * Mouse + * + ****************************************************************************) + +type + PDIMouseState = ^TDIMouseState; + _DIMOUSESTATE = packed record + lX: Longint; + lY: Longint; + lZ: Longint; + rgbButtons: array[0..3] of Byte; + end; + {$EXTERNALSYM _DIMOUSESTATE} + DIMOUSESTATE = _DIMOUSESTATE; + {$EXTERNALSYM DIMOUSESTATE} + TDIMouseState = _DIMOUSESTATE; + +{$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *) + PDIMouseState2 = ^TDIMouseState2; + _DIMOUSESTATE2 = packed record + lX: Longint; + lY: Longint; + lZ: Longint; + rgbButtons: array[0..7] of Byte; + end; + {$EXTERNALSYM _DIMOUSESTATE2} + DIMOUSESTATE2 = _DIMOUSESTATE2; + {$EXTERNALSYM DIMOUSESTATE2} + TDIMouseState2 = _DIMOUSESTATE2; + +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *) + +const + DIMOFS_X = 0; // FIELD_OFFSET(DIMOUSESTATE, lX) + {$EXTERNALSYM DIMOFS_X} + DIMOFS_Y = 4; // FIELD_OFFSET(DIMOUSESTATE, lY) + {$EXTERNALSYM DIMOFS_Y} + DIMOFS_Z = 8; // FIELD_OFFSET(DIMOUSESTATE, lZ) + {$EXTERNALSYM DIMOFS_Z} + DIMOFS_BUTTON0 = 12; // (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) + {$EXTERNALSYM DIMOFS_BUTTON0} + DIMOFS_BUTTON1 = DIMOFS_BUTTON0 + 1; // (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) + {$EXTERNALSYM DIMOFS_BUTTON1} + DIMOFS_BUTTON2 = DIMOFS_BUTTON0 + 2; // (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) + {$EXTERNALSYM DIMOFS_BUTTON2} + DIMOFS_BUTTON3 = DIMOFS_BUTTON0 + 3; // (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) + {$EXTERNALSYM DIMOFS_BUTTON3} +{$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *) + DIMOFS_BUTTON4 = DIMOFS_BUTTON0 + 4; // (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 4) + {$EXTERNALSYM DIMOFS_BUTTON4} + DIMOFS_BUTTON5 = DIMOFS_BUTTON0 + 5; // (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 5) + {$EXTERNALSYM DIMOFS_BUTTON5} + DIMOFS_BUTTON6 = DIMOFS_BUTTON0 + 6; // (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 6) + {$EXTERNALSYM DIMOFS_BUTTON6} + DIMOFS_BUTTON7 = DIMOFS_BUTTON0 + 7; // (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 7) + {$EXTERNALSYM DIMOFS_BUTTON7} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *) + +(**************************************************************************** + * + * Keyboard + * + ****************************************************************************) + +(**************************************************************************** + * + * DirectInput keyboard scan codes + * + ****************************************************************************) +const + DIK_ESCAPE = $01; + {$EXTERNALSYM DIK_ESCAPE} + DIK_1 = $02; + {$EXTERNALSYM DIK_1} + DIK_2 = $03; + {$EXTERNALSYM DIK_2} + DIK_3 = $04; + {$EXTERNALSYM DIK_3} + DIK_4 = $05; + {$EXTERNALSYM DIK_4} + DIK_5 = $06; + {$EXTERNALSYM DIK_5} + DIK_6 = $07; + {$EXTERNALSYM DIK_6} + DIK_7 = $08; + {$EXTERNALSYM DIK_7} + DIK_8 = $09; + {$EXTERNALSYM DIK_8} + DIK_9 = $0A; + {$EXTERNALSYM DIK_9} + DIK_0 = $0B; + {$EXTERNALSYM DIK_0} + DIK_MINUS = $0C; (* - on main keyboard *) + {$EXTERNALSYM DIK_MINUS} + DIK_EQUALS = $0D; + {$EXTERNALSYM DIK_EQUALS} + DIK_BACK = $0E; (* backspace *) + {$EXTERNALSYM DIK_BACK} + DIK_TAB = $0F; + {$EXTERNALSYM DIK_TAB} + DIK_Q = $10; + {$EXTERNALSYM DIK_Q} + DIK_W = $11; + {$EXTERNALSYM DIK_W} + DIK_E = $12; + {$EXTERNALSYM DIK_E} + DIK_R = $13; + {$EXTERNALSYM DIK_R} + DIK_T = $14; + {$EXTERNALSYM DIK_T} + DIK_Y = $15; + {$EXTERNALSYM DIK_Y} + DIK_U = $16; + {$EXTERNALSYM DIK_U} + DIK_I = $17; + {$EXTERNALSYM DIK_I} + DIK_O = $18; + {$EXTERNALSYM DIK_O} + DIK_P = $19; + {$EXTERNALSYM DIK_P} + DIK_LBRACKET = $1A; + {$EXTERNALSYM DIK_LBRACKET} + DIK_RBRACKET = $1B; + {$EXTERNALSYM DIK_RBRACKET} + DIK_RETURN = $1C; (* Enter on main keyboard *) + {$EXTERNALSYM DIK_RETURN} + DIK_LCONTROL = $1D; + {$EXTERNALSYM DIK_LCONTROL} + DIK_A = $1E; + {$EXTERNALSYM DIK_A} + DIK_S = $1F; + {$EXTERNALSYM DIK_S} + DIK_D = $20; + {$EXTERNALSYM DIK_D} + DIK_F = $21; + {$EXTERNALSYM DIK_F} + DIK_G = $22; + {$EXTERNALSYM DIK_G} + DIK_H = $23; + {$EXTERNALSYM DIK_H} + DIK_J = $24; + {$EXTERNALSYM DIK_J} + DIK_K = $25; + {$EXTERNALSYM DIK_K} + DIK_L = $26; + {$EXTERNALSYM DIK_L} + DIK_SEMICOLON = $27; + {$EXTERNALSYM DIK_SEMICOLON} + DIK_APOSTROPHE = $28; + {$EXTERNALSYM DIK_APOSTROPHE} + DIK_GRAVE = $29; (* accent grave *) + {$EXTERNALSYM DIK_GRAVE} + DIK_LSHIFT = $2A; + {$EXTERNALSYM DIK_LSHIFT} + DIK_BACKSLASH = $2B; + {$EXTERNALSYM DIK_BACKSLASH} + DIK_Z = $2C; + {$EXTERNALSYM DIK_Z} + DIK_X = $2D; + {$EXTERNALSYM DIK_X} + DIK_C = $2E; + {$EXTERNALSYM DIK_C} + DIK_V = $2F; + {$EXTERNALSYM DIK_V} + DIK_B = $30; + {$EXTERNALSYM DIK_B} + DIK_N = $31; + {$EXTERNALSYM DIK_N} + DIK_M = $32; + {$EXTERNALSYM DIK_M} + DIK_COMMA = $33; + {$EXTERNALSYM DIK_COMMA} + DIK_PERIOD = $34; (* . on main keyboard *) + {$EXTERNALSYM DIK_PERIOD} + DIK_SLASH = $35; (* / on main keyboard *) + {$EXTERNALSYM DIK_SLASH} + DIK_RSHIFT = $36; + {$EXTERNALSYM DIK_RSHIFT} + DIK_MULTIPLY = $37; (* * on numeric keypad *) + {$EXTERNALSYM DIK_MULTIPLY} + DIK_LMENU = $38; (* left Alt *) + {$EXTERNALSYM DIK_LMENU} + DIK_SPACE = $39; + {$EXTERNALSYM DIK_SPACE} + DIK_CAPITAL = $3A; + {$EXTERNALSYM DIK_CAPITAL} + DIK_F1 = $3B; + {$EXTERNALSYM DIK_F1} + DIK_F2 = $3C; + {$EXTERNALSYM DIK_F2} + DIK_F3 = $3D; + {$EXTERNALSYM DIK_F3} + DIK_F4 = $3E; + {$EXTERNALSYM DIK_F4} + DIK_F5 = $3F; + {$EXTERNALSYM DIK_F5} + DIK_F6 = $40; + {$EXTERNALSYM DIK_F6} + DIK_F7 = $41; + {$EXTERNALSYM DIK_F7} + DIK_F8 = $42; + {$EXTERNALSYM DIK_F8} + DIK_F9 = $43; + {$EXTERNALSYM DIK_F9} + DIK_F10 = $44; + {$EXTERNALSYM DIK_F10} + DIK_NUMLOCK = $45; + {$EXTERNALSYM DIK_NUMLOCK} + DIK_SCROLL = $46; (* Scroll Lock *) + {$EXTERNALSYM DIK_SCROLL} + DIK_NUMPAD7 = $47; + {$EXTERNALSYM DIK_NUMPAD7} + DIK_NUMPAD8 = $48; + {$EXTERNALSYM DIK_NUMPAD8} + DIK_NUMPAD9 = $49; + {$EXTERNALSYM DIK_NUMPAD9} + DIK_SUBTRACT = $4A; (* - on numeric keypad *) + {$EXTERNALSYM DIK_SUBTRACT} + DIK_NUMPAD4 = $4B; + {$EXTERNALSYM DIK_NUMPAD4} + DIK_NUMPAD5 = $4C; + {$EXTERNALSYM DIK_NUMPAD5} + DIK_NUMPAD6 = $4D; + {$EXTERNALSYM DIK_NUMPAD6} + DIK_ADD = $4E; (* + on numeric keypad *) + {$EXTERNALSYM DIK_ADD} + DIK_NUMPAD1 = $4F; + {$EXTERNALSYM DIK_NUMPAD1} + DIK_NUMPAD2 = $50; + {$EXTERNALSYM DIK_NUMPAD2} + DIK_NUMPAD3 = $51; + {$EXTERNALSYM DIK_NUMPAD3} + DIK_NUMPAD0 = $52; + {$EXTERNALSYM DIK_NUMPAD0} + DIK_DECIMAL = $53; (* . on numeric keypad *) + {$EXTERNALSYM DIK_DECIMAL} + DIK_OEM_102 = $56; (* <> or \| on RT 102-key keyboard (Non-U.S.) *) + {$EXTERNALSYM DIK_OEM_102} + DIK_F11 = $57; + {$EXTERNALSYM DIK_F11} + DIK_F12 = $58; + {$EXTERNALSYM DIK_F12} + DIK_F13 = $64; (* (NEC PC98) *) + {$EXTERNALSYM DIK_F13} + DIK_F14 = $65; (* (NEC PC98) *) + {$EXTERNALSYM DIK_F14} + DIK_F15 = $66; (* (NEC PC98) *) + {$EXTERNALSYM DIK_F15} + DIK_KANA = $70; (* (Japanese keyboard) *) + {$EXTERNALSYM DIK_KANA} + DIK_ABNT_C1 = $73; (* /? on Brazilian keyboard *) + {$EXTERNALSYM DIK_ABNT_C1} + DIK_CONVERT = $79; (* (Japanese keyboard) *) + {$EXTERNALSYM DIK_CONVERT} + DIK_NOCONVERT = $7B; (* (Japanese keyboard) *) + {$EXTERNALSYM DIK_NOCONVERT} + DIK_YEN = $7D; (* (Japanese keyboard) *) + {$EXTERNALSYM DIK_YEN} + DIK_ABNT_C2 = $7E; (* Numpad . on Brazilian keyboard *) + {$EXTERNALSYM DIK_ABNT_C2} + DIK_NUMPADEQUALS = $8D; (* = on numeric keypad (NEC PC98) *) + {$EXTERNALSYM DIK_NUMPADEQUALS} + DIK_PREVTRACK = $90; (* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) *) + {$EXTERNALSYM DIK_PREVTRACK} + DIK_AT = $91; (* (NEC PC98) *) + {$EXTERNALSYM DIK_AT} + DIK_COLON = $92; (* (NEC PC98) *) + {$EXTERNALSYM DIK_COLON} + DIK_UNDERLINE = $93; (* (NEC PC98) *) + {$EXTERNALSYM DIK_UNDERLINE} + DIK_KANJI = $94; (* (Japanese keyboard) *) + {$EXTERNALSYM DIK_KANJI} + DIK_STOP = $95; (* (NEC PC98) *) + {$EXTERNALSYM DIK_STOP} + DIK_AX = $96; (* (Japan AX) *) + {$EXTERNALSYM DIK_AX} + DIK_UNLABELED = $97; (* (J3100) *) + {$EXTERNALSYM DIK_UNLABELED} + DIK_NEXTTRACK = $99; (* Next Track *) + {$EXTERNALSYM DIK_NEXTTRACK} + DIK_NUMPADENTER = $9C; (* Enter on numeric keypad *) + {$EXTERNALSYM DIK_NUMPADENTER} + DIK_RCONTROL = $9D; + {$EXTERNALSYM DIK_RCONTROL} + DIK_MUTE = $A0; (* Mute *) + {$EXTERNALSYM DIK_MUTE} + DIK_CALCULATOR = $A1; (* Calculator *) + {$EXTERNALSYM DIK_CALCULATOR} + DIK_PLAYPAUSE = $A2; (* Play / Pause *) + {$EXTERNALSYM DIK_PLAYPAUSE} + DIK_MEDIASTOP = $A4; (* Media Stop *) + {$EXTERNALSYM DIK_MEDIASTOP} + DIK_VOLUMEDOWN = $AE; (* Volume - *) + {$EXTERNALSYM DIK_VOLUMEDOWN} + DIK_VOLUMEUP = $B0; (* Volume + *) + {$EXTERNALSYM DIK_VOLUMEUP} + DIK_WEBHOME = $B2; (* Web home *) + {$EXTERNALSYM DIK_WEBHOME} + DIK_NUMPADCOMMA = $B3; (* , on numeric keypad (NEC PC98) *) + {$EXTERNALSYM DIK_NUMPADCOMMA} + DIK_DIVIDE = $B5; (* / on numeric keypad *) + {$EXTERNALSYM DIK_DIVIDE} + DIK_SYSRQ = $B7; + {$EXTERNALSYM DIK_SYSRQ} + DIK_RMENU = $B8; (* right Alt *) + {$EXTERNALSYM DIK_RMENU} + DIK_PAUSE = $C5; (* Pause *) + {$EXTERNALSYM DIK_PAUSE} + DIK_HOME = $C7; (* Home on arrow keypad *) + {$EXTERNALSYM DIK_HOME} + DIK_UP = $C8; (* UpArrow on arrow keypad *) + {$EXTERNALSYM DIK_UP} + DIK_PRIOR = $C9; (* PgUp on arrow keypad *) + {$EXTERNALSYM DIK_PRIOR} + DIK_LEFT = $CB; (* LeftArrow on arrow keypad *) + {$EXTERNALSYM DIK_LEFT} + DIK_RIGHT = $CD; (* RightArrow on arrow keypad *) + {$EXTERNALSYM DIK_RIGHT} + DIK_END = $CF; (* End on arrow keypad *) + {$EXTERNALSYM DIK_END} + DIK_DOWN = $D0; (* DownArrow on arrow keypad *) + {$EXTERNALSYM DIK_DOWN} + DIK_NEXT = $D1; (* PgDn on arrow keypad *) + {$EXTERNALSYM DIK_NEXT} + DIK_INSERT = $D2; (* Insert on arrow keypad *) + {$EXTERNALSYM DIK_INSERT} + DIK_DELETE = $D3; (* Delete on arrow keypad *) + {$EXTERNALSYM DIK_DELETE} + DIK_LWIN = $DB; (* Left Windows key *) + {$EXTERNALSYM DIK_LWIN} + DIK_RWIN = $DC; (* Right Windows key *) + {$EXTERNALSYM DIK_RWIN} + DIK_APPS = $DD; (* AppMenu key *) + {$EXTERNALSYM DIK_APPS} + DIK_POWER = $DE; (* System Power *) + {$EXTERNALSYM DIK_POWER} + DIK_SLEEP = $DF; (* System Sleep *) + {$EXTERNALSYM DIK_SLEEP} + DIK_WAKE = $E3; (* System Wake *) + {$EXTERNALSYM DIK_WAKE} + DIK_WEBSEARCH = $E5; (* Web Search *) + {$EXTERNALSYM DIK_WEBSEARCH} + DIK_WEBFAVORITES = $E6; (* Web Favorites *) + {$EXTERNALSYM DIK_WEBFAVORITES} + DIK_WEBREFRESH = $E7; (* Web Refresh *) + {$EXTERNALSYM DIK_WEBREFRESH} + DIK_WEBSTOP = $E8; (* Web Stop *) + {$EXTERNALSYM DIK_WEBSTOP} + DIK_WEBFORWARD = $E9; (* Web Forward *) + {$EXTERNALSYM DIK_WEBFORWARD} + DIK_WEBBACK = $EA; (* Web Back *) + {$EXTERNALSYM DIK_WEBBACK} + DIK_MYCOMPUTER = $EB; (* My Computer *) + {$EXTERNALSYM DIK_MYCOMPUTER} + DIK_MAIL = $EC; (* Mail *) + {$EXTERNALSYM DIK_MAIL} + DIK_MEDIASELECT = $ED; (* Media Select *) + {$EXTERNALSYM DIK_MEDIASELECT} + +(* + * Alternate names for keys, to facilitate transition from DOS. + *) + DIK_BACKSPACE = DIK_BACK; (* backspace *) + {$EXTERNALSYM DIK_BACKSPACE} + DIK_NUMPADSTAR = DIK_MULTIPLY; (* * on numeric keypad *) + {$EXTERNALSYM DIK_NUMPADSTAR} + DIK_LALT = DIK_LMENU; (* left Alt *) + {$EXTERNALSYM DIK_LALT} + DIK_CAPSLOCK = DIK_CAPITAL; (* CapsLock *) + {$EXTERNALSYM DIK_CAPSLOCK} + DIK_NUMPADMINUS = DIK_SUBTRACT; (* - on numeric keypad *) + {$EXTERNALSYM DIK_NUMPADMINUS} + DIK_NUMPADPLUS = DIK_ADD; (* + on numeric keypad *) + {$EXTERNALSYM DIK_NUMPADPLUS} + DIK_NUMPADPERIOD = DIK_DECIMAL; (* . on numeric keypad *) + {$EXTERNALSYM DIK_NUMPADPERIOD} + DIK_NUMPADSLASH = DIK_DIVIDE; (* / on numeric keypad *) + {$EXTERNALSYM DIK_NUMPADSLASH} + DIK_RALT = DIK_RMENU; (* right Alt *) + {$EXTERNALSYM DIK_RALT} + DIK_UPARROW = DIK_UP; (* UpArrow on arrow keypad *) + {$EXTERNALSYM DIK_UPARROW} + DIK_PGUP = DIK_PRIOR; (* PgUp on arrow keypad *) + {$EXTERNALSYM DIK_PGUP} + DIK_LEFTARROW = DIK_LEFT; (* LeftArrow on arrow keypad *) + {$EXTERNALSYM DIK_LEFTARROW} + DIK_RIGHTARROW = DIK_RIGHT; (* RightArrow on arrow keypad *) + {$EXTERNALSYM DIK_RIGHTARROW} + DIK_DOWNARROW = DIK_DOWN; (* DownArrow on arrow keypad *) + {$EXTERNALSYM DIK_DOWNARROW} + DIK_PGDN = DIK_NEXT; (* PgDn on arrow keypad *) + {$EXTERNALSYM DIK_PGDN} + +(* + * Alternate names for keys originally not used on US keyboards. + *) + DIK_CIRCUMFLEX = DIK_PREVTRACK; (* Japanese keyboard *) + {$EXTERNALSYM DIK_CIRCUMFLEX} + +(**************************************************************************** + * + * Joystick + * + ****************************************************************************) + +type + PDIJoyState = ^TDIJoyState; + DIJOYSTATE = packed record + lX: Longint; (* x-axis position *) + lY: Longint; (* y-axis position *) + lZ: Longint; (* z-axis position *) + lRx: Longint; (* x-axis rotation *) + lRy: Longint; (* y-axis rotation *) + lRz: Longint; (* z-axis rotation *) + rglSlider: array[0..1] of Longint; (* extra axes positions *) + rgdwPOV: array[0..3] of DWORD; (* POV directions *) + rgbButtons: array[0..31] of Byte; (* 32 buttons *) + end; + {$EXTERNALSYM DIJOYSTATE} + TDIJoyState = DIJOYSTATE; + + PDIJoyState2 = ^TDIJoyState2; + DIJOYSTATE2 = packed record + lX: Longint; (* x-axis position *) + lY: Longint; (* y-axis position *) + lZ: Longint; (* z-axis position *) + lRx: Longint; (* x-axis rotation *) + lRy: Longint; (* y-axis rotation *) + lRz: Longint; (* z-axis rotation *) + rglSlider: array[0..1] of Longint; (* extra axes positions *) + rgdwPOV: array[0..3] of DWORD; (* POV directions *) + rgbButtons: array[0..127] of Byte; (* 128 buttons *) + lVX: Longint; (* x-axis velocity *) + lVY: Longint; (* y-axis velocity *) + lVZ: Longint; (* z-axis velocity *) + lVRx: Longint; (* x-axis angular velocity *) + lVRy: Longint; (* y-axis angular velocity *) + lVRz: Longint; (* z-axis angular velocity *) + rglVSlider: array[0..1] of Longint; (* extra axes velocities *) + lAX: Longint; (* x-axis acceleration *) + lAY: Longint; (* y-axis acceleration *) + lAZ: Longint; (* z-axis acceleration *) + lARx: Longint; (* x-axis angular acceleration *) + lARy: Longint; (* y-axis angular acceleration *) + lARz: Longint; (* z-axis angular acceleration *) + rglASlider: array[0..1] of Longint; (* extra axes accelerations *) + lFX: Longint; (* x-axis force *) + lFY: Longint; (* y-axis force *) + lFZ: Longint; (* z-axis force *) + lFRx: Longint; (* x-axis torque *) + lFRy: Longint; (* y-axis torque *) + lFRz: Longint; (* z-axis torque *) + rglFSlider: array[0..1] of Longint; (* extra axes forces *) + end; + {$EXTERNALSYM DIJOYSTATE2} + TDIJoyState2 = DIJOYSTATE2; + +const + DIJOFS_X = 0; // FIELD_OFFSET(DIJOYSTATE, lX) + {$EXTERNALSYM DIJOFS_X} + DIJOFS_Y = 4; // FIELD_OFFSET(DIJOYSTATE, lY) + {$EXTERNALSYM DIJOFS_Y} + DIJOFS_Z = 8; // FIELD_OFFSET(DIJOYSTATE, lZ) + {$EXTERNALSYM DIJOFS_Z} + DIJOFS_RX = 12; // FIELD_OFFSET(DIJOYSTATE, lRx) + {$EXTERNALSYM DIJOFS_RX} + DIJOFS_RY = 16; // FIELD_OFFSET(DIJOYSTATE, lRy) + {$EXTERNALSYM DIJOFS_RY} + DIJOFS_RZ = 20; // FIELD_OFFSET(DIJOYSTATE, lRz) + {$EXTERNALSYM DIJOFS_RZ} + +// #define DIJOFS_SLIDER(n) (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \ +// (n) * sizeof(LONG)) +function DIJOFS_SLIDER(n: Cardinal): Cardinal; +{$EXTERNALSYM DIJOFS_SLIDER} + +// #define DIJOFS_POV(n) (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \ +// (n) * sizeof(DWORD)) +function DIJOFS_POV(n: Cardinal): Cardinal; +{$EXTERNALSYM DIJOFS_POV} + +// #define DIJOFS_BUTTON(n) (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n)) +function DIJOFS_BUTTON(n: Cardinal): Cardinal; +{$EXTERNALSYM DIJOFS_BUTTON} + +const + DIJOFS_BUTTON_ = 48; // Helper const + + DIJOFS_BUTTON0 = DIJOFS_BUTTON_ + 0; // DIJOFS_BUTTON(0) + {$EXTERNALSYM DIJOFS_BUTTON0} + DIJOFS_BUTTON1 = DIJOFS_BUTTON_ + 1; // DIJOFS_BUTTON(1) + {$EXTERNALSYM DIJOFS_BUTTON1} + DIJOFS_BUTTON2 = DIJOFS_BUTTON_ + 2; // DIJOFS_BUTTON(2) + {$EXTERNALSYM DIJOFS_BUTTON2} + DIJOFS_BUTTON3 = DIJOFS_BUTTON_ + 3; // DIJOFS_BUTTON(3) + {$EXTERNALSYM DIJOFS_BUTTON3} + DIJOFS_BUTTON4 = DIJOFS_BUTTON_ + 4; // DIJOFS_BUTTON(4) + {$EXTERNALSYM DIJOFS_BUTTON4} + DIJOFS_BUTTON5 = DIJOFS_BUTTON_ + 5; // DIJOFS_BUTTON(5) + {$EXTERNALSYM DIJOFS_BUTTON5} + DIJOFS_BUTTON6 = DIJOFS_BUTTON_ + 6; // DIJOFS_BUTTON(6) + {$EXTERNALSYM DIJOFS_BUTTON6} + DIJOFS_BUTTON7 = DIJOFS_BUTTON_ + 7; // DIJOFS_BUTTON(7) + {$EXTERNALSYM DIJOFS_BUTTON7} + DIJOFS_BUTTON8 = DIJOFS_BUTTON_ + 8; // DIJOFS_BUTTON(8) + {$EXTERNALSYM DIJOFS_BUTTON8} + DIJOFS_BUTTON9 = DIJOFS_BUTTON_ + 9; // DIJOFS_BUTTON(9) + {$EXTERNALSYM DIJOFS_BUTTON9} + DIJOFS_BUTTON10 = DIJOFS_BUTTON_ + 10; // DIJOFS_BUTTON(10) + {$EXTERNALSYM DIJOFS_BUTTON10} + DIJOFS_BUTTON11 = DIJOFS_BUTTON_ + 11; // DIJOFS_BUTTON(11) + {$EXTERNALSYM DIJOFS_BUTTON11} + DIJOFS_BUTTON12 = DIJOFS_BUTTON_ + 12; // DIJOFS_BUTTON(12) + {$EXTERNALSYM DIJOFS_BUTTON12} + DIJOFS_BUTTON13 = DIJOFS_BUTTON_ + 13; // DIJOFS_BUTTON(13) + {$EXTERNALSYM DIJOFS_BUTTON13} + DIJOFS_BUTTON14 = DIJOFS_BUTTON_ + 14; // DIJOFS_BUTTON(14) + {$EXTERNALSYM DIJOFS_BUTTON14} + DIJOFS_BUTTON15 = DIJOFS_BUTTON_ + 15; // DIJOFS_BUTTON(15) + {$EXTERNALSYM DIJOFS_BUTTON15} + DIJOFS_BUTTON16 = DIJOFS_BUTTON_ + 16; // DIJOFS_BUTTON(16) + {$EXTERNALSYM DIJOFS_BUTTON16} + DIJOFS_BUTTON17 = DIJOFS_BUTTON_ + 17; // DIJOFS_BUTTON(17) + {$EXTERNALSYM DIJOFS_BUTTON17} + DIJOFS_BUTTON18 = DIJOFS_BUTTON_ + 18; // DIJOFS_BUTTON(18) + {$EXTERNALSYM DIJOFS_BUTTON18} + DIJOFS_BUTTON19 = DIJOFS_BUTTON_ + 19; // DIJOFS_BUTTON(19) + {$EXTERNALSYM DIJOFS_BUTTON19} + DIJOFS_BUTTON20 = DIJOFS_BUTTON_ + 20; // DIJOFS_BUTTON(20) + {$EXTERNALSYM DIJOFS_BUTTON20} + DIJOFS_BUTTON21 = DIJOFS_BUTTON_ + 21; // DIJOFS_BUTTON(21) + {$EXTERNALSYM DIJOFS_BUTTON21} + DIJOFS_BUTTON22 = DIJOFS_BUTTON_ + 22; // DIJOFS_BUTTON(22) + {$EXTERNALSYM DIJOFS_BUTTON22} + DIJOFS_BUTTON23 = DIJOFS_BUTTON_ + 23; // DIJOFS_BUTTON(23) + {$EXTERNALSYM DIJOFS_BUTTON23} + DIJOFS_BUTTON24 = DIJOFS_BUTTON_ + 24; // DIJOFS_BUTTON(24) + {$EXTERNALSYM DIJOFS_BUTTON24} + DIJOFS_BUTTON25 = DIJOFS_BUTTON_ + 25; // DIJOFS_BUTTON(25) + {$EXTERNALSYM DIJOFS_BUTTON25} + DIJOFS_BUTTON26 = DIJOFS_BUTTON_ + 26; // DIJOFS_BUTTON(26) + {$EXTERNALSYM DIJOFS_BUTTON26} + DIJOFS_BUTTON27 = DIJOFS_BUTTON_ + 27; // DIJOFS_BUTTON(27) + {$EXTERNALSYM DIJOFS_BUTTON27} + DIJOFS_BUTTON28 = DIJOFS_BUTTON_ + 28; // DIJOFS_BUTTON(28) + {$EXTERNALSYM DIJOFS_BUTTON28} + DIJOFS_BUTTON29 = DIJOFS_BUTTON_ + 29; // DIJOFS_BUTTON(29) + {$EXTERNALSYM DIJOFS_BUTTON29} + DIJOFS_BUTTON30 = DIJOFS_BUTTON_ + 30; // DIJOFS_BUTTON(30) + {$EXTERNALSYM DIJOFS_BUTTON30} + DIJOFS_BUTTON31 = DIJOFS_BUTTON_ + 31; // DIJOFS_BUTTON(31) + {$EXTERNALSYM DIJOFS_BUTTON31} + +const + rgodfDIMouse: array[0..6] of TDIObjectDataFormat = ( + (pguid: @GUID_XAxis; dwOfs: DIMOFS_X; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE; dwFlags: 0), + (pguid: @GUID_YAxis; dwOfs: DIMOFS_Y; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE; dwFlags: 0), + (pguid: @GUID_ZAxis; dwOfs: DIMOFS_Z; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON0; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON1; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON2; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON3; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0) + ); + {$EXTERNALSYM rgodfDIMouse} + + c_dfDIMouse: TDIDataFormat = ( + dwSize: Sizeof(c_dfDIMouse); // $18 + dwObjSize: Sizeof(TDIObjectDataFormat); // $10 + dwFlags: DIDF_RELAXIS; // $2 + dwDataSize: Sizeof(TDIMouseState); // $10 + dwNumObjs: High(rgodfDIMouse) + 1; + rgodf: @rgodfDIMouse + ); + {$EXTERNALSYM c_dfDIMouse} + + +{$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *) + rgodfDIMouse2: array[0..10] of TDIObjectDataFormat = ( + (pguid: @GUID_XAxis; dwOfs: DIMOFS_X; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE; dwFlags: 0), + (pguid: @GUID_YAxis; dwOfs: DIMOFS_Y; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE; dwFlags: 0), + (pguid: @GUID_ZAxis; dwOfs: DIMOFS_Z; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), // DIDFT_ENUMCOLLECTION(DIDFT_ALIAS) == $80000000 + (pguid: nil; dwOfs: DIMOFS_BUTTON0; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON1; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON2; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON3; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON4; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON5; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON6; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIMOFS_BUTTON7; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0) + ); + {$EXTERNALSYM rgodfDIMouse2} + + c_dfDIMouse2: TDIDataFormat = ( + dwSize : Sizeof(c_dfDIMouse2); // $18 + dwObjSize : Sizeof(TDIObjectDataFormat); // $10 + dwFlags : DIDF_RELAXIS; // $2 + dwDataSize : Sizeof(TDIMouseState2); // $10 + dwNumObjs : High(rgodfDIMouse2) + 1; + rgodf : @rgodfDIMouse2 + ); + {$EXTERNALSYM c_dfDIMouse2} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *) + + +const + rgodfKeyboard: array[0..255] of TDIObjectDataFormat = ( + (pguid: @GUID_Key; dwOfs: 0; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 0 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 1; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 1 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 2; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 2 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 3; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 3 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 4; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 4 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 5; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 5 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 6; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 6 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 7; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 7 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 8; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 8 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 9; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 9 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 10; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 10 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 11; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 11 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 12; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 12 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 13; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 13 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 14; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 14 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 15; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 15 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 16; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 16 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 17; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 17 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 18; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 18 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 19; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 19 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 20; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 20 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 21; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 21 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 22; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 22 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 23; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 23 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 24; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 24 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 25; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 25 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 26; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 26 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 27; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 27 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 28; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 28 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 29; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 29 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 30; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 30 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 31; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 31 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 32; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 32 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 33; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 33 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 34; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 34 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 35; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 35 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 36; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 36 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 37; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 37 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 38; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 38 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 39; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 39 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 40; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 40 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 41; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 41 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 42; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 42 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 43; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 43 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 44; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 44 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 45; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 45 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 46; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 46 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 47; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 47 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 48; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 48 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 49; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 49 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 50; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 50 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 51; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 51 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 52; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 52 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 53; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 53 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 54; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 54 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 55; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 55 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 56; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 56 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 57; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 57 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 58; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 58 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 59; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 59 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 60; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 60 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 61; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 61 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 62; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 62 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 63; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 63 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 64; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 64 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 65; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 65 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 66; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 66 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 67; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 67 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 68; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 68 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 69; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 69 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 70; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 70 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 71; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 71 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 72; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 72 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 73; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 73 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 74; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 74 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 75; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 75 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 76; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 76 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 77; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 77 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 78; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 78 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 79; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 79 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 80; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 80 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 81; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 81 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 82; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 82 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 83; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 83 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 84; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 84 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 85; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 85 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 86; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 86 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 87; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 87 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 88; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 88 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 89; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 89 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 90; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 90 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 91; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 91 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 92; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 92 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 93; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 93 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 94; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 94 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 95; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 95 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 96; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 96 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 97; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 97 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 98; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 98 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 99; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or ( 99 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 100; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (100 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 101; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (101 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 102; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (102 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 103; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (103 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 104; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (104 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 105; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (105 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 106; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (106 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 107; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (107 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 108; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (108 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 109; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (109 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 110; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (110 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 111; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (111 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 112; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (112 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 113; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (113 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 114; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (114 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 115; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (115 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 116; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (116 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 117; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (117 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 118; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (118 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 119; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (119 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 120; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (120 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 121; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (121 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 122; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (122 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 123; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (123 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 124; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (124 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 125; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (125 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 126; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (126 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 127; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (127 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 128; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (128 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 129; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (129 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 130; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (130 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 131; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (131 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 132; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (132 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 133; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (133 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 134; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (134 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 135; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (135 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 136; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (136 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 137; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (137 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 138; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (138 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 139; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (139 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 140; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (140 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 141; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (141 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 142; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (142 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 143; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (143 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 144; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (144 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 145; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (145 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 146; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (146 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 147; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (147 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 148; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (148 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 149; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (149 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 150; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (150 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 151; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (151 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 152; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (152 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 153; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (153 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 154; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (154 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 155; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (155 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 156; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (156 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 157; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (157 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 158; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (158 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 159; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (159 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 160; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (160 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 161; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (161 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 162; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (162 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 163; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (163 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 164; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (164 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 165; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (165 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 166; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (166 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 167; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (167 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 168; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (168 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 169; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (169 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 170; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (170 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 171; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (171 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 172; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (172 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 173; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (173 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 174; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (174 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 175; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (175 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 176; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (176 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 177; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (177 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 178; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (178 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 179; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (179 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 180; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (180 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 181; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (181 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 182; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (182 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 183; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (183 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 184; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (184 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 185; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (185 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 186; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (186 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 187; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (187 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 188; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (188 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 189; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (189 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 190; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (190 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 191; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (191 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 192; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (192 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 193; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (193 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 194; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (194 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 195; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (195 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 196; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (196 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 197; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (197 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 198; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (198 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 199; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (199 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 200; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (200 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 201; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (201 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 202; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (202 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 203; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (203 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 204; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (204 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 205; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (205 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 206; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (206 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 207; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (207 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 208; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (208 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 209; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (209 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 210; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (210 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 211; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (211 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 212; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (212 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 213; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (213 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 214; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (214 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 215; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (215 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 216; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (216 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 217; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (217 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 218; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (218 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 219; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (219 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 220; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (220 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 221; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (221 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 222; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (222 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 223; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (223 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 224; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (224 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 225; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (225 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 226; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (226 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 227; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (227 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 228; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (228 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 229; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (229 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 230; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (230 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 231; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (231 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 232; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (232 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 233; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (233 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 234; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (234 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 235; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (235 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 236; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (236 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 237; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (237 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 238; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (238 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 239; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (239 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 240; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (240 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 241; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (241 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 242; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (242 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 243; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (243 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 244; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (244 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 245; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (245 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 246; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (246 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 247; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (247 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 248; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (248 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 249; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (249 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 250; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (250 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 251; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (251 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 252; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (252 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 253; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (253 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 254; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (254 shl 8); dwFlags: 0), + (pguid: @GUID_Key; dwOfs: 255; dwType: DIDFT_BUTTON or DIPROPRANGE_NOMIN or (255 shl 8); dwFlags: 0) + ); + {$EXTERNALSYM rgodfKeyboard} + +const + c_dfDIKeyboard: TDIDataFormat = ( + dwSize : Sizeof(c_dfDIKeyboard); + dwObjSize : Sizeof(TDIObjectDataFormat); + dwFlags : DIDF_RELAXIS; + dwDataSize : 256; + dwNumObjs : High(rgodfKeyboard) + 1; + rgodf : @rgodfKeyboard + ); + {$EXTERNALSYM c_dfDIKeyboard} + + +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + rgodfJoystick: array[0..43] of TDIObjectDataFormat = ( + (pguid: @GUID_XAxis; dwOfs: DIJOFS_X; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_YAxis; dwOfs: DIJOFS_Y; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_ZAxis; dwOfs: DIJOFS_Z; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_RxAxis; dwOfs: DIJOFS_RX; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_RyAxis; dwOfs: DIJOFS_RY; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_RzAxis; dwOfs: DIJOFS_RZ; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + // 2 Sliders + (pguid: @GUID_Slider; dwOfs: 24; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_Slider; dwOfs: 28; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + // 4 POVs (yes, really) + (pguid: @GUID_POV; dwOfs: 32; dwType: DIDFT_POV or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: @GUID_POV; dwOfs: 36; dwType: DIDFT_POV or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: @GUID_POV; dwOfs: 40; dwType: DIDFT_POV or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: @GUID_POV; dwOfs: 44; dwType: DIDFT_POV or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + // Buttons + (pguid: nil; dwOfs: DIJOFS_BUTTON0; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON1; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON2; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON3; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON4; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON5; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON6; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON7; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON8; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON9; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON10; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON11; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON12; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON13; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON14; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON15; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON16; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON17; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON18; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON19; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON20; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON21; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON22; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON23; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON24; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON25; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON26; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON27; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON28; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON29; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON30; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON31; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0) + ); + {$EXTERNALSYM rgodfJoystick} + + c_dfDIJoystick: TDIDataFormat = ( + dwSize : Sizeof(c_dfDIJoystick); + dwObjSize : Sizeof(TDIObjectDataFormat); // $10 + dwFlags : DIDF_ABSAXIS; + dwDataSize : SizeOf(TDIJoyState); // $10 + dwNumObjs : High(rgodfJoystick) + 1; // $2C + rgodf : @rgodfJoystick + ); + {$EXTERNALSYM c_dfDIJoystick} + + + rgodfJoystick2: array[0..163] of TDIObjectDataFormat = ( + (pguid: @GUID_XAxis; dwOfs: DIJOFS_X; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_YAxis; dwOfs: DIJOFS_Y; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_ZAxis; dwOfs: DIJOFS_Z; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_RxAxis; dwOfs: DIJOFS_RX; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_RyAxis; dwOfs: DIJOFS_RY; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_RzAxis; dwOfs: DIJOFS_RZ; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + // 2 Sliders + (pguid: @GUID_Slider; dwOfs: 24; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + (pguid: @GUID_Slider; dwOfs: 28; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTPOSITION), + // 4 POVs (yes, really) + (pguid: @GUID_POV; dwOfs: 32; dwType: DIDFT_POV or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: @GUID_POV; dwOfs: 36; dwType: DIDFT_POV or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: @GUID_POV; dwOfs: 40; dwType: DIDFT_POV or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: @GUID_POV; dwOfs: 44; dwType: DIDFT_POV or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + // Buttons + (pguid: nil; dwOfs: DIJOFS_BUTTON0; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON1; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON2; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON3; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON4; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON5; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON6; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON7; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON8; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON9; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON10; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON11; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON12; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON13; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON14; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON15; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON16; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON17; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON18; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON19; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON20; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON21; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON22; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON23; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON24; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON25; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON26; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON27; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON28; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON29; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON30; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: DIJOFS_BUTTON31; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: 0), + (pguid: nil; dwOfs: 80; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 81; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 82; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 83; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 84; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 85; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 86; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 87; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 88; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 89; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 90; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 91; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 92; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 93; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 94; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 95; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 96; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 97; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 98; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 99; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 100; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 101; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 102; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 103; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 104; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 105; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 106; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 107; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 108; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 109; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 110; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 111; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 112; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 113; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 114; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 115; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 116; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 117; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 118; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 119; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 120; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 121; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 122; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 123; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 124; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 125; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 126; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 127; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 128; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 129; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 130; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 131; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 132; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 133; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 134; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 135; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 136; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 137; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 138; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 139; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 140; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 141; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 142; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 143; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 144; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 145; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 146; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 147; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 148; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 149; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 150; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 151; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 152; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 153; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 154; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 155; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 156; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 157; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 158; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 159; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 160; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 161; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 162; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 163; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 164; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 165; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 166; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 167; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 168; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 169; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 170; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 171; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 172; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 173; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 174; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: nil; dwOfs: 175; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE or $80000000; dwFlags: $0), + (pguid: @GUID_XAxis; dwOfs: 176; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTVELOCITY), + (pguid: @GUID_YAxis; dwOfs: 180; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTVELOCITY), + (pguid: @GUID_ZAxis; dwOfs: 184; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTVELOCITY), + (pguid: @GUID_RxAxis; dwOfs: 188; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTVELOCITY), + (pguid: @GUID_RyAxis; dwOfs: 192; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTVELOCITY), + (pguid: @GUID_RzAxis; dwOfs: 196; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTVELOCITY), + (pguid: @GUID_Slider; dwOfs: 24; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTVELOCITY), + (pguid: @GUID_Slider; dwOfs: 28; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTVELOCITY), + (pguid: @GUID_XAxis; dwOfs: 208; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTACCEL), + (pguid: @GUID_YAxis; dwOfs: 212; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTACCEL), + (pguid: @GUID_ZAxis; dwOfs: 216; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTACCEL), + (pguid: @GUID_RxAxis; dwOfs: 220; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTACCEL), + (pguid: @GUID_RyAxis; dwOfs: 224; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTACCEL), + (pguid: @GUID_RzAxis; dwOfs: 228; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTACCEL), + (pguid: @GUID_Slider; dwOfs: 24; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTACCEL), + (pguid: @GUID_Slider; dwOfs: 28; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTACCEL), + (pguid: @GUID_XAxis; dwOfs: 240; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTFORCE), + (pguid: @GUID_YAxis; dwOfs: 244; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTFORCE), + (pguid: @GUID_ZAxis; dwOfs: 248; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTFORCE), + (pguid: @GUID_RxAxis; dwOfs: 252; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTFORCE), + (pguid: @GUID_RyAxis; dwOfs: 256; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTFORCE), + (pguid: @GUID_RzAxis; dwOfs: 260; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTFORCE), + (pguid: @GUID_Slider; dwOfs: 24; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTFORCE), + (pguid: @GUID_Slider; dwOfs: 28; dwType: DIDFT_AXIS or DIDFT_ANYINSTANCE or $80000000; dwFlags: DIDOI_ASPECTFORCE) + ); + {$EXTERNALSYM rgodfJoystick2} + + c_dfDIJoystick2: TDIDataFormat = ( + dwSize : Sizeof(c_dfDIJoystick2); + dwObjSize : Sizeof(TDIObjectDataFormat); + dwFlags : DIDF_ABSAXIS; + dwDataSize : SizeOf(TDIJoyState2); + dwNumObjs : High(rgodfJoystick2) + 1; + rgodf : @rgodfJoystick2 + ); + {$EXTERNALSYM c_dfDIJoystick2} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) + + + +(**************************************************************************** + * + * IDirectInput + * + ****************************************************************************) + +const + DIENUM_STOP = BOOL(0); + {$EXTERNALSYM DIENUM_STOP} + DIENUM_CONTINUE = BOOL(1); + {$EXTERNALSYM DIENUM_CONTINUE} + +type + TDIEnumDevicesCallbackA = function (var lpddi: TDIDeviceInstanceA; pvRef: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDIEnumDevicesCallbackA} + TDIEnumDevicesCallbackW = function (var lpddi: TDIDeviceInstanceW; pvRef: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDIEnumDevicesCallbackW} + TDIEnumDevicesCallback = TDIEnumDevicesCallbackA; + {$EXTERNALSYM TDIEnumDevicesCallback} + TDIConfigureDevicesCallback = function (lpDDSTarget: IUnknown; pvRef: Pointer): BOOL; stdcall; + +const + DIEDFL_ALLDEVICES = $00000000; + {$EXTERNALSYM DIEDFL_ALLDEVICES} + DIEDFL_ATTACHEDONLY = $00000001; + {$EXTERNALSYM DIEDFL_ATTACHEDONLY} +{$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *) + DIEDFL_FORCEFEEDBACK = $00000100; + {$EXTERNALSYM DIEDFL_FORCEFEEDBACK} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *) +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) + DIEDFL_INCLUDEALIASES = $00010000; + {$EXTERNALSYM DIEDFL_INCLUDEALIASES} + DIEDFL_INCLUDEPHANTOMS = $00020000; + {$EXTERNALSYM DIEDFL_INCLUDEPHANTOMS} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) + DIEDFL_INCLUDEHIDDEN = $00040000; + {$EXTERNALSYM DIEDFL_INCLUDEHIDDEN} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + + +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) +type + TDIEnumDevicesBySemanticsCallbackA = function (var lpddi: TDIDeviceInstanceA; lpdid: IDirectInputDevice8A; dwFlags, dwRemaining: DWORD; pvRef: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDIEnumDevicesBySemanticsCallbackA} + TDIEnumDevicesBySemanticsCallbackW = function (var lpddi: TDIDeviceInstanceW; lpdid: IDirectInputDevice8W; dwFlags, dwRemaining: DWORD; pvRef: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDIEnumDevicesBySemanticsCallbackW} + TDIEnumDevicesBySemanticsCallback = TDIEnumDevicesBySemanticsCallbackA; + {$EXTERNALSYM TDIEnumDevicesBySemanticsCallback} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) +const + DIEDBS_MAPPEDPRI1 = $00000001; + {$EXTERNALSYM DIEDBS_MAPPEDPRI1} + DIEDBS_MAPPEDPRI2 = $00000002; + {$EXTERNALSYM DIEDBS_MAPPEDPRI2} + DIEDBS_RECENTDEVICE = $00000010; + {$EXTERNALSYM DIEDBS_RECENTDEVICE} + DIEDBS_NEWDEVICE = $00000020; + {$EXTERNALSYM DIEDBS_NEWDEVICE} + + DIEDBSFL_ATTACHEDONLY = $00000000; + {$EXTERNALSYM DIEDBSFL_ATTACHEDONLY} + DIEDBSFL_THISUSER = $00000010; + {$EXTERNALSYM DIEDBSFL_THISUSER} + DIEDBSFL_FORCEFEEDBACK = DIEDFL_FORCEFEEDBACK; + {$EXTERNALSYM DIEDBSFL_FORCEFEEDBACK} + DIEDBSFL_AVAILABLEDEVICES = $00001000; + {$EXTERNALSYM DIEDBSFL_AVAILABLEDEVICES} + DIEDBSFL_MULTIMICEKEYBOARDS = $00002000; + {$EXTERNALSYM DIEDBSFL_MULTIMICEKEYBOARDS} + DIEDBSFL_NONGAMINGDEVICES = $00004000; + {$EXTERNALSYM DIEDBSFL_NONGAMINGDEVICES} + DIEDBSFL_VALID = $00007110; + {$EXTERNALSYM DIEDBSFL_VALID} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + +type + {$EXTERNALSYM IDirectInputA} + IDirectInputA = interface(IUnknown) + [SID_IDirectInputA] + (*** IDirectInputA methods ***) + function CreateDevice(const rguid: TGUID; out lplpDirectInputDevice: IDirectInputDeviceA; pUnkOuter: IUnknown): HResult; stdcall; + function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackA; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetDeviceStatus(const rguidInstance: TGUID): HResult; stdcall; + function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall; + function Initialize(hinst: THandle; dwVersion: DWORD): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInputW} + IDirectInputW = interface(IUnknown) + [SID_IDirectInputW] + (*** IDirectInputW methods ***) + function CreateDevice(const rguid: TGUID; out lplpDirectInputDevice: IDirectInputDeviceW; pUnkOuter: IUnknown): HResult; stdcall; + function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackW; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetDeviceStatus(const rguidInstance: TGUID): HResult; stdcall; + function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall; + function Initialize(hinst: THandle; dwVersion: DWORD): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInput} + IDirectInput = IDirectInputA; +type + IID_IDirectInput = IDirectInput; + {$EXTERNALSYM IID_IDirectInput} + +type + {$EXTERNALSYM IDirectInput2A} + IDirectInput2A = interface(IDirectInputA) + [SID_IDirectInput2A] + (*** IDirectInput2A methods ***) + function FindDevice(const rguidClass: TGUID; ptszName: PAnsiChar; out pguidInstance: TGUID): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInput2W} + IDirectInput2W = interface(IDirectInputW) + [SID_IDirectInput2W] + (*** IDirectInput2W methods ***) + function FindDevice(const rguidClass: TGUID; ptszName: PWideChar; out pguidInstance: TGUID): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInput2} + IDirectInput2 = IDirectInput2A; +type + IID_IDirectInput2 = IDirectInput2; + {$EXTERNALSYM IID_IDirectInput2} + +type + {$EXTERNALSYM IDirectInput7A} + IDirectInput7A = interface(IDirectInput2A) + [SID_IDirectInput7A] + (*** IDirectInput7A methods ***) + function CreateDeviceEx(const rguid, riid: TGUID; out pvOut: Pointer; pUnkOuter: IUnknown) : HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInput7W} + IDirectInput7W = interface(IDirectInput2W) + [SID_IDirectInput7W] + (*** IDirectInput7W methods ***) + function CreateDeviceEx(const rguid, riid: TGUID; out pvOut: Pointer; pUnkOuter: IUnknown) : HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInput7} + IDirectInput7 = IDirectInput7A; +type + IID_IDirectInput7 = IDirectInput7; + {$EXTERNALSYM IID_IDirectInput7} + +{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *) +type + {$EXTERNALSYM IDirectInput8A} + IDirectInput8A = interface(IUnknown) + [SID_IDirectInput8A] + (*** IDirectInput8A methods ***) + function CreateDevice(const rguid: TGUID; out lplpDirectInputDevice: IDirectInputDevice8A; pUnkOuter: IUnknown): HResult; stdcall; + function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackA; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetDeviceStatus(const rguidInstance: TGUID): HResult; stdcall; + function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall; + function Initialize(hinst: THandle; dwVersion: DWORD): HResult; stdcall; + function FindDevice(const rguidClass: TGUID; ptszName: PAnsiChar; out pguidInstance: TGUID): HResult; stdcall; + function EnumDevicesBySemantics(ptszUserName: PAnsiChar; lpdiActionFormat: TDIActionFormatA; lpCallback: TDIEnumDevicesBySemanticsCallbackA; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function ConfigureDevices(lpdiCallback: TDIConfigureDevicesCallback; lpdiCDParams: TDIConfigureDevicesParamsA; dwFlags: DWORD; pvRefData: Pointer): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInput8W} + IDirectInput8W = interface(IUnknown) + [SID_IDirectInput8W] + (*** IDirectInput8W methods ***) + function CreateDevice(const rguid: TGUID; out lplpDirectInputDevice: IDirectInputDevice8W; pUnkOuter: IUnknown): HResult; stdcall; + function EnumDevices(dwDevType: DWORD; lpCallback: TDIEnumDevicesCallbackW; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetDeviceStatus(const rguidInstance: TGUID): HResult; stdcall; + function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall; + function Initialize(hinst: THandle; dwVersion: DWORD): HResult; stdcall; + function FindDevice(const rguidClass: TGUID; ptszName: PWideChar; out pguidInstance: TGUID): HResult; stdcall; + function EnumDevicesBySemantics(ptszUserName: PWideChar; lpdiActionFormat: TDIActionFormatW; lpCallback: TDIEnumDevicesBySemanticsCallbackW; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall; + function ConfigureDevices(lpdiCallback: TDIConfigureDevicesCallback; lpdiCDParams: TDIConfigureDevicesParamsW; dwFlags: DWORD; pvRefData: Pointer): HResult; stdcall; + end; + + {$EXTERNALSYM IDirectInput8} + IDirectInput8 = IDirectInput8A; +type + IID_IDirectInput8 = IDirectInput8; + {$EXTERNALSYM IID_IDirectInput8} +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *) + + +const + DirectInputDll = 'dinput.dll'; + DirectInput8Dll = 'dinput8.dll'; + +function DirectInputLoaded: Boolean; +function UnLoadDirectInput: Boolean; +function LoadDirectInput: Boolean; + +{$IFDEF DIRECTINPUT_DYNAMIC_LINK} +//{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION > 0x0700) *) +var + DirectInput8Create: function(hinst: THandle; dwVersion: Cardinal; const riidltf: TGUID; out ppvOut; punkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectInput8Create} + +//{$ELSE} + DirectInputCreateA: function(hinst: THandle; dwVersion: DWORD; out ppDI: IDirectInputA; punkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectInputCreateA} + DirectInputCreateW: function(hinst: THandle; dwVersion: DWORD; out ppDI: IDirectInputW; punkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectInputCreateW} + DirectInputCreate: function(hinst: THandle; dwVersion: DWORD; out ppDI: IDirectInput; punkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectInputCreate} + + DirectInputCreateEx: function(hinst : THandle; dwVersion: DWORD; const riidltf: TGUID; out ppvOut; punkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectInputCreateEx} + +//{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *) +{$ELSE} +//{$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION > 0x0700) *) +function DirectInput8Create(hinst: THandle; dwVersion: DWORD; const riidltf: TGUID; out ppvOut{: Pointer}; punkOuter: IUnknown): HResult; stdcall; external DirectInput8Dll; +{$EXTERNALSYM DirectInput8Create} + +//{$ELSE} +function DirectInputCreateA(hinst: THandle; dwVersion: DWORD; out ppDI: IDirectInputA; punkOuter: IUnknown): HResult; stdcall; external DirectInputDll name 'DirectInputCreateA'; +{$EXTERNALSYM DirectInputCreateA} +function DirectInputCreateW(hinst: THandle; dwVersion: DWORD; out ppDI: IDirectInputW; punkOuter: IUnknown): HResult; stdcall; external DirectInputDll name 'DirectInputCreateW'; +{$EXTERNALSYM DirectInputCreateW} +function DirectInputCreate(hinst: THandle; dwVersion: DWORD; out ppDI: IDirectInput; punkOuter: IUnknown): HResult; stdcall; external DirectInputDll name 'DirectInputCreateA'; +{$EXTERNALSYM DirectInputCreate} + +function DirectInputCreateEx(hinst: THandle; dwVersion: DWORD; const riidltf: TGUID; out ppvOut{: Pointer}; punkOuter: IUnknown): HResult; stdcall; external DirectInputDll; +{$EXTERNALSYM DirectInputCreateEx} + +//{$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *) +{$ENDIF} + + +(**************************************************************************** + * + * Return Codes + * + ****************************************************************************) + +const +(* + * The operation completed successfully. + *) + DI_OK = S_OK; + {$EXTERNALSYM DI_OK} + +(* + * The device exists but is not currently attached. + *) + DI_NOTATTACHED = S_FALSE; + {$EXTERNALSYM DI_NOTATTACHED} + +(* + * The device buffer overflowed. Some input was lost. + *) + DI_BUFFEROVERFLOW = S_FALSE; + {$EXTERNALSYM DI_BUFFEROVERFLOW} + +(* + * The change in device properties had no effect. + *) + DI_PROPNOEFFECT = S_FALSE; + {$EXTERNALSYM DI_PROPNOEFFECT} + +(* + * The operation had no effect. + *) + DI_NOEFFECT = S_FALSE; + {$EXTERNALSYM DI_NOEFFECT} + +(* + * The device is a polled device. As a result, device buffering + * will not collect any data and event notifications will not be + * signalled until GetDeviceState is called. + *) + DI_POLLEDDEVICE = HRESULT($00000002); + {$EXTERNALSYM DI_POLLEDDEVICE} + +(* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but the effect was not + * downloaded because the device is not exclusively acquired + * or because the DIEP_NODOWNLOAD flag was passed. + *) + DI_DOWNLOADSKIPPED = HRESULT($00000003); + {$EXTERNALSYM DI_DOWNLOADSKIPPED} + +(* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but in order to change + * the parameters, the effect needed to be restarted. + *) + DI_EFFECTRESTARTED = HRESULT($00000004); + {$EXTERNALSYM DI_EFFECTRESTARTED} + +(* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but some of them were + * beyond the capabilities of the device and were truncated. + *) + DI_TRUNCATED = HRESULT($00000008); + {$EXTERNALSYM DI_TRUNCATED} + +(* + * The settings have been successfully applied but could not be + * persisted. + *) + DI_SETTINGSNOTSAVED = HRESULT($0000000B); + {$EXTERNALSYM DI_SETTINGSNOTSAVED} + +(* + * Equal to DI_EFFECTRESTARTED | DI_TRUNCATED. + *) + DI_TRUNCATEDANDRESTARTED = HRESULT($0000000C); + {$EXTERNALSYM DI_TRUNCATEDANDRESTARTED} + +(* + * A SUCCESS code indicating that settings cannot be modified. + *) + DI_WRITEPROTECT = HRESULT($00000013); + {$EXTERNALSYM DI_WRITEPROTECT} + + + SEVERITY_ERROR_FACILITY_WIN32 = + HResult(SEVERITY_ERROR shl 31) or HResult(FACILITY_WIN32 shl 16); + {$EXTERNALSYM SEVERITY_ERROR_FACILITY_WIN32} + +(* + * The application requires a newer version of DirectInput. + *) + DIERR_OLDDIRECTINPUTVERSION = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_OLD_WIN_VERSION); + {$EXTERNALSYM DIERR_OLDDIRECTINPUTVERSION} + +(* + * The application was written for an unsupported prerelease version + * of DirectInput. + *) + DIERR_BETADIRECTINPUTVERSION = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_RMODE_APP); + {$EXTERNALSYM DIERR_BETADIRECTINPUTVERSION} + +(* + * The object could not be created due to an incompatible driver version + * or mismatched or incomplete driver components. + *) + DIERR_BADDRIVERVER = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_BAD_DRIVER_LEVEL); + {$EXTERNALSYM DIERR_BADDRIVERVER} + +(* + * The device or device instance or effect is not registered with DirectInput. + *) + DIERR_DEVICENOTREG = REGDB_E_CLASSNOTREG; + {$EXTERNALSYM DIERR_DEVICENOTREG} + +(* + * The requested object does not exist. + *) + DIERR_NOTFOUND = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_FILE_NOT_FOUND); + {$EXTERNALSYM DIERR_NOTFOUND} + +(* + * The requested object does not exist. + *) + DIERR_OBJECTNOTFOUND = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_FILE_NOT_FOUND); + {$EXTERNALSYM DIERR_OBJECTNOTFOUND} + +(* + * An invalid parameter was passed to the returning function, + * or the object was not in a state that admitted the function + * to be called. + *) + DIERR_INVALIDPARAM = E_INVALIDARG; + {$EXTERNALSYM DIERR_INVALIDPARAM} + +(* + * The specified interface is not supported by the object + *) + DIERR_NOINTERFACE = E_NOINTERFACE; + {$EXTERNALSYM DIERR_NOINTERFACE} + +(* + * An undetermined error occured inside the DInput subsystem + *) + DIERR_GENERIC = E_FAIL; + {$EXTERNALSYM DIERR_GENERIC} + +(* + * The DInput subsystem couldn't allocate sufficient memory to complete the + * caller's request. + *) + DIERR_OUTOFMEMORY = E_OUTOFMEMORY; + {$EXTERNALSYM DIERR_OUTOFMEMORY} + +(* + * The function called is not supported at this time + *) + DIERR_UNSUPPORTED = E_NOTIMPL; + {$EXTERNALSYM DIERR_UNSUPPORTED} + +(* + * This object has not been initialized + *) + DIERR_NOTINITIALIZED = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_NOT_READY); + {$EXTERNALSYM DIERR_NOTINITIALIZED} + +(* + * This object is already initialized + *) + DIERR_ALREADYINITIALIZED = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_ALREADY_INITIALIZED); + {$EXTERNALSYM DIERR_ALREADYINITIALIZED} + +(* + * This object does not support aggregation + *) + DIERR_NOAGGREGATION = CLASS_E_NOAGGREGATION; + {$EXTERNALSYM DIERR_NOAGGREGATION} + +(* + * Another app has a higher priority level, preventing this call from + * succeeding. + *) + DIERR_OTHERAPPHASPRIO = E_ACCESSDENIED; + {$EXTERNALSYM DIERR_OTHERAPPHASPRIO} + +(* + * Access to the device has been lost. It must be re-acquired. + *) + DIERR_INPUTLOST = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_READ_FAULT); + {$EXTERNALSYM DIERR_INPUTLOST} + +(* + * The operation cannot be performed while the device is acquired. + *) + DIERR_ACQUIRED = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_BUSY); + {$EXTERNALSYM DIERR_ACQUIRED} + +(* + * The operation cannot be performed unless the device is acquired. + *) + DIERR_NOTACQUIRED = HRESULT(SEVERITY_ERROR_FACILITY_WIN32 or + ERROR_INVALID_ACCESS); + {$EXTERNALSYM DIERR_NOTACQUIRED} + +(* + * The specified property cannot be changed. + *) + DIERR_READONLY = E_ACCESSDENIED; + {$EXTERNALSYM DIERR_READONLY} + +(* + * The device already has an event notification associated with it. + *) + DIERR_HANDLEEXISTS = E_ACCESSDENIED; + {$EXTERNALSYM DIERR_HANDLEEXISTS} + +(* + * Data is not yet available. + *) + E_PENDING = $8000000A; + {$EXTERNALSYM E_PENDING} + +(* + * Unable to IDirectInputJoyConfig_Acquire because the user + * does not have sufficient privileges to change the joystick + * configuration. + *) + DIERR_INSUFFICIENTPRIVS = $80040200; + {$EXTERNALSYM DIERR_INSUFFICIENTPRIVS} + +(* + * The device is full. + *) + DIERR_DEVICEFULL = $80040201; + {$EXTERNALSYM DIERR_DEVICEFULL} + +(* + * Not all the requested information fit into the buffer. + *) + DIERR_MOREDATA = $80040202; + {$EXTERNALSYM DIERR_MOREDATA} + +(* + * The effect is not downloaded. + *) + DIERR_NOTDOWNLOADED = $80040203; + {$EXTERNALSYM DIERR_NOTDOWNLOADED} + +(* + * The device cannot be reinitialized because there are still effects + * attached to it. + *) + DIERR_HASEFFECTS = $80040204; + {$EXTERNALSYM DIERR_HASEFFECTS} + +(* + * The operation cannot be performed unless the device is acquired + * in DISCL_EXCLUSIVE mode. + *) + DIERR_NOTEXCLUSIVEACQUIRED = $80040205; + {$EXTERNALSYM DIERR_NOTEXCLUSIVEACQUIRED} + +(* + * The effect could not be downloaded because essential information + * is missing. For example, no axes have been associated with the + * effect, or no type-specific information has been created. + *) + DIERR_INCOMPLETEEFFECT = $80040206; + {$EXTERNALSYM DIERR_INCOMPLETEEFFECT} + +(* + * Attempted to read buffered device data from a device that is + * not buffered. + *) + DIERR_NOTBUFFERED = $80040207; + {$EXTERNALSYM DIERR_NOTBUFFERED} + +(* + * An attempt was made to modify parameters of an effect while it is + * playing. Not all hardware devices support altering the parameters + * of an effect while it is playing. + *) + DIERR_EFFECTPLAYING = $80040208; + {$EXTERNALSYM DIERR_EFFECTPLAYING} + +(* + * The operation could not be completed because the device is not + * plugged in. + *) + DIERR_UNPLUGGED = $80040209; + {$EXTERNALSYM DIERR_UNPLUGGED} + +(* + * SendDeviceData failed because more information was requested + * to be sent than can be sent to the device. Some devices have + * restrictions on how much data can be sent to them. (For example, + * there might be a limit on the number of buttons that can be + * pressed at once.) + *) + DIERR_REPORTFULL = $8004020A; + {$EXTERNALSYM DIERR_REPORTFULL} + + +(* + * A mapper file function failed because reading or writing the user or IHV + * settings file failed. + *) + DIERR_MAPFILEFAIL = $8004020B; + {$EXTERNALSYM DIERR_MAPFILEFAIL} + + +(*--- DINPUT Mapper Definitions: New for Dx8 ---*) + + +(*--- Keyboard + Physical Keyboard Device ---*) + + DIKEYBOARD_ESCAPE = $81000401; + {$EXTERNALSYM DIKEYBOARD_ESCAPE} + DIKEYBOARD_1 = $81000402; + {$EXTERNALSYM DIKEYBOARD_1} + DIKEYBOARD_2 = $81000403; + {$EXTERNALSYM DIKEYBOARD_2} + DIKEYBOARD_3 = $81000404; + {$EXTERNALSYM DIKEYBOARD_3} + DIKEYBOARD_4 = $81000405; + {$EXTERNALSYM DIKEYBOARD_4} + DIKEYBOARD_5 = $81000406; + {$EXTERNALSYM DIKEYBOARD_5} + DIKEYBOARD_6 = $81000407; + {$EXTERNALSYM DIKEYBOARD_6} + DIKEYBOARD_7 = $81000408; + {$EXTERNALSYM DIKEYBOARD_7} + DIKEYBOARD_8 = $81000409; + {$EXTERNALSYM DIKEYBOARD_8} + DIKEYBOARD_9 = $8100040A; + {$EXTERNALSYM DIKEYBOARD_9} + DIKEYBOARD_0 = $8100040B; + {$EXTERNALSYM DIKEYBOARD_0} + DIKEYBOARD_MINUS = $8100040C; (* - on main keyboard *) + {$EXTERNALSYM DIKEYBOARD_MINUS} + DIKEYBOARD_EQUALS = $8100040D; + {$EXTERNALSYM DIKEYBOARD_EQUALS} + DIKEYBOARD_BACK = $8100040E; (* backspace *) + {$EXTERNALSYM DIKEYBOARD_BACK} + DIKEYBOARD_TAB = $8100040F; + {$EXTERNALSYM DIKEYBOARD_TAB} + DIKEYBOARD_Q = $81000410; + {$EXTERNALSYM DIKEYBOARD_Q} + DIKEYBOARD_W = $81000411; + {$EXTERNALSYM DIKEYBOARD_W} + DIKEYBOARD_E = $81000412; + {$EXTERNALSYM DIKEYBOARD_E} + DIKEYBOARD_R = $81000413; + {$EXTERNALSYM DIKEYBOARD_R} + DIKEYBOARD_T = $81000414; + {$EXTERNALSYM DIKEYBOARD_T} + DIKEYBOARD_Y = $81000415; + {$EXTERNALSYM DIKEYBOARD_Y} + DIKEYBOARD_U = $81000416; + {$EXTERNALSYM DIKEYBOARD_U} + DIKEYBOARD_I = $81000417; + {$EXTERNALSYM DIKEYBOARD_I} + DIKEYBOARD_O = $81000418; + {$EXTERNALSYM DIKEYBOARD_O} + DIKEYBOARD_P = $81000419; + {$EXTERNALSYM DIKEYBOARD_P} + DIKEYBOARD_LBRACKET = $8100041A; + {$EXTERNALSYM DIKEYBOARD_LBRACKET} + DIKEYBOARD_RBRACKET = $8100041B; + {$EXTERNALSYM DIKEYBOARD_RBRACKET} + DIKEYBOARD_RETURN = $8100041C; (* Enter on main keyboard *) + {$EXTERNALSYM DIKEYBOARD_RETURN} + DIKEYBOARD_LCONTROL = $8100041D; + {$EXTERNALSYM DIKEYBOARD_LCONTROL} + DIKEYBOARD_A = $8100041E; + {$EXTERNALSYM DIKEYBOARD_A} + DIKEYBOARD_S = $8100041F; + {$EXTERNALSYM DIKEYBOARD_S} + DIKEYBOARD_D = $81000420; + {$EXTERNALSYM DIKEYBOARD_D} + DIKEYBOARD_F = $81000421; + {$EXTERNALSYM DIKEYBOARD_F} + DIKEYBOARD_G = $81000422; + {$EXTERNALSYM DIKEYBOARD_G} + DIKEYBOARD_H = $81000423; + {$EXTERNALSYM DIKEYBOARD_H} + DIKEYBOARD_J = $81000424; + {$EXTERNALSYM DIKEYBOARD_J} + DIKEYBOARD_K = $81000425; + {$EXTERNALSYM DIKEYBOARD_K} + DIKEYBOARD_L = $81000426; + {$EXTERNALSYM DIKEYBOARD_L} + DIKEYBOARD_SEMICOLON = $81000427; + {$EXTERNALSYM DIKEYBOARD_SEMICOLON} + DIKEYBOARD_APOSTROPHE = $81000428; + {$EXTERNALSYM DIKEYBOARD_APOSTROPHE} + DIKEYBOARD_GRAVE = $81000429; (* accent grave *) + {$EXTERNALSYM DIKEYBOARD_GRAVE} + DIKEYBOARD_LSHIFT = $8100042A; + {$EXTERNALSYM DIKEYBOARD_LSHIFT} + DIKEYBOARD_BACKSLASH = $8100042B; + {$EXTERNALSYM DIKEYBOARD_BACKSLASH} + DIKEYBOARD_Z = $8100042C; + {$EXTERNALSYM DIKEYBOARD_Z} + DIKEYBOARD_X = $8100042D; + {$EXTERNALSYM DIKEYBOARD_X} + DIKEYBOARD_C = $8100042E; + {$EXTERNALSYM DIKEYBOARD_C} + DIKEYBOARD_V = $8100042F; + {$EXTERNALSYM DIKEYBOARD_V} + DIKEYBOARD_B = $81000430; + {$EXTERNALSYM DIKEYBOARD_B} + DIKEYBOARD_N = $81000431; + {$EXTERNALSYM DIKEYBOARD_N} + DIKEYBOARD_M = $81000432; + {$EXTERNALSYM DIKEYBOARD_M} + DIKEYBOARD_COMMA = $81000433; + {$EXTERNALSYM DIKEYBOARD_COMMA} + DIKEYBOARD_PERIOD = $81000434; (* . on main keyboard *) + {$EXTERNALSYM DIKEYBOARD_PERIOD} + DIKEYBOARD_SLASH = $81000435; (* / on main keyboard *) + {$EXTERNALSYM DIKEYBOARD_SLASH} + DIKEYBOARD_RSHIFT = $81000436; + {$EXTERNALSYM DIKEYBOARD_RSHIFT} + DIKEYBOARD_MULTIPLY = $81000437; (* * on numeric keypad *) + {$EXTERNALSYM DIKEYBOARD_MULTIPLY} + DIKEYBOARD_LMENU = $81000438; (* left Alt *) + {$EXTERNALSYM DIKEYBOARD_LMENU} + DIKEYBOARD_SPACE = $81000439; + {$EXTERNALSYM DIKEYBOARD_SPACE} + DIKEYBOARD_CAPITAL = $8100043A; + {$EXTERNALSYM DIKEYBOARD_CAPITAL} + DIKEYBOARD_F1 = $8100043B; + {$EXTERNALSYM DIKEYBOARD_F1} + DIKEYBOARD_F2 = $8100043C; + {$EXTERNALSYM DIKEYBOARD_F2} + DIKEYBOARD_F3 = $8100043D; + {$EXTERNALSYM DIKEYBOARD_F3} + DIKEYBOARD_F4 = $8100043E; + {$EXTERNALSYM DIKEYBOARD_F4} + DIKEYBOARD_F5 = $8100043F; + {$EXTERNALSYM DIKEYBOARD_F5} + DIKEYBOARD_F6 = $81000440; + {$EXTERNALSYM DIKEYBOARD_F6} + DIKEYBOARD_F7 = $81000441; + {$EXTERNALSYM DIKEYBOARD_F7} + DIKEYBOARD_F8 = $81000442; + {$EXTERNALSYM DIKEYBOARD_F8} + DIKEYBOARD_F9 = $81000443; + {$EXTERNALSYM DIKEYBOARD_F9} + DIKEYBOARD_F10 = $81000444; + {$EXTERNALSYM DIKEYBOARD_F10} + DIKEYBOARD_NUMLOCK = $81000445; + {$EXTERNALSYM DIKEYBOARD_NUMLOCK} + DIKEYBOARD_SCROLL = $81000446; (* Scroll Lock *) + {$EXTERNALSYM DIKEYBOARD_SCROLL} + DIKEYBOARD_NUMPAD7 = $81000447; + {$EXTERNALSYM DIKEYBOARD_NUMPAD7} + DIKEYBOARD_NUMPAD8 = $81000448; + {$EXTERNALSYM DIKEYBOARD_NUMPAD8} + DIKEYBOARD_NUMPAD9 = $81000449; + {$EXTERNALSYM DIKEYBOARD_NUMPAD9} + DIKEYBOARD_SUBTRACT = $8100044A; (* - on numeric keypad *) + {$EXTERNALSYM DIKEYBOARD_SUBTRACT} + DIKEYBOARD_NUMPAD4 = $8100044B; + {$EXTERNALSYM DIKEYBOARD_NUMPAD4} + DIKEYBOARD_NUMPAD5 = $8100044C; + {$EXTERNALSYM DIKEYBOARD_NUMPAD5} + DIKEYBOARD_NUMPAD6 = $8100044D; + {$EXTERNALSYM DIKEYBOARD_NUMPAD6} + DIKEYBOARD_ADD = $8100044E; (* + on numeric keypad *) + {$EXTERNALSYM DIKEYBOARD_ADD} + DIKEYBOARD_NUMPAD1 = $8100044F; + {$EXTERNALSYM DIKEYBOARD_NUMPAD1} + DIKEYBOARD_NUMPAD2 = $81000450; + {$EXTERNALSYM DIKEYBOARD_NUMPAD2} + DIKEYBOARD_NUMPAD3 = $81000451; + {$EXTERNALSYM DIKEYBOARD_NUMPAD3} + DIKEYBOARD_NUMPAD0 = $81000452; + {$EXTERNALSYM DIKEYBOARD_NUMPAD0} + DIKEYBOARD_DECIMAL = $81000453; (* . on numeric keypad *) + {$EXTERNALSYM DIKEYBOARD_DECIMAL} + DIKEYBOARD_OEM_102 = $81000456; (* <> or \| on RT 102-key keyboard (Non-U.S.) *) + {$EXTERNALSYM DIKEYBOARD_OEM_102} + DIKEYBOARD_F11 = $81000457; + {$EXTERNALSYM DIKEYBOARD_F11} + DIKEYBOARD_F12 = $81000458; + {$EXTERNALSYM DIKEYBOARD_F12} + DIKEYBOARD_F13 = $81000464; (* (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_F13} + DIKEYBOARD_F14 = $81000465; (* (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_F14} + DIKEYBOARD_F15 = $81000466; (* (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_F15} + DIKEYBOARD_KANA = $81000470; (* (Japanese keyboard) *) + {$EXTERNALSYM DIKEYBOARD_KANA} + DIKEYBOARD_ABNT_C1 = $81000473; (* /? on Brazilian keyboard *) + {$EXTERNALSYM DIKEYBOARD_ABNT_C1} + DIKEYBOARD_CONVERT = $81000479; (* (Japanese keyboard) *) + {$EXTERNALSYM DIKEYBOARD_CONVERT} + DIKEYBOARD_NOCONVERT = $8100047B; (* (Japanese keyboard) *) + {$EXTERNALSYM DIKEYBOARD_NOCONVERT} + DIKEYBOARD_YEN = $8100047D; (* (Japanese keyboard) *) + {$EXTERNALSYM DIKEYBOARD_YEN} + DIKEYBOARD_ABNT_C2 = $8100047E; (* Numpad . on Brazilian keyboard *) + {$EXTERNALSYM DIKEYBOARD_ABNT_C2} + DIKEYBOARD_NUMPADEQUALS = $8100048D; (* = on numeric keypad (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_NUMPADEQUALS} + DIKEYBOARD_PREVTRACK = $81000490; (* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) *) + {$EXTERNALSYM DIKEYBOARD_PREVTRACK} + DIKEYBOARD_AT = $81000491; (* (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_AT} + DIKEYBOARD_COLON = $81000492; (* (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_COLON} + DIKEYBOARD_UNDERLINE = $81000493; (* (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_UNDERLINE} + DIKEYBOARD_KANJI = $81000494; (* (Japanese keyboard) *) + {$EXTERNALSYM DIKEYBOARD_KANJI} + DIKEYBOARD_STOP = $81000495; (* (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_STOP} + DIKEYBOARD_AX = $81000496; (* (Japan AX) *) + {$EXTERNALSYM DIKEYBOARD_AX} + DIKEYBOARD_UNLABELED = $81000497; (* (J3100) *) + {$EXTERNALSYM DIKEYBOARD_UNLABELED} + DIKEYBOARD_NEXTTRACK = $81000499; (* Next Track *) + {$EXTERNALSYM DIKEYBOARD_NEXTTRACK} + DIKEYBOARD_NUMPADENTER = $8100049C; (* Enter on numeric keypad *) + {$EXTERNALSYM DIKEYBOARD_NUMPADENTER} + DIKEYBOARD_RCONTROL = $8100049D; + {$EXTERNALSYM DIKEYBOARD_RCONTROL} + DIKEYBOARD_MUTE = $810004A0; (* Mute *) + {$EXTERNALSYM DIKEYBOARD_MUTE} + DIKEYBOARD_CALCULATOR = $810004A1; (* Calculator *) + {$EXTERNALSYM DIKEYBOARD_CALCULATOR} + DIKEYBOARD_PLAYPAUSE = $810004A2; (* Play / Pause *) + {$EXTERNALSYM DIKEYBOARD_PLAYPAUSE} + DIKEYBOARD_MEDIASTOP = $810004A4; (* Media Stop *) + {$EXTERNALSYM DIKEYBOARD_MEDIASTOP} + DIKEYBOARD_VOLUMEDOWN = $810004AE; (* Volume - *) + {$EXTERNALSYM DIKEYBOARD_VOLUMEDOWN} + DIKEYBOARD_VOLUMEUP = $810004B0; (* Volume + *) + {$EXTERNALSYM DIKEYBOARD_VOLUMEUP} + DIKEYBOARD_WEBHOME = $810004B2; (* Web home *) + {$EXTERNALSYM DIKEYBOARD_WEBHOME} + DIKEYBOARD_NUMPADCOMMA = $810004B3; (* , on numeric keypad (NEC PC98) *) + {$EXTERNALSYM DIKEYBOARD_NUMPADCOMMA} + DIKEYBOARD_DIVIDE = $810004B5; (* / on numeric keypad *) + {$EXTERNALSYM DIKEYBOARD_DIVIDE} + DIKEYBOARD_SYSRQ = $810004B7; + {$EXTERNALSYM DIKEYBOARD_SYSRQ} + DIKEYBOARD_RMENU = $810004B8; (* right Alt *) + {$EXTERNALSYM DIKEYBOARD_RMENU} + DIKEYBOARD_PAUSE = $810004C5; (* Pause *) + {$EXTERNALSYM DIKEYBOARD_PAUSE} + DIKEYBOARD_HOME = $810004C7; (* Home on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_HOME} + DIKEYBOARD_UP = $810004C8; (* UpArrow on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_UP} + DIKEYBOARD_PRIOR = $810004C9; (* PgUp on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_PRIOR} + DIKEYBOARD_LEFT = $810004CB; (* LeftArrow on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_LEFT} + DIKEYBOARD_RIGHT = $810004CD; (* RightArrow on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_RIGHT} + DIKEYBOARD_END = $810004CF; (* End on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_END} + DIKEYBOARD_DOWN = $810004D0; (* DownArrow on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_DOWN} + DIKEYBOARD_NEXT = $810004D1; (* PgDn on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_NEXT} + DIKEYBOARD_INSERT = $810004D2; (* Insert on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_INSERT} + DIKEYBOARD_DELETE = $810004D3; (* Delete on arrow keypad *) + {$EXTERNALSYM DIKEYBOARD_DELETE} + DIKEYBOARD_LWIN = $810004DB; (* Left Windows key *) + {$EXTERNALSYM DIKEYBOARD_LWIN} + DIKEYBOARD_RWIN = $810004DC; (* Right Windows key *) + {$EXTERNALSYM DIKEYBOARD_RWIN} + DIKEYBOARD_APPS = $810004DD; (* AppMenu key *) + {$EXTERNALSYM DIKEYBOARD_APPS} + DIKEYBOARD_POWER = $810004DE; (* System Power *) + {$EXTERNALSYM DIKEYBOARD_POWER} + DIKEYBOARD_SLEEP = $810004DF; (* System Sleep *) + {$EXTERNALSYM DIKEYBOARD_SLEEP} + DIKEYBOARD_WAKE = $810004E3; (* System Wake *) + {$EXTERNALSYM DIKEYBOARD_WAKE} + DIKEYBOARD_WEBSEARCH = $810004E5; (* Web Search *) + {$EXTERNALSYM DIKEYBOARD_WEBSEARCH} + DIKEYBOARD_WEBFAVORITES = $810004E6; (* Web Favorites *) + {$EXTERNALSYM DIKEYBOARD_WEBFAVORITES} + DIKEYBOARD_WEBREFRESH = $810004E7; (* Web Refresh *) + {$EXTERNALSYM DIKEYBOARD_WEBREFRESH} + DIKEYBOARD_WEBSTOP = $810004E8; (* Web Stop *) + {$EXTERNALSYM DIKEYBOARD_WEBSTOP} + DIKEYBOARD_WEBFORWARD = $810004E9; (* Web Forward *) + {$EXTERNALSYM DIKEYBOARD_WEBFORWARD} + DIKEYBOARD_WEBBACK = $810004EA; (* Web Back *) + {$EXTERNALSYM DIKEYBOARD_WEBBACK} + DIKEYBOARD_MYCOMPUTER = $810004EB; (* My Computer *) + {$EXTERNALSYM DIKEYBOARD_MYCOMPUTER} + DIKEYBOARD_MAIL = $810004EC; (* Mail *) + {$EXTERNALSYM DIKEYBOARD_MAIL} + DIKEYBOARD_MEDIASELECT = $810004ED; (* Media Select *) + {$EXTERNALSYM DIKEYBOARD_MEDIASELECT} + + +(*--- MOUSE + Physical Mouse Device ---*) + + DIMOUSE_XAXISAB = ($82000200 or DIMOFS_X); (* X Axis-absolute: Some mice natively report absolute coordinates *) + {$EXTERNALSYM DIMOUSE_XAXISAB} + DIMOUSE_YAXISAB = ($82000200 or DIMOFS_Y); (* Y Axis-absolute: Some mice natively report absolute coordinates *) + {$EXTERNALSYM DIMOUSE_YAXISAB} + DIMOUSE_XAXIS = ($82000300 or DIMOFS_X); (* X Axis *) + {$EXTERNALSYM DIMOUSE_XAXIS} + DIMOUSE_YAXIS = ($82000300 or DIMOFS_Y); (* Y Axis *) + {$EXTERNALSYM DIMOUSE_YAXIS} + DIMOUSE_WHEEL = ($82000300 or DIMOFS_Z); (* Z Axis *) + {$EXTERNALSYM DIMOUSE_WHEEL} + DIMOUSE_BUTTON0 = ($82000400 or DIMOFS_BUTTON0); (* Button 0 *) + {$EXTERNALSYM DIMOUSE_BUTTON0} + DIMOUSE_BUTTON1 = ($82000400 or DIMOFS_BUTTON1); (* Button 1 *) + {$EXTERNALSYM DIMOUSE_BUTTON1} + DIMOUSE_BUTTON2 = ($82000400 or DIMOFS_BUTTON2); (* Button 2 *) + {$EXTERNALSYM DIMOUSE_BUTTON2} + DIMOUSE_BUTTON3 = ($82000400 or DIMOFS_BUTTON3); (* Button 3 *) + {$EXTERNALSYM DIMOUSE_BUTTON3} + DIMOUSE_BUTTON4 = ($82000400 or DIMOFS_BUTTON4); (* Button 4 *) + {$EXTERNALSYM DIMOUSE_BUTTON4} + DIMOUSE_BUTTON5 = ($82000400 or DIMOFS_BUTTON5); (* Button 5 *) + {$EXTERNALSYM DIMOUSE_BUTTON5} + DIMOUSE_BUTTON6 = ($82000400 or DIMOFS_BUTTON6); (* Button 6 *) + {$EXTERNALSYM DIMOUSE_BUTTON6} + DIMOUSE_BUTTON7 = ($82000400 or DIMOFS_BUTTON7); (* Button 7 *) + {$EXTERNALSYM DIMOUSE_BUTTON7} + + +(*--- VOICE + Physical Dplay Voice Device ---*) + + DIVOICE_CHANNEL1 = $83000401; + {$EXTERNALSYM DIVOICE_CHANNEL1} + DIVOICE_CHANNEL2 = $83000402; + {$EXTERNALSYM DIVOICE_CHANNEL2} + DIVOICE_CHANNEL3 = $83000403; + {$EXTERNALSYM DIVOICE_CHANNEL3} + DIVOICE_CHANNEL4 = $83000404; + {$EXTERNALSYM DIVOICE_CHANNEL4} + DIVOICE_CHANNEL5 = $83000405; + {$EXTERNALSYM DIVOICE_CHANNEL5} + DIVOICE_CHANNEL6 = $83000406; + {$EXTERNALSYM DIVOICE_CHANNEL6} + DIVOICE_CHANNEL7 = $83000407; + {$EXTERNALSYM DIVOICE_CHANNEL7} + DIVOICE_CHANNEL8 = $83000408; + {$EXTERNALSYM DIVOICE_CHANNEL8} + DIVOICE_TEAM = $83000409; + {$EXTERNALSYM DIVOICE_TEAM} + DIVOICE_ALL = $8300040A; + {$EXTERNALSYM DIVOICE_ALL} + DIVOICE_RECORDMUTE = $8300040B; + {$EXTERNALSYM DIVOICE_RECORDMUTE} + DIVOICE_PLAYBACKMUTE = $8300040C; + {$EXTERNALSYM DIVOICE_PLAYBACKMUTE} + DIVOICE_TRANSMIT = $8300040D; + {$EXTERNALSYM DIVOICE_TRANSMIT} + + DIVOICE_VOICECOMMAND = $83000410; + {$EXTERNALSYM DIVOICE_VOICECOMMAND} + + +(*--- Driving Simulator - Racing + Vehicle control is primary objective ---*) + DIVIRTUAL_DRIVING_RACE = $01000000; + {$EXTERNALSYM DIVIRTUAL_DRIVING_RACE} + DIAXIS_DRIVINGR_STEER = $01008A01; (* Steering *) + {$EXTERNALSYM DIAXIS_DRIVINGR_STEER} + DIAXIS_DRIVINGR_ACCELERATE = $01039202; (* Accelerate *) + {$EXTERNALSYM DIAXIS_DRIVINGR_ACCELERATE} + DIAXIS_DRIVINGR_BRAKE = $01041203; (* Brake-Axis *) + {$EXTERNALSYM DIAXIS_DRIVINGR_BRAKE} + DIBUTTON_DRIVINGR_SHIFTUP = $01000C01; (* Shift to next higher gear *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_SHIFTUP} + DIBUTTON_DRIVINGR_SHIFTDOWN = $01000C02; (* Shift to next lower gear *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_SHIFTDOWN} + DIBUTTON_DRIVINGR_VIEW = $01001C03; (* Cycle through view options *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_VIEW} + DIBUTTON_DRIVINGR_MENU = $010004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_MENU} +(*--- Priority 2 controls ---*) + + DIAXIS_DRIVINGR_ACCEL_AND_BRAKE = $01014A04; (* Some devices combine accelerate and brake in a single axis *) + {$EXTERNALSYM DIAXIS_DRIVINGR_ACCEL_AND_BRAKE} + DIHATSWITCH_DRIVINGR_GLANCE = $01004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_DRIVINGR_GLANCE} + DIBUTTON_DRIVINGR_BRAKE = $01004C04; (* Brake-button *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_BRAKE} + DIBUTTON_DRIVINGR_DASHBOARD = $01004405; (* Select next dashboard option *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_DASHBOARD} + DIBUTTON_DRIVINGR_AIDS = $01004406; (* Driver correction aids *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_AIDS} + DIBUTTON_DRIVINGR_MAP = $01004407; (* Display Driving Map *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_MAP} + DIBUTTON_DRIVINGR_BOOST = $01004408; (* Turbo Boost *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_BOOST} + DIBUTTON_DRIVINGR_PIT = $01004409; (* Pit stop notification *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_PIT} + DIBUTTON_DRIVINGR_ACCELERATE_LINK = $0103D4E0; (* Fallback Accelerate button *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_ACCELERATE_LINK} + DIBUTTON_DRIVINGR_STEER_LEFT_LINK = $0100CCE4; (* Fallback Steer Left button *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_STEER_LEFT_LINK} + DIBUTTON_DRIVINGR_STEER_RIGHT_LINK = $0100CCEC; (* Fallback Steer Right button *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_STEER_RIGHT_LINK} + DIBUTTON_DRIVINGR_GLANCE_LEFT_LINK = $0107C4E4; (* Fallback Glance Left button *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_GLANCE_LEFT_LINK} + DIBUTTON_DRIVINGR_GLANCE_RIGHT_LINK = $0107C4EC; (* Fallback Glance Right button *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_GLANCE_RIGHT_LINK} + DIBUTTON_DRIVINGR_DEVICE = $010044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_DEVICE} + DIBUTTON_DRIVINGR_PAUSE = $010044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_DRIVINGR_PAUSE} + +(*--- Driving Simulator - Combat + Combat from within a vehicle is primary objective ---*) + DIVIRTUAL_DRIVING_COMBAT = $02000000; + {$EXTERNALSYM DIVIRTUAL_DRIVING_COMBAT} + DIAXIS_DRIVINGC_STEER = $02008A01; (* Steering *) + {$EXTERNALSYM DIAXIS_DRIVINGC_STEER} + DIAXIS_DRIVINGC_ACCELERATE = $02039202; (* Accelerate *) + {$EXTERNALSYM DIAXIS_DRIVINGC_ACCELERATE} + DIAXIS_DRIVINGC_BRAKE = $02041203; (* Brake-axis *) + {$EXTERNALSYM DIAXIS_DRIVINGC_BRAKE} + DIBUTTON_DRIVINGC_FIRE = $02000C01; (* Fire *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_FIRE} + DIBUTTON_DRIVINGC_WEAPONS = $02000C02; (* Select next weapon *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_WEAPONS} + DIBUTTON_DRIVINGC_TARGET = $02000C03; (* Select next available target *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_TARGET} + DIBUTTON_DRIVINGC_MENU = $020004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_MENU} +(*--- Priority 2 controls ---*) + + DIAXIS_DRIVINGC_ACCEL_AND_BRAKE = $02014A04; (* Some devices combine accelerate and brake in a single axis *) + {$EXTERNALSYM DIAXIS_DRIVINGC_ACCEL_AND_BRAKE} + DIHATSWITCH_DRIVINGC_GLANCE = $02004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_DRIVINGC_GLANCE} + DIBUTTON_DRIVINGC_SHIFTUP = $02004C04; (* Shift to next higher gear *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_SHIFTUP} + DIBUTTON_DRIVINGC_SHIFTDOWN = $02004C05; (* Shift to next lower gear *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_SHIFTDOWN} + DIBUTTON_DRIVINGC_DASHBOARD = $02004406; (* Select next dashboard option *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_DASHBOARD} + DIBUTTON_DRIVINGC_AIDS = $02004407; (* Driver correction aids *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_AIDS} + DIBUTTON_DRIVINGC_BRAKE = $02004C08; (* Brake-button *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_BRAKE} + DIBUTTON_DRIVINGC_FIRESECONDARY = $02004C09; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_FIRESECONDARY} + DIBUTTON_DRIVINGC_ACCELERATE_LINK = $0203D4E0; (* Fallback Accelerate button *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_ACCELERATE_LINK} + DIBUTTON_DRIVINGC_STEER_LEFT_LINK = $0200CCE4; (* Fallback Steer Left button *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_STEER_LEFT_LINK} + DIBUTTON_DRIVINGC_STEER_RIGHT_LINK = $0200CCEC; (* Fallback Steer Right button *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_STEER_RIGHT_LINK} + DIBUTTON_DRIVINGC_GLANCE_LEFT_LINK = $0207C4E4; (* Fallback Glance Left button *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_GLANCE_LEFT_LINK} + DIBUTTON_DRIVINGC_GLANCE_RIGHT_LINK = $0207C4EC; (* Fallback Glance Right button *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_GLANCE_RIGHT_LINK} + DIBUTTON_DRIVINGC_DEVICE = $020044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_DEVICE} + DIBUTTON_DRIVINGC_PAUSE = $020044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_DRIVINGC_PAUSE} + +(*--- Driving Simulator - Tank + Combat from withing a tank is primary objective ---*) + DIVIRTUAL_DRIVING_TANK = $03000000; + {$EXTERNALSYM DIVIRTUAL_DRIVING_TANK} + DIAXIS_DRIVINGT_STEER = $03008A01; (* Turn tank left / right *) + {$EXTERNALSYM DIAXIS_DRIVINGT_STEER} + DIAXIS_DRIVINGT_BARREL = $03010202; (* Raise / lower barrel *) + {$EXTERNALSYM DIAXIS_DRIVINGT_BARREL} + DIAXIS_DRIVINGT_ACCELERATE = $03039203; (* Accelerate *) + {$EXTERNALSYM DIAXIS_DRIVINGT_ACCELERATE} + DIAXIS_DRIVINGT_ROTATE = $03020204; (* Turn barrel left / right *) + {$EXTERNALSYM DIAXIS_DRIVINGT_ROTATE} + DIBUTTON_DRIVINGT_FIRE = $03000C01; (* Fire *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_FIRE} + DIBUTTON_DRIVINGT_WEAPONS = $03000C02; (* Select next weapon *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_WEAPONS} + DIBUTTON_DRIVINGT_TARGET = $03000C03; (* Selects next available target *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_TARGET} + DIBUTTON_DRIVINGT_MENU = $030004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_DRIVINGT_GLANCE = $03004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_DRIVINGT_GLANCE} + DIAXIS_DRIVINGT_BRAKE = $03045205; (* Brake-axis *) + {$EXTERNALSYM DIAXIS_DRIVINGT_BRAKE} + DIAXIS_DRIVINGT_ACCEL_AND_BRAKE = $03014A06; (* Some devices combine accelerate and brake in a single axis *) + {$EXTERNALSYM DIAXIS_DRIVINGT_ACCEL_AND_BRAKE} + DIBUTTON_DRIVINGT_VIEW = $03005C04; (* Cycle through view options *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_VIEW} + DIBUTTON_DRIVINGT_DASHBOARD = $03005C05; (* Select next dashboard option *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_DASHBOARD} + DIBUTTON_DRIVINGT_BRAKE = $03004C06; (* Brake-button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_BRAKE} + DIBUTTON_DRIVINGT_FIRESECONDARY = $03004C07; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_FIRESECONDARY} + DIBUTTON_DRIVINGT_ACCELERATE_LINK = $0303D4E0; (* Fallback Accelerate button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_ACCELERATE_LINK} + DIBUTTON_DRIVINGT_STEER_LEFT_LINK = $0300CCE4; (* Fallback Steer Left button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_STEER_LEFT_LINK} + DIBUTTON_DRIVINGT_STEER_RIGHT_LINK = $0300CCEC; (* Fallback Steer Right button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_STEER_RIGHT_LINK} + DIBUTTON_DRIVINGT_BARREL_UP_LINK = $030144E0; (* Fallback Barrel up button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_BARREL_UP_LINK} + DIBUTTON_DRIVINGT_BARREL_DOWN_LINK = $030144E8; (* Fallback Barrel down button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_BARREL_DOWN_LINK} + DIBUTTON_DRIVINGT_ROTATE_LEFT_LINK = $030244E4; (* Fallback Rotate left button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_ROTATE_LEFT_LINK} + DIBUTTON_DRIVINGT_ROTATE_RIGHT_LINK = $030244EC; (* Fallback Rotate right button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_ROTATE_RIGHT_LINK} + DIBUTTON_DRIVINGT_GLANCE_LEFT_LINK = $0307C4E4; (* Fallback Glance Left button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_GLANCE_LEFT_LINK} + DIBUTTON_DRIVINGT_GLANCE_RIGHT_LINK = $0307C4EC; (* Fallback Glance Right button *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_GLANCE_RIGHT_LINK} + DIBUTTON_DRIVINGT_DEVICE = $030044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_DEVICE} + DIBUTTON_DRIVINGT_PAUSE = $030044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_DRIVINGT_PAUSE} + +(*--- Flight Simulator - Civilian + Plane control is the primary objective ---*) + DIVIRTUAL_FLYING_CIVILIAN = $04000000; + {$EXTERNALSYM DIVIRTUAL_FLYING_CIVILIAN} + DIAXIS_FLYINGC_BANK = $04008A01; (* Roll ship left / right *) + {$EXTERNALSYM DIAXIS_FLYINGC_BANK} + DIAXIS_FLYINGC_PITCH = $04010A02; (* Nose up / down *) + {$EXTERNALSYM DIAXIS_FLYINGC_PITCH} + DIAXIS_FLYINGC_THROTTLE = $04039203; (* Throttle *) + {$EXTERNALSYM DIAXIS_FLYINGC_THROTTLE} + DIBUTTON_FLYINGC_VIEW = $04002401; (* Cycle through view options *) + {$EXTERNALSYM DIBUTTON_FLYINGC_VIEW} + DIBUTTON_FLYINGC_DISPLAY = $04002402; (* Select next dashboard / heads up display option *) + {$EXTERNALSYM DIBUTTON_FLYINGC_DISPLAY} + DIBUTTON_FLYINGC_GEAR = $04002C03; (* Gear up / down *) + {$EXTERNALSYM DIBUTTON_FLYINGC_GEAR} + DIBUTTON_FLYINGC_MENU = $040004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FLYINGC_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_FLYINGC_GLANCE = $04004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_FLYINGC_GLANCE} + DIAXIS_FLYINGC_BRAKE = $04046A04; (* Apply Brake *) + {$EXTERNALSYM DIAXIS_FLYINGC_BRAKE} + DIAXIS_FLYINGC_RUDDER = $04025205; (* Yaw ship left/right *) + {$EXTERNALSYM DIAXIS_FLYINGC_RUDDER} + DIAXIS_FLYINGC_FLAPS = $04055A06; (* Flaps *) + {$EXTERNALSYM DIAXIS_FLYINGC_FLAPS} + DIBUTTON_FLYINGC_FLAPSUP = $04006404; (* Increment stepping up until fully retracted *) + {$EXTERNALSYM DIBUTTON_FLYINGC_FLAPSUP} + DIBUTTON_FLYINGC_FLAPSDOWN = $04006405; (* Decrement stepping down until fully extended *) + {$EXTERNALSYM DIBUTTON_FLYINGC_FLAPSDOWN} + DIBUTTON_FLYINGC_BRAKE_LINK = $04046CE0; (* Fallback brake button *) + {$EXTERNALSYM DIBUTTON_FLYINGC_BRAKE_LINK} + DIBUTTON_FLYINGC_FASTER_LINK = $0403D4E0; (* Fallback throttle up button *) + {$EXTERNALSYM DIBUTTON_FLYINGC_FASTER_LINK} + DIBUTTON_FLYINGC_SLOWER_LINK = $0403D4E8; (* Fallback throttle down button *) + {$EXTERNALSYM DIBUTTON_FLYINGC_SLOWER_LINK} + DIBUTTON_FLYINGC_GLANCE_LEFT_LINK = $0407C4E4; (* Fallback Glance Left button *) + {$EXTERNALSYM DIBUTTON_FLYINGC_GLANCE_LEFT_LINK} + DIBUTTON_FLYINGC_GLANCE_RIGHT_LINK = $0407C4EC; (* Fallback Glance Right button *) + {$EXTERNALSYM DIBUTTON_FLYINGC_GLANCE_RIGHT_LINK} + DIBUTTON_FLYINGC_GLANCE_UP_LINK = $0407C4E0; (* Fallback Glance Up button *) + {$EXTERNALSYM DIBUTTON_FLYINGC_GLANCE_UP_LINK} + DIBUTTON_FLYINGC_GLANCE_DOWN_LINK = $0407C4E8; (* Fallback Glance Down button *) + {$EXTERNALSYM DIBUTTON_FLYINGC_GLANCE_DOWN_LINK} + DIBUTTON_FLYINGC_DEVICE = $040044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FLYINGC_DEVICE} + DIBUTTON_FLYINGC_PAUSE = $040044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FLYINGC_PAUSE} + +(*--- Flight Simulator - Military + Aerial combat is the primary objective ---*) + DIVIRTUAL_FLYING_MILITARY = $05000000; + {$EXTERNALSYM DIVIRTUAL_FLYING_MILITARY} + DIAXIS_FLYINGM_BANK = $05008A01; (* Bank - Roll ship left / right *) + {$EXTERNALSYM DIAXIS_FLYINGM_BANK} + DIAXIS_FLYINGM_PITCH = $05010A02; (* Pitch - Nose up / down *) + {$EXTERNALSYM DIAXIS_FLYINGM_PITCH} + DIAXIS_FLYINGM_THROTTLE = $05039203; (* Throttle - faster / slower *) + {$EXTERNALSYM DIAXIS_FLYINGM_THROTTLE} + DIBUTTON_FLYINGM_FIRE = $05000C01; (* Fire *) + {$EXTERNALSYM DIBUTTON_FLYINGM_FIRE} + DIBUTTON_FLYINGM_WEAPONS = $05000C02; (* Select next weapon *) + {$EXTERNALSYM DIBUTTON_FLYINGM_WEAPONS} + DIBUTTON_FLYINGM_TARGET = $05000C03; (* Selects next available target *) + {$EXTERNALSYM DIBUTTON_FLYINGM_TARGET} + DIBUTTON_FLYINGM_MENU = $050004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FLYINGM_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_FLYINGM_GLANCE = $05004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_FLYINGM_GLANCE} + DIBUTTON_FLYINGM_COUNTER = $05005C04; (* Activate counter measures *) + {$EXTERNALSYM DIBUTTON_FLYINGM_COUNTER} + DIAXIS_FLYINGM_RUDDER = $05024A04; (* Rudder - Yaw ship left/right *) + {$EXTERNALSYM DIAXIS_FLYINGM_RUDDER} + DIAXIS_FLYINGM_BRAKE = $05046205; (* Brake-axis *) + {$EXTERNALSYM DIAXIS_FLYINGM_BRAKE} + DIBUTTON_FLYINGM_VIEW = $05006405; (* Cycle through view options *) + {$EXTERNALSYM DIBUTTON_FLYINGM_VIEW} + DIBUTTON_FLYINGM_DISPLAY = $05006406; (* Select next dashboard option *) + {$EXTERNALSYM DIBUTTON_FLYINGM_DISPLAY} + DIAXIS_FLYINGM_FLAPS = $05055206; (* Flaps *) + {$EXTERNALSYM DIAXIS_FLYINGM_FLAPS} + DIBUTTON_FLYINGM_FLAPSUP = $05005407; (* Increment stepping up until fully retracted *) + {$EXTERNALSYM DIBUTTON_FLYINGM_FLAPSUP} + DIBUTTON_FLYINGM_FLAPSDOWN = $05005408; (* Decrement stepping down until fully extended *) + {$EXTERNALSYM DIBUTTON_FLYINGM_FLAPSDOWN} + DIBUTTON_FLYINGM_FIRESECONDARY = $05004C09; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_FLYINGM_FIRESECONDARY} + DIBUTTON_FLYINGM_GEAR = $0500640A; (* Gear up / down *) + {$EXTERNALSYM DIBUTTON_FLYINGM_GEAR} + DIBUTTON_FLYINGM_BRAKE_LINK = $050464E0; (* Fallback brake button *) + {$EXTERNALSYM DIBUTTON_FLYINGM_BRAKE_LINK} + DIBUTTON_FLYINGM_FASTER_LINK = $0503D4E0; (* Fallback throttle up button *) + {$EXTERNALSYM DIBUTTON_FLYINGM_FASTER_LINK} + DIBUTTON_FLYINGM_SLOWER_LINK = $0503D4E8; (* Fallback throttle down button *) + {$EXTERNALSYM DIBUTTON_FLYINGM_SLOWER_LINK} + DIBUTTON_FLYINGM_GLANCE_LEFT_LINK = $0507C4E4; (* Fallback Glance Left button *) + {$EXTERNALSYM DIBUTTON_FLYINGM_GLANCE_LEFT_LINK} + DIBUTTON_FLYINGM_GLANCE_RIGHT_LINK = $0507C4EC; (* Fallback Glance Right button *) + {$EXTERNALSYM DIBUTTON_FLYINGM_GLANCE_RIGHT_LINK} + DIBUTTON_FLYINGM_GLANCE_UP_LINK = $0507C4E0; (* Fallback Glance Up button *) + {$EXTERNALSYM DIBUTTON_FLYINGM_GLANCE_UP_LINK} + DIBUTTON_FLYINGM_GLANCE_DOWN_LINK = $0507C4E8; (* Fallback Glance Down button *) + {$EXTERNALSYM DIBUTTON_FLYINGM_GLANCE_DOWN_LINK} + DIBUTTON_FLYINGM_DEVICE = $050044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FLYINGM_DEVICE} + DIBUTTON_FLYINGM_PAUSE = $050044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FLYINGM_PAUSE} + +(*--- Flight Simulator - Combat Helicopter + Combat from helicopter is primary objective ---*) + DIVIRTUAL_FLYING_HELICOPTER = $06000000; + {$EXTERNALSYM DIVIRTUAL_FLYING_HELICOPTER} + DIAXIS_FLYINGH_BANK = $06008A01; (* Bank - Roll ship left / right *) + {$EXTERNALSYM DIAXIS_FLYINGH_BANK} + DIAXIS_FLYINGH_PITCH = $06010A02; (* Pitch - Nose up / down *) + {$EXTERNALSYM DIAXIS_FLYINGH_PITCH} + DIAXIS_FLYINGH_COLLECTIVE = $06018A03; (* Collective - Blade pitch/power *) + {$EXTERNALSYM DIAXIS_FLYINGH_COLLECTIVE} + DIBUTTON_FLYINGH_FIRE = $06001401; (* Fire *) + {$EXTERNALSYM DIBUTTON_FLYINGH_FIRE} + DIBUTTON_FLYINGH_WEAPONS = $06001402; (* Select next weapon *) + {$EXTERNALSYM DIBUTTON_FLYINGH_WEAPONS} + DIBUTTON_FLYINGH_TARGET = $06001403; (* Selects next available target *) + {$EXTERNALSYM DIBUTTON_FLYINGH_TARGET} + DIBUTTON_FLYINGH_MENU = $060004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FLYINGH_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_FLYINGH_GLANCE = $06004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_FLYINGH_GLANCE} + DIAXIS_FLYINGH_TORQUE = $06025A04; (* Torque - Rotate ship around left / right axis *) + {$EXTERNALSYM DIAXIS_FLYINGH_TORQUE} + DIAXIS_FLYINGH_THROTTLE = $0603DA05; (* Throttle *) + {$EXTERNALSYM DIAXIS_FLYINGH_THROTTLE} + DIBUTTON_FLYINGH_COUNTER = $06005404; (* Activate counter measures *) + {$EXTERNALSYM DIBUTTON_FLYINGH_COUNTER} + DIBUTTON_FLYINGH_VIEW = $06006405; (* Cycle through view options *) + {$EXTERNALSYM DIBUTTON_FLYINGH_VIEW} + DIBUTTON_FLYINGH_GEAR = $06006406; (* Gear up / down *) + {$EXTERNALSYM DIBUTTON_FLYINGH_GEAR} + DIBUTTON_FLYINGH_FIRESECONDARY = $06004C07; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_FLYINGH_FIRESECONDARY} + DIBUTTON_FLYINGH_FASTER_LINK = $0603DCE0; (* Fallback throttle up button *) + {$EXTERNALSYM DIBUTTON_FLYINGH_FASTER_LINK} + DIBUTTON_FLYINGH_SLOWER_LINK = $0603DCE8; (* Fallback throttle down button *) + {$EXTERNALSYM DIBUTTON_FLYINGH_SLOWER_LINK} + DIBUTTON_FLYINGH_GLANCE_LEFT_LINK = $0607C4E4; (* Fallback Glance Left button *) + {$EXTERNALSYM DIBUTTON_FLYINGH_GLANCE_LEFT_LINK} + DIBUTTON_FLYINGH_GLANCE_RIGHT_LINK = $0607C4EC; (* Fallback Glance Right button *) + {$EXTERNALSYM DIBUTTON_FLYINGH_GLANCE_RIGHT_LINK} + DIBUTTON_FLYINGH_GLANCE_UP_LINK = $0607C4E0; (* Fallback Glance Up button *) + {$EXTERNALSYM DIBUTTON_FLYINGH_GLANCE_UP_LINK} + DIBUTTON_FLYINGH_GLANCE_DOWN_LINK = $0607C4E8; (* Fallback Glance Down button *) + {$EXTERNALSYM DIBUTTON_FLYINGH_GLANCE_DOWN_LINK} + DIBUTTON_FLYINGH_DEVICE = $060044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FLYINGH_DEVICE} + DIBUTTON_FLYINGH_PAUSE = $060044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FLYINGH_PAUSE} + +(*--- Space Simulator - Combat + Space Simulator with weapons ---*) + DIVIRTUAL_SPACESIM = $07000000; + {$EXTERNALSYM DIVIRTUAL_SPACESIM} + DIAXIS_SPACESIM_LATERAL = $07008201; (* Move ship left / right *) + {$EXTERNALSYM DIAXIS_SPACESIM_LATERAL} + DIAXIS_SPACESIM_MOVE = $07010202; (* Move ship forward/backward *) + {$EXTERNALSYM DIAXIS_SPACESIM_MOVE} + DIAXIS_SPACESIM_THROTTLE = $07038203; (* Throttle - Engine speed *) + {$EXTERNALSYM DIAXIS_SPACESIM_THROTTLE} + DIBUTTON_SPACESIM_FIRE = $07000401; (* Fire *) + {$EXTERNALSYM DIBUTTON_SPACESIM_FIRE} + DIBUTTON_SPACESIM_WEAPONS = $07000402; (* Select next weapon *) + {$EXTERNALSYM DIBUTTON_SPACESIM_WEAPONS} + DIBUTTON_SPACESIM_TARGET = $07000403; (* Selects next available target *) + {$EXTERNALSYM DIBUTTON_SPACESIM_TARGET} + DIBUTTON_SPACESIM_MENU = $070004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_SPACESIM_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_SPACESIM_GLANCE = $07004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_SPACESIM_GLANCE} + DIAXIS_SPACESIM_CLIMB = $0701C204; (* Climb - Pitch ship up/down *) + {$EXTERNALSYM DIAXIS_SPACESIM_CLIMB} + DIAXIS_SPACESIM_ROTATE = $07024205; (* Rotate - Turn ship left/right *) + {$EXTERNALSYM DIAXIS_SPACESIM_ROTATE} + DIBUTTON_SPACESIM_VIEW = $07004404; (* Cycle through view options *) + {$EXTERNALSYM DIBUTTON_SPACESIM_VIEW} + DIBUTTON_SPACESIM_DISPLAY = $07004405; (* Select next dashboard / heads up display option *) + {$EXTERNALSYM DIBUTTON_SPACESIM_DISPLAY} + DIBUTTON_SPACESIM_RAISE = $07004406; (* Raise ship while maintaining current pitch *) + {$EXTERNALSYM DIBUTTON_SPACESIM_RAISE} + DIBUTTON_SPACESIM_LOWER = $07004407; (* Lower ship while maintaining current pitch *) + {$EXTERNALSYM DIBUTTON_SPACESIM_LOWER} + DIBUTTON_SPACESIM_GEAR = $07004408; (* Gear up / down *) + {$EXTERNALSYM DIBUTTON_SPACESIM_GEAR} + DIBUTTON_SPACESIM_FIRESECONDARY = $07004409; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_FIRESECONDARY} + DIBUTTON_SPACESIM_LEFT_LINK = $0700C4E4; (* Fallback move left button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_LEFT_LINK} + DIBUTTON_SPACESIM_RIGHT_LINK = $0700C4EC; (* Fallback move right button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_RIGHT_LINK} + DIBUTTON_SPACESIM_FORWARD_LINK = $070144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_FORWARD_LINK} + DIBUTTON_SPACESIM_BACKWARD_LINK = $070144E8; (* Fallback move backwards button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_BACKWARD_LINK} + DIBUTTON_SPACESIM_FASTER_LINK = $0703C4E0; (* Fallback throttle up button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_FASTER_LINK} + DIBUTTON_SPACESIM_SLOWER_LINK = $0703C4E8; (* Fallback throttle down button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_SLOWER_LINK} + DIBUTTON_SPACESIM_TURN_LEFT_LINK = $070244E4; (* Fallback turn left button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_TURN_LEFT_LINK} + DIBUTTON_SPACESIM_TURN_RIGHT_LINK = $070244EC; (* Fallback turn right button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_TURN_RIGHT_LINK} + DIBUTTON_SPACESIM_GLANCE_LEFT_LINK = $0707C4E4; (* Fallback Glance Left button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_GLANCE_LEFT_LINK} + DIBUTTON_SPACESIM_GLANCE_RIGHT_LINK = $0707C4EC; (* Fallback Glance Right button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_GLANCE_RIGHT_LINK} + DIBUTTON_SPACESIM_GLANCE_UP_LINK = $0707C4E0; (* Fallback Glance Up button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_GLANCE_UP_LINK} + DIBUTTON_SPACESIM_GLANCE_DOWN_LINK = $0707C4E8; (* Fallback Glance Down button *) + {$EXTERNALSYM DIBUTTON_SPACESIM_GLANCE_DOWN_LINK} + DIBUTTON_SPACESIM_DEVICE = $070044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_SPACESIM_DEVICE} + DIBUTTON_SPACESIM_PAUSE = $070044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_SPACESIM_PAUSE} + +(*--- Fighting - First Person + Hand to Hand combat is primary objective ---*) + DIVIRTUAL_FIGHTING_HAND2HAND = $08000000; + {$EXTERNALSYM DIVIRTUAL_FIGHTING_HAND2HAND} + DIAXIS_FIGHTINGH_LATERAL = $08008201; (* Sidestep left/right *) + {$EXTERNALSYM DIAXIS_FIGHTINGH_LATERAL} + DIAXIS_FIGHTINGH_MOVE = $08010202; (* Move forward/backward *) + {$EXTERNALSYM DIAXIS_FIGHTINGH_MOVE} + DIBUTTON_FIGHTINGH_PUNCH = $08000401; (* Punch *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_PUNCH} + DIBUTTON_FIGHTINGH_KICK = $08000402; (* Kick *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_KICK} + DIBUTTON_FIGHTINGH_BLOCK = $08000403; (* Block *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_BLOCK} + DIBUTTON_FIGHTINGH_CROUCH = $08000404; (* Crouch *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_CROUCH} + DIBUTTON_FIGHTINGH_JUMP = $08000405; (* Jump *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_JUMP} + DIBUTTON_FIGHTINGH_SPECIAL1 = $08000406; (* Apply first special move *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_SPECIAL1} + DIBUTTON_FIGHTINGH_SPECIAL2 = $08000407; (* Apply second special move *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_SPECIAL2} + DIBUTTON_FIGHTINGH_MENU = $080004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_FIGHTINGH_SELECT = $08004408; (* Select special move *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_SELECT} + DIHATSWITCH_FIGHTINGH_SLIDE = $08004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_FIGHTINGH_SLIDE} + DIBUTTON_FIGHTINGH_DISPLAY = $08004409; (* Shows next on-screen display option *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_DISPLAY} + DIAXIS_FIGHTINGH_ROTATE = $08024203; (* Rotate - Turn body left/right *) + {$EXTERNALSYM DIAXIS_FIGHTINGH_ROTATE} + DIBUTTON_FIGHTINGH_DODGE = $0800440A; (* Dodge *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_DODGE} + DIBUTTON_FIGHTINGH_LEFT_LINK = $0800C4E4; (* Fallback left sidestep button *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_LEFT_LINK} + DIBUTTON_FIGHTINGH_RIGHT_LINK = $0800C4EC; (* Fallback right sidestep button *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_RIGHT_LINK} + DIBUTTON_FIGHTINGH_FORWARD_LINK = $080144E0; (* Fallback forward button *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_FORWARD_LINK} + DIBUTTON_FIGHTINGH_BACKWARD_LINK = $080144E8; (* Fallback backward button *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_BACKWARD_LINK} + DIBUTTON_FIGHTINGH_DEVICE = $080044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_DEVICE} + DIBUTTON_FIGHTINGH_PAUSE = $080044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FIGHTINGH_PAUSE} + +(*--- Fighting - First Person Shooting + Navigation and combat are primary objectives ---*) + DIVIRTUAL_FIGHTING_FPS = $09000000; + {$EXTERNALSYM DIVIRTUAL_FIGHTING_FPS} + DIAXIS_FPS_ROTATE = $09008201; (* Rotate character left/right *) + {$EXTERNALSYM DIAXIS_FPS_ROTATE} + DIAXIS_FPS_MOVE = $09010202; (* Move forward/backward *) + {$EXTERNALSYM DIAXIS_FPS_MOVE} + DIBUTTON_FPS_FIRE = $09000401; (* Fire *) + {$EXTERNALSYM DIBUTTON_FPS_FIRE} + DIBUTTON_FPS_WEAPONS = $09000402; (* Select next weapon *) + {$EXTERNALSYM DIBUTTON_FPS_WEAPONS} + DIBUTTON_FPS_APPLY = $09000403; (* Use item *) + {$EXTERNALSYM DIBUTTON_FPS_APPLY} + DIBUTTON_FPS_SELECT = $09000404; (* Select next inventory item *) + {$EXTERNALSYM DIBUTTON_FPS_SELECT} + DIBUTTON_FPS_CROUCH = $09000405; (* Crouch/ climb down/ swim down *) + {$EXTERNALSYM DIBUTTON_FPS_CROUCH} + DIBUTTON_FPS_JUMP = $09000406; (* Jump/ climb up/ swim up *) + {$EXTERNALSYM DIBUTTON_FPS_JUMP} + DIAXIS_FPS_LOOKUPDOWN = $09018203; (* Look up / down *) + {$EXTERNALSYM DIAXIS_FPS_LOOKUPDOWN} + DIBUTTON_FPS_STRAFE = $09000407; (* Enable strafing while active *) + {$EXTERNALSYM DIBUTTON_FPS_STRAFE} + DIBUTTON_FPS_MENU = $090004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FPS_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_FPS_GLANCE = $09004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_FPS_GLANCE} + DIBUTTON_FPS_DISPLAY = $09004408; (* Shows next on-screen display option/ map *) + {$EXTERNALSYM DIBUTTON_FPS_DISPLAY} + DIAXIS_FPS_SIDESTEP = $09024204; (* Sidestep *) + {$EXTERNALSYM DIAXIS_FPS_SIDESTEP} + DIBUTTON_FPS_DODGE = $09004409; (* Dodge *) + {$EXTERNALSYM DIBUTTON_FPS_DODGE} + DIBUTTON_FPS_GLANCEL = $0900440A; (* Glance Left *) + {$EXTERNALSYM DIBUTTON_FPS_GLANCEL} + DIBUTTON_FPS_GLANCER = $0900440B; (* Glance Right *) + {$EXTERNALSYM DIBUTTON_FPS_GLANCER} + DIBUTTON_FPS_FIRESECONDARY = $0900440C; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_FPS_FIRESECONDARY} + DIBUTTON_FPS_ROTATE_LEFT_LINK = $0900C4E4; (* Fallback rotate left button *) + {$EXTERNALSYM DIBUTTON_FPS_ROTATE_LEFT_LINK} + DIBUTTON_FPS_ROTATE_RIGHT_LINK = $0900C4EC; (* Fallback rotate right button *) + {$EXTERNALSYM DIBUTTON_FPS_ROTATE_RIGHT_LINK} + DIBUTTON_FPS_FORWARD_LINK = $090144E0; (* Fallback forward button *) + {$EXTERNALSYM DIBUTTON_FPS_FORWARD_LINK} + DIBUTTON_FPS_BACKWARD_LINK = $090144E8; (* Fallback backward button *) + {$EXTERNALSYM DIBUTTON_FPS_BACKWARD_LINK} + DIBUTTON_FPS_GLANCE_UP_LINK = $0901C4E0; (* Fallback look up button *) + {$EXTERNALSYM DIBUTTON_FPS_GLANCE_UP_LINK} + DIBUTTON_FPS_GLANCE_DOWN_LINK = $0901C4E8; (* Fallback look down button *) + {$EXTERNALSYM DIBUTTON_FPS_GLANCE_DOWN_LINK} + DIBUTTON_FPS_STEP_LEFT_LINK = $090244E4; (* Fallback step left button *) + {$EXTERNALSYM DIBUTTON_FPS_STEP_LEFT_LINK} + DIBUTTON_FPS_STEP_RIGHT_LINK = $090244EC; (* Fallback step right button *) + {$EXTERNALSYM DIBUTTON_FPS_STEP_RIGHT_LINK} + DIBUTTON_FPS_DEVICE = $090044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FPS_DEVICE} + DIBUTTON_FPS_PAUSE = $090044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FPS_PAUSE} + +(*--- Fighting - Third Person action + Perspective of camera is behind the main character ---*) + DIVIRTUAL_FIGHTING_THIRDPERSON = $0A000000; + {$EXTERNALSYM DIVIRTUAL_FIGHTING_THIRDPERSON} + DIAXIS_TPS_TURN = $0A020201; (* Turn left/right *) + {$EXTERNALSYM DIAXIS_TPS_TURN} + DIAXIS_TPS_MOVE = $0A010202; (* Move forward/backward *) + {$EXTERNALSYM DIAXIS_TPS_MOVE} + DIBUTTON_TPS_RUN = $0A000401; (* Run or walk toggle switch *) + {$EXTERNALSYM DIBUTTON_TPS_RUN} + DIBUTTON_TPS_ACTION = $0A000402; (* Action Button *) + {$EXTERNALSYM DIBUTTON_TPS_ACTION} + DIBUTTON_TPS_SELECT = $0A000403; (* Select next weapon *) + {$EXTERNALSYM DIBUTTON_TPS_SELECT} + DIBUTTON_TPS_USE = $0A000404; (* Use inventory item currently selected *) + {$EXTERNALSYM DIBUTTON_TPS_USE} + DIBUTTON_TPS_JUMP = $0A000405; (* Character Jumps *) + {$EXTERNALSYM DIBUTTON_TPS_JUMP} + DIBUTTON_TPS_MENU = $0A0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_TPS_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_TPS_GLANCE = $0A004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_TPS_GLANCE} + DIBUTTON_TPS_VIEW = $0A004406; (* Select camera view *) + {$EXTERNALSYM DIBUTTON_TPS_VIEW} + DIBUTTON_TPS_STEPLEFT = $0A004407; (* Character takes a left step *) + {$EXTERNALSYM DIBUTTON_TPS_STEPLEFT} + DIBUTTON_TPS_STEPRIGHT = $0A004408; (* Character takes a right step *) + {$EXTERNALSYM DIBUTTON_TPS_STEPRIGHT} + DIAXIS_TPS_STEP = $0A00C203; (* Character steps left/right *) + {$EXTERNALSYM DIAXIS_TPS_STEP} + DIBUTTON_TPS_DODGE = $0A004409; (* Character dodges or ducks *) + {$EXTERNALSYM DIBUTTON_TPS_DODGE} + DIBUTTON_TPS_INVENTORY = $0A00440A; (* Cycle through inventory *) + {$EXTERNALSYM DIBUTTON_TPS_INVENTORY} + DIBUTTON_TPS_TURN_LEFT_LINK = $0A0244E4; (* Fallback turn left button *) + {$EXTERNALSYM DIBUTTON_TPS_TURN_LEFT_LINK} + DIBUTTON_TPS_TURN_RIGHT_LINK = $0A0244EC; (* Fallback turn right button *) + {$EXTERNALSYM DIBUTTON_TPS_TURN_RIGHT_LINK} + DIBUTTON_TPS_FORWARD_LINK = $0A0144E0; (* Fallback forward button *) + {$EXTERNALSYM DIBUTTON_TPS_FORWARD_LINK} + DIBUTTON_TPS_BACKWARD_LINK = $0A0144E8; (* Fallback backward button *) + {$EXTERNALSYM DIBUTTON_TPS_BACKWARD_LINK} + DIBUTTON_TPS_GLANCE_UP_LINK = $0A07C4E0; (* Fallback look up button *) + {$EXTERNALSYM DIBUTTON_TPS_GLANCE_UP_LINK} + DIBUTTON_TPS_GLANCE_DOWN_LINK = $0A07C4E8; (* Fallback look down button *) + {$EXTERNALSYM DIBUTTON_TPS_GLANCE_DOWN_LINK} + DIBUTTON_TPS_GLANCE_LEFT_LINK = $0A07C4E4; (* Fallback glance up button *) + {$EXTERNALSYM DIBUTTON_TPS_GLANCE_LEFT_LINK} + DIBUTTON_TPS_GLANCE_RIGHT_LINK = $0A07C4EC; (* Fallback glance right button *) + {$EXTERNALSYM DIBUTTON_TPS_GLANCE_RIGHT_LINK} + DIBUTTON_TPS_DEVICE = $0A0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_TPS_DEVICE} + DIBUTTON_TPS_PAUSE = $0A0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_TPS_PAUSE} + +(*--- Strategy - Role Playing + Navigation and problem solving are primary actions ---*) + DIVIRTUAL_STRATEGY_ROLEPLAYING = $0B000000; + {$EXTERNALSYM DIVIRTUAL_STRATEGY_ROLEPLAYING} + DIAXIS_STRATEGYR_LATERAL = $0B008201; (* sidestep - left/right *) + {$EXTERNALSYM DIAXIS_STRATEGYR_LATERAL} + DIAXIS_STRATEGYR_MOVE = $0B010202; (* move forward/backward *) + {$EXTERNALSYM DIAXIS_STRATEGYR_MOVE} + DIBUTTON_STRATEGYR_GET = $0B000401; (* Acquire item *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_GET} + DIBUTTON_STRATEGYR_APPLY = $0B000402; (* Use selected item *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_APPLY} + DIBUTTON_STRATEGYR_SELECT = $0B000403; (* Select nextitem *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_SELECT} + DIBUTTON_STRATEGYR_ATTACK = $0B000404; (* Attack *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_ATTACK} + DIBUTTON_STRATEGYR_CAST = $0B000405; (* Cast Spell *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_CAST} + DIBUTTON_STRATEGYR_CROUCH = $0B000406; (* Crouch *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_CROUCH} + DIBUTTON_STRATEGYR_JUMP = $0B000407; (* Jump *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_JUMP} + DIBUTTON_STRATEGYR_MENU = $0B0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_STRATEGYR_GLANCE = $0B004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_STRATEGYR_GLANCE} + DIBUTTON_STRATEGYR_MAP = $0B004408; (* Cycle through map options *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_MAP} + DIBUTTON_STRATEGYR_DISPLAY = $0B004409; (* Shows next on-screen display option *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_DISPLAY} + DIAXIS_STRATEGYR_ROTATE = $0B024203; (* Turn body left/right *) + {$EXTERNALSYM DIAXIS_STRATEGYR_ROTATE} + DIBUTTON_STRATEGYR_LEFT_LINK = $0B00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_LEFT_LINK} + DIBUTTON_STRATEGYR_RIGHT_LINK = $0B00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_RIGHT_LINK} + DIBUTTON_STRATEGYR_FORWARD_LINK = $0B0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_FORWARD_LINK} + DIBUTTON_STRATEGYR_BACK_LINK = $0B0144E8; (* Fallback move backward button *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_BACK_LINK} + DIBUTTON_STRATEGYR_ROTATE_LEFT_LINK = $0B0244E4; (* Fallback turn body left button *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_ROTATE_LEFT_LINK} + DIBUTTON_STRATEGYR_ROTATE_RIGHT_LINK = $0B0244EC; (* Fallback turn body right button *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_ROTATE_RIGHT_LINK} + DIBUTTON_STRATEGYR_DEVICE = $0B0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_DEVICE} + DIBUTTON_STRATEGYR_PAUSE = $0B0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_STRATEGYR_PAUSE} + +(*--- Strategy - Turn based + Navigation and problem solving are primary actions ---*) + DIVIRTUAL_STRATEGY_TURN = $0C000000; + {$EXTERNALSYM DIVIRTUAL_STRATEGY_TURN} + DIAXIS_STRATEGYT_LATERAL = $0C008201; (* Sidestep left/right *) + {$EXTERNALSYM DIAXIS_STRATEGYT_LATERAL} + DIAXIS_STRATEGYT_MOVE = $0C010202; (* Move forward/backwards *) + {$EXTERNALSYM DIAXIS_STRATEGYT_MOVE} + DIBUTTON_STRATEGYT_SELECT = $0C000401; (* Select unit or object *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_SELECT} + DIBUTTON_STRATEGYT_INSTRUCT = $0C000402; (* Cycle through instructions *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_INSTRUCT} + DIBUTTON_STRATEGYT_APPLY = $0C000403; (* Apply selected instruction *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_APPLY} + DIBUTTON_STRATEGYT_TEAM = $0C000404; (* Select next team / cycle through all *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_TEAM} + DIBUTTON_STRATEGYT_TURN = $0C000405; (* Indicate turn over *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_TURN} + DIBUTTON_STRATEGYT_MENU = $0C0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_STRATEGYT_ZOOM = $0C004406; (* Zoom - in / out *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_ZOOM} + DIBUTTON_STRATEGYT_MAP = $0C004407; (* cycle through map options *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_MAP} + DIBUTTON_STRATEGYT_DISPLAY = $0C004408; (* shows next on-screen display options *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_DISPLAY} + DIBUTTON_STRATEGYT_LEFT_LINK = $0C00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_LEFT_LINK} + DIBUTTON_STRATEGYT_RIGHT_LINK = $0C00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_RIGHT_LINK} + DIBUTTON_STRATEGYT_FORWARD_LINK = $0C0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_FORWARD_LINK} + DIBUTTON_STRATEGYT_BACK_LINK = $0C0144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_BACK_LINK} + DIBUTTON_STRATEGYT_DEVICE = $0C0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_DEVICE} + DIBUTTON_STRATEGYT_PAUSE = $0C0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_STRATEGYT_PAUSE} + +(*--- Sports - Hunting + Hunting ---*) + DIVIRTUAL_SPORTS_HUNTING = $0D000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_HUNTING} + DIAXIS_HUNTING_LATERAL = $0D008201; (* sidestep left/right *) + {$EXTERNALSYM DIAXIS_HUNTING_LATERAL} + DIAXIS_HUNTING_MOVE = $0D010202; (* move forward/backwards *) + {$EXTERNALSYM DIAXIS_HUNTING_MOVE} + DIBUTTON_HUNTING_FIRE = $0D000401; (* Fire selected weapon *) + {$EXTERNALSYM DIBUTTON_HUNTING_FIRE} + DIBUTTON_HUNTING_AIM = $0D000402; (* Select aim/move *) + {$EXTERNALSYM DIBUTTON_HUNTING_AIM} + DIBUTTON_HUNTING_WEAPON = $0D000403; (* Select next weapon *) + {$EXTERNALSYM DIBUTTON_HUNTING_WEAPON} + DIBUTTON_HUNTING_BINOCULAR = $0D000404; (* Look through Binoculars *) + {$EXTERNALSYM DIBUTTON_HUNTING_BINOCULAR} + DIBUTTON_HUNTING_CALL = $0D000405; (* Make animal call *) + {$EXTERNALSYM DIBUTTON_HUNTING_CALL} + DIBUTTON_HUNTING_MAP = $0D000406; (* View Map *) + {$EXTERNALSYM DIBUTTON_HUNTING_MAP} + DIBUTTON_HUNTING_SPECIAL = $0D000407; (* Special game operation *) + {$EXTERNALSYM DIBUTTON_HUNTING_SPECIAL} + DIBUTTON_HUNTING_MENU = $0D0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_HUNTING_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_HUNTING_GLANCE = $0D004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_HUNTING_GLANCE} + DIBUTTON_HUNTING_DISPLAY = $0D004408; (* show next on-screen display option *) + {$EXTERNALSYM DIBUTTON_HUNTING_DISPLAY} + DIAXIS_HUNTING_ROTATE = $0D024203; (* Turn body left/right *) + {$EXTERNALSYM DIAXIS_HUNTING_ROTATE} + DIBUTTON_HUNTING_CROUCH = $0D004409; (* Crouch/ Climb / Swim down *) + {$EXTERNALSYM DIBUTTON_HUNTING_CROUCH} + DIBUTTON_HUNTING_JUMP = $0D00440A; (* Jump/ Climb up / Swim up *) + {$EXTERNALSYM DIBUTTON_HUNTING_JUMP} + DIBUTTON_HUNTING_FIRESECONDARY = $0D00440B; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_HUNTING_FIRESECONDARY} + DIBUTTON_HUNTING_LEFT_LINK = $0D00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_HUNTING_LEFT_LINK} + DIBUTTON_HUNTING_RIGHT_LINK = $0D00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_HUNTING_RIGHT_LINK} + DIBUTTON_HUNTING_FORWARD_LINK = $0D0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_HUNTING_FORWARD_LINK} + DIBUTTON_HUNTING_BACK_LINK = $0D0144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_HUNTING_BACK_LINK} + DIBUTTON_HUNTING_ROTATE_LEFT_LINK = $0D0244E4; (* Fallback turn body left button *) + {$EXTERNALSYM DIBUTTON_HUNTING_ROTATE_LEFT_LINK} + DIBUTTON_HUNTING_ROTATE_RIGHT_LINK = $0D0244EC; (* Fallback turn body right button *) + {$EXTERNALSYM DIBUTTON_HUNTING_ROTATE_RIGHT_LINK} + DIBUTTON_HUNTING_DEVICE = $0D0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_HUNTING_DEVICE} + DIBUTTON_HUNTING_PAUSE = $0D0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_HUNTING_PAUSE} + +(*--- Sports - Fishing + Catching Fish is primary objective ---*) + DIVIRTUAL_SPORTS_FISHING = $0E000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_FISHING} + DIAXIS_FISHING_LATERAL = $0E008201; (* sidestep left/right *) + {$EXTERNALSYM DIAXIS_FISHING_LATERAL} + DIAXIS_FISHING_MOVE = $0E010202; (* move forward/backwards *) + {$EXTERNALSYM DIAXIS_FISHING_MOVE} + DIBUTTON_FISHING_CAST = $0E000401; (* Cast line *) + {$EXTERNALSYM DIBUTTON_FISHING_CAST} + DIBUTTON_FISHING_TYPE = $0E000402; (* Select cast type *) + {$EXTERNALSYM DIBUTTON_FISHING_TYPE} + DIBUTTON_FISHING_BINOCULAR = $0E000403; (* Look through Binocular *) + {$EXTERNALSYM DIBUTTON_FISHING_BINOCULAR} + DIBUTTON_FISHING_BAIT = $0E000404; (* Select type of Bait *) + {$EXTERNALSYM DIBUTTON_FISHING_BAIT} + DIBUTTON_FISHING_MAP = $0E000405; (* View Map *) + {$EXTERNALSYM DIBUTTON_FISHING_MAP} + DIBUTTON_FISHING_MENU = $0E0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FISHING_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_FISHING_GLANCE = $0E004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_FISHING_GLANCE} + DIBUTTON_FISHING_DISPLAY = $0E004406; (* Show next on-screen display option *) + {$EXTERNALSYM DIBUTTON_FISHING_DISPLAY} + DIAXIS_FISHING_ROTATE = $0E024203; (* Turn character left / right *) + {$EXTERNALSYM DIAXIS_FISHING_ROTATE} + DIBUTTON_FISHING_CROUCH = $0E004407; (* Crouch/ Climb / Swim down *) + {$EXTERNALSYM DIBUTTON_FISHING_CROUCH} + DIBUTTON_FISHING_JUMP = $0E004408; (* Jump/ Climb up / Swim up *) + {$EXTERNALSYM DIBUTTON_FISHING_JUMP} + DIBUTTON_FISHING_LEFT_LINK = $0E00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_FISHING_LEFT_LINK} + DIBUTTON_FISHING_RIGHT_LINK = $0E00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_FISHING_RIGHT_LINK} + DIBUTTON_FISHING_FORWARD_LINK = $0E0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_FISHING_FORWARD_LINK} + DIBUTTON_FISHING_BACK_LINK = $0E0144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_FISHING_BACK_LINK} + DIBUTTON_FISHING_ROTATE_LEFT_LINK = $0E0244E4; (* Fallback turn body left button *) + {$EXTERNALSYM DIBUTTON_FISHING_ROTATE_LEFT_LINK} + DIBUTTON_FISHING_ROTATE_RIGHT_LINK = $0E0244EC; (* Fallback turn body right button *) + {$EXTERNALSYM DIBUTTON_FISHING_ROTATE_RIGHT_LINK} + DIBUTTON_FISHING_DEVICE = $0E0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FISHING_DEVICE} + DIBUTTON_FISHING_PAUSE = $0E0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FISHING_PAUSE} + +(*--- Sports - Baseball - Batting + Batter control is primary objective ---*) + DIVIRTUAL_SPORTS_BASEBALL_BAT = $0F000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_BASEBALL_BAT} + DIAXIS_BASEBALLB_LATERAL = $0F008201; (* Aim left / right *) + {$EXTERNALSYM DIAXIS_BASEBALLB_LATERAL} + DIAXIS_BASEBALLB_MOVE = $0F010202; (* Aim up / down *) + {$EXTERNALSYM DIAXIS_BASEBALLB_MOVE} + DIBUTTON_BASEBALLB_SELECT = $0F000401; (* cycle through swing options *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_SELECT} + DIBUTTON_BASEBALLB_NORMAL = $0F000402; (* normal swing *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_NORMAL} + DIBUTTON_BASEBALLB_POWER = $0F000403; (* swing for the fence *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_POWER} + DIBUTTON_BASEBALLB_BUNT = $0F000404; (* bunt *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_BUNT} + DIBUTTON_BASEBALLB_STEAL = $0F000405; (* Base runner attempts to steal a base *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_STEAL} + DIBUTTON_BASEBALLB_BURST = $0F000406; (* Base runner invokes burst of speed *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_BURST} + DIBUTTON_BASEBALLB_SLIDE = $0F000407; (* Base runner slides into base *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_SLIDE} + DIBUTTON_BASEBALLB_CONTACT = $0F000408; (* Contact swing *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_CONTACT} + DIBUTTON_BASEBALLB_MENU = $0F0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_BASEBALLB_NOSTEAL = $0F004409; (* Base runner goes back to a base *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_NOSTEAL} + DIBUTTON_BASEBALLB_BOX = $0F00440A; (* Enter or exit batting box *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_BOX} + DIBUTTON_BASEBALLB_LEFT_LINK = $0F00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_LEFT_LINK} + DIBUTTON_BASEBALLB_RIGHT_LINK = $0F00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_RIGHT_LINK} + DIBUTTON_BASEBALLB_FORWARD_LINK = $0F0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_FORWARD_LINK} + DIBUTTON_BASEBALLB_BACK_LINK = $0F0144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_BACK_LINK} + DIBUTTON_BASEBALLB_DEVICE = $0F0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_DEVICE} + DIBUTTON_BASEBALLB_PAUSE = $0F0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_BASEBALLB_PAUSE} + +(*--- Sports - Baseball - Pitching + Pitcher control is primary objective ---*) + DIVIRTUAL_SPORTS_BASEBALL_PITCH = $10000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_BASEBALL_PITCH} + DIAXIS_BASEBALLP_LATERAL = $10008201; (* Aim left / right *) + {$EXTERNALSYM DIAXIS_BASEBALLP_LATERAL} + DIAXIS_BASEBALLP_MOVE = $10010202; (* Aim up / down *) + {$EXTERNALSYM DIAXIS_BASEBALLP_MOVE} + DIBUTTON_BASEBALLP_SELECT = $10000401; (* cycle through pitch selections *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_SELECT} + DIBUTTON_BASEBALLP_PITCH = $10000402; (* throw pitch *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_PITCH} + DIBUTTON_BASEBALLP_BASE = $10000403; (* select base to throw to *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_BASE} + DIBUTTON_BASEBALLP_THROW = $10000404; (* throw to base *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_THROW} + DIBUTTON_BASEBALLP_FAKE = $10000405; (* Fake a throw to a base *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_FAKE} + DIBUTTON_BASEBALLP_MENU = $100004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_BASEBALLP_WALK = $10004406; (* Throw intentional walk / pitch out *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_WALK} + DIBUTTON_BASEBALLP_LOOK = $10004407; (* Look at runners on bases *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_LOOK} + DIBUTTON_BASEBALLP_LEFT_LINK = $1000C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_LEFT_LINK} + DIBUTTON_BASEBALLP_RIGHT_LINK = $1000C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_RIGHT_LINK} + DIBUTTON_BASEBALLP_FORWARD_LINK = $100144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_FORWARD_LINK} + DIBUTTON_BASEBALLP_BACK_LINK = $100144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_BACK_LINK} + DIBUTTON_BASEBALLP_DEVICE = $100044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_DEVICE} + DIBUTTON_BASEBALLP_PAUSE = $100044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_BASEBALLP_PAUSE} + +(*--- Sports - Baseball - Fielding + Fielder control is primary objective ---*) + DIVIRTUAL_SPORTS_BASEBALL_FIELD = $11000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_BASEBALL_FIELD} + DIAXIS_BASEBALLF_LATERAL = $11008201; (* Aim left / right *) + {$EXTERNALSYM DIAXIS_BASEBALLF_LATERAL} + DIAXIS_BASEBALLF_MOVE = $11010202; (* Aim up / down *) + {$EXTERNALSYM DIAXIS_BASEBALLF_MOVE} + DIBUTTON_BASEBALLF_NEAREST = $11000401; (* Switch to fielder nearest to the ball *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_NEAREST} + DIBUTTON_BASEBALLF_THROW1 = $11000402; (* Make conservative throw *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_THROW1} + DIBUTTON_BASEBALLF_THROW2 = $11000403; (* Make aggressive throw *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_THROW2} + DIBUTTON_BASEBALLF_BURST = $11000404; (* Invoke burst of speed *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_BURST} + DIBUTTON_BASEBALLF_JUMP = $11000405; (* Jump to catch ball *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_JUMP} + DIBUTTON_BASEBALLF_DIVE = $11000406; (* Dive to catch ball *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_DIVE} + DIBUTTON_BASEBALLF_MENU = $110004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_BASEBALLF_SHIFTIN = $11004407; (* Shift the infield positioning *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_SHIFTIN} + DIBUTTON_BASEBALLF_SHIFTOUT = $11004408; (* Shift the outfield positioning *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_SHIFTOUT} + DIBUTTON_BASEBALLF_AIM_LEFT_LINK = $1100C4E4; (* Fallback aim left button *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_AIM_LEFT_LINK} + DIBUTTON_BASEBALLF_AIM_RIGHT_LINK = $1100C4EC; (* Fallback aim right button *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_AIM_RIGHT_LINK} + DIBUTTON_BASEBALLF_FORWARD_LINK = $110144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_FORWARD_LINK} + DIBUTTON_BASEBALLF_BACK_LINK = $110144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_BACK_LINK} + DIBUTTON_BASEBALLF_DEVICE = $110044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_DEVICE} + DIBUTTON_BASEBALLF_PAUSE = $110044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_BASEBALLF_PAUSE} + +(*--- Sports - Basketball - Offense + Offense ---*) + DIVIRTUAL_SPORTS_BASKETBALL_OFFENSE = $12000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_BASKETBALL_OFFENSE} + DIAXIS_BBALLO_LATERAL = $12008201; (* left / right *) + {$EXTERNALSYM DIAXIS_BBALLO_LATERAL} + DIAXIS_BBALLO_MOVE = $12010202; (* up / down *) + {$EXTERNALSYM DIAXIS_BBALLO_MOVE} + DIBUTTON_BBALLO_SHOOT = $12000401; (* shoot basket *) + {$EXTERNALSYM DIBUTTON_BBALLO_SHOOT} + DIBUTTON_BBALLO_DUNK = $12000402; (* dunk basket *) + {$EXTERNALSYM DIBUTTON_BBALLO_DUNK} + DIBUTTON_BBALLO_PASS = $12000403; (* throw pass *) + {$EXTERNALSYM DIBUTTON_BBALLO_PASS} + DIBUTTON_BBALLO_FAKE = $12000404; (* fake shot or pass *) + {$EXTERNALSYM DIBUTTON_BBALLO_FAKE} + DIBUTTON_BBALLO_SPECIAL = $12000405; (* apply special move *) + {$EXTERNALSYM DIBUTTON_BBALLO_SPECIAL} + DIBUTTON_BBALLO_PLAYER = $12000406; (* select next player *) + {$EXTERNALSYM DIBUTTON_BBALLO_PLAYER} + DIBUTTON_BBALLO_BURST = $12000407; (* invoke burst *) + {$EXTERNALSYM DIBUTTON_BBALLO_BURST} + DIBUTTON_BBALLO_CALL = $12000408; (* call for ball / pass to me *) + {$EXTERNALSYM DIBUTTON_BBALLO_CALL} + DIBUTTON_BBALLO_MENU = $120004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_BBALLO_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_BBALLO_GLANCE = $12004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_BBALLO_GLANCE} + DIBUTTON_BBALLO_SCREEN = $12004409; (* Call for screen *) + {$EXTERNALSYM DIBUTTON_BBALLO_SCREEN} + DIBUTTON_BBALLO_PLAY = $1200440A; (* Call for specific offensive play *) + {$EXTERNALSYM DIBUTTON_BBALLO_PLAY} + DIBUTTON_BBALLO_JAB = $1200440B; (* Initiate fake drive to basket *) + {$EXTERNALSYM DIBUTTON_BBALLO_JAB} + DIBUTTON_BBALLO_POST = $1200440C; (* Perform post move *) + {$EXTERNALSYM DIBUTTON_BBALLO_POST} + DIBUTTON_BBALLO_TIMEOUT = $1200440D; (* Time Out *) + {$EXTERNALSYM DIBUTTON_BBALLO_TIMEOUT} + DIBUTTON_BBALLO_SUBSTITUTE = $1200440E; (* substitute one player for another *) + {$EXTERNALSYM DIBUTTON_BBALLO_SUBSTITUTE} + DIBUTTON_BBALLO_LEFT_LINK = $1200C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_BBALLO_LEFT_LINK} + DIBUTTON_BBALLO_RIGHT_LINK = $1200C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_BBALLO_RIGHT_LINK} + DIBUTTON_BBALLO_FORWARD_LINK = $120144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_BBALLO_FORWARD_LINK} + DIBUTTON_BBALLO_BACK_LINK = $120144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_BBALLO_BACK_LINK} + DIBUTTON_BBALLO_DEVICE = $120044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_BBALLO_DEVICE} + DIBUTTON_BBALLO_PAUSE = $120044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_BBALLO_PAUSE} + +(*--- Sports - Basketball - Defense + Defense ---*) + DIVIRTUAL_SPORTS_BASKETBALL_DEFENSE = $13000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_BASKETBALL_DEFENSE} + DIAXIS_BBALLD_LATERAL = $13008201; (* left / right *) + {$EXTERNALSYM DIAXIS_BBALLD_LATERAL} + DIAXIS_BBALLD_MOVE = $13010202; (* up / down *) + {$EXTERNALSYM DIAXIS_BBALLD_MOVE} + DIBUTTON_BBALLD_JUMP = $13000401; (* jump to block shot *) + {$EXTERNALSYM DIBUTTON_BBALLD_JUMP} + DIBUTTON_BBALLD_STEAL = $13000402; (* attempt to steal ball *) + {$EXTERNALSYM DIBUTTON_BBALLD_STEAL} + DIBUTTON_BBALLD_FAKE = $13000403; (* fake block or steal *) + {$EXTERNALSYM DIBUTTON_BBALLD_FAKE} + DIBUTTON_BBALLD_SPECIAL = $13000404; (* apply special move *) + {$EXTERNALSYM DIBUTTON_BBALLD_SPECIAL} + DIBUTTON_BBALLD_PLAYER = $13000405; (* select next player *) + {$EXTERNALSYM DIBUTTON_BBALLD_PLAYER} + DIBUTTON_BBALLD_BURST = $13000406; (* invoke burst *) + {$EXTERNALSYM DIBUTTON_BBALLD_BURST} + DIBUTTON_BBALLD_PLAY = $13000407; (* call for specific defensive play *) + {$EXTERNALSYM DIBUTTON_BBALLD_PLAY} + DIBUTTON_BBALLD_MENU = $130004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_BBALLD_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_BBALLD_GLANCE = $13004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_BBALLD_GLANCE} + DIBUTTON_BBALLD_TIMEOUT = $13004408; (* Time Out *) + {$EXTERNALSYM DIBUTTON_BBALLD_TIMEOUT} + DIBUTTON_BBALLD_SUBSTITUTE = $13004409; (* substitute one player for another *) + {$EXTERNALSYM DIBUTTON_BBALLD_SUBSTITUTE} + DIBUTTON_BBALLD_LEFT_LINK = $1300C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_BBALLD_LEFT_LINK} + DIBUTTON_BBALLD_RIGHT_LINK = $1300C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_BBALLD_RIGHT_LINK} + DIBUTTON_BBALLD_FORWARD_LINK = $130144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_BBALLD_FORWARD_LINK} + DIBUTTON_BBALLD_BACK_LINK = $130144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_BBALLD_BACK_LINK} + DIBUTTON_BBALLD_DEVICE = $130044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_BBALLD_DEVICE} + DIBUTTON_BBALLD_PAUSE = $130044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_BBALLD_PAUSE} + +(*--- Sports - Football - Play + Play selection ---*) + DIVIRTUAL_SPORTS_FOOTBALL_FIELD = $14000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_FOOTBALL_FIELD} + DIBUTTON_FOOTBALLP_PLAY = $14000401; (* cycle through available plays *) + {$EXTERNALSYM DIBUTTON_FOOTBALLP_PLAY} + DIBUTTON_FOOTBALLP_SELECT = $14000402; (* select play *) + {$EXTERNALSYM DIBUTTON_FOOTBALLP_SELECT} + DIBUTTON_FOOTBALLP_HELP = $14000403; (* Bring up pop-up help *) + {$EXTERNALSYM DIBUTTON_FOOTBALLP_HELP} + DIBUTTON_FOOTBALLP_MENU = $140004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FOOTBALLP_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_FOOTBALLP_DEVICE = $140044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FOOTBALLP_DEVICE} + DIBUTTON_FOOTBALLP_PAUSE = $140044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FOOTBALLP_PAUSE} + +(*--- Sports - Football - QB + Offense: Quarterback / Kicker ---*) + DIVIRTUAL_SPORTS_FOOTBALL_QBCK = $15000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_FOOTBALL_QBCK} + DIAXIS_FOOTBALLQ_LATERAL = $15008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_FOOTBALLQ_LATERAL} + DIAXIS_FOOTBALLQ_MOVE = $15010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_FOOTBALLQ_MOVE} + DIBUTTON_FOOTBALLQ_SELECT = $15000401; (* Select *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_SELECT} + DIBUTTON_FOOTBALLQ_SNAP = $15000402; (* snap ball - start play *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_SNAP} + DIBUTTON_FOOTBALLQ_JUMP = $15000403; (* jump over defender *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_JUMP} + DIBUTTON_FOOTBALLQ_SLIDE = $15000404; (* Dive/Slide *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_SLIDE} + DIBUTTON_FOOTBALLQ_PASS = $15000405; (* throws pass to receiver *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_PASS} + DIBUTTON_FOOTBALLQ_FAKE = $15000406; (* pump fake pass or fake kick *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_FAKE} + DIBUTTON_FOOTBALLQ_MENU = $150004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_FOOTBALLQ_FAKESNAP = $15004407; (* Fake snap *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_FAKESNAP} + DIBUTTON_FOOTBALLQ_MOTION = $15004408; (* Send receivers in motion *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_MOTION} + DIBUTTON_FOOTBALLQ_AUDIBLE = $15004409; (* Change offensive play at line of scrimmage *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_AUDIBLE} + DIBUTTON_FOOTBALLQ_LEFT_LINK = $1500C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_LEFT_LINK} + DIBUTTON_FOOTBALLQ_RIGHT_LINK = $1500C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_RIGHT_LINK} + DIBUTTON_FOOTBALLQ_FORWARD_LINK = $150144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_FORWARD_LINK} + DIBUTTON_FOOTBALLQ_BACK_LINK = $150144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_BACK_LINK} + DIBUTTON_FOOTBALLQ_DEVICE = $150044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_DEVICE} + DIBUTTON_FOOTBALLQ_PAUSE = $150044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FOOTBALLQ_PAUSE} + +(*--- Sports - Football - Offense + Offense - Runner ---*) + DIVIRTUAL_SPORTS_FOOTBALL_OFFENSE = $16000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_FOOTBALL_OFFENSE} + DIAXIS_FOOTBALLO_LATERAL = $16008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_FOOTBALLO_LATERAL} + DIAXIS_FOOTBALLO_MOVE = $16010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_FOOTBALLO_MOVE} + DIBUTTON_FOOTBALLO_JUMP = $16000401; (* jump or hurdle over defender *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_JUMP} + DIBUTTON_FOOTBALLO_LEFTARM = $16000402; (* holds out left arm *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_LEFTARM} + DIBUTTON_FOOTBALLO_RIGHTARM = $16000403; (* holds out right arm *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_RIGHTARM} + DIBUTTON_FOOTBALLO_THROW = $16000404; (* throw pass or lateral ball to another runner *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_THROW} + DIBUTTON_FOOTBALLO_SPIN = $16000405; (* Spin to avoid defenders *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_SPIN} + DIBUTTON_FOOTBALLO_MENU = $160004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_FOOTBALLO_JUKE = $16004406; (* Use special move to avoid defenders *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_JUKE} + DIBUTTON_FOOTBALLO_SHOULDER = $16004407; (* Lower shoulder to run over defenders *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_SHOULDER} + DIBUTTON_FOOTBALLO_TURBO = $16004408; (* Speed burst past defenders *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_TURBO} + DIBUTTON_FOOTBALLO_DIVE = $16004409; (* Dive over defenders *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_DIVE} + DIBUTTON_FOOTBALLO_ZOOM = $1600440A; (* Zoom view in / out *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_ZOOM} + DIBUTTON_FOOTBALLO_SUBSTITUTE = $1600440B; (* substitute one player for another *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_SUBSTITUTE} + DIBUTTON_FOOTBALLO_LEFT_LINK = $1600C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_LEFT_LINK} + DIBUTTON_FOOTBALLO_RIGHT_LINK = $1600C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_RIGHT_LINK} + DIBUTTON_FOOTBALLO_FORWARD_LINK = $160144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_FORWARD_LINK} + DIBUTTON_FOOTBALLO_BACK_LINK = $160144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_BACK_LINK} + DIBUTTON_FOOTBALLO_DEVICE = $160044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_DEVICE} + DIBUTTON_FOOTBALLO_PAUSE = $160044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FOOTBALLO_PAUSE} + +(*--- Sports - Football - Defense + Defense ---*) + DIVIRTUAL_SPORTS_FOOTBALL_DEFENSE = $17000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_FOOTBALL_DEFENSE} + DIAXIS_FOOTBALLD_LATERAL = $17008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_FOOTBALLD_LATERAL} + DIAXIS_FOOTBALLD_MOVE = $17010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_FOOTBALLD_MOVE} + DIBUTTON_FOOTBALLD_PLAY = $17000401; (* cycle through available plays *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_PLAY} + DIBUTTON_FOOTBALLD_SELECT = $17000402; (* select player closest to the ball *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_SELECT} + DIBUTTON_FOOTBALLD_JUMP = $17000403; (* jump to intercept or block *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_JUMP} + DIBUTTON_FOOTBALLD_TACKLE = $17000404; (* tackler runner *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_TACKLE} + DIBUTTON_FOOTBALLD_FAKE = $17000405; (* hold down to fake tackle or intercept *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_FAKE} + DIBUTTON_FOOTBALLD_SUPERTACKLE = $17000406; (* Initiate special tackle *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_SUPERTACKLE} + DIBUTTON_FOOTBALLD_MENU = $170004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_FOOTBALLD_SPIN = $17004407; (* Spin to beat offensive line *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_SPIN} + DIBUTTON_FOOTBALLD_SWIM = $17004408; (* Swim to beat the offensive line *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_SWIM} + DIBUTTON_FOOTBALLD_BULLRUSH = $17004409; (* Bull rush the offensive line *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_BULLRUSH} + DIBUTTON_FOOTBALLD_RIP = $1700440A; (* Rip the offensive line *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_RIP} + DIBUTTON_FOOTBALLD_AUDIBLE = $1700440B; (* Change defensive play at the line of scrimmage *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_AUDIBLE} + DIBUTTON_FOOTBALLD_ZOOM = $1700440C; (* Zoom view in / out *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_ZOOM} + DIBUTTON_FOOTBALLD_SUBSTITUTE = $1700440D; (* substitute one player for another *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_SUBSTITUTE} + DIBUTTON_FOOTBALLD_LEFT_LINK = $1700C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_LEFT_LINK} + DIBUTTON_FOOTBALLD_RIGHT_LINK = $1700C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_RIGHT_LINK} + DIBUTTON_FOOTBALLD_FORWARD_LINK = $170144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_FORWARD_LINK} + DIBUTTON_FOOTBALLD_BACK_LINK = $170144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_BACK_LINK} + DIBUTTON_FOOTBALLD_DEVICE = $170044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_DEVICE} + DIBUTTON_FOOTBALLD_PAUSE = $170044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_FOOTBALLD_PAUSE} + +(*--- Sports - Golf + ---*) + DIVIRTUAL_SPORTS_GOLF = $18000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_GOLF} + DIAXIS_GOLF_LATERAL = $18008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_GOLF_LATERAL} + DIAXIS_GOLF_MOVE = $18010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_GOLF_MOVE} + DIBUTTON_GOLF_SWING = $18000401; (* swing club *) + {$EXTERNALSYM DIBUTTON_GOLF_SWING} + DIBUTTON_GOLF_SELECT = $18000402; (* cycle between: club / swing strength / ball arc / ball spin *) + {$EXTERNALSYM DIBUTTON_GOLF_SELECT} + DIBUTTON_GOLF_UP = $18000403; (* increase selection *) + {$EXTERNALSYM DIBUTTON_GOLF_UP} + DIBUTTON_GOLF_DOWN = $18000404; (* decrease selection *) + {$EXTERNALSYM DIBUTTON_GOLF_DOWN} + DIBUTTON_GOLF_TERRAIN = $18000405; (* shows terrain detail *) + {$EXTERNALSYM DIBUTTON_GOLF_TERRAIN} + DIBUTTON_GOLF_FLYBY = $18000406; (* view the hole via a flyby *) + {$EXTERNALSYM DIBUTTON_GOLF_FLYBY} + DIBUTTON_GOLF_MENU = $180004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_GOLF_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_GOLF_SCROLL = $18004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_GOLF_SCROLL} + DIBUTTON_GOLF_ZOOM = $18004407; (* Zoom view in / out *) + {$EXTERNALSYM DIBUTTON_GOLF_ZOOM} + DIBUTTON_GOLF_TIMEOUT = $18004408; (* Call for time out *) + {$EXTERNALSYM DIBUTTON_GOLF_TIMEOUT} + DIBUTTON_GOLF_SUBSTITUTE = $18004409; (* substitute one player for another *) + {$EXTERNALSYM DIBUTTON_GOLF_SUBSTITUTE} + DIBUTTON_GOLF_LEFT_LINK = $1800C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_GOLF_LEFT_LINK} + DIBUTTON_GOLF_RIGHT_LINK = $1800C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_GOLF_RIGHT_LINK} + DIBUTTON_GOLF_FORWARD_LINK = $180144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_GOLF_FORWARD_LINK} + DIBUTTON_GOLF_BACK_LINK = $180144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_GOLF_BACK_LINK} + DIBUTTON_GOLF_DEVICE = $180044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_GOLF_DEVICE} + DIBUTTON_GOLF_PAUSE = $180044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_GOLF_PAUSE} + +(*--- Sports - Hockey - Offense + Offense ---*) + DIVIRTUAL_SPORTS_HOCKEY_OFFENSE = $19000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_HOCKEY_OFFENSE} + DIAXIS_HOCKEYO_LATERAL = $19008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_HOCKEYO_LATERAL} + DIAXIS_HOCKEYO_MOVE = $19010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_HOCKEYO_MOVE} + DIBUTTON_HOCKEYO_SHOOT = $19000401; (* Shoot *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_SHOOT} + DIBUTTON_HOCKEYO_PASS = $19000402; (* pass the puck *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_PASS} + DIBUTTON_HOCKEYO_BURST = $19000403; (* invoke speed burst *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_BURST} + DIBUTTON_HOCKEYO_SPECIAL = $19000404; (* invoke special move *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_SPECIAL} + DIBUTTON_HOCKEYO_FAKE = $19000405; (* hold down to fake pass or kick *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_FAKE} + DIBUTTON_HOCKEYO_MENU = $190004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_HOCKEYO_SCROLL = $19004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_HOCKEYO_SCROLL} + DIBUTTON_HOCKEYO_ZOOM = $19004406; (* Zoom view in / out *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_ZOOM} + DIBUTTON_HOCKEYO_STRATEGY = $19004407; (* Invoke coaching menu for strategy help *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_STRATEGY} + DIBUTTON_HOCKEYO_TIMEOUT = $19004408; (* Call for time out *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_TIMEOUT} + DIBUTTON_HOCKEYO_SUBSTITUTE = $19004409; (* substitute one player for another *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_SUBSTITUTE} + DIBUTTON_HOCKEYO_LEFT_LINK = $1900C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_LEFT_LINK} + DIBUTTON_HOCKEYO_RIGHT_LINK = $1900C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_RIGHT_LINK} + DIBUTTON_HOCKEYO_FORWARD_LINK = $190144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_FORWARD_LINK} + DIBUTTON_HOCKEYO_BACK_LINK = $190144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_BACK_LINK} + DIBUTTON_HOCKEYO_DEVICE = $190044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_DEVICE} + DIBUTTON_HOCKEYO_PAUSE = $190044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_HOCKEYO_PAUSE} + +(*--- Sports - Hockey - Defense + Defense ---*) + DIVIRTUAL_SPORTS_HOCKEY_DEFENSE = $1A000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_HOCKEY_DEFENSE} + DIAXIS_HOCKEYD_LATERAL = $1A008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_HOCKEYD_LATERAL} + DIAXIS_HOCKEYD_MOVE = $1A010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_HOCKEYD_MOVE} + DIBUTTON_HOCKEYD_PLAYER = $1A000401; (* control player closest to the puck *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_PLAYER} + DIBUTTON_HOCKEYD_STEAL = $1A000402; (* attempt steal *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_STEAL} + DIBUTTON_HOCKEYD_BURST = $1A000403; (* speed burst or body check *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_BURST} + DIBUTTON_HOCKEYD_BLOCK = $1A000404; (* block puck *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_BLOCK} + DIBUTTON_HOCKEYD_FAKE = $1A000405; (* hold down to fake tackle or intercept *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_FAKE} + DIBUTTON_HOCKEYD_MENU = $1A0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_HOCKEYD_SCROLL = $1A004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_HOCKEYD_SCROLL} + DIBUTTON_HOCKEYD_ZOOM = $1A004406; (* Zoom view in / out *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_ZOOM} + DIBUTTON_HOCKEYD_STRATEGY = $1A004407; (* Invoke coaching menu for strategy help *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_STRATEGY} + DIBUTTON_HOCKEYD_TIMEOUT = $1A004408; (* Call for time out *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_TIMEOUT} + DIBUTTON_HOCKEYD_SUBSTITUTE = $1A004409; (* substitute one player for another *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_SUBSTITUTE} + DIBUTTON_HOCKEYD_LEFT_LINK = $1A00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_LEFT_LINK} + DIBUTTON_HOCKEYD_RIGHT_LINK = $1A00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_RIGHT_LINK} + DIBUTTON_HOCKEYD_FORWARD_LINK = $1A0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_FORWARD_LINK} + DIBUTTON_HOCKEYD_BACK_LINK = $1A0144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_BACK_LINK} + DIBUTTON_HOCKEYD_DEVICE = $1A0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_DEVICE} + DIBUTTON_HOCKEYD_PAUSE = $1A0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_HOCKEYD_PAUSE} + +(*--- Sports - Hockey - Goalie + Goal tending ---*) + DIVIRTUAL_SPORTS_HOCKEY_GOALIE = $1B000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_HOCKEY_GOALIE} + DIAXIS_HOCKEYG_LATERAL = $1B008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_HOCKEYG_LATERAL} + DIAXIS_HOCKEYG_MOVE = $1B010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_HOCKEYG_MOVE} + DIBUTTON_HOCKEYG_PASS = $1B000401; (* pass puck *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_PASS} + DIBUTTON_HOCKEYG_POKE = $1B000402; (* poke / check / hack *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_POKE} + DIBUTTON_HOCKEYG_STEAL = $1B000403; (* attempt steal *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_STEAL} + DIBUTTON_HOCKEYG_BLOCK = $1B000404; (* block puck *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_BLOCK} + DIBUTTON_HOCKEYG_MENU = $1B0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_HOCKEYG_SCROLL = $1B004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_HOCKEYG_SCROLL} + DIBUTTON_HOCKEYG_ZOOM = $1B004405; (* Zoom view in / out *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_ZOOM} + DIBUTTON_HOCKEYG_STRATEGY = $1B004406; (* Invoke coaching menu for strategy help *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_STRATEGY} + DIBUTTON_HOCKEYG_TIMEOUT = $1B004407; (* Call for time out *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_TIMEOUT} + DIBUTTON_HOCKEYG_SUBSTITUTE = $1B004408; (* substitute one player for another *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_SUBSTITUTE} + DIBUTTON_HOCKEYG_LEFT_LINK = $1B00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_LEFT_LINK} + DIBUTTON_HOCKEYG_RIGHT_LINK = $1B00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_RIGHT_LINK} + DIBUTTON_HOCKEYG_FORWARD_LINK = $1B0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_FORWARD_LINK} + DIBUTTON_HOCKEYG_BACK_LINK = $1B0144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_BACK_LINK} + DIBUTTON_HOCKEYG_DEVICE = $1B0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_DEVICE} + DIBUTTON_HOCKEYG_PAUSE = $1B0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_HOCKEYG_PAUSE} + +(*--- Sports - Mountain Biking + ---*) + DIVIRTUAL_SPORTS_BIKING_MOUNTAIN = $1C000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_BIKING_MOUNTAIN} + DIAXIS_BIKINGM_TURN = $1C008201; (* left / right *) + {$EXTERNALSYM DIAXIS_BIKINGM_TURN} + DIAXIS_BIKINGM_PEDAL = $1C010202; (* Pedal faster / slower / brake *) + {$EXTERNALSYM DIAXIS_BIKINGM_PEDAL} + DIBUTTON_BIKINGM_JUMP = $1C000401; (* jump over obstacle *) + {$EXTERNALSYM DIBUTTON_BIKINGM_JUMP} + DIBUTTON_BIKINGM_CAMERA = $1C000402; (* switch camera view *) + {$EXTERNALSYM DIBUTTON_BIKINGM_CAMERA} + DIBUTTON_BIKINGM_SPECIAL1 = $1C000403; (* perform first special move *) + {$EXTERNALSYM DIBUTTON_BIKINGM_SPECIAL1} + DIBUTTON_BIKINGM_SELECT = $1C000404; (* Select *) + {$EXTERNALSYM DIBUTTON_BIKINGM_SELECT} + DIBUTTON_BIKINGM_SPECIAL2 = $1C000405; (* perform second special move *) + {$EXTERNALSYM DIBUTTON_BIKINGM_SPECIAL2} + DIBUTTON_BIKINGM_MENU = $1C0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_BIKINGM_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_BIKINGM_SCROLL = $1C004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_BIKINGM_SCROLL} + DIBUTTON_BIKINGM_ZOOM = $1C004406; (* Zoom view in / out *) + {$EXTERNALSYM DIBUTTON_BIKINGM_ZOOM} + DIAXIS_BIKINGM_BRAKE = $1C044203; (* Brake axis *) + {$EXTERNALSYM DIAXIS_BIKINGM_BRAKE} + DIBUTTON_BIKINGM_LEFT_LINK = $1C00C4E4; (* Fallback turn left button *) + {$EXTERNALSYM DIBUTTON_BIKINGM_LEFT_LINK} + DIBUTTON_BIKINGM_RIGHT_LINK = $1C00C4EC; (* Fallback turn right button *) + {$EXTERNALSYM DIBUTTON_BIKINGM_RIGHT_LINK} + DIBUTTON_BIKINGM_FASTER_LINK = $1C0144E0; (* Fallback pedal faster button *) + {$EXTERNALSYM DIBUTTON_BIKINGM_FASTER_LINK} + DIBUTTON_BIKINGM_SLOWER_LINK = $1C0144E8; (* Fallback pedal slower button *) + {$EXTERNALSYM DIBUTTON_BIKINGM_SLOWER_LINK} + DIBUTTON_BIKINGM_BRAKE_BUTTON_LINK = $1C0444E8; (* Fallback brake button *) + {$EXTERNALSYM DIBUTTON_BIKINGM_BRAKE_BUTTON_LINK} + DIBUTTON_BIKINGM_DEVICE = $1C0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_BIKINGM_DEVICE} + DIBUTTON_BIKINGM_PAUSE = $1C0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_BIKINGM_PAUSE} + +(*--- Sports: Skiing / Snowboarding / Skateboarding + ---*) + DIVIRTUAL_SPORTS_SKIING = $1D000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_SKIING} + DIAXIS_SKIING_TURN = $1D008201; (* left / right *) + {$EXTERNALSYM DIAXIS_SKIING_TURN} + DIAXIS_SKIING_SPEED = $1D010202; (* faster / slower *) + {$EXTERNALSYM DIAXIS_SKIING_SPEED} + DIBUTTON_SKIING_JUMP = $1D000401; (* Jump *) + {$EXTERNALSYM DIBUTTON_SKIING_JUMP} + DIBUTTON_SKIING_CROUCH = $1D000402; (* crouch down *) + {$EXTERNALSYM DIBUTTON_SKIING_CROUCH} + DIBUTTON_SKIING_CAMERA = $1D000403; (* switch camera view *) + {$EXTERNALSYM DIBUTTON_SKIING_CAMERA} + DIBUTTON_SKIING_SPECIAL1 = $1D000404; (* perform first special move *) + {$EXTERNALSYM DIBUTTON_SKIING_SPECIAL1} + DIBUTTON_SKIING_SELECT = $1D000405; (* Select *) + {$EXTERNALSYM DIBUTTON_SKIING_SELECT} + DIBUTTON_SKIING_SPECIAL2 = $1D000406; (* perform second special move *) + {$EXTERNALSYM DIBUTTON_SKIING_SPECIAL2} + DIBUTTON_SKIING_MENU = $1D0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_SKIING_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_SKIING_GLANCE = $1D004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_SKIING_GLANCE} + DIBUTTON_SKIING_ZOOM = $1D004407; (* Zoom view in / out *) + {$EXTERNALSYM DIBUTTON_SKIING_ZOOM} + DIBUTTON_SKIING_LEFT_LINK = $1D00C4E4; (* Fallback turn left button *) + {$EXTERNALSYM DIBUTTON_SKIING_LEFT_LINK} + DIBUTTON_SKIING_RIGHT_LINK = $1D00C4EC; (* Fallback turn right button *) + {$EXTERNALSYM DIBUTTON_SKIING_RIGHT_LINK} + DIBUTTON_SKIING_FASTER_LINK = $1D0144E0; (* Fallback increase speed button *) + {$EXTERNALSYM DIBUTTON_SKIING_FASTER_LINK} + DIBUTTON_SKIING_SLOWER_LINK = $1D0144E8; (* Fallback decrease speed button *) + {$EXTERNALSYM DIBUTTON_SKIING_SLOWER_LINK} + DIBUTTON_SKIING_DEVICE = $1D0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_SKIING_DEVICE} + DIBUTTON_SKIING_PAUSE = $1D0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_SKIING_PAUSE} + +(*--- Sports - Soccer - Offense + Offense ---*) + DIVIRTUAL_SPORTS_SOCCER_OFFENSE = $1E000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_SOCCER_OFFENSE} + DIAXIS_SOCCERO_LATERAL = $1E008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_SOCCERO_LATERAL} + DIAXIS_SOCCERO_MOVE = $1E010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_SOCCERO_MOVE} + DIAXIS_SOCCERO_BEND = $1E018203; (* Bend to soccer shot/pass *) + {$EXTERNALSYM DIAXIS_SOCCERO_BEND} + DIBUTTON_SOCCERO_SHOOT = $1E000401; (* Shoot the ball *) + {$EXTERNALSYM DIBUTTON_SOCCERO_SHOOT} + DIBUTTON_SOCCERO_PASS = $1E000402; (* Pass *) + {$EXTERNALSYM DIBUTTON_SOCCERO_PASS} + DIBUTTON_SOCCERO_FAKE = $1E000403; (* Fake *) + {$EXTERNALSYM DIBUTTON_SOCCERO_FAKE} + DIBUTTON_SOCCERO_PLAYER = $1E000404; (* Select next player *) + {$EXTERNALSYM DIBUTTON_SOCCERO_PLAYER} + DIBUTTON_SOCCERO_SPECIAL1 = $1E000405; (* Apply special move *) + {$EXTERNALSYM DIBUTTON_SOCCERO_SPECIAL1} + DIBUTTON_SOCCERO_SELECT = $1E000406; (* Select special move *) + {$EXTERNALSYM DIBUTTON_SOCCERO_SELECT} + DIBUTTON_SOCCERO_MENU = $1E0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_SOCCERO_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_SOCCERO_GLANCE = $1E004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_SOCCERO_GLANCE} + DIBUTTON_SOCCERO_SUBSTITUTE = $1E004407; (* Substitute one player for another *) + {$EXTERNALSYM DIBUTTON_SOCCERO_SUBSTITUTE} + DIBUTTON_SOCCERO_SHOOTLOW = $1E004408; (* Shoot the ball low *) + {$EXTERNALSYM DIBUTTON_SOCCERO_SHOOTLOW} + DIBUTTON_SOCCERO_SHOOTHIGH = $1E004409; (* Shoot the ball high *) + {$EXTERNALSYM DIBUTTON_SOCCERO_SHOOTHIGH} + DIBUTTON_SOCCERO_PASSTHRU = $1E00440A; (* Make a thru pass *) + {$EXTERNALSYM DIBUTTON_SOCCERO_PASSTHRU} + DIBUTTON_SOCCERO_SPRINT = $1E00440B; (* Sprint / turbo boost *) + {$EXTERNALSYM DIBUTTON_SOCCERO_SPRINT} + DIBUTTON_SOCCERO_CONTROL = $1E00440C; (* Obtain control of the ball *) + {$EXTERNALSYM DIBUTTON_SOCCERO_CONTROL} + DIBUTTON_SOCCERO_HEAD = $1E00440D; (* Attempt to head the ball *) + {$EXTERNALSYM DIBUTTON_SOCCERO_HEAD} + DIBUTTON_SOCCERO_LEFT_LINK = $1E00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_SOCCERO_LEFT_LINK} + DIBUTTON_SOCCERO_RIGHT_LINK = $1E00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_SOCCERO_RIGHT_LINK} + DIBUTTON_SOCCERO_FORWARD_LINK = $1E0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_SOCCERO_FORWARD_LINK} + DIBUTTON_SOCCERO_BACK_LINK = $1E0144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_SOCCERO_BACK_LINK} + DIBUTTON_SOCCERO_DEVICE = $1E0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_SOCCERO_DEVICE} + DIBUTTON_SOCCERO_PAUSE = $1E0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_SOCCERO_PAUSE} + +(*--- Sports - Soccer - Defense + Defense ---*) + DIVIRTUAL_SPORTS_SOCCER_DEFENSE = $1F000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_SOCCER_DEFENSE} + DIAXIS_SOCCERD_LATERAL = $1F008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_SOCCERD_LATERAL} + DIAXIS_SOCCERD_MOVE = $1F010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_SOCCERD_MOVE} + DIBUTTON_SOCCERD_BLOCK = $1F000401; (* Attempt to block shot *) + {$EXTERNALSYM DIBUTTON_SOCCERD_BLOCK} + DIBUTTON_SOCCERD_STEAL = $1F000402; (* Attempt to steal ball *) + {$EXTERNALSYM DIBUTTON_SOCCERD_STEAL} + DIBUTTON_SOCCERD_FAKE = $1F000403; (* Fake a block or a steal *) + {$EXTERNALSYM DIBUTTON_SOCCERD_FAKE} + DIBUTTON_SOCCERD_PLAYER = $1F000404; (* Select next player *) + {$EXTERNALSYM DIBUTTON_SOCCERD_PLAYER} + DIBUTTON_SOCCERD_SPECIAL = $1F000405; (* Apply special move *) + {$EXTERNALSYM DIBUTTON_SOCCERD_SPECIAL} + DIBUTTON_SOCCERD_SELECT = $1F000406; (* Select special move *) + {$EXTERNALSYM DIBUTTON_SOCCERD_SELECT} + DIBUTTON_SOCCERD_SLIDE = $1F000407; (* Attempt a slide tackle *) + {$EXTERNALSYM DIBUTTON_SOCCERD_SLIDE} + DIBUTTON_SOCCERD_MENU = $1F0004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_SOCCERD_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_SOCCERD_GLANCE = $1F004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_SOCCERD_GLANCE} + DIBUTTON_SOCCERD_FOUL = $1F004408; (* Initiate a foul / hard-foul *) + {$EXTERNALSYM DIBUTTON_SOCCERD_FOUL} + DIBUTTON_SOCCERD_HEAD = $1F004409; (* Attempt a Header *) + {$EXTERNALSYM DIBUTTON_SOCCERD_HEAD} + DIBUTTON_SOCCERD_CLEAR = $1F00440A; (* Attempt to clear the ball down the field *) + {$EXTERNALSYM DIBUTTON_SOCCERD_CLEAR} + DIBUTTON_SOCCERD_GOALIECHARGE = $1F00440B; (* Make the goalie charge out of the box *) + {$EXTERNALSYM DIBUTTON_SOCCERD_GOALIECHARGE} + DIBUTTON_SOCCERD_SUBSTITUTE = $1F00440C; (* Substitute one player for another *) + {$EXTERNALSYM DIBUTTON_SOCCERD_SUBSTITUTE} + DIBUTTON_SOCCERD_LEFT_LINK = $1F00C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_SOCCERD_LEFT_LINK} + DIBUTTON_SOCCERD_RIGHT_LINK = $1F00C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_SOCCERD_RIGHT_LINK} + DIBUTTON_SOCCERD_FORWARD_LINK = $1F0144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_SOCCERD_FORWARD_LINK} + DIBUTTON_SOCCERD_BACK_LINK = $1F0144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_SOCCERD_BACK_LINK} + DIBUTTON_SOCCERD_DEVICE = $1F0044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_SOCCERD_DEVICE} + DIBUTTON_SOCCERD_PAUSE = $1F0044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_SOCCERD_PAUSE} + +(*--- Sports - Racquet + Tennis - Table-Tennis - Squash ---*) + DIVIRTUAL_SPORTS_RACQUET = $20000000; + {$EXTERNALSYM DIVIRTUAL_SPORTS_RACQUET} + DIAXIS_RACQUET_LATERAL = $20008201; (* Move / Aim: left / right *) + {$EXTERNALSYM DIAXIS_RACQUET_LATERAL} + DIAXIS_RACQUET_MOVE = $20010202; (* Move / Aim: up / down *) + {$EXTERNALSYM DIAXIS_RACQUET_MOVE} + DIBUTTON_RACQUET_SWING = $20000401; (* Swing racquet *) + {$EXTERNALSYM DIBUTTON_RACQUET_SWING} + DIBUTTON_RACQUET_BACKSWING = $20000402; (* Swing backhand *) + {$EXTERNALSYM DIBUTTON_RACQUET_BACKSWING} + DIBUTTON_RACQUET_SMASH = $20000403; (* Smash shot *) + {$EXTERNALSYM DIBUTTON_RACQUET_SMASH} + DIBUTTON_RACQUET_SPECIAL = $20000404; (* Special shot *) + {$EXTERNALSYM DIBUTTON_RACQUET_SPECIAL} + DIBUTTON_RACQUET_SELECT = $20000405; (* Select special shot *) + {$EXTERNALSYM DIBUTTON_RACQUET_SELECT} + DIBUTTON_RACQUET_MENU = $200004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_RACQUET_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_RACQUET_GLANCE = $20004601; (* scroll view *) + {$EXTERNALSYM DIHATSWITCH_RACQUET_GLANCE} + DIBUTTON_RACQUET_TIMEOUT = $20004406; (* Call for time out *) + {$EXTERNALSYM DIBUTTON_RACQUET_TIMEOUT} + DIBUTTON_RACQUET_SUBSTITUTE = $20004407; (* Substitute one player for another *) + {$EXTERNALSYM DIBUTTON_RACQUET_SUBSTITUTE} + DIBUTTON_RACQUET_LEFT_LINK = $2000C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_RACQUET_LEFT_LINK} + DIBUTTON_RACQUET_RIGHT_LINK = $2000C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_RACQUET_RIGHT_LINK} + DIBUTTON_RACQUET_FORWARD_LINK = $200144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_RACQUET_FORWARD_LINK} + DIBUTTON_RACQUET_BACK_LINK = $200144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_RACQUET_BACK_LINK} + DIBUTTON_RACQUET_DEVICE = $200044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_RACQUET_DEVICE} + DIBUTTON_RACQUET_PAUSE = $200044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_RACQUET_PAUSE} + +(*--- Arcade- 2D + Side to Side movement ---*) + DIVIRTUAL_ARCADE_SIDE2SIDE = $21000000; + {$EXTERNALSYM DIVIRTUAL_ARCADE_SIDE2SIDE} + DIAXIS_ARCADES_LATERAL = $21008201; (* left / right *) + {$EXTERNALSYM DIAXIS_ARCADES_LATERAL} + DIAXIS_ARCADES_MOVE = $21010202; (* up / down *) + {$EXTERNALSYM DIAXIS_ARCADES_MOVE} + DIBUTTON_ARCADES_THROW = $21000401; (* throw object *) + {$EXTERNALSYM DIBUTTON_ARCADES_THROW} + DIBUTTON_ARCADES_CARRY = $21000402; (* carry object *) + {$EXTERNALSYM DIBUTTON_ARCADES_CARRY} + DIBUTTON_ARCADES_ATTACK = $21000403; (* attack *) + {$EXTERNALSYM DIBUTTON_ARCADES_ATTACK} + DIBUTTON_ARCADES_SPECIAL = $21000404; (* apply special move *) + {$EXTERNALSYM DIBUTTON_ARCADES_SPECIAL} + DIBUTTON_ARCADES_SELECT = $21000405; (* select special move *) + {$EXTERNALSYM DIBUTTON_ARCADES_SELECT} + DIBUTTON_ARCADES_MENU = $210004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_ARCADES_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_ARCADES_VIEW = $21004601; (* scroll view left / right / up / down *) + {$EXTERNALSYM DIHATSWITCH_ARCADES_VIEW} + DIBUTTON_ARCADES_LEFT_LINK = $2100C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_ARCADES_LEFT_LINK} + DIBUTTON_ARCADES_RIGHT_LINK = $2100C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_ARCADES_RIGHT_LINK} + DIBUTTON_ARCADES_FORWARD_LINK = $210144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_ARCADES_FORWARD_LINK} + DIBUTTON_ARCADES_BACK_LINK = $210144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_ARCADES_BACK_LINK} + DIBUTTON_ARCADES_VIEW_UP_LINK = $2107C4E0; (* Fallback scroll view up button *) + {$EXTERNALSYM DIBUTTON_ARCADES_VIEW_UP_LINK} + DIBUTTON_ARCADES_VIEW_DOWN_LINK = $2107C4E8; (* Fallback scroll view down button *) + {$EXTERNALSYM DIBUTTON_ARCADES_VIEW_DOWN_LINK} + DIBUTTON_ARCADES_VIEW_LEFT_LINK = $2107C4E4; (* Fallback scroll view left button *) + {$EXTERNALSYM DIBUTTON_ARCADES_VIEW_LEFT_LINK} + DIBUTTON_ARCADES_VIEW_RIGHT_LINK = $2107C4EC; (* Fallback scroll view right button *) + {$EXTERNALSYM DIBUTTON_ARCADES_VIEW_RIGHT_LINK} + DIBUTTON_ARCADES_DEVICE = $210044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_ARCADES_DEVICE} + DIBUTTON_ARCADES_PAUSE = $210044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_ARCADES_PAUSE} + +(*--- Arcade - Platform Game + Character moves around on screen ---*) + DIVIRTUAL_ARCADE_PLATFORM = $22000000; + {$EXTERNALSYM DIVIRTUAL_ARCADE_PLATFORM} + DIAXIS_ARCADEP_LATERAL = $22008201; (* Left / right *) + {$EXTERNALSYM DIAXIS_ARCADEP_LATERAL} + DIAXIS_ARCADEP_MOVE = $22010202; (* Up / down *) + {$EXTERNALSYM DIAXIS_ARCADEP_MOVE} + DIBUTTON_ARCADEP_JUMP = $22000401; (* Jump *) + {$EXTERNALSYM DIBUTTON_ARCADEP_JUMP} + DIBUTTON_ARCADEP_FIRE = $22000402; (* Fire *) + {$EXTERNALSYM DIBUTTON_ARCADEP_FIRE} + DIBUTTON_ARCADEP_CROUCH = $22000403; (* Crouch *) + {$EXTERNALSYM DIBUTTON_ARCADEP_CROUCH} + DIBUTTON_ARCADEP_SPECIAL = $22000404; (* Apply special move *) + {$EXTERNALSYM DIBUTTON_ARCADEP_SPECIAL} + DIBUTTON_ARCADEP_SELECT = $22000405; (* Select special move *) + {$EXTERNALSYM DIBUTTON_ARCADEP_SELECT} + DIBUTTON_ARCADEP_MENU = $220004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_ARCADEP_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_ARCADEP_VIEW = $22004601; (* Scroll view *) + {$EXTERNALSYM DIHATSWITCH_ARCADEP_VIEW} + DIBUTTON_ARCADEP_FIRESECONDARY = $22004406; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_FIRESECONDARY} + DIBUTTON_ARCADEP_LEFT_LINK = $2200C4E4; (* Fallback sidestep left button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_LEFT_LINK} + DIBUTTON_ARCADEP_RIGHT_LINK = $2200C4EC; (* Fallback sidestep right button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_RIGHT_LINK} + DIBUTTON_ARCADEP_FORWARD_LINK = $220144E0; (* Fallback move forward button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_FORWARD_LINK} + DIBUTTON_ARCADEP_BACK_LINK = $220144E8; (* Fallback move back button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_BACK_LINK} + DIBUTTON_ARCADEP_VIEW_UP_LINK = $2207C4E0; (* Fallback scroll view up button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_VIEW_UP_LINK} + DIBUTTON_ARCADEP_VIEW_DOWN_LINK = $2207C4E8; (* Fallback scroll view down button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_VIEW_DOWN_LINK} + DIBUTTON_ARCADEP_VIEW_LEFT_LINK = $2207C4E4; (* Fallback scroll view left button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_VIEW_LEFT_LINK} + DIBUTTON_ARCADEP_VIEW_RIGHT_LINK = $2207C4EC; (* Fallback scroll view right button *) + {$EXTERNALSYM DIBUTTON_ARCADEP_VIEW_RIGHT_LINK} + DIBUTTON_ARCADEP_DEVICE = $220044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_ARCADEP_DEVICE} + DIBUTTON_ARCADEP_PAUSE = $220044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_ARCADEP_PAUSE} + +(*--- CAD - 2D Object Control + Controls to select and move objects in 2D ---*) + DIVIRTUAL_CAD_2DCONTROL = $23000000; + {$EXTERNALSYM DIVIRTUAL_CAD_2DCONTROL} + DIAXIS_2DCONTROL_LATERAL = $23008201; (* Move view left / right *) + {$EXTERNALSYM DIAXIS_2DCONTROL_LATERAL} + DIAXIS_2DCONTROL_MOVE = $23010202; (* Move view up / down *) + {$EXTERNALSYM DIAXIS_2DCONTROL_MOVE} + DIAXIS_2DCONTROL_INOUT = $23018203; (* Zoom - in / out *) + {$EXTERNALSYM DIAXIS_2DCONTROL_INOUT} + DIBUTTON_2DCONTROL_SELECT = $23000401; (* Select Object *) + {$EXTERNALSYM DIBUTTON_2DCONTROL_SELECT} + DIBUTTON_2DCONTROL_SPECIAL1 = $23000402; (* Do first special operation *) + {$EXTERNALSYM DIBUTTON_2DCONTROL_SPECIAL1} + DIBUTTON_2DCONTROL_SPECIAL = $23000403; (* Select special operation *) + {$EXTERNALSYM DIBUTTON_2DCONTROL_SPECIAL} + DIBUTTON_2DCONTROL_SPECIAL2 = $23000404; (* Do second special operation *) + {$EXTERNALSYM DIBUTTON_2DCONTROL_SPECIAL2} + DIBUTTON_2DCONTROL_MENU = $230004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_2DCONTROL_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_2DCONTROL_HATSWITCH = $23004601; (* Hat switch *) + {$EXTERNALSYM DIHATSWITCH_2DCONTROL_HATSWITCH} + DIAXIS_2DCONTROL_ROTATEZ = $23024204; (* Rotate view clockwise / counterclockwise *) + {$EXTERNALSYM DIAXIS_2DCONTROL_ROTATEZ} + DIBUTTON_2DCONTROL_DISPLAY = $23004405; (* Shows next on-screen display options *) + {$EXTERNALSYM DIBUTTON_2DCONTROL_DISPLAY} + DIBUTTON_2DCONTROL_DEVICE = $230044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_2DCONTROL_DEVICE} + DIBUTTON_2DCONTROL_PAUSE = $230044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_2DCONTROL_PAUSE} + +(*--- CAD - 3D object control + Controls to select and move objects within a 3D environment ---*) + DIVIRTUAL_CAD_3DCONTROL = $24000000; + {$EXTERNALSYM DIVIRTUAL_CAD_3DCONTROL} + DIAXIS_3DCONTROL_LATERAL = $24008201; (* Move view left / right *) + {$EXTERNALSYM DIAXIS_3DCONTROL_LATERAL} + DIAXIS_3DCONTROL_MOVE = $24010202; (* Move view up / down *) + {$EXTERNALSYM DIAXIS_3DCONTROL_MOVE} + DIAXIS_3DCONTROL_INOUT = $24018203; (* Zoom - in / out *) + {$EXTERNALSYM DIAXIS_3DCONTROL_INOUT} + DIBUTTON_3DCONTROL_SELECT = $24000401; (* Select Object *) + {$EXTERNALSYM DIBUTTON_3DCONTROL_SELECT} + DIBUTTON_3DCONTROL_SPECIAL1 = $24000402; (* Do first special operation *) + {$EXTERNALSYM DIBUTTON_3DCONTROL_SPECIAL1} + DIBUTTON_3DCONTROL_SPECIAL = $24000403; (* Select special operation *) + {$EXTERNALSYM DIBUTTON_3DCONTROL_SPECIAL} + DIBUTTON_3DCONTROL_SPECIAL2 = $24000404; (* Do second special operation *) + {$EXTERNALSYM DIBUTTON_3DCONTROL_SPECIAL2} + DIBUTTON_3DCONTROL_MENU = $240004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_3DCONTROL_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_3DCONTROL_HATSWITCH = $24004601; (* Hat switch *) + {$EXTERNALSYM DIHATSWITCH_3DCONTROL_HATSWITCH} + DIAXIS_3DCONTROL_ROTATEX = $24034204; (* Rotate view forward or up / backward or down *) + {$EXTERNALSYM DIAXIS_3DCONTROL_ROTATEX} + DIAXIS_3DCONTROL_ROTATEY = $2402C205; (* Rotate view clockwise / counterclockwise *) + {$EXTERNALSYM DIAXIS_3DCONTROL_ROTATEY} + DIAXIS_3DCONTROL_ROTATEZ = $24024206; (* Rotate view left / right *) + {$EXTERNALSYM DIAXIS_3DCONTROL_ROTATEZ} + DIBUTTON_3DCONTROL_DISPLAY = $24004405; (* Show next on-screen display options *) + {$EXTERNALSYM DIBUTTON_3DCONTROL_DISPLAY} + DIBUTTON_3DCONTROL_DEVICE = $240044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_3DCONTROL_DEVICE} + DIBUTTON_3DCONTROL_PAUSE = $240044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_3DCONTROL_PAUSE} + +(*--- CAD - 3D Navigation - Fly through + Controls for 3D modeling ---*) + DIVIRTUAL_CAD_FLYBY = $25000000; + {$EXTERNALSYM DIVIRTUAL_CAD_FLYBY} + DIAXIS_CADF_LATERAL = $25008201; (* move view left / right *) + {$EXTERNALSYM DIAXIS_CADF_LATERAL} + DIAXIS_CADF_MOVE = $25010202; (* move view up / down *) + {$EXTERNALSYM DIAXIS_CADF_MOVE} + DIAXIS_CADF_INOUT = $25018203; (* in / out *) + {$EXTERNALSYM DIAXIS_CADF_INOUT} + DIBUTTON_CADF_SELECT = $25000401; (* Select Object *) + {$EXTERNALSYM DIBUTTON_CADF_SELECT} + DIBUTTON_CADF_SPECIAL1 = $25000402; (* do first special operation *) + {$EXTERNALSYM DIBUTTON_CADF_SPECIAL1} + DIBUTTON_CADF_SPECIAL = $25000403; (* Select special operation *) + {$EXTERNALSYM DIBUTTON_CADF_SPECIAL} + DIBUTTON_CADF_SPECIAL2 = $25000404; (* do second special operation *) + {$EXTERNALSYM DIBUTTON_CADF_SPECIAL2} + DIBUTTON_CADF_MENU = $250004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_CADF_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_CADF_HATSWITCH = $25004601; (* Hat switch *) + {$EXTERNALSYM DIHATSWITCH_CADF_HATSWITCH} + DIAXIS_CADF_ROTATEX = $25034204; (* Rotate view forward or up / backward or down *) + {$EXTERNALSYM DIAXIS_CADF_ROTATEX} + DIAXIS_CADF_ROTATEY = $2502C205; (* Rotate view clockwise / counterclockwise *) + {$EXTERNALSYM DIAXIS_CADF_ROTATEY} + DIAXIS_CADF_ROTATEZ = $25024206; (* Rotate view left / right *) + {$EXTERNALSYM DIAXIS_CADF_ROTATEZ} + DIBUTTON_CADF_DISPLAY = $25004405; (* shows next on-screen display options *) + {$EXTERNALSYM DIBUTTON_CADF_DISPLAY} + DIBUTTON_CADF_DEVICE = $250044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_CADF_DEVICE} + DIBUTTON_CADF_PAUSE = $250044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_CADF_PAUSE} + +(*--- CAD - 3D Model Control + Controls for 3D modeling ---*) + DIVIRTUAL_CAD_MODEL = $26000000; + {$EXTERNALSYM DIVIRTUAL_CAD_MODEL} + DIAXIS_CADM_LATERAL = $26008201; (* move view left / right *) + {$EXTERNALSYM DIAXIS_CADM_LATERAL} + DIAXIS_CADM_MOVE = $26010202; (* move view up / down *) + {$EXTERNALSYM DIAXIS_CADM_MOVE} + DIAXIS_CADM_INOUT = $26018203; (* in / out *) + {$EXTERNALSYM DIAXIS_CADM_INOUT} + DIBUTTON_CADM_SELECT = $26000401; (* Select Object *) + {$EXTERNALSYM DIBUTTON_CADM_SELECT} + DIBUTTON_CADM_SPECIAL1 = $26000402; (* do first special operation *) + {$EXTERNALSYM DIBUTTON_CADM_SPECIAL1} + DIBUTTON_CADM_SPECIAL = $26000403; (* Select special operation *) + {$EXTERNALSYM DIBUTTON_CADM_SPECIAL} + DIBUTTON_CADM_SPECIAL2 = $26000404; (* do second special operation *) + {$EXTERNALSYM DIBUTTON_CADM_SPECIAL2} + DIBUTTON_CADM_MENU = $260004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_CADM_MENU} +(*--- Priority 2 controls ---*) + + DIHATSWITCH_CADM_HATSWITCH = $26004601; (* Hat switch *) + {$EXTERNALSYM DIHATSWITCH_CADM_HATSWITCH} + DIAXIS_CADM_ROTATEX = $26034204; (* Rotate view forward or up / backward or down *) + {$EXTERNALSYM DIAXIS_CADM_ROTATEX} + DIAXIS_CADM_ROTATEY = $2602C205; (* Rotate view clockwise / counterclockwise *) + {$EXTERNALSYM DIAXIS_CADM_ROTATEY} + DIAXIS_CADM_ROTATEZ = $26024206; (* Rotate view left / right *) + {$EXTERNALSYM DIAXIS_CADM_ROTATEZ} + DIBUTTON_CADM_DISPLAY = $26004405; (* shows next on-screen display options *) + {$EXTERNALSYM DIBUTTON_CADM_DISPLAY} + DIBUTTON_CADM_DEVICE = $260044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_CADM_DEVICE} + DIBUTTON_CADM_PAUSE = $260044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_CADM_PAUSE} + +(*--- Control - Media Equipment + Remote ---*) + DIVIRTUAL_REMOTE_CONTROL = $27000000; + {$EXTERNALSYM DIVIRTUAL_REMOTE_CONTROL} + DIAXIS_REMOTE_SLIDER = $27050201; (* Slider for adjustment: volume / color / bass / etc *) + {$EXTERNALSYM DIAXIS_REMOTE_SLIDER} + DIBUTTON_REMOTE_MUTE = $27000401; (* Set volume on current device to zero *) + {$EXTERNALSYM DIBUTTON_REMOTE_MUTE} + DIBUTTON_REMOTE_SELECT = $27000402; (* Next/previous: channel/ track / chapter / picture / station *) + {$EXTERNALSYM DIBUTTON_REMOTE_SELECT} + DIBUTTON_REMOTE_PLAY = $27002403; (* Start or pause entertainment on current device *) + {$EXTERNALSYM DIBUTTON_REMOTE_PLAY} + DIBUTTON_REMOTE_CUE = $27002404; (* Move through current media *) + {$EXTERNALSYM DIBUTTON_REMOTE_CUE} + DIBUTTON_REMOTE_REVIEW = $27002405; (* Move through current media *) + {$EXTERNALSYM DIBUTTON_REMOTE_REVIEW} + DIBUTTON_REMOTE_CHANGE = $27002406; (* Select next device *) + {$EXTERNALSYM DIBUTTON_REMOTE_CHANGE} + DIBUTTON_REMOTE_RECORD = $27002407; (* Start recording the current media *) + {$EXTERNALSYM DIBUTTON_REMOTE_RECORD} + DIBUTTON_REMOTE_MENU = $270004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_REMOTE_MENU} +(*--- Priority 2 controls ---*) + + DIAXIS_REMOTE_SLIDER2 = $27054202; (* Slider for adjustment: volume *) + {$EXTERNALSYM DIAXIS_REMOTE_SLIDER2} + DIBUTTON_REMOTE_TV = $27005C08; (* Select TV *) + {$EXTERNALSYM DIBUTTON_REMOTE_TV} + DIBUTTON_REMOTE_CABLE = $27005C09; (* Select cable box *) + {$EXTERNALSYM DIBUTTON_REMOTE_CABLE} + DIBUTTON_REMOTE_CD = $27005C0A; (* Select CD player *) + {$EXTERNALSYM DIBUTTON_REMOTE_CD} + DIBUTTON_REMOTE_VCR = $27005C0B; (* Select VCR *) + {$EXTERNALSYM DIBUTTON_REMOTE_VCR} + DIBUTTON_REMOTE_TUNER = $27005C0C; (* Select tuner *) + {$EXTERNALSYM DIBUTTON_REMOTE_TUNER} + DIBUTTON_REMOTE_DVD = $27005C0D; (* Select DVD player *) + {$EXTERNALSYM DIBUTTON_REMOTE_DVD} + DIBUTTON_REMOTE_ADJUST = $27005C0E; (* Enter device adjustment menu *) + {$EXTERNALSYM DIBUTTON_REMOTE_ADJUST} + DIBUTTON_REMOTE_DIGIT0 = $2700540F; (* Digit 0 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT0} + DIBUTTON_REMOTE_DIGIT1 = $27005410; (* Digit 1 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT1} + DIBUTTON_REMOTE_DIGIT2 = $27005411; (* Digit 2 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT2} + DIBUTTON_REMOTE_DIGIT3 = $27005412; (* Digit 3 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT3} + DIBUTTON_REMOTE_DIGIT4 = $27005413; (* Digit 4 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT4} + DIBUTTON_REMOTE_DIGIT5 = $27005414; (* Digit 5 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT5} + DIBUTTON_REMOTE_DIGIT6 = $27005415; (* Digit 6 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT6} + DIBUTTON_REMOTE_DIGIT7 = $27005416; (* Digit 7 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT7} + DIBUTTON_REMOTE_DIGIT8 = $27005417; (* Digit 8 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT8} + DIBUTTON_REMOTE_DIGIT9 = $27005418; (* Digit 9 *) + {$EXTERNALSYM DIBUTTON_REMOTE_DIGIT9} + DIBUTTON_REMOTE_DEVICE = $270044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_REMOTE_DEVICE} + DIBUTTON_REMOTE_PAUSE = $270044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_REMOTE_PAUSE} + +(*--- Control- Web + Help or Browser ---*) + DIVIRTUAL_BROWSER_CONTROL = $28000000; + {$EXTERNALSYM DIVIRTUAL_BROWSER_CONTROL} + DIAXIS_BROWSER_LATERAL = $28008201; (* Move on screen pointer *) + {$EXTERNALSYM DIAXIS_BROWSER_LATERAL} + DIAXIS_BROWSER_MOVE = $28010202; (* Move on screen pointer *) + {$EXTERNALSYM DIAXIS_BROWSER_MOVE} + DIBUTTON_BROWSER_SELECT = $28000401; (* Select current item *) + {$EXTERNALSYM DIBUTTON_BROWSER_SELECT} + DIAXIS_BROWSER_VIEW = $28018203; (* Move view up/down *) + {$EXTERNALSYM DIAXIS_BROWSER_VIEW} + DIBUTTON_BROWSER_REFRESH = $28000402; (* Refresh *) + {$EXTERNALSYM DIBUTTON_BROWSER_REFRESH} + DIBUTTON_BROWSER_MENU = $280004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_BROWSER_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_BROWSER_SEARCH = $28004403; (* Use search tool *) + {$EXTERNALSYM DIBUTTON_BROWSER_SEARCH} + DIBUTTON_BROWSER_STOP = $28004404; (* Cease current update *) + {$EXTERNALSYM DIBUTTON_BROWSER_STOP} + DIBUTTON_BROWSER_HOME = $28004405; (* Go directly to "home" location *) + {$EXTERNALSYM DIBUTTON_BROWSER_HOME} + DIBUTTON_BROWSER_FAVORITES = $28004406; (* Mark current site as favorite *) + {$EXTERNALSYM DIBUTTON_BROWSER_FAVORITES} + DIBUTTON_BROWSER_NEXT = $28004407; (* Select Next page *) + {$EXTERNALSYM DIBUTTON_BROWSER_NEXT} + DIBUTTON_BROWSER_PREVIOUS = $28004408; (* Select Previous page *) + {$EXTERNALSYM DIBUTTON_BROWSER_PREVIOUS} + DIBUTTON_BROWSER_HISTORY = $28004409; (* Show/Hide History *) + {$EXTERNALSYM DIBUTTON_BROWSER_HISTORY} + DIBUTTON_BROWSER_PRINT = $2800440A; (* Print current page *) + {$EXTERNALSYM DIBUTTON_BROWSER_PRINT} + DIBUTTON_BROWSER_DEVICE = $280044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_BROWSER_DEVICE} + DIBUTTON_BROWSER_PAUSE = $280044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_BROWSER_PAUSE} + +(*--- Driving Simulator - Giant Walking Robot + Walking tank with weapons ---*) + DIVIRTUAL_DRIVING_MECHA = $29000000; + {$EXTERNALSYM DIVIRTUAL_DRIVING_MECHA} + DIAXIS_MECHA_STEER = $29008201; (* Turns mecha left/right *) + {$EXTERNALSYM DIAXIS_MECHA_STEER} + DIAXIS_MECHA_TORSO = $29010202; (* Tilts torso forward/backward *) + {$EXTERNALSYM DIAXIS_MECHA_TORSO} + DIAXIS_MECHA_ROTATE = $29020203; (* Turns torso left/right *) + {$EXTERNALSYM DIAXIS_MECHA_ROTATE} + DIAXIS_MECHA_THROTTLE = $29038204; (* Engine Speed *) + {$EXTERNALSYM DIAXIS_MECHA_THROTTLE} + DIBUTTON_MECHA_FIRE = $29000401; (* Fire *) + {$EXTERNALSYM DIBUTTON_MECHA_FIRE} + DIBUTTON_MECHA_WEAPONS = $29000402; (* Select next weapon group *) + {$EXTERNALSYM DIBUTTON_MECHA_WEAPONS} + DIBUTTON_MECHA_TARGET = $29000403; (* Select closest enemy available target *) + {$EXTERNALSYM DIBUTTON_MECHA_TARGET} + DIBUTTON_MECHA_REVERSE = $29000404; (* Toggles throttle in/out of reverse *) + {$EXTERNALSYM DIBUTTON_MECHA_REVERSE} + DIBUTTON_MECHA_ZOOM = $29000405; (* Zoom in/out targeting reticule *) + {$EXTERNALSYM DIBUTTON_MECHA_ZOOM} + DIBUTTON_MECHA_JUMP = $29000406; (* Fires jump jets *) + {$EXTERNALSYM DIBUTTON_MECHA_JUMP} + DIBUTTON_MECHA_MENU = $290004FD; (* Show menu options *) + {$EXTERNALSYM DIBUTTON_MECHA_MENU} +(*--- Priority 2 controls ---*) + + DIBUTTON_MECHA_CENTER = $29004407; (* Center torso to legs *) + {$EXTERNALSYM DIBUTTON_MECHA_CENTER} + DIHATSWITCH_MECHA_GLANCE = $29004601; (* Look around *) + {$EXTERNALSYM DIHATSWITCH_MECHA_GLANCE} + DIBUTTON_MECHA_VIEW = $29004408; (* Cycle through view options *) + {$EXTERNALSYM DIBUTTON_MECHA_VIEW} + DIBUTTON_MECHA_FIRESECONDARY = $29004409; (* Alternative fire button *) + {$EXTERNALSYM DIBUTTON_MECHA_FIRESECONDARY} + DIBUTTON_MECHA_LEFT_LINK = $2900C4E4; (* Fallback steer left button *) + {$EXTERNALSYM DIBUTTON_MECHA_LEFT_LINK} + DIBUTTON_MECHA_RIGHT_LINK = $2900C4EC; (* Fallback steer right button *) + {$EXTERNALSYM DIBUTTON_MECHA_RIGHT_LINK} + DIBUTTON_MECHA_FORWARD_LINK = $290144E0; (* Fallback tilt torso forward button *) + {$EXTERNALSYM DIBUTTON_MECHA_FORWARD_LINK} + DIBUTTON_MECHA_BACK_LINK = $290144E8; (* Fallback tilt toroso backward button *) + {$EXTERNALSYM DIBUTTON_MECHA_BACK_LINK} + DIBUTTON_MECHA_ROTATE_LEFT_LINK = $290244E4; (* Fallback rotate toroso right button *) + {$EXTERNALSYM DIBUTTON_MECHA_ROTATE_LEFT_LINK} + DIBUTTON_MECHA_ROTATE_RIGHT_LINK = $290244EC; (* Fallback rotate torso left button *) + {$EXTERNALSYM DIBUTTON_MECHA_ROTATE_RIGHT_LINK} + DIBUTTON_MECHA_FASTER_LINK = $2903C4E0; (* Fallback increase engine speed *) + {$EXTERNALSYM DIBUTTON_MECHA_FASTER_LINK} + DIBUTTON_MECHA_SLOWER_LINK = $2903C4E8; (* Fallback decrease engine speed *) + {$EXTERNALSYM DIBUTTON_MECHA_SLOWER_LINK} + DIBUTTON_MECHA_DEVICE = $290044FE; (* Show input device and controls *) + {$EXTERNALSYM DIBUTTON_MECHA_DEVICE} + DIBUTTON_MECHA_PAUSE = $290044FC; (* Start / Pause / Restart game *) + {$EXTERNALSYM DIBUTTON_MECHA_PAUSE} + +(* + * "ANY" semantics can be used as a last resort to get mappings for actions + * that match nothing in the chosen virtual genre. These semantics will be + * mapped at a lower priority that virtual genre semantics. Also, hardware + * vendors will not be able to provide sensible mappings for these unless + * they provide application specific mappings. + *) + DIAXIS_ANY_X_1 = $FF00C201; + {$EXTERNALSYM DIAXIS_ANY_X_1} + DIAXIS_ANY_X_2 = $FF00C202; + {$EXTERNALSYM DIAXIS_ANY_X_2} + DIAXIS_ANY_Y_1 = $FF014201; + {$EXTERNALSYM DIAXIS_ANY_Y_1} + DIAXIS_ANY_Y_2 = $FF014202; + {$EXTERNALSYM DIAXIS_ANY_Y_2} + DIAXIS_ANY_Z_1 = $FF01C201; + {$EXTERNALSYM DIAXIS_ANY_Z_1} + DIAXIS_ANY_Z_2 = $FF01C202; + {$EXTERNALSYM DIAXIS_ANY_Z_2} + DIAXIS_ANY_R_1 = $FF024201; + {$EXTERNALSYM DIAXIS_ANY_R_1} + DIAXIS_ANY_R_2 = $FF024202; + {$EXTERNALSYM DIAXIS_ANY_R_2} + DIAXIS_ANY_U_1 = $FF02C201; + {$EXTERNALSYM DIAXIS_ANY_U_1} + DIAXIS_ANY_U_2 = $FF02C202; + {$EXTERNALSYM DIAXIS_ANY_U_2} + DIAXIS_ANY_V_1 = $FF034201; + {$EXTERNALSYM DIAXIS_ANY_V_1} + DIAXIS_ANY_V_2 = $FF034202; + {$EXTERNALSYM DIAXIS_ANY_V_2} + DIAXIS_ANY_A_1 = $FF03C201; + {$EXTERNALSYM DIAXIS_ANY_A_1} + DIAXIS_ANY_A_2 = $FF03C202; + {$EXTERNALSYM DIAXIS_ANY_A_2} + DIAXIS_ANY_B_1 = $FF044201; + {$EXTERNALSYM DIAXIS_ANY_B_1} + DIAXIS_ANY_B_2 = $FF044202; + {$EXTERNALSYM DIAXIS_ANY_B_2} + DIAXIS_ANY_C_1 = $FF04C201; + {$EXTERNALSYM DIAXIS_ANY_C_1} + DIAXIS_ANY_C_2 = $FF04C202; + {$EXTERNALSYM DIAXIS_ANY_C_2} + DIAXIS_ANY_S_1 = $FF054201; + {$EXTERNALSYM DIAXIS_ANY_S_1} + DIAXIS_ANY_S_2 = $FF054202; + {$EXTERNALSYM DIAXIS_ANY_S_2} + + DIAXIS_ANY_1 = $FF004201; + {$EXTERNALSYM DIAXIS_ANY_1} + DIAXIS_ANY_2 = $FF004202; + {$EXTERNALSYM DIAXIS_ANY_2} + DIAXIS_ANY_3 = $FF004203; + {$EXTERNALSYM DIAXIS_ANY_3} + DIAXIS_ANY_4 = $FF004204; + {$EXTERNALSYM DIAXIS_ANY_4} + + DIPOV_ANY_1 = $FF004601; + {$EXTERNALSYM DIPOV_ANY_1} + DIPOV_ANY_2 = $FF004602; + {$EXTERNALSYM DIPOV_ANY_2} + DIPOV_ANY_3 = $FF004603; + {$EXTERNALSYM DIPOV_ANY_3} + DIPOV_ANY_4 = $FF004604; + {$EXTERNALSYM DIPOV_ANY_4} + +// #define DIBUTTON_ANY(instance) ( 0xFF004400 | instance ) +function DIBUTTON_ANY(instance: Cardinal): Cardinal; +{$EXTERNALSYM DIBUTTON_ANY} + + + +(**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current sdk files + * + ****************************************************************************) + +//#ifdef _INC_MMSYSTEM +//#ifndef MMNOJOY + +//#ifndef __VJOYDX_INCLUDED__ +//#define __VJOYDX_INCLUDED__ + +const +(* + * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure + * contains mini-driver specific data to be passed by VJoyD to the mini- + * driver instead of doing a poll. + *) + JOY_PASSDRIVERDATA = $10000000; + {$EXTERNALSYM JOY_PASSDRIVERDATA} + +(* + * Informs the joystick driver that the configuration has been changed + * and should be reloaded from the registery. + * dwFlags is reserved and should be set to zero + *) +const + WinMMDll = 'WinMM.dll'; +{$IFDEF DIRECTINPUT_DYNAMIC_LINK} +var + joyConfigChanged: function(dwFlags: DWORD): MMRESULT; stdcall; +{$ELSE} +function joyConfigChanged(dwFlags: DWORD): MMRESULT; stdcall; external WinMMDll; +{$ENDIF} +{$EXTERNALSYM joyConfigChanged} + +(* + * Invoke the joystick control panel directly, using the passed window handle + * as the parent of the dialog. This API is only supported for compatibility + * purposes; new applications should use the RunControlPanel method of a + * device interface for a game controller. + * The API is called by using the function pointer returned by + * GetProcAddress( hCPL, TEXT("ShowJoyCPL") ) where hCPL is a HMODULE returned + * by LoadLibrary( TEXT("joy.cpl") ). The typedef is provided to allow + * declaration and casting of an appropriately typed variable. + *) +const + JoyCPL = 'joy.cpl'; +type + TShowJoyCPL = procedure(hWnd: HWND); stdcall; +{$IFDEF DIRECTINPUT_DYNAMIC_LINK} +var + ShowJoyCPL: TShowJoyCPL; +{$ELSE} +procedure ShowJoyCPL(hWnd: HWND); stdcall; external JoyCPL; +{$ENDIF} +{$EXTERNALSYM ShowJoyCPL} + +const +(* + * Hardware Setting indicating that the device is a headtracker + *) + JOY_HWS_ISHEADTRACKER = $02000000; + {$EXTERNALSYM JOY_HWS_ISHEADTRACKER} + +(* + * Hardware Setting indicating that the VxD is used to replace + * the standard analog polling + *) + JOY_HWS_ISGAMEPORTDRIVER = $04000000; + {$EXTERNALSYM JOY_HWS_ISGAMEPORTDRIVER} + +(* + * Hardware Setting indicating that the driver needs a standard + * gameport in order to communicate with the device. + *) + JOY_HWS_ISANALOGPORTDRIVER = $08000000; + {$EXTERNALSYM JOY_HWS_ISANALOGPORTDRIVER} + +(* + * Hardware Setting indicating that VJoyD should not load this + * driver, it will be loaded externally and will register with + * VJoyD of it's own accord. + *) + JOY_HWS_AUTOLOAD = $10000000; + {$EXTERNALSYM JOY_HWS_AUTOLOAD} + +(* + * Hardware Setting indicating that the driver acquires any + * resources needed without needing a devnode through VJoyD. + *) + JOY_HWS_NODEVNODE = $20000000; + {$EXTERNALSYM JOY_HWS_NODEVNODE} + + +(* + * Hardware Setting indicating that the device is a gameport bus + *) + JOY_HWS_ISGAMEPORTBUS = $80000000; + {$EXTERNALSYM JOY_HWS_ISGAMEPORTBUS} + JOY_HWS_GAMEPORTBUSBUSY = $00000001; + {$EXTERNALSYM JOY_HWS_GAMEPORTBUSBUSY} + +(* + * Usage Setting indicating that the settings are volatile and + * should be removed if still present on a reboot. + *) + JOY_US_VOLATILE = $00000008; + {$EXTERNALSYM JOY_US_VOLATILE} + +//#endif (* __VJOYDX_INCLUDED__ *) + +//#endif (* not MMNOJOY *) +//#endif (* _INC_MMSYSTEM *) + +(**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current ddk files + * + ****************************************************************************) + +//#ifdef _INC_MMDDK +//#ifndef MMNOJOYDEV + +//#ifndef __VJOYDXD_INCLUDED__ +//#define __VJOYDXD_INCLUDED__ + +const +(* + * Poll type in which the do_other field of the JOYOEMPOLLDATA + * structure contains mini-driver specific data passed from an app. + *) + JOY_OEMPOLL_PASSDRIVERDATA = 7; + {$EXTERNALSYM JOY_OEMPOLL_PASSDRIVERDATA} + +//#endif (* __VJOYDXD_INCLUDED__ *) + +//#endif (* not MMNOJOYDEV *) +//#endif (* _INC_MMDDK *) + +implementation + +//#define DIEFT_GETTYPE(n) LOBYTE(n) +function DIEFT_GETTYPE(n: Cardinal): Byte; +begin + Result := LOBYTE(n); +end; + +// #define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) +function GET_DIDEVICE_TYPE(dwDevType: DWORD): Byte; +begin + Result := LOBYTE(dwDevType); +end; + +// #define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) +function GET_DIDEVICE_SUBTYPE(dwDevType: DWORD): Byte; +begin + Result := HiByte(Word(dwDevType)); +end; + +// #define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8) +function DIDFT_MAKEINSTANCE(n: Cardinal): Cardinal; +begin + Result := Word(n) shl 8; +end; + +// #define DIDFT_GETTYPE(n) LOBYTE(n) +function DIDFT_GETTYPE(n: Cardinal): Byte; +begin + Result := LOBYTE(n); +end; + +// #define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8) +function DIDFT_GETINSTANCE(n: Cardinal): Cardinal; +begin + Result := LOWORD(n) shr 8; +end; + +// #define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8) +function DIDFT_ENUMCOLLECTION(n: Cardinal): Cardinal; +begin + Result := Word(n) shl 8; +end; + +{$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *) +// #define DIMAKEUSAGEDWORD(UsagePage, Usage) \ +// (DWORD)MAKELONG(Usage, UsagePage) +function DIMAKEUSAGEDWORD(UsagePage, Usage: Word): DWORD; +begin + Result:= DWORD(MakeLong(UsagePage, Usage)); +end; +{$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *) + +// #define DIJOFS_SLIDER(n) (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \ +// (n) * sizeof(LONG)) +function DIJOFS_SLIDER(n: Cardinal): Cardinal; +begin + Result := Cardinal(@PDIJoyState(nil)^.rglSlider) + n*SizeOf(DWORD); // + 24; +end; + +// #define DIJOFS_POV(n) (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \ +// (n) * sizeof(DWORD)) +function DIJOFS_POV(n: Cardinal): Cardinal; +begin + Result := Cardinal(@PDIJoyState(nil).rgdwPOV) + n*SizeOf(DWORD); // + 32; +end; + +// #define DIJOFS_BUTTON(n) (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n)) +function DIJOFS_BUTTON(n: Cardinal): Cardinal; +begin + Result := Cardinal(@PDIJoyState(nil).rgbButtons) + n*SizeOf(DWORD); // + 48; +end; + +// #define DIBUTTON_ANY(instance) ( 0xFF004400 | instance ) +function DIBUTTON_ANY(instance: Cardinal): Cardinal; +begin + Result := $FF004400 or instance; +end; + + +{$IFDEF DIRECTINPUT_DYNAMIC_LINK} +var + DirectInputLib: THandle = 0; + DirectInput8Lib: THandle = 0; + WinMMLib: THandle = 0; + JoyCPLLib: THandle = 0; + +function DirectInputLoaded: Boolean; +begin + Result:= (DirectInputLib <> 0) and (DirectInput8Lib<>0); +end; + +function UnLoadDirectInput: Boolean; +begin + Result:= True; + if (DirectInputLib <> 0) then + begin + Result:= Result and FreeLibrary(DirectInputLib); + DirectInputCreateA:= nil; + DirectInputCreateW:= nil; + DirectInputCreate:= nil; + + DirectInputCreateEx:= nil; + DirectInputLib:= 0; + end; + + if (DirectInput8Lib <> 0) then + begin + Result:= Result and FreeLibrary(DirectInput8Lib); + DirectInput8Create:= nil; + DirectInput8Lib:= 0; + end; + + if (WinMMLib <> 0) then + begin + Result:= Result and FreeLibrary(WinMMLib); + joyConfigChanged:= nil; + WinMMLib:= 0; + end; + + if (JoyCPLLib <> 0) then + begin + Result:= Result and FreeLibrary(JoyCPLLib); + ShowJoyCPL:= nil; + JoyCPLLib:= 0; + end; +end; + +function LoadDirectInput: Boolean; +begin + Result:= DirectInputLoaded; + if (not Result) then + begin + DirectInputLib:= LoadLibrary(DirectInputDll); + if (DirectInputLib<>0) then + begin + DirectInputCreateA:= GetProcAddress(DirectInputLib, 'DirectInputCreateA'); + DirectInputCreateW:= GetProcAddress(DirectInputLib, 'DirectInputCreateW'); + {$IFDEF UNICODE} + DirectInputCreate:= GetProcAddress(DirectInputLib, 'DirectInputCreateW'); + {$ELSE} + DirectInputCreate:= GetProcAddress(DirectInputLib, 'DirectInputCreateA'); + {$ENDIF} + + DirectInputCreateEx:= GetProcAddress(DirectInputLib, 'DirectInputCreateEx'); + end; + + DirectInput8Lib:= LoadLibrary(DirectInput8Dll); + if (DirectInput8Lib<>0) then + begin + DirectInput8Create:= GetProcAddress(DirectInputLib, 'DirectInput8Create'); + end; + + WinMMLib:= LoadLibrary(WinMMDll); + if (WinMMLib <> 0) then + begin + joyConfigChanged:= GetProcAddress(WinMMLib, 'joyConfigChanged'); + end; + + JoyCPLLib:= LoadLibrary(JoyCPL); + if (JoyCPLLib <> 0) then + begin + ShowJoyCPL:= GetProcAddress(JoyCPLLib, 'ShowJoyCPL'); + end; + + // At least basic procedure is found! + Result:= Assigned(DirectInputCreate) or Assigned(DirectInput8Create); + if not Result then UnLoadDirectInput; + end; +end; +{$ELSE} +function DirectInputLoaded: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +function UnLoadDirectInput: Boolean; +begin // Stub function for static linking + Result:= True; // should emulate "normal" behaviour +end; + +function LoadDirectInput: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +{$ENDIF} + +{$IFDEF DIRECTINPUT_DYNAMIC_LINK} +initialization +{$IFNDEF DIRECTINPUT_DYNAMIC_LINK_EXPLICIT} + LoadDirectInput; +{$ENDIF} +finalization + UnLoadDirectInput; +{$ENDIF} +end. + diff --git a/Game/Code/lib/DSPack/DirectX9/DirectMusic.pas b/Game/Code/lib/DSPack/DirectX9/DirectMusic.pas new file mode 100644 index 00000000..e46899df --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DirectMusic.pas @@ -0,0 +1,8102 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: dls1.h dls2.h dmdls.h dmerror.h dmksctrl.h dmplugin.h *} +{* dmusicc.h dmusici.h dmusicf.h dmusbuff.h *} +{* Content: DirectMusic include files *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 27-Apr-2003 *} +{* *} +{* Based upon : *} +{* DirectX 7.0 Delphi adaptation by Erik Unger *} +{* DirectX 8.0 Delphi adaptation by Ivo Steinmann *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{******************************************************************************} +{ } +{ 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} +{$MINENUMSIZE 1} + +unit DirectMusic; + +interface + +(*$HPPEMIT '#include "ks.h"' *) +(*$HPPEMIT '#include "dls1.h"' *) +(*$HPPEMIT '#include "dls2.h"' *) +(*$HPPEMIT '#include "dmdls.h"' *) +(*$HPPEMIT '#include "dmerror.h"' *) +(*$HPPEMIT '#include "dmplugin.h"' *) +(*$HPPEMIT '#include "dmusicc.h"' *) +(*$HPPEMIT '#include "dmusici.h"' *) +(*$HPPEMIT '#include "dmusicf.h"' *) +(*$HPPEMIT '#include "dmusbuff.h"' *) + +{$NOINCLUDE ActiveX} + +uses + Windows, MMSystem, ActiveX, DirectSound; + +(*==========================================================================; +// +// dls1.h +// +// +// Description: +// +// Interface defines and structures for the Instrument Collection Form +// RIFF DLS. +// +// +// Written by Sonic Foundry 1996. Released for public use. +// +//=========================================================================*) + +(*)///////////////////////////////////////////////////////////////////////// +// +// +// Layout of an instrument collection: +// +// +// RIFF [] 'DLS ' [dlid,colh,INSTLIST,WAVEPOOL,INFOLIST] +// +// INSTLIST +// LIST [] 'lins' +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// +// RGNLIST +// LIST [] 'lrgn' +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// +// ARTLIST +// LIST [] 'lart' +// 'art1' level 1 Articulation connection graph +// 'art2' level 2 Articulation connection graph +// '3rd1' Possible 3rd party articulation structure 1 +// '3rd2' Possible 3rd party articulation structure 2 .... and so on +// +// WAVEPOOL +// ptbl [] [pool table] +// LIST [] 'wvpl' +// [path], +// [path], +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// +// INFOLIST +// LIST [] 'INFO' +// 'icmt' 'One of those crazy comments.' +// 'icop' 'Copyright (C) 1996 Sonic Foundry' +// +////////////////////////////////////////////////////////////////////////(*) + + +(*)//////////////////////////////////////////////////////////////////////// +// FOURCC's used in the DLS file +////////////////////////////////////////////////////////////////////////(*) + +const + FOURCC_DLS = DWORD(Byte('D') or (Byte('L') shl 8) or (Byte('S') shl 16) or (Byte(' ') shl 24)); + {$EXTERNALSYM FOURCC_DLS} + FOURCC_DLID = DWORD(Byte('d') or (Byte('l') shl 8) or (Byte('i') shl 16) or (Byte('d') shl 24)); + {$EXTERNALSYM FOURCC_DLID} + FOURCC_COLH = DWORD(Byte('c') or (Byte('o') shl 8) or (Byte('l') shl 16) or (Byte('h') shl 24)); + {$EXTERNALSYM FOURCC_COLH} + FOURCC_WVPL = DWORD(Byte('w') or (Byte('v') shl 8) or (Byte('p') shl 16) or (Byte('l') shl 24)); + {$EXTERNALSYM FOURCC_WVPL} + FOURCC_PTBL = DWORD(Byte('p') or (Byte('t') shl 8) or (Byte('b') shl 16) or (Byte('l') shl 24)); + {$EXTERNALSYM FOURCC_PTBL} + FOURCC_PATH = DWORD(Byte('p') or (Byte('a') shl 8) or (Byte('t') shl 16) or (Byte('h') shl 24)); + {$EXTERNALSYM FOURCC_PATH} + FOURCC_wave = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('v') shl 16) or (Byte('e') shl 24)); + {$EXTERNALSYM FOURCC_wave} + FOURCC_LINS = DWORD(Byte('l') or (Byte('i') shl 8) or (Byte('n') shl 16) or (Byte('s') shl 24)); + {$EXTERNALSYM FOURCC_LINS} + FOURCC_INS = DWORD(Byte('i') or (Byte('n') shl 8) or (Byte('s') shl 16) or (Byte(' ') shl 24)); + {$EXTERNALSYM FOURCC_INS} + FOURCC_INSH = DWORD(Byte('i') or (Byte('n') shl 8) or (Byte('s') shl 16) or (Byte('h') shl 24)); + {$EXTERNALSYM FOURCC_INSH} + FOURCC_LRGN = DWORD(Byte('l') or (Byte('r') shl 8) or (Byte('g') shl 16) or (Byte('n') shl 24)); + {$EXTERNALSYM FOURCC_LRGN} + FOURCC_RGN = DWORD(Byte('r') or (Byte('g') shl 8) or (Byte('n') shl 16) or (Byte(' ') shl 24)); + {$EXTERNALSYM FOURCC_RGN} + FOURCC_RGNH = DWORD(Byte('r') or (Byte('g') shl 8) or (Byte('n') shl 16) or (Byte('h') shl 24)); + {$EXTERNALSYM FOURCC_RGNH} + FOURCC_LART = DWORD(Byte('l') or (Byte('a') shl 8) or (Byte('r') shl 16) or (Byte('t') shl 24)); + {$EXTERNALSYM FOURCC_LART} + FOURCC_ART1 = DWORD(Byte('a') or (Byte('r') shl 8) or (Byte('t') shl 16) or (Byte('1') shl 24)); + {$EXTERNALSYM FOURCC_ART1} + FOURCC_WLNK = DWORD(Byte('w') or (Byte('l') shl 8) or (Byte('n') shl 16) or (Byte('k') shl 24)); + {$EXTERNALSYM FOURCC_WLNK} + FOURCC_WSMP = DWORD(Byte('w') or (Byte('s') shl 8) or (Byte('m') shl 16) or (Byte('p') shl 24)); + {$EXTERNALSYM FOURCC_WSMP} + FOURCC_VERS = DWORD(Byte('v') or (Byte('e') shl 8) or (Byte('r') shl 16) or (Byte('s') shl 24)); + {$EXTERNALSYM FOURCC_VERS} + +(*)//////////////////////////////////////////////////////////////////////// +// Articulation connection graph definitions +////////////////////////////////////////////////////////////////////////(*) + + // Generic Sources + CONN_SRC_NONE = $0000; + {$EXTERNALSYM CONN_SRC_NONE} + CONN_SRC_LFO = $0001; + {$EXTERNALSYM CONN_SRC_LFO} + CONN_SRC_KEYONVELOCITY = $0002; + {$EXTERNALSYM CONN_SRC_KEYONVELOCITY} + CONN_SRC_KEYNUMBER = $0003; + {$EXTERNALSYM CONN_SRC_KEYNUMBER} + CONN_SRC_EG1 = $0004; + {$EXTERNALSYM CONN_SRC_EG1} + CONN_SRC_EG2 = $0005; + {$EXTERNALSYM CONN_SRC_EG2} + CONN_SRC_PITCHWHEEL = $0006; + {$EXTERNALSYM CONN_SRC_PITCHWHEEL} + + // Midi Controllers 0-127 + CONN_SRC_CC1 = $0081; + {$EXTERNALSYM CONN_SRC_CC1} + CONN_SRC_CC7 = $0087; + {$EXTERNALSYM CONN_SRC_CC7} + CONN_SRC_CC10 = $008a; + {$EXTERNALSYM CONN_SRC_CC10} + CONN_SRC_CC11 = $008b; + {$EXTERNALSYM CONN_SRC_CC11} + + // Generic Destinations + CONN_DST_NONE = $0000; + {$EXTERNALSYM CONN_DST_NONE} + CONN_DST_ATTENUATION = $0001; + {$EXTERNALSYM CONN_DST_ATTENUATION} + CONN_DST_PITCH = $0003; + {$EXTERNALSYM CONN_DST_PITCH} + CONN_DST_PAN = $0004; + {$EXTERNALSYM CONN_DST_PAN} + + // LFO Destinations + CONN_DST_LFO_FREQUENCY = $0104; + {$EXTERNALSYM CONN_DST_LFO_FREQUENCY} + CONN_DST_LFO_STARTDELAY = $0105; + {$EXTERNALSYM CONN_DST_LFO_STARTDELAY} + + // EG1 Destinations + CONN_DST_EG1_ATTACKTIME = $0206; + {$EXTERNALSYM CONN_DST_EG1_ATTACKTIME} + CONN_DST_EG1_DECAYTIME = $0207; + {$EXTERNALSYM CONN_DST_EG1_DECAYTIME} + CONN_DST_EG1_RELEASETIME = $0209; + {$EXTERNALSYM CONN_DST_EG1_RELEASETIME} + CONN_DST_EG1_SUSTAINLEVEL = $020a; + {$EXTERNALSYM CONN_DST_EG1_SUSTAINLEVEL} + + // EG2 Destinations + CONN_DST_EG2_ATTACKTIME = $030a; + {$EXTERNALSYM CONN_DST_EG2_ATTACKTIME} + CONN_DST_EG2_DECAYTIME = $030b; + {$EXTERNALSYM CONN_DST_EG2_DECAYTIME} + CONN_DST_EG2_RELEASETIME = $030d; + {$EXTERNALSYM CONN_DST_EG2_RELEASETIME} + CONN_DST_EG2_SUSTAINLEVEL = $030e; + {$EXTERNALSYM CONN_DST_EG2_SUSTAINLEVEL} + + CONN_TRN_NONE = $0000; + {$EXTERNALSYM CONN_TRN_NONE} + CONN_TRN_CONCAVE = $0001; + {$EXTERNALSYM CONN_TRN_CONCAVE} + +type + PDLSID = ^TDLSID; + _DLSID = packed record + ulData1: Cardinal; + usData2: Word; + usData3: Word; + abData4: array[0..7] of Byte; + end; + {$EXTERNALSYM _DLSID} + DLSID = _DLSID; + {$EXTERNALSYM DLSID} + TDLSID= _DLSID; + + PDLSVersion = ^TDLSVersion; + _DLSVERSION = packed record + dwVersionMS: DWORD; + dwVersionLS: DWORD; + end; + {$EXTERNALSYM _DLSVERSION} + DLSVERSION = _DLSVERSION; + {$EXTERNALSYM DLSVERSION} + TDLSVersion = _DLSVERSION; + + PConnection = ^TConnection; + _CONNECTION = packed record + usSource: Word; + usControl: Word; + usDestination: Word; + usTransform: Word; + lScale: Longint; + end; + {$EXTERNALSYM _CONNECTION} + CONNECTION = _CONNECTION; + {$EXTERNALSYM CONNECTION} + TConnection = _CONNECTION; + + // Level 1 Articulation Data + + PConnectionList = ^TConnectionList; + _CONNECTIONLIST = packed record + cbSize: Cardinal; // size of the connection list structure + cConnections: Cardinal; // count of connections in the list + end; + {$EXTERNALSYM _CONNECTIONLIST} + CONNECTIONLIST = _CONNECTIONLIST; + {$EXTERNALSYM CONNECTIONLIST} + TConnectionList = _CONNECTIONLIST; + + +(*)//////////////////////////////////////////////////////////////////////// +// Generic type defines for regions and instruments +////////////////////////////////////////////////////////////////////////(*) + + PRGNRange = ^TRGNRange; + _RGNRANGE = packed record + usLow: Word; + usHigh: Word; + end; + {$EXTERNALSYM _RGNRANGE} + RGNRANGE = _RGNRANGE; + {$EXTERNALSYM RGNRANGE} + TRGNRange = _RGNRANGE; + +const + F_INSTRUMENT_DRUMS = $80000000; + {$EXTERNALSYM F_INSTRUMENT_DRUMS} + +type + PMIDILocale = ^TMIDILocale; + _MIDILOCALE = packed record + ulBank: Cardinal; + ulInstrument: Cardinal; + end; + {$EXTERNALSYM _MIDILOCALE} + MIDILOCALE = _MIDILOCALE; + {$EXTERNALSYM MIDILOCALE} + TMIDILocale = _MIDILOCALE; + +(*)//////////////////////////////////////////////////////////////////////// +// Header structures found in an DLS file for collection, instruments, and +// regions. +////////////////////////////////////////////////////////////////////////(*) + +const + F_RGN_OPTION_SELFNONEXCLUSIVE = $0001; + {$EXTERNALSYM F_RGN_OPTION_SELFNONEXCLUSIVE} + +type + PRGNHeader = ^TRGNHeader; + _RGNHEADER = packed record + RangeKey: TRGNRange; // Key range + RangeVelocity: TRGNRange; // Velocity Range + fusOptions: Word; // Synthesis options for this range + usKeyGroup: Word; // Key grouping for non simultaneous play + // 0 = no group, 1 up is group + // for Level 1 only groups 1-15 are allowed + end; + {$EXTERNALSYM _RGNHEADER} + RGNHEADER = _RGNHEADER; + {$EXTERNALSYM RGNHEADER} + TRGNHeader = _RGNHEADER; + + PInstHeader = ^TInstHeader; + _INSTHEADER = packed record + cRegions: Cardinal; // Count of regions in this instrument + Locale: TMIDILocale; // Intended MIDI locale of this instrument + end; + {$EXTERNALSYM _INSTHEADER} + INSTHEADER = _INSTHEADER; + {$EXTERNALSYM INSTHEADER} + TInstHeader = _INSTHEADER; + + PDLSHeader = ^TDLSHeader; + _DLSHEADER = packed record + cInstruments: Cardinal; // Count of instruments in the collection + end; + {$EXTERNALSYM _DLSHEADER} + DLSHEADER = _DLSHEADER; + {$EXTERNALSYM DLSHEADER} + TDLSHeader = _DLSHEADER; + +(*)/////////////////////////////////////////////////////////////////////////// +// definitions for the Wave link structure +///////////////////////////////////////////////////////////////////////////(*) + +// **** For level 1 only WAVELINK_CHANNEL_MONO is valid **** +// ulChannel allows for up to 32 channels of audio with each bit position +// specifiying a channel of playback + +const + WAVELINK_CHANNEL_LEFT = $0001; + {$EXTERNALSYM WAVELINK_CHANNEL_LEFT} + WAVELINK_CHANNEL_RIGHT = $0002; + {$EXTERNALSYM WAVELINK_CHANNEL_RIGHT} + + F_WAVELINK_PHASE_MASTER = $0001; + {$EXTERNALSYM F_WAVELINK_PHASE_MASTER} + +type + PWaveLink = ^TWaveLink; + _WAVELINK = packed record // any paths or links are stored right after struct + fusOptions: Word; // options flags for this wave + usPhaseGroup: Word; // Phase grouping for locking channels + ulChannel: Cardinal; // channel placement + ulTableIndex: Cardinal; // index into the wave pool table, 0 based + end; + {$EXTERNALSYM _WAVELINK} + WAVELINK = _WAVELINK; + {$EXTERNALSYM WAVELINK} + TWaveLink = _WAVELINK; + +const + POOL_CUE_NULL = $ffffffff; + {$EXTERNALSYM POOL_CUE_NULL} + +type + PPoolCUE = ^TPoolCUE; + _POOLCUE = packed record + ulOffset: Cardinal; // Offset to the entry in the list + end; + {$EXTERNALSYM _POOLCUE} + POOLCUE = _POOLCUE; + {$EXTERNALSYM POOLCUE} + TPoolCUE = _POOLCUE; + + PPoolTable = ^TPoolTable; + _POOLTABLE = packed record + cbSize: Cardinal; // size of the pool table structure + cCues: Cardinal; // count of cues in the list + end; + {$EXTERNALSYM _POOLTABLE} + POOLTABLE = _POOLTABLE; + {$EXTERNALSYM POOLTABLE} + TPoolTable = _POOLTABLE; + +(*)/////////////////////////////////////////////////////////////////////////// +// Structures for the "wsmp" chunk +///////////////////////////////////////////////////////////////////////////(*) + +const + F_WSMP_NO_TRUNCATION = $0001; + {$EXTERNALSYM F_WSMP_NO_TRUNCATION} + F_WSMP_NO_COMPRESSION = $0002; + {$EXTERNALSYM F_WSMP_NO_COMPRESSION} + + +type + PWSMPL = ^TWSMPL; + _rwsmp = packed record + cbSize: Cardinal; + usUnityNote: Word; // MIDI Unity Playback Note + sFineTune: SmallInt; // Fine Tune in log tuning + lAttenuation: Longint; // Overall Attenuation to be applied to data + fulOptions: Cardinal; // Flag options + cSampleLoops: Cardinal; // Count of Sample loops, 0 loops is one shot + end; + {$EXTERNALSYM _rwsmp} + WSMPL = _rwsmp; + {$EXTERNALSYM WSMPL} + TWSMPL = _rwsmp; + + +// This loop type is a normal forward playing loop which is continually +// played until the envelope reaches an off threshold in the release +// portion of the volume envelope + +const + WLOOP_TYPE_FORWARD = 0; + {$EXTERNALSYM WLOOP_TYPE_FORWARD} + +type + PWLoop = ^TWLoop; + _rloop = packed record + cbSize: Cardinal; + ulType: Cardinal; // Loop Type + ulStart: Cardinal; // Start of loop in samples + ulLength: Cardinal; // Length of loop in samples + end; + {$EXTERNALSYM _rloop} + WLOOP = _rloop; + {$EXTERNALSYM WLOOP} + TWLoop = _rloop; + + + + +(* + + dls2.h + + Description: + + Interface defines and structures for the DLS2 extensions of DLS. + + + Written by Microsoft 1998. Released for public use. + +*) + + +(* + FOURCC's used in the DLS2 file, in addition to DLS1 chunks +*) + +const + FOURCC_RGN2 = DWORD(Byte('r') or (Byte('g') shl 8) or (Byte('n') shl 16) or (Byte('2') shl 24)); + {$EXTERNALSYM FOURCC_RGN2} + FOURCC_LAR2 = DWORD(Byte('l') or (Byte('a') shl 8) or (Byte('r') shl 16) or (Byte('2') shl 24)); + {$EXTERNALSYM FOURCC_LAR2} + FOURCC_ART2 = DWORD(Byte('a') or (Byte('r') shl 8) or (Byte('t') shl 16) or (Byte('2') shl 24)); + {$EXTERNALSYM FOURCC_ART2} + FOURCC_CDL = DWORD(Byte('c') or (Byte('d') shl 8) or (Byte('l') shl 16) or (Byte(' ') shl 24)); + {$EXTERNALSYM FOURCC_CDL} +// FOURCC_DLID = DWORD(Byte('d') or (Byte('l') shl 8) or (Byte('i') shl 16) or (Byte('d') shl 24)); //Already defined above + +(* + Articulation connection graph definitions. These are in addition to + the definitions in the DLS1 header. +*) + + // Generic Sources (in addition to DLS1 sources. + CONN_SRC_POLYPRESSURE = $0007; // Polyphonic Pressure + {$EXTERNALSYM CONN_SRC_POLYPRESSURE} + CONN_SRC_CHANNELPRESSURE = $0008; // Channel Pressure + {$EXTERNALSYM CONN_SRC_CHANNELPRESSURE} + CONN_SRC_VIBRATO = $0009; // Vibrato LFO + {$EXTERNALSYM CONN_SRC_VIBRATO} + CONN_SRC_MONOPRESSURE = $000a; // MIDI Mono pressure + {$EXTERNALSYM CONN_SRC_MONOPRESSURE} + + + // Midi Controllers + CONN_SRC_CC91 = $00db; // Reverb Send + {$EXTERNALSYM CONN_SRC_CC91} + CONN_SRC_CC93 = $00dd; // Chorus Send + {$EXTERNALSYM CONN_SRC_CC93} + + + (* Generic Destinations *) + CONN_DST_GAIN = $0001; // Same as CONN_DST_ ATTENUATION, but more appropriate terminology. + {$EXTERNALSYM CONN_DST_GAIN} + CONN_DST_KEYNUMBER = $0005; // Key Number Generator + {$EXTERNALSYM CONN_DST_KEYNUMBER} + + // Audio Channel Output Destinations + CONN_DST_LEFT = $0010; // Left Channel Send + {$EXTERNALSYM CONN_DST_LEFT} + CONN_DST_RIGHT = $0011; // Right Channel Send + {$EXTERNALSYM CONN_DST_RIGHT} + CONN_DST_CENTER = $0012; // Center Channel Send + {$EXTERNALSYM CONN_DST_CENTER} + CONN_DST_LEFTREAR = $0013; // Left Rear Channel Send + {$EXTERNALSYM CONN_DST_LEFTREAR} + CONN_DST_RIGHTREAR = $0014; // Right Rear Channel Send + {$EXTERNALSYM CONN_DST_RIGHTREAR} + CONN_DST_LFE_CHANNEL = $0015; // LFE Channel Send + {$EXTERNALSYM CONN_DST_LFE_CHANNEL} + CONN_DST_CHORUS = $0080; // Chorus Send + {$EXTERNALSYM CONN_DST_CHORUS} + CONN_DST_REVERB = $0081; // Reverb Send + {$EXTERNALSYM CONN_DST_REVERB} + + // Vibrato LFO Destinations + CONN_DST_VIB_FREQUENCY = $0114; // Vibrato Frequency + {$EXTERNALSYM CONN_DST_VIB_FREQUENCY} + CONN_DST_VIB_STARTDELAY = $0115; // Vibrato Start Delay + {$EXTERNALSYM CONN_DST_VIB_STARTDELAY} + + // EG1 Destinations + CONN_DST_EG1_DELAYTIME = $020B; // EG1 Delay Time + {$EXTERNALSYM CONN_DST_EG1_DELAYTIME} + CONN_DST_EG1_HOLDTIME = $020C; // EG1 Hold Time + {$EXTERNALSYM CONN_DST_EG1_HOLDTIME} + CONN_DST_EG1_SHUTDOWNTIME = $020D; // EG1 Shutdown Time + {$EXTERNALSYM CONN_DST_EG1_SHUTDOWNTIME} + + + // EG2 Destinations + CONN_DST_EG2_DELAYTIME = $030F; // EG2 Delay Time + {$EXTERNALSYM CONN_DST_EG2_DELAYTIME} + CONN_DST_EG2_HOLDTIME = $0310; // EG2 Hold Time + {$EXTERNALSYM CONN_DST_EG2_HOLDTIME} + + + // Filter Destinations + CONN_DST_FILTER_CUTOFF = $0500; // Filter Cutoff Frequency + {$EXTERNALSYM CONN_DST_FILTER_CUTOFF} + CONN_DST_FILTER_Q = $0501; // Filter Resonance + {$EXTERNALSYM CONN_DST_FILTER_Q} + + + // Transforms + CONN_TRN_CONVEX = $0002; // Convex Transform + {$EXTERNALSYM CONN_TRN_CONVEX} + CONN_TRN_SWITCH = $0003; // Switch Transform + {$EXTERNALSYM CONN_TRN_SWITCH} + + + // Conditional chunk operators + DLS_CDL_AND = $0001;// X = X & Y + {$EXTERNALSYM DLS_CDL_AND} + DLS_CDL_OR = $0002;// X = X | Y + {$EXTERNALSYM DLS_CDL_OR} + DLS_CDL_XOR = $0003;// X = X ^ Y + {$EXTERNALSYM DLS_CDL_XOR} + DLS_CDL_ADD = $0004;// X = X + Y + {$EXTERNALSYM DLS_CDL_ADD} + DLS_CDL_SUBTRACT = $0005;// X = X - Y + {$EXTERNALSYM DLS_CDL_SUBTRACT} + DLS_CDL_MULTIPLY = $0006;// X = X * Y + {$EXTERNALSYM DLS_CDL_MULTIPLY} + DLS_CDL_DIVIDE = $0007;// X = X / Y + {$EXTERNALSYM DLS_CDL_DIVIDE} + DLS_CDL_LOGICAL_AND = $0008;// X = X && Y + {$EXTERNALSYM DLS_CDL_LOGICAL_AND} + DLS_CDL_LOGICAL_OR = $0009;// X = X || Y + {$EXTERNALSYM DLS_CDL_LOGICAL_OR} + DLS_CDL_LT = $000A;// X = (X < Y) + {$EXTERNALSYM DLS_CDL_LT} + DLS_CDL_LE = $000B;// X = (X <= Y) + {$EXTERNALSYM DLS_CDL_LE} + DLS_CDL_GT = $000C;// X = (X > Y) + {$EXTERNALSYM DLS_CDL_GT} + DLS_CDL_GE = $000D;// X = (X >= Y) + {$EXTERNALSYM DLS_CDL_GE} + DLS_CDL_EQ = $000E;// X = (X == Y) + {$EXTERNALSYM DLS_CDL_EQ} + DLS_CDL_NOT = $000F;// X = !X + {$EXTERNALSYM DLS_CDL_NOT} + DLS_CDL_CONST = $0010;// 32-bit constant + {$EXTERNALSYM DLS_CDL_CONST} + DLS_CDL_QUERY = $0011;// 32-bit value returned from query + {$EXTERNALSYM DLS_CDL_QUERY} + DLS_CDL_QUERYSUPPORTED = $0012;// Test to see if query is supported by synth + {$EXTERNALSYM DLS_CDL_QUERYSUPPORTED} + + (* + Loop and release + *) + + WLOOP_TYPE_RELEASE = 1; + {$EXTERNALSYM WLOOP_TYPE_RELEASE} + + (* + WaveLink chunk + *) + + F_WAVELINK_MULTICHANNEL = $0002; + {$EXTERNALSYM F_WAVELINK_MULTICHANNEL} + + +const + (* + DLSID queries for + *) + + DLSID_GMInHardware: TGUID = '{178f2f24-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM DLSID_GMInHardware} + DLSID_GSInHardware: TGUID = '{178f2f25-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM DLSID_GSInHardware} + DLSID_XGInHardware: TGUID = '{178f2f26-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM DLSID_XGInHardware} + DLSID_SupportsDLS1: TGUID = '{178f2f27-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM DLSID_SupportsDLS1} + DLSID_SupportsDLS2: TGUID = '{f14599e5-4689-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM DLSID_SupportsDLS2} + DLSID_SampleMemorySize: TGUID = '{178f2f28-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM DLSID_SampleMemorySize} + DLSID_ManufacturersID: TGUID = '{b03e1181-8095-11d2-a1ef-00600833dbd8}'; + {$EXTERNALSYM DLSID_ManufacturersID} + DLSID_ProductID: TGUID = '{b03e1182-8095-11d2-a1ef-00600833dbd8}'; + {$EXTERNALSYM DLSID_ProductID} + DLSID_SamplePlaybackRate: TGUID = '{2a91f713-a4bf-11d2-bbdf-00600833dbd8}'; + {$EXTERNALSYM DLSID_SamplePlaybackRate} + + + +(************************************************************************ +* * +* dmdls.h -- DLS download definitions for DirectMusic API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************) + +type + PCENT = Longint; (* Pitch cents *) + {$EXTERNALSYM PCENT} + GCENT = Longint; (* Gain cents *) + {$EXTERNALSYM GCENT} + TCENT = Longint; (* Time cents *) + {$EXTERNALSYM TCENT} + PERCENT = Longint; (* Per.. cent! *) + {$EXTERNALSYM PERCENT} + + + PReferenceTime = ^TReferenceTime; + REFERENCE_TIME = LONGLONG; + {$EXTERNALSYM REFERENCE_TIME} + TReferenceTime = REFERENCE_TIME; + PReference_Time = PReferenceTime; + TReference_Time = TReferenceTime; + + PDMusDownloadInfo = ^TDMusDownloadInfo; + _DMUS_DOWNLOADINFO = packed record + dwDLType: DWORD; // Instrument or Wave + dwDLId: DWORD; // Unique identifier to tag this download. + dwNumOffsetTableEntries: DWORD; // Number of index in the offset address table. + cbSize: DWORD; // Total size of this memory chunk. + end; + {$EXTERNALSYM _DMUS_DOWNLOADINFO} + DMUS_DOWNLOADINFO = _DMUS_DOWNLOADINFO; + {$EXTERNALSYM DMUS_DOWNLOADINFO} + TDMusDownloadInfo = _DMUS_DOWNLOADINFO; + +const + DMUS_DOWNLOADINFO_INSTRUMENT = 1; + {$EXTERNALSYM DMUS_DOWNLOADINFO_INSTRUMENT} + DMUS_DOWNLOADINFO_WAVE = 2; + {$EXTERNALSYM DMUS_DOWNLOADINFO_WAVE} + DMUS_DOWNLOADINFO_INSTRUMENT2 = 3; (* New version for better DLS2 support. *) + {$EXTERNALSYM DMUS_DOWNLOADINFO_INSTRUMENT2} + +(* Support for oneshot and streaming wave data + *) + DMUS_DOWNLOADINFO_WAVEARTICULATION = 4; (* Wave articulation data *) + {$EXTERNALSYM DMUS_DOWNLOADINFO_WAVEARTICULATION} + DMUS_DOWNLOADINFO_STREAMINGWAVE = 5; (* One chunk of a streaming *) + {$EXTERNALSYM DMUS_DOWNLOADINFO_STREAMINGWAVE} + DMUS_DOWNLOADINFO_ONESHOTWAVE = 6; + {$EXTERNALSYM DMUS_DOWNLOADINFO_ONESHOTWAVE} + + DMUS_DEFAULT_SIZE_OFFSETTABLE = 1; + {$EXTERNALSYM DMUS_DEFAULT_SIZE_OFFSETTABLE} + +(* Flags for DMUS_INSTRUMENT's ulFlags member *) + + DMUS_INSTRUMENT_GM_INSTRUMENT = (1 shr 0); + {$EXTERNALSYM DMUS_INSTRUMENT_GM_INSTRUMENT} + +type + PDMusOffsetTable = ^TDMusOffsetTable; + _DMUS_OFFSETTABLE = packed record + ulOffsetTable: array[0..DMUS_DEFAULT_SIZE_OFFSETTABLE - 1] of Cardinal; + end; + {$EXTERNALSYM _DMUS_OFFSETTABLE} + DMUS_OFFSETTABLE = _DMUS_OFFSETTABLE; + {$EXTERNALSYM DMUS_OFFSETTABLE} + TDMusOffsetTable = _DMUS_OFFSETTABLE; + + PDMusInstrument = ^TDMusInstrument; + _DMUS_INSTRUMENT = packed record + ulPatch: Cardinal; + ulFirstRegionIdx: Cardinal; + ulGlobalArtIdx: Cardinal; // If zero the instrument does not have an articulation + ulFirstExtCkIdx: Cardinal; // If zero no 3rd party entenstion chunks associated with the instrument + ulCopyrightIdx: Cardinal; // If zero no Copyright information associated with the instrument + ulFlags: Cardinal; + end; + {$EXTERNALSYM _DMUS_INSTRUMENT} + DMUS_INSTRUMENT = _DMUS_INSTRUMENT; + {$EXTERNALSYM DMUS_INSTRUMENT} + TDMusInstrument = _DMUS_INSTRUMENT; + + PDMusRegion = ^TDMusRegion; + _DMUS_REGION = packed record + RangeKey: TRGNRange; + RangeVelocity: TRGNRange; + fusOptions: Word; + usKeyGroup: Word; + ulRegionArtIdx: Cardinal; // If zero the region does not have an articulation + ulNextRegionIdx: Cardinal; // If zero no more regions + ulFirstExtCkIdx: Cardinal; // If zero no 3rd party entenstion chunks associated with the region + WaveLink: TWaveLink; + WSMP: TWSMPL; // If WSMP.cSampleLoops > 1 then a WLOOP is included + WLOOP: array [0..0] of TWLoop; + end; + {$EXTERNALSYM _DMUS_REGION} + DMUS_REGION = _DMUS_REGION; + {$EXTERNALSYM DMUS_REGION} + TDMusRegion = _DMUS_REGION; + + PDMusLFOParams = ^TDMusLFOParams; + _DMUS_LFOPARAMS = packed record + pcFrequency: PCENT; + tcDelay: TCENT; + gcVolumeScale: GCENT; + pcPitchScale: PCENT; + gcMWToVolume: GCENT; + pcMWToPitch: PCENT; + end; + {$EXTERNALSYM _DMUS_LFOPARAMS} + DMUS_LFOPARAMS = _DMUS_LFOPARAMS; + {$EXTERNALSYM DMUS_LFOPARAMS} + TDMusLFOParams = _DMUS_LFOPARAMS; + + PDMusVEGParams = ^TDMusVEGParams; + _DMUS_VEGPARAMS = packed record + tcAttack: TCENT; + tcDecay: TCENT; + ptSustain: PERCENT; + tcRelease: TCENT; + tcVel2Attack: TCENT; + tcKey2Decay: TCENT; + end; + {$EXTERNALSYM _DMUS_VEGPARAMS} + DMUS_VEGPARAMS = _DMUS_VEGPARAMS; + {$EXTERNALSYM DMUS_VEGPARAMS} + TDMusVEGParams = _DMUS_VEGPARAMS; + + PDMusPEGParams = ^TDMusPEGParams; + _DMUS_PEGPARAMS = packed record + tcAttack: TCENT; + tcDecay: TCENT; + ptSustain: PERCENT; + tcRelease: TCENT; + tcVel2Attack: TCENT; + tcKey2Decay: TCENT; + pcRange: PCENT; + end; + {$EXTERNALSYM _DMUS_PEGPARAMS} + DMUS_PEGPARAMS = _DMUS_PEGPARAMS; + {$EXTERNALSYM DMUS_PEGPARAMS} + TDMusPEGParams = _DMUS_PEGPARAMS; + + PDMusMSCParams = ^TDMusMSCParams; + _DMUS_MSCPARAMS = packed record + ptDefaultPan: PERCENT; + end; + {$EXTERNALSYM _DMUS_MSCPARAMS} + DMUS_MSCPARAMS = _DMUS_MSCPARAMS; + {$EXTERNALSYM DMUS_MSCPARAMS} + TDMusMSCParams = _DMUS_MSCPARAMS; + + PDMusArticParams = ^TDMusArticParams; + _DMUS_ARTICPARAMS = packed record + LFO: TDMusLFOParams; + VolEG: TDMusVEGParams; + PitchEG: TDMusPEGParams; + Misc: TDMusMSCParams; + end; + {$EXTERNALSYM _DMUS_ARTICPARAMS} + DMUS_ARTICPARAMS = _DMUS_ARTICPARAMS; + {$EXTERNALSYM DMUS_ARTICPARAMS} + TDMusArticParams = _DMUS_ARTICPARAMS; + + PDMusArticulation = ^TDMusArticulation; + _DMUS_ARTICULATION = packed record (* Articulation chunk for DMUS_DOWNLOADINFO_INSTRUMENT format. *) + ulArt1Idx: Cardinal; // DLS Level 1 articulation chunk + ulFirstExtCkIdx: Cardinal; // 3rd party extenstion chunks associated with the articulation + end; + {$EXTERNALSYM _DMUS_ARTICULATION} + DMUS_ARTICULATION = _DMUS_ARTICULATION; + {$EXTERNALSYM DMUS_ARTICULATION} + TDMusArticulation = _DMUS_ARTICULATION; + + PDMusArticulation2 = ^TDMusArticulation2; + _DMUS_ARTICULATION2 = packed record (* Articulation chunk for DMUS_DOWNLOADINFO_INSTRUMENT2 format. *) + ulArtIdx: Cardinal; (* DLS Level 1/2 articulation chunk *) + ulFirstExtCkIdx: Cardinal; (* 3rd party extenstion chunks associated with the articulation *) + ulNextArtIdx: Cardinal; (* Additional articulation chunks *) + end; + {$EXTERNALSYM _DMUS_ARTICULATION2} + DMUS_ARTICULATION2 = _DMUS_ARTICULATION2; + {$EXTERNALSYM DMUS_ARTICULATION2} + TDMusArticulation2 = _DMUS_ARTICULATION2; + +const + DMUS_MIN_DATA_SIZE = 4; + {$EXTERNALSYM DMUS_MIN_DATA_SIZE} + +type + (* The actual number is determined by cbSize of struct _DMUS_EXTENSIONCHUNK *) + + PDMusExtensionChunk = ^TDMusExtensionChunk; + _DMUS_EXTENSIONCHUNK = packed record + cbSize: Cardinal; (* Size of extension chunk *) + ulNextExtCkIdx: Cardinal; (* If zero no more 3rd party entenstion chunks *) + ExtCkID: FOURCC; + byExtCk: array[0..DMUS_MIN_DATA_SIZE-1] of Byte; (* The actual number that follows is determined by cbSize *) + end; + {$EXTERNALSYM _DMUS_EXTENSIONCHUNK} + DMUS_EXTENSIONCHUNK = _DMUS_EXTENSIONCHUNK; + {$EXTERNALSYM DMUS_EXTENSIONCHUNK} + TDMusExtensionChunk = _DMUS_EXTENSIONCHUNK; + + (* The actual number is determined by cbSize of struct _DMUS_COPYRIGHT *) + + PDMusCopyright = ^TDMusCopyright; + _DMUS_COPYRIGHT = packed record + cbSize: Cardinal; (* Size of copyright information *) + byCopyright: array[0..DMUS_MIN_DATA_SIZE-1] of Byte; (* The actual number that follows is determined by cbSize *) + end; + {$EXTERNALSYM _DMUS_COPYRIGHT} + DMUS_COPYRIGHT = _DMUS_COPYRIGHT; + {$EXTERNALSYM DMUS_COPYRIGHT} + TDMusCopyright = _DMUS_COPYRIGHT; + + PDMusWaveData = ^TDMusWaveData; + _DMUS_WAVEDATA = packed record + cbSize: Cardinal; + byData: array[0..DMUS_MIN_DATA_SIZE-1] of Byte; + end; + {$EXTERNALSYM _DMUS_WAVEDATA} + DMUS_WAVEDATA = _DMUS_WAVEDATA; + {$EXTERNALSYM DMUS_WAVEDATA} + TDMusWaveData = _DMUS_WAVEDATA; + + PDMusWave = ^TDMusWave; + _DMUS_WAVE = packed record + ulFirstExtCkIdx: Cardinal; (* If zero no 3rd party entenstion chunks associated with the wave *) + ulCopyrightIdx: Cardinal; (* If zero no Copyright information associated with the wave *) + ulWaveDataIdx: Cardinal; (* Location of actual wave data. *) + WaveformatEx: tWAVEFORMATEX; + end; + {$EXTERNALSYM _DMUS_WAVE} + DMUS_WAVE = _DMUS_WAVE; + {$EXTERNALSYM DMUS_WAVE} + TDMusWave = _DMUS_WAVE; + + PDMusNoteRange = ^TDMusNoteRange; + _DMUS_NOTERANGE = packed record + dwLowNote: DWORD; (* Sets the low note for the range of MIDI note events to which the instrument responds.*) + dwHighNote: DWORD; (* Sets the high note for the range of MIDI note events to which the instrument responds.*) + end; + {$EXTERNALSYM _DMUS_NOTERANGE} + DMUS_NOTERANGE = _DMUS_NOTERANGE; + {$EXTERNALSYM DMUS_NOTERANGE} + TDMusNoteRange = _DMUS_NOTERANGE; + + PDMusWaveArtDL = ^TDMusWaveArtDL; + _DMUS_WAVEARTDL = packed record + ulDownloadIdIdx: Cardinal; (* Download ID's of each buffer *) + ulBus: Cardinal; (* Playback bus *) + ulBuffers: Cardinal; (* Buffers *) + ulMasterDLId: Cardinal; (* Download ID of master voice of slave group *) + usOptions: Word; (* Same as DLS2 region options *) + end; + {$EXTERNALSYM _DMUS_WAVEARTDL} + DMUS_WAVEARTDL = _DMUS_WAVEARTDL; + {$EXTERNALSYM DMUS_WAVEARTDL} + TDMusWaveArtDL = _DMUS_WAVEARTDL; + + PDMusWaveDL = ^TDMusWaveDL; + _DMUS_WAVEDL = packed record + cbWaveData: Cardinal; (* Bytes of wave data *) + end; + {$EXTERNALSYM _DMUS_WAVEDL} + DMUS_WAVEDL = _DMUS_WAVEDL; + {$EXTERNALSYM DMUS_WAVEDL} + TDMusWaveDL = _DMUS_WAVEDL; + + + + + +(************************************************************************ +* * +* dmerror.h -- Error codes returned by DirectMusic API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************) + +const + FACILITY_DIRECTMUSIC = $878; (* Shared with DirectSound *) + {$EXTERNALSYM FACILITY_DIRECTMUSIC} + DMUS_ERRBASE = $1000; (* Make error codes human readable in hex *) + {$EXTERNALSYM DMUS_ERRBASE} + +// #define MAKE_DMHRESULTSUCCESS(code) MAKE_HRESULT(0, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code))) +function MAKE_DMHRESULTSUCCESS(Code: DWord): DWord; +{$EXTERNALSYM MAKE_DMHRESULTSUCCESS} +// #define MAKE_DMHRESULTERROR(code) MAKE_HRESULT(1, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code))) +function MAKE_DMHRESULTERROR(Code: DWord): DWord; +{$EXTERNALSYM MAKE_DMHRESULTERROR} + + +const + MAKE_DMHRESULTSUCCESS_R = (0 shl 31) or (FACILITY_DIRECTMUSIC shl 16) or DMUS_ERRBASE; + MAKE_DMHRESULTERROR_R = (1 shl 31) or (FACILITY_DIRECTMUSIC shl 16) or DMUS_ERRBASE; + +(* DMUS_S_PARTIALLOAD + * + * The object could only load partially. This can happen if some components are + * not registered properly, such as embedded tracks and tools. This can also happen + * if some content is missing. For example, if a segment uses a DLS collection that + * is not in the loader's current search directory. + *) + DMUS_S_PARTIALLOAD = (MAKE_DMHRESULTSUCCESS_R + $091); + {$EXTERNALSYM DMUS_S_PARTIALLOAD} + +(* DMUS_S_PARTIALDOWNLOAD + * + * Return value from IDirectMusicBand::Download() which indicates that + * some of the instruments safely downloaded, but others failed. This usually + * occurs when some instruments are on PChannels not supported by the performance + * or port. + *) + DMUS_S_PARTIALDOWNLOAD = (MAKE_DMHRESULTSUCCESS_R + $092); + {$EXTERNALSYM DMUS_S_PARTIALDOWNLOAD} + +(* DMUS_S_REQUEUE + * + * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the + * performance that it should cue the PMsg again automatically. + *) + DMUS_S_REQUEUE = (MAKE_DMHRESULTSUCCESS_R + $200); + {$EXTERNALSYM DMUS_S_REQUEUE} + +(* DMUS_S_FREE + * + * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the + * performance that it should free the PMsg automatically. + *) + DMUS_S_FREE = (MAKE_DMHRESULTSUCCESS_R + $201); + {$EXTERNALSYM DMUS_S_FREE} + +(* DMUS_S_END + * + * Return value from IDirectMusicTrack::Play() which indicates to the + * segment that the track has no more data after mtEnd. + *) + DMUS_S_END = (MAKE_DMHRESULTSUCCESS_R + $202); + {$EXTERNALSYM DMUS_S_END} + +(* DMUS_S_STRING_TRUNCATED + * + * Returned string has been truncated to fit the buffer size. + *) + DMUS_S_STRING_TRUNCATED = (MAKE_DMHRESULTSUCCESS_R + $210); + {$EXTERNALSYM DMUS_S_STRING_TRUNCATED} + +(* DMUS_S_LAST_TOOL + * + * Returned from IDirectMusicGraph::StampPMsg(), this indicates that the PMsg + * is already stamped with the last tool in the graph. The returned PMsg's + * tool pointer is now NULL. + *) + DMUS_S_LAST_TOOL = (MAKE_DMHRESULTSUCCESS_R + $211); + {$EXTERNALSYM DMUS_S_LAST_TOOL} + +(* DMUS_S_OVER_CHORD + * + * Returned from IDirectMusicPerformance::MusicToMIDI(), this indicates + * that no note has been calculated because the music value has the note + * at a position higher than the top note of the chord. This applies only + * to DMUS_PLAYMODE_NORMALCHORD play mode. This success code indicates + * that the caller should not do anything with the note. It is not meant + * to be played against this chord. + *) + DMUS_S_OVER_CHORD = (MAKE_DMHRESULTSUCCESS_R + $212); + {$EXTERNALSYM DMUS_S_OVER_CHORD} + +(* DMUS_S_UP_OCTAVE + * + * Returned from IDirectMusicPerformance::MIDIToMusic(), and + * IDirectMusicPerformance::MusicToMIDI(), this indicates + * that the note conversion generated a note value that is below 0, + * so it has been bumped up one or more octaves to be in the proper + * MIDI range of 0 through 127. + * Note that this is valid for MIDIToMusic() when using play modes + * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of + * which store MIDI values in wMusicValue. With MusicToMIDI(), it is + * valid for all play modes. + * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code. + *) + DMUS_S_UP_OCTAVE = (MAKE_DMHRESULTSUCCESS_R + $213); + {$EXTERNALSYM DMUS_S_UP_OCTAVE} + +(* DMUS_S_DOWN_OCTAVE + * + * Returned from IDirectMusicPerformance::MIDIToMusic(), and + * IDirectMusicPerformance::MusicToMIDI(), this indicates + * that the note conversion generated a note value that is above 127, + * so it has been bumped down one or more octaves to be in the proper + * MIDI range of 0 through 127. + * Note that this is valid for MIDIToMusic() when using play modes + * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of + * which store MIDI values in wMusicValue. With MusicToMIDI(), it is + * valid for all play modes. + * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code. + *) + DMUS_S_DOWN_OCTAVE = (MAKE_DMHRESULTSUCCESS_R + $214); + {$EXTERNALSYM DMUS_S_DOWN_OCTAVE} + +(* DMUS_S_NOBUFFERCONTROL + * + * Although the audio output from the port will be routed to the + * same device as the given DirectSound buffer, buffer controls + * such as pan and volume will not affect the output. + * + *) + DMUS_S_NOBUFFERCONTROL = (MAKE_DMHRESULTSUCCESS_R + $215); + {$EXTERNALSYM DMUS_S_NOBUFFERCONTROL} + +(* DMUS_S_GARBAGE_COLLECTED + * + * The requested operation was not performed because during CollectGarbage + * the loader determined that the object had been released. + *) + DMUS_S_GARBAGE_COLLECTED = (MAKE_DMHRESULTSUCCESS_R + $216); + {$EXTERNALSYM DMUS_S_GARBAGE_COLLECTED} + +(* DMUS_E_DRIVER_FAILED + * + * An unexpected error was returned from a device driver, indicating + * possible failure of the driver or hardware. + *) + DMUS_E_DRIVER_FAILED = (MAKE_DMHRESULTERROR_R + $0101); + {$EXTERNALSYM DMUS_E_DRIVER_FAILED} + +(* DMUS_E_PORTS_OPEN + * + * The requested operation cannot be performed while there are + * instantiated ports in any process in the system. + *) + DMUS_E_PORTS_OPEN = (MAKE_DMHRESULTERROR_R + $0102); + {$EXTERNALSYM DMUS_E_PORTS_OPEN} + +(* DMUS_E_DEVICE_IN_USE + * + * The requested device is already in use (possibly by a non-DirectMusic + * client) and cannot be opened again. + *) + DMUS_E_DEVICE_IN_USE = (MAKE_DMHRESULTERROR_R + $0103); + {$EXTERNALSYM DMUS_E_DEVICE_IN_USE} + +(* DMUS_E_INSUFFICIENTBUFFER + * + * Buffer is not large enough for requested operation. + *) + DMUS_E_INSUFFICIENTBUFFER = (MAKE_DMHRESULTERROR_R + $0104); + {$EXTERNALSYM DMUS_E_INSUFFICIENTBUFFER} + +(* DMUS_E_BUFFERNOTSET + * + * No buffer was prepared for the download data. + *) + DMUS_E_BUFFERNOTSET = (MAKE_DMHRESULTERROR_R + $0105); + {$EXTERNALSYM DMUS_E_BUFFERNOTSET} + +(* DMUS_E_BUFFERNOTAVAILABLE + * + * Download failed due to inability to access or create download buffer. + *) + DMUS_E_BUFFERNOTAVAILABLE = (MAKE_DMHRESULTERROR_R + $0106); + {$EXTERNALSYM DMUS_E_BUFFERNOTAVAILABLE} + +(* DMUS_E_NOTADLSCOL + * + * Error parsing DLS collection. File is corrupt. + *) + DMUS_E_NOTADLSCOL = (MAKE_DMHRESULTERROR_R + $0108); + {$EXTERNALSYM DMUS_E_NOTADLSCOL} + +(* DMUS_E_INVALIDOFFSET + * + * Wave chunks in DLS collection file are at incorrect offsets. + *) + DMUS_E_INVALIDOFFSET = (MAKE_DMHRESULTERROR_R + $0109); + {$EXTERNALSYM DMUS_E_INVALIDOFFSET} + +(* DMUS_E_ALREADY_LOADED + * + * Second attempt to load a DLS collection that is currently open. + *) + DMUS_E_ALREADY_LOADED = (MAKE_DMHRESULTERROR_R + $0111); + {$EXTERNALSYM DMUS_E_ALREADY_LOADED} + +(* DMUS_E_INVALIDPOS + * + * Error reading wave data from DLS collection. Indicates bad file. + *) + DMUS_E_INVALIDPOS = (MAKE_DMHRESULTERROR_R + $0113); + {$EXTERNALSYM DMUS_E_INVALIDPOS} + +(* DMUS_E_INVALIDPATCH + * + * There is no instrument in the collection that matches patch number. + *) + DMUS_E_INVALIDPATCH = (MAKE_DMHRESULTERROR_R + $0114); + {$EXTERNALSYM DMUS_E_INVALIDPATCH} + +(* DMUS_E_CANNOTSEEK + * + * The IStream* doesn't support Seek(). + *) + DMUS_E_CANNOTSEEK = (MAKE_DMHRESULTERROR_R + $0115); + {$EXTERNALSYM DMUS_E_CANNOTSEEK} + +(* DMUS_E_CANNOTWRITE + * + * The IStream* doesn't support Write(). + *) + DMUS_E_CANNOTWRITE = (MAKE_DMHRESULTERROR_R + $0116); + {$EXTERNALSYM DMUS_E_CANNOTWRITE} + +(* DMUS_E_CHUNKNOTFOUND + * + * The RIFF parser doesn't contain a required chunk while parsing file. + *) + DMUS_E_CHUNKNOTFOUND = (MAKE_DMHRESULTERROR_R + $0117); + {$EXTERNALSYM DMUS_E_CHUNKNOTFOUND} + +(* DMUS_E_INVALID_DOWNLOADID + * + * Invalid download id was used in the process of creating a download buffer. + *) + DMUS_E_INVALID_DOWNLOADID = (MAKE_DMHRESULTERROR_R + $0119); + {$EXTERNALSYM DMUS_E_INVALID_DOWNLOADID} + +(* DMUS_E_NOT_DOWNLOADED_TO_PORT + * + * Tried to unload an object that was not downloaded or previously unloaded. + *) + DMUS_E_NOT_DOWNLOADED_TO_PORT = (MAKE_DMHRESULTERROR_R + $0120); + {$EXTERNALSYM DMUS_E_NOT_DOWNLOADED_TO_PORT} + +(* DMUS_E_ALREADY_DOWNLOADED + * + * Buffer was already downloaded to synth. + *) + DMUS_E_ALREADY_DOWNLOADED = (MAKE_DMHRESULTERROR_R + $0121); + {$EXTERNALSYM DMUS_E_ALREADY_DOWNLOADED} + +(* DMUS_E_UNKNOWN_PROPERTY + * + * The specified property item was not recognized by the target object. + *) + DMUS_E_UNKNOWN_PROPERTY = (MAKE_DMHRESULTERROR_R + $0122); + {$EXTERNALSYM DMUS_E_UNKNOWN_PROPERTY} + +(* DMUS_E_SET_UNSUPPORTED + * + * The specified property item may not be set on the target object. + *) + DMUS_E_SET_UNSUPPORTED = (MAKE_DMHRESULTERROR_R + $0123); + {$EXTERNALSYM DMUS_E_SET_UNSUPPORTED} + +(* DMUS_E_GET_UNSUPPORTED + * + * The specified property item may not be retrieved from the target object. + *) + DMUS_E_GET_UNSUPPORTED = (MAKE_DMHRESULTERROR_R + $0124); + {$EXTERNALSYM DMUS_E_GET_UNSUPPORTED} + +(* DMUS_E_NOTMONO + * + * Wave chunk has more than one interleaved channel. DLS format requires MONO. + *) + DMUS_E_NOTMONO = (MAKE_DMHRESULTERROR_R + $0125); + {$EXTERNALSYM DMUS_E_NOTMONO} + +(* DMUS_E_BADARTICULATION + * + * Invalid articulation chunk in DLS collection. + *) + DMUS_E_BADARTICULATION = (MAKE_DMHRESULTERROR_R + $0126); + {$EXTERNALSYM DMUS_E_BADARTICULATION} + +(* DMUS_E_BADINSTRUMENT + * + * Invalid instrument chunk in DLS collection. + *) + DMUS_E_BADINSTRUMENT = (MAKE_DMHRESULTERROR_R + $0127); + {$EXTERNALSYM DMUS_E_BADINSTRUMENT} + +(* DMUS_E_BADWAVELINK + * + * Wavelink chunk in DLS collection points to invalid wave. + *) + DMUS_E_BADWAVELINK = (MAKE_DMHRESULTERROR_R + $0128); + {$EXTERNALSYM DMUS_E_BADWAVELINK} + +(* DMUS_E_NOARTICULATION + * + * Articulation missing from instrument in DLS collection. + *) + DMUS_E_NOARTICULATION = (MAKE_DMHRESULTERROR_R + $0129); + {$EXTERNALSYM DMUS_E_NOARTICULATION} + +(* DMUS_E_NOTPCM + * + * Downoaded DLS wave is not in PCM format. +*) + DMUS_E_NOTPCM = (MAKE_DMHRESULTERROR_R + $012A); + {$EXTERNALSYM DMUS_E_NOTPCM} + +(* DMUS_E_BADWAVE + * + * Bad wave chunk in DLS collection + *) + DMUS_E_BADWAVE = (MAKE_DMHRESULTERROR_R + $012B); + {$EXTERNALSYM DMUS_E_BADWAVE} + +(* DMUS_E_BADOFFSETTABLE + * + * Offset Table for download buffer has errors. + *) + DMUS_E_BADOFFSETTABLE = (MAKE_DMHRESULTERROR_R + $012C); + {$EXTERNALSYM DMUS_E_BADOFFSETTABLE} + +(* DMUS_E_UNKNOWNDOWNLOAD + * + * Attempted to download unknown data type. + *) + DMUS_E_UNKNOWNDOWNLOAD = (MAKE_DMHRESULTERROR_R + $012D); + {$EXTERNALSYM DMUS_E_UNKNOWNDOWNLOAD} + +(* DMUS_E_NOSYNTHSINK + * + * The operation could not be completed because no sink was connected to + * the synthesizer. + *) + DMUS_E_NOSYNTHSINK = (MAKE_DMHRESULTERROR_R + $012E); + {$EXTERNALSYM DMUS_E_NOSYNTHSINK} + +(* DMUS_E_ALREADYOPEN + * + * An attempt was made to open the software synthesizer while it was already + * open. + * ASSERT? + *) + DMUS_E_ALREADYOPEN = (MAKE_DMHRESULTERROR_R + $012F); + {$EXTERNALSYM DMUS_E_ALREADYOPEN} + +(* DMUS_E_ALREADYCLOSE + * + * An attempt was made to close the software synthesizer while it was already + * open. + * ASSERT? + *) + DMUS_E_ALREADYCLOSED = (MAKE_DMHRESULTERROR_R + $0130); + {$EXTERNALSYM DMUS_E_ALREADYCLOSED} + +(* DMUS_E_SYNTHNOTCONFIGURED + * + * The operation could not be completed because the software synth has not + * yet been fully configured. + * ASSERT? + *) + DMUS_E_SYNTHNOTCONFIGURED = (MAKE_DMHRESULTERROR_R + $0131); + {$EXTERNALSYM DMUS_E_SYNTHNOTCONFIGURED} + +(* DMUS_E_SYNTHACTIVE + * + * The operation cannot be carried out while the synthesizer is active. + *) + DMUS_E_SYNTHACTIVE = (MAKE_DMHRESULTERROR_R + $0132); + {$EXTERNALSYM DMUS_E_SYNTHACTIVE} + +(* DMUS_E_CANNOTREAD + * + * An error occurred while attempting to read from the IStream* object. + *) + DMUS_E_CANNOTREAD = (MAKE_DMHRESULTERROR_R + $0133); + {$EXTERNALSYM DMUS_E_CANNOTREAD} + +(* DMUS_E_DMUSIC_RELEASED + * + * The operation cannot be performed because the final instance of the + * DirectMusic object was released. Ports cannot be used after final + * release of the DirectMusic object. + *) + DMUS_E_DMUSIC_RELEASED = (MAKE_DMHRESULTERROR_R + $0134); + {$EXTERNALSYM DMUS_E_DMUSIC_RELEASED} + +(* DMUS_E_BUFFER_EMPTY + * + * There was no data in the referenced buffer. + *) + DMUS_E_BUFFER_EMPTY = (MAKE_DMHRESULTERROR_R + $0135); + {$EXTERNALSYM DMUS_E_BUFFER_EMPTY} + +(* DMUS_E_BUFFER_FULL + * + * There is insufficient space to insert the given event into the buffer. + *) + DMUS_E_BUFFER_FULL = (MAKE_DMHRESULTERROR_R + $0136); + {$EXTERNALSYM DMUS_E_BUFFER_FULL} + +(* DMUS_E_PORT_NOT_CAPTURE + * + * The given operation could not be carried out because the port is a + * capture port. + *) + DMUS_E_PORT_NOT_CAPTURE = (MAKE_DMHRESULTERROR_R + $0137); + {$EXTERNALSYM DMUS_E_PORT_NOT_CAPTURE} + +(* DMUS_E_PORT_NOT_RENDER + * + * The given operation could not be carried out because the port is a + * render port. + *) + DMUS_E_PORT_NOT_RENDER = (MAKE_DMHRESULTERROR_R + $0138); + {$EXTERNALSYM DMUS_E_PORT_NOT_RENDER} + +(* DMUS_E_DSOUND_NOT_SET + * + * The port could not be created because no DirectSound has been specified. + * Specify a DirectSound interface via the IDirectMusic::SetDirectSound + * method; pass NULL to have DirectMusic manage usage of DirectSound. + *) + DMUS_E_DSOUND_NOT_SET = (MAKE_DMHRESULTERROR_R + $0139); + {$EXTERNALSYM DMUS_E_DSOUND_NOT_SET} + +(* DMUS_E_ALREADY_ACTIVATED + * + * The operation cannot be carried out while the port is active. + *) + DMUS_E_ALREADY_ACTIVATED = (MAKE_DMHRESULTERROR_R + $013A); + {$EXTERNALSYM DMUS_E_ALREADY_ACTIVATED} + +(* DMUS_E_INVALIDBUFFER + * + * Invalid DirectSound buffer was handed to port. + *) + DMUS_E_INVALIDBUFFER = (MAKE_DMHRESULTERROR_R + $013B); + {$EXTERNALSYM DMUS_E_INVALIDBUFFER} + +(* DMUS_E_WAVEFORMATNOTSUPPORTED + * + * Invalid buffer format was handed to the synth sink. + *) + DMUS_E_WAVEFORMATNOTSUPPORTED = (MAKE_DMHRESULTERROR_R + $013C); + {$EXTERNALSYM DMUS_E_WAVEFORMATNOTSUPPORTED} + +(* DMUS_E_SYNTHINACTIVE + * + * The operation cannot be carried out while the synthesizer is inactive. + *) + DMUS_E_SYNTHINACTIVE = (MAKE_DMHRESULTERROR_R + $013D); + {$EXTERNALSYM DMUS_E_SYNTHINACTIVE} + +(* DMUS_E_DSOUND_ALREADY_SET + * + * IDirectMusic::SetDirectSound has already been called. It may not be + * changed while in use. + *) + DMUS_E_DSOUND_ALREADY_SET = (MAKE_DMHRESULTERROR_R + $013E); + {$EXTERNALSYM DMUS_E_DSOUND_ALREADY_SET} + +(* DMUS_E_INVALID_EVENT + * + * The given event is invalid (either it is not a valid MIDI message + * or it makes use of running status). The event cannot be packed + * into the buffer. + *) + DMUS_E_INVALID_EVENT = (MAKE_DMHRESULTERROR_R + $013F); + {$EXTERNALSYM DMUS_E_INVALID_EVENT} + +(* DMUS_E_UNSUPPORTED_STREAM + * + * The IStream* object does not contain data supported by the loading object. + *) + DMUS_E_UNSUPPORTED_STREAM = (MAKE_DMHRESULTERROR_R + $0150); + {$EXTERNALSYM DMUS_E_UNSUPPORTED_STREAM} + +(* DMUS_E_ALREADY_INITED + * + * The object has already been initialized. + *) + DMUS_E_ALREADY_INITED = (MAKE_DMHRESULTERROR_R + $0151); + {$EXTERNALSYM DMUS_E_ALREADY_INITED} + +(* DMUS_E_INVALID_BAND + * + * The file does not contain a valid band. + *) + DMUS_E_INVALID_BAND = (MAKE_DMHRESULTERROR_R + $0152); + {$EXTERNALSYM DMUS_E_INVALID_BAND} + +(* DMUS_E_TRACK_HDR_NOT_FIRST_CK + * + * The IStream* object's data does not have a track header as the first chunk, + * and therefore can not be read by the segment object. + *) + DMUS_E_TRACK_HDR_NOT_FIRST_CK = (MAKE_DMHRESULTERROR_R + $0155); + {$EXTERNALSYM DMUS_E_TRACK_HDR_NOT_FIRST_CK} + +(* DMUS_E_TOOL_HDR_NOT_FIRST_CK + * + * The IStream* object's data does not have a tool header as the first chunk, + * and therefore can not be read by the graph object. + *) + DMUS_E_TOOL_HDR_NOT_FIRST_CK = (MAKE_DMHRESULTERROR_R + $0156); + {$EXTERNALSYM DMUS_E_TOOL_HDR_NOT_FIRST_CK} + +(* DMUS_E_INVALID_TRACK_HDR + * + * The IStream* object's data contains an invalid track header (ckid is 0 and + * fccType is NULL,) and therefore can not be read by the segment object. + *) + DMUS_E_INVALID_TRACK_HDR = (MAKE_DMHRESULTERROR_R + $0157); + {$EXTERNALSYM DMUS_E_INVALID_TRACK_HDR} + +(* DMUS_E_INVALID_TOOL_HDR + * + * The IStream* object's data contains an invalid tool header (ckid is 0 and + * fccType is NULL,) and therefore can not be read by the graph object. + *) + DMUS_E_INVALID_TOOL_HDR = (MAKE_DMHRESULTERROR_R + $0158); + {$EXTERNALSYM DMUS_E_INVALID_TOOL_HDR} + +(* DMUS_E_ALL_TOOLS_FAILED + * + * The graph object was unable to load all tools from the IStream* object data. + * This may be due to errors in the stream, or the tools being incorrectly + * registered on the client. + *) + DMUS_E_ALL_TOOLS_FAILED = (MAKE_DMHRESULTERROR_R + $0159); + {$EXTERNALSYM DMUS_E_ALL_TOOLS_FAILED} + +(* DMUS_E_ALL_TRACKS_FAILED + * + * The segment object was unable to load all tracks from the IStream* object data. + * This may be due to errors in the stream, or the tracks being incorrectly + * registered on the client. + *) + DMUS_E_ALL_TRACKS_FAILED = (MAKE_DMHRESULTERROR_R + $0160); + {$EXTERNALSYM DMUS_E_ALL_TRACKS_FAILED} + +(* DMUS_E_NOT_FOUND + * + * The requested item was not contained by the object. + *) + DMUS_E_NOT_FOUND = (MAKE_DMHRESULTERROR_R + $0161); + {$EXTERNALSYM DMUS_E_NOT_FOUND} + +(* DMUS_E_NOT_INIT + * + * A required object is not initialized or failed to initialize. + *) + DMUS_E_NOT_INIT = (MAKE_DMHRESULTERROR_R + $0162); + {$EXTERNALSYM DMUS_E_NOT_INIT} + +(* DMUS_E_TYPE_DISABLED + * + * The requested parameter type is currently disabled. Parameter types may + * be enabled and disabled by certain calls to SetParam(). + *) + DMUS_E_TYPE_DISABLED = (MAKE_DMHRESULTERROR_R + $0163); + {$EXTERNALSYM DMUS_E_TYPE_DISABLED} + +(* DMUS_E_TYPE_UNSUPPORTED + * + * The requested parameter type is not supported on the object. + *) + DMUS_E_TYPE_UNSUPPORTED = (MAKE_DMHRESULTERROR_R + $0164); + {$EXTERNALSYM DMUS_E_TYPE_UNSUPPORTED} + +(* DMUS_E_TIME_PAST + * + * The time is in the past, and the operation can not succeed. + *) + DMUS_E_TIME_PAST = (MAKE_DMHRESULTERROR_R + $0165); + {$EXTERNALSYM DMUS_E_TIME_PAST} + +(* DMUS_E_TRACK_NOT_FOUND + * + * The requested track is not contained by the segment. + *) + DMUS_E_TRACK_NOT_FOUND = (MAKE_DMHRESULTERROR_R + $0166); + {$EXTERNALSYM DMUS_E_TRACK_NOT_FOUND} + +(* DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT + * + * The track does not support clock time playback or getparam. + *) + DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT = (MAKE_DMHRESULTERROR_R + $0167); + {$EXTERNALSYM DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT} + +(* DMUS_E_NO_MASTER_CLOCK + * + * There is no master clock in the performance. Be sure to call + * IDirectMusicPerformance::Init(). + *) + DMUS_E_NO_MASTER_CLOCK = (MAKE_DMHRESULTERROR_R + $0170); + {$EXTERNALSYM DMUS_E_NO_MASTER_CLOCK} + +(* DMUS_E_LOADER_NOCLASSID + * + * The class id field is required and missing in the DMUS_OBJECTDESC. + *) + DMUS_E_LOADER_NOCLASSID = (MAKE_DMHRESULTERROR_R + $0180); + {$EXTERNALSYM DMUS_E_LOADER_NOCLASSID} + +(* DMUS_E_LOADER_BADPATH + * + * The requested file path is invalid. + *) + DMUS_E_LOADER_BADPATH = (MAKE_DMHRESULTERROR_R + $0181); + {$EXTERNALSYM DMUS_E_LOADER_BADPATH} + +(* DMUS_E_LOADER_FAILEDOPEN + * + * File open failed - either file doesn't exist or is locked. + *) + DMUS_E_LOADER_FAILEDOPEN = (MAKE_DMHRESULTERROR_R + $0182); + {$EXTERNALSYM DMUS_E_LOADER_FAILEDOPEN} + +(* DMUS_E_LOADER_FORMATNOTSUPPORTED + * + * Search data type is not supported. + *) + DMUS_E_LOADER_FORMATNOTSUPPORTED = (MAKE_DMHRESULTERROR_R + $0183); + {$EXTERNALSYM DMUS_E_LOADER_FORMATNOTSUPPORTED} + +(* DMUS_E_LOADER_FAILEDCREATE + * + * Unable to find or create object. + *) + DMUS_E_LOADER_FAILEDCREATE = (MAKE_DMHRESULTERROR_R + $0184); + {$EXTERNALSYM DMUS_E_LOADER_FAILEDCREATE} + +(* DMUS_E_LOADER_OBJECTNOTFOUND + * + * Object was not found. + *) + DMUS_E_LOADER_OBJECTNOTFOUND = (MAKE_DMHRESULTERROR_R + $0185); + {$EXTERNALSYM DMUS_E_LOADER_OBJECTNOTFOUND} + +(* DMUS_E_LOADER_NOFILENAME + * + * The file name is missing from the DMUS_OBJECTDESC. + *) + DMUS_E_LOADER_NOFILENAME = (MAKE_DMHRESULTERROR_R + $0186); + {$EXTERNALSYM DMUS_E_LOADER_NOFILENAME} + +(* DMUS_E_INVALIDFILE + * + * The file requested is not a valid file. + *) + DMUS_E_INVALIDFILE = (MAKE_DMHRESULTERROR_R + $0200); + {$EXTERNALSYM DMUS_E_INVALIDFILE} + +(* DMUS_E_ALREADY_EXISTS + * + * The tool is already contained in the graph. Create a new instance. + *) + DMUS_E_ALREADY_EXISTS = (MAKE_DMHRESULTERROR_R + $0201); + {$EXTERNALSYM DMUS_E_ALREADY_EXISTS} + +(* DMUS_E_OUT_OF_RANGE + * + * Value is out of range, for instance the requested length is longer than + * the segment. + *) + DMUS_E_OUT_OF_RANGE = (MAKE_DMHRESULTERROR_R + $0202); + {$EXTERNALSYM DMUS_E_OUT_OF_RANGE} + +(* DMUS_E_SEGMENT_INIT_FAILED + * + * Segment initialization failed, most likely due to a critical memory situation. + *) + DMUS_E_SEGMENT_INIT_FAILED = (MAKE_DMHRESULTERROR_R + $0203); + {$EXTERNALSYM DMUS_E_SEGMENT_INIT_FAILED} + +(* DMUS_E_ALREADY_SENT + * + * The DMUS_PMSG has already been sent to the performance object via + * IDirectMusicPerformance::SendPMsg(). + *) + DMUS_E_ALREADY_SENT = (MAKE_DMHRESULTERROR_R + $0204); + {$EXTERNALSYM DMUS_E_ALREADY_SENT} + +(* DMUS_E_CANNOT_FREE + * + * The DMUS_PMSG was either not allocated by the performance via + * IDirectMusicPerformance::AllocPMsg(), or it was already freed via + * IDirectMusicPerformance::FreePMsg(). + *) + DMUS_E_CANNOT_FREE = (MAKE_DMHRESULTERROR_R + $0205); + {$EXTERNALSYM DMUS_E_CANNOT_FREE} + +(* DMUS_E_CANNOT_OPEN_PORT + * + * The default system port could not be opened. + *) + DMUS_E_CANNOT_OPEN_PORT = (MAKE_DMHRESULTERROR_R + $0206); + {$EXTERNALSYM DMUS_E_CANNOT_OPEN_PORT} + +(* DMUS_E_CANNOT_CONVERT + * + * A call to MIDIToMusic() or MusicToMIDI() resulted in an error because + * the requested conversion could not happen. This usually occurs when the + * provided DMUS_CHORD_KEY structure has an invalid chord or scale pattern. + *) + DMUS_E_CANNOT_CONVERT = (MAKE_DMHRESULTERROR_R + $0207); + {$EXTERNALSYM DMUS_E_CANNOT_CONVERT} +(* misspelling in previous versions of DirectX preserved for backward compatibility *) + DMUS_E_CONNOT_CONVERT = DMUS_E_CANNOT_CONVERT; + {$EXTERNALSYM DMUS_E_CONNOT_CONVERT} + +(* DMUS_E_DESCEND_CHUNK_FAIL + * + * DMUS_E_DESCEND_CHUNK_FAIL is returned when the end of the file + * was reached before the desired chunk was found. + *) + DMUS_E_DESCEND_CHUNK_FAIL = (MAKE_DMHRESULTERROR_R + $0210); + {$EXTERNALSYM DMUS_E_DESCEND_CHUNK_FAIL} + +(* DMUS_E_NOT_LOADED + * + * An attempt to use this object failed because it first needs to + * be loaded. + *) + DMUS_E_NOT_LOADED = (MAKE_DMHRESULTERROR_R + $0211); + {$EXTERNALSYM DMUS_E_NOT_LOADED} + +(* DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE + * + * The activeX scripting engine for the script's language is not compatible with + * DirectMusic. + * + *) + DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE = (MAKE_DMHRESULTERROR_R + $0213); + {$EXTERNALSYM DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE} + +(* DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE + * + * A varient was used that had a type that is not supported by DirectMusic. + * + *) + DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE = (MAKE_DMHRESULTERROR_R + $0214); + {$EXTERNALSYM DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE} + +(* DMUS_E_SCRIPT_ERROR_IN_SCRIPT + * + * An error was encountered while parsing or executing the script. + * The pErrorInfo parameter (if supplied) was filled with information about the error. + *) + DMUS_E_SCRIPT_ERROR_IN_SCRIPT = (MAKE_DMHRESULTERROR_R + $0215); + {$EXTERNALSYM DMUS_E_SCRIPT_ERROR_IN_SCRIPT} + +(* DMUS_E_SCRIPT_CANTLOAD_OLEAUT32 + * + * Loading of oleaut32.dll failed. VBScript and other activeX scripting languages + * require use of oleaut32.dll. On platforms where oleaut32.dll is not present, only + * the DirectMusicScript language, which doesn't require oleaut32.dll can be used. + *) + DMUS_E_SCRIPT_CANTLOAD_OLEAUT32 = (MAKE_DMHRESULTERROR_R + $0216); + {$EXTERNALSYM DMUS_E_SCRIPT_CANTLOAD_OLEAUT32} + +(* DMUS_E_SCRIPT_LOADSCRIPT_ERROR + * + * An error occured while parsing a script loaded using LoadScript. The script that + * was loaded contains an error. + *) + DMUS_E_SCRIPT_LOADSCRIPT_ERROR = (MAKE_DMHRESULTERROR_R + $0217); + {$EXTERNALSYM DMUS_E_SCRIPT_LOADSCRIPT_ERROR} + +(* DMUS_E_SCRIPT_INVALID_FILE + * + * The script file is invalid. + *) + DMUS_E_SCRIPT_INVALID_FILE = (MAKE_DMHRESULTERROR_R + $0218); + {$EXTERNALSYM DMUS_E_SCRIPT_INVALID_FILE} + +(* DMUS_E_INVALID_SCRIPTTRACK + * + * The file contains an invalid script track. + *) + DMUS_E_INVALID_SCRIPTTRACK = (MAKE_DMHRESULTERROR_R + $0219); + {$EXTERNALSYM DMUS_E_INVALID_SCRIPTTRACK} + +(* DMUS_E_SCRIPT_VARIABLE_NOT_FOUND + * + * The script does not contain a variable with the specified name. + *) + DMUS_E_SCRIPT_VARIABLE_NOT_FOUND = (MAKE_DMHRESULTERROR_R + $021A); + {$EXTERNALSYM DMUS_E_SCRIPT_VARIABLE_NOT_FOUND} + +(* DMUS_E_SCRIPT_ROUTINE_NOT_FOUND + * + * The script does not contain a routine with the specified name. + *) + DMUS_E_SCRIPT_ROUTINE_NOT_FOUND = (MAKE_DMHRESULTERROR_R + $021B); + {$EXTERNALSYM DMUS_E_SCRIPT_ROUTINE_NOT_FOUND} + +(* DMUS_E_SCRIPT_CONTENT_READONLY + * + * Scripts variables for content referenced or embedded in a script cannot be set. + *) + DMUS_E_SCRIPT_CONTENT_READONLY = (MAKE_DMHRESULTERROR_R + $021C); + {$EXTERNALSYM DMUS_E_SCRIPT_CONTENT_READONLY} + +(* DMUS_E_SCRIPT_NOT_A_REFERENCE + * + * Attempt was made to set a script's variable by reference to a value that was + * not an object type. + *) + DMUS_E_SCRIPT_NOT_A_REFERENCE = (MAKE_DMHRESULTERROR_R + $021D); + {$EXTERNALSYM DMUS_E_SCRIPT_NOT_A_REFERENCE} + +(* DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED + * + * Attempt was made to set a script's variable by value to an object that does + * not support a default value property. + *) + DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED = (MAKE_DMHRESULTERROR_R + $021E); + {$EXTERNALSYM DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED} + +(* DMUS_E_INVALID_SEGMENTTRIGGERTRACK + * + * The file contains an invalid segment trigger track. + *) + DMUS_E_INVALID_SEGMENTTRIGGERTRACK = (MAKE_DMHRESULTERROR_R + $0220); + {$EXTERNALSYM DMUS_E_INVALID_SEGMENTTRIGGERTRACK} + +(* DMUS_E_INVALID_LYRICSTRACK + * + * The file contains an invalid lyrics track. + *) + DMUS_E_INVALID_LYRICSTRACK = (MAKE_DMHRESULTERROR_R + $0221); + {$EXTERNALSYM DMUS_E_INVALID_LYRICSTRACK} + +(* DMUS_E_INVALID_PARAMCONTROLTRACK + * + * The file contains an invalid parameter control track. + *) + DMUS_E_INVALID_PARAMCONTROLTRACK = (MAKE_DMHRESULTERROR_R + $0222); + {$EXTERNALSYM DMUS_E_INVALID_PARAMCONTROLTRACK} + +(* DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR + * + * A script written in AudioVBScript could not be read because it contained a statement that + * is not allowed by the AudioVBScript language. + *) + DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR = (MAKE_DMHRESULTERROR_R + $0223); + {$EXTERNALSYM DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR} + +(* DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR + * + * A script routine written in AudioVBScript failed because an invalid operation occurred. For example, + * adding the number 3 to a segment object would produce this error. So would attempting to call a routine + * that doesn't exist. + *) + DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR = (MAKE_DMHRESULTERROR_R + $0224); + {$EXTERNALSYM DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR} + +(* DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE + * + * A script routine written in AudioVBScript failed because a function outside of a script failed to complete. + * For example, a call to PlaySegment that fails to play because of low memory would return this error. + *) + DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE = (MAKE_DMHRESULTERROR_R + $0225); + {$EXTERNALSYM DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE} + +(* DMUS_E_AUDIOPATHS_NOT_VALID + * + * The Performance has set up some PChannels using the AssignPChannel command, which + * makes it not capable of supporting audio paths. + *) + DMUS_E_AUDIOPATHS_NOT_VALID = (MAKE_DMHRESULTERROR_R + $0226); + {$EXTERNALSYM DMUS_E_AUDIOPATHS_NOT_VALID} + +(* DMUS_E_AUDIOPATHS_IN_USE + * + * This is the inverse of the previous error. + * The Performance has set up some audio paths, which makes is incompatible + * with the calls to allocate pchannels, etc. + *) + DMUS_E_AUDIOPATHS_IN_USE = (MAKE_DMHRESULTERROR_R + $0227); + {$EXTERNALSYM DMUS_E_AUDIOPATHS_IN_USE} + +(* DMUS_E_NO_AUDIOPATH_CONFIG + * + * A segment was asked for its embedded audio path configuration, + * but there isn't any. + *) + DMUS_E_NO_AUDIOPATH_CONFIG = (MAKE_DMHRESULTERROR_R + $0228); + {$EXTERNALSYM DMUS_E_NO_AUDIOPATH_CONFIG} + +(* DMUS_E_AUDIOPATH_INACTIVE + * + * An audiopath is inactive, perhaps because closedown was called. + *) + DMUS_E_AUDIOPATH_INACTIVE = (MAKE_DMHRESULTERROR_R + $0229); + {$EXTERNALSYM DMUS_E_AUDIOPATH_INACTIVE} + +(* DMUS_E_AUDIOPATH_NOBUFFER + * + * An audiopath failed to create because a requested buffer could not be created. + *) + DMUS_E_AUDIOPATH_NOBUFFER = (MAKE_DMHRESULTERROR_R + $022A); + {$EXTERNALSYM DMUS_E_AUDIOPATH_NOBUFFER} + +(* DMUS_E_AUDIOPATH_NOPORT + * + * An audiopath could not be used for playback because it lacked port assignments. + *) + DMUS_E_AUDIOPATH_NOPORT = (MAKE_DMHRESULTERROR_R + $022B); + {$EXTERNALSYM DMUS_E_AUDIOPATH_NOPORT} + +(* DMUS_E_NO_AUDIOPATH + * + * Attempt was made to play segment in audiopath mode and there was no audiopath. + *) + DMUS_E_NO_AUDIOPATH = (MAKE_DMHRESULTERROR_R + $022C); + {$EXTERNALSYM DMUS_E_NO_AUDIOPATH} + +(* DMUS_E_INVALIDCHUNK + * + * Invalid data was found in a RIFF file chunk. + *) + DMUS_E_INVALIDCHUNK = (MAKE_DMHRESULTERROR_R + $022D); + {$EXTERNALSYM DMUS_E_INVALIDCHUNK} + +(* DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER + * + * Attempt was made to create an audiopath that sends to a global effects buffer which did not exist. + *) + DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER = (MAKE_DMHRESULTERROR_R + $022E); + {$EXTERNALSYM DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER} + +(* DMUS_E_INVALID_CONTAINER_OBJECT + * + * The file does not contain a valid container object. + *) + DMUS_E_INVALID_CONTAINER_OBJECT = (MAKE_DMHRESULTERROR_R + $022F); + {$EXTERNALSYM DMUS_E_INVALID_CONTAINER_OBJECT} + + + + + +(************************************************************************ +* * +* dmusicc.h -- This module defines the DirectMusic core API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************) + +type + SAMPLE_TIME = Int64; + {$EXTERNALSYM SAMPLE_TIME} + TSampleTime = SAMPLE_TIME; + PSampleTime = ^TSampleTime; + + SAMPLE_POSITION = Int64; + {$EXTERNALSYM SAMPLE_POSITION} + TSamplePosition = SAMPLE_POSITION; + PSamplePosition = ^TSamplePosition; + +const + DMUS_MAX_DESCRIPTION = 128; + {$EXTERNALSYM DMUS_MAX_DESCRIPTION} + DMUS_MAX_DRIVER = 128; + {$EXTERNALSYM DMUS_MAX_DRIVER} + +type + PDMusBufferDesc = ^TDMusBufferDesc; + _DMUS_BUFFERDESC = packed record + dwSize: DWORD; + dwFlags: DWORD; + guidBufferFormat: TGUID; + cbBuffer: DWORD; + end; + {$EXTERNALSYM _DMUS_BUFFERDESC} + DMUS_BUFFERDESC = _DMUS_BUFFERDESC; + {$EXTERNALSYM DMUS_BUFFERDESC} + TDMusBufferDesc = _DMUS_BUFFERDESC; + +const +(* DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS + * and DMUS_PORTPARAMS. + *) + DMUS_EFFECT_NONE = $00000000; + {$EXTERNALSYM DMUS_EFFECT_NONE} + DMUS_EFFECT_REVERB = $00000001; + {$EXTERNALSYM DMUS_EFFECT_REVERB} + DMUS_EFFECT_CHORUS = $00000002; + {$EXTERNALSYM DMUS_EFFECT_CHORUS} + DMUS_EFFECT_DELAY = $00000004; + {$EXTERNALSYM DMUS_EFFECT_DELAY} + +(* For DMUS_PORTCAPS dwClass + *) + DMUS_PC_INPUTCLASS = (0); + {$EXTERNALSYM DMUS_PC_INPUTCLASS} + DMUS_PC_OUTPUTCLASS = (1); + {$EXTERNALSYM DMUS_PC_OUTPUTCLASS} + +(* For DMUS_PORTCAPS dwFlags + *) + DMUS_PC_DLS = ($00000001); // Supports DLS downloading and DLS level 1. + {$EXTERNALSYM DMUS_PC_DLS} + DMUS_PC_EXTERNAL = ($00000002); // External MIDI module. + {$EXTERNALSYM DMUS_PC_EXTERNAL} + DMUS_PC_SOFTWARESYNTH = ($00000004); // Software synthesizer. + {$EXTERNALSYM DMUS_PC_SOFTWARESYNTH} + DMUS_PC_MEMORYSIZEFIXED = ($00000008); // Memory size is fixed. + {$EXTERNALSYM DMUS_PC_MEMORYSIZEFIXED} + DMUS_PC_GMINHARDWARE = ($00000010); // GM sound set is built in, no need to download. + {$EXTERNALSYM DMUS_PC_GMINHARDWARE} + DMUS_PC_GSINHARDWARE = ($00000020); // GS sound set is built in. + {$EXTERNALSYM DMUS_PC_GSINHARDWARE} + DMUS_PC_XGINHARDWARE = ($00000040); // XG sound set is built in. + {$EXTERNALSYM DMUS_PC_XGINHARDWARE} + DMUS_PC_DIRECTSOUND = ($00000080); // Connects to DirectSound via a DSound buffer. + {$EXTERNALSYM DMUS_PC_DIRECTSOUND} + DMUS_PC_SHAREABLE = ($00000100); // Synth can be actively shared by multiple apps at once. + {$EXTERNALSYM DMUS_PC_SHAREABLE} + DMUS_PC_DLS2 = ($00000200); // Supports DLS2 instruments. + {$EXTERNALSYM DMUS_PC_DLS2} + DMUS_PC_AUDIOPATH = ($00000400); // Multiple outputs can be connected to DirectSound for audiopaths. + {$EXTERNALSYM DMUS_PC_AUDIOPATH} + DMUS_PC_WAVE = ($00000800); // Supports streaming and one shot waves. + {$EXTERNALSYM DMUS_PC_WAVE} + + DMUS_PC_SYSTEMMEMORY = ($7FFFFFFF); // Sample memory is system memory. + {$EXTERNALSYM DMUS_PC_SYSTEMMEMORY} + + +type + PDMusPortCaps = ^TDMusPortCaps; + _DMUS_PORTCAPS = packed record + dwSize: DWORD; + dwFlags: DWORD; + guidPort: TGUID; + dwClass: DWORD; + dwType: DWORD; + dwMemorySize: DWORD; + dwMaxChannelGroups: DWORD; + dwMaxVoices: DWORD; + dwMaxAudioChannels: DWORD; + dwEffectFlags: DWORD; + wszDescription: array[0..DMUS_MAX_DESCRIPTION-1] of WideChar; + end; + {$EXTERNALSYM _DMUS_PORTCAPS} + DMUS_PORTCAPS = _DMUS_PORTCAPS; + {$EXTERNALSYM DMUS_PORTCAPS} + TDMusPortCaps = _DMUS_PORTCAPS; + +const +(* Values for DMUS_PORTCAPS dwType. This field indicates the underlying + * driver type of the port. + *) + DMUS_PORT_WINMM_DRIVER = (0); + {$EXTERNALSYM DMUS_PORT_WINMM_DRIVER} + DMUS_PORT_USER_MODE_SYNTH = (1); + {$EXTERNALSYM DMUS_PORT_USER_MODE_SYNTH} + DMUS_PORT_KERNEL_MODE = (2); + {$EXTERNALSYM DMUS_PORT_KERNEL_MODE} + +// These flags (set in dwValidParams) indicate which other members of the +// DMUS_PORTPARAMS are valid. +// + DMUS_PORTPARAMS_VOICES = $00000001; + {$EXTERNALSYM DMUS_PORTPARAMS_VOICES} + DMUS_PORTPARAMS_CHANNELGROUPS = $00000002; + {$EXTERNALSYM DMUS_PORTPARAMS_CHANNELGROUPS} + DMUS_PORTPARAMS_AUDIOCHANNELS = $00000004; + {$EXTERNALSYM DMUS_PORTPARAMS_AUDIOCHANNELS} + DMUS_PORTPARAMS_SAMPLERATE = $00000008; + {$EXTERNALSYM DMUS_PORTPARAMS_SAMPLERATE} + DMUS_PORTPARAMS_EFFECTS = $00000020; + {$EXTERNALSYM DMUS_PORTPARAMS_EFFECTS} + DMUS_PORTPARAMS_SHARE = $00000040; + {$EXTERNALSYM DMUS_PORTPARAMS_SHARE} + DMUS_PORTPARAMS_FEATURES = $00000080; // DirectX 8.0 and above + {$EXTERNALSYM DMUS_PORTPARAMS_FEATURES} + +type + PDMusPortParams7 = ^TDMusPortParams7; + _DMUS_PORTPARAMS = packed record + dwSize: DWORD; + dwValidParams: DWORD; + dwVoices: DWORD; + dwChannelGroups: DWORD; + dwAudioChannels: DWORD; + dwSampleRate: DWORD; + dwEffectFlags: DWORD; + fShare: BOOL; + end; + {$EXTERNALSYM _DMUS_PORTPARAMS} + DMUS_PORTPARAMS7 = _DMUS_PORTPARAMS; + {$EXTERNALSYM DMUS_PORTPARAMS7} + TDMusPortParams7 = _DMUS_PORTPARAMS; + + PDMusPortParams8 = ^TDMusPortParams8; + _DMUS_PORTPARAMS8 = packed record + dwSize: DWORD; + dwValidParams: DWORD; + dwVoices: DWORD; + dwChannelGroups: DWORD; + dwAudioChannels: DWORD; + dwSampleRate: DWORD; + dwEffectFlags: DWORD; + fShare: BOOL; + dwFeatures: DWORD; + end; + {$EXTERNALSYM _DMUS_PORTPARAMS8} + DMUS_PORTPARAMS8 = _DMUS_PORTPARAMS8; + {$EXTERNALSYM DMUS_PORTPARAMS8} + TDMusPortParams8 = _DMUS_PORTPARAMS8; + +const + DMUS_PORT_FEATURE_AUDIOPATH = $00000001; // Supports audiopath connection to DSound buffers. + {$EXTERNALSYM DMUS_PORT_FEATURE_AUDIOPATH} + DMUS_PORT_FEATURE_STREAMING = $00000002; // Supports streaming waves through the synth. + {$EXTERNALSYM DMUS_PORT_FEATURE_STREAMING} + + +type + DMUS_PORTPARAMS = DMUS_PORTPARAMS8; + {$EXTERNALSYM DMUS_PORTPARAMS} + TDMusPortParams = DMUS_PORTPARAMS; + PDMusPortParams = PDMusPortParams8; + + PDMusSynthStats = ^TDMusSynthStats; + _DMUS_SYNTHSTATS = packed record + dwSize: DWORD; (* Size in bytes of the structure *) + dwValidStats: DWORD; (* Flags indicating which fields below are valid. *) + dwVoices: DWORD; (* Average number of voices playing. *) + dwTotalCPU: DWORD; (* Total CPU usage as percent * 100. *) + dwCPUPerVoice: DWORD; (* CPU per voice as percent * 100. *) + dwLostNotes: DWORD; (* Number of notes lost in 1 second. *) + dwFreeMemory: DWORD; (* Free memory in bytes *) + lPeakVolume: Longint; (* Decibel level * 100. *) + end; + {$EXTERNALSYM _DMUS_SYNTHSTATS} + DMUS_SYNTHSTATS = _DMUS_SYNTHSTATS; + {$EXTERNALSYM DMUS_SYNTHSTATS} + TDMusSynthStats = _DMUS_SYNTHSTATS; + + PDMusSynthStats8 = ^TDMusSynthStats8; + _DMUS_SYNTHSTATS8 = packed record + dwSize: DWORD; (* Size in bytes of the structure *) + dwValidStats: DWORD; (* Flags indicating which fields below are valid. *) + dwVoices: DWORD; (* Average number of voices playing. *) + dwTotalCPU: DWORD; (* Total CPU usage as percent * 100. *) + dwCPUPerVoice: DWORD; (* CPU per voice as percent * 100. *) + dwLostNotes: DWORD; (* Number of notes lost in 1 second. *) + dwFreeMemory: DWORD; (* Free memory in bytes *) + lPeakVolume: Longint; (* Decibel level * 100. *) + dwSynthMemUse: DWORD; (* Memory used by synth wave data *) + end; + {$EXTERNALSYM _DMUS_SYNTHSTATS8} + DMUS_SYNTHSTATS8 = _DMUS_SYNTHSTATS8; + {$EXTERNALSYM DMUS_SYNTHSTATS8} + TDMusSynthStats8 = _DMUS_SYNTHSTATS8; + +const + DMUS_SYNTHSTATS_VOICES = (1 shl 0); + {$EXTERNALSYM DMUS_SYNTHSTATS_VOICES} + DMUS_SYNTHSTATS_TOTAL_CPU = (1 shl 1); + {$EXTERNALSYM DMUS_SYNTHSTATS_TOTAL_CPU} + DMUS_SYNTHSTATS_CPU_PER_VOICE = (1 shl 2); + {$EXTERNALSYM DMUS_SYNTHSTATS_CPU_PER_VOICE} + DMUS_SYNTHSTATS_LOST_NOTES = (1 shl 3); + {$EXTERNALSYM DMUS_SYNTHSTATS_LOST_NOTES} + DMUS_SYNTHSTATS_PEAK_VOLUME = (1 shl 4); + {$EXTERNALSYM DMUS_SYNTHSTATS_PEAK_VOLUME} + DMUS_SYNTHSTATS_FREE_MEMORY = (1 shl 5); + {$EXTERNALSYM DMUS_SYNTHSTATS_FREE_MEMORY} + + DMUS_SYNTHSTATS_SYSTEMMEMORY = DMUS_PC_SYSTEMMEMORY; + {$EXTERNALSYM DMUS_SYNTHSTATS_SYSTEMMEMORY} + +type + PDMusWavesReverbParams = ^TDMusWavesReverbParams; + _DMUS_WAVES_REVERB_PARAMS = packed record + fInGain: Single; (* Input gain in dB (to avoid output overflows) *) + fReverbMix: Single; (* Reverb mix in dB. 0dB means 100% wet reverb (no direct signal) + Negative values gives less wet signal. + The coeficients are calculated so that the overall output level stays + (approximately) constant regardless of the ammount of reverb mix. *) + fReverbTime: Single; (* The reverb decay time, in milliseconds. *) + fHighFreqRTRatio: Single; (* The ratio of the high frequencies to the global reverb time. + Unless very 'splashy-bright' reverbs are wanted, this should be set to + a value < 1.0. + For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the + decay time for high frequencies will be 100ms.*) + end; + {$EXTERNALSYM _DMUS_WAVES_REVERB_PARAMS} + DMUS_WAVES_REVERB_PARAMS = _DMUS_WAVES_REVERB_PARAMS; + {$EXTERNALSYM DMUS_WAVES_REVERB_PARAMS} + TDMusWavesReverbParams = _DMUS_WAVES_REVERB_PARAMS; + +(* Note: Default values for Reverb are: + fInGain = 0.0dB (no change in level) + fReverbMix = -10.0dB (a reasonable reverb mix) + fReverbTime = 1000.0ms (one second global reverb time) + fHighFreqRTRatio = 0.001 (the ratio of the high frequencies to the global reverb time) +*) + + DMUS_CLOCKTYPE = ( + DMUS_CLOCK_SYSTEM {= 0}, + DMUS_CLOCK_WAVE {= 1} + ); + {$EXTERNALSYM DMUS_CLOCKTYPE} + TDMusClockType = DMUS_CLOCKTYPE; + +const + DMUS_CLOCKF_GLOBAL = $00000001; + {$EXTERNALSYM DMUS_CLOCKF_GLOBAL} + +type + PDMusClockInfo7 = ^TDMusClockInfo7; + _DMUS_CLOCKINFO7 = packed record + dwSize: DWORD; + ctType: TDMusClockType; + guidClock: TGUID; // Identifies this time source + wszDescription: array[0..DMUS_MAX_DESCRIPTION-1] of WideChar; + end; + {$EXTERNALSYM _DMUS_CLOCKINFO7} + DMUS_CLOCKINFO7 = _DMUS_CLOCKINFO7; + {$EXTERNALSYM DMUS_CLOCKINFO7} + TDMusClockInfo7 = _DMUS_CLOCKINFO7; + + PDMusClockInfo8 = ^TDMusClockInfo8; + _DMUS_CLOCKINFO8 = packed record + dwSize: DWORD; + ctType: TDMusClockType; + guidClock: TGUID; // Identifies this time source + wszDescription: array[0..DMUS_MAX_DESCRIPTION-1] of WideChar; + dwFlags: DWORD; + end; + {$EXTERNALSYM _DMUS_CLOCKINFO8} + DMUS_CLOCKINFO8 = _DMUS_CLOCKINFO8; + {$EXTERNALSYM DMUS_CLOCKINFO8} + TDMusClockInfo8 = _DMUS_CLOCKINFO8; + + + DMUS_CLOCKINFO = DMUS_CLOCKINFO8; + {$EXTERNALSYM DMUS_CLOCKINFO} + TDMusClockInfo = DMUS_CLOCKINFO; + PDMusClockInfo = PDMusClockInfo8; + +const +(* Default bus identifiers + * + * The first 17 are direct mappings to the destinations defined in both + * the MMA DLS Level 2 specification and the Microsoft Multi-Channel audio + * specification. + *) + DSBUSID_FIRST_SPKR_LOC = 0; + {$EXTERNALSYM DSBUSID_FIRST_SPKR_LOC} + DSBUSID_FRONT_LEFT = 0; + {$EXTERNALSYM DSBUSID_FRONT_LEFT} + DSBUSID_LEFT = 0; // Front left is also just left + {$EXTERNALSYM DSBUSID_LEFT} + DSBUSID_FRONT_RIGHT = 1; + {$EXTERNALSYM DSBUSID_FRONT_RIGHT} + DSBUSID_RIGHT = 1; // Ditto front right + {$EXTERNALSYM DSBUSID_RIGHT} + DSBUSID_FRONT_CENTER = 2; + {$EXTERNALSYM DSBUSID_FRONT_CENTER} + DSBUSID_LOW_FREQUENCY = 3; + {$EXTERNALSYM DSBUSID_LOW_FREQUENCY} + DSBUSID_BACK_LEFT = 4; + {$EXTERNALSYM DSBUSID_BACK_LEFT} + DSBUSID_BACK_RIGHT = 5; + {$EXTERNALSYM DSBUSID_BACK_RIGHT} + DSBUSID_FRONT_LEFT_OF_CENTER = 6; + {$EXTERNALSYM DSBUSID_FRONT_LEFT_OF_CENTER} + DSBUSID_FRONT_RIGHT_OF_CENTER = 7; + {$EXTERNALSYM DSBUSID_FRONT_RIGHT_OF_CENTER} + DSBUSID_BACK_CENTER = 8; + {$EXTERNALSYM DSBUSID_BACK_CENTER} + DSBUSID_SIDE_LEFT = 9; + {$EXTERNALSYM DSBUSID_SIDE_LEFT} + DSBUSID_SIDE_RIGHT = 10; + {$EXTERNALSYM DSBUSID_SIDE_RIGHT} + DSBUSID_TOP_CENTER = 11; + {$EXTERNALSYM DSBUSID_TOP_CENTER} + DSBUSID_TOP_FRONT_LEFT = 12; + {$EXTERNALSYM DSBUSID_TOP_FRONT_LEFT} + DSBUSID_TOP_FRONT_CENTER = 13; + {$EXTERNALSYM DSBUSID_TOP_FRONT_CENTER} + DSBUSID_TOP_FRONT_RIGHT = 14; + {$EXTERNALSYM DSBUSID_TOP_FRONT_RIGHT} + DSBUSID_TOP_BACK_LEFT = 15; + {$EXTERNALSYM DSBUSID_TOP_BACK_LEFT} + DSBUSID_TOP_BACK_CENTER = 16; + {$EXTERNALSYM DSBUSID_TOP_BACK_CENTER} + DSBUSID_TOP_BACK_RIGHT = 17; + {$EXTERNALSYM DSBUSID_TOP_BACK_RIGHT} + DSBUSID_LAST_SPKR_LOC = 17; + {$EXTERNALSYM DSBUSID_LAST_SPKR_LOC} + +// #define DSBUSID_IS_SPKR_LOC(id) ( ((id) >= DSBUSID_FIRST_SPKR_LOC) && ((id) <= DSBUSID_LAST_SPKR_LOC) ) +function DSBUSID_IS_SPKR_LOC(id: Integer): Boolean; +{$EXTERNALSYM DSBUSID_IS_SPKR_LOC} + +const +(* These bus identifiers are for the standard DLS effect sends + *) + DSBUSID_REVERB_SEND = 64; + {$EXTERNALSYM DSBUSID_REVERB_SEND} + DSBUSID_CHORUS_SEND = 65; + {$EXTERNALSYM DSBUSID_CHORUS_SEND} + +(* Dynamic bus identifiers start here. See the documentation for how + * synthesizers map the output of voices to static and dynamic + * bus identifiers. + *) + DSBUSID_DYNAMIC_0 = 512; + {$EXTERNALSYM DSBUSID_DYNAMIC_0} + +(* Null bus, used to identify busses that have no function mapping. +*) + DSBUSID_NULL = $FFFFFFFF; + {$EXTERNALSYM DSBUSID_NULL} + + +(* Standard values for voice priorities. Numerically higher priorities are higher in priority. + * These priorities are used to set the voice priority for all voices on a channel. They are + * used in the dwPriority parameter of IDirectMusicPort::GetPriority and returned in the + * lpwPriority parameter of pdwPriority. + * + * These priorities are shared with DirectSound. + *) + +const + DAUD_CRITICAL_VOICE_PRIORITY = ($F0000000); + {$EXTERNALSYM DAUD_CRITICAL_VOICE_PRIORITY} + DAUD_HIGH_VOICE_PRIORITY = ($C0000000); + {$EXTERNALSYM DAUD_HIGH_VOICE_PRIORITY} + DAUD_STANDARD_VOICE_PRIORITY = ($80000000); + {$EXTERNALSYM DAUD_STANDARD_VOICE_PRIORITY} + DAUD_LOW_VOICE_PRIORITY = ($40000000); + {$EXTERNALSYM DAUD_LOW_VOICE_PRIORITY} + DAUD_PERSIST_VOICE_PRIORITY = ($10000000); + {$EXTERNALSYM DAUD_PERSIST_VOICE_PRIORITY} + +(* These are the default priorities assigned if not overridden. By default priorities are + * equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as + * channel 5 on channel group 2). + * + * In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16 + * except for 10. + *) + DAUD_CHAN1_VOICE_PRIORITY_OFFSET = ($0000000E); + {$EXTERNALSYM DAUD_CHAN1_VOICE_PRIORITY_OFFSET} + DAUD_CHAN2_VOICE_PRIORITY_OFFSET = ($0000000D); + {$EXTERNALSYM DAUD_CHAN2_VOICE_PRIORITY_OFFSET} + DAUD_CHAN3_VOICE_PRIORITY_OFFSET = ($0000000C); + {$EXTERNALSYM DAUD_CHAN3_VOICE_PRIORITY_OFFSET} + DAUD_CHAN4_VOICE_PRIORITY_OFFSET = ($0000000B); + {$EXTERNALSYM DAUD_CHAN4_VOICE_PRIORITY_OFFSET} + DAUD_CHAN5_VOICE_PRIORITY_OFFSET = ($0000000A); + {$EXTERNALSYM DAUD_CHAN5_VOICE_PRIORITY_OFFSET} + DAUD_CHAN6_VOICE_PRIORITY_OFFSET = ($00000009); + {$EXTERNALSYM DAUD_CHAN6_VOICE_PRIORITY_OFFSET} + DAUD_CHAN7_VOICE_PRIORITY_OFFSET = ($00000008); + {$EXTERNALSYM DAUD_CHAN7_VOICE_PRIORITY_OFFSET} + DAUD_CHAN8_VOICE_PRIORITY_OFFSET = ($00000007); + {$EXTERNALSYM DAUD_CHAN8_VOICE_PRIORITY_OFFSET} + DAUD_CHAN9_VOICE_PRIORITY_OFFSET = ($00000006); + {$EXTERNALSYM DAUD_CHAN9_VOICE_PRIORITY_OFFSET} + DAUD_CHAN10_VOICE_PRIORITY_OFFSET = ($0000000F); + {$EXTERNALSYM DAUD_CHAN10_VOICE_PRIORITY_OFFSET} + DAUD_CHAN11_VOICE_PRIORITY_OFFSET = ($00000005); + {$EXTERNALSYM DAUD_CHAN11_VOICE_PRIORITY_OFFSET} + DAUD_CHAN12_VOICE_PRIORITY_OFFSET = ($00000004); + {$EXTERNALSYM DAUD_CHAN12_VOICE_PRIORITY_OFFSET} + DAUD_CHAN13_VOICE_PRIORITY_OFFSET = ($00000003); + {$EXTERNALSYM DAUD_CHAN13_VOICE_PRIORITY_OFFSET} + DAUD_CHAN14_VOICE_PRIORITY_OFFSET = ($00000002); + {$EXTERNALSYM DAUD_CHAN14_VOICE_PRIORITY_OFFSET} + DAUD_CHAN15_VOICE_PRIORITY_OFFSET = ($00000001); + {$EXTERNALSYM DAUD_CHAN15_VOICE_PRIORITY_OFFSET} + DAUD_CHAN16_VOICE_PRIORITY_OFFSET = ($00000000); + {$EXTERNALSYM DAUD_CHAN16_VOICE_PRIORITY_OFFSET} + + + DAUD_CHAN1_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN1_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN1_DEF_VOICE_PRIORITY} + DAUD_CHAN2_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN2_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN2_DEF_VOICE_PRIORITY} + DAUD_CHAN3_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN3_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN3_DEF_VOICE_PRIORITY} + DAUD_CHAN4_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN4_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN4_DEF_VOICE_PRIORITY} + DAUD_CHAN5_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN5_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN5_DEF_VOICE_PRIORITY} + DAUD_CHAN6_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN6_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN6_DEF_VOICE_PRIORITY} + DAUD_CHAN7_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN7_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN7_DEF_VOICE_PRIORITY} + DAUD_CHAN8_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN8_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN8_DEF_VOICE_PRIORITY} + DAUD_CHAN9_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN9_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN9_DEF_VOICE_PRIORITY} + DAUD_CHAN10_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN10_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN10_DEF_VOICE_PRIORITY} + DAUD_CHAN11_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN11_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN11_DEF_VOICE_PRIORITY} + DAUD_CHAN12_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN12_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN12_DEF_VOICE_PRIORITY} + DAUD_CHAN13_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN13_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN13_DEF_VOICE_PRIORITY} + DAUD_CHAN14_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN14_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN14_DEF_VOICE_PRIORITY} + DAUD_CHAN15_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN15_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN15_DEF_VOICE_PRIORITY} + DAUD_CHAN16_DEF_VOICE_PRIORITY = (DAUD_STANDARD_VOICE_PRIORITY or DAUD_CHAN16_VOICE_PRIORITY_OFFSET); + {$EXTERNALSYM DAUD_CHAN16_DEF_VOICE_PRIORITY} + +type + IDirectMusicBuffer = interface; + IDirectMusicPort = interface; + + PIReferenceClock = ^IReferenceClock; + PIDirectSound = ^IDirectSound; + + PIDirectMusic = ^IDirectMusic; + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusic);'} + {$EXTERNALSYM IDirectMusic} + IDirectMusic = interface(IUnknown) + ['{6536115a-7b2d-11d2-ba18-0000f875ac12}'] + (* IDirectMusic *) + function EnumPort(dwIndex: DWORD; var pPortCaps: TDMusPortCaps): HResult; stdcall; + function CreateMusicBuffer(var pBufferDesc: TDMusBufferDesc; + out ppBuffer: IDirectMusicBuffer; pUnkOuter: IUnknown): HResult; stdcall; + function CreatePort(const rclsidPort: TGUID; const pPortParams: TDMusPortParams; + out ppPort: IDirectMusicPort; pUnkOuter: IUnknown): HResult; stdcall; + function EnumMasterClock(dwIndex: DWORD; var lpClockInfo: TDMusClockInfo): HResult; stdcall; + function GetMasterClock(pguidClock: PGUID; ppReferenceClock: PIReferenceClock): HResult; stdcall; + function SetMasterClock(const rguidClock: TGUID): HResult; stdcall; + function Activate(fEnable: BOOL): HResult; stdcall; + function GetDefaultPort(out pguidPort: TGUID): HResult; stdcall; + function SetDirectSound(pDirectSound: IDirectSound; hWnd: HWND): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusic8);'} + {$EXTERNALSYM IDirectMusic8} + IDirectMusic8 = interface(IDirectMusic) + ['{2d3629f7-813d-4939-8508-f05c6b75fd97}'] + (* IDirectMusic8 *) + function SetExternalMasterClock(pClock: IReferenceClock): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicBuffer);'} + {$EXTERNALSYM IDirectMusicBuffer} + IDirectMusicBuffer = interface(IUnknown) + ['{d2ac2878-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicBuffer *) + function Flush: HResult; stdcall; + function TotalTime(out prtTime: TReferenceTime): HResult; stdcall; + function PackStructured(const rt: TReferenceTime; dwChannelGroup: DWORD; + dwChannelMessage: DWORD): HResult; stdcall; + function PackUnstructured(const rt: TReferenceTime; dwChannelGroup: DWORD; + cb: DWORD; const lpb): HResult; stdcall; + function ResetReadPtr : HResult; stdcall; + function GetNextEvent(out prt: TReferenceTime; out pdwChannelGroup: DWORD; + out pdwLength: DWORD; out ppData: Pointer): HResult; stdcall; + function GetRawBufferPtr(out ppData: Pointer): HResult; stdcall; + function GetStartTime(out prt: TReferenceTime): HResult; stdcall; + function GetUsedBytes(out pcb: DWORD): HResult; stdcall; + function GetMaxBytes(out pcb: DWORD): HResult; stdcall; + function GetBufferFormat(out pGuidFormat: TGUID): HResult; stdcall; + function SetStartTime(const rt: TReferenceTime): HResult; stdcall; + function SetUsedBytes(cb: DWORD): HResult; stdcall; + end; + + IDirectMusicBuffer8 = IDirectMusicBuffer; + {$NODEFINE IDirectMusicBuffer8} + {$HPPEMIT 'typedef _di_IDirectMusicBuffer _di_IDirectMusicBuffer8;'} + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicInstrument);'} + {$EXTERNALSYM IDirectMusicInstrument} + IDirectMusicInstrument = interface(IUnknown) + ['{d2ac287d-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicInstrument *) + function GetPatch(out pdwPatch: DWORD): HResult; stdcall; + function SetPatch(dwPatch: DWORD): HResult; stdcall; + end; + + IDirectMusicInstrument8 = IDirectMusicInstrument; + {$NODEFINE IDirectMusicInstrument8} + {$HPPEMIT 'typedef _di_IDirectMusicInstrument _di_IDirectMusicInstrument8;'} + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicDownloadedInstrument);'} + {$EXTERNALSYM IDirectMusicDownloadedInstrument} + IDirectMusicDownloadedInstrument = interface(IUnknown) + ['{d2ac287e-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicDownloadedInstrument *) + (* None at this time *) + end; + + IDirectMusicDownloadedInstrument8 = IDirectMusicDownloadedInstrument; + {$NODEFINE IDirectMusicDownloadedInstrument8} + {$HPPEMIT 'typedef _di_IDirectMusicDownloadedInstrument _di_IDirectMusicDownloadedInstrument8;'} + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicCollection);'} + {$EXTERNALSYM IDirectMusicCollection} + IDirectMusicCollection = interface(IUnknown) + ['{d2ac287c-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicCollection *) + function GetInstrument(dwPatch: DWORD; out ppInstrument: IDirectMusicInstrument): HResult; stdcall; + function EnumInstrument(dwIndex: DWORD; out pdwPatch: DWORD; + pwszName: PWideChar; dwNameLen: DWORD): HResult; stdcall; + end; + + IDirectMusicCollection8 = IDirectMusicCollection; + {$NODEFINE IDirectMusicCollection8} + {$HPPEMIT 'typedef _di_IDirectMusicCollection _di_IDirectMusicCollection8;'} + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicDownload);'} + {$EXTERNALSYM IDirectMusicDownload} + IDirectMusicDownload = interface(IUnknown) + ['{d2ac287b-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicDownload *) + function GetBuffer(out ppvBuffer: Pointer; out pdwSize: DWORD): HResult; stdcall; + end; + + IDirectMusicDownload8 = IDirectMusicDownload; + {$NODEFINE IDirectMusicDownload8} + {$HPPEMIT 'typedef _di_IDirectMusicDownload _di_IDirectMusicDownload8;'} + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicPortDownload);'} + {$EXTERNALSYM IDirectMusicPortDownload} + IDirectMusicPortDownload = interface(IUnknown) + ['{d2ac287a-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicPortDownload *) + function GetBuffer(dwDLId: DWORD; out ppIDMDownload: IDirectMusicDownload): HResult; stdcall; + function AllocateBuffer(dwSize: DWORD; out ppIDMDownload: IDirectMusicDownload): HResult; stdcall; + function GetDLId(out pdwStartDLId: DWORD; dwCount: DWORD): HResult; stdcall; + function GetAppend(out pdwAppend: DWORD): HResult; stdcall; + function Download(pIDMDownload: IDirectMusicDownload): HResult; stdcall; + function Unload(pIDMDownload: IDirectMusicDownload): HResult; stdcall; + end; + + IDirectMusicPortDownload8 = IDirectMusicPortDownload; + {$NODEFINE IDirectMusicPortDownload8} + {$HPPEMIT 'typedef _di_IDirectMusicPortDownload _di_IDirectMusicPortDownload8;'} + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicPort);'} + {$EXTERNALSYM IDirectMusicPort} + IDirectMusicPort = interface(IUnknown) + ['{08f2d8c9-37c2-11d2-b9f9-0000f875ac12}'] + (* IDirectMusicPort *) + function PlayBuffer(pBuffer: IDirectMusicBuffer): HResult; stdcall; + function SetReadNotificationHandle(hEvent: THANDLE): HResult; stdcall; + function Read(pBuffer: IDirectMusicBuffer): HResult; stdcall; + function DownloadInstrument(pInstrument: IDirectMusicInstrument; + out ppDownloadedInstrument: IDirectMusicDownloadedInstrument; + pNoteRanges: PDMusNoteRange; dwNumNoteRanges: DWORD): HResult; stdcall; + function UnloadInstrument(pDownloadedInstrument: IDirectMusicDownloadedInstrument): HResult; stdcall; + function GetLatencyClock(out ppClock: IReferenceClock): HResult; stdcall; + function GetRunningStats(var pStats: TDMusSynthStats): HResult; stdcall; + function Compact: HResult; stdcall; + function GetCaps(var pPortCaps: TDMusPortCaps): HResult; stdcall; + function DeviceIoControl(dwIoControlCode: DWORD; const lpInBuffer; nInBufferSize: DWORD; + out lpOutBuffer; nOutBufferSize: DWORD; out lpBytesReturned: DWORD; + var lpOverlapped: TOVERLAPPED): HResult; stdcall; + function SetNumChannelGroups(dwChannelGroups: DWORD): HResult; stdcall; + function GetNumChannelGroups(out pdwChannelGroups: DWORD): HResult; stdcall; + function Activate(fActive: BOOL): HResult; stdcall; + function SetChannelPriority(dwChannelGroup, dwChannel, dwPriority: DWORD): HResult; stdcall; + function GetChannelPriority(dwChannelGroup, dwChannel: DWORD; out pdwPriority: DWORD): HResult; stdcall; + function SetDirectSound(pDirectSound: IDirectSound; pDirectSoundBuffer: IDirectSoundBuffer): HResult; stdcall; + function GetFormat(pWaveFormatEx: PWaveFormatEx; var pdwWaveFormatExSize: DWORD; + out pdwBufferSize: DWORD): HResult; stdcall; + end; + + IDirectMusicPort8 = IDirectMusicPort; + {$NODEFINE IDirectMusicPort8} + {$HPPEMIT 'typedef _di_IDirectMusicPort _di_IDirectMusicPort8;'} + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicThru);'} + {$EXTERNALSYM IDirectMusicThru} + IDirectMusicThru = interface(IUnknown) + ['{ced153e7-3606-11d2-b9f9-0000f875ac12}'] + (* IDirectMusicThru *) + function ThruChannel(dwSourceChannelGroup, dwSourceChannel, dwDestinationChannelGroup, + dwDestinationChannel: DWORD; pDestinationPort: IDirectMusicPort): HResult; stdcall; + end; + + IDirectMusicThru8 = IDirectMusicThru; + {$NODEFINE IDirectMusicThru8} + {$HPPEMIT 'typedef _di_IDirectMusicThru _di_IDirectMusicThru8;'} + +//Translator: IReferenceClock is already defined in DirectSound.pas + IReferenceClock = DirectSound.IReferenceClock; + {$NODEFINE IReferenceClock} +(* + IReferenceClock = interface(IUnknown) + ['{56a86897-0ad4-11ce-b03a-0020af0ba770}'] *) { + (* IReferenceClock *) + + (* get the time now *) + function GetTime(out pTime: TReferenceTime): HResult; stdcall; + + (* ask for an async notification that a time has elapsed *) + function AdviseTime(const baseTime, (* base time *) + streamTime: TReferenceTime; (* stream offset time *) + hEvent: THANDLE; (* advise via this event *) + var pdwAdviseCookie: DWORD): HResult; stdcall; (* where your cookie goes *) + + (* ask for an async periodic notification that a time has elapsed *) + function AdvisePeriodic(const startTime, (* starting at this time *) + periodTime: TReferenceTime; (* time between notifications *) + hSemaphore: THANDLE; (* advise via a semaphore *) + var pdwAdviseCookie: DWORD): HResult; stdcall; (* where your cookie goes *) + + (* cancel a request for notification *) + function Unadvise(dwAdviseCookie: DWORD): HResult; stdcall; + end; +} + + IID_IReferenceClock = IReferenceClock; + {$EXTERNALSYM IID_IReferenceClock} + +const + CLSID_DirectMusic: TGUID = '{636b9f10-0c7d-11d1-95b2-0020afdc7421}'; + {$EXTERNALSYM CLSID_DirectMusic} + CLSID_DirectMusicCollection: TGUID = '{480ff4b0-28b2-11d1-bef7-00c04fbf8fef}'; + {$EXTERNALSYM CLSID_DirectMusicCollection} + CLSID_DirectMusicSynth: TGUID = '{58C2B4D0-46E7-11D1-89AC-00A0C9054129}'; + {$EXTERNALSYM CLSID_DirectMusicSynth} + + // Alternate interface ID for IID_IDirectMusic, available in DX7 release and after. + IID_IDirectMusic2: TGUID = '{6fc2cae1-bc78-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM IID_IDirectMusic2} + +type + IID_IDirectMusic = IDirectMusic; + {$EXTERNALSYM IID_IDirectMusic} + IID_IDirectMusicBuffer = IDirectMusicBuffer; + {$EXTERNALSYM IID_IDirectMusicBuffer} + IID_IDirectMusicPort = IDirectMusicPort; + {$EXTERNALSYM IID_IDirectMusicPort} + IID_IDirectMusicThru = IDirectMusicThru; + {$EXTERNALSYM IID_IDirectMusicThru} + IID_IDirectMusicPortDownload = IDirectMusicPortDownload; + {$EXTERNALSYM IID_IDirectMusicPortDownload} + IID_IDirectMusicDownload = IDirectMusicDownload; + {$EXTERNALSYM IID_IDirectMusicDownload} + IID_IDirectMusicCollection = IDirectMusicCollection; + {$EXTERNALSYM IID_IDirectMusicCollection} + IID_IDirectMusicInstrument = IDirectMusicInstrument; + {$EXTERNALSYM IID_IDirectMusicInstrument} + IID_IDirectMusicDownloadedInstrument = IDirectMusicDownloadedInstrument; + {$EXTERNALSYM IID_IDirectMusicDownloadedInstrument} + + IID_IDirectMusic8 = IDirectMusic8; + {$EXTERNALSYM IID_IDirectMusic8} + + IID_IDirectMusicThru8 = IID_IDirectMusicThru; + {$EXTERNALSYM IID_IDirectMusicThru8} + IID_IDirectMusicPortDownload8 = IID_IDirectMusicPortDownload; + {$EXTERNALSYM IID_IDirectMusicPortDownload8} + IID_IDirectMusicDownload8 = IID_IDirectMusicDownload; + {$EXTERNALSYM IID_IDirectMusicDownload8} + IID_IDirectMusicCollection8 = IID_IDirectMusicCollection; + {$EXTERNALSYM IID_IDirectMusicCollection8} + IID_IDirectMusicInstrument8 = IID_IDirectMusicInstrument; + {$EXTERNALSYM IID_IDirectMusicInstrument8} + IID_IDirectMusicDownloadedInstrument8 = IID_IDirectMusicDownloadedInstrument; + {$EXTERNALSYM IID_IDirectMusicDownloadedInstrument8} + IID_IDirectMusicPort8 = IID_IDirectMusicPort; + {$EXTERNALSYM IID_IDirectMusicPort8} + + +const +(* Property Query GUID_DMUS_PROP_GM_Hardware - Local GM set, no need to download + * Property Query GUID_DMUS_PROP_GS_Hardware - Local GS set, no need to download + * Property Query GUID_DMUS_PROP_XG_Hardware - Local XG set, no need to download + * Property Query GUID_DMUS_PROP_DLS1 - Support DLS level 1 + * Property Query GUID_DMUS_PROP_INSTRUMENT2 - Support new INSTRUMENT2 download format + * Property Query GUID_DMUS_PROP_XG_Capable - Support minimum requirements of XG + * Property Query GUID_DMUS_PROP_GS_Capable - Support minimum requirements of GS + * Property Query GUID_DMUS_PROP_SynthSink_DSOUND - Synthsink talks to DSound + * Property Query GUID_DMUS_PROP_SynthSink_WAVE - Synthsink talks to Wave device + * + * Item 0: Supported + * Returns a DWORD which is non-zero if the feature is supported + *) + GUID_DMUS_PROP_GM_Hardware: TGUID = '{178f2f24-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM GUID_DMUS_PROP_GM_Hardware} + GUID_DMUS_PROP_GS_Hardware: TGUID = '{178f2f25-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM GUID_DMUS_PROP_GS_Hardware} + GUID_DMUS_PROP_XG_Hardware: TGUID = '{178f2f26-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM GUID_DMUS_PROP_XG_Hardware} + GUID_DMUS_PROP_XG_Capable: TGUID = '{6496aba1-61b0-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM GUID_DMUS_PROP_XG_Capable} + GUID_DMUS_PROP_GS_Capable: TGUID = '{6496aba2-61b0-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM GUID_DMUS_PROP_GS_Capable} + GUID_DMUS_PROP_DLS1: TGUID = '{178f2f27-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM GUID_DMUS_PROP_DLS1} + GUID_DMUS_PROP_DLS2: TGUID = '{f14599e5-4689-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM GUID_DMUS_PROP_DLS2} + GUID_DMUS_PROP_INSTRUMENT2: TGUID = '{865fd372-9f67-11d2-872a-00600893b1bd}'; + {$EXTERNALSYM GUID_DMUS_PROP_INSTRUMENT2} + GUID_DMUS_PROP_SynthSink_DSOUND: TGUID = '{0aa97844-c877-11d1-870c-00600893b1bd}'; + {$EXTERNALSYM GUID_DMUS_PROP_SynthSink_DSOUND} + GUID_DMUS_PROP_SynthSink_WAVE: TGUID = '{0aa97845-c877-11d1-870c-00600893b1bd}'; + {$EXTERNALSYM GUID_DMUS_PROP_SynthSink_WAVE} + GUID_DMUS_PROP_SampleMemorySize: TGUID = '{178f2f28-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM GUID_DMUS_PROP_SampleMemorySize} + GUID_DMUS_PROP_SamplePlaybackRate: TGUID = '{2a91f713-a4bf-11d2-bbdf-00600833dbd8}'; + {$EXTERNALSYM GUID_DMUS_PROP_SamplePlaybackRate} + +(* Property Get/Set GUID_DMUS_PROP_WriteLatency + * + * Item 0: Synth buffer write latency, in milliseconds + * Get/Set SynthSink latency, the average time after the play head that the next buffer gets written. + *) + GUID_DMUS_PROP_WriteLatency: TGUID = '{268a0fa0-60f2-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM GUID_DMUS_PROP_WriteLatency} + +(* Property Get/Set GUID_DMUS_PROP_WritePeriod + * + * Item 0: Synth buffer write period, in milliseconds + * Get/Set SynthSink buffer write period, time span between successive writes. + *) + GUID_DMUS_PROP_WritePeriod: TGUID = '{268a0fa1-60f2-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM GUID_DMUS_PROP_WritePeriod} + +(* Property Get GUID_DMUS_PROP_MemorySize + * + * Item 0: Memory size + * Returns a DWORD containing the total number of bytes of sample RAM + *) + GUID_DMUS_PROP_MemorySize: TGUID = '{178f2f28-c364-11d1-a760-0000f875ac12}'; + {$EXTERNALSYM GUID_DMUS_PROP_MemorySize} + +(* Property Set GUID_DMUS_PROP_WavesReverb + * + * Item 0: DMUS_WAVES_REVERB structure + * Sets reverb parameters + *) + GUID_DMUS_PROP_WavesReverb: TGUID = '{04cb5622-32e5-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM GUID_DMUS_PROP_WavesReverb} + +(* Property Set GUID_DMUS_PROP_Effects + * + * Item 0: DWORD with effects flags. + * Get/Set effects bits, same as dwEffectFlags in DMUS_PORTPARAMS and DMUS_PORTCAPS: + * DMUS_EFFECT_NONE + * DMUS_EFFECT_REVERB + * DMUS_EFFECT_CHORUS + *) + GUID_DMUS_PROP_Effects: TGUID = '{cda8d611-684a-11d2-871e-00600893b1bd}'; + {$EXTERNALSYM GUID_DMUS_PROP_Effects} + +(* Property Set GUID_DMUS_PROP_LegacyCaps + * + * Item 0: The MIDINCAPS or MIDIOUTCAPS which describes the port's underlying WinMM device. This property is only supported + * by ports which wrap WinMM devices. + *) + + GUID_DMUS_PROP_LegacyCaps: TGUID = '{cfa7cdc2-00a1-11d2-aad5-0000f875ac12}'; + {$EXTERNALSYM GUID_DMUS_PROP_LegacyCaps} + +(* Property Set GUID_DMUS_PROP_Volume + * + * Item 0: A long which contains an offset, in 1/100 dB, to be added to the final volume + * + *) + GUID_DMUS_PROP_Volume: TGUID = '{fedfae25-e46e-11d1-aace-0000f875ac12}'; + {$EXTERNALSYM GUID_DMUS_PROP_Volume} + + // Min and Max values for setting volume with GUID_DMUS_PROP_Volume + + DMUS_VOLUME_MAX = 2000; (* +20 dB *) + {$EXTERNALSYM DMUS_VOLUME_MAX} + DMUS_VOLUME_MIN = -20000; (* -200 dB *) + {$EXTERNALSYM DMUS_VOLUME_MIN} + + + +(************************************************************************ +* * +* dmusici.h -- This module contains the API for the * +* DirectMusic performance layer * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************) + +type + TRANSITION_TYPE = Word; + {$EXTERNALSYM TRANSITION_TYPE} + + PMusicTime = ^TMusicTime; + MUSIC_TIME = Longint; + {$EXTERNALSYM MUSIC_TIME} + TMusicTime = MUSIC_TIME; + + +const + MT_MIN = $80000000; // Minimum music time value. + {$EXTERNALSYM MT_MIN} + MT_MAX = $7FFFFFFF; // Maximum music time value. + {$EXTERNALSYM MT_MAX} + + DMUS_PPQ = 768; // parts per quarter note + {$EXTERNALSYM DMUS_PPQ} + + +type + PDMusStyletTypes = ^TDMusStyletTypes; + enumDMUS_STYLET_TYPES = ( + DMUS_STYLET_PATTERN {= 0}, + DMUS_STYLET_MOTIF {= 1} + ); + {$EXTERNALSYM enumDMUS_STYLET_TYPES} + DMUS_STYLET_TYPES = enumDMUS_STYLET_TYPES; + {$EXTERNALSYM DMUS_STYLET_TYPES} + TDMusStyletTypes = DMUS_STYLET_TYPES; + + + enumDMUS_COMMANDT_TYPES = ( + DMUS_COMMANDT_GROOVE {= 0}, + DMUS_COMMANDT_FILL {= 1}, + DMUS_COMMANDT_INTRO {= 2}, + DMUS_COMMANDT_BREAK {= 3}, + DMUS_COMMANDT_END {= 4}, + DMUS_COMMANDT_ENDANDINTRO {= 5} + ); + {$EXTERNALSYM enumDMUS_COMMANDT_TYPES} + DMUS_COMMANDT_TYPES = enumDMUS_COMMANDT_TYPES; + {$EXTERNALSYM DMUS_COMMANDT_TYPES} + TDMusCommandtTypes = DMUS_COMMANDT_TYPES; + PDMusCommandtTypes = ^TDMusCommandtTypes; + + PDMusShapetTypes = ^TDMusShapetTypes; + enumDMUS_SHAPET_TYPES = ( + DMUS_SHAPET_FALLING {= 0}, + DMUS_SHAPET_LEVEL {= 1}, + DMUS_SHAPET_LOOPABLE {= 2}, + DMUS_SHAPET_LOUD {= 3}, + DMUS_SHAPET_QUIET {= 4}, + DMUS_SHAPET_PEAKING {= 5}, + DMUS_SHAPET_RANDOM {= 6}, + DMUS_SHAPET_RISING {= 7}, + DMUS_SHAPET_SONG {= 8} + ); + {$EXTERNALSYM enumDMUS_SHAPET_TYPES} + DMUS_SHAPET_TYPES = enumDMUS_SHAPET_TYPES; + {$EXTERNALSYM DMUS_SHAPET_TYPES} + TDMusShapetTypes = DMUS_SHAPET_TYPES; + + enumDMUS_COMPOSEF_FLAGS = DWORD; + {$EXTERNALSYM enumDMUS_COMPOSEF_FLAGS} + DMUS_COMPOSEF_FLAGS = enumDMUS_COMPOSEF_FLAGS; + {$EXTERNALSYM DMUS_COMPOSEF_FLAGS} + TDMusComposefFlags = DMUS_COMPOSEF_FLAGS; + PDMusComposefFlags = ^TDMusComposefFlags; + +const + DMUS_COMPOSEF_NONE = 0; + {$EXTERNALSYM DMUS_COMPOSEF_NONE} + DMUS_COMPOSEF_ALIGN = $1; + {$EXTERNALSYM DMUS_COMPOSEF_ALIGN} + DMUS_COMPOSEF_OVERLAP = $2; + {$EXTERNALSYM DMUS_COMPOSEF_OVERLAP} + DMUS_COMPOSEF_IMMEDIATE = $4; + {$EXTERNALSYM DMUS_COMPOSEF_IMMEDIATE} + DMUS_COMPOSEF_GRID = $8; + {$EXTERNALSYM DMUS_COMPOSEF_GRID} + DMUS_COMPOSEF_BEAT = $10; + {$EXTERNALSYM DMUS_COMPOSEF_BEAT} + DMUS_COMPOSEF_MEASURE = $20; + {$EXTERNALSYM DMUS_COMPOSEF_MEASURE} + DMUS_COMPOSEF_AFTERPREPARETIME = $40; + {$EXTERNALSYM DMUS_COMPOSEF_AFTERPREPARETIME} + DMUS_COMPOSEF_VALID_START_BEAT = $80; (* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any beat. *) + {$EXTERNALSYM DMUS_COMPOSEF_VALID_START_BEAT} + DMUS_COMPOSEF_VALID_START_GRID = $100; (* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any grid. *) + {$EXTERNALSYM DMUS_COMPOSEF_VALID_START_GRID} + DMUS_COMPOSEF_VALID_START_TICK = $200; (* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur any time. *) + {$EXTERNALSYM DMUS_COMPOSEF_VALID_START_TICK} + DMUS_COMPOSEF_SEGMENTEND = $400; (* Play the transition at the end of the current segment. *) + {$EXTERNALSYM DMUS_COMPOSEF_SEGMENTEND} + DMUS_COMPOSEF_MARKER = $800; (* Play the transition at the next marker in the current segment. *) + {$EXTERNALSYM DMUS_COMPOSEF_MARKER} + DMUS_COMPOSEF_MODULATE = $1000; + {$EXTERNALSYM DMUS_COMPOSEF_MODULATE} + DMUS_COMPOSEF_LONG = $2000; + {$EXTERNALSYM DMUS_COMPOSEF_LONG} + DMUS_COMPOSEF_ENTIRE_TRANSITION = $4000; (* play the entire transition pattern *) + {$EXTERNALSYM DMUS_COMPOSEF_ENTIRE_TRANSITION} + DMUS_COMPOSEF_1BAR_TRANSITION = $8000; (* play one bar of the transition pattern *) + {$EXTERNALSYM DMUS_COMPOSEF_1BAR_TRANSITION} + DMUS_COMPOSEF_ENTIRE_ADDITION = $10000; (* play the additional pattern in its entirety *) + {$EXTERNALSYM DMUS_COMPOSEF_ENTIRE_ADDITION} + DMUS_COMPOSEF_1BAR_ADDITION = $20000; (* play one bar of the additional pattern *) + {$EXTERNALSYM DMUS_COMPOSEF_1BAR_ADDITION} + DMUS_COMPOSEF_VALID_START_MEASURE = $40000; (* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any bar. *) + {$EXTERNALSYM DMUS_COMPOSEF_VALID_START_MEASURE} + DMUS_COMPOSEF_DEFAULT = $80000; (* Use segment's default boundary *) + {$EXTERNALSYM DMUS_COMPOSEF_DEFAULT} + DMUS_COMPOSEF_NOINVALIDATE = $100000; (* Play without invalidating the currently playing segment(s) *) + {$EXTERNALSYM DMUS_COMPOSEF_NOINVALIDATE} + DMUS_COMPOSEF_USE_AUDIOPATH = $200000; (* Uses the audio paths that are embedded in the segments *) + {$EXTERNALSYM DMUS_COMPOSEF_USE_AUDIOPATH} + DMUS_COMPOSEF_INVALIDATE_PRI = $400000; (* Invalidate only the current primary seg state *) + {$EXTERNALSYM DMUS_COMPOSEF_INVALIDATE_PRI} + + + +const + DMUS_PCHANNEL_BROADCAST_PERFORMANCE = $FFFFFFFF; // PMsg is sent on all PChannels of the performance. + {$EXTERNALSYM DMUS_PCHANNEL_BROADCAST_PERFORMANCE} + DMUS_PCHANNEL_BROADCAST_AUDIOPATH = $FFFFFFFE; // PMsg is sent on all PChannels of the audio path. + {$EXTERNALSYM DMUS_PCHANNEL_BROADCAST_AUDIOPATH} + DMUS_PCHANNEL_BROADCAST_SEGMENT = $FFFFFFFD; // PMsg is sent on all PChannels of the segment. + {$EXTERNALSYM DMUS_PCHANNEL_BROADCAST_SEGMENT} + DMUS_PCHANNEL_BROADCAST_GROUPS = $FFFFFFFC; // A duplicate PMsg is for each Channels Groups in the performance. + {$EXTERNALSYM DMUS_PCHANNEL_BROADCAST_GROUPS} + +(* The DMUS_PATH constants are used in conjunction with GetObjectInPath to find a requested + interface at a particular stage in the audio path. +*) + DMUS_PATH_SEGMENT = $1000; // Get the segment itself (from a segment state.) + {$EXTERNALSYM DMUS_PATH_SEGMENT} + DMUS_PATH_SEGMENT_TRACK = $1100; // Look in Track List of Segment. + {$EXTERNALSYM DMUS_PATH_SEGMENT_TRACK} + DMUS_PATH_SEGMENT_GRAPH = $1200; // Get the segment's tool graph. + {$EXTERNALSYM DMUS_PATH_SEGMENT_GRAPH} + DMUS_PATH_SEGMENT_TOOL = $1300; // Look in Tool Graph of Segment. + {$EXTERNALSYM DMUS_PATH_SEGMENT_TOOL} + DMUS_PATH_AUDIOPATH = $2000; // Get the audiopath itself (from a segment state.) + {$EXTERNALSYM DMUS_PATH_AUDIOPATH} + DMUS_PATH_AUDIOPATH_GRAPH = $2200; // Get the audiopath's tool graph. + {$EXTERNALSYM DMUS_PATH_AUDIOPATH_GRAPH} + DMUS_PATH_AUDIOPATH_TOOL = $2300; // Look in Tool Graph of Audio Path. + {$EXTERNALSYM DMUS_PATH_AUDIOPATH_TOOL} + DMUS_PATH_PERFORMANCE = $3000; // Access the performance. + {$EXTERNALSYM DMUS_PATH_PERFORMANCE} + DMUS_PATH_PERFORMANCE_GRAPH = $3200; // Get the performance's tool graph. + {$EXTERNALSYM DMUS_PATH_PERFORMANCE_GRAPH} + DMUS_PATH_PERFORMANCE_TOOL = $3300; // Look in Tool Graph of Performance. + {$EXTERNALSYM DMUS_PATH_PERFORMANCE_TOOL} + DMUS_PATH_PORT = $4000; // Access the synth. + {$EXTERNALSYM DMUS_PATH_PORT} + DMUS_PATH_BUFFER = $6000; // Look in DirectSoundBuffer. + {$EXTERNALSYM DMUS_PATH_BUFFER} + DMUS_PATH_BUFFER_DMO = $6100; // Access a DMO in the buffer. + {$EXTERNALSYM DMUS_PATH_BUFFER_DMO} + DMUS_PATH_MIXIN_BUFFER = $7000; // Look in a global mixin buffer. + {$EXTERNALSYM DMUS_PATH_MIXIN_BUFFER} + DMUS_PATH_MIXIN_BUFFER_DMO = $7100; // Access a DMO in a global mixin buffer. + {$EXTERNALSYM DMUS_PATH_MIXIN_BUFFER_DMO} + DMUS_PATH_PRIMARY_BUFFER = $8000; // Access the primary buffer. + {$EXTERNALSYM DMUS_PATH_PRIMARY_BUFFER} + +(* To ignore PChannels when calling GetObjectInPath(), use the DMUS_PCHANNEL_ALL constant. *) + DMUS_PCHANNEL_ALL = $FFFFFFFB; + {$EXTERNALSYM DMUS_PCHANNEL_ALL} + +(* The DMUS_APATH types are used in conjunction with CreateStandardAudioPath to + build default path types. _SHARED_ means the same buffer is shared across multiple + instantiations of the audiopath type. _DYNAMIC_ means a unique buffer is created + every time. +*) + + DMUS_APATH_SHARED_STEREOPLUSREVERB = 1; // A standard music set up with stereo outs and reverb. + {$EXTERNALSYM DMUS_APATH_SHARED_STEREOPLUSREVERB} + DMUS_APATH_DYNAMIC_3D = 6; // An audio path with one dynamic bus from the synth feeding to a dynamic 3d buffer. Does not send to env reverb. + {$EXTERNALSYM DMUS_APATH_DYNAMIC_3D} + DMUS_APATH_DYNAMIC_MONO = 7; // An audio path with one dynamic bus from the synth feeding to a dynamic mono buffer. + {$EXTERNALSYM DMUS_APATH_DYNAMIC_MONO} + DMUS_APATH_DYNAMIC_STEREO = 8; // An audio path with two dynamic buses from the synth feeding to a dynamic stereo buffer. + {$EXTERNALSYM DMUS_APATH_DYNAMIC_STEREO} + +type + PDMusAudioParams = ^TDMusAudioParams; + _DMUS_AUDIOPARAMS = packed record + dwSize: DWORD; // Size of this structure. + fInitNow: BOOL; // If true, the sink and synth are created immediately and results returned in this structure. + dwValidData: DWORD; // Flags indicating which fields below are valid. + dwFeatures: DWORD; // Required DMUS_AUDIOF features. + dwVoices: DWORD; // Required number of voices. + dwSampleRate: DWORD; // Sample rate of synths and sink. + clsidDefaultSynth: TGUID; // Class ID of default synthesizer. + end; + {$EXTERNALSYM _DMUS_AUDIOPARAMS} + DMUS_AUDIOPARAMS = _DMUS_AUDIOPARAMS; + {$EXTERNALSYM DMUS_AUDIOPARAMS} + TDMusAudioParams = _DMUS_AUDIOPARAMS; + +const + (* dwFeatures flags. These indicate which features are required for the audio environment. *) + DMUS_AUDIOF_3D = $1; // Require 3D buffers. + {$EXTERNALSYM DMUS_AUDIOF_3D} + DMUS_AUDIOF_ENVIRON = $2; // Require environmental modeling. + {$EXTERNALSYM DMUS_AUDIOF_ENVIRON} + DMUS_AUDIOF_EAX = $4; // Require use of EAX effects. + {$EXTERNALSYM DMUS_AUDIOF_EAX} + DMUS_AUDIOF_DMOS = $8; // Require use of additional DMOs. + {$EXTERNALSYM DMUS_AUDIOF_DMOS} + DMUS_AUDIOF_STREAMING = $10; // Require support for streaming waves. + {$EXTERNALSYM DMUS_AUDIOF_STREAMING} + DMUS_AUDIOF_BUFFERS = $20; // Require support for multiple buffers (all above cases need this.) + {$EXTERNALSYM DMUS_AUDIOF_BUFFERS} + DMUS_AUDIOF_ALL = $3F; // Requires everything. + {$EXTERNALSYM DMUS_AUDIOF_ALL} + + (* dwValidData flags. These indicate which fields in DMUS_AUDIOPARAMS have been filled in. If fInitNow is set, these also return what was allocated. *) + DMUS_AUDIOPARAMS_FEATURES = $00000001; + {$EXTERNALSYM DMUS_AUDIOPARAMS_FEATURES} + DMUS_AUDIOPARAMS_VOICES = $00000002; + {$EXTERNALSYM DMUS_AUDIOPARAMS_VOICES} + DMUS_AUDIOPARAMS_SAMPLERATE = $00000004; + {$EXTERNALSYM DMUS_AUDIOPARAMS_SAMPLERATE} + DMUS_AUDIOPARAMS_DEFAULTSYNTH = $00000008; + {$EXTERNALSYM DMUS_AUDIOPARAMS_DEFAULTSYNTH} + +(* DMUS_PMSGF_FLAGS fill the DMUS_PMSG's dwFlags member *) +type + enumDMUS_PMSGF_FLAGS = DWORD; + {$EXTERNALSYM enumDMUS_PMSGF_FLAGS} + DMUS_PMSGF_FLAGS = enumDMUS_PMSGF_FLAGS; + {$EXTERNALSYM DMUS_PMSGF_FLAGS} + TDMusPmsgfFlags = DMUS_PMSGF_FLAGS; + PDMusPmsgfFlags = ^TDMusPmsgfFlags; + +const + DMUS_PMSGF_REFTIME = 1; // if rtTime is valid + {$EXTERNALSYM DMUS_PMSGF_REFTIME} + DMUS_PMSGF_MUSICTIME = 2; // if mtTime is valid + {$EXTERNALSYM DMUS_PMSGF_MUSICTIME} + DMUS_PMSGF_TOOL_IMMEDIATE = 4; // if PMSG should be processed immediately + {$EXTERNALSYM DMUS_PMSGF_TOOL_IMMEDIATE} + DMUS_PMSGF_TOOL_QUEUE = 8; // if PMSG should be processed a little early, at Queue time + {$EXTERNALSYM DMUS_PMSGF_TOOL_QUEUE} + DMUS_PMSGF_TOOL_ATTIME = $10; // if PMSG should be processed at the time stamp + {$EXTERNALSYM DMUS_PMSGF_TOOL_ATTIME} + DMUS_PMSGF_TOOL_FLUSH = $20; // if PMSG is being flushed + {$EXTERNALSYM DMUS_PMSGF_TOOL_FLUSH} + DMUS_PMSGF_LOCKTOREFTIME = $40; // if rtTime can not be overriden by a tempo change. + {$EXTERNALSYM DMUS_PMSGF_LOCKTOREFTIME} + DMUS_PMSGF_DX8 = $80; // if the message has DX8 or later extensions. + {$EXTERNALSYM DMUS_PMSGF_DX8} + // The values of DMUS_TIME_RESOLVE_FLAGS may also be used inside the + // DMUS_PMSG's dwFlags member. + +(* DMUS_PMSGT_TYPES fill the DMUS_PMSG's dwType member *) +type + enumDMUS_PMSGT_TYPES = DWORD; + {$EXTERNALSYM enumDMUS_PMSGT_TYPES} + DMUS_PMSGT_TYPES = enumDMUS_PMSGT_TYPES; + {$EXTERNALSYM DMUS_PMSGT_TYPES} + TDMusPmsgtTypes = DMUS_PMSGT_TYPES; + PDMusPmsgtTypes = ^TDMusPmsgtTypes; + +const + DMUS_PMSGT_MIDI = 0; // MIDI short message + {$EXTERNALSYM DMUS_PMSGT_MIDI} + DMUS_PMSGT_NOTE = 1; // Interactive Music Note + {$EXTERNALSYM DMUS_PMSGT_NOTE} + DMUS_PMSGT_SYSEX = 2; // MIDI long message (system exclusive message) + {$EXTERNALSYM DMUS_PMSGT_SYSEX} + DMUS_PMSGT_NOTIFICATION = 3; // Notification message + {$EXTERNALSYM DMUS_PMSGT_NOTIFICATION} + DMUS_PMSGT_TEMPO = 4; // Tempo message + {$EXTERNALSYM DMUS_PMSGT_TEMPO} + DMUS_PMSGT_CURVE = 5; // Control change / pitch bend, etc. curve + {$EXTERNALSYM DMUS_PMSGT_CURVE} + DMUS_PMSGT_TIMESIG = 6; // Time signature + {$EXTERNALSYM DMUS_PMSGT_TIMESIG} + DMUS_PMSGT_PATCH = 7; // Patch changes + {$EXTERNALSYM DMUS_PMSGT_PATCH} + DMUS_PMSGT_TRANSPOSE = 8; // Transposition messages + {$EXTERNALSYM DMUS_PMSGT_TRANSPOSE} + DMUS_PMSGT_CHANNEL_PRIORITY = 9; // Channel priority + {$EXTERNALSYM DMUS_PMSGT_CHANNEL_PRIORITY} + DMUS_PMSGT_STOP = 10; // Stop message + {$EXTERNALSYM DMUS_PMSGT_STOP} + DMUS_PMSGT_DIRTY = 11; // Tells Tools that cache GetParam() info to refresh + {$EXTERNALSYM DMUS_PMSGT_DIRTY} + DMUS_PMSGT_WAVE = 12; // Carries control information for playing a wave. + {$EXTERNALSYM DMUS_PMSGT_WAVE} + DMUS_PMSGT_LYRIC = 13; // Lyric message from lyric track. + {$EXTERNALSYM DMUS_PMSGT_LYRIC} + DMUS_PMSGT_SCRIPTLYRIC = 14; // Lyric message sent by a script with the Trace function. + {$EXTERNALSYM DMUS_PMSGT_SCRIPTLYRIC} + DMUS_PMSGT_USER = 255; // User message + {$EXTERNALSYM DMUS_PMSGT_USER} + +type + (* DMUS_SEGF_FLAGS correspond to IDirectMusicPerformance::PlaySegment, and other API *) + enumDMUS_SEGF_FLAGS = DWORD; + DMUS_SEGF_FLAGS = enumDMUS_SEGF_FLAGS; + {$EXTERNALSYM DMUS_SEGF_FLAGS} + TDMusSegfFlags = DMUS_SEGF_FLAGS; + PDMusSegfFlags = ^TDMusSegfFlags; + +const + DMUS_SEGF_REFTIME = 1 shr 6; // 0x40 Time parameter is in reference time + {$EXTERNALSYM DMUS_SEGF_REFTIME} + DMUS_SEGF_SECONDARY = 1 shr 7; // 0x80 Secondary segment + {$EXTERNALSYM DMUS_SEGF_SECONDARY} + DMUS_SEGF_QUEUE = 1 shr 8; // 0x100 Queue at the end of the primary segment queue (primary only) + {$EXTERNALSYM DMUS_SEGF_QUEUE} + DMUS_SEGF_CONTROL = 1 shr 9; // 0x200 Play as a control track (secondary segments only) + {$EXTERNALSYM DMUS_SEGF_CONTROL} + DMUS_SEGF_AFTERPREPARETIME = 1 shr 10; // 0x400 Play after the prepare time (See IDirectMusicPerformance::GetPrepareTime) + {$EXTERNALSYM DMUS_SEGF_AFTERPREPARETIME} + DMUS_SEGF_GRID = 1 shr 11; // 0x800 Play on grid boundary + {$EXTERNALSYM DMUS_SEGF_GRID} + DMUS_SEGF_BEAT = 1 shr 12; // 0x1000 Play on beat boundary + {$EXTERNALSYM DMUS_SEGF_BEAT} + DMUS_SEGF_MEASURE = 1 shr 13; // 0x2000 Play on measure boundary + {$EXTERNALSYM DMUS_SEGF_MEASURE} + DMUS_SEGF_DEFAULT = 1 shr 14; // 0x4000 Use segment's default boundary + {$EXTERNALSYM DMUS_SEGF_DEFAULT} + DMUS_SEGF_NOINVALIDATE = 1 shr 15; // 0x8000 Play without invalidating the currently playing segment(s) + {$EXTERNALSYM DMUS_SEGF_NOINVALIDATE} + DMUS_SEGF_ALIGN = 1 shr 16; // 0x10000 Align segment with requested boundary, but switch at first valid point + {$EXTERNALSYM DMUS_SEGF_ALIGN} + DMUS_SEGF_VALID_START_BEAT = 1 shr 17; // 0x20000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any beat. + {$EXTERNALSYM DMUS_SEGF_VALID_START_BEAT} + DMUS_SEGF_VALID_START_GRID = 1 shr 18; // 0x40000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any grid. + {$EXTERNALSYM DMUS_SEGF_VALID_START_GRID} + DMUS_SEGF_VALID_START_TICK = 1 shr 19; // 0x80000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur any time. + {$EXTERNALSYM DMUS_SEGF_VALID_START_TICK} + DMUS_SEGF_AUTOTRANSITION = 1 shr 20; // 0x100000 Compose and play a transition segment, using the transition template. + {$EXTERNALSYM DMUS_SEGF_AUTOTRANSITION} + DMUS_SEGF_AFTERQUEUETIME = 1 shr 21; // 0x200000 Make sure to play after the queue time. This is default for primary segments + {$EXTERNALSYM DMUS_SEGF_AFTERQUEUETIME} + DMUS_SEGF_AFTERLATENCYTIME = 1 shr 22; // 0x400000 Make sure to play after the latency time. This is true for all segments, so this is a nop + {$EXTERNALSYM DMUS_SEGF_AFTERLATENCYTIME} + DMUS_SEGF_SEGMENTEND = 1 shr 23; // 0x800000 Play at the next end of segment. + {$EXTERNALSYM DMUS_SEGF_SEGMENTEND} + DMUS_SEGF_MARKER = 1 shr 24; // 0x1000000 Play at next marker in the primary segment. If there are no markers, default to any other resolution requests. + {$EXTERNALSYM DMUS_SEGF_MARKER} + DMUS_SEGF_TIMESIG_ALWAYS = 1 shr 25; // 0x2000000 Even if there is no primary segment, align start time with current time signature. + {$EXTERNALSYM DMUS_SEGF_TIMESIG_ALWAYS} + DMUS_SEGF_USE_AUDIOPATH = 1 shr 26; // 0x4000000 Uses the audio path that is embedded in the segment. + {$EXTERNALSYM DMUS_SEGF_USE_AUDIOPATH} + DMUS_SEGF_VALID_START_MEASURE = 1 shr 27; // 0x8000000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any bar. + {$EXTERNALSYM DMUS_SEGF_VALID_START_MEASURE} + DMUS_SEGF_INVALIDATE_PRI = 1 shr 28; // 0x10000000 invalidate only the current primary seg state + {$EXTERNALSYM DMUS_SEGF_INVALIDATE_PRI} + + DMUS_SEG_REPEAT_INFINITE = $FFFFFFFF; // For IDirectMusicSegment::SetRepeat + {$EXTERNALSYM DMUS_SEG_REPEAT_INFINITE} + DMUS_SEG_ALLTRACKS = $80000000; // For IDirectMusicSegment::SetParam() and SetTrackConfig() - selects all tracks instead on nth index. + {$EXTERNALSYM DMUS_SEG_ALLTRACKS} + DMUS_SEG_ANYTRACK = $80000000; // For IDirectMusicSegment::GetParam() - checks each track until it finds one that returns data (not DMUS_E_NOT_FOUND.) + {$EXTERNALSYM DMUS_SEG_ANYTRACK} + + +// DMUS_TIME_RESOLVE_FLAGS correspond to IDirectMusicPerformance::GetResolvedTime, and can +// also be used interchangeably with the corresponding DMUS_SEGF_FLAGS, since their values +// are intentionally the same +type + enumDMUS_TIME_RESOLVE_FLAGS = DWORD; + {$EXTERNALSYM enumDMUS_TIME_RESOLVE_FLAGS} + DMUS_TIME_RESOLVE_FLAGS = enumDMUS_TIME_RESOLVE_FLAGS; + {$EXTERNALSYM DMUS_TIME_RESOLVE_FLAGS} + TDMusTimeResolveFlags = DMUS_TIME_RESOLVE_FLAGS; + PDMusTimeResolveFlags = ^TDMusTimeResolveFlags; + +const + DMUS_TIME_RESOLVE_AFTERPREPARETIME = DMUS_SEGF_AFTERPREPARETIME; + {$EXTERNALSYM DMUS_TIME_RESOLVE_AFTERPREPARETIME} + DMUS_TIME_RESOLVE_AFTERQUEUETIME = DMUS_SEGF_AFTERQUEUETIME; + {$EXTERNALSYM DMUS_TIME_RESOLVE_AFTERQUEUETIME} + DMUS_TIME_RESOLVE_AFTERLATENCYTIME = DMUS_SEGF_AFTERLATENCYTIME; + {$EXTERNALSYM DMUS_TIME_RESOLVE_AFTERLATENCYTIME} + DMUS_TIME_RESOLVE_GRID = DMUS_SEGF_GRID; + {$EXTERNALSYM DMUS_TIME_RESOLVE_GRID} + DMUS_TIME_RESOLVE_BEAT = DMUS_SEGF_BEAT; + {$EXTERNALSYM DMUS_TIME_RESOLVE_BEAT} + DMUS_TIME_RESOLVE_MEASURE = DMUS_SEGF_MEASURE; + {$EXTERNALSYM DMUS_TIME_RESOLVE_MEASURE} + DMUS_TIME_RESOLVE_MARKER = DMUS_SEGF_MARKER; + {$EXTERNALSYM DMUS_TIME_RESOLVE_MARKER} + DMUS_TIME_RESOLVE_SEGMENTEND = DMUS_SEGF_SEGMENTEND; + {$EXTERNALSYM DMUS_TIME_RESOLVE_SEGMENTEND} + +type + (* The following flags are sent inside the DMUS_CHORD_KEY.dwFlags parameter *) + enumDMUS_CHORDKEYF_FLAGS = DWORD; + {$EXTERNALSYM enumDMUS_CHORDKEYF_FLAGS} + DMUS_CHORDKEYF_FLAGS = enumDMUS_CHORDKEYF_FLAGS; + {$EXTERNALSYM DMUS_CHORDKEYF_FLAGS} + TDMusChordkeyfFlags = DMUS_CHORDKEYF_FLAGS; + PDMusChordkeyfFlags = ^TDMusChordkeyfFlags; + +const + DMUS_CHORDKEYF_SILENT = 1; // is the chord silent? + {$EXTERNALSYM DMUS_CHORDKEYF_SILENT} + + DMUS_MAXSUBCHORD = 8; + {$EXTERNALSYM DMUS_MAXSUBCHORD} + +type + PDMusSubChord = ^TDMusSubChord; + _DMUS_SUBCHORD = packed record + dwChordPattern: DWORD; // Notes in the subchord + dwScalePattern: DWORD; // Notes in the scale + dwInversionPoints: DWORD; // Where inversions can occur + dwLevels: DWORD; // Which levels are supported by this subchord + bChordRoot: Byte; // Root of the subchord + bScaleRoot: Byte; // Root of the scale + end; + {$EXTERNALSYM _DMUS_SUBCHORD} + DMUS_SUBCHORD = _DMUS_SUBCHORD; + {$EXTERNALSYM DMUS_SUBCHORD} + TDMusSubChord = _DMUS_SUBCHORD; + + PDMusChordKey = ^TDMusChordKey; + _DMUS_CHORD_KEY = packed record + wszName: array [0..15] of WideChar; // Name of the chord + wMeasure: Word; // Measure this falls on + bBeat: Byte; // Beat this falls on + bSubChordCount: Byte; // Number of chords in the list of subchords + SubChordList: array[0..DMUS_MAXSUBCHORD-1] of TDMUSSUBCHORD; // List of sub chords + dwScale: DWORD; // Scale underlying the entire chord + bKey: Byte; // Key underlying the entire chord + bFlags: Byte; // Miscelaneous flags + end; + {$EXTERNALSYM _DMUS_CHORD_KEY} + DMUS_CHORD_KEY = _DMUS_CHORD_KEY; + {$EXTERNALSYM DMUS_CHORD_KEY} + TDMusChordKey = _DMUS_CHORD_KEY; + + enumDMUS_NOTEF_FLAGS = DWORD; + {$EXTERNALSYM enumDMUS_NOTEF_FLAGS} + DMUS_NOTEF_FLAGS = enumDMUS_NOTEF_FLAGS; + {$EXTERNALSYM DMUS_NOTEF_FLAGS} + TDMusNotefFlags = DMUS_NOTEF_FLAGS; + PDMusNotefFlags = ^TDMusNotefFlags; + +const + DMUS_NOTEF_NOTEON = 1; // Set if this is a MIDI Note On. Otherwise, it is MIDI Note Off + {$EXTERNALSYM DMUS_NOTEF_NOTEON} + // DX8 flags: + DMUS_NOTEF_NOINVALIDATE = 2; // Don't invalidate this note off. + {$EXTERNALSYM DMUS_NOTEF_NOINVALIDATE} + DMUS_NOTEF_NOINVALIDATE_INSCALE = 4;// Don't invalidate if still within the scale. + {$EXTERNALSYM DMUS_NOTEF_NOINVALIDATE_INSCALE} + DMUS_NOTEF_NOINVALIDATE_INCHORD = 8;// Don't invalidate if still within the chord. + {$EXTERNALSYM DMUS_NOTEF_NOINVALIDATE_INCHORD} + DMUS_NOTEF_REGENERATE = #10; // Regenerate the note on an invalidate. + {$EXTERNALSYM DMUS_NOTEF_REGENERATE} + +type +(* The DMUS_PLAYMODE_FLAGS are used to determine how to convert wMusicValue + into the appropriate bMidiValue. +*) + enumDMUS_PLAYMODE_FLAGS = Byte; + DMUS_PLAYMODE_FLAGS = enumDMUS_PLAYMODE_FLAGS; + +const + DMUS_PLAYMODE_KEY_ROOT = 1; // Transpose on top of the key root. + {$EXTERNALSYM DMUS_PLAYMODE_KEY_ROOT} + DMUS_PLAYMODE_CHORD_ROOT = 2; // Transpose on top of the chord root. + {$EXTERNALSYM DMUS_PLAYMODE_CHORD_ROOT} + DMUS_PLAYMODE_SCALE_INTERVALS = 4; // Use scale intervals from scale pattern. + {$EXTERNALSYM DMUS_PLAYMODE_SCALE_INTERVALS} + DMUS_PLAYMODE_CHORD_INTERVALS = 8; // Use chord intervals from chord pattern. + {$EXTERNALSYM DMUS_PLAYMODE_CHORD_INTERVALS} + DMUS_PLAYMODE_NONE = 16; // No mode. Indicates the parent part's mode should be used. + {$EXTERNALSYM DMUS_PLAYMODE_NONE} + +(* The following are playback modes that can be created by combining the DMUS_PLAYMODE_FLAGS + in various ways: +*) + +(* Fixed. wMusicValue holds final MIDI note value. This is used for drums, sound effects, and sequenced + notes that should not be transposed by the chord or scale. +*) + DMUS_PLAYMODE_FIXED = 0; + {$EXTERNALSYM DMUS_PLAYMODE_FIXED} +(* In fixed to key, the musicvalue is again a fixed MIDI value, but it + is transposed on top of the key root. +*) + DMUS_PLAYMODE_FIXEDTOKEY = DMUS_PLAYMODE_KEY_ROOT; + {$EXTERNALSYM DMUS_PLAYMODE_FIXEDTOKEY} +(* In fixed to chord, the musicvalue is also a fixed MIDI value, but it + is transposed on top of the chord root. +*) + DMUS_PLAYMODE_FIXEDTOCHORD = DMUS_PLAYMODE_CHORD_ROOT; + {$EXTERNALSYM DMUS_PLAYMODE_FIXEDTOCHORD} +(* In Pedalpoint, the key root is used and the notes only track the intervals in + the scale. The chord root and intervals are completely ignored. This is useful + for melodic lines that play relative to the key root. +*) + DMUS_PLAYMODE_PEDALPOINT = (DMUS_PLAYMODE_KEY_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS); + {$EXTERNALSYM DMUS_PLAYMODE_PEDALPOINT} +(* In the Melodic mode, the chord root is used but the notes only track the intervals in + the scale. The key root and chord intervals are completely ignored. This is useful + for melodic lines that play relative to the chord root. +*) + DMUS_PLAYMODE_MELODIC = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS); + {$EXTERNALSYM DMUS_PLAYMODE_MELODIC} +(* Normal chord mode is the prevalent playback mode. + The notes track the intervals in the chord, which is based on the chord root. + If there is a scale component to the MusicValue, the additional intervals + are pulled from the scale and added. + If the chord does not have an interval to match the chord component of + the MusicValue, the note is silent. +*) + DMUS_PLAYMODE_NORMALCHORD = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_CHORD_INTERVALS); + {$EXTERNALSYM DMUS_PLAYMODE_NORMALCHORD} +(* If it is desirable to play a note that is above the top of the chord, the + always play mode (known as "purpleized" in a former life) finds a position + for the note by using intervals from the scale. Essentially, this mode is + a combination of the Normal and Melodic playback modes, where a failure + in Normal causes a second try in Melodic mode. +*) + DMUS_PLAYMODE_ALWAYSPLAY = (DMUS_PLAYMODE_MELODIC or DMUS_PLAYMODE_NORMALCHORD); + {$EXTERNALSYM DMUS_PLAYMODE_ALWAYSPLAY} + +(* These playmodes are new for dx8. *) +(* In PedalpointChord, the key root is used and the notes only track the intervals in + the chord. The chord root and scale intervals are completely ignored. This is useful + for chordal lines that play relative to the key root. +*) + DMUS_PLAYMODE_PEDALPOINTCHORD = (DMUS_PLAYMODE_KEY_ROOT or DMUS_PLAYMODE_CHORD_INTERVALS); + {$EXTERNALSYM DMUS_PLAYMODE_PEDALPOINTCHORD} + +(* For completeness, here's a mode that tries for pedalpointchord, but if it fails + uses scale intervals +*) + DMUS_PLAYMODE_PEDALPOINTALWAYS = (DMUS_PLAYMODE_PEDALPOINT or DMUS_PLAYMODE_PEDALPOINTCHORD); + {$EXTERNALSYM DMUS_PLAYMODE_PEDALPOINTALWAYS} + + + (* Legacy names for modes... *) + DMUS_PLAYMODE_PURPLEIZED = DMUS_PLAYMODE_ALWAYSPLAY; + {$EXTERNALSYM DMUS_PLAYMODE_PURPLEIZED} + DMUS_PLAYMODE_SCALE_ROOT = DMUS_PLAYMODE_KEY_ROOT; + {$EXTERNALSYM DMUS_PLAYMODE_SCALE_ROOT} + DMUS_PLAYMODE_FIXEDTOSCALE = DMUS_PLAYMODE_FIXEDTOKEY; + {$EXTERNALSYM DMUS_PLAYMODE_FIXEDTOSCALE} + +const + DMUS_TEMPO_MAX = 1000; + {$EXTERNALSYM DMUS_TEMPO_MAX} + DMUS_TEMPO_MIN = 1; + {$EXTERNALSYM DMUS_TEMPO_MIN} + + DMUS_MASTERTEMPO_MAX = 100.0; + {$EXTERNALSYM DMUS_MASTERTEMPO_MAX} + DMUS_MASTERTEMPO_MIN = 0.01; + {$EXTERNALSYM DMUS_MASTERTEMPO_MIN} + +const + DMUS_CURVE_RESET = 1; (* When set, the nResetValue must be sent when the + time is reached or an invalidate occurs because + of a transition. If not set, the curve stays + permanently stuck at the new value. *) + {$EXTERNALSYM DMUS_CURVE_RESET} + DMUS_CURVE_START_FROM_CURRENT = 2; (* Ignore Start, start the curve at the current value. + This only works for volume, expression, and pitchbend. *) + {$EXTERNALSYM DMUS_CURVE_START_FROM_CURRENT} + + + (* Curve shapes *) + DMUS_CURVES_LINEAR = 0; + {$EXTERNALSYM DMUS_CURVES_LINEAR} + DMUS_CURVES_INSTANT = 1; + {$EXTERNALSYM DMUS_CURVES_INSTANT} + DMUS_CURVES_EXP = 2; + {$EXTERNALSYM DMUS_CURVES_EXP} + DMUS_CURVES_LOG = 3; + {$EXTERNALSYM DMUS_CURVES_LOG} + DMUS_CURVES_SINE = 4; + {$EXTERNALSYM DMUS_CURVES_SINE} + + (* curve types *) + DMUS_CURVET_PBCURVE = $03; // Pitch bend curve. + {$EXTERNALSYM DMUS_CURVET_PBCURVE} + DMUS_CURVET_CCCURVE = $04; // Control change curve. + {$EXTERNALSYM DMUS_CURVET_CCCURVE} + DMUS_CURVET_MATCURVE = $05; // Mono aftertouch curve. + {$EXTERNALSYM DMUS_CURVET_MATCURVE} + DMUS_CURVET_PATCURVE = $06; // Poly aftertouch curve. + {$EXTERNALSYM DMUS_CURVET_PATCURVE} + DMUS_CURVET_RPNCURVE = $07; // RPN curve with curve type in wParamType. + {$EXTERNALSYM DMUS_CURVET_RPNCURVE} + DMUS_CURVET_NRPNCURVE = $08; // NRPN curve with curve type in wParamType. + {$EXTERNALSYM DMUS_CURVET_NRPNCURVE} + +const +(* notification type values *) + (* The following correspond to GUID_NOTIFICATION_SEGMENT *) + DMUS_NOTIFICATION_SEGSTART = 0; + {$EXTERNALSYM DMUS_NOTIFICATION_SEGSTART} + DMUS_NOTIFICATION_SEGEND = 1; + {$EXTERNALSYM DMUS_NOTIFICATION_SEGEND} + DMUS_NOTIFICATION_SEGALMOSTEND = 2; + {$EXTERNALSYM DMUS_NOTIFICATION_SEGALMOSTEND} + DMUS_NOTIFICATION_SEGLOOP = 3; + {$EXTERNALSYM DMUS_NOTIFICATION_SEGLOOP} + DMUS_NOTIFICATION_SEGABORT = 4; + {$EXTERNALSYM DMUS_NOTIFICATION_SEGABORT} + (* The following correspond to GUID_NOTIFICATION_PERFORMANCE *) + DMUS_NOTIFICATION_MUSICSTARTED = 0; + {$EXTERNALSYM DMUS_NOTIFICATION_MUSICSTARTED} + DMUS_NOTIFICATION_MUSICSTOPPED = 1; + {$EXTERNALSYM DMUS_NOTIFICATION_MUSICSTOPPED} + DMUS_NOTIFICATION_MUSICALMOSTEND = 2; + {$EXTERNALSYM DMUS_NOTIFICATION_MUSICALMOSTEND} + (* The following corresponds to GUID_NOTIFICATION_MEASUREANDBEAT *) + DMUS_NOTIFICATION_MEASUREBEAT = 0; + {$EXTERNALSYM DMUS_NOTIFICATION_MEASUREBEAT} + (* The following corresponds to GUID_NOTIFICATION_CHORD *) + DMUS_NOTIFICATION_CHORD = 0; + {$EXTERNALSYM DMUS_NOTIFICATION_CHORD} + (* The following correspond to GUID_NOTIFICATION_COMMAND *) + DMUS_NOTIFICATION_GROOVE = 0; + {$EXTERNALSYM DMUS_NOTIFICATION_GROOVE} + DMUS_NOTIFICATION_EMBELLISHMENT = 1; + {$EXTERNALSYM DMUS_NOTIFICATION_EMBELLISHMENT} + (* The following corresponds to GUID_NOTIFICATION_RECOMPOSE *) + DMUS_NOTIFICATION_RECOMPOSE = 0; + {$EXTERNALSYM DMUS_NOTIFICATION_RECOMPOSE} + +const + DMUS_WAVEF_OFF = 1; // If wave is playing and this is the off message. + {$EXTERNALSYM DMUS_WAVEF_OFF} + DMUS_WAVEF_STREAMING = 2; // If wave is streaming. + {$EXTERNALSYM DMUS_WAVEF_STREAMING} + DMUS_WAVEF_NOINVALIDATE = 4; // Don't invalidate this wave. + {$EXTERNALSYM DMUS_WAVEF_NOINVALIDATE} + DMUS_WAVEF_NOPREROLL = 8; // Don't preroll any wave data. + {$EXTERNALSYM DMUS_WAVEF_NOPREROLL} + DMUS_WAVEF_IGNORELOOPS = $20; // Ignore segment looping. + {$EXTERNALSYM DMUS_WAVEF_IGNORELOOPS} + +const + DMUS_MAX_NAME = 64; (* Maximum object name length. *) + {$EXTERNALSYM DMUS_MAX_NAME} + DMUS_MAX_CATEGORY = 64; (* Maximum object category name length. *) + {$EXTERNALSYM DMUS_MAX_CATEGORY} + DMUS_MAX_FILENAME = MAX_PATH; + {$EXTERNALSYM DMUS_MAX_FILENAME} + +type + PDMusVersion = ^TDMusVersion; + _DMUS_VERSION = packed record + dwVersionMS: DWORD; + dwVersionLS: DWORD; + end; + {$EXTERNALSYM _DMUS_VERSION} + DMUS_VERSION = _DMUS_VERSION; + {$EXTERNALSYM DMUS_VERSION} + TDMusVersion = _DMUS_VERSION; + + // Time Signature structure, used by IDirectMusicStyle + // Also used as a parameter for GetParam() and SetParam + PDMusTimeSignature = ^TDMusTimeSignature; + _DMUS_TIMESIGNATURE = packed record + mtTime: TMusicTime; + bBeatsPerMeasure: Byte; (* beats per measure (top of time sig) *) + bBeat: Byte; (* what note receives the beat (bottom of time sig.) *) + (* we can assume that 0 means 256th note *) + wGridsPerBeat: Word; (* grids per beat *) + end; + {$EXTERNALSYM _DMUS_TIMESIGNATURE} + DMUS_TIMESIGNATURE = _DMUS_TIMESIGNATURE; + {$EXTERNALSYM DMUS_TIMESIGNATURE} + TDMusTimeSignature = _DMUS_TIMESIGNATURE; + + PDMusValidStartParam = ^TDMusValidStartParam; + _DMUS_VALID_START_PARAM = packed record + mtTime: TMUSICTIME; (* Time of the first legal start + point after (or including) the requested time. + This is a returned value. + Time format is the relative offset from requested time. *) + end; + {$EXTERNALSYM _DMUS_VALID_START_PARAM} + DMUS_VALID_START_PARAM = _DMUS_VALID_START_PARAM; + {$EXTERNALSYM DMUS_VALID_START_PARAM} + TDMusValidStartParam = _DMUS_VALID_START_PARAM; + + PDMusPlayMarkerParam = ^TDMusPlayMarkerParam; + _DMUS_PLAY_MARKER_PARAM = packed record + mtTime: TMusicTime; (* Time of the first legal segment play + marker before (or including) the requested time. + This is a returned value. + Time format is the relative offset from requested time. *) + end; + {$EXTERNALSYM _DMUS_PLAY_MARKER_PARAM} + DMUS_PLAY_MARKER_PARAM = _DMUS_PLAY_MARKER_PARAM; + {$EXTERNALSYM DMUS_PLAY_MARKER_PARAM} + TDMusPlayMarkerParam = _DMUS_PLAY_MARKER_PARAM; + +// The DMUSOBJECTDESC structure is used to communicate everything you could +// possibly use to describe a DirectMusic object. + + PDMusObjectDesc = ^TDMusObjectDesc; + _DMUS_OBJECTDESC = packed record + dwSize: DWORD; (* Size of this structure. *) + dwValidData: DWORD; (* Flags indicating which fields below are valid. *) + guidObject: TGUID; (* Unique ID for this object. *) + guidClass: TGUID; (* GUID for the class of object. *) + ftDate: TFileTime; (* Last edited date of object. *) + vVersion: TDMusVersion; (* Version. *) + wszName: array[0..DMUS_MAX_NAME-1] of WideChar; (* Name of object. *) + wszCategory: array[0..DMUS_MAX_CATEGORY-1] of WideChar; (* Category for object (optional). *) + wszFileName: array[0..DMUS_MAX_FILENAME-1] of WideChar; (* File path. *) + llMemLength: LONGLONG; (* Size of Memory data. *) + pbMemData: PByte; (* Memory pointer for data. *) + pStream: IStream; (* Stream with data. *) + end; + {$EXTERNALSYM _DMUS_OBJECTDESC} + DMUS_OBJECTDESC = _DMUS_OBJECTDESC; + {$EXTERNALSYM DMUS_OBJECTDESC} + TDMusObjectDesc = _DMUS_OBJECTDESC; + +// Flags for dwValidData. When set, a flag indicates that the +// corresponding field in DMUSOBJECTDESC holds valid data. + +const + DMUS_OBJ_OBJECT = (1 shl 0); (* Object GUID is valid. *) + {$EXTERNALSYM DMUS_OBJ_OBJECT} + DMUS_OBJ_CLASS = (1 shl 1); (* Class GUID is valid. *) + {$EXTERNALSYM DMUS_OBJ_CLASS} + DMUS_OBJ_NAME = (1 shl 2); (* Name is valid. *) + {$EXTERNALSYM DMUS_OBJ_NAME} + DMUS_OBJ_CATEGORY = (1 shl 3); (* Category is valid. *) + {$EXTERNALSYM DMUS_OBJ_CATEGORY} + DMUS_OBJ_FILENAME = (1 shl 4); (* File path is valid. *) + {$EXTERNALSYM DMUS_OBJ_FILENAME} + DMUS_OBJ_FULLPATH = (1 shl 5); (* Path is full path. *) + {$EXTERNALSYM DMUS_OBJ_FULLPATH} + DMUS_OBJ_URL = (1 shl 6); (* Path is URL. *) + {$EXTERNALSYM DMUS_OBJ_URL} + DMUS_OBJ_VERSION = (1 shl 7); (* Version is valid. *) + {$EXTERNALSYM DMUS_OBJ_VERSION} + DMUS_OBJ_DATE = (1 shl 8); (* Date is valid. *) + {$EXTERNALSYM DMUS_OBJ_DATE} + DMUS_OBJ_LOADED = (1 shl 9); (* Object is currently loaded in memory. *) + {$EXTERNALSYM DMUS_OBJ_LOADED} + DMUS_OBJ_MEMORY = (1 shl 10); (* Object is pointed to by pbMemData. *) + {$EXTERNALSYM DMUS_OBJ_MEMORY} + DMUS_OBJ_STREAM = (1 shl 11); (* Object is stored in pStream. *) + {$EXTERNALSYM DMUS_OBJ_STREAM} + +type +(* The DMUS_SCRIPT_ERRORINFO structure describes an error that occurred in a script. + It is returned by methods in IDirectMusicScript. *) + PDMusScriptErrorInfo = ^TDMusScriptErrorInfo; + _DMUS_SCRIPT_ERRORINFO = packed record + dwSize: DWORD; (* Size of this structure. *) + hr: HRESULT; + ulLineNumber: Cardinal; + ichCharPosition: Longint; + wszSourceFile: array[0..DMUS_MAX_FILENAME-1] of WideChar; + wszSourceComponent: array[0..DMUS_MAX_FILENAME-1] of WideChar; + wszDescription: array[0..DMUS_MAX_FILENAME-1] of WideChar; + wszSourceLineText: array[0..DMUS_MAX_FILENAME-1] of WideChar; + end; + {$EXTERNALSYM _DMUS_SCRIPT_ERRORINFO} + DMUS_SCRIPT_ERRORINFO = _DMUS_SCRIPT_ERRORINFO; + {$EXTERNALSYM DMUS_SCRIPT_ERRORINFO} + TDMusScriptErrorInfo = _DMUS_SCRIPT_ERRORINFO; + +(* Track configuration flags, used with IDirectMusicSegment8::SetTrackConfig() *) + +const + DMUS_TRACKCONFIG_OVERRIDE_ALL = 1; (* This track should get parameters from this segment before controlling and primary tracks. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_OVERRIDE_ALL} + DMUS_TRACKCONFIG_OVERRIDE_PRIMARY = 2; (* This track should get parameters from this segment before the primary segment tracks. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_OVERRIDE_PRIMARY} + DMUS_TRACKCONFIG_FALLBACK = 4; (* This track should get parameters from this segment if the primary and controlling segments don't succeed. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_FALLBACK} + DMUS_TRACKCONFIG_CONTROL_ENABLED = 8; (* GetParam() enabled for this track. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_CONTROL_ENABLED} + DMUS_TRACKCONFIG_PLAY_ENABLED = $10; (* Play() enabled for this track. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_PLAY_ENABLED} + DMUS_TRACKCONFIG_NOTIFICATION_ENABLED = $20; (* Notifications enabled for this track. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_NOTIFICATION_ENABLED} + DMUS_TRACKCONFIG_PLAY_CLOCKTIME = $40; (* This track plays in clock time, not music time. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_PLAY_CLOCKTIME} + DMUS_TRACKCONFIG_PLAY_COMPOSE = $80; (* This track should regenerate data each time it starts playing. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_PLAY_COMPOSE} + DMUS_TRACKCONFIG_LOOP_COMPOSE = $100; (* This track should regenerate data each time it repeats. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_LOOP_COMPOSE} + DMUS_TRACKCONFIG_COMPOSING = $200; (* This track is used to compose other tracks. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_COMPOSING} + DMUS_TRACKCONFIG_CONTROL_PLAY = $10000; (* This track, when played in a controlling segment, overrides playback of primary segment tracks. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_CONTROL_PLAY} + DMUS_TRACKCONFIG_CONTROL_NOTIFICATION = $20000; (* This track, when played in a controlling segment, overrides notification of primary segment tracks. *) + {$EXTERNALSYM DMUS_TRACKCONFIG_CONTROL_NOTIFICATION} +(* Additional track config flags for composing transitions *) + DMUS_TRACKCONFIG_TRANS1_FROMSEGSTART = $400; (* Get track info from start of From segment *) + {$EXTERNALSYM DMUS_TRACKCONFIG_TRANS1_FROMSEGSTART} + DMUS_TRACKCONFIG_TRANS1_FROMSEGCURRENT = $800; (* Get track info from current place in From segment *) + {$EXTERNALSYM DMUS_TRACKCONFIG_TRANS1_FROMSEGCURRENT} + DMUS_TRACKCONFIG_TRANS1_TOSEGSTART = $1000; (* Get track info from start of To segment *) + {$EXTERNALSYM DMUS_TRACKCONFIG_TRANS1_TOSEGSTART} + DMUS_TRACKCONFIG_DEFAULT = (DMUS_TRACKCONFIG_CONTROL_ENABLED or DMUS_TRACKCONFIG_PLAY_ENABLED or DMUS_TRACKCONFIG_NOTIFICATION_ENABLED); + {$EXTERNALSYM DMUS_TRACKCONFIG_DEFAULT} + +type + // Get/SetParam structs for commands + // PARAM structures, used by GetParam() and SetParam() + PDMusCommandParam = ^TDMusCommandParam; + _DMUS_COMMAND_PARAM = packed record + bCommand: Byte; + bGrooveLevel: Byte; + bGrooveRange: Byte; + bRepeatMode: Byte; + end; + {$EXTERNALSYM _DMUS_COMMAND_PARAM} + DMUS_COMMAND_PARAM = _DMUS_COMMAND_PARAM; + {$EXTERNALSYM DMUS_COMMAND_PARAM} + TDMusCommandParam = _DMUS_COMMAND_PARAM; + + PDMusCommandParam2 = ^TDMusCommandParam2; + _DMUS_COMMAND_PARAM_2 = packed record + mtTime: TMusicTime; + bCommand: Byte; + bGrooveLevel: Byte; + bGrooveRange: Byte; + bRepeatMode: Byte; + end; + {$EXTERNALSYM _DMUS_COMMAND_PARAM_2} + DMUS_COMMAND_PARAM_2 = _DMUS_COMMAND_PARAM_2; + {$EXTERNALSYM DMUS_COMMAND_PARAM_2} + TDMusCommandParam2 = _DMUS_COMMAND_PARAM_2; + +const + DMUSB_LOADED = (1 shl 0); (* Set when band has been loaded *) + {$EXTERNALSYM DMUSB_LOADED} + DMUSB_DEFAULT = (1 shl 1); (* Set when band is default band for a style *) + {$EXTERNALSYM DMUSB_DEFAULT} + + +type + IDirectMusicTrack = interface; + IDirectMusicSegment = interface; + IDirectMusicSegmentState = interface; + IDirectMusicGraph = interface; + IDirectMusicPerformance = interface; + IDirectMusicTool = interface; + IDirectMusicChordMap = interface; + + PIDirectMusicSegmentState = ^IDirectMusicSegmentState; + + +// Translator: Structure declarations below (until interface declaration) were +// moved here from above of header due to refereces to IDirectMusicTool and +// IDirectMusicGraph interfaces + +{ +//Translator: this '#define' will be used later is several places +//#define DMUS_PMSG_PART + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) +} + +(* every DMUS_PMSG is based off of this structure. The Performance needs + to access these members consistently in every PMSG that goes through it. *) + PDMusPMsg = ^TDMusPMsg; + _DMUS_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + end; + {$EXTERNALSYM _DMUS_PMSG} + DMUS_PMSG = _DMUS_PMSG; + {$EXTERNALSYM DMUS_PMSG} + TDMusPMsg = _DMUS_PMSG; + + (* DMUS_NOTE_PMSG *) + PDMusNotePMsg = ^TDMusNotePMsg; + _DMUS_NOTE_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; // real time (in 100 nanosecond increments) + mtTime: TMusicTime; // music time + dwFlags: DWORD; // various bits (see DMUS_PMSGF_FLAGS enumeration) + dwPChannel: DWORD; // Performance Channel. The Performance can + // use this to determine the port/channel. + dwVirtualTrackID: DWORD; // virtual track ID + pTool: IDirectMusicTool; // tool interface pointer + pGraph: IDirectMusicGraph; // tool graph interface pointer + dwType: DWORD; // PMSG type (see DMUS_PMSGT_TYPES defines) + dwVoiceID: DWORD; // unique voice id which allows synthesizers to + // identify a specific event. For DirectX 6.0, + // this field should always be 0. + dwGroupID: DWORD; // Track group id + punkUser: IUnknown; // user com pointer, auto released upon PMSG free + (* end DMUS_PMSG_PART *) + + mtDuration: TMusicTime; // duration + wMusicValue: Word; // Description of note in chord and key. + wMeasure: Word; // Measure in which this note occurs + nOffset: Smallint; // Offset from grid at which this note occurs + bBeat: Byte; // Beat (in measure) at which this note occurs + bGrid: Byte; // Grid offset from beat at which this note occurs + bVelocity: Byte; // Note velocity + bFlags: Byte; // see DMUS_NOTEF_FLAGS + bTimeRange: Byte; // Range to randomize time. + bDurRange: Byte; // Range to randomize duration. + bVelRange: Byte; // Range to randomize velocity. + bPlayModeFlags: Byte; // Play mode + bSubChordLevel: Byte; // Which subchord level this note uses. + bMidiValue: Byte; // The MIDI note value, converted from wMusicValue + cTranspose: Char; // Transposition to add to midi note value after converted from wMusicValue. + end; + {$EXTERNALSYM _DMUS_NOTE_PMSG} + DMUS_NOTE_PMSG = _DMUS_NOTE_PMSG; + {$EXTERNALSYM DMUS_NOTE_PMSG} + TDMusNotePMsg = _DMUS_NOTE_PMSG; + + (* DMUS_MIDI_PMSG *) + PDMusMidiPMsg = ^TDMusMidiPMsg; + _DMUS_MIDI_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + bStatus: Byte; + bByte1: Byte; + bByte2: Byte; + bPad: array[0..0] of Byte; + end; + {$EXTERNALSYM _DMUS_MIDI_PMSG} + DMUS_MIDI_PMSG = _DMUS_MIDI_PMSG; + {$EXTERNALSYM DMUS_MIDI_PMSG} + TDMusMidiPMsg = _DMUS_MIDI_PMSG; + + (* DMUS_PATCH_PMSG *) + PDMusPatchPMsg = ^TDMusPatchPMsg; + _DMUS_PATCH_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + byInstrument: Byte; + byMSB: Byte; + byLSB: Byte; + byPad: array[0..0] of Byte; + end; + {$EXTERNALSYM _DMUS_PATCH_PMSG} + DMUS_PATCH_PMSG = _DMUS_PATCH_PMSG; + {$EXTERNALSYM DMUS_PATCH_PMSG} + TDMusPatchPMsg = _DMUS_PATCH_PMSG; + + (* DMUS_TRANSPOSE_PMSG *) + PDMusTransposePMsg = ^TDMusTransposePMsg; + _DMUS_TRANSPOSE_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + nTranspose: Smallint; + (* Following exists only under DX8 and on (check dwFlags for DMUS_PMSGF_DX8) *) + wMergeIndex: Word; (* Allows multiple parameters to be merged (pitchbend, volume, and expression.)*) + end; + {$EXTERNALSYM _DMUS_TRANSPOSE_PMSG} + DMUS_TRANSPOSE_PMSG = _DMUS_TRANSPOSE_PMSG; + {$EXTERNALSYM DMUS_TRANSPOSE_PMSG} + TDMusTransposePMsg = _DMUS_TRANSPOSE_PMSG; + + (* DMUS_CHANNEL_PRIORITY_PMSG *) + PDMusChannelPriorityPMsg = ^TDMusChannelPriorityPMsg; + _DMUS_CHANNEL_PRIORITY_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + dwChannelPriority: DWORD; + end; + {$EXTERNALSYM _DMUS_CHANNEL_PRIORITY_PMSG} + DMUS_CHANNEL_PRIORITY_PMSG = _DMUS_CHANNEL_PRIORITY_PMSG; + {$EXTERNALSYM DMUS_CHANNEL_PRIORITY_PMSG} + TDMusChannelPriorityPMsg = _DMUS_CHANNEL_PRIORITY_PMSG; + + (* DMUS_TEMPO_PMSG *) + PDMusTempoPMsg = ^TDMusTempoPMsg; + _DMUS_TEMPO_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + dblTempo: Double; (* the tempo *) + end; + {$EXTERNALSYM _DMUS_TEMPO_PMSG} + DMUS_TEMPO_PMSG = _DMUS_TEMPO_PMSG; + {$EXTERNALSYM DMUS_TEMPO_PMSG} + TDMusTempoPMsg = _DMUS_TEMPO_PMSG; + + (* DMUS_SYSEX_PMSG *) + PDMusSysexPMsg = ^TDMusSysexPMsg; + _DMUS_SYSEX_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + dwLen: DWORD; // length of the data + abData: array[0..0] of Byte; // array of data, length equal to dwLen + end; + {$EXTERNALSYM _DMUS_SYSEX_PMSG} + DMUS_SYSEX_PMSG = _DMUS_SYSEX_PMSG; + {$EXTERNALSYM DMUS_SYSEX_PMSG} + TDMusSysexPMsg = _DMUS_SYSEX_PMSG; + + (* DMUS_CURVE_PMSG *) + PDMusCurvePMsg = ^TDMusCurvePMsg; + _DMUS_CURVE_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + mtDuration: TMusicTime; // how long this curve lasts + mtOriginalStart: TMusicTime; // must be set to either zero when this PMSG is created or to the original mtTime of the curve + mtResetDuration: TMusicTime; (* how long after the curve is finished to allow a flush or + invalidation to reset to the reset value, nResetValue *) + nStartValue: Smallint; // curve's start value + nEndValue: Smallint; // curve's end value + nResetValue: Smallint; (* curve's reset value, set when a flush or invalidation + occurs within mtDuration + mtResetDuration *) + wMeasure: Word; // Measure in which this curve occurs + nOffset: Smallint; // Offset from grid at which this curve occurs + bBeat: Byte; // Beat (in measure) at which this curve occurs + bGrid: Byte; // Grid offset from beat at which this curve occurs + bType: Byte; // type of curve + bCurveShape: Byte; // shape of curve + bCCData: Byte; // CC# if this is a control change type + bFlags: Byte; // Curve reset and start from current value flags. + // Following exists only under DX8 and on (check dwFlags for DMUS_PMSGF_DX8) + wParamType: Word; // RPN or NRPN parameter number. + wMergeIndex: Word; // Allows multiple parameters to be merged (pitchbend, volume, and expression.)*/ + end; + {$EXTERNALSYM _DMUS_CURVE_PMSG} + DMUS_CURVE_PMSG = _DMUS_CURVE_PMSG; + {$EXTERNALSYM DMUS_CURVE_PMSG} + TDMusCurvePMsg = _DMUS_CURVE_PMSG; + + enumDMUS_CURVE_FLAGS = DWORD; + DMUS_CURVE_FLAGS = enumDMUS_CURVE_FLAGS; + {$EXTERNALSYM DMUS_CURVE_FLAGS} + TDMusCurveFlags = DMUS_CURVE_FLAGS; + PDMusCurveFlags = ^TDMusCurveFlags; + + (* DMUS_TIMESIG_PMSG *) + PDMusTimeSigPMsg = ^TDMusTimesigPMsg; + _DMUS_TIMESIG_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + // Time signatures define how many beats per measure, which note receives + // the beat, and the grid resolution. + bBeatsPerMeasure: Byte; // beats per measure (top of time sig) + bBeat: Byte; // what note receives the beat (bottom of time sig.) + // we can assume that 0 means 256th note + wGridsPerBeat: Word; // grids per beat + end; + {$EXTERNALSYM _DMUS_TIMESIG_PMSG} + DMUS_TIMESIG_PMSG = _DMUS_TIMESIG_PMSG; + {$EXTERNALSYM DMUS_TIMESIG_PMSG} + TDMusTimeSigPMsg = _DMUS_TIMESIG_PMSG; + + (* DMUS_NOTIFICATION_PMSG *) + PDMusNotificationPMsg = ^TDMusNotificationPMsg; + _DMUS_NOTIFICATION_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + guidNotificationType: TGUID; + dwNotificationOption: DWORD; + dwField1: DWORD; + dwField2: DWORD; + end; + {$EXTERNALSYM _DMUS_NOTIFICATION_PMSG} + DMUS_NOTIFICATION_PMSG = _DMUS_NOTIFICATION_PMSG; + {$EXTERNALSYM DMUS_NOTIFICATION_PMSG} + TDMusNotificationPMsg = _DMUS_NOTIFICATION_PMSG; + + (* DMUS_WAVE_PMSG *) + PDMusWavePMsg = ^TDMusWavePMsg; + _DMUS_WAVE_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + rtStartOffset: TReferenceTime; (* How far into the wave to start, in reference time units only. *) + rtDuration: TReferenceTime; (* Duration of the wave, in either reference time or music time. *) + lOffset: Longint; (* Offset from actual time to logical time, in music or ref time. *) + lVolume: Longint; (* Initial volume, in 100ths of a dB. *) + lPitch: Longint; (* Initial pitch, in 100ths of a semitone. *) + bFlags: Byte; (* Flags, including DMUS_WAVEF_OFF... *) + end; + {$EXTERNALSYM _DMUS_WAVE_PMSG} + DMUS_WAVE_PMSG = _DMUS_WAVE_PMSG; + {$EXTERNALSYM DMUS_WAVE_PMSG} + TDMusWavePMsg = _DMUS_WAVE_PMSG; + + (* DMUS_LYRIC_PMSG *) + PDMusLyricPMsg = ^TDMusLyricPMsg; + _DMUS_LYRIC_PMSG = packed record + (* begin DMUS_PMSG_PART *) + dwSize: DWORD; + rtTime: TReferenceTime; (* real time (in 100 nanosecond increments) *) + mtTime: TMusicTime; (* music time *) + dwFlags: DWORD; (* various bits (see DMUS_PMSGF_FLAGS enumeration) *) + dwPChannel: DWORD; (* Performance Channel. The Performance can *) + (* use this to determine the port/channel. *) + dwVirtualTrackID: DWORD; (* virtual track ID *) + pTool: IDirectMusicTool; (* tool interface pointer *) + pGraph: IDirectMusicGraph; (* tool graph interface pointer *) + dwType: DWORD; (* PMSG type (see DMUS_PMSGT_TYPES defines) *) + dwVoiceID: DWORD; (* unique voice id which allows synthesizers to *) + (* identify a specific event. For DirectX 6.0, *) + (* this field should always be 0. *) + dwGroupID: DWORD; (* Track group id *) + punkUser: IUnknown; (* user com pointer, auto released upon PMSG free *) + (* end DMUS_PMSG_PART *) + + wszString: array[0..0] of WideChar; (* null-terminated Unicode lyric string (structure is actually larger than size 1) *) + end; + {$EXTERNALSYM _DMUS_LYRIC_PMSG} + DMUS_LYRIC_PMSG = _DMUS_LYRIC_PMSG; + {$EXTERNALSYM DMUS_LYRIC_PMSG} + TDMusLyricPMsg = _DMUS_LYRIC_PMSG; + + + +(*)/////////////////////////////////////////////////////////////////// +// IDirectMusicBand *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicBand);'} + {$EXTERNALSYM IDirectMusicBand} + IDirectMusicBand = interface(IUnknown) + ['{d2ac28c0-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicBand *) + function CreateSegment(out ppSegment: IDirectMusicSegment): HResult; stdcall; + function Download(pPerformance: IDirectMusicPerformance): HResult; stdcall; + function Unload(pPerformance: IDirectMusicPerformance): HResult; stdcall; + end; + + IDirectMusicBand8 = IDirectMusicBand; + {$NODEFINE IDirectMusicBand8} + {$HPPEMIT 'typedef _di_IDirectMusicBand _di_IDirectMusicBand8;'} + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicObject *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicObject);'} + {$EXTERNALSYM IDirectMusicObject} + IDirectMusicObject = interface(IUnknown) + ['{d2ac28b5-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicObject *) + function GetDescriptor(out pDesc: TDMusObjectDesc): HResult; stdcall; + function SetDescriptor(const pDesc: TDMusObjectDesc): HResult; stdcall; + function ParseDescriptor(var pStream; out pDesc: TDMusObjectDesc): HResult; stdcall; + end; + + IDirectMusicObject8 = IDirectMusicObject; + {$NODEFINE IDirectMusicObject8} + {$HPPEMIT 'typedef _di_IDirectMusicObject _di_IDirectMusicObject8;'} + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicLoader *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicLoader);'} + {$EXTERNALSYM IDirectMusicLoader} + IDirectMusicLoader = interface(IUnknown) + ['{2ffaaca2-5dca-11d2-afa6-00aa0024d8b6}'] + (* IDirectMusicLoader *) + function GetObject(const pDesc: TDMusObjectDesc; const riid : TGUID; + out ppv): HResult; stdcall; + function SetObject(const pDesc: TDMusObjectDesc): HResult; stdcall; + function SetSearchDirectory(const rguidClass: TGUID; pwzPath: PWideChar; + fClear: BOOL): HResult; stdcall; + function ScanDirectory(const rguidClass: TGUID; pwzFileExtension, + pwzScanFileName: PWideChar): HResult; stdcall; + function CacheObject(pObject: IDirectMusicObject): HResult; stdcall; + function ReleaseObject(pObject: IDirectMusicObject): HResult; stdcall; + function ClearCache(const rguidClass: TGUID): HResult; stdcall; + function EnableCache(const rguidClass: TGUID; fEnable: BOOL): HResult; stdcall; + function EnumObject(const rguidClass: TGUID; dwIndex: DWORD; + const pDesc: TDMusObjectDesc): HResult; stdcall; + end; + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicLoader8 *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicLoader8);'} + {$EXTERNALSYM IDirectMusicLoader8} + IDirectMusicLoader8 = interface(IDirectMusicLoader) + ['{19e7c08c-0a44-4e6a-a116-595a7cd5de8c}'] + (* IDirectMusicLoader8 *) + function CollectGarbage: HResult; stdcall; + function ReleaseObjectByUnknown(pObject: IUnknown): HResult; stdcall; + function LoadObjectFromFile(const rguidClassID: TGUID; const iidInterfaceID: TGUID; + pwzFilePath: PWideChar; out ppObject): HResult; stdcall; + end; + +(* Stream object supports IDirectMusicGetLoader interface to access loader while file parsing. *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicGetLoader);'} + {$EXTERNALSYM IDirectMusicGetLoader} + IDirectMusicGetLoader = interface(IUnknown) + ['{68a04844-d13d-11d1-afa6-00aa0024d8b6}'] + (* IDirectMusicGetLoader *) + function GetLoader(out ppLoader: IDirectMusicLoader): HResult; stdcall; + end; + + IDirectMusicGetLoader8 = IDirectMusicGetLoader; + {$NODEFINE IDirectMusicGetLoader8} + {$HPPEMIT 'typedef _di_IDirectMusicGetLoader _di_IDirectMusicGetLoader8;'} + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicSegment *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicSegment);'} + {$EXTERNALSYM IDirectMusicSegment} + IDirectMusicSegment = interface(IUnknown) + ['{f96029a2-4282-11d2-8717-00600893b1bd}'] + (* IDirectMusicSegment *) + function GetLength(out pmtLength: TMusicTime): HResult; stdcall; + function SetLength(mtLength: TMusicTime): HResult; stdcall; + function GetRepeats(out pdwRepeats: DWORD): HResult; stdcall; + function SetRepeats(dwRepeats: DWORD): HResult; stdcall; + function GetDefaultResolution(out pdwResolution: DWORD): HResult; stdcall; + function SetDefaultResolution(dwResolution: DWORD): HResult; stdcall; + function GetTrack(const rguidType: TGUID; dwGroupBits, dwIndex: DWORD; + out ppTrack: IDirectMusicTrack): HResult; stdcall; + function GetTrackGroup(pTrack: IDirectMusicTrack; out pdwGroupBits: DWORD): HResult; stdcall; + function InsertTrack(pTrack: IDirectMusicTrack; dwGroupBits: DWORD): HResult; stdcall; + function RemoveTrack(pTrack: IDirectMusicTrack): HResult; stdcall; + function InitPlay(out ppSegState: IDirectMusicSegmentState; + pPerformance: IDirectMusicPerformance; dwFlags: DWORD): HResult; stdcall; + function GetGraph(out ppGraph: IDirectMusicGraph): HResult; stdcall; + function SetGraph(pGraph: IDirectMusicGraph): HResult; stdcall; + function AddNotificationType(const rguidNotificationType: TGUID): HResult; stdcall; + function RemoveNotificationType(const rguidNotificationType: TGUID): HResult; stdcall; + function GetParam(const rguidType: TGUID; dwGroupBits, dwIndex: DWORD; + mtTime: TMusicTime; out pmtNext: TMusicTime; pParam: Pointer): HResult; stdcall; + function SetParam(const rguidType: TGUID; dwGroupBits, dwIndex: DWORD; + mtTime: TMusicTime; pParam: Pointer): HResult; stdcall; + function Clone(mtStart: TMusicTime; mtEnd: TMusicTime; + out ppSegment: IDirectMusicSegment): HResult; stdcall; + function SetStartPoint(mtStart: TMusicTime): HResult; stdcall; + function GetStartPoint(out pmtStart: TMusicTime): HResult; stdcall; + function SetLoopPoints(mtStart: TMusicTime; mtEnd: TMusicTime): HResult; stdcall; + function GetLoopPoints(out pmtStart, pmtEnd: TMusicTime): HResult; stdcall; + function SetPChannelsUsed(dwNumPChannels: DWORD; var paPChannels: DWORD): HResult; stdcall; + end; + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicSegment8 *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicSegment8);'} + {$EXTERNALSYM IDirectMusicSegment8} + IDirectMusicSegment8 = interface(IDirectMusicSegment) + ['{c6784488-41a3-418f-aa15-b35093ba42d4}'] + (* IDirectMusicSegment8 *) + function SetTrackConfig(const rguidTrackClassID: TGUID; + dwGroupBits, dwIndex, dwFlagsOn, dwFlagsOff: DWORD): HResult; stdcall; + function GetAudioPathConfig(out ppAudioPathConfig: IUnknown): HResult; stdcall; + function Compose(mtTime: TMusicTime; pFromSegment, pToSegment: IDirectMusicSegment; + out ppComposedSegment: IDirectMusicSegment): HResult; stdcall; + function Download(pAudioPath: IUnknown): HResult; stdcall; + function Unload(pAudioPath: IUnknown): HResult; stdcall; + end; + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicSegmentState *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicSegmentState);'} + {$EXTERNALSYM IDirectMusicSegmentState} + IDirectMusicSegmentState = interface(IUnknown) + ['{a3afdcc7-d3ee-11d1-bc8d-00a0c922e6eb}'] + (* IDirectMusicSegmentState *) + function GetRepeats(out pdwRepeats: DWORD): HResult; stdcall; + function GetSegment(out ppSegment: IDirectMusicSegment): HResult; stdcall; + function GetStartTime(out pmtStart: TMusicTime): HResult; stdcall; + function GetSeek(out pmtSeek: TMusicTime): HResult; stdcall; + function GetStartPoint(out pmtStart: TMusicTime): HResult; stdcall; + end; + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicSegmentState8 *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicSegmentState8);'} + {$EXTERNALSYM IDirectMusicSegmentState8} + IDirectMusicSegmentState8 = interface(IDirectMusicSegmentState) + ['{a50e4730-0ae4-48a7-9839-bc04bfe07772}'] + (* IDirectMusicSegmentState8 *) + function SetTrackConfig( + const rguidTrackClassID: TGUID; // Class ID of the type of track on which to set the configuration flags. + dwGroupBits, // Group bits. + dwIndex, // Nth track (or DMUS_SEG_ALLTRACKS) that matches class id and group id. + dwFlagsOn, // DMUS_TRACKCONFIG_ flags to enable. + dwFlagsOff: DWORD): HResult; stdcall; // DMUS_TRACKCONFIG_ flags to disable. + function GetObjectInPath( + dwPChannel, // PChannel to search. + dwStage, // Which stage in the path. + dwBuffer: DWORD; // Which buffer to address, if more than one. + const guidObject: TGUID; // ClassID of object. + dwIndex: DWORD; // Which object of that class. + const iidInterface: TGUID; // Requested COM interface. + out ppObject): HResult; stdcall; // Pointer to interface. + end; + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicAudioPath *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicAudioPath);'} + {$EXTERNALSYM IDirectMusicAudioPath} + IDirectMusicAudioPath = interface(IUnknown) + ['{c87631f5-23be-4986-8836-05832fcc48f9}'] + (* IDirectMusicAudioPath *) + function GetObjectInPath( + dwPChannel, // PChannel to search. + dwStage, // Which stage in the path. + dwBuffer: DWORD; // Which buffer to address, if more than one. + const guidObject: TGUID; // ClassID of object. + dwIndex: DWORD; // Which object of that class. + const iidInterface: TGUID; // Requested COM interface. + out ppObject): HResult; stdcall; // Pointer to interface. + function Activate(fActivate: BOOL): HResult; stdcall; // True to activate, False to deactivate. + function SetVolume(lVolume: Longint; // Gain, in 100ths of a dB. This must be negative (0 represents full volume.) + dwDuration: DWORD): HResult; stdcall; // Duration of volume ramp in milliseconds. Note that 0 is more efficient. + function ConvertPChannel (dwPChannelIn: DWORD; // Pchannel of source. + var pdwPChannelOut: DWORD): HResult; stdcall; // Equivalent pchannel on performance. + end; + + IDirectMusicAudioPath8 = IDirectMusicAudioPath; + {$NODEFINE IDirectMusicAudioPath8} + {$HPPEMIT 'typedef _di_IDirectMusicAudioPath _di_IDirectMusicAudioPath8;'} + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicPerformance *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicPerformance);'} + {$EXTERNALSYM IDirectMusicPerformance} + IDirectMusicPerformance = interface(IUnknown) + ['{07d43d03-6523-11d2-871d-00600893b1bd}'] + (* IDirectMusicPerformance *) + function Init(var ppDirectMusic: IDirectMusic; + pDirectSound: IDirectSound; hWnd: HWND): HResult; stdcall; + function PlaySegment(pSegment: IDirectMusicSegment; dwFlags: DWORD; + i64StartTime: LongLong; ppSegmentState: PIDirectMusicSegmentState): HResult; stdcall; + function Stop(pSegment: IDirectMusicSegment; pSegmentState: IDirectMusicSegmentState; + mtTime: TMusicTime; dwFlags: DWORD): HResult; stdcall; + function GetSegmentState(out ppSegmentState: IDirectMusicSegmentState; + mtTime: TMusicTime): HResult; stdcall; + function SetPrepareTime(dwMilliSeconds: DWORD): HResult; stdcall; + function GetPrepareTime(out pdwMilliSeconds: DWORD): HResult; stdcall; + function SetBumperLength(dwMilliSeconds: DWORD): HResult; stdcall; + function GetBumperLength(out pdwMilliSeconds: DWORD): HResult; stdcall; + function SendPMsg(pPMSG: PDMusPMsg): HResult; stdcall; + function MusicToReferenceTime(mtTime: TMusicTime; out prtTime: TReferenceTime): HResult; stdcall; + function ReferenceToMusicTime(rtTime: TReferenceTime; out pmtTime: TMusicTime): HResult; stdcall; + function IsPlaying(pSegment: IDirectMusicSegment; pSegState: IDirectMusicSegmentState): HResult; stdcall; + function GetTime(prtNow: PReference_Time; pmtNow: PMusicTime): HResult; stdcall; + function AllocPMsg(cb: ULONG; out ppPMSG: PDMusPMsg): HResult; stdcall; + function FreePMsg(pPMSG: PDMusPMsg): HResult; stdcall; + function GetGraph(out ppGraph: IDirectMusicGraph): HResult; stdcall; + function SetGraph(pGraph: IDirectMusicGraph): HResult; stdcall; + function SetNotificationHandle(hNotification: THANDLE; rtMinimum: TReferenceTime): HResult; stdcall; + function GetNotificationPMsg(out ppNotificationPMsg: PDMusNotificationPMsg): HResult; stdcall; + function AddNotificationType(const rguidNotificationType: TGUID): HResult; stdcall; + function RemoveNotificationType(const rguidNotificationType: TGUID): HResult; stdcall; + function AddPort(pPort: IDirectMusicPort): HResult; stdcall; + function RemovePort(pPort: IDirectMusicPort): HResult; stdcall; + function AssignPChannelBlock(dwBlockNum: DWORD; pPort: IDirectMusicPort; + dwGroup: DWORD): HResult; stdcall; + function AssignPChannel(dwPChannel: DWORD; pPort: IDirectMusicPort; + dwGroup, dwMChannel: DWORD): HResult; stdcall; + function PChannelInfo(dwPChannel: DWORD; out ppPort: IDirectMusicPort; + out pdwGroup, pdwMChannel: DWORD ): HResult; stdcall; + function DownloadInstrument(pInst: IDirectMusicInstrument; dwPChannel: DWORD; + out ppDownInst: IDirectMusicDownloadedInstrument; var pNoteRanges: TDMusNoteRange; + dwNumNoteRanges: DWORD; out ppPort: IDirectMusicPort; + out pdwGroup, pdwMChannel: DWORD): HResult; stdcall; + function Invalidate(mtTime: TMusicTime; dwFlags: DWORD): HResult; stdcall; + function GetParam(const rguidType: TGUID; dwGroupBits, dwIndex: DWORD; + mtTime: TMusicTime; out pmtNext: TMusicTime; pParam: Pointer): HResult; stdcall; + function SetParam(const rguidType: TGUID; dwGroupBits, dwIndex: DWORD; + mtTime: TMusicTime; pParam: Pointer): HResult; stdcall; + function GetGlobalParam(const rguidType: TGUID; pParam: Pointer; + dwSize: DWORD): HResult; stdcall; + function SetGlobalParam(const rguidType: TGUID; pParam: Pointer; + dwSize: DWORD): HResult; stdcall; + function GetLatencyTime(out prtTime: TReferenceTime): HResult; stdcall; + function GetQueueTime(out prtTime: TReferenceTime): HResult; stdcall; + function AdjustTime(rtAmount: TReferenceTime): HResult; stdcall; + function CloseDown : HResult; stdcall; + function GetResolvedTime(rtTime: TReferenceTime; out prtResolved: TReferenceTime; + dwTimeResolveFlags: DWORD): HResult; stdcall; + function MIDIToMusic(bMIDIValue: Byte; const pChord: TDMusChordKey; + bPlayMode, bChordLevel: Byte; out pwMusicValue: Word): HResult; stdcall; + function MusicToMIDI(wMusicValue: Word; const pChord: TDMusChordKey; + bPlayMode, bChordLevel: Byte; out pbMIDIValue: Byte): HResult; stdcall; + function TimeToRhythm(mtTime: TMusicTime; const pTimeSig: TDMusTimeSignature; + out pwMeasure: Word; out pbBeat, pbGrid: Byte; + out pnOffset: SmallInt): HResult; stdcall; + function RhythmToTime(wMeasure: Word; bBeat, bGrid: Byte; nOffset: Smallint; + const pTimeSig: TDMusTimeSignature; out pmtTime: TMusicTime): HResult; stdcall; + end; + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicPerformance8 *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicPerformance8);'} + {$EXTERNALSYM IDirectMusicPerformance8} + IDirectMusicPerformance8 = interface(IDirectMusicPerformance) + ['{679c4137-c62e-4147-b2b4-9d569acb254c}'] + (* IDirectMusicPerformance8 *) + function InitAudio( + ppDirectMusic: PIDirectMusic; // Optional DMusic pointer. + ppDirectSound: PIDirectSound; // Optional DSound pointer. + hWnd: hWnd; // HWND for DSound. + dwDefaultPathType, // Requested default audio path type, also optional. + dwPChannelCount, // Number of PChannels, if default audio path to be created. + dwFlags: DWORD; // DMUS_AUDIOF flags, if no pParams structure. + pParams: PDMUSAudioParams): HResult; stdcall; // Optional initialization structure, defining required voices, buffers, etc. + function PlaySegmentEx( + pSource: IUnknown; // Segment to play. + pwzSegmentName: PWideChar; // Not supported in DX8. + pTransition: IUnknown; // Optional template segment to compose transition with. + dwFlags: DWORD; // DMUS_SEGF_ flags. + i64StartTime: Int64; // Time to start playback. + out ppSegmentState: IDirectMusicSegmentState; // Returned Segment State. + pFrom, // Optional segmentstate or audiopath to replace. + pAudioPath: IUnknown): HResult; stdcall; // Optional audioPath to play on. + function StopEx(pObjectToStop: IUnknown; // Segstate, AudioPath, or Segment. + i64StopTime: int64; dwFlags: DWORD): HResult; stdcall; + function ClonePMsg(pSourcePMSG: TDMusPMsg; + var ppCopyPMSG: TDMusPMsg): HResult; stdcall; + function CreateAudioPath( + pSourceConfig: IUnknown; // Source configuration, from AudioPathConfig file. + fActivate: BOOL; // TRUE to activate on creation. + out ppNewPath: IDirectMusicAudioPath): HResult; stdcall; // Returns created audiopath. + function CreateStandardAudioPath( + dwType, // Type of path to create. + dwPChannelCount: DWORD; // How many PChannels to allocate for it. + fActivate: BOOL; // TRUE to activate on creation. + out ppNewPath: IDirectMusicAudioPath): HResult; stdcall; // Returns created audiopath. + function SetDefaultAudioPath(pAudioPath: IDirectMusicAudioPath): HResult; stdcall; + function GetDefaultAudioPath(out ppAudioPath: IDirectMusicAudioPath): HResult; stdcall; + function GetParamEx( + const rguidType: TGUID; // GetParam command ID. + dwTrackID, // Virtual track ID of caller. + dwGroupBits, // Group bits of caller. + dwIndex: DWORD; // Index to Nth parameter. + mtTime, // Time of requested parameter. + pmtNext: TMusicTime; // Returned delta to next parameter. + pParam: Pointer): HResult; stdcall; // Data structure to fill with parameter. + end; + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicGraph *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicGraph);'} + {$EXTERNALSYM IDirectMusicGraph} + IDirectMusicGraph = interface(IUnknown) + ['{2befc277-5497-11d2-bccb-00a0c922e6eb}'] + (* IDirectMusicGraph *) + function StampPMsg(var pPMSG: TDMusPMsg): HResult; stdcall; + function InsertTool(pTool: IDirectMusicTool; var pdwPChannels: DWORD; + cPChannels: DWORD; lIndex: LongInt): HResult; stdcall; + function GetTool(dwIndex: DWORD; out ppTool: IDirectMusicTool): HResult; stdcall; + function RemoveTool(pTool: IDirectMusicTool): HResult; stdcall; + end; + + IDirectMusicGraph8 = IDirectMusicGraph; + {$NODEFINE IDirectMusicGraph8} + {$HPPEMIT 'typedef _di_IDirectMusicGraph _di_IDirectMusicGraph8;'} + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicTool *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicTool);'} + {$EXTERNALSYM IDirectMusicTool} + IDirectMusicTool = interface(IUnknown) + ['{d2ac28ba-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicTool *) + function Init(pGraph: IDirectMusicGraph): HResult; stdcall; + function GetMsgDeliveryType(out pdwDeliveryType: DWORD): HResult; stdcall; + function GetMediaTypeArraySize(out pdwNumElements: DWORD): HResult; stdcall; + function GetMediaTypes(out padwMediaTypes: PDWORD; dwNumElements: DWORD): HResult; stdcall; + function ProcessPMsg(pPerf: IDirectMusicPerformance; pPMSG: PDMusPMsg): HResult; stdcall; + function Flush(pPerf: IDirectMusicPerformance; const pPMSG: TDMusPMsg; + rtTime: TReferenceTime): HResult; stdcall; + end; + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicStyle *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicStyle);'} + {$EXTERNALSYM IDirectMusicStyle} + IDirectMusicStyle = interface(IUnknown) + ['{d2ac28bd-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicStyle *) + function GetBand(pwszName: PWideChar; out ppBand: IDirectMusicBand): HResult; stdcall; + function EnumBand(dwIndex: DWORD; pwszName: PWideChar): HResult; stdcall; + function GetDefaultBand(out ppBand: IDirectMusicBand): HResult; stdcall; + function EnumMotif(dwIndex: DWORD; pwszName: PWideChar): HResult; stdcall; + function GetMotif(pwszName: PWideChar; out ppSegment: IDirectMusicSegment): HResult; stdcall; + function GetDefaultChordMap(out ppChordMap: IDirectMusicChordMap): HResult; stdcall; + function EnumChordMap(dwIndex: DWORD; pwszName: PWideChar): HResult; stdcall; + function GetChordMap(pwszName: PWideChar; out ppChordMap: IDirectMusicChordMap): HResult; stdcall; + function GetTimeSignature(out pTimeSig: TDMusTimeSignature): HResult; stdcall; + function GetEmbellishmentLength(dwType, dwLevel: DWORD; out pdwMin, pdwMax: DWORD): HResult; stdcall; + function GetTempo(out pTempo: Double): HResult; stdcall; + end; + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicStyle8 *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicStyle8);'} + {$EXTERNALSYM IDirectMusicStyle8} + IDirectMusicStyle8 = interface(IDirectMusicStyle) + ['{fd24ad8a-a260-453d-bf50-6f9384f70985}'] + (* IDirectMusicStyle8 *) + function EnumPattern(dwIndex, dwPatternType: DWORD; pwszName: PWideChar): HResult; stdcall; + end; + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicChordMap *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicChordMap);'} + {$EXTERNALSYM IDirectMusicChordMap} + IDirectMusicChordMap = interface(IUnknown) + ['{d2ac28be-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicChordMap *) + function GetScale(out pdwScale: DWORD): HResult; stdcall; + end; + + IDirectMusicChordMap8 = IDirectMusicChordMap; + {$NODEFINE IDirectMusicChordMap8} + {$HPPEMIT 'typedef _di_IDirectMusicChordMap _di_IDirectMusicChordMap8;'} + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicComposer *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicComposer);'} + {$EXTERNALSYM IDirectMusicComposer} + IDirectMusicComposer = interface(IUnknown) + ['{d2ac28bf-b39b-11d1-8704-00600893b1bd}'] + (* IDirectMusicComposer *) + function ComposeSegmentFromTemplate(pStyle: IDirectMusicStyle; + pTempSeg: IDirectMusicSegment; wActivity: Word; + pChordMap: IDirectMusicChordMap; out ppSectionSeg: IDirectMusicSegment): HResult; stdcall; + function ComposeSegmentFromShape(pStyle: IDirectMusicStyle; wNumMeasures, + wShape, wActivity: Word; fIntro: BOOL; fEnd: BOOL; + pChordMap: IDirectMusicChordMap; out ppSectionSeg: IDirectMusicSegment): HResult; stdcall; + function ComposeTransition(pFromSeg: IDirectMusicSegment; pToSeg: IDirectMusicSegment; + mtTime: TMusicTime; wCommand: Word; dwFlags: DWORD; pChordMap: IDirectMusicChordMap; + out ppSectionSeg: IDirectMusicSegment): HResult; stdcall; + function AutoTransition(pPerformance: IDirectMusicPerformance; + pToSeg: IDirectMusicSegment; wCommand: Word; dwFlags: DWORD; + pChordMap: IDirectMusicChordMap; out ppTransSeg: IDirectMusicSegment; + out ppToSegState: IDirectMusicSegmentState; out ppTransSegState: IDirectMusicSegmentState): HResult; stdcall; + function ComposeTemplateFromShape(wNumMeasures: Word; wShape: Word; fIntro: BOOL; + fEnd: BOOL; wEndLength: Word; out ppTempSeg:IDirectMusicSegment): HResult; stdcall; + function ChangeChordMap(pSectionSeg: IDirectMusicSegment; + fTrackScale: BOOL; pChordMap: IDirectMusicChordMap): HResult; stdcall; + end; + + IDirectMusicComposer8 = IDirectMusicComposer; + {$NODEFINE IDirectMusicComposer8} + {$HPPEMIT 'typedef _di_IDirectMusicComposer _di_IDirectMusicComposer8;'} + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicPatternTrack *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicPatternTrack);'} + {$EXTERNALSYM IDirectMusicPatternTrack} + IDirectMusicPatternTrack = interface(IUnknown) + ['{51c22e10-b49f-46fc-bec2-e6288fb9ede6}'] + (* IDirectMusicPatternTrack *) + function CreateSegment(pStyle: IDirectMusicStyle; + out ppSegment: IDirectMusicSegment): HResult; stdcall; + function SetVariation(pSegState: IDirectMusicSegmentState; + dwVariationFlags, dwPart: DWORD): HResult; stdcall; + function SetPatternByName(pSegState: IDirectMusicSegmentState; + wszName: PWideChar; pStyle: IDirectMusicStyle; dwPatternType: DWORD; + var pdwLength: DWORD): HResult; stdcall; + end; + + IDirectMusicPatternTrack8 = IDirectMusicPatternTrack; + {$NODEFINE IDirectMusicPatternTrack8} + {$HPPEMIT 'typedef _di_IDirectMusicPatternTrack _di_IDirectMusicPatternTrack8;'} + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicScript *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicScript);'} + {$EXTERNALSYM IDirectMusicScript} + IDirectMusicScript = interface(IUnknown) + ['{2252373a-5814-489b-8209-31fedebaf137}'] + (* IDirectMusicScript *) + function Init(pPerformance: IDirectMusicPerformance; + pErrorInfo: PDMusScriptErrorInfo): HResult; stdcall; + function CallRoutine(pwszRoutineName: PWideChar; + pErrorInfo: PDMusScriptErrorInfo): HResult; stdcall; + function SetVariableVariant(pwszVariableName: PWideChar; varValue: Variant; + fSetRef: BOOL; pErrorInfo: PDMusScriptErrorInfo): HResult; stdcall; + function GetVariableVariant(pwszVariableName: PWideChar; var pvarValue: Variant; + pErrorInfo: PDMusScriptErrorInfo): HResult; stdcall; + function SetVariableNumber(pwszVariableName: PWideChar; lValue: Longint; + pErrorInfo: PDMusScriptErrorInfo): HResult; stdcall; + function GetVariableNumber(pwszVariableName: PWideChar; var plValue: Longint; + pErrorInfo: PDMusScriptErrorInfo): HResult; stdcall; + function SetVariableObject(pwszVariableName: PWideChar; punkValue: IUnknown; + pErrorInfo: PDMusScriptErrorInfo): HResult; stdcall; + function GetVariableObject(pwszVariableName: PWideChar; const riid: TGUID; + out ppv; pErrorInfo: PDMusScriptErrorInfo): HResult; stdcall; + function EnumRoutine(dwIndex: DWORD; pwszName: PWideChar): HResult; stdcall; + function EnumVariable(dwIndex: DWORD; pwszName: PWideChar): HResult; stdcall; + end; + + IDirectMusicScript8 = IDirectMusicScript; + {$NODEFINE IDirectMusicScript8} + {$HPPEMIT 'typedef _di_IDirectMusicScript _di_IDirectMusicScript8;'} + +(*///////////////////////////////////////////////////////////////////// +// IDirectMusicContainer *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicContainer);'} + {$EXTERNALSYM IDirectMusicContainer} + IDirectMusicContainer = interface(IUnknown) + ['{9301e386-1f22-11d3-8226-d2fa76255d47}'] + (* IDirectMusicContainer *) + function EnumObject(const rguidClass: TGUID; dwIndex: DWORD; + pDesc: PDMusObjectDesc; pwszAlias: PWideChar): HResult; stdcall; + end; + + IDirectMusicContainer8 = IDirectMusicContainer; + {$NODEFINE IDirectMusicContainer8} + {$HPPEMIT 'typedef _di_IDirectMusicContainer _di_IDirectMusicContainer8;'} + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicTrack *) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicTrack);'} + {$EXTERNALSYM IDirectMusicTrack} + IDirectMusicTrack = interface(IUnknown) + ['{f96029a1-4282-11d2-8717-00600893b1bd}'] + (* IDirectMusicTrack *) + function Init(pSegment: IDirectMusicSegment): HResult; stdcall; + function InitPlay(pSegmentState: IDirectMusicSegmentState; + pPerformance: IDirectMusicPerformance; out ppStateData: Pointer; + dwVirtualTrackID, dwFlags: DWORD): HResult; stdcall; + function EndPlay(pStateData: Pointer): HResult; stdcall; + function Play(pStateData: Pointer; mtStart, mtEnd, mtOffset: TMusicTime; + dwFlags: DWORD; pPerf: IDirectMusicPerformance; + pSegSt: IDirectMusicSegmentState; dwVirtualID: DWORD): HResult; stdcall; + function GetParam (const rguidType: TGUID; mtTime: TMusicTime; out pmtNext: TMusicTime; + pParam: Pointer): HResult; stdcall; + function SetParam(const rguidType: TGUID; mtTime: TMusicTime; pParam: Pointer): HResult; stdcall; + function IsParamSupported(const rguidType: TGUID): HResult; stdcall; + function AddNotificationType(const rguidNotificationType: TGUID): HResult; stdcall; + function RemoveNotificationType(const rguidNotificationType: TGUID): HResult; stdcall; + function Clone(mtStart: TMusicTime; mtEnd: TMusicTime; out ppTrack: IDirectMusicTrack): HResult; stdcall; + end; + + +const + (* CLSID's *) + CLSID_DirectMusicPerformance: TGUID = '{d2ac2881-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicPerformance} + CLSID_DirectMusicSegment: TGUID = '{d2ac2882-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicSegment} + CLSID_DirectMusicSegmentState: TGUID = '{d2ac2883-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicSegmentState} + CLSID_DirectMusicGraph: TGUID = '{d2ac2884-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicGraph} + CLSID_DirectMusicStyle: TGUID = '{d2ac288a-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicStyle} + CLSID_DirectMusicChordMap: TGUID = '{d2ac288f-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicChordMap} + CLSID_DirectMusicComposer: TGUID = '{d2ac2890-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicComposer} + CLSID_DirectMusicLoader: TGUID = '{d2ac2892-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicLoader} + CLSID_DirectMusicBand: TGUID = '{79ba9e00-b6ee-11d1-86be-00c04fbf8fef}'; + {$EXTERNALSYM CLSID_DirectMusicBand} + + (* New CLSID's for DX8 *) + CLSID_DirectMusicPatternTrack: TGUID = '{d2ac2897-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicPatternTrack} + CLSID_DirectMusicScript: TGUID = '{810b5013-e88d-11d2-8bc1-00600893b1b6}'; (* {810B5013-E88D-11d2-8BC1-00600893B1B6} *) + {$EXTERNALSYM CLSID_DirectMusicScript} + CLSID_DirectMusicContainer: TGUID = '{9301e380-1f22-11d3-8226-d2fa76255d47}'; + {$EXTERNALSYM CLSID_DirectMusicContainer} + CLSID_DirectSoundWave: TGUID = '{8a667154-f9cb-11d2-ad8a-0060b0575abc}'; + {$EXTERNALSYM CLSID_DirectSoundWave} + CLSID_DirectMusicAudioPathConfig: TGUID = '{ee0b9ca0-a81e-11d3-9bd1-0080c7150a74}'; + {$EXTERNALSYM CLSID_DirectMusicAudioPathConfig} + + (* Special GUID for all object types. This is used by the loader. *) + GUID_DirectMusicAllTypes: TGUID = '{d2ac2893-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_DirectMusicAllTypes} + + (* Notification guids *) + GUID_NOTIFICATION_SEGMENT: TGUID = '{d2ac2899-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_NOTIFICATION_SEGMENT} + GUID_NOTIFICATION_PERFORMANCE: TGUID = '{81f75bc5-4e5d-11d2-bcc7-00a0c922e6eb}'; + {$EXTERNALSYM GUID_NOTIFICATION_PERFORMANCE} + GUID_NOTIFICATION_MEASUREANDBEAT: TGUID = '{d2ac289a-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_NOTIFICATION_MEASUREANDBEAT} + GUID_NOTIFICATION_CHORD: TGUID = '{d2ac289b-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_NOTIFICATION_CHORD} + GUID_NOTIFICATION_COMMAND: TGUID = '{d2ac289c-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_NOTIFICATION_COMMAND} + GUID_NOTIFICATION_RECOMPOSE: TGUID = '{d348372b-945b-45ae-a522-450f125b84a5}'; + {$EXTERNALSYM GUID_NOTIFICATION_RECOMPOSE} + + (* Track param type guids *) + (* Use to get/set a DMUS_COMMAND_PARAM param in the Command track *) + GUID_CommandParam: TGUID = '{d2ac289d-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_CommandParam} + + (* Use to get a DMUS_COMMAND_PARAM_2 param in the Command track *) + GUID_CommandParam2: TGUID = '{28f97ef7-9538-11d2-97a9-00c04fa36e58}'; + {$EXTERNALSYM GUID_CommandParam2} + + (* Use to get/set a DMUS_COMMAND_PARAM_2 param to be used as the command following all commands in + the Command track (this information can't be saved) *) + GUID_CommandParamNext: TGUID = '{472afe7a-281b-11d3-817d-00c04fa36e58}'; + {$EXTERNALSYM GUID_CommandParamNext} + + (* Use to get/set a DMUS_CHORD_PARAM param in the Chord track *) + GUID_ChordParam: TGUID = '{d2ac289e-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_ChordParam} + + (* Use to get a DMUS_RHYTHM_PARAM param in the Chord track *) + GUID_RhythmParam: TGUID = '{d2ac289f-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_RhythmParam} + + (* Use to get/set an IDirectMusicStyle param in the Style track *) + GUID_IDirectMusicStyle: TGUID = '{d2ac28a1-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_IDirectMusicStyle} + + (* Use to get a DMUS_TIMESIGNATURE param in the Style and TimeSig tracks *) + GUID_TimeSignature: TGUID = '{d2ac28a4-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_TimeSignature} + + (* Use to get/set a DMUS_TEMPO_PARAM param in the Tempo track *) + GUID_TempoParam: TGUID = '{d2ac28a5-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_TempoParam} + + (* Use to get the next valid point in a segment at which it may start *) + GUID_Valid_Start_Time: TGUID = '{7f6b1760-1fdb-11d3-8226-444553540000}'; + {$EXTERNALSYM GUID_Valid_Start_Time} + + (* Use to get the next point in the currently playing primary segment at which a new segment may start *) + GUID_Play_Marker: TGUID = '{d8761a41-801a-11d3-9bd1-daf7e1c3d834}'; + {$EXTERNALSYM GUID_Play_Marker} + + (* Use to get (GetParam) or add (SetParam) bands in the Band track *) + GUID_BandParam: TGUID = '{02bb1938-cb8b-11d2-8bb9-00600893b1b6}'; + {$EXTERNALSYM GUID_BandParam} + +type + _DMUS_BAND_PARAM = packed record + mtTimePhysical: MUSIC_TIME; // Note: If this is a clock-time track, then this field is interpreted in the track's internal time format, which is the number of milliseconds after the beginning of playback. + pBand: IDirectMusicBand; + end; + {$EXTERNALSYM _DMUS_BAND_PARAM} + DMUS_BAND_PARAM = _DMUS_BAND_PARAM; + {$EXTERNALSYM DMUS_BAND_PARAM} + TDMusBandParam = _DMUS_BAND_PARAM; + PDMusBandParam = ^TDMusBandParam; + +const + (* Obsolete -- doesn't distinguish physical and logical time. Use GUID_BandParam instead. *) + GUID_IDirectMusicBand: TGUID = '{d2ac28ac-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_IDirectMusicBand} + + (* Use to get/set an IDirectMusicChordMap param in the ChordMap track *) + GUID_IDirectMusicChordMap: TGUID = '{d2ac28ad-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_IDirectMusicChordMap} + + (* Use to get/set a DMUS_MUTE_PARAM param in the Mute track *) + GUID_MuteParam: TGUID = '{d2ac28af-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_MuteParam} + + (* These guids are used in IDirectMusicSegment::SetParam to tell the band track to perform various actions. + Some of these guids (where noted) also apply to wave tracks. + *) + (* Download bands/waves for the IDirectMusicSegment *) + GUID_Download: TGUID = '{d2ac28a7-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_Download} + + (* Unload bands/waves for the IDirectMusicSegment *) + GUID_Unload: TGUID = '{d2ac28a8-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_Unload} + + (* Connect segment's bands to an IDirectMusicCollection *) + GUID_ConnectToDLSCollection: TGUID = '{1db1ae6b-e92e-11d1-a8c5-00c04fa3726e}'; + {$EXTERNALSYM GUID_ConnectToDLSCollection} + + (* Enable/disable autodownloading of bands/waves *) + GUID_Enable_Auto_Download: TGUID = '{d2ac28a9-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_Enable_Auto_Download} + GUID_Disable_Auto_Download: TGUID = '{d2ac28aa-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_Disable_Auto_Download} + + (* Clear all bands *) + GUID_Clear_All_Bands: TGUID = '{d2ac28ab-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_Clear_All_Bands} + + (* Set segment to manage all program changes, bank selects, etc. for simple playback of a standard MIDI file *) + GUID_StandardMIDIFile: TGUID = '{06621075-e92e-11d1-a8c5-00c04fa3726e}'; + {$EXTERNALSYM GUID_StandardMIDIFile} + (* For compatibility with beta releases... *) + GUID_IgnoreBankSelectForGM: TGUID = '{06621075-e92e-11d1-a8c5-00c04fa3726e}'; // = GUID_StandardMIDIFile; + {$EXTERNALSYM GUID_IgnoreBankSelectForGM} + + (* Disable/enable param guids. Use these in SetParam calls to disable or enable sending + * specific PMsg types. + *) + GUID_DisableTimeSig: TGUID = '{45fc707b-1db4-11d2-bcac-00a0c922e6eb}'; + {$EXTERNALSYM GUID_DisableTimeSig} + GUID_EnableTimeSig: TGUID = '{45fc707c-1db4-11d2-bcac-00a0c922e6eb}'; + {$EXTERNALSYM GUID_EnableTimeSig} + GUID_DisableTempo: TGUID = '{45fc707d-1db4-11d2-bcac-00a0c922e6eb}'; + {$EXTERNALSYM GUID_DisableTempo} + GUID_EnableTempo: TGUID = '{45fc707e-1db4-11d2-bcac-00a0c922e6eb}'; + {$EXTERNALSYM GUID_EnableTempo} + + (* Used in SetParam calls for pattern-based tracks. A nonzero value seeds the random number + generator for variation selection; a value of zero reverts to the default behavior of + getting the seed from the system clock. + *) + GUID_SeedVariations: TGUID = '{65b76fa5-ff37-11d2-814e-00c04fa36e58}'; + {$EXTERNALSYM GUID_SeedVariations} + + (* Used to get the variations currently in effect across PChannels *) + GUID_Variations: TGUID = '{11f72cce-26e6-4ecd-af2e-d668e66707d8}'; + {$EXTERNALSYM GUID_Variations} + +type + PDMusVariationsParam = ^TDMusVariationsParam; + _DMUS_VARIATIONS_PARAM = packed record + dwPChannelsUsed: DWORD; // number of PChannels in use + padwPChannels: PDWORD; // array of PChannels in use + padwVariations: PDWORD; // array of variations in effect for each PChannel + end; + {$EXTERNALSYM _DMUS_VARIATIONS_PARAM} + DMUS_VARIATIONS_PARAM = _DMUS_VARIATIONS_PARAM; + {$EXTERNALSYM DMUS_VARIATIONS_PARAM} + TDMusVariationsParam = _DMUS_VARIATIONS_PARAM; + +const + (* Download bands/waves for the IDirectMusicSegment, passed an IDirectMusicAudioPath instead of an IDirectMusicPerformance *) + GUID_DownloadToAudioPath: TGUID = '{9f2c0341-c5c4-11d3-9bd1-444553540000}'; + {$EXTERNALSYM GUID_DownloadToAudioPath} + + (* Unload bands/waves for the IDirectMusicSegment, passed an IDirectMusicAudioPath instead of an IDirectMusicPerformance *) + GUID_UnloadFromAudioPath: TGUID = '{9f2c0342-c5c4-11d3-9bd1-444553540000}'; + {$EXTERNALSYM GUID_UnloadFromAudioPath} + + + (* Global data guids *) + GUID_PerfMasterTempo: TGUID = '{d2ac28b0-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_PerfMasterTempo} + GUID_PerfMasterVolume: TGUID = '{d2ac28b1-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_PerfMasterVolume} + GUID_PerfMasterGrooveLevel: TGUID = '{d2ac28b2-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM GUID_PerfMasterGrooveLevel} + GUID_PerfAutoDownload: TGUID = '{fb09565b-3631-11d2-bcb8-00a0c922e6eb}'; + {$EXTERNALSYM GUID_PerfAutoDownload} + + (* GUID for default GM/GS dls collection. *) + GUID_DefaultGMCollection: TGUID = '{f17e8673-c3b4-11d1-870b-00600893b1bd}'; + {$EXTERNALSYM GUID_DefaultGMCollection} + + (* GUID to define default synth, placed in AudioPath configuration file. *) + GUID_Synth_Default: TGUID = '{26bb9432-45fe-48d3-a375-2472c5e3e786}'; + {$EXTERNALSYM GUID_Synth_Default} + + (* GUIDs to define default buffer configurations to place in AudioPath configuration file. *) + GUID_Buffer_Reverb: TGUID = '{186cc541-db29-11d3-9bd1-0080c7150a74}'; + {$EXTERNALSYM GUID_Buffer_Reverb} + GUID_Buffer_EnvReverb: TGUID = '{186cc542-db29-11d3-9bd1-0080c7150a74}'; + {$EXTERNALSYM GUID_Buffer_EnvReverb} + GUID_Buffer_Stereo: TGUID = '{186cc545-db29-11d3-9bd1-0080c7150a74}'; + {$EXTERNALSYM GUID_Buffer_Stereo} + GUID_Buffer_3D_Dry: TGUID = '{186cc546-db29-11d3-9bd1-0080c7150a74}'; + {$EXTERNALSYM GUID_Buffer_3D_Dry} + GUID_Buffer_Mono: TGUID = '{186cc547-db29-11d3-9bd1-0080c7150a74}'; + {$EXTERNALSYM GUID_Buffer_Mono} + +type + (* IID's *) + IID_IDirectMusicLoader = IDirectMusicLoader; + {$EXTERNALSYM IID_IDirectMusicLoader} + IID_IDirectMusicGetLoader = IDirectMusicGetLoader; + {$EXTERNALSYM IID_IDirectMusicGetLoader} + IID_IDirectMusicObject = IDirectMusicObject; + {$EXTERNALSYM IID_IDirectMusicObject} + IID_IDirectMusicSegment = IDirectMusicSegment; + {$EXTERNALSYM IID_IDirectMusicSegment} + IID_IDirectMusicSegmentState = IDirectMusicSegmentState; + {$EXTERNALSYM IID_IDirectMusicSegmentState} + IID_IDirectMusicPerformance = IDirectMusicPerformance; + {$EXTERNALSYM IID_IDirectMusicPerformance} + IID_IDirectMusicGraph = IDirectMusicGraph; + {$EXTERNALSYM IID_IDirectMusicGraph} + IID_IDirectMusicStyle = IDirectMusicStyle; + {$EXTERNALSYM IID_IDirectMusicStyle} + IID_IDirectMusicChordMap = IDirectMusicChordMap; + {$EXTERNALSYM IID_IDirectMusicChordMap} + IID_IDirectMusicComposer = IDirectMusicComposer; + {$EXTERNALSYM IID_IDirectMusicComposer} + IID_IDirectMusicBand = IDirectMusicBand; + {$EXTERNALSYM IID_IDirectMusicBand} + +const + (* Alternate interface IDs, available in DX7 release and after. *) + IID_IDirectMusicPerformance2: TGUID = '{6fc2cae0-bc78-11d2-afa6-00aa0024d8b6}'; + {$EXTERNALSYM IID_IDirectMusicPerformance2} + IID_IDirectMusicSegment2: TGUID = '{d38894d1-c052-11d2-872f-00600893b1bd}'; + {$EXTERNALSYM IID_IDirectMusicSegment2} + +type + (* Interface IDs for DX8 *) + (* changed interfaces (GUID only) *) + IID_IDirectMusicLoader8 = IDirectMusicLoader8; + {$EXTERNALSYM IID_IDirectMusicLoader8} + IID_IDirectMusicPerformance8 = IDirectMusicPerformance8; + {$EXTERNALSYM IID_IDirectMusicPerformance8} + IID_IDirectMusicSegment8 = IDirectMusicSegment8; + {$EXTERNALSYM IID_IDirectMusicSegment8} + IID_IDirectMusicSegmentState8 = IDirectMusicSegmentState8; + {$EXTERNALSYM IID_IDirectMusicSegmentState8} + IID_IDirectMusicStyle8 = IDirectMusicStyle8; + {$EXTERNALSYM IID_IDirectMusicStyle8} + + (* new interfaces (GUID + alias) *) + IID_IDirectMusicPatternTrack = IDirectMusicPatternTrack; + {$EXTERNALSYM IID_IDirectMusicPatternTrack} + IID_IDirectMusicScript = IDirectMusicScript; (* {2252373A-5814-489b-8209-31FEDEBAF137} *) + {$EXTERNALSYM IID_IDirectMusicScript} + IID_IDirectMusicContainer = IDirectMusicContainer; + {$EXTERNALSYM IID_IDirectMusicContainer} + IID_IDirectMusicAudioPath = IDirectMusicAudioPath; + {$EXTERNALSYM IID_IDirectMusicAudioPath} + + IID_IDirectMusicPatternTrack8 = IID_IDirectMusicPatternTrack; + {$EXTERNALSYM IID_IDirectMusicPatternTrack8} + IID_IDirectMusicScript8 = IID_IDirectMusicScript; + {$EXTERNALSYM IID_IDirectMusicScript8} + IID_IDirectMusicContainer8 = IID_IDirectMusicContainer; + {$EXTERNALSYM IID_IDirectMusicContainer8} + IID_IDirectMusicAudioPath8 = IID_IDirectMusicAudioPath; + {$EXTERNALSYM IID_IDirectMusicAudioPath8} + (* unchanged interfaces (alias only) *) + IID_IDirectMusicGetLoader8 = IID_IDirectMusicGetLoader; + {$EXTERNALSYM IID_IDirectMusicGetLoader8} + IID_IDirectMusicChordMap8 = IID_IDirectMusicChordMap; + {$EXTERNALSYM IID_IDirectMusicChordMap8} + IID_IDirectMusicGraph8 = IID_IDirectMusicGraph; + {$EXTERNALSYM IID_IDirectMusicGraph8} + IID_IDirectMusicBand8 = IID_IDirectMusicBand; + {$EXTERNALSYM IID_IDirectMusicBand8} + IID_IDirectMusicObject8 = IID_IDirectMusicObject; + {$EXTERNALSYM IID_IDirectMusicObject8} + IID_IDirectMusicComposer8 = IID_IDirectMusicComposer; + {$EXTERNALSYM IID_IDirectMusicComposer8} + + + + + +(************************************************************************ +* * +* dmusicf.h -- This module defines the DirectMusic file formats * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************) + +const + // Common chunks + + DMUS_FOURCC_GUID_CHUNK = DWORD(Byte('g') or (Byte('u') shl 8) or (Byte('i') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('g','u','i','d') + {$EXTERNALSYM DMUS_FOURCC_GUID_CHUNK} + DMUS_FOURCC_INFO_LIST = DWORD(Byte('I') or (Byte('N') shl 8) or (Byte('F') shl 16) or (Byte('O') shl 24)); // mmioFOURCC('I','N','F','O') + {$EXTERNALSYM DMUS_FOURCC_INFO_LIST} + DMUS_FOURCC_UNFO_LIST = DWORD(Byte('U') or (Byte('N') shl 8) or (Byte('F') shl 16) or (Byte('O') shl 24)); // mmioFOURCC('U','N','F','O') + {$EXTERNALSYM DMUS_FOURCC_UNFO_LIST} + DMUS_FOURCC_UNAM_CHUNK = DWORD(Byte('U') or (Byte('N') shl 8) or (Byte('A') shl 16) or (Byte('M') shl 24)); // mmioFOURCC('U','N','A','M') + {$EXTERNALSYM DMUS_FOURCC_UNAM_CHUNK} + DMUS_FOURCC_UART_CHUNK = DWORD(Byte('U') or (Byte('A') shl 8) or (Byte('R') shl 16) or (Byte('T') shl 24)); // mmioFOURCC('U','A','R','T') + {$EXTERNALSYM DMUS_FOURCC_UART_CHUNK} + DMUS_FOURCC_UCOP_CHUNK = DWORD(Byte('U') or (Byte('C') shl 8) or (Byte('O') shl 16) or (Byte('P') shl 24)); // mmioFOURCC('U','C','O','P') + {$EXTERNALSYM DMUS_FOURCC_UCOP_CHUNK} + DMUS_FOURCC_USBJ_CHUNK = DWORD(Byte('U') or (Byte('S') shl 8) or (Byte('B') shl 16) or (Byte('J') shl 24)); // mmioFOURCC('U','S','B','J') + {$EXTERNALSYM DMUS_FOURCC_USBJ_CHUNK} + DMUS_FOURCC_UCMT_CHUNK = DWORD(Byte('U') or (Byte('C') shl 8) or (Byte('M') shl 16) or (Byte('T') shl 24)); // mmioFOURCC('U','C','M','T') + {$EXTERNALSYM DMUS_FOURCC_UCMT_CHUNK} + DMUS_FOURCC_CATEGORY_CHUNK = DWORD(Byte('c') or (Byte('a') shl 8) or (Byte('t') shl 16) or (Byte('g') shl 24)); // mmioFOURCC('c','a','t','g') + {$EXTERNALSYM DMUS_FOURCC_CATEGORY_CHUNK} + DMUS_FOURCC_VERSION_CHUNK = DWORD(Byte('v') or (Byte('e') shl 8) or (Byte('r') shl 16) or (Byte('s') shl 24)); // mmioFOURCC('v','e','r','s') + {$EXTERNALSYM DMUS_FOURCC_VERSION_CHUNK} + +type + // The following structures are used by the Tracks, and are the packed structures + // that are passed to the Tracks inside the IStream. + + + PDMusIoSeqItem = ^TDMusIoSeqItem; + _DMUS_IO_SEQ_ITEM = packed record + mtTime: TMusicTime; + mtDuration: TMusicTime; + dwPChannel: DWORD; + nOffset: Smallint; + bStatus: Byte; + bByte1: Byte; + bByte2: Byte; + end; + {$EXTERNALSYM _DMUS_IO_SEQ_ITEM} + DMUS_IO_SEQ_ITEM = _DMUS_IO_SEQ_ITEM; + {$EXTERNALSYM DMUS_IO_SEQ_ITEM} + TDMusIoSeqItem = _DMUS_IO_SEQ_ITEM; + + + PDMusIoCurveItem = ^TDMusIoCurveItem; + _DMUS_IO_CURVE_ITEM = packed record + mtStart: TMusicTime; + mtDuration: TMusicTime; + mtResetDuration: TMusicTime; + dwPChannel: DWORD; + nOffset: Smallint; + nStartValue: Smallint; + nEndValue: Smallint; + nResetValue: Smallint; + bType: Byte; + bCurveShape: Byte; + bCCData: Byte; + bFlags: Byte; + // Following was added for DX8. + wParamType: Word; // RPN or NRPN parameter number. + wMergeIndex: Word; // Allows multiple parameters to be merged (pitchbend, volume, and expression.) + end; + {$EXTERNALSYM _DMUS_IO_CURVE_ITEM} + DMUS_IO_CURVE_ITEM = _DMUS_IO_CURVE_ITEM; + {$EXTERNALSYM DMUS_IO_CURVE_ITEM} + TDMusIoCurveItem = _DMUS_IO_CURVE_ITEM; + + + PDMusIoTempoItem = ^TDMusIoTempoItem; + _DMUS_IO_TEMPO_ITEM = packed record + lTime: TMusicTime; + dblTempo: Double; + end; + {$EXTERNALSYM _DMUS_IO_TEMPO_ITEM} + DMUS_IO_TEMPO_ITEM = _DMUS_IO_TEMPO_ITEM; + {$EXTERNALSYM DMUS_IO_TEMPO_ITEM} + TDMusIoTempoItem = _DMUS_IO_TEMPO_ITEM; + + + PDMusIoSysExItem = ^TDMusIoSysExItem; + _DMUS_IO_SYSEX_ITEM = packed record + mtTime: TMusicTime; + dwPChannel: DWORD; + dwSysExLength: DWORD; + end; + {$EXTERNALSYM _DMUS_IO_SYSEX_ITEM} + DMUS_IO_SYSEX_ITEM = _DMUS_IO_SYSEX_ITEM; + {$EXTERNALSYM DMUS_IO_SYSEX_ITEM} + TDMusIoSysExItem = _DMUS_IO_SYSEX_ITEM; + + DMUS_CHORD_PARAM = DMUS_CHORD_KEY; (* DMUS_CHORD_KEY defined in dmusici.h *) + {$EXTERNALSYM DMUS_CHORD_PARAM} + TDMusChordParam = DMUS_CHORD_PARAM; + PDMusChordParam = ^TDMusChordParam; + + _DMUS_RHYTHM_PARAM = packed record + TimeSig: TDMusTimeSignature; + dwRhythmPattern: DWORD; + end; + {$EXTERNALSYM _DMUS_RHYTHM_PARAM} + DMUS_RHYTHM_PARAM = _DMUS_RHYTHM_PARAM; + {$EXTERNALSYM DMUS_RHYTHM_PARAM} + TDMusRhythmParam = _DMUS_RHYTHM_PARAM; + PDMusRhythmParam = ^TDMusRhythmParam; + + PDMusTempoParam = ^TDMusTempoParam; + _DMUS_TEMPO_PARAM = packed record + mtTime: TMusicTime; + dblTempo: Double; + end; + {$EXTERNALSYM _DMUS_TEMPO_PARAM} + DMUS_TEMPO_PARAM = _DMUS_TEMPO_PARAM; + {$EXTERNALSYM DMUS_TEMPO_PARAM} + TDMusTempoParam = _DMUS_TEMPO_PARAM; + + PDMusMuteParam = ^TDMusMuteParam; + _DMUS_MUTE_PARAM = packed record + dwPChannel: DWORD; + dwPChannelMap: DWORD; + fMute: BOOL; + end; + {$EXTERNALSYM _DMUS_MUTE_PARAM} + DMUS_MUTE_PARAM = _DMUS_MUTE_PARAM; + {$EXTERNALSYM DMUS_MUTE_PARAM} + TDMusMuteParam = _DMUS_MUTE_PARAM; + +const + (* Style chunks *) + + DMUS_FOURCC_STYLE_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('S') shl 16) or (Byte('T') shl 24)); // mmioFOURCC('D','M','S','T') + {$EXTERNALSYM DMUS_FOURCC_STYLE_FORM} + DMUS_FOURCC_STYLE_CHUNK = DWORD(Byte('s') or (Byte('t') shl 8) or (Byte('y') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('s','t','y','h') + {$EXTERNALSYM DMUS_FOURCC_STYLE_CHUNK} + DMUS_FOURCC_PART_LIST = DWORD(Byte('p') or (Byte('a') shl 8) or (Byte('r') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('p','a','r','t') + {$EXTERNALSYM DMUS_FOURCC_PART_LIST} + DMUS_FOURCC_PART_CHUNK = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('t') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('p','r','t','h') + {$EXTERNALSYM DMUS_FOURCC_PART_CHUNK} + DMUS_FOURCC_NOTE_CHUNK = DWORD(Byte('n') or (Byte('o') shl 8) or (Byte('t') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('n','o','t','e') + {$EXTERNALSYM DMUS_FOURCC_NOTE_CHUNK} + DMUS_FOURCC_CURVE_CHUNK = DWORD(Byte('c') or (Byte('r') shl 8) or (Byte('v') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('c','r','v','e') + {$EXTERNALSYM DMUS_FOURCC_CURVE_CHUNK} + DMUS_FOURCC_MARKER_CHUNK = DWORD(Byte('m') or (Byte('r') shl 8) or (Byte('k') shl 16) or (Byte('r') shl 24)); // mmioFOURCC('m','r','k','r') + {$EXTERNALSYM DMUS_FOURCC_MARKER_CHUNK} + DMUS_FOURCC_RESOLUTION_CHUNK = DWORD(Byte('r') or (Byte('s') shl 8) or (Byte('l') shl 16) or (Byte('n') shl 24)); // mmioFOURCC('r','s','l','n') + {$EXTERNALSYM DMUS_FOURCC_RESOLUTION_CHUNK} + DMUS_FOURCC_ANTICIPATION_CHUNK = DWORD(Byte('a') or (Byte('n') shl 8) or (Byte('p') shl 16) or (Byte('n') shl 24)); // mmioFOURCC('a','n','p','n') + {$EXTERNALSYM DMUS_FOURCC_ANTICIPATION_CHUNK} + DMUS_FOURCC_PATTERN_LIST = DWORD(Byte('p') or (Byte('t') shl 8) or (Byte('t') shl 16) or (Byte('n') shl 24)); // mmioFOURCC('p','t','t','n') + {$EXTERNALSYM DMUS_FOURCC_PATTERN_LIST} + DMUS_FOURCC_PATTERN_CHUNK = DWORD(Byte('p') or (Byte('t') shl 8) or (Byte('n') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('p','t','n','h') + {$EXTERNALSYM DMUS_FOURCC_PATTERN_CHUNK} + DMUS_FOURCC_RHYTHM_CHUNK = DWORD(Byte('r') or (Byte('h') shl 8) or (Byte('t') shl 16) or (Byte('m') shl 24)); // mmioFOURCC('r','h','t','m') + {$EXTERNALSYM DMUS_FOURCC_RHYTHM_CHUNK} + DMUS_FOURCC_PARTREF_LIST = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('e') shl 16) or (Byte('f') shl 24)); // mmioFOURCC('p','r','e','f') + {$EXTERNALSYM DMUS_FOURCC_PARTREF_LIST} + DMUS_FOURCC_PARTREF_CHUNK = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('f') shl 16) or (Byte('c') shl 24)); // mmioFOURCC('p','r','f','c') + {$EXTERNALSYM DMUS_FOURCC_PARTREF_CHUNK} + DMUS_FOURCC_STYLE_PERS_REF_LIST = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('r') shl 16) or (Byte('f') shl 24)); // mmioFOURCC('p','r','r','f') + {$EXTERNALSYM DMUS_FOURCC_STYLE_PERS_REF_LIST} + DMUS_FOURCC_MOTIFSETTINGS_CHUNK = DWORD(Byte('m') or (Byte('t') shl 8) or (Byte('f') shl 16) or (Byte('s') shl 24)); // mmioFOURCC('m','t','f','s') + {$EXTERNALSYM DMUS_FOURCC_MOTIFSETTINGS_CHUNK} + + (* Flags used by variations: these make up the DWORDs in dwVariationChoices. *) + + (* These flags determine the types of chords supported by a given variation in DirectMusic *) + (* mode. The first seven flags (bits 1-7) are set if the variation supports major chords *) + (* rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation *) + (* supports major chords rooted in the tonic, second, and fourth scale positions. The *) + (* next seven flags serve the same purpose, but for minor chords, and the following seven *) + (* flags serve the same purpose for chords that are not major or minor (e.g., SUS 4 *) + (* chords). Bits 22, 23, and 24 are set if the variation supports chords rooted in the *) + (* scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones, *) + (* respectively. For example, to support a C# minor chord in the scale of C Major, *) + (* bits 8 (for tonic minor) and 24 (for sharp) need to be set. Bits 25, 26, an 27 handle *) + (* chords that are triads, 6th or 7th chords, and chords with extensions, respectively. *) + (* bits 28 and 29 handle chords that are followed by tonic and dominant chords, *) + (* respectively. *) + DMUS_VARIATIONF_MAJOR = $0000007F; (* Seven positions in the scale - major chords. *) + {$EXTERNALSYM DMUS_VARIATIONF_MAJOR} + DMUS_VARIATIONF_MINOR = $00003F80; (* Seven positions in the scale - minor chords. *) + {$EXTERNALSYM DMUS_VARIATIONF_MINOR} + DMUS_VARIATIONF_OTHER = $001FC000; (* Seven positions in the scale - other chords. *) + {$EXTERNALSYM DMUS_VARIATIONF_OTHER} + DMUS_VARIATIONF_ROOT_SCALE = $00200000; (* Handles chord roots in the scale. *) + {$EXTERNALSYM DMUS_VARIATIONF_ROOT_SCALE} + DMUS_VARIATIONF_ROOT_FLAT = $00400000; (* Handles flat chord roots (based on scale notes). *) + {$EXTERNALSYM DMUS_VARIATIONF_ROOT_FLAT} + DMUS_VARIATIONF_ROOT_SHARP = $00800000; (* Handles sharp chord roots (based on scale notes). *) + {$EXTERNALSYM DMUS_VARIATIONF_ROOT_SHARP} + DMUS_VARIATIONF_TYPE_TRIAD = $01000000; (* Handles simple chords - triads. *) + {$EXTERNALSYM DMUS_VARIATIONF_TYPE_TRIAD} + DMUS_VARIATIONF_TYPE_6AND7 = $02000000; (* Handles simple chords - 6 and 7. *) + {$EXTERNALSYM DMUS_VARIATIONF_TYPE_6AND7} + DMUS_VARIATIONF_TYPE_COMPLEX = $04000000; (* Handles complex chords. *) + {$EXTERNALSYM DMUS_VARIATIONF_TYPE_COMPLEX} + DMUS_VARIATIONF_DEST_TO1 = $08000000; (* Handles transitions to 1 chord. *) + {$EXTERNALSYM DMUS_VARIATIONF_DEST_TO1} + DMUS_VARIATIONF_DEST_TO5 = $10000000; (* Handles transitions to 5 chord. *) + {$EXTERNALSYM DMUS_VARIATIONF_DEST_TO5} + DMUS_VARIATIONF_DEST_OTHER = $40000000; (* Handles transitions to chords other than 1 . *) + {$EXTERNALSYM DMUS_VARIATIONF_DEST_OTHER} + + (* legacy mask for variation modes *) + DMUS_VARIATIONF_MODES = $E0000000; + {$EXTERNALSYM DMUS_VARIATIONF_MODES} + (* Bits 29 and 31 of the variation flags are the Mode bits. If both are 0, it's IMA. *) + (* If bit 29 is 1, it's Direct Music. *) + DMUS_VARIATIONF_MODES_EX = ($20000000 or $80000000); + {$EXTERNALSYM DMUS_VARIATIONF_MODES_EX} + DMUS_VARIATIONF_IMA25_MODE = $00000000; + {$EXTERNALSYM DMUS_VARIATIONF_IMA25_MODE} + DMUS_VARIATIONF_DMUS_MODE = $20000000; + {$EXTERNALSYM DMUS_VARIATIONF_DMUS_MODE} + + (* Set this if the part uses marker events *) + DMUS_PARTF_USE_MARKERS = $1; + {$EXTERNALSYM DMUS_PARTF_USE_MARKERS} + (* Set this if the part is allowed to switch only on chord-aligned markers *) + DMUS_PARTF_ALIGN_CHORDS = $2; + {$EXTERNALSYM DMUS_PARTF_ALIGN_CHORDS} + + (* These specify if the marker event signals whether to stop a variation or start a + pattern/variation (or both), and whether new variations must align with a chord *) + DMUS_MARKERF_START = $1; + {$EXTERNALSYM DMUS_MARKERF_START} + DMUS_MARKERF_STOP = $2; + {$EXTERNALSYM DMUS_MARKERF_STOP} + DMUS_MARKERF_CHORD_ALIGN = $4; + {$EXTERNALSYM DMUS_MARKERF_CHORD_ALIGN} + + (* if this flag is set, variation settings in a playing pattern-based track's state data will + persist in the track after it stops playing *) + DMUS_PATTERNF_PERSIST_CONTROL = $1; + {$EXTERNALSYM DMUS_PATTERNF_PERSIST_CONTROL} + + + (* These specify possible values for DMUS_IO_PATTERN.wEmbellishment (dx8) *) + DMUS_EMBELLISHT_NORMAL = 0; + {$EXTERNALSYM DMUS_EMBELLISHT_NORMAL} + DMUS_EMBELLISHT_FILL = 1; + {$EXTERNALSYM DMUS_EMBELLISHT_FILL} + DMUS_EMBELLISHT_BREAK = 2; + {$EXTERNALSYM DMUS_EMBELLISHT_BREAK} + DMUS_EMBELLISHT_INTRO = 4; + {$EXTERNALSYM DMUS_EMBELLISHT_INTRO} + DMUS_EMBELLISHT_END = 8; + {$EXTERNALSYM DMUS_EMBELLISHT_END} + DMUS_EMBELLISHT_MOTIF = 16; + {$EXTERNALSYM DMUS_EMBELLISHT_MOTIF} + DMUS_EMBELLISHT_ALL = $FFFF; + {$EXTERNALSYM DMUS_EMBELLISHT_ALL} +type + (* These specify possible values for DMUS_IO_PATTERN.wEmbellishment (dx8) *) + enumDMUS_EMBELLISHT_TYPES = Word; + DMUS_EMBELLISHT_TYPES = enumDMUS_EMBELLISHT_TYPES; + {$EXTERNALSYM DMUS_EMBELLISHT_TYPES} + TDMusEmbellishtTypes = DMUS_EMBELLISHT_TYPES; + +{$IFNDEF COMPILER6_UP} + Byte2 = Word; + +{$ELSE}{$ALIGN 2} +{$ENDIF} + (* These specify possible values for DMUS_IO_PARTREF.bRandomVariation + all but DMUS_VARIATIONT_SEQUENTIAL and DMUS_VARIATIONT_RANDOM are dx8. *) +{$IFNDEF COMPILER6_UP}{$MINENUMSIZE 2}{$ENDIF} + enumDMUS_VARIATIONT_TYPES = ( + DMUS_VARIATIONT_SEQUENTIAL {= 0}, (* Play sequential starting with variation 1. *) + DMUS_VARIATIONT_RANDOM {= 1}, (* Play randomly. *) + DMUS_VARIATIONT_RANDOM_START {= 2}, (* Play sequential starting with a random variation. *) + DMUS_VARIATIONT_NO_REPEAT {= 3}, (* Play randomly, but don't play the same variation twice. *) + DMUS_VARIATIONT_RANDOM_ROW {= 4} (* Play randomly as a row: don't repeat any variation until all have played. *) + ); + {$EXTERNALSYM enumDMUS_VARIATIONT_TYPES} + DMUS_VARIATIONT_TYPES = enumDMUS_VARIATIONT_TYPES; + {$EXTERNALSYM DMUS_VARIATIONT_TYPES} + TDMusVariationtTypes = DMUS_VARIATIONT_TYPES; + PDMusVariationtTypes = ^TDMusVariationtTypes; +{$IFNDEF COMPILER6_UP}{$MINENUMSIZE 1}{$ENDIF} + + + PDMusIoTimesig = ^TDMusIoTimesig; + _DMUS_IO_TIMESIG = record + (* Time signatures define how many beats per measure, which note receives *) + (* the beat, and the grid resolution. *) + bBeatsPerMeasure: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // beats per measure (top of time sig) + bBeat: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // what note receives the beat (bottom of time sig.) + // we can assume that 0 means 256th note + wGridsPerBeat: Word; // grids per beat + end; + {$EXTERNALSYM _DMUS_IO_TIMESIG} + DMUS_IO_TIMESIG = _DMUS_IO_TIMESIG; + {$EXTERNALSYM DMUS_IO_TIMESIG} + TDMusIoTimesig = _DMUS_IO_TIMESIG; + + PDMusIoStyle = ^TDMusIoStyle; + _DMUS_IO_STYLE = record + timeSig: TDMusIoTimesig; // Styles have a default Time Signature + dblTempo: Double; + end; + {$EXTERNALSYM _DMUS_IO_STYLE} + DMUS_IO_STYLE = _DMUS_IO_STYLE; + {$EXTERNALSYM DMUS_IO_STYLE} + TDMusIoStyle = _DMUS_IO_STYLE; + + PDMusIoVersion = ^TDMusIoVersion; + _DMUS_IO_VERSION = record + dwVersionMS: DWORD; // Version # high-order 32 bits + dwVersionLS: DWORD; // Version # low-order 32 bits + end; + {$EXTERNALSYM _DMUS_IO_VERSION} + DMUS_IO_VERSION = _DMUS_IO_VERSION; + {$EXTERNALSYM DMUS_IO_VERSION} + TDMusIoVersion = _DMUS_IO_VERSION; + + PDMusIoPattern = ^TDMusIoPattern; + _DMUS_IO_PATTERN = record + timeSig: TDMusIoTimesig; // Patterns can override the Style's Time sig. + bGrooveBottom: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // bottom of groove range + bGrooveTop: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // top of groove range + wEmbellishment: TDMusEmbellishtTypes; // Fill, Break, Intro, End, Normal, Motif + wNbrMeasures: Word; // length in measures + bDestGrooveBottom: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // bottom of groove range for next pattern + bDestGrooveTop: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // top of groove range for next pattern + dwFlags: DWORD; // various flags + end; + {$EXTERNALSYM _DMUS_IO_PATTERN} + DMUS_IO_PATTERN = _DMUS_IO_PATTERN; + {$EXTERNALSYM DMUS_IO_PATTERN} + TDMusIoPattern = _DMUS_IO_PATTERN; + + PDMusIoStylePart = ^TDMusIoStylePart; + _DMUS_IO_STYLEPART = record + timeSig: TDMusIoTimesig; // can override pattern's + dwVariationChoices: array[0..31] of DWORD; // MOAW choice bitfield + guidPartID: TGUID; // identifies the part + wNbrMeasures: Word; // length of the Part + bPlayModeFlags: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // see PLAYMODE flags + bInvertUpper: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // inversion upper limit + bInvertLower: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; // inversion lower limit + bPad: array[0..2] of Byte; // for DWORD alignment + dwFlags: DWORD; // various flags + end; + {$EXTERNALSYM _DMUS_IO_STYLEPART} + DMUS_IO_STYLEPART = _DMUS_IO_STYLEPART; + {$EXTERNALSYM DMUS_IO_STYLEPART} + TDMusIoStylePart = _DMUS_IO_STYLEPART; + + PDMusIoPartRef = ^TDMusIoPartRef; + _DMUS_IO_PARTREF = record + guidPartID: TGUID; (* unique ID for matching up with parts *) + wLogicalPartID: Word; (* corresponds to port/device/midi channel OBSOLETE *) + bVariationLockID: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* parts with the same ID lock variations. *) + (* high bit is used to identify master Part *) + bSubChordLevel: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* tells which sub chord level this part wants *) + bPriority: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* 256 priority levels. Parts with lower priority *) + (* aren't played first when a device runs out of *) + (* notes *) + bRandomVariation: TDMusVariationtTypes; (* when set, matching variations play in random order *) + (* when clear, matching variations play sequentially *) + wPad: Word; (* not used *) + dwPChannel: DWORD; (* replaces wLogicalPartID *) + end; + {$EXTERNALSYM _DMUS_IO_PARTREF} + DMUS_IO_PARTREF = _DMUS_IO_PARTREF; + {$EXTERNALSYM DMUS_IO_PARTREF} + TDMusIoPartRef = _DMUS_IO_PARTREF; + + PDMusIoStyleNote = ^TDMusIoStyleNote; + _DMUS_IO_STYLENOTE = record + mtGridStart: TMusicTime; (* when this note occurs *) + dwVariation: DWORD; (* variation bits *) + mtDuration: TMusicTime; (* how long this note lasts *) + nTimeOffset: Smallint; (* offset from mtGridStart *) + wMusicValue: Word; (* Position in scale. *) + bVelocity: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Note velocity. *) + bTimeRange: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Range to randomize start time. *) + bDurRange: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Range to randomize duration. *) + bVelRange: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Range to randomize velocity. *) + bInversionID: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Identifies inversion group to which this note belongs *) + bPlayModeFlags: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Can override part *) + (* Following exists only under DX8 and on *) + bNoteFlags: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* values from DMUS_NOTEF_FLAGS *) + end; + {$EXTERNALSYM _DMUS_IO_STYLENOTE} + DMUS_IO_STYLENOTE = _DMUS_IO_STYLENOTE; + {$EXTERNALSYM DMUS_IO_STYLENOTE} + TDMusIoStyleNote = _DMUS_IO_STYLENOTE; + + PDMusIoStyleCurve = ^TDMusIoStyleCurve; + _DMUS_IO_STYLECURVE = record + mtGridStart: TMusicTime; (* when this curve occurs *) + dwVariation: DWORD; (* variation bits *) + mtDuration: TMusicTime; (* how long this curve lasts *) + mtResetDuration: TMusicTime; (* how long after the end of the curve to reset the curve *) + nTimeOffset: Smallint; (* offset from mtGridStart *) + nStartValue: Smallint; (* curve's start value *) + nEndValue: Smallint; (* curve's end value *) + nResetValue: Smallint; (* the value to which to reset the curve *) + bEventType: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* type of curve *) + bCurveShape: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* shape of curve *) + bCCData: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* CC# *) + bFlags: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Bit 1=TRUE means to send nResetValue. Otherwise, don't. + Other bits are reserved. *) + (* Following was added for DX8. *) + wParamType: Word; (* RPN or NRPN parameter number. *) + wMergeIndex: Word; (* Allows multiple parameters to be merged (pitchbend, volume, and expression.) *) + end; + {$EXTERNALSYM _DMUS_IO_STYLECURVE} + DMUS_IO_STYLECURVE = _DMUS_IO_STYLECURVE; + {$EXTERNALSYM DMUS_IO_STYLECURVE} + TDMusIoStyleCurve = _DMUS_IO_STYLECURVE; + + PDMusIoStyleMarker = ^TDMusIoStyleMarker; + _DMUS_IO_STYLEMARKER = record + mtGridStart: TMusicTime; (* when this marker occurs *) + dwVariation: DWORD; (* variation bits *) + wMarkerFlags: Word; (* how the marker is used *) + end; + {$EXTERNALSYM _DMUS_IO_STYLEMARKER} + DMUS_IO_STYLEMARKER = _DMUS_IO_STYLEMARKER; + {$EXTERNALSYM DMUS_IO_STYLEMARKER} + TDMusIoStyleMarker = _DMUS_IO_STYLEMARKER; + + PDMusIoStyleResolution = ^TDMusIoStyleResolution; + _DMUS_IO_STYLERESOLUTION = record + dwVariation: DWORD; (* variation bits *) + wMusicValue: Word; (* Position in scale. *) + bInversionID: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Identifies inversion group to which this note belongs *) + bPlayModeFlags: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Can override part *) + end; + {$EXTERNALSYM _DMUS_IO_STYLERESOLUTION} + DMUS_IO_STYLERESOLUTION = _DMUS_IO_STYLERESOLUTION; + {$EXTERNALSYM DMUS_IO_STYLERESOLUTION} + TDMusIoStyleResolution = _DMUS_IO_STYLERESOLUTION; + + PDMusIoStyleAnticipation = ^TDMusIoStyleAnticipation; + _DMUS_IO_STYLE_ANTICIPATION = record + mtGridStart: TMusicTime; (* when this anticipation occurs *) + dwVariation: DWORD; (* variation bits *) + nTimeOffset: Smallint; (* offset from mtGridStart *) + bTimeRange: {$IFNDEF COMPILER6_UP}Byte2{$ELSE}Byte{$ENDIF}; (* Range to randomize start time. *) + end; + {$EXTERNALSYM _DMUS_IO_STYLE_ANTICIPATION} + DMUS_IO_STYLE_ANTICIPATION = _DMUS_IO_STYLE_ANTICIPATION; + {$EXTERNALSYM DMUS_IO_STYLE_ANTICIPATION} + TDMusIoStyleAnticipation = _DMUS_IO_STYLE_ANTICIPATION; + + PDMusIoMotifSettings = ^TDMusIoMotifSettings; + _DMUS_IO_MOTIFSETTINGS = record + dwRepeats: DWORD; (* Number of repeats. By default, 0. *) + mtPlayStart: TMusicTime; (* Start of playback. By default, 0. *) + mtLoopStart: TMusicTime; (* Start of looping portion. By default, 0. *) + mtLoopEnd: TMusicTime; (* End of loop. Must be greater than mtLoopStart. Or, 0, indicating loop full motif. *) + dwResolution: DWORD; (* Default resolution. *) + end; + {$EXTERNALSYM _DMUS_IO_MOTIFSETTINGS} + DMUS_IO_MOTIFSETTINGS = _DMUS_IO_MOTIFSETTINGS; + {$EXTERNALSYM DMUS_IO_MOTIFSETTINGS} + TDMusIoMotifSettings = _DMUS_IO_MOTIFSETTINGS; + +{$ALIGN ON} + + +(* +RIFF +( + 'DMST' // Style + // Style header chunk + // Every Style has a GUID + [] // Name, author, copyright info., comments + [] // version chunk + ... // Array of parts in the Style, used by patterns + ... // Array of patterns in the Style + ... // Array of bands in the Style + []...// Optional array of chord map references in the Style +) + + // + styh + ( + + ) + + // + guid + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'part' + // Part header chunk + [] // Name, author, copyright info., comments + [] // Optional chunk containing an array of notes in Part + [] // Optional chunk containing an array of curves in Part + [] // Optional chunk containing an array of markers in Part + [] // Optional chunk containing an array of variation resolutions in Part + [] // Optional chunk containing an array of resolution anticipations in Part + ) + + // + prth + ( + + ) + + // + 'note' + ( + // sizeof DMUS_IO_STYLENOTE:DWORD + ... + ) + + // + 'crve' + ( + // sizeof DMUS_IO_STYLECURVE:DWORD + ... + ) + + // + 'mrkr' + ( + // sizeof DMUS_IO_STYLEMARKER:DWORD + ... + ) + + // + 'rsln' + ( + // sizeof DMUS_IO_STYLERESOLUTION:DWORD + ... + ) + + // + 'anpn' + ( + // sizeof DMUS_IO_STYLE_ANTICIPATION:DWORD + ... + ) + + // + LIST + ( + 'pttn' + // Pattern header chunk + // Chunk containing an array of rhythms for chord matching + [] // Name, author, copyright info., comments + [] // Motif settings chunk + [] // Optional band to be associated with the pattern (for motifs) + ... // Array of part reference id's + ) + + // + ptnh + ( + + ) + + // + 'rhtm' + ( + // DWORD's representing rhythms for chord matching based on number + // of measures in the pattern + ) + + + // pref-list + LIST + ( + 'pref' + // part ref chunk + ) + + // + prfc + ( + + ) + + // + mtfs + ( + + ) + + // + LIST + ( + 'prrf' + ... // Array of Chordmap references + ) +*) + +const + (* Pattern chunk, for use in Pattern tracks *) + DMUS_FOURCC_PATTERN_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('P') shl 16) or (Byte('T') shl 24)); // mmioFOURCC('D','M','P','T') + {$EXTERNALSYM DMUS_FOURCC_PATTERN_FORM} + +(* +RIFF +( + 'DMPT' // Pattern + // Style header chunk + // The pattern, in single pattern format (includes DMUS_FOURCC_PART_LIST chunks) +) +*) + + +(* Chord and command file formats *) + +type + (* These specify possible values for DMUS_IO_COMMAND.bRepeatMode (dx8) *) + enumDMUS_PATTERNT_TYPES = ( + DMUS_PATTERNT_RANDOM {= 0}, (* Play randomly. (dx7 behavior) *) + DMUS_PATTERNT_REPEAT {= 1}, (* Repeat last pattern. *) + DMUS_PATTERNT_SEQUENTIAL {= 2}, (* Play sequential starting with first matching pattern. *) + DMUS_PATTERNT_RANDOM_START {= 3}, (* Play sequential starting with a random pattern. *) + DMUS_PATTERNT_NO_REPEAT {= 4}, (* Play randomly, but don't play the same pattern twice. *) + DMUS_PATTERNT_RANDOM_ROW {= 5} (* Play randomly as a row: don't repeat any pattern until all have played. *) + ); + {$EXTERNALSYM enumDMUS_PATTERNT_TYPES} + DMUS_PATTERNT_TYPES = enumDMUS_PATTERNT_TYPES; + {$EXTERNALSYM DMUS_PATTERNT_TYPES} + TDMusPatterntTypes = DMUS_PATTERNT_TYPES; + +const + DMUS_FOURCC_CHORDTRACK_LIST = DWORD(Byte('c') or (Byte('o') shl 8) or (Byte('r') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('c','o','r','d') + {$EXTERNALSYM DMUS_FOURCC_CHORDTRACK_LIST} + DMUS_FOURCC_CHORDTRACKHEADER_CHUNK = DWORD(Byte('c') or (Byte('r') shl 8) or (Byte('d') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('c','r','d','h') + {$EXTERNALSYM DMUS_FOURCC_CHORDTRACKHEADER_CHUNK} + DMUS_FOURCC_CHORDTRACKBODY_CHUNK = DWORD(Byte('c') or (Byte('r') shl 8) or (Byte('d') shl 16) or (Byte('b') shl 24)); // mmioFOURCC('c','r','d','b') + {$EXTERNALSYM DMUS_FOURCC_CHORDTRACKBODY_CHUNK} + + DMUS_FOURCC_COMMANDTRACK_CHUNK = DWORD(Byte('c') or (Byte('m') shl 8) or (Byte('n') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('c','m','n','d') + {$EXTERNALSYM DMUS_FOURCC_COMMANDTRACK_CHUNK} + +type + PDMusIoChord = ^TDMusIoChord; + _DMUS_IO_CHORD = packed record + wszName: array[0..15] of WideChar; (* Name of the chord *) + mtTime: TMusicTime; (* Time of this chord *) + wMeasure: Word; (* Measure this falls on *) + bBeat: Byte; (* Beat this falls on *) + bFlags: Byte; (* Various flags *) + end; + {$EXTERNALSYM _DMUS_IO_CHORD} + DMUS_IO_CHORD = _DMUS_IO_CHORD; + {$EXTERNALSYM DMUS_IO_CHORD} + TDMusIoChord = _DMUS_IO_CHORD; + + PDMusIoSubChord = ^TDMusIoSubChord; + _DMUS_IO_SUBCHORD = packed record + dwChordPattern: DWORD; (* Notes in the subchord *) + dwScalePattern: DWORD; (* Notes in the scale *) + dwInversionPoints: DWORD; (* Where inversions can occur *) + dwLevels: DWORD; (* Which levels are supported by this subchord *) + bChordRoot: Byte; (* Root of the subchord *) + bScaleRoot: Byte; (* Root of the scale *) + end; + {$EXTERNALSYM _DMUS_IO_SUBCHORD} + DMUS_IO_SUBCHORD = _DMUS_IO_SUBCHORD; + {$EXTERNALSYM DMUS_IO_SUBCHORD} + TDMusIoSubChord = _DMUS_IO_SUBCHORD; + + PDMusIoCommand = ^TDMusIoCommand; + _DMUS_IO_COMMAND = packed record + mtTime: TMusicTime; (* Time of this command *) + wMeasure: Word; (* Measure this falls on *) + bBeat: Byte; (* Beat this falls on *) + bCommand: Byte; (* Command type (see #defines below) *) + bGrooveLevel: Byte; (* Groove level (0 if command is not a groove) *) + bGrooveRange: Byte; (* Groove range *) + bRepeatMode: Byte; (* Used to control selection of patterns with same groove level *) + end; + {$EXTERNALSYM _DMUS_IO_COMMAND} + DMUS_IO_COMMAND = _DMUS_IO_COMMAND; + {$EXTERNALSYM DMUS_IO_COMMAND} + TDMusIoCommand = _DMUS_IO_COMMAND; + + +(* + + // + LIST + ( + 'cord' + + ... // Chord body chunks + ) + + // + crdh + ( + // Scale: dword (upper 8 bits for root, lower 24 for scale) + ) + + // + crdb + ( + // sizeof DMUS_IO_CHORD:dword + + // # of DMUS_IO_SUBCHORDS:dword + // sizeof DMUS_IO_SUBCHORDS:dword + // a number of + ) + + + // + 'cmnd' + ( + //sizeof DMUS_IO_COMMAND: DWORD + ... + ) + +*) + +(* File io for DirectMusic Tool and ToolGraph objects +*) + +const + (* RIFF ids: *) + + DMUS_FOURCC_TOOLGRAPH_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('T') shl 16) or (Byte('G') shl 24)); // mmioFOURCC('D','M','T','G') + {$EXTERNALSYM DMUS_FOURCC_TOOLGRAPH_FORM} + DMUS_FOURCC_TOOL_LIST = DWORD(Byte('t') or (Byte('o') shl 8) or (Byte('l') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('t','o','l','l') + {$EXTERNALSYM DMUS_FOURCC_TOOL_LIST} + DMUS_FOURCC_TOOL_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('T') shl 16) or (Byte('L') shl 24)); // mmioFOURCC('D','M','T','L') + {$EXTERNALSYM DMUS_FOURCC_TOOL_FORM} + DMUS_FOURCC_TOOL_CHUNK = DWORD(Byte('t') or (Byte('o') shl 8) or (Byte('l') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('t','o','l','h') + {$EXTERNALSYM DMUS_FOURCC_TOOL_CHUNK} + +type + (* io type = recordures: *) + PDMusIoToolHeader = ^TDMusIoToolHeader; + _DMUS_IO_TOOL_HEADER = packed record + guidClassID: TGUID; (* Class id of tool. *) + lIndex: Longint; (* Position in graph. *) + cPChannels: DWORD; (* Number of items in channels array. *) + ckid: FOURCC; (* chunk ID of tool's data chunk if 0 fccType valid. *) + fccType: FOURCC; (* list type if NULL ckid valid. *) + dwPChannels: array[0..0] of DWORD; (* Array of PChannels, size determined by cPChannels. *) + end; + {$EXTERNALSYM _DMUS_IO_TOOL_HEADER} + DMUS_IO_TOOL_HEADER = _DMUS_IO_TOOL_HEADER; + {$EXTERNALSYM DMUS_IO_TOOL_HEADER} + TDMusIoToolHeader = _DMUS_IO_TOOL_HEADER; + +(* +RIFF +( + 'DMTG' // DirectMusic ToolGraph chunk + [] // GUID for ToolGraph + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Tools +) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'toll' // Array of tools + ... // Each tool is encapsulated in a RIFF chunk + ) + +// Tools are embedded in a graph. Theoretically, they can be saved as individual files too. +RIFF +( + 'DMTL' + + [] // Tool data. Must be a RIFF readable chunk. +) + + // // Tool header chunk + ( + 'tolh' + // Tool header + ) +*) + +(* The AudioPath file carries everything for describing a specific audio path, + including Tool Graph and Buffer Descriptor. + This can even be used for configuring a complete performance. +*) + +const + DMUS_FOURCC_AUDIOPATH_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('A') shl 16) or (Byte('P') shl 24)); // mmioFOURCC('D','M','A','P') + {$EXTERNALSYM DMUS_FOURCC_AUDIOPATH_FORM} + +(* +RIFF +( + 'DMAP' // DirectMusic AudioPath chunk + [] // GUID for this Audio Path configuration + [] // Optional version info + [] // Name, author, copyright info., comments + [] // Optional ToolGraph + [] // Optional list of port configurations + []...// Optional array of Dsound buffer descriptors +) +*) + + DMUS_FOURCC_PORTCONFIGS_LIST = DWORD(Byte('p') or (Byte('c') shl 8) or (Byte('s') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('p','c','s','l') + {$EXTERNALSYM DMUS_FOURCC_PORTCONFIGS_LIST} + DMUS_FOURCC_PORTCONFIG_LIST = DWORD(Byte('p') or (Byte('c') shl 8) or (Byte('f') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('p','c','f','l') + {$EXTERNALSYM DMUS_FOURCC_PORTCONFIG_LIST} + DMUS_FOURCC_PORTCONFIG_ITEM = DWORD(Byte('p') or (Byte('c') shl 8) or (Byte('f') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('p','c','f','h') + {$EXTERNALSYM DMUS_FOURCC_PORTCONFIG_ITEM} + DMUS_FOURCC_PORTPARAMS_ITEM = DWORD(Byte('p') or (Byte('p') shl 8) or (Byte('r') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('p','p','r','h') + {$EXTERNALSYM DMUS_FOURCC_PORTPARAMS_ITEM} + DMUS_FOURCC_DSBUFFER_LIST = DWORD(Byte('d') or (Byte('b') shl 8) or (Byte('f') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('d','b','f','l') + {$EXTERNALSYM DMUS_FOURCC_DSBUFFER_LIST} + DMUS_FOURCC_DSBUFFATTR_ITEM = DWORD(Byte('d') or (Byte('d') shl 8) or (Byte('a') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('d','d','a','h') + {$EXTERNALSYM DMUS_FOURCC_DSBUFFATTR_ITEM} + DMUS_FOURCC_PCHANNELS_LIST = DWORD(Byte('p') or (Byte('c') shl 8) or (Byte('h') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('p','c','h','l') + {$EXTERNALSYM DMUS_FOURCC_PCHANNELS_LIST} + DMUS_FOURCC_PCHANNELS_ITEM = DWORD(Byte('p') or (Byte('c') shl 8) or (Byte('h') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('p','c','h','h') + {$EXTERNALSYM DMUS_FOURCC_PCHANNELS_ITEM} + +type + PDMusIoPortConfigHeader = ^TDMusIoPortConfigHeader; + _DMUS_IO_PORTCONFIG_HEADER = packed record + guidPort: TGUID; (* GUID of requested port. *) + dwPChannelBase: DWORD; (* PChannel that this should start on. *) + dwPChannelCount: DWORD; (* How many channels. *) + dwFlags: DWORD; (* Various flags. *) + end; + {$EXTERNALSYM _DMUS_IO_PORTCONFIG_HEADER} + DMUS_IO_PORTCONFIG_HEADER = _DMUS_IO_PORTCONFIG_HEADER; + {$EXTERNALSYM DMUS_IO_PORTCONFIG_HEADER} + TDMusIoPortConfigHeader = _DMUS_IO_PORTCONFIG_HEADER; + +const + DMUS_PORTCONFIGF_DRUMSON10 = 1; (* This port configured for drums on channel 10. *) + {$EXTERNALSYM DMUS_PORTCONFIGF_DRUMSON10} + DMUS_PORTCONFIGF_USEDEFAULT = 2; (* Use the default port. *) + {$EXTERNALSYM DMUS_PORTCONFIGF_USEDEFAULT} + +(* Each portconfig has one or more pchannel to buffer mappings. Each buffer + is identified by a guid. Each pchannel can map to one or more buffers. + This is defined with one or more DMUS_IO_PCHANNELTOBUFFER_HEADER + structures. Each defines a range of PChannels and the set of buffers + that they connect to. +*) + +type + PDMusIoPChannelToBufferHeader = ^TDMusIoPChannelToBufferHeader; + _DMUS_IO_PCHANNELTOBUFFER_HEADER = packed record + dwPChannelBase: DWORD; (* PChannel that this should start on. *) + dwPChannelCount: DWORD; (* How many PChannels. *) + dwBufferCount: DWORD; (* How many buffers do these connect to. *) + dwFlags: DWORD; (* Various flags. Currently reserved for future use. Must be 0. *) + end; + {$EXTERNALSYM _DMUS_IO_PCHANNELTOBUFFER_HEADER} + DMUS_IO_PCHANNELTOBUFFER_HEADER = _DMUS_IO_PCHANNELTOBUFFER_HEADER; + {$EXTERNALSYM DMUS_IO_PCHANNELTOBUFFER_HEADER} + TDMusIoPChannelToBufferHeader = _DMUS_IO_PCHANNELTOBUFFER_HEADER; + +(* Each buffer is represented by an DSBC form. This is wrapped by the + DMUS_IO_BUFFER_ATTRIBUTES_HEADER which identifies how to use the + buffer. In particular, it indicates whether this gets dynamically duplicated + or all references to this should share the same instance. + To resolve references, the unique GUID of the buffer is also stored + in this structure. +*) + + PDMusIoBufferAttributesHeader = ^TDMusIoBufferAttributesHeader; + _DMUS_IO_BUFFER_ATTRIBUTES_HEADER = packed record + guidBufferID: TGUID; (* Each buffer config has a unique ID. *) + dwFlags: DWORD; (* Various flags. *) + end; + {$EXTERNALSYM _DMUS_IO_BUFFER_ATTRIBUTES_HEADER} + DMUS_IO_BUFFER_ATTRIBUTES_HEADER = _DMUS_IO_BUFFER_ATTRIBUTES_HEADER; + {$EXTERNALSYM DMUS_IO_BUFFER_ATTRIBUTES_HEADER} + TDMusIoBufferAttributesHeader = _DMUS_IO_BUFFER_ATTRIBUTES_HEADER; + +const + (* DMUS_IO_BUFFER_ATTRIBUTES_HEADER.dwFlags: *) + DMUS_BUFFERF_SHARED = 1; (* Share this with other audio paths, instead of creating unique copies. *) + {$EXTERNALSYM DMUS_BUFFERF_SHARED} + DMUS_BUFFERF_DEFINED = 2; (* Use one of the standard predefined buffers (see GUID_Buffer... in dmusici.h.) *) + {$EXTERNALSYM DMUS_BUFFERF_DEFINED} + DMUS_BUFFERF_MIXIN = 8; (* This is a mixin buffer. *) + {$EXTERNALSYM DMUS_BUFFERF_MIXIN} + +(* + +LIST +( + 'pcsl' // Array of port configurations + ... // One or more port configurations, each in a list chunk +) + +LIST +( + 'pcfl' // List container for one port configuration. + // Portconfig header chunk. + // Port params, to be used to create the port. + []...// Optional array of Dsound buffer descriptors + [] // Optional list of pchannel to buffer assignments + +) + + // // Port config header chunk + ( + 'pcfh' + // Port config header + ) + + // // Port params header chunk + ( + 'pprh' + // Port params header + ) + +LIST +( + 'pchl' // List container for one or more pchannel to buffer assignments. + ... // One or more pchannel to buffer assignment headers and data. + + // + ( + 'pchh' + // Description of PChannels + ... // Array of GUIDs defining the buffers they all connect to. + ) +) + +LIST +( + 'dbfl' // List container for one buffer and buffer attributes header. + // Buffer attributes header. + [] // Buffer configuration. Not required when header uses a predefined buffer type. + + // + ( + 'ddah' + // Buffer attributes. + ) +) +*) + +(* File io for DirectMusic Band Track object *) + + +const + (* RIFF ids: *) + DMUS_FOURCC_BANDTRACK_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('B') shl 16) or (Byte('T') shl 24)); // mmioFOURCC('D','M','B','T') + {$EXTERNALSYM DMUS_FOURCC_BANDTRACK_FORM} + DMUS_FOURCC_BANDTRACK_CHUNK = DWORD(Byte('b') or (Byte('d') shl 8) or (Byte('t') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('b','d','t','h') + {$EXTERNALSYM DMUS_FOURCC_BANDTRACK_CHUNK} + DMUS_FOURCC_BANDS_LIST = DWORD(Byte('l') or (Byte('b') shl 8) or (Byte('d') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('l','b','d','l') + {$EXTERNALSYM DMUS_FOURCC_BANDS_LIST} + DMUS_FOURCC_BAND_LIST = DWORD(Byte('l') or (Byte('b') shl 8) or (Byte('n') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('l','b','n','d') + {$EXTERNALSYM DMUS_FOURCC_BAND_LIST} + DMUS_FOURCC_BANDITEM_CHUNK = DWORD(Byte('b') or (Byte('d') shl 8) or (Byte('i') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('b','d','i','h') + {$EXTERNALSYM DMUS_FOURCC_BANDITEM_CHUNK} + DMUS_FOURCC_BANDITEM_CHUNK2 = DWORD(Byte('b') or (Byte('d') shl 8) or (Byte('2') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('b','d','2','h') + {$EXTERNALSYM DMUS_FOURCC_BANDITEM_CHUNK2} + +type + (* io structures *) + PDMusIoBandTrackHeader = ^TDMusIoBandTrackHeader; + _DMUS_IO_BAND_TRACK_HEADER = packed record + bAutoDownload: BOOL; (* Determines if Auto-Download is enabled. *) + end; + {$EXTERNALSYM _DMUS_IO_BAND_TRACK_HEADER} + DMUS_IO_BAND_TRACK_HEADER = _DMUS_IO_BAND_TRACK_HEADER; + {$EXTERNALSYM DMUS_IO_BAND_TRACK_HEADER} + TDMusIoBandTrackHeader = _DMUS_IO_BAND_TRACK_HEADER; + + PDMusIoBandItemHeader = ^TDMusIoBandItemHeader; + _DMUS_IO_BAND_ITEM_HEADER = packed record + lBandTime: TMusicTime; (* Position in track list. *) + end; + {$EXTERNALSYM _DMUS_IO_BAND_ITEM_HEADER} + DMUS_IO_BAND_ITEM_HEADER = _DMUS_IO_BAND_ITEM_HEADER; + {$EXTERNALSYM DMUS_IO_BAND_ITEM_HEADER} + TDMusIoBandItemHeader = _DMUS_IO_BAND_ITEM_HEADER; + + PDMusIoBandItemHeader2 = ^TDMusIoBandItemHeader2; + _DMUS_IO_BAND_ITEM_HEADER2 = packed record + lBandTimeLogical: TMusicTime; (* Position in track list. Time in the music with which band change is associated. *) + lBandTimePhysical: TMusicTime; (* Precise time band change will take effect. Should be close to logical time. *) + end; + {$EXTERNALSYM _DMUS_IO_BAND_ITEM_HEADER2} + DMUS_IO_BAND_ITEM_HEADER2 = _DMUS_IO_BAND_ITEM_HEADER2; + {$EXTERNALSYM DMUS_IO_BAND_ITEM_HEADER2} + TDMusIoBandItemHeader2 = _DMUS_IO_BAND_ITEM_HEADER2; + +(* +RIFF +( + 'DMBT' // DirectMusic Band Track form-type + [] // Band track header + [] // GUID for band track + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Band items +) + + // + 'bdth' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'lbdl' + ... // Array of bands, each encapsulated in a list chunk + ) + + // + LIST + ( + 'lbnd' + or // bdih is a legacy format. bd2h is preferred for new content. + // Band + ) + + // or // band item header + ( + or // Band item header + ) +*) + + +(* File io for DirectMusic Band object +*) + +const + (* RIFF ids: *) + + DMUS_FOURCC_BAND_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('B') shl 16) or (Byte('D') shl 24)); // mmioFOURCC('D','M','B','D') + {$EXTERNALSYM DMUS_FOURCC_BAND_FORM} + DMUS_FOURCC_INSTRUMENTS_LIST = DWORD(Byte('l') or (Byte('b') shl 8) or (Byte('i') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('l','b','i','l') + {$EXTERNALSYM DMUS_FOURCC_INSTRUMENTS_LIST} + DMUS_FOURCC_INSTRUMENT_LIST = DWORD(Byte('l') or (Byte('b') shl 8) or (Byte('i') shl 16) or (Byte('n') shl 24)); // mmioFOURCC('l','b','i','n') + {$EXTERNALSYM DMUS_FOURCC_INSTRUMENT_LIST} + DMUS_FOURCC_INSTRUMENT_CHUNK = DWORD(Byte('b') or (Byte('i') shl 8) or (Byte('n') shl 16) or (Byte('s') shl 24)); // mmioFOURCC('b','i','n','s') + {$EXTERNALSYM DMUS_FOURCC_INSTRUMENT_CHUNK} + +(* Flags for DMUS_IO_INSTRUMENT + *) + DMUS_IO_INST_PATCH = (1 shl 0); (* dwPatch is valid. *) + {$EXTERNALSYM DMUS_IO_INST_PATCH} + DMUS_IO_INST_BANKSELECT = (1 shl 1); (* dwPatch contains a valid Bank Select MSB and LSB part *) + {$EXTERNALSYM DMUS_IO_INST_BANKSELECT} + DMUS_IO_INST_ASSIGN_PATCH = (1 shl 3); (* dwAssignPatch is valid *) + {$EXTERNALSYM DMUS_IO_INST_ASSIGN_PATCH} + DMUS_IO_INST_NOTERANGES = (1 shl 4); (* dwNoteRanges is valid *) + {$EXTERNALSYM DMUS_IO_INST_NOTERANGES} + DMUS_IO_INST_PAN = (1 shl 5); (* bPan is valid *) + {$EXTERNALSYM DMUS_IO_INST_PAN} + DMUS_IO_INST_VOLUME = (1 shl 6); (* bVolume is valid *) + {$EXTERNALSYM DMUS_IO_INST_VOLUME} + DMUS_IO_INST_TRANSPOSE = (1 shl 7); (* nTranspose is valid *) + {$EXTERNALSYM DMUS_IO_INST_TRANSPOSE} + DMUS_IO_INST_GM = (1 shl 8); (* Instrument is from GM collection *) + {$EXTERNALSYM DMUS_IO_INST_GM} + DMUS_IO_INST_GS = (1 shl 9); (* Instrument is from GS collection *) + {$EXTERNALSYM DMUS_IO_INST_GS} + DMUS_IO_INST_XG = (1 shl 10); (* Instrument is from XG collection *) + {$EXTERNALSYM DMUS_IO_INST_XG} + DMUS_IO_INST_CHANNEL_PRIORITY = (1 shl 11); (* dwChannelPriority is valid *) + {$EXTERNALSYM DMUS_IO_INST_CHANNEL_PRIORITY} + DMUS_IO_INST_USE_DEFAULT_GM_SET = (1 shl 12); (* Always use the default GM set for this patch, *) + {$EXTERNALSYM DMUS_IO_INST_USE_DEFAULT_GM_SET} + (* don't rely on the synth caps stating GM or GS in hardware. *) + DMUS_IO_INST_PITCHBENDRANGE = (1 shl 13); (* nPitchBendRange is valid *) + {$EXTERNALSYM DMUS_IO_INST_PITCHBENDRANGE} + +type + (* io structures *) + PDMusIoInstrument = ^TDMusIoInstrument; + _DMUS_IO_INSTRUMENT = packed record + dwPatch: DWORD; (* MSB, LSB and Program change to define instrument *) + dwAssignPatch: DWORD; (* MSB, LSB and Program change to assign to instrument when downloading *) + dwNoteRanges: array[0..3] of DWORD; (* 128 bits; one for each MIDI note instrument needs to able to play *) + dwPChannel: DWORD; (* PChannel instrument plays on *) + dwFlags: DWORD; (* DMUS_IO_INST_ flags *) + bPan: Byte; (* Pan for instrument *) + bVolume: Byte; (* Volume for instrument *) + nTranspose: Smallint; (* Number of semitones to transpose notes *) + dwChannelPriority: DWORD; (* Channel priority *) + nPitchBendRange: Smallint; (* Number of semitones shifted by pitch bend *) + end; + {$EXTERNALSYM _DMUS_IO_INSTRUMENT} + DMUS_IO_INSTRUMENT = _DMUS_IO_INSTRUMENT; + {$EXTERNALSYM DMUS_IO_INSTRUMENT} + TDMusIoInstrument = _DMUS_IO_INSTRUMENT; + +(* +// bands can be embedded in other forms +RIFF +( + 'DMBD' // DirectMusic Band chunk + [] // GUID for band + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Instruments +) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'lbil' // Array of instruments + ... // Each instrument is encapsulated in a list + ) + + // + LIST + ( + 'lbin' + + [] // Optional reference to DLS Collection file. + ) + + // // Instrument chunk + ( + 'bins' + // Instrument header + ) +*) + +(* This RIFF id and io struct have been added to allow wave files (and the wave object) to + differentiate between streaming and one-shot waves, and to give a prefetch for streaming + waves *) + +const + DMUS_FOURCC_WAVEHEADER_CHUNK = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('v') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('w','a','v','h') + {$EXTERNALSYM DMUS_FOURCC_WAVEHEADER_CHUNK} + +type + PDMusIoWaveHeader = ^TDMusIoWaveHeader; + _DMUS_IO_WAVE_HEADER = packed record + rtReadAhead: TReferenceTime; (* How far ahead in the stream wave data will be read (in REFERENCE_TIME). Ignored for one-shot waves. *) + dwFlags: DWORD; (* Various flags, including whether this is a streaming wave and whether it can be invalidated. *) + end; + {$EXTERNALSYM _DMUS_IO_WAVE_HEADER} + DMUS_IO_WAVE_HEADER = _DMUS_IO_WAVE_HEADER; + {$EXTERNALSYM DMUS_IO_WAVE_HEADER} + TDMusIoWaveHeader = _DMUS_IO_WAVE_HEADER; + + +(* File io for Wave track *) + +const +(* RIFF ids: *) + + DMUS_FOURCC_WAVETRACK_LIST = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('v') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('w','a','v','t') + {$EXTERNALSYM DMUS_FOURCC_WAVETRACK_LIST} + DMUS_FOURCC_WAVETRACK_CHUNK = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('t') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('w','a','t','h') + {$EXTERNALSYM DMUS_FOURCC_WAVETRACK_CHUNK} + DMUS_FOURCC_WAVEPART_LIST = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('v') shl 16) or (Byte('p') shl 24)); // mmioFOURCC('w','a','v','p') + {$EXTERNALSYM DMUS_FOURCC_WAVEPART_LIST} + DMUS_FOURCC_WAVEPART_CHUNK = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('p') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('w','a','p','h') + {$EXTERNALSYM DMUS_FOURCC_WAVEPART_CHUNK} + DMUS_FOURCC_WAVEITEM_LIST = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('v') shl 16) or (Byte('i') shl 24)); // mmioFOURCC('w','a','v','i') + {$EXTERNALSYM DMUS_FOURCC_WAVEITEM_LIST} + DMUS_FOURCC_WAVE_LIST = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('v') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('w','a','v','e') + {$EXTERNALSYM DMUS_FOURCC_WAVE_LIST} + DMUS_FOURCC_WAVEITEM_CHUNK = DWORD(Byte('w') or (Byte('a') shl 8) or (Byte('i') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('w','a','i','h') + {$EXTERNALSYM DMUS_FOURCC_WAVEITEM_CHUNK} + +(* This flag is included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags. If set, the track will get its + variations from a pattern track, via GetParam(GUID_Variations). *) + DMUS_WAVETRACKF_SYNC_VAR = $1; + {$EXTERNALSYM DMUS_WAVETRACKF_SYNC_VAR} +(* This is also included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags. If set, variation control + information will persist from one playback instance to the next.*) + DMUS_WAVETRACKF_PERSIST_CONTROL = $2; + {$EXTERNALSYM DMUS_WAVETRACKF_PERSIST_CONTROL} + +type + PDMusIoWaveTrackHeader = ^TDMusIoWaveTrackHeader; + _DMUS_IO_WAVE_TRACK_HEADER = packed record + lVolume: Longint; (* Gain, in 1/100th of dB, to be applied to all waves. Note: All gain values should be negative. *) + dwFlags: DWORD; (* Flags, including whether this track syncs to a pattern track for its variations. *) + end; + {$EXTERNALSYM _DMUS_IO_WAVE_TRACK_HEADER} + DMUS_IO_WAVE_TRACK_HEADER = _DMUS_IO_WAVE_TRACK_HEADER; + {$EXTERNALSYM DMUS_IO_WAVE_TRACK_HEADER} + TDMusIoWaveTrackHeader = _DMUS_IO_WAVE_TRACK_HEADER; + + PDMusIoWavePartHeader = ^TDMusIoWavePartHeader; + _DMUS_IO_WAVE_PART_HEADER = packed record + lVolume: Longint; (* Gain, in 1/100th of dB, to be applied to all waves in wave part. Note: All gain values should be negative. *) + dwVariations: DWORD; (* Variation mask for which of 32 variations *) + dwPChannel: DWORD; (* PChannel *) + dwLockToPart: DWORD; (* Part ID to lock to. *) + dwFlags: DWORD; (* Flags, including stuff for managing how variations are chosen (in low-order nibble) *) + dwIndex: DWORD; (* Index for distinguishing multiple parts on the same PChannel*) + end; + {$EXTERNALSYM _DMUS_IO_WAVE_PART_HEADER} + DMUS_IO_WAVE_PART_HEADER = _DMUS_IO_WAVE_PART_HEADER; + {$EXTERNALSYM DMUS_IO_WAVE_PART_HEADER} + TDMusIoWavePartHeader = _DMUS_IO_WAVE_PART_HEADER; + + PDMusIoWaveItemHeader = ^TDMusIoWaveItemHeader; + _DMUS_IO_WAVE_ITEM_HEADER = packed record + lVolume: Longint; (* Gain, in 1/100th of dB. Note: All gain values should be negative. *) + lPitch: Longint; (* Pitch offset in 1/100th of a semitone. *) + dwVariations: DWORD; (* Variation flags for which of 32 variations this wave belongs to. *) + rtTime: TReferenceTime; (* Start time, in REFERENCE_TIME, if clock time track, or MUSIC_TIME for music time track. *) + rtStartOffset: TReferenceTime; (* Distance into wave to start playback, in reference time units. *) + rtReserved: TReferenceTime; (* Reserved field. *) + rtDuration: TReferenceTime; (* Duration, in REFERENCE_TIME or MUSIC_TIME, depending on track timing format. *) + mtLogicalTime: TMusicTime; (* If in music track format, this indicates the musical boundary where this belongs. Otherwise, ignored. *) + dwLoopStart: DWORD; (* Start point for a looping wave. *) + dwLoopEnd: DWORD; (* End point for a looping wave. *) + dwFlags: DWORD; (* Various flags, including whether this is a streaming wave and whether it can be invalidated. *) + wVolumeRange: Word; (* Random range for volume. *) + wPitchRange: Word; (* Random range for pitch. *) + end; + {$EXTERNALSYM _DMUS_IO_WAVE_ITEM_HEADER} + DMUS_IO_WAVE_ITEM_HEADER = _DMUS_IO_WAVE_ITEM_HEADER; + {$EXTERNALSYM DMUS_IO_WAVE_ITEM_HEADER} + TDMusIoWaveItemHeader = _DMUS_IO_WAVE_ITEM_HEADER; + +(* +LIST +{ + 'wavt' // Wave track chunk + // Wave track header + ... // Array of Wave Parts +} + // + 'wath' + { + + } + + // + LIST + { + 'wavp' + // Wave Part Header + // List of wave items + } + + // + 'waph' + { + + } + + // + LIST + { + 'wavi' + ... // Array of waves; each wave is encapsulated in a list + } + + // + LIST + { + 'wave' + // Wave item header + // Reference to wave object + } + + // + 'waih' + { + + } + +*) + +(* File io for DirectMusic Container file. This embeds a set of related files. And, + in turn, it can be embedded within a segment or script file. +*) + +const + DMUS_FOURCC_CONTAINER_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('C') shl 16) or (Byte('N') shl 24)); // mmioFOURCC('D','M','C','N') + {$EXTERNALSYM DMUS_FOURCC_CONTAINER_FORM} + DMUS_FOURCC_CONTAINER_CHUNK = DWORD(Byte('c') or (Byte('o') shl 8) or (Byte('n') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('c','o','n','h') + {$EXTERNALSYM DMUS_FOURCC_CONTAINER_CHUNK} + DMUS_FOURCC_CONTAINED_ALIAS_CHUNK = DWORD(Byte('c') or (Byte('o') shl 8) or (Byte('b') shl 16) or (Byte('a') shl 24)); // mmioFOURCC('c','o','b','a') + {$EXTERNALSYM DMUS_FOURCC_CONTAINED_ALIAS_CHUNK} + DMUS_FOURCC_CONTAINED_OBJECT_CHUNK = DWORD(Byte('c') or (Byte('o') shl 8) or (Byte('b') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('c','o','b','h') + {$EXTERNALSYM DMUS_FOURCC_CONTAINED_OBJECT_CHUNK} + DMUS_FOURCC_CONTAINED_OBJECTS_LIST = DWORD(Byte('c') or (Byte('o') shl 8) or (Byte('s') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('c','o','s','l') + {$EXTERNALSYM DMUS_FOURCC_CONTAINED_OBJECTS_LIST} + DMUS_FOURCC_CONTAINED_OBJECT_LIST = DWORD(Byte('c') or (Byte('o') shl 8) or (Byte('b') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('c','o','b','l') + {$EXTERNALSYM DMUS_FOURCC_CONTAINED_OBJECT_LIST} + +type + PDMusIoContainerHeader = ^TDMusIoContainerHeader; + _DMUS_IO_CONTAINER_HEADER = packed record + dwFlags: DWORD; (* Flags. *) + end; + {$EXTERNALSYM _DMUS_IO_CONTAINER_HEADER} + DMUS_IO_CONTAINER_HEADER = _DMUS_IO_CONTAINER_HEADER; + {$EXTERNALSYM DMUS_IO_CONTAINER_HEADER} + TDMusIoContainerHeader = _DMUS_IO_CONTAINER_HEADER; + + +const + DMUS_CONTAINER_NOLOADS = (1 shl 1); (* Contained items are not loaded when the container is loaded. + Entries will be created in the loader (via SetObject) but + the actual objects will not be created until they are + specifically loaded at a later time. *) + {$EXTERNALSYM DMUS_CONTAINER_NOLOADS} + +type + PDMusIoContainedObjectHeader = ^TDMusIoContainedObjectHeader; + _DMUS_IO_CONTAINED_OBJECT_HEADER = packed record + guidClassID: TGUID; (* Class id of object. *) + dwFlags: DWORD; (* Flags, for example DMUS_CONTAINED_OBJF_KEEP. *) + ckid: FOURCC; (* chunk ID of track's data chunk if 0 fccType valid. *) + fccType: FOURCC; (* list type if NULL ckid valid */ + (* Note that LIST:DMRF may be used for ckid and fccType in order to reference an + object instead of embedding it within the container. *) + end; + {$EXTERNALSYM _DMUS_IO_CONTAINED_OBJECT_HEADER} + DMUS_IO_CONTAINED_OBJECT_HEADER = _DMUS_IO_CONTAINED_OBJECT_HEADER; + {$EXTERNALSYM DMUS_IO_CONTAINED_OBJECT_HEADER} + TDMusIoContainedObjectHeader = _DMUS_IO_CONTAINED_OBJECT_HEADER; + +const + DMUS_CONTAINED_OBJF_KEEP = 1; (* Keep the object cached in the loader after the container is released. *) + {$EXTERNALSYM DMUS_CONTAINED_OBJF_KEEP} + +(* +RIFF +( + 'DMCN' // DirectMusic Container chunk + // Container header chunk + [] // GUID for container + [] // Optional version info + [] // Name, author, copyright info., comments + // List of objects. +) + + // + 'conh' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + LIST + ( + 'cosl' // Array of embedded objects. + ... // Each object is encapsulated in a LIST chunk + ) + + // // Encapsulates one object + LIST + ( + 'cobl' + [] // Alias. An alternative name by which this object is known + // within the container. + // Required header, includes CLASS ID for object. + [] or // Object data of the type specified in . + // If DMRF, it is a reference of where to find the object. + // Otherwise, it could be any RIFF readable chunk in the + // exact same format as a file. The object will load + // itself from this data. + ) + + // + 'coba' + ( + // Alias, stored as NULL terminated string of WCHARs + ) + + // + 'cobh' + ( + + ) +*) + +(* File io for DirectMusic Segment object *) + +(* RIFF ids: *) + +const + DMUS_FOURCC_SEGMENT_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('S') shl 16) or (Byte('G') shl 24)); // mmioFOURCC('D','M','S','G') + {$EXTERNALSYM DMUS_FOURCC_SEGMENT_FORM} + DMUS_FOURCC_SEGMENT_CHUNK = DWORD(Byte('s') or (Byte('e') shl 8) or (Byte('g') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('s','e','g','h') + {$EXTERNALSYM DMUS_FOURCC_SEGMENT_CHUNK} + DMUS_FOURCC_TRACK_LIST = DWORD(Byte('t') or (Byte('r') shl 8) or (Byte('k') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('t','r','k','l') + {$EXTERNALSYM DMUS_FOURCC_TRACK_LIST} + DMUS_FOURCC_TRACK_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('T') shl 16) or (Byte('K') shl 24)); // mmioFOURCC('D','M','T','K') + {$EXTERNALSYM DMUS_FOURCC_TRACK_FORM} + DMUS_FOURCC_TRACK_CHUNK = DWORD(Byte('t') or (Byte('r') shl 8) or (Byte('k') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('t','r','k','h') + {$EXTERNALSYM DMUS_FOURCC_TRACK_CHUNK} + DMUS_FOURCC_TRACK_EXTRAS_CHUNK = DWORD(Byte('t') or (Byte('r') shl 8) or (Byte('k') shl 16) or (Byte('x') shl 24)); // mmioFOURCC('t','r','k','x') + {$EXTERNALSYM DMUS_FOURCC_TRACK_EXTRAS_CHUNK} + + (* io structures:*) + +type + PDMusIoSegmentHeader = ^TDMusIoSegmentHeader; + _DMUS_IO_SEGMENT_HEADER = packed record + dwRepeats: DWORD; (* Number of repeats. By default, 0. *) + mtLength: TMusicTime; (* Length, in music time. *) + mtPlayStart: TMusicTime; (* Start of playback. By default, 0. *) + mtLoopStart: TMusicTime; (* Start of looping portion. By default, 0. *) + mtLoopEnd: TMusicTime; (* End of loop. Must be greater than dwPlayStart. Or, 0, indicating loop full segment. *) + dwResolution: DWORD; (* Default resolution. *) + // Following added for DX8: + rtLength: TReferenceTime; (* Length, in reference time (overrides music time length.) *) + dwFlags: DWORD; + dwReserved: DWORD; (* Reserved. *) + // Added for DX9. + rtLoopStart: TReferenceTime; (* Clock time loop start. *) + rtLoopEnd: TReferenceTime; (* Clock time loop end. *) + rtPlayStart: TReferenceTime; (* Start of playback in clock time. *) + end; + {$EXTERNALSYM _DMUS_IO_SEGMENT_HEADER} + DMUS_IO_SEGMENT_HEADER = _DMUS_IO_SEGMENT_HEADER; + {$EXTERNALSYM DMUS_IO_SEGMENT_HEADER} + TDMusIoSegmentHeader = _DMUS_IO_SEGMENT_HEADER; + +const + DMUS_SEGIOF_REFLENGTH = 1; // Use the time in rtLength for the segment length. + {$EXTERNALSYM DMUS_SEGIOF_REFLENGTH} + DMUS_SEGIOF_CLOCKTIME = 2; // This is a clock time segment. + {$EXTERNALSYM DMUS_SEGIOF_CLOCKTIME} + +type + PDMusIoTrackHeader = ^TDMusIoTrackHeader; + _DMUS_IO_TRACK_HEADER = packed record + guidClassID: TGUID; (* Class id of track. *) + dwPosition: DWORD; (* Position in track list. *) + dwGroup: DWORD; (* Group bits for track. *) + ckid: FOURCC; (* chunk ID of track's data chunk. *) + fccType: FOURCC; (* list type if ckid is RIFF or LIST *) + end; + {$EXTERNALSYM _DMUS_IO_TRACK_HEADER} + DMUS_IO_TRACK_HEADER = _DMUS_IO_TRACK_HEADER; + {$EXTERNALSYM DMUS_IO_TRACK_HEADER} + TDMusIoTrackHeader = _DMUS_IO_TRACK_HEADER; + +(* Additional parameters for the track header chunk, introduced in DX8 and + on, are stored in a separate chunk. *) + + PDMusIoTrackExtrasHeader = ^TDMusIoTrackExtrasHeader; + _DMUS_IO_TRACK_EXTRAS_HEADER = packed record + dwFlags: DWORD; (* DX8 Added flags for control tracks. *) + dwPriority: DWORD; (* Priority for composition. *) + end; + {$EXTERNALSYM _DMUS_IO_TRACK_EXTRAS_HEADER} + DMUS_IO_TRACK_EXTRAS_HEADER = _DMUS_IO_TRACK_EXTRAS_HEADER; + {$EXTERNALSYM DMUS_IO_TRACK_EXTRAS_HEADER} + TDMusIoTrackExtrasHeader = _DMUS_IO_TRACK_EXTRAS_HEADER; + +(* +RIFF +( + 'DMSG' // DirectMusic Segment chunk + // Segment header chunk + [] // GUID for segment + [] // Optional version info + [] // Name, author, copyright info., comments + [] // Optional container of objects embedded in file. Must precede tracklist. + // List of Tracks + [] // Optional ToolGraph + [] // Optional Audio Path +) + + // + 'segh' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'trkl' // Array of tracks + ... // Each track is encapsulated in a RIFF chunk + ) + + // // Tracks can be embedded in a segment or stored as separate files. + RIFF + ( + 'DMTK' + + [] // Optional track flags. + [] // Optional GUID for track object instance (not to be confused with Class id in track header) + [] // Optional version info + [] // Optional name, author, copyright info., comments + [] // Track data. Must be a RIFF readable chunk. + ) + + // // Track header chunk + ( + 'trkh' + // Track header + ) + + // // Track flags chunk + ( + 'trkx' + // DX8 Track flags header + ) +*) + +(* File io for DirectMusic reference chunk. + This is used to embed a reference to an object. +*) + +const + (* RIFF ids: *) + + DMUS_FOURCC_REF_LIST = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('R') shl 16) or (Byte('F') shl 24)); // mmioFOURCC('D','M','R','F') + {$EXTERNALSYM DMUS_FOURCC_REF_LIST} + DMUS_FOURCC_REF_CHUNK = DWORD(Byte('r') or (Byte('e') shl 8) or (Byte('f') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('r','e','f','h') + {$EXTERNALSYM DMUS_FOURCC_REF_CHUNK} + DMUS_FOURCC_DATE_CHUNK = DWORD(Byte('d') or (Byte('a') shl 8) or (Byte('t') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('d','a','t','e') + {$EXTERNALSYM DMUS_FOURCC_DATE_CHUNK} + DMUS_FOURCC_NAME_CHUNK = DWORD(Byte('n') or (Byte('a') shl 8) or (Byte('m') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('n','a','m','e') + {$EXTERNALSYM DMUS_FOURCC_NAME_CHUNK} + DMUS_FOURCC_FILE_CHUNK = DWORD(Byte('f') or (Byte('i') shl 8) or (Byte('l') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('f','i','l','e') + {$EXTERNALSYM DMUS_FOURCC_FILE_CHUNK} + +type + PDMusIoReference = ^TDMusIoReference; + _DMUS_IO_REFERENCE = packed record + guidClassID: TGUID; (* Class id is always required. *) + dwValidData: DWORD; (* Flags. *) + end; + {$EXTERNALSYM _DMUS_IO_REFERENCE} + DMUS_IO_REFERENCE = _DMUS_IO_REFERENCE; + {$EXTERNALSYM DMUS_IO_REFERENCE} + TDMusIoReference = _DMUS_IO_REFERENCE; + +(* +LIST +( + 'DMRF' // DirectMusic Reference chunk + // Reference header chunk + [] // Optional object GUID. + [] // Optional file date. + [] // Optional name. + [] // Optional file name. + [] // Optional category name. + [] // Optional version info. +) + + // + 'refh' + ( + + ) + + // + 'guid' + ( + + ) + + // + date + ( + + ) + + // + name + ( + // Name, stored as NULL terminated string of WCHARs + ) + + // + file + ( + // File name, stored as NULL terminated string of WCHARs + ) + + // + catg + ( + // Category name, stored as NULL terminated string of WCHARs + ) + + // + vers + ( + + ) +*) + +const + (* Chord Maps *) + + (* runtime chunks *) + DMUS_FOURCC_CHORDMAP_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('P') shl 16) or (Byte('R') shl 24)); // mmioFOURCC('D','M','P','R') + {$EXTERNALSYM DMUS_FOURCC_CHORDMAP_FORM} + DMUS_FOURCC_IOCHORDMAP_CHUNK = DWORD(Byte('p') or (Byte('e') shl 8) or (Byte('r') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('p','e','r','h') + {$EXTERNALSYM DMUS_FOURCC_IOCHORDMAP_CHUNK} + DMUS_FOURCC_SUBCHORD_CHUNK = DWORD(Byte('c') or (Byte('h') shl 8) or (Byte('d') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('c','h','d','t') + {$EXTERNALSYM DMUS_FOURCC_SUBCHORD_CHUNK} + DMUS_FOURCC_CHORDENTRY_CHUNK = DWORD(Byte('c') or (Byte('h') shl 8) or (Byte('e') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('c','h','e','h') + {$EXTERNALSYM DMUS_FOURCC_CHORDENTRY_CHUNK} + DMUS_FOURCC_SUBCHORDID_CHUNK = DWORD(Byte('s') or (Byte('b') shl 8) or (Byte('c') shl 16) or (Byte('n') shl 24)); // mmioFOURCC('s','b','c','n') + {$EXTERNALSYM DMUS_FOURCC_SUBCHORDID_CHUNK} + DMUS_FOURCC_IONEXTCHORD_CHUNK = DWORD(Byte('n') or (Byte('c') shl 8) or (Byte('r') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('n','c','r','d') + {$EXTERNALSYM DMUS_FOURCC_IONEXTCHORD_CHUNK} + DMUS_FOURCC_NEXTCHORDSEQ_CHUNK = DWORD(Byte('n') or (Byte('c') shl 8) or (Byte('s') shl 16) or (Byte('q') shl 24)); // mmioFOURCC('n','c','s','q') + {$EXTERNALSYM DMUS_FOURCC_NEXTCHORDSEQ_CHUNK} + DMUS_FOURCC_IOSIGNPOST_CHUNK = DWORD(Byte('s') or (Byte('p') shl 8) or (Byte('s') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('s','p','s','h') + {$EXTERNALSYM DMUS_FOURCC_IOSIGNPOST_CHUNK} + DMUS_FOURCC_CHORDNAME_CHUNK = DWORD(Byte('I') or (Byte('N') shl 8) or (Byte('A') shl 16) or (Byte('M') shl 24)); // mmioFOURCC('I','N','A','M') + {$EXTERNALSYM DMUS_FOURCC_CHORDNAME_CHUNK} + + (* runtime list chunks *) + DMUS_FOURCC_CHORDENTRY_LIST = DWORD(Byte('c') or (Byte('h') shl 8) or (Byte('o') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('c','h','o','e') + {$EXTERNALSYM DMUS_FOURCC_CHORDENTRY_LIST} + DMUS_FOURCC_CHORDMAP_LIST = DWORD(Byte('c') or (Byte('m') shl 8) or (Byte('a') shl 16) or (Byte('p') shl 24)); // mmioFOURCC('c','m','a','p') + {$EXTERNALSYM DMUS_FOURCC_CHORDMAP_LIST} + DMUS_FOURCC_CHORD_LIST = DWORD(Byte('c') or (Byte('h') shl 8) or (Byte('r') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('c','h','r','d') + {$EXTERNALSYM DMUS_FOURCC_CHORD_LIST} + DMUS_FOURCC_CHORDPALETTE_LIST = DWORD(Byte('c') or (Byte('h') shl 8) or (Byte('p') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('c','h','p','l') + {$EXTERNALSYM DMUS_FOURCC_CHORDPALETTE_LIST} + DMUS_FOURCC_CADENCE_LIST = DWORD(Byte('c') or (Byte('a') shl 8) or (Byte('d') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('c','a','d','e') + {$EXTERNALSYM DMUS_FOURCC_CADENCE_LIST} + DMUS_FOURCC_SIGNPOSTITEM_LIST = DWORD(Byte('s') or (Byte('p') shl 8) or (Byte('s') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('s','p','s','t') + {$EXTERNALSYM DMUS_FOURCC_SIGNPOSTITEM_LIST} + + DMUS_FOURCC_SIGNPOST_LIST = DWORD(Byte('s') or (Byte('p') shl 8) or (Byte('s') shl 16) or (Byte('q') shl 24)); // mmioFOURCC('s','p','s','q') + {$EXTERNALSYM DMUS_FOURCC_SIGNPOST_LIST} + + (* values for dwChord field of DMUS_IO_PERS_SIGNPOST *) + (* DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST) *) + DMUS_SIGNPOSTF_A = 1; + {$EXTERNALSYM DMUS_SIGNPOSTF_A} + DMUS_SIGNPOSTF_B = 2; + {$EXTERNALSYM DMUS_SIGNPOSTF_B} + DMUS_SIGNPOSTF_C = 4; + {$EXTERNALSYM DMUS_SIGNPOSTF_C} + DMUS_SIGNPOSTF_D = 8; + {$EXTERNALSYM DMUS_SIGNPOSTF_D} + DMUS_SIGNPOSTF_E = $10; + {$EXTERNALSYM DMUS_SIGNPOSTF_E} + DMUS_SIGNPOSTF_F = $20; + {$EXTERNALSYM DMUS_SIGNPOSTF_F} + DMUS_SIGNPOSTF_LETTER = (DMUS_SIGNPOSTF_A or DMUS_SIGNPOSTF_B or DMUS_SIGNPOSTF_C or DMUS_SIGNPOSTF_D or DMUS_SIGNPOSTF_E or DMUS_SIGNPOSTF_F); + {$EXTERNALSYM DMUS_SIGNPOSTF_LETTER} + DMUS_SIGNPOSTF_1 = $100; + {$EXTERNALSYM DMUS_SIGNPOSTF_1} + DMUS_SIGNPOSTF_2 = $200; + {$EXTERNALSYM DMUS_SIGNPOSTF_2} + DMUS_SIGNPOSTF_3 = $400; + {$EXTERNALSYM DMUS_SIGNPOSTF_3} + DMUS_SIGNPOSTF_4 = $800; + {$EXTERNALSYM DMUS_SIGNPOSTF_4} + DMUS_SIGNPOSTF_5 = $1000; + {$EXTERNALSYM DMUS_SIGNPOSTF_5} + DMUS_SIGNPOSTF_6 = $2000; + {$EXTERNALSYM DMUS_SIGNPOSTF_6} + DMUS_SIGNPOSTF_7 = $4000; + {$EXTERNALSYM DMUS_SIGNPOSTF_7} + DMUS_SIGNPOSTF_ROOT = (DMUS_SIGNPOSTF_1 or DMUS_SIGNPOSTF_2 or DMUS_SIGNPOSTF_3 or DMUS_SIGNPOSTF_4 or DMUS_SIGNPOSTF_5 or DMUS_SIGNPOSTF_6 or DMUS_SIGNPOSTF_7); + {$EXTERNALSYM DMUS_SIGNPOSTF_ROOT} + DMUS_SIGNPOSTF_CADENCE = $8000; + {$EXTERNALSYM DMUS_SIGNPOSTF_CADENCE} + + // values for dwFlags field of DMUS_IO_CHORDMAP + DMUS_CHORDMAPF_VERSION8 = 1; // Chordmap is version 8 or above. + {$EXTERNALSYM DMUS_CHORDMAPF_VERSION8} + + // values for dwChord field of DMUS_IO_PERS_SIGNPOST + DMUS_SPOSTCADENCEF_1 = 2; // Use the first cadence chord. + {$EXTERNALSYM DMUS_SPOSTCADENCEF_1} + DMUS_SPOSTCADENCEF_2 = 4; // Use the second cadence chord. + {$EXTERNALSYM DMUS_SPOSTCADENCEF_2} + +type + // run time data structs + PDMusIoChordMap = ^TDMusIoChordMap; + _DMUS_IO_CHORDMAP = packed record + wszLoadName: array[0..19] of WideChar; + dwScalePattern: DWORD; + dwFlags: DWORD; // Various flags. Only lower 16 bits are significant. + end; + {$EXTERNALSYM _DMUS_IO_CHORDMAP} + DMUS_IO_CHORDMAP = _DMUS_IO_CHORDMAP; + {$EXTERNALSYM DMUS_IO_CHORDMAP} + TDMusIoChordMap = _DMUS_IO_CHORDMAP; + + PDMusIoChordmapSubChord = ^TDMusIoChordmapSubChord; + _DMUS_IO_CHORDMAP_SUBCHORD = packed record + dwChordPattern: DWORD; + dwScalePattern: DWORD; + dwInvertPattern: DWORD; + bChordRoot: Byte; + bScaleRoot: Byte; + wCFlags: Word; + dwLevels: DWORD; // parts or which subchord levels this chord supports + end; + {$EXTERNALSYM _DMUS_IO_CHORDMAP_SUBCHORD} + DMUS_IO_CHORDMAP_SUBCHORD = _DMUS_IO_CHORDMAP_SUBCHORD; + {$EXTERNALSYM DMUS_IO_CHORDMAP_SUBCHORD} + TDMusIoChordmapSubChord = _DMUS_IO_CHORDMAP_SUBCHORD; + + // Legacy name... + DMUS_IO_PERS_SUBCHORD = DMUS_IO_CHORDMAP_SUBCHORD; + {$EXTERNALSYM DMUS_IO_PERS_SUBCHORD} + + PDMusIoChordEntry = ^TDMusIoChordEntry; + _DMUS_IO_CHORDENTRY = packed record + dwFlags: DWORD; + wConnectionID: Word; // replaces runtime "pointer to this" + end; + {$EXTERNALSYM _DMUS_IO_CHORDENTRY} + DMUS_IO_CHORDENTRY = _DMUS_IO_CHORDENTRY; + {$EXTERNALSYM DMUS_IO_CHORDENTRY} + TDMusIoChordEntry = _DMUS_IO_CHORDENTRY; + + PDMusIoNextChord = ^TDMusIoNextChord; + _DMUS_IO_NEXTCHORD = packed record + dwFlags: DWORD; + nWeight: Word; + wMinBeats: Word; + wMaxBeats: Word; + wConnectionID: Word; // points to an ioChordEntry + end; + {$EXTERNALSYM _DMUS_IO_NEXTCHORD} + DMUS_IO_NEXTCHORD = _DMUS_IO_NEXTCHORD; + {$EXTERNALSYM DMUS_IO_NEXTCHORD} + TDMusIoNextChord = _DMUS_IO_NEXTCHORD; + + PDMusIoChordMapSignPost = ^TDMusIoChordMapSignPost; + _DMUS_IO_CHORDMAP_SIGNPOST = packed record + dwChords: DWORD; // 1bit per group + dwFlags: DWORD; + end; + {$EXTERNALSYM _DMUS_IO_CHORDMAP_SIGNPOST} + DMUS_IO_CHORDMAP_SIGNPOST = _DMUS_IO_CHORDMAP_SIGNPOST; + {$EXTERNALSYM DMUS_IO_CHORDMAP_SIGNPOST} + TDMusIoChordMapSignPost = _DMUS_IO_CHORDMAP_SIGNPOST; + + // Legacy name... + DMUS_IO_PERS_SIGNPOST = DMUS_IO_CHORDMAP_SIGNPOST; + {$EXTERNALSYM DMUS_IO_PERS_SIGNPOST} + +(* +RIFF +( + 'DMPR' + // Chord map header chunk + [] // guid chunk + [] // version chunk (two DWORDS) + [] // Unfo chunk + // subchord database + // chord palette + // chord map + // signpost list + ) + + ::= LIST('cmap' ) + + ::= LIST('choe' + // chord entry data + // chord definition + // connecting(next) chords + ) + + ::= LIST('chrd' + // name of chord in wide char format + // list of subchords composing chord + ) + + ::= LIST('chpl' + ... // chord definition + ) + + ::== LIST('spsq' ... ) + + ::= LIST('spst' + + + [] + ) + + ::= LIST('cade' ...) + + ::= perh() + + ::= chdt( + ... ) + + ::= cheh() + + ::= sbcn( ...) + + ::= ncsq( + ...) + + ::= spsh() + +*) + +(* File io for DirectMusic Script object *) + +const + (* RIFF ids: *) + + DMUS_FOURCC_SCRIPT_FORM = DWORD(Byte('D') or (Byte('M') shl 8) or (Byte('S') shl 16) or (Byte('C') shl 24)); // mmioFOURCC('D','M','S','C') + {$EXTERNALSYM DMUS_FOURCC_SCRIPT_FORM} + DMUS_FOURCC_SCRIPT_CHUNK = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('h') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('s','c','h','d') + {$EXTERNALSYM DMUS_FOURCC_SCRIPT_CHUNK} + DMUS_FOURCC_SCRIPTVERSION_CHUNK = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('v') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('s','c','v','e') + {$EXTERNALSYM DMUS_FOURCC_SCRIPTVERSION_CHUNK} + DMUS_FOURCC_SCRIPTLANGUAGE_CHUNK = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('l') shl 16) or (Byte('a') shl 24)); // mmioFOURCC('s','c','l','a') + {$EXTERNALSYM DMUS_FOURCC_SCRIPTLANGUAGE_CHUNK} + DMUS_FOURCC_SCRIPTSOURCE_CHUNK = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('s') shl 16) or (Byte('r') shl 24)); // mmioFOURCC('s','c','s','r') + {$EXTERNALSYM DMUS_FOURCC_SCRIPTSOURCE_CHUNK} + +type + (* io structures: *) + + PDMusIoScriptHeader = ^TDMusIoScriptHeader; + _DMUS_IO_SCRIPT_HEADER = packed record + dwFlags: DWORD; // DMUS_SCRIPTIOF_ flags + end; + {$EXTERNALSYM _DMUS_IO_SCRIPT_HEADER} + DMUS_IO_SCRIPT_HEADER = _DMUS_IO_SCRIPT_HEADER; + {$EXTERNALSYM DMUS_IO_SCRIPT_HEADER} + TDMusIoScriptHeader = _DMUS_IO_SCRIPT_HEADER; + +const + DMUS_SCRIPTIOF_LOAD_ALL_CONTENT = (1 shl 0); + {$EXTERNALSYM DMUS_SCRIPTIOF_LOAD_ALL_CONTENT} + // If set, when the script loads it will also load all the content in its container. + DMUS_SCRIPTIOF_DOWNLOAD_ALL_SEGMENTS = (1 shl 1); + {$EXTERNALSYM DMUS_SCRIPTIOF_DOWNLOAD_ALL_SEGMENTS} + (* If set and LOAD_ALL_CONTENT is also set, when the script initializes it will also download all the segments in its container. + If set and LOAD_ALL_CONTENT is not set, when the script calls segment.Load on a segment then the segment will also be downloaded. + If not set, the script must manually download and unload by calling segment.DownloadSoundData and segment.UnloadSoundData. *) + +(* +RIFF +( + 'DMSC' // DirectMusic Script chunk + // Script header chunk + [] // GUID for script + [] // Optional version info + [] // Name, author, copyright info., comments + // Version of DirectMusic this script was authored to run against + // Container of content referenced by the script. + // ActiveX scripting language in which the script is written + or // The script's source code. + // If scsr-ck, the source is embedding in the chunk. + // If DMRF, it is a reference of where to find a text file with the source. + // Class id (guidClassID in DMUS_IO_REFERENCE) must be GUID_NULL because + // this text file is not a DirectMusic object in its own right. +) + + // + 'schd' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + scve + ( + + ) + + 'scla' + ( + // Language name, stored as NULL terminated string of WCHARs + ) + + 'scsr' + ( + // Source code, stored as NULL terminated string of WCHARs + ) +*) + +const + (* Signpost tracks *) + + DMUS_FOURCC_SIGNPOST_TRACK_CHUNK = DWORD(Byte('s') or (Byte('g') shl 8) or (Byte('n') shl 16) or (Byte('p') shl 24)); // mmioFOURCC('s','g','n','p') + {$EXTERNALSYM DMUS_FOURCC_SIGNPOST_TRACK_CHUNK} + + +type + PDMusIoSignPost = ^TDMusIoSignPost; + _DMUS_IO_SIGNPOST = packed record + mtTime: TMusicTime; + dwChords: DWORD; + wMeasure: Word; + end; + {$EXTERNALSYM _DMUS_IO_SIGNPOST} + DMUS_IO_SIGNPOST = _DMUS_IO_SIGNPOST; + {$EXTERNALSYM DMUS_IO_SIGNPOST} + TDMusIoSignPost = _DMUS_IO_SIGNPOST; + +(* + + // + 'sgnp' + ( + //sizeof DMUS_IO_SIGNPOST: DWORD + ... + ) + +*) + +const + DMUS_FOURCC_MUTE_CHUNK = DWORD(Byte('m') or (Byte('u') shl 8) or (Byte('t') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('m','u','t','e') + {$EXTERNALSYM DMUS_FOURCC_MUTE_CHUNK} + +type + PDMusIoMute = ^TDMusIoMute; + _DMUS_IO_MUTE = packed record + mtTime: TMusicTime; + dwPChannel: DWORD; + dwPChannelMap: DWORD; + end; + {$EXTERNALSYM _DMUS_IO_MUTE} + DMUS_IO_MUTE = _DMUS_IO_MUTE; + {$EXTERNALSYM DMUS_IO_MUTE} + TDMusIoMute = _DMUS_IO_MUTE; + +(* + + // + 'mute' + ( + //sizeof DMUS_IO_MUTE:DWORD + ... + ) + + +*) + +const + (* Used for both style and chord map tracks *) + + DMUS_FOURCC_TIME_STAMP_CHUNK = DWORD(Byte('s') or (Byte('t') shl 8) or (Byte('m') shl 16) or (Byte('p') shl 24)); // mmioFOURCC('s','t','m','p') + {$EXTERNALSYM DMUS_FOURCC_TIME_STAMP_CHUNK} + + (* Style tracks *) + + DMUS_FOURCC_STYLE_TRACK_LIST = DWORD(Byte('s') or (Byte('t') shl 8) or (Byte('t') shl 16) or (Byte('r') shl 24)); // mmioFOURCC('s','t','t','r') + {$EXTERNALSYM DMUS_FOURCC_STYLE_TRACK_LIST} + DMUS_FOURCC_STYLE_REF_LIST = DWORD(Byte('s') or (Byte('t') shl 8) or (Byte('r') shl 16) or (Byte('f') shl 24)); // mmioFOURCC('s','t','r','f') + {$EXTERNALSYM DMUS_FOURCC_STYLE_REF_LIST} + +(* + + // + LIST('sttr' + ( + ... // Array of Style references + ) + + // + LIST('strf' + ( + + + ) + + // + 'stmp' + ( + // time:DWORD + ) + +*) + +const + (* Chord map tracks *) + + DMUS_FOURCC_PERS_TRACK_LIST = DWORD(Byte('p') or (Byte('f') shl 8) or (Byte('t') shl 16) or (Byte('r') shl 24)); // mmioFOURCC('p','f','t','r') + {$EXTERNALSYM DMUS_FOURCC_PERS_TRACK_LIST} + DMUS_FOURCC_PERS_REF_LIST = DWORD(Byte('p') or (Byte('f') shl 8) or (Byte('r') shl 16) or (Byte('f') shl 24)); // mmioFOURCC('p','f','r','f') + {$EXTERNALSYM DMUS_FOURCC_PERS_REF_LIST} + +(* + + // + LIST('pftr' + ( + ... // Array of Chord map references + ) + + // + LIST('pfrf' + ( + + + ) + + // + 'stmp' + ( + // time:DWORD + ) + +*) + + DMUS_FOURCC_TEMPO_TRACK = DWORD(Byte('t') or (Byte('e') shl 8) or (Byte('t') shl 16) or (Byte('r') shl 24)); // mmioFOURCC('t','e','t','r') + {$EXTERNALSYM DMUS_FOURCC_TEMPO_TRACK} + +(* + // tempo array + 'tetr' + ( + // sizeof DMUS_IO_TEMPO_ITEM: DWORD + ... + ) + *) + + DMUS_FOURCC_SEQ_TRACK = DWORD(Byte('s') or (Byte('e') shl 8) or (Byte('q') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('s','e','q','t') + {$EXTERNALSYM DMUS_FOURCC_SEQ_TRACK} + DMUS_FOURCC_SEQ_LIST = DWORD(Byte('e') or (Byte('v') shl 8) or (Byte('t') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('e','v','t','l') + {$EXTERNALSYM DMUS_FOURCC_SEQ_LIST} + DMUS_FOURCC_CURVE_LIST = DWORD(Byte('c') or (Byte('u') shl 8) or (Byte('r') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('c','u','r','l') + {$EXTERNALSYM DMUS_FOURCC_CURVE_LIST} + +(* + // sequence track + 'seqt' + ( + // sequence array + 'evtl' + ( + // sizeof DMUS_IO_SEQ_ITEM: DWORD + ... + ) + // curve array + 'curl' + ( + // sizeof DMUS_IO_CURVE_ITEM: DWORD + ... + ) + ) +*) + + DMUS_FOURCC_SYSEX_TRACK = DWORD(Byte('s') or (Byte('y') shl 8) or (Byte('e') shl 16) or (Byte('x') shl 24)); // mmioFOURCC('s','y','e','x') + {$EXTERNALSYM DMUS_FOURCC_SYSEX_TRACK} + +(* + // sysex track + 'syex' + ( + { + + ... // Array of bytes, length defined in the DMUS_IO_SYSEXITEM structure + }... + ) +*) + + DMUS_FOURCC_TIMESIGNATURE_TRACK = DWORD(Byte('t') or (Byte('i') shl 8) or (Byte('m') shl 16) or (Byte('s') shl 24)); // mmioFOURCC('t','i','m','s') + {$EXTERNALSYM DMUS_FOURCC_TIMESIGNATURE_TRACK} + +type + PDMusIoTimeSignatureItem = ^TDMusIoTimeSignatureItem; + _DMUS_IO_TIMESIGNATURE_ITEM = packed record + lTime: TMusicTime; + bBeatsPerMeasure: Byte; // beats per measure (top of time sig) + bBeat: Byte; // what note receives the beat (bottom of time sig.) + // we can assume that 0 means 256th note + wGridsPerBeat: Word; // grids per beat + end; + {$EXTERNALSYM _DMUS_IO_TIMESIGNATURE_ITEM} + DMUS_IO_TIMESIGNATURE_ITEM = _DMUS_IO_TIMESIGNATURE_ITEM; + {$EXTERNALSYM DMUS_IO_TIMESIGNATURE_ITEM} + TDMusIoTimeSignatureItem = _DMUS_IO_TIMESIGNATURE_ITEM; + +(* DX6 time signature track + + 'tims' + ( + // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD + ... + ) +*) + +(* DX8 Time signature track. The track has been updated from DX7 to support a list of + RIFF chunks. This will allow the time signature track to expand in the future. +*) + +const + DMUS_FOURCC_TIMESIGTRACK_LIST = DWORD(Byte('T') or (Byte('I') shl 8) or (Byte('M') shl 16) or (Byte('S') shl 24)); // mmioFOURCC('T','I','M','S') + {$EXTERNALSYM DMUS_FOURCC_TIMESIGTRACK_LIST} + DMUS_FOURCC_TIMESIG_CHUNK = DMUS_FOURCC_TIMESIGNATURE_TRACK; + {$EXTERNALSYM DMUS_FOURCC_TIMESIG_CHUNK} + +(* +LIST +( + 'TIMS' // Time Signature Track list-type + // Chunk containing an array of time signatures +) + + 'tims' + ( + // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD + ... + ) + +*) + +(* DX8 Marker track. This is used to store valid start points and other + flow control parameters that may come later. For example, if we want + to implement more sophisticated looping and branching constructs, they + would live in this track. +*) + +const + DMUS_FOURCC_MARKERTRACK_LIST = DWORD(Byte('M') or (Byte('A') shl 8) or (Byte('R') shl 16) or (Byte('K') shl 24)); // mmioFOURCC('M','A','R','K') + {$EXTERNALSYM DMUS_FOURCC_MARKERTRACK_LIST} + DMUS_FOURCC_VALIDSTART_CHUNK = DWORD(Byte('v') or (Byte('a') shl 8) or (Byte('l') shl 16) or (Byte('s') shl 24)); // mmioFOURCC('v','a','l','s') + {$EXTERNALSYM DMUS_FOURCC_VALIDSTART_CHUNK} + DMUS_FOURCC_PLAYMARKER_CHUNK = DWORD(Byte('p') or (Byte('l') shl 8) or (Byte('a') shl 16) or (Byte('y') shl 24)); // mmioFOURCC('p','l','a','y') + {$EXTERNALSYM DMUS_FOURCC_PLAYMARKER_CHUNK} + +type + (* io structures *) + PDMusIoValidStart = ^TDMusIoValidStart; + _DMUS_IO_VALID_START = packed record + mtTime: TMusicTime; // Time of a legal start. + end; + {$EXTERNALSYM _DMUS_IO_VALID_START} + DMUS_IO_VALID_START = _DMUS_IO_VALID_START; + {$EXTERNALSYM DMUS_IO_VALID_START} + TDMusIoValidStart = _DMUS_IO_VALID_START; + + PDMusIoPlayMarker = ^TDMusIoPlayMarker; + _DMUS_IO_PLAY_MARKER = packed record + mtTime: TMusicTime; // Time of a next legal play point marker. + end; + {$EXTERNALSYM _DMUS_IO_PLAY_MARKER} + DMUS_IO_PLAY_MARKER = _DMUS_IO_PLAY_MARKER; + {$EXTERNALSYM DMUS_IO_PLAY_MARKER} + TDMusIoPlayMarker = _DMUS_IO_PLAY_MARKER; + +(* +LIST +( + 'MARK' // Marker Track list-type + [] // Chunk containing an array of start points + [] // Chunk containing an array of play start markers +) + + 'vals' + ( + // size of DMUS_IO_VALID_START : DWORD + ... + ) + + 'play' + ( + // size of DMUS_IO_PLAY_MARKER : DWORD + ... + ) + +*) + +(* segment trigger tracks *) + +const + (* RIFF ids: *) + DMUS_FOURCC_SEGTRACK_LIST = DWORD(Byte('s') or (Byte('e') shl 8) or (Byte('g') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('s','e','g','t') + {$EXTERNALSYM DMUS_FOURCC_SEGTRACK_LIST} + DMUS_FOURCC_SEGTRACK_CHUNK = DWORD(Byte('s') or (Byte('g') shl 8) or (Byte('t') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('s','g','t','h') + {$EXTERNALSYM DMUS_FOURCC_SEGTRACK_CHUNK} + DMUS_FOURCC_SEGMENTS_LIST = DWORD(Byte('l') or (Byte('s') shl 8) or (Byte('g') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('l','s','g','l') + {$EXTERNALSYM DMUS_FOURCC_SEGMENTS_LIST} + DMUS_FOURCC_SEGMENT_LIST = DWORD(Byte('l') or (Byte('s') shl 8) or (Byte('e') shl 16) or (Byte('g') shl 24)); // mmioFOURCC('l','s','e','g') + {$EXTERNALSYM DMUS_FOURCC_SEGMENT_LIST} + DMUS_FOURCC_SEGMENTITEM_CHUNK = DWORD(Byte('s') or (Byte('g') shl 8) or (Byte('i') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('s','g','i','h') + {$EXTERNALSYM DMUS_FOURCC_SEGMENTITEM_CHUNK} + DMUS_FOURCC_SEGMENTITEMNAME_CHUNK = DWORD(Byte('s') or (Byte('n') shl 8) or (Byte('a') shl 16) or (Byte('m') shl 24)); // mmioFOURCC('s','n','a','m') + {$EXTERNALSYM DMUS_FOURCC_SEGMENTITEMNAME_CHUNK} + +type + (* io structures *) + PDMusIoSegmentTrackHeader = ^TDMusIoSegmentTrackHeader; + _DMUS_IO_SEGMENT_TRACK_HEADER = packed record + dwFlags: DWORD; // Reserved leave as 0. + end; + {$EXTERNALSYM _DMUS_IO_SEGMENT_TRACK_HEADER} + DMUS_IO_SEGMENT_TRACK_HEADER = _DMUS_IO_SEGMENT_TRACK_HEADER; + {$EXTERNALSYM DMUS_IO_SEGMENT_TRACK_HEADER} + TDMusIoSegmentTrackHeader = _DMUS_IO_SEGMENT_TRACK_HEADER; + + PDMusIoSegmentItemHeader = ^TDMusIoSegmentItemHeader; + _DMUS_IO_SEGMENT_ITEM_HEADER = packed record + lTimeLogical: TMusicTime; // Position in track list. Time in the music with which the event is associated. + lTimePhysical: TMusicTime; // Precise time event will be triggered. Should be close to logical time. + dwPlayFlags: DWORD; // Flags for PlaySegment(). + dwFlags: DWORD; // Flags. + end; + {$EXTERNALSYM _DMUS_IO_SEGMENT_ITEM_HEADER} + DMUS_IO_SEGMENT_ITEM_HEADER = _DMUS_IO_SEGMENT_ITEM_HEADER; + {$EXTERNALSYM DMUS_IO_SEGMENT_ITEM_HEADER} + TDMusIoSegmentItemHeader = _DMUS_IO_SEGMENT_ITEM_HEADER; + +const + (* values for dwflags field of DMUS_IO_SEGMENT_ITEM_HEADER *) + DMUS_SEGMENTTRACKF_MOTIF = 1; // interpret DMRF as link to style, and use snam as the name of a motif within the style + {$EXTERNALSYM DMUS_SEGMENTTRACKF_MOTIF} + +(* +LIST +( + 'segt' // DirectMusic Segment Trigger Track form-type + [] // Segment track header + // List of Segment Lists +) + + // + 'sgth' + ( + + ) + + // + LIST + ( + 'lsgl' // Array of segments + ... // Each segment is encapsulated in a list (that way it can still be riff parsed.) + ) + + // + LIST + ( + 'lseg' + + // Link to a segment or style file. + [] // Name field. Used with DMUS_SEGMENTTRACKF_MOTIF flag. + ) + + // // segment item header + ( + // Segment item header + ) + + // + ( + // Name, stored as NULL terminated string of WCHARs + ) +*) + +(* Script track. *) + +const + (* RIFF ids: *) + DMUS_FOURCC_SCRIPTTRACK_LIST = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('r') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('s','c','r','t') + {$EXTERNALSYM DMUS_FOURCC_SCRIPTTRACK_LIST} + DMUS_FOURCC_SCRIPTTRACKEVENTS_LIST = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('r') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('s','c','r','l') + {$EXTERNALSYM DMUS_FOURCC_SCRIPTTRACKEVENTS_LIST} + DMUS_FOURCC_SCRIPTTRACKEVENT_LIST = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('r') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('s','c','r','e') + {$EXTERNALSYM DMUS_FOURCC_SCRIPTTRACKEVENT_LIST} + DMUS_FOURCC_SCRIPTTRACKEVENTHEADER_CHUNK = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('r') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('s','c','r','h') + {$EXTERNALSYM DMUS_FOURCC_SCRIPTTRACKEVENTHEADER_CHUNK} + DMUS_FOURCC_SCRIPTTRACKEVENTNAME_CHUNK = DWORD(Byte('s') or (Byte('c') shl 8) or (Byte('r') shl 16) or (Byte('n') shl 24)); // mmioFOURCC('s','c','r','n') + {$EXTERNALSYM DMUS_FOURCC_SCRIPTTRACKEVENTNAME_CHUNK} + +(* Flags for DMUS_IO_SCRIPTTRACK_TIMING + *) + DMUS_IO_SCRIPTTRACKF_PREPARE = (1 shl 0); (* Fire event in advance of time stamp, at Prepare time. This is the default because it leaves the script time to change the music happening at the target time. *) + {$EXTERNALSYM DMUS_IO_SCRIPTTRACKF_PREPARE} + DMUS_IO_SCRIPTTRACKF_QUEUE = (1 shl 1); (* Fire event just before time stamp, at Queue time. *) + {$EXTERNALSYM DMUS_IO_SCRIPTTRACKF_QUEUE} + DMUS_IO_SCRIPTTRACKF_ATTIME = (1 shl 2); (* Fire event right at the time stamp. *) + {$EXTERNALSYM DMUS_IO_SCRIPTTRACKF_ATTIME} + +type + PDMusIoScriptTrackEventHeader = ^TDMusIoScriptTrackEventHeader; + _DMUS_IO_SCRIPTTRACK_EVENTHEADER = packed record + dwFlags: DWORD; (* various bits ( see DMUS_IO_SCRIPTTRACKF_* ) *) + lTimeLogical: TMusicTime; (* Position in track list. Time in the music with which the event is associated. *) + lTimePhysical: TMusicTime; (* Precise time event will be triggered. Should be close to logical time. *) + end; + {$EXTERNALSYM _DMUS_IO_SCRIPTTRACK_EVENTHEADER} + DMUS_IO_SCRIPTTRACK_EVENTHEADER = _DMUS_IO_SCRIPTTRACK_EVENTHEADER; + {$EXTERNALSYM DMUS_IO_SCRIPTTRACK_EVENTHEADER} + TDMusIoScriptTrackEventHeader = _DMUS_IO_SCRIPTTRACK_EVENTHEADER; + +(* + // Script Track + + // + LIST + ( + // List of script events + ) + + // + LIST + ( + ... // Array of event descriptions + ) + + // + LIST + ( + // Event header chunk + + // Routine name + ) + + 'scrh' + ( + + ) + + 'scrn' + ( + // Name, stored as NULL terminated string of WCHARs + ) +*) + +(* Lyrics/Notification track. *) + +const + (* RIFF ids: *) + DMUS_FOURCC_LYRICSTRACK_LIST = DWORD(Byte('l') or (Byte('y') shl 8) or (Byte('r') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('l','y','r','t') + {$EXTERNALSYM DMUS_FOURCC_LYRICSTRACK_LIST} + DMUS_FOURCC_LYRICSTRACKEVENTS_LIST = DWORD(Byte('l') or (Byte('y') shl 8) or (Byte('r') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('l','y','r','l') + {$EXTERNALSYM DMUS_FOURCC_LYRICSTRACKEVENTS_LIST} + DMUS_FOURCC_LYRICSTRACKEVENT_LIST = DWORD(Byte('l') or (Byte('y') shl 8) or (Byte('r') shl 16) or (Byte('e') shl 24)); // mmioFOURCC('l','y','r','e') + {$EXTERNALSYM DMUS_FOURCC_LYRICSTRACKEVENT_LIST} + DMUS_FOURCC_LYRICSTRACKEVENTHEADER_CHUNK = DWORD(Byte('l') or (Byte('y') shl 8) or (Byte('r') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('l','y','r','h') + {$EXTERNALSYM DMUS_FOURCC_LYRICSTRACKEVENTHEADER_CHUNK} + DMUS_FOURCC_LYRICSTRACKEVENTTEXT_CHUNK = DWORD(Byte('l') or (Byte('y') shl 8) or (Byte('r') shl 16) or (Byte('n') shl 24)); // mmioFOURCC('l','y','r','n') + {$EXTERNALSYM DMUS_FOURCC_LYRICSTRACKEVENTTEXT_CHUNK} + +type + PDMusIoLyricsTrackEventHeader = ^TDMusIoLyricStrackEventHeader; + _DMUS_IO_LYRICSTRACK_EVENTHEADER = packed record + dwFlags: DWORD; (* Reserved leave as 0. *) + dwTimingFlags: DWORD; (* Combination DMUS_PMSGF_TOOL_* flags. Determines the precise timing of when the notification happens. Invalid with the flag DMUS_PMSGF_REFTIME, DMUS_PMSGF_MUSICTIME, DMUS_PMSGF_TOOL_FLUSH, or DMUS_PMSGF_LOCKTOREFTIME. *) + lTimeLogical: TMusicTime; (* Position in track list. Time in the music with which the event is associated. *) + lTimePhysical: TMusicTime; (* Precise time event will be triggered. Should be close to logical time. *) + end; + {$EXTERNALSYM _DMUS_IO_LYRICSTRACK_EVENTHEADER} + DMUS_IO_LYRICSTRACK_EVENTHEADER = _DMUS_IO_LYRICSTRACK_EVENTHEADER; + {$EXTERNALSYM DMUS_IO_LYRICSTRACK_EVENTHEADER} + TDMusIoLyricsTrackEventHeader = _DMUS_IO_LYRICSTRACK_EVENTHEADER; + +(* + // Lyrics/Notification Track + + // + LIST + ( + // List of notification events + ) + + // + LIST + ( + ... // Array of event descriptions + ) + + // + LIST + ( + // Event header chunk + // Notification text + ) + + 'lyrh' + ( + + ) + + 'lyrn' + ( + // Name, stored as NULL terminated string of WCHARs + ) +*) + +(* Parameter control track *) + +const + (* RIFF ids: *) + DMUS_FOURCC_PARAMCONTROLTRACK_TRACK_LIST = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('m') shl 16) or (Byte('t') shl 24)); // mmioFOURCC('p','r','m','t') + {$EXTERNALSYM DMUS_FOURCC_PARAMCONTROLTRACK_TRACK_LIST} + DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_LIST = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('o') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('p','r','o','l') + {$EXTERNALSYM DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_LIST} + DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_CHUNK = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('o') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('p','r','o','h') + {$EXTERNALSYM DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_CHUNK} + DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_LIST = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('p') shl 16) or (Byte('l') shl 24)); // mmioFOURCC('p','r','p','l') + {$EXTERNALSYM DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_LIST} + DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_CHUNK = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('p') shl 16) or (Byte('h') shl 24)); // mmioFOURCC('p','r','p','h') + {$EXTERNALSYM DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_CHUNK} + DMUS_FOURCC_PARAMCONTROLTRACK_CURVES_CHUNK = DWORD(Byte('p') or (Byte('r') shl 8) or (Byte('c') shl 16) or (Byte('c') shl 24)); // mmioFOURCC('p','r','c','c') + {$EXTERNALSYM DMUS_FOURCC_PARAMCONTROLTRACK_CURVES_CHUNK} + +type + PDMusIoParamControlTrackObjectHeader = ^TDMusIoParamControlTrackObjectHeader; + _DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER = packed record + dwFlags: DWORD; (* Reserved. Must be zero. *) + guidTimeFormat: TGUID; (* Time format to set the object to. Must be GUID_TIME_REFERNCE or GUID_TIME_MUSIC from medparam.h. *) + (* Path for finding the object. These fields correspond to the first five parameters of IDirectMusicSegmentState::GetObjectInPath. *) + dwPChannel: DWORD; + dwStage: DWORD; + dwBuffer: DWORD; + guidObject: TGUID; + dwIndex: DWORD; + end; + {$EXTERNALSYM _DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER} + DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER = _DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER; + {$EXTERNALSYM DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER} + TDMusIoParamControlTrackObjectHeader = _DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER; + + PDMusIoParamControlTrackParamHeader = ^TDMusIoParamControlTrackParamHeader; + _DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER = packed record + dwFlags: DWORD; (* Reserved. Must be zero. *) + dwIndex: DWORD; (* Index number of the parameter on the object *) + end; + {$EXTERNALSYM _DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER} + DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER = _DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER; + {$EXTERNALSYM DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER} + TDMusIoParamControlTrackParamHeader = _DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER; + + PDMusIoParamControlTrackCurveInfo = ^TDMusIoParamControlTrackCurveInfo; + _DMUS_IO_PARAMCONTROLTRACK_CURVEINFO = packed record + mtStartTime: TMusicTime; + mtEndTime: TMusicTime; + fltStartValue: Single; + fltEndValue: Single; + dwCurveType: DWORD; (* One of the items from the MP_CURVE_TYPE enum in medparam.h *) + dwFlags: DWORD; (* A combination of the MPF_ENVLP_* constants in medparam.h *) + end; + {$EXTERNALSYM _DMUS_IO_PARAMCONTROLTRACK_CURVEINFO} + DMUS_IO_PARAMCONTROLTRACK_CURVEINFO = _DMUS_IO_PARAMCONTROLTRACK_CURVEINFO; + {$EXTERNALSYM DMUS_IO_PARAMCONTROLTRACK_CURVEINFO} + TDMusIoParamControlTrackCurveInfo = _DMUS_IO_PARAMCONTROLTRACK_CURVEINFO; + +(* + // + LIST + ( + ... // one for each object + ) + + // + LIST + ( + // object header chunk + ... // one for each parameter + ) + + // + proh + ( + + ) + + // + LIST + ( + // parameter header chunk + // chunk containing an array of curves + ) + + // + prph + ( + + ) + + // + prcc + ( + // sizeof DMUS_IO_PARAMCONTROLTRACK_CURVEINFO:DWORD + ... // curves, sorted in order of mtTime + ) +*) + +(* DirectSoundBufferConfig FX Map *) + +const + (* RIFF ids: *) + DMUS_FOURCC_DSBC_FORM = DWORD(Byte('D') or (Byte('S') shl 8) or (Byte('B') shl 16) or (Byte('C') shl 24)); // mmioFOURCC('D','S','B','C') + {$EXTERNALSYM DMUS_FOURCC_DSBC_FORM} + DMUS_FOURCC_DSBD_CHUNK = DWORD(Byte('d') or (Byte('s') shl 8) or (Byte('b') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('d','s','b','d') + {$EXTERNALSYM DMUS_FOURCC_DSBD_CHUNK} + DMUS_FOURCC_BSID_CHUNK = DWORD(Byte('b') or (Byte('s') shl 8) or (Byte('i') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('b','s','i','d') + {$EXTERNALSYM DMUS_FOURCC_BSID_CHUNK} + DMUS_FOURCC_DS3D_CHUNK = DWORD(Byte('d') or (Byte('s') shl 8) or (Byte('3') shl 16) or (Byte('d') shl 24)); // mmioFOURCC('d','s','3','d') + {$EXTERNALSYM DMUS_FOURCC_DS3D_CHUNK} + DMUS_FOURCC_DSBC_LIST = DWORD(Byte('f') or (Byte('x') shl 8) or (Byte('l') shl 16) or (Byte('s') shl 24)); // mmioFOURCC('f','x','l','s') + {$EXTERNALSYM DMUS_FOURCC_DSBC_LIST} + DMUS_FOURCC_DSFX_FORM = DWORD(Byte('D') or (Byte('S') shl 8) or (Byte('F') shl 16) or (Byte('X') shl 24)); // mmioFOURCC('D','S','F','X') + {$EXTERNALSYM DMUS_FOURCC_DSFX_FORM} + DMUS_FOURCC_DSFX_CHUNK = DWORD(Byte('f') or (Byte('x') shl 8) or (Byte('h') shl 16) or (Byte('r') shl 24)); // mmioFOURCC('f','x','h','r') + {$EXTERNALSYM DMUS_FOURCC_DSFX_CHUNK} + DMUS_FOURCC_DSFX_DATA = DWORD(Byte('d') or (Byte('a') shl 8) or (Byte('t') shl 16) or (Byte('a') shl 24)); // mmioFOURCC('d','a','t','a') + {$EXTERNALSYM DMUS_FOURCC_DSFX_DATA} + +(* io structures *) + +type + PDSoundIoDSBufferDesc = ^TDSoundIoDSBufferDesc; + _DSOUND_IO_DSBUFFERDESC = packed record + dwFlags: DWORD; (* DirectSound buffer creation flags *) + nChannels: Word; (* No. of channels (rest of buffer format is determined by owning sink) *) + lVolume: Longint; (* Initial pan; only used if CTRLVOLUME is specified *) + lPan: Longint; (* Initial pan; only used if CTRLPAN is specified *) + dwReserved: DWORD; (* Reserved - must be 0 *) + end; + {$EXTERNALSYM _DSOUND_IO_DSBUFFERDESC} + DSOUND_IO_DSBUFFERDESC = _DSOUND_IO_DSBUFFERDESC; + {$EXTERNALSYM DSOUND_IO_DSBUFFERDESC} + TDSoundIoDSBufferDesc = _DSOUND_IO_DSBUFFERDESC; + + PDSoundIoDSBusID = ^TDSoundIoDSBusID; + _DSOUND_IO_DSBUSID = packed record + busid: array[0..0] of DWORD; (* Array size determined from chunk size *) + end; + {$EXTERNALSYM _DSOUND_IO_DSBUSID} + DSOUND_IO_DSBUSID = _DSOUND_IO_DSBUSID; + {$EXTERNALSYM DSOUND_IO_DSBUSID} + TDSoundIoDSBusID = _DSOUND_IO_DSBUSID; + + PDSoundIo3D = ^TDSoundIo3D; + _DSOUND_IO_3D = packed record + guid3DAlgorithm: TGUID; (* GUID identifying the 3D algorithm to use (defined in dsound.h) *) + ds3d: DS3DBUFFER; (* Initial 3D parameters *) + end; + {$EXTERNALSYM _DSOUND_IO_3D} + DSOUND_IO_3D = _DSOUND_IO_3D; + {$EXTERNALSYM DSOUND_IO_3D} + TDSoundIo3D = _DSOUND_IO_3D; + + PDSoundIoDXDMOHeader = ^TDSoundIoDXDMOHeader; + _DSOUND_IO_DXDMO_HEADER = packed record + dwEffectFlags: DWORD; (* Effect creation flags - equivalent to DSEFFECTDESC::dwFlags *) + guidDSFXClass: TGUID; (* GUID identifying the effect to use - corresponds to a COM CLSID *) + guidReserved: TGUID; (* Reserved - must be the null GUID *) + guidSendBuffer: TGUID; (* GUID identifying the buffer to send to if this is a send effect *) + dwReserved: DWORD; (* Reserved - must be 0 *) + end; + {$EXTERNALSYM _DSOUND_IO_DXDMO_HEADER} + DSOUND_IO_DXDMO_HEADER = _DSOUND_IO_DXDMO_HEADER; + {$EXTERNALSYM DSOUND_IO_DXDMO_HEADER} + TDSoundIoDXDMOHeader = _DSOUND_IO_DXDMO_HEADER; + + PDSoundIoDXDMOData = ^TDSoundIoDXDMOData; + _DSOUND_IO_DXDMO_DATA= packed record + data: array[0..0] of DWORD; (* Array size determined by the DMO involved *) + end; + {$EXTERNALSYM _DSOUND_IO_DXDMO_DATA} + DSOUND_IO_DXDMO_DATA = _DSOUND_IO_DXDMO_DATA; + {$EXTERNALSYM DSOUND_IO_DXDMO_DATA} + TDSoundIoDXDMOData = _DSOUND_IO_DXDMO_DATA; + +(* +RIFF +( + 'DSBC' // DirectSoundBufferConfig chunk + [] // GUID identifier for this DirectSoundBufferConfig + [] // Optional version info + [] // Name, author, copyright info., comments + // DirectSound Buffer descriptor chunk + [] // Optional bus id array + [] // Optional 3d Parameters + [] // Optional list of FX descriptors +) + + // + 'guid' + ( + + ) + + // + 'vers' + ( + + ) + + // + 'dsbd' + ( + // Creation parameters and initial settings for the buffer + ) + + // + 'bsid' + ( + // The size of DSOUND_IO_DSBUSID is determined by the chunk size + ) + + // + 'ds3d' + ( + // Initial 3D buffer parameters: position, etc. + ) + + // + LIST + ( + 'fxls' // Array of DMO creation parameter blocks + ... // Each DMO is encapsulated in a RIFF chunk + ) + +// // DMOs can be embedded in a buffer configuration or stored as separate files +RIFF +( + 'DSFX' + // FX header chunk + [] // FX initial settings chunk +) + + // + 'fxhr' + ( + + ) + + // + 'data' + ( + // Opaque data block used by the DMO to load itself. + // For our standard included DMOs, this is simply the structure accepted by + // the DMO's SetAllParameters() method - e.g. struct DSFXChorus for Chorus. + ) +*) + + + +(*************************************************************************** +* * +* DMusBuff.h -- This module defines the buffer format for DirectMusic * +* Shared file between user mode and kernel mode components * +* * +* Copyright (c) 1998, Microsoft Corp. All rights reserved. * +* * +***************************************************************************) + +(* Format of DirectMusic events in a buffer + * + * A buffer contains 1 or more events, each with the following header. + * Immediately following the header is the event data. The header+data + * size is rounded to the nearest quadword (8 bytes). + *) + +type + PDMusEventHeader = ^TDMusEventHeader; + _DMUS_EVENTHEADER = packed record + cbEvent: DWORD; (* Unrounded bytes in event *) + dwChannelGroup: DWORD; (* Channel group of event *) + rtDelta: TReferenceTime; (* Delta from start time of entire buffer *) + dwFlags: DWORD; (* Flags DMUS_EVENT_xxx *) + end; + {$EXTERNALSYM _DMUS_EVENTHEADER} + DMUS_EVENTHEADER = _DMUS_EVENTHEADER; + {$EXTERNALSYM DMUS_EVENTHEADER} + TDMusEventHeader = _DMUS_EVENTHEADER; + +const + DMUS_EVENT_STRUCTURED = $00000001; (* Unstructured data (SysEx, etc.) *) + {$EXTERNALSYM DMUS_EVENT_STRUCTURED} + +(* The number of bytes to allocate for an event with 'cb' data bytes. + *) +// #define QWORD_ALIGN(x) (((x) + 7) & ~7) +function QWORD_ALIGN(x: DWORD): DWORD; +{$EXTERNALSYM QWORD_ALIGN} +// #define DMUS_EVENT_SIZE(cb) QWORD_ALIGN(sizeof(DMUS_EVENTHEADER) + cb) +function DMUS_EVENT_SIZE(cb: DWORD): DWORD; +{$EXTERNALSYM DMUS_EVENT_SIZE} + + +(************************************************************************ +* * +* dmplugin.h -- This module contains the API for plugins for the * +* DirectMusic performance layer * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************) +// Translator: only part of this header located below, other definitions +// can be found above + +const + // Registry location for tools + DMUS_REGSTR_PATH_TOOLS = 'Software\Microsoft\DirectMusic\Tools'; + {$EXTERNALSYM DMUS_REGSTR_PATH_TOOLS} + +(*//////////////////////////////////////////////////////////////////// +// IDirectMusicTool8 *) + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicTool8);'} + {$EXTERNALSYM IDirectMusicTool8} + IDirectMusicTool8 = interface(IDirectMusicTool) + (* IDirectMusicTool8 *) + ['{0e674303-3b05-11d3-9bd1-f9e7f0a01536}'] + function Clone(out ppTool: IDirectMusicTool): HResult; stdcall; + end; + + +(* The following flags are sent in the IDirectMusicTrack.Play() method *) +(* inside the dwFlags parameter *) +type + enumDMUS_TRACKF_FLAGS = DWORD; + DMUS_TRACKF_FLAGS = enumDMUS_TRACKF_FLAGS; + {$EXTERNALSYM DMUS_TRACKF_FLAGS} + TDMusTrackfFlags = DMUS_TRACKF_FLAGS; + PDMusTrackfFlags = ^TDMusTrackfFlags; +const + DMUS_TRACKF_SEEK = 1; (* set on a seek *) + {$EXTERNALSYM DMUS_TRACKF_SEEK} + DMUS_TRACKF_LOOP = 2; (* set on a loop (repeat) *) + {$EXTERNALSYM DMUS_TRACKF_LOOP} + DMUS_TRACKF_START = 4; (* set on first call to Play *) + {$EXTERNALSYM DMUS_TRACKF_START} + DMUS_TRACKF_FLUSH = 8; (* set when this call is in response to a flush on the perfomance *) + {$EXTERNALSYM DMUS_TRACKF_FLUSH} + DMUS_TRACKF_DIRTY = $10; (* set when the track should consider any cached values from a previous call to GetParam to be invalidated *) + {$EXTERNALSYM DMUS_TRACKF_DIRTY} + // The following flags are DX8 only. + DMUS_TRACKF_NOTIFY_OFF = $20; (* tells track not to send notifications. *) + {$EXTERNALSYM DMUS_TRACKF_NOTIFY_OFF} + DMUS_TRACKF_PLAY_OFF = $40; (* tells track not to play anything (but can still send notifications.) *) + {$EXTERNALSYM DMUS_TRACKF_PLAY_OFF} + DMUS_TRACKF_LOOPEND = $80; (* set when the end of range is also a loop end. *) + {$EXTERNALSYM DMUS_TRACKF_LOOPEND} + DMUS_TRACKF_STOP = $100; (* set when the end of range is also end of playing this segment. *) + {$EXTERNALSYM DMUS_TRACKF_STOP} + DMUS_TRACKF_RECOMPOSE = $200; (* set to indicate the track should compose. *) + {$EXTERNALSYM DMUS_TRACKF_RECOMPOSE} + DMUS_TRACKF_CLOCK = $400; (* set when time parameters are in reference (clock) time. Only valid for PlayEx(). *) + {$EXTERNALSYM DMUS_TRACKF_CLOCK} + + (* The following flags are sent in the IDirectMusicTrack8::GetParamEx() and SetParamEx() methods *) + (* inside the dwFlags parameter *) + DMUS_TRACK_PARAMF_CLOCK = $01; (* set when the time is measured is in reference (clock) time *) + {$EXTERNALSYM DMUS_TRACK_PARAMF_CLOCK} + + +(*)/////////////////////////////////////////////////////////////////// +// IDirectMusicTrack8 *) + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectMusicTrack8);'} + {$EXTERNALSYM IDirectMusicTrack8} + IDirectMusicTrack8 = interface(IDirectMusicTrack) + (* IDirectMusicTrack8 *) + ['{0e674304-3b05-11d3-9bd1-f9e7f0a01536}'] + function PlayEx(pStateData: Pointer; rtStart, rtEnd, rtOffset: TReferenceTime; + dwFlags: DWORD; pPerf: IDirectMusicPerformance; + pSegSt: IDirectMusicSegmentState; dwVirtualID: DWORD): HResult; stdcall; + function GetParamEx(const rguidType: TGUID; rtTime: TReferenceTime; + out prtNext: TReferenceTime; pParam, pStateData: pointer; dwFlags: DWORD): HResult; stdcall; + function SetParamEx(const rguidType: TGUID; rtTime: TReferenceTime; + pParam, pStateData: pointer; dwFlags: DWORD): HResult; stdcall; + function Compose(pContext: IUnknown; dwTrackGroup: DWORD; + out ppResultTrack: IDirectMusicTrack): HResult; stdcall; + function Join(pNewTrack: IDirectMusicTrack; mtJoin: TMusicTime; + pContext: IUnknown; dwTrackGroup: DWORD; + out ppResultTrack: IDirectMusicTrack): HResult; stdcall; + end; + +const + (* CLSID's *) + CLSID_DirectMusicTempoTrack : TGUID = '{d2ac2885-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicTempoTrack} + CLSID_DirectMusicSeqTrack : TGUID = '{d2ac2886-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicSeqTrack} + CLSID_DirectMusicSysExTrack : TGUID = '{d2ac2887-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicSysExTrack} + CLSID_DirectMusicTimeSigTrack : TGUID = '{d2ac2888-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicTimeSigTrack} + CLSID_DirectMusicChordTrack : TGUID = '{d2ac288b-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicChordTrack} + CLSID_DirectMusicCommandTrack : TGUID = '{d2ac288c-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicCommandTrack} + CLSID_DirectMusicStyleTrack : TGUID = '{d2ac288d-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicStyleTrack} + CLSID_DirectMusicMotifTrack : TGUID = '{d2ac288e-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicMotifTrack} + CLSID_DirectMusicSignPostTrack : TGUID = '{f17e8672-c3b4-11d1-870b-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicSignPostTrack} + CLSID_DirectMusicBandTrack : TGUID = '{d2ac2894-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicBandTrack} + CLSID_DirectMusicChordMapTrack : TGUID = '{d2ac2896-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicChordMapTrack} + CLSID_DirectMusicMuteTrack : TGUID = '{d2ac2898-b39b-11d1-8704-00600893b1bd}'; + {$EXTERNALSYM CLSID_DirectMusicMuteTrack} + + (* New CLSID's for DX8 *) + CLSID_DirectMusicScriptTrack: TGUID = '{4108fa85-3586-11d3-8bd7-00600893b1b6}'; (* {4108FA85-3586-11d3-8BD7-00600893B1B6} *) + {$EXTERNALSYM CLSID_DirectMusicScriptTrack} + CLSID_DirectMusicMarkerTrack: TGUID = '{55a8fd00-4288-11d3-9bd1-8a0d61c88835}'; + {$EXTERNALSYM CLSID_DirectMusicMarkerTrack} + CLSID_DirectMusicSegmentTriggerTrack: TGUID = '{bae4d665-4ea1-11d3-8bda-00600893b1b6}'; (* {BAE4D665-4EA1-11d3-8BDA-00600893B1B6} *) + {$EXTERNALSYM CLSID_DirectMusicSegmentTriggerTrack} + CLSID_DirectMusicLyricsTrack: TGUID = '{995c1cf5-54ff-11d3-8bda-00600893b1b6}'; (* {995C1CF5-54FF-11d3-8BDA-00600893B1B6} *) + {$EXTERNALSYM CLSID_DirectMusicLyricsTrack} + CLSID_DirectMusicParamControlTrack: TGUID = '{4be0537b-5c19-11d3-8bdc-00600893b1b6}'; (* {4BE0537B-5C19-11d3-8BDC-00600893B1B6} *) + {$EXTERNALSYM CLSID_DirectMusicParamControlTrack} + CLSID_DirectMusicWaveTrack: TGUID = '{eed36461-9ea5-11d3-9bd1-0080c7150a74}'; + {$EXTERNALSYM CLSID_DirectMusicWaveTrack} + +type + (* IID's *) + IID_IDirectMusicTrack = IDirectMusicTrack; + {$EXTERNALSYM IID_IDirectMusicTrack} + IID_IDirectMusicTool = IDirectMusicTool; + {$EXTERNALSYM IID_IDirectMusicTool} + + // Interface IDs for DX8 + // changed interfaces (GUID only) + IID_IDirectMusicTool8 = IDirectMusicTool8; + {$EXTERNALSYM IID_IDirectMusicTool8} + IID_IDirectMusicTrack8 = IDirectMusicTrack8; + {$EXTERNALSYM IID_IDirectMusicTrack8} + + +// Translator: Types below are declared to compatibility with previous - +// non borland compliant - conversions of DirectMusic. +type + PDMus_Downloadinfo = PDMusDownloadInfo; + TDMus_Downloadinfo = TDMusDownloadInfo; + PDMus_Offsettable = PDMusOffsetTable; + TDMus_Offsettable = TDMusOffsetTable; + PDMus_Instrument = PDMusInstrument; + TDMus_Instrument = TDMusInstrument; + PDMus_Region = PDMusRegion; + TDMus_Region = TDMusRegion; + PDMus_Lfoparams = PDMusLFOParams; + TDMus_Lfoparams = TDMusLFOParams; + PDMus_Vegparams = PDMusVEGParams; + TDMus_Vegparams = TDMusVEGParams; + PDMus_Pegparams = PDMusPEGParams; + TDMus_Pegparams = TDMusPEGParams; + PDMus_Mscparams = PDMusMSCParams; + TDMus_Mscparams = TDMusMSCParams; + PDMus_Articparams = PDMusArticParams; + TDMus_Articparams = TDMusArticParams; + PDMus_Articulation = PDMusArticulation; + TDMus_Articulation = TDMusArticulation; + PDMus_Articulation2 = PDMusArticulation2; + TDMus_Articulation2 = TDMusArticulation2; + PDMus_Extensionchunk = PDMusExtensionChunk; + TDMus_Extensionchunk = TDMusExtensionChunk; + PDMus_Copyright = PDMusCopyright; + TDMus_Copyright = TDMusCopyright; + PDMus_Wavedata = PDMusWaveData; + TDMus_Wavedata = TDMusWaveData; + PDMus_Wave = PDMusWave; + TDMus_Wave = TDMusWave; + PDMus_Noterange = PDMusNoteRange; + TDMus_Noterange = TDMusNoteRange; + PDMus_Waveartdl = PDMusWaveArtDL; + TDMus_Waveartdl = TDMusWaveArtDL; + PDMus_Wavedl = PDMusWaveDL; + TDMus_Wavedl = TDMusWaveDL; + PDMus_Bufferdesc = PDMusBufferDesc; + TDMus_Bufferdesc = TDMusBufferDesc; + PDMus_Portcaps = PDMusPortCaps; + TDMus_Portcaps = TDMusPortCaps; + PDMus_Portparams = PDMusPortParams; + TDMus_Portparams = TDMusPortParams; + PDMus_Portparams8 = PDMusPortParams8; + TDMus_Portparams8 = TDMusPortParams8; + PDMus_Synthstats = PDMusSynthStats; + TDMus_Synthstats = TDMusSynthStats; + PDMus_Synthstats8 = PDMusSynthStats8; + TDMus_Synthstats8 = TDMusSynthStats8; + PDMus_Waves_Reverb_Params = PDMusWavesReverbParams; + TDMus_Waves_Reverb_Params = TDMusWavesReverbParams; + PDMus_Clockinfo7 = PDMusClockInfo7; + TDMus_Clockinfo7 = TDMusClockInfo7; + PDMus_Clockinfo8 = PDMusClockInfo8; + TDMus_Clockinfo8 = TDMusClockInfo8; + PDMus_Audioparams = PDMusAudioParams; + TDMus_Audioparams = TDMusAudioParams; + PDMus_Subchord = PDMusSubChord; + TDMus_Subchord = TDMusSubChord; + PDMus_Chord_Key = PDMusChordKey; + TDMus_Chord_Key = TDMusChordKey; + PDMus_Version = PDMusVersion; + TDMus_Version = TDMusVersion; + PDMus_Timesignature = PDMusTimeSignature; + TDMus_Timesignature = TDMusTimeSignature; + PDMus_Valid_Start_Param = PDMusValidStartParam; + TDMus_Valid_Start_Param = TDMusValidStartParam; + PDMus_Play_Marker_Param = PDMusPlayMarkerParam; + TDMus_Play_Marker_Param = TDMusPlayMarkerParam; + PDMus_Objectdesc = PDMusObjectDesc; + TDMus_Objectdesc = TDMusObjectDesc; + PDMus_Script_Errorinfo = PDMusScriptErrorInfo; + TDMus_Script_Errorinfo = TDMusScriptErrorInfo; + PDMus_Command_Param = PDMusCommandParam; + TDMus_Command_Param = TDMusCommandParam; + PDMus_Command_Param_2 = PDMusCommandParam2; + TDMus_Command_Param_2 = TDMusCommandParam2; + PDMus_Pmsg = PDMusPMsg; + TDMus_Pmsg = TDMusPMsg; + PDMus_Note_Pmsg = PDMusNotePMsg; + TDMus_Note_Pmsg = TDMusNotePMsg; + PDMus_Midi_Pmsg = PDMusMidiPMsg; + TDMus_Midi_Pmsg = TDMusMidiPMsg; + PDMus_Patch_Pmsg = PDMusPatchPMsg; + TDMus_Patch_Pmsg = TDMusPatchPMsg; + PDMus_Transpose_Pmsg = PDMusTransposePMsg; + TDMus_Transpose_Pmsg = TDMusTransposePMsg; + PDMus_Channel_Priority_Pmsg = PDMusChannelPriorityPMsg; + TDMus_Channel_Priority_Pmsg = TDMusChannelPriorityPMsg; + PDMus_Tempo_Pmsg = PDMusTempoPMsg; + TDMus_Tempo_Pmsg = TDMusTempoPMsg; + PDMus_Sysex_Pmsg = PDMusSysexPMsg; + TDMus_Sysex_Pmsg = TDMusSysexPMsg; + PDMus_Curve_Pmsg = PDMusCurvePMsg; + TDMus_Curve_Pmsg = TDMusCurvePMsg; + PDMus_Timesig_Pmsg = PDMusTimeSigPMsg; + TDMus_Timesig_Pmsg = TDMusTimeSigPMsg; + PDMus_Notification_Pmsg = PDMusNotificationPMsg; + TDMus_Notification_Pmsg = TDMusNotificationPMsg; + PDMus_Wave_Pmsg = PDMusWavePMsg; + TDMus_Wave_Pmsg = TDMusWavePMsg; + PDMus_Lyric_Pmsg = PDMusLyricPMsg; + TDMus_Lyric_Pmsg = TDMusLyricPMsg; + PDMus_Band_Param = PDMusBandParam; + TDMus_Band_Param = TDMusBandParam; + PDMus_Variations_Param = PDMusVariationsParam; + TDMus_Variations_Param = TDMusVariationsParam; + PDMus_Io_Seq_Item = PDMusIoSeqItem; + TDMus_Io_Seq_Item = TDMusIoSeqItem; + PDMus_Io_Curve_Item = PDMusIoCurveItem; + TDMus_Io_Curve_Item = TDMusIoCurveItem; + PDMus_Io_Tempo_Item = PDMusIoTempoItem; + TDMus_Io_Tempo_Item = TDMusIoTempoItem; + PDMus_Io_Sysex_Item = PDMusIoSysexItem; + TDMus_Io_Sysex_Item = TDMusIoSysexItem; + PDMus_Rhythm_Param = PDMusRhythmParam; + TDMus_Rhythm_Param = TDMusRhythmParam; + PDMus_Tempo_Param = PDMusTempoParam; + TDMus_Tempo_Param = TDMusTempoParam; + PDMus_Mute_Param = PDMusMuteParam; + TDMus_Mute_Param = TDMusMuteParam; + PDMus_Io_Timesig = PDMusIoTimesig; + TDMus_Io_Timesig = TDMusIoTimesig; + PDMus_Io_Style = PDMusIoStyle; + TDMus_Io_Style = TDMusIoStyle; + PDMus_Io_Version = PDMusIoVersion; + TDMus_Io_Version = TDMusIoVersion; + PDMus_Io_Pattern = PDMusIoPattern; + TDMus_Io_Pattern = TDMusIoPattern; + PDMus_Io_Stylepart = PDMusIoStylepart; + TDMus_Io_Stylepart = TDMusIoStylepart; + PDMus_Io_Partref = PDMusIoPartref; + TDMus_Io_Partref = TDMusIoPartref; + PDMus_Io_Stylenote = PDMusIoStyleNote; + TDMus_Io_Stylenote = TDMusIoStyleNote; + PDMus_Io_Stylecurve = PDMusIoStyleCurve; + TDMus_Io_Stylecurve = TDMusIoStyleCurve; + PDMus_Io_Stylemarker = PDMusIoStyleMarker; + TDMus_Io_Stylemarker = TDMusIoStyleMarker; + PDMus_Io_Styleresolution = PDMusIoStyleResolution; + TDMus_Io_Styleresolution = TDMusIoStyleResolution; + PDMus_Io_Style_Anticipation = PDMusIoStyleAnticipation; + TDMus_Io_Style_Anticipation = TDMusIoStyleAnticipation; + PDMus_Io_Motifsettings = PDMusIoMotifSettings; + TDMus_Io_Motifsettings = TDMusIoMotifSettings; + PDMus_Io_Chord = PDMusIoChord; + TDMus_Io_Chord = TDMusIoChord; + PDMus_Io_Subchord = PDMusIoSubChord; + TDMus_Io_Subchord = TDMusIoSubChord; + PDMus_Io_Command = PDMusIoCommand; + TDMus_Io_Command = TDMusIoCommand; + PDMus_Io_Tool_Header = PDMusIoToolHeader; + TDMus_Io_Tool_Header = TDMusIoToolHeader; + PDMus_Io_Portconfig_Header = PDMusIoPortconfigHeader; + TDMus_Io_Portconfig_Header = TDMusIoPortconfigHeader; + PDMus_Io_Pchanneltobuffer_Header = PDMusIoPchanneltobufferHeader; + TDMus_Io_Pchanneltobuffer_Header = TDMusIoPchanneltobufferHeader; + PDMus_Io_Buffer_Attributes_Header = PDMusIoBufferAttributesHeader; + TDMus_Io_Buffer_Attributes_Header = TDMusIoBufferAttributesHeader; + PDMus_Io_Band_Track_Header = PDMusIoBandTrackHeader; + TDMus_Io_Band_Track_Header = TDMusIoBandTrackHeader; + PDMus_Io_Band_Item_Header = PDMusIoBandItemHeader; + TDMus_Io_Band_Item_Header = TDMusIoBandItemHeader; + PDMus_Io_Band_Item_Header2 = PDMusIoBandItemHeader2; + TDMus_Io_Band_Item_Header2 = TDMusIoBandItemHeader2; + PDMus_Io_Instrument = PDMusIoInstrument; + TDMus_Io_Instrument = TDMusIoInstrument; + PDMus_Io_Wave_Header = PDMusIoWaveHeader; + TDMus_Io_Wave_Header = TDMusIoWaveHeader; + PDMus_Io_Wave_Track_Header = PDMusIoWaveTrackHeader; + TDMus_Io_Wave_Track_Header = TDMusIoWaveTrackHeader; + PDMus_Io_Wave_Part_Header = PDMusIoWavePartHeader; + TDMus_Io_Wave_Part_Header = TDMusIoWavePartHeader; + PDMus_Io_Wave_Item_Header = PDMusIoWaveItemHeader; + TDMus_Io_Wave_Item_Header = TDMusIoWaveItemHeader; + PDMus_Io_Container_Header = PDMusIoContainerHeader; + TDMus_Io_Container_Header = TDMusIoContainerHeader; + PDMus_Io_Contained_Object_Header = PDMusIoContainedObjectHeader; + TDMus_Io_Contained_Object_Header = TDMusIoContainedObjectHeader; + PDMus_Io_Segment_Header = PDMusIoSegmentHeader; + TDMus_Io_Segment_Header = TDMusIoSegmentHeader; + PDMus_Io_Track_Header = PDMusIoTrackHeader; + TDMus_Io_Track_Header = TDMusIoTrackHeader; + PDMus_Io_Track_Extras_Header = PDMusIoTrackExtrasHeader; + TDMus_Io_Track_Extras_Header = TDMusIoTrackExtrasHeader; + PDMus_Io_Reference = PDMusIoReference; + TDMus_Io_Reference = TDMusIoReference; + PDMus_Io_Chordmap = PDMusIoChordmap; + TDMus_Io_Chordmap = TDMusIoChordmap; + PDMus_Io_Chordmap_Subchord = PDMusIoChordmapSubChord; + TDMus_Io_Chordmap_Subchord = TDMusIoChordmapSubChord; + PDMus_Io_Chordentry = PDMusIoChordEntry; + TDMus_Io_Chordentry = TDMusIoChordEntry; + PDMus_Io_Nextchord = PDMusIoNextChord; + TDMus_Io_Nextchord = TDMusIoNextChord; + PDMus_Io_Chordmap_Signpost = PDMusIoChordMapSignPost; + TDMus_Io_Chordmap_Signpost = TDMusIoChordMapSignPost; + PDMus_Io_Script_Header = PDMusIoScriptHeader; + TDMus_Io_Script_Header = TDMusIoScriptHeader; + PDMus_Io_Signpost = PDMusIoSignPost; + TDMus_Io_Signpost = TDMusIoSignPost; + PDMus_Io_Mute = PDMusIoMute; + TDMus_Io_Mute = TDMusIoMute; + PDMus_Io_Timesignature_Item = PDMusIoTimesignatureItem; + TDMus_Io_Timesignature_Item = TDMusIoTimesignatureItem; + PDMus_Io_Valid_Start = PDMusIoValidStart; + TDMus_Io_Valid_Start = TDMusIoValidStart; + PDMus_Io_Play_Marker = PDMusIoPlayMarker; + TDMus_Io_Play_Marker = TDMusIoPlayMarker; + PDMus_Io_Segment_Track_Header = PDMusIoSegmentTrackHeader; + TDMus_Io_Segment_Track_Header = TDMusIoSegmentTrackHeader; + PDMus_Io_Segment_Item_Header = PDMusIoSegmentItemHeader; + TDMus_Io_Segment_Item_Header = TDMusIoSegmentItemHeader; + PDMus_Io_Scripttrack_Eventheader = PDMusIoScriptTrackEventHeader; + TDMus_Io_Scripttrack_Eventheader = TDMusIoScriptTrackEventHeader; + PDMus_Io_Lyricstrack_Eventheader = PDMusIoLyricsTrackEventHeader; + TDMus_Io_Lyricstrack_Eventheader = TDMusIoLyricsTrackEventHeader; + PDMus_Io_Paramcontroltrack_Objectheader = PDMusIoParamControlTrackObjectHeader; + TDMus_Io_Paramcontroltrack_Objectheader = TDMusIoParamControlTrackObjectHeader; + PDMus_Io_Paramcontroltrack_Paramheader = PDMusIoParamControlTrackParamHeader; + TDMus_Io_Paramcontroltrack_Paramheader = TDMusIoParamControlTrackParamHeader; + PDMus_Io_Paramcontroltrack_Curveinfo = PDMusIoParamControlTrackCurveInfo; + TDMus_Io_Paramcontroltrack_Curveinfo = TDMusIoParamControlTrackCurveInfo; + PDMus_Eventheader = PDMusEventHeader; + TDMus_Eventheader = TDMusEventHeader; + PDSound_Io_Dsbufferdesc = PDSoundIoDSBufferDesc; + TDSound_Io_Dsbufferdesc = TDSoundIoDSBufferDesc; + PDSound_Io_Dsbusid = PDSoundIoDSBusID; + TDSound_Io_Dsbusid = TDSoundIoDSBusID; + PDSound_Io_3d = PDSoundIo3D; + TDSound_Io_3d = TDSoundIo3D; + PDSound_Io_Dxdmo_Header = PDSoundIoDXDMOHeader; + TDSound_Io_Dxdmo_Header = TDSoundIoDXDMOHeader; + PDSound_Io_Dxdmo_Data = PDSoundIoDXDMOData; + TDSound_Io_Dxdmo_Data = TDSoundIoDXDMOData; + + + +implementation + +// #define MAKE_DMHRESULTSUCCESS(code) MAKE_HRESULT(0, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code))) +function MAKE_DMHRESULTSUCCESS(Code: DWord): DWord; +begin + Result:= (0 shl 31) or (FACILITY_DIRECTMUSIC shl 16) or (DMUS_ERRBASE + Code); +end; + +// #define MAKE_DMHRESULTERROR(code) MAKE_HRESULT(1, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code))) +function MAKE_DMHRESULTERROR(Code: DWord): DWord; +begin + Result:= DWORD((1 shl 31) or (FACILITY_DIRECTMUSIC shl 16)) or (DMUS_ERRBASE + Code); +end; + +// #define DSBUSID_IS_SPKR_LOC(id) ( ((id) >= DSBUSID_FIRST_SPKR_LOC) && ((id) <= DSBUSID_LAST_SPKR_LOC) ) +function DSBUSID_IS_SPKR_LOC(id: Integer): Boolean; +begin + Result := (id >= DSBUSID_FIRST_SPKR_LOC) and (id <= DSBUSID_LAST_SPKR_LOC); +end; + +function QWORD_ALIGN(x: DWORD): DWORD; +begin + Result := (x + 7) and (not 7); // (((x) + 7) & ~7) +end; + +function DMUS_EVENT_SIZE(cb: DWORD): DWORD; +begin + Result := QWORD_ALIGN(SizeOf(TDMusEventHeader) + cb); // QWORD_ALIGN(sizeof(DMUS_EVENTHEADER) + cb) +end; + +end. diff --git a/Game/Code/lib/DSPack/DirectX9/DirectPlay8.pas b/Game/Code/lib/DSPack/DirectX9/DirectPlay8.pas new file mode 100644 index 00000000..7c4aa8bb --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DirectPlay8.pas @@ -0,0 +1,3451 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: dpaddr.h dplobby8.h dplay8.h dvoice.h *} +{* Content: DirectPlay8 include files *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 27-Apr-2003 *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{******************************************************************************} +{ } +{ 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 DirectPlay8; + +interface + +(*$HPPEMIT '#include "dplay8.h"' *) +(*$HPPEMIT '#include "dplobby8.h"' *) +(*$HPPEMIT '#include "dvoice.h"' *) + +uses + Windows, WinSock, DirectSound; + +(*==========================================================================; + * + * Copyright (C) 2000-2002 Microsoft Corporation. All Rights Reserved. + * + * File: dpaddr.h + * Content: DirectPlayAddress include file + ***************************************************************************) + + +const +(**************************************************************************** + * + * DirectPlay8Address CLSIDs + * + ****************************************************************************) + + // {934A9523-A3CA-4bc5-ADA0-D6D95D979421} + CLSID_DirectPlay8Address: TGUID = '{934a9523-a3ca-4bc5-ada0-d6d95d979421}'; + {$EXTERNALSYM CLSID_DirectPlay8Address} + + +(**************************************************************************** + * + * DirectPlay8Address Interface IIDs + * + ****************************************************************************) +type + DPNAREFIID = TGUID; + {$EXTERNALSYM DPNAREFIID} + TDPNARefIID = DPNAREFIID; + + +(**************************************************************************** + * + * DirectPlay8Address Constants + * + ****************************************************************************) +const + // + // Asynchronous operation flags + // + DPNA_DATATYPE_STRING = $00000001; + {$EXTERNALSYM DPNA_DATATYPE_STRING} + DPNA_DATATYPE_DWORD = $00000002; + {$EXTERNALSYM DPNA_DATATYPE_DWORD} + DPNA_DATATYPE_GUID = $00000003; + {$EXTERNALSYM DPNA_DATATYPE_GUID} + DPNA_DATATYPE_BINARY = $00000004; + {$EXTERNALSYM DPNA_DATATYPE_BINARY} + DPNA_DATATYPE_STRING_ANSI = $00000005; + {$EXTERNALSYM DPNA_DATATYPE_STRING_ANSI} + + DPNA_DPNSVR_PORT = 6073; + {$EXTERNALSYM DPNA_DPNSVR_PORT} + + DPNA_INDEX_INVALID = $FFFFFFFF; + {$EXTERNALSYM DPNA_INDEX_INVALID} + +(**************************************************************************** + * + * DirectPlay8Address Address Elements + * + ****************************************************************************) + + DPNA_SEPARATOR_KEYVALUE = WideChar('='); + {$EXTERNALSYM DPNA_SEPARATOR_KEYVALUE} + DPNA_SEPARATOR_USERDATA = WideChar('#'); + {$EXTERNALSYM DPNA_SEPARATOR_USERDATA} + DPNA_SEPARATOR_COMPONENT = WideChar(';'); + {$EXTERNALSYM DPNA_SEPARATOR_COMPONENT} + DPNA_ESCAPECHAR = WideChar('%'); + {$EXTERNALSYM DPNA_ESCAPECHAR} + + // Header + DPNA_HEADER = 'x-directplay:/'; + {$EXTERNALSYM DPNA_HEADER} + + // key names for address components + DPNA_KEY_NAT_RESOLVER = 'natresolver'; + {$EXTERNALSYM DPNA_KEY_NAT_RESOLVER} + DPNA_KEY_NAT_RESOLVER_USER_STRING = 'natresolveruserstring'; + {$EXTERNALSYM DPNA_KEY_NAT_RESOLVER_USER_STRING} + DPNA_KEY_APPLICATION_INSTANCE = 'applicationinstance'; + {$EXTERNALSYM DPNA_KEY_APPLICATION_INSTANCE} + DPNA_KEY_DEVICE = 'device'; + {$EXTERNALSYM DPNA_KEY_DEVICE} + DPNA_KEY_HOSTNAME = 'hostname'; + {$EXTERNALSYM DPNA_KEY_HOSTNAME} + DPNA_KEY_PORT = 'port'; + {$EXTERNALSYM DPNA_KEY_PORT} + DPNA_KEY_NAMEINFO = 'nameinfo'; + {$EXTERNALSYM DPNA_KEY_NAMEINFO} + DPNA_KEY_PROCESSOR = 'processor'; + {$EXTERNALSYM DPNA_KEY_PROCESSOR} + DPNA_KEY_PROGRAM = 'program'; + {$EXTERNALSYM DPNA_KEY_PROGRAM} + DPNA_KEY_PROVIDER = 'provider'; + {$EXTERNALSYM DPNA_KEY_PROVIDER} + DPNA_KEY_SCOPE = 'scope'; + {$EXTERNALSYM DPNA_KEY_SCOPE} + DPNA_KEY_TRAVERSALMODE = 'traversalmode'; + {$EXTERNALSYM DPNA_KEY_TRAVERSALMODE} + DPNA_KEY_BAUD = 'baud'; + {$EXTERNALSYM DPNA_KEY_BAUD} + DPNA_KEY_FLOWCONTROL = 'flowcontrol'; + {$EXTERNALSYM DPNA_KEY_FLOWCONTROL} + DPNA_KEY_PARITY = 'parity'; + {$EXTERNALSYM DPNA_KEY_PARITY} + DPNA_KEY_PHONENUMBER = 'phonenumber'; + {$EXTERNALSYM DPNA_KEY_PHONENUMBER} + DPNA_KEY_STOPBITS = 'stopbits'; + {$EXTERNALSYM DPNA_KEY_STOPBITS} + + // values for baud rate + DPNA_BAUD_RATE_9600 = 9600; + {$EXTERNALSYM DPNA_BAUD_RATE_9600} + DPNA_BAUD_RATE_14400 = 14400; + {$EXTERNALSYM DPNA_BAUD_RATE_14400} + DPNA_BAUD_RATE_19200 = 19200; + {$EXTERNALSYM DPNA_BAUD_RATE_19200} + DPNA_BAUD_RATE_38400 = 38400; + {$EXTERNALSYM DPNA_BAUD_RATE_38400} + DPNA_BAUD_RATE_56000 = 56000; + {$EXTERNALSYM DPNA_BAUD_RATE_56000} + DPNA_BAUD_RATE_57600 = 57600; + {$EXTERNALSYM DPNA_BAUD_RATE_57600} + DPNA_BAUD_RATE_115200 = 115200; + {$EXTERNALSYM DPNA_BAUD_RATE_115200} + + // values for stop bits + DPNA_STOP_BITS_ONE = '1'; + {$EXTERNALSYM DPNA_STOP_BITS_ONE} + DPNA_STOP_BITS_ONE_FIVE = '1.5'; + {$EXTERNALSYM DPNA_STOP_BITS_ONE_FIVE} + DPNA_STOP_BITS_TWO = '2'; + {$EXTERNALSYM DPNA_STOP_BITS_TWO} + + // values for parity + DPNA_PARITY_NONE = 'NONE'; + {$EXTERNALSYM DPNA_PARITY_NONE} + DPNA_PARITY_EVEN = 'EVEN'; + {$EXTERNALSYM DPNA_PARITY_EVEN} + DPNA_PARITY_ODD = 'ODD'; + {$EXTERNALSYM DPNA_PARITY_ODD} + DPNA_PARITY_MARK = 'MARK'; + {$EXTERNALSYM DPNA_PARITY_MARK} + DPNA_PARITY_SPACE = 'SPACE'; + {$EXTERNALSYM DPNA_PARITY_SPACE} + + // values for flow control + DPNA_FLOW_CONTROL_NONE = 'NONE'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_NONE} + DPNA_FLOW_CONTROL_XONXOFF = 'XONXOFF'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_XONXOFF} + DPNA_FLOW_CONTROL_RTS = 'RTS'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_RTS} + DPNA_FLOW_CONTROL_DTR = 'DTR'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_DTR} + DPNA_FLOW_CONTROL_RTSDTR = 'RTSDTR'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_RTSDTR} + // values for traversal mode + DPNA_TRAVERSALMODE_NONE = 0; + {$EXTERNALSYM DPNA_TRAVERSALMODE_NONE} + DPNA_TRAVERSALMODE_PORTREQUIRED = 1; + {$EXTERNALSYM DPNA_TRAVERSALMODE_PORTREQUIRED} + DPNA_TRAVERSALMODE_PORTRECOMMENDED = 2; + {$EXTERNALSYM DPNA_TRAVERSALMODE_PORTRECOMMENDED} + // Shortcut values + // + // These can be used instead of the corresponding CLSID_DP8SP_XXXX guids + // + DPNA_VALUE_TCPIPPROVIDER = 'IP'; + {$EXTERNALSYM DPNA_VALUE_TCPIPPROVIDER} + DPNA_VALUE_IPXPROVIDER = 'IPX'; + {$EXTERNALSYM DPNA_VALUE_IPXPROVIDER} + DPNA_VALUE_MODEMPROVIDER = 'MODEM'; + {$EXTERNALSYM DPNA_VALUE_MODEMPROVIDER} + DPNA_VALUE_SERIALPROVIDER = 'SERIAL'; + {$EXTERNALSYM DPNA_VALUE_SERIALPROVIDER} + +//// ANSI DEFINITIONS + + // Header + DPNA_HEADER_A = 'x-directplay:/'; + {$EXTERNALSYM DPNA_HEADER_A} + DPNA_SEPARATOR_KEYVALUE_A = '='; + {$EXTERNALSYM DPNA_SEPARATOR_KEYVALUE_A} + DPNA_SEPARATOR_USERDATA_A = '#'; + {$EXTERNALSYM DPNA_SEPARATOR_USERDATA_A} + DPNA_SEPARATOR_COMPONENT_A = ';'; + {$EXTERNALSYM DPNA_SEPARATOR_COMPONENT_A} + DPNA_ESCAPECHAR_A = '%'; + {$EXTERNALSYM DPNA_ESCAPECHAR_A} + + // key names for address components + DPNA_KEY_NAT_RESOLVER_A = 'natresolver'; + {$EXTERNALSYM DPNA_KEY_NAT_RESOLVER_A} + DPNA_KEY_NAT_RESOLVER_USER_STRING_A = 'natresolveruserstring'; + {$EXTERNALSYM DPNA_KEY_NAT_RESOLVER_USER_STRING_A} + DPNA_KEY_APPLICATION_INSTANCE_A = 'applicationinstance'; + {$EXTERNALSYM DPNA_KEY_APPLICATION_INSTANCE_A} + DPNA_KEY_DEVICE_A = 'device'; + {$EXTERNALSYM DPNA_KEY_DEVICE_A} + DPNA_KEY_HOSTNAME_A = 'hostname'; + {$EXTERNALSYM DPNA_KEY_HOSTNAME_A} + DPNA_KEY_PORT_A = 'port'; + {$EXTERNALSYM DPNA_KEY_PORT_A} + DPNA_KEY_NAMEINFO_A = 'nameinfo'; + {$EXTERNALSYM DPNA_KEY_NAMEINFO_A} + DPNA_KEY_PROCESSOR_A = 'processor'; + {$EXTERNALSYM DPNA_KEY_PROCESSOR_A} + DPNA_KEY_PROGRAM_A = 'program'; + {$EXTERNALSYM DPNA_KEY_PROGRAM_A} + DPNA_KEY_PROVIDER_A = 'provider'; + {$EXTERNALSYM DPNA_KEY_PROVIDER_A} + DPNA_KEY_SCOPE_A = 'scope'; + {$EXTERNALSYM DPNA_KEY_SCOPE_A} + DPNA_KEY_TRAVERSALMODE_A = 'traversalmode'; + {$EXTERNALSYM DPNA_KEY_TRAVERSALMODE_A} + DPNA_KEY_BAUD_A = 'baud'; + {$EXTERNALSYM DPNA_KEY_BAUD_A} + DPNA_KEY_FLOWCONTROL_A = 'flowcontrol'; + {$EXTERNALSYM DPNA_KEY_FLOWCONTROL_A} + DPNA_KEY_PARITY_A = 'parity'; + {$EXTERNALSYM DPNA_KEY_PARITY_A} + DPNA_KEY_PHONENUMBER_A = 'phonenumber'; + {$EXTERNALSYM DPNA_KEY_PHONENUMBER_A} + DPNA_KEY_STOPBITS_A = 'stopbits'; + {$EXTERNALSYM DPNA_KEY_STOPBITS_A} + + // values for stop bits + DPNA_STOP_BITS_ONE_A = '1'; + {$EXTERNALSYM DPNA_STOP_BITS_ONE_A} + DPNA_STOP_BITS_ONE_FIVE_A = '1.5'; + {$EXTERNALSYM DPNA_STOP_BITS_ONE_FIVE_A} + DPNA_STOP_BITS_TWO_A = '2'; + {$EXTERNALSYM DPNA_STOP_BITS_TWO_A} + + // values for parity + DPNA_PARITY_NONE_A = 'NONE'; + {$EXTERNALSYM DPNA_PARITY_NONE_A} + DPNA_PARITY_EVEN_A = 'EVEN'; + {$EXTERNALSYM DPNA_PARITY_EVEN_A} + DPNA_PARITY_ODD_A = 'ODD'; + {$EXTERNALSYM DPNA_PARITY_ODD_A} + DPNA_PARITY_MARK_A = 'MARK'; + {$EXTERNALSYM DPNA_PARITY_MARK_A} + DPNA_PARITY_SPACE_A = 'SPACE'; + {$EXTERNALSYM DPNA_PARITY_SPACE_A} + + // values for flow control + DPNA_FLOW_CONTROL_NONE_A = 'NONE'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_NONE_A} + DPNA_FLOW_CONTROL_XONXOFF_A = 'XONXOFF'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_XONXOFF_A} + DPNA_FLOW_CONTROL_RTS_A = 'RTS'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_RTS_A} + DPNA_FLOW_CONTROL_DTR_A = 'DTR'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_DTR_A} + DPNA_FLOW_CONTROL_RTSDTR_A = 'RTSDTR'; + {$EXTERNALSYM DPNA_FLOW_CONTROL_RTSDTR_A} + // Shortcut values + // + // These can be used instead of the corresponding CLSID_DP8SP_XXXX guids + // + DPNA_VALUE_TCPIPPROVIDER_A = 'IP'; + {$EXTERNALSYM DPNA_VALUE_TCPIPPROVIDER_A} + DPNA_VALUE_IPXPROVIDER_A = 'IPX'; + {$EXTERNALSYM DPNA_VALUE_IPXPROVIDER_A} + DPNA_VALUE_MODEMPROVIDER_A = 'MODEM'; + {$EXTERNALSYM DPNA_VALUE_MODEMPROVIDER_A} + DPNA_VALUE_SERIALPROVIDER_A = 'SERIAL'; + {$EXTERNALSYM DPNA_VALUE_SERIALPROVIDER_A} + +type +(**************************************************************************** + * + * DirectPlay8Address Forward Declarations For External Types + * + ****************************************************************************) + + SOCKADDR = TSockAddr; + {$EXTERNALSYM SOCKADDR} + +(**************************************************************************** + * + * DirectPlay8Address Functions + * + ****************************************************************************) + + +(* + * + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 address objects. + * + * HRESULT WINAPI DirectPlay8AddressCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + *) + +(**************************************************************************** + * + * DirectPlay8Address Application Interfaces + * + ****************************************************************************) + + // + // COM definition for IDirectPlay8Address Generic Interface + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8Address);'} + {$EXTERNALSYM IDirectPlay8Address} + IDirectPlay8Address = interface(IUnknown) + ['{83783300-4063-4c8a-9db3-82830a7feb31}'] + (*** IDirectPlay8Address methods ***) + function BuildFromURLW(pwszSourceURL: PWideChar): HResult; stdcall; + function BuildFromURLA(pszSourceURL: PAnsiChar): HResult; stdcall; + function Duplicate(out ppdpaNewAddress: IDirectPlay8Address): HResult; stdcall; + function SetEqual(pdpaAddress: IDirectPlay8Address): HResult; stdcall; + function IsEqual(pdpaAddress: IDirectPlay8Address): HResult; stdcall; + function Clear: HResult; stdcall; + function GetURLW(pwszURL: PWideChar; var pdwNumChars: DWORD): HResult; stdcall; + function GetURLA(pszURL: PAnsiChar; var pdwNumChars: DWORD): HResult; stdcall; + function GetSP(out pguidSP: TGUID): HResult; stdcall; + function GetUserData(pvUserData: Pointer; var pdwBufferSize: DWORD): HResult; stdcall; + function SetSP(const pguidSP: TGUID): HResult; stdcall; + function SetUserData(pvUserData: Pointer; dwDataSize: DWORD): HResult; stdcall; + function GetNumComponents(out pdwNumComponents: DWORD): HResult; stdcall; + function GetComponentByName(pwszName: PWideChar; pvBuffer: Pointer; var pdwBufferSize: DWORD; out pdwDataType: DWORD): HResult; stdcall; + function GetComponentByIndex(dwComponentID: DWORD; pwszName: PWideChar; var pdwNameLen: DWORD; pvBuffer: Pointer; var pdwBufferSize: DWORD; out pdwDataType: DWORD): HResult; stdcall; + function AddComponent(pwszName: PWideChar; lpvData: Pointer; dwDataSize, dwDataType: DWORD): HResult; stdcall; + function GetDevice(out pguidDevice: TGUID): HResult; stdcall; + function SetDevice(const pguidDevice: TGUID): HResult; stdcall; + function BuildFromDPADDRESS(pvAddress: Pointer; dwDataSize: DWORD): HResult; stdcall; + end; + {$NODEFINE PIDirectPlay8Address} + {$HPPEMIT 'typedef _di_IDirectPlay8Address *PIDirectPlay8Address;'} + PIDirectPlay8Address = ^IDirectPlay8Address; + + // + // COM definition for IDirectPlay8AddressIP Generic Interface + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8AddressIP);'} + {$EXTERNALSYM IDirectPlay8AddressIP} + IDirectPlay8AddressIP = interface(IUnknown) + ['{e5a0e990-2bad-430b-87da-a142cf75de58}'] + (*** IDirectPlay8AddressIP methods ***) + // Constructs a IDirectPlay8 TCP Address from a SOCKADDR structure + function BuildFromSockAddr(const pSockAddr: TSockAddr): HResult; stdcall; + + // Constructs a TCP Address from a string (hostname) and port + function BuildAddress(wszAddress: PWideChar; usPort: Word): HResult; stdcall; + + // Builds a local TCP Address + function BuildLocalAddress(const pguidAdapter: TGUID; usPort: Word): HResult; stdcall; + + // Gets the address from the structure in SOCKADR format + function GetSockAddress(psockAddress: PSockAddr; var pdwAddressBufferSize: DWORD): HResult; stdcall; + + // Gets the local afddress + function GetLocalAddress(out pguidAdapter: TGUID; out pusPort: Word): HResult; stdcall; + + // Gets the remote address + function GetAddress(wszAddress: PWideChar; var pdwAddressLength: DWORD; out psPort: Word): HResult; stdcall; + end; + + +(**************************************************************************** + * + * DirectPlay8Address Interface IIDs + * + ****************************************************************************) + +type + // {83783300-4063-4c8a-9DB3-82830A7FEB31} + IID_IDirectPlay8Address = IDirectPlay8Address; + {$EXTERNALSYM IID_IDirectPlay8Address} + // {E5A0E990-2BAD-430b-87DA-A142CF75DE58} + IID_IDirectPlay8AddressIP = IDirectPlay8AddressIP; + {$EXTERNALSYM IID_IDirectPlay8AddressIP} + + + +(*==========================================================================; + * + * Copyright (C) 1998-2002 Microsoft Corporation. All Rights Reserved. + * + * File: DPlay8.h + * Content: DirectPlay8 include file + * + ***************************************************************************) + +const +(**************************************************************************** + * + * DirectPlay8 CLSIDs + * + ****************************************************************************) + + // {743F1DC6-5ABA-429f-8BDF-C54D03253DC2} + CLSID_DirectPlay8Client: TGUID = '{743f1dc6-5aba-429f-8bdf-c54d03253dc2}'; + {$EXTERNALSYM CLSID_DirectPlay8Client} + + // {DA825E1B-6830-43d7-835D-0B5AD82956A2} + CLSID_DirectPlay8Server: TGUID = '{da825e1b-6830-43d7-835d-0b5ad82956a2}'; + {$EXTERNALSYM CLSID_DirectPlay8Server} + + // {286F484D-375E-4458-A272-B138E2F80A6A} + CLSID_DirectPlay8Peer: TGUID = '{286f484d-375e-4458-a272-b138e2f80a6a}'; + {$EXTERNALSYM CLSID_DirectPlay8Peer} + + // CLSIDs added for DirectX 9 + + // {FC47060E-6153-4b34-B975-8E4121EB7F3C} + CLSID_DirectPlay8ThreadPool: TGUID = '{fc47060e-6153-4b34-b975-8e4121eb7f3c}'; + {$EXTERNALSYM CLSID_DirectPlay8ThreadPool} + + // {E4C1D9A2-CBF7-48bd-9A69-34A55E0D8941} + CLSID_DirectPlay8NATResolver: TGUID = '{e4c1d9a2-cbf7-48bd-9a69-34a55e0d8941}'; + {$EXTERNALSYM CLSID_DirectPlay8NATResolver} + +(**************************************************************************** + * + * DirectPlay8 Service Provider GUIDs + * + ****************************************************************************) + + // {53934290-628D-11D2-AE0F-006097B01411} + CLSID_DP8SP_IPX: TGUID = '{53934290-628d-11d2-ae0f-006097b01411}'; + {$EXTERNALSYM CLSID_DP8SP_IPX} + + // {6D4A3650-628D-11D2-AE0F-006097B01411} + CLSID_DP8SP_MODEM: TGUID = '{6d4a3650-628d-11d2-ae0f-006097b01411}'; + {$EXTERNALSYM CLSID_DP8SP_MODEM} + + // {743B5D60-628D-11D2-AE0F-006097B01411} + CLSID_DP8SP_SERIAL: TGUID = '{743b5d60-628d-11d2-ae0f-006097b01411}'; + {$EXTERNALSYM CLSID_DP8SP_SERIAL} + + // {EBFE7BA0-628D-11D2-AE0F-006097B01411} + CLSID_DP8SP_TCPIP: TGUID = '{ebfe7ba0-628d-11d2-ae0f-006097b01411}'; + {$EXTERNALSYM CLSID_DP8SP_TCPIP} + + + // Service providers added for DirectX 9 + + + // {995513AF-3027-4b9a-956E-C772B3F78006} + CLSID_DP8SP_BLUETOOTH: TGUID = '{995513af-3027-4b9a-956e-c772b3f78006}'; + {$EXTERNALSYM CLSID_DP8SP_BLUETOOTH} + + +type +(**************************************************************************** + * + * DirectPlay8 Callback Functions + * + ****************************************************************************) + + // + // Callback Function Type Definition + // + TFNDPNMessageHandler = function (pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall; + {$NODEFINE TFNDPNMessageHandler} + {$HPPEMIT 'typedef PFNDPNMESSAGEHANDLER TFNDPNMessageHandler;'} + +(**************************************************************************** + * + * DirectPlay8 Datatypes (Non-Structure / Non-Message) + * + ****************************************************************************) + + // + // Player IDs. Used to uniquely identify a player in a session + // + PDPNID = ^DPNID; + {$EXTERNALSYM PDPNID} + DPNID = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWORD; + {$EXTERNALSYM DPNID} + TDPNID = DPNID; + + // + // Used as identifiers for operations + // + PDPNHandle = ^TDPNHandle; + DPNHANDLE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWORD; + {$EXTERNALSYM DPNHANDLE} + TDPNHandle = DPNHANDLE; + +(**************************************************************************** + * + * DirectPlay8 Message Identifiers + * + ****************************************************************************) + +const + DPN_MSGID_OFFSET = $FFFF0000; + {$EXTERNALSYM DPN_MSGID_OFFSET} + DPN_MSGID_ADD_PLAYER_TO_GROUP = (DPN_MSGID_OFFSET or $0001); + {$EXTERNALSYM DPN_MSGID_ADD_PLAYER_TO_GROUP} + DPN_MSGID_APPLICATION_DESC = (DPN_MSGID_OFFSET or $0002); + {$EXTERNALSYM DPN_MSGID_APPLICATION_DESC} + DPN_MSGID_ASYNC_OP_COMPLETE = (DPN_MSGID_OFFSET or $0003); + {$EXTERNALSYM DPN_MSGID_ASYNC_OP_COMPLETE} + DPN_MSGID_CLIENT_INFO = (DPN_MSGID_OFFSET or $0004); + {$EXTERNALSYM DPN_MSGID_CLIENT_INFO} + DPN_MSGID_CONNECT_COMPLETE = (DPN_MSGID_OFFSET or $0005); + {$EXTERNALSYM DPN_MSGID_CONNECT_COMPLETE} + DPN_MSGID_CREATE_GROUP = (DPN_MSGID_OFFSET or $0006); + {$EXTERNALSYM DPN_MSGID_CREATE_GROUP} + DPN_MSGID_CREATE_PLAYER = (DPN_MSGID_OFFSET or $0007); + {$EXTERNALSYM DPN_MSGID_CREATE_PLAYER} + DPN_MSGID_DESTROY_GROUP = (DPN_MSGID_OFFSET or $0008); + {$EXTERNALSYM DPN_MSGID_DESTROY_GROUP} + DPN_MSGID_DESTROY_PLAYER = (DPN_MSGID_OFFSET or $0009); + {$EXTERNALSYM DPN_MSGID_DESTROY_PLAYER} + DPN_MSGID_ENUM_HOSTS_QUERY = (DPN_MSGID_OFFSET or $000a); + {$EXTERNALSYM DPN_MSGID_ENUM_HOSTS_QUERY} + DPN_MSGID_ENUM_HOSTS_RESPONSE = (DPN_MSGID_OFFSET or $000b); + {$EXTERNALSYM DPN_MSGID_ENUM_HOSTS_RESPONSE} + DPN_MSGID_GROUP_INFO = (DPN_MSGID_OFFSET or $000c); + {$EXTERNALSYM DPN_MSGID_GROUP_INFO} + DPN_MSGID_HOST_MIGRATE = (DPN_MSGID_OFFSET or $000d); + {$EXTERNALSYM DPN_MSGID_HOST_MIGRATE} + DPN_MSGID_INDICATE_CONNECT = (DPN_MSGID_OFFSET or $000e); + {$EXTERNALSYM DPN_MSGID_INDICATE_CONNECT} + DPN_MSGID_INDICATED_CONNECT_ABORTED = (DPN_MSGID_OFFSET or $000f); + {$EXTERNALSYM DPN_MSGID_INDICATED_CONNECT_ABORTED} + DPN_MSGID_PEER_INFO = (DPN_MSGID_OFFSET or $0010); + {$EXTERNALSYM DPN_MSGID_PEER_INFO} + DPN_MSGID_RECEIVE = (DPN_MSGID_OFFSET or $0011); + {$EXTERNALSYM DPN_MSGID_RECEIVE} + DPN_MSGID_REMOVE_PLAYER_FROM_GROUP = (DPN_MSGID_OFFSET or $0012); + {$EXTERNALSYM DPN_MSGID_REMOVE_PLAYER_FROM_GROUP} + DPN_MSGID_RETURN_BUFFER = (DPN_MSGID_OFFSET or $0013); + {$EXTERNALSYM DPN_MSGID_RETURN_BUFFER} + DPN_MSGID_SEND_COMPLETE = (DPN_MSGID_OFFSET or $0014); + {$EXTERNALSYM DPN_MSGID_SEND_COMPLETE} + DPN_MSGID_SERVER_INFO = (DPN_MSGID_OFFSET or $0015); + {$EXTERNALSYM DPN_MSGID_SERVER_INFO} + DPN_MSGID_TERMINATE_SESSION = (DPN_MSGID_OFFSET or $0016); + {$EXTERNALSYM DPN_MSGID_TERMINATE_SESSION} + + // Messages added for DirectX 9 + DPN_MSGID_CREATE_THREAD = (DPN_MSGID_OFFSET or $0017); + {$EXTERNALSYM DPN_MSGID_CREATE_THREAD} + DPN_MSGID_DESTROY_THREAD = (DPN_MSGID_OFFSET or $0018); + {$EXTERNALSYM DPN_MSGID_DESTROY_THREAD} + DPN_MSGID_NAT_RESOLVER_QUERY = (DPN_MSGID_OFFSET or $0101); + {$EXTERNALSYM DPN_MSGID_NAT_RESOLVER_QUERY} + +(**************************************************************************** + * + * DirectPlay8 Constants + * + ****************************************************************************) + + DPNID_ALL_PLAYERS_GROUP = 0; + {$EXTERNALSYM DPNID_ALL_PLAYERS_GROUP} + + // + // DESTROY_GROUP reasons + // + DPNDESTROYGROUPREASON_NORMAL = $0001; + {$EXTERNALSYM DPNDESTROYGROUPREASON_NORMAL} + DPNDESTROYGROUPREASON_AUTODESTRUCTED = $0002; + {$EXTERNALSYM DPNDESTROYGROUPREASON_AUTODESTRUCTED} + DPNDESTROYGROUPREASON_SESSIONTERMINATED = $0003; + {$EXTERNALSYM DPNDESTROYGROUPREASON_SESSIONTERMINATED} + + // + // DESTROY_PLAYER reasons + // + DPNDESTROYPLAYERREASON_NORMAL = $0001; + {$EXTERNALSYM DPNDESTROYPLAYERREASON_NORMAL} + DPNDESTROYPLAYERREASON_CONNECTIONLOST = $0002; + {$EXTERNALSYM DPNDESTROYPLAYERREASON_CONNECTIONLOST} + DPNDESTROYPLAYERREASON_SESSIONTERMINATED = $0003; + {$EXTERNALSYM DPNDESTROYPLAYERREASON_SESSIONTERMINATED} + DPNDESTROYPLAYERREASON_HOSTDESTROYEDPLAYER = $0004; + {$EXTERNALSYM DPNDESTROYPLAYERREASON_HOSTDESTROYEDPLAYER} + + + DPN_MAX_APPDESC_RESERVEDDATA_SIZE = 64; + {$EXTERNALSYM DPN_MAX_APPDESC_RESERVEDDATA_SIZE} + + +(**************************************************************************** + * + * DirectPlay8 Flags + * + ****************************************************************************) + + // + // Asynchronous operation flags (For Async Ops) + // + DPNOP_SYNC = $80000000; + {$EXTERNALSYM DPNOP_SYNC} + + // + // Add player to group flags (For AddPlayerToGroup) + // + DPNADDPLAYERTOGROUP_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNADDPLAYERTOGROUP_SYNC} + + // + // Cancel flags + // + DPNCANCEL_CONNECT = $0001; + {$EXTERNALSYM DPNCANCEL_CONNECT} + DPNCANCEL_ENUM = $0002; + {$EXTERNALSYM DPNCANCEL_ENUM} + DPNCANCEL_SEND = $0004; + {$EXTERNALSYM DPNCANCEL_SEND} + DPNCANCEL_ALL_OPERATIONS = $8000; + {$EXTERNALSYM DPNCANCEL_ALL_OPERATIONS} + + // Flags added for DirectX 9 + DPNCANCEL_PLAYER_SENDS = $80000000; + {$EXTERNALSYM DPNCANCEL_PLAYER_SENDS} + DPNCANCEL_PLAYER_SENDS_PRIORITY_HIGH = (DPNCANCEL_PLAYER_SENDS or $00010000); + {$EXTERNALSYM DPNCANCEL_PLAYER_SENDS_PRIORITY_HIGH} + DPNCANCEL_PLAYER_SENDS_PRIORITY_NORMAL = (DPNCANCEL_PLAYER_SENDS or $00020000); + {$EXTERNALSYM DPNCANCEL_PLAYER_SENDS_PRIORITY_NORMAL} + DPNCANCEL_PLAYER_SENDS_PRIORITY_LOW = (DPNCANCEL_PLAYER_SENDS or $00040000); + {$EXTERNALSYM DPNCANCEL_PLAYER_SENDS_PRIORITY_LOW} + + // + // Close flags (for Close, added for DirectX 9) + // + DPNCLOSE_IMMEDIATE = $00000001; + {$EXTERNALSYM DPNCLOSE_IMMEDIATE} + + // + // Connect flags (For Connect) + // + DPNCONNECT_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNCONNECT_SYNC} + DPNCONNECT_OKTOQUERYFORADDRESSING = $0001; + {$EXTERNALSYM DPNCONNECT_OKTOQUERYFORADDRESSING} + + // + // Create group flags (For CreateGroup) + // + DPNCREATEGROUP_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNCREATEGROUP_SYNC} + + // + // Destroy group flags (For DestroyGroup) + // + DPNDESTROYGROUP_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNDESTROYGROUP_SYNC} + + // + // Enumerate clients and groups flags (For EnumPlayersAndGroups) + // + DPNENUM_PLAYERS = $0001; + {$EXTERNALSYM DPNENUM_PLAYERS} + DPNENUM_GROUPS = $0010; + {$EXTERNALSYM DPNENUM_GROUPS} + + // + // Enum hosts flags (For EnumHosts) + // + DPNENUMHOSTS_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNENUMHOSTS_SYNC} + DPNENUMHOSTS_OKTOQUERYFORADDRESSING = $0001; + {$EXTERNALSYM DPNENUMHOSTS_OKTOQUERYFORADDRESSING} + DPNENUMHOSTS_NOBROADCASTFALLBACK = $0002; + {$EXTERNALSYM DPNENUMHOSTS_NOBROADCASTFALLBACK} + + // + // Enum service provider flags (For EnumSP) + // + DPNENUMSERVICEPROVIDERS_ALL = $0001; + {$EXTERNALSYM DPNENUMSERVICEPROVIDERS_ALL} + + // + // GetLocalHostAddresses flags (added for DirectX 9) + // + DPNGETLOCALHOSTADDRESSES_COMBINED = $0001; + {$EXTERNALSYM DPNGETLOCALHOSTADDRESSES_COMBINED} + + // + // Get send queue info flags (For GetSendQueueInfo) + // + DPNGETSENDQUEUEINFO_PRIORITY_NORMAL = $0001; + {$EXTERNALSYM DPNGETSENDQUEUEINFO_PRIORITY_NORMAL} + DPNGETSENDQUEUEINFO_PRIORITY_HIGH = $0002; + {$EXTERNALSYM DPNGETSENDQUEUEINFO_PRIORITY_HIGH} + DPNGETSENDQUEUEINFO_PRIORITY_LOW = $0004; + {$EXTERNALSYM DPNGETSENDQUEUEINFO_PRIORITY_LOW} + + // + // Group information flags (For Group Info) + // + DPNGROUP_AUTODESTRUCT = $0001; + {$EXTERNALSYM DPNGROUP_AUTODESTRUCT} + + // + // Host flags (For Host) + // + DPNHOST_OKTOQUERYFORADDRESSING = $0001; + {$EXTERNALSYM DPNHOST_OKTOQUERYFORADDRESSING} + + // + // Set info + // + DPNINFO_NAME = $0001; + {$EXTERNALSYM DPNINFO_NAME} + DPNINFO_DATA = $0002; + {$EXTERNALSYM DPNINFO_DATA} + + // + // Initialize flags (For Initialize) + // + DPNINITIALIZE_DISABLEPARAMVAL = $0001; + {$EXTERNALSYM DPNINITIALIZE_DISABLEPARAMVAL} + // Flags added for DirectX 9 + DPNINITIALIZE_HINT_LANSESSION = $0002; + {$EXTERNALSYM DPNINITIALIZE_HINT_LANSESSION} + DPNINITIALIZE_DISABLELINKTUNING = $0004; + {$EXTERNALSYM DPNINITIALIZE_DISABLELINKTUNING} + + + // + // Register Lobby flags + // + DPNLOBBY_REGISTER = $0001; + {$EXTERNALSYM DPNLOBBY_REGISTER} + DPNLOBBY_UNREGISTER = $0002; + {$EXTERNALSYM DPNLOBBY_UNREGISTER} + + // + // Player information flags (For Player Info / Player Messages) + // + DPNPLAYER_LOCAL = $0002; + {$EXTERNALSYM DPNPLAYER_LOCAL} + DPNPLAYER_HOST = $0004; + {$EXTERNALSYM DPNPLAYER_HOST} + + // + // Receive indication flags (added for DirectX 9) + // + DPNRECEIVE_GUARANTEED = $0001; + {$EXTERNALSYM DPNRECEIVE_GUARANTEED} + DPNRECEIVE_COALESCED = $0002; + {$EXTERNALSYM DPNRECEIVE_COALESCED} + + // + // Remove player from group flags (For RemovePlayerFromGroup) + // + DPNREMOVEPLAYERFROMGROUP_SYN = DPNOP_SYNC; + {$EXTERNALSYM DPNREMOVEPLAYERFROMGROUP_SYN} + + // + // Send flags (For Send/SendTo) + // + DPNSEND_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNSEND_SYNC} + DPNSEND_NOCOPY = $0001; + {$EXTERNALSYM DPNSEND_NOCOPY} + DPNSEND_NOCOMPLETE = $0002; + {$EXTERNALSYM DPNSEND_NOCOMPLETE} + DPNSEND_COMPLETEONPROCESS = $0004; + {$EXTERNALSYM DPNSEND_COMPLETEONPROCESS} + DPNSEND_GUARANTEED = $0008; + {$EXTERNALSYM DPNSEND_GUARANTEED} + DPNSEND_NONSEQUENTIAL = $0010; + {$EXTERNALSYM DPNSEND_NONSEQUENTIAL} + DPNSEND_NOLOOPBACK = $0020; + {$EXTERNALSYM DPNSEND_NOLOOPBACK} + DPNSEND_PRIORITY_LOW = $0040; + {$EXTERNALSYM DPNSEND_PRIORITY_LOW} + DPNSEND_PRIORITY_HIGH = $0080; + {$EXTERNALSYM DPNSEND_PRIORITY_HIGH} + // Flag added for DirectX 9 + DPNSEND_COALESCE = $0100; + {$EXTERNALSYM DPNSEND_COALESCE} + + // + // Send complete indication flags (added for DirectX 9) + // + DPNSENDCOMPLETE_GUARANTEED = $0001; + {$EXTERNALSYM DPNSENDCOMPLETE_GUARANTEED} + DPNSENDCOMPLETE_COALESCED = $0002; + {$EXTERNALSYM DPNSENDCOMPLETE_COALESCED} + + // + // Session Flags (for DPN_APPLICATION_DESC) + // + DPNSESSION_CLIENT_SERVER = $0001; + {$EXTERNALSYM DPNSESSION_CLIENT_SERVER} + DPNSESSION_MIGRATE_HOST = $0004; + {$EXTERNALSYM DPNSESSION_MIGRATE_HOST} + DPNSESSION_NODPNSVR = $0040; + {$EXTERNALSYM DPNSESSION_NODPNSVR} + DPNSESSION_REQUIREPASSWORD = $0080; + {$EXTERNALSYM DPNSESSION_REQUIREPASSWORD} + // Flag added for DirectX 9 + DPNSESSION_NOENUMS = $0100; + {$EXTERNALSYM DPNSESSION_NOENUMS} + DPNSESSION_FAST_SIGNED = $0200; + {$EXTERNALSYM DPNSESSION_FAST_SIGNED} + DPNSESSION_FULL_SIGNED = $0400; + {$EXTERNALSYM DPNSESSION_FULL_SIGNED} + + // + // Set client info flags (For SetClientInfo) + // + DPNSETCLIENTINFO_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNSETCLIENTINFO_SYNC} + + // + // Set group info flags (For SetGroupInfo) + // + DPNSETGROUPINFO_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNSETGROUPINFO_SYNC} + + // + // Set peer info flags (For SetPeerInfo) + // + DPNSETPEERINFO_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNSETPEERINFO_SYNC} + + // + // Set server info flags (For SetServerInfo) + // + DPNSETSERVERINFO_SYNC = DPNOP_SYNC; + {$EXTERNALSYM DPNSETSERVERINFO_SYNC} + + // + // SP capabilities flags + // + DPNSPCAPS_SUPPORTSDPNSVR = $0001; + {$EXTERNALSYM DPNSPCAPS_SUPPORTSDPNSVR} + DPNSPCAPS_SUPPORTSDPNSRV = DPNSPCAPS_SUPPORTSDPNSVR; + {$EXTERNALSYM DPNSPCAPS_SUPPORTSDPNSRV} + DPNSPCAPS_SUPPORTSBROADCAST = $0002; + {$EXTERNALSYM DPNSPCAPS_SUPPORTSBROADCAST} + DPNSPCAPS_SUPPORTSALLADAPTERS = $0004; + {$EXTERNALSYM DPNSPCAPS_SUPPORTSALLADAPTERS} + // Flags added for DirectX 9 + DPNSPCAPS_SUPPORTSTHREADPOOL = $0008; + {$EXTERNALSYM DPNSPCAPS_SUPPORTSTHREADPOOL} + DPNSPCAPS_NETWORKSIMULATOR = $0010; + {$EXTERNALSYM DPNSPCAPS_NETWORKSIMULATOR} + + // + // SP information flags (added for DirectX 9) + // + DPNSPINFO_NETWORKSIMULATORDEVICE = $0001; + {$EXTERNALSYM DPNSPINFO_NETWORKSIMULATORDEVICE} + +(**************************************************************************** + * + * DirectPlay8 Structures (Non-Message) + * + ****************************************************************************) + +type + // + // Application description + // + + PDPNApplicationDesc = ^TDPNApplicationDesc; + _DPN_APPLICATION_DESC = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Flags (DPNSESSION_...) + guidInstance: TGUID; // Instance GUID + guidApplication: TGUID; // Application GUID + dwMaxPlayers: DWORD; // Maximum # of players allowed (0=no limit) + dwCurrentPlayers: DWORD; // Current # of players allowed + pwszSessionName: PWideChar; // Name of the session + pwszPassword: PWideChar; // Password for the session + pvReservedData: Pointer; + dwReservedDataSize: DWORD; + pvApplicationReservedData: Pointer; + dwApplicationReservedDataSize: DWORD; + end; + {$EXTERNALSYM _DPN_APPLICATION_DESC} + DPN_APPLICATION_DESC = _DPN_APPLICATION_DESC; + {$EXTERNALSYM DPN_APPLICATION_DESC} + TDPNApplicationDesc = _DPN_APPLICATION_DESC; + + // + // Generic Buffer Description + // + PBufferDesc = ^TBufferDesc; + _BUFFERDESC = packed record + wBufferSize:DWORD; + pBufferData: PByte; + end; + {$EXTERNALSYM _BUFFERDESC} + BUFFERDESC = _BUFFERDESC; + {$EXTERNALSYM BUFFERDESC} + TBufferDesc = _BUFFERDESC; + + PDPNBufferDesc = ^TDPNBufferDesc; + DPN_BUFFER_DESC = _BUFFERDESC; + {$EXTERNALSYM DPN_BUFFER_DESC} + TDPNBufferDesc = DPN_BUFFER_DESC; + + // + // DirectPlay8 capabilities + // + PDPNCaps = ^TDPNCaps; + _DPN_CAPS = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Flags + dwConnectTimeout: DWORD; // ms before a connect request times out + dwConnectRetries: DWORD; // # of times to attempt the connection + dwTimeoutUntilKeepAlive: DWORD; // ms of inactivity before a keep alive is sent + end; + {$EXTERNALSYM _DPN_CAPS} + DPN_CAPS = _DPN_CAPS; + {$EXTERNALSYM DPN_CAPS} + TDPNCaps = _DPN_CAPS; + + // + // Extended capabilities structures (added for DirectX 9) + // + PDPNCapsEx = ^TDPNCapsEx; + _DPN_CAPS_EX = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Flags + dwConnectTimeout: DWORD; // ms before a connect request times out + dwConnectRetries: DWORD; // # of times to attempt the connection + dwTimeoutUntilKeepAlive: DWORD; // ms of inactivity before a keep alive is sent + dwMaxRecvMsgSize: DWORD; // maximum size in bytes of message that can be received + dwNumSendRetries: DWORD; // maximum number of send retries before link is considered dead + dwMaxSendRetryInterval: DWORD; // maximum period in msec between send retries + dwDropThresholdRate: DWORD; // percentage of dropped packets before throttling + dwThrottleRate: DWORD; // percentage amount to reduce send window when throttling + dwNumHardDisconnectSends: DWORD; // number of hard disconnect frames to send when close immediate flag is specified + dwMaxHardDisconnectPeriod: DWORD; // maximum period between hard disconnect sends + end; + {$EXTERNALSYM _DPN_CAPS_EX} + DPN_CAPS_EX = _DPN_CAPS_EX; + {$EXTERNALSYM DPN_CAPS_EX} + TDPNCapsEx = _DPN_CAPS_EX; + + // Connection Statistics information + + PDPNConnectionInfo = ^TDPNConnectionInfo; + _DPN_CONNECTION_INFO = packed record + dwSize: DWORD; + dwRoundTripLatencyMS: DWORD; + dwThroughputBPS: DWORD; + dwPeakThroughputBPS: DWORD; + + dwBytesSentGuaranteed: DWORD; + dwPacketsSentGuaranteed: DWORD; + dwBytesSentNonGuaranteed: DWORD; + dwPacketsSentNonGuaranteed: DWORD; + + dwBytesRetried: DWORD; // Guaranteed only + dwPacketsRetried: DWORD; // Guaranteed only + dwBytesDropped: DWORD; // Non Guaranteed only + dwPacketsDropped: DWORD; // Non Guaranteed only + + dwMessagesTransmittedHighPriority: DWORD; + dwMessagesTimedOutHighPriority: DWORD; + dwMessagesTransmittedNormalPriority: DWORD; + dwMessagesTimedOutNormalPriority: DWORD; + dwMessagesTransmittedLowPriority: DWORD; + dwMessagesTimedOutLowPriority: DWORD; + + dwBytesReceivedGuaranteed: DWORD; + dwPacketsReceivedGuaranteed: DWORD; + dwBytesReceivedNonGuaranteed: DWORD; + dwPacketsReceivedNonGuaranteed: DWORD; + dwMessagesReceived: DWORD; + end; + {$EXTERNALSYM _DPN_CONNECTION_INFO} + DPN_CONNECTION_INFO = _DPN_CONNECTION_INFO; + {$EXTERNALSYM DPN_CONNECTION_INFO} + TDPNConnectionInfo = _DPN_CONNECTION_INFO; + + + // + // Group information strucutre + // + PDPNGroupInfo = ^TDPNGroupInfo; + _DPN_GROUP_INFO = packed record + dwSize: DWORD; // size of this structure + dwInfoFlags: DWORD; // information contained + pwszName: PWideChar; // Unicode Name + pvData: Pointer; // data block + dwDataSize: DWORD; // size in BYTES of data block + dwGroupFlags: DWORD; // group flags (DPNGROUP_...) + end; + {$EXTERNALSYM _DPN_GROUP_INFO} + DPN_GROUP_INFO = _DPN_GROUP_INFO; + {$EXTERNALSYM DPN_GROUP_INFO} + TDPNGroupInfo = _DPN_GROUP_INFO; + + // + // Player information structure + // + PDPNPlayerInfo = ^TDPNPlayerInfo; + _DPN_PLAYER_INFO = packed record + dwSize: DWORD; // size of this structure + dwInfoFlags: DWORD; // information contained + pwszName: PWideChar; // Unicode Name + pvData: Pointer; // data block + dwDataSize: DWORD; // size in BYTES of data block + dwPlayerFlags: DWORD; // player flags (DPNPLAYER_...) + end; + {$EXTERNALSYM _DPN_PLAYER_INFO} + DPN_PLAYER_INFO = _DPN_PLAYER_INFO; + {$EXTERNALSYM DPN_PLAYER_INFO} + TDPNPlayerInfo = _DPN_PLAYER_INFO; + + PDPNSecurityCredentials = ^TDPNSecurityCredentials; + _DPN_SECURITY_CREDENTIALS = record + end; + {$EXTERNALSYM _DPN_SECURITY_CREDENTIALS} + DPN_SECURITY_CREDENTIALS = _DPN_SECURITY_CREDENTIALS; + {$EXTERNALSYM DPN_SECURITY_CREDENTIALS} + TDPNSecurityCredentials = _DPN_SECURITY_CREDENTIALS; + + PDPNSecurityDesc = ^TDPNSecurityDesc; + _DPN_SECURITY_DESC = record + end; + {$EXTERNALSYM _DPN_SECURITY_DESC} + DPN_SECURITY_DESC = _DPN_SECURITY_DESC; + {$EXTERNALSYM DPN_SECURITY_DESC} + TDPNSecurityDesc = _DPN_SECURITY_DESC; + + // + // Service provider & adapter enumeration structure + // + PDPNServiceProviderInfo = ^TDPNServiceProviderInfo; + _DPN_SERVICE_PROVIDER_INFO = packed record + dwFlags: DWORD; + guid: TGUID; // SP Guid + pwszName: PWideChar; // Friendly Name + pvReserved: Pointer; + dwReserved: DWORD; + end; + {$EXTERNALSYM _DPN_SERVICE_PROVIDER_INFO} + DPN_SERVICE_PROVIDER_INFO = _DPN_SERVICE_PROVIDER_INFO; + {$EXTERNALSYM DPN_SERVICE_PROVIDER_INFO} + TDPNServiceProviderInfo = _DPN_SERVICE_PROVIDER_INFO; + + // + // Service provider caps structure + // + PDPNSpCaps = ^TDPNSpCaps; + _DPN_SP_CAPS = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Flags ((DPNSPCAPS_...) + dwNumThreads: DWORD; // # of worker threads to use + dwDefaultEnumCount: DWORD; // default # of enum requests + dwDefaultEnumRetryInterval: DWORD; // default ms between enum requests + dwDefaultEnumTimeout: DWORD; // default enum timeout + dwMaxEnumPayloadSize: DWORD; // maximum size in bytes for enum payload data + dwBuffersPerThread: DWORD; // number of receive buffers per thread + dwSystemBufferSize: DWORD; // amount of buffering to do in addition to posted receive buffers + end; + {$EXTERNALSYM _DPN_SP_CAPS} + DPN_SP_CAPS = _DPN_SP_CAPS; + {$EXTERNALSYM DPN_SP_CAPS} + TDPNSpCaps = _DPN_SP_CAPS; + + +(**************************************************************************** + * + * IDirectPlay8 message handler call back structures + * + ****************************************************************************) + + // + // Add player to group strucutre for message handler + // (DPN_MSGID_ADD_PLAYER_TO_GROUP) + // + PDPNMsgAddPlayerToGroup = ^TDPNMsgAddPlayerToGroup; + _DPNMSG_ADD_PLAYER_TO_GROUP = packed record + dwSize: DWORD; // Size of this structure + dpnidGroup: TDPNID; // DPNID of group + pvGroupContext: Pointer; // Group context value + dpnidPlayer: TDPNID; // DPNID of added player + pvPlayerContext: Pointer; // Player context value + end; + {$EXTERNALSYM _DPNMSG_ADD_PLAYER_TO_GROUP} + DPNMSG_ADD_PLAYER_TO_GROUP = _DPNMSG_ADD_PLAYER_TO_GROUP; + {$EXTERNALSYM DPNMSG_ADD_PLAYER_TO_GROUP} + TDPNMsgAddPlayerToGroup = _DPNMSG_ADD_PLAYER_TO_GROUP; + + // + // Async operation completion structure for message handler + // (DPN_MSGID_ASYNC_OP_COMPLETE) + // + PDPNMsgAsyncOpComplete = ^TDPNMsgAsyncOpComplete; + _DPNMSG_ASYNC_OP_COMPLETE = packed record + dwSize: DWORD; // Size of this structure + hAsyncOp: TDPNHandle; // DirectPlay8 async operation handle + pvUserContext: Pointer; // User context supplied + hResultCode: HRESULT; // HRESULT of operation + end; + {$EXTERNALSYM _DPNMSG_ASYNC_OP_COMPLETE} + DPNMSG_ASYNC_OP_COMPLETE = _DPNMSG_ASYNC_OP_COMPLETE; + {$EXTERNALSYM DPNMSG_ASYNC_OP_COMPLETE} + TDPNMsgAsyncOpComplete = _DPNMSG_ASYNC_OP_COMPLETE; + + // + // Client info structure for message handler + // (DPN_MSGID_CLIENT_INFO) + // + PDPNMsgClientInfo = ^TDPNMsgClientInfo; + _DPNMSG_CLIENT_INFO = packed record + dwSize: DWORD; // Size of this structure + dpnidClient: TDPNID; // DPNID of client + pvPlayerContext: Pointer; // Player context value + end; + {$EXTERNALSYM _DPNMSG_CLIENT_INFO} + DPNMSG_CLIENT_INFO = _DPNMSG_CLIENT_INFO; + {$EXTERNALSYM DPNMSG_CLIENT_INFO} + TDPNMsgClientInfo = _DPNMSG_CLIENT_INFO; + + // + // Connect complete structure for message handler + // (DPN_MSGID_CONNECT_COMPLETE) + // + PDPNMsgConnectComplete = ^TDPNMsgConnectComplete; + _DPNMSG_CONNECT_COMPLETE = packed record + dwSize: DWORD; // Size of this structure + hAsyncOp: TDPNHandle; // DirectPlay8 Async operation handle + pvUserContext: Pointer; // User context supplied at Connect + hResultCode: HRESULT; // HRESULT of connection attempt + pvApplicationReplyData: Pointer; // Connection reply data from Host/Server + dwApplicationReplyDataSize: DWORD; // Size (in bytes) of pvApplicationReplyData + + // Fields added for DirectX 9 + dpnidLocal: TDPNID; // DPNID of local player + end; + {$EXTERNALSYM _DPNMSG_CONNECT_COMPLETE} + DPNMSG_CONNECT_COMPLETE = _DPNMSG_CONNECT_COMPLETE; + {$EXTERNALSYM DPNMSG_CONNECT_COMPLETE} + TDPNMsgConnectComplete = _DPNMSG_CONNECT_COMPLETE; + + // + // Create group structure for message handler + // (DPN_MSGID_CREATE_GROUP) + // + PDPNMsgCreateGroup = ^TDPNMsgCreateGroup; + _DPNMSG_CREATE_GROUP = packed record + dwSize: DWORD; // Size of this structure + dpnidGroup: TDPNID; // DPNID of new group + dpnidOwner: TDPNID; // Owner of newgroup + pvGroupContext: Pointer; // Group context value + + // Fields added for DirectX 9 + pvOwnerContext: Pointer; // Owner context value + end; + {$EXTERNALSYM _DPNMSG_CREATE_GROUP} + DPNMSG_CREATE_GROUP = _DPNMSG_CREATE_GROUP; + {$EXTERNALSYM DPNMSG_CREATE_GROUP} + TDPNMsgCreateGroup = _DPNMSG_CREATE_GROUP; + + // + // Create player structure for message handler + // (DPN_MSGID_CREATE_PLAYER) + // + PDPNMsgCreatePlayer = ^TDPNMsgCreatePlayer; + _DPNMSG_CREATE_PLAYER = packed record + dwSize: DWORD; // Size of this structure + dpnidPlayer: DPNID; // DPNID of new player + pvPlayerContext: Pointer; // Player context value + end; + {$EXTERNALSYM _DPNMSG_CREATE_PLAYER} + DPNMSG_CREATE_PLAYER = _DPNMSG_CREATE_PLAYER; + {$EXTERNALSYM DPNMSG_CREATE_PLAYER} + TDPNMsgCreatePlayer = _DPNMSG_CREATE_PLAYER; + + // + // Destroy group structure for message handler + // (DPN_MSGID_DESTROY_GROUP) + // + PDPNMsgDestroyGroup = ^TDPNMsgDestroyGroup; + _DPNMSG_DESTROY_GROUP = packed record + dwSize: DWORD; // Size of this structure + dpnidGroup: TDPNID; // DPNID of destroyed group + pvGroupContext: Pointer; // Group context value + dwReason: DWORD; // Information only + end; + {$EXTERNALSYM _DPNMSG_DESTROY_GROUP} + DPNMSG_DESTROY_GROUP = _DPNMSG_DESTROY_GROUP; + {$EXTERNALSYM DPNMSG_DESTROY_GROUP} + TDPNMsgDestroyGroup = _DPNMSG_DESTROY_GROUP; + + // + // Destroy player structure for message handler + // (DPN_MSGID_DESTROY_PLAYER) + // + PDPNMsgDestroyPlayer = ^TDPNMsgDestroyPlayer; + _DPNMSG_DESTROY_PLAYER = packed record + dwSize: DWORD; // Size of this structure + dpnidPlayer: TDPNID; // DPNID of leaving player + pvPlayerContext: Pointer; // Player context value + dwReason: DWORD; // Information only + end; + {$EXTERNALSYM _DPNMSG_DESTROY_PLAYER} + DPNMSG_DESTROY_PLAYER = _DPNMSG_DESTROY_PLAYER; + {$EXTERNALSYM DPNMSG_DESTROY_PLAYER} + TDPNMsgDestroyPlayer = _DPNMSG_DESTROY_PLAYER; + + // + // Enumeration request received structure for message handler + // (DPN_MSGID_ENUM_HOSTS_QUERY) + // + PDPNMsgEnumHostsQuery = ^TDPNMsgEnumHostsQuery; + _DPNMSG_ENUM_HOSTS_QUERY = packed record + dwSize: DWORD; // Size of this structure. + pAddressSender: IDirectPlay8Address; // Address of client who sent the request + pAddressDevice: IDirectPlay8Address; // Address of device request was received on + pvReceivedData: Pointer; // Request data (set on client) + dwReceivedDataSize: DWORD; // Request data size (set on client) + dwMaxResponseDataSize: DWORD; // Max allowable size of enum response + pvResponseData: Pointer; // Optional query repsonse (user set) + dwResponseDataSize: DWORD; // Optional query response size (user set) + pvResponseContext: Pointer; // Optional query response context (user set) + end; + {$EXTERNALSYM _DPNMSG_ENUM_HOSTS_QUERY} + DPNMSG_ENUM_HOSTS_QUERY = _DPNMSG_ENUM_HOSTS_QUERY; + {$EXTERNALSYM DPNMSG_ENUM_HOSTS_QUERY} + TDPNMsgEnumHostsQuery = _DPNMSG_ENUM_HOSTS_QUERY; + + // + // Enumeration response received structure for message handler + // (DPN_MSGID_ENUM_HOSTS_RESPONSE) + // + PDPNMsgEnumHostsResponse = ^TDPNMsgEnumHostsResponse; + _DPNMSG_ENUM_HOSTS_RESPONSE = packed record + dwSize: DWORD; // Size of this structure + pAddressSender: IDirectPlay8Address; // Address of host who responded + pAddressDevice: IDirectPlay8Address; // Device response was received on + pApplicationDescription: PDPNApplicationDesc; // Application description for the session + pvResponseData: Pointer; // Optional response data (set on host) + dwResponseDataSize: DWORD; // Optional response data size (set on host) + pvUserContext: Pointer; // Context value supplied for enumeration + dwRoundTripLatencyMS: DWORD; // Round trip latency in MS + end; + {$EXTERNALSYM _DPNMSG_ENUM_HOSTS_RESPONSE} + DPNMSG_ENUM_HOSTS_RESPONSE = _DPNMSG_ENUM_HOSTS_RESPONSE; + {$EXTERNALSYM DPNMSG_ENUM_HOSTS_RESPONSE} + TDPNMsgEnumHostsResponse = _DPNMSG_ENUM_HOSTS_RESPONSE; + + // + // Group info structure for message handler + // (DPN_MSGID_GROUP_INFO) + // + PDPNMsgGroupInfo = ^TDPNMsgGroupInfo; + _DPNMSG_GROUP_INFO = packed record + dwSize: DWORD; // Size of this structure + dpnidGroup: TDPNID; // DPNID of group + pvGroupContext: Pointer; // Group context value + end; + {$EXTERNALSYM _DPNMSG_GROUP_INFO} + DPNMSG_GROUP_INFO = _DPNMSG_GROUP_INFO; + {$EXTERNALSYM DPNMSG_GROUP_INFO} + TDPNMsgGroupInfo = _DPNMSG_GROUP_INFO; + + // + // Migrate host structure for message handler + // (DPN_MSGID_HOST_MIGRATE) + // + PDPNMsgHostMigrate = ^TDPNMsgHostMigrate; + _DPNMSG_HOST_MIGRATE = packed record + dwSize: DWORD; // Size of this structure + dpnidNewHost: TDPNID; // DPNID of new Host player + pvPlayerContext: Pointer; // Player context value + end; + {$EXTERNALSYM _DPNMSG_HOST_MIGRATE} + DPNMSG_HOST_MIGRATE = _DPNMSG_HOST_MIGRATE; + {$EXTERNALSYM DPNMSG_HOST_MIGRATE} + TDPNMsgHostMigrate = _DPNMSG_HOST_MIGRATE; + + // + // Indicate connect structure for message handler + // (DPN_MSGID_INDICATE_CONNECT) + // + PDPNMsgIndicateConnect = ^TDPNMsgIndicateConnect; + _DPNMSG_INDICATE_CONNECT = packed record + dwSize: DWORD; // Size of this structure + pvUserConnectData: Pointer; // Connecting player data + dwUserConnectDataSize: DWORD; // Size (in bytes) of pvUserConnectData + pvReplyData: Pointer; // Connection reply data + dwReplyDataSize: DWORD; // Size (in bytes) of pvReplyData + pvReplyContext: Pointer; // Buffer context for pvReplyData + pvPlayerContext: Pointer; // Player context preset + pAddressPlayer: IDirectPlay8Address; // Address of connecting player + pAddressDevice: IDirectPlay8Address; // Address of device receiving connect attempt + end; + {$EXTERNALSYM _DPNMSG_INDICATE_CONNECT} + DPNMSG_INDICATE_CONNECT = _DPNMSG_INDICATE_CONNECT; + {$EXTERNALSYM DPNMSG_INDICATE_CONNECT} + TDPNMsgIndicateConnect = _DPNMSG_INDICATE_CONNECT; + + // + // Indicated connect aborted structure for message handler + // (DPN_MSGID_INDICATED_CONNECT_ABORTED) + // + PDPNMsgIndicatedConnectAborted = ^TDPNMsgIndicatedConnectAborted; + _DPNMSG_INDICATED_CONNECT_ABORTED = packed record + dwSize: DWORD; // Size of this structure + pvPlayerContext: Pointer; // Player context preset from DPNMSG_INDICATE_CONNECT + end; + {$EXTERNALSYM _DPNMSG_INDICATED_CONNECT_ABORTED} + DPNMSG_INDICATED_CONNECT_ABORTED = _DPNMSG_INDICATED_CONNECT_ABORTED; + {$EXTERNALSYM DPNMSG_INDICATED_CONNECT_ABORTED} + TDPNMsgIndicatedConnectAborted = _DPNMSG_INDICATED_CONNECT_ABORTED; + + // + // Peer info structure for message handler + // (DPN_MSGID_PEER_INFO) + // + PDPNMsgPeerInfo = ^TDPNMsgPeerInfo; + _DPNMSG_PEER_INFO = packed record + dwSize: DWORD; // Size of this structure + dpnidPeer: TDPNID; // DPNID of peer + pvPlayerContext: Pointer; // Player context value + end; + {$EXTERNALSYM _DPNMSG_PEER_INFO} + DPNMSG_PEER_INFO = _DPNMSG_PEER_INFO; + {$EXTERNALSYM DPNMSG_PEER_INFO} + TDPNMsgPeerInfo = _DPNMSG_PEER_INFO; + + // + // Receive structure for message handler + // (DPN_MSGID_RECEIVE) + // + PDPNMsgReceive = ^TDPNMsgReceive; + _DPNMSG_RECEIVE = packed record + dwSize: DWORD; // Size of this structure + dpnidSender: TDPNID; // DPNID of sending player + pvPlayerContext: Pointer; // Player context value of sending player + pReceiveData: PByte; // Received data + dwReceiveDataSize: DWORD; // Size (in bytes) of pReceiveData + hBufferHandle: TDPNHandle; // Buffer handle for pReceiveData + + // Fields added for DirectX 9 + dwReceiveFlags: DWORD; // Flags describing how message was received + end; + {$EXTERNALSYM _DPNMSG_RECEIVE} + DPNMSG_RECEIVE = _DPNMSG_RECEIVE; + {$EXTERNALSYM DPNMSG_RECEIVE} + TDPNMsgReceive = _DPNMSG_RECEIVE; + + // + // Remove player from group structure for message handler + // (DPN_MSGID_REMOVE_PLAYER_FROM_GROUP) + // + PDPNMsgRemovePlayerFromGroup = ^TDPNMsgRemovePlayerFromGroup; + _DPNMSG_REMOVE_PLAYER_FROM_GROUP = packed record + dwSize: DWORD; // Size of this structure + dpnidGroup: TDPNID; // DPNID of group + pvGroupContext: Pointer; // Group context value + dpnidPlayer: TDPNID; // DPNID of deleted player + pvPlayerContext: Pointer; // Player context value + end; + {$EXTERNALSYM _DPNMSG_REMOVE_PLAYER_FROM_GROUP} + DPNMSG_REMOVE_PLAYER_FROM_GROUP = _DPNMSG_REMOVE_PLAYER_FROM_GROUP; + {$EXTERNALSYM DPNMSG_REMOVE_PLAYER_FROM_GROUP} + TDPNMsgRemovePlayerFromGroup = _DPNMSG_REMOVE_PLAYER_FROM_GROUP; + + // + // Returned buffer structure for message handler + // (DPN_MSGID_RETURN_BUFFER) + // + PDPNMsgReturnBuffer = ^TDPNMsgReturnBuffer; + _DPNMSG_RETURN_BUFFER = packed record + dwSize: DWORD; // Size of this structure + hResultCode: HRESULT; // Return value of operation + pvBuffer: Pointer; // Buffer being returned + pvUserContext: Pointer; // Context associated with buffer + end; + {$EXTERNALSYM _DPNMSG_RETURN_BUFFER} + DPNMSG_RETURN_BUFFER = _DPNMSG_RETURN_BUFFER; + {$EXTERNALSYM DPNMSG_RETURN_BUFFER} + TDPNMsgReturnBuffer = _DPNMSG_RETURN_BUFFER; + + // + // Send complete structure for message handler + // (DPN_MSGID_SEND_COMPLETE) + // + PDPNMsgSendComplete = ^TDPNMsgSendComplete; + _DPNMSG_SEND_COMPLETE = packed record + dwSize: DWORD; // Size of this structure + hAsyncOp: TDPNHandle; // DirectPlay8 Async operation handle + pvUserContext: Pointer; // User context supplied at Send/SendTo + hResultCode: HRESULT; // HRESULT of send + dwSendTime: DWORD; // Send time in ms + + // Fields added for DirectX 9 + dwFirstFrameRTT: DWORD; // RTT of the first frame in the message + dwFirstFrameRetryCount: DWORD; // Retry count of the first frame + dwSendCompleteFlags: DWORD; // Flags describing how message was sent + pBuffers: PDPNBufferDesc; // Pointer to array of buffers sent, if DirectPlay did not make a copy + dwNumBuffers: DWORD; // Number of buffers in previous array + end; + {$EXTERNALSYM _DPNMSG_SEND_COMPLETE} + DPNMSG_SEND_COMPLETE = _DPNMSG_SEND_COMPLETE; + {$EXTERNALSYM DPNMSG_SEND_COMPLETE} + TDPNMsgSendComplete = _DPNMSG_SEND_COMPLETE; + + // + // Server info structure for message handler + // (DPN_MSGID_SERVER_INFO) + // + PDPNMsgServerInfo = ^TDPNMsgServerInfo; + _DPNMSG_SERVER_INFO = packed record + dwSize: DWORD; // Size of this structure + dpnidServer: TDPNID; // DPNID of server + pvPlayerContext: Pointer; // Player context value + end; + {$EXTERNALSYM _DPNMSG_SERVER_INFO} + DPNMSG_SERVER_INFO = _DPNMSG_SERVER_INFO; + {$EXTERNALSYM DPNMSG_SERVER_INFO} + TDPNMsgServerInfo = _DPNMSG_SERVER_INFO; + + // + // Terminated session structure for message handler + // (DPN_MSGID_TERMINATE_SESSION) + // + PDPNMsgTerminateSession = ^TDPNMsgTerminateSession; + _DPNMSG_TERMINATE_SESSION = packed record + dwSize: DWORD; // Size of this structure + hResultCode: HRESULT; // Reason + pvTerminateData: Pointer; // Data passed from Host/Server + dwTerminateDataSize: DWORD; // Size (in bytes) of pvTerminateData + end; + {$EXTERNALSYM _DPNMSG_TERMINATE_SESSION} + DPNMSG_TERMINATE_SESSION = _DPNMSG_TERMINATE_SESSION; + {$EXTERNALSYM DPNMSG_TERMINATE_SESSION} + TDPNMsgTerminateSession = _DPNMSG_TERMINATE_SESSION; + + // + // Message structures added for DirectX 9 + // + + // + // Create thread info structure for message handler + // (DPN_MSGID_CREATE_THREAD) + // + PDPNMsgCreateThread = ^TDPNMsgCreateThread; + _DPNMSG_CREATE_THREAD = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Flags describing this thread + dwProcessorNum: DWORD; // Index of processor to which thread is bound + pvUserContext: Pointer; // Thread context value + end; + {$EXTERNALSYM _DPNMSG_CREATE_THREAD} + DPNMSG_CREATE_THREAD = _DPNMSG_CREATE_THREAD; + {$EXTERNALSYM DPNMSG_CREATE_THREAD} + TDPNMsgCreateThread = _DPNMSG_CREATE_THREAD; + + // + // Destroy thread info structure for message handler + // (DPN_MSGID_DESTROY_THREAD) + // + PDPNMsgDestroyThread = ^TDPNMsgDestroyThread; + _DPNMSG_DESTROY_THREAD = packed record + dwSize: DWORD; // Size of this structure + dwProcessorNum: DWORD; // Index of processor to which thread was bound + pvUserContext: Pointer; // Thread context value + end; + {$EXTERNALSYM _DPNMSG_DESTROY_THREAD} + DPNMSG_DESTROY_THREAD = _DPNMSG_DESTROY_THREAD; + {$EXTERNALSYM DPNMSG_DESTROY_THREAD} + TDPNMsgDestroyThread = _DPNMSG_DESTROY_THREAD; + + + // + // Query-to-resolve-NAT-address structure for message handler + // (DPN_MSGID_NAT_RESOLVER_QUERY) + // + PDPNMsgNatResolverQuery = ^TDPNMsgNatResolverQuery; + _DPNMSG_NAT_RESOLVER_QUERY = packed record + dwSize: DWORD; // Size of this structure. + pAddressSender: IDirectPlay8Address; // Address of client that sent the query + pAddressDevice: IDirectPlay8Address; // Address of device on which query was received + pwszUserString: PWideChar; // User specified string, or NULL if none + end; + {$EXTERNALSYM _DPNMSG_NAT_RESOLVER_QUERY} + DPNMSG_NAT_RESOLVER_QUERY = _DPNMSG_NAT_RESOLVER_QUERY; + {$EXTERNALSYM DPNMSG_NAT_RESOLVER_QUERY} + TDPNMsgNatResolverQuery = _DPNMSG_NAT_RESOLVER_QUERY; + + +(**************************************************************************** + * + * DirectPlay8 Functions + * + ****************************************************************************) + +(* + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 objects. + * + * extern HRESULT WINAPI DirectPlay8Create( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + *) + + +(**************************************************************************** + * + * DirectPlay8Lobby Interface Pointer + * + ****************************************************************************) + + IDirectPlay8LobbiedApplication = interface; + +(**************************************************************************** + * + * DirectPlay8 Application Interfaces + * + ****************************************************************************) + + // + // COM definition for DirectPlay8 Client interface + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8Client);'} + {$EXTERNALSYM IDirectPlay8Client} + IDirectPlay8Client = interface(IUnknown) + ['{5102dacd-241b-11d3-aea7-006097b01411}'] + (*** IDirectPlay8Client methods ***) + function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall; + function EnumServiceProviders(pguidServiceProvider, pguidApplication: PGUID; + pSPInfoBuffer: PDPNServiceProviderInfo; out pcbEnumData, pcReturned: DWORD; + dwFlags: DWORD): HResult; stdcall; + function EnumHosts(const pApplicationDesc: TDPNApplicationDesc; + pAddrHost, pDeviceInfo: IDirectPlay8Address; pUserEnumData: Pointer; + dwUserEnumDataSize, dwEnumCount, dwRetryInterval, dwTimeOut: DWORD; + pvUserContext: Pointer; pAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function CancelAsyncOperation(hAsyncHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall; + function Connect(const pdnAppDesc: TDPNApplicationDesc; + pHostAddr: IDirectPlay8Address; pDeviceInfo: IDirectPlay8Address; + pdnSecurity: PDPNSecurityDesc; pdnCredentials: PDPNSecurityCredentials; + pvUserConnectData: Pointer; dwUserConnectDataSize: DWORD; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function Send(const prgBufferDesc: TDPNBufferDesc; cBufferDesc, dwTimeOut: DWORD; + pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetSendQueueInfo(pdwNumMsgs, pdwNumBytes: PDWORD; dwFlags: DWORD): HResult; stdcall; + function GetApplicationDesc(pAppDescBuffer: PDPNApplicationDesc; var pcbDataSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetClientInfo(const pdpnPlayerInfo: TDPNPlayerInfo; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetServerInfo(pdpnPlayerInfo: PDPNPlayerInfo; var pdwSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function GetServerAddress(out pAddress: IDirectPlay8Address; dwFlags: DWORD): HResult; stdcall; + function Close(dwFlags: DWORD): HResult; stdcall; + function ReturnBuffer(hBufferHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx + function SetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx + function SetSPCaps(const pguidSP: TGUID; const pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall; + function GetSPCaps(const pguidSP: TGUID; var pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall; + function GetConnectionInfo(var pdpConnectionInfo: TDPNConnectionInfo; dwFlags: DWORD): HResult; stdcall; + function RegisterLobby(dpnHandle: TDPNHandle; pIDP8LobbiedApplication: IDirectPlay8LobbiedApplication; dwFlags: DWORD): HResult; stdcall; + end; + + // + // COM definition for DirectPlay8 Server interface + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8Server);'} + {$EXTERNALSYM IDirectPlay8Server} + IDirectPlay8Server = interface(IUnknown) + ['{5102dace-241b-11d3-aea7-006097b01411}'] + (*** IDirectPlay8Server methods ***) + function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall; + function EnumServiceProviders(pguidServiceProvider, pguidApplication: PGUID; + pSPInfoBuffer: PDPNServiceProviderInfo; out pcbEnumData, pcReturned: DWORD; + dwFlags: DWORD): HResult; stdcall; + function CancelAsyncOperation(hAsyncHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetSendQueueInfo(dpnid: TDPNID; pdwNumMsgs, pdwNumBytes: PDWORD; dwFlags: DWORD): HResult; stdcall; + function GetApplicationDesc(pAppDescBuffer: PDPNApplicationDesc; var pcbDataSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function GetServerInfo(pdpnPlayerInfo: PDPNPlayerInfo; pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetClientInfo(dpnid: TDPNID; pdpnPlayerInfo: PDPNPlayerInfo; pdwSize: PDWORD; dwFlags: DWORD): HResult; stdcall; + function GetClientAddress(dpnid: TDPNID; out pAddress: IDirectPlay8Address; dwFlags: DWORD): HResult; stdcall; + function GetLocalHostAddresses(out prgpAddress: IDirectPlay8Address; var pcAddress: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetApplicationDesc(const pad: TDPNApplicationDesc; dwFlags: DWORD): HResult; stdcall; + function Host(const pdnAppDesc: TDPNApplicationDesc; prgpDeviceInfo: PIDirectPlay8Address; + cDeviceInfo: DWORD; pdnSecurity: PDPNSecurityDesc; pdnCredentials: PDPNSecurityCredentials; + pvPlayerContext: Pointer; dwFlags: DWORD): HResult; stdcall; + function SendTo(dpnid: TDPNID; const prgBufferDesc: TDPNBufferDesc; cBufferDesc, dwTimeOut: DWORD; + pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function CreateGroup(const pdpnGroupInfo: TDPNGroupInfo; pvGroupContext, pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function DestroyGroup(idGroup: TDPNID; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function AddPlayerToGroup(idGroup, idClient: TDPNID; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function RemovePlayerFromGroup(idGroup, idClient: TDPNID; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function SetGroupInfo(dpnid: TDPNID; const pdpnGroupInfo: TDPNGroupInfo; pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetGroupInfo(dpnid: TDPNID; pdpnGroupInfo: PDPNGroupInfo; pdwSize: PDWORD; dwFlags: DWORD): HResult; stdcall; //todo: Changed + function EnumPlayersAndGroups(prgdpnid: PDPNID; var pcdpnid: DWORD; dwFlags: DWORD): HResult; stdcall; + function EnumGroupMembers(dpnid: TDPNID; prgdpnid: PDPNID; var pcdpnid: DWORD; dwFlags: DWORD): HResult; stdcall; + function Close(dwFlags: DWORD): HResult; stdcall; + function DestroyClient(dpnidClient: TDPNID; pvDestroyData: Pointer; dwDestroyDataSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function ReturnBuffer(hBufferHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetPlayerContext(dpnid: TDPNID; out ppvPlayerContext: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetGroupContext(dpnid: TDPNID; out ppvGroupContext: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx + function SetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx + function SetSPCaps(const pguidSP: TGUID; const pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall; + function GetSPCaps(const pguidSP: TGUID; var pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall; + function GetConnectionInfo(dpnid: TDPNID; var pdpConnectionInfo: TDPNConnectionInfo; dwFlags: DWORD): HResult; stdcall; + function RegisterLobby(dpnHandle: TDPNHandle; pIDP8LobbiedApplication: IDirectPlay8LobbiedApplication; dwFlags: DWORD): HResult; stdcall; + end; + + // + // COM definition for DirectPlay8 Peer interface + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8Peer);'} + {$EXTERNALSYM IDirectPlay8Peer} + IDirectPlay8Peer = interface(IUnknown) + ['{5102dacf-241b-11d3-aea7-006097b01411}'] + (*** IDirectPlay8Peer methods ***) + function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall; + function EnumServiceProviders(pguidServiceProvider, pguidApplication: PGUID; + pSPInfoBuffer: PDPNServiceProviderInfo; out pcbEnumData, pcReturned: DWORD; + dwFlags: DWORD): HResult; stdcall; + function CancelAsyncOperation(hAsyncHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall; + function Connect(const pdnAppDesc: TDPNApplicationDesc; + pHostAddr: IDirectPlay8Address; pDeviceInfo: IDirectPlay8Address; + pdnSecurity: PDPNSecurityDesc; pdnCredentials: PDPNSecurityCredentials; + pvUserConnectData: Pointer; dwUserConnectDataSize: DWORD; + pvPlayerContext, pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function SendTo(dpnid: TDPNID; const prgBufferDesc: TDPNBufferDesc; cBufferDesc, dwTimeOut: DWORD; + pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetSendQueueInfo(dpnid: TDPNID; pdwNumMsgs, pdwNumBytes: PDWORD; dwFlags: DWORD): HResult; stdcall; + function Host(const pdnAppDesc: TDPNApplicationDesc; prgpDeviceInfo: PIDirectPlay8Address; + cDeviceInfo: DWORD; pdnSecurity: PDPNSecurityDesc; pdnCredentials: PDPNSecurityCredentials; + pvPlayerContext: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetApplicationDesc(pAppDescBuffer: PDPNApplicationDesc; var pcbDataSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetApplicationDesc(const pad: TDPNApplicationDesc; dwFlags: DWORD): HResult; stdcall; + function CreateGroup(const pdpnGroupInfo: TDPNGroupInfo; pvGroupContext, pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function DestroyGroup(idGroup: TDPNID; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function AddPlayerToGroup(idGroup, idClient: TDPNID; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function RemovePlayerFromGroup(idGroup, idClient: TDPNID; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function SetGroupInfo(dpnid: TDPNID; const pdpnGroupInfo: TDPNGroupInfo; pvAsyncContext: Pointer; phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetGroupInfo(dpnid: TDPNID; pdpnGroupInfo: PDPNGroupInfo; pdwSize: PDWORD; dwFlags: DWORD): HResult; stdcall; //todo: Changed + function EnumPlayersAndGroups(prgdpnid: PDPNID; var pcdpnid: DWORD; dwFlags: DWORD): HResult; stdcall; + function EnumGroupMembers(dpnid: TDPNID; prgdpnid: PDPNID; var pcdpnid: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetPeerInfo(const pdpnPlayerInfo: TDPNPlayerInfo; pvAsyncContext: Pointer; + phAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetPeerInfo(dpnid: TDPNID; var pdpnPlayerInfo: TDPNPlayerInfo; pdwSize: PDWORD; dwFlags: DWORD): HResult; stdcall; //todo: Changed + function GetPeerAddress(dpnid: TDPNID; out pAddress: IDirectPlay8Address; dwFlags: DWORD): HResult; stdcall; + function GetLocalHostAddresses(prgpAddress: PIDirectPlay8Address; var pcAddress: DWORD; dwFlags: DWORD): HResult; stdcall; + function Close(dwFlags: DWORD): HResult; stdcall; + function EnumHosts(const pApplicationDesc: TDPNApplicationDesc; + pAddrHost, pDeviceInfo: IDirectPlay8Address; pUserEnumData: Pointer; + dwUserEnumDataSize, dwEnumCount, dwRetryInterval, dwTimeOut: DWORD; + pvUserContext: Pointer; pAsyncHandle: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function DestroyPeer(dpnidClient: TDPNID; pvDestroyData: Pointer; dwDestroyDataSize, dwFlags: DWORD): HResult; stdcall; + function ReturnBuffer(hBufferHandle: TDPNHandle; dwFlags: DWORD): HResult; stdcall; + function GetPlayerContext(dpnid: TDPNID; out ppvPlayerContext: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetGroupContext(dpnid: TDPNID; out ppvGroupContext: Pointer; dwFlags: DWORD): HResult; stdcall; + function GetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx + function SetCaps(pdpCaps: PDPNCaps; dwFlags: DWORD): HResult; stdcall; //Translator: pdpCaps can be either PDPNCaps or PDPNCapsEx + function SetSPCaps(const pguidSP: TGUID; const pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall; + function GetSPCaps(const pguidSP: TGUID; var pdpspCaps: TDPNSpCaps; dwFlags: DWORD): HResult; stdcall; + function GetConnectionInfo(dpnid: TDPNID; var pdpConnectionInfo: TDPNConnectionInfo; dwFlags: DWORD): HResult; stdcall; + function RegisterLobby(dpnHandle: TDPNHandle; pIDP8LobbiedApplication: IDirectPlay8LobbiedApplication; dwFlags: DWORD): HResult; stdcall; + function TerminateSession(pvTerminateData: Pointer; dwTerminateDataSize, dwFlags: DWORD): HResult; stdcall; + end; + + + // + // COM definition for DirectPlay8 Thread Pool interface + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8ThreadPool);'} + {$EXTERNALSYM IDirectPlay8ThreadPool} + IDirectPlay8ThreadPool = interface(IUnknown) + ['{0d22ee73-4a46-4a0d-89b2-045b4d666425}'] + (*** IDirectPlay8ThreadPool methods ***) + function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall; + function Close(dwFlags: DWORD): HResult; stdcall; + function GetThreadCount(dwProcessorNum: DWORD; out pdwNumThreads: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetThreadCount(dwProcessorNum: DWORD; dwNumThreads: DWORD; dwFlags: DWORD): HResult; stdcall; + function DoWork(dwAllowedTimeSlice: DWORD; dwFlags: DWORD): HResult; stdcall; + end; + + + // + // COM definition for DirectPlay8 NAT Resolver interface + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8NATResolver);'} + {$EXTERNALSYM IDirectPlay8NATResolver} + IDirectPlay8NATResolver = interface(IUnknown) + ['{a9e213f2-9a60-486f-bf3b-53408b6d1cbb}'] + (*** IDirectPlay8NATResolver methods ***) + function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall; + function Start(ppDevices: PIDirectPlay8Address; dwNumDevices: DWORD; dwFlags: DWORD): HResult; stdcall; + function Close(dwFlags: DWORD): HResult; stdcall; + function EnumDevices(pSPInfoBuffer: PDPNServiceProviderInfo; var pdwBufferSize: DWORD; out pdwNumDevices: DWORD; dwFlags: DWORD): HResult; stdcall; + function GetAddresses(ppAddresses: PIDirectPlay8Address; out pdwNumAddresses: DWORD; dwFlags: DWORD): HResult; stdcall; + end; + + +(**************************************************************************** + * + * DirectPlay8 Interface IIDs + * + ****************************************************************************) + + // {5102DACD-241B-11d3-AEA7-006097B01411} + IID_IDirectPlay8Client = IDirectPlay8Client; + {$EXTERNALSYM IID_IDirectPlay8Client} + + // {5102DACE-241B-11d3-AEA7-006097B01411} + IID_IDirectPlay8Server = IDirectPlay8Server; + {$EXTERNALSYM IID_IDirectPlay8Server} + + // {5102DACF-241B-11d3-AEA7-006097B01411} + IID_IDirectPlay8Peer = IDirectPlay8Peer; + {$EXTERNALSYM IID_IDirectPlay8Peer} + + + // IIDs added for DirectX 9 + + // {0D22EE73-4A46-4a0d-89B2-045B4D666425} + IID_IDirectPlay8ThreadPool = IDirectPlay8ThreadPool; + {$EXTERNALSYM IID_IDirectPlay8ThreadPool} + + // {A9E213F2-9A60-486f-BF3B-53408B6D1CBB} + IID_IDirectPlay8NATResolver = IDirectPlay8NATResolver; + {$EXTERNALSYM IID_IDirectPlay8NATResolver} + + + +(*========================================================================== + * + * Copyright (C) 2000 Microsoft Corporation. All Rights Reserved. + * + * File: DPLobby.h + * Content: DirectPlay8 Lobby Include File + * + ***************************************************************************) + + +(**************************************************************************** + * + * DirectPlay8Lobby Structures (Non-Message) + * + ****************************************************************************) + + // + // Information on a registered game + // + PDPLApplicationInfo = ^TDPLApplicationInfo; + _DPL_APPLICATION_INFO = packed record + guidApplication: TGUID; // GUID of the application + pwszApplicationName: PWideChar; // Name of the application + dwNumRunning: DWORD; // # of instances of this application running + dwNumWaiting: DWORD; // # of instances of this application waiting + dwFlags: DWORD; // Flags + end; + {$EXTERNALSYM _DPL_APPLICATION_INFO} + DPL_APPLICATION_INFO = _DPL_APPLICATION_INFO; + {$EXTERNALSYM DPL_APPLICATION_INFO} + TDPLApplicationInfo = _DPL_APPLICATION_INFO; + + // + // Settings to be used for connecting / hosting a game session + // + PDPLConnectionSettings = ^TDPLConnectionSettings; + _DPL_CONNECTION_SETTINGS = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Connection settings flags (DPLCONNECTSETTINGS_...) + dpnAppDesc: TDPNApplicationDesc; // Application desc for the associated DirectPlay session + pdp8HostAddress: IDirectPlay8Address; // Address of host to connect to + ppdp8DeviceAddresses: IDirectPlay8Address; // Address of device to connect from / host on + cNumDeviceAddresses: DWORD; // # of addresses specified in ppdp8DeviceAddresses + pwszPlayerName: PWideChar; // Name to give the player + end; + {$EXTERNALSYM _DPL_CONNECTION_SETTINGS} + DPL_CONNECTION_SETTINGS = _DPL_CONNECTION_SETTINGS; + {$EXTERNALSYM DPL_CONNECTION_SETTINGS} + TDPLConnectionSettings = _DPL_CONNECTION_SETTINGS; + + // + // Information for performing a lobby connect + // (ConnectApplication) + // + PDPLConnectInfo = ^TDPLConnectInfo; + _DPL_CONNECT_INFO = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Flags (DPLCONNECT_...) + guidApplication: TGUID; // GUID of application to launch + pdplConnectionSettings: PDPLConnectionSettings; // Settings application should use + pvLobbyConnectData: Pointer; // User defined data block + dwLobbyConnectDataSize: DWORD; // Size of user defined data block + end; + {$EXTERNALSYM _DPL_CONNECT_INFO} + DPL_CONNECT_INFO = _DPL_CONNECT_INFO; + {$EXTERNALSYM DPL_CONNECT_INFO} + TDPLConnectInfo = _DPL_CONNECT_INFO; + + // + // Information for registering an application + // (RegisterApplication) + // + PDPLProgramDesc = ^TDPLProgramDesc; + _DPL_PROGRAM_DESC = packed record + dwSize: DWORD; + dwFlags: DWORD; + guidApplication: TGUID; // Application GUID + pwszApplicationName: PWideChar; // Unicode application name + pwszCommandLine: PWideChar; // Unicode command line arguments + pwszCurrentDirectory: PWideChar; // Unicode current directory + pwszDescription: PWideChar; // Unicode application description + pwszExecutableFilename: PWideChar; // Unicode filename of application executable + pwszExecutablePath: PWideChar; // Unicode path of application executable + pwszLauncherFilename: PWideChar; // Unicode filename of launcher executable + pwszLauncherPath: PWideChar; // Unicode path of launcher executable + end; + {$EXTERNALSYM _DPL_PROGRAM_DESC} + DPL_PROGRAM_DESC = _DPL_PROGRAM_DESC; + {$EXTERNALSYM DPL_PROGRAM_DESC} + TDPLProgramDesc = _DPL_PROGRAM_DESC; + +(**************************************************************************** + * + * DirectPlay8 Lobby Message Structures + * + ****************************************************************************) + + // + // A connection was established + // (DPL_MSGID_CONNECT) + // + PDPLMessageConnect = ^TDPLMessageConnect; + _DPL_MESSAGE_CONNECT = packed record + dwSize: DWORD; // Size of this structure + hConnectId: TDPNHandle; // Handle of new connection + pdplConnectionSettings: PDPLConnectionSettings; // Connection settings for this connection + pvLobbyConnectData: Pointer; // User defined lobby data block + dwLobbyConnectDataSize: DWORD; // Size of user defined lobby data block + pvConnectionContext: Pointer; // Context value for this connection (user set) + end; + {$EXTERNALSYM _DPL_MESSAGE_CONNECT} + DPL_MESSAGE_CONNECT = _DPL_MESSAGE_CONNECT; + {$EXTERNALSYM DPL_MESSAGE_CONNECT} + TDPLMessageConnect = _DPL_MESSAGE_CONNECT; + + // + // Connection settings have been updated + // (DPL_MSGID_CONNECTION_SETTINGS) + // + PDPLMessageConnectionSettings = ^TDPLMessageConnectionSettings; + _DPL_MESSAGE_CONNECTION_SETTINGS = packed record + dwSize: DWORD; // Size of this structure + hSender: TDPNHandle; // Handle of the connection for these settings + pdplConnectionSettings: PDPLConnectionSettings; // Connection settings + pvConnectionContext: Pointer; // Context value for this connection + end; + {$EXTERNALSYM _DPL_MESSAGE_CONNECTION_SETTINGS} + DPL_MESSAGE_CONNECTION_SETTINGS = _DPL_MESSAGE_CONNECTION_SETTINGS; + {$EXTERNALSYM DPL_MESSAGE_CONNECTION_SETTINGS} + TDPLMessageConnectionSettings = _DPL_MESSAGE_CONNECTION_SETTINGS; + + // + // A connection has been disconnected + // (DPL_MSGID_DISCONNECT) + // + PDPLMessageDisconnect = ^TDPLMessageDisconnect; + _DPL_MESSAGE_DISCONNECT = packed record + dwSize: DWORD; // Size of this structure + hDisconnectId: TDPNHandle; // Handle of the connection that was terminated + hrReason: HRESULT; // Reason the connection was broken + pvConnectionContext: Pointer; // Context value for this connection + end; + {$EXTERNALSYM _DPL_MESSAGE_DISCONNECT} + DPL_MESSAGE_DISCONNECT = _DPL_MESSAGE_DISCONNECT; + {$EXTERNALSYM DPL_MESSAGE_DISCONNECT} + TDPLMessageDisconnect = _DPL_MESSAGE_DISCONNECT; + + // + // Data was received through a connection + // (DPL_MSGID_RECEIVE) + // + PDPLMessageReceive = ^TDPLMessageReceive; + _DPL_MESSAGE_RECEIVE = packed record + dwSize: DWORD; // Size of this structure + hSender: TDPNHandle; // Handle of the connection that is from + pBuffer: PByte; // Contents of the message + dwBufferSize: DWORD; // Size of the message context + pvConnectionContext: Pointer; // Context value for this connection + end; + {$EXTERNALSYM _DPL_MESSAGE_RECEIVE} + DPL_MESSAGE_RECEIVE = _DPL_MESSAGE_RECEIVE; + {$EXTERNALSYM DPL_MESSAGE_RECEIVE} + TDPLMessageReceive = _DPL_MESSAGE_RECEIVE; + + // + // Current status of the associated connection + // (DPL_MSGID_SESSION_STATUS) + // + PDPLMessageSessionStatus = ^TDPLMessageSessionStatus; + _DPL_MESSAGE_SESSION_STATUS = packed record + dwSize: DWORD; // Size of this structure + hSender: TDPNHandle; // Handle of the connection that this is from + dwStatus: DWORD; // Status (DPLSESSION_...) + pvConnectionContext: Pointer; // Context value for this connection + end; + {$EXTERNALSYM _DPL_MESSAGE_SESSION_STATUS} + DPL_MESSAGE_SESSION_STATUS = _DPL_MESSAGE_SESSION_STATUS; + {$EXTERNALSYM DPL_MESSAGE_SESSION_STATUS} + TDPLMessageSessionStatus = _DPL_MESSAGE_SESSION_STATUS; + +(**************************************************************************** + * + * DirectPlay8Lobby Create + * + ****************************************************************************) + +(* + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 lobby objects. + * + * extern HRESULT WINAPI DirectPlay8LobbyCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + *) + +(**************************************************************************** + * + * DirectPlay8 Functions + * + ****************************************************************************) + + // + // COM definition for DirectPlayLobbyClient + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8LobbyClient);'} + {$EXTERNALSYM IDirectPlay8LobbyClient} + IDirectPlay8LobbyClient = interface(IUnknown) + ['{819074a2-016c-11d3-ae14-006097b01411}'] + // IDirectPlayLobbyClient methods + function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall; + function EnumLocalPrograms(pGuidApplication: PGUID; pEnumData: PByte; var pdwEnumData: DWORD; out pdwItems: DWORD; dwFlags: DWORD): HResult; stdcall; + function ConnectApplication(const pdplConnectionInfo: PDPLConnectInfo; + pvConnectionContext: Pointer; hApplication: PDPNHandle; dwTimeOut, dwFlags: DWORD): HResult; stdcall; + function Send(hConnection: TDPNHandle; pBuffer: PByte; pBufferSize, dwFlags: DWORD): HResult; stdcall; + function ReleaseApplication(hConnection: TDPNHandle; dwFlags: DWORD): HResult; stdcall; + function Close(dwFlags: DWORD): HResult; stdcall; + function GetConnectionSettings(hConnection: TDPNHandle; pdplSessionInfo: PDPLConnectionSettings; var pdwInfoSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetConnectionSettings(hConnection: TDPNHandle; const pdplSessionInfo: TDPLConnectionSettings; dwFlags: DWORD): HResult; stdcall; + end; + + + // + // COM definition for DirectPlayLobbiedApplication + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlay8LobbiedApplication);'} + {$EXTERNALSYM IDirectPlay8LobbiedApplication} + IDirectPlay8LobbiedApplication = interface(IUnknown) + ['{819074a3-016c-11d3-ae14-006097b01411}'] + // IDirectPlayLobbiedApplication methods + function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; pdpnhConnection: PDPNHandle; dwFlags: DWORD): HResult; stdcall; + function RegisterProgram(const pdplProgramDesc: TDPLProgramDesc; dwFlags: DWORD): HResult; stdcall; + function UnRegisterProgram(const pguidApplication: TGUID; dwFlags: DWORD): HResult; stdcall; + function Send(hConnection: TDPNHandle; pBuffer: PByte; pBufferSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetAppAvailable(fAvailable: BOOL; dwFlags: DWORD): HResult; stdcall; + function UpdateStatus(hConnection: TDPNHandle; dwStatus, dwFlags: DWORD): HResult; stdcall; + function Close(dwFlags: DWORD): HResult; stdcall; + function GetConnectionSettings(hConnection: TDPNHandle; pdplSessionInfo: PDPLConnectionSettings; var pdwInfoSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetConnectionSettings(hConnection: TDPNHandle; const pdplSessionInfo: TDPLConnectionSettings; dwFlags: DWORD): HResult; stdcall; + end; + + +const +(**************************************************************************** + * + * DirectPlay8Lobby CLSIDs + * + ****************************************************************************) + + // {667955AD-6B3B-43ca-B949-BC69B5BAFF7F} + CLSID_DirectPlay8LobbiedApplication: TGUID = '{667955ad-6b3b-43ca-b949-bc69b5baff7f}'; + {$EXTERNALSYM CLSID_DirectPlay8LobbiedApplication} + + // {3B2B6775-70B6-45af-8DEA-A209C69559F3} + CLSID_DirectPlay8LobbyClient: TGUID = '{3b2b6775-70b6-45af-8dea-a209c69559f3}'; + {$EXTERNALSYM CLSID_DirectPlay8LobbyClient} + +(**************************************************************************** + * + * DirectPlay8Lobby Interface IIDs + * + ****************************************************************************) + + // {819074A3-016C-11d3-AE14-006097B01411} + IID_IDirectPlay8LobbiedApplication = IDirectPlay8LobbiedApplication; + {$EXTERNALSYM IID_IDirectPlay8LobbiedApplication} + + // {819074A2-016C-11d3-AE14-006097B01411} + IID_IDirectPlay8LobbyClient = IDirectPlay8LobbyClient; + {$EXTERNALSYM IID_IDirectPlay8LobbyClient} + +(**************************************************************************** + * + * DirectPlay8 Lobby Message IDs + * + ****************************************************************************) + + DPL_MSGID_LOBBY = $8000; + {$EXTERNALSYM DPL_MSGID_LOBBY} + DPL_MSGID_RECEIVE = ($0001 or DPL_MSGID_LOBBY); + {$EXTERNALSYM DPL_MSGID_RECEIVE} + DPL_MSGID_CONNECT = ($0002 or DPL_MSGID_LOBBY); + {$EXTERNALSYM DPL_MSGID_CONNECT} + DPL_MSGID_DISCONNECT = ($0003 or DPL_MSGID_LOBBY); + {$EXTERNALSYM DPL_MSGID_DISCONNECT} + DPL_MSGID_SESSION_STATUS = ($0004 or DPL_MSGID_LOBBY); + {$EXTERNALSYM DPL_MSGID_SESSION_STATUS} + DPL_MSGID_CONNECTION_SETTINGS = ($0005 or DPL_MSGID_LOBBY); + {$EXTERNALSYM DPL_MSGID_CONNECTION_SETTINGS} + +(**************************************************************************** + * + * DirectPlay8Lobby Constants + * + ****************************************************************************) + + // + // Specifies that operation should be performed on all open connections + // + DPLHANDLE_ALLCONNECTIONS = $FFFFFFFF; + {$EXTERNALSYM DPLHANDLE_ALLCONNECTIONS} + + // + // The associated game session has suceeded in connecting / hosting + // + DPLSESSION_CONNECTED = $0001; + {$EXTERNALSYM DPLSESSION_CONNECTED} + + // The associated game session failed connecting / hosting + // + DPLSESSION_COULDNOTCONNECT = $0002; + {$EXTERNALSYM DPLSESSION_COULDNOTCONNECT} + + // + // The associated game session has disconnected + // + DPLSESSION_DISCONNECTED = $0003; + {$EXTERNALSYM DPLSESSION_DISCONNECTED} + + // + // The associated game session has terminated + // + DPLSESSION_TERMINATED = $0004; + {$EXTERNALSYM DPLSESSION_TERMINATED} + + // + // The associated game session's host has migrated + // + DPLSESSION_HOSTMIGRATED = $0005; + {$EXTERNALSYM DPLSESSION_HOSTMIGRATED} + + // + // The associated game session's host has migrated to the local client + // + DPLSESSION_HOSTMIGRATEDHERE = $0006; + {$EXTERNALSYM DPLSESSION_HOSTMIGRATEDHERE} + + +(**************************************************************************** + * + * DirectPlay8 Lobby Flags + * + ****************************************************************************) + + // + // Do not automatically make the lobby app unavailable when a connection is established + // + DPLAVAILABLE_ALLOWMULTIPLECONNECT = $0001; + {$EXTERNALSYM DPLAVAILABLE_ALLOWMULTIPLECONNECT} + + // + // Launch a new instance of the application to connect to + // + DPLCONNECT_LAUNCHNEW = $0001; + {$EXTERNALSYM DPLCONNECT_LAUNCHNEW} + + // + // Launch a new instance of the application if one is not waiting + // + DPLCONNECT_LAUNCHNOTFOUND = $0002; + {$EXTERNALSYM DPLCONNECT_LAUNCHNOTFOUND} + + // + // When starting the associated game session, start it as a host + // + DPLCONNECTSETTINGS_HOST = $0001; + {$EXTERNALSYM DPLCONNECTSETTINGS_HOST} + + // + // Disable parameter validation + // + DPLINITIALIZE_DISABLEPARAMVAL = $0001; + {$EXTERNALSYM DPLINITIALIZE_DISABLEPARAMVAL} + + + + + +///// Part 2 of dplay8.h ///// +(*==========================================================================; + * + * Copyright (C) 1998-2000 Microsoft Corporation. All Rights Reserved. + * + * File: DPlay8.h + * Content: DirectPlay8 include file + * + ***************************************************************************) + +(**************************************************************************** + * + * DIRECTPLAY8 ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************) + +const + _DPN_FACILITY_CODE = $015; + {$EXTERNALSYM _DPN_FACILITY_CODE} + _DPNHRESULT_BASE = $8000; + {$EXTERNALSYM _DPNHRESULT_BASE} + + MAKE_DPNHRESULT_R = (1 shl 31) or (_DPN_FACILITY_CODE shl 16) + _DPNHRESULT_BASE; + +// #define MAKE_DPNHRESULT( code ) MAKE_HRESULT( 1, _DPN_FACILITY_CODE, ( code + _DPNHRESULT_BASE ) ) +function MAKE_DPNHRESULT(Code: DWORD): DWORD; +{$EXTERNALSYM MAKE_DPNHRESULT} + +const + DPN_OK = S_OK; + {$EXTERNALSYM DPN_OK} + + DPNSUCCESS_EQUAL = HRESULT((0 shl 31) or (_DPN_FACILITY_CODE shl 16) or ($5 + _DPNHRESULT_BASE)); // MAKE_HRESULT( 0, _DPN_FACILITY_CODE, ( 0x5 + _DPNHRESULT_BASE ) ) + {$EXTERNALSYM DPNSUCCESS_EQUAL} + DPNSUCCESS_NOPLAYERSINGROUP = HRESULT((0 shl 31) or (_DPN_FACILITY_CODE shl 16) or ($8 + _DPNHRESULT_BASE)); // MAKE_HRESULT( 0, _DPN_FACILITY_CODE, ( 0x8 + _DPNHRESULT_BASE ) ) // added for DirectX 9 + {$EXTERNALSYM DPNSUCCESS_NOPLAYERSINGROUP} + DPNSUCCESS_NOTEQUAL = HRESULT((0 shl 31) or (_DPN_FACILITY_CODE shl 16) or ($A + _DPNHRESULT_BASE)); // MAKE_HRESULT( 0, _DPN_FACILITY_CODE, (0x0A + _DPNHRESULT_BASE ) ) + {$EXTERNALSYM DPNSUCCESS_NOTEQUAL} + DPNSUCCESS_PENDING = HRESULT((0 shl 31) or (_DPN_FACILITY_CODE shl 16) or ($e + _DPNHRESULT_BASE)); // MAKE_HRESULT( 0, _DPN_FACILITY_CODE, (0x0e + _DPNHRESULT_BASE ) ) + {$EXTERNALSYM DPNSUCCESS_PENDING} + + DPNERR_ABORTED = HRESULT(MAKE_DPNHRESULT_R + $30); // MAKE_DPNHRESULT( 0x30 ) + {$EXTERNALSYM DPNERR_ABORTED} + DPNERR_ADDRESSING = HRESULT(MAKE_DPNHRESULT_R + $40); // MAKE_DPNHRESULT( 0x40 ) + {$EXTERNALSYM DPNERR_ADDRESSING} + DPNERR_ALREADYCLOSING = HRESULT(MAKE_DPNHRESULT_R + $50); // MAKE_DPNHRESULT( 0x50 ) + {$EXTERNALSYM DPNERR_ALREADYCLOSING} + DPNERR_ALREADYCONNECTED = HRESULT(MAKE_DPNHRESULT_R + $60); // MAKE_DPNHRESULT( 0x60 ) + {$EXTERNALSYM DPNERR_ALREADYCONNECTED} + DPNERR_ALREADYDISCONNECTING = HRESULT(MAKE_DPNHRESULT_R + $70); // MAKE_DPNHRESULT( 0x70 ) + {$EXTERNALSYM DPNERR_ALREADYDISCONNECTING} + DPNERR_ALREADYINITIALIZED = HRESULT(MAKE_DPNHRESULT_R + $80); // MAKE_DPNHRESULT( 0x80 ) + {$EXTERNALSYM DPNERR_ALREADYINITIALIZED} + DPNERR_ALREADYREGISTERED = HRESULT(MAKE_DPNHRESULT_R + $90); // MAKE_DPNHRESULT( 0x90 ) + {$EXTERNALSYM DPNERR_ALREADYREGISTERED} + DPNERR_BUFFERTOOSMALL = HRESULT(MAKE_DPNHRESULT_R + $100); // MAKE_DPNHRESULT( 0x100 ) + {$EXTERNALSYM DPNERR_BUFFERTOOSMALL} + DPNERR_CANNOTCANCEL = HRESULT(MAKE_DPNHRESULT_R + $110); // MAKE_DPNHRESULT( 0x110 ) + {$EXTERNALSYM DPNERR_CANNOTCANCEL} + DPNERR_CANTCREATEGROUP = HRESULT(MAKE_DPNHRESULT_R + $120); // MAKE_DPNHRESULT( 0x120 ) + {$EXTERNALSYM DPNERR_CANTCREATEGROUP} + DPNERR_CANTCREATEPLAYER = HRESULT(MAKE_DPNHRESULT_R + $130); // MAKE_DPNHRESULT( 0x130 ) + {$EXTERNALSYM DPNERR_CANTCREATEPLAYER} + DPNERR_CANTLAUNCHAPPLICATION = HRESULT(MAKE_DPNHRESULT_R + $140); // MAKE_DPNHRESULT( 0x140 ) + {$EXTERNALSYM DPNERR_CANTLAUNCHAPPLICATION} + DPNERR_CONNECTING = HRESULT(MAKE_DPNHRESULT_R + $150); // MAKE_DPNHRESULT( 0x150 ) + {$EXTERNALSYM DPNERR_CONNECTING} + DPNERR_CONNECTIONLOST = HRESULT(MAKE_DPNHRESULT_R + $160); // MAKE_DPNHRESULT( 0x160 ) + {$EXTERNALSYM DPNERR_CONNECTIONLOST} + DPNERR_CONVERSION = HRESULT(MAKE_DPNHRESULT_R + $170); // MAKE_DPNHRESULT( 0x170 ) + {$EXTERNALSYM DPNERR_CONVERSION} + DPNERR_DATATOOLARGE = HRESULT(MAKE_DPNHRESULT_R + $175); // MAKE_DPNHRESULT( 0x175 ) + {$EXTERNALSYM DPNERR_DATATOOLARGE} + DPNERR_DOESNOTEXIST = HRESULT(MAKE_DPNHRESULT_R + $180); // MAKE_DPNHRESULT( 0x180 ) + {$EXTERNALSYM DPNERR_DOESNOTEXIST} + DPNERR_DPNSVRNOTAVAILABLE = HRESULT(MAKE_DPNHRESULT_R + $185); // MAKE_DPNHRESULT( 0x185 ) + {$EXTERNALSYM DPNERR_DPNSVRNOTAVAILABLE} + DPNERR_DUPLICATECOMMAND = HRESULT(MAKE_DPNHRESULT_R + $190); // MAKE_DPNHRESULT( 0x190 ) + {$EXTERNALSYM DPNERR_DUPLICATECOMMAND} + DPNERR_ENDPOINTNOTRECEIVING = HRESULT(MAKE_DPNHRESULT_R + $200); // MAKE_DPNHRESULT( 0x200 ) + {$EXTERNALSYM DPNERR_ENDPOINTNOTRECEIVING} + DPNERR_ENUMQUERYTOOLARGE = HRESULT(MAKE_DPNHRESULT_R + $210); // MAKE_DPNHRESULT( 0x210 ) + {$EXTERNALSYM DPNERR_ENUMQUERYTOOLARGE} + DPNERR_ENUMRESPONSETOOLARGE = HRESULT(MAKE_DPNHRESULT_R + $220); // MAKE_DPNHRESULT( 0x220 ) + {$EXTERNALSYM DPNERR_ENUMRESPONSETOOLARGE} + DPNERR_EXCEPTION = HRESULT(MAKE_DPNHRESULT_R + $230); // MAKE_DPNHRESULT( 0x230 ) + {$EXTERNALSYM DPNERR_EXCEPTION} + DPNERR_GENERIC = E_FAIL; + {$EXTERNALSYM DPNERR_GENERIC} + DPNERR_GROUPNOTEMPTY = HRESULT(MAKE_DPNHRESULT_R + $240); // MAKE_DPNHRESULT( 0x240 ) + {$EXTERNALSYM DPNERR_GROUPNOTEMPTY} + DPNERR_HOSTING = HRESULT(MAKE_DPNHRESULT_R + $250); // MAKE_DPNHRESULT( 0x250 ) + {$EXTERNALSYM DPNERR_HOSTING} + DPNERR_HOSTREJECTEDCONNECTION = HRESULT(MAKE_DPNHRESULT_R + $260); // MAKE_DPNHRESULT( 0x260 ) + {$EXTERNALSYM DPNERR_HOSTREJECTEDCONNECTION} + DPNERR_HOSTTERMINATEDSESSION = HRESULT(MAKE_DPNHRESULT_R + $270); // MAKE_DPNHRESULT( 0x270 ) + {$EXTERNALSYM DPNERR_HOSTTERMINATEDSESSION} + DPNERR_INCOMPLETEADDRESS = HRESULT(MAKE_DPNHRESULT_R + $280); // MAKE_DPNHRESULT( 0x280 ) + {$EXTERNALSYM DPNERR_INCOMPLETEADDRESS} + DPNERR_INVALIDADDRESSFORMAT = HRESULT(MAKE_DPNHRESULT_R + $290); // MAKE_DPNHRESULT( 0x290 ) + {$EXTERNALSYM DPNERR_INVALIDADDRESSFORMAT} + DPNERR_INVALIDAPPLICATION = HRESULT(MAKE_DPNHRESULT_R + $300); // MAKE_DPNHRESULT( 0x300 ) + {$EXTERNALSYM DPNERR_INVALIDAPPLICATION} + DPNERR_INVALIDCOMMAND = HRESULT(MAKE_DPNHRESULT_R + $310); // MAKE_DPNHRESULT( 0x310 ) + {$EXTERNALSYM DPNERR_INVALIDCOMMAND} + DPNERR_INVALIDDEVICEADDRESS = HRESULT(MAKE_DPNHRESULT_R + $320); // MAKE_DPNHRESULT( 0x320 ) + {$EXTERNALSYM DPNERR_INVALIDDEVICEADDRESS} + DPNERR_INVALIDENDPOINT = HRESULT(MAKE_DPNHRESULT_R + $330); // MAKE_DPNHRESULT( 0x330 ) + {$EXTERNALSYM DPNERR_INVALIDENDPOINT} + DPNERR_INVALIDFLAGS = HRESULT(MAKE_DPNHRESULT_R + $340); // MAKE_DPNHRESULT( 0x340 ) + {$EXTERNALSYM DPNERR_INVALIDFLAGS} + DPNERR_INVALIDGROUP = HRESULT(MAKE_DPNHRESULT_R + $350); // MAKE_DPNHRESULT( 0x350 ) + {$EXTERNALSYM DPNERR_INVALIDGROUP} + DPNERR_INVALIDHANDLE = HRESULT(MAKE_DPNHRESULT_R + $360); // MAKE_DPNHRESULT( 0x360 ) + {$EXTERNALSYM DPNERR_INVALIDHANDLE} + DPNERR_INVALIDHOSTADDRESS = HRESULT(MAKE_DPNHRESULT_R + $370); // MAKE_DPNHRESULT( 0x370 ) + {$EXTERNALSYM DPNERR_INVALIDHOSTADDRESS} + DPNERR_INVALIDINSTANCE = HRESULT(MAKE_DPNHRESULT_R + $380); // MAKE_DPNHRESULT( 0x380 ) + {$EXTERNALSYM DPNERR_INVALIDINSTANCE} + DPNERR_INVALIDINTERFACE = HRESULT(MAKE_DPNHRESULT_R + $390); // MAKE_DPNHRESULT( 0x390 ) + {$EXTERNALSYM DPNERR_INVALIDINTERFACE} + DPNERR_INVALIDOBJECT = HRESULT(MAKE_DPNHRESULT_R + $400); // MAKE_DPNHRESULT( 0x400 ) + {$EXTERNALSYM DPNERR_INVALIDOBJECT} + DPNERR_INVALIDPARAM = E_INVALIDARG; + {$EXTERNALSYM DPNERR_INVALIDPARAM} + DPNERR_INVALIDPASSWORD = HRESULT(MAKE_DPNHRESULT_R + $410); // MAKE_DPNHRESULT( 0x410 ) + {$EXTERNALSYM DPNERR_INVALIDPASSWORD} + DPNERR_INVALIDPLAYER = HRESULT(MAKE_DPNHRESULT_R + $420); // MAKE_DPNHRESULT( 0x420 ) + {$EXTERNALSYM DPNERR_INVALIDPLAYER} + DPNERR_INVALIDPOINTER = E_POINTER; + {$EXTERNALSYM DPNERR_INVALIDPOINTER} + DPNERR_INVALIDPRIORITY = HRESULT(MAKE_DPNHRESULT_R + $430); // MAKE_DPNHRESULT( 0x430 ) + {$EXTERNALSYM DPNERR_INVALIDPRIORITY} + DPNERR_INVALIDSTRING = HRESULT(MAKE_DPNHRESULT_R + $440); // MAKE_DPNHRESULT( 0x440 ) + {$EXTERNALSYM DPNERR_INVALIDSTRING} + DPNERR_INVALIDURL = HRESULT(MAKE_DPNHRESULT_R + $450); // MAKE_DPNHRESULT( 0x450 ) + {$EXTERNALSYM DPNERR_INVALIDURL} + DPNERR_INVALIDVERSION = HRESULT(MAKE_DPNHRESULT_R + $460); // MAKE_DPNHRESULT( 0x460 ) + {$EXTERNALSYM DPNERR_INVALIDVERSION} + DPNERR_NOCAPS = HRESULT(MAKE_DPNHRESULT_R + $470); // MAKE_DPNHRESULT( 0x470 ) + {$EXTERNALSYM DPNERR_NOCAPS} + DPNERR_NOCONNECTION = HRESULT(MAKE_DPNHRESULT_R + $480); // MAKE_DPNHRESULT( 0x480 ) + {$EXTERNALSYM DPNERR_NOCONNECTION} + DPNERR_NOHOSTPLAYER = HRESULT(MAKE_DPNHRESULT_R + $490); // MAKE_DPNHRESULT( 0x490 ) + {$EXTERNALSYM DPNERR_NOHOSTPLAYER} + DPNERR_NOINTERFACE = E_NOINTERFACE; + {$EXTERNALSYM DPNERR_NOINTERFACE} + DPNERR_NOMOREADDRESSCOMPONENTS = HRESULT(MAKE_DPNHRESULT_R + $500); // MAKE_DPNHRESULT( 0x500 ) + {$EXTERNALSYM DPNERR_NOMOREADDRESSCOMPONENTS} + DPNERR_NORESPONSE = HRESULT(MAKE_DPNHRESULT_R + $510); // MAKE_DPNHRESULT( 0x510 ) + {$EXTERNALSYM DPNERR_NORESPONSE} + DPNERR_NOTALLOWED = HRESULT(MAKE_DPNHRESULT_R + $520); // MAKE_DPNHRESULT( 0x520 ) + {$EXTERNALSYM DPNERR_NOTALLOWED} + DPNERR_NOTHOST = HRESULT(MAKE_DPNHRESULT_R + $530); // MAKE_DPNHRESULT( 0x530 ) + {$EXTERNALSYM DPNERR_NOTHOST} + DPNERR_NOTREADY = HRESULT(MAKE_DPNHRESULT_R + $540); // MAKE_DPNHRESULT( 0x540 ) + {$EXTERNALSYM DPNERR_NOTREADY} + DPNERR_NOTREGISTERED = HRESULT(MAKE_DPNHRESULT_R + $550); // MAKE_DPNHRESULT( 0x550 ) + {$EXTERNALSYM DPNERR_NOTREGISTERED} + DPNERR_OUTOFMEMORY = E_OUTOFMEMORY; + {$EXTERNALSYM DPNERR_OUTOFMEMORY} + DPNERR_PENDING = DPNSUCCESS_PENDING; + {$EXTERNALSYM DPNERR_PENDING} + DPNERR_PLAYERALREADYINGROUP = HRESULT(MAKE_DPNHRESULT_R + $560); // MAKE_DPNHRESULT( 0x560 ) + {$EXTERNALSYM DPNERR_PLAYERALREADYINGROUP} + DPNERR_PLAYERLOST = HRESULT(MAKE_DPNHRESULT_R + $570); // MAKE_DPNHRESULT( 0x570 ) + {$EXTERNALSYM DPNERR_PLAYERLOST} + DPNERR_PLAYERNOTINGROUP = HRESULT(MAKE_DPNHRESULT_R + $580); // MAKE_DPNHRESULT( 0x580 ) + {$EXTERNALSYM DPNERR_PLAYERNOTINGROUP} + DPNERR_PLAYERNOTREACHABLE = HRESULT(MAKE_DPNHRESULT_R + $590); // MAKE_DPNHRESULT( 0x590 ) + {$EXTERNALSYM DPNERR_PLAYERNOTREACHABLE} + DPNERR_SENDTOOLARGE = HRESULT(MAKE_DPNHRESULT_R + $600); // MAKE_DPNHRESULT( 0x600 ) + {$EXTERNALSYM DPNERR_SENDTOOLARGE} + DPNERR_SESSIONFULL = HRESULT(MAKE_DPNHRESULT_R + $610); // MAKE_DPNHRESULT( 0x610 ) + {$EXTERNALSYM DPNERR_SESSIONFULL} + DPNERR_TABLEFULL = HRESULT(MAKE_DPNHRESULT_R + $620); // MAKE_DPNHRESULT( 0x620 ) + {$EXTERNALSYM DPNERR_TABLEFULL} + DPNERR_TIMEDOUT = HRESULT(MAKE_DPNHRESULT_R + $630); // MAKE_DPNHRESULT( 0x630 ) + {$EXTERNALSYM DPNERR_TIMEDOUT} + DPNERR_UNINITIALIZED = HRESULT(MAKE_DPNHRESULT_R + $640); // MAKE_DPNHRESULT( 0x640 ) + {$EXTERNALSYM DPNERR_UNINITIALIZED} + DPNERR_UNSUPPORTED = E_NOTIMPL; + {$EXTERNALSYM DPNERR_UNSUPPORTED} + DPNERR_USERCANCEL = HRESULT(MAKE_DPNHRESULT_R + $650); // MAKE_DPNHRESULT( 0x650 ) + {$EXTERNALSYM DPNERR_USERCANCEL} + + + + +(*==========================================================================; + * + * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved. + * + * File: dpvoice.h + * Content: DirectPlayVoice include file + ***************************************************************************) + + +const +(**************************************************************************** + * + * DirectPlayVoice CLSIDs + * + ****************************************************************************) + + + // {B9F3EB85-B781-4ac1-8D90-93A05EE37D7D} + CLSID_DirectPlayVoiceClient: TGUID = '{b9f3eb85-b781-4ac1-8d90-93a05ee37d7d}'; + {$EXTERNALSYM CLSID_DirectPlayVoiceClient} + + // {D3F5B8E6-9B78-4a4c-94EA-CA2397B663D3} + CLSID_DirectPlayVoiceServer: TGUID = '{d3f5b8e6-9b78-4a4c-94ea-ca2397b663d3}'; + {$EXTERNALSYM CLSID_DirectPlayVoiceServer} + + // {0F0F094B-B01C-4091-A14D-DD0CD807711A} + CLSID_DirectPlayVoiceTest: TGUID = '{0f0f094b-b01c-4091-a14d-dd0cd807711a}'; + {$EXTERNALSYM CLSID_DirectPlayVoiceTest} + +(**************************************************************************** + * + * DirectPlayVoice Compression Type GUIDs + * + ****************************************************************************) + + // MS-ADPCM 32.8 kbit/s + // + // {699B52C1-A885-46a8-A308-97172419ADC7} + DPVCTGUID_ADPCM: TGUID = '{699b52c1-a885-46a8-a308-97172419adc7}'; + {$EXTERNALSYM DPVCTGUID_ADPCM} + + // Microsoft GSM 6.10 13 kbit/s + // + // {24768C60-5A0D-11d3-9BE4-525400D985E7} + DPVCTGUID_GSM: TGUID = '{24768c60-5a0d-11d3-9be4-525400d985e7}'; + {$EXTERNALSYM DPVCTGUID_GSM} + + // MS-PCM 64 kbit/s + // + // {8DE12FD4-7CB3-48ce-A7E8-9C47A22E8AC5} + DPVCTGUID_NONE: TGUID = '{8de12fd4-7cb3-48ce-a7e8-9c47a22e8ac5}'; + {$EXTERNALSYM DPVCTGUID_NONE} + + // Voxware SC03 3.2kbit/s + // + // {7D82A29B-2242-4f82-8F39-5D1153DF3E41} + DPVCTGUID_SC03: TGUID = '{7d82a29b-2242-4f82-8f39-5d1153df3e41}'; + {$EXTERNALSYM DPVCTGUID_SC03} + + // Voxware SC06 6.4kbit/s + // + // {53DEF900-7168-4633-B47F-D143916A13C7} + DPVCTGUID_SC06: TGUID = '{53def900-7168-4633-b47f-d143916a13c7}'; + {$EXTERNALSYM DPVCTGUID_SC06} + + // TrueSpeech(TM) 8.6 kbit/s + // + // {D7954361-5A0B-11d3-9BE4-525400D985E7} + DPVCTGUID_TRUESPEECH: TGUID = '{d7954361-5a0b-11d3-9be4-525400d985e7}'; + {$EXTERNALSYM DPVCTGUID_TRUESPEECH} + + // Voxware VR12 1.4kbit/s + // + // {FE44A9FE-8ED4-48bf-9D66-1B1ADFF9FF6D} + DPVCTGUID_VR12: TGUID = '{fe44a9fe-8ed4-48bf-9d66-1b1adff9ff6d}'; + {$EXTERNALSYM DPVCTGUID_VR12} + + // Define the default compression type + DPVCTGUID_DEFAULT: TGUID = '{7d82a29b-2242-4f82-8f39-5d1153df3e41}'; // DPVCTGUID_SC03; + {$EXTERNALSYM DPVCTGUID_DEFAULT} + +(**************************************************************************** + * + * DirectPlayVoice Callback Functions + * + ****************************************************************************) + +type + TDVMessageHandler = function(pvUserContext: Pointer; dwMessageType: DWORD; lpMessage: Pointer): HResult; stdcall; + {$NODEFINE TDVMessageHandler} + {$HPPEMIT 'typedef PDVMESSAGEHANDLER TDVMessageHandler;'} + +(**************************************************************************** + * + * DirectPlayVoice Datatypes (Non-Structure / Non-Message) + * + ****************************************************************************) + + PDVID = ^DVID; + DVID = DWORD; + {$EXTERNALSYM DVID} + TDVID = DVID; + +(**************************************************************************** + * + * DirectPlayVoice Message Types + * + ****************************************************************************) + +const + DVMSGID_BASE = $0000; + {$EXTERNALSYM DVMSGID_BASE} + + DVMSGID_CREATEVOICEPLAYER = (DVMSGID_BASE+$0001); + {$EXTERNALSYM DVMSGID_CREATEVOICEPLAYER} + DVMSGID_DELETEVOICEPLAYER = (DVMSGID_BASE+$0002); + {$EXTERNALSYM DVMSGID_DELETEVOICEPLAYER} + DVMSGID_SESSIONLOST = (DVMSGID_BASE+$0003); + {$EXTERNALSYM DVMSGID_SESSIONLOST} + DVMSGID_PLAYERVOICESTART = (DVMSGID_BASE+$0004); + {$EXTERNALSYM DVMSGID_PLAYERVOICESTART} + DVMSGID_PLAYERVOICESTOP = (DVMSGID_BASE+$0005); + {$EXTERNALSYM DVMSGID_PLAYERVOICESTOP} + DVMSGID_RECORDSTART = (DVMSGID_BASE+$0006); + {$EXTERNALSYM DVMSGID_RECORDSTART} + DVMSGID_RECORDSTOP = (DVMSGID_BASE+$0007); + {$EXTERNALSYM DVMSGID_RECORDSTOP} + DVMSGID_CONNECTRESULT = (DVMSGID_BASE+$0008); + {$EXTERNALSYM DVMSGID_CONNECTRESULT} + DVMSGID_DISCONNECTRESULT = (DVMSGID_BASE+$0009); + {$EXTERNALSYM DVMSGID_DISCONNECTRESULT} + DVMSGID_INPUTLEVEL = (DVMSGID_BASE+$000A); + {$EXTERNALSYM DVMSGID_INPUTLEVEL} + DVMSGID_OUTPUTLEVEL = (DVMSGID_BASE+$000B); + {$EXTERNALSYM DVMSGID_OUTPUTLEVEL} + DVMSGID_HOSTMIGRATED = (DVMSGID_BASE+$000C); + {$EXTERNALSYM DVMSGID_HOSTMIGRATED} + DVMSGID_SETTARGETS = (DVMSGID_BASE+$000D); + {$EXTERNALSYM DVMSGID_SETTARGETS} + DVMSGID_PLAYEROUTPUTLEVEL = (DVMSGID_BASE+$000E); + {$EXTERNALSYM DVMSGID_PLAYEROUTPUTLEVEL} + DVMSGID_LOSTFOCUS = (DVMSGID_BASE+$0010); + {$EXTERNALSYM DVMSGID_LOSTFOCUS} + DVMSGID_GAINFOCUS = (DVMSGID_BASE+$0011); + {$EXTERNALSYM DVMSGID_GAINFOCUS} + DVMSGID_LOCALHOSTSETUP = (DVMSGID_BASE+$0012); + {$EXTERNALSYM DVMSGID_LOCALHOSTSETUP} + DVMSGID_MAXBASE = (DVMSGID_LOCALHOSTSETUP); + {$EXTERNALSYM DVMSGID_MAXBASE} + DVMSGID_MINBASE = (DVMSGID_CREATEVOICEPLAYER); + {$EXTERNALSYM DVMSGID_MINBASE} + +(**************************************************************************** + * + * DirectPlayVoice Constants + * + ****************************************************************************) + + // + // Buffer Aggresiveness Value Ranges + // + DVBUFFERAGGRESSIVENESS_MIN = $00000001; + {$EXTERNALSYM DVBUFFERAGGRESSIVENESS_MIN} + DVBUFFERAGGRESSIVENESS_MAX = $00000064; + {$EXTERNALSYM DVBUFFERAGGRESSIVENESS_MAX} + DVBUFFERAGGRESSIVENESS_DEFAULT = $00000000; + {$EXTERNALSYM DVBUFFERAGGRESSIVENESS_DEFAULT} + + // + // Buffer Quality Value Ranges + // + DVBUFFERQUALITY_MIN = $00000001; + {$EXTERNALSYM DVBUFFERQUALITY_MIN} + DVBUFFERQUALITY_MAX = $00000064; + {$EXTERNALSYM DVBUFFERQUALITY_MAX} + DVBUFFERQUALITY_DEFAULT = $00000000; + {$EXTERNALSYM DVBUFFERQUALITY_DEFAULT} + + DVID_SYS = 0; + {$EXTERNALSYM DVID_SYS} + + // + // Used to identify the session host in client/server + // + DVID_SERVERPLAYER = 1; + {$EXTERNALSYM DVID_SERVERPLAYER} + + // + // Used to target all players + // + DVID_ALLPLAYERS = 0; + {$EXTERNALSYM DVID_ALLPLAYERS} + + // + // Used to identify the main buffer + // + DVID_REMAINING = $FFFFFFFF; + {$EXTERNALSYM DVID_REMAINING} + + // + // Input level range + // + DVINPUTLEVEL_MIN = $00000000; + {$EXTERNALSYM DVINPUTLEVEL_MIN} + DVINPUTLEVEL_MAX = $00000063; // 99 decimal + {$EXTERNALSYM DVINPUTLEVEL_MAX} + + DVNOTIFYPERIOD_MINPERIOD = 20; + {$EXTERNALSYM DVNOTIFYPERIOD_MINPERIOD} + + + DVPLAYBACKVOLUME_DEFAULT = DSBVOLUME_MAX; + {$EXTERNALSYM DVPLAYBACKVOLUME_DEFAULT} + + DVRECORDVOLUME_LAST = $00000001; + {$EXTERNALSYM DVRECORDVOLUME_LAST} + + + // + // Use the default value + // + DVTHRESHOLD_DEFAULT = $FFFFFFFF; + {$EXTERNALSYM DVTHRESHOLD_DEFAULT} + + // + // Threshold Ranges + // + DVTHRESHOLD_MIN = $00000000; + {$EXTERNALSYM DVTHRESHOLD_MIN} + DVTHRESHOLD_MAX = $00000063; // 99 decimal + {$EXTERNALSYM DVTHRESHOLD_MAX} + + // + // Threshold field is not used + // + DVTHRESHOLD_UNUSED = $FFFFFFFE; + {$EXTERNALSYM DVTHRESHOLD_UNUSED} + + // + // Session Types + // + DVSESSIONTYPE_PEER = $00000001; + {$EXTERNALSYM DVSESSIONTYPE_PEER} + DVSESSIONTYPE_MIXING = $00000002; + {$EXTERNALSYM DVSESSIONTYPE_MIXING} + DVSESSIONTYPE_FORWARDING = $00000003; + {$EXTERNALSYM DVSESSIONTYPE_FORWARDING} + DVSESSIONTYPE_ECHO = $00000004; + {$EXTERNALSYM DVSESSIONTYPE_ECHO} + +(**************************************************************************** + * + * DirectPlayVoice Flags + * + ****************************************************************************) + + + // + // Enable automatic adjustment of the recording volume + // + DVCLIENTCONFIG_AUTORECORDVOLUME = $00000008; + {$EXTERNALSYM DVCLIENTCONFIG_AUTORECORDVOLUME} + + // + // Enable automatic voice activation + // + DVCLIENTCONFIG_AUTOVOICEACTIVATED = $00000020; + {$EXTERNALSYM DVCLIENTCONFIG_AUTOVOICEACTIVATED} + + // + // Enable echo suppression + // + DVCLIENTCONFIG_ECHOSUPPRESSION = $08000000; + {$EXTERNALSYM DVCLIENTCONFIG_ECHOSUPPRESSION} + + // + // Voice Activation manual mode + // + DVCLIENTCONFIG_MANUALVOICEACTIVATED = $00000004; + {$EXTERNALSYM DVCLIENTCONFIG_MANUALVOICEACTIVATED} + + // + // Only playback voices that have buffers created for them + // + DVCLIENTCONFIG_MUTEGLOBAL = $00000010; + {$EXTERNALSYM DVCLIENTCONFIG_MUTEGLOBAL} + + // + // Mute the playback + // + DVCLIENTCONFIG_PLAYBACKMUTE = $00000002; + {$EXTERNALSYM DVCLIENTCONFIG_PLAYBACKMUTE} + + // + // Mute the recording + // + DVCLIENTCONFIG_RECORDMUTE = $00000001; + {$EXTERNALSYM DVCLIENTCONFIG_RECORDMUTE} + + // + // Complete the operation before returning + // + DVFLAGS_SYNC = $00000001; + {$EXTERNALSYM DVFLAGS_SYNC} + + // + // Just check to see if wizard has been run, and if so what it's results were + // + DVFLAGS_QUERYONLY = $00000002; + {$EXTERNALSYM DVFLAGS_QUERYONLY} + + // + // Shutdown the voice session without migrating the host + // + DVFLAGS_NOHOSTMIGRATE = $00000008; + {$EXTERNALSYM DVFLAGS_NOHOSTMIGRATE} + + // + // Allow the back button to be enabled in the wizard + // + DVFLAGS_ALLOWBACK = $00000010; + {$EXTERNALSYM DVFLAGS_ALLOWBACK} + + // + // Disable host migration in the voice session + // + DVSESSION_NOHOSTMIGRATION = $00000001; + {$EXTERNALSYM DVSESSION_NOHOSTMIGRATION} + + // + // Server controlled targetting + // + DVSESSION_SERVERCONTROLTARGET = $00000002; + {$EXTERNALSYM DVSESSION_SERVERCONTROLTARGET} + + // + // Use DirectSound Normal Mode instead of priority + // + DVSOUNDCONFIG_NORMALMODE = $00000001; + {$EXTERNALSYM DVSOUNDCONFIG_NORMALMODE} + + // + // Automatically select the microphone + // + DVSOUNDCONFIG_AUTOSELECT = $00000002; + {$EXTERNALSYM DVSOUNDCONFIG_AUTOSELECT} + + // + // Run in half duplex mode + // + DVSOUNDCONFIG_HALFDUPLEX = $00000004; + {$EXTERNALSYM DVSOUNDCONFIG_HALFDUPLEX} + + // + // No volume controls are available for the recording device + // + DVSOUNDCONFIG_NORECVOLAVAILABLE = $00000010; + {$EXTERNALSYM DVSOUNDCONFIG_NORECVOLAVAILABLE} + + // + // Disable capture sharing + // + DVSOUNDCONFIG_NOFOCUS = $20000000; + {$EXTERNALSYM DVSOUNDCONFIG_NOFOCUS} + + // + // Set system conversion quality to high + // + DVSOUNDCONFIG_SETCONVERSIONQUALITY = $00000008; + {$EXTERNALSYM DVSOUNDCONFIG_SETCONVERSIONQUALITY} + + // + // Enable strict focus mode + // + DVSOUNDCONFIG_STRICTFOCUS = $40000000; + {$EXTERNALSYM DVSOUNDCONFIG_STRICTFOCUS} + + // + // Player is in half duplex mode + // + DVPLAYERCAPS_HALFDUPLEX = $00000001; + {$EXTERNALSYM DVPLAYERCAPS_HALFDUPLEX} + + // + // Specifies that player is the local player + // + DVPLAYERCAPS_LOCAL = $00000002; + {$EXTERNALSYM DVPLAYERCAPS_LOCAL} + + +type +(**************************************************************************** + * + * DirectPlayVoice Interface Pointer definitions + * + ****************************************************************************) + + IDirectPlayVoiceServer = interface; + +(**************************************************************************** + * + * DirectPlayVoice Structures (Non-Message) + * + ****************************************************************************) + + + // + // DirectPlayVoice Caps + // (GetCaps / SetCaps) + // + PDVCaps = ^TDVCaps; + DVCAPS = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Caps flags + end; + {$EXTERNALSYM DVCAPS} + TDVCaps = DVCAPS; + + // + // DirectPlayVoice Client Configuration + // (Connect / GetClientConfig) + // + PDVClientConfig = ^TDVClientConfig; + DVCLIENTCONFIG = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Flags for client config (DVCLIENTCONFIG_...) + lRecordVolume: Longint; // Recording volume + lPlaybackVolume: Longint; // Playback volume + dwThreshold: DWORD; // Voice Activation Threshold + dwBufferQuality: DWORD; // Buffer quality + dwBufferAggressiveness: DWORD; // Buffer aggressiveness + dwNotifyPeriod: DWORD; // Period of notification messages (ms) + end; + {$EXTERNALSYM DVCLIENTCONFIG} + TDVClientConfig = DVCLIENTCONFIG; + + // + // DirectPlayVoice Compression Type Information + // (GetCompressionTypes) + // + PDVCompressionInfo = ^TDVCompressionInfo; + DVCOMPRESSIONINFO = packed record + dwSize: DWORD; // Size of this structure + guidType: TGUID; // GUID that identifies this compression type + lpszName: PWideChar; // String name of this compression type + lpszDescription: PWideChar; // Description for this compression type + dwFlags: DWORD; // Flags for this compression type + dwMaxBitsPerSecond: DWORD; // Maximum # of bit/s this compression type uses + end; + {$EXTERNALSYM DVCOMPRESSIONINFO} + TDVCompressionInfo = DVCOMPRESSIONINFO; + + // + // DirectPlayVoice Session Description + // (Host / GetSessionDesc) + // + PDVSessionDesc = ^TDVSessionDesc; + DVSESSIONDESC = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Session flags (DVSESSION_...) + dwSessionType: DWORD; // Session type (DVSESSIONTYPE_...) + guidCT: TGUID; // Compression Type to use + dwBufferQuality: DWORD; // Buffer quality + dwBufferAggressiveness: DWORD; // Buffer aggresiveness + end; + {$EXTERNALSYM DVSESSIONDESC} + TDVSessionDesc = DVSESSIONDESC; + + // + // DirectPlayVoice Client Sound Device Configuration + // (Connect / GetSoundDeviceConfig) + // + PDVSoundDeviceConfig = ^TDVSoundDeviceConfig; + DVSOUNDDEVICECONFIG = packed record + dwSize: DWORD; // Size of this structure + dwFlags: DWORD; // Flags for sound config (DVSOUNDCONFIG_...) + guidPlaybackDevice: TGUID; // GUID of the playback device to use + lpdsPlaybackDevice: IDirectSound; // DirectSound Object to use (optional) + guidCaptureDevice: TGUID; // GUID of the capture device to use + lpdsCaptureDevice: IDirectSoundCapture; // DirectSoundCapture Object to use (optional) + hwndAppWindow: HWND; // HWND of your application's top-level window + lpdsMainBuffer: IDirectSoundBuffer; // DirectSoundBuffer to use for playback (optional) + dwMainBufferFlags: DWORD; // Flags to pass to Play() on the main buffer + dwMainBufferPriority: DWORD; // Priority to set when calling Play() on the main buffer + end; + {$EXTERNALSYM DVSOUNDDEVICECONFIG} + TDVSoundDeviceConfig = DVSOUNDDEVICECONFIG; + +(**************************************************************************** + * + * DirectPlayVoice message handler call back structures + * + ****************************************************************************) + + // + // Result of the Connect() call. (If it wasn't called Async) + // (DVMSGID_CONNECTRESULT) + // + PDVMsgConnectResult = ^TDVMsgConnectResult; + DVMSG_CONNECTRESULT = packed record + dwSize: DWORD; // Size of this structure + hrResult: HRESULT; // Result of the Connect() call + end; + {$EXTERNALSYM DVMSG_CONNECTRESULT} + TDVMsgConnectResult = DVMSG_CONNECTRESULT; + + // + // A new player has entered the voice session + // (DVMSGID_CREATEVOICEPLAYER) + // + PDVMsgCreateVoicePlayer = ^TDVMsgCreateVoicePlayer; + DVMSG_CREATEVOICEPLAYER = packed record + dwSize: DWORD; // Size of this structure + dvidPlayer: TDVID; // DVID of the player who joined + dwFlags: DWORD; // Player flags (DVPLAYERCAPS_...) + pvPlayerContext: Pointer; // Context value for this player (user set) + end; + {$EXTERNALSYM DVMSG_CREATEVOICEPLAYER} + TDVMsgCreateVoicePlayer = DVMSG_CREATEVOICEPLAYER; + + // + // A player has left the voice session + // (DVMSGID_DELETEVOICEPLAYER) + // + PDVMsgDeleteVoicePlayer = ^TDVMsgDeleteVoicePlayer; + DVMSG_DELETEVOICEPLAYER = packed record + dwSize: DWORD; // Size of this structure + dvidPlayer: TDVID; // DVID of the player who left + pvPlayerContext: Pointer; // Context value for the player + end; + {$EXTERNALSYM DVMSG_DELETEVOICEPLAYER} + TDVMsgDeleteVoicePlayer = DVMSG_DELETEVOICEPLAYER; + + // + // Result of the Disconnect() call. (If it wasn't called Async) + // (DVMSGID_DISCONNECTRESULT) + // + PDVMsgDisconnectResult = ^TDVMsgDisconnectResult; + DVMSG_DISCONNECTRESULT = packed record + dwSize: DWORD; // Size of this structure + hrResult: HRESULT; // Result of the Disconnect() call + end; + {$EXTERNALSYM DVMSG_DISCONNECTRESULT} + TDVMsgDisconnectResult = DVMSG_DISCONNECTRESULT; + + // + // The voice session host has migrated. + // (DVMSGID_HOSTMIGRATED) + // + PDVMsgHostMigrated = ^TDVMsgHostMigrated; + DVMSG_HOSTMIGRATED = packed record + dwSize: DWORD; // Size of this structure + dvidNewHostID: TDVID; // DVID of the player who is now the host + pdvServerInterface: IDirectPlayVoiceServer; // Pointer to the new host object (if local player is now host) + end; + {$EXTERNALSYM DVMSG_HOSTMIGRATED} + TDVMsgHostMigrated = DVMSG_HOSTMIGRATED; + + // + // The current input level / recording volume on the local machine + // (DVMSGID_INPUTLEVEL) + // + PDVMsgInputlevel = ^TDVMsgInputlevel; + DVMSG_INPUTLEVEL = packed record + dwSize: DWORD; // Size of this structure + dwPeakLevel: DWORD; // Current peak level of the audio + lRecordVolume: Longint; // Current recording volume + pvLocalPlayerContext: Pointer; // Context value for the local player + end; + {$EXTERNALSYM DVMSG_INPUTLEVEL} + TDVMsgInputlevel = DVMSG_INPUTLEVEL; + + // + // The local client is about to become the new host + // (DVMSGID_LOCALHOSTSETUP) + // + PDVMsgLocalHostSetup = ^TDVMsgLocalHostSetup; + DVMSG_LOCALHOSTSETUP = packed record + dwSize: DWORD; // Size of this structure + pvContext: Pointer; // Context value to be passed to Initialize() of new host object + pMessageHandler: TDVMessageHandler; // Message handler to be used by new host object + end; + {$EXTERNALSYM DVMSG_LOCALHOSTSETUP} + TDVMsgLocalHostSetup = DVMSG_LOCALHOSTSETUP; + + // + // The current output level for the combined output of all incoming streams. + // (DVMSGID_OUTPUTLEVEL) + // + PDVMsgOutputLevel = ^TDVMsgOutputLevel; + DVMSG_OUTPUTLEVEL = packed record + dwSize: DWORD; // Size of this structure + dwPeakLevel: DWORD; // Current peak level of the output + lOutputVolume: Longint; // Current playback volume + pvLocalPlayerContext: Pointer; // Context value for the local player + end; + {$EXTERNALSYM DVMSG_OUTPUTLEVEL} + TDVMsgOutputLevel = DVMSG_OUTPUTLEVEL; + + // + // The current peak level of an individual player's incoming audio stream as it is + // being played back. + // (DVMSGID_PLAYEROUTPUTLEVEL) + // + PDVMsgPlayerOutputLevel = ^TDVMsgPlayerOutputLevel; + DVMSG_PLAYEROUTPUTLEVEL = packed record + dwSize: DWORD; // Size of this structure + dvidSourcePlayerID: TDVID; // DVID of the player + dwPeakLevel: DWORD; // Peak level of the player's stream + pvPlayerContext: Pointer; // Context value for the player + end; + {$EXTERNALSYM DVMSG_PLAYEROUTPUTLEVEL} + TDVMsgPlayerOutputLevel = DVMSG_PLAYEROUTPUTLEVEL; + + // + // An audio stream from the specified player has started playing back on the local client. + // (DVMSGID_PLAYERVOICESTART). + // + PDVMsgPlayerVoiceStart = ^TDVMsgPlayerVoiceStart; + DVMSG_PLAYERVOICESTART = packed record + dwSize: DWORD; // Size of this structure + dvidSourcePlayerID: TDVID; // DVID of the Player + pvPlayerContext: Pointer; // Context value for this player + end; + {$EXTERNALSYM DVMSG_PLAYERVOICESTART} + TDVMsgPlayerVoiceStart = DVMSG_PLAYERVOICESTART; + + // + // The audio stream from the specified player has stopped playing back on the local client. + // (DVMSGID_PLAYERVOICESTOP) + // + PDVMsgPlayerVoiceStop = ^TDVMsgPlayerVoiceStop; + DVMSG_PLAYERVOICESTOP = packed record + dwSize: DWORD; // Size of this structure + dvidSourcePlayerID: DVID; // DVID of the player + pvPlayerContext: Pointer; // Context value for this player + end; + {$EXTERNALSYM DVMSG_PLAYERVOICESTOP} + TDVMsgPlayerVoiceStop = DVMSG_PLAYERVOICESTOP; + + // + // Transmission has started on the local machine + // (DVMSGID_RECORDSTART) + // + PDVMsgRecordStart = ^TDVMsgRecordStart; + DVMSG_RECORDSTART = packed record + dwSize: DWORD; // Size of this structure + dwPeakLevel: DWORD; // Peak level that caused transmission to start + pvLocalPlayerContext: Pointer; // Context value for the local player + end; + {$EXTERNALSYM DVMSG_RECORDSTART} + TDVMsgRecordStart = DVMSG_RECORDSTART; + + // + // Transmission has stopped on the local machine + // (DVMSGID_RECORDSTOP) + // + PDVMsgRecordStop = ^TDVMsgRecordStop; + DVMSG_RECORDSTOP = packed record + dwSize: DWORD; // Size of this structure + dwPeakLevel: DWORD; // Peak level that caused transmission to stop + pvLocalPlayerContext: Pointer; // Context value for the local player + end; + {$EXTERNALSYM DVMSG_RECORDSTOP} + TDVMsgRecordStop = DVMSG_RECORDSTOP; + + // + // The voice session has been lost + // (DVMSGID_SESSIONLOST) + // + PDVMsgSessionLost = ^TDVMsgSessionLost; + DVMSG_SESSIONLOST = packed record + dwSize: DWORD; // Size of this structure + hrResult: HRESULT; // Reason the session was disconnected + end; + {$EXTERNALSYM DVMSG_SESSIONLOST} + TDVMsgSessionLost = DVMSG_SESSIONLOST; + + // + // The target list has been updated for the local client + // (DVMSGID_SETTARGETS) + // + PDVMsgSetTargets = ^TDVMsgSetTargets; + DVMSG_SETTARGETS = packed record + dwSize: DWORD; // Size of this structure + dwNumTargets: DWORD; // # of targets + pdvidTargets: PDVID; // An array of DVIDs specifying the current targets + end; + {$EXTERNALSYM DVMSG_SETTARGETS} + TDVMsgSetTargets = DVMSG_SETTARGETS; + + +(**************************************************************************** + * + * DirectPlayVoice Functions + * + ****************************************************************************) + +(* + * + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay voice objects. + * + * extern HRESULT WINAPI DirectPlayVoiceCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + *) + +(**************************************************************************** + * + * DirectPlay8 Application Interfaces + * + ****************************************************************************) + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlayVoiceClient);'} + {$EXTERNALSYM IDirectPlayVoiceClient} + IDirectPlayVoiceClient = interface(IUnknown) + ['{1dfdc8ea-bcf7-41d6-b295-ab64b3b23306}'] + (*** IDirectPlayVoiceClient methods ***) + function Initialize(pVoid: IUnknown; pMessageHandler: TDVMessageHandler; + pUserContext: Pointer; pdwMessageMask: PDWORD; dwMessageMaskElements: DWORD): HResult; stdcall; + function Connect(const pSoundDeviceConfig: TDVSoundDeviceConfig; + const pdvClientConfig: TDVClientConfig; dwFlags: DWORD): HResult; stdcall; + function Disconnect(dwFlags: DWORD): HResult; stdcall; + function GetSessionDesc(out pvSessionDesc: TDVSessionDesc): HResult; stdcall; + function GetClientConfig(out pClientConfig: TDVClientConfig): HResult; stdcall; + function SetClientConfig(const pClientConfig: TDVClientConfig): HResult; stdcall; + function GetCaps(out pDVCaps: TDVCaps): HResult; stdcall; + function GetCompressionTypes(pData: Pointer; var pdwDataSize: DWORD; + out pdwNumElements: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetTransmitTargets(pdvIDTargets: PDVID; dwNumTargets, dwFlags: DWORD): HResult; stdcall; + function GetTransmitTargets(pdvIDTargets: PDVID; var dwNumTargets: DWORD; dwFlags: DWORD): HResult; stdcall; + function Create3DSoundBuffer(dvID: TDVID; lpdsSourceBuffer: IDirectSoundBuffer; + dwPriority, dwFlags: DWORD; out lpUserBuffer: IDirectSound3DBuffer): HResult; stdcall; + function Delete3DSoundBuffer(dvID: TDVID; lpUserBuffer: IDirectSound3DBuffer): HResult; stdcall; + function SetNotifyMask(pdwMessageMask: PDWORD; dwMessageMaskElements: DWORD): HResult; stdcall; + function GetSoundDeviceConfig(pSoundDeviceConfig: PDVSoundDeviceConfig; var pdwSize: DWORD): HResult; stdcall; + end; + + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlayVoiceServer);'} + {$EXTERNALSYM IDirectPlayVoiceServer} + IDirectPlayVoiceServer = interface(IUnknown) + ['{faa1c173-0468-43b6-8a2a-ea8a4f2076c9}'] + (*** IDirectPlayVoiceServer methods ***) + function Initialize(pVoid: IUnknown; pMessageHandler: TDVMessageHandler; + pUserContext: Pointer; pdwMessageMask: PDWORD; dwMessageMaskElements: DWORD): HResult; stdcall; + function StartSession(const pSessionDesc: TDVSessionDesc; dwFlags: DWORD): HResult; stdcall; + function StopSession(dwFlags: DWORD): HResult; stdcall; + function GetSessionDesc(out pvSessionDesc: TDVSessionDesc): HResult; stdcall; + function SetSessionDesc(const pvSessionDesc: TDVSessionDesc): HResult; stdcall; + function GetCaps(out pDVCaps: TDVCaps): HResult; stdcall; + function GetCompressionTypes(pData: Pointer; var pdwDataSize: DWORD; + out pdwNumElements: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetTransmitTargets(dvSource: TDVID; pdvIDTargets: PDVID; + dwNumTargets, dwFlags: DWORD): HResult; stdcall; + function GetTransmitTargets(dvSource: TDVID; pdvIDTargets: PDVID; + var dwNumTargets: DWORD; dwFlags: DWORD): HResult; stdcall; + function SetNotifyMask(pdwMessageMask: PDWORD; dwMessageMaskElements: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectPlayVoiceTest);'} + {$EXTERNALSYM IDirectPlayVoiceTest} + IDirectPlayVoiceTest = interface(IUnknown) + ['{d26af734-208b-41da-8224-e0ce79810be1}'] + (*** IDirectPlayVoiceTest methods ***) + function CheckAudioSetup(pguidPlaybackDevice, pguidCaptureDevice: PGUID; + hwndParent: hWND; dwFlags: DWORD): HResult; stdcall; + end; + +(**************************************************************************** + * + * DirectPlayVoice Interface IIDs + * + ****************************************************************************) + + // {1DFDC8EA-BCF7-41d6-B295-AB64B3B23306} + IID_IDirectPlayVoiceClient = IDirectPlayVoiceClient; + {$EXTERNALSYM IID_IDirectPlayVoiceClient} + + // {FAA1C173-0468-43b6-8A2A-EA8A4F2076C9} + IID_IDirectPlayVoiceServer = IDirectPlayVoiceServer; + {$EXTERNALSYM IID_IDirectPlayVoiceServer} + + // {D26AF734-208B-41da-8224-E0CE79810BE1} + IID_IDirectPlayVoiceTest = IDirectPlayVoiceTest; + {$EXTERNALSYM IID_IDirectPlayVoiceTest} + + +(**************************************************************************** + * + * DIRECTPLAYVOICE ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************) + +const + _FACDPV = $15; + {$EXTERNALSYM _FACDPV} + +//#define MAKE_DVHRESULT( code ) MAKE_HRESULT( 1, _FACDPV, code ) + +(* +#define DV_FULLDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x0005 ) +#define DV_HALFDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x000A ) +#define DV_PENDING MAKE_HRESULT( 0, _FACDPV, 0x0010 ) + +#define DVERR_BUFFERTOOSMALL MAKE_DVHRESULT( 0x001E ) +#define DVERR_EXCEPTION MAKE_DVHRESULT( 0x004A ) +#define DVERR_GENERIC E_FAIL +#define DVERR_INVALIDFLAGS MAKE_DVHRESULT( 0x0078 ) +#define DVERR_INVALIDOBJECT MAKE_DVHRESULT( 0x0082 ) +#define DVERR_INVALIDPARAM E_INVALIDARG +#define DVERR_INVALIDPLAYER MAKE_DVHRESULT( 0x0087 ) +#define DVERR_INVALIDGROUP MAKE_DVHRESULT( 0x0091 ) +#define DVERR_INVALIDHANDLE MAKE_DVHRESULT( 0x0096 ) +#define DVERR_OUTOFMEMORY E_OUTOFMEMORY +#define DVERR_PENDING DV_PENDING +#define DVERR_NOTSUPPORTED E_NOTIMPL +#define DVERR_NOINTERFACE E_NOINTERFACE +#define DVERR_SESSIONLOST MAKE_DVHRESULT( 0x012C ) +#define DVERR_NOVOICESESSION MAKE_DVHRESULT( 0x012E ) +#define DVERR_CONNECTIONLOST MAKE_DVHRESULT( 0x0168 ) +#define DVERR_NOTINITIALIZED MAKE_DVHRESULT( 0x0169 ) +#define DVERR_CONNECTED MAKE_DVHRESULT( 0x016A ) +#define DVERR_NOTCONNECTED MAKE_DVHRESULT( 0x016B ) +#define DVERR_CONNECTABORTING MAKE_DVHRESULT( 0x016E ) +#define DVERR_NOTALLOWED MAKE_DVHRESULT( 0x016F ) +#define DVERR_INVALIDTARGET MAKE_DVHRESULT( 0x0170 ) +#define DVERR_TRANSPORTNOTHOST MAKE_DVHRESULT( 0x0171 ) +#define DVERR_COMPRESSIONNOTSUPPORTED MAKE_DVHRESULT( 0x0172 ) +#define DVERR_ALREADYPENDING MAKE_DVHRESULT( 0x0173 ) +#define DVERR_SOUNDINITFAILURE MAKE_DVHRESULT( 0x0174 ) +#define DVERR_TIMEOUT MAKE_DVHRESULT( 0x0175 ) +#define DVERR_CONNECTABORTED MAKE_DVHRESULT( 0x0176 ) +#define DVERR_NO3DSOUND MAKE_DVHRESULT( 0x0177 ) +#define DVERR_ALREADYBUFFERED MAKE_DVHRESULT( 0x0178 ) +#define DVERR_NOTBUFFERED MAKE_DVHRESULT( 0x0179 ) +#define DVERR_HOSTING MAKE_DVHRESULT( 0x017A ) +#define DVERR_NOTHOSTING MAKE_DVHRESULT( 0x017B ) +#define DVERR_INVALIDDEVICE MAKE_DVHRESULT( 0x017C ) +#define DVERR_RECORDSYSTEMERROR MAKE_DVHRESULT( 0x017D ) +#define DVERR_PLAYBACKSYSTEMERROR MAKE_DVHRESULT( 0x017E ) +#define DVERR_SENDERROR MAKE_DVHRESULT( 0x017F ) +#define DVERR_USERCANCEL MAKE_DVHRESULT( 0x0180 ) +#define DVERR_RUNSETUP MAKE_DVHRESULT( 0x0183 ) +#define DVERR_INCOMPATIBLEVERSION MAKE_DVHRESULT( 0x0184 ) +#define DVERR_INITIALIZED MAKE_DVHRESULT( 0x0187 ) +#define DVERR_INVALIDPOINTER E_POINTER +#define DVERR_NOTRANSPORT MAKE_DVHRESULT( 0x0188 ) +#define DVERR_NOCALLBACK MAKE_DVHRESULT( 0x0189 ) +#define DVERR_TRANSPORTNOTINIT MAKE_DVHRESULT( 0x018A ) +#define DVERR_TRANSPORTNOSESSION MAKE_DVHRESULT( 0x018B ) +#define DVERR_TRANSPORTNOPLAYER MAKE_DVHRESULT( 0x018C ) +#define DVERR_USERBACK MAKE_DVHRESULT( 0x018D ) +#define DVERR_NORECVOLAVAILABLE MAKE_DVHRESULT( 0x018E ) +#define DVERR_INVALIDBUFFER MAKE_DVHRESULT( 0x018F ) +#define DVERR_LOCKEDBUFFER MAKE_DVHRESULT( 0x0190 ) +*) + + MAKE_DVHRESULT_R = (1 shl 31) or (_FACDPV shl 16); + + DV_OK = S_OK; + {$EXTERNALSYM DV_OK} + DV_FULLDUPLEX = (0 shl 31) or (_FACDPV shl 16) or $0005; + {$EXTERNALSYM DV_FULLDUPLEX} + DV_HALFDUPLEX = (0 shl 31) or (_FACDPV shl 16) or $000A; + {$EXTERNALSYM DV_HALFDUPLEX} + DV_PENDING = (0 shl 31) or (_FACDPV shl 16) or $0010; + {$EXTERNALSYM DV_PENDING} + + DVERR_BUFFERTOOSMALL = MAKE_DVHRESULT_R + $001E ; + {$EXTERNALSYM DVERR_BUFFERTOOSMALL} + DVERR_EXCEPTION = MAKE_DVHRESULT_R + $004A ; + {$EXTERNALSYM DVERR_EXCEPTION} + DVERR_GENERIC = E_FAIL; + {$EXTERNALSYM DVERR_GENERIC} + DVERR_INVALIDFLAGS = MAKE_DVHRESULT_R + $0078 ; + {$EXTERNALSYM DVERR_INVALIDFLAGS} + DVERR_INVALIDOBJECT = MAKE_DVHRESULT_R + $0082 ; + {$EXTERNALSYM DVERR_INVALIDOBJECT} + DVERR_INVALIDPARAM = E_INVALIDARG; + {$EXTERNALSYM DVERR_INVALIDPARAM} + DVERR_INVALIDPLAYER = MAKE_DVHRESULT_R + $0087 ; + {$EXTERNALSYM DVERR_INVALIDPLAYER} + DVERR_INVALIDGROUP = MAKE_DVHRESULT_R + $0091 ; + {$EXTERNALSYM DVERR_INVALIDGROUP} + DVERR_INVALIDHANDLE = MAKE_DVHRESULT_R + $0096 ; + {$EXTERNALSYM DVERR_INVALIDHANDLE} + DVERR_OUTOFMEMORY = E_OUTOFMEMORY; + {$EXTERNALSYM DVERR_OUTOFMEMORY} + DVERR_PENDING = DV_PENDING; + {$EXTERNALSYM DVERR_PENDING} + DVERR_NOTSUPPORTED = E_NOTIMPL; + {$EXTERNALSYM DVERR_NOTSUPPORTED} + DVERR_NOINTERFACE = E_NOINTERFACE; + {$EXTERNALSYM DVERR_NOINTERFACE} + DVERR_SESSIONLOST = MAKE_DVHRESULT_R + $012C ; + {$EXTERNALSYM DVERR_SESSIONLOST} + DVERR_NOVOICESESSION = MAKE_DVHRESULT_R + $012E ; + {$EXTERNALSYM DVERR_NOVOICESESSION} + DVERR_CONNECTIONLOST = MAKE_DVHRESULT_R + $0168 ; + {$EXTERNALSYM DVERR_CONNECTIONLOST} + DVERR_NOTINITIALIZED = MAKE_DVHRESULT_R + $0169 ; + {$EXTERNALSYM DVERR_NOTINITIALIZED} + DVERR_CONNECTED = MAKE_DVHRESULT_R + $016A ; + {$EXTERNALSYM DVERR_CONNECTED} + DVERR_NOTCONNECTED = MAKE_DVHRESULT_R + $016B ; + {$EXTERNALSYM DVERR_NOTCONNECTED} + DVERR_CONNECTABORTING = MAKE_DVHRESULT_R + $016E ; + {$EXTERNALSYM DVERR_CONNECTABORTING} + DVERR_NOTALLOWED = MAKE_DVHRESULT_R + $016F ; + {$EXTERNALSYM DVERR_NOTALLOWED} + DVERR_INVALIDTARGET = MAKE_DVHRESULT_R + $0170 ; + {$EXTERNALSYM DVERR_INVALIDTARGET} + DVERR_TRANSPORTNOTHOST = MAKE_DVHRESULT_R + $0171 ; + {$EXTERNALSYM DVERR_TRANSPORTNOTHOST} + DVERR_COMPRESSIONNOTSUPPORTED = MAKE_DVHRESULT_R + $0172 ; + {$EXTERNALSYM DVERR_COMPRESSIONNOTSUPPORTED} + DVERR_ALREADYPENDING = MAKE_DVHRESULT_R + $0173 ; + {$EXTERNALSYM DVERR_ALREADYPENDING} + DVERR_SOUNDINITFAILURE = MAKE_DVHRESULT_R + $0174 ; + {$EXTERNALSYM DVERR_SOUNDINITFAILURE} + DVERR_TIMEOUT = MAKE_DVHRESULT_R + $0175 ; + {$EXTERNALSYM DVERR_TIMEOUT} + DVERR_CONNECTABORTED = MAKE_DVHRESULT_R + $0176 ; + {$EXTERNALSYM DVERR_CONNECTABORTED} + DVERR_NO3DSOUND = MAKE_DVHRESULT_R + $0177 ; + {$EXTERNALSYM DVERR_NO3DSOUND} + DVERR_ALREADYBUFFERED = MAKE_DVHRESULT_R + $0178 ; + {$EXTERNALSYM DVERR_ALREADYBUFFERED} + DVERR_NOTBUFFERED = MAKE_DVHRESULT_R + $0179 ; + {$EXTERNALSYM DVERR_NOTBUFFERED} + DVERR_HOSTING = MAKE_DVHRESULT_R + $017A ; + {$EXTERNALSYM DVERR_HOSTING} + DVERR_NOTHOSTING = MAKE_DVHRESULT_R + $017B ; + {$EXTERNALSYM DVERR_NOTHOSTING} + DVERR_INVALIDDEVICE = MAKE_DVHRESULT_R + $017C ; + {$EXTERNALSYM DVERR_INVALIDDEVICE} + DVERR_RECORDSYSTEMERROR = MAKE_DVHRESULT_R + $017D ; + {$EXTERNALSYM DVERR_RECORDSYSTEMERROR} + DVERR_PLAYBACKSYSTEMERROR = MAKE_DVHRESULT_R + $017E ; + {$EXTERNALSYM DVERR_PLAYBACKSYSTEMERROR} + DVERR_SENDERROR = MAKE_DVHRESULT_R + $017F ; + {$EXTERNALSYM DVERR_SENDERROR} + DVERR_USERCANCEL = MAKE_DVHRESULT_R + $0180 ; + {$EXTERNALSYM DVERR_USERCANCEL} + DVERR_RUNSETUP = MAKE_DVHRESULT_R + $0183 ; + {$EXTERNALSYM DVERR_RUNSETUP} + DVERR_INCOMPATIBLEVERSION = MAKE_DVHRESULT_R + $0184 ; + {$EXTERNALSYM DVERR_INCOMPATIBLEVERSION} + DVERR_INITIALIZED = MAKE_DVHRESULT_R + $0187 ; + {$EXTERNALSYM DVERR_INITIALIZED} + DVERR_INVALIDPOINTER = E_POINTER; + {$EXTERNALSYM DVERR_INVALIDPOINTER} + DVERR_NOTRANSPORT = MAKE_DVHRESULT_R + $0188 ; + {$EXTERNALSYM DVERR_NOTRANSPORT} + DVERR_NOCALLBACK = MAKE_DVHRESULT_R + $0189 ; + {$EXTERNALSYM DVERR_NOCALLBACK} + DVERR_TRANSPORTNOTINIT = MAKE_DVHRESULT_R + $018A ; + {$EXTERNALSYM DVERR_TRANSPORTNOTINIT} + DVERR_TRANSPORTNOSESSION = MAKE_DVHRESULT_R + $018B ; + {$EXTERNALSYM DVERR_TRANSPORTNOSESSION} + DVERR_TRANSPORTNOPLAYER = MAKE_DVHRESULT_R + $018C ; + {$EXTERNALSYM DVERR_TRANSPORTNOPLAYER} + DVERR_USERBACK = MAKE_DVHRESULT_R + $018D ; + {$EXTERNALSYM DVERR_USERBACK} + DVERR_NORECVOLAVAILABLE = MAKE_DVHRESULT_R + $018E ; + {$EXTERNALSYM DVERR_NORECVOLAVAILABLE} + DVERR_INVALIDBUFFER = MAKE_DVHRESULT_R + $018F ; + {$EXTERNALSYM DVERR_INVALIDBUFFER} + DVERR_LOCKEDBUFFER = MAKE_DVHRESULT_R + $0190 ; + {$EXTERNALSYM DVERR_LOCKEDBUFFER} + + + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +// Compatibility types for non-Borland compliant translations of DirectPlay8 // +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +type + PDvmsg_Connectresult = PDVMsgConnectResult; + TDvmsg_Connectresult = TDVMsgConnectResult; + PDvmsg_Createvoiceplayer = PDVMsgCreateVoicePlayer; + TDvmsg_Createvoiceplayer = TDVMsgCreateVoicePlayer; + PDvmsg_Deletevoiceplayer = PDVMsgDeleteVoicePlayer; + TDvmsg_Deletevoiceplayer = TDVMsgDeleteVoicePlayer; + PDvmsg_Disconnectresult = PDVMsgDisconnectResult; + TDvmsg_Disconnectresult = TDVMsgDisconnectResult; + PDvmsg_Hostmigrated = PDVMsgHostMigrated; + TDvmsg_Hostmigrated = TDVMsgHostMigrated; + PDvmsg_Inputlevel = PDVMsgInputlevel; + TDvmsg_Inputlevel = TDVMsgInputlevel; + PDvmsg_Localhostsetup = PDVMsgLocalHostSetup; + TDvmsg_Localhostsetup = TDVMsgLocalHostSetup; + PDvmsg_Outputlevel = PDVMsgOutputLevel; + TDvmsg_Outputlevel = TDVMsgOutputLevel; + PDvmsg_Playeroutputlevel = PDVMsgPlayerOutputLevel; + TDvmsg_Playeroutputlevel = TDVMsgPlayerOutputLevel; + PDvmsg_Playervoicestart = PDVMsgPlayerVoiceStart; + TDvmsg_Playervoicestart = TDVMsgPlayerVoiceStart; + PDvmsg_Playervoicestop = PDVMsgPlayerVoiceStop; + TDvmsg_Playervoicestop = TDVMsgPlayerVoiceStop; + PDvmsg_Recordstart = PDVMsgRecordStart; + TDvmsg_Recordstart = TDVMsgRecordStart; + PDvmsg_Recordstop = PDVMsgRecordStop; + TDvmsg_Recordstop = TDVMsgRecordStop; + PDvmsg_Sessionlost = PDVMsgSessionLost; + TDvmsg_Sessionlost = TDVMsgSessionLost; + PDvmsg_Settargets = PDVMsgSetTargets; + TDvmsg_Settargets = TDVMsgSetTargets; + + PDPN_Application_Desc = PDPNApplicationDesc; + TDPN_Application_Desc = TDPNApplicationDesc; + PDPN_Caps = PDPNCaps; + TDPN_Caps = TDPNCaps; + PDPN_Caps_Ex = PDPNCapsEx; + TDPN_Caps_Ex = TDPNCapsEx; + PDPN_Connection_Info = PDPNConnectionInfo; + TDPN_Connection_Info = TDPNConnectionInfo; + PDPN_Group_Info = PDPNGroupInfo; + TDPN_Group_Info = TDPNGroupInfo; + PDPN_Player_Info = PDPNPlayerInfo; + TDPN_Player_Info = TDPNPlayerInfo; + PDPN_Security_Credentials = PDPNSecurityCredentials; + TDPN_Security_Credentials = TDPNSecurityCredentials; + PDPN_Security_Desc = PDPNSecurityDesc; + TDPN_Security_Desc = TDPNSecurityDesc; + PDPN_Service_Provider_Info = PDPNServiceProviderInfo; + TDPN_Service_Provider_Info = TDPNServiceProviderInfo; + PDPN_Sp_Caps = PDPNSpCaps; + TDPN_Sp_Caps = TDPNSpCaps; + PDPNMsg_Add_Player_To_Group = PDPNMsgAddPlayerToGroup; + TDPNMsg_Add_Player_To_Group = TDPNMsgAddPlayerToGroup; + PDPNMsg_Async_Op_Complete = PDPNMsgAsyncOpComplete; + TDPNMsg_Async_Op_Complete = TDPNMsgAsyncOpComplete; + PDPNMsg_Client_Info = PDPNMsgClientInfo; + TDPNMsg_Client_Info = TDPNMsgClientInfo; + PDPNMsg_Connect_Complete = PDPNMsgConnectComplete; + TDPNMsg_Connect_Complete = TDPNMsgConnectComplete; + PDPNMsg_Create_Group = PDPNMsgCreateGroup; + TDPNMsg_Create_Group = TDPNMsgCreateGroup; + PDPNMsg_Create_Player = PDPNMsgCreatePlayer; + TDPNMsg_Create_Player = TDPNMsgCreatePlayer; + PDPNMsg_Destroy_Group = PDPNMsgDestroyGroup; + TDPNMsg_Destroy_Group = TDPNMsgDestroyGroup; + PDPNMsg_Destroy_Player = PDPNMsgDestroyPlayer; + TDPNMsg_Destroy_Player = TDPNMsgDestroyPlayer; + PDPNMsg_Enum_Hosts_Query = PDPNMsgEnumHostsQuery; + TDPNMsg_Enum_Hosts_Query = TDPNMsgEnumHostsQuery; + PDPNMsg_Enum_Hosts_Response = PDPNMsgEnumHostsResponse; + TDPNMsg_Enum_Hosts_Response = TDPNMsgEnumHostsResponse; + PDPNMsg_Group_Info = PDPNMsgGroupInfo; + TDPNMsg_Group_Info = TDPNMsgGroupInfo; + PDPNMsg_Host_Migrate = PDPNMsgHostMigrate; + TDPNMsg_Host_Migrate = TDPNMsgHostMigrate; + PDPNMsg_Indicate_Connect = PDPNMsgIndicateConnect; + TDPNMsg_Indicate_Connect = TDPNMsgIndicateConnect; + PDPNMsg_Indicated_Connect_Aborted = PDPNMsgIndicatedConnectAborted; + TDPNMsg_Indicated_Connect_Aborted = TDPNMsgIndicatedConnectAborted; + PDPNMsg_Peer_Info = PDPNMsgPeerInfo; + TDPNMsg_Peer_Info = TDPNMsgPeerInfo; + PDPNMsg_Receive = PDPNMsgReceive; + TDPNMsg_Receive = TDPNMsgReceive; + PDPNMsg_Remove_Player_From_Group = PDPNMsgRemovePlayerFromGroup; + TDPNMsg_Remove_Player_From_Group = TDPNMsgRemovePlayerFromGroup; + PDPNMsg_Return_Buffer = PDPNMsgReturnBuffer; + TDPNMsg_Return_Buffer = TDPNMsgReturnBuffer; + PDPNMsg_Send_Complete = PDPNMsgSendComplete; + TDPNMsg_Send_Complete = TDPNMsgSendComplete; + PDPNMsg_Server_Info = PDPNMsgServerInfo; + TDPNMsg_Server_Info = TDPNMsgServerInfo; + PDPNMsg_Terminate_Session = PDPNMsgTerminateSession; + TDPNMsg_Terminate_Session = TDPNMsgTerminateSession; + PDPNMsg_Create_Thread = PDPNMsgCreateThread; + TDPNMsg_Create_Thread = TDPNMsgCreateThread; + PDPNMsg_Destroy_Thread = PDPNMsgDestroyThread; + TDPNMsg_Destroy_Thread = TDPNMsgDestroyThread; + PDPNMsg_Nat_Resolver_Query = PDPNMsgNatResolverQuery; + TDPNMsg_Nat_Resolver_Query = TDPNMsgNatResolverQuery; + + +implementation + +// #define MAKE_DPNHRESULT( code ) MAKE_HRESULT( 1, _DPN_FACILITY_CODE, ( code + _DPNHRESULT_BASE ) ) +function MAKE_DPNHRESULT(Code: DWORD): DWORD; +begin + Result:= DWord((1 shl 31) or (_DPN_FACILITY_CODE shl 16)) or (Code + _DPNHRESULT_BASE); +end; + +end. + diff --git a/Game/Code/lib/DSPack/DirectX9/DirectShow9.pas b/Game/Code/lib/DSPack/DirectX9/DirectShow9.pas new file mode 100644 index 00000000..738835b0 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DirectShow9.pas @@ -0,0 +1,31887 @@ + + {###### #### ############################################################## + ## ### ### ## ,###### ## ## ###### ### ### ## ## + ## ### #### ## ## ## ## ## ## # ## ## ## + ## ## ### ###### ####### ## ## \## ### ##/ ########## + ## ## ##### ##### ####### ## ## ######### ## + ## ## ## ### ,## ## ## ## ## ### ### ### + ###### ### #### ####### ## ## ###### ## ## ########### + | | + | 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 _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(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(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_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)) + +// ------------------------------------------------------------------------- +// +// DXVA Extended color data - occupies the HIWORD of the SampleFormat DWORD +// use the DXVA_ExtractExtColorData macro to extract the individual color +// data fields. +// +// The packed form is: +// VideoTransferFunction (bits 15..12) +// VideoPrimaries (bits 11..8) +// VideoLighting (bits 7..5) +// VideoTransferMatrix (Y'Cb'Cr') OR VideoNominalRange (RGB images) (bits 4..2) +// VideoChromaSubsampling (bits 1..0) +// +// ------------------------------------------------------------------------- + +//#define DXVA_ExtractExtColorData(_sf, _Mask, _Shift) \ +// (((_sf) >> (_Shift)) & (_Mask)) + +const + DXVA_ExtColorData_ShiftBase = 16; + {$EXTERNALSYM DXVA_ExtColorData_ShiftBase} + + DXVA_VideoTransFuncMask = (1 shl 15) or (1 shl 14) or (1 shl 13) or (1 shl 12); + {$EXTERNALSYM DXVA_VideoTransFuncMask} + DXVA_VideoTransFuncShift = (DXVA_ExtColorData_ShiftBase + 12); + {$EXTERNALSYM DXVA_VideoTransFuncShift} + +type + DXVA_VideoTransferFunction = ( + DXVA_VideoTransFunc_Unknown, + DXVA_VideoTransFunc_10, + DXVA_VideoTransFunc_18, + DXVA_VideoTransFunc_20, + DXVA_VideoTransFunc_22, + DXVA_VideoTransFunc_22_8bit, + DXVA_VideoTransFunc_22_8bit_240M, + DXVA_VideoTransFunc_24_8bit_sRGB, + DXVA_VideoTransFunc_28 + ); + {$EXTERNALSYM DXVA_VideoTransferFunction} + TDXVAVideoTransferFunction = DXVA_VideoTransferFunction; + +const + DXVA_VideoPrimariesMask = (1 shl 11)or (1 shl 10) or (1 shl 9) or (1 shl 8); + {$EXTERNALSYM DXVA_VideoPrimariesMask} + DXVA_VideoPrimariesShift = (DXVA_ExtColorData_ShiftBase + 8); + {$EXTERNALSYM DXVA_VideoPrimariesShift} + +type + DXVA_VideoPrimaries = ( + DXVA_VideoPrimaries_Unknown, + DXVA_VideoPrimaries_BT601, + 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_VideoLightingMask = (1 shl 7)or (1 shl 6) or (1 shl 5); + {$EXTERNALSYM DXVA_VideoLightingMask} + DXVA_VideoLightingShift = (DXVA_ExtColorData_ShiftBase + 5); + {$EXTERNALSYM DXVA_VideoLightingShift} + +type + DXVA_VideoLighting = ( + DXVA_VideoLighting_Unknown, + DXVA_VideoLighting_bright, + DXVA_VideoLighting_office, + DXVA_VideoLighting_dim, + DXVA_VideoLighting_dark + ); + {$EXTERNALSYM DXVA_VideoLighting} + TDXVAVideoLighting = DXVA_VideoLighting; + +// ------------------------------------------------------------------------- +// Note: +// +// DXVA_NominalRange and DXVA_VideoTransferMatrix are unioned together. +// +// ------------------------------------------------------------------------- +// + +const + DXVA_VideoTransferMatrixMask = (1 shl 4) or (1 shl 3) or (1 shl 2); + {$EXTERNALSYM DXVA_VideoTransferMatrixMask} + DXVA_VideoTransferMatrixShift = (DXVA_ExtColorData_ShiftBase + 2); + {$EXTERNALSYM DXVA_VideoTransferMatrixShift} + +type + DXVA_VideoTransferMatrix = ( + DXVA_VideoTransferMatrix_Unknown, + DXVA_VideoTransferMatrix_BT709, + DXVA_VideoTransferMatrix_BT601, + DXVA_VideoTransferMatrix_SMPTE240M + ); + {$EXTERNALSYM DXVA_VideoTransferMatrix} + TDXVAVideoTransferMatrix = DXVA_VideoTransferMatrix; + +const + DXVA_NominalRangeMask = (1 shl 4) or (1 shl 3) or (1 shl 2); + {$EXTERNALSYM DXVA_NominalRangeMask} + DXVA_NominalRangeShift = (DXVA_ExtColorData_ShiftBase + 2); + {$EXTERNALSYM DXVA_NominalRangeShift} + +type + DXVA_NominalRange = ( + DXVA_NominalRange_Normal, + DXVA_NominalRange_Wide + ); + {$EXTERNALSYM DXVA_NominalRange} + TDXVANominalRange = DXVA_NominalRange; + +const + DXVA_VideoChromaSubsamplingMask = (1 shl 1) or (1 shl 0); + {$EXTERNALSYM DXVA_VideoChromaSubsamplingMask} + DXVA_VideoChromaSubsamplingShift = (DXVA_ExtColorData_ShiftBase + 0); + {$EXTERNALSYM DXVA_VideoChromaSubsamplingShift} + +type + DXVA_VideoChromaSubsampling = ( + DXVA_VideoChromaSubsampling_Unknown, + DXVA_VideoChromaSubsampling_non_cosited, + DXVA_VideoChromaSubsampling_cosited + ); + {$EXTERNALSYM DXVA_VideoChromaSubsampling} + TDXVAVideoChromaSubsampling = DXVA_VideoChromaSubsampling; + +// ------------------------------------------------------------------------- +// +// 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; + 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; + TypeSpecificMask: ULONG; + TypeSpecificInfo: 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_CopyFreely = 0; + {$EXTERNALSYM COPP_CGMSA_CopyFreely} + COPP_CGMSA_LevelMin = COPP_CGMSA_CopyFreely; + {$EXTERNALSYM COPP_CGMSA_LevelMin} + COPP_CGMSA_CopyOneGeneration = 2; + {$EXTERNALSYM COPP_CGMSA_CopyOneGeneration} + COPP_CGMSA_CopyNever = 3; + {$EXTERNALSYM COPP_CGMSA_CopyNever} + COPP_CGMSA_RedistributionControlRequired = $04; + {$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} + + COPP_WSS_FLAG = $01; // used with DXVA_COPPSetProtectionLevelCmdData::TypeSpecificInfo + {$EXTERNALSYM COPP_WSS_FLAG} + +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} + +// ------------------------------------------------------------------------- +// 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; + TypeSpecificMask : ULONG; + TypeSpecificInfo : 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 = ( + COPP_HDCPReceiver, + COPP_HDCPRepeater + ); + {$EXTERNALSYM COPP_StatusHDCPFlags} + TCOPPStatusHDCPFlags = COPP_StatusHDCPFlags; + + 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; + +//------------------------------------------------------------------------------ +// 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} + +//------------------------------------------------------------ +// BDA Table Section Property Set +// {516B99C5-971C-4aaf-B3F3-D9FDA8A15E16} + + 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; + + + 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; + var rgulNodeTypes: ULONG): 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; + var rgulPinTypes: ULONG): HResult; stdcall; + function GetTemplateConnections(var pulcConnections: ULONG; ulcConnectionsMax: ULONG; + var rgConnections: TBDATemplateConnection): 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; + 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: PULONG): HResult; stdcall; + function get_Autotune(pulTransponder: PULONG): HResult; stdcall; + function put_Frequency(pulFrequency: PULONG): HResult; stdcall; + function get_Frequency(pulFrequency: PULONG): HResult; stdcall; + function put_Polarity(pulPolarity: PULONG): HResult; stdcall; + function get_Polarity(pulPolarity: PULONG): HResult; stdcall; + function put_Range(pulRange: PULONG): HResult; stdcall; + function get_Range(pulRange: PULONG): 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; var pPIDMap: TPIDMap; 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_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} + VMR9AllocFlag_UsageReserved = $00F0; + {$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; + +//===================================================================== +// +// 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/Game/Code/lib/DSPack/DirectX9/DirectSound.pas b/Game/Code/lib/DSPack/DirectX9/DirectSound.pas new file mode 100644 index 00000000..f89aaafc --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/DirectSound.pas @@ -0,0 +1,2427 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: dsound.h *} +{* Content: DirectSound include file *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 27-Apr-2003 *} +{* *} +{* 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.narod.ru/delphi *} +{* *} +{******************************************************************************} +{ } +{ 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 } +{ } +{******************************************************************************} + +unit DirectSound; + +interface + +uses + Windows, MMSystem, DXTypes; + +(*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: dsound.h + * Content: DirectSound include file + * + **************************************************************************) + +{$I DirectX.inc} + +//////////////////////////////////////////////////////////////////////// +// 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} + {$HPPEMIT '#define DIRECTSOUND_VERSION 0x0700'} +{$ENDIF} +{$IFDEF DIRECTSOUND_VERSION_8} + {$HPPEMIT '#define DIRECTSOUND_VERSION 0x0800'} +{$ENDIF} +{$IFDEF DIRECTSOUND_VERSION_9} + {$HPPEMIT '#define DIRECTSOUND_VERSION 0x0900'} +{$ENDIF} + +{$NOINCLUDE DXTypes} +(*$HPPEMIT '#include "dsound.h"' *) + + +//////////////////////////////////////////////////////////////////////// +// 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; + {$EXTERNALSYM D3DVALUE} + TD3DValue = DXTypes.TD3DValue; + {$NODEFINE TD3DValue} + PD3DValue = DXTypes.PD3DValue; + {$NODEFINE PD3DValue} + + D3DCOLOR = DXTypes.D3DCOLOR; + {$EXTERNALSYM D3DCOLOR} + TD3DColor = DXTypes.TD3DColor; + {$NODEFINE TD3DColor} + + _D3DVECTOR = DXTypes._D3DVECTOR; + {$EXTERNALSYM _D3DVECTOR} + D3DVECTOR = DXTypes.D3DVECTOR; + {$EXTERNALSYM D3DVECTOR} + TD3DVector = DXTypes.TD3DVector; + {$NODEFINE TD3DVector} + PD3DVector = DXTypes.PD3DVector; + {$NODEFINE PD3DVector} + +{$HPPEMIT ''} +{$HPPEMIT '#ifndef DX_SHARED_DEFINES_BCB'} +{$HPPEMIT ''} +{$HPPEMIT 'typedef D3DVALUE TD3DValue;'} +{$HPPEMIT 'typedef D3DVALUE *PD3DValue;'} +{$HPPEMIT ''} +{$HPPEMIT '#ifndef D3DCOLOR_DEFINED_BCB'} +{$HPPEMIT 'typedef D3DCOLOR TD3DColor;'} +{$HPPEMIT '#define D3DCOLOR_DEFINED_BCB'} +{$HPPEMIT '#endif'} +{$HPPEMIT ''} +{$HPPEMIT '#ifndef D3DVECTOR_DEFINED_BCB'} +{$HPPEMIT 'typedef _D3DVECTOR TD3DVector;'} +{$HPPEMIT 'typedef _D3DVECTOR *PD3DVector;'} +{$HPPEMIT '#define D3DVECTOR_DEFINED_BCB'} +{$HPPEMIT '#endif'} +{$HPPEMIT ''} +{$HPPEMIT '#define DX_SHARED_DEFINES_BCB'} +{$HPPEMIT '#endif // DX_SHARED_DEFINES_BCB'} +{$HPPEMIT ''} + +const + _FACDS = $878; { DirectSound's facility code } + {$EXTERNALSYM _FACDS} + +// #define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code) +function MAKE_DSHRESULT(Code: DWord): DWord; +{$EXTERNALSYM MAKE_DSHRESULT} + +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}'; + {$EXTERNALSYM CLSID_DirectSound} + + // DirectSound 8.0 Component GUID {3901CC3F-84B5-4FA4-BA35-AA8172B8A09B} + CLSID_DirectSound8: TGUID = '{3901cc3f-84b5-4fa4-ba35-aa8172b8a09b}'; + {$EXTERNALSYM CLSID_DirectSound8} + + // DirectSound Capture Component GUID {B0210780-89CD-11D0-AF08-00A0C925CD16} + CLSID_DirectSoundCapture: TGUID = '{b0210780-89cd-11d0-af08-00a0c925cd16}'; + {$EXTERNALSYM CLSID_DirectSoundCapture} + + // DirectSound 8.0 Capture Component GUID {E4BCAC13-7F99-4908-9A8E-74E3BF24B6E1} + CLSID_DirectSoundCapture8: TGUID = '{e4bcac13-7f99-4908-9a8e-74e3bf24b6e1}'; + {$EXTERNALSYM CLSID_DirectSoundCapture8} + + // DirectSound Full Duplex Component GUID {FEA4300C-7959-4147-B26A-2377B9E7A91D} + CLSID_DirectSoundFullDuplex: TGUID = '{fea4300c-7959-4147-b26a-2377b9e7a91d}'; + {$EXTERNALSYM CLSID_DirectSoundFullDuplex} + + + // DirectSound default playback device GUID {DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03} + DSDEVID_DefaultPlayback: TGUID = '{def00000-9c6d-47ed-aaf1-4dda8f2b5c03}'; + {$EXTERNALSYM DSDEVID_DefaultPlayback} + + // DirectSound default capture device GUID {DEF00001-9C6D-47ED-AAF1-4DDA8F2B5C03} + DSDEVID_DefaultCapture: TGUID = '{def00001-9c6d-47ed-aaf1-4dda8f2b5c03}'; + {$EXTERNALSYM DSDEVID_DefaultCapture} + + // DirectSound default device for voice playback {DEF00002-9C6D-47ED-AAF1-4DDA8F2B5C03} + DSDEVID_DefaultVoicePlayback: TGUID = '{def00002-9c6d-47ed-aaf1-4dda8f2b5c03}'; + {$EXTERNALSYM DSDEVID_DefaultVoicePlayback} + + // DirectSound default device for voice capture {DEF00003-9C6D-47ED-AAF1-4DDA8F2B5C03} + DSDEVID_DefaultVoiceCapture: TGUID = '{def00003-9c6d-47ed-aaf1-4dda8f2b5c03}'; + {$EXTERNALSYM DSDEVID_DefaultVoiceCapture} + + +// +// 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; + {$EXTERNALSYM _DSCAPS} + DSCAPS = _DSCAPS; + {$EXTERNALSYM DSCAPS} + TDSCaps = _DSCAPS; + + PDSBcaps = ^TDSBcaps; + _DSBCAPS = packed record + dwSize : DWORD; + dwFlags : DWORD; + dwBufferBytes : DWORD; + dwUnlockTransferRate : DWORD; + dwPlayCpuOverhead : DWORD; + end; + {$EXTERNALSYM _DSBCAPS} + DSBCAPS = _DSBCAPS; + {$EXTERNALSYM DSBCAPS} + TDSBcaps = _DSBCAPS; + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + {$IFDEF WIN64} + DWORD_PTR = Int64; + {$ELSE} + DWORD_PTR = DWORD; + {$ENDIF} + {$NODEFINE DWORD_PTR} + + PDSEffectDesc = ^TDSEffectDesc; + _DSEFFECTDESC = packed record + dwSize : DWORD; + dwFlags : DWORD; + guidDSFXClass : TGUID; + dwReserved1 : DWORD_PTR; + dwReserved2 : DWORD_PTR; + end; + {$EXTERNALSYM _DSEFFECTDESC} + DSEFFECTDESC = _DSEFFECTDESC; + {$EXTERNALSYM DSEFFECTDESC} + TDSEffectDesc = _DSEFFECTDESC; + +const + DSFX_LOCHARDWARE = $00000001; + {$EXTERNALSYM DSFX_LOCHARDWARE} + DSFX_LOCSOFTWARE = $00000002; + {$EXTERNALSYM DSFX_LOCSOFTWARE} + + DSFXR_PRESENT = 0; + {$EXTERNALSYM DSFXR_PRESENT} + DSFXR_LOCHARDWARE = 1; + {$EXTERNALSYM DSFXR_LOCHARDWARE} + DSFXR_LOCSOFTWARE = 2; + {$EXTERNALSYM DSFXR_LOCSOFTWARE} + DSFXR_UNALLOCATED = 3; + {$EXTERNALSYM DSFXR_UNALLOCATED} + DSFXR_FAILED = 4; + {$EXTERNALSYM DSFXR_FAILED} + DSFXR_UNKNOWN = 5; + {$EXTERNALSYM DSFXR_UNKNOWN} + DSFXR_SENDLOOP = 6; + {$EXTERNALSYM DSFXR_SENDLOOP} + +type + PDSCEffectDesc = ^TDSCEffectDesc; + _DSCEFFECTDESC = packed record + dwSize: DWORD; + dwFlags: DWORD; + guidDSCFXClass: TGUID; + guidDSCFXInstance: TGUID; + dwReserved1: DWORD; + dwReserved2: DWORD; + end; + {$EXTERNALSYM _DSCEFFECTDESC} + DSCEFFECTDESC = _DSCEFFECTDESC; + {$EXTERNALSYM DSCEFFECTDESC} + TDSCEffectDesc = _DSCEFFECTDESC; + +const + DSCFX_LOCHARDWARE = $00000001; + {$EXTERNALSYM DSCFX_LOCHARDWARE} + DSCFX_LOCSOFTWARE = $00000002; + {$EXTERNALSYM DSCFX_LOCSOFTWARE} + + DSCFXR_LOCHARDWARE = $00000010; + {$EXTERNALSYM DSCFXR_LOCHARDWARE} + DSCFXR_LOCSOFTWARE = $00000020; + {$EXTERNALSYM DSCFXR_LOCSOFTWARE} + +{$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; + {$EXTERNALSYM _DSBUFFERDESC} + DSBUFFERDESC = _DSBUFFERDESC; + {$EXTERNALSYM DSBUFFERDESC} + TDSBufferDesc = _DSBUFFERDESC; + +// Older version of this structure: + + PDSBufferDesc1 = ^TDSBufferDesc1; + _DSBUFFERDESC1 = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwBufferBytes: DWORD; + dwReserved: DWORD; + lpwfxFormat: PWaveFormatEx; + end; + {$EXTERNALSYM _DSBUFFERDESC1} + DSBUFFERDESC1 = _DSBUFFERDESC1; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DS3DBUFFER} + DS3DBUFFER = _DS3DBUFFER; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DS3DLISTENER} + DS3DLISTENER = _DS3DLISTENER; + {$EXTERNALSYM DS3DLISTENER} + TDS3DListener = _DS3DLISTENER; + + PDSCcaps = ^TDSCcaps; + _DSCCAPS = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwFormats: DWORD; + dwChannels: DWORD; + end; + {$EXTERNALSYM _DSCCAPS} + DSCCAPS = _DSCCAPS; + {$EXTERNALSYM DSCCAPS} + TDSCcaps = _DSCCAPS; + + PDSCBufferDesc1 = ^TDSCBufferDesc1; + _DSCBUFFERDESC1 = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwBufferBytes: DWORD; + dwReserved: DWORD; + lpwfxFormat: PWaveFormatEx; + end; + {$EXTERNALSYM _DSCBUFFERDESC1} + DSCBUFFERDESC1 = _DSCBUFFERDESC1; + {$EXTERNALSYM 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; + {$EXTERNALSYM _DSCBUFFERDESC} + DSCBUFFERDESC = _DSCBUFFERDESC; + {$EXTERNALSYM DSCBUFFERDESC} + TDSCBufferDesc = _DSCBUFFERDESC; + + PDSCBCaps = ^TDSCBCaps; + _DSCBCAPS = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwBufferBytes: DWORD; + dwReserved: DWORD; + end; + {$EXTERNALSYM _DSCBCAPS} + DSCBCAPS = _DSCBCAPS; + {$EXTERNALSYM DSCBCAPS} + TDSCBCaps = _DSCBCAPS; + + PDSBPositionNotify = ^TDSBPositionNotify; + _DSBPOSITIONNOTIFY = packed record + dwOffset: DWORD; + hEventNotify: THandle; + end; + {$EXTERNALSYM _DSBPOSITIONNOTIFY} + DSBPOSITIONNOTIFY = _DSBPOSITIONNOTIFY; + {$EXTERNALSYM DSBPOSITIONNOTIFY} + TDSBPositionNotify = _DSBPOSITIONNOTIFY; + + +type + PReferenceTime = ^TReferenceTime; + REFERENCE_TIME = LONGLONG; + {$EXTERNALSYM REFERENCE_TIME} + TReferenceTime = REFERENCE_TIME; + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IReferenceClock);'} + {$EXTERNALSYM IReferenceClock} + 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; + {$EXTERNALSYM IID_IReferenceClock} + + + IDirectSoundBuffer = interface; + + // + // IDirectSound + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSound);'} + {$EXTERNALSYM 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; + {$EXTERNALSYM IID_IDirectSound} + + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSound8 + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSound8);'} + {$EXTERNALSYM IDirectSound8} + IDirectSound8 = interface(IDirectSound) + ['{C50A7E93-F395-4834-9EF6-7FA99DE50966}'] + // IDirectSound8 methods + function VerifyCertification(pdwCertified: PDWORD): HResult; stdcall; + end; + + IID_IDirectSound8 = IDirectSound8; + {$EXTERNALSYM IID_IDirectSound8} + + +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundBuffer + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundBuffer);'} + {$EXTERNALSYM 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; out ppvAudioPtr1: Pointer; out pdwAudioBytes1: DWORD; + out ppvAudioPtr2: Pointer; out pdwAudioBytes2: DWORD; 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; + {$EXTERNALSYM IID_IDirectSoundBuffer} + + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundBuffer8 + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundBuffer8);'} + {$EXTERNALSYM 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, pdwResultCodes: PDWORD): HResult; stdcall; + function GetObjectInPath(const rguidObject: TGUID; dwIndex: DWORD; const rguidInterface: TGUID; out ppObject{IUnknown}): HResult; stdcall; + end; + + IID_IDirectSoundBuffer8 = IDirectSoundBuffer8; + {$EXTERNALSYM IID_IDirectSoundBuffer8} + +const + // Special GUID meaning "select all objects" for use in GetObjectInPath() + GUID_All_Objects: TGUID = '{aa114de5-c262-4169-a1c8-23d698cc73b5}'; + {$EXTERNALSYM GUID_All_Objects} + + +type +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSound3DListener + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSound3DListener);'} + {$EXTERNALSYM 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; + {$EXTERNALSYM IID_IDirectSound3DListener} + + + // + // IDirectSound3DBuffer + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSound3DBuffer);'} + {$EXTERNALSYM 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; + {$EXTERNALSYM IID_IDirectSound3DBuffer} + + + IDirectSoundCaptureBuffer = interface; + + // + // IDirectSoundCapture + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCapture);'} + {$EXTERNALSYM 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; + {$EXTERNALSYM IID_IDirectSoundCapture} + + + // + // IDirectSoundCaptureBuffer + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCaptureBuffer);'} + {$EXTERNALSYM 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; out ppvAudioPtr1: Pointer; out pdwAudioBytes1: DWORD; out ppvAudioPtr2: Pointer; out pdwAudioBytes2: DWORD; 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; + {$EXTERNALSYM IID_IDirectSoundCaptureBuffer} + + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundCaptureBuffer8 + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCaptureBuffer8);'} + {$EXTERNALSYM 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; + {$EXTERNALSYM IID_IDirectSoundCaptureBuffer8} + +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundNotify + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundNotify);'} + {$EXTERNALSYM IDirectSoundNotify} + IDirectSoundNotify = interface(IUnknown) + ['{b0210783-89cd-11d0-af08-00a0c925cd16}'] + // IDirectSoundNotify methods + function SetNotificationPositions(dwPositionNotifies: DWORD; pcPositionNotifies: PDSBPositionNotify): HResult; stdcall; + end; + + IID_IDirectSoundNotify = IDirectSoundNotify; + {$EXTERNALSYM IID_IDirectSoundNotify} + + + // + // IKsPropertySet + // + +const + KSPROPERTY_SUPPORT_GET = $00000001; + {$EXTERNALSYM KSPROPERTY_SUPPORT_GET} + KSPROPERTY_SUPPORT_SET = $00000002; + {$EXTERNALSYM KSPROPERTY_SUPPORT_SET} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IKsPropertySet);'} + {$EXTERNALSYM IKsPropertySet} + 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(rguidPropSet: TGUID; ulId: ULONG; out pulTypeSupport: ULONG): HResult; stdcall; + end; + + IID_IKsPropertySet = IKsPropertySet; + {$EXTERNALSYM IID_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; + {$EXTERNALSYM _DSFXGargle} + DSFXGargle = _DSFXGargle; + {$EXTERNALSYM DSFXGargle} + TDSFXGargle = _DSFXGargle; + +const + DSFXGARGLE_WAVE_TRIANGLE = 0; + {$EXTERNALSYM DSFXGARGLE_WAVE_TRIANGLE} + DSFXGARGLE_WAVE_SQUARE = 1; + {$EXTERNALSYM DSFXGARGLE_WAVE_SQUARE} + + DSFXGARGLE_RATEHZ_MIN = 1; + {$EXTERNALSYM DSFXGARGLE_RATEHZ_MIN} + DSFXGARGLE_RATEHZ_MAX = 1000; + {$EXTERNALSYM DSFXGARGLE_RATEHZ_MAX} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXGargle);'} + {$EXTERNALSYM IDirectSoundFXGargle} + 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; + {$EXTERNALSYM IID_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; + {$EXTERNALSYM _DSFXChorus} + DSFXChorus = _DSFXChorus; + {$EXTERNALSYM DSFXChorus} + TDSFXChorus = _DSFXChorus; + +const + DSFXCHORUS_WAVE_TRIANGLE = 0; + {$EXTERNALSYM DSFXCHORUS_WAVE_TRIANGLE} + DSFXCHORUS_WAVE_SIN = 1; + {$EXTERNALSYM DSFXCHORUS_WAVE_SIN} + + DSFXCHORUS_WETDRYMIX_MIN = 0.0; + {$EXTERNALSYM DSFXCHORUS_WETDRYMIX_MIN} + DSFXCHORUS_WETDRYMIX_MAX = 100.0; + {$EXTERNALSYM DSFXCHORUS_WETDRYMIX_MAX} + DSFXCHORUS_DEPTH_MIN = 0.0; + {$EXTERNALSYM DSFXCHORUS_DEPTH_MIN} + DSFXCHORUS_DEPTH_MAX = 100.0; + {$EXTERNALSYM DSFXCHORUS_DEPTH_MAX} + DSFXCHORUS_FEEDBACK_MIN = -99.0; + {$EXTERNALSYM DSFXCHORUS_FEEDBACK_MIN} + DSFXCHORUS_FEEDBACK_MAX = 99.0; + {$EXTERNALSYM DSFXCHORUS_FEEDBACK_MAX} + DSFXCHORUS_FREQUENCY_MIN = 0.0; + {$EXTERNALSYM DSFXCHORUS_FREQUENCY_MIN} + DSFXCHORUS_FREQUENCY_MAX = 10.0; + {$EXTERNALSYM DSFXCHORUS_FREQUENCY_MAX} + DSFXCHORUS_DELAY_MIN = 0.0; + {$EXTERNALSYM DSFXCHORUS_DELAY_MIN} + DSFXCHORUS_DELAY_MAX = 20.0; + {$EXTERNALSYM DSFXCHORUS_DELAY_MAX} + DSFXCHORUS_PHASE_MIN = 0; + {$EXTERNALSYM DSFXCHORUS_PHASE_MIN} + DSFXCHORUS_PHASE_MAX = 4; + {$EXTERNALSYM DSFXCHORUS_PHASE_MAX} + + DSFXCHORUS_PHASE_NEG_180 = 0; + {$EXTERNALSYM DSFXCHORUS_PHASE_NEG_180} + DSFXCHORUS_PHASE_NEG_90 = 1; + {$EXTERNALSYM DSFXCHORUS_PHASE_NEG_90} + DSFXCHORUS_PHASE_ZERO = 2; + {$EXTERNALSYM DSFXCHORUS_PHASE_ZERO} + DSFXCHORUS_PHASE_90 = 3; + {$EXTERNALSYM DSFXCHORUS_PHASE_90} + DSFXCHORUS_PHASE_180 = 4; + {$EXTERNALSYM DSFXCHORUS_PHASE_180} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXChorus);'} + {$EXTERNALSYM IDirectSoundFXChorus} + 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; + {$EXTERNALSYM IID_IDirectSoundFXChorus} + + + // + // IDirectSoundFXFlanger + // + + PDSFXFlanger = ^TDSFXFlanger; + _DSFXFlanger = packed record + fWetDryMix: Single; + fDepth: Single; + fFeedback: Single; + fFrequency: Single; + lWaveform: Longint; + fDelay: Single; + lPhase: Longint; + end; + {$EXTERNALSYM _DSFXFlanger} + DSFXFlanger = _DSFXFlanger; + {$EXTERNALSYM DSFXFlanger} + TDSFXFlanger = _DSFXFlanger; + +const + DSFXFLANGER_WAVE_TRIANGLE = 0; + {$EXTERNALSYM DSFXFLANGER_WAVE_TRIANGLE} + DSFXFLANGER_WAVE_SIN = 1; + {$EXTERNALSYM DSFXFLANGER_WAVE_SIN} + + DSFXFLANGER_WETDRYMIX_MIN = 0.0; + {$EXTERNALSYM DSFXFLANGER_WETDRYMIX_MIN} + DSFXFLANGER_WETDRYMIX_MAX = 100.0; + {$EXTERNALSYM DSFXFLANGER_WETDRYMIX_MAX} + DSFXFLANGER_FREQUENCY_MIN = 0.0; + {$EXTERNALSYM DSFXFLANGER_FREQUENCY_MIN} + DSFXFLANGER_FREQUENCY_MAX = 10.0; + {$EXTERNALSYM DSFXFLANGER_FREQUENCY_MAX} + DSFXFLANGER_DEPTH_MIN = 0.0; + {$EXTERNALSYM DSFXFLANGER_DEPTH_MIN} + DSFXFLANGER_DEPTH_MAX = 100.0; + {$EXTERNALSYM DSFXFLANGER_DEPTH_MAX} + DSFXFLANGER_PHASE_MIN = 0; + {$EXTERNALSYM DSFXFLANGER_PHASE_MIN} + DSFXFLANGER_PHASE_MAX = 4; + {$EXTERNALSYM DSFXFLANGER_PHASE_MAX} + DSFXFLANGER_FEEDBACK_MIN = -99.0; + {$EXTERNALSYM DSFXFLANGER_FEEDBACK_MIN} + DSFXFLANGER_FEEDBACK_MAX = 99.0; + {$EXTERNALSYM DSFXFLANGER_FEEDBACK_MAX} + DSFXFLANGER_DELAY_MIN = 0.0; + {$EXTERNALSYM DSFXFLANGER_DELAY_MIN} + DSFXFLANGER_DELAY_MAX = 4.0; + {$EXTERNALSYM DSFXFLANGER_DELAY_MAX} + + DSFXFLANGER_PHASE_NEG_180 = 0; + {$EXTERNALSYM DSFXFLANGER_PHASE_NEG_180} + DSFXFLANGER_PHASE_NEG_90 = 1; + {$EXTERNALSYM DSFXFLANGER_PHASE_NEG_90} + DSFXFLANGER_PHASE_ZERO = 2; + {$EXTERNALSYM DSFXFLANGER_PHASE_ZERO} + DSFXFLANGER_PHASE_90 = 3; + {$EXTERNALSYM DSFXFLANGER_PHASE_90} + DSFXFLANGER_PHASE_180 = 4; + {$EXTERNALSYM DSFXFLANGER_PHASE_180} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXFlanger);'} + {$EXTERNALSYM IDirectSoundFXFlanger} + 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; + {$EXTERNALSYM IID_IDirectSoundFXFlanger} + + + // + // IDirectSoundFXEcho + // + + PDSFXEcho = ^TDSFXEcho; + _DSFXEcho = packed record + fWetDryMix: Single; + fFeedback: Single; + fLeftDelay: Single; + fRightDelay: Single; + lPanDelay: Longint; + end; + {$EXTERNALSYM _DSFXEcho} + DSFXEcho = _DSFXEcho; + {$EXTERNALSYM DSFXEcho} + TDSFXEcho = _DSFXEcho; + +const + DSFXECHO_WETDRYMIX_MIN = 0.0; + {$EXTERNALSYM DSFXECHO_WETDRYMIX_MIN} + DSFXECHO_WETDRYMIX_MAX = 100.0; + {$EXTERNALSYM DSFXECHO_WETDRYMIX_MAX} + DSFXECHO_FEEDBACK_MIN = 0.0; + {$EXTERNALSYM DSFXECHO_FEEDBACK_MIN} + DSFXECHO_FEEDBACK_MAX = 100.0; + {$EXTERNALSYM DSFXECHO_FEEDBACK_MAX} + DSFXECHO_LEFTDELAY_MIN = 1.0; + {$EXTERNALSYM DSFXECHO_LEFTDELAY_MIN} + DSFXECHO_LEFTDELAY_MAX = 2000.0; + {$EXTERNALSYM DSFXECHO_LEFTDELAY_MAX} + DSFXECHO_RIGHTDELAY_MIN = 1.0; + {$EXTERNALSYM DSFXECHO_RIGHTDELAY_MIN} + DSFXECHO_RIGHTDELAY_MAX = 2000.0; + {$EXTERNALSYM DSFXECHO_RIGHTDELAY_MAX} + DSFXECHO_PANDELAY_MIN = 0; + {$EXTERNALSYM DSFXECHO_PANDELAY_MIN} + DSFXECHO_PANDELAY_MAX = 1; + {$EXTERNALSYM DSFXECHO_PANDELAY_MAX} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXEcho);'} + {$EXTERNALSYM IDirectSoundFXEcho} + 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; + {$EXTERNALSYM IID_IDirectSoundFXEcho} + + + // + // IDirectSoundFXDistortion + // + + PDSFXDistortion = ^TDSFXDistortion; + _DSFXDistortion = packed record + fGain: Single; + fEdge: Single; + fPostEQCenterFrequency: Single; + fPostEQBandwidth: Single; + fPreLowpassCutoff: Single; + end; + {$EXTERNALSYM _DSFXDistortion} + DSFXDistortion = _DSFXDistortion; + {$EXTERNALSYM DSFXDistortion} + TDSFXDistortion = _DSFXDistortion; + +const + DSFXDISTORTION_GAIN_MIN = -60.0; + {$EXTERNALSYM DSFXDISTORTION_GAIN_MIN} + DSFXDISTORTION_GAIN_MAX = 0.0; + {$EXTERNALSYM DSFXDISTORTION_GAIN_MAX} + DSFXDISTORTION_EDGE_MIN = 0.0; + {$EXTERNALSYM DSFXDISTORTION_EDGE_MIN} + DSFXDISTORTION_EDGE_MAX = 100.0; + {$EXTERNALSYM DSFXDISTORTION_EDGE_MAX} + DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN = 100.0; + {$EXTERNALSYM DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN} + DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX = 8000.0; + {$EXTERNALSYM DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX} + DSFXDISTORTION_POSTEQBANDWIDTH_MIN = 100.0; + {$EXTERNALSYM DSFXDISTORTION_POSTEQBANDWIDTH_MIN} + DSFXDISTORTION_POSTEQBANDWIDTH_MAX = 8000.0; + {$EXTERNALSYM DSFXDISTORTION_POSTEQBANDWIDTH_MAX} + DSFXDISTORTION_PRELOWPASSCUTOFF_MIN = 100.0; + {$EXTERNALSYM DSFXDISTORTION_PRELOWPASSCUTOFF_MIN} + DSFXDISTORTION_PRELOWPASSCUTOFF_MAX = 8000.0; + {$EXTERNALSYM DSFXDISTORTION_PRELOWPASSCUTOFF_MAX} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXDistortion);'} + {$EXTERNALSYM IDirectSoundFXDistortion} + 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; + {$EXTERNALSYM IID_IDirectSoundFXDistortion} + + + // + // IDirectSoundFXCompressor + // + + PDSFXCompressor = ^TDSFXCompressor; + _DSFXCompressor = packed record + fGain: Single; + fAttack: Single; + fRelease: Single; + fThreshold: Single; + fRatio: Single; + fPredelay: Single; + end; + {$EXTERNALSYM _DSFXCompressor} + DSFXCompressor = _DSFXCompressor; + {$EXTERNALSYM DSFXCompressor} + TDSFXCompressor = _DSFXCompressor; + +const + DSFXCOMPRESSOR_GAIN_MIN = -60.0; + {$EXTERNALSYM DSFXCOMPRESSOR_GAIN_MIN} + DSFXCOMPRESSOR_GAIN_MAX = 60.0; + {$EXTERNALSYM DSFXCOMPRESSOR_GAIN_MAX} + DSFXCOMPRESSOR_ATTACK_MIN = 0.01; + {$EXTERNALSYM DSFXCOMPRESSOR_ATTACK_MIN} + DSFXCOMPRESSOR_ATTACK_MAX = 500.0; + {$EXTERNALSYM DSFXCOMPRESSOR_ATTACK_MAX} + DSFXCOMPRESSOR_RELEASE_MIN = 50.0; + {$EXTERNALSYM DSFXCOMPRESSOR_RELEASE_MIN} + DSFXCOMPRESSOR_RELEASE_MAX = 3000.0; + {$EXTERNALSYM DSFXCOMPRESSOR_RELEASE_MAX} + DSFXCOMPRESSOR_THRESHOLD_MIN = -60.0; + {$EXTERNALSYM DSFXCOMPRESSOR_THRESHOLD_MIN} + DSFXCOMPRESSOR_THRESHOLD_MAX = 0.0; + {$EXTERNALSYM DSFXCOMPRESSOR_THRESHOLD_MAX} + DSFXCOMPRESSOR_RATIO_MIN = 1.0; + {$EXTERNALSYM DSFXCOMPRESSOR_RATIO_MIN} + DSFXCOMPRESSOR_RATIO_MAX = 100.0; + {$EXTERNALSYM DSFXCOMPRESSOR_RATIO_MAX} + DSFXCOMPRESSOR_PREDELAY_MIN = 0.0; + {$EXTERNALSYM DSFXCOMPRESSOR_PREDELAY_MIN} + DSFXCOMPRESSOR_PREDELAY_MAX = 4.0; + {$EXTERNALSYM DSFXCOMPRESSOR_PREDELAY_MAX} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXCompressor);'} + {$EXTERNALSYM IDirectSoundFXCompressor} + 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; + {$EXTERNALSYM IID_IDirectSoundFXCompressor} + + + // + // IDirectSoundFXParamEq + // + + PDSFXParamEq = ^TDSFXParamEq; + _DSFXParamEq = packed record + fCenter: Single; + fBandwidth: Single; + fGain: Single; + end; + {$EXTERNALSYM _DSFXParamEq} + DSFXParamEq = _DSFXParamEq; + {$EXTERNALSYM DSFXParamEq} + TDSFXParamEq = _DSFXParamEq; + +const + DSFXPARAMEQ_CENTER_MIN = 80.0; + {$EXTERNALSYM DSFXPARAMEQ_CENTER_MIN} + DSFXPARAMEQ_CENTER_MAX = 16000.0; + {$EXTERNALSYM DSFXPARAMEQ_CENTER_MAX} + DSFXPARAMEQ_BANDWIDTH_MIN = 1.0; + {$EXTERNALSYM DSFXPARAMEQ_BANDWIDTH_MIN} + DSFXPARAMEQ_BANDWIDTH_MAX = 36.0; + {$EXTERNALSYM DSFXPARAMEQ_BANDWIDTH_MAX} + DSFXPARAMEQ_GAIN_MIN = -15.0; + {$EXTERNALSYM DSFXPARAMEQ_GAIN_MIN} + DSFXPARAMEQ_GAIN_MAX = 15.0; + {$EXTERNALSYM DSFXPARAMEQ_GAIN_MAX} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXParamEq);'} + {$EXTERNALSYM IDirectSoundFXParamEq} + 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; + {$EXTERNALSYM IID_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; + {$EXTERNALSYM _DSFXI3DL2Reverb} + DSFXI3DL2Reverb = _DSFXI3DL2Reverb; + {$EXTERNALSYM DSFXI3DL2Reverb} + TDSFXI3DL2Reverb = _DSFXI3DL2Reverb; + +const + DSFX_I3DL2REVERB_ROOM_MIN = (-10000); + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOM_MIN} + DSFX_I3DL2REVERB_ROOM_MAX = 0; + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOM_MAX} + DSFX_I3DL2REVERB_ROOM_DEFAULT = (-1000); + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOM_DEFAULT} + + DSFX_I3DL2REVERB_ROOMHF_MIN = (-10000); + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMHF_MIN} + DSFX_I3DL2REVERB_ROOMHF_MAX = 0; + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMHF_MAX} + DSFX_I3DL2REVERB_ROOMHF_DEFAULT = (-100); + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMHF_DEFAULT} + + DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN = 0.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN} + DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX = 10.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX} + DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT = 0.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT} + + DSFX_I3DL2REVERB_DECAYTIME_MIN = 0.1; + {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYTIME_MIN} + DSFX_I3DL2REVERB_DECAYTIME_MAX = 20.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYTIME_MAX} + DSFX_I3DL2REVERB_DECAYTIME_DEFAULT = 1.49; + {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYTIME_DEFAULT} + + DSFX_I3DL2REVERB_DECAYHFRATIO_MIN = 0.1; + {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYHFRATIO_MIN} + DSFX_I3DL2REVERB_DECAYHFRATIO_MAX = 2.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYHFRATIO_MAX} + DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT = 0.83; + {$EXTERNALSYM DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT} + + DSFX_I3DL2REVERB_REFLECTIONS_MIN = (-10000); + {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONS_MIN} + DSFX_I3DL2REVERB_REFLECTIONS_MAX = 1000; + {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONS_MAX} + DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT = (-2602); + {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT} + + DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN = 0.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN} + DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX = 0.3; + {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX} + DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT = 0.007; + {$EXTERNALSYM DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT} + + DSFX_I3DL2REVERB_REVERB_MIN = (-10000); + {$EXTERNALSYM DSFX_I3DL2REVERB_REVERB_MIN} + DSFX_I3DL2REVERB_REVERB_MAX = 2000; + {$EXTERNALSYM DSFX_I3DL2REVERB_REVERB_MAX} + DSFX_I3DL2REVERB_REVERB_DEFAULT = (200); + {$EXTERNALSYM DSFX_I3DL2REVERB_REVERB_DEFAULT} + + DSFX_I3DL2REVERB_REVERBDELAY_MIN = 0.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_REVERBDELAY_MIN} + DSFX_I3DL2REVERB_REVERBDELAY_MAX = 0.1; + {$EXTERNALSYM DSFX_I3DL2REVERB_REVERBDELAY_MAX} + DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT = 0.011; + {$EXTERNALSYM DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT} + + DSFX_I3DL2REVERB_DIFFUSION_MIN = 0.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_DIFFUSION_MIN} + DSFX_I3DL2REVERB_DIFFUSION_MAX = 100.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_DIFFUSION_MAX} + DSFX_I3DL2REVERB_DIFFUSION_DEFAULT = 100.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_DIFFUSION_DEFAULT} + + DSFX_I3DL2REVERB_DENSITY_MIN = 0.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_DENSITY_MIN} + DSFX_I3DL2REVERB_DENSITY_MAX = 100.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_DENSITY_MAX} + DSFX_I3DL2REVERB_DENSITY_DEFAULT = 100.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_DENSITY_DEFAULT} + + DSFX_I3DL2REVERB_HFREFERENCE_MIN = 20.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_HFREFERENCE_MIN} + DSFX_I3DL2REVERB_HFREFERENCE_MAX = 20000.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_HFREFERENCE_MAX} + DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT = 5000.0; + {$EXTERNALSYM DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT} + + DSFX_I3DL2REVERB_QUALITY_MIN = 0; + {$EXTERNALSYM DSFX_I3DL2REVERB_QUALITY_MIN} + DSFX_I3DL2REVERB_QUALITY_MAX = 3; + {$EXTERNALSYM DSFX_I3DL2REVERB_QUALITY_MAX} + DSFX_I3DL2REVERB_QUALITY_DEFAULT = 2; + {$EXTERNALSYM DSFX_I3DL2REVERB_QUALITY_DEFAULT} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXI3DL2Reverb);'} + {$EXTERNALSYM IDirectSoundFXI3DL2Reverb} + 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; + {$EXTERNALSYM IID_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; + {$EXTERNALSYM _DSFXWavesReverb} + DSFXWavesReverb = _DSFXWavesReverb; + {$EXTERNALSYM DSFXWavesReverb} + TDSFXWavesReverb = _DSFXWavesReverb; + +const + DSFX_WAVESREVERB_INGAIN_MIN = -96.0; + {$EXTERNALSYM DSFX_WAVESREVERB_INGAIN_MIN} + DSFX_WAVESREVERB_INGAIN_MAX = 0.0; + {$EXTERNALSYM DSFX_WAVESREVERB_INGAIN_MAX} + DSFX_WAVESREVERB_INGAIN_DEFAULT = 0.0; + {$EXTERNALSYM DSFX_WAVESREVERB_INGAIN_DEFAULT} + DSFX_WAVESREVERB_REVERBMIX_MIN = -96.0; + {$EXTERNALSYM DSFX_WAVESREVERB_REVERBMIX_MIN} + DSFX_WAVESREVERB_REVERBMIX_MAX = 0.0; + {$EXTERNALSYM DSFX_WAVESREVERB_REVERBMIX_MAX} + DSFX_WAVESREVERB_REVERBMIX_DEFAULT = 0.0; + {$EXTERNALSYM DSFX_WAVESREVERB_REVERBMIX_DEFAULT} + DSFX_WAVESREVERB_REVERBTIME_MIN = 0.001; + {$EXTERNALSYM DSFX_WAVESREVERB_REVERBTIME_MIN} + DSFX_WAVESREVERB_REVERBTIME_MAX = 3000.0; + {$EXTERNALSYM DSFX_WAVESREVERB_REVERBTIME_MAX} + DSFX_WAVESREVERB_REVERBTIME_DEFAULT = 1000.0; + {$EXTERNALSYM DSFX_WAVESREVERB_REVERBTIME_DEFAULT} + DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN = 0.001; + {$EXTERNALSYM DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN} + DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX = 0.999; + {$EXTERNALSYM DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX} + DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT = 0.001; + {$EXTERNALSYM DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFXWavesReverb);'} + {$EXTERNALSYM IDirectSoundFXWavesReverb} + 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; + {$EXTERNALSYM IID_IDirectSoundFXWavesReverb} + + + // + // IDirectSoundCaptureFXAec + // + + PDSCFXAec = ^TDSCFXAec; + _DSCFXAec = packed record + fEnable: BOOL; + fNoiseFill: BOOL; + dwMode: DWORD; + end; + {$EXTERNALSYM _DSCFXAec} + DSCFXAec = _DSCFXAec; + {$EXTERNALSYM DSCFXAec} + TDSCFXAec = _DSCFXAec; + +const + // These match the AEC_MODE_* constants in the DDK's ksmedia.h file + DSCFX_AEC_MODE_PASS_THROUGH = $0; + {$EXTERNALSYM DSCFX_AEC_MODE_PASS_THROUGH} + DSCFX_AEC_MODE_HALF_DUPLEX = $1; + {$EXTERNALSYM DSCFX_AEC_MODE_HALF_DUPLEX} + DSCFX_AEC_MODE_FULL_DUPLEX = $2; + {$EXTERNALSYM DSCFX_AEC_MODE_FULL_DUPLEX} + + // These match the AEC_STATUS_* constants in ksmedia.h + DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED = $0; + {$EXTERNALSYM DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED} + DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED = $1; + {$EXTERNALSYM DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED} + DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED = $2; + {$EXTERNALSYM DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED} + DSCFX_AEC_STATUS_CURRENTLY_CONVERGED = $8; + {$EXTERNALSYM DSCFX_AEC_STATUS_CURRENTLY_CONVERGED} + +type + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCaptureFXAec);'} + {$EXTERNALSYM IDirectSoundCaptureFXAec} + 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; + {$EXTERNALSYM IID_IDirectSoundCaptureFXAec} + + + // + // IDirectSoundCaptureFXNoiseSuppress + // + + PDSCFXNoiseSuppress = ^TDSCFXNoiseSuppress; + _DSCFXNoiseSuppress = packed record + fEnable: BOOL; + end; + {$EXTERNALSYM _DSCFXNoiseSuppress} + DSCFXNoiseSuppress = _DSCFXNoiseSuppress; + {$EXTERNALSYM DSCFXNoiseSuppress} + TDSCFXNoiseSuppress = _DSCFXNoiseSuppress; + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundCaptureFXNoiseSuppress);'} + {$EXTERNALSYM IDirectSoundCaptureFXNoiseSuppress} + 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; + {$EXTERNALSYM IID_IDirectSoundCaptureFXNoiseSuppress} + + + // + // IDirectSoundFullDuplex + // + + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectSoundFullDuplex);'} + {$EXTERNALSYM 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; + {$EXTERNALSYM IID_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; + {$EXTERNALSYM IDirectSoundCapture8} + IDirectSound3DListener8 = IDirectSound3DListener; + {$EXTERNALSYM IDirectSound3DListener8} + IDirectSound3DBuffer8 = IDirectSound3DBuffer; + {$EXTERNALSYM IDirectSound3DBuffer8} + IDirectSoundNotify8 = IDirectSoundNotify; + {$EXTERNALSYM IDirectSoundNotify8} + IDirectSoundFXGargle8 = IDirectSoundFXGargle; + {$EXTERNALSYM IDirectSoundFXGargle8} + IDirectSoundFXChorus8 = IDirectSoundFXChorus; + {$EXTERNALSYM IDirectSoundFXChorus8} + IDirectSoundFXFlanger8 = IDirectSoundFXFlanger; + {$EXTERNALSYM IDirectSoundFXFlanger8} + IDirectSoundFXEcho8 = IDirectSoundFXEcho; + {$EXTERNALSYM IDirectSoundFXEcho8} + IDirectSoundFXDistortion8 = IDirectSoundFXDistortion; + {$EXTERNALSYM IDirectSoundFXDistortion8} + IDirectSoundFXCompressor8 = IDirectSoundFXCompressor; + {$EXTERNALSYM IDirectSoundFXCompressor8} + IDirectSoundFXParamEq8 = IDirectSoundFXParamEq; + {$EXTERNALSYM IDirectSoundFXParamEq8} + IDirectSoundFXWavesReverb8 = IDirectSoundFXWavesReverb; + {$EXTERNALSYM IDirectSoundFXWavesReverb8} + IDirectSoundFXI3DL2Reverb8 = IDirectSoundFXI3DL2Reverb; + {$EXTERNALSYM IDirectSoundFXI3DL2Reverb8} + IDirectSoundCaptureFXAec8 = IDirectSoundCaptureFXAec; + {$EXTERNALSYM IDirectSoundCaptureFXAec8} + IDirectSoundCaptureFXNoiseSuppress8 = IDirectSoundCaptureFXNoiseSuppress; + {$EXTERNALSYM IDirectSoundCaptureFXNoiseSuppress8} + IDirectSoundFullDuplex8 = IDirectSoundFullDuplex; + {$EXTERNALSYM IDirectSoundFullDuplex8} + + // + // IID definitions for the unchanged DirectSound 8.0 interfaces + // + + IID_IDirectSoundCapture8 = IID_IDirectSoundCapture; + {$EXTERNALSYM IID_IDirectSoundCapture8} + IID_IDirectSound3DListener8 = IID_IDirectSound3DListener; + {$EXTERNALSYM IID_IDirectSound3DListener8} + IID_IDirectSound3DBuffer8 = IID_IDirectSound3DBuffer; + {$EXTERNALSYM IID_IDirectSound3DBuffer8} + IID_IDirectSoundNotify8 = IID_IDirectSoundNotify; + {$EXTERNALSYM IID_IDirectSoundNotify8} + IID_IDirectSoundFXGargle8 = IID_IDirectSoundFXGargle; + {$EXTERNALSYM IID_IDirectSoundFXGargle8} + IID_IDirectSoundFXChorus8 = IID_IDirectSoundFXChorus; + {$EXTERNALSYM IID_IDirectSoundFXChorus8} + IID_IDirectSoundFXFlanger8 = IID_IDirectSoundFXFlanger; + {$EXTERNALSYM IID_IDirectSoundFXFlanger8} + IID_IDirectSoundFXEcho8 = IID_IDirectSoundFXEcho; + {$EXTERNALSYM IID_IDirectSoundFXEcho8} + IID_IDirectSoundFXDistortion8 = IID_IDirectSoundFXDistortion; + {$EXTERNALSYM IID_IDirectSoundFXDistortion8} + IID_IDirectSoundFXCompressor8 = IID_IDirectSoundFXCompressor; + {$EXTERNALSYM IID_IDirectSoundFXCompressor8} + IID_IDirectSoundFXParamEq8 = IID_IDirectSoundFXParamEq; + {$EXTERNALSYM IID_IDirectSoundFXParamEq8} + IID_IDirectSoundFXWavesReverb8 = IID_IDirectSoundFXWavesReverb; + {$EXTERNALSYM IID_IDirectSoundFXWavesReverb8} + IID_IDirectSoundFXI3DL2Reverb8 = IID_IDirectSoundFXI3DL2Reverb; + {$EXTERNALSYM IID_IDirectSoundFXI3DL2Reverb8} + IID_IDirectSoundCaptureFXAec8 = IID_IDirectSoundCaptureFXAec; + {$EXTERNALSYM IID_IDirectSoundCaptureFXAec8} + IID_IDirectSoundCaptureFXNoiseSuppress8 = IID_IDirectSoundCaptureFXNoiseSuppress; + {$EXTERNALSYM IID_IDirectSoundCaptureFXNoiseSuppress8} + IID_IDirectSoundFullDuplex8 = IID_IDirectSoundFullDuplex; + {$EXTERNALSYM IID_IDirectSoundFullDuplex8} +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + +const + // + // Return Codes + // + + // The function completed successfully + DS_OK = S_OK; + {$EXTERNALSYM DS_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) + {$EXTERNALSYM DS_NO_VIRTUALIZATION} + + // 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) + {$EXTERNALSYM DSERR_ALLOCATED} + + // The control (vol, pan, etc.) requested by the caller is not available + DSERR_CONTROLUNAVAIL = MAKE_DSHRESULT_R or 30; // MAKE_DSHRESULT(30) + {$EXTERNALSYM DSERR_CONTROLUNAVAIL} + + // An invalid parameter was passed to the returning function + DSERR_INVALIDPARAM = E_INVALIDARG; + {$EXTERNALSYM DSERR_INVALIDPARAM} + + // This call is not valid for the current state of this object + DSERR_INVALIDCALL = MAKE_DSHRESULT_R or 50; // MAKE_DSHRESULT(50) + {$EXTERNALSYM DSERR_INVALIDCALL} + + // An undetermined error occurred inside the DirectSound subsystem + DSERR_GENERIC = E_FAIL; + {$EXTERNALSYM DSERR_GENERIC} + + // The caller does not have the priority level required for the function to + // succeed + DSERR_PRIOLEVELNEEDED = MAKE_DSHRESULT_R or 70; // MAKE_DSHRESULT(70) + {$EXTERNALSYM DSERR_PRIOLEVELNEEDED} + + // Not enough free memory is available to complete the operation + DSERR_OUTOFMEMORY = E_OUTOFMEMORY; + {$EXTERNALSYM DSERR_OUTOFMEMORY} + + // The specified WAVE format is not supported + DSERR_BADFORMAT = MAKE_DSHRESULT_R or 100; // MAKE_DSHRESULT(100) + {$EXTERNALSYM DSERR_BADFORMAT} + + // The function called is not supported at this time + DSERR_UNSUPPORTED = E_NOTIMPL; + {$EXTERNALSYM DSERR_UNSUPPORTED} + + // No sound driver is available for use + DSERR_NODRIVER = MAKE_DSHRESULT_R or 120; // MAKE_DSHRESULT(120) + {$EXTERNALSYM DSERR_NODRIVER} + + // This object is already initialized + DSERR_ALREADYINITIALIZED = MAKE_DSHRESULT_R or 130; // MAKE_DSHRESULT(130) + {$EXTERNALSYM DSERR_ALREADYINITIALIZED} + + // This object does not support aggregation + DSERR_NOAGGREGATION = CLASS_E_NOAGGREGATION; + {$EXTERNALSYM DSERR_NOAGGREGATION} + + // The buffer memory has been lost, and must be restored + DSERR_BUFFERLOST = MAKE_DSHRESULT_R or 150; // MAKE_DSHRESULT(150) + {$EXTERNALSYM DSERR_BUFFERLOST} + + // Another app has a higher priority level, preventing this call from + // succeeding + DSERR_OTHERAPPHASPRIO = MAKE_DSHRESULT_R or 160; // MAKE_DSHRESULT(160) + {$EXTERNALSYM DSERR_OTHERAPPHASPRIO} + + // This object has not been initialized + DSERR_UNINITIALIZED = MAKE_DSHRESULT_R or 170; // MAKE_DSHRESULT(170) + {$EXTERNALSYM DSERR_UNINITIALIZED} + + // The requested COM interface is not available + DSERR_NOINTERFACE = E_NOINTERFACE; + {$EXTERNALSYM DSERR_NOINTERFACE} + + // Access is denied + DSERR_ACCESSDENIED = E_ACCESSDENIED; + {$EXTERNALSYM DSERR_ACCESSDENIED} + + // Tried to create a DSBCAPS_CTRLFX buffer shorter than DSBSIZE_FX_MIN milliseconds + DSERR_BUFFERTOOSMALL = MAKE_DSHRESULT_R or 180; // MAKE_DSHRESULT(180) + {$EXTERNALSYM DSERR_BUFFERTOOSMALL} + + // Attempt to use DirectSound 8 functionality on an older DirectSound object + DSERR_DS8_REQUIRED = MAKE_DSHRESULT_R or 190; // MAKE_DSHRESULT(190) + {$EXTERNALSYM DSERR_DS8_REQUIRED} + + // A circular loop of send effects was detected + DSERR_SENDLOOP = MAKE_DSHRESULT_R or 200; // MAKE_DSHRESULT(200) + {$EXTERNALSYM DSERR_SENDLOOP} + + // The GUID specified in an audiopath file does not match a valid MIXIN buffer + DSERR_BADSENDBUFFERGUID = MAKE_DSHRESULT_R or 210; // MAKE_DSHRESULT(210) + {$EXTERNALSYM DSERR_BADSENDBUFFERGUID} + + // The object requested was not found (numerically equal to DMUS_E_NOT_FOUND) + DSERR_OBJECTNOTFOUND = MAKE_DSHRESULT_R or 4449; // MAKE_DSHRESULT(4449) + {$EXTERNALSYM DSERR_OBJECTNOTFOUND} + + // 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) + {$EXTERNALSYM DSERR_FXUNAVAILABLE} + + // + // Flags + // + + DSCAPS_PRIMARYMONO = $00000001; + {$EXTERNALSYM DSCAPS_PRIMARYMONO} + DSCAPS_PRIMARYSTEREO = $00000002; + {$EXTERNALSYM DSCAPS_PRIMARYSTEREO} + DSCAPS_PRIMARY8BIT = $00000004; + {$EXTERNALSYM DSCAPS_PRIMARY8BIT} + DSCAPS_PRIMARY16BIT = $00000008; + {$EXTERNALSYM DSCAPS_PRIMARY16BIT} + DSCAPS_CONTINUOUSRATE = $00000010; + {$EXTERNALSYM DSCAPS_CONTINUOUSRATE} + DSCAPS_EMULDRIVER = $00000020; + {$EXTERNALSYM DSCAPS_EMULDRIVER} + DSCAPS_CERTIFIED = $00000040; + {$EXTERNALSYM DSCAPS_CERTIFIED} + DSCAPS_SECONDARYMONO = $00000100; + {$EXTERNALSYM DSCAPS_SECONDARYMONO} + DSCAPS_SECONDARYSTEREO = $00000200; + {$EXTERNALSYM DSCAPS_SECONDARYSTEREO} + DSCAPS_SECONDARY8BIT = $00000400; + {$EXTERNALSYM DSCAPS_SECONDARY8BIT} + DSCAPS_SECONDARY16BIT = $00000800; + {$EXTERNALSYM DSCAPS_SECONDARY16BIT} + + DSSCL_NORMAL = $00000001; + {$EXTERNALSYM DSSCL_NORMAL} + DSSCL_PRIORITY = $00000002; + {$EXTERNALSYM DSSCL_PRIORITY} + DSSCL_EXCLUSIVE = $00000003; + {$EXTERNALSYM DSSCL_EXCLUSIVE} + DSSCL_WRITEPRIMARY = $00000004; + {$EXTERNALSYM DSSCL_WRITEPRIMARY} + + DSSPEAKER_DIRECTOUT = $00000000; + {$EXTERNALSYM DSSPEAKER_DIRECTOUT} + DSSPEAKER_HEADPHONE = $00000001; + {$EXTERNALSYM DSSPEAKER_HEADPHONE} + DSSPEAKER_MONO = $00000002; + {$EXTERNALSYM DSSPEAKER_MONO} + DSSPEAKER_QUAD = $00000003; + {$EXTERNALSYM DSSPEAKER_QUAD} + DSSPEAKER_STEREO = $00000004; + {$EXTERNALSYM DSSPEAKER_STEREO} + DSSPEAKER_SURROUND = $00000005; + {$EXTERNALSYM DSSPEAKER_SURROUND} + DSSPEAKER_5POINT1 = $00000006; + {$EXTERNALSYM DSSPEAKER_5POINT1} + DSSPEAKER_7POINT1 = $00000007; + {$EXTERNALSYM DSSPEAKER_7POINT1} + + DSSPEAKER_GEOMETRY_MIN = $00000005; // 5 degrees + {$EXTERNALSYM DSSPEAKER_GEOMETRY_MIN} + DSSPEAKER_GEOMETRY_NARROW = $0000000A; // 10 degrees + {$EXTERNALSYM DSSPEAKER_GEOMETRY_NARROW} + DSSPEAKER_GEOMETRY_WIDE = $00000014; // 20 degrees + {$EXTERNALSYM DSSPEAKER_GEOMETRY_WIDE} + DSSPEAKER_GEOMETRY_MAX = $000000B4; // 180 degrees + {$EXTERNALSYM DSSPEAKER_GEOMETRY_MAX} + +// #define DSSPEAKER_COMBINED(c, g) ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16)) +function DSSPEAKER_COMBINED(c, g: DWORD): DWORD; +{$EXTERNALSYM DSSPEAKER_COMBINED} +// #define DSSPEAKER_CONFIG(a) ((BYTE)(a)) +function DSSPEAKER_CONFIG(a: Cardinal): Byte; +{$EXTERNALSYM DSSPEAKER_CONFIG} +// #define DSSPEAKER_GEOMETRY(a) ((BYTE)(((DWORD)(a) >> 16) & 0x00FF)) +function DSSPEAKER_GEOMETRY(a: Cardinal): Byte; +{$EXTERNALSYM DSSPEAKER_GEOMETRY} + +const + DSBCAPS_PRIMARYBUFFER = $00000001; + {$EXTERNALSYM DSBCAPS_PRIMARYBUFFER} + DSBCAPS_STATIC = $00000002; + {$EXTERNALSYM DSBCAPS_STATIC} + DSBCAPS_LOCHARDWARE = $00000004; + {$EXTERNALSYM DSBCAPS_LOCHARDWARE} + DSBCAPS_LOCSOFTWARE = $00000008; + {$EXTERNALSYM DSBCAPS_LOCSOFTWARE} + DSBCAPS_CTRL3D = $00000010; + {$EXTERNALSYM DSBCAPS_CTRL3D} + DSBCAPS_CTRLFREQUENCY = $00000020; + {$EXTERNALSYM DSBCAPS_CTRLFREQUENCY} + DSBCAPS_CTRLPAN = $00000040; + {$EXTERNALSYM DSBCAPS_CTRLPAN} + DSBCAPS_CTRLVOLUME = $00000080; + {$EXTERNALSYM DSBCAPS_CTRLVOLUME} + DSBCAPS_CTRLPOSITIONNOTIFY = $00000100; + {$EXTERNALSYM DSBCAPS_CTRLPOSITIONNOTIFY} + DSBCAPS_CTRLFX = $00000200; + {$EXTERNALSYM DSBCAPS_CTRLFX} + DSBCAPS_STICKYFOCUS = $00004000; + {$EXTERNALSYM DSBCAPS_STICKYFOCUS} + DSBCAPS_GLOBALFOCUS = $00008000; + {$EXTERNALSYM DSBCAPS_GLOBALFOCUS} + DSBCAPS_GETCURRENTPOSITION2 = $00010000; + {$EXTERNALSYM DSBCAPS_GETCURRENTPOSITION2} + DSBCAPS_MUTE3DATMAXDISTANCE = $00020000; + {$EXTERNALSYM DSBCAPS_MUTE3DATMAXDISTANCE} + DSBCAPS_LOCDEFER = $00040000; + {$EXTERNALSYM DSBCAPS_LOCDEFER} + + DSBPLAY_LOOPING = $00000001; + {$EXTERNALSYM DSBPLAY_LOOPING} + DSBPLAY_LOCHARDWARE = $00000002; + {$EXTERNALSYM DSBPLAY_LOCHARDWARE} + DSBPLAY_LOCSOFTWARE = $00000004; + {$EXTERNALSYM DSBPLAY_LOCSOFTWARE} + DSBPLAY_TERMINATEBY_TIME = $00000008; + {$EXTERNALSYM DSBPLAY_TERMINATEBY_TIME} + DSBPLAY_TERMINATEBY_DISTANCE = $000000010; + {$EXTERNALSYM DSBPLAY_TERMINATEBY_DISTANCE} + DSBPLAY_TERMINATEBY_PRIORITY = $000000020; + {$EXTERNALSYM DSBPLAY_TERMINATEBY_PRIORITY} + + DSBSTATUS_PLAYING = $00000001; + {$EXTERNALSYM DSBSTATUS_PLAYING} + DSBSTATUS_BUFFERLOST = $00000002; + {$EXTERNALSYM DSBSTATUS_BUFFERLOST} + DSBSTATUS_LOOPING = $00000004; + {$EXTERNALSYM DSBSTATUS_LOOPING} + DSBSTATUS_LOCHARDWARE = $00000008; + {$EXTERNALSYM DSBSTATUS_LOCHARDWARE} + DSBSTATUS_LOCSOFTWARE = $00000010; + {$EXTERNALSYM DSBSTATUS_LOCSOFTWARE} + DSBSTATUS_TERMINATED = $00000020; + {$EXTERNALSYM DSBSTATUS_TERMINATED} + + DSBLOCK_FROMWRITECURSOR = $00000001; + {$EXTERNALSYM DSBLOCK_FROMWRITECURSOR} + DSBLOCK_ENTIREBUFFER = $00000002; + {$EXTERNALSYM DSBLOCK_ENTIREBUFFER} + + DSBFREQUENCY_ORIGINAL = 0; + {$EXTERNALSYM DSBFREQUENCY_ORIGINAL} + DSBFREQUENCY_MIN = 100; + {$EXTERNALSYM DSBFREQUENCY_MIN} +{$IFDEF DIRECTSOUND_VERSION_9} // #if DIRECTSOUND_VERSION >= 0x0900 + DSBFREQUENCY_MAX = 200000; + {$EXTERNALSYM DSBFREQUENCY_MAX} +{$ELSE} + DSBFREQUENCY_MAX = 100000; + {$EXTERNALSYM DSBFREQUENCY_MAX} +{$ENDIF} + + DSBPAN_LEFT = -10000; + {$EXTERNALSYM DSBPAN_LEFT} + DSBPAN_CENTER = 0; + {$EXTERNALSYM DSBPAN_CENTER} + DSBPAN_RIGHT = 10000; + {$EXTERNALSYM DSBPAN_RIGHT} + + DSBVOLUME_MIN = -10000; + {$EXTERNALSYM DSBVOLUME_MIN} + DSBVOLUME_MAX = 0; + {$EXTERNALSYM DSBVOLUME_MAX} + + DSBSIZE_MIN = 4; + {$EXTERNALSYM DSBSIZE_MIN} + DSBSIZE_MAX = $0FFFFFFF; + {$EXTERNALSYM DSBSIZE_MAX} + DSBSIZE_FX_MIN = 150; // NOTE: Milliseconds, not bytes + {$EXTERNALSYM DSBSIZE_FX_MIN} + + DS3DMODE_NORMAL = $00000000; + {$EXTERNALSYM DS3DMODE_NORMAL} + DS3DMODE_HEADRELATIVE = $00000001; + {$EXTERNALSYM DS3DMODE_HEADRELATIVE} + DS3DMODE_DISABLE = $00000002; + {$EXTERNALSYM DS3DMODE_DISABLE} + + DS3D_IMMEDIATE = $00000000; + {$EXTERNALSYM DS3D_IMMEDIATE} + DS3D_DEFERRED = $00000001; + {$EXTERNALSYM DS3D_DEFERRED} +var + // Forced to define as 'var' cos pascal compiler treats all consts as Double + DS3D_MINDISTANCEFACTOR: Single = 1.175494351e-38; // FLT_MIN; + {$EXTERNALSYM DS3D_MINDISTANCEFACTOR} + DS3D_MAXDISTANCEFACTOR: Single = 3.402823466e+38; // FLT_MAX; + {$EXTERNALSYM DS3D_MAXDISTANCEFACTOR} +const + DS3D_DEFAULTDISTANCEFACTOR = 1.0; + {$EXTERNALSYM DS3D_DEFAULTDISTANCEFACTOR} + + DS3D_MINROLLOFFFACTOR = 0.0; + {$EXTERNALSYM DS3D_MINROLLOFFFACTOR} + DS3D_MAXROLLOFFFACTOR = 10.0; + {$EXTERNALSYM DS3D_MAXROLLOFFFACTOR} + DS3D_DEFAULTROLLOFFFACTOR = 1.0; + {$EXTERNALSYM DS3D_DEFAULTROLLOFFFACTOR} + + DS3D_MINDOPPLERFACTOR = 0.0; + {$EXTERNALSYM DS3D_MINDOPPLERFACTOR} + DS3D_MAXDOPPLERFACTOR = 10.0; + {$EXTERNALSYM DS3D_MAXDOPPLERFACTOR} + DS3D_DEFAULTDOPPLERFACTOR = 1.0; + {$EXTERNALSYM DS3D_DEFAULTDOPPLERFACTOR} + + DS3D_DEFAULTMINDISTANCE = 1.0; + {$EXTERNALSYM DS3D_DEFAULTMINDISTANCE} + DS3D_DEFAULTMAXDISTANCE = 1000000000.0; + {$EXTERNALSYM DS3D_DEFAULTMAXDISTANCE} + + DS3D_MINCONEANGLE = 0; + {$EXTERNALSYM DS3D_MINCONEANGLE} + DS3D_MAXCONEANGLE = 360; + {$EXTERNALSYM DS3D_MAXCONEANGLE} + DS3D_DEFAULTCONEANGLE = 360; + {$EXTERNALSYM DS3D_DEFAULTCONEANGLE} + + DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX; + {$EXTERNALSYM DS3D_DEFAULTCONEOUTSIDEVOLUME} + + // IDirectSoundCapture attributes + + DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER; + {$EXTERNALSYM DSCCAPS_EMULDRIVER} + DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED; + {$EXTERNALSYM DSCCAPS_CERTIFIED} + DSCCAPS_MULTIPLECAPTURE = $00000001; + {$EXTERNALSYM DSCCAPS_MULTIPLECAPTURE} + + // IDirectSoundCaptureBuffer attributes + + DSCBCAPS_WAVEMAPPED = $80000000; + {$EXTERNALSYM DSCBCAPS_WAVEMAPPED} + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + DSCBCAPS_CTRLFX = $00000200; + {$EXTERNALSYM DSCBCAPS_CTRLFX} +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + + DSCBLOCK_ENTIREBUFFER = $00000001; + {$EXTERNALSYM DSCBLOCK_ENTIREBUFFER} + + DSCBSTATUS_CAPTURING = $00000001; + {$EXTERNALSYM DSCBSTATUS_CAPTURING} + DSCBSTATUS_LOOPING = $00000002; + {$EXTERNALSYM DSCBSTATUS_LOOPING} + + DSCBSTART_LOOPING = $00000001; + {$EXTERNALSYM DSCBSTART_LOOPING} + + DSBPN_OFFSETSTOP = $FFFFFFFF; + {$EXTERNALSYM DSBPN_OFFSETSTOP} + + DS_CERTIFIED = $00000000; + {$EXTERNALSYM DS_CERTIFIED} + DS_UNCERTIFIED = $00000001; + {$EXTERNALSYM DS_UNCERTIFIED} + + + // + // Flags for the I3DL2 effects + // + + // + // I3DL2 Material Presets + // + + DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW = 0; + {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW} + DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW = 1; + {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW} + DSFX_I3DL2_MATERIAL_PRESET_THINDOOR = 2; + {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_THINDOOR} + DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR = 3; + {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR} + DSFX_I3DL2_MATERIAL_PRESET_WOODWALL = 4; + {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_WOODWALL} + DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL = 5; + {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL} + DSFX_I3DL2_MATERIAL_PRESET_STONEWALL = 6; + {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_STONEWALL} + DSFX_I3DL2_MATERIAL_PRESET_CURTAIN = 7; + {$EXTERNALSYM DSFX_I3DL2_MATERIAL_PRESET_CURTAIN} + +//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; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_DEFAULT} + DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC = 1; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC} + DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL = 2; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL} + DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM = 3; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM} + DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM = 4; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM} + DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM = 5; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM} + DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM = 6; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM} + DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM = 7; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM} + DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL = 8; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL} + DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE = 9; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE} + DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA = 10; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA} + DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR = 11; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR} + DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY = 12; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY} + DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY = 13; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY} + DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR = 14; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR} + DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY = 15; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY} + DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST = 16; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST} + DSFX_I3DL2_ENVIRONMENT_PRESET_CITY = 17; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_CITY} + DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS = 18; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS} + DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY = 19; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY} + DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN = 20; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN} + DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT = 21; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT} + DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE = 22; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE} + DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER = 23; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER} + DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM = 24; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM} + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM = 25; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM} + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM = 26; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM} + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL = 27; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL} + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL = 28; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL} + DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE = 29; + {$EXTERNALSYM DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE} + + // + // 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_DEFAULT} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_GENERIC} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_PADDEDCELL} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_ROOM} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_BATHROOM} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_LIVINGROOM} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_STONEROOM} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_AUDITORIUM} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_CONCERTHALL} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_CAVE} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_ARENA} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_HANGAR} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_HALLWAY} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_ALLEY} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_FOREST} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_CITY} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_MOUNTAINS} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_QUARRY} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_PLAIN} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_PARKINGLOT} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_SEWERPIPE} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_UNDERWATER} + + // + // 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_SMALLROOM} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_LARGEROOM} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_LARGEHALL} + 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); + {$EXTERNALSYM I3DL2_ENVIRONMENT_PRESET_PLATE} + + // + // DirectSound3D Algorithms + // + + // Default DirectSound3D algorithm {00000000-0000-0000-0000-000000000000} + DS3DALG_DEFAULT : TGUID = '{00000000-0000-0000-0000-000000000000}'; // GUID_NULL; + {$EXTERNALSYM DS3DALG_DEFAULT} + + // No virtualization (Pan3D) {C241333F-1C1B-11d2-94F5-00C04FC28ACA} + DS3DALG_NO_VIRTUALIZATION: TGUID = '{c241333f-1c1b-11d2-94f5-00c04fc28aca}'; + {$EXTERNALSYM DS3DALG_NO_VIRTUALIZATION} + + // High-quality HRTF algorithm {C2413340-1C1B-11d2-94F5-00C04FC28ACA} + DS3DALG_HRTF_FULL: TGUID = '{c2413340-1c1b-11d2-94f5-00c04fc28aca}'; + {$EXTERNALSYM DS3DALG_HRTF_FULL} + + // Lower-quality HRTF algorithm {C2413342-1C1B-11d2-94F5-00C04FC28ACA} + DS3DALG_HRTF_LIGHT: TGUID = '{c2413342-1c1b-11d2-94f5-00c04fc28aca}'; + {$EXTERNALSYM DS3DALG_HRTF_LIGHT} + + +{$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}'; + {$EXTERNALSYM GUID_DSFX_STANDARD_GARGLE} + + // Chorus {EFE6629C-81F7-4281-BD91-C9D604A95AF6} + GUID_DSFX_STANDARD_CHORUS: TGUID = '{efe6629c-81f7-4281-bd91-c9d604a95af6}'; + {$EXTERNALSYM GUID_DSFX_STANDARD_CHORUS} + + // Flanger {EFCA3D92-DFD8-4672-A603-7420894BAD98} + GUID_DSFX_STANDARD_FLANGER: TGUID = '{efca3d92-dfd8-4672-a603-7420894bad98}'; + {$EXTERNALSYM GUID_DSFX_STANDARD_FLANGER} + + // Echo/Delay {EF3E932C-D40B-4F51-8CCF-3F98F1B29D5D} + GUID_DSFX_STANDARD_ECHO: TGUID = '{ef3e932c-d40b-4f51-8ccf-3f98f1b29d5d}'; + {$EXTERNALSYM GUID_DSFX_STANDARD_ECHO} + + // Distortion {EF114C90-CD1D-484E-96E5-09CFAF912A21} + GUID_DSFX_STANDARD_DISTORTION: TGUID = '{ef114c90-cd1d-484e-96e5-09cfaf912a21}'; + {$EXTERNALSYM GUID_DSFX_STANDARD_DISTORTION} + + // Compressor/Limiter {EF011F79-4000-406D-87AF-BFFB3FC39D57} + GUID_DSFX_STANDARD_COMPRESSOR: TGUID = '{ef011f79-4000-406d-87af-bffb3fc39d57}'; + {$EXTERNALSYM GUID_DSFX_STANDARD_COMPRESSOR} + + // Parametric Equalization {120CED89-3BF4-4173-A132-3CB406CF3231} + GUID_DSFX_STANDARD_PARAMEQ: TGUID = '{120ced89-3bf4-4173-a132-3cb406cf3231}'; + {$EXTERNALSYM GUID_DSFX_STANDARD_PARAMEQ} + + // I3DL2 Environmental Reverberation: Reverb (Listener) Effect {EF985E71-D5C7-42D4-BA4D-2D073E2E96F4} + GUID_DSFX_STANDARD_I3DL2REVERB: TGUID = '{ef985e71-d5c7-42d4-ba4d-2d073e2e96f4}'; + {$EXTERNALSYM GUID_DSFX_STANDARD_I3DL2REVERB} + + // Waves Reverberation {87FC0268-9A55-4360-95AA-004A1D9DE26C} + GUID_DSFX_WAVES_REVERB: TGUID = '{87fc0268-9a55-4360-95aa-004a1d9de26c}'; + {$EXTERNALSYM GUID_DSFX_WAVES_REVERB} + + // + // 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}'; + {$EXTERNALSYM GUID_DSCFX_CLASS_AEC} + + // Microsoft AEC {CDEBB919-379A-488a-8765-F53CFD36DE40} + GUID_DSCFX_MS_AEC: TGUID = '{cdebb919-379a-488a-8765-f53cfd36de40}'; + {$EXTERNALSYM GUID_DSCFX_MS_AEC} + + // System AEC {1C22C56D-9879-4f5b-A389-27996DDC2810} + GUID_DSCFX_SYSTEM_AEC: TGUID = '{1c22c56d-9879-4f5b-a389-27996ddc2810}'; + {$EXTERNALSYM GUID_DSCFX_SYSTEM_AEC} + + // 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}'; + {$EXTERNALSYM GUID_DSCFX_CLASS_NS} + + // Microsoft Noise Suppresion {11C5C73B-66E9-4ba1-A0BA-E814C6EED92D} + GUID_DSCFX_MS_NS: TGUID = '{11c5c73b-66e9-4ba1-a0ba-e814c6eed92d}'; + {$EXTERNALSYM GUID_DSCFX_MS_NS} + + // System Noise Suppresion {5AB0882E-7274-4516-877D-4EEE99BA4FD0} + GUID_DSCFX_SYSTEM_NS: TGUID = '{5ab0882e-7274-4516-877d-4eee99ba4fd0}'; + {$EXTERNALSYM GUID_DSCFX_SYSTEM_NS} + +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + + +// +// DirectSound API +// + +type + TDSEnumCallbackA = function(lpGuid: PGUID; lpcstrDescription, lpcstrModule: PAnsiChar; + lpContext: Pointer): BOOL; stdcall; + {$NODEFINE TDSEnumCallbackA} + TDSEnumCallbackW = function(lpGuid: PGUID; lpcstrDescription, lpcstrModule: PWideChar; + lpContext: Pointer): BOOL; stdcall; + {$NODEFINE TDSEnumCallbackW} +{$IFDEF UNICODE} + TDSEnumCallback = TDSEnumCallbackW; +{$ELSE} + TDSEnumCallback = TDSEnumCallbackA; +{$ENDIF} + {$NODEFINE TDSEnumCallback} + {$HPPEMIT 'typedef LPDSENUMCALLBACKA TDSEnumCallbackA;'} + {$HPPEMIT 'typedef LPDSENUMCALLBACKW TDSEnumCallbackW;'} + {$HPPEMIT 'typedef LPDSENUMCALLBACK TDSEnumCallback;'} + +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; + {$EXTERNALSYM DirectSoundCreate} + DirectSoundEnumerateW: function(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectSoundEnumerateW} + DirectSoundEnumerateA: function(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectSoundEnumerateA} + DirectSoundEnumerate: function(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectSoundEnumerate} + + DirectSoundCaptureCreate: function(lpGUID: PGUID; out lplpDSC: IDirectSoundCapture; pUnkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectSoundCaptureCreate} + DirectSoundCaptureEnumerateW: function(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectSoundCaptureEnumerateW} + DirectSoundCaptureEnumerateA: function(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectSoundCaptureEnumerateA} + DirectSoundCaptureEnumerate: function(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectSoundCaptureEnumerate} + +//#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; + {$EXTERNALSYM DirectSoundCreate8} + DirectSoundCaptureCreate8: function(pcGuidDevice: PGUID; out ppDSC8: IDirectSoundCapture8; pUnkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectSoundCaptureCreate8} + DirectSoundFullDuplexCreate: TDirectSoundFullDuplexCreateFunc; + {$EXTERNALSYM DirectSoundFullDuplexCreate} + DirectSoundFullDuplexCreate8: TDirectSoundFullDuplexCreateFunc; + {$EXTERNALSYM DirectSoundFullDuplexCreate8} + + GetDeviceID: function(pGuidSrc, pGuidDest: PGUID): HResult; stdcall; + {$EXTERNALSYM GetDeviceID} +//#endif // DIRECTSOUND_VERSION >= 0x0800 + +{$ELSE} +function DirectSoundCreate(lpGuid: PGUID; out ppDS: IDirectSound; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +{$EXTERNALSYM DirectSoundCreate} +function DirectSoundEnumerateW(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateW'; +{$EXTERNALSYM DirectSoundEnumerateW} +function DirectSoundEnumerateA(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateA'; +{$EXTERNALSYM 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} +{$EXTERNALSYM DirectSoundEnumerate} + +function DirectSoundCaptureCreate(lpGUID: PGUID; out lplpDSC: IDirectSoundCapture; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +{$EXTERNALSYM DirectSoundCaptureCreate} +function DirectSoundCaptureEnumerateW(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateW'; +{$EXTERNALSYM DirectSoundCaptureEnumerateW} +function DirectSoundCaptureEnumerateA(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateA'; +{$EXTERNALSYM 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} +{$EXTERNALSYM DirectSoundCaptureEnumerate} + +//#if DIRECTSOUND_VERSION >= 0x0800 +function DirectSoundCreate8(pcGuidDevice: PGUID; out ppDS8: IDirectSound8; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +{$EXTERNALSYM DirectSoundCreate8} +function DirectSoundCaptureCreate8(pcGuidDevice: PGUID; out ppDSC8: IDirectSoundCapture8; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +{$EXTERNALSYM DirectSoundCaptureCreate8} +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; +{$EXTERNALSYM DirectSoundFullDuplexCreate} +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; +{$EXTERNALSYM DirectSoundFullDuplexCreate8} + +function GetDeviceID(pGuidSrc, pGuidDest: PGUID): HResult; stdcall; external DirectSoundDLL; +{$EXTERNALSYM GetDeviceID} +//#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/Game/Code/lib/DSPack/DirectX9/DirectX.inc b/Game/Code/lib/DSPack/DirectX9/DirectX.inc new file mode 100644 index 00000000..aa33115b --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/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/Game/Code/lib/DSPack/DirectX9/Jedi.inc b/Game/Code/lib/DSPack/DirectX9/Jedi.inc new file mode 100644 index 00000000..c7c0c6bb --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/Jedi.inc @@ -0,0 +1,510 @@ +{******************************************************************************} +{ } +{ 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: 2003-07-14, Peter J. Haas (jediplus@pjh2.de) } +{ } +{******************************************************************************} + +(* + +- 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 + BCB 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 + 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 + +- 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 + COMPILER7 Defined when compiling with Delphi 7 or C++ Builder 7 + 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 7 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) + +- 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 ver180} + {$DEFINE COMPILER7} + {$IFDEF BCB} + {$DEFINE BCB7} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI7} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF ver180} + +{$IFDEF ver170} + {$DEFINE COMPILER7} + {$IFDEF BCB} + {$DEFINE BCB7} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI7} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF ver170} + +{$IFDEF ver160} + {$DEFINE COMPILER7} + {$IFDEF BCB} + {$DEFINE BCB7} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI7} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF ver160} + +{$IFDEF VER150} + {$DEFINE COMPILER7} + {$IFDEF BCB} + {$DEFINE BCB7} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI7} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER140} + {$DEFINE COMPILER6} + {$IFDEF BCB} + {$DEFINE BCB6} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI6} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER130} + {$DEFINE COMPILER5} + {$IFDEF BCB} + {$DEFINE BCB5} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI5} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER125} + {$DEFINE COMPILER4} + {$DEFINE BCB4} + {$DEFINE BCB} +{$ENDIF} + +{$IFDEF VER120} + {$DEFINE COMPILER4} + {$DEFINE DELPHI4} + {$DEFINE DELPHI} +{$ENDIF} + +{$IFDEF VER110} + {$DEFINE COMPILER35} + {$DEFINE BCB3} +{$ENDIF} + +{$IFDEF VER100} + {$DEFINE COMPILER3} + {$DEFINE DELPHI3} + {$DEFINE DELPHI} +{$ENDIF} + +{$IFDEF VER93} + {$DEFINE COMPILER2} + {$DEFINE BCB1} + {$DEFINE BCB} +{$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 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 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 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} + +//------------------------------------------------------------------------------ +// 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/Game/Code/lib/DSPack/DirectX9/UseD3D8.inc b/Game/Code/lib/DSPack/DirectX9/UseD3D8.inc new file mode 100644 index 00000000..b7e0419e --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/UseD3D8.inc @@ -0,0 +1,3 @@ +{$IFDEF DXG_COMPAT}DirectXGraphics +{$ELSE}Direct3D8 +{$ENDIF} \ No newline at end of file diff --git a/Game/Code/lib/DSPack/DirectX9/WMF9.pas b/Game/Code/lib/DSPack/DirectX9/WMF9.pas new file mode 100644 index 00000000..ec5fce90 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/WMF9.pas @@ -0,0 +1,15613 @@ + (********************************************************************* + * Windows Media Format 9 API * + * * + * home page : http://www.progdigy.com * + * email : hgourvest@progdigy.com * + * * + * date : 21-02-2003 * + * * + * 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 * + * * + * wmsdkvalidate.h, wmdxva.idl, wmnetsourcecreator.idl, * + * wmsbuffer.idl, drmexternals.id, asferr.h, wmsysprf.h, * + * WMSInternalAdminNetSource.idl, wmsdkidl.idl, dshowasf.idl * + * * + * 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 WMF9; + +interface +{$I DirectX.inc} + +{$IFDEF DYNAMIC_LINK_ALL} + {$DEFINE WMF9_DYNAMIC_LINK} +{$ENDIF} + +{$HPPEMIT '#include "asferr.h"'} +{$HPPEMIT '#include "drmexternals.h"'} +{$HPPEMIT '#include "dshowasf.h"'} +{$HPPEMIT '#include "nserror.h"'} +{$HPPEMIT '#include "wmdxva.h"'} +{$HPPEMIT '#include "wmnetsourcecreator.h"'} +{$HPPEMIT '#include "wmsbuffer.h"'} +{$HPPEMIT '#include "wmsdk.h"'} +{$HPPEMIT '#include "wmsdkidl.h"'} +{$HPPEMIT '#include "wmsdkvalidate.h"'} +{$HPPEMIT '#include "wmsinternaladminnetsource.h"'} +{$HPPEMIT '#include "wmsysprf.h"'} + +uses Windows, ActiveX, DirectShow9; + + +//*@@@+++@@@@****************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +//*@@@---@@@@****************************************************************** + +const + WMProfile_V40_DialUpMBR : TGUID = '{fd7f47f1-72a6-45a4-80f0-3aecefc32c07}'; + {$EXTERNALSYM WMProfile_V40_DialUpMBR} + WMProfile_V40_IntranetMBR : TGUID = '{82cd3321-a94a-4ffc-9c2b-092c10ca16e7}'; + {$EXTERNALSYM WMProfile_V40_IntranetMBR} + WMProfile_V40_2856100MBR : TGUID = '{5a1c2206-dc5e-4186-beb2-4c5a994b132e}'; + {$EXTERNALSYM WMProfile_V40_2856100MBR} + WMProfile_V40_6VoiceAudio : TGUID = '{D508978A-11A0-4d15-B0DA-ACDC99D4F890}'; + {$EXTERNALSYM WMProfile_V40_6VoiceAudio} + WMProfile_V40_16AMRadio : TGUID = '{0f4be81f-d57d-41e1-b2e3-2fad986bfec2}'; + {$EXTERNALSYM WMProfile_V40_16AMRadio} + WMProfile_V40_288FMRadioMono : TGUID = '{7fa57fc8-6ea4-4645-8abf-b6e5a8f814a1}'; + {$EXTERNALSYM WMProfile_V40_288FMRadioMono} + WMProfile_V40_288FMRadioStereo : TGUID = '{22fcf466-aa40-431f-a289-06d0ea1a1e40}'; + {$EXTERNALSYM WMProfile_V40_288FMRadioStereo} + WMProfile_V40_56DialUpStereo : TGUID = '{e8026f87-e905-4594-a3c7-00d00041d1d9}'; + {$EXTERNALSYM WMProfile_V40_56DialUpStereo} + WMProfile_V40_64Audio : TGUID = '{4820b3f7-cbec-41dc-9391-78598714c8e5}'; + {$EXTERNALSYM WMProfile_V40_64Audio} + WMProfile_V40_96Audio : TGUID = '{0efa0ee3-9e64-41e2-837f-3c0038f327ba}'; + {$EXTERNALSYM WMProfile_V40_96Audio} + WMProfile_V40_128Audio : TGUID = '{93ddbe12-13dc-4e32-a35e-40378e34279a}'; + {$EXTERNALSYM WMProfile_V40_128Audio} + WMProfile_V40_288VideoVoice : TGUID = '{bb2bc274-0eb6-4da9-b550-ecf7f2b9948f}'; + {$EXTERNALSYM WMProfile_V40_288VideoVoice} + WMProfile_V40_288VideoAudio : TGUID = '{ac617f2d-6cbe-4e84-8e9a-ce151a12a354}'; + {$EXTERNALSYM WMProfile_V40_288VideoAudio} + WMProfile_V40_288VideoWebServer : TGUID = '{abf2f00d-d555-4815-94ce-8275f3a70bfe}'; + {$EXTERNALSYM WMProfile_V40_288VideoWebServer} + WMProfile_V40_56DialUpVideo : TGUID = '{e21713bb-652f-4dab-99de-71e04400270f}'; + {$EXTERNALSYM WMProfile_V40_56DialUpVideo} + WMProfile_V40_56DialUpVideoWebServer : TGUID = '{b756ff10-520f-4749-a399-b780e2fc9250}'; + {$EXTERNALSYM WMProfile_V40_56DialUpVideoWebServer} + WMProfile_V40_100Video : TGUID = '{8f99ddd8-6684-456b-a0a3-33e1316895f0}'; + {$EXTERNALSYM WMProfile_V40_100Video} + WMProfile_V40_250Video : TGUID = '{541841c3-9339-4f7b-9a22-b11540894e42}'; + {$EXTERNALSYM WMProfile_V40_250Video} + WMProfile_V40_512Video : TGUID = '{70440e6d-c4ef-4f84-8cd0-d5c28686e784}'; + {$EXTERNALSYM WMProfile_V40_512Video} + WMProfile_V40_1MBVideo : TGUID = '{b4482a4c-cc17-4b07-a94e-9818d5e0f13f}'; + {$EXTERNALSYM WMProfile_V40_1MBVideo} + WMProfile_V40_3MBVideo : TGUID = '{55374ac0-309b-4396-b88f-e6e292113f28}'; + {$EXTERNALSYM WMProfile_V40_3MBVideo} + + WMProfile_V70_DialUpMBR : TGUID = '{5B16E74B-4068-45b5-B80E-7BF8C80D2C2F}'; + {$EXTERNALSYM WMProfile_V70_DialUpMBR} + WMProfile_V70_IntranetMBR : TGUID = '{045880DC-34B6-4ca9-A326-73557ED143F3}'; + {$EXTERNALSYM WMProfile_V70_IntranetMBR} + WMProfile_V70_2856100MBR : TGUID = '{07DF7A25-3FE2-4a5b-8B1E-348B0721CA70}'; + {$EXTERNALSYM WMProfile_V70_2856100MBR} + WMProfile_V70_288VideoVoice : TGUID = '{B952F38E-7DBC-4533-A9CA-B00B1C6E9800}'; + {$EXTERNALSYM WMProfile_V70_288VideoVoice} + WMProfile_V70_288VideoAudio : TGUID = '{58BBA0EE-896A-4948-9953-85B736F83947}'; + {$EXTERNALSYM WMProfile_V70_288VideoAudio} + WMProfile_V70_288VideoWebServer : TGUID = '{70A32E2B-E2DF-4ebd-9105-D9CA194A2D50}'; + {$EXTERNALSYM WMProfile_V70_288VideoWebServer} + WMProfile_V70_56VideoWebServer : TGUID = '{DEF99E40-57BC-4ab3-B2D1-B6E3CAF64257}'; + {$EXTERNALSYM WMProfile_V70_56VideoWebServer} + WMProfile_V70_64VideoISDN : TGUID = '{C2B7A7E9-7B8E-4992-A1A1-068217A3B311}'; + {$EXTERNALSYM WMProfile_V70_64VideoISDN} + WMProfile_V70_100Video : TGUID = '{D9F3C932-5EA9-4c6d-89B4-2686E515426E}'; + {$EXTERNALSYM WMProfile_V70_100Video} + WMProfile_V70_256Video : TGUID = '{AFE69B3A-403F-4a1b-8007-0E21CFB3DF84}'; + {$EXTERNALSYM WMProfile_V70_256Video} + WMProfile_V70_384Video : TGUID = '{F3D45FBB-8782-44df-97C6-8678E2F9B13D}'; + {$EXTERNALSYM WMProfile_V70_384Video} + WMProfile_V70_768Video : TGUID = '{0326EBB6-F76E-4964-B0DB-E729978D35EE}'; + {$EXTERNALSYM WMProfile_V70_768Video} + WMProfile_V70_1500Video : TGUID = '{0B89164A-5490-4686-9E37-5A80884E5146}'; + {$EXTERNALSYM WMProfile_V70_1500Video} + WMProfile_V70_2000Video : TGUID = '{AA980124-BF10-4e4f-9AFD-4329A7395CFF}'; + {$EXTERNALSYM WMProfile_V70_2000Video} + WMProfile_V70_700FilmContentVideo : TGUID = '{7A747920-2449-4d76-99CB-FDB0C90484D4}'; + {$EXTERNALSYM WMProfile_V70_700FilmContentVideo} + WMProfile_V70_1500FilmContentVideo : TGUID = '{F6A5F6DF-EE3F-434c-A433-523CE55F516B}'; + {$EXTERNALSYM WMProfile_V70_1500FilmContentVideo} + WMProfile_V70_6VoiceAudio : TGUID = '{EABA9FBF-B64F-49b3-AA0C-73FBDD150AD0}'; + {$EXTERNALSYM WMProfile_V70_6VoiceAudio} + WMProfile_V70_288FMRadioMono : TGUID = '{C012A833-A03B-44a5-96DC-ED95CC65582D}'; + {$EXTERNALSYM WMProfile_V70_288FMRadioMono} + WMProfile_V70_288FMRadioStereo : TGUID = '{E96D67C9-1A39-4dc4-B900-B1184DC83620}'; + {$EXTERNALSYM WMProfile_V70_288FMRadioStereo} + WMProfile_V70_56DialUpStereo : TGUID = '{674EE767-0949-4fac-875E-F4C9C292013B}'; + {$EXTERNALSYM WMProfile_V70_56DialUpStereo} + WMProfile_V70_64AudioISDN : TGUID = '{91DEA458-9D60-4212-9C59-D40919C939E4}'; + {$EXTERNALSYM WMProfile_V70_64AudioISDN} + WMProfile_V70_64Audio : TGUID = '{B29CFFC6-F131-41db-B5E8-99D8B0B945F4}'; + {$EXTERNALSYM WMProfile_V70_64Audio} + WMProfile_V70_96Audio : TGUID = '{A9D4B819-16CC-4a59-9F37-693DBB0302D6}'; + {$EXTERNALSYM WMProfile_V70_96Audio} + WMProfile_V70_128Audio : TGUID = '{C64CF5DA-DF45-40d3-8027-DE698D68DC66}'; + {$EXTERNALSYM WMProfile_V70_128Audio} + WMProfile_V70_225VideoPDA : TGUID = '{F55EA573-4C02-42b5-9026-A8260C438A9F}'; + {$EXTERNALSYM WMProfile_V70_225VideoPDA} + WMProfile_V70_150VideoPDA : TGUID = '{0F472967-E3C6-4797-9694-F0304C5E2F17}'; + {$EXTERNALSYM WMProfile_V70_150VideoPDA} + + WMProfile_V80_255VideoPDA : TGUID = '{FEEDBCDF-3FAC-4c93-AC0D-47941EC72C0B}'; + {$EXTERNALSYM WMProfile_V80_255VideoPDA} + WMProfile_V80_150VideoPDA : TGUID = '{AEE16DFA-2C14-4a2f-AD3F-A3034031784F}'; + {$EXTERNALSYM WMProfile_V80_150VideoPDA} + WMProfile_V80_28856VideoMBR : TGUID = '{D66920C4-C21F-4ec8-A0B4-95CF2BD57FC4}'; + {$EXTERNALSYM WMProfile_V80_28856VideoMBR} + WMProfile_V80_100768VideoMBR : TGUID = '{5BDB5A0E-979E-47d3-9596-73B386392A55}'; + {$EXTERNALSYM WMProfile_V80_100768VideoMBR} + WMProfile_V80_288100VideoMBR : TGUID = '{D8722C69-2419-4b36-B4E0-6E17B60564E5}'; + {$EXTERNALSYM WMProfile_V80_288100VideoMBR} + WMProfile_V80_288Video : TGUID = '{3DF678D9-1352-4186-BBF8-74F0C19B6AE2}'; + {$EXTERNALSYM WMProfile_V80_288Video} + WMProfile_V80_56Video : TGUID = '{254E8A96-2612-405c-8039-F0BF725CED7D}'; + {$EXTERNALSYM WMProfile_V80_56Video} + WMProfile_V80_100Video : TGUID = '{A2E300B4-C2D4-4fc0-B5DD-ECBD948DC0DF}'; + {$EXTERNALSYM WMProfile_V80_100Video} + WMProfile_V80_256Video : TGUID = '{BBC75500-33D2-4466-B86B-122B201CC9AE}'; + {$EXTERNALSYM WMProfile_V80_256Video} + WMProfile_V80_384Video : TGUID = '{29B00C2B-09A9-48bd-AD09-CDAE117D1DA7}'; + {$EXTERNALSYM WMProfile_V80_384Video} + WMProfile_V80_768Video : TGUID = '{74D01102-E71A-4820-8F0D-13D2EC1E4872}'; + {$EXTERNALSYM WMProfile_V80_768Video} + WMProfile_V80_700NTSCVideo : TGUID = '{C8C2985F-E5D9-4538-9E23-9B21BF78F745}'; + {$EXTERNALSYM WMProfile_V80_700NTSCVideo} + WMProfile_V80_1400NTSCVideo : TGUID = '{931D1BEE-617A-4bcd-9905-CCD0786683EE}'; + {$EXTERNALSYM WMProfile_V80_1400NTSCVideo} + WMProfile_V80_384PALVideo : TGUID = '{9227C692-AE62-4f72-A7EA-736062D0E21E}'; + {$EXTERNALSYM WMProfile_V80_384PALVideo} + WMProfile_V80_700PALVideo : TGUID = '{EC298949-639B-45e2-96FD-4AB32D5919C2}'; + {$EXTERNALSYM WMProfile_V80_700PALVideo} + WMProfile_V80_288MonoAudio : TGUID = '{7EA3126D-E1BA-4716-89AF-F65CEE0C0C67}'; + {$EXTERNALSYM WMProfile_V80_288MonoAudio} + WMProfile_V80_288StereoAudio : TGUID = '{7E4CAB5C-35DC-45bb-A7C0-19B28070D0CC}'; + {$EXTERNALSYM WMProfile_V80_288StereoAudio} + WMProfile_V80_32StereoAudio : TGUID = '{60907F9F-B352-47e5-B210-0EF1F47E9F9D}'; + {$EXTERNALSYM WMProfile_V80_32StereoAudio} + WMProfile_V80_48StereoAudio : TGUID = '{5EE06BE5-492B-480a-8A8F-12F373ECF9D4}'; + {$EXTERNALSYM WMProfile_V80_48StereoAudio} + WMProfile_V80_64StereoAudio : TGUID = '{09BB5BC4-3176-457f-8DD6-3CD919123E2D}'; + {$EXTERNALSYM WMProfile_V80_64StereoAudio} + WMProfile_V80_96StereoAudio : TGUID = '{1FC81930-61F2-436f-9D33-349F2A1C0F10}'; + {$EXTERNALSYM WMProfile_V80_96StereoAudio} + WMProfile_V80_128StereoAudio : TGUID = '{407B9450-8BDC-4ee5-88B8-6F527BD941F2}'; + {$EXTERNALSYM WMProfile_V80_128StereoAudio} + WMProfile_V80_288VideoOnly : TGUID = '{8C45B4C7-4AEB-4f78-A5EC-88420B9DADEF}'; + {$EXTERNALSYM WMProfile_V80_288VideoOnly} + WMProfile_V80_56VideoOnly : TGUID = '{6E2A6955-81DF-4943-BA50-68A986A708F6}'; + {$EXTERNALSYM WMProfile_V80_56VideoOnly} + WMProfile_V80_FAIRVBRVideo : TGUID = '{3510A862-5850-4886-835F-D78EC6A64042}'; + {$EXTERNALSYM WMProfile_V80_FAIRVBRVideo} + WMProfile_V80_HIGHVBRVideo : TGUID = '{0F10D9D3-3B04-4fb0-A3D3-88D4AC854ACC}'; + {$EXTERNALSYM WMProfile_V80_HIGHVBRVideo} + WMProfile_V80_BESTVBRVideo : TGUID = '{048439BA-309C-440e-9CB4-3DCCA3756423}'; + {$EXTERNALSYM WMProfile_V80_BESTVBRVideo} + +//*@@@+++@@@@****************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +//*@@@---@@@@****************************************************************** +// + +//import "mediaobj.idl"; +//import "videoacc.idl"; // IAMVideoAccelerator +const + IID_IWMPlayerTimestampHook : TGUID = '{28580dda-d98e-48d0-b7ae-69e473a02825}'; + {$EXTERNALSYM IID_IWMPlayerTimestampHook} + IID_IWMCodecVideoAccelerator : TGUID = '{990641b0-739f-4e94-a808-9888da8f75af}'; + {$EXTERNALSYM IID_IWMCodecVideoAccelerator} + IID_IWMCodecAMVideoAccelerator : TGUID = '{d98ee251-34e0-4a2d-9312-9b4c788d9fa1}'; + {$EXTERNALSYM IID_IWMCodecAMVideoAccelerator} + +type +// Implemented by the player + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMPlayerTimestampHook;'} + {$EXTERNALSYM IWMPlayerTimestampHook} + IWMPlayerTimestampHook = interface(IUnknown) + ['{28580dda-d98e-48d0-b7ae-69e473a02825}'] + (*** IWMPlayerTimestampHook methods ***) + function MapTimestamp(rtIn: TReferenceTime; + out prtOut: TReferenceTime): HRESULT; stdcall; + end; + +// Implemeted by video decoder DMOs for DXVA support + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMCodecAMVideoAccelerator;'} + {$EXTERNALSYM IWMCodecAMVideoAccelerator} + IWMCodecAMVideoAccelerator = interface(IUnknown) + ['{d98ee251-34e0-4a2d-9312-9b4c788d9fa1}'] + (*** IWMCodecAMVideoAccelerator methods ***) + function SetAcceleratorInterface(pIAMVA: IAMVideoAccelerator): HRESULT; stdcall; + function NegotiateConnection(pMediaType: PDMOMediaType ): HRESULT; stdcall; + function SetPlayerNotify(pHook: IWMPlayerTimestampHook): HRESULT; stdcall; + end; + +// Outdated version of IWMCodecAMVideoAccelerator + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMCodecVideoAccelerator;'} + {$EXTERNALSYM IWMCodecVideoAccelerator} + IWMCodecVideoAccelerator = interface(IUnknown) + ['{990641b0-739f-4e94-a808-9888da8f75af}'] + (*** IWMCodecVideoAccelerator methods ***) + function NegotiateConnection(pIAMVA: IAMVideoAccelerator; + pMediaType: PDMOMediaType): HRESULT; + function SetPlayerNotify(pHook: IWMPlayerTimestampHook): HRESULT; + end; + +//***************************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// FileName: WMNetSourceCreator.idl +// +// Abstract: +// +//***************************************************************************** + +const + CLSID_ClientNetManager : TGUID = '{CD12A3CE-9C42-11D2-BEED-0060082F2054}'; + {$EXTERNALSYM CLSID_ClientNetManager} + IID_INSNetSourceCreator : TGUID = '{0C0E4080-9081-11d2-BEEC-0060082F2054}'; + {$EXTERNALSYM IID_INSNetSourceCreator} + +////////////////////////////////////////////////////////////////////////////// +// +// Interface for creating a NetSource plugin. +// +type + {$HPPEMIT 'typedef System::DelphiInterface _di_INSNetSourceCreator;'} + {$EXTERNALSYM INSNetSourceCreator} + INSNetSourceCreator = interface(IUnknown) + ['{0C0E4080-9081-11d2-BEEC-0060082F2054}'] + (*** INSNetSourceCreator methods ***) + function Initialize: HRESULT; stdcall; + + // + // This method is called to create an instance of the a particular + // Network Source plugin + // + function CreateNetSource(pszStreamName: PWideChar; pMonitor: IUnknown; + pData: PBYTE; pUserContext, pCallback: IUnknown; qwContext: Int64): HRESULT; stdcall; + + // + // This method returns the namespace node for the properties of the + // the Network Source plugin that would be used given the + // provided stream name. + // + function GetNetSourceProperties(pszStreamName: PWideChar; + out ppPropertiesNode: IUnknown): HRESULT; stdcall; + + // + // Returns part of the Namespace that is used for values that are + // shared among all Network Source plugins + // + function GetNetSourceSharedNamespace(out ppSharedNamespace: IUnknown): HRESULT; stdcall; + + function GetNetSourceAdminInterface(pszStreamName: PWideChar; + out pVal: OLEVARIANT): HRESULT; stdcall; + + // + // Iterate through the network protocols supported + // + function GetNumProtocolsSupported(out pcProtocols: LongWord): HRESULT; stdcall; + + function GetProtocolName(dwProtocolNum: LongWord; {out} pwszProtocolName: PWideChar; + var pcchProtocolName: Word): HRESULT; stdcall; + + function Shutdown: HRESULT; stdcall; + end; + +//*@@@+++@@@@****************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +//*@@@---@@@@****************************************************************** +const + IID_INSSBuffer : TGUID = '{E1CD3524-03D7-11d2-9EED-006097D2D7CF}'; + {$EXTERNALSYM IID_INSSBuffer} + IID_IWMSBuffer : TGUID = '{E1CD3524-03D7-11d2-9EED-006097D2D7CF}'; + {$EXTERNALSYM IID_IWMSBuffer} + IID_INSSBuffer2 : TGUID = '{4f528693-1035-43fe-b428-757561ad3a68}'; + {$EXTERNALSYM IID_INSSBuffer2} + IID_INSSBuffer3 : TGUID = '{c87ceaaf-75be-4bc4-84eb-ac2798507672}'; + {$EXTERNALSYM IID_INSSBuffer3} + IID_INSSBuffer4 : TGUID = '{b6b8fd5a-32e2-49d4-a910-c26cc85465ed}'; + {$EXTERNALSYM IID_INSSBuffer4} + IID_IWMSBufferAllocator : TGUID = '{61103CA4-2033-11d2-9EF1-006097D2D7CF}'; + {$EXTERNALSYM IID_IWMSBufferAllocator} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_INSSBuffer;'} + {$EXTERNALSYM INSSBuffer} + INSSBuffer = interface(IUnknown) + ['{E1CD3524-03D7-11d2-9EED-006097D2D7CF}'] + (*** INSSBuffer methods ***) + function GetLength(out pdwLength: LongWord): HRESULT; stdcall; + function SetLength(dwLength: LongWord): HRESULT; stdcall; + function GetMaxLength(out pdwLength: LongWord): HRESULT; stdcall; + function GetBuffer(out ppdwBuffer: PBYTE): HRESULT; stdcall; + function GetBufferAndLength(out ppdwBuffer: PBYTE; out pdwLength: LongWord): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_INSSBuffer2;'} + {$EXTERNALSYM INSSBuffer2} + INSSBuffer2 = interface(INSSBuffer) + ['{4F528693-1035-43fe-B428-757561AD3A68}'] + (*** INSSBuffer2 methods ***) + function GetSampleProperties(cbProperties: LongWord; {out} pbProperties: PBYTE): HRESULT; stdcall; + function SetSampleProperties(cbProperties: LongWord; pbProperties: PBYTE): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_INSSBuffer3;'} + {$EXTERNALSYM INSSBuffer3} + INSSBuffer3 = interface(INSSBuffer2) + ['{C87CEAAF-75BE-4bc4-84EB-AC2798507672}'] + (*** INSSBuffer3 methods ***) + function SetProperty(guidBufferProperty: TGUID; pvBufferProperty: Pointer; + dwBufferPropertySize: LongWord): HRESULT; stdcall; + function GetProperty(guidBufferProperty: TGUID; {out} pvBufferProperty: Pointer; + var pdwBufferPropertySize: LongWord): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_INSSBuffer4;'} + {$EXTERNALSYM INSSBuffer4} + INSSBuffer4 = interface(INSSBuffer3) + ['{B6B8FD5A-32E2-49d4-A910-C26CC85465ED}'] + (*** INSSBuffer4 methods ***) + function GetPropertyCount(out pcBufferProperties: LongWord): HRESULT; stdcall; + function GetPropertyByIndex(dwBufferPropertyIndex: LongWord; + out pguidBufferProperty: TGUID; pvBufferProperty: pointer; + var pdwBufferPropertySize: LongWord): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMSBufferAllocator;'} + {$EXTERNALSYM IWMSBufferAllocator} + IWMSBufferAllocator = interface(IUnknown) + ['{61103CA4-2033-11d2-9EF1-006097D2D7CF}'] + (*** IWMSBufferAllocator methods ***) + function AllocateBuffer(dwMaxBufferSize: LongWord; out ppBuffer: INSSBuffer): HRESULT; stdcall; + function AllocatePageSizeBuffer(dwMaxBufferSize: LongWord; out ppBuffer: INSSBuffer): HRESULT; stdcall; + end; + +//*@@@+++@@@@****************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +//*@@@---@@@@****************************************************************** +// + +// The following is a partial list of DRM actions that are of interest to applications +const + g_wszWMDRM_RIGHT_PLAYBACK = WideString('Play'); + {$EXTERNALSYM g_wszWMDRM_RIGHT_PLAYBACK} + g_wszWMDRM_RIGHT_COPY_TO_CD = WideString('Print.redbook'); + {$EXTERNALSYM g_wszWMDRM_RIGHT_COPY_TO_CD} + g_wszWMDRM_RIGHT_COPY_TO_SDMI_DEVICE = WideString('Transfer.SDMI'); + {$EXTERNALSYM g_wszWMDRM_RIGHT_COPY_TO_SDMI_DEVICE} + g_wszWMDRM_RIGHT_COPY_TO_NON_SDMI_DEVICE = WideString('Transfer.NONSDMI'); + {$EXTERNALSYM g_wszWMDRM_RIGHT_COPY_TO_NON_SDMI_DEVICE} + g_wszWMDRM_RIGHT_BACKUP = WideString('Backup'); + {$EXTERNALSYM g_wszWMDRM_RIGHT_BACKUP} + + g_wszWMDRM_IsDRM = WideString('IsDRM'); + {$EXTERNALSYM g_wszWMDRM_IsDRM} + g_wszWMDRM_IsDRMCached = WideString('IsDRMCached'); + {$EXTERNALSYM g_wszWMDRM_IsDRMCached} + g_wszWMDRM_BaseLicenseAcqURL = WideString('BaseLAURL'); + {$EXTERNALSYM g_wszWMDRM_BaseLicenseAcqURL} + g_wszWMDRM_Rights = WideString('Rights'); + {$EXTERNALSYM g_wszWMDRM_Rights} + g_wszWMDRM_LicenseID = WideString('LID'); + {$EXTERNALSYM g_wszWMDRM_LicenseID} + + g_wszWMDRM_ActionAllowed = WideString('ActionAllowed.'); + {$EXTERNALSYM g_wszWMDRM_ActionAllowed} + g_wszWMDRM_ActionAllowed_Playback = WideString('ActionAllowed.Play'); + {$EXTERNALSYM g_wszWMDRM_ActionAllowed_Playback} + g_wszWMDRM_ActionAllowed_CopyToCD = WideString('ActionAllowed.Print.redbook'); + {$EXTERNALSYM g_wszWMDRM_ActionAllowed_CopyToCD} + g_wszWMDRM_ActionAllowed_CopyToSDMIDevice = WideString('ActionAllowed.Transfer.SDMI'); + {$EXTERNALSYM g_wszWMDRM_ActionAllowed_CopyToSDMIDevice} + g_wszWMDRM_ActionAllowed_CopyToNonSDMIDevice = WideString('ActionAllowed.Transfer.NONSDMI'); + {$EXTERNALSYM g_wszWMDRM_ActionAllowed_CopyToNonSDMIDevice} + g_wszWMDRM_ActionAllowed_Backup = WideString('ActionAllowed.Backup'); + {$EXTERNALSYM g_wszWMDRM_ActionAllowed_Backup} + + g_wszWMDRM_LicenseState = WideString('LicenseStateData.'); + {$EXTERNALSYM g_wszWMDRM_LicenseState} + g_wszWMDRM_LicenseState_Playback = WideString('LicenseStateData.Play'); + {$EXTERNALSYM g_wszWMDRM_LicenseState_Playback} + g_wszWMDRM_LicenseState_CopyToCD = WideString('LicenseStateData.Print.redbook'); + {$EXTERNALSYM g_wszWMDRM_LicenseState_CopyToCD} + g_wszWMDRM_LicenseState_CopyToSDMIDevice = WideString('LicenseStateData.Transfer.SDMI'); + {$EXTERNALSYM g_wszWMDRM_LicenseState_CopyToSDMIDevice} + g_wszWMDRM_LicenseState_CopyToNonSDMIDevice = WideString('LicenseStateData.Transfer.NONSDMI'); + {$EXTERNALSYM g_wszWMDRM_LicenseState_CopyToNonSDMIDevice} + + g_wszWMDRM_DRMHeader = WideString('DRMHeader.'); + {$EXTERNALSYM g_wszWMDRM_DRMHeader} + g_wszWMDRM_DRMHeader_KeyID = WideString('DRMHeader.KID'); + {$EXTERNALSYM g_wszWMDRM_DRMHeader_KeyID} + g_wszWMDRM_DRMHeader_LicenseAcqURL = WideString('DRMHeader.LAINFO'); + {$EXTERNALSYM g_wszWMDRM_DRMHeader_LicenseAcqURL} + g_wszWMDRM_DRMHeader_ContentID = WideString('DRMHeader.CID'); + {$EXTERNALSYM g_wszWMDRM_DRMHeader_ContentID} + g_wszWMDRM_DRMHeader_IndividualizedVersion = WideString('DRMHeader.SECURITYVERSION'); + {$EXTERNALSYM g_wszWMDRM_DRMHeader_IndividualizedVersion} + g_wszWMDRM_DRMHeader_ContentDistributor = WideString('DRMHeader.ContentDistributor'); + {$EXTERNALSYM g_wszWMDRM_DRMHeader_ContentDistributor} + g_wszWMDRM_DRMHeader_SubscriptionContentID = WideString('DRMHeader.SubscriptionContentID'); + {$EXTERNALSYM g_wszWMDRM_DRMHeader_SubscriptionContentID} + + +// This enum indicates the category for each possible output string to be displayed. +// 0 - Playback not permitted. +// 1 - Playback unlimited. +// 2 - Playback valid 5 times. +// 3 - Playback valid from 7/12/00. +// 4 - Playback valid until 7/12/00. +// 5 - Playback valid from 5/12 to 9/12. +// 6 - Playback valid 5 times from 7/12/00. +// 7 - Playback valid 5 times until 7/12/00. +// 8 - Playback valid 5 times from 5/12 to 9/12. +// 9 - Playback valid for 24 hours from first use. +type + DRM_LICENSE_STATE_CATEGORY = ( + WM_DRM_LICENSE_STATE_NORIGHT, + WM_DRM_LICENSE_STATE_UNLIM, + WM_DRM_LICENSE_STATE_COUNT, + WM_DRM_LICENSE_STATE_FROM, + WM_DRM_LICENSE_STATE_UNTIL, + WM_DRM_LICENSE_STATE_FROM_UNTIL, + WM_DRM_LICENSE_STATE_COUNT_FROM, + WM_DRM_LICENSE_STATE_COUNT_UNTIL, + WM_DRM_LICENSE_STATE_COUNT_FROM_UNTIL, + WM_DRM_LICENSE_STATE_EXPIRATION_AFTER_FIRSTUSE + ); + {$EXTERNALSYM DRM_LICENSE_STATE_CATEGORY} + TDRMLicenseStateCategory = DRM_LICENSE_STATE_CATEGORY; + + PDRMLicenseStateData = ^TDRMLicenseStateData; + _DRM_LICENSE_STATE_DATA = packed record + dwStreamId : LongWord; // 0 -> All streams, != 0 -> A particular stream. + dwCategory : TDRMLicenseStateCategory; // Indicates the category of string to be displayed. + dwNumCounts : LongWord; // Number of items supplied in dwCount. + dwCount : array[0..3] of LongWord; // Up to 4 counts. + dwNumDates : LongWord; // Number of items supplied in dwDate. + datetime : array [0..3] of FILETIME; // Up to 4 dates. + dwVague : LongWord; // 0 -> certain, 1 -> atleast. (There could be more + // licenses. Aggregation not possible.) + end; + {$EXTERNALSYM _DRM_LICENSE_STATE_DATA} + DRM_LICENSE_STATE_DATA = _DRM_LICENSE_STATE_DATA; + {$EXTERNALSYM DRM_LICENSE_STATE_DATA} + TDRMLicenseStateData = _DRM_LICENSE_STATE_DATA; + + DRM_HTTP_STATUS = ( + HTTP_NOTINITIATED, + HTTP_CONNECTING, + HTTP_REQUESTING, + HTTP_RECEIVING, + HTTP_COMPLETED + ); + {$EXTERNALSYM DRM_HTTP_STATUS} + TDRMHTTPStatus = DRM_HTTP_STATUS; + + // The various states individualization can be in: +{$IFNDEF COMPILER6_UP} + DRM_INDIVIDUALIZATION_STATUS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + const + INDI_UNDEFINED = $00; + {$EXTERNALSYM INDI_UNDEFINED} + INDI_BEGIN = $01; + {$EXTERNALSYM INDI_BEGIN} + INDI_SUCCEED = $02; + {$EXTERNALSYM INDI_SUCCEED} + INDI_FAIL = $04; + {$EXTERNALSYM INDI_FAIL} + INDI_CANCEL = $08; + {$EXTERNALSYM INDI_CANCEL} + INDI_DOWNLOAD = $10; + {$EXTERNALSYM INDI_DOWNLOAD} + INDI_INSTALL = $20; + {$EXTERNALSYM INDI_INSTALL} +{$ELSE} +type + DRM_INDIVIDUALIZATION_STATUS = ( + INDI_UNDEFINED = $00, + INDI_BEGIN = $01, + INDI_SUCCEED = $02, + INDI_FAIL = $04, + INDI_CANCEL = $08, + INDI_DOWNLOAD = $10, + INDI_INSTALL = $20 + ); +{$ENDIF} +type + {$EXTERNALSYM DRM_INDIVIDUALIZATION_STATUS} + TDRMIndividualizationStatus = DRM_INDIVIDUALIZATION_STATUS; + +type + PWMIndividualizeStatus = ^TWMIndividualizeStatus; + _WMIndividualizeStatus = packed record + hr : HRESULT; + enIndiStatus : TDRMIndividualizationStatus; + pszIndiRespUrl : PChar; + dwHTTPRequest : LongWord; + enHTTPStatus : TDRMHTTPStatus; + dwHTTPReadProgress : LongWord; + dwHTTPReadTotal : LongWord; + end; + {$EXTERNALSYM _WMIndividualizeStatus} + WM_INDIVIDUALIZE_STATUS = _WMIndividualizeStatus; + {$EXTERNALSYM WM_INDIVIDUALIZE_STATUS} + TWMIndividualizeStatus = _WMIndividualizeStatus; + + PWMGetLicenseData = ^TWMGetLicenseData; + _WMGetLicenseData = packed record + dwSize : LongWord; + hr : HRESULT; + wszURL : PWideChar; + wszLocalFilename : PWideChar; + pbPostData : PBYTE; + dwPostDataSize : LongWord; + end; + {$EXTERNALSYM _WMGetLicenseData} + WM_GET_LICENSE_DATA = _WMGetLicenseData; + {$EXTERNALSYM WM_GET_LICENSE_DATA} + TWMGetLicenseData = _WMGetLicenseData; + + +//***************************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// FileName: WMSInternalAdminNetSource.idl +// +// Abstract: +// +//***************************************************************************** + +const + IID_IWMSInternalAdminNetSource : TGUID = '{8BB23E5F-D127-4afb-8D02-AE5B66D54C78}'; + {$EXTERNALSYM IID_IWMSInternalAdminNetSource} + IID_IWMSInternalAdminNetSource2 : TGUID = '{E74D58C3-CF77-4b51-AF17-744687C43EAE}'; + {$EXTERNALSYM IID_IWMSInternalAdminNetSource2} + IID_IWMSInternalAdminNetSource3 : TGUID = '{6b63d08e-4590-44af-9eb3-57ff1e73bf80}'; + {$EXTERNALSYM IID_IWMSInternalAdminNetSource3} + +type + NETSOURCE_URLCREDPOLICY_SETTINGS = ( + NETSOURCE_URLCREDPOLICY_SETTING_SILENTLOGONOK, + NETSOURCE_URLCREDPOLICY_SETTING_MUSTPROMPTUSER, + NETSOURCE_URLCREDPOLICY_SETTING_ANONYMOUSONLY + ); + {$EXTERNALSYM NETSOURCE_URLCREDPOLICY_SETTINGS} + TNetSourceURLCredpolicySettings = NETSOURCE_URLCREDPOLICY_SETTINGS; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// This interface is used by WMP 7 and MPXP +// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMSInternalAdminNetSource;'} + {$EXTERNALSYM IWMSInternalAdminNetSource} + IWMSInternalAdminNetSource = interface(IUnknown) + ['{8BB23E5F-D127-4afb-8D02-AE5B66D54C78}'] + (*** IWMSInternalAdminNetSource methods ***) + function Initialize(pSharedNamespace, + pNamespaceNode: IUnknown; + pNetSourceCreator: INSNetSourceCreator; + fEmbeddedInServer: BOOL): HRESULT; stdcall; + + function GetNetSourceCreator(out ppNetSourceCreator: INSNetSourceCreator): HRESULT; stdcall; + + // Authentication + function SetCredentials(bstrRealm, bstrName, bstrPassword: WideString; fPersist, fConfirmedGood: BOOL): HRESULT; stdcall; + function GetCredentials(bstrRealm: WideString; out pbstrName, pbstrPassword: WideString; out pfConfirmedGood: BOOL): HRESULT; stdcall; + function DeleteCredentials(bstrRealm: WideString): HRESULT; stdcall; + function GetCredentialFlags(out lpdwFlags: LongWord): HRESULT; stdcall; + function SetCredentialFlags(dwFlags: LongWord): HRESULT; stdcall; + + // Proxy + function FindProxyForURL(bstrProtocol, bstrHost: WideString; + out pfProxyEnabled: BOOL; + out pbstrProxyServer: WideString; + out pdwProxyPort: LongWord; + var pdwProxyContext: LongWord): HRESULT; stdcall; + + function RegisterProxyFailure(hrParam: HRESULT; dwProxyContext: LongWord): HRESULT; stdcall; + function ShutdownProxyContext(dwProxyContext: LongWord): HRESULT; stdcall; + function IsUsingIE(dwProxyContext: LongWord; out pfIsUsingIE: BOOL): HRESULT; stdcall; + end; + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// This interface is used by WMP 7 and MPXP +// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMSInternalAdminNetSource2;'} + {$EXTERNALSYM IWMSInternalAdminNetSource2} + IWMSInternalAdminNetSource2 = interface(IUnknown) + ['{E74D58C3-CF77-4b51-AF17-744687C43EAE}'] + (*** IWMSInternalAdminNetSource2 methods ***) + // Authentication + function SetCredentialsEx(bstrRealm : WideString; + bstrUrl : WideString; + fProxy : BOOL; + bstrName : WideString; + bstrPassword : WideString; + fPersist : BOOL; + fConfirmedGood : BOOL): HRESULT; stdcall; + + function GetCredentialsEx(bstrRealm : WideString; + bstrUrl : WideString; + fProxy : BOOL; + out pdwUrlPolicy : TNetSourceURLCredpolicySettings; + out pbstrName : WideString; + out pbstrPassword : WideString; + out pfConfirmedGood : BOOL): HRESULT; stdcall; + + function DeleteCredentialsEx(bstrRealm, bstrUrl: WideString; fProxy: BOOL): HRESULT; stdcall; + + function FindProxyForURLEx(bstrProtocol : WideString; + bstrHost : WideString; + bstrUrl : WideString; + out pfProxyEnabled : BOOL; + out pbstrProxyServer : WideString; + out pdwProxyPort : LongWord; + var pdwProxyContext : LongWord): HRESULT; stdcall; + + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMSInternalAdminNetSource3;'} + {$EXTERNALSYM IWMSInternalAdminNetSource3} + IWMSInternalAdminNetSource3 = interface(IWMSInternalAdminNetSource2) + ['{6b63d08e-4590-44af-9eb3-57ff1e73bf80}'] + (*** IWMSInternalAdminNetSource3 methods ***) + function GetNetSourceCreator2(out ppNetSourceCreator: IUnknown): HRESULT; stdcall; + + // Proxy + function FindProxyForURLEx2(bstrProtocol : WideString; + bstrHost : WideString; + bstrUrl : WideString; + out pfProxyEnabled : BOOL; + out pbstrProxyServer : WideString; + out pdwProxyPort : LongWord; + var pqwProxyContext : Int64): HRESULT; stdcall; + + function RegisterProxyFailure2(hrParam: HRESULT; qwProxyContext: Int64): HRESULT; stdcall; + function ShutdownProxyContext2(qwProxyContext: Int64): HRESULT; stdcall; + function IsUsingIE2(qwProxyContext: Int64; out pfIsUsingIE: BOOL): HRESULT; stdcall; + + // Authentication + function SetCredentialsEx2(bstrRealm : WideString; + bstrUrl : WideString; + fProxy : BOOL; + bstrName : WideString; + bstrPassword : WideString; + fPersist : BOOL; + fConfirmedGood : BOOL; + fClearTextAuthentication : BOOL): HRESULT; stdcall; + + function GetCredentialsEx2(bstrRealm : WideString; + bstrUrl : WideString; + fProxy : BOOL; + fClearTextAuthentication : BOOL; + out pdwUrlPolicy : TNetSourceURLCredpolicySettings; + out pbstrName : WideString; + out pbstrPassword : WideString; + out pfConfirmedGood : BOOL): HRESULT; stdcall; + end; + +//*@@@+++@@@@****************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +//*@@@---@@@@****************************************************************** +// + +/////////////////////////////////////////////////////////////////////////////// +// +// Enumerations and constants used by the SDK. +// +/////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// +// Imports, typedefs and forward declarations +// + +/////////////////////////////////////////////////////////////////////////////// +// +// Attributes +// +/////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// +// These are the special case attributes that give information +// about the Windows Media file. +// +const + g_dwWMSpecialAttributes = LongWord(20); + {$EXTERNALSYM g_dwWMSpecialAttributes} + g_wszWMDuration = WideString('Duration'); + {$EXTERNALSYM g_wszWMDuration} + g_wszWMBitrate = WideString('Bitrate'); + {$EXTERNALSYM g_wszWMBitrate} + g_wszWMSeekable = WideString('Seekable'); + {$EXTERNALSYM g_wszWMSeekable} + g_wszWMStridable = WideString('Stridable'); + {$EXTERNALSYM g_wszWMStridable} + g_wszWMBroadcast = WideString('Broadcast'); + {$EXTERNALSYM g_wszWMBroadcast} + g_wszWMProtected = WideString('Is_Protected'); + {$EXTERNALSYM g_wszWMProtected} + g_wszWMTrusted = WideString('Is_Trusted'); + {$EXTERNALSYM g_wszWMTrusted} + g_wszWMSignature_Name = WideString('Signature_Name'); + {$EXTERNALSYM g_wszWMSignature_Name} + g_wszWMHasAudio = WideString('HasAudio'); + {$EXTERNALSYM g_wszWMHasAudio} + g_wszWMHasImage = WideString('HasImage'); + {$EXTERNALSYM g_wszWMHasImage} + g_wszWMHasScript = WideString('HasScript'); + {$EXTERNALSYM g_wszWMHasScript} + g_wszWMHasVideo = WideString('HasVideo'); + {$EXTERNALSYM g_wszWMHasVideo} + g_wszWMCurrentBitrate = WideString('CurrentBitrate'); + {$EXTERNALSYM g_wszWMCurrentBitrate} + g_wszWMOptimalBitrate = WideString('OptimalBitrate'); + {$EXTERNALSYM g_wszWMOptimalBitrate} + g_wszWMHasAttachedImages = WideString('HasAttachedImages'); + {$EXTERNALSYM g_wszWMHasAttachedImages} + g_wszWMSkipBackward = WideString('Can_Skip_Backward'); + {$EXTERNALSYM g_wszWMSkipBackward} + g_wszWMSkipForward = WideString('Can_Skip_Forward'); + {$EXTERNALSYM g_wszWMSkipForward} + g_wszWMNumberOfFrames = WideString('NumberOfFrames'); + {$EXTERNALSYM g_wszWMNumberOfFrames} + g_wszWMFileSize = WideString('FileSize'); + {$EXTERNALSYM g_wszWMFileSize} + g_wszWMHasArbitraryDataStream = WideString('HasArbitraryDataStream'); + {$EXTERNALSYM g_wszWMHasArbitraryDataStream} + g_wszWMHasFileTransferStream = WideString('HasFileTransferStream'); + {$EXTERNALSYM g_wszWMHasFileTransferStream} + g_wszWMContainerFormat = WideString('WM/ContainerFormat'); + {$EXTERNALSYM g_wszWMContainerFormat} + +//////////////////////////////////////////////////////////////// +// +// The content description object supports 5 basic attributes. +// + + g_dwWMContentAttributes = LongWord(5); + {$EXTERNALSYM g_dwWMContentAttributes} + g_wszWMTitle = WideString('Title'); + {$EXTERNALSYM g_wszWMTitle} + g_wszWMAuthor = WideString('Author'); + {$EXTERNALSYM g_wszWMAuthor} + g_wszWMDescription = WideString('Description'); + {$EXTERNALSYM g_wszWMDescription} + g_wszWMRating = WideString('Rating'); + {$EXTERNALSYM g_wszWMRating} + g_wszWMCopyright = WideString('Copyright'); + {$EXTERNALSYM g_wszWMCopyright} + +//////////////////////////////////////////////////////////////// +// +// These attributes are used to configure and query DRM settings in the reader and writer. +// + + g_wszWMUse_DRM = WideString('Use_DRM'); + {$EXTERNALSYM g_wszWMUse_DRM} + g_wszWMDRM_Flags = WideString('DRM_Flags'); + {$EXTERNALSYM g_wszWMDRM_Flags} + g_wszWMDRM_Level = WideString('DRM_Level'); + {$EXTERNALSYM g_wszWMDRM_Level} + g_wszWMUse_Advanced_DRM = WideString('Use_Advanced_DRM'); + {$EXTERNALSYM g_wszWMUse_Advanced_DRM} + g_wszWMDRM_KeySeed = WideString('DRM_KeySeed'); + {$EXTERNALSYM g_wszWMDRM_KeySeed} + g_wszWMDRM_KeyID = WideString('DRM_KeyID'); + {$EXTERNALSYM g_wszWMDRM_KeyID} + g_wszWMDRM_ContentID = WideString('DRM_ContentID'); + {$EXTERNALSYM g_wszWMDRM_ContentID} + g_wszWMDRM_IndividualizedVersion = WideString('DRM_IndividualizedVersion'); + {$EXTERNALSYM g_wszWMDRM_IndividualizedVersion} + g_wszWMDRM_LicenseAcqURL = WideString('DRM_LicenseAcqURL'); + {$EXTERNALSYM g_wszWMDRM_LicenseAcqURL} + g_wszWMDRM_V1LicenseAcqURL = WideString('DRM_V1LicenseAcqURL'); + {$EXTERNALSYM g_wszWMDRM_V1LicenseAcqURL} + g_wszWMDRM_HeaderSignPrivKey = WideString('DRM_HeaderSignPrivKey'); + {$EXTERNALSYM g_wszWMDRM_HeaderSignPrivKey} + g_wszWMDRM_LASignaturePrivKey = WideString('DRM_LASignaturePrivKey'); + {$EXTERNALSYM g_wszWMDRM_LASignaturePrivKey} + g_wszWMDRM_LASignatureCert = WideString('DRM_LASignatureCert'); + {$EXTERNALSYM g_wszWMDRM_LASignatureCert} + g_wszWMDRM_LASignatureLicSrvCert = WideString('DRM_LASignatureLicSrvCert'); + {$EXTERNALSYM g_wszWMDRM_LASignatureLicSrvCert} + g_wszWMDRM_LASignatureRootCert = WideString('DRM_LASignatureRootCert'); + {$EXTERNALSYM g_wszWMDRM_LASignatureRootCert} + +//////////////////////////////////////////////////////////////// +// +// These are the additional attributes defined in the WM attribute +// namespace that give information about the content. +// + + g_wszWMAlbumTitle = WideString('WM/AlbumTitle'); + {$EXTERNALSYM g_wszWMAlbumTitle} + g_wszWMTrack = WideString('WM/Track'); + {$EXTERNALSYM g_wszWMTrack} + g_wszWMPromotionURL = WideString('WM/PromotionURL'); + {$EXTERNALSYM g_wszWMPromotionURL} + g_wszWMAlbumCoverURL = WideString('WM/AlbumCoverURL'); + {$EXTERNALSYM g_wszWMAlbumCoverURL} + g_wszWMGenre = WideString('WM/Genre'); + {$EXTERNALSYM g_wszWMGenre} + g_wszWMYear = WideString('WM/Year'); + {$EXTERNALSYM g_wszWMYear} + g_wszWMGenreID = WideString('WM/GenreID'); + {$EXTERNALSYM g_wszWMGenreID} + g_wszWMMCDI = WideString('WM/MCDI'); + {$EXTERNALSYM g_wszWMMCDI} + g_wszWMComposer = WideString('WM/Composer'); + {$EXTERNALSYM g_wszWMComposer} + g_wszWMLyrics = WideString('WM/Lyrics'); + {$EXTERNALSYM g_wszWMLyrics} + g_wszWMTrackNumber = WideString('WM/TrackNumber'); + {$EXTERNALSYM g_wszWMTrackNumber} + g_wszWMToolName = WideString('WM/ToolName'); + {$EXTERNALSYM g_wszWMToolName} + g_wszWMToolVersion = WideString('WM/ToolVersion'); + {$EXTERNALSYM g_wszWMToolVersion} + g_wszWMIsVBR = WideString('IsVBR'); + {$EXTERNALSYM g_wszWMIsVBR} + +// +// WM/AlbumArtist is a potentially different value than Author +// + g_wszWMAlbumArtist = WideString('WM/AlbumArtist'); + {$EXTERNALSYM g_wszWMAlbumArtist} + +//////////////////////////////////////////////////////////////// +// +// These optional attributes may be used to give information +// about the branding of the content. +// + + g_wszWMBannerImageType = WideString('BannerImageType'); + {$EXTERNALSYM g_wszWMBannerImageType} + g_wszWMBannerImageData = WideString('BannerImageData'); + {$EXTERNALSYM g_wszWMBannerImageData} + g_wszWMBannerImageURL = WideString('BannerImageURL'); + {$EXTERNALSYM g_wszWMBannerImageURL} + g_wszWMCopyrightURL = WideString('CopyrightURL'); + {$EXTERNALSYM g_wszWMCopyrightURL} + +//////////////////////////////////////////////////////////////// +// +// Optional attributes, used to give information +// about video stream properties. +// + + g_wszWMAspectRatioX = WideString('AspectRatioX'); + {$EXTERNALSYM g_wszWMAspectRatioX} + g_wszWMAspectRatioY = WideString('AspectRatioY'); + {$EXTERNALSYM g_wszWMAspectRatioY} + +//////////////////////////////////////////////////////////////// +// +// Optional attributes, used to give information +// about the overall streaming properties of VBR files. +// This attribute takes the format: +// Word wReserved (must be 0) +// WM_LEAKY_BUCKET_PAIR pair1 +// WM_LEAKY_BUCKET_PAIR pair2 +// ... +// + g_wszASFLeakyBucketPairs = WideString('ASFLeakyBucketPairs'); + {$EXTERNALSYM g_wszASFLeakyBucketPairs} + +//////////////////////////////////////////////////////////////// +// +// The NSC file supports the following attributes. +// + g_dwWMNSCAttributes = LongWord(5); + {$EXTERNALSYM g_dwWMNSCAttributes} + g_wszWMNSCName = WideString('NSC_Name'); + {$EXTERNALSYM g_wszWMNSCName} + g_wszWMNSCAddress = WideString('NSC_Address'); + {$EXTERNALSYM g_wszWMNSCAddress} + g_wszWMNSCPhone = WideString('NSC_Phone'); + {$EXTERNALSYM g_wszWMNSCPhone} + g_wszWMNSCEmail = WideString('NSC_Email'); + {$EXTERNALSYM g_wszWMNSCEmail} + g_wszWMNSCDescription = WideString('NSC_Description'); + {$EXTERNALSYM g_wszWMNSCDescription} + + +/////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// +// Attributes introduced in V9 +// + g_wszWMWriter = WideString('WM/Writer'); + {$EXTERNALSYM g_wszWMWriter} + g_wszWMConductor = WideString('WM/Conductor'); + {$EXTERNALSYM g_wszWMConductor} + g_wszWMProducer = WideString('WM/Producer'); + {$EXTERNALSYM g_wszWMProducer} + g_wszWMDirector = WideString('WM/Director'); + {$EXTERNALSYM g_wszWMDirector} + g_wszWMContentGroupDescription = WideString('WM/ContentGroupDescription'); + {$EXTERNALSYM g_wszWMContentGroupDescription} + g_wszWMSubTitle = WideString('WM/SubTitle'); + {$EXTERNALSYM g_wszWMSubTitle} + g_wszWMPartOfSet = WideString('WM/PartOfSet'); + {$EXTERNALSYM g_wszWMPartOfSet} + g_wszWMProtectionType = WideString('WM/ProtectionType'); + {$EXTERNALSYM g_wszWMProtectionType} + g_wszWMVideoHeight = WideString('WM/VideoHeight'); + {$EXTERNALSYM g_wszWMVideoHeight} + g_wszWMVideoWidth = WideString('WM/VideoWidth'); + {$EXTERNALSYM g_wszWMVideoWidth} + g_wszWMVideoFrameRate = WideString('WM/VideoFrameRate'); + {$EXTERNALSYM g_wszWMVideoFrameRate} + g_wszWMMediaClassPrimaryID = WideString('WM/MediaClassPrimaryID'); + {$EXTERNALSYM g_wszWMMediaClassPrimaryID} + g_wszWMMediaClassSecondaryID = WideString('WM/MediaClassSecondaryID'); + {$EXTERNALSYM g_wszWMMediaClassSecondaryID} + g_wszWMPeriod = WideString('WM/Period'); + {$EXTERNALSYM g_wszWMPeriod} + g_wszWMCategory = WideString('WM/Category'); + {$EXTERNALSYM g_wszWMCategory} + g_wszWMPicture = WideString('WM/Picture'); + {$EXTERNALSYM g_wszWMPicture} + g_wszWMLyrics_Synchronised = WideString('WM/Lyrics_Synchronised'); + {$EXTERNALSYM g_wszWMLyrics_Synchronised} + g_wszWMOriginalLyricist = WideString('WM/OriginalLyricist'); + {$EXTERNALSYM g_wszWMOriginalLyricist} + g_wszWMOriginalArtist = WideString('WM/OriginalArtist'); + {$EXTERNALSYM g_wszWMOriginalArtist} + g_wszWMOriginalAlbumTitle = WideString('WM/OriginalAlbumTitle'); + {$EXTERNALSYM g_wszWMOriginalAlbumTitle} + g_wszWMOriginalReleaseYear = WideString('WM/OriginalReleaseYear'); + {$EXTERNALSYM g_wszWMOriginalReleaseYear} + g_wszWMOriginalFilename = WideString('WM/OriginalFilename'); + {$EXTERNALSYM g_wszWMOriginalFilename} + g_wszWMPublisher = WideString('WM/Publisher'); + {$EXTERNALSYM g_wszWMPublisher} + g_wszWMEncodedBy = WideString('WM/EncodedBy'); + {$EXTERNALSYM g_wszWMEncodedBy} + g_wszWMEncodingSettings = WideString('WM/EncodingSettings'); + {$EXTERNALSYM g_wszWMEncodingSettings} + g_wszWMEncodingTime = WideString('WM/EncodingTime'); + {$EXTERNALSYM g_wszWMEncodingTime} + g_wszWMAuthorURL = WideString('WM/AuthorURL'); + {$EXTERNALSYM g_wszWMAuthorURL} + g_wszWMUserWebURL = WideString('WM/UserWebURL'); + {$EXTERNALSYM g_wszWMUserWebURL} + g_wszWMAudioFileURL = WideString('WM/AudioFileURL'); + {$EXTERNALSYM g_wszWMAudioFileURL} + g_wszWMAudioSourceURL = WideString('WM/AudioSourceURL'); + {$EXTERNALSYM g_wszWMAudioSourceURL} + g_wszWMLanguage = WideString('WM/Language'); + {$EXTERNALSYM g_wszWMLanguage} + g_wszWMParentalRating = WideString('WM/ParentalRating'); + {$EXTERNALSYM g_wszWMParentalRating} + g_wszWMBeatsPerMinute = WideString('WM/BeatsPerMinute'); + {$EXTERNALSYM g_wszWMBeatsPerMinute} + g_wszWMInitialKey = WideString('WM/InitialKey'); + {$EXTERNALSYM g_wszWMInitialKey} + g_wszWMMood = WideString('WM/Mood'); + {$EXTERNALSYM g_wszWMMood} + g_wszWMText = WideString('WM/Text'); + {$EXTERNALSYM g_wszWMText} + g_wszWMDVDID = WideString('WM/DVDID'); + {$EXTERNALSYM g_wszWMDVDID} + g_wszWMWMContentID = WideString('WM/WMContentID'); + {$EXTERNALSYM g_wszWMWMContentID} + g_wszWMWMCollectionID = WideString('WM/WMCollectionID'); + {$EXTERNALSYM g_wszWMWMCollectionID} + g_wszWMWMCollectionGroupID = WideString('WM/WMCollectionGroupID'); + {$EXTERNALSYM g_wszWMWMCollectionGroupID} + g_wszWMUniqueFileIdentifier = WideString('WM/UniqueFileIdentifier'); + {$EXTERNALSYM g_wszWMUniqueFileIdentifier} + g_wszWMModifiedBy = WideString('WM/ModifiedBy'); + {$EXTERNALSYM g_wszWMModifiedBy} + g_wszWMRadioStationName = WideString('WM/RadioStationName'); + {$EXTERNALSYM g_wszWMRadioStationName} + g_wszWMRadioStationOwner = WideString('WM/RadioStationOwner'); + {$EXTERNALSYM g_wszWMRadioStationOwner} + g_wszWMPlaylistDelay = WideString('WM/PlaylistDelay'); + {$EXTERNALSYM g_wszWMPlaylistDelay} + g_wszWMCodec = WideString('WM/Codec'); + {$EXTERNALSYM g_wszWMCodec} + g_wszWMDRM = WideString('WM/DRM'); + {$EXTERNALSYM g_wszWMDRM} + g_wszWMISRC = WideString('WM/ISRC'); + {$EXTERNALSYM g_wszWMISRC} + g_wszWMProvider = WideString('WM/Provider'); + {$EXTERNALSYM g_wszWMProvider} + g_wszWMProviderRating = WideString('WM/ProviderRating'); + {$EXTERNALSYM g_wszWMProviderRating} + g_wszWMProviderStyle = WideString('WM/ProviderStyle'); + {$EXTERNALSYM g_wszWMProviderStyle} + g_wszWMContentDistributor = WideString('WM/ContentDistributor'); + {$EXTERNALSYM g_wszWMContentDistributor} + g_wszWMSubscriptionContentID = WideString('WM/SubscriptionContentID'); + {$EXTERNALSYM g_wszWMSubscriptionContentID} + g_wszWMWMADRCPeakReference = WideString('WM/WMADRCPeakReference'); + {$EXTERNALSYM g_wszWMWMADRCPeakReference} + g_wszWMWMADRCPeakTarget = WideString('WM/WMADRCPeakTarget'); + {$EXTERNALSYM g_wszWMWMADRCPeakTarget} + g_wszWMWMADRCAverageReference = WideString('WM/WMADRCAverageReference'); + {$EXTERNALSYM g_wszWMWMADRCAverageReference} + g_wszWMWMADRCAverageTarget = WideString('WM/WMADRCAverageTarget'); + {$EXTERNALSYM g_wszWMWMADRCAverageTarget} + +/////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// +// These are setting names for use in Get/SetOutputSetting +// + g_wszEarlyDataDelivery = WideString('EarlyDataDelivery'); + {$EXTERNALSYM g_wszEarlyDataDelivery} + g_wszJustInTimeDecode = WideString('JustInTimeDecode'); + {$EXTERNALSYM g_wszJustInTimeDecode} + g_wszSingleOutputBuffer = WideString('SingleOutputBuffer'); + {$EXTERNALSYM g_wszSingleOutputBuffer} + g_wszSoftwareScaling = WideString('SoftwareScaling'); + {$EXTERNALSYM g_wszSoftwareScaling} + g_wszDeliverOnReceive = WideString('DeliverOnReceive'); + {$EXTERNALSYM g_wszDeliverOnReceive} + g_wszScrambledAudio = WideString('ScrambledAudio'); + {$EXTERNALSYM g_wszScrambledAudio} + g_wszDedicatedDeliveryThread = WideString('DedicatedDeliveryThread'); + {$EXTERNALSYM g_wszDedicatedDeliveryThread} + g_wszEnableDiscreteOutput = WideString('EnableDiscreteOutput'); + {$EXTERNALSYM g_wszEnableDiscreteOutput} + g_wszSpeakerConfig = WideString('SpeakerConfig'); + {$EXTERNALSYM g_wszSpeakerConfig} + g_wszDynamicRangeControl = WideString('DynamicRangeControl'); + {$EXTERNALSYM g_wszDynamicRangeControl} + g_wszAllowInterlacedOutput = WideString('AllowInterlacedOutput'); + {$EXTERNALSYM g_wszAllowInterlacedOutput} + g_wszVideoSampleDurations = WideString('VideoSampleDurations'); + {$EXTERNALSYM g_wszVideoSampleDurations} + g_wszStreamLanguage = WideString('StreamLanguage'); + {$EXTERNALSYM g_wszStreamLanguage} + + +/////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// +// These are setting names for use in Get/SetInputSetting +// + g_wszDeinterlaceMode = WideString('DeinterlaceMode'); + {$EXTERNALSYM g_wszDeinterlaceMode} + g_wszInitialPatternForInverseTelecine = WideString('InitialPatternForInverseTelecine'); + {$EXTERNALSYM g_wszInitialPatternForInverseTelecine} + g_wszJPEGCompressionQuality = WideString('JPEGCompressionQuality'); + {$EXTERNALSYM g_wszJPEGCompressionQuality} + g_wszWatermarkCLSID = WideString('WatermarkCLSID'); + {$EXTERNALSYM g_wszWatermarkCLSID} + g_wszWatermarkConfig = WideString('WatermarkConfig'); + {$EXTERNALSYM g_wszWatermarkConfig} + g_wszInterlacedCoding = WideString('InterlacedCoding'); + {$EXTERNALSYM g_wszInterlacedCoding} + g_wszFixedFrameRate = WideString('FixedFrameRate'); + {$EXTERNALSYM g_wszFixedFrameRate} + + +//////////////////////////////////////////////////////////////// +// +// All known IWMPropertyVault property names +// +// g_wszOriginalSourceFormatTag is obsolete and has been superceded by g_wszOriginalWaveFormat + g_wszOriginalSourceFormatTag = WideString('_SOURCEFORMATTAG'); + {$EXTERNALSYM g_wszOriginalSourceFormatTag} + g_wszOriginalWaveFormat = WideString('_ORIGINALWAVEFORMAT'); + {$EXTERNALSYM g_wszOriginalWaveFormat} + g_wszEDL = WideString('_EDL'); + {$EXTERNALSYM g_wszEDL} + g_wszComplexity = WideString('_COMPLEXITYEX'); + {$EXTERNALSYM g_wszComplexity} + g_wszDecoderComplexityRequested = WideString('_DECODERCOMPLEXITYPROFILE'); + {$EXTERNALSYM g_wszDecoderComplexityRequested} + + +//////////////////////////////////////////////////////////////// +// +// All known IWMIStreamProps property names +// + g_wszReloadIndexOnSeek = WideString('ReloadIndexOnSeek'); + {$EXTERNALSYM g_wszReloadIndexOnSeek} + g_wszStreamNumIndexObjects = WideString('StreamNumIndexObjects'); + {$EXTERNALSYM g_wszStreamNumIndexObjects} + g_wszFailSeekOnError = WideString('FailSeekOnError'); + {$EXTERNALSYM g_wszFailSeekOnError} + g_wszPermitSeeksBeyondEndOfStream = WideString('PermitSeeksBeyondEndOfStream'); + {$EXTERNALSYM g_wszPermitSeeksBeyondEndOfStream} + g_wszUsePacketAtSeekPoint = WideString('UsePacketAtSeekPoint'); + {$EXTERNALSYM g_wszUsePacketAtSeekPoint} + g_wszSourceBufferTime = WideString('SourceBufferTime'); + {$EXTERNALSYM g_wszSourceBufferTime} + g_wszSourceMaxBytesAtOnce = WideString('SourceMaxBytesAtOnce'); + {$EXTERNALSYM g_wszSourceMaxBytesAtOnce} + + +/////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// +// VBR encoding settings +// + g_wszVBREnabled = WideString('_VBRENABLED'); + {$EXTERNALSYM g_wszVBREnabled} + g_wszVBRQuality = WideString('_VBRQUALITY'); + {$EXTERNALSYM g_wszVBRQuality} + g_wszVBRBitrateMax = WideString('_RMAX'); + {$EXTERNALSYM g_wszVBRBitrateMax} + g_wszVBRBufferWindowMax = WideString('_BMAX'); + {$EXTERNALSYM g_wszVBRBufferWindowMax} + + +//////////////////////////////////////////////////////////////// +// +// VBR Video settings +// + g_wszVBRPeak = WideString('VBR Peak'); + {$EXTERNALSYM g_wszVBRPeak} + g_wszBufferAverage = WideString('Buffer Average'); + {$EXTERNALSYM g_wszBufferAverage} + + +//////////////////////////////////////////////////////////////// +// +// Codec encoding complexity settings +// +// g_wszComplexity should be used to set desired encoding complexity on the +// stream's IWMPropertyVault (see above for definition) +// The below settings can be queried from IWMCodecInfo3::GetCodecProp() +// + g_wszComplexityMax = WideString('_COMPLEXITYEXMAX'); + {$EXTERNALSYM g_wszComplexityMax} + g_wszComplexityOffline = WideString('_COMPLEXITYEXOFFLINE'); + {$EXTERNALSYM g_wszComplexityOffline} + g_wszComplexityLive = WideString('_COMPLEXITYEXLIVE'); + {$EXTERNALSYM g_wszComplexityLive} + g_wszIsVBRSupported = WideString('_ISVBRSUPPORTED'); + {$EXTERNALSYM g_wszIsVBRSupported} + + +//////////////////////////////////////////////////////////////// +// +// Codec enumeration settings +// +// g_wszVBREnabled can be used as a codec enumeration setting (see above for definition) + g_wszNumPasses = WideString('_PASSESUSED'); + {$EXTERNALSYM g_wszNumPasses} + + +//////////////////////////////////////////////////////////////// +// +// These are WMA Voice V9 attribute names and values +// + g_wszMusicSpeechClassMode = WideString('MusicSpeechClassMode'); + {$EXTERNALSYM g_wszMusicSpeechClassMode} + g_wszMusicClassMode = WideString('MusicClassMode'); + {$EXTERNALSYM g_wszMusicClassMode} + g_wszSpeechClassMode = WideString('SpeechClassMode'); + {$EXTERNALSYM g_wszSpeechClassMode} + g_wszMixedClassMode = WideString('MixedClassMode'); + {$EXTERNALSYM g_wszMixedClassMode} + + +//////////////////////////////////////////////////////////////// +// +// The WMA Voice V9 supports the following format property. +// + g_wszSpeechCaps = WideString('SpeechFormatCap'); + {$EXTERNALSYM g_wszSpeechCaps} + + +//////////////////////////////////////////////////////////////// +// +// Multi-channel WMA properties +// + g_wszPeakValue = WideString('PeakValue'); + {$EXTERNALSYM g_wszPeakValue} + g_wszAverageLevel = WideString('AverageLevel'); + {$EXTERNALSYM g_wszAverageLevel} + g_wszFold6To2Channels3 = WideString('Fold6To2Channels3'); + {$EXTERNALSYM g_wszFold6To2Channels3} + g_wszFoldToChannelsTemplate = WideString('Fold%luTo%luChannels%lu'); + {$EXTERNALSYM g_wszFoldToChannelsTemplate} + + +//////////////////////////////////////////////////////////////// +// +// Complexity profile description strings +// + g_wszDeviceConformanceTemplate = WideString('DeviceConformanceTemplate'); + {$EXTERNALSYM g_wszDeviceConformanceTemplate} + + +//////////////////////////////////////////////////////////////// +// +// Frame interpolation on video decode +// + g_wszEnableFrameInterpolation = WideString('EnableFrameInterpolation'); + {$EXTERNALSYM g_wszEnableFrameInterpolation} + + +//////////////////////////////////////////////////////////////// +// +// Needs previous sample for Delta frame on video decode +// + g_wszNeedsPreviousSample = WideString('NeedsPreviousSample'); + {$EXTERNALSYM g_wszNeedsPreviousSample} + + +/////////////////////////////////////////////////////////////////////////////// +// +// Enumerations and flags used by the SDK. +// +/////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// +// Flags that can be passed into the Start method of IWMReader +// + WM_START_CURRENTPOSITION = Int64(-1); + {$EXTERNALSYM WM_START_CURRENTPOSITION} + +// +// Flag to force overwrite of existing license backup +// + WM_BACKUP_OVERWRITE = LongWord($00000001); + {$EXTERNALSYM WM_BACKUP_OVERWRITE} + WM_RESTORE_INDIVIDUALIZE = LongWord($00000002); + {$EXTERNALSYM WM_RESTORE_INDIVIDUALIZE} + +// +// Wave format ex type +// + WAVE_FORMAT_DRM = $0009; + {$EXTERNALSYM WAVE_FORMAT_DRM} + +// +// Sample type ids for Web Streams +// + + WEBSTREAM_SAMPLE_TYPE_FILE = $1; + {$EXTERNALSYM WEBSTREAM_SAMPLE_TYPE_FILE} + WEBSTREAM_SAMPLE_TYPE_RENDER = $2; + {$EXTERNALSYM WEBSTREAM_SAMPLE_TYPE_RENDER} + +// +// The flags that can be set on a sample (input or output). +// + + WM_SF_CLEANPOINT = $1; + {$EXTERNALSYM WM_SF_CLEANPOINT} + WM_SF_DISCONTINUITY = $2; + {$EXTERNALSYM WM_SF_DISCONTINUITY} + WM_SF_DATALOSS = $4; + {$EXTERNALSYM WM_SF_DATALOSS} + +// +// These flags might be set for a call to the IWMReaderAllocatorEx methods. +// + WM_SFEX_NOTASYNCPOINT = $2; + {$EXTERNALSYM WM_SFEX_NOTASYNCPOINT} + WM_SFEX_DATALOSS = $4; + {$EXTERNALSYM WM_SFEX_DATALOSS} + +// +// Status messages that the reader and index objects can +// pass in the OnStatus call. +// +type + WMT_STATUS = ( + WMT_ERROR, + WMT_OPENED, + WMT_BUFFERING_START, + WMT_BUFFERING_STOP, + WMT_END_OF_FILE, +{$IFDEF COMPILER6_UP} + WMT_EOF = 4, +{$ENDIF} + WMT_END_OF_SEGMENT, + WMT_END_OF_STREAMING, + WMT_LOCATING, + WMT_CONNECTING, + WMT_NO_RIGHTS, + WMT_MISSING_CODEC, + WMT_STARTED, + WMT_STOPPED, + WMT_CLOSED, + WMT_STRIDING, + WMT_TIMER, + WMT_INDEX_PROGRESS, + WMT_SAVEAS_START, + WMT_SAVEAS_STOP, + WMT_NEW_SOURCEFLAGS, + WMT_NEW_METADATA, + WMT_BACKUPRESTORE_BEGIN, + WMT_SOURCE_SWITCH, + WMT_ACQUIRE_LICENSE, + WMT_INDIVIDUALIZE, + WMT_NEEDS_INDIVIDUALIZATION, + WMT_NO_RIGHTS_EX, + WMT_BACKUPRESTORE_END, + WMT_BACKUPRESTORE_CONNECTING, + WMT_BACKUPRESTORE_DISCONNECTING, + WMT_ERROR_WITHURL, + WMT_RESTRICTED_LICENSE, + WMT_CLIENT_CONNECT, + WMT_CLIENT_DISCONNECT, + WMT_NATIVE_OUTPUT_PROPS_CHANGED, + WMT_RECONNECT_START, + WMT_RECONNECT_END, + WMT_CLIENT_CONNECT_EX, + WMT_CLIENT_DISCONNECT_EX, + WMT_SET_FEC_SPAN, + WMT_PREROLL_READY, + WMT_PREROLL_COMPLETE, + WMT_CLIENT_PROPERTIES, + WMT_LICENSEURL_SIGNATURE_STATE + ); + {$EXTERNALSYM WMT_STATUS} + TWMTStatus = WMT_STATUS; + +{$IFNDEF COMPILER6_UP} +const + WMT_EOF = WMT_END_OF_FILE; + {$NODEFINE WMT_EOF} +{$ENDIF} + + +type + WMT_RIGHTS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM WMT_RIGHTS} + const + WMT_RIGHT_PLAYBACK = $00000001; + {$EXTERNALSYM WMT_RIGHT_PLAYBACK} + WMT_RIGHT_COPY_TO_NON_SDMI_DEVICE = $00000002; + {$EXTERNALSYM WMT_RIGHT_COPY_TO_NON_SDMI_DEVICE} + WMT_RIGHT_COPY_TO_CD = $00000008; + {$EXTERNALSYM WMT_RIGHT_COPY_TO_CD} + WMT_RIGHT_COPY_TO_SDMI_DEVICE = $00000010; + {$EXTERNALSYM WMT_RIGHT_COPY_TO_SDMI_DEVICE} + WMT_RIGHT_ONE_TIME = $00000020; + {$EXTERNALSYM WMT_RIGHT_ONE_TIME} + WMT_RIGHT_SAVE_STREAM_PROTECTED = $00000040; + {$EXTERNALSYM WMT_RIGHT_SAVE_STREAM_PROTECTED} + WMT_RIGHT_SDMI_TRIGGER = $00010000; + {$EXTERNALSYM WMT_RIGHT_SDMI_TRIGGER} + WMT_RIGHT_SDMI_NOMORECOPIES = $00020000; + {$EXTERNALSYM WMT_RIGHT_SDMI_NOMORECOPIES} + +// +// Stream selection statuses (stati?). +// +type + PWMTStreamSelection = ^TWMTStreamSelection; + WMT_STREAM_SELECTION = ( + WMT_OFF, + WMT_CLEANPOINT_ONLY, + WMT_ON + ); + {$EXTERNALSYM WMT_STREAM_SELECTION} + TWMTStreamSelection = WMT_STREAM_SELECTION; + +// +// Image types (used with CBO) +// + WMT_IMAGE_TYPE = ( + WMT_IT_NONE, + WMT_IT_BITMAP, + WMT_IT_JPEG, + WMT_IT_GIF + ); + {$EXTERNALSYM WMT_IMAGE_TYPE} + TWMTImageType = WMT_IMAGE_TYPE; + +// +// Attribute datatypes. +// + WMT_ATTR_DATATYPE = ( + WMT_TYPE_DWORD, + WMT_TYPE_STRING, + WMT_TYPE_BINARY, + WMT_TYPE_BOOL, + WMT_TYPE_QWORD, + WMT_TYPE_WORD, + WMT_TYPE_GUID + ); + {$EXTERNALSYM WMT_ATTR_DATATYPE} + TWMTAttrDataType = WMT_ATTR_DATATYPE; + +// +// Types of images that can be stored in the header of a Windows Media File. +// + WMT_ATTR_IMAGETYPE = ( +{$IFNDEF COMPILER6_UP} + WMT_IMAGETYPE_INVALID_0, + WMT_IMAGETYPE_BITMAP, +{$ELSE} + WMT_IMAGETYPE_BITMAP = 1, +{$ENDIF} + WMT_IMAGETYPE_JPEG, + WMT_IMAGETYPE_GIF + ); + {$EXTERNALSYM WMT_ATTR_IMAGETYPE} + TWMTAttrImageType = WMT_ATTR_IMAGETYPE; + +// +// Windows Media versions. +// + WMT_VERSION = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM WMT_VERSION} + const + WMT_VER_4_0 = $00040000; + {$EXTERNALSYM WMT_VER_4_0} + WMT_VER_7_0 = $00070000; + {$EXTERNALSYM WMT_VER_7_0} + WMT_VER_8_0 = $00080000; + {$EXTERNALSYM WMT_VER_8_0} + WMT_VER_9_0 = $00090000; + {$EXTERNALSYM WMT_VER_9_0} + +// +// Storage formats. These are the values returned when querying +// the WM/ContainerFormat attribute (g_wszWMContainerFormat). +// +type + tagWMT_STORAGE_FORMAT = ( + WMT_Storage_Format_MP3, + WMT_Storage_Format_V1 + ); + {$EXTERNALSYM tagWMT_STORAGE_FORMAT} + WMT_STORAGE_FORMAT = tagWMT_STORAGE_FORMAT; + {$EXTERNALSYM WMT_STORAGE_FORMAT} + TWMTStorageFormat = tagWMT_STORAGE_FORMAT; + + tagWMT_DRMLA_TRUST = ( + WMT_DRMLA_UNTRUSTED, + WMT_DRMLA_TRUSTED, + WMT_DRMLA_TAMPERED + ); + {$EXTERNALSYM tagWMT_DRMLA_TRUST} + WMT_DRMLA_TRUST = tagWMT_DRMLA_TRUST; + {$EXTERNALSYM WMT_DRMLA_TRUST} + TWMTDRMLATrust = tagWMT_DRMLA_TRUST; + +// +// Type of data communication protocol (reliable or unreliable) +// + tagWMT_TRANSPORT_TYPE = ( + WMT_Transport_Type_Unreliable, + WMT_Transport_Type_Reliable + ); + {$EXTERNALSYM tagWMT_TRANSPORT_TYPE} + WMT_TRANSPORT_TYPE = tagWMT_TRANSPORT_TYPE; + {$EXTERNALSYM WMT_TRANSPORT_TYPE} + TWMTTransportType = tagWMT_TRANSPORT_TYPE; + +// +// Protocols that the network sink supports. +// + WMT_NET_PROTOCOL = ( + WMT_PROTOCOL_HTTP + ); + {$EXTERNALSYM WMT_NET_PROTOCOL} + TWMTNetProtocol = WMT_NET_PROTOCOL; + +// +// The reader supports a number of different types of playback, each with +// slightly different characteristics. +// + WMT_PLAY_MODE = ( + WMT_PLAY_MODE_AUTOSELECT, + WMT_PLAY_MODE_LOCAL, + WMT_PLAY_MODE_DOWNLOAD, + WMT_PLAY_MODE_STREAMING + ); + {$EXTERNALSYM WMT_PLAY_MODE} + TWMTPlayMode = WMT_PLAY_MODE; + +// +// Network Proxy settings for the reader +// + WMT_PROXY_SETTINGS = ( + WMT_PROXY_SETTING_NONE, + WMT_PROXY_SETTING_MANUAL, + WMT_PROXY_SETTING_AUTO, + WMT_PROXY_SETTING_BROWSER, // Only valid for HTTP + WMT_PROXY_SETTING_MAX + ); + {$EXTERNALSYM WMT_PROXY_SETTINGS} + TWMTProxySettings = WMT_PROXY_SETTINGS; + + WMT_CODEC_INFO_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM WMT_CODEC_INFO_TYPE} + const + WMT_CODECINFO_AUDIO = 0; // codec info is a Word = wFormatTag + {$EXTERNALSYM WMT_CODECINFO_AUDIO} + WMT_CODECINFO_VIDEO = 1; // codec info is a LongWord = biCompression + {$EXTERNALSYM WMT_CODECINFO_VIDEO} + WMT_CODECINFO_UNKNOWN = $FFFFFFFF; // codec info is undefined + {$EXTERNALSYM WMT_CODECINFO_UNKNOWN} + +// +// These values can be passed in when setting the DeinterlaceMode +// setting on the writer +// + WM_DM_NOTINTERLACED = LongWord(0); + {$EXTERNALSYM WM_DM_NOTINTERLACED} + WM_DM_DEINTERLACE_NORMAL = LongWord(1); + {$EXTERNALSYM WM_DM_DEINTERLACE_NORMAL} + WM_DM_DEINTERLACE_HALFSIZE = LongWord(2); + {$EXTERNALSYM WM_DM_DEINTERLACE_HALFSIZE} + WM_DM_DEINTERLACE_HALFSIZEDOUBLERATE = LongWord(3); + {$EXTERNALSYM WM_DM_DEINTERLACE_HALFSIZEDOUBLERATE} + WM_DM_DEINTERLACE_INVERSETELECINE = LongWord(4); + {$EXTERNALSYM WM_DM_DEINTERLACE_INVERSETELECINE} + WM_DM_DEINTERLACE_VERTICALHALFSIZEDOUBLERATE = LongWord(5); + {$EXTERNALSYM WM_DM_DEINTERLACE_VERTICALHALFSIZEDOUBLERATE} + +// +// These values can be passed to further configure the inverse +// telecine process +// + + WM_DM_IT_DISABLE_COHERENT_MODE = LongWord(0); + {$EXTERNALSYM WM_DM_IT_DISABLE_COHERENT_MODE} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_AA_TOP = LongWord(1); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_AA_TOP} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BB_TOP = LongWord(2); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BB_TOP} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BC_TOP = LongWord(3); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BC_TOP} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_CD_TOP = LongWord(4); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_CD_TOP} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_DD_TOP = LongWord(5); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_DD_TOP} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_AA_BOTTOM = LongWord(6); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_AA_BOTTOM} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BB_BOTTOM = LongWord(7); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BB_BOTTOM} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BC_BOTTOM = LongWord(8); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_BC_BOTTOM} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_CD_BOTTOM = LongWord(9); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_CD_BOTTOM} + WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_DD_BOTTOM = LongWord(10); + {$EXTERNALSYM WM_DM_IT_FIRST_FRAME_IN_CLIP_IS_DD_BOTTOM} + + +// +// Frame level access data structures +// +type + tagWMT_OFFSET_FORMAT = ( + WMT_OFFSET_FORMAT_100NS, + WMT_OFFSET_FORMAT_FRAME_NUMBERS, + WMT_OFFSET_FORMAT_PLAYLIST_OFFSET, + WMT_OFFSET_FORMAT_TIMECODE + ); + {$EXTERNALSYM tagWMT_OFFSET_FORMAT} + WMT_OFFSET_FORMAT = tagWMT_OFFSET_FORMAT; + {$EXTERNALSYM WMT_OFFSET_FORMAT} + TWMTOffsetFormat = tagWMT_OFFSET_FORMAT; + +// +// Indexer type and index type +// + tagWMT_INDEXER_TYPE = ( + WMT_IT_PRESENTATION_TIME, + WMT_IT_FRAME_NUMBERS, + WMT_IT_TIMECODE + ); + {$EXTERNALSYM tagWMT_INDEXER_TYPE} + WMT_INDEXER_TYPE = tagWMT_INDEXER_TYPE; + {$EXTERNALSYM WMT_INDEXER_TYPE} + TWMTIndexerType = tagWMT_INDEXER_TYPE; + + tagWMT_INDEX_TYPE = ( + {$IFNDEF COMPILER6_UP} + WMT_IT_NEAREST_INVALID_0, + WMT_IT_NEAREST_DATA_UNIT, + {$ELSE} + WMT_IT_NEAREST_DATA_UNIT = 1, + {$ENDIF} + WMT_IT_NEAREST_OBJECT, + WMT_IT_NEAREST_CLEAN_POINT + ); + {$EXTERNALSYM tagWMT_INDEX_TYPE} + WMT_INDEX_TYPE = tagWMT_INDEX_TYPE; + {$EXTERNALSYM WMT_INDEX_TYPE} + TWMTIndexType = tagWMT_INDEX_TYPE; + +// +// The types of input accepted by the file sink +// + WMT_FILESINK_MODE = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM WMT_FILESINK_MODE} + const + WMT_FM_SINGLE_BUFFERS = $00000001; + {$EXTERNALSYM WMT_FM_SINGLE_BUFFERS} + WMT_FM_FILESINK_DATA_UNITS = $00000002; + {$EXTERNALSYM WMT_FM_FILESINK_DATA_UNITS} + WMT_FM_FILESINK_UNBUFFERED = $00000004; + {$EXTERNALSYM WMT_FM_FILESINK_UNBUFFERED} + +// +// WMA Voice V9 supports several type of compression, +// profile settting are mapped to these constants +// +type + tagWMT_MUSICSPEECH_CLASS_MODE = ( + WMT_MS_CLASS_MUSIC, + WMT_MS_CLASS_SPEECH, + WMT_MS_CLASS_MIXED + ); + {$EXTERNALSYM tagWMT_MUSICSPEECH_CLASS_MODE} + WMT_MUSICSPEECH_CLASS_MODE = tagWMT_MUSICSPEECH_CLASS_MODE; + {$EXTERNALSYM WMT_MUSICSPEECH_CLASS_MODE} + TWMTMusicSpeechClassMode = tagWMT_MUSICSPEECH_CLASS_MODE; + + tagWMT_WATERMARK_ENTRY_TYPE = ( + {$IFNDEF COMPILER6_UP} + WMT_WMETYPE_INVALID_0, + WMT_WMETYPE_AUDIO, + {$ELSE} + WMT_WMETYPE_AUDIO = 1, + {$ENDIF} + WMT_WMETYPE_VIDEO + ); + {$EXTERNALSYM tagWMT_WATERMARK_ENTRY_TYPE} + WMT_WATERMARK_ENTRY_TYPE = tagWMT_WATERMARK_ENTRY_TYPE; + {$EXTERNALSYM WMT_WATERMARK_ENTRY_TYPE} + TWMTWatermarkEntryType = tagWMT_WATERMARK_ENTRY_TYPE; + +// +// Dynamic Range Control values for playback +// +const + WM_PLAYBACK_DRC_HIGH = 0; + {$EXTERNALSYM WM_PLAYBACK_DRC_HIGH} + WM_PLAYBACK_DRC_MEDIUM = 1; + {$EXTERNALSYM WM_PLAYBACK_DRC_MEDIUM} + WM_PLAYBACK_DRC_LOW = 2; + {$EXTERNALSYM WM_PLAYBACK_DRC_LOW} + +// +// Timecode frame rates. These are meant to be used as the +// values for the stream-based frame rate metadata attribute. +// See the WM Format SDK docs for more details. +// + WMT_TIMECODE_FRAMERATE_30 = 0; + {$EXTERNALSYM WMT_TIMECODE_FRAMERATE_30} + WMT_TIMECODE_FRAMERATE_30DROP = 1; + {$EXTERNALSYM WMT_TIMECODE_FRAMERATE_30DROP} + WMT_TIMECODE_FRAMERATE_25 = 2; + {$EXTERNALSYM WMT_TIMECODE_FRAMERATE_25} + WMT_TIMECODE_FRAMERATE_24 = 3; + {$EXTERNALSYM WMT_TIMECODE_FRAMERATE_24} + + +// +// Flags that can be specified in IWMCredentialCallback::AcquireCredentials() +// +type + WMT_CREDENTIAL_FLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM WMT_CREDENTIAL_FLAGS} + const + WMT_CREDENTIAL_SAVE = $00000001; // Save the credentials in a persistent manner + {$EXTERNALSYM WMT_CREDENTIAL_SAVE} + WMT_CREDENTIAL_DONT_CACHE = $00000002; // Don't cache the credentials in memory + {$EXTERNALSYM WMT_CREDENTIAL_DONT_CACHE} + WMT_CREDENTIAL_CLEAR_TEXT = $00000004; // Credentials will be sent in clear text + {$EXTERNALSYM WMT_CREDENTIAL_CLEAR_TEXT} + WMT_CREDENTIAL_PROXY = $00000008; // Credentials are for a proxy server + {$EXTERNALSYM WMT_CREDENTIAL_PROXY} + WMT_CREDENTIAL_ENCRYPT = $00000010; // Encryption supported/used (in request/response, respectively) + {$EXTERNALSYM WMT_CREDENTIAL_ENCRYPT} + +type + WM_AETYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM WM_AETYPE} + const + WM_AETYPE_INCLUDE = $69; + {$EXTERNALSYM WM_AETYPE_INCLUDE} + WM_AETYPE_EXCLUDE = $65; + {$EXTERNALSYM WM_AETYPE_EXCLUDE} + + +/////////////////////////////////////////////////////////////////////////////// +// +// Structures used by the SDK. +// +/////////////////////////////////////////////////////////////////////////////// + +// +// Stream prioritization struct +// +type + PWMStreamPrioritizationRecord = ^TWMStreamPrioritizationRecord; + _WMStreamPrioritizationRecord = packed record + wStreamNumber: Word; + fMandatory : BOOL; + end; + {$EXTERNALSYM _WMStreamPrioritizationRecord} + WM_STREAM_PRIORITY_RECORD = _WMStreamPrioritizationRecord; + {$EXTERNALSYM WM_STREAM_PRIORITY_RECORD} + TWMStreamPrioritizationRecord = _WMStreamPrioritizationRecord; + +// +// Writer Statistics struct +// + PWMWriterStatistics = ^TWMWriterStatistics; + _WMWriterStatistics = packed record + qwSampleCount : Int64; + qwByteCount : Int64; + + qwDroppedSampleCount : Int64; + qwDroppedByteCount : Int64; + + dwCurrentBitrate : LongWord; + dwAverageBitrate : LongWord; + dwExpectedBitrate : LongWord; + + // + // Sample rates are given as 1000 * (samples / second). + // + dwCurrentSampleRate : LongWord; + dwAverageSampleRate : LongWord; + dwExpectedSampleRate : LongWord; + end; + {$EXTERNALSYM _WMWriterStatistics} + WM_WRITER_STATISTICS = _WMWriterStatistics; + {$EXTERNALSYM WM_WRITER_STATISTICS} + TWMWriterStatistics = _WMWriterStatistics; + +// +// Extended Writer Statistics +// + PWMWriterStatisticsEx = ^TWMWriterStatisticsEx; + _WMWriterStatisticsEx = packed record + // + // Bitrate that includes overhead + // + dwBitratePlusOverhead : LongWord; + + // + // Sample rates are given as 1000 * (samples / second) + // + dwCurrentSampleDropRateInQueue : LongWord; + dwCurrentSampleDropRateInCodec : LongWord; + dwCurrentSampleDropRateInMultiplexer : LongWord; + + // + // Cumulative sample drops + // + dwTotalSampleDropsInQueue : LongWord; + dwTotalSampleDropsInCodec : LongWord; + dwTotalSampleDropsInMultiplexer : LongWord; + end; + {$EXTERNALSYM _WMWriterStatisticsEx} + WM_WRITER_STATISTICS_EX = _WMWriterStatisticsEx; + {$EXTERNALSYM WM_WRITER_STATISTICS_EX} + TWMWriterStatisticsEx = _WMWriterStatisticsEx; + +// +// Reader Statistics struct +// + PWMReaderStatistics = ^TWMReaderStatistics; + _WMReaderStatistics = packed record + cbSize : LongWord; + dwBandwidth : LongWord; + cPacketsReceived : LongWord; + cPacketsRecovered : LongWord; + cPacketsLost : LongWord; + wQuality : Word; + end; + {$EXTERNALSYM _WMReaderStatistics} + WM_READER_STATISTICS = _WMReaderStatistics; + {$EXTERNALSYM WM_READER_STATISTICS} + TWMReaderStatistics = _WMReaderStatistics; + +// +// Reader Client Info struct +// + PWMReaderClientInfo = ^TWMReaderClientInfo; + _WMReaderClientInfo = packed record + cbSize : LongWord; + wszLang : PWideChar; // 2-3 letter language code + wszBrowserUserAgent : PWideChar; // Embedded browser's user-agent string + wszBrowserWebPage : PWideChar; // The web page that contains the plugin + qwReserved : Int64; // Reserved + pReserved : PLongInt; // Reserved + wszHostExe : PWideChar; // iexplore.exe, netscape.exe dshow.exe, etc + qwHostVersion : Int64; // Version of the host application e.g.:4.70.12.15 + wszPlayerUserAgent : PWideChar; // String identifying the player application, e.g. WMPlayer/9.0.0.0 + end; + {$EXTERNALSYM _WMReaderClientInfo} + WM_READER_CLIENTINFO = _WMReaderClientInfo; + {$EXTERNALSYM WM_READER_CLIENTINFO} + TWMReaderClientInfo = _WMReaderClientInfo; + + +// +// This structure is returned with the WMT_CLIENT_CONNECT and +// WMT_CLIENT_DISCONNECT status notifications. It is also used +// by IWMClientConnections. +// + PWMClientProperties = ^TWMClientProperties; + _WMClientProperties = packed record + dwIPAddress : LongWord; + dwPort : LongWord; + end; + {$EXTERNALSYM _WMClientProperties} + WM_CLIENT_PROPERTIES = _WMClientProperties; + {$EXTERNALSYM WM_CLIENT_PROPERTIES} + TWMClientProperties = _WMClientProperties; + +// +// This structure is returned with the WMT_CLIENT_CONNECT_EX, WMT_CLIENT_DISCONNECT_EX +// and WMT_CLIENT_PROPERTIES status notifications. +// + PWMClientPropertiesEx = ^TWMClientPropertiesEx; + _WMClientPropertiesEx = packed record + cbSize : LongWord; // size of structure + pwszIPAddress : PWideChar; // IP address in dot notation + pwszPort : PWideChar; // Client's port number + pwszDNSName : PWideChar; // DNS name of client, if known + end; + {$EXTERNALSYM _WMClientPropertiesEx} + WM_CLIENT_PROPERTIES_EX = _WMClientPropertiesEx; + {$EXTERNALSYM WM_CLIENT_PROPERTIES_EX} + TWMClientPropertiesEx = _WMClientPropertiesEx; + +// +// Inclusive port number range. +// Used by IWMReaderNetworkConfig. +// + PWMPortNumberRange = ^TWMPortNumberRange; + _WMPortNumberRange = packed record + wPortBegin : Word; + wPortEnd : Word; + end; + {$EXTERNALSYM _WMPortNumberRange} + WM_PORT_NUMBER_RANGE = _WMPortNumberRange; + {$EXTERNALSYM WM_PORT_NUMBER_RANGE} + TWMPortNumberRange = _WMPortNumberRange; + +// +// For passing data units to the file sink +// + PWMTBufferSegment = ^TWMTBufferSegment; + _WMT_BUFFER_SEGMENT = packed record + pBuffer : INSSBuffer; + cbOffset : LongWord; + cbLength : LongWord; + end; + {$EXTERNALSYM _WMT_BUFFER_SEGMENT} + WMT_BUFFER_SEGMENT = _WMT_BUFFER_SEGMENT; + {$EXTERNALSYM WMT_BUFFER_SEGMENT} + TWMTBufferSegment = _WMT_BUFFER_SEGMENT; + + PWMTPayloadFragment = ^TWMTPayloadFragment; + _WMT_PAYLOAD_FRAGMENT = packed record + dwPayloadIndex : LongWord; + segmentData : TWMTBufferSegment; + end; + {$EXTERNALSYM _WMT_PAYLOAD_FRAGMENT} + WMT_PAYLOAD_FRAGMENT = _WMT_PAYLOAD_FRAGMENT; + {$EXTERNALSYM WMT_PAYLOAD_FRAGMENT} + TWMTPayloadFragment = _WMT_PAYLOAD_FRAGMENT; + + PWMTFileSinkDataUnit = ^TWMTFileSinkDataUnit; + _WMT_FILESINK_DATA_UNIT = packed record + packetHeaderBuffer : TWMTBufferSegment; + + cPayloads : LongWord; + pPayloadHeaderBuffers : PWMTBufferSegment; + + cPayloadDataFragments : LongWord; + pPayloadDataFragments : PWMTPayloadFragment; + end; + {$EXTERNALSYM _WMT_FILESINK_DATA_UNIT} + WMT_FILESINK_DATA_UNIT = _WMT_FILESINK_DATA_UNIT; + {$EXTERNALSYM WMT_FILESINK_DATA_UNIT} + TWMTFileSinkDataUnit = _WMT_FILESINK_DATA_UNIT; + + PWMTWebStreamFormat = ^TWMTWebStreamFormat; + _WMT_WEBSTREAM_FORMAT = packed record + cbSize : Word; // Set to sizeof( WMT_WEBSTREAM_FORMAT ) + cbSampleHeaderFixedData : Word; // Length of the fixed part of the sample header should be + // set to sizeof( WMT_WEBSTREAM_SAMPLE_HEADER ) + wVersion : Word; + wReserved : Word; // Reserved. Should be set to 0. + end; + {$EXTERNALSYM _WMT_WEBSTREAM_FORMAT} + WMT_WEBSTREAM_FORMAT = _WMT_WEBSTREAM_FORMAT; + {$EXTERNALSYM WMT_WEBSTREAM_FORMAT} + TWMTWebStreamFormat = WMT_WEBSTREAM_FORMAT; + + PWMTWebStreamSampleHeader = ^TWMTWebStreamSampleHeader; + _WMT_WEBSTREAM_SAMPLE_HEADER = packed record + cbLength : Word; // Length of this header including string data + // should be set to sizeof( WMT_WEBSTREAM_SAMPLE_HEADER ) + + // wcslen( wszURL ) * sizeof( WCHAR ) + wPart : Word; // Current part. From 0 to cTotalParts - 1 + cTotalParts : Word; // Total number of parts for this file must be at least 1. + wSampleType : Word; // Sample type. Should be set to + // WEBSTREAM_SAMPLE_TYPE_FILE = 0x0001 or + // WEBSTREAM_SAMPLE_TYPE_RENDER = 0x0002 + wszURL : array[0..0] of WCHAR; // Variable length string data containing file url + end; + {$EXTERNALSYM _WMT_WEBSTREAM_SAMPLE_HEADER} + WMT_WEBSTREAM_SAMPLE_HEADER = _WMT_WEBSTREAM_SAMPLE_HEADER; + {$EXTERNALSYM WMT_WEBSTREAM_SAMPLE_HEADER} + TWMTWebStreamSampleHeader = _WMT_WEBSTREAM_SAMPLE_HEADER; + + PWMAddressAccessEntry = ^TWMAddressAccessEntry; + _WMAddressAccessEntry = packed record + dwIPAddress : LongWord; + dwMask : LongWord; + end; + {$EXTERNALSYM _WMAddressAccessEntry} + WM_ADDRESS_ACCESSENTRY = _WMAddressAccessEntry; + {$EXTERNALSYM WM_ADDRESS_ACCESSENTRY} + TWMAddressAccessEntry = _WMAddressAccessEntry; + +/////////////////////////////////////////////////////////////////////////////// +// +// Structures for complex metadata attributes +// +/////////////////////////////////////////////////////////////////////////////// + + PWMPicture = ^TWMPicture; + _WMPicture = packed record + pwszMIMEType : PWideChar; + bPictureType : BYTE; + pwszDescription : PWideChar; + dwDataLen : LongWord; + pbData : PBYTE; + end; + {$EXTERNALSYM _WMPicture} + WM_PICTURE = _WMPicture; + {$EXTERNALSYM WM_PICTURE} + TWMPicture = _WMPicture; + + PWMSynchronisedLyrics = ^TWMSynchronisedLyrics; + _WMSynchronisedLyrics = packed record + bTimeStampFormat : BYTE; + bContentType : BYTE; + pwszContentDescriptor : PWideChar; + dwLyricsLen : LongWord; + pbLyrics : PBYTE; + end; + {$EXTERNALSYM _WMSynchronisedLyrics} + WM_SYNCHRONISED_LYRICS = _WMSynchronisedLyrics; + {$EXTERNALSYM WM_SYNCHRONISED_LYRICS} + TWMSynchronisedLyrics = _WMSynchronisedLyrics; + + PWMUserWebURL = ^TWMUserWebURL; + _WMUserWebURL = packed record + pwszDescription : PWideChar; + pwszURL : PWideChar; + end; + {$EXTERNALSYM _WMUserWebURL} + WM_USER_WEB_URL = _WMUserWebURL; + {$EXTERNALSYM WM_USER_WEB_URL} + TWMUserWebURL = _WMUserWebURL; + + PWMUserText = ^TWMUserText; + _WMUserText = packed record + pwszDescription : PWideChar; + pwszText : PWideChar; + end; + {$EXTERNALSYM _WMUserText} + WM_USER_TEXT = _WMUserText; + {$EXTERNALSYM WM_USER_TEXT} + TWMUserText = _WMUserText; + + PWMLeakyBucketPair = ^TWMLeakyBucketPair; + _WMLeakyBucketPair = packed record + dwBitrate : LongWord; + msBufferWindow : LongWord; + end; + {$EXTERNALSYM _WMLeakyBucketPair} + WM_LEAKY_BUCKET_PAIR = _WMLeakyBucketPair; + {$EXTERNALSYM WM_LEAKY_BUCKET_PAIR} + TWMLeakyBucketPair = _WMLeakyBucketPair; + +/////////////////////////////////////////////////////////////////////////////// +// +// Structure needed for using GetDRMProperty. +// +/////////////////////////////////////////////////////////////////////////////// + + PWMLicenseStateData = ^TWMLicenseStateData; + _WM_LICENSE_STATE_DATA = packed record + dwSize : LongWord; // Size of the entire structure. + dwNumStates : LongWord; // Number of state data passed back in array of structure below + stateData : array[0..0] of TDRMLicenseStateData; + end; + {$EXTERNALSYM _WM_LICENSE_STATE_DATA} + WM_LICENSE_STATE_DATA = _WM_LICENSE_STATE_DATA; + {$EXTERNALSYM WM_LICENSE_STATE_DATA} + TWMLicenseStateData = _WM_LICENSE_STATE_DATA; + +/////////////////////////////////////////////////////////////////////////////// +// Watermark entry +/////////////////////////////////////////////////////////////////////////////// + + PWMTWatermarkEntry = ^TWMTWatermarkEntry; + __WMT_WATERMARK_ENTRY = packed record + wmetType : TWMTWatermarkEntryType; + clsid : TGUID; + cbDisplayName : UINT; + pwszDisplayName : PWideChar; + end; + {$EXTERNALSYM __WMT_WATERMARK_ENTRY} + WMT_WATERMARK_ENTRY = __WMT_WATERMARK_ENTRY; + {$EXTERNALSYM WMT_WATERMARK_ENTRY} + TWMTWatermarkEntry = __WMT_WATERMARK_ENTRY; + +/////////////////////////////////////////////////////////////////////////////// +// VideoImage structs +/////////////////////////////////////////////////////////////////////////////// + +// +// dwControlFlags +// +const + WMT_VIDEOIMAGE_SAMPLE_INPUT_FRAME = 1; // sample has input frame + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE_INPUT_FRAME} + WMT_VIDEOIMAGE_SAMPLE_OUTPUT_FRAME = 2; // sample produces output frame + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE_OUTPUT_FRAME} + WMT_VIDEOIMAGE_SAMPLE_USES_CURRENT_INPUT_FRAME = 4; + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE_USES_CURRENT_INPUT_FRAME} + WMT_VIDEOIMAGE_SAMPLE_USES_PREVIOUS_INPUT_FRAME = 8; + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE_USES_PREVIOUS_INPUT_FRAME} + +// +// dwInputFlags +// + WMT_VIDEOIMAGE_SAMPLE_MOTION = 1; // acef used (includes resizing) + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE_MOTION} + WMT_VIDEOIMAGE_SAMPLE_ROTATION = 2; // bd also used (not valid without acef) + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE_ROTATION} + WMT_VIDEOIMAGE_SAMPLE_BLENDING = 4; // BlendCoef1 used + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE_BLENDING} + WMT_VIDEOIMAGE_SAMPLE_ADV_BLENDING = 8; // BlendCoef2 also used (not valid without BlendCoef1) + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE_ADV_BLENDING} + + WMT_VIDEOIMAGE_INTEGER_DENOMINATOR = 65536; + {$EXTERNALSYM WMT_VIDEOIMAGE_INTEGER_DENOMINATOR} + + WMT_VIDEOIMAGE_MAGIC_NUMBER = $1d4a45f2; + {$EXTERNALSYM WMT_VIDEOIMAGE_MAGIC_NUMBER} + +type + PWMTVideoImageSample = ^TWMTVideoImageSample; + __WMT_VIDEOIMAGE_SAMPLE = packed record + dwMagic : LongWord; + cbStruct : ULONG; // size of structure; incudes dwMagic and cbStruct + dwControlFlags : LongWord; + + // + // most recent input frame + // + dwInputFlagsCur : LongWord; + lCurMotionXtoX : LongInt; // a + lCurMotionYtoX : LongInt; // b + lCurMotionXoffset : LongInt; // c + lCurMotionXtoY : LongInt; // d + lCurMotionYtoY : LongInt; // e + lCurMotionYoffset : LongInt; // f + lCurBlendCoef1 : LongInt; + lCurBlendCoef2 : LongInt; + + // + // second most recent input frame + // + dwInputFlagsPrev : LongWord; + lPrevMotionXtoX : LongInt; // a + lPrevMotionYtoX : LongInt; // b + lPrevMotionXoffset : LongInt; // c + lPrevMotionXtoY : LongInt; // d + lPrevMotionYtoY : LongInt; // e + lPrevMotionYoffset : LongInt; // f + lPrevBlendCoef1 : LongInt; + lPrevBlendCoef2 : LongInt; + end; + {$EXTERNALSYM __WMT_VIDEOIMAGE_SAMPLE} + WMT_VIDEOIMAGE_SAMPLE = __WMT_VIDEOIMAGE_SAMPLE; + {$EXTERNALSYM WMT_VIDEOIMAGE_SAMPLE} + TWMTVideoImageSample = __WMT_VIDEOIMAGE_SAMPLE; + +/////////////////////////////////////////////////////////////////////////////// +// +// Media-type structures and GUIDs. +// +/////////////////////////////////////////////////////////////////////////////// + +// +// We use DirectShow media types in this SDK. However, to avoid conflict with +// their names, we define our own version of the structure. This is exactly +// the same as an AM_MEDIA_TYPE! +// + PWMMediaType = ^TWMMediaType; + _WMMediaType = packed record + majortype : TGUID; + subtype : TGUID; + bFixedSizeSamples : BOOL; + bTemporalCompression : BOOL; + lSampleSize : ULONG; + formattype : TGUID; + pUnk : IUnknown; + cbFormat : ULONG; + pbFormat : PBYTE; // size_is(cbFormat) + end; + {$EXTERNALSYM _WMMediaType} + WM_MEDIA_TYPE = _WMMediaType; + {$EXTERNALSYM WM_MEDIA_TYPE} + TWMMediaType = _WMMediaType; + + PWMVideoInfoHeader = ^TWMVideoInfoHeader; + tagWMVIDEOINFOHEADER = packed record + rcSource : TRECT; // The bit we really want to use. + rcTarget : TRECT; // Where the video should go. + dwBitRate : LongWord; // Approximate bit data rate. + dwBitErrorRate : LongWord; // Bit error rate for this stream. + AvgTimePerFrame : Int64; // Average time per frame (100ns units). + bmiHeader : TBitmapInfoHeader; + end; + {$EXTERNALSYM tagWMVIDEOINFOHEADER} + WMVIDEOINFOHEADER = tagWMVIDEOINFOHEADER; + {$EXTERNALSYM WMVIDEOINFOHEADER} + TWMVideoInfoHeader = tagWMVIDEOINFOHEADER; + + PWMVideoInfoHeader2 = ^TWMVideoInfoHeader2; + tagWMVIDEOINFOHEADER2 = packed record + rcSource : TRECT; // The bit we really want to use. + rcTarget : TRECT; // Where the video should go. + dwBitRate : LongWord; // Approximate bit data rate. + dwBitErrorRate : LongWord; // Bit error rate for this stream. + AvgTimePerFrame : Int64; // Average time per frame (100ns units). + dwInterlaceFlags : LongWord; // Use AMINTERLACE_* defines. Reject connection if undefined bits are not 0. + dwCopyProtectFlags : LongWord; // use AMCOPYPROTECT_* defines. Reject connection if undefined bits are not 0. + dwPictAspectRatioX : LongWord; // X dimension of picture aspect ratio, e.g. 16 for 16x9 display. + dwPictAspectRatioY : LongWord; // Y dimension of picture aspect ratio, e.g. 9 for 16x9 display. + dwReserved1 : LongWord; // Must be 0; reject connection otherwise. + dwReserved2 : LongWord; // Must be 0; reject connection otherwise. + bmiHeader : TBitmapInfoHeader; + end; + {$EXTERNALSYM tagWMVIDEOINFOHEADER2} + WMVIDEOINFOHEADER2 = tagWMVIDEOINFOHEADER2; + {$EXTERNALSYM WMVIDEOINFOHEADER2} + TWMVideoInfoHeader2 = tagWMVIDEOINFOHEADER2; + + PWMMPEG2VideoInfo = ^TWMMPEG2VideoInfo; + tagWMMPEG2VIDEOINFO = packed record + hdr : TWMVideoInfoHeader2; // Video info header2. + dwStartTimeCode : LongWord; // Not used for DVD. + cbSequenceHeader : LongWord; // Is 0 for DVD (no sequence header). + dwProfile : LongWord; // Use enum MPEG2Profile. + dwLevel : LongWord; // Use enum MPEG2Level. + dwFlags : LongWord; // Use AMMPEG2_* defines. Reject connection if undefined bits are not 0. + dwSequenceHeader : array[0..0] of LongWord; // Sequence header. + end; + {$EXTERNALSYM tagWMMPEG2VIDEOINFO} + WMMPEG2VIDEOINFO = tagWMMPEG2VIDEOINFO; + {$EXTERNALSYM WMMPEG2VIDEOINFO} + TWMMPEG2VideoInfo = tagWMMPEG2VIDEOINFO; + + PWMScriptFormat = ^TWMScriptFormat; + tagWMSCRIPTFORMAT = packed record + scriptType: TGUID; + end; + {$EXTERNALSYM tagWMSCRIPTFORMAT} + WMSCRIPTFORMAT = tagWMSCRIPTFORMAT; + {$EXTERNALSYM WMSCRIPTFORMAT} + TWMScriptFormat = tagWMSCRIPTFORMAT; + +// +// This special GUID is used to create a subtype from an audio format tag, or +// video four-character code. Just fill in the first LongWord of the GUID with +// the appropriate value. +// +const + WMMEDIASUBTYPE_Base : TGUID = '{00000000-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_Base} + WMMEDIATYPE_Video : TGUID = '{73646976-0000-0010-8000-00AA00389B71}'; // 'vids' + {$EXTERNALSYM WMMEDIATYPE_Video} + WMMEDIASUBTYPE_RGB1 : TGUID = '{e436eb78-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM WMMEDIASUBTYPE_RGB1} + WMMEDIASUBTYPE_RGB4 : TGUID = '{e436eb79-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM WMMEDIASUBTYPE_RGB4} + WMMEDIASUBTYPE_RGB8 : TGUID = '{e436eb7a-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM WMMEDIASUBTYPE_RGB8} + WMMEDIASUBTYPE_RGB565 : TGUID = '{e436eb7b-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM WMMEDIASUBTYPE_RGB565} + WMMEDIASUBTYPE_RGB555 : TGUID = '{e436eb7c-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM WMMEDIASUBTYPE_RGB555} + WMMEDIASUBTYPE_RGB24 : TGUID = '{e436eb7d-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM WMMEDIASUBTYPE_RGB24} + WMMEDIASUBTYPE_RGB32 : TGUID = '{e436eb7e-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM WMMEDIASUBTYPE_RGB32} + WMMEDIASUBTYPE_I420 : TGUID = '{30323449-0000-0010-8000-00AA00389B71}'; // 'YV12' + {$EXTERNALSYM WMMEDIASUBTYPE_I420} + WMMEDIASUBTYPE_IYUV : TGUID = '{56555949-0000-0010-8000-00AA00389B71}'; // 'YV12' + {$EXTERNALSYM WMMEDIASUBTYPE_IYUV} + WMMEDIASUBTYPE_YV12 : TGUID = '{31313259-0000-0010-8000-00AA00389B71}'; // 'YV12' + {$EXTERNALSYM WMMEDIASUBTYPE_YV12} + WMMEDIASUBTYPE_YUY2 : TGUID = '{32595559-0000-0010-8000-00AA00389B71}'; // 'YUY2' + {$EXTERNALSYM WMMEDIASUBTYPE_YUY2} + WMMEDIASUBTYPE_UYVY : TGUID = '{59565955-0000-0010-8000-00AA00389B71}'; // 'UYVY' + {$EXTERNALSYM WMMEDIASUBTYPE_UYVY} + WMMEDIASUBTYPE_YVYU : TGUID = '{55595659-0000-0010-8000-00AA00389B71}'; // 'YVYU' + {$EXTERNALSYM WMMEDIASUBTYPE_YVYU} + WMMEDIASUBTYPE_YVU9 : TGUID = '{39555659-0000-0010-8000-00AA00389B71}'; // 'YVU9' + {$EXTERNALSYM WMMEDIASUBTYPE_YVU9} + WMMEDIASUBTYPE_VIDEOIMAGE : TGUID = '{1d4a45f2-e5f6-4b44-8388-f0ae5c0e0c37}'; + {$EXTERNALSYM WMMEDIASUBTYPE_VIDEOIMAGE} + WMMEDIASUBTYPE_MP43 : TGUID = '{3334504D-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_MP43} + WMMEDIASUBTYPE_MP4S : TGUID = '{5334504D-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_MP4S} + WMMEDIASUBTYPE_WMV1 : TGUID = '{31564D57-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMV1} + WMMEDIASUBTYPE_WMV2 : TGUID = '{32564D57-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMV2} + WMMEDIASUBTYPE_MSS1 : TGUID = '{3153534D-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_MSS1} + WMMEDIASUBTYPE_MPEG2_VIDEO : TGUID = '{e06d8026-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM WMMEDIASUBTYPE_MPEG2_VIDEO} + WMMEDIATYPE_Audio : TGUID = '{73647561-0000-0010-8000-00AA00389B71}'; // 'auds' + {$EXTERNALSYM WMMEDIATYPE_Audio} + WMMEDIASUBTYPE_PCM : TGUID = '{00000001-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_PCM} + WMMEDIASUBTYPE_DRM : TGUID = '{00000009-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_DRM} + WMMEDIASUBTYPE_WMAudioV9 : TGUID = '{00000162-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMAudioV9} + WMMEDIASUBTYPE_WMAudio_Lossless : TGUID = '{00000163-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMAudio_Lossless} + WMMEDIASUBTYPE_MSS2 : TGUID = '{3253534D-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_MSS2} + WMMEDIASUBTYPE_WMSP1 : TGUID = '{0000000A-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMSP1} + WMMEDIASUBTYPE_WMV3 : TGUID = '{33564D57-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMV3} + WMMEDIASUBTYPE_WMVP : TGUID = '{50564D57-0000-0010-8000-00AA00389B71}'; + + {$EXTERNALSYM WMMEDIASUBTYPE_WMVP} + +// +// WM Audio v2 and v7 are actually compatible bitstreams. +// + WMMEDIASUBTYPE_WMAudioV8 : TGUID = '{00000161-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMAudioV8} + WMMEDIASUBTYPE_WMAudioV7 : TGUID = '{00000161-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMAudioV7} + WMMEDIASUBTYPE_WMAudioV2 : TGUID = '{00000161-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WMAudioV2} + WMMEDIASUBTYPE_ACELPnet : TGUID = '{00000130-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_ACELPnet} + WMMEDIASUBTYPE_MP3 : TGUID = '{00000050-0000-0010-8000-00AA00389B71}'; + {$EXTERNALSYM WMMEDIASUBTYPE_MP3} + WMMEDIASUBTYPE_WebStream : TGUID = '{776257d4-c627-41cb-8f81-7ac7ff1c40cc}'; + {$EXTERNALSYM WMMEDIASUBTYPE_WebStream} + WMMEDIATYPE_Script : TGUID = '{73636d64-0000-0010-8000-00AA00389B71}'; // 'scmd' + {$EXTERNALSYM WMMEDIATYPE_Script} + WMMEDIATYPE_Image : TGUID = '{34A50FD8-8AA5-4386-81FE-A0EFE0488E31}'; // 'imag' + {$EXTERNALSYM WMMEDIATYPE_Image} + WMMEDIATYPE_FileTransfer : TGUID = '{D9E47579-930E-4427-ADFC-AD80F290E470}'; // 'fxfr' + {$EXTERNALSYM WMMEDIATYPE_FileTransfer} + WMMEDIATYPE_Text : TGUID = '{9BBA1EA7-5AB2-4829-BA57-0940209BCF3E}'; // 'text' + {$EXTERNALSYM WMMEDIATYPE_Text} + WMFORMAT_VideoInfo : TGUID = '{05589f80-c356-11ce-bf01-00aa0055595a}'; + {$EXTERNALSYM WMFORMAT_VideoInfo} + WMFORMAT_MPEG2Video : TGUID = '{e06d80e3-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM WMFORMAT_MPEG2Video} + WMFORMAT_WaveFormatEx : TGUID = '{05589f81-c356-11ce-bf01-00aa0055595a}'; + {$EXTERNALSYM WMFORMAT_WaveFormatEx} + WMFORMAT_Script : TGUID = '{5C8510F2-DEBE-4ca7-BBA5-F07A104F8DFF}'; + {$EXTERNALSYM WMFORMAT_Script} + WMFORMAT_WebStream : TGUID = '{da1e6b13-8359-4050-b398-388e965bf00c}'; + {$EXTERNALSYM WMFORMAT_WebStream} + WMSCRIPTTYPE_TwoStrings : TGUID = '{82f38a70-c29f-11d1-97ad-00a0c95ea850}'; + {$EXTERNALSYM WMSCRIPTTYPE_TwoStrings} + +////////////////////////////////////////////////////////////////////////////// +// +// GUIDs for common buffer properties +// + WM_SampleExtensionGUID_OutputCleanPoint : TGUID = '{f72a3c6f-6eb4-4ebc-b192-09ad9759e828}'; + {$EXTERNALSYM WM_SampleExtensionGUID_OutputCleanPoint} + WM_SampleExtensionGUID_Timecode : TGUID = '{399595ec-8667-4e2d-8fdb-98814ce76c1e}'; + {$EXTERNALSYM WM_SampleExtensionGUID_Timecode} + + +// +// This buffer property is used in conjunction with file transfer streams. +// It is the name of the file being transfered (in WCHARs). +// + WM_SampleExtensionGUID_FileName : TGUID = '{e165ec0e-19ed-45d7-b4a7-25cbd1e28e9b}'; + {$EXTERNALSYM WM_SampleExtensionGUID_FileName} + + WM_SampleExtensionGUID_ContentType : TGUID = '{d590dc20-07bc-436c-9cf7-f3bbfbf1a4dc}'; + {$EXTERNALSYM WM_SampleExtensionGUID_ContentType} + WM_SampleExtensionGUID_PixelAspectRatio : TGUID = '{1b1ee554-f9ea-4bc8-821a-376b74e4c4b8}'; + {$EXTERNALSYM WM_SampleExtensionGUID_PixelAspectRatio} + WM_SampleExtensionGUID_SampleDuration : TGUID = '{c6bd9450-867f-4907-83a3-c77921b733ad}'; + {$EXTERNALSYM WM_SampleExtensionGUID_SampleDuration} + +// +// Constants for use with the corresponding sample extension properties +// + WM_SampleExtension_ContentType_Size = 1; + {$EXTERNALSYM WM_SampleExtension_ContentType_Size} + WM_SampleExtension_PixelAspectRatio_Size = 2; + {$EXTERNALSYM WM_SampleExtension_PixelAspectRatio_Size} + WM_SampleExtension_Timecode_Size = 14; + {$EXTERNALSYM WM_SampleExtension_Timecode_Size} + WM_SampleExtension_SampleDuration_Size = 2; + {$EXTERNALSYM WM_SampleExtension_SampleDuration_Size} + +/////////////////////////////////////////////////////////////////////////////// +// +// Content Types to be used with WM_SampleExtensionGUID_ContentType +// on INSSBuffer3::SetProperty/GetProperty +// +/////////////////////////////////////////////////////////////////////////////// + + WM_CT_INTERLACED = 128; + {$EXTERNALSYM WM_CT_INTERLACED} + WM_CT_BOTTOM_FIELD_FIRST = 32; + {$EXTERNALSYM WM_CT_BOTTOM_FIELD_FIRST} + WM_CT_TOP_FIELD_FIRST = 64; + {$EXTERNALSYM WM_CT_TOP_FIELD_FIRST} + +/////////////////////////////////////////////////////////////////////////////// +// +// Timecode structures to be used with WM_SampleExtensionGUID_Timecode +// on INSSBuffer3::SetProperty/GetProperty. The timecode LongWord +// contains the following timecode representation: +// +// BYTE MSB LSB +// ---------------------------------------------- +// 1 Tens of hour Hour +// 2 Tens of minute Minute +// 3 Tens of second Second +// 4 Tens of frame Frame +// +/////////////////////////////////////////////////////////////////////////////// + +type + PWMTTimeCodeExtensionData = ^TWMTTimeCodeExtensionData; + _WMT_TIMECODE_EXTENSION_DATA = packed record + wRange : Word; + dwTimecode : LongWord; + dwUserbits : LongWord; + dwAmFlags : LongWord; + end; + {$EXTERNALSYM _WMT_TIMECODE_EXTENSION_DATA} + WMT_TIMECODE_EXTENSION_DATA = _WMT_TIMECODE_EXTENSION_DATA; + {$EXTERNALSYM WMT_TIMECODE_EXTENSION_DATA} + TWMTTimeCodeExtensionData = _WMT_TIMECODE_EXTENSION_DATA; + +/////////////////////////////////////////////////////////////////////////////// +// +// IID GUIDs defined here. +// +/////////////////////////////////////////////////////////////////////////////// +const + IID_IWMMediaProps : TGUID = '{96406bce-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMMediaProps} + IID_IWMVideoMediaProps : TGUID = '{96406bcf-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMVideoMediaProps} + IID_IWMWriter : TGUID = '{96406bd4-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMWriter} + IID_IWMInputMediaProps : TGUID = '{96406bd5-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMInputMediaProps} + IID_IWMReader : TGUID = '{96406bd6-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMReader} + IID_IWMSyncReader : TGUID = '{9397f121-7705-4dc9-b049-98b698188414}'; + {$EXTERNALSYM IID_IWMSyncReader} + IID_IWMSyncReader2 : TGUID = '{faed3d21-1b6b-4af7-8cb6-3e189bbc187b}'; + {$EXTERNALSYM IID_IWMSyncReader2} + IID_IWMOutputMediaProps : TGUID = '{96406bd7-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMOutputMediaProps} + IID_IWMStatusCallback : TGUID = '{6d7cdc70-9888-11d3-8edc-00c04f6109cf}'; + {$EXTERNALSYM IID_IWMStatusCallback} + IID_IWMReaderCallback : TGUID = '{96406bd8-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMReaderCallback} + IID_IWMCredentialCallback : TGUID = '{342e0eb7-e651-450c-975b-2ace2c90c48e}'; + {$EXTERNALSYM IID_IWMCredentialCallback} + IID_IWMMetadataEditor : TGUID = '{96406bd9-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMMetadataEditor} + IID_IWMMetadataEditor2 : TGUID = '{203cffe3-2e18-4fdf-b59d-6e71530534cf}'; + {$EXTERNALSYM IID_IWMMetadataEditor2} + IID_IWMDRMEditor : TGUID = '{FF130EBC-A6C3-42A6-B401-C3382C3E08B3}'; + {$EXTERNALSYM IID_IWMDRMEditor} + IID_IWMHeaderInfo : TGUID = '{96406bda-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMHeaderInfo} + IID_IWMHeaderInfo2 : TGUID = '{15cf9781-454e-482e-b393-85fae487a810}'; + {$EXTERNALSYM IID_IWMHeaderInfo2} + IID_IWMHeaderInfo3 : TGUID = '{15CC68E3-27CC-4ecd-B222-3F5D02D80BD5}'; + {$EXTERNALSYM IID_IWMHeaderInfo3} + IID_IWMProfileManager : TGUID = '{d16679f2-6ca0-472d-8d31-2f5d55aee155}'; + {$EXTERNALSYM IID_IWMProfileManager} + IID_IWMProfileManager2 : TGUID = '{7a924e51-73c1-494d-8019-23d37ed9b89a}'; + {$EXTERNALSYM IID_IWMProfileManager2} + IID_IWMProfileManagerLanguage : TGUID = '{ba4dcc78-7ee0-4ab8-b27a-dbce8bc51454}'; + {$EXTERNALSYM IID_IWMProfileManagerLanguage} + IID_IWMProfile : TGUID = '{96406bdb-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMProfile} + IID_IWMProfile2 : TGUID = '{07e72d33-d94e-4be7-8843-60ae5ff7e5f5}'; + {$EXTERNALSYM IID_IWMProfile2} + IID_IWMProfile3 : TGUID = '{00ef96cc-a461-4546-8bcd-c9a28f0e06f5}'; + {$EXTERNALSYM IID_IWMProfile3} + IID_IWMStreamConfig : TGUID = '{96406bdc-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMStreamConfig} + IID_IWMStreamConfig2 : TGUID = '{7688d8cb-fc0d-43bd-9459-5a8dec200cfa}'; + {$EXTERNALSYM IID_IWMStreamConfig2} + IID_IWMStreamConfig3 : TGUID = '{cb164104-3aa9-45a7-9ac9-4daee131d6e1}'; + {$EXTERNALSYM IID_IWMStreamConfig3} + IID_IWMStreamList : TGUID = '{96406bdd-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMStreamList} + IID_IWMMutualExclusion : TGUID = '{96406bde-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMMutualExclusion} + IID_IWMMutualExclusion2 : TGUID = '{0302b57d-89d1-4ba2-85c9-166f2c53eb91}'; + {$EXTERNALSYM IID_IWMMutualExclusion2} + IID_IWMBandwidthSharing : TGUID = '{ad694af1-f8d9-42f8-bc47-70311b0c4f9e}'; + {$EXTERNALSYM IID_IWMBandwidthSharing} + IID_IWMStreamPrioritization : TGUID = '{8c1c6090-f9a8-4748-8ec3-dd1108ba1e77}'; + {$EXTERNALSYM IID_IWMStreamPrioritization} + IID_IWMWriterAdvanced : TGUID = '{96406be3-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMWriterAdvanced} + IID_IWMWriterAdvanced2 : TGUID = '{962dc1ec-c046-4db8-9cc7-26ceae500817}'; + {$EXTERNALSYM IID_IWMWriterAdvanced2} + IID_IWMWriterAdvanced3 : TGUID = '{2cd6492d-7c37-4e76-9d3b-59261183a22e}'; + {$EXTERNALSYM IID_IWMWriterAdvanced3} + IID_IWMWriterPreprocess : TGUID = '{fc54a285-38c4-45b5-aa23-85b9f7cb424b}'; + {$EXTERNALSYM IID_IWMWriterPreprocess} + IID_IWMWriterSink : TGUID = '{96406be4-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMWriterSink} + IID_IWMWriterFileSink : TGUID = '{96406be5-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMWriterFileSink} + IID_IWMWriterFileSink2 : TGUID = '{14282ba7-4aef-4205-8ce5-c229035a05bc}'; + {$EXTERNALSYM IID_IWMWriterFileSink2} + IID_IWMWriterFileSink3 : TGUID = '{3fea4feb-2945-47a7-a1dd-c53a8fc4c45c}'; + {$EXTERNALSYM IID_IWMWriterFileSink3} + IID_IWMWriterNetworkSink : TGUID = '{96406be7-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMWriterNetworkSink} + IID_IWMClientConnections : TGUID = '{73c66010-a299-41df-b1f0-ccf03b09c1c6}'; + {$EXTERNALSYM IID_IWMClientConnections} + IID_IWMClientConnections2 : TGUID = '{4091571e-4701-4593-bb3d-d5f5f0c74246}'; + {$EXTERNALSYM IID_IWMClientConnections2} + IID_IWMReaderAdvanced : TGUID = '{96406bea-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMReaderAdvanced} + IID_IWMReaderAdvanced2 : TGUID = '{ae14a945-b90c-4d0d-9127-80d665f7d73e}'; + {$EXTERNALSYM IID_IWMReaderAdvanced2} + IID_IWMReaderAdvanced3 : TGUID = '{5dc0674b-f04b-4a4e-9f2a-b1afde2c8100}'; + {$EXTERNALSYM IID_IWMReaderAdvanced3} + IID_IWMReaderAdvanced4 : TGUID = '{945a76a2-12ae-4d48-bd3c-cd1d90399b85}'; + {$EXTERNALSYM IID_IWMReaderAdvanced4} + IID_IWMDRMReader : TGUID = '{d2827540-3ee7-432c-b14c-dc17f085d3b3}'; + {$EXTERNALSYM IID_IWMDRMReader} + IID_IWMReaderCallbackAdvanced : TGUID = '{96406beb-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMReaderCallbackAdvanced} + IID_IWMReaderNetworkConfig : TGUID = '{96406bec-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMReaderNetworkConfig} + IID_IWMReaderStreamClock : TGUID = '{96406bed-2b2b-11d3-b36b-00c04f6108ff}'; + {$EXTERNALSYM IID_IWMReaderStreamClock} + IID_IWMIndexer : TGUID = '{6d7cdc71-9888-11d3-8edc-00c04f6109cf}'; + {$EXTERNALSYM IID_IWMIndexer} + IID_IWMIndexer2 : TGUID = '{b70f1e42-6255-4df0-a6b9-02b212d9e2bb}'; + {$EXTERNALSYM IID_IWMIndexer2} + IID_IWMReaderAllocatorEx : TGUID = '{9f762fa7-a22e-428d-93c9-ac82f3aafe5a}'; + {$EXTERNALSYM IID_IWMReaderAllocatorEx} + IID_IWMReaderTypeNegotiation : TGUID = '{fdbe5592-81a1-41ea-93bd-735cad1adc05}'; + {$EXTERNALSYM IID_IWMReaderTypeNegotiation} + IID_IWMLicenseBackup : TGUID = '{05E5AC9F-3FB6-4508-BB43-A4067BA1EBE8}'; + {$EXTERNALSYM IID_IWMLicenseBackup} + IID_IWMLicenseRestore : TGUID = '{C70B6334-a22e-4efb-A245-15E65A004A13}'; + {$EXTERNALSYM IID_IWMLicenseRestore} + IID_IWMBackupRestoreProps : TGUID = '{3C8E0DA6-996F-4ff3-A1AF-4838F9377e2e}'; + {$EXTERNALSYM IID_IWMBackupRestoreProps} + IID_IWMPacketSize : TGUID = '{cdfb97ab-188f-40b3-b643-5b7903975c59}'; + {$EXTERNALSYM IID_IWMPacketSize} + IID_IWMPacketSize2 : TGUID = '{8bfc2b9e-b646-4233-a877-1c6a079669dc}'; + {$EXTERNALSYM IID_IWMPacketSize2} + IID_IWMRegisterCallback : TGUID = '{cf4b1f99-4de2-4e49-a363-252740d99bc1}'; + {$EXTERNALSYM IID_IWMRegisterCallback} + IID_IWMWriterPostView : TGUID = '{81e20ce4-75ef-491a-8004-fc53c45bdc3e}'; + {$EXTERNALSYM IID_IWMWriterPostView} + IID_IWMWriterPostViewCallback : TGUID = '{d9d6549d-a193-4f24-b308-03123d9b7f8d}'; + {$EXTERNALSYM IID_IWMWriterPostViewCallback} + IID_IWMCodecInfo : TGUID = '{a970f41e-34de-4a98-b3ba-e4b3ca7528f0}'; + {$EXTERNALSYM IID_IWMCodecInfo} + IID_IWMCodecInfo2 : TGUID = '{aa65e273-b686-4056-91ec-dd768d4df710}'; + {$EXTERNALSYM IID_IWMCodecInfo2} + IID_IWMCodecInfo3 : TGUID = '{7e51f487-4d93-4f98-8ab4-27d0565adc51}'; + {$EXTERNALSYM IID_IWMCodecInfo3} + IID_IWMPropertyVault : TGUID = '{72995A79-5090-42a4-9C8C-D9D0B6D34BE5}'; + {$EXTERNALSYM IID_IWMPropertyVault} + IID_IWMIStreamProps : TGUID = '{6816dad3-2b4b-4c8e-8149-874c3483a753}'; + {$EXTERNALSYM IID_IWMIStreamProps} + IID_IWMLanguageList : TGUID = '{df683f00-2d49-4d8e-92b7-fb19f6a0dc57}'; + {$EXTERNALSYM IID_IWMLanguageList} + IID_IWMDRMWriter : TGUID = '{d6ea5dd0-12a0-43f4-90ab-a3fd451e6a07}'; + {$EXTERNALSYM IID_IWMDRMWriter} + IID_IWMWriterPushSink : TGUID = '{dc10e6a5-072c-467d-bf57-6330a9dde12a}'; + {$EXTERNALSYM IID_IWMWriterPushSink} + IID_IWMReaderNetworkConfig2 : TGUID = '{d979a853-042b-4050-8387-c939db22013f}'; + {$EXTERNALSYM IID_IWMReaderNetworkConfig2} + IID_IWMWatermarkInfo : TGUID = '{6f497062-f2e2-4624-8ea7-9dd40d81fc8d}'; + {$EXTERNALSYM IID_IWMWatermarkInfo} + IID_IWMReaderAccelerator : TGUID = '{bddc4d08-944d-4d52-a612-46c3fda07dd4}'; + {$EXTERNALSYM IID_IWMReaderAccelerator} + IID_IWMReaderTimecode : TGUID = '{f369e2f0-e081-4fe6-8450-b810b2f410d1}'; + {$EXTERNALSYM IID_IWMReaderTimecode} + IID_IWMImageInfo : TGUID = '{9f0aa3b6-7267-4d89-88f2-ba915aa5c4c6}'; + {$EXTERNALSYM IID_IWMImageInfo} + IID_IWMAddressAccess : TGUID = '{BB3C6389-1633-4e92-AF14-9F3173BA39D0}'; + {$EXTERNALSYM IID_IWMAddressAccess} + IID_IWMAddressAccess2 : TGUID = '{65a83fc2-3e98-4d4d-81b5-2a742886b33d}'; + {$EXTERNALSYM IID_IWMAddressAccess2} + +/////////////////////////////////////////////////////////////////////////////// +// +// Other GUIDs defined here +// +/////////////////////////////////////////////////////////////////////////////// + + CLSID_WMMUTEX_Language : TGUID = '{D6E22A00-35DA-11D1-9034-00A0C90349BE}'; + {$EXTERNALSYM CLSID_WMMUTEX_Language} + CLSID_WMMUTEX_Bitrate : TGUID = '{D6E22A01-35DA-11D1-9034-00A0C90349BE}'; + {$EXTERNALSYM CLSID_WMMUTEX_Bitrate} + CLSID_WMMUTEX_Presentation : TGUID = '{D6E22A02-35DA-11D1-9034-00A0C90349BE}'; + {$EXTERNALSYM CLSID_WMMUTEX_Presentation} + CLSID_WMMUTEX_Unknown : TGUID = '{D6E22A03-35DA-11D1-9034-00A0C90349BE}'; + {$EXTERNALSYM CLSID_WMMUTEX_Unknown} + + CLSID_WMBandwidthSharing_Exclusive : TGUID = '{af6060aa-5197-11d2-b6af-00c04fd908e9}'; + {$EXTERNALSYM CLSID_WMBandwidthSharing_Exclusive} + CLSID_WMBandwidthSharing_Partial : TGUID = '{af6060ab-5197-11d2-b6af-00c04fd908e9}'; + {$EXTERNALSYM CLSID_WMBandwidthSharing_Partial} + + WMT_DMOCATEGORY_AUDIO_WATERMARK : TGUID = '{B42CDE2B-6178-4a2c-A375-89DD3FD7F497}'; + {$EXTERNALSYM WMT_DMOCATEGORY_AUDIO_WATERMARK} + WMT_DMOCATEGORY_VIDEO_WATERMARK : TGUID = '{E77797C6-18AF-4458-BBDD-492D3F78FC8F}'; + {$EXTERNALSYM WMT_DMOCATEGORY_VIDEO_WATERMARK} + +/////////////////////////////////////////////////////////////////////////////// +// +// Max Video Streams / Bands +// +/////////////////////////////////////////////////////////////////////////////// + + WM_MAX_VIDEO_STREAMS = $3f; + {$EXTERNALSYM WM_MAX_VIDEO_STREAMS} + WM_MAX_STREAMS = $3f; + {$EXTERNALSYM WM_MAX_STREAMS} + +/////////////////////////////////////////////////////////////////////////////// +// +// Creation functions. +// +// The SDK supports 3 major objects: +// - CLSID_WMWriter - For writing out WM content. +// - CLSID_WMReader - For playing back WM content. +// - CLSID_WMMetadataEditor - For getting and editing header metadata in WM +// content. +// +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +// +// The following interfaces define the media types that this SDK supports. +// These media types are used by the writer, the reader, and the profile +// object, to identify the media-type specific properties of a media stream. +// +// The main media type is stored in the WM_MEDIA_TYPE structure. Some +// interesting (option) parameters may exist for particular stream types; +// in that case, an IWMMediaProps interface can be used to get and set +// these additional parameters. +// +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMMediaProps;'} + {$EXTERNALSYM IWMMediaProps} + IWMMediaProps = interface(IUnknown) + ['{96406BCE-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMMediaProps methods ***) + // + // GetType is provided for convenience; it returns the same as the + // majortype of the WM_MEDIA_TYPE. + // + function GetType(out pguidType: TGUID): HRESULT; stdcall; + function GetMediaType(pType: PWMMediaType; + var pcbType: LongWord): HRESULT; stdcall; + function SetMediaType(pType: PWMMediaType): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMVideoMediaProps;'} + {$EXTERNALSYM IWMVideoMediaProps} + IWMVideoMediaProps = interface(IWMMediaProps) + ['{96406BCF-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMVideoMediaProps methods ***) + function GetMaxKeyFrameSpacing(out pllTime: Int64): HRESULT; stdcall; + function SetMaxKeyFrameSpacing(llTime: Int64): HRESULT; stdcall; + function GetQuality(out pdwQuality: LongWord): HRESULT; stdcall; + function SetQuality(dwQuality: LongWord): HRESULT; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// The CLSID_WMWriter basic interfaces. +// +// Usage scenario is as follows: +// 1) SetProfile to define the configuration. +// 2) Set the outputs. +// 3) Call GetInputCount (which is valid after (1)), and GetInputProps for +// each stream. Get the default input format, and change it if desired. +// 3.5) Call SetAttribute to add metadata to the header +// At this point, the writer has been configured. +// 4) Call WriteSample repeatedly, until done. (Note that the AllocateSample +// call is just provided for convenience. You are welcome to pass in your +// own samples.) +// 5) Call Flush to write out any buffered data, and update the header and +// index. +// +/////////////////////////////////////////////////////////////////////////////// + IWMProfile = interface; + IWMInputMediaProps = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriter;'} + {$EXTERNALSYM IWMWriter} + IWMWriter = interface(IUnknown) + ['{96406BD4-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMWriter methods ***) + // This interface QI's for IWMHeaderInfo, and IWMWriterAdvanced. + + // + // There are 3 options for setting the profile on the writer. Note that + // setting the profile means that the profile is copied into the writer. + // Further editing of that profile object will have no effect, unless + // SetProfile() is called again. + // + // Calling SetProfile() removes any previously set header attribute info + // + function SetProfileByID(const guidProfile: TGUID): HRESULT; stdcall; + + function SetProfile(pProfile: IWMProfile): HRESULT; stdcall; + + // + // The easiest way to use the writer is just to write to file. + // + function SetOutputFilename(pwszFilename: PWideChar): HRESULT; stdcall; + + // + // The user can enumerate through the various inputs, and get the input + // format. Note that these are not ASF streams; one input stream may map + // to multiple ASF streams in a MEB scenario. + // + // Manipulating the IWMInputMediaProps has no effect on the writer, unless + // the user calls SetInputProps to configure the input. + // + function GetInputCount(out pcInputs: LongWord): HRESULT; stdcall; + + function GetInputProps(dwInputNum: LongWord; out ppInput: IWMInputMediaProps): HRESULT; stdcall; + + function SetInputProps(dwInputNum: LongWord; pInput: IWMInputMediaProps): HRESULT; stdcall; + + // + // Used for determining all possible format types supported by this + // input on the writer. + // + function GetInputFormatCount(dwInputNumber: LongWord; out pcFormats: LongWord): HRESULT; stdcall; + + function GetInputFormat(dwInputNumber, dwFormatNumber: LongWord; + out pProps: IWMInputMediaProps): HRESULT; stdcall; + + // + // You must call BeginWriting before sending any samples, and + // you must call EndWriting when you're done sending samples. + // + function BeginWriting: HRESULT; stdcall; + + // + // EndWriting flushes everything, updates indices and headers, + // and closes the file. + // + function EndWriting: HRESULT; stdcall; + + // + // Allocate a sample. This is optional; the user is welcome to allocate + // their own buffer class. + // + function AllocateSample(dwSampleSize: LongWord; out ppSample: INSSBuffer): HRESULT; stdcall; + + function WriteSample(dwInputNum: LongWord; cnsSampleTime: Int64; dwFlags: LongWord; + pSample: INSSBuffer): HRESULT; stdcall; + + // + // Flush() will flush the writer, but leaves the writer prepared to run + // again, when WriteSample() is called again. + // Flush() also causes an updated header to be sent to the sink. + // + function Flush: HRESULT; stdcall; + end; + +// +// The writer can be QI'd for this interface, which provides helpers +// to generate DRM keys. +// + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMDRMWriter;'} + {$EXTERNALSYM IWMDRMWriter} + IWMDRMWriter = interface(IUnknown) + ['{d6ea5dd0-12a0-43f4-90ab-a3fd451e6a07}'] + (*** IWMDRMWriter methods ***) + function GenerateKeySeed({out} pwszKeySeed: PWideChar; var pcwchLength: LongWord): HRESULT; stdcall; + function GenerateKeyID({out} pwszKeyID: PWideChar; var pcwchLength: LongWord): HRESULT; stdcall; + function GenerateSigningKeyPair({out} pwszPrivKey: PWideChar; + var pcwchPrivKeyLength: LongWord; + {out} pwszPubKey: PWideChar; + var pcwchPubKeyLength: LongWord): HRESULT; stdcall; + function SetDRMAttribute(wStreamNum: Word; pszName: PWideChar; Type_: TWMTAttrDataType; + pValue: PBYTE; cbLength: Word): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMInputMediaProps;'} + {$EXTERNALSYM IWMInputMediaProps} + IWMInputMediaProps = interface(IWMMediaProps) + ['{96406BD5-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMInputMediaProps methods ***) + function GetConnectionName({out} pwszName: PWideChar; var pcchName: Word): HRESULT; stdcall; + function GetGroupName({out} pwszName: PWideChar; var pcchName: Word): HRESULT; stdcall; + end; + + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMPropertyVault;'} + {$EXTERNALSYM IWMPropertyVault} + IWMPropertyVault = interface(IUnknown) + ['{72995A79-5090-42a4-9C8C-D9D0B6D34BE5}'] + (*** IWMPropertyVault methods ***) + function GetPropertyCount(out pdwCount: LongWord): HRESULT; stdcall; + function GetPropertyByName(pszName: PWideChar; out pType: TWMTAttrDataType; + {out} pValue: PBYTE; var pdwSize: LongWord): HRESULT; stdcall; + function SetProperty(pszName: PWideChar; pType: TWMTAttrDataType; + pValue: PBYTE; dwSize: LongWord): HRESULT; stdcall; + function GetPropertyByIndex(dwIndex: LongWord; {out} pszName: PWideChar; + var pdwNameLen: LongWord; out pType: TWMTAttrDataType; + {out} pValue: PBYTE; var pdwSize: LongWord): HRESULT; stdcall; + function CopyPropertiesFrom(pIWMPropertyVault: IWMPropertyVault): HRESULT; stdcall; + function Clear: HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMIStreamProps;'} + {$EXTERNALSYM IWMIStreamProps} + IWMIStreamProps = interface(IUnknown) + ['{6816dad3-2b4b-4c8e-8149-874c3483a753}'] + (*** IWMIStreamProps methods ***) + function GetProperty(pszName: PWideChar; out pType: TWMTAttrDataType; + {out} pValue: PBYTE; var pdwSize: LongWord): HRESULT; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// The CLSID_WMReader basic interfaces. +// +// Usage is as follows: +// 1) Call Open with a URL (possibly a local filename) and a user-supplied +// callback. After open has completed, the file has been opened and parsed. +// 2) Call GetOutputCount, and GetOutputProps for each output. This +// is valid after (1). This allows the user to get the output format for +// each output. +// 3) Call Start. Status messages and samples will begin arriving in the +// callback function. +// 4) Continue with any combination of Start/Stop/Pause, until finished. +// +/////////////////////////////////////////////////////////////////////////////// + + IWMReaderCallback = interface; + IWMOutputMediaProps = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReader;'} + {$EXTERNALSYM IWMReader} + IWMReader = interface(IUnknown) + ['{96406BD6-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMReader methods ***) + // + // This interface QI's for IWMHeaderInfo, IWMProfile, IWMReaderAdvanced, + // IWMReaderAdvanced2, and IWMReaderAdvanced3. + // + + // + // Open is an asynch call; it returns almost immediately (if the URL + // is valid), and the user should wait for appropriate OnStatus calls to + // be sent to the callback. + // + function Open(pwszURL: PWideChar; pCallback: IWMReaderCallback; + pvContext: Pointer): HRESULT; stdcall; + + function Close: HRESULT; stdcall; + + // + // The user can enumerate through the various outputs, and get the + // output format for that data. + // + // Manipulating the IWMOutputMediaProps has no effect on the output, unless + // the user also calls SetOutputProps. + // + function GetOutputCount(out pcOutputs: LongWord): HRESULT; stdcall; + + function GetOutputProps(dwOutputNum: LongWord; out ppOutput: IWMOutputMediaProps): HRESULT; stdcall; + + function SetOutputProps(dwOutputNum: LongWord; pOutput: IWMOutputMediaProps): HRESULT; stdcall; + + // + // Used for determining all possible format types supported by this + // output on the reader. + // + function GetOutputFormatCount(dwOutputNumber: LongWord; out pcFormats: LongWord): HRESULT; stdcall; + + function GetOutputFormat(dwOutputNumber, dwFormatNumber: LongWord; + out ppProps: IWMOutputMediaProps): HRESULT; stdcall; + + // + // If duration is 0, play to the end of the file. + // If msStart is set to WM_START_CURRENTPOSITION then don't perform a seek + // operation. A good use for this is when you want to change the rate but + // not the current file position. + // + // Note that any call to start while Paused will be treated as a seek. + // Even calls to Start( WM_START_CURRENTPOSITION, ... ). If your intention + // is to seek (which will incur the buffering penalty from network files) + // then you can go ahead and call Start. However, if your intention was + // to continue playing from where the user paused, you should call Resume + // instead. + // + function Start(cnsStart, cnsDuration: Int64; fRate: Single; pvContext: Pointer): HRESULT; stdcall; + function Stop: HRESULT; stdcall; + function Pause: HRESULT; stdcall; + function Resume: HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMSyncReader;'} + {$EXTERNALSYM IWMSyncReader} + IWMSyncReader = interface(IUnknown) + ['{9397F121-7705-4dc9-B049-98B698188414}'] + (*** IWMSyncReader methods ***) + // + // This interface can be QI'ed for IWMProfile, IWMHeaderInfo and + // IWMReaderTimecode interfaces + // + + // + // Open is an synchronous call. We do not support streaming at this time. + // All open with http:// etc would fail. We do support MP3 or Windows + // media files from both local file or UNC path. + // + function Open(pwszFilename: PWideChar): HRESULT; stdcall; + + function Close: HRESULT; stdcall; + + // + // SetRange is basically a seek method, you can only set same range + // for all streams. Use cnsDuration=0 to specify reading to end of file. + // + function SetRange(cnsStartTime, cnsDuration: Int64): HRESULT; stdcall; + + // + // SetRangeByFrame is frame-based access, the file has to be frame + // indexed to succeeded this call. If the call is successful, all + // streams are synchronized to the same position based on time. + // Also use cFramesToRead=0 to specify reading to end of file. + // + function SetRangeByFrame(wStreamNum: Word; qwFrameNumber, cFramesToRead: Int64 ): HRESULT; stdcall; + + // + // If a valid stream number is specified, next sample from that stream + // will be returned, pwStreamNum can be NULL in this case. Otherwise, + // GetNextSample returns the next sample in time line (regardless of + // which stream). The sample's stream number will be returned. + // Time line is presentation time if no output setting is specified. + // To get early delivery for some stream, use SetOutputSetting + // + function GetNextSample(wStreamNum: Word; out ppSample: INSSBuffer; + out pcnsSampleTime: Int64; out pcnsDuration: Int64; + out pdwFlags: LongWord; out pdwOutputNum: LongWord; + out pwStreamNum: Word): HRESULT; stdcall; + + // + // Stream selection methods are the same as asynchronous interface + // + function SetStreamsSelected(cStreamCount: Word; pwStreamNumbers: PWORD; + pSelections: PWMTStreamSelection): HRESULT; stdcall; + + function GetStreamSelected(wStreamNum: Word; out pSelection: TWMTStreamSelection): HRESULT; stdcall; + + function SetReadStreamSamples(wStreamNum: Word; fCompressed: BOOL): HRESULT; stdcall; + + function GetReadStreamSamples(wStreamNum: Word; out pfCompressed: BOOL): HRESULT; stdcall; + + // + // The following two methods are the same as the ones in + // IWMReaderAdvanced2 interface. We don't support JustInTimeDecode + // in this interface + // + function GetOutputSetting(dwOutputNum: LongWord; pszName: PWideChar; + out pType: TWMTAttrDataType; {out} pValue: PBYTE; + var pcbLength: Word): HRESULT; stdcall; + + // + // Sets a named setting for a particular output + // + function SetOutputSetting(dwOutputNum: LongWord; pszName: PWideChar; + Type_: TWMTAttrDataType; {in} pValue: PBYTE; cbLength: Word): HRESULT; stdcall; + + // + // The following methods are important for receiving uncompressed samples, + // they are identical to methods in asynchronous Reader interface. + // + function GetOutputCount(out pcOutputs: LongWord): HRESULT; stdcall; + + function GetOutputProps(dwOutputNum: LongWord; out ppOutput: IWMOutputMediaProps): HRESULT; stdcall; + + function SetOutputProps(dwOutputNum: LongWord; pOutput: IWMOutputMediaProps): HRESULT; stdcall; + + // + // Used for determining all possible format types supported by this + // output on the reader. + // + function GetOutputFormatCount(dwOutputNum: LongWord; out pcFormats: LongWord): HRESULT; stdcall; + + function GetOutputFormat(dwOutputNum, dwFormatNum: LongWord; out ppProps: IWMOutputMediaProps): HRESULT; stdcall; + + // + // Methods provided to relate output numbers with stream numbers + // + function GetOutputNumberForStream(wStreamNum: Word; out pdwOutputNum: LongWord): HRESULT; stdcall; + + function GetStreamNumberForOutput(dwOutputNum: LongWord; out pwStreamNum: Word): HRESULT; stdcall; + + function GetMaxOutputSampleSize(dwOutput: LongWord; out pcbMax: LongWord): HRESULT; stdcall; + + function GetMaxStreamSampleSize(wStream: Word; out pcbMax: LongWord): HRESULT; stdcall; + + // + // Same as IWMSyncReader::Open but takes an IStream interface pointer + // instead of an file name to be opened. This method is typically + // used for custom source. + // + function OpenStream(pStream: IStream): HRESULT; stdcall; + end; + + IWMReaderAllocatorEx = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMSyncReader2;'} + {$EXTERNALSYM IWMSyncReader2} + IWMSyncReader2 = interface(IWMSyncReader) + ['{faed3d21-1b6b-4af7-8cb6-3e189bbc187b}'] + (*** IWMSyncReader2 methods ***) + // + // SetRangeByTimecode is timecode-based access, the file has to be timecode + // indexed to succeeded this call. If the call is successful, all + // streams are synchronized to the same position based on presentation + // time. + // + function SetRangeByTimecode(wStreamNum: Word; + var pStart, pEnd: TWMTTimeCodeExtensionData): HRESULT; stdcall; + + // + // SetRangeByFrame is frame-based access, the file has to be frame + // indexed to succeeded this call. If the call is successful, all + // streams are synchronized to the same position based on time. + // Also use cFramesToRead=0 to specify reading to end of file. + // + function SetRangeByFrameEx(wStreamNum: Word; qwFrameNumber, cFramesToRead: Int64; + out pcnsStartTime: Int64): HRESULT; stdcall; + + // + // The following four methods are for user buffer allocations + // + function SetAllocateForOutput(dwOutputNum: LongWord; pAllocator: IWMReaderAllocatorEx): HRESULT; stdcall; + function GetAllocateForOutput(dwOutputNum: LongWord; out ppAllocator: IWMReaderAllocatorEx): HRESULT; stdcall; + function SetAllocateForStream(wStreamNum: Word; pAllocator: IWMReaderAllocatorEx): HRESULT; stdcall; + function GetAllocateForStream(dwSreamNum: Word; out ppAllocator: IWMReaderAllocatorEx): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMOutputMediaProps;'} + {$EXTERNALSYM IWMOutputMediaProps} + IWMOutputMediaProps = interface(IWMMediaProps) + ['{96406BD7-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMOutputMediaProps methods ***) + // + // A Stream Group and type together uniquely identify each output. (The + // type is on IWMMediaProps). + // + function GetStreamGroupName({out} pwszName: PWideChar; var pcchName: Word): HRESULT; stdcall; + function GetConnectionName({out} pwszName: PWideChar; var pcchName: Word): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMStatusCallback;'} + {$EXTERNALSYM IWMStatusCallback} + IWMStatusCallback = interface(IUnknown) + ['{6d7cdc70-9888-11d3-8edc-00c04f6109cf}'] + (*** IWMStatusCallback methods ***) + // The contents of pValue depends on the Status. + function OnStatus(Status: TWMTStatus; hr: HRESULT; dwType: TWMTAttrDataType; + pValue: PBYTE; pvContext: Pointer): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderCallback;'} + {$EXTERNALSYM IWMReaderCallback} + IWMReaderCallback = interface(IWMStatusCallback) + ['{96406BD8-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMReaderCallback methods ***) + // cnsSampleDuration will be 0 for most media types. + function OnSample(dwOutputNum: LongWord; cnsSampleTime, cnsSampleDuration: Int64; + dwFlags: LongWord; pSample: INSSBuffer; pvContext: Pointer): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMCredentialCallback;'} + {$EXTERNALSYM IWMCredentialCallback} + IWMCredentialCallback = interface(IUnknown) + ['{342e0eb7-e651-450c-975b-2ace2c90c48e}'] + (*** IWMCredentialCallback methods ***) + function AcquireCredentials(pwszRealm, pwszSite: PWideChar; {out} pwszUser: PWideChar; + cchUser: LongWord; {out} pwszPassword: PWideChar; cchPassword: LongWord; + hrStatus: HRESULT; out pdwFlags: LongWord): HRESULT; stdcall; // Combination of WMT_CREDENTIAL_FLAGS + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// The CLSID_WMMetadataEditor basic interfaces. +// +// Usage: +// 1) Call Open with a filename. +// 2) QI for IWMHeaderInfo, and use that to get and set attributes as +// needed. +// 3) Flush() will cause any changes to be written back to disk (if possible). +// 4) Close() closes the file without writing any changes to disk. +// +/////////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMMetadataEditor;'} + {$EXTERNALSYM IWMMetadataEditor} + IWMMetadataEditor = interface(IUnknown) + ['{96406BD9-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMMetadataEditor methods ***) + // QI this for IWMHeaderInfo to edit the header attributes. + // Manage the file + function Open(pwszFilename: PWideChar): HRESULT; stdcall; + function Close: HRESULT; stdcall; + function Flush: HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMMetadataEditor2;'} + {$EXTERNALSYM IWMMetadataEditor2} + IWMMetadataEditor2 = interface(IWMMetadataEditor) + ['{203CFFE3-2E18-4fdf-B59D-6E71530534CF}'] + (*** IWMMetadataEditor2 methods ***) + // + // The flags to dwDesiredAccess and dwShareMode match the flags to + // (the win32 API) CreateFile. + // + // Supported combinations are: + // + // dwDesiredAccess dwShareMode + // ---------------------------- ----------- + // GENERIC_READ | GENERIC_WRITE 0 + // GENERIC_READ | GENERIC_WRITE FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE + // GENERIC_READ 0 + // GENERIC_READ FILE_SHARE_READ + // GENERIC_READ FILE_SHARE_DELETE + // GENERIC_READ FILE_SHARE_READ | FILE_SHARE_DELETE + // + function OpenEx(pwszFilename: PWideChar; dwDesiredAccess, dwShareMode: LongWord): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMDRMEditor;'} + {$EXTERNALSYM IWMDRMEditor} + IWMDRMEditor = interface(IUnknown) + ['{FF130EBC-A6C3-42A6-B401-C3382C3E08B3}'] + (*** IWMDRMEditor methods ***) + // For accessing DRM properties from the metadata editor. + function GetDRMProperty(pwstrName: PWideChar; out pdwType: TWMTAttrDataType; + {out} pValue: PBYTE; var pcbLength: Word): HRESULT; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// Below are utility interfaces used across all 3 of the main objects. +// +/////////////////////////////////////////////////////////////////////////////// + + +// +// The 3 main interface (IWMWriter, IWMReader, and +// IWMMetadataEditor) can be QI'd for this interface to get and set +// header attributes, and markers. +// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMHeaderInfo;'} + {$EXTERNALSYM IWMHeaderInfo} + IWMHeaderInfo = interface(IUnknown) + ['{96406BDA-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMHeaderInfo methods ***) + // For attributes, the stream number passed in means: + // -1 (0xffff) to specifies "any or no stream". + // 0 specifies "no stream". + // Any other value indicates the stream number. + // + // Windows Media version 4 and earlier does not support per stream + // attributes, so any stream number other than 0 will fail. + // + function GetAttributeCount(wStreamNum: Word; out pcAttributes: Word): HRESULT; stdcall; + + function GetAttributeByIndex(wIndex: Word; var pwStreamNum: Word; + {out} pwszName: PWideChar; var pcchNameLen: Word; + out pType: TWMTAttrDataType; {out} pValue: PBYTE; + var pcbLength: Word): HRESULT; stdcall; + + function GetAttributeByName(var pwStreamNum: Word; pszName: PWideChar; + out pType: TWMTAttrDataType; {out} pValue: PBYTE; + var pcbLength: Word): HRESULT; stdcall; + + function SetAttribute(wStreamNum: Word; pszName: PWideChar; + Type_: TWMTAttrDataType; {in} pValue: PBYTE; + cbLength: Word): HRESULT; stdcall; + + // Marker methods. + function GetMarkerCount(out pcMarkers: Word): HRESULT; stdcall; + + function GetMarker(wIndex: Word; {out} pwszMarkerName: PWideChar; + var pcchMarkerNameLen: Word; out pcnsMarkerTime: Int64): HRESULT; stdcall; + + function AddMarker(pwszMarkerName: PWideChar; cnsMarkerTime: Int64): HRESULT; stdcall; + + function RemoveMarker(wIndex: Word): HRESULT; stdcall; + + // Script command methods. + function GetScriptCount(out pcScripts: Word): HRESULT; stdcall; + + function GetScript(wIndex: Word; {out} pwszType: PWideChar; + var pcchTypeLen: Word; {out} pwszCommand: PWideChar; + var pcchCommandLen: Word; out pcnsScriptTime: Int64): HRESULT; stdcall; + + function AddScript(pwszType, pwszCommand: PWideChar; + cnsScriptTime: Int64): HRESULT; stdcall; + + function RemoveScript(wIndex: Word): HRESULT; stdcall; + end; + +// The 3 main interface (IWMWriter, IWMReader, and +// IWMMetadataEditor) can be QI'd for this interface to get and set +// header attributes, and markers. + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMHeaderInfo2;'} + {$EXTERNALSYM IWMHeaderInfo2} + IWMHeaderInfo2 = interface(IWMHeaderInfo) + ['{15CF9781-454E-482e-B393-85FAE487A810}'] + (*** IWMHeaderInfo2 methods ***) + function GetCodecInfoCount(out pcCodecInfos: LongWord): HRESULT; stdcall; + + function GetCodecInfo(wIndex: LongWord; var pcchName: Word; + {out} pwszName: PWideChar; var pcchDescription: Word; + {out} pwszDescription: PWideChar; out pCodecType: WMT_CODEC_INFO_TYPE; + var pcbCodecInfo: Word; {out} pbCodecInfo: PBYTE): HRESULT; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// IWMHeaderInfo3 - V9 metadata features. This interface extends IWMHeaderInfo +// functionality: +// - allows >64k attributes; +// - allows multiple attributes with the same name; +// - works with attribute languages. +// +/////////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMHeaderInfo3;'} + {$EXTERNALSYM IWMHeaderInfo3} + IWMHeaderInfo3 = interface(IWMHeaderInfo2) + ['{15CC68E3-27CC-4ecd-B222-3F5D02D80BD5}'] + (*** IWMHeaderInfo3 methods ***) + function GetAttributeCountEx(wStreamNum: Word; out pcAttributes: Word): HRESULT; stdcall; + + function GetAttributeIndices(wStreamNum: Word; pwszName: PWideChar; + pwLangIndex: PWORD; {out} pwIndices: PWORD; var pwCount: Word): HRESULT; stdcall; + + function GetAttributeByIndexEx(wStreamNum: Word; wIndex: Word; {out} pwszName: PWideChar; + var pwNameLen: Word; out pType: TWMTAttrDataType; out pwLangIndex: Word; + {out} pValue: PBYTE; var pdwDataLength: LongWord): HRESULT; stdcall; + + function ModifyAttribute(wStreamNum: Word; wIndex: Word; Type_: TWMTAttrDataType; + wLangIndex: Word; pValue: PBYTE; dwLength: LongWord): HRESULT; stdcall; + + function AddAttribute(wStreamNum: Word; pszName: PWideChar; + out pwIndex: Word; Type_: TWMTAttrDataType; wLangIndex: Word; + pValue: PBYTE; dwLength: LongWord): HRESULT; stdcall; + + function DeleteAttribute(wStreamNum, wIndex: Word): HRESULT; stdcall; + + function AddCodecInfo(pwszName: PWideChar; pwszDescription: PWideChar; + codecType: WMT_CODEC_INFO_TYPE; cbCodecInfo: Word; + pbCodecInfo: PBYTE): HRESULT; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// The profile API. The intention is that most users don't touch the profile +// API, but just use pre-existing profiles. +// +// Profiles define authoring configurations, such as stream types, bitrates, +// etc. +// +/////////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMProfileManager;'} + {$EXTERNALSYM IWMProfileManager} + IWMProfileManager = interface(IUnknown) + ['{d16679f2-6ca0-472d-8d31-2f5d55aee155}'] + (*** IWMProfileManager methods ***) + // Create a profile with nothing in it. + function CreateEmptyProfile(dwVersion: WMT_VERSION; out ppProfile: IWMProfile): HRESULT; stdcall; + + // Load a system profile given its ID. + function LoadProfileByID(const guidProfile: TGUID; out ppProfile: IWMProfile): HRESULT; stdcall; + + // Load a profile from a stored string. + function LoadProfileByData(pwszProfile: PWideChar; out ppProfile: IWMProfile): HRESULT; stdcall; + + // Save profile specified by its string. + function SaveProfile(pIWMProfile: IWMProfile; pwszProfile: PWideChar; + var pdwLength: LongWord): HRESULT; stdcall; + + // Iterate through the system profiles. + function GetSystemProfileCount(out pcProfiles: LongWord): HRESULT; stdcall; + + function LoadSystemProfile(dwProfileIndex: LongWord; out ppProfile: IWMProfile): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMProfileManager2;'} + {$EXTERNALSYM IWMProfileManager2} + IWMProfileManager2 = interface(IWMProfileManager) + ['{7A924E51-73C1-494d-8019-23D37ED9B89A}'] + (*** IWMProfileManager2 methods ***) + // Set the version number of the system profiles that the profile manager + // will enumerate. WMT_VER_4_0 is the default, for compatibility reasons, + // so be sure to set this to the latest version if that is the desired + // result. + function GetSystemProfileVersion(out pdwVersion: WMT_VERSION): HRESULT; stdcall; + function SetSystemProfileVersion(dwVersion: WMT_VERSION): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMProfileManagerLanguage;'} + {$EXTERNALSYM IWMProfileManagerLanguage} + IWMProfileManagerLanguage = interface(IUnknown) + ['{BA4DCC78-7EE0-4ab8-B27A-DBCE8BC51454}'] + (*** IWMProfileManagerLanguage methods ***) + // Set the language ID that user prefers to use, it must be a valid + // LANGID we support and the corresponding localized profile must + // present. Or we'll use English as default + function GetUserLanguageID(out wLangID: Word): HRESULT; stdcall; + function SetUserLanguageID(wLangID: Word): HRESULT; stdcall; + end; + + IWMStreamConfig = interface; + IWMMutualExclusion = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMProfile;'} + {$EXTERNALSYM IWMProfile} + IWMProfile = interface(IUnknown) + ['{96406BDB-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMProfile methods ***) + // By default, when the user creates a profile, it will use the latest + // version of Windows Media. To create a backward-compatible profile, + // call IWMProfileManager::CreateEmptyProfile with the appropriate version + // number. + function GetVersion(out pdwVersion: WMT_VERSION): HRESULT; stdcall; + + // Profiles have names and descriptions, for use when displaying lists + // of profiles, etc. + function GetName({out} pwszName: PWideChar; var pcchName: LongWord): HRESULT; stdcall; + function SetName(pwszName: PWideChar): HRESULT; stdcall; + + function GetDescription({out} pwszDescription: PWideChar; + var pcchDescription: LongWord): HRESULT; stdcall; + + function SetDescription(pwszDescription: PWideChar): HRESULT; stdcall; + + // Methods for enumerating the streams. Note that updating the + // returned IWMStreamConfig has no effect on the profile until you + // call ReconfigStream(). + function GetStreamCount(out pcStreams: LongWord): HRESULT; stdcall; + + function GetStream(dwStreamIndex: LongWord; out ppConfig: IWMStreamConfig): HRESULT; stdcall; + + function GetStreamByNumber(wStreamNum: Word; out ppConfig: IWMStreamConfig): HRESULT; stdcall; + + // Remove a stream. + function RemoveStream(pConfig: IWMStreamConfig): HRESULT; stdcall; + + function RemoveStreamByNumber(wStreamNum: Word): HRESULT; stdcall; + + // Adding a stream copies the config into the profile. + function AddStream(pConfig: IWMStreamConfig): HRESULT; stdcall; + + function ReconfigStream(pConfig: IWMStreamConfig): HRESULT; stdcall; + + // Create a new stream config object (avoiding the need to CoCreate). + // This will still need to be added to the profile using the AddStream() + // call (but only after it has been configured). + function CreateNewStream(const guidStreamType: TGUID; + out ppConfig: IWMStreamConfig): HRESULT; stdcall; + + // Mutual Exclusion. As above, only Add and Remove actual change the + // profile. + function GetMutualExclusionCount(out pcME: LongWord): HRESULT; stdcall; + + function GetMutualExclusion(dwMEIndex: LongWord; out ppME: IWMMutualExclusion): HRESULT; stdcall; + + function RemoveMutualExclusion(pME: IWMMutualExclusion): HRESULT; stdcall; + + function AddMutualExclusion(pME: IWMMutualExclusion): HRESULT; stdcall; + + function CreateNewMutualExclusion(out ppME: IWMMutualExclusion): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMProfile2;'} + {$EXTERNALSYM IWMProfile2} + IWMProfile2 = interface(IWMProfile) + ['{07E72D33-D94E-4be7-8843-60AE5FF7E5F5}'] + (*** IWMProfile2 methods ***) + // Get/set this profile's unique identifier + function GetProfileID(out pguidID: TGUID): HRESULT; stdcall; + end; + + IWMBandwidthSharing = interface; + IWMStreamPrioritization = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMProfile3;'} + {$EXTERNALSYM IWMProfile3} + IWMProfile3 = interface(IWMProfile2) + ['{00EF96CC-A461-4546-8BCD-C9A28F0E06F5}'] + (*** IWMProfile3 methods ***) + // Get/set the storage format. These calls have been deprecated. + // Query the WM/ContainerFormat attribute instead. + // + function GetStorageFormat(out pnStorageFormat: TWMTStorageFormat): HRESULT; stdcall; + + function SetStorageFormat(nStorageFormat: TWMTStorageFormat): HRESULT; stdcall; + + // + // Bandwidth sharing. Only Add and Remove actually change the + // profile. + // + function GetBandwidthSharingCount(out pcBS: LongWord): HRESULT; stdcall; + + function GetBandwidthSharing(dwBSIndex: LongWord; out ppBS: IWMBandwidthSharing): HRESULT; stdcall; + + function RemoveBandwidthSharing(pBS: IWMBandwidthSharing): HRESULT; stdcall; + + function AddBandwidthSharing(pBS: IWMBandwidthSharing): HRESULT; stdcall; + + function CreateNewBandwidthSharing(out ppBS: IWMBandwidthSharing): HRESULT; stdcall; + + // + // Stream prioritization. Only Set and Remove actually + // change the profile. + // Note that there can be at most one such object. + // + function GetStreamPrioritization(out ppSP: IWMStreamPrioritization): HRESULT; stdcall; + + function SetStreamPrioritization(pSP: IWMStreamPrioritization): HRESULT; stdcall; + + function RemoveStreamPrioritization: HRESULT; stdcall; + + function CreateNewStreamPrioritization(out ppSP: IWMStreamPrioritization): HRESULT; stdcall; + + // + // Get information about how the muxing will be done + // + function GetExpectedPacketCount(msDuration: Int64; out pcPackets: Int64): HRESULT; stdcall; + end; + +// +// IWMStreamConfig represents an ASF stream. +// + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMStreamConfig;'} + {$EXTERNALSYM IWMStreamConfig} + IWMStreamConfig = interface(IUnknown) + ['{96406BDC-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMStreamConfig methods ***) + // This interface QI's for IWMMediaProps and one of it's inheritors. + // (IWMVideoMediaProps, for instance). + function GetStreamType(out pguidStreamType: TGUID): HRESULT; stdcall; + function GetStreamNumber(out pwStreamNum: Word): HRESULT; stdcall; + function SetStreamNumber(wStreamNum: Word): HRESULT; stdcall; + function GetStreamName({out} pwszStreamName: PWideChar; var pcchStreamName: Word): HRESULT; stdcall; + function SetStreamName(pwszStreamName: PWideChar): HRESULT; stdcall; + function GetConnectionName({out} pwszInputName: PWideChar; var pcchInputName: Word): HRESULT; stdcall; + function SetConnectionName(pwszInputName: PWideChar): HRESULT; stdcall; + function GetBitrate(out pdwBitrate: LongWord): HRESULT; stdcall; + function SetBitrate(pdwBitrate: LongWord): HRESULT; stdcall; + + // + // A buffer window of -1 (0xffffffff) indicates that the buffer window + // is unknown. On the writer side, this means the writer can use whatever + // buffer window it chooses. + // + function GetBufferWindow(out pmsBufferWindow: LongWord): HRESULT; stdcall; + function SetBufferWindow(msBufferWindow: LongWord): HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMStreamConfig2;'} + {$EXTERNALSYM IWMStreamConfig2} + IWMStreamConfig2 = interface(IWMStreamConfig) + ['{7688D8CB-FC0D-43BD-9459-5A8DEC200CFA}'] + (*** IWMStreamConfig2 methods ***) + // Get/set the type of data communication protocol (reliable or unreliable) + function GetTransportType (out pnTransportType: TWMTTransportType): HRESULT; stdcall; + + function SetTransportType(nTransportType: TWMTTransportType): HRESULT; stdcall; + + // + // Add/Get data unit extension systems (for attaching user-defined + // data to samples in the output file) + // + function AddDataUnitExtension(const guidExtensionSystemID: TGUID; + cbExtensionDataSize: Word; pbExtensionSystemInfo: PBYTE; + cbExtensionSystemInfo: LongWord): HRESULT; stdcall; + + function GetDataUnitExtensionCount(out pcDataUnitExtensions: Word): HRESULT; stdcall; + + function GetDataUnitExtension(wDataUnitExtensionNumber: Word; + out pguidExtensionSystemID: TGUID; out pcbExtensionDataSize: Word; + {out} pbExtensionSystemInfo: PBYTE; var pcbExtensionSystemInfo: LongWord): HRESULT; stdcall; + + function RemoveAllDataUnitExtensions: HRESULT; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMStreamConfig3;'} + {$EXTERNALSYM IWMStreamConfig3} + IWMStreamConfig3 = interface(IWMStreamConfig2) + ['{CB164104-3AA9-45a7-9AC9-4DAEE131D6E1}'] + (*** IWMStreamConfig3 methods ***) + // Get/set language info for this stream as an RFC1766 string. + function GetLanguage({out} pwszLanguageString: PWideChar; var pcchLanguageStringLength: Word): HRESULT; stdcall; + function SetLanguage(pwszLanguageString: PWideChar): HRESULT; stdcall; + end; + + // Controls how big packets can get in an ASF file. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMPacketSize;'} + {$EXTERNALSYM IWMPacketSize} + IWMPacketSize = interface(IUnknown) + ['{CDFB97AB-188F-40b3-B643-5B7903975C59}'] + (*** IWMPacketSize methods ***) + function GetMaxPacketSize(out pdwMaxPacketSize: LongWord): HRESULT; stdcall; + function SetMaxPacketSize(dwMaxPacketSize: LongWord): HRESULT; stdcall; + end; + + // Controls how small packets can get in an ASF file. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMPacketSize2;'} + {$EXTERNALSYM IWMPacketSize2} + IWMPacketSize2 = interface(IWMPacketSize) + ['{8BFC2B9E-B646-4233-A877-1C6A079669DC}'] + (*** IWMPacketSize2 methods ***) + function GetMinPacketSize(out pdwMinPacketSize: LongWord): HRESULT; stdcall; + function SetMinPacketSize(dwMinPacketSize: LongWord): HRESULT; stdcall; + end; + + // IWMStreamList is used for the various objects that define relationships + // between streams. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMStreamList;'} + {$EXTERNALSYM IWMStreamList} + IWMStreamList = interface(IUnknown) + ['{96406BDD-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMStreamList methods ***) + function GetStreams({out} pwStreamNumArray: PWORD; var pcStreams: PWORD): HRESULT; stdcall; + function AddStream(wStreamNum: Word): HRESULT; stdcall; + function RemoveStream(wStreamNum: Word): HRESULT; stdcall; + end; + + // IWMMutualExclusion specifies a group of streams, of which only one can + // be played at once. These are used to do MEB (stream selection based on + // bandwidth). + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMMutualExclusion;'} + {$EXTERNALSYM IWMMutualExclusion} + IWMMutualExclusion = interface(IWMStreamList) + ['{96406BDE-2B2B-11d3-B36B-00C04F6108FF}'] + (*** IWMMutualExclusion methods ***) + // The possible types of mutual exclusion are defined in the ASF + // header. + function GetType(out pguidType: TGUID): HRESULT; stdcall; + function SetType(guidType: TGUID): HRESULT; stdcall; + end; + + // IWMMutualExclusion2 extends IWMMutualExclusion to incorporate more advanced + // mutual exclusion concepts. + // + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMMutualExclusion2;'} + {$EXTERNALSYM IWMMutualExclusion2} + IWMMutualExclusion2 = interface(IWMMutualExclusion) + ['{0302B57D-89D1-4ba2-85C9-166F2C53EB91}'] + (*** IWMMutualExclusion2 methods ***) + // Methods to get and set the name of the mutual exclusion. + function GetName({out} pwszName: PWideChar; var pcchName: Word): HRESULT; stdcall; + function SetName(pwszName: PWideChar): HRESULT; stdcall; + + // Methods to query and manipulate the records in the object. + function GetRecordCount(out pwRecordCount: Word): HRESULT; stdcall; + function AddRecord: HRESULT; stdcall; + function RemoveRecord(wRecordNumber: Word ): HRESULT; stdcall; + + // Methods to get and set the name associated with a record. + function GetRecordName(wRecordNumber: Word; {out} pwszRecordName: PWideChar; + var pcchRecordName: Word): HRESULT; stdcall; + function SetRecordName(wRecordNumber: Word; pwszRecordName: PWideChar): HRESULT; stdcall; + + // Methods to get and set the streams in a record. + function GetStreamsForRecord(wRecordNumber: Word; {out} pwStreamNumArray: PWORD; + var pcStreams: Word): HRESULT; stdcall; + function AddStreamForRecord(wRecordNumber, wStreamNumber: Word): HRESULT; stdcall; + function RemoveStreamForRecord(wRecordNumber, wStreamNumber: Word): HRESULT; stdcall; + end; + + // IWMBandwidthSharing specifies a group of streams whose combined bitrate + // and buffer size are not to exceed the parameters given to this interface, + // even though the sum of their individual bitrates may be more. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMBandwidthSharing;'} + {$EXTERNALSYM IWMBandwidthSharing} + IWMBandwidthSharing = interface(IWMStreamList) + ['{AD694AF1-F8D9-42F8-BC47-70311B0C4F9E}'] + (*** IWMBandwidthSharing methods ***) + // The possible types of bandwidth are defined in the ASF + // header. + function GetType(out pguidType: TGUID): HRESULT; stdcall; + function SetType(const guidType: TGUID): HRESULT; stdcall; + + // Methods to get and set properties of the combined streams. + // Buffer windows are given in milliseconds + function GetBandwidth(out pdwBitrate, pmsBufferWindow: LongWord): HRESULT; stdcall; + function SetBandwidth(dwBitrate, msBufferWindow: LongWord): HRESULT; stdcall; + end; + + // IWMStreamPrioritization specifies the author's intentions as to which + // streams should or should not be dropped in response to various network + // congestion situations. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMStreamPrioritization;'} + {$EXTERNALSYM IWMStreamPrioritization} + IWMStreamPrioritization = interface(IUnknown) + ['{8C1C6090-F9A8-4748-8EC3-DD1108BA1E77}'] + (*** IWMStreamPrioritization methods ***) + // Records in a stream prioritization object are given in order of + // decreasing priority + function GetPriorityRecords({out} pRecordArray: PWMStreamPrioritizationRecord; var cRecords: Word): HResult; stdcall; + function SetPriorityRecords(pRecordArray: PWMStreamPrioritizationRecord; cRecords: Word): HResult; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// Advanced features. +// +/////////////////////////////////////////////////////////////////////////////// + + IWMWriterSink = interface; + + // The writer can be QI'd for this interface, which provides advanced writing + // functionality. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterAdvanced;'} + {$EXTERNALSYM IWMWriterAdvanced} + IWMWriterAdvanced = interface(IUnknown) + ['{96406BE3-2B2B-11D3-B36B-00C04F6108FF}'] + (*** IWMWriterAdvanced methods ***) + // Sinks are where the output ASF data goes. + function GetSinkCount(out pcSinks: LongWord): HResult; stdcall; + function GetSink(dwSinkNum: LongWord; out ppSink: IWMWriterSink): HResult; stdcall; + function AddSink(pSink: IWMWriterSink): HResult; stdcall; + function RemoveSink(pSink: IWMWriterSink): HResult; stdcall; + // By default, the user provides samples to an input on the + // IWMWriter interface, and the samples may be compressed, put + // into a MEB stream, etc. However, the user can use this interface to + // put the samples directly into the ASF, with no compression etc. + function WriteStreamSample(wStreamNum: Word; cnsSampleTime: Int64; + msSampleSendTime: LongWord; cnsSampleDuration: Int64; + dwFlags: LongWord; pSample: INSSBuffer): HResult; stdcall; + // The writer may be running in real-time. If so, it's interesting to + // get the current time from the writer. + function SetLiveSource(fIsLiveSource: BOOL): HResult; stdcall; + function IsRealTime(out pfRealTime: BOOL): HResult; stdcall; + function GetWriterTime(out pcnsCurrentTime: Int64): HResult; stdcall; + // To get statistics, pass in a WM_WRITER_STATISTICS structure, which + // will be filled out by the GetStatistics() call with the requested + // stats. + // + // Pass in a stream number to get statistics for a specific stream, or + // pass 0 to get statistics for the entire ASF file. + function GetStatistics(wStreamNum: Word; out pStats: TWMWriterStatistics): HResult; stdcall; + // Sync tolerance determines how far out of sync the inputs will be allowed + // to get before samples are thrown away. Default is 3000 ms. + function SetSyncTolerance(msWindow: LongWord): HResult; stdcall; + function GetSyncTolerance(out pmsWindow: LongWord): HResult; stdcall; + end; + + // The writer can be QI'd for this interface, which provides advanced writing + // functionality. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterAdvanced2;'} + {$EXTERNALSYM IWMWriterAdvanced2} + IWMWriterAdvanced2 = interface(IWMWriterAdvanced) + ['{962DC1EC-C046-4DB8-9CC7-26CEAE500817}'] + (*** IWMWriterAdvanced2 methods ***) + // Retrieves a setting for a particular output by name + function GetInputSetting(dwInputNum: LongWord; pszName: PWideChar; + out pType: TWMTAttrDataType; {out} pValue: PByte; var pcbLength: Word): HResult; stdcall; + // Sets a named setting for a particular input + function SetInputSetting(dwInputNum: LongWord; pszName: PWideChar; Type_: TWMTAttrDataType; + pValue: PByte; cbLength: Word): HResult; stdcall; + end; + + // The writer can be QI'd for this interface, which provides advanced writing + // functionality. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterAdvanced3;'} + {$EXTERNALSYM IWMWriterAdvanced3} + IWMWriterAdvanced3 = interface(IWMWriterAdvanced2) + ['{2CD6492D-7C37-4E76-9D3B-59261183A22E}'] + (*** IWMWriterAdvanced3 methods ***) + // To get extended statistics, pass in a WM_WRITER_STATISTICS_EX structure, which + // will be filled out by the GetStatisticsEx() call with the requested + // stats. + // + // Pass in a stream number to get extended statistics for a specific stream, or + // pass 0 to get extended statistics for the entire ASF file. + function GetStatisticsEx(wStreamNum: Word; out pStats: TWMWriterStatisticsEx): HResult; stdcall; + function SetNonBlocking: HResult; stdcall; + end; + + // The writer can be QI'd for this interface, which provides multi-pass + // encoding functionality. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterPreprocess;'} + {$EXTERNALSYM IWMWriterPreprocess} + IWMWriterPreprocess = interface(IUnknown) + ['{FC54A285-38C4-45B5-AA23-85B9F7CB424B}'] + (*** IWMWriterPreprocess methods ***) + function GetMaxPreprocessingPasses(dwInputNum: LongWord; dwFlags: LongWord; + out pdwMaxNumPasses: LongWord): HResult; stdcall; + function SetNumPreprocessingPasses(dwInputNum: LongWord; dwFlags: LongWord; + dwNumPasses: LongWord): HResult; stdcall; + function BeginPreprocessingPass(dwInputNum: LongWord; dwFlags: LongWord): HResult; stdcall; + function PreprocessSample(dwInputNum: LongWord; cnsSampleTime: Int64; dwFlags: LongWord; + pSample: INSSBuffer): HResult; stdcall; + function EndPreprocessingPass(dwInputNum: LongWord; dwFlags: LongWord): HResult; stdcall; + end; + + // This is the interface that receives uncompressed samples from the writer + // to preview (well, postview) what the codec is doing. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterPostViewCallback;'} + {$EXTERNALSYM IWMWriterPostViewCallback} + IWMWriterPostViewCallback = interface(IWMStatusCallback) + ['{D9D6549D-A193-4F24-B308-03123D9B7F8D}'] + (*** IWMWriterPostViewCallback methods ***) + // cnsSampleDuration will be 0 for most media types. + function OnPostViewSample(wStreamNumber: Word; cnsSampleTime: Int64; + cnsSampleDuration: Int64; dwFlags: LongWord; + pSample: INSSBuffer; pvContext: Pointer): HResult; stdcall; + function AllocateForPostView(wStreamNum: Word; cbBuffer: LongWord; out ppBuffer: INSSBuffer; + pvContext: Pointer): HResult; stdcall; + end; + + // The writer can be QI'd for this interface, which provides advanced writing + // functionality. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterPostView;'} + {$EXTERNALSYM IWMWriterPostView} + IWMWriterPostView = interface(IUnknown) + ['{81E20CE4-75EF-491A-8004-FC53C45BDC3E}'] + (*** IWMWriterPostView methods ***) + // Specify the callback to use for PostView + function SetPostViewCallback(pCallback: IWMWriterPostViewCallback; pvContext: Pointer): HResult; stdcall; + // Turns on delivery of postview samples for a given stream + function SetReceivePostViewSamples(wStreamNum: Word; fReceivePostViewSamples: BOOL): HResult; stdcall; + function GetReceivePostViewSamples(wStreamNum: Word; out pfReceivePostViewSamples: BOOL): HResult; stdcall; + // The user can enumerate through the various outputs, and get the + // output format for that data. + // + // Manipulating the IWMOutputMediaProps has no effect on the output, unless + // the user also calls SetOutputProps. + function GetPostViewProps(wStreamNumber: Word; out ppOutput: IWMMediaProps): HResult; stdcall; + function SetPostViewProps(wStreamNumber: Word; pOutput: IWMMediaProps): HResult; stdcall; + // Used for determining all possible format types supported by this + // output on the reader. + function GetPostViewFormatCount(wStreamNumber: Word; out pcFormats: LongWord): HResult; stdcall; + function GetPostViewFormat(wStreamNumber: Word; dwFormatNumber: LongWord; + out ppProps: IWMMediaProps): HResult; stdcall; + // The user can register himself to provide buffers for any of the outputs + // (for instance, DDraw buffers). The actual allocation is on the + // IWMReaderCallbackAdvanced interface. + function SetAllocateForPostView(wStreamNumber: Word; fAllocate: BOOL): HResult; stdcall; + function GetAllocateForPostView(wStreamNumber: Word; out pfAllocate: BOOL): HResult; stdcall; + end; + + // This is the interface that receives raw ASF from the writer. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterSink;'} + {$EXTERNALSYM IWMWriterSink} + IWMWriterSink = interface(IUnknown) + ['{96406BE4-2B2B-11D3-B36B-00C04F6108FF}'] + (*** IWMWriterSink methods ***) + function OnHeader(pHeader: INSSBuffer): HResult; stdcall; + // Some sinks require that data be fed to them in real-time. + function IsRealTime(out pfRealTime: BOOL): HResult; stdcall; + function AllocateDataUnit(cbDataUnit: LongWord; out ppDataUnit: INSSBuffer): HResult; stdcall; + function OnDataUnit(pDataUnit: INSSBuffer): HResult; stdcall; + // This function is called when the writer is done sending data. + function OnEndWriting: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMRegisterCallback;'} + {$EXTERNALSYM IWMRegisterCallback} + IWMRegisterCallback = interface(IUnknown) + ['{CF4B1F99-4DE2-4E49-A363-252740D99BC1}'] + (*** IWMRegisterCallback methods ***) + function Advise(pCallback: IWMStatusCallback; pvContext: Pointer): HResult; stdcall; + function Unadvise(pCallback: IWMStatusCallback; pvContext: Pointer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterFileSink;'} + {$EXTERNALSYM IWMWriterFileSink} + IWMWriterFileSink = interface(IWMWriterSink) + ['{96406BE5-2B2B-11D3-B36B-00C04F6108FF}'] + (*** IWMWriterFileSink methods ***) + function Open(pwszFilename: PWideChar): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterFileSink2;'} + {$EXTERNALSYM IWMWriterFileSink2} + IWMWriterFileSink2 = interface(IWMWriterFileSink) + ['{14282BA7-4AEF-4205-8CE5-C229035A05BC}'] + (*** IWMWriterFileSink2 methods ***) + function Start(cnsStartTime: Int64): HResult; stdcall; + function Stop(cnsStopTime: Int64): HResult; stdcall; + function IsStopped(out pfStopped: BOOL): HResult; stdcall; + function GetFileDuration(out pcnsDuration: Int64): HResult; stdcall; + function GetFileSize(out pcbFile: Int64): HResult; stdcall; + function Close: HResult; stdcall; + function IsClosed(out pfClosed: BOOL): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterFileSink3;'} + {$EXTERNALSYM IWMWriterFileSink3} + IWMWriterFileSink3 = interface(IWMWriterFileSink2) + ['{3FEA4FEB-2945-47A7-A1DD-C53A8FC4C45C}'] + (*** IWMWriterFileSink3 methods ***) + function SetAutoIndexing(fDoAutoIndexing: BOOL): HResult; stdcall; + function GetAutoIndexing(out pfAutoIndexing: BOOL): HResult; stdcall; + function SetControlStream(wStreamNumber: Word; fShouldControlStartAndStop: BOOL): HResult; stdcall; + function GetMode(out pdwFileSinkMode: LongWord): HResult; stdcall; + function OnDataUnitEx(pFileSinkDataUnit: PWMTFileSinkDataUnit): HResult; stdcall; + function SetUnbufferedIO(fUnbufferedIO: BOOL; fRestrictMemUsage: BOOL): HResult; stdcall; + function GetUnbufferedIO(out pfUnbufferedIO: BOOL): HResult; stdcall; + function CompleteOperations: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterNetworkSink;'} + {$EXTERNALSYM IWMWriterNetworkSink} + IWMWriterNetworkSink = interface(IWMWriterSink) + ['{96406BE7-2B2B-11D3-B36B-00C04F6108FF}'] + (*** IWMWriterNetworkSink methods ***) + // Determine the maximum number of clients that can connect to this sink. + // Default is 5. + function SetMaximumClients(dwMaxClients: LongWord): HResult; stdcall; + function GetMaximumClients(out pdwMaxClients: LongWord): HResult; stdcall; + // The network protocol that the network sink will use. + function SetNetworkProtocol(protocol: TWMTNetProtocol): HResult; stdcall; + function GetNetworkProtocol(out pProtocol: TWMTNetProtocol): HResult; stdcall; + // Find out the name of the URL on which we're broadcasting + function GetHostURL({out} pwszURL: PWideChar; var pcchURL: LongWord): HResult; stdcall; + // The method claims the network port number. Close the sink to release + // the port. + // + // Specify 0 for the port number and the sink will select a port for + // the user. + function Open(var pdwPortNum: LongWord): HResult; stdcall; + // Disconnect all connected clients. + function Disconnect: HResult; stdcall; + // Close and release the open port. + function Close: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMClientConnections;'} + {$EXTERNALSYM IWMClientConnections} + IWMClientConnections = interface(IUnknown) + ['{73C66010-A299-41DF-B1F0-CCF03B09C1C6}'] + (*** IWMClientConnections methods ***) + // Determine the number of connected clients + function GetClientCount(out pcClients: LongWord): HResult; stdcall; + // Get information about a connected client + function GetClientProperties(dwClientNum: LongWord; out pClientProperties: TWMClientProperties): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMClientConnections2;'} + {$EXTERNALSYM IWMClientConnections2} + IWMClientConnections2 = interface(IWMClientConnections) + ['{4091571E-4701-4593-BB3D-D5F5F0C74246}'] + (*** IWMClientConnections2 methods ***) + // Get information about a connected client + function GetClientInfo(dwClientNum: LongWord; {out} pwszNetworkAddress: PWideChar; + var pcchNetworkAddress: LongWord; {out} pwszPort: PWideChar; + var pcchPort: LongWord; {out} pwszDNSName: PWideChar; + var pcchDNSName: LongWord): HResult; stdcall; + end; + +// The reader can be QI'd for this interface for advanced functionality. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderAdvanced;'} + {$EXTERNALSYM IWMReaderAdvanced} + IWMReaderAdvanced = interface(IUnknown) + ['{96406BEA-2B2B-11D3-B36B-00C04F6108FF}'] + (*** IWMReaderAdvanced methods ***) + // The user may want to drive the clock himself, particularly if he wants + // to source from a file faster-than-realtime. This call may fail if the + // current source does not support user-driven clocks. + // + // The proper way for a user to drive the clock is for the user to call + // DeliverTime, and then wait for the OnTime call on + // IWMReaderCallbackAdvanced to reach the time he specified. + function SetUserProvidedClock(fUserClock: BOOL): HResult; stdcall; + function GetUserProvidedClock(out pfUserClock: BOOL): HResult; stdcall; + function DeliverTime(cnsTime: Int64): HResult; stdcall; + // The user can select streams manually, instead of relying on the + // automatic bandwidth stream selection that the reader will + // normally do. To figure out what streams are in this ASF and what their + // numbers are, QI for IWMProfile. + // + // When SetManualStreamSelection( TRUE ) is called, all streams are + // selected by default. + function SetManualStreamSelection(fSelection: BOOL): HResult; stdcall; + function GetManualStreamSelection(out pfSelection: BOOL): HResult; stdcall; + function SetStreamsSelected(cStreamCount: Word; pwStreamNumbers: PWord; + pSelections: PWMTStreamSelection): HResult; stdcall; + function GetStreamSelected(wStreamNum: Word; out pSelection: TWMTStreamSelection): HResult; stdcall; + // The user can also choose to get callbacks when automatic stream + // selection occurs. + function SetReceiveSelectionCallbacks(fGetCallbacks: BOOL): HResult; stdcall; + function GetReceiveSelectionCallbacks(out pfGetCallbacks: BOOL): HResult; stdcall; + // The user can register himself to receive samples directly from the + // ASF streams, rather than letting the Reader decompress them. Note that + // to do this, the IWMReaderCallback (supplied by the user) must support + // IWMReaderCallbackAdvanced. + // + // To get actual information about the contents of a stream, QI the + // object for IWMProfile. + function SetReceiveStreamSamples(wStreamNum: Word; fReceiveStreamSamples: BOOL): HResult; stdcall; + function GetReceiveStreamSamples(wStreamNum: Word; out pfReceiveStreamSamples: BOOL): HResult; stdcall; + // The user can register himself to provide buffers for any of the outputs + // (for instance, DDraw buffers). The actual allocation is on the + // IWMReaderCallbackAdvanced interface. + function SetAllocateForOutput(dwOutputNum: LongWord; fAllocate: BOOL): HResult; stdcall; + function GetAllocateForOutput(dwOutputNum: LongWord; out pfAllocate: BOOL): HResult; stdcall; + function SetAllocateForStream(wStreamNum: Word; fAllocate: BOOL): HResult; stdcall; + function GetAllocateForStream(dwSreamNum: Word; out pfAllocate: BOOL): HResult; stdcall; + // Get statistics on demand + function GetStatistics(var pStatistics: TWMReaderStatistics): HResult; stdcall; + // Set client side information used for logging + function SetClientInfo(pClientInfo: PWMReaderClientInfo): HResult; stdcall; + // Get the maximum required buffer sizes that the SDK will allocate. + // The first is for output buffers, the second for stream buffers. + function GetMaxOutputSampleSize(dwOutput: LongWord; out pcbMax: LongWord): HResult; stdcall; + function GetMaxStreamSampleSize(wStream: Word; out pcbMax: LongWord): HResult; stdcall; + // Used to notify the reader that it's delivering data + // too slowly to the client. The reader will try to speed + // up. + function NotifyLateDelivery(cnsLateness: Int64): HResult; stdcall; + end; + + // The reader can be QI'd for this interface for advanced functionality. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderAdvanced2;'} + {$EXTERNALSYM IWMReaderAdvanced2} + IWMReaderAdvanced2 = interface(IWMReaderAdvanced) + ['{AE14A945-B90C-4D0D-9127-80D665F7D73E}'] + (*** IWMReaderAdvanced2 methods ***) + // Set the play mode to WMT_PLAY_MODE_AUTOSELECT to allow the reader + // to pick the mode. (This is the default). If you select a play mode that + // is impossible for the requested URL, an error will be returned when + // the URL is opened. + function SetPlayMode(Mode: TWMTPlayMode): HResult; stdcall; + // Get the current play mode. + function GetPlayMode(out pMode: TWMTPlayMode): HResult; stdcall; + // Between WMT_BUFFERING_START and WMT_BUFFERING_STOP this call will + // return progress values. pdwPercent returns the percentage of buffering + // that has completed, and pcnsBuffering returns the amount of buffering + // remaining. + function GetBufferProgress(out pdwPercent: LongWord; out pcnsBuffering: Int64): HResult; stdcall; + // When the play mode is WMT_PLAY_MODE_DOWNLOAD, this call will return + // progress values. pdwPercent returns the percentage of the download + // that has completed, pqwBytesDownloaded returns the number of bytes + // that have been downloaded, and pcnsDownload returns the amount of + // downloading remaining. + function GetDownloadProgress(out pdwPercent: LongWord; out pqwBytesDownloaded: Int64; + out pcnsDownload: Int64): HResult; stdcall; + // When saving a file, the operation may take awhile. Between + // WMT_SAVEAS_START and WMT_SAVEAS_STOP, this call will return progress + // values. pdwPercent returns the percentage of the save as that has + // completed. + function GetSaveAsProgress(out pdwPercent: LongWord): HResult; stdcall; + // Save the current file. This only works for WMT_PLAY_MODE_DOWNLOAD. + // This operation is asynchronous; WMT_SAVEAS_STOP indicates that the + // save has completed. Closing the reader will abort a save operation + // that has not completed. + function SaveFileAs(pwszFilename: PWideChar): HResult; stdcall; + // Returns the name of the protocol that is currently being used. + // The protocol name is a URL scheme, such as "mmsu", "http", "file", etc. + // Note, however, that the protocol name may differ from the URL scheme + // that was specified in IWMReader::Open(). + // This method may return an empty string if the protocol name cannot be determined. + function GetProtocolName({out} pwszProtocol: PWideChar; var pcchProtocol: LongWord): HResult; stdcall; + // Same as IWMReader::Start, but uses a marker index instead of a time value. + function StartAtMarker(wMarkerIndex: Word; cnsDuration: Int64; fRate: Single; + pvContext: Pointer): HResult; stdcall; + // Retrieves a setting for a particular output by name + function GetOutputSetting(dwOutputNum: LongWord; pszName: PWideChar; + out pType: TWMTAttrDataType; {out} pValue: PByte; var pcbLength: Word): HResult; stdcall; + // Sets a named setting for a particular output + function SetOutputSetting(dwOutputNum: LongWord; pszName: PWideChar; Type_: TWMTAttrDataType; + pValue: PByte; cbLength: Word): HResult; stdcall; + // Used to begin prerolling the reader. Call this method + // when you know you're going to call Start soon and want + // to start buffering data in advance. cnsStart, cnsDuration + // and fRate should be the same as the values you plan to pass + // to Start in the future. + function Preroll(cnsStart: Int64; cnsDuration: Int64; fRate: Single): HResult; stdcall; + // Specifies whether the SDK should send the client's unique identifier + // to the server when streaming. + function SetLogClientID(fLogClientID: BOOL): HResult; stdcall; + function GetLogClientID(out pfLogClientID: BOOL): HResult; stdcall; + // This method requests that the Reader send WMT_BUFFERING_STOP as soon + // as possible. The Reader will only honor the request if it is currently + // buffering, i.e., it has sent a WMT_BUFFERING_START, but not yet sent the + // corresponding WMT_BUFFERING_STOP. + function StopBuffering: HResult; stdcall; + // Same as IWMReader::Open but takes an IStream interface pointer instead + // of an URL to be opened + function OpenStream(const pStream: IStream; pCallback: IWMReaderCallback; + pvContext: Pointer): HResult; stdcall; + end; + + // The reader can be QI'ed for this interface for frame access functionaly. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderAdvanced3;'} + {$EXTERNALSYM IWMReaderAdvanced3} + IWMReaderAdvanced3 = interface(IWMReaderAdvanced2) + ['{5DC0674B-F04B-4A4E-9F2A-B1AFDE2C8100}'] + (*** IWMReaderAdvanced3 methods ***) + // This method is used when you want to stop net streaming right away but + // continue to receive samples that SDK have gotten so far. + // + // If it's successful, user should receive an END_OF_STREAMING quickly. + function StopNetStreaming: HResult; stdcall; + // This method supports extended start functionality. The currently + // support start formats are: + // + // WMT_OFFSET_FORMAT_100NS + // WMT_OFFSET_FORMAT_FRAME_NUMBERS + // WMT_OFFSET_FORMAT_PLAYLIST_OFFSET + // WMT_OFFSET_FORMAT_TIMECODE + function StartAtPosition(wStreamNum: Word; pvOffsetStart: Pointer; pvDuration: Pointer; + dwOffsetFormat: TWMTOffsetFormat; fRate: Single; + pvContext: Pointer): HResult; stdcall; + end; + + // The reader can be QI'ed for this interface for frame access functionaly. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderAdvanced4;'} + {$EXTERNALSYM IWMReaderAdvanced4} + IWMReaderAdvanced4 = interface(IWMReaderAdvanced3) + ['{945A76A2-12AE-4D48-BD3C-CD1D90399B85}'] + (*** IWMReaderAdvanced4 methods ***) + function GetLanguageCount(dwOutputNum: LongWord; out pwLanguageCount: Word): HResult; stdcall; + function GetLanguage(dwOutputNum: LongWord; wLanguage: Word; {out} pwszLanguageString: PWideChar; + var pcchLanguageStringLength: Word): HResult; stdcall; + function GetMaxSpeedFactor(out pdblFactor: Double): HResult; stdcall; + function IsUsingFastCache(out pfUsingFastCache: BOOL): HResult; stdcall; + function AddLogParam(wszNameSpace: PWideChar; wszName: PWideChar; wszValue: PWideChar): HResult; stdcall; + function SendLogParams: HResult; stdcall; + // Sets output parameter to TRUE if IWMReaderAdvanced2::SaveFileAs() is + // can be invoked for the current content. + function CanSaveFileAs(out pfCanSave: BOOL): HResult; stdcall; + // Cancels the current FileSaveAs operation + function CancelSaveFileAs: HResult; stdcall; + // This method returns the URL currently being played. This URL might be + // different from the URL passed in to IWMReader::Open, because the Reader + // may have been redirected to an alternate URL. + function GetURL(pwszURL: PWideChar; var pcchURL: LongWord): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderAllocatorEx;'} + {$EXTERNALSYM IWMReaderAllocatorEx} + IWMReaderAllocatorEx = interface(IUnknown) + ['{9F762FA7-A22E-428D-93C9-AC82F3AAFE5A}'] + (*** IWMReaderAllocatorEx methods ***) + function AllocateForStreamEx(wStreamNum: Word; cbBuffer: LongWord; out ppBuffer: INSSBuffer; + dwFlags: LongWord; cnsSampleTime: Int64; + cnsSampleDuration: Int64; pvContext: Pointer): HResult; stdcall; + function AllocateForOutputEx(dwOutputNum: LongWord; cbBuffer: LongWord; + out ppBuffer: INSSBuffer; dwFlags: LongWord; + cnsSampleTime: Int64; cnsSampleDuration: Int64; + pvContext: Pointer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderTypeNegotiation;'} + {$EXTERNALSYM IWMReaderTypeNegotiation} + IWMReaderTypeNegotiation = interface(IUnknown) + ['{FDBE5592-81A1-41EA-93BD-735CAD1ADC05}'] + (*** IWMReaderTypeNegotiation methods ***) + function TryOutputProps(dwOutputNum: LongWord; pOutput: IWMOutputMediaProps): HResult; stdcall; + end; + + // For some advanced functionality, the IWMReaderCallback must support this + // interface. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderCallbackAdvanced;'} + {$EXTERNALSYM IWMReaderCallbackAdvanced} + IWMReaderCallbackAdvanced = interface(IUnknown) + ['{96406BEB-2B2B-11D3-B36B-00C04F6108FF}'] + (*** IWMReaderCallbackAdvanced methods ***) + // Receive a sample directly from the ASF. To get this call, the user + // must register himself to receive samples for a particular stream. + function OnStreamSample(wStreamNum: Word; cnsSampleTime: Int64; + cnsSampleDuration: Int64; dwFlags: LongWord; + pSample: INSSBuffer; pvContext: Pointer): HResult; stdcall; + // In some cases, the user may want to get callbacks telling what the + // reader thinks the current time is. This is interesting in 2 cases: + // - If the ASF has gaps in it; say no audio for 10 seconds. This call + // will continue to be called, while OnSample won't be called. + // - If the user is driving the clock, the reader needs to communicate + // back to the user its time, to avoid the user overrunning the reader. + function OnTime(cnsCurrentTime: Int64; pvContext: Pointer): HResult; stdcall; + // The user can also get callbacks when stream selection occurs. + function OnStreamSelection(wStreamCount: Word; pStreamNumbers: PWord; + pSelections: PWMTStreamSelection; pvContext: Pointer): HResult; stdcall; + // Will be called if the user got an async result from their + // call to SetOutputProps. The next sample you receive for + // this output will have these properties. The contents of the + // media type after calling SetOutputProps and before receiving + // an OutputPropsChanged notification are undefined. + function OnOutputPropsChanged(dwOutputNum: LongWord; pMediaType: PWMMediaType; + pvContext: Pointer): HResult; stdcall; + // If the user has registered to allocate buffers, this is where he must + // do it. + function AllocateForStream(wStreamNum: Word; cbBuffer: LongWord; out ppBuffer: INSSBuffer; + pvContext: Pointer): HResult; stdcall; + function AllocateForOutput(dwOutputNum: LongWord; cbBuffer: LongWord; out ppBuffer: INSSBuffer; + pvContext: Pointer): HResult; stdcall; + end; + + // Used to access advanced DRM functionality. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMDRMReader;'} + {$EXTERNALSYM IWMDRMReader} + IWMDRMReader = interface(IUnknown) + ['{D2827540-3EE7-432C-B14C-DC17F085D3B3}'] + (*** IWMDRMReader methods ***) + function AcquireLicense(dwFlags: LongWord): HResult; stdcall; + function CancelLicenseAcquisition: HResult; stdcall; + function Individualize(dwFlags: LongWord): HResult; stdcall; + function CancelIndividualization: HResult; stdcall; + function MonitorLicenseAcquisition: HResult; stdcall; + function CancelMonitorLicenseAcquisition: HResult; stdcall; + function SetDRMProperty(pwstrName: PWideChar; dwType: TWMTAttrDataType; pValue: PByte; + cbLength: Word): HResult; stdcall; + function GetDRMProperty(pwstrName: PWideChar; out pdwType: TWMTAttrDataType; pValue: PByte; + var pcbLength: Word): HResult; stdcall; + end; + + // Used to configure the network. This interface is implemented by + // the IWMReader object. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderNetworkConfig;'} + {$EXTERNALSYM IWMReaderNetworkConfig} + IWMReaderNetworkConfig = interface(IUnknown) + ['{96406BEC-2B2B-11D3-B36B-00C04F6108FF}'] + (*** IWMReaderNetworkConfig methods ***) + // Get and set the amount of time the network source will buffer + // data before rendering it. + function GetBufferingTime(out pcnsBufferingTime: Int64): HResult; stdcall; + function SetBufferingTime(cnsBufferingTime: Int64): HResult; stdcall; + // Returns the UDP port number ranges that will be used for receiving + // data. If no ranges are available, random UDP port numbers will be used. + function GetUDPPortRanges({out} pRangeArray: PWMPortNumberRange; var pcRanges: LongWord): HResult; stdcall; + // Sets the UDP port number ranges that can be used for receiving data. + // If no ranges are specified, random UDP port numbers will be used. + function SetUDPPortRanges({in} pRangeArray: PWMPortNumberRange; cRanges: LongWord): HResult; stdcall; + // Proxy settings: Manual proxy, Autodetect, UseBrowser (only for HTTP), or No Proxy. + function GetProxySettings(pwszProtocol: PWideChar; out pProxySetting: TWMTProxySettings): HResult; stdcall; + function SetProxySettings(pwszProtocol: PWideChar; ProxySetting: TWMTProxySettings): HResult; stdcall; + // The host to use as the proxy. + function GetProxyHostName(pwszProtocol: PWideChar; {out} pwszHostName: PWideChar; + var pcchHostName: LongWord): HResult; stdcall; + function SetProxyHostName(pwszProtocol: PWideChar; pwszHostName: PWideChar): HResult; stdcall; + // The port to use as the proxy. + function GetProxyPort(pwszProtocol: PWideChar; out pdwPort: LongWord): HResult; stdcall; + function SetProxyPort(pwszProtocol: PWideChar; dwPort: LongWord): HResult; stdcall; + // Get and set the proxy exception list. + function GetProxyExceptionList(pwszProtocol: PWideChar; {out} pwszExceptionList: PWideChar; + var pcchExceptionList: LongWord): HResult; stdcall; + function SetProxyExceptionList(pwszProtocol: PWideChar; pwszExceptionList: PWideChar): HResult; stdcall; + // Whether or not to bypass proxy for local hosts + function GetProxyBypassForLocal(pwszProtocol: PWideChar; out pfBypassForLocal: BOOL): HResult; stdcall; + function SetProxyBypassForLocal(pwszProtocol: PWideChar; fBypassForLocal: BOOL): HResult; stdcall; + // Whether to force a wpad discovery on the next run + function GetForceRerunAutoProxyDetection(out pfForceRerunDetection: BOOL): HResult; stdcall; + function SetForceRerunAutoProxyDetection(fForceRerunDetection: BOOL): HResult; stdcall; + // Whether or not to use multicast, http, tcp, or udp + function GetEnableMulticast(out pfEnableMulticast: BOOL): HResult; stdcall; + function SetEnableMulticast(fEnableMulticast: BOOL): HResult; stdcall; + function GetEnableHTTP(out pfEnableHTTP: BOOL): HResult; stdcall; + function SetEnableHTTP(fEnableHTTP: BOOL): HResult; stdcall; + function GetEnableUDP(out pfEnableUDP: BOOL): HResult; stdcall; + function SetEnableUDP(fEnableUDP: BOOL): HResult; stdcall; + function GetEnableTCP(out pfEnableTCP: BOOL): HResult; stdcall; + function SetEnableTCP(fEnableTCP: BOOL): HResult; stdcall; + // Forgets automatic protocol detection settings and redetects next time. + function ResetProtocolRollover: HResult; stdcall; + // Return or set the client's link bandwidth in bps. This is an optional + // setting. By default, the SDK will automatically detect its connection + // bandwidth to the streaming media server. + function GetConnectionBandwidth(out pdwConnectionBandwidth: LongWord): HResult; stdcall; + function SetConnectionBandwidth(dwConnectionBandwidth: LongWord): HResult; stdcall; + // Iterate through the network protocols supported by this reader + function GetNumProtocolsSupported(out pcProtocols: LongWord): HResult; stdcall; + function GetSupportedProtocolName(dwProtocolNum: LongWord; {out} pwszProtocolName: PWideChar; + var pcchProtocolName: LongWord): HResult; stdcall; + // Adds the specified pszUrl to the list of URL's to recieve logging data. + // This list is in addition to the origin server. + function AddLoggingUrl(pwszURL: PWideChar): HResult; stdcall; + // Fills the buffer with the URL corresponding to index dwIndex. + function GetLoggingUrl(dwIndex: LongWord; {out} pwszURL: PWideChar; var pcchURL: LongWord): HResult; stdcall; + // Returns the number of URLs in the current list of logging URLs. + function GetLoggingUrlCount(out pdwUrlCount: LongWord): HResult; stdcall; + // Clears the list of logging URLs + function ResetLoggingUrlList: HResult; stdcall; + end; + + // Used to configure the network. This interface is implemented by + // the IWMReader object. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderNetworkConfig2;'} + {$EXTERNALSYM IWMReaderNetworkConfig2} + IWMReaderNetworkConfig2 = interface(IWMReaderNetworkConfig) + ['{D979A853-042B-4050-8387-C939DB22013F}'] + (*** IWMReaderNetworkConfig2 methods ***) + // If enabled, allows streaming content (WMT_PLAY_MODE_STREAMING) + // to be cached locally. + function GetEnableContentCaching(out pfEnableContentCaching: BOOL): HResult; stdcall; + function SetEnableContentCaching(fEnableContentCaching: BOOL): HResult; stdcall; + // If enabled, allows streaming content to be streamed at a rate higher + // than the playback rate. This feature requires ContentCaching to be + // enabled as well. + function GetEnableFastCache(out pfEnableFastCache: BOOL): HResult; stdcall; + function SetEnableFastCache(fEnableFastCache: BOOL): HResult; stdcall; + function GetAcceleratedStreamingDuration(out pcnsAccelDuration: Int64): HResult; stdcall; + function SetAcceleratedStreamingDuration(cnsAccelDuration: Int64): HResult; stdcall; + function GetAutoReconnectLimit(out pdwAutoReconnectLimit: LongWord): HResult; stdcall; + function SetAutoReconnectLimit(dwAutoReconnectLimit: LongWord): HResult; stdcall; + function GetEnableResends(out pfEnableResends: BOOL): HResult; stdcall; + function SetEnableResends(fEnableResends: BOOL): HResult; stdcall; + function GetEnableThinning(out pfEnableThinning: BOOL): HResult; stdcall; + function SetEnableThinning(fEnableThinning: BOOL): HResult; stdcall; + function GetMaxNetPacketSize(out pdwMaxNetPacketSize: LongWord): HResult; stdcall; + end; + + // Used to configure the network. This interface is implemented by + // the IWMReader object. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderStreamClock;'} + {$EXTERNALSYM IWMReaderStreamClock} + IWMReaderStreamClock = interface(IUnknown) + ['{96406BED-2B2B-11D3-B36B-00C04F6108FF}'] + (*** IWMReaderStreamClock methods ***) + // Get the current value of the stream clock + function GetTime(pcnsNow: PInt64): HResult; stdcall; + // Set or kill a timer. All timers are automatically + // killed whenever you stop the Reader. When a timer + // expires, you'll receive a WMT_TIMER OnStatus callback + // with hr == S_OK, pValue = TimerId and pvContext == pvParam. + function SetTimer(cnsWhen: Int64; pvParam: Pointer; out pdwTimerId: LongWord): HResult; stdcall; + function KillTimer(dwTimerId: LongWord): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMIndexer;'} + {$EXTERNALSYM IWMIndexer} + IWMIndexer = interface(IUnknown) + ['{6D7CDC71-9888-11D3-8EDC-00C04F6109CF}'] + (*** IWMIndexer methods ***) + // Start is an asynchronous call; it returns almost immediately and the user + // should wait for appropriate OnStatus calls to be sent to the callback. + function StartIndexing(pwszURL: PWideChar; pCallback: IWMStatusCallback; + pvContext: Pointer): HResult; stdcall; + function Cancel: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMIndexer2;'} + {$EXTERNALSYM IWMIndexer2} + IWMIndexer2 = interface(IWMIndexer) + ['{B70F1E42-6255-4DF0-A6B9-02B212D9E2BB}'] + (*** IWMIndexer2 methods ***) + function Configure(wStreamNum: Word; nIndexerType: TWMTIndexType; + pvInterval: Pointer; pvIndexType: Pointer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMLicenseBackup;'} + {$EXTERNALSYM IWMLicenseBackup} + IWMLicenseBackup = interface(IUnknown) + ['{05E5AC9F-3FB6-4508-BB43-A4067BA1EBE8}'] + (*** IWMLicenseBackup methods ***) + function BackupLicenses(dwFlags: LongWord; pCallback: IWMStatusCallback): HResult; stdcall; + function CancelLicenseBackup: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMLicenseRestore;'} + {$EXTERNALSYM IWMLicenseRestore} + IWMLicenseRestore = interface(IUnknown) + ['{C70B6334-A22E-4EFB-A245-15E65A004A13}'] + (*** IWMLicenseRestore methods ***) + function RestoreLicenses(dwFlags: LongWord; pCallback: IWMStatusCallback): HResult; stdcall; + function CancelLicenseRestore: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMBackupRestoreProps;'} + {$EXTERNALSYM IWMBackupRestoreProps} + IWMBackupRestoreProps = interface(IUnknown) + ['{3C8E0DA6-996F-4FF3-A1AF-4838F9377E2E}'] + (*** IWMBackupRestoreProps methods ***) + function GetPropCount(out pcProps: Word): HResult; stdcall; + function GetPropByIndex(wIndex: Word; {out} pwszName: PWideChar; var pcchNameLen: Word; + out pType: TWMTAttrDataType; {out} pValue: PByte; var pcbLength: Word): HResult; stdcall; + function GetPropByName(pszName: PWideChar; out pType: TWMTAttrDataType; {out} pValue: PByte; + var pcbLength: Word): HResult; stdcall; + function SetProp(pszName: PWideChar; Type_: TWMTAttrDataType; pValue: PByte; cbLength: Word): HResult; stdcall; + function RemoveProp(pcwszName: PWideChar): HResult; stdcall; + function RemoveAllProps: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMCodecInfo;'} + {$EXTERNALSYM IWMCodecInfo} + IWMCodecInfo = interface(IUnknown) + ['{A970F41E-34DE-4A98-B3BA-E4B3CA7528F0}'] + (*** IWMCodecInfo methods ***) + function GetCodecInfoCount(const guidType: TGUID; out pcCodecs: LongWord): HResult; stdcall; + function GetCodecFormatCount(const guidType: TGUID; dwCodecIndex: LongWord; out pcFormat: LongWord): HResult; stdcall; + function GetCodecFormat(const guidType: TGUID; dwCodecIndex: LongWord; dwFormatIndex: LongWord; + out ppIStreamConfig: IWMStreamConfig): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMCodecInfo2;'} + {$EXTERNALSYM IWMCodecInfo2} + IWMCodecInfo2 = interface(IWMCodecInfo) + ['{AA65E273-B686-4056-91EC-DD768D4DF710}'] + (*** IWMCodecInfo2 methods ***) + function GetCodecName(const guidType: TGUID; dwCodecIndex: LongWord; {out} wszName: PWideChar; + var pcchName: LongWord): HResult; stdcall; + function GetCodecFormatDesc(const guidType: TGUID; dwCodecIndex: LongWord; + dwFormatIndex: LongWord; out ppIStreamConfig: IWMStreamConfig; + {out} wszDesc: PWideChar; var pcchDesc: LongWord): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMCodecInfo3;'} + {$EXTERNALSYM IWMCodecInfo3} + IWMCodecInfo3 = interface(IWMCodecInfo2) + ['{7E51F487-4D93-4F98-8AB4-27D0565ADC51}'] + (*** IWMCodecInfo3 methods ***) + function GetCodecFormatProp(const guidType: TGUID; dwCodecIndex: LongWord; + dwFormatIndex: LongWord; pszName: PWideChar; + out pType: TWMTAttrDataType; {out} pValue: PByte; + var pdwSize: LongWord): HResult; stdcall; + function GetCodecProp(const guidType: TGUID; dwCodecIndex: LongWord; pszName: PWideChar; + out pType: TWMTAttrDataType; {out} pValue: PByte; var pdwSize: LongWord): HResult; stdcall; + function SetCodecEnumerationSetting(const guidType: TGUID; dwCodecIndex: LongWord; + pszName: PWideChar; Type_: TWMTAttrDataType; + {in} pValue: PByte; dwSize: LongWord): HResult; stdcall; + function GetCodecEnumerationSetting(const guidType: TGUID; dwCodecIndex: LongWord; + pszName: PWideChar; out pType: TWMTAttrDataType; + {out} pValue: PByte; var pdwSize: LongWord): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMLanguageList;'} + {$EXTERNALSYM IWMLanguageList} + IWMLanguageList = interface(IUnknown) + ['{DF683F00-2D49-4D8E-92B7-FB19F6A0DC57}'] + (*** IWMLanguageList methods ***) + function GetLanguageCount(out pwCount: Word): HResult; stdcall; + function GetLanguageDetails(wIndex: Word; {out} pwszLanguageString: PWideChar; + var pcchLanguageStringLength: Word): HResult; stdcall; + function AddLanguageByRFC1766String(pwszLanguageString: PWideChar; out pwIndex: Word): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWriterPushSink;'} + {$EXTERNALSYM IWMWriterPushSink} + IWMWriterPushSink = interface(IWMWriterSink) + ['{DC10E6A5-072C-467D-BF57-6330A9DDE12A}'] + (*** IWMWriterPushSink methods ***) + // Connect to a publishing point on the server. + // If the publishing point does not exist, and pwszTemplateURL is + // non-NULL, an attempt will be made to create a new publishing point based + // on the template URL. + function Connect(pwszURL: PWideChar; pwszTemplateURL: PWideChar; fAutoDestroy: BOOL): HResult; stdcall; + // Terminate the control connection with the downstream server. The data path on the + // downstream server remains active for 5 minutes after which it is cleaned up. + function Disconnect: HResult; stdcall; + // Gracefully end the push distribution session. This shuts down the data path on + // the server for the publishing point. + function EndSession: HResult; stdcall; + end; + + // The writer can be QI'd for this interface to enumerate all of the + // watermark DMOs installed on a system. + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMWatermarkInfo;'} + {$EXTERNALSYM IWMWatermarkInfo} + IWMWatermarkInfo = interface(IUnknown) + ['{6F497062-F2E2-4624-8EA7-9DD40D81FC8D}'] + (*** IWMWatermarkInfo methods ***) + function GetWatermarkEntryCount(wmetType: TWMTWatermarkEntryType; out pdwCount: LongWord): HResult; stdcall; + function GetWatermarkEntry(wmetType: TWMTWatermarkEntryType; dwEntryNum: LongWord; + out pEntry: TWMTWatermarkEntry): HResult; stdcall; + end; + + // The Reader can be QI'ed for this interface for DirectX-VA support + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderAccelerator;'} + {$EXTERNALSYM IWMReaderAccelerator} + IWMReaderAccelerator = interface(IUnknown) + ['{BDDC4D08-944D-4D52-A612-46C3FDA07DD4}'] + (*** IWMReaderAccelerator methods ***) + function GetCodecInterface(dwOutputNum: LongWord; const riid: TGUID; + out ppvCodecInterface: Pointer): HResult; stdcall; + function Notify(dwOutputNum: LongWord; pSubtype: PWMMediaType): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMReaderTimecode;'} + {$EXTERNALSYM IWMReaderTimecode} + IWMReaderTimecode = interface(IUnknown) + ['{F369E2F0-E081-4FE6-8450-B810B2F410D1}'] + (*** IWMReaderTimecode methods ***) + // Get the number of ranges of timecode data for a given stream in the file. + // Returns 0 if there is no timecode index for the specified stream. + function GetTimecodeRangeCount(wStreamNum: Word; out pwRangeCount: Word): HResult; stdcall; + // Gets the first and last timecode available for a given range. + function GetTimecodeRangeBounds(wStreamNum: Word; wRangeNum: Word; + out pStartTimecode: LongWord; out pEndTimecode: LongWord): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMAddressAccess;'} + {$EXTERNALSYM IWMAddressAccess} + IWMAddressAccess = interface(IUnknown) + ['{BB3C6389-1633-4E92-AF14-9F3173BA39D0}'] + (*** IWMAddressAccess methods ***) + // Determine the number of access list entries (by type) + function GetAccessEntryCount(aeType: WM_AETYPE; out pcEntries: LongWord): HResult; stdcall; + // Retrieve a single address access entry (by type) + function GetAccessEntry(aeType: WM_AETYPE; dwEntryNum: LongWord; + out pAddrAccessEntry: TWMAddressAccessEntry): HResult; stdcall; + // Add a single address access entry + function AddAccessEntry(aeType: WM_AETYPE; pAddrAccessEntry: PWMAddressAccessEntry): HResult; stdcall; + // Remove a single address access entry (by type) + function RemoveAccessEntry(aeType: WM_AETYPE; dwEntryNum: LongWord): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMAddressAccess2;'} + {$EXTERNALSYM IWMAddressAccess2} + IWMAddressAccess2 = interface(IWMAddressAccess) + ['{65A83FC2-3E98-4D4D-81B5-2A742886B33D}'] + (*** IWMAddressAccess2 methods ***) + // Retrieve a single address access entry (by type) + function GetAccessEntryEx(aeType: WM_AETYPE; dwEntryNum: LongWord; + out pbstrAddress: WideString; out pbstrMask: WideString): HResult; stdcall; + // Add a single address access entry + function AddAccessEntryEx(aeType: WM_AETYPE; bstrAddress: WideString; + bstrMask: WideString): HResult; stdcall; + end; + + // Used to get "APIC" ID3v2 frames + {$HPPEMIT 'typedef System::DelphiInterface _di_IWMImageInfo;'} + {$EXTERNALSYM IWMImageInfo} + IWMImageInfo = interface(IUnknown) + ['{9F0AA3B6-7267-4D89-88F2-BA915AA5C4C6}'] + (*** IWMImageInfo methods ***) + function GetImageCount(out pcImages: LongWord): HResult; stdcall; + function GetImage(wIndex: LongWord; var pcchMIMEType: Word; {out} pwszMIMEType: PWideChar; + var pcchDescription: Word; {out} pwszDescription: PWideChar; out pImageType: Word; + var pcbImageData: LongWord; {out} pbImageData: PByte): HResult; stdcall; + end; + +//*@@@+++@@@@****************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +//*@@@---@@@@****************************************************************** +// + +const + IID_IConfigAsfWriter2 : TGUID = '{7989ccaa-53f0-44f0-884a-f3b03f6ae066}'; + {$EXTERNALSYM IID_IConfigAsfWriter2} + IID_IConfigAsfWriter : TGUID = '{45086030-F7E4-486a-B504-826BB5792A3B}'; + {$EXTERNALSYM IID_IConfigAsfWriter} + + IID_IAMWMBufferPass : TGUID = '{6DD816D7-E740-4123-9E24-2444412644D8}'; + {$EXTERNALSYM IID_IAMWMBufferPass} + IID_IAMWMBufferPassCallback : TGUID = '{B25B8372-D2D2-44b2-8653-1B8DAE332489}'; + {$EXTERNALSYM IID_IAMWMBufferPassCallback} + + EC_PREPROCESS_COMPLETE = $56; + {$EXTERNALSYM EC_PREPROCESS_COMPLETE} + +type + IAMWMBufferPassCallback = interface; + + // Interface used to setup callback for app to set/get properties on WindowsMedia buffers that + // are passed by the ASF reader and writer filters + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMWMBufferPass;'} + {$EXTERNALSYM IAMWMBufferPass} + IAMWMBufferPass = interface(IUnknown) + ['{6DD816D7-E740-4123-9E24-2444412644D8}'] + (*** IAMWMBufferPass methods ***) + // set the interface to use for callback notification + function SetNotify(pCallback: IAMWMBufferPassCallback): HRESULT; stdcall; + end; + + // Callback interface used to notify that a WindowMedia buffer is being passed. Typically implemented + // by the app and called by the ASF writer and reader filters. + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMWMBufferPassCallback;'} + {$EXTERNALSYM IAMWMBufferPassCallback} + IAMWMBufferPassCallback = interface(IUnknown) + ['{B25B8372-D2D2-44b2-8653-1B8DAE332489}'] + (*** IAMWMBufferPassCallback methods ***) + // give the callback receiver a chance to examine + // (and act on) the INSSBuffer3 before passing on + function Notify(pNSSBuffer3: INSSBuffer3; pPin: IPin; + prtStart, prtEnd: PReferenceTime): HRESULT; stdcall; + end; + + // ASF Writer filter paramaters for IConfigAsfWriter2 interface + _AM_ASFWRITERCONFIG_PARAM = ( + {$IFNDEF COMPILER6_UP} + AM_CONFIGASFWRITER_PARAM_INVALID_0, + AM_CONFIGASFWRITER_PARAM_AUTOINDEX, // dynamic indexing, lParam1 boolean, lParam2 + {$ELSE} + AM_CONFIGASFWRITER_PARAM_AUTOINDEX = 1, + {$ENDIF} + AM_CONFIGASFWRITER_PARAM_MULTIPASS, // multipass encoding, app should be able + // to handle EC_PREPROCESS_COMPLETE events + AM_CONFIGASFWRITER_PARAM_DONTCOMPRESS // configure writer to take audio and video input data + // as-is, without any recompression, useful for repackaging + // content in the ASF container + ); + {$EXTERNALSYM _AM_ASFWRITERCONFIG_PARAM} + TAMASFWriterConfigParam = _AM_ASFWRITERCONFIG_PARAM; + + // Interface to control the ASF writer (version 2) + {$HPPEMIT 'typedef System::DelphiInterface _di_IConfigAsfWriter2;'} + {$EXTERNALSYM IConfigAsfWriter2} + IConfigAsfWriter2 = interface(IConfigAsfWriter) + ['{7989CCAA-53F0-44f0-884A-F3B03F6AE066}'] + (*** IConfigAsfWriter2 methods ***) + // Helper method to allow caller to pass in a pin pointer and get back the associated + // stream number. This is helpful when using WMF SDK interfaces directly to work with + // stream-specific properties. + function StreamNumFromPin(pPin: IPin; out pwStreamNum: WORD): HRESULT; stdcall; + // Set value corresponding to the passed in parameter id + function SetParam(dwParam: TAMASFWriterConfigParam; dwParam1, dwParam2 {not used, must be 0}: LongWord): HRESULT; stdcall; + // Get value corresponding to the passed in parameter id + function GetParam(dwParam: LongWord; out pdwParam1, pdwParam2 {not used, must be 0}: LongWord): HRESULT; stdcall; + // Multipass encoding + function ResetMultiPassState: HRESULT; stdcall; + end; + + // 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: The following 2 XXXProfileId methods are obsolete and their use is not recommended. + // Once the WMF SDK added the notion of profile versions, their behavior became ambiguous. + // At the time of this release (Corona) the methods will assume use of the default profile + // version number and make no attempt to override that. For instance, in the Corona release + // version 9 profiles are assumed. + // + // Instead, it is recommended that apps use the XXXProfile methods which take the IWMProfile* + // directly or the ProfileGuid methods which take a profile GUID. + function ConfigureFilterUsingProfileId(dwProfileId: LongWord): HRESULT; stdcall; + function GetCurrentProfileId(out pdwProfileId: LongWord): 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: IWMProfile): HRESULT; stdcall; + function GetCurrentProfile(out ppProfile: IWMProfile): HRESULT; stdcall; + + // + // allow app to control whether or not to index file + // + function SetIndexMode(bIndexFile: BOOL): HRESULT; stdcall; + function GetIndexMode(out pbIndexFile: BOOL): HRESULT; stdcall; + end; + +// Microsoft Windows Media Technology +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// Module Name: +// nserror.h +// +// Abstract: +// Definitions for Windows Media events. +// +// Here are the commented error ranges for the Windows Media Technologies Group +// +// LEGACY RANGES +// +// 0 - 199 = General NetShow errors +// 200 - 399 = NetShow error events +// 400 - 599 = NetShow monitor events +// 600 - 799 = NetShow IMmsAutoServer errors +// 1000 - 1199 = NetShow MCMADM errors +// +// +// NEW RANGES +// +// 2000 - 2999 = ASF (defined in ASFERR.MC) +// 3000 - 3999 = Windows Media SDK +// 4000 - 4999 = Windows Media Player +// 5000 - 5999 = Windows Media Server +// 6000 - 6999 = Windows Media HTTP/RTSP result codes (defined in NETERROR.MC) +// 7000 - 7999 = Windows Media Tools +// 8000 - 8999 = Windows Media Content Discovery +// 9000 - 9999 = Windows Media Real Time Collaboration +// 10000 - 10999 = Windows Media Digital Rights Management +// 11000 - 11999 = Windows Media Setup +// 12000 - 12999 = Windows Media Networking +// 13000 - 13999 = Windows Media Client Media Services + + +//#define STATUS_SEVERITY(hr) (((hr) >> 30) & 0x3) + +///////////////////////////////////////////////////////////////////////// +// +// NETSHOW Success Events +// +///////////////////////////////////////////////////////////////////////// + +// +// Values are 32 bit values layed out 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 +// +---+-+-+-----------------------+-------------------------------+ +// |Sev|C|R| Facility | Code | +// +---+-+-+-----------------------+-------------------------------+ +// +// where +// +// Sev - is the severity code +// +// 00 - Success +// 01 - Informational +// 10 - Warning +// 11 - Error +// +// C - is the Customer code flag +// +// R - is a reserved bit +// +// Facility - is the facility code +// +// Code - is the facility's status code +// +// +// Define the facility codes +// +const + FACILITY_NS_WIN32 = $7; + {$EXTERNALSYM FACILITY_NS_WIN32} + FACILITY_NS = $D; + {$EXTERNALSYM FACILITY_NS} + + +// +// Define the severity codes +// + STATUS_SEVERITY_WARNING = $2; + {$EXTERNALSYM STATUS_SEVERITY_WARNING} + STATUS_SEVERITY_SUCCESS = $0; + {$EXTERNALSYM STATUS_SEVERITY_SUCCESS} + STATUS_SEVERITY_INFORMATIONAL = $1; + {$EXTERNALSYM STATUS_SEVERITY_INFORMATIONAL} + STATUS_SEVERITY_ERROR = $3; + {$EXTERNALSYM STATUS_SEVERITY_ERROR} + + +// +// MessageId: NS_S_CALLPENDING +// +// MessageText: +// +// The requested operation is pending completion.%0 +// + NS_S_CALLPENDING = HRESULT($000D0000); + {$EXTERNALSYM NS_S_CALLPENDING} + +// +// MessageId: NS_S_CALLABORTED +// +// MessageText: +// +// The requested operation was aborted by the client.%0 + NS_S_CALLABORTED = HRESULT($000D0001); + {$EXTERNALSYM NS_S_CALLABORTED} + +// +// MessageId: NS_S_STREAM_TRUNCATED +// +// MessageText: +// +// The stream was purposefully stopped before completion.%0 +// + NS_S_STREAM_TRUNCATED = HRESULT($000D0002); + {$EXTERNALSYM NS_S_STREAM_TRUNCATED} + + +///////////////////////////////////////////////////////////////////////// +// +// NETSHOW Warning Events +// +///////////////////////////////////////////////////////////////////////// + +// +// MessageId: NS_W_SERVER_BANDWIDTH_LIMIT +// +// MessageText: +// +// The maximum filebitrate value specified is greater than the server's configured maximum bandwidth.%0 +// + NS_W_SERVER_BANDWIDTH_LIMIT = HRESULT($800D0003); + {$EXTERNALSYM NS_W_SERVER_BANDWIDTH_LIMIT} + +// +// MessageId: NS_W_FILE_BANDWIDTH_LIMIT +// +// MessageText: +// +// The maximum bandwidth value specified is less than the maximum filebitrate.%0 +// + NS_W_FILE_BANDWIDTH_LIMIT = HRESULT($800D0004); + {$EXTERNALSYM NS_W_FILE_BANDWIDTH_LIMIT} + + +///////////////////////////////////////////////////////////////////////// +// +// NETSHOW Error Events +// +///////////////////////////////////////////////////////////////////////// + +// +// MessageId: NS_E_NOCONNECTION +// +// MessageText: +// +// There is no connection established with the Windows Media server. The operation failed.%0 +// + NS_E_NOCONNECTION = HRESULT($C00D0005); + {$EXTERNALSYM NS_E_NOCONNECTION} + +// +// MessageId: NS_E_CANNOTCONNECT +// +// MessageText: +// +// Unable to establish a connection to the server.%0 +// + NS_E_CANNOTCONNECT = HRESULT($C00D0006); + {$EXTERNALSYM NS_E_CANNOTCONNECT} + +// +// MessageId: NS_E_CANNOTDESTROYTITLE +// +// MessageText: +// +// Unable to destroy the title.%0 +// + NS_E_CANNOTDESTROYTITLE = HRESULT($C00D0007); + {$EXTERNALSYM NS_E_CANNOTDESTROYTITLE} + +// +// MessageId: NS_E_CANNOTRENAMETITLE +// +// MessageText: +// +// Unable to rename the title.%0 +// + NS_E_CANNOTRENAMETITLE = HRESULT($C00D0008); + {$EXTERNALSYM NS_E_CANNOTRENAMETITLE} + +// +// MessageId: NS_E_CANNOTOFFLINEDISK +// +// MessageText: +// +// Unable to offline disk.%0 +// + NS_E_CANNOTOFFLINEDISK = HRESULT($C00D0009); + {$EXTERNALSYM NS_E_CANNOTOFFLINEDISK} + +// +// MessageId: NS_E_CANNOTONLINEDISK +// +// MessageText: +// +// Unable to online disk.%0 +// + NS_E_CANNOTONLINEDISK = HRESULT($C00D000A); + {$EXTERNALSYM NS_E_CANNOTONLINEDISK} + +// +// MessageId: NS_E_NOREGISTEREDWALKER +// +// MessageText: +// +// There is no file parser registered for this type of file.%0 +// + NS_E_NOREGISTEREDWALKER = HRESULT($C00D000B); + {$EXTERNALSYM NS_E_NOREGISTEREDWALKER} + +// +// MessageId: NS_E_NOFUNNEL +// +// MessageText: +// +// There is no data connection established.%0 +// + NS_E_NOFUNNEL = HRESULT($C00D000C); + {$EXTERNALSYM NS_E_NOFUNNEL} + +// +// MessageId: NS_E_NO_LOCALPLAY +// +// MessageText: +// +// Failed to load the local play DLL.%0 +// + NS_E_NO_LOCALPLAY = HRESULT($C00D000D); + {$EXTERNALSYM NS_E_NO_LOCALPLAY} + +// +// MessageId: NS_E_NETWORK_BUSY +// +// MessageText: +// +// The network is busy.%0 +// + NS_E_NETWORK_BUSY = HRESULT($C00D000E); + {$EXTERNALSYM NS_E_NETWORK_BUSY} + +// +// MessageId: NS_E_TOO_MANY_SESS +// +// MessageText: +// +// The server session limit was exceeded.%0 +// + NS_E_TOO_MANY_SESS = HRESULT($C00D000F); + {$EXTERNALSYM NS_E_TOO_MANY_SESS} + +// +// MessageId: NS_E_ALREADY_CONNECTED +// +// MessageText: +// +// The network connection already exists.%0 +// + NS_E_ALREADY_CONNECTED = HRESULT($C00D0010); + {$EXTERNALSYM NS_E_ALREADY_CONNECTED} + +// +// MessageId: NS_E_INVALID_INDEX +// +// MessageText: +// +// Index %1 is invalid.%0 +// + NS_E_INVALID_INDEX = HRESULT($C00D0011); + {$EXTERNALSYM NS_E_INVALID_INDEX} + +// +// MessageId: NS_E_PROTOCOL_MISMATCH +// +// MessageText: +// +// There is no protocol or protocol version supported by both the client and the server.%0 +// + NS_E_PROTOCOL_MISMATCH = HRESULT($C00D0012); + {$EXTERNALSYM NS_E_PROTOCOL_MISMATCH} + +// +// MessageId: NS_E_TIMEOUT +// +// MessageText: +// +// The server, a computer set up to offer multimedia content to other computers, could not handle your request for multimedia content in a timely manner. Please try again later.%0 +// + NS_E_TIMEOUT = HRESULT($C00D0013); + {$EXTERNALSYM NS_E_TIMEOUT} + +// +// MessageId: NS_E_NET_WRITE +// +// MessageText: +// +// Error writing to the network.%0 +// + NS_E_NET_WRITE = HRESULT($C00D0014); + {$EXTERNALSYM NS_E_NET_WRITE} + +// +// MessageId: NS_E_NET_READ +// +// MessageText: +// +// Error reading from the network.%0 +// + NS_E_NET_READ = HRESULT($C00D0015); + {$EXTERNALSYM NS_E_NET_READ} + +// +// MessageId: NS_E_DISK_WRITE +// +// MessageText: +// +// Error writing to a disk.%0 +// + NS_E_DISK_WRITE = HRESULT($C00D0016); + {$EXTERNALSYM NS_E_DISK_WRITE} + +// +// MessageId: NS_E_DISK_READ +// +// MessageText: +// +// Error reading from a disk.%0 +// + NS_E_DISK_READ = HRESULT($C00D0017); + {$EXTERNALSYM NS_E_DISK_READ} + +// +// MessageId: NS_E_FILE_WRITE +// +// MessageText: +// +// Error writing to a file.%0 +// + NS_E_FILE_WRITE = HRESULT($C00D0018); + {$EXTERNALSYM NS_E_FILE_WRITE} + +// +// MessageId: NS_E_FILE_READ +// +// MessageText: +// +// Error reading from a file.%0 +// + NS_E_FILE_READ = HRESULT($C00D0019); + {$EXTERNALSYM NS_E_FILE_READ} + +// +// MessageId: NS_E_FILE_NOT_FOUND +// +// MessageText: +// +// The system cannot find the file specified.%0 +// + NS_E_FILE_NOT_FOUND = HRESULT($C00D001A); + {$EXTERNALSYM NS_E_FILE_NOT_FOUND} + +// +// MessageId: NS_E_FILE_EXISTS +// +// MessageText: +// +// The file already exists.%0 +// + NS_E_FILE_EXISTS = HRESULT($C00D001B); + {$EXTERNALSYM NS_E_FILE_EXISTS} + +// +// MessageId: NS_E_INVALID_NAME +// +// MessageText: +// +// The file name, directory name, or volume label syntax is incorrect.%0 +// + NS_E_INVALID_NAME = HRESULT($C00D001C); + {$EXTERNALSYM NS_E_INVALID_NAME} + +// +// MessageId: NS_E_FILE_OPEN_FAILED +// +// MessageText: +// +// Failed to open a file.%0 +// + NS_E_FILE_OPEN_FAILED = HRESULT($C00D001D); + {$EXTERNALSYM NS_E_FILE_OPEN_FAILED} + +// +// MessageId: NS_E_FILE_ALLOCATION_FAILED +// +// MessageText: +// +// Unable to allocate a file.%0 +// + NS_E_FILE_ALLOCATION_FAILED = HRESULT($C00D001E); + {$EXTERNALSYM NS_E_FILE_ALLOCATION_FAILED} + +// +// MessageId: NS_E_FILE_INIT_FAILED +// +// MessageText: +// +// Unable to initialize a file.%0 +// + NS_E_FILE_INIT_FAILED = HRESULT($C00D001F); + {$EXTERNALSYM NS_E_FILE_INIT_FAILED} + +// +// MessageId: NS_E_FILE_PLAY_FAILED +// +// MessageText: +// +// Unable to play a file.%0 +// + NS_E_FILE_PLAY_FAILED = HRESULT($C00D0020); + {$EXTERNALSYM NS_E_FILE_PLAY_FAILED} + +// +// MessageId: NS_E_SET_DISK_UID_FAILED +// +// MessageText: +// +// Could not set the disk UID.%0 +// + NS_E_SET_DISK_UID_FAILED = HRESULT($C00D0021); + {$EXTERNALSYM NS_E_SET_DISK_UID_FAILED} + +// +// MessageId: NS_E_INDUCED +// +// MessageText: +// +// An error was induced for testing purposes.%0 +// + NS_E_INDUCED = HRESULT($C00D0022); + {$EXTERNALSYM NS_E_INDUCED} + +// +// MessageId: NS_E_CCLINK_DOWN +// +// MessageText: +// +// Two Content Servers failed to communicate.%0 +// + NS_E_CCLINK_DOWN = HRESULT($C00D0023); + {$EXTERNALSYM NS_E_CCLINK_DOWN} + +// +// MessageId: NS_E_INTERNAL +// +// MessageText: +// +// An unknown error occurred.%0 +// + NS_E_INTERNAL = HRESULT($C00D0024); + {$EXTERNALSYM NS_E_INTERNAL} + +// +// MessageId: NS_E_BUSY +// +// MessageText: +// +// The requested resource is in use.%0 +// + NS_E_BUSY = HRESULT($C00D0025); + {$EXTERNALSYM NS_E_BUSY} + +// +// MessageId: NS_E_UNRECOGNIZED_STREAM_TYPE +// +// MessageText: +// +// The specified protocol is not recognized. Be sure that the file name and syntax, such as slashes, are correct for the protocol.%0 +// + NS_E_UNRECOGNIZED_STREAM_TYPE = HRESULT($C00D0026); + {$EXTERNALSYM NS_E_UNRECOGNIZED_STREAM_TYPE} + +// +// MessageId: NS_E_NETWORK_SERVICE_FAILURE +// +// MessageText: +// +// The network service provider failed.%0 +// + NS_E_NETWORK_SERVICE_FAILURE = HRESULT($C00D0027); + {$EXTERNALSYM NS_E_NETWORK_SERVICE_FAILURE} + +// +// MessageId: NS_E_NETWORK_RESOURCE_FAILURE +// +// MessageText: +// +// An attempt to acquire a network resource failed.%0 +// + NS_E_NETWORK_RESOURCE_FAILURE = HRESULT($C00D0028); + {$EXTERNALSYM NS_E_NETWORK_RESOURCE_FAILURE} + +// +// MessageId: NS_E_CONNECTION_FAILURE +// +// MessageText: +// +// The network connection has failed.%0 +// + NS_E_CONNECTION_FAILURE = HRESULT($C00D0029); + {$EXTERNALSYM NS_E_CONNECTION_FAILURE} + +// +// MessageId: NS_E_SHUTDOWN +// +// MessageText: +// +// The session is being terminated locally.%0 +// + NS_E_SHUTDOWN = HRESULT($C00D002A); + {$EXTERNALSYM NS_E_SHUTDOWN} + +// +// MessageId: NS_E_INVALID_REQUEST +// +// MessageText: +// +// The request is invalid in the current state.%0 +// + NS_E_INVALID_REQUEST = HRESULT($C00D002B); + {$EXTERNALSYM NS_E_INVALID_REQUEST} + +// +// MessageId: NS_E_INSUFFICIENT_BANDWIDTH +// +// MessageText: +// +// There is insufficient bandwidth available to fulfill the request.%0 +// + NS_E_INSUFFICIENT_BANDWIDTH = HRESULT($C00D002C); + {$EXTERNALSYM NS_E_INSUFFICIENT_BANDWIDTH} + +// +// MessageId: NS_E_NOT_REBUILDING +// +// MessageText: +// +// The disk is not rebuilding.%0 +// + NS_E_NOT_REBUILDING = HRESULT($C00D002D); + {$EXTERNALSYM NS_E_NOT_REBUILDING} + +// +// MessageId: NS_E_LATE_OPERATION +// +// MessageText: +// +// An operation requested for a particular time could not be carried out on schedule.%0 +// + NS_E_LATE_OPERATION = HRESULT($C00D002E); + {$EXTERNALSYM NS_E_LATE_OPERATION} + +// +// MessageId: NS_E_INVALID_DATA +// +// MessageText: +// +// Invalid or corrupt data was encountered.%0 +// + NS_E_INVALID_DATA = HRESULT($C00D002F); + {$EXTERNALSYM NS_E_INVALID_DATA} + +// +// MessageId: NS_E_FILE_BANDWIDTH_LIMIT +// +// MessageText: +// +// The bandwidth required to stream a file is higher than the maximum file bandwidth allowed on the server.%0 +// + NS_E_FILE_BANDWIDTH_LIMIT = HRESULT($C00D0030); + {$EXTERNALSYM NS_E_FILE_BANDWIDTH_LIMIT} + +// +// MessageId: NS_E_OPEN_FILE_LIMIT +// +// MessageText: +// +// The client cannot have any more files open simultaneously.%0 +// + NS_E_OPEN_FILE_LIMIT = HRESULT($C00D0031); + {$EXTERNALSYM NS_E_OPEN_FILE_LIMIT} + +// +// MessageId: NS_E_BAD_CONTROL_DATA +// +// MessageText: +// +// The server received invalid data from the client on the control connection.%0 +// + NS_E_BAD_CONTROL_DATA = HRESULT($C00D0032); + {$EXTERNALSYM NS_E_BAD_CONTROL_DATA} + +// +// MessageId: NS_E_NO_STREAM +// +// MessageText: +// +// There is no stream available.%0 +// + NS_E_NO_STREAM = HRESULT($C00D0033); + {$EXTERNALSYM NS_E_NO_STREAM} + +// +// MessageId: NS_E_STREAM_END +// +// MessageText: +// +// There is no more data in the stream.%0 +// + NS_E_STREAM_END = HRESULT($C00D0034); + {$EXTERNALSYM NS_E_STREAM_END} + +// +// MessageId: NS_E_SERVER_NOT_FOUND +// +// MessageText: +// +// The specified server could not be found.%0 +// + NS_E_SERVER_NOT_FOUND = HRESULT($C00D0035); + {$EXTERNALSYM NS_E_SERVER_NOT_FOUND} + +// +// MessageId: NS_E_DUPLICATE_NAME +// +// MessageText: +// +// The specified name is already in use. +// + NS_E_DUPLICATE_NAME = HRESULT($C00D0036); + {$EXTERNALSYM NS_E_DUPLICATE_NAME} + +// +// MessageId: NS_E_DUPLICATE_ADDRESS +// +// MessageText: +// +// The specified address is already in use. +// + NS_E_DUPLICATE_ADDRESS = HRESULT($C00D0037); + {$EXTERNALSYM NS_E_DUPLICATE_ADDRESS} + +// +// MessageId: NS_E_BAD_MULTICAST_ADDRESS +// +// MessageText: +// +// The specified address is not a valid multicast address. +// + NS_E_BAD_MULTICAST_ADDRESS = HRESULT($C00D0038); + {$EXTERNALSYM NS_E_BAD_MULTICAST_ADDRESS} + +// +// MessageId: NS_E_BAD_ADAPTER_ADDRESS +// +// MessageText: +// +// The specified adapter address is invalid. +// + NS_E_BAD_ADAPTER_ADDRESS = HRESULT($C00D0039); + {$EXTERNALSYM NS_E_BAD_ADAPTER_ADDRESS} + +// +// MessageId: NS_E_BAD_DELIVERY_MODE +// +// MessageText: +// +// The specified delivery mode is invalid. +// + NS_E_BAD_DELIVERY_MODE = HRESULT($C00D003A); + {$EXTERNALSYM NS_E_BAD_DELIVERY_MODE} + +// +// MessageId: NS_E_INVALID_CHANNEL +// +// MessageText: +// +// The specified station does not exist. +// + NS_E_INVALID_CHANNEL = HRESULT($C00D003B); + {$EXTERNALSYM NS_E_INVALID_CHANNEL} + +// +// MessageId: NS_E_INVALID_STREAM +// +// MessageText: +// +// The specified stream does not exist. +// + NS_E_INVALID_STREAM = HRESULT($C00D003C); + {$EXTERNALSYM NS_E_INVALID_STREAM} + +// +// MessageId: NS_E_INVALID_ARCHIVE +// +// MessageText: +// +// The specified archive could not be opened. +// + NS_E_INVALID_ARCHIVE = HRESULT($C00D003D); + {$EXTERNALSYM NS_E_INVALID_ARCHIVE} + +// +// MessageId: NS_E_NOTITLES +// +// MessageText: +// +// The system cannot find any titles on the server.%0 +// + NS_E_NOTITLES = HRESULT($C00D003E); + {$EXTERNALSYM NS_E_NOTITLES} + +// +// MessageId: NS_E_INVALID_CLIENT +// +// MessageText: +// +// The system cannot find the client specified.%0 +// + NS_E_INVALID_CLIENT = HRESULT($C00D003F); + {$EXTERNALSYM NS_E_INVALID_CLIENT} + +// +// MessageId: NS_E_INVALID_BLACKHOLE_ADDRESS +// +// MessageText: +// +// The Blackhole Address is not initialized.%0 +// + NS_E_INVALID_BLACKHOLE_ADDRESS = HRESULT($C00D0040); + {$EXTERNALSYM NS_E_INVALID_BLACKHOLE_ADDRESS} + +// +// MessageId: NS_E_INCOMPATIBLE_FORMAT +// +// MessageText: +// +// The station does not support the stream format. +// + NS_E_INCOMPATIBLE_FORMAT = HRESULT($C00D0041); + {$EXTERNALSYM NS_E_INCOMPATIBLE_FORMAT} + +// +// MessageId: NS_E_INVALID_KEY +// +// MessageText: +// +// The specified key is not valid. +// + NS_E_INVALID_KEY = HRESULT($C00D0042); + {$EXTERNALSYM NS_E_INVALID_KEY} + +// +// MessageId: NS_E_INVALID_PORT +// +// MessageText: +// +// The specified port is not valid. +// + NS_E_INVALID_PORT = HRESULT($C00D0043); + {$EXTERNALSYM NS_E_INVALID_PORT} + +// +// MessageId: NS_E_INVALID_TTL +// +// MessageText: +// +// The specified TTL is not valid. +// + NS_E_INVALID_TTL = HRESULT($C00D0044); + {$EXTERNALSYM NS_E_INVALID_TTL} + +// +// MessageId: NS_E_STRIDE_REFUSED +// +// MessageText: +// +// The request to fast forward or rewind could not be fulfilled. +// + NS_E_STRIDE_REFUSED = HRESULT($C00D0045); + {$EXTERNALSYM NS_E_STRIDE_REFUSED} + +// +// IMmsAutoServer Errors +// +// +// MessageId: NS_E_MMSAUTOSERVER_CANTFINDWALKER +// +// MessageText: +// +// Unable to load the appropriate file parser.%0 +// + NS_E_MMSAUTOSERVER_CANTFINDWALKER = HRESULT($C00D0046); + {$EXTERNALSYM NS_E_MMSAUTOSERVER_CANTFINDWALKER} + +// +// MessageId: NS_E_MAX_BITRATE +// +// MessageText: +// +// Cannot exceed the maximum bandwidth limit.%0 +// + NS_E_MAX_BITRATE = HRESULT($C00D0047); + {$EXTERNALSYM NS_E_MAX_BITRATE} + +// +// MessageId: NS_E_LOGFILEPERIOD +// +// MessageText: +// +// Invalid value for LogFilePeriod.%0 +// + NS_E_LOGFILEPERIOD = HRESULT($C00D0048); + {$EXTERNALSYM NS_E_LOGFILEPERIOD} + +// +// MessageId: NS_E_MAX_CLIENTS +// +// MessageText: +// +// Cannot exceed the maximum client limit.%0 +// +// + NS_E_MAX_CLIENTS = HRESULT($C00D0049); + {$EXTERNALSYM NS_E_MAX_CLIENTS} + +// +// MessageId: NS_E_LOG_FILE_SIZE +// +// MessageText: +// +// The maximum log file size has been reached.%0 +// +// + NS_E_LOG_FILE_SIZE = HRESULT($C00D004A); + {$EXTERNALSYM NS_E_LOG_FILE_SIZE} + +// +// MessageId: NS_E_MAX_FILERATE +// +// MessageText: +// +// Cannot exceed the maximum file rate.%0 +// + NS_E_MAX_FILERATE = HRESULT($C00D004B); + {$EXTERNALSYM NS_E_MAX_FILERATE} + +// +// File Walker Errors +// +// +// MessageId: NS_E_WALKER_UNKNOWN +// +// MessageText: +// +// Unknown file type.%0 +// + NS_E_WALKER_UNKNOWN = HRESULT($C00D004C); + {$EXTERNALSYM NS_E_WALKER_UNKNOWN} + +// +// MessageId: NS_E_WALKER_SERVER +// +// MessageText: +// +// The specified file, %1, cannot be loaded onto the specified server, %2.%0 +// + NS_E_WALKER_SERVER = HRESULT($C00D004D); + {$EXTERNALSYM NS_E_WALKER_SERVER} + +// +// MessageId: NS_E_WALKER_USAGE +// +// MessageText: +// +// There was a usage error with file parser.%0 +// + NS_E_WALKER_USAGE = HRESULT($C00D004E); + {$EXTERNALSYM NS_E_WALKER_USAGE} + + +///////////////////////////////////////////////////////////////////////// +// +// NETSHOW Monitor Events +// +///////////////////////////////////////////////////////////////////////// + + + // Tiger Events + + // %1 is the tiger name + +// +// MessageId: NS_I_TIGER_START +// +// MessageText: +// +// The Title Server %1 is running.%0 +// + NS_I_TIGER_START = HRESULT($400D004F); + {$EXTERNALSYM NS_I_TIGER_START} + +// +// MessageId: NS_E_TIGER_FAIL +// +// MessageText: +// +// The Title Server %1 has failed.%0 +// + NS_E_TIGER_FAIL = HRESULT($C00D0050); + {$EXTERNALSYM NS_E_TIGER_FAIL} + + + // Cub Events + + // %1 is the cub ID + // %2 is the cub name + +// +// MessageId: NS_I_CUB_START +// +// MessageText: +// +// Content Server %1 (%2) is starting.%0 +// + NS_I_CUB_START = HRESULT($400D0051); + {$EXTERNALSYM NS_I_CUB_START} + +// +// MessageId: NS_I_CUB_RUNNING +// +// MessageText: +// +// Content Server %1 (%2) is running.%0 +// + NS_I_CUB_RUNNING = HRESULT($400D0052); + {$EXTERNALSYM NS_I_CUB_RUNNING} + +// +// MessageId: NS_E_CUB_FAIL +// +// MessageText: +// +// Content Server %1 (%2) has failed.%0 +// + NS_E_CUB_FAIL = HRESULT($C00D0053); + {$EXTERNALSYM NS_E_CUB_FAIL} + + + // Disk Events + + // %1 is the tiger disk ID + // %2 is the device name + // %3 is the cub ID +// +// MessageId: NS_I_DISK_START +// +// MessageText: +// +// Disk %1 ( %2 ) on Content Server %3, is running.%0 +// + NS_I_DISK_START = HRESULT($400D0054); + {$EXTERNALSYM NS_I_DISK_START} + +// +// MessageId: NS_E_DISK_FAIL +// +// MessageText: +// +// Disk %1 ( %2 ) on Content Server %3, has failed.%0 +// + NS_E_DISK_FAIL = HRESULT($C00D0055); + {$EXTERNALSYM NS_E_DISK_FAIL} + +// +// MessageId: NS_I_DISK_REBUILD_STARTED +// +// MessageText: +// +// Started rebuilding disk %1 ( %2 ) on Content Server %3.%0 +// + NS_I_DISK_REBUILD_STARTED = HRESULT($400D0056); + {$EXTERNALSYM NS_I_DISK_REBUILD_STARTED} + +// +// MessageId: NS_I_DISK_REBUILD_FINISHED +// +// MessageText: +// +// Finished rebuilding disk %1 ( %2 ) on Content Server %3.%0 +// + NS_I_DISK_REBUILD_FINISHED = HRESULT($400D0057); + {$EXTERNALSYM NS_I_DISK_REBUILD_FINISHED} + +// +// MessageId: NS_I_DISK_REBUILD_ABORTED +// +// MessageText: +// +// Aborted rebuilding disk %1 ( %2 ) on Content Server %3.%0 +// + NS_I_DISK_REBUILD_ABORTED = HRESULT($400D0058); + {$EXTERNALSYM NS_I_DISK_REBUILD_ABORTED} + + + // Admin Events + +// +// MessageId: NS_I_LIMIT_FUNNELS +// +// MessageText: +// +// A NetShow administrator at network location %1 set the data stream limit to %2 streams.%0 +// + NS_I_LIMIT_FUNNELS = HRESULT($400D0059); + {$EXTERNALSYM NS_I_LIMIT_FUNNELS} + +// +// MessageId: NS_I_START_DISK +// +// MessageText: +// +// A NetShow administrator at network location %1 started disk %2.%0 +// + NS_I_START_DISK = HRESULT($400D005A); + {$EXTERNALSYM NS_I_START_DISK} + +// +// MessageId: NS_I_STOP_DISK +// +// MessageText: +// +// A NetShow administrator at network location %1 stopped disk %2.%0 +// + NS_I_STOP_DISK = HRESULT($400D005B); + {$EXTERNALSYM NS_I_STOP_DISK} + +// +// MessageId: NS_I_STOP_CUB +// +// MessageText: +// +// A NetShow administrator at network location %1 stopped Content Server %2.%0 +// + NS_I_STOP_CUB = HRESULT($400D005C); + {$EXTERNALSYM NS_I_STOP_CUB} + +// +// MessageId: NS_I_KILL_USERSESSION +// +// MessageText: +// +// A NetShow administrator at network location %1 aborted user session %2 from the system.%0 +// + NS_I_KILL_USERSESSION = HRESULT($400D005D); + {$EXTERNALSYM NS_I_KILL_USERSESSION} + +// +// MessageId: NS_I_KILL_CONNECTION +// +// MessageText: +// +// A NetShow administrator at network location %1 aborted obsolete connection %2 from the system.%0 +// + NS_I_KILL_CONNECTION = HRESULT($400D005E); + {$EXTERNALSYM NS_I_KILL_CONNECTION} + +// +// MessageId: NS_I_REBUILD_DISK +// +// MessageText: +// +// A NetShow administrator at network location %1 started rebuilding disk %2.%0 +// + NS_I_REBUILD_DISK = HRESULT($400D005F); + {$EXTERNALSYM NS_I_REBUILD_DISK} + +// +// MessageId: NS_W_UNKNOWN_EVENT +// +// MessageText: +// +// Unknown %1 event encountered.%0 +// + NS_W_UNKNOWN_EVENT = HRESULT($800D0060); + {$EXTERNALSYM NS_W_UNKNOWN_EVENT} + + + // Alerts + +// +// MessageId: NS_E_MAX_FUNNELS_ALERT +// +// MessageText: +// +// The NetShow data stream limit of %1 streams was reached.%0 +// + NS_E_MAX_FUNNELS_ALERT = HRESULT($C00D0060); + {$EXTERNALSYM NS_E_MAX_FUNNELS_ALERT} + +// +// MessageId: NS_E_ALLOCATE_FILE_FAIL +// +// MessageText: +// +// The NetShow Video Server was unable to allocate a %1 block file named %2.%0 +// + NS_E_ALLOCATE_FILE_FAIL = HRESULT($C00D0061); + {$EXTERNALSYM NS_E_ALLOCATE_FILE_FAIL} + +// +// MessageId: NS_E_PAGING_ERROR +// +// MessageText: +// +// A Content Server was unable to page a block.%0 +// + NS_E_PAGING_ERROR = HRESULT($C00D0062); + {$EXTERNALSYM NS_E_PAGING_ERROR} + +// +// MessageId: NS_E_BAD_BLOCK0_VERSION +// +// MessageText: +// +// Disk %1 has unrecognized control block version %2.%0 +// + NS_E_BAD_BLOCK0_VERSION = HRESULT($C00D0063); + {$EXTERNALSYM NS_E_BAD_BLOCK0_VERSION} + +// +// MessageId: NS_E_BAD_DISK_UID +// +// MessageText: +// +// Disk %1 has incorrect uid %2.%0 +// + NS_E_BAD_DISK_UID = HRESULT($C00D0064); + {$EXTERNALSYM NS_E_BAD_DISK_UID} + +// +// MessageId: NS_E_BAD_FSMAJOR_VERSION +// +// MessageText: +// +// Disk %1 has unsupported file system major version %2.%0 +// + NS_E_BAD_FSMAJOR_VERSION = HRESULT($C00D0065); + {$EXTERNALSYM NS_E_BAD_FSMAJOR_VERSION} + +// +// MessageId: NS_E_BAD_STAMPNUMBER +// +// MessageText: +// +// Disk %1 has bad stamp number in control block.%0 +// + NS_E_BAD_STAMPNUMBER = HRESULT($C00D0066); + {$EXTERNALSYM NS_E_BAD_STAMPNUMBER} + +// +// MessageId: NS_E_PARTIALLY_REBUILT_DISK +// +// MessageText: +// +// Disk %1 is partially reconstructed.%0 +// + NS_E_PARTIALLY_REBUILT_DISK = HRESULT($C00D0067); + {$EXTERNALSYM NS_E_PARTIALLY_REBUILT_DISK} + +// +// MessageId: NS_E_ENACTPLAN_GIVEUP +// +// MessageText: +// +// EnactPlan gives up.%0 +// + NS_E_ENACTPLAN_GIVEUP = HRESULT($C00D0068); + {$EXTERNALSYM NS_E_ENACTPLAN_GIVEUP} + + + // MCMADM warnings/errors + +// +// MessageId: MCMADM_I_NO_EVENTS +// +// MessageText: +// +// Event initialization failed, there will be no MCM events.%0 +// + MCMADM_I_NO_EVENTS = HRESULT($400D0069); + {$EXTERNALSYM MCMADM_I_NO_EVENTS} + +// +// MessageId: MCMADM_E_REGKEY_NOT_FOUND +// +// MessageText: +// +// The key was not found in the registry.%0 +// + MCMADM_E_REGKEY_NOT_FOUND = HRESULT($C00D006A); + {$EXTERNALSYM MCMADM_E_REGKEY_NOT_FOUND} + +// +// MessageId: NS_E_NO_FORMATS +// +// MessageText: +// +// The publishing point cannot be started because the server does not have the appropriate stream formats. Use the Multicast Announcement Wizard to create a new announcement for this publishing point.%0 +// + NS_E_NO_FORMATS = HRESULT($C00D006B); + {$EXTERNALSYM NS_E_NO_FORMATS} + +// +// MessageId: NS_E_NO_REFERENCES +// +// MessageText: +// +// No reference URLs were found in an ASX file.%0 +// + NS_E_NO_REFERENCES = HRESULT($C00D006C); + {$EXTERNALSYM NS_E_NO_REFERENCES} + +// +// MessageId: NS_E_WAVE_OPEN +// +// MessageText: +// +// Error opening wave device, the device might be in use.%0 +// + NS_E_WAVE_OPEN = HRESULT($C00D006D); + {$EXTERNALSYM NS_E_WAVE_OPEN} + +// +// MessageId: NS_I_LOGGING_FAILED +// +// MessageText: +// +// The logging operation failed. +// + NS_I_LOGGING_FAILED = HRESULT($400D006E); + {$EXTERNALSYM NS_I_LOGGING_FAILED} + +// +// MessageId: NS_E_CANNOTCONNECTEVENTS +// +// MessageText: +// +// Unable to establish a connection to the NetShow event monitor service.%0 +// + NS_E_CANNOTCONNECTEVENTS = HRESULT($C00D006F); + {$EXTERNALSYM NS_E_CANNOTCONNECTEVENTS} + +// +// MessageId: NS_I_LIMIT_BANDWIDTH +// +// MessageText: +// +// A NetShow administrator at network location %1 set the maximum bandwidth limit to %2 bps.%0 +// + NS_I_LIMIT_BANDWIDTH = HRESULT($400D0070); + {$EXTERNALSYM NS_I_LIMIT_BANDWIDTH} + +// +// MessageId: NS_E_NO_DEVICE +// +// MessageText: +// +// No device driver is present on the system.%0 +// + NS_E_NO_DEVICE = HRESULT($C00D0071); + {$EXTERNALSYM NS_E_NO_DEVICE} + +// +// MessageId: NS_E_NO_SPECIFIED_DEVICE +// +// MessageText: +// +// No specified device driver is present.%0 +// + NS_E_NO_SPECIFIED_DEVICE = HRESULT($C00D0072); + {$EXTERNALSYM NS_E_NO_SPECIFIED_DEVICE} + + +// NOTENOTE!!! +// +// Due to legacy problems these error codes live inside the ASF error code range +// +// +// MessageId: NS_E_NOTHING_TO_DO +// +// MessageText: +// +// NS_E_NOTHING_TO_DO +// + NS_E_NOTHING_TO_DO = HRESULT($C00D07F1); + {$EXTERNALSYM NS_E_NOTHING_TO_DO} + +// +// MessageId: NS_E_NO_MULTICAST +// +// MessageText: +// +// Not receiving data from the server.%0 +// + NS_E_NO_MULTICAST = HRESULT($C00D07F2); + {$EXTERNALSYM NS_E_NO_MULTICAST} + + +///////////////////////////////////////////////////////////////////////// +// +// NETSHOW Error Events +// +// IdRange = 200..399 +// +///////////////////////////////////////////////////////////////////////// + +// +// MessageId: NS_E_MONITOR_GIVEUP +// +// MessageText: +// +// Netshow Events Monitor is not operational and has been disconnected.%0 +// + NS_E_MONITOR_GIVEUP = HRESULT($C00D00C8); + {$EXTERNALSYM NS_E_MONITOR_GIVEUP} + +// +// MessageId: NS_E_REMIRRORED_DISK +// +// MessageText: +// +// Disk %1 is remirrored.%0 +// + NS_E_REMIRRORED_DISK = HRESULT($C00D00C9); + {$EXTERNALSYM NS_E_REMIRRORED_DISK} + +// +// MessageId: NS_E_INSUFFICIENT_DATA +// +// MessageText: +// +// Insufficient data found.%0 +// + NS_E_INSUFFICIENT_DATA = HRESULT($C00D00CA); + {$EXTERNALSYM NS_E_INSUFFICIENT_DATA} + +// +// MessageId: NS_E_ASSERT +// +// MessageText: +// +// %1 failed in file %2 line %3.%0 +// + NS_E_ASSERT = HRESULT($C00D00CB); + {$EXTERNALSYM NS_E_ASSERT} + +// +// MessageId: NS_E_BAD_ADAPTER_NAME +// +// MessageText: +// +// The specified adapter name is invalid.%0 +// + NS_E_BAD_ADAPTER_NAME = HRESULT($C00D00CC); + {$EXTERNALSYM NS_E_BAD_ADAPTER_NAME} + +// +// MessageId: NS_E_NOT_LICENSED +// +// MessageText: +// +// The application is not licensed for this feature.%0 +// + NS_E_NOT_LICENSED = HRESULT($C00D00CD); + {$EXTERNALSYM NS_E_NOT_LICENSED} + +// +// MessageId: NS_E_NO_SERVER_CONTACT +// +// MessageText: +// +// Unable to contact the server.%0 +// + NS_E_NO_SERVER_CONTACT = HRESULT($C00D00CE); + {$EXTERNALSYM NS_E_NO_SERVER_CONTACT} + +// +// MessageId: NS_E_TOO_MANY_TITLES +// +// MessageText: +// +// Maximum number of titles exceeded.%0 +// + NS_E_TOO_MANY_TITLES = HRESULT($C00D00CF); + {$EXTERNALSYM NS_E_TOO_MANY_TITLES} + +// +// MessageId: NS_E_TITLE_SIZE_EXCEEDED +// +// MessageText: +// +// Maximum size of a title exceeded.%0 +// + NS_E_TITLE_SIZE_EXCEEDED = HRESULT($C00D00D0); + {$EXTERNALSYM NS_E_TITLE_SIZE_EXCEEDED} + +// +// MessageId: NS_E_UDP_DISABLED +// +// MessageText: +// +// UDP protocol not enabled. Not trying %1!ls!.%0 +// + NS_E_UDP_DISABLED = HRESULT($C00D00D1); + {$EXTERNALSYM NS_E_UDP_DISABLED} + +// +// MessageId: NS_E_TCP_DISABLED +// +// MessageText: +// +// TCP protocol not enabled. Not trying %1!ls!.%0 +// + NS_E_TCP_DISABLED = HRESULT($C00D00D2); + {$EXTERNALSYM NS_E_TCP_DISABLED} + +// +// MessageId: NS_E_HTTP_DISABLED +// +// MessageText: +// +// HTTP protocol not enabled. Not trying %1!ls!.%0 +// + NS_E_HTTP_DISABLED = HRESULT($C00D00D3); + {$EXTERNALSYM NS_E_HTTP_DISABLED} + +// +// MessageId: NS_E_LICENSE_EXPIRED +// +// MessageText: +// +// The product license has expired.%0 +// + NS_E_LICENSE_EXPIRED = HRESULT($C00D00D4); + {$EXTERNALSYM NS_E_LICENSE_EXPIRED} + +// +// MessageId: NS_E_TITLE_BITRATE +// +// MessageText: +// +// Source file exceeds the per title maximum bitrate. See NetShow Theater documentation for more information.%0 +// + NS_E_TITLE_BITRATE = HRESULT($C00D00D5); + {$EXTERNALSYM NS_E_TITLE_BITRATE} + +// +// MessageId: NS_E_EMPTY_PROGRAM_NAME +// +// MessageText: +// +// The program name cannot be empty.%0 +// + NS_E_EMPTY_PROGRAM_NAME = HRESULT($C00D00D6); + {$EXTERNALSYM NS_E_EMPTY_PROGRAM_NAME} + +// +// MessageId: NS_E_MISSING_CHANNEL +// +// MessageText: +// +// Station %1 does not exist.%0 +// + NS_E_MISSING_CHANNEL = HRESULT($C00D00D7); + {$EXTERNALSYM NS_E_MISSING_CHANNEL} + +// +// MessageId: NS_E_NO_CHANNELS +// +// MessageText: +// +// You need to define at least one station before this operation can complete.%0 +// + NS_E_NO_CHANNELS = HRESULT($C00D00D8); + {$EXTERNALSYM NS_E_NO_CHANNELS} + + +///////////////////////////////////////////////////////////////////// +// This error message is to replace previous NS_E_INVALID_INDEX which +// takes an index value for the error message string. For some application +// obtain the idex value at reporting error time is very difficult, so we +// use this string to avoid the problem. +////////////////////////////////////////////////////////////////////// + +// +// MessageId: NS_E_INVALID_INDEX2 +// +// MessageText: +// +// The index specified is invalid.%0 +// + NS_E_INVALID_INDEX2 = HRESULT($C00D00D9); + {$EXTERNALSYM NS_E_INVALID_INDEX2} + + +///////////////////////////////////////////////////////////////////////// +// +// NETSHOW Monitor Events +// +// IdRange = 400..599 +// +// Admin Events: +// +// Alerts: +// +// Title Server: +// %1 is the Title Server name +// +// Content Server: +// %1 is the Content Server ID +// %2 is the Content Server name +// %3 is the Peer Content Server name (optiona); +// +// Disks: +// %1 is the Title Server disk ID +// %2 is the device name +// %3 is the Content Server ID +// +///////////////////////////////////////////////////////////////////////// + +// +// MessageId: NS_E_CUB_FAIL_LINK +// +// MessageText: +// +// Content Server %1 (%2) has failed its link to Content Server %3.%0 +// + NS_E_CUB_FAIL_LINK = HRESULT($C00D0190); + {$EXTERNALSYM NS_E_CUB_FAIL_LINK} + +// +// MessageId: NS_I_CUB_UNFAIL_LINK +// +// MessageText: +// +// Content Server %1 (%2) has established its link to Content Server %3.%0 +// + NS_I_CUB_UNFAIL_LINK = HRESULT($400D0191); + {$EXTERNALSYM NS_I_CUB_UNFAIL_LINK} + +// +// MessageId: NS_E_BAD_CUB_UID +// +// MessageText: +// +// Content Server %1 (%2) has incorrect uid %3.%0 +// + NS_E_BAD_CUB_UID = HRESULT($C00D0192); + {$EXTERNALSYM NS_E_BAD_CUB_UID} + +// +// MessageId: NS_I_RESTRIPE_START +// +// MessageText: +// +// Restripe operation has started.%0 +// + NS_I_RESTRIPE_START = HRESULT($400D0193); + {$EXTERNALSYM NS_I_RESTRIPE_START} + +// +// MessageId: NS_I_RESTRIPE_DONE +// +// MessageText: +// +// Restripe operation has completed.%0 +// + NS_I_RESTRIPE_DONE = HRESULT($400D0194); + {$EXTERNALSYM NS_I_RESTRIPE_DONE} + +// +// MessageId: NS_E_GLITCH_MODE +// +// MessageText: +// +// Server unreliable because multiple components failed.%0 +// + NS_E_GLITCH_MODE = HRESULT($C00D0195); + {$EXTERNALSYM NS_E_GLITCH_MODE} + +// +// MessageId: NS_I_RESTRIPE_DISK_OUT +// +// MessageText: +// +// Content disk %1 (%2) on Content Server %3 has been restriped out.%0 +// + NS_I_RESTRIPE_DISK_OUT = HRESULT($400D0196); + {$EXTERNALSYM NS_I_RESTRIPE_DISK_OUT} + +// +// MessageId: NS_I_RESTRIPE_CUB_OUT +// +// MessageText: +// +// Content server %1 (%2) has been restriped out.%0 +// + NS_I_RESTRIPE_CUB_OUT = HRESULT($400D0197); + {$EXTERNALSYM NS_I_RESTRIPE_CUB_OUT} + +// +// MessageId: NS_I_DISK_STOP +// +// MessageText: +// +// Disk %1 ( %2 ) on Content Server %3, has been offlined.%0 +// + NS_I_DISK_STOP = HRESULT($400D0198); + {$EXTERNALSYM NS_I_DISK_STOP} + +// +// MessageId: NS_I_CATATONIC_FAILURE +// +// MessageText: +// +// Disk %1 ( %2 ) on Content Server %3, will be failed because it is catatonic.%0 +// + NS_I_CATATONIC_FAILURE = HRESULT($800D0199); + {$EXTERNALSYM NS_I_CATATONIC_FAILURE} + +// +// MessageId: NS_I_CATATONIC_AUTO_UNFAIL +// +// MessageText: +// +// Disk %1 ( %2 ) on Content Server %3, auto online from catatonic state.%0 +// + NS_I_CATATONIC_AUTO_UNFAIL = HRESULT($800D019A); + {$EXTERNALSYM NS_I_CATATONIC_AUTO_UNFAIL} + +// +// MessageId: NS_E_NO_MEDIA_PROTOCOL +// +// MessageText: +// +// Content Server %1 (%2) is unable to communicate with the Media System Network Protocol.%0 +// + NS_E_NO_MEDIA_PROTOCOL = HRESULT($C00D019B); + {$EXTERNALSYM NS_E_NO_MEDIA_PROTOCOL} + + +// +// Advanced Streaming Format (ASF) codes occupy MessageIds 2000-2999 +// +// See ASFErr.mc for more details - please do not define any symbols +// in that range in this file. +// + + +///////////////////////////////////////////////////////////////////////// +// +// Windows Media SDK Errors +// +// IdRange = 3000-3199 +// +///////////////////////////////////////////////////////////////////////// + +// +// MessageId: NS_E_INVALID_INPUT_FORMAT +// +// MessageText: +// +// The input media format is invalid.%0 +// + NS_E_INVALID_INPUT_FORMAT = HRESULT($C00D0BB8); + {$EXTERNALSYM NS_E_INVALID_INPUT_FORMAT} + +// +// MessageId: NS_E_MSAUDIO_NOT_INSTALLED +// +// MessageText: +// +// The MSAudio codec is not installed on this system.%0 +// + NS_E_MSAUDIO_NOT_INSTALLED = HRESULT($C00D0BB9); + {$EXTERNALSYM NS_E_MSAUDIO_NOT_INSTALLED} + +// +// MessageId: NS_E_UNEXPECTED_MSAUDIO_ERROR +// +// MessageText: +// +// An unexpected error occurred with the MSAudio codec.%0 +// + NS_E_UNEXPECTED_MSAUDIO_ERROR = HRESULT($C00D0BBA); + {$EXTERNALSYM NS_E_UNEXPECTED_MSAUDIO_ERROR} + +// +// MessageId: NS_E_INVALID_OUTPUT_FORMAT +// +// MessageText: +// +// The output media format is invalid.%0 +// + NS_E_INVALID_OUTPUT_FORMAT = HRESULT($C00D0BBB); + {$EXTERNALSYM NS_E_INVALID_OUTPUT_FORMAT} + +// +// MessageId: NS_E_NOT_CONFIGURED +// +// MessageText: +// +// The object must be fully configured before audio samples can be processed.%0 +// + NS_E_NOT_CONFIGURED = HRESULT($C00D0BBC); + {$EXTERNALSYM NS_E_NOT_CONFIGURED} + +// +// MessageId: NS_E_PROTECTED_CONTENT +// +// MessageText: +// +// You need a license to perform the requested operation on this media file.%0 +// + NS_E_PROTECTED_CONTENT = HRESULT($C00D0BBD); + {$EXTERNALSYM NS_E_PROTECTED_CONTENT} + +// +// MessageId: NS_E_LICENSE_REQUIRED +// +// MessageText: +// +// You need a license to perform the requested operation on this media file.%0 +// + NS_E_LICENSE_REQUIRED = HRESULT($C00D0BBE); + {$EXTERNALSYM NS_E_LICENSE_REQUIRED} + +// +// MessageId: NS_E_TAMPERED_CONTENT +// +// MessageText: +// +// This media file is corrupted or invalid. Contact the content provider for a new file.%0 +// + NS_E_TAMPERED_CONTENT = HRESULT($C00D0BBF); + {$EXTERNALSYM NS_E_TAMPERED_CONTENT} + +// +// MessageId: NS_E_LICENSE_OUTOFDATE +// +// MessageText: +// +// The license for this media file has expired. Get a new license or contact the content provider for further assistance.%0 +// + NS_E_LICENSE_OUTOFDATE = HRESULT($C00D0BC0); + {$EXTERNALSYM NS_E_LICENSE_OUTOFDATE} + +// +// MessageId: NS_E_LICENSE_INCORRECT_RIGHTS +// +// MessageText: +// +// You are not allowed to open this file. Contact the content provider for further assistance.%0 +// + NS_E_LICENSE_INCORRECT_RIGHTS = HRESULT($C00D0BC1); + {$EXTERNALSYM NS_E_LICENSE_INCORRECT_RIGHTS} + +// +// MessageId: NS_E_AUDIO_CODEC_NOT_INSTALLED +// +// MessageText: +// +// The requested audio codec is not installed on this system.%0 +// + NS_E_AUDIO_CODEC_NOT_INSTALLED = HRESULT($C00D0BC2); + {$EXTERNALSYM NS_E_AUDIO_CODEC_NOT_INSTALLED} + +// +// MessageId: NS_E_AUDIO_CODEC_ERROR +// +// MessageText: +// +// An unexpected error occurred with the audio codec.%0 +// + NS_E_AUDIO_CODEC_ERROR = HRESULT($C00D0BC3); + {$EXTERNALSYM NS_E_AUDIO_CODEC_ERROR} + +// +// MessageId: NS_E_VIDEO_CODEC_NOT_INSTALLED +// +// MessageText: +// +// The requested video codec is not installed on this system.%0 +// + NS_E_VIDEO_CODEC_NOT_INSTALLED = HRESULT($C00D0BC4); + {$EXTERNALSYM NS_E_VIDEO_CODEC_NOT_INSTALLED} + +// +// MessageId: NS_E_VIDEO_CODEC_ERROR +// +// MessageText: +// +// An unexpected error occurred with the video codec.%0 +// + NS_E_VIDEO_CODEC_ERROR = HRESULT($C00D0BC5); + {$EXTERNALSYM NS_E_VIDEO_CODEC_ERROR} + +// +// MessageId: NS_E_INVALIDPROFILE +// +// MessageText: +// +// The Profile is invalid.%0 +// + NS_E_INVALIDPROFILE = HRESULT($C00D0BC6); + {$EXTERNALSYM NS_E_INVALIDPROFILE} + +// +// MessageId: NS_E_INCOMPATIBLE_VERSION +// +// MessageText: +// +// A new version of the SDK is needed to play the requested content.%0 +// + NS_E_INCOMPATIBLE_VERSION = HRESULT($C00D0BC7); + {$EXTERNALSYM NS_E_INCOMPATIBLE_VERSION} + +// +// MessageId: NS_S_REBUFFERING +// +// MessageText: +// +// The requested operation has caused the source to rebuffer.%0 +// + NS_S_REBUFFERING = HRESULT($000D0BC8); + {$EXTERNALSYM NS_S_REBUFFERING} + +// +// MessageId: NS_S_DEGRADING_QUALITY +// +// MessageText: +// +// The requested operation has caused the source to degrade codec quality.%0 +// + NS_S_DEGRADING_QUALITY = HRESULT($000D0BC9); + {$EXTERNALSYM NS_S_DEGRADING_QUALITY} + +// +// MessageId: NS_E_OFFLINE_MODE +// +// MessageText: +// +// The requested URL is not available in offline mode.%0 +// + NS_E_OFFLINE_MODE = HRESULT($C00D0BCA); + {$EXTERNALSYM NS_E_OFFLINE_MODE} + +// +// MessageId: NS_E_NOT_CONNECTED +// +// MessageText: +// +// The requested URL cannot be accessed because there is no network connection.%0 +// + NS_E_NOT_CONNECTED = HRESULT($C00D0BCB); + {$EXTERNALSYM NS_E_NOT_CONNECTED} + +// +// MessageId: NS_E_TOO_MUCH_DATA +// +// MessageText: +// +// The encoding process was unable to keep up with the amount of supplied data.%0 +// + NS_E_TOO_MUCH_DATA = HRESULT($C00D0BCC); + {$EXTERNALSYM NS_E_TOO_MUCH_DATA} + +// +// MessageId: NS_E_UNSUPPORTED_PROPERTY +// +// MessageText: +// +// The given property is not supported.%0 +// + NS_E_UNSUPPORTED_PROPERTY = HRESULT($C00D0BCD); + {$EXTERNALSYM NS_E_UNSUPPORTED_PROPERTY} + +// +// MessageId: NS_E_8BIT_WAVE_UNSUPPORTED +// +// MessageText: +// +// Windows Media Player cannot copy the files to the CD because they are 8-bit. Convert the files to 16-bit, 44-kHz stereo files by using Sound Recorder or another audio-processing program, and then try again.%0 +// + NS_E_8BIT_WAVE_UNSUPPORTED = HRESULT($C00D0BCE); + {$EXTERNALSYM NS_E_8BIT_WAVE_UNSUPPORTED} + +// +// MessageId: NS_E_NO_MORE_SAMPLES +// +// MessageText: +// +// There are no more samples in the current range.%0 +// + NS_E_NO_MORE_SAMPLES = HRESULT($C00D0BCF); + {$EXTERNALSYM NS_E_NO_MORE_SAMPLES} + +// +// MessageId: NS_E_INVALID_SAMPLING_RATE +// +// MessageText: +// +// The given sampling rate is invalid.%0 +// + NS_E_INVALID_SAMPLING_RATE = HRESULT($C00D0BD0); + {$EXTERNALSYM NS_E_INVALID_SAMPLING_RATE} + +// +// MessageId: NS_E_MAX_PACKET_SIZE_TOO_SMALL +// +// MessageText: +// +// The given maximum packet size is too small to accommodate this profile +// + NS_E_MAX_PACKET_SIZE_TOO_SMALL = HRESULT($C00D0BD1); + {$EXTERNALSYM NS_E_MAX_PACKET_SIZE_TOO_SMALL} + +// +// MessageId: NS_E_LATE_PACKET +// +// MessageText: +// +// The packet arrived too late to be of use +// + NS_E_LATE_PACKET = HRESULT($C00D0BD2); + {$EXTERNALSYM NS_E_LATE_PACKET} + +// +// MessageId: NS_E_DUPLICATE_PACKET +// +// MessageText: +// +// The packet is a duplicate of one received before +// + NS_E_DUPLICATE_PACKET = HRESULT($C00D0BD3); + {$EXTERNALSYM NS_E_DUPLICATE_PACKET} + +// +// MessageId: NS_E_SDK_BUFFERTOOSMALL +// +// MessageText: +// +// Supplied buffer is too small +// + NS_E_SDK_BUFFERTOOSMALL = HRESULT($C00D0BD4); + {$EXTERNALSYM NS_E_SDK_BUFFERTOOSMALL} + +// +// MessageId: NS_E_INVALID_NUM_PASSES +// +// MessageText: +// +// The wrong number of preprocessing passes was used for the stream's output type +// + NS_E_INVALID_NUM_PASSES = HRESULT($C00D0BD5); + {$EXTERNALSYM NS_E_INVALID_NUM_PASSES} + +// +// MessageId: NS_E_ATTRIBUTE_READ_ONLY +// +// MessageText: +// +// An attempt was made to add, modify, or delete a read only attribute +// + NS_E_ATTRIBUTE_READ_ONLY = HRESULT($C00D0BD6); + {$EXTERNALSYM NS_E_ATTRIBUTE_READ_ONLY} + +// +// MessageId: NS_E_ATTRIBUTE_NOT_ALLOWED +// +// MessageText: +// +// An attempt was made to add attribute that is not allowed for the given media type +// + NS_E_ATTRIBUTE_NOT_ALLOWED = HRESULT($C00D0BD7); + {$EXTERNALSYM NS_E_ATTRIBUTE_NOT_ALLOWED} + +// +// MessageId: NS_E_INVALID_EDL +// +// MessageText: +// +// The EDL provided is invalid +// + NS_E_INVALID_EDL = HRESULT($C00D0BD8); + {$EXTERNALSYM NS_E_INVALID_EDL} + +// +// MessageId: NS_E_DATA_UNIT_EXTENSION_TOO_LARGE +// +// MessageText: +// +// The Data Unit Extension data was too large to be used.%0 +// + NS_E_DATA_UNIT_EXTENSION_TOO_LARGE = HRESULT($C00D0BD9); + {$EXTERNALSYM NS_E_DATA_UNIT_EXTENSION_TOO_LARGE} + +// +// MessageId: NS_E_CODEC_DMO_ERROR +// +// MessageText: +// +// An unexpected error occurred with a DMO codec.%0 +// + NS_E_CODEC_DMO_ERROR = HRESULT($C00D0BDA); + {$EXTERNALSYM NS_E_CODEC_DMO_ERROR} + + + +///////////////////////////////////////////////////////////////////////// +// +// Windows Media Player Errors +// +// IdRange = 4000 - 4999 +// +///////////////////////////////////////////////////////////////////////// + +// +// WMP CD Filter Error codes +// +// +// MessageId: NS_E_NO_CD +// +// MessageText: +// +// There is no CD in the CD-ROM drive. Insert a CD, and try again.%0 +// + NS_E_NO_CD = HRESULT($C00D0FA0); + {$EXTERNALSYM NS_E_NO_CD} + +// +// MessageId: NS_E_CANT_READ_DIGITAL +// +// MessageText: +// +// Unable to perform digital reads on this compact disc drive. Please try analog playback via the Tools Options menu.%0 +// + NS_E_CANT_READ_DIGITAL = HRESULT($C00D0FA1); + {$EXTERNALSYM NS_E_CANT_READ_DIGITAL} + +// +// MessageId: NS_E_DEVICE_DISCONNECTED +// +// MessageText: +// +// Windows Media Player no longer detects a connected portable device. Reconnect your portable device, and then try copying the file again.%0 +// + NS_E_DEVICE_DISCONNECTED = HRESULT($C00D0FA2); + {$EXTERNALSYM NS_E_DEVICE_DISCONNECTED} + +// +// MessageId: NS_E_DEVICE_NOT_SUPPORT_FORMAT +// +// MessageText: +// +// Windows Media Player cannot play the file. The portable device does not support the specified format.%0 +// + NS_E_DEVICE_NOT_SUPPORT_FORMAT = HRESULT($C00D0FA3); + {$EXTERNALSYM NS_E_DEVICE_NOT_SUPPORT_FORMAT} + +// +// MessageId: NS_E_SLOW_READ_DIGITAL +// +// MessageText: +// +// Windows Media Player encountered a problem while attempting to play the CD using digital playback. The Player has automatically switched the CD-ROM drive to analog playback. To switch back to digital CD playback, use the Devices tab.%0 +// + NS_E_SLOW_READ_DIGITAL = HRESULT($C00D0FA4); + {$EXTERNALSYM NS_E_SLOW_READ_DIGITAL} + +// +// MessageId: NS_E_MIXER_INVALID_LINE +// +// MessageText: +// +// An invalid line error occurred in the mixer.%0 +// + NS_E_MIXER_INVALID_LINE = HRESULT($C00D0FA5); + {$EXTERNALSYM NS_E_MIXER_INVALID_LINE} + +// +// MessageId: NS_E_MIXER_INVALID_CONTROL +// +// MessageText: +// +// An invalid control error occurred in the mixer.%0 +// + NS_E_MIXER_INVALID_CONTROL = HRESULT($C00D0FA6); + {$EXTERNALSYM NS_E_MIXER_INVALID_CONTROL} + +// +// MessageId: NS_E_MIXER_INVALID_VALUE +// +// MessageText: +// +// An invalid value error occurred in the mixer.%0 +// + NS_E_MIXER_INVALID_VALUE = HRESULT($C00D0FA7); + {$EXTERNALSYM NS_E_MIXER_INVALID_VALUE} + +// +// MessageId: NS_E_MIXER_UNKNOWN_MMRESULT +// +// MessageText: +// +// An unrecognized MMRESULT occurred in the mixer.%0 +// + NS_E_MIXER_UNKNOWN_MMRESULT = HRESULT($C00D0FA8); + {$EXTERNALSYM NS_E_MIXER_UNKNOWN_MMRESULT} + +// +// MessageId: NS_E_USER_STOP +// +// MessageText: +// +// User has stopped the operation.%0 +// + NS_E_USER_STOP = HRESULT($C00D0FA9); + {$EXTERNALSYM NS_E_USER_STOP} + +// +// MessageId: NS_E_MP3_FORMAT_NOT_FOUND +// +// MessageText: +// +// Windows Media Player cannot copy the file because a compatible MP3 encoder is not installed on your computer. Install a compatible MP3 encoder, or choose a different format to copy to (such as Windows Media Audio).%0 +// + NS_E_MP3_FORMAT_NOT_FOUND = HRESULT($C00D0FAA); + {$EXTERNALSYM NS_E_MP3_FORMAT_NOT_FOUND} + +// +// MessageId: NS_E_CD_READ_ERROR_NO_CORRECTION +// +// MessageText: +// +// Windows Media Player cannot read the CD. It may contain flaws. Turn on error correction and try again.%0 +// + NS_E_CD_READ_ERROR_NO_CORRECTION = HRESULT($C00D0FAB); + {$EXTERNALSYM NS_E_CD_READ_ERROR_NO_CORRECTION} + +// +// MessageId: NS_E_CD_READ_ERROR +// +// MessageText: +// +// Windows Media Player cannot read the CD. Be sure the CD is free of dirt and scratches and the CD-ROM drive is functioning properly.%0 +// + NS_E_CD_READ_ERROR = HRESULT($C00D0FAC); + {$EXTERNALSYM NS_E_CD_READ_ERROR} + +// +// MessageId: NS_E_CD_SLOW_COPY +// +// MessageText: +// +// To speed up the copy process, do not play CD tracks while copying.%0 +// + NS_E_CD_SLOW_COPY = HRESULT($C00D0FAD); + {$EXTERNALSYM NS_E_CD_SLOW_COPY} + +// +// MessageId: NS_E_CD_COPYTO_CD +// +// MessageText: +// +// Cannot copy directly from a CDROM to a CD drive.%0 +// + NS_E_CD_COPYTO_CD = HRESULT($C00D0FAE); + {$EXTERNALSYM NS_E_CD_COPYTO_CD} + +// +// MessageId: NS_E_MIXER_NODRIVER +// +// MessageText: +// +// Could not open a sound mixer driver.%0 +// + NS_E_MIXER_NODRIVER = HRESULT($C00D0FAF); + {$EXTERNALSYM NS_E_MIXER_NODRIVER} + +// +// MessageId: NS_E_REDBOOK_ENABLED_WHILE_COPYING +// +// MessageText: +// +// Windows Media Player has detected that a setting for the CD-ROM drive will cause audio CDs to copy incorrectly; no audio is copied. Change the CD-ROM drive setting in Device Manager, and then try again.%0 +// + NS_E_REDBOOK_ENABLED_WHILE_COPYING = HRESULT($C00D0FB0); + {$EXTERNALSYM NS_E_REDBOOK_ENABLED_WHILE_COPYING} + +// +// MessageId: NS_E_CD_REFRESH +// +// MessageText: +// +// Trying to refresh the CD playlist.%0 +// + NS_E_CD_REFRESH = HRESULT($C00D0FB1); + {$EXTERNALSYM NS_E_CD_REFRESH} + +// +// MessageId: NS_E_CD_DRIVER_PROBLEM +// +// MessageText: +// +// Windows Media Player must switch to analog mode because there is a problem reading the CD-ROM drive in digital mode. Verify that the CD-ROM drive is installed correctly or try to update the drivers for the CD-ROM drive, and then try to use digital mode again.%0 +// + NS_E_CD_DRIVER_PROBLEM = HRESULT($C00D0FB2); + {$EXTERNALSYM NS_E_CD_DRIVER_PROBLEM} + +// +// MessageId: NS_E_WONT_DO_DIGITAL +// +// MessageText: +// +// Windows Media Player must switch to analog mode because there is a problem reading the CD-ROM drive in digital mode.%0 +// + NS_E_WONT_DO_DIGITAL = HRESULT($C00D0FB3); + {$EXTERNALSYM NS_E_WONT_DO_DIGITAL} + +// +// WMP IWMPXMLParser Error codes +// +// +// MessageId: NS_E_WMPXML_NOERROR +// +// MessageText: +// +// A call was made to GetParseError on the XML parser but there was no error to retrieve.%0 +// + NS_E_WMPXML_NOERROR = HRESULT($C00D0FB4); + {$EXTERNALSYM NS_E_WMPXML_NOERROR} + +// +// MessageId: NS_E_WMPXML_ENDOFDATA +// +// MessageText: +// +// The XML Parser ran out of data while parsing.%0 +// + NS_E_WMPXML_ENDOFDATA = HRESULT($C00D0FB5); + {$EXTERNALSYM NS_E_WMPXML_ENDOFDATA} + +// +// MessageId: NS_E_WMPXML_PARSEERROR +// +// MessageText: +// +// A generic parse error occurred in the XML parser but no information is available.%0 +// + NS_E_WMPXML_PARSEERROR = HRESULT($C00D0FB6); + {$EXTERNALSYM NS_E_WMPXML_PARSEERROR} + +// +// MessageId: NS_E_WMPXML_ATTRIBUTENOTFOUND +// +// MessageText: +// +// A call get GetNamedAttribute or GetNamedAttributeIndex on the XML parser resulted in the index not being found.%0 +// + NS_E_WMPXML_ATTRIBUTENOTFOUND = HRESULT($C00D0FB7); + {$EXTERNALSYM NS_E_WMPXML_ATTRIBUTENOTFOUND} + +// +// MessageId: NS_E_WMPXML_PINOTFOUND +// +// MessageText: +// +// A call was made go GetNamedPI on the XML parser, but the requested Processing Instruction was not found.%0 +// + NS_E_WMPXML_PINOTFOUND = HRESULT($C00D0FB8); + {$EXTERNALSYM NS_E_WMPXML_PINOTFOUND} + +// +// MessageId: NS_E_WMPXML_EMPTYDOC +// +// MessageText: +// +// Persist was called on the XML parser, but the parser has no data to persist.%0 +// + NS_E_WMPXML_EMPTYDOC = HRESULT($C00D0FB9); + {$EXTERNALSYM NS_E_WMPXML_EMPTYDOC} + +// +// Miscellaneous Media Player Error codes +// +// +// MessageId: NS_E_WMP_WINDOWSAPIFAILURE +// +// MessageText: +// +// A Windows API call failed but no error information was available.%0 +// + NS_E_WMP_WINDOWSAPIFAILURE = HRESULT($C00D0FC8); + {$EXTERNALSYM NS_E_WMP_WINDOWSAPIFAILURE} + +// +// MessageId: NS_E_WMP_RECORDING_NOT_ALLOWED +// +// MessageText: +// +// Windows Media Player cannot copy the file. Either the license restricts copying, or you must obtain a license to copy the file.%0 +// + NS_E_WMP_RECORDING_NOT_ALLOWED = HRESULT($C00D0FC9); + {$EXTERNALSYM NS_E_WMP_RECORDING_NOT_ALLOWED} + +// +// MessageId: NS_E_DEVICE_NOT_READY +// +// MessageText: +// +// Windows Media Player no longer detects a connected portable device. Reconnect your portable device, and try again.%0 +// + NS_E_DEVICE_NOT_READY = HRESULT($C00D0FCA); + {$EXTERNALSYM NS_E_DEVICE_NOT_READY} + +// +// MessageId: NS_E_DAMAGED_FILE +// +// MessageText: +// +// Windows Media Player cannot play the file because it is either damaged or corrupt.%0 +// + NS_E_DAMAGED_FILE = HRESULT($C00D0FCB); + {$EXTERNALSYM NS_E_DAMAGED_FILE} + +// +// MessageId: NS_E_MPDB_GENERIC +// +// MessageText: +// +// An error occurred when the Player was attempting to access information in your media library. Try closing and then reopening the Player.%0 +// + NS_E_MPDB_GENERIC = HRESULT($C00D0FCC); + {$EXTERNALSYM NS_E_MPDB_GENERIC} + +// +// MessageId: NS_E_FILE_FAILED_CHECKS +// +// MessageText: +// +// The file cannot be added to Media Library because it is smaller than the minimum-size requirement. Adjust the size requirements, and then try again.%0 +// + NS_E_FILE_FAILED_CHECKS = HRESULT($C00D0FCD); + {$EXTERNALSYM NS_E_FILE_FAILED_CHECKS} + +// +// MessageId: NS_E_MEDIA_LIBRARY_FAILED +// +// MessageText: +// +// Windows Media Player could not create Media Library. Check with your system administrator to get the necessary permissions to create Media Library on your computer, and then try installing the Player again.%0 +// + NS_E_MEDIA_LIBRARY_FAILED = HRESULT($C00D0FCE); + {$EXTERNALSYM NS_E_MEDIA_LIBRARY_FAILED} + +// +// MessageId: NS_E_SHARING_VIOLATION +// +// MessageText: +// +// The file is already in use. Close other programs that may be using the file, or stop playing the file, and try again.%0 +// + NS_E_SHARING_VIOLATION = HRESULT($C00D0FCF); + {$EXTERNALSYM NS_E_SHARING_VIOLATION} + +// +// MessageId: NS_E_NO_ERROR_STRING_FOUND +// +// MessageText: +// +// Windows Media Player has encountered an unknown error.%0 +// + NS_E_NO_ERROR_STRING_FOUND = HRESULT($C00D0FD0); + {$EXTERNALSYM NS_E_NO_ERROR_STRING_FOUND} + +// +// MessageId: NS_E_WMPOCX_NO_REMOTE_CORE +// +// MessageText: +// +// The Windows Media Player control was unable to connect to remote media services, but will continue with local media services.%0 +// + NS_E_WMPOCX_NO_REMOTE_CORE = HRESULT($C00D0FD1); + {$EXTERNALSYM NS_E_WMPOCX_NO_REMOTE_CORE} + +// +// MessageId: NS_E_WMPOCX_NO_ACTIVE_CORE +// +// MessageText: +// +// The requested method or property is not available because the Windows Media Player control has not been properly activated.%0 +// + NS_E_WMPOCX_NO_ACTIVE_CORE = HRESULT($C00D0FD2); + {$EXTERNALSYM NS_E_WMPOCX_NO_ACTIVE_CORE} + +// +// MessageId: NS_E_WMPOCX_NOT_RUNNING_REMOTELY +// +// MessageText: +// +// Windows Media Player ActiveX control is not running in remote mode.%0 +// + NS_E_WMPOCX_NOT_RUNNING_REMOTELY = HRESULT($C00D0FD3); + {$EXTERNALSYM NS_E_WMPOCX_NOT_RUNNING_REMOTELY} + +// +// MessageId: NS_E_WMPOCX_NO_REMOTE_WINDOW +// +// MessageText: +// +// An error occurred when trying to get remote Windows Media Player window.%0 +// + NS_E_WMPOCX_NO_REMOTE_WINDOW = HRESULT($C00D0FD4); + {$EXTERNALSYM NS_E_WMPOCX_NO_REMOTE_WINDOW} + +// +// MessageId: NS_E_WMPOCX_ERRORMANAGERNOTAVAILABLE +// +// MessageText: +// +// Windows Media Player has encountered an unknown error.%0 +// + NS_E_WMPOCX_ERRORMANAGERNOTAVAILABLE = HRESULT($C00D0FD5); + {$EXTERNALSYM NS_E_WMPOCX_ERRORMANAGERNOTAVAILABLE} + +// +// MessageId: NS_E_PLUGIN_NOTSHUTDOWN +// +// MessageText: +// +// Windows Media Player was not closed properly. A damaged or incompatible plug-in may have caused the problem to occur. As a precaution, all third-party plug-ins have been disabled.%0 +// + NS_E_PLUGIN_NOTSHUTDOWN = HRESULT($C00D0FD6); + {$EXTERNALSYM NS_E_PLUGIN_NOTSHUTDOWN} + +// +// MessageId: NS_E_WMP_CANNOT_FIND_FOLDER +// +// MessageText: +// +// Windows Media Player cannot find the specified path. Be sure the path is typed correctly. If it is, the path does not exist in the specified location, or the computer where the path is located is offline.%0 +// + NS_E_WMP_CANNOT_FIND_FOLDER = HRESULT($C00D0FD7); + {$EXTERNALSYM NS_E_WMP_CANNOT_FIND_FOLDER} + +// +// MessageId: NS_E_WMP_STREAMING_RECORDING_NOT_ALLOWED +// +// MessageText: +// +// Windows Media Player cannot copy streaming media.%0 +// + NS_E_WMP_STREAMING_RECORDING_NOT_ALLOWED = HRESULT($C00D0FD8); + {$EXTERNALSYM NS_E_WMP_STREAMING_RECORDING_NOT_ALLOWED} + +// +// MessageId: NS_E_WMP_PLUGINDLL_NOTFOUND +// +// MessageText: +// +// Windows Media Player cannot find the selected plug-in. The Player will try to remove it from the menu. To use this plug-in, install it again.%0 +// + NS_E_WMP_PLUGINDLL_NOTFOUND = HRESULT($C00D0FD9); + {$EXTERNALSYM NS_E_WMP_PLUGINDLL_NOTFOUND} + +// +// MessageId: NS_E_NEED_TO_ASK_USER +// +// MessageText: +// +// Action requires input from the user.%0 +// + NS_E_NEED_TO_ASK_USER = HRESULT($C00D0FDA); + {$EXTERNALSYM NS_E_NEED_TO_ASK_USER} + +// +// MessageId: NS_E_WMPOCX_PLAYER_NOT_DOCKED +// +// MessageText: +// +// The Windows Media Player control must be in a docked state for this action to succeed.%0 +// + NS_E_WMPOCX_PLAYER_NOT_DOCKED = HRESULT($C00D0FDB); + {$EXTERNALSYM NS_E_WMPOCX_PLAYER_NOT_DOCKED} + +// +// MessageId: NS_E_WMP_EXTERNAL_NOTREADY +// +// MessageText: +// +// Media Player external object is not ready.%0 +// + NS_E_WMP_EXTERNAL_NOTREADY = HRESULT($C00D0FDC); + {$EXTERNALSYM NS_E_WMP_EXTERNAL_NOTREADY} + +// +// MessageId: NS_E_WMP_MLS_STALE_DATA +// +// MessageText: +// +// Metadata is stale. The operation failed.%0 +// + NS_E_WMP_MLS_STALE_DATA = HRESULT($C00D0FDD); + {$EXTERNALSYM NS_E_WMP_MLS_STALE_DATA} + +// +// Generic Media PlayerUI error codes +// +// +// MessageId: NS_E_WMP_UI_SUBCONTROLSNOTSUPPORTED +// +// MessageText: +// +// The control (%s) does not support creation of sub-controls, yet (%d) sub-controls have been specified.%0 +// + NS_E_WMP_UI_SUBCONTROLSNOTSUPPORTED = HRESULT($C00D0FDE); + {$EXTERNALSYM NS_E_WMP_UI_SUBCONTROLSNOTSUPPORTED} + +// +// MessageId: NS_E_WMP_UI_VERSIONMISMATCH +// +// MessageText: +// +// Version mismatch: (%.1f required, %.1f found).%0 +// + NS_E_WMP_UI_VERSIONMISMATCH = HRESULT($C00D0FDF); + {$EXTERNALSYM NS_E_WMP_UI_VERSIONMISMATCH} + +// +// MessageId: NS_E_WMP_UI_NOTATHEMEFILE +// +// MessageText: +// +// The layout manager was given valid XML that wasn't a theme file.%0 +// + NS_E_WMP_UI_NOTATHEMEFILE = HRESULT($C00D0FE0); + {$EXTERNALSYM NS_E_WMP_UI_NOTATHEMEFILE} + +// +// MessageId: NS_E_WMP_UI_SUBELEMENTNOTFOUND +// +// MessageText: +// +// The %s subelement could not be found on the %s object.%0 +// + NS_E_WMP_UI_SUBELEMENTNOTFOUND = HRESULT($C00D0FE1); + {$EXTERNALSYM NS_E_WMP_UI_SUBELEMENTNOTFOUND} + +// +// MessageId: NS_E_WMP_UI_VERSIONPARSE +// +// MessageText: +// +// An error occurred parsing the version tag.\nValid version tags are of the form:\n\n\t.%0 +// + NS_E_WMP_UI_VERSIONPARSE = HRESULT($C00D0FE2); + {$EXTERNALSYM NS_E_WMP_UI_VERSIONPARSE} + +// +// MessageId: NS_E_WMP_UI_VIEWIDNOTFOUND +// +// MessageText: +// +// The view specified in for the 'currentViewID' property (%s) was not found in this theme file.%0 +// + NS_E_WMP_UI_VIEWIDNOTFOUND = HRESULT($C00D0FE3); + {$EXTERNALSYM NS_E_WMP_UI_VIEWIDNOTFOUND} + +// +// MessageId: NS_E_WMP_UI_PASSTHROUGH +// +// MessageText: +// +// This error used internally for hit testing.%0 +// + NS_E_WMP_UI_PASSTHROUGH = HRESULT($C00D0FE4); + {$EXTERNALSYM NS_E_WMP_UI_PASSTHROUGH} + +// +// MessageId: NS_E_WMP_UI_OBJECTNOTFOUND +// +// MessageText: +// +// Attributes were specified for the %s object, but the object was not available to send them to.%0 +// + NS_E_WMP_UI_OBJECTNOTFOUND = HRESULT($C00D0FE5); + {$EXTERNALSYM NS_E_WMP_UI_OBJECTNOTFOUND} + +// +// MessageId: NS_E_WMP_UI_SECONDHANDLER +// +// MessageText: +// +// The %s event already has a handler, the second handler was ignored.%0 +// + NS_E_WMP_UI_SECONDHANDLER = HRESULT($C00D0FE6); + {$EXTERNALSYM NS_E_WMP_UI_SECONDHANDLER} + +// +// MessageId: NS_E_WMP_UI_NOSKININZIP +// +// MessageText: +// +// No .wms file found in skin archive.%0 +// + NS_E_WMP_UI_NOSKININZIP = HRESULT($C00D0FE7); + {$EXTERNALSYM NS_E_WMP_UI_NOSKININZIP} + +// +// MessageId: NS_S_WMP_UI_VERSIONMISMATCH +// +// MessageText: +// +// An upgrade may be needed for the theme manager to correctly show this skin. Skin reports version: %.1f.%0 +// + NS_S_WMP_UI_VERSIONMISMATCH = HRESULT($000D0FE8); + {$EXTERNALSYM NS_S_WMP_UI_VERSIONMISMATCH} + +// +// MessageId: NS_S_WMP_EXCEPTION +// +// MessageText: +// +// An error occurred in one of the UI components.%0 +// + NS_S_WMP_EXCEPTION = HRESULT($000D0FE9); + {$EXTERNALSYM NS_S_WMP_EXCEPTION} + +// +// MessageId: NS_E_WMP_URLDOWNLOADFAILED +// +// MessageText: +// +// Windows Media Player cannot save the file.%0 +// + NS_E_WMP_URLDOWNLOADFAILED = HRESULT($C00D0FEA); + {$EXTERNALSYM NS_E_WMP_URLDOWNLOADFAILED} + +// +// MessageId: NS_E_WMPOCX_UNABLE_TO_LOAD_SKIN +// +// MessageText: +// +// The Windows Media Player Control was unable to load the requested uiMode and could not successfully roll back to the existing uiMode.%0 +// + NS_E_WMPOCX_UNABLE_TO_LOAD_SKIN = HRESULT($C00D0FEB); + {$EXTERNALSYM NS_E_WMPOCX_UNABLE_TO_LOAD_SKIN} + +// +// MessageId: NS_E_WMP_INVALID_SKIN +// +// MessageText: +// +// The skin file is invalid.%0 +// + NS_E_WMP_INVALID_SKIN = HRESULT($C00D0FEC); + {$EXTERNALSYM NS_E_WMP_INVALID_SKIN} + +// +// MessageId: NS_E_WMP_SENDMAILFAILED +// +// MessageText: +// +// Windows Media Player cannot send the link because your e-mail program is not responding. Verify that your e-mail program is configured properly, and then try again. For more information about e-mail, see Windows Help%0 +// + NS_E_WMP_SENDMAILFAILED = HRESULT($C00D0FED); + {$EXTERNALSYM NS_E_WMP_SENDMAILFAILED} + +//Save As +// +// MessageId: NS_E_WMP_SAVEAS_READONLY +// +// MessageText: +// +// The Windows Media Player cannot overwrite a read only file. Choose another file to save as or change the file attributes.%0 +// + NS_E_WMP_SAVEAS_READONLY = HRESULT($C00D0FF0); + {$EXTERNALSYM NS_E_WMP_SAVEAS_READONLY} + +// +// WMP Regional button control +// +// +// MessageId: NS_E_WMP_RBC_JPGMAPPINGIMAGE +// +// MessageText: +// +// JPG Images are not recommended for use as a mappingImage.%0 +// + NS_E_WMP_RBC_JPGMAPPINGIMAGE = HRESULT($C00D1004); + {$EXTERNALSYM NS_E_WMP_RBC_JPGMAPPINGIMAGE} + +// +// MessageId: NS_E_WMP_JPGTRANSPARENCY +// +// MessageText: +// +// JPG Images are not recommended when using a transparencyColor.%0 +// + NS_E_WMP_JPGTRANSPARENCY = HRESULT($C00D1005); + {$EXTERNALSYM NS_E_WMP_JPGTRANSPARENCY} + +// +// WMP Slider control +// +// +// MessageId: NS_E_WMP_INVALID_MAX_VAL +// +// MessageText: +// +// The Max property cannot be less than Min property.%0 +// + NS_E_WMP_INVALID_MAX_VAL = HRESULT($C00D1009); + {$EXTERNALSYM NS_E_WMP_INVALID_MAX_VAL} + +// +// MessageId: NS_E_WMP_INVALID_MIN_VAL +// +// MessageText: +// +// The Min property cannot be greater than Max property.%0 +// + NS_E_WMP_INVALID_MIN_VAL = HRESULT($C00D100A); + {$EXTERNALSYM NS_E_WMP_INVALID_MIN_VAL} + +// +// WMP CustomSlider control +// +// +// MessageId: NS_E_WMP_CS_JPGPOSITIONIMAGE +// +// MessageText: +// +// JPG Images are not recommended for use as a positionImage.%0 +// + NS_E_WMP_CS_JPGPOSITIONIMAGE = HRESULT($C00D100E); + {$EXTERNALSYM NS_E_WMP_CS_JPGPOSITIONIMAGE} + +// +// MessageId: NS_E_WMP_CS_NOTEVENLYDIVISIBLE +// +// MessageText: +// +// The (%s) image's size is not evenly divisible by the positionImage's size.%0 +// + NS_E_WMP_CS_NOTEVENLYDIVISIBLE = HRESULT($C00D100F); + {$EXTERNALSYM NS_E_WMP_CS_NOTEVENLYDIVISIBLE} + +// +// WMP ZIP Decoder +// +// +// MessageId: NS_E_WMPZIP_NOTAZIPFILE +// +// MessageText: +// +// The ZIP reader opened a file and its signature didn't match that of ZIP files.%0 +// + NS_E_WMPZIP_NOTAZIPFILE = HRESULT($C00D1018); + {$EXTERNALSYM NS_E_WMPZIP_NOTAZIPFILE} + +// +// MessageId: NS_E_WMPZIP_CORRUPT +// +// MessageText: +// +// The ZIP reader has detected that the file is corrupt.%0 +// + NS_E_WMPZIP_CORRUPT = HRESULT($C00D1019); + {$EXTERNALSYM NS_E_WMPZIP_CORRUPT} + +// +// MessageId: NS_E_WMPZIP_FILENOTFOUND +// +// MessageText: +// +// GetFileStream, SaveToFile, or SaveTemp file was called on the ZIP reader with a filename that was not found in the zip file.%0 +// + NS_E_WMPZIP_FILENOTFOUND = HRESULT($C00D101A); + {$EXTERNALSYM NS_E_WMPZIP_FILENOTFOUND} + +// +// WMP Image Decoding Error codes +// +// +// MessageId: NS_E_WMP_IMAGE_FILETYPE_UNSUPPORTED +// +// MessageText: +// +// Image type not supported.%0 +// + NS_E_WMP_IMAGE_FILETYPE_UNSUPPORTED = HRESULT($C00D1022); + {$EXTERNALSYM NS_E_WMP_IMAGE_FILETYPE_UNSUPPORTED} + +// +// MessageId: NS_E_WMP_IMAGE_INVALID_FORMAT +// +// MessageText: +// +// Image file may be corrupt.%0 +// + NS_E_WMP_IMAGE_INVALID_FORMAT = HRESULT($C00D1023); + {$EXTERNALSYM NS_E_WMP_IMAGE_INVALID_FORMAT} + +// +// MessageId: NS_E_WMP_GIF_UNEXPECTED_ENDOFFILE +// +// MessageText: +// +// Unexpected end of file. GIF file may be corrupt.%0 +// + NS_E_WMP_GIF_UNEXPECTED_ENDOFFILE = HRESULT($C00D1024); + {$EXTERNALSYM NS_E_WMP_GIF_UNEXPECTED_ENDOFFILE} + +// +// MessageId: NS_E_WMP_GIF_INVALID_FORMAT +// +// MessageText: +// +// Invalid GIF file.%0 +// + NS_E_WMP_GIF_INVALID_FORMAT = HRESULT($C00D1025); + {$EXTERNALSYM NS_E_WMP_GIF_INVALID_FORMAT} + +// +// MessageId: NS_E_WMP_GIF_BAD_VERSION_NUMBER +// +// MessageText: +// +// Invalid GIF version. Only 87a or 89a supported.%0 +// + NS_E_WMP_GIF_BAD_VERSION_NUMBER = HRESULT($C00D1026); + {$EXTERNALSYM NS_E_WMP_GIF_BAD_VERSION_NUMBER} + +// +// MessageId: NS_E_WMP_GIF_NO_IMAGE_IN_FILE +// +// MessageText: +// +// No images found in GIF file.%0 +// + NS_E_WMP_GIF_NO_IMAGE_IN_FILE = HRESULT($C00D1027); + {$EXTERNALSYM NS_E_WMP_GIF_NO_IMAGE_IN_FILE} + +// +// MessageId: NS_E_WMP_PNG_INVALIDFORMAT +// +// MessageText: +// +// Invalid PNG image file format.%0 +// + NS_E_WMP_PNG_INVALIDFORMAT = HRESULT($C00D1028); + {$EXTERNALSYM NS_E_WMP_PNG_INVALIDFORMAT} + +// +// MessageId: NS_E_WMP_PNG_UNSUPPORTED_BITDEPTH +// +// MessageText: +// +// PNG bitdepth not supported.%0 +// + NS_E_WMP_PNG_UNSUPPORTED_BITDEPTH = HRESULT($C00D1029); + {$EXTERNALSYM NS_E_WMP_PNG_UNSUPPORTED_BITDEPTH} + +// +// MessageId: NS_E_WMP_PNG_UNSUPPORTED_COMPRESSION +// +// MessageText: +// +// Compression format defined in PNG file not supported,%0 +// + NS_E_WMP_PNG_UNSUPPORTED_COMPRESSION = HRESULT($C00D102A); + {$EXTERNALSYM NS_E_WMP_PNG_UNSUPPORTED_COMPRESSION} + +// +// MessageId: NS_E_WMP_PNG_UNSUPPORTED_FILTER +// +// MessageText: +// +// Filter method defined in PNG file not supported.%0 +// + NS_E_WMP_PNG_UNSUPPORTED_FILTER = HRESULT($C00D102B); + {$EXTERNALSYM NS_E_WMP_PNG_UNSUPPORTED_FILTER} + +// +// MessageId: NS_E_WMP_PNG_UNSUPPORTED_INTERLACE +// +// MessageText: +// +// Interlace method defined in PNG file not supported.%0 +// + NS_E_WMP_PNG_UNSUPPORTED_INTERLACE = HRESULT($C00D102C); + {$EXTERNALSYM NS_E_WMP_PNG_UNSUPPORTED_INTERLACE} + +// +// MessageId: NS_E_WMP_PNG_UNSUPPORTED_BAD_CRC +// +// MessageText: +// +// Bad CRC in PNG file.%0 +// + NS_E_WMP_PNG_UNSUPPORTED_BAD_CRC = HRESULT($C00D102D); + {$EXTERNALSYM NS_E_WMP_PNG_UNSUPPORTED_BAD_CRC} + +// +// MessageId: NS_E_WMP_BMP_INVALID_BITMASK +// +// MessageText: +// +// Invalid bitmask in BMP file.%0 +// + NS_E_WMP_BMP_INVALID_BITMASK = HRESULT($C00D102E); + {$EXTERNALSYM NS_E_WMP_BMP_INVALID_BITMASK} + +// +// MessageId: NS_E_WMP_BMP_TOPDOWN_DIB_UNSUPPORTED +// +// MessageText: +// +// Topdown DIB not supported.%0 +// + NS_E_WMP_BMP_TOPDOWN_DIB_UNSUPPORTED = HRESULT($C00D102F); + {$EXTERNALSYM NS_E_WMP_BMP_TOPDOWN_DIB_UNSUPPORTED} + +// +// MessageId: NS_E_WMP_BMP_BITMAP_NOT_CREATED +// +// MessageText: +// +// Bitmap could not be created.%0 +// + NS_E_WMP_BMP_BITMAP_NOT_CREATED = HRESULT($C00D1030); + {$EXTERNALSYM NS_E_WMP_BMP_BITMAP_NOT_CREATED} + +// +// MessageId: NS_E_WMP_BMP_COMPRESSION_UNSUPPORTED +// +// MessageText: +// +// Compression format defined in BMP not supported.%0 +// + NS_E_WMP_BMP_COMPRESSION_UNSUPPORTED = HRESULT($C00D1031); + {$EXTERNALSYM NS_E_WMP_BMP_COMPRESSION_UNSUPPORTED} + +// +// MessageId: NS_E_WMP_BMP_INVALID_FORMAT +// +// MessageText: +// +// Invalid Bitmap format.%0 +// + NS_E_WMP_BMP_INVALID_FORMAT = HRESULT($C00D1032); + {$EXTERNALSYM NS_E_WMP_BMP_INVALID_FORMAT} + +// +// MessageId: NS_E_WMP_JPG_JERR_ARITHCODING_NOTIMPL +// +// MessageText: +// +// JPEG Arithmetic coding not supported.%0 +// + NS_E_WMP_JPG_JERR_ARITHCODING_NOTIMPL = HRESULT($C00D1033); + {$EXTERNALSYM NS_E_WMP_JPG_JERR_ARITHCODING_NOTIMPL} + +// +// MessageId: NS_E_WMP_JPG_INVALID_FORMAT +// +// MessageText: +// +// Invalid JPEG format.%0 +// + NS_E_WMP_JPG_INVALID_FORMAT = HRESULT($C00D1034); + {$EXTERNALSYM NS_E_WMP_JPG_INVALID_FORMAT} + +// +// MessageId: NS_E_WMP_JPG_BAD_DCTSIZE +// +// MessageText: +// +// Invalid JPEG format.%0 +// + NS_E_WMP_JPG_BAD_DCTSIZE = HRESULT($C00D1035); + {$EXTERNALSYM NS_E_WMP_JPG_BAD_DCTSIZE} + +// +// MessageId: NS_E_WMP_JPG_BAD_VERSION_NUMBER +// +// MessageText: +// +// Internal version error. Unexpected JPEG library version.%0 +// + NS_E_WMP_JPG_BAD_VERSION_NUMBER = HRESULT($C00D1036); + {$EXTERNALSYM NS_E_WMP_JPG_BAD_VERSION_NUMBER} + +// +// MessageId: NS_E_WMP_JPG_BAD_PRECISION +// +// MessageText: +// +// Internal JPEG Library error. Unsupported JPEG data precision.%0 +// + NS_E_WMP_JPG_BAD_PRECISION = HRESULT($C00D1037); + {$EXTERNALSYM NS_E_WMP_JPG_BAD_PRECISION} + +// +// MessageId: NS_E_WMP_JPG_CCIR601_NOTIMPL +// +// MessageText: +// +// JPEG CCIR601 not supported.%0 +// + NS_E_WMP_JPG_CCIR601_NOTIMPL = HRESULT($C00D1038); + {$EXTERNALSYM NS_E_WMP_JPG_CCIR601_NOTIMPL} + +// +// MessageId: NS_E_WMP_JPG_NO_IMAGE_IN_FILE +// +// MessageText: +// +// No image found in JPEG file.%0 +// + NS_E_WMP_JPG_NO_IMAGE_IN_FILE = HRESULT($C00D1039); + {$EXTERNALSYM NS_E_WMP_JPG_NO_IMAGE_IN_FILE} + +// +// MessageId: NS_E_WMP_JPG_READ_ERROR +// +// MessageText: +// +// Could not read JPEG file.%0 +// + NS_E_WMP_JPG_READ_ERROR = HRESULT($C00D103A); + {$EXTERNALSYM NS_E_WMP_JPG_READ_ERROR} + +// +// MessageId: NS_E_WMP_JPG_FRACT_SAMPLE_NOTIMPL +// +// MessageText: +// +// JPEG Fractional sampling not supported.%0 +// + NS_E_WMP_JPG_FRACT_SAMPLE_NOTIMPL = HRESULT($C00D103B); + {$EXTERNALSYM NS_E_WMP_JPG_FRACT_SAMPLE_NOTIMPL} + +// +// MessageId: NS_E_WMP_JPG_IMAGE_TOO_BIG +// +// MessageText: +// +// JPEG image too large. Maximum image size supported is 65500 X 65500.%0 +// + NS_E_WMP_JPG_IMAGE_TOO_BIG = HRESULT($C00D103C); + {$EXTERNALSYM NS_E_WMP_JPG_IMAGE_TOO_BIG} + +// +// MessageId: NS_E_WMP_JPG_UNEXPECTED_ENDOFFILE +// +// MessageText: +// +// Unexpected end of file reached in JPEG file.%0 +// + NS_E_WMP_JPG_UNEXPECTED_ENDOFFILE = HRESULT($C00D103D); + {$EXTERNALSYM NS_E_WMP_JPG_UNEXPECTED_ENDOFFILE} + +// +// MessageId: NS_E_WMP_JPG_SOF_UNSUPPORTED +// +// MessageText: +// +// Unsupported JPEG SOF marker found.%0 +// + NS_E_WMP_JPG_SOF_UNSUPPORTED = HRESULT($C00D103E); + {$EXTERNALSYM NS_E_WMP_JPG_SOF_UNSUPPORTED} + +// +// MessageId: NS_E_WMP_JPG_UNKNOWN_MARKER +// +// MessageText: +// +// Unknown JPEG marker found.%0 +// + NS_E_WMP_JPG_UNKNOWN_MARKER = HRESULT($C00D103F); + {$EXTERNALSYM NS_E_WMP_JPG_UNKNOWN_MARKER} + +// +// MessageId: NS_S_WMP_LOADED_GIF_IMAGE +// +// MessageText: +// +// Successfully loaded a GIF file.%0 +// + NS_S_WMP_LOADED_GIF_IMAGE = HRESULT($000D1040); + {$EXTERNALSYM NS_S_WMP_LOADED_GIF_IMAGE} + +// +// MessageId: NS_S_WMP_LOADED_PNG_IMAGE +// +// MessageText: +// +// Successfully loaded a PNG file.%0 +// + NS_S_WMP_LOADED_PNG_IMAGE = HRESULT($000D1041); + {$EXTERNALSYM NS_S_WMP_LOADED_PNG_IMAGE} + +// +// MessageId: NS_S_WMP_LOADED_BMP_IMAGE +// +// MessageText: +// +// Successfully loaded a BMP file.%0 +// + NS_S_WMP_LOADED_BMP_IMAGE = HRESULT($000D1042); + {$EXTERNALSYM NS_S_WMP_LOADED_BMP_IMAGE} + +// +// MessageId: NS_S_WMP_LOADED_JPG_IMAGE +// +// MessageText: +// +// Successfully loaded a JPG file.%0 +// + NS_S_WMP_LOADED_JPG_IMAGE = HRESULT($000D1043); + {$EXTERNALSYM NS_S_WMP_LOADED_JPG_IMAGE} + +// +// WMP WM Runtime Error codes +// +// +// MessageId: NS_E_WMG_RATEUNAVAILABLE +// +// MessageText: +// +// The requested playback rate is unavailable on this content.%0 +// + NS_E_WMG_RATEUNAVAILABLE = HRESULT($C00D104A); + {$EXTERNALSYM NS_E_WMG_RATEUNAVAILABLE} + +// +// MessageId: NS_E_WMG_PLUGINUNAVAILABLE +// +// MessageText: +// +// The rendering or digital signal processing plugin could not be instantiated.%0 +// + NS_E_WMG_PLUGINUNAVAILABLE = HRESULT($C00D104B); + {$EXTERNALSYM NS_E_WMG_PLUGINUNAVAILABLE} + +// +// MessageId: NS_E_WMG_CANNOTQUEUE +// +// MessageText: +// +// The file cannot be queued for seamless playback.%0 +// + NS_E_WMG_CANNOTQUEUE = HRESULT($C00D104C); + {$EXTERNALSYM NS_E_WMG_CANNOTQUEUE} + +// +// MessageId: NS_E_WMG_PREROLLLICENSEACQUISITIONNOTALLOWED +// +// MessageText: +// +// Windows Media Player cannot acquire the license for a file that is being prerolled.%0 +// + NS_E_WMG_PREROLLLICENSEACQUISITIONNOTALLOWED = HRESULT($C00D104D); + {$EXTERNALSYM NS_E_WMG_PREROLLLICENSEACQUISITIONNOTALLOWED} + +// +// MessageId: NS_E_WMG_UNEXPECTEDPREROLLSTATUS +// +// MessageText: +// +// Windows Media Player received an unexpected message while attempting to preroll a file.%0 +// + NS_E_WMG_UNEXPECTEDPREROLLSTATUS = HRESULT($C00D104E); + {$EXTERNALSYM NS_E_WMG_UNEXPECTEDPREROLLSTATUS} + +// +// MessageId: NS_E_WMG_INVALIDSTATE +// +// MessageText: +// +// Operation attempted in an invalid graph state.%0 +// + NS_E_WMG_INVALIDSTATE = HRESULT($C00D1054); + {$EXTERNALSYM NS_E_WMG_INVALIDSTATE} + +// +// MessageId: NS_E_WMG_SINKALREADYEXISTS +// +// MessageText: +// +// A renderer cannot be inserted in a stream while one already exists.%0 +// + NS_E_WMG_SINKALREADYEXISTS = HRESULT($C00D1055); + {$EXTERNALSYM NS_E_WMG_SINKALREADYEXISTS} + +// +// MessageId: NS_E_WMG_NOSDKINTERFACE +// +// MessageText: +// +// A necessary WM SDK interface to complete the operation doesn't exist at this time.%0 +// + NS_E_WMG_NOSDKINTERFACE = HRESULT($C00D1056); + {$EXTERNALSYM NS_E_WMG_NOSDKINTERFACE} + +// +// MessageId: NS_E_WMG_NOTALLOUTPUTSRENDERED +// +// MessageText: +// +// Windows Media Player cannot play the file. The file may be formatted with an unsupported codec, or the Player could not download the codec.%0 +// + NS_E_WMG_NOTALLOUTPUTSRENDERED = HRESULT($C00D1057); + {$EXTERNALSYM NS_E_WMG_NOTALLOUTPUTSRENDERED} + +// +// MessageId: NS_E_WMG_FILETRANSFERNOTALLOWED +// +// MessageText: +// +// File transfer streams are not allowed in the stand alone player.%0 +// + NS_E_WMG_FILETRANSFERNOTALLOWED = HRESULT($C00D1058); + {$EXTERNALSYM NS_E_WMG_FILETRANSFERNOTALLOWED} + +// +// MessageId: NS_E_WMR_UNSUPPORTEDSTREAM +// +// MessageText: +// +// Windows Media Player cannot play the file. The Player does not support the format you are trying to play.%0 +// + NS_E_WMR_UNSUPPORTEDSTREAM = HRESULT($C00D1059); + {$EXTERNALSYM NS_E_WMR_UNSUPPORTEDSTREAM} + +// +// MessageId: NS_E_WMR_PINNOTFOUND +// +// MessageText: +// +// An operation was attempted on a pin that doesn't exist in the DirectShow filter graph.%0 +// + NS_E_WMR_PINNOTFOUND = HRESULT($C00D105A); + {$EXTERNALSYM NS_E_WMR_PINNOTFOUND} + +// +// MessageId: NS_E_WMR_WAITINGONFORMATSWITCH +// +// MessageText: +// +// Specified operation cannot be completed while waiting for a media format change from the SDK.%0 +// + NS_E_WMR_WAITINGONFORMATSWITCH = HRESULT($C00D105B); + {$EXTERNALSYM NS_E_WMR_WAITINGONFORMATSWITCH} + +// +// MessageId: NS_E_WMR_NOSOURCEFILTER +// +// MessageText: +// +// Specified operation cannot be completed because the source filter does not exist.%0 +// + NS_E_WMR_NOSOURCEFILTER = HRESULT($C00D105C); + {$EXTERNALSYM NS_E_WMR_NOSOURCEFILTER} + +// +// MessageId: NS_E_WMR_PINTYPENOMATCH +// +// MessageText: +// +// The specified type does not match this pin.%0 +// + NS_E_WMR_PINTYPENOMATCH = HRESULT($C00D105D); + {$EXTERNALSYM NS_E_WMR_PINTYPENOMATCH} + +// +// MessageId: NS_E_WMR_NOCALLBACKAVAILABLE +// +// MessageText: +// +// The WMR Source Filter does not have a callback available.%0 +// + NS_E_WMR_NOCALLBACKAVAILABLE = HRESULT($C00D105E); + {$EXTERNALSYM NS_E_WMR_NOCALLBACKAVAILABLE} + +// +// MessageId: NS_S_WMR_ALREADYRENDERED +// +// MessageText: +// +// The specified stream has already been rendered.%0 +// + NS_S_WMR_ALREADYRENDERED = HRESULT($000D105F); + {$EXTERNALSYM NS_S_WMR_ALREADYRENDERED} + +// +// MessageId: NS_S_WMR_PINTYPEPARTIALMATCH +// +// MessageText: +// +// The specified type partially matches this pin type.%0 +// + NS_S_WMR_PINTYPEPARTIALMATCH = HRESULT($000D1060); + {$EXTERNALSYM NS_S_WMR_PINTYPEPARTIALMATCH} + +// +// MessageId: NS_S_WMR_PINTYPEFULLMATCH +// +// MessageText: +// +// The specified type fully matches this pin type.%0 +// + NS_S_WMR_PINTYPEFULLMATCH = HRESULT($000D1061); + {$EXTERNALSYM NS_S_WMR_PINTYPEFULLMATCH} + +// +// MessageId: NS_E_WMR_SAMPLEPROPERTYNOTSET +// +// MessageText: +// +// The specified property has not been set on this sample.%0 +// + NS_E_WMR_SAMPLEPROPERTYNOTSET = HRESULT($C00D1062); + {$EXTERNALSYM NS_E_WMR_SAMPLEPROPERTYNOTSET} + +// +// MessageId: NS_E_WMR_CANNOT_RENDER_BINARY_STREAM +// +// MessageText: +// +// A plugin is required to correctly play this file. To determine if this plugin is available to download from the Web, click Web Help.%0 +// + NS_E_WMR_CANNOT_RENDER_BINARY_STREAM = HRESULT($C00D1063); + {$EXTERNALSYM NS_E_WMR_CANNOT_RENDER_BINARY_STREAM} + +// +// MessageId: NS_E_WMG_LICENSE_TAMPERED +// +// MessageText: +// +// The file cannot be played, the content has been tampered.%0 +// + NS_E_WMG_LICENSE_TAMPERED = HRESULT($C00D1064); + {$EXTERNALSYM NS_E_WMG_LICENSE_TAMPERED} + +// +// MessageId: NS_E_WMR_WILLNOT_RENDER_BINARY_STREAM +// +// MessageText: +// +// The content you are trying to play is protected content and the player will not render binary streams from protected content.%0 +// + NS_E_WMR_WILLNOT_RENDER_BINARY_STREAM = HRESULT($C00D1065); + {$EXTERNALSYM NS_E_WMR_WILLNOT_RENDER_BINARY_STREAM} + +// +// WMP Playlist Error codes +// +// +// MessageId: NS_E_WMX_UNRECOGNIZED_PLAYLIST_FORMAT +// +// MessageText: +// +// The format of this file was not recognized as a valid playlist format.%0 +// + NS_E_WMX_UNRECOGNIZED_PLAYLIST_FORMAT = HRESULT($C00D1068); + {$EXTERNALSYM NS_E_WMX_UNRECOGNIZED_PLAYLIST_FORMAT} + +// +// MessageId: NS_E_ASX_INVALIDFORMAT +// +// MessageText: +// +// This file was believed to be an ASX playlist, but the format was not recognized.%0 +// + NS_E_ASX_INVALIDFORMAT = HRESULT($C00D1069); + {$EXTERNALSYM NS_E_ASX_INVALIDFORMAT} + +// +// MessageId: NS_E_ASX_INVALIDVERSION +// +// MessageText: +// +// The version of this playlist is not supported. Click More Information to go to the Microsoft web site and see if there is a newer version of the player to install.%0 +// + NS_E_ASX_INVALIDVERSION = HRESULT($C00D106A); + {$EXTERNALSYM NS_E_ASX_INVALIDVERSION} + +// +// MessageId: NS_E_ASX_INVALID_REPEAT_BLOCK +// +// MessageText: +// +// Format of a REPEAT loop within the current playlist file is invalid.%0 +// + NS_E_ASX_INVALID_REPEAT_BLOCK = HRESULT($C00D106B); + {$EXTERNALSYM NS_E_ASX_INVALID_REPEAT_BLOCK} + +// +// MessageId: NS_E_ASX_NOTHING_TO_WRITE +// +// MessageText: +// +// Windows Media Player cannot export the playlist because it is empty.%0 +// + NS_E_ASX_NOTHING_TO_WRITE = HRESULT($C00D106C); + {$EXTERNALSYM NS_E_ASX_NOTHING_TO_WRITE} + +// +// MessageId: NS_E_URLLIST_INVALIDFORMAT +// +// MessageText: +// +// Windows Media Player does not recognize this file as a supported playlist.%0 +// + NS_E_URLLIST_INVALIDFORMAT = HRESULT($C00D106D); + {$EXTERNALSYM NS_E_URLLIST_INVALIDFORMAT} + +// +// MessageId: NS_E_WMX_ATTRIBUTE_DOES_NOT_EXIST +// +// MessageText: +// +// The specified attribute does not exist.%0 +// + NS_E_WMX_ATTRIBUTE_DOES_NOT_EXIST = HRESULT($C00D106E); + {$EXTERNALSYM NS_E_WMX_ATTRIBUTE_DOES_NOT_EXIST} + +// +// MessageId: NS_E_WMX_ATTRIBUTE_ALREADY_EXISTS +// +// MessageText: +// +// The specified attribute already exists.%0 +// + NS_E_WMX_ATTRIBUTE_ALREADY_EXISTS = HRESULT($C00D106F); + {$EXTERNALSYM NS_E_WMX_ATTRIBUTE_ALREADY_EXISTS} + +// +// MessageId: NS_E_WMX_ATTRIBUTE_UNRETRIEVABLE +// +// MessageText: +// +// Can not retrieve the specified attribute.%0 +// + NS_E_WMX_ATTRIBUTE_UNRETRIEVABLE = HRESULT($C00D1070); + {$EXTERNALSYM NS_E_WMX_ATTRIBUTE_UNRETRIEVABLE} + +// +// MessageId: NS_E_WMX_ITEM_DOES_NOT_EXIST +// +// MessageText: +// +// The specified item does not exist in the current playlist.%0 +// + NS_E_WMX_ITEM_DOES_NOT_EXIST = HRESULT($C00D1071); + {$EXTERNALSYM NS_E_WMX_ITEM_DOES_NOT_EXIST} + +// +// MessageId: NS_E_WMX_ITEM_TYPE_ILLEGAL +// +// MessageText: +// +// Items of the specified type can not be created within the current playlist.%0 +// + NS_E_WMX_ITEM_TYPE_ILLEGAL = HRESULT($C00D1072); + {$EXTERNALSYM NS_E_WMX_ITEM_TYPE_ILLEGAL} + +// +// MessageId: NS_E_WMX_ITEM_UNSETTABLE +// +// MessageText: +// +// The specified item can not be set in the current playlist.%0 +// + NS_E_WMX_ITEM_UNSETTABLE = HRESULT($C00D1073); + {$EXTERNALSYM NS_E_WMX_ITEM_UNSETTABLE} + +// +// MessageId: NS_E_WMX_PLAYLIST_EMPTY +// +// MessageText: +// +// The specified playlist is empty.%0 +// + NS_E_WMX_PLAYLIST_EMPTY = HRESULT($C00D1074); + {$EXTERNALSYM NS_E_WMX_PLAYLIST_EMPTY} + +// +// MessageId: NS_E_MLS_SMARTPLAYLIST_FILTER_NOT_REGISTERED +// +// MessageText: +// +// Playlist load error: The specified autoplaylist contains a filter type which is either invalid or is not installed on this computer%0 +// + NS_E_MLS_SMARTPLAYLIST_FILTER_NOT_REGISTERED = HRESULT($C00D1075); + {$EXTERNALSYM NS_E_MLS_SMARTPLAYLIST_FILTER_NOT_REGISTERED} + +// +// MessageId: NS_E_WMX_INVALID_FORMAT_OVER_NESTING +// +// MessageText: +// +// Windows Media Player cannot play the file because the associated Windows Media metafile playlist is not valid.%0 +// + NS_E_WMX_INVALID_FORMAT_OVER_NESTING = HRESULT($C00D1076); + {$EXTERNALSYM NS_E_WMX_INVALID_FORMAT_OVER_NESTING} + +// +// WMP Core Error codes +// +// +// MessageId: NS_E_WMPCORE_NOSOURCEURLSTRING +// +// MessageText: +// +// Windows Media Player cannot find the file. Be sure the path is typed correctly. If it is, the file may not exist in the specified location, or the computer where the file is stored may be offline.%0 +// + NS_E_WMPCORE_NOSOURCEURLSTRING = HRESULT($C00D107C); + {$EXTERNALSYM NS_E_WMPCORE_NOSOURCEURLSTRING} + +// +// MessageId: NS_E_WMPCORE_COCREATEFAILEDFORGITOBJECT +// +// MessageText: +// +// Failed to create the Global Interface Table.%0 +// + NS_E_WMPCORE_COCREATEFAILEDFORGITOBJECT = HRESULT($C00D107D); + {$EXTERNALSYM NS_E_WMPCORE_COCREATEFAILEDFORGITOBJECT} + +// +// MessageId: NS_E_WMPCORE_FAILEDTOGETMARSHALLEDEVENTHANDLERINTERFACE +// +// MessageText: +// +// Failed to get the marshaled graph event handler interface.%0 +// + NS_E_WMPCORE_FAILEDTOGETMARSHALLEDEVENTHANDLERINTERFACE = HRESULT($C00D107E); + {$EXTERNALSYM NS_E_WMPCORE_FAILEDTOGETMARSHALLEDEVENTHANDLERINTERFACE} + +// +// MessageId: NS_E_WMPCORE_BUFFERTOOSMALL +// +// MessageText: +// +// Buffer is too small for copying media type.%0 +// + NS_E_WMPCORE_BUFFERTOOSMALL = HRESULT($C00D107F); + {$EXTERNALSYM NS_E_WMPCORE_BUFFERTOOSMALL} + +// +// MessageId: NS_E_WMPCORE_UNAVAILABLE +// +// MessageText: +// +// Current state of the player does not allow the operation.%0 +// + NS_E_WMPCORE_UNAVAILABLE = HRESULT($C00D1080); + {$EXTERNALSYM NS_E_WMPCORE_UNAVAILABLE} + +// +// MessageId: NS_E_WMPCORE_INVALIDPLAYLISTMODE +// +// MessageText: +// +// Playlist manager does not understand the current play mode (shuffle, normal etc).%0 +// + NS_E_WMPCORE_INVALIDPLAYLISTMODE = HRESULT($C00D1081); + {$EXTERNALSYM NS_E_WMPCORE_INVALIDPLAYLISTMODE} + +// +// MessageId: NS_E_WMPCORE_ITEMNOTINPLAYLIST +// +// MessageText: +// +// The item is not in the playlist.%0 +// + NS_E_WMPCORE_ITEMNOTINPLAYLIST = HRESULT($C00D1086); + {$EXTERNALSYM NS_E_WMPCORE_ITEMNOTINPLAYLIST} + +// +// MessageId: NS_E_WMPCORE_PLAYLISTEMPTY +// +// MessageText: +// +// There are no items in this playlist. Add items to the playlist, and try again.%0 +// + NS_E_WMPCORE_PLAYLISTEMPTY = HRESULT($C00D1087); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLISTEMPTY} + +// +// MessageId: NS_E_WMPCORE_NOBROWSER +// +// MessageText: +// +// The Web site cannot be accessed. A Web browser is not detected on your computer.%0 +// + NS_E_WMPCORE_NOBROWSER = HRESULT($C00D1088); + {$EXTERNALSYM NS_E_WMPCORE_NOBROWSER} + +// +// MessageId: NS_E_WMPCORE_UNRECOGNIZED_MEDIA_URL +// +// MessageText: +// +// Windows Media Player cannot find the specified file. Be sure the path is typed correctly. If it is, the file does not exist in the specified location, or the computer where the file is stored is offline.%0 +// + NS_E_WMPCORE_UNRECOGNIZED_MEDIA_URL = HRESULT($C00D1089); + {$EXTERNALSYM NS_E_WMPCORE_UNRECOGNIZED_MEDIA_URL} + +// +// MessageId: NS_E_WMPCORE_GRAPH_NOT_IN_LIST +// +// MessageText: +// +// Graph with the specified URL was not found in the prerolled graph list.%0 +// + NS_E_WMPCORE_GRAPH_NOT_IN_LIST = HRESULT($C00D108A); + {$EXTERNALSYM NS_E_WMPCORE_GRAPH_NOT_IN_LIST} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_EMPTY_OR_SINGLE_MEDIA +// +// MessageText: +// +// There is only one item in the playlist.%0 +// + NS_E_WMPCORE_PLAYLIST_EMPTY_OR_SINGLE_MEDIA = HRESULT($C00D108B); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_EMPTY_OR_SINGLE_MEDIA} + +// +// MessageId: NS_E_WMPCORE_ERRORSINKNOTREGISTERED +// +// MessageText: +// +// An error sink was never registered for the calling object.%0 +// + NS_E_WMPCORE_ERRORSINKNOTREGISTERED = HRESULT($C00D108C); + {$EXTERNALSYM NS_E_WMPCORE_ERRORSINKNOTREGISTERED} + +// +// MessageId: NS_E_WMPCORE_ERRORMANAGERNOTAVAILABLE +// +// MessageText: +// +// The error manager is not available to respond to errors.%0 +// + NS_E_WMPCORE_ERRORMANAGERNOTAVAILABLE = HRESULT($C00D108D); + {$EXTERNALSYM NS_E_WMPCORE_ERRORMANAGERNOTAVAILABLE} + +// +// MessageId: NS_E_WMPCORE_WEBHELPFAILED +// +// MessageText: +// +// Failed launching WebHelp URL.%0 +// + NS_E_WMPCORE_WEBHELPFAILED = HRESULT($C00D108E); + {$EXTERNALSYM NS_E_WMPCORE_WEBHELPFAILED} + +// +// MessageId: NS_E_WMPCORE_MEDIA_ERROR_RESUME_FAILED +// +// MessageText: +// +// Could not resume playing next item in playlist.%0 +// + NS_E_WMPCORE_MEDIA_ERROR_RESUME_FAILED = HRESULT($C00D108F); + {$EXTERNALSYM NS_E_WMPCORE_MEDIA_ERROR_RESUME_FAILED} + +// +// MessageId: NS_E_WMPCORE_NO_REF_IN_ENTRY +// +// MessageText: +// +// Windows Media Player cannot play the file because the associated Windows Media metafile playlist is not valid.%0 +// + NS_E_WMPCORE_NO_REF_IN_ENTRY = HRESULT($C00D1090); + {$EXTERNALSYM NS_E_WMPCORE_NO_REF_IN_ENTRY} + +// +// MessageId: NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_NAME_EMPTY +// +// MessageText: +// +// An empty string for playlist attribute name was found.%0 +// + NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_NAME_EMPTY = HRESULT($C00D1091); + {$EXTERNALSYM NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_NAME_EMPTY} + +// +// MessageId: NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_NAME_ILLEGAL +// +// MessageText: +// +// An invalid playlist attribute name was found.%0 +// + NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_NAME_ILLEGAL = HRESULT($C00D1092); + {$EXTERNALSYM NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_NAME_ILLEGAL} + +// +// MessageId: NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_VALUE_EMPTY +// +// MessageText: +// +// An empty string for a playlist attribute value was found.%0 +// + NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_VALUE_EMPTY = HRESULT($C00D1093); + {$EXTERNALSYM NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_VALUE_EMPTY} + +// +// MessageId: NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_VALUE_ILLEGAL +// +// MessageText: +// +// An illegal value for a playlist attribute was found.%0 +// + NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_VALUE_ILLEGAL = HRESULT($C00D1094); + {$EXTERNALSYM NS_E_WMPCORE_WMX_LIST_ATTRIBUTE_VALUE_ILLEGAL} + +// +// MessageId: NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_NAME_EMPTY +// +// MessageText: +// +// An empty string for a playlist item attribute name was found.%0 +// + NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_NAME_EMPTY = HRESULT($C00D1095); + {$EXTERNALSYM NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_NAME_EMPTY} + +// +// MessageId: NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_NAME_ILLEGAL +// +// MessageText: +// +// An illegal value for a playlist item attribute name was found.%0 +// + NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_NAME_ILLEGAL = HRESULT($C00D1096); + {$EXTERNALSYM NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_NAME_ILLEGAL} + +// +// MessageId: NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_VALUE_EMPTY +// +// MessageText: +// +// An illegal value for a playlist item attribute was found.%0 +// + NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_VALUE_EMPTY = HRESULT($C00D1097); + {$EXTERNALSYM NS_E_WMPCORE_WMX_LIST_ITEM_ATTRIBUTE_VALUE_EMPTY} + +// +// MessageId: NS_E_WMPCORE_LIST_ENTRY_NO_REF +// +// MessageText: +// +// No entries found in the playlist file.%0 +// + NS_E_WMPCORE_LIST_ENTRY_NO_REF = HRESULT($C00D1098); + {$EXTERNALSYM NS_E_WMPCORE_LIST_ENTRY_NO_REF} + +// +// MessageId: NS_E_WMPCORE_MISNAMED_FILE +// +// MessageText: +// +// Windows Media Player cannot play the file. The file is either corrupt or the Player does not support the format you are trying to play.%0 +// + NS_E_WMPCORE_MISNAMED_FILE = HRESULT($C00D1099); + {$EXTERNALSYM NS_E_WMPCORE_MISNAMED_FILE} + +// +// MessageId: NS_E_WMPCORE_CODEC_NOT_TRUSTED +// +// MessageText: +// +// The codec downloaded for this media does not appear to be properly signed. Installation is not possible.%0 +// + NS_E_WMPCORE_CODEC_NOT_TRUSTED = HRESULT($C00D109A); + {$EXTERNALSYM NS_E_WMPCORE_CODEC_NOT_TRUSTED} + +// +// MessageId: NS_E_WMPCORE_CODEC_NOT_FOUND +// +// MessageText: +// +// Windows Media Player cannot play the file. One or more codecs required to play the file could not be found.%0 +// + NS_E_WMPCORE_CODEC_NOT_FOUND = HRESULT($C00D109B); + {$EXTERNALSYM NS_E_WMPCORE_CODEC_NOT_FOUND} + +// +// MessageId: NS_E_WMPCORE_CODEC_DOWNLOAD_NOT_ALLOWED +// +// MessageText: +// +// Some of the codecs required by this media are not installed on your system. Since the option for automatic codec acquisition is disabled, no codecs will be downloaded.%0 +// + NS_E_WMPCORE_CODEC_DOWNLOAD_NOT_ALLOWED = HRESULT($C00D109C); + {$EXTERNALSYM NS_E_WMPCORE_CODEC_DOWNLOAD_NOT_ALLOWED} + +// +// MessageId: NS_E_WMPCORE_ERROR_DOWNLOADING_PLAYLIST +// +// MessageText: +// +// Failed to download the playlist file.%0 +// + NS_E_WMPCORE_ERROR_DOWNLOADING_PLAYLIST = HRESULT($C00D109D); + {$EXTERNALSYM NS_E_WMPCORE_ERROR_DOWNLOADING_PLAYLIST} + +// +// MessageId: NS_E_WMPCORE_FAILED_TO_BUILD_PLAYLIST +// +// MessageText: +// +// Failed to build the playlist.%0 +// + NS_E_WMPCORE_FAILED_TO_BUILD_PLAYLIST = HRESULT($C00D109E); + {$EXTERNALSYM NS_E_WMPCORE_FAILED_TO_BUILD_PLAYLIST} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_NONE +// +// MessageText: +// +// Playlist has no alternates to switch into.%0 +// + NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_NONE = HRESULT($C00D109F); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_NONE} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_EXHAUSTED +// +// MessageText: +// +// No more playlist alternates available to switch to.%0 +// + NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_EXHAUSTED = HRESULT($C00D10A0); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_EXHAUSTED} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_NAME_NOT_FOUND +// +// MessageText: +// +// Could not find the name of the alternate playlist to switch into.%0 +// + NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_NAME_NOT_FOUND = HRESULT($C00D10A1); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_NAME_NOT_FOUND} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_MORPH_FAILED +// +// MessageText: +// +// Failed to switch to an alternate for this media.%0 +// + NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_MORPH_FAILED = HRESULT($C00D10A2); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_MORPH_FAILED} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_INIT_FAILED +// +// MessageText: +// +// Failed to initialize an alternate for the media.%0 +// + NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_INIT_FAILED = HRESULT($C00D10A3); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_ITEM_ALTERNATE_INIT_FAILED} + +// +// MessageId: NS_E_WMPCORE_MEDIA_ALTERNATE_REF_EMPTY +// +// MessageText: +// +// No URL specified for the roll over Refs in the playlist file.%0 +// + NS_E_WMPCORE_MEDIA_ALTERNATE_REF_EMPTY = HRESULT($C00D10A4); + {$EXTERNALSYM NS_E_WMPCORE_MEDIA_ALTERNATE_REF_EMPTY} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_NO_EVENT_NAME +// +// MessageText: +// +// Encountered a playlist with no name.%0 +// + NS_E_WMPCORE_PLAYLIST_NO_EVENT_NAME = HRESULT($C00D10A5); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_NO_EVENT_NAME} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_EVENT_ATTRIBUTE_ABSENT +// +// MessageText: +// +// A required attribute in the event block of the playlist was not found.%0 +// + NS_E_WMPCORE_PLAYLIST_EVENT_ATTRIBUTE_ABSENT = HRESULT($C00D10A6); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_EVENT_ATTRIBUTE_ABSENT} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_EVENT_EMPTY +// +// MessageText: +// +// No items were found in the event block of the playlist.%0 +// + NS_E_WMPCORE_PLAYLIST_EVENT_EMPTY = HRESULT($C00D10A7); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_EVENT_EMPTY} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_STACK_EMPTY +// +// MessageText: +// +// No playlist was found while returning from a nested playlist.%0 +// + NS_E_WMPCORE_PLAYLIST_STACK_EMPTY = HRESULT($C00D10A8); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_STACK_EMPTY} + +// +// MessageId: NS_E_WMPCORE_CURRENT_MEDIA_NOT_ACTIVE +// +// MessageText: +// +// The media item is not active currently.%0 +// + NS_E_WMPCORE_CURRENT_MEDIA_NOT_ACTIVE = HRESULT($C00D10A9); + {$EXTERNALSYM NS_E_WMPCORE_CURRENT_MEDIA_NOT_ACTIVE} + +// +// MessageId: NS_E_WMPCORE_USER_CANCEL +// +// MessageText: +// +// Open was aborted by user.%0 +// + NS_E_WMPCORE_USER_CANCEL = HRESULT($C00D10AB); + {$EXTERNALSYM NS_E_WMPCORE_USER_CANCEL} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_REPEAT_EMPTY +// +// MessageText: +// +// No items were found inside the playlist repeat block.%0 +// + NS_E_WMPCORE_PLAYLIST_REPEAT_EMPTY = HRESULT($C00D10AC); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_REPEAT_EMPTY} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_REPEAT_START_MEDIA_NONE +// +// MessageText: +// +// Media object corresponding to start of a playlist repeat block was not found.%0 +// + NS_E_WMPCORE_PLAYLIST_REPEAT_START_MEDIA_NONE = HRESULT($C00D10AD); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_REPEAT_START_MEDIA_NONE} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_REPEAT_END_MEDIA_NONE +// +// MessageText: +// +// Media object corresponding to the end of a playlist repeat block was not found.%0 +// + NS_E_WMPCORE_PLAYLIST_REPEAT_END_MEDIA_NONE = HRESULT($C00D10AE); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_REPEAT_END_MEDIA_NONE} + +// +// MessageId: NS_E_WMPCORE_INVALID_PLAYLIST_URL +// +// MessageText: +// +// Playlist URL supplied to the playlist manager is invalid.%0 +// + NS_E_WMPCORE_INVALID_PLAYLIST_URL = HRESULT($C00D10AF); + {$EXTERNALSYM NS_E_WMPCORE_INVALID_PLAYLIST_URL} + +// +// MessageId: NS_E_WMPCORE_MISMATCHED_RUNTIME +// +// MessageText: +// +// Windows Media Player cannot play the file because it is corrupted.%0 +// + NS_E_WMPCORE_MISMATCHED_RUNTIME = HRESULT($C00D10B0); + {$EXTERNALSYM NS_E_WMPCORE_MISMATCHED_RUNTIME} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_IMPORT_FAILED_NO_ITEMS +// +// MessageText: +// +// Windows Media Player cannot import the playlist to Media Library because the playlist is empty.%0 +// + NS_E_WMPCORE_PLAYLIST_IMPORT_FAILED_NO_ITEMS = HRESULT($C00D10B1); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_IMPORT_FAILED_NO_ITEMS} + +// +// MessageId: NS_E_WMPCORE_VIDEO_TRANSFORM_FILTER_INSERTION +// +// MessageText: +// +// An error has occurred that could prevent the changing of the video contrast on this media.%0 +// + NS_E_WMPCORE_VIDEO_TRANSFORM_FILTER_INSERTION = HRESULT($C00D10B2); + {$EXTERNALSYM NS_E_WMPCORE_VIDEO_TRANSFORM_FILTER_INSERTION} + +// +// MessageId: NS_E_WMPCORE_MEDIA_UNAVAILABLE +// +// MessageText: +// +// Windows Media Player cannot play this file. Connect to the Internet or insert the removable media on which the file is located, and then try to play the file again.%0 +// + NS_E_WMPCORE_MEDIA_UNAVAILABLE = HRESULT($C00D10B3); + {$EXTERNALSYM NS_E_WMPCORE_MEDIA_UNAVAILABLE} + +// +// MessageId: NS_E_WMPCORE_WMX_ENTRYREF_NO_REF +// +// MessageText: +// +// The playlist contains an ENTRYREF for which no href was parsed. Check the syntax of playlist file.%0 +// + NS_E_WMPCORE_WMX_ENTRYREF_NO_REF = HRESULT($C00D10B4); + {$EXTERNALSYM NS_E_WMPCORE_WMX_ENTRYREF_NO_REF} + +// +// MessageId: NS_E_WMPCORE_NO_PLAYABLE_MEDIA_IN_PLAYLIST +// +// MessageText: +// +// Windows Media Player cannot play any items in this playlist. For additional information, right-click an item that cannot be played, and then click Error Details.%0 +// + NS_E_WMPCORE_NO_PLAYABLE_MEDIA_IN_PLAYLIST = HRESULT($C00D10B5); + {$EXTERNALSYM NS_E_WMPCORE_NO_PLAYABLE_MEDIA_IN_PLAYLIST} + +// +// MessageId: NS_E_WMPCORE_PLAYLIST_EMPTY_NESTED_PLAYLIST_SKIPPED_ITEMS +// +// MessageText: +// +// Windows Media Player cannot play some or all of the playlist items.%0 +// + NS_E_WMPCORE_PLAYLIST_EMPTY_NESTED_PLAYLIST_SKIPPED_ITEMS = HRESULT($C00D10B6); + {$EXTERNALSYM NS_E_WMPCORE_PLAYLIST_EMPTY_NESTED_PLAYLIST_SKIPPED_ITEMS} + +// +// MessageId: NS_E_WMPCORE_BUSY +// +// MessageText: +// +// Windows Media Player cannot play the file at this time. Try again later.%0 +// + NS_E_WMPCORE_BUSY = HRESULT($C00D10B7); + {$EXTERNALSYM NS_E_WMPCORE_BUSY} + +// +// MessageId: NS_E_WMPCORE_MEDIA_CHILD_PLAYLIST_UNAVAILABLE +// +// MessageText: +// +// There is no child playlist available for this media item at this time.%0 +// + NS_E_WMPCORE_MEDIA_CHILD_PLAYLIST_UNAVAILABLE = HRESULT($C00D10B8); + {$EXTERNALSYM NS_E_WMPCORE_MEDIA_CHILD_PLAYLIST_UNAVAILABLE} + +// +// MessageId: NS_E_WMPCORE_MEDIA_NO_CHILD_PLAYLIST +// +// MessageText: +// +// There is no child playlist for this media item.%0 +// + NS_E_WMPCORE_MEDIA_NO_CHILD_PLAYLIST = HRESULT($C00D10B9); + {$EXTERNALSYM NS_E_WMPCORE_MEDIA_NO_CHILD_PLAYLIST} + +// +// MessageId: NS_E_WMPCORE_FILE_NOT_FOUND +// +// MessageText: +// +// Windows Media Player cannot play one or more files. Right-click the file, and then click Error Details to view information about the error.%0 +// + NS_E_WMPCORE_FILE_NOT_FOUND = HRESULT($C00D10BA); + {$EXTERNALSYM NS_E_WMPCORE_FILE_NOT_FOUND} + +// +// MessageId: NS_E_WMPCORE_TEMP_FILE_NOT_FOUND +// +// MessageText: +// +// The temporary file was not found.%0 +// + NS_E_WMPCORE_TEMP_FILE_NOT_FOUND = HRESULT($C00D10BB); + {$EXTERNALSYM NS_E_WMPCORE_TEMP_FILE_NOT_FOUND} + +// +// MessageId: NS_E_WMDM_REVOKED +// +// MessageText: +// +// Windows Media Player cannot transfer media to the portable device without an update. Please click More Information to find out how to update your device.%0 +// + NS_E_WMDM_REVOKED = HRESULT($C00D10BC); + {$EXTERNALSYM NS_E_WMDM_REVOKED} + +// +// MessageId: NS_E_DDRAW_GENERIC +// +// MessageText: +// +// Windows Media Player cannot play the video stream because of a problem with your video card.%0 +// + NS_E_DDRAW_GENERIC = HRESULT($C00D10BD); + {$EXTERNALSYM NS_E_DDRAW_GENERIC} + +// +// MessageId: NS_E_DISPLAY_MODE_CHANGE_FAILED +// +// MessageText: +// +// Windows Media Player failed to change the screen mode for fullscreen video playback.%0 +// + NS_E_DISPLAY_MODE_CHANGE_FAILED = HRESULT($C00D10BE); + {$EXTERNALSYM NS_E_DISPLAY_MODE_CHANGE_FAILED} + +// +// MessageId: NS_E_PLAYLIST_CONTAINS_ERRORS +// +// MessageText: +// +// One or more items in the playlist cannot be played. For more details, right-click an item in the playlist, and then click Error Details.%0 +// + NS_E_PLAYLIST_CONTAINS_ERRORS = HRESULT($C00D10BF); + {$EXTERNALSYM NS_E_PLAYLIST_CONTAINS_ERRORS} + +// +// MessageId: NS_E_CHANGING_PROXY_NAME +// +// MessageText: +// +// Can't change proxy name if the proxy setting is not set to custom.%0 +// + NS_E_CHANGING_PROXY_NAME = HRESULT($C00D10C0); + {$EXTERNALSYM NS_E_CHANGING_PROXY_NAME} + +// +// MessageId: NS_E_CHANGING_PROXY_PORT +// +// MessageText: +// +// Can't change proxy port if the proxy setting is not set to custom.%0 +// + NS_E_CHANGING_PROXY_PORT = HRESULT($C00D10C1); + {$EXTERNALSYM NS_E_CHANGING_PROXY_PORT} + +// +// MessageId: NS_E_CHANGING_PROXY_EXCEPTIONLIST +// +// MessageText: +// +// Can't change proxy exception list if the proxy setting is not set to custom.%0 +// + NS_E_CHANGING_PROXY_EXCEPTIONLIST = HRESULT($C00D10C2); + {$EXTERNALSYM NS_E_CHANGING_PROXY_EXCEPTIONLIST} + +// +// MessageId: NS_E_CHANGING_PROXYBYPASS +// +// MessageText: +// +// Can't change proxy bypass flag if the proxy setting is not set to custom.%0 +// + NS_E_CHANGING_PROXYBYPASS = HRESULT($C00D10C3); + {$EXTERNALSYM NS_E_CHANGING_PROXYBYPASS} + +// +// MessageId: NS_E_CHANGING_PROXY_PROTOCOL_NOT_FOUND +// +// MessageText: +// +// Can't find specified protocol.%0 +// + NS_E_CHANGING_PROXY_PROTOCOL_NOT_FOUND = HRESULT($C00D10C4); + {$EXTERNALSYM NS_E_CHANGING_PROXY_PROTOCOL_NOT_FOUND} + +// +// MessageId: NS_E_GRAPH_NOAUDIOLANGUAGE +// +// MessageText: +// +// Can't change language settings. Either the graph has no audio, or the audio only supports one language.%0 +// + NS_E_GRAPH_NOAUDIOLANGUAGE = HRESULT($C00D10C5); + {$EXTERNALSYM NS_E_GRAPH_NOAUDIOLANGUAGE} + +// +// MessageId: NS_E_GRAPH_NOAUDIOLANGUAGESELECTED +// +// MessageText: +// +// The graph has no audio language selected.%0 +// + NS_E_GRAPH_NOAUDIOLANGUAGESELECTED = HRESULT($C00D10C6); + {$EXTERNALSYM NS_E_GRAPH_NOAUDIOLANGUAGESELECTED} + +// +// MessageId: NS_E_CORECD_NOTAMEDIACD +// +// MessageText: +// +// This is not a media CD.%0 +// + NS_E_CORECD_NOTAMEDIACD = HRESULT($C00D10C7); + {$EXTERNALSYM NS_E_CORECD_NOTAMEDIACD} + +// +// MessageId: NS_E_WMPCORE_MEDIA_URL_TOO_LONG +// +// MessageText: +// +// Windows Media Player cannot play this file because the URL is too long.%0 +// + NS_E_WMPCORE_MEDIA_URL_TOO_LONG = HRESULT($C00D10C8); + {$EXTERNALSYM NS_E_WMPCORE_MEDIA_URL_TOO_LONG} + +// +// MessageId: NS_E_WMPFLASH_CANT_FIND_COM_SERVER +// +// MessageText: +// +// Windows Media Player needs the Macromedia Flash Player to play this content. Windows Media Player was not able to detect the Flash player on your system. To play the selected item, you must install the Macromedia Flash Player from the Macromedia Web site, and then try to play the item again.%0 +// + NS_E_WMPFLASH_CANT_FIND_COM_SERVER = HRESULT($C00D10C9); + {$EXTERNALSYM NS_E_WMPFLASH_CANT_FIND_COM_SERVER} + +// +// MessageId: NS_E_WMPFLASH_INCOMPATIBLEVERSION +// +// MessageText: +// +// To play the selected item, you must install an updated version of the Macromedia Flash Player from the Macromedia Web site, and then try to play the item again.%0 +// + NS_E_WMPFLASH_INCOMPATIBLEVERSION = HRESULT($C00D10CA); + {$EXTERNALSYM NS_E_WMPFLASH_INCOMPATIBLEVERSION} + +// +// MessageId: NS_E_WMPOCXGRAPH_IE_DISALLOWS_ACTIVEX_CONTROLS +// +// MessageText: +// +// The use of ActiveX controls has been turned off in Internet Explorer. As a result Windows Media Player will not be able to playback this content.%0 +// + NS_E_WMPOCXGRAPH_IE_DISALLOWS_ACTIVEX_CONTROLS = HRESULT($C00D10CB); + {$EXTERNALSYM NS_E_WMPOCXGRAPH_IE_DISALLOWS_ACTIVEX_CONTROLS} + +// +// MessageId: NS_E_NEED_CORE_REFERENCE +// +// MessageText: +// +// The use of this method requires an existing reference to the Player object.%0 +// + NS_E_NEED_CORE_REFERENCE = HRESULT($C00D10CC); + {$EXTERNALSYM NS_E_NEED_CORE_REFERENCE} + +// +// MessageId: NS_E_MEDIACD_READ_ERROR +// +// MessageText: +// +// There was an error reading from the CD-ROM.%0 +// + NS_E_MEDIACD_READ_ERROR = HRESULT($C00D10CD); + {$EXTERNALSYM NS_E_MEDIACD_READ_ERROR} + +// +// MessageId: NS_E_IE_DISALLOWS_ACTIVEX_CONTROLS +// +// MessageText: +// +// Internet Explorer is set to disallow ActiveX controls.%0 +// + NS_E_IE_DISALLOWS_ACTIVEX_CONTROLS = HRESULT($C00D10CE); + {$EXTERNALSYM NS_E_IE_DISALLOWS_ACTIVEX_CONTROLS} + +// +// MessageId: NS_E_FLASH_PLAYBACK_NOT_ALLOWED +// +// MessageText: +// +// Flash playback has been turned off in Windows Media Player.%0 +// + NS_E_FLASH_PLAYBACK_NOT_ALLOWED = HRESULT($C00D10CF); + {$EXTERNALSYM NS_E_FLASH_PLAYBACK_NOT_ALLOWED} + +// +// MessageId: NS_E_UNABLE_TO_CREATE_RIP_LOCATION +// +// MessageText: +// +// Media Player was unable to create a valid location to copy the CD track.%0 +// + NS_E_UNABLE_TO_CREATE_RIP_LOCATION = HRESULT($C00D10D0); + {$EXTERNALSYM NS_E_UNABLE_TO_CREATE_RIP_LOCATION} + +// +// MessageId: NS_E_WMPCORE_SOME_CODECS_MISSING +// +// MessageText: +// +// One or more codecs required to open this content could not be found.%0 +// + NS_E_WMPCORE_SOME_CODECS_MISSING = HRESULT($C00D10D1); + {$EXTERNALSYM NS_E_WMPCORE_SOME_CODECS_MISSING} + +// +// WMP Core Success codes +// +// +// MessageId: NS_S_WMPCORE_PLAYLISTCLEARABORT +// +// MessageText: +// +// Failed to clear playlist because it was aborted by user.%0 +// + NS_S_WMPCORE_PLAYLISTCLEARABORT = HRESULT($000D10FE); + {$EXTERNALSYM NS_S_WMPCORE_PLAYLISTCLEARABORT} + +// +// MessageId: NS_S_WMPCORE_PLAYLISTREMOVEITEMABORT +// +// MessageText: +// +// Failed to remove item in the playlist since it was aborted by user.%0 +// + NS_S_WMPCORE_PLAYLISTREMOVEITEMABORT = HRESULT($000D10FF); + {$EXTERNALSYM NS_S_WMPCORE_PLAYLISTREMOVEITEMABORT} + +// +// MessageId: NS_S_WMPCORE_PLAYLIST_CREATION_PENDING +// +// MessageText: +// +// Playlist is being generated asynchronously.%0 +// + NS_S_WMPCORE_PLAYLIST_CREATION_PENDING = HRESULT($000D1102); + {$EXTERNALSYM NS_S_WMPCORE_PLAYLIST_CREATION_PENDING} + +// +// MessageId: NS_S_WMPCORE_MEDIA_VALIDATION_PENDING +// +// MessageText: +// +// Validation of the media is pending...%0 +// + NS_S_WMPCORE_MEDIA_VALIDATION_PENDING = HRESULT($000D1103); + {$EXTERNALSYM NS_S_WMPCORE_MEDIA_VALIDATION_PENDING} + +// +// MessageId: NS_S_WMPCORE_PLAYLIST_REPEAT_SECONDARY_SEGMENTS_IGNORED +// +// MessageText: +// +// Encountered more than one Repeat block during ASX processing.%0 +// + NS_S_WMPCORE_PLAYLIST_REPEAT_SECONDARY_SEGMENTS_IGNORED = HRESULT($000D1104); + {$EXTERNALSYM NS_S_WMPCORE_PLAYLIST_REPEAT_SECONDARY_SEGMENTS_IGNORED} + +// +// MessageId: NS_S_WMPCORE_COMMAND_NOT_AVAILABLE +// +// MessageText: +// +// Current state of WMP disallows calling this method or property.%0 +// + NS_S_WMPCORE_COMMAND_NOT_AVAILABLE = HRESULT($000D1105); + {$EXTERNALSYM NS_S_WMPCORE_COMMAND_NOT_AVAILABLE} + +// +// MessageId: NS_S_WMPCORE_PLAYLIST_NAME_AUTO_GENERATED +// +// MessageText: +// +// Name for the playlist has been auto generated.%0 +// + NS_S_WMPCORE_PLAYLIST_NAME_AUTO_GENERATED = HRESULT($000D1106); + {$EXTERNALSYM NS_S_WMPCORE_PLAYLIST_NAME_AUTO_GENERATED} + +// +// MessageId: NS_S_WMPCORE_PLAYLIST_IMPORT_MISSING_ITEMS +// +// MessageText: +// +// The imported playlist does not contain all items from the original.%0 +// + NS_S_WMPCORE_PLAYLIST_IMPORT_MISSING_ITEMS = HRESULT($000D1107); + {$EXTERNALSYM NS_S_WMPCORE_PLAYLIST_IMPORT_MISSING_ITEMS} + +// +// MessageId: NS_S_WMPCORE_PLAYLIST_COLLAPSED_TO_SINGLE_MEDIA +// +// MessageText: +// +// The M3U playlist has been ignored because it only contains one item.%0 +// + NS_S_WMPCORE_PLAYLIST_COLLAPSED_TO_SINGLE_MEDIA = HRESULT($000D1108); + {$EXTERNALSYM NS_S_WMPCORE_PLAYLIST_COLLAPSED_TO_SINGLE_MEDIA} + +// +// MessageId: NS_S_WMPCORE_MEDIA_CHILD_PLAYLIST_OPEN_PENDING +// +// MessageText: +// +// The open for the child playlist associated with this media is pending.%0 +// + NS_S_WMPCORE_MEDIA_CHILD_PLAYLIST_OPEN_PENDING = HRESULT($000D1109); + {$EXTERNALSYM NS_S_WMPCORE_MEDIA_CHILD_PLAYLIST_OPEN_PENDING} + +// +// MessageId: NS_S_WMPCORE_MORE_NODES_AVAIABLE +// +// MessageText: +// +// More nodes support the interface requested, but the array for returning them is full.%0 +// + NS_S_WMPCORE_MORE_NODES_AVAIABLE = HRESULT($000D110A); + {$EXTERNALSYM NS_S_WMPCORE_MORE_NODES_AVAIABLE} + +// +// WMP Internet Manager error codes +// +// +// MessageId: NS_E_WMPIM_USEROFFLINE +// +// MessageText: +// +// Windows Media Player has detected that you are not connected to the Internet. Connect to the Internet, and then try again.%0 +// + NS_E_WMPIM_USEROFFLINE = HRESULT($C00D1126); + {$EXTERNALSYM NS_E_WMPIM_USEROFFLINE} + +// +// MessageId: NS_E_WMPIM_USERCANCELED +// +// MessageText: +// +// User cancelled attempt to connect to the Internet.%0 +// + NS_E_WMPIM_USERCANCELED = HRESULT($C00D1127); + {$EXTERNALSYM NS_E_WMPIM_USERCANCELED} + +// +// MessageId: NS_E_WMPIM_DIALUPFAILED +// +// MessageText: +// +// Attempt to dial connection to the Internet failed.%0 +// + NS_E_WMPIM_DIALUPFAILED = HRESULT($C00D1128); + {$EXTERNALSYM NS_E_WMPIM_DIALUPFAILED} + +// +// MessageId: NS_E_WINSOCK_ERROR_STRING +// +// MessageText: +// +// Windows Media Player has encountered an unknown network error.%0 +// + NS_E_WINSOCK_ERROR_STRING = HRESULT($C00D1129); + {$EXTERNALSYM NS_E_WINSOCK_ERROR_STRING} + +// +// WMP Backup and restore error and success codes +// +// +// MessageId: NS_E_WMPBR_NOLISTENER +// +// MessageText: +// +// No window is currently listening to Backup and Restore events.%0 +// + NS_E_WMPBR_NOLISTENER = HRESULT($C00D1130); + {$EXTERNALSYM NS_E_WMPBR_NOLISTENER} + +// +// MessageId: NS_E_WMPBR_BACKUPCANCEL +// +// MessageText: +// +// Backup of your licenses has been cancelled. Please try again to ensure license backup.%0 +// + NS_E_WMPBR_BACKUPCANCEL = HRESULT($C00D1131); + {$EXTERNALSYM NS_E_WMPBR_BACKUPCANCEL} + +// +// MessageId: NS_E_WMPBR_RESTORECANCEL +// +// MessageText: +// +// The licenses were not restored because the restoration was cancelled.%0 +// + NS_E_WMPBR_RESTORECANCEL = HRESULT($C00D1132); + {$EXTERNALSYM NS_E_WMPBR_RESTORECANCEL} + +// +// MessageId: NS_E_WMPBR_ERRORWITHURL +// +// MessageText: +// +// An error occurred during the backup or restore operation that requires a web page be displayed to the user.%0 +// + NS_E_WMPBR_ERRORWITHURL = HRESULT($C00D1133); + {$EXTERNALSYM NS_E_WMPBR_ERRORWITHURL} + +// +// MessageId: NS_E_WMPBR_NAMECOLLISION +// +// MessageText: +// +// The licenses were not backed up because the backup was cancelled.%0 +// + NS_E_WMPBR_NAMECOLLISION = HRESULT($C00D1134); + {$EXTERNALSYM NS_E_WMPBR_NAMECOLLISION} + +// +// MessageId: NS_S_WMPBR_SUCCESS +// +// MessageText: +// +// Backup or Restore successful!.%0 +// + NS_S_WMPBR_SUCCESS = HRESULT($000D1135); + {$EXTERNALSYM NS_S_WMPBR_SUCCESS} + +// +// MessageId: NS_S_WMPBR_PARTIALSUCCESS +// +// MessageText: +// +// Transfer complete with limitations.%0 +// + NS_S_WMPBR_PARTIALSUCCESS = HRESULT($000D1136); + {$EXTERNALSYM NS_S_WMPBR_PARTIALSUCCESS} + +// +// MessageId: NS_E_WMPBR_DRIVE_INVALID +// +// MessageText: +// +// The location specified for restoring licenses is not valid. Choose another location, and then try again.%0 +// + NS_E_WMPBR_DRIVE_INVALID = HRESULT($C00D1137); + {$EXTERNALSYM NS_E_WMPBR_DRIVE_INVALID} + +// +// WMP Effects Success codes +// +// +// MessageId: NS_S_WMPEFFECT_TRANSPARENT +// +// MessageText: +// +// Request to the effects control to change transparency status to transparent.%0 +// + NS_S_WMPEFFECT_TRANSPARENT = HRESULT($000D1144); + {$EXTERNALSYM NS_S_WMPEFFECT_TRANSPARENT} + +// +// MessageId: NS_S_WMPEFFECT_OPAQUE +// +// MessageText: +// +// Request to the effects control to change transparency status to opaque.%0 +// + NS_S_WMPEFFECT_OPAQUE = HRESULT($000D1145); + {$EXTERNALSYM NS_S_WMPEFFECT_OPAQUE} + +// +// WMP Application Success codes +// +// +// MessageId: NS_S_OPERATION_PENDING +// +// MessageText: +// +// The requested application pane is performing an operation and will not be relased.%0 +// + NS_S_OPERATION_PENDING = HRESULT($000D114E); + {$EXTERNALSYM NS_S_OPERATION_PENDING} + +// +// WMP DVD Error Codes +// +// +// MessageId: NS_E_DVD_NO_SUBPICTURE_STREAM +// +// MessageText: +// +// Windows Media Player cannot display subtitles or highlights in menus. Reinstall +// the DVD decoder or contact your device manufacturer to obtain an updated decoder, +// and then try again.%0 +// + NS_E_DVD_NO_SUBPICTURE_STREAM = HRESULT($C00D1162); + {$EXTERNALSYM NS_E_DVD_NO_SUBPICTURE_STREAM} + +// +// MessageId: NS_E_DVD_COPY_PROTECT +// +// MessageText: +// +// Windows Media Player cannot play this DVD because a problem occurred with digital copyright protection.%0 +// + NS_E_DVD_COPY_PROTECT = HRESULT($C00D1163); + {$EXTERNALSYM NS_E_DVD_COPY_PROTECT} + +// +// MessageId: NS_E_DVD_AUTHORING_PROBLEM +// +// MessageText: +// +// Windows Media Player cannot play this DVD because the disc is incompatible with the Player.%0 +// + NS_E_DVD_AUTHORING_PROBLEM = HRESULT($C00D1164); + {$EXTERNALSYM NS_E_DVD_AUTHORING_PROBLEM} + +// +// MessageId: NS_E_DVD_INVALID_DISC_REGION +// +// MessageText: +// +// Windows Media Player cannot play this DVD because the disc prohibits playback in your region of the world. You must obtain a disc that is intended for your geographic region.%0 +// + NS_E_DVD_INVALID_DISC_REGION = HRESULT($C00D1165); + {$EXTERNALSYM NS_E_DVD_INVALID_DISC_REGION} + +// +// MessageId: NS_E_DVD_COMPATIBLE_VIDEO_CARD +// +// MessageText: +// +// Windows Media Player cannot play this DVD because your video card does not support DVD playback.%0 +// + NS_E_DVD_COMPATIBLE_VIDEO_CARD = HRESULT($C00D1166); + {$EXTERNALSYM NS_E_DVD_COMPATIBLE_VIDEO_CARD} + +// +// MessageId: NS_E_DVD_MACROVISION +// +// MessageText: +// +// Windows Media Player cannot play this DVD because a problem occurred with copyright protection.%0 +// + NS_E_DVD_MACROVISION = HRESULT($C00D1167); + {$EXTERNALSYM NS_E_DVD_MACROVISION} + +// +// MessageId: NS_E_DVD_SYSTEM_DECODER_REGION +// +// MessageText: +// +// Windows Media Player cannot play this DVD because the region assigned to your DVD drive does not match the region assigned to your DVD decoder.%0 +// + NS_E_DVD_SYSTEM_DECODER_REGION = HRESULT($C00D1168); + {$EXTERNALSYM NS_E_DVD_SYSTEM_DECODER_REGION} + +// +// MessageId: NS_E_DVD_DISC_DECODER_REGION +// +// MessageText: +// +// Windows Media Player cannot play this DVD because the disc prohibits playback +// in your region of the world. To play the disc by using the Player, you must +// obtain a disc that is intended for your geographic region.%0 +// + NS_E_DVD_DISC_DECODER_REGION = HRESULT($C00D1169); + {$EXTERNALSYM NS_E_DVD_DISC_DECODER_REGION} + +// +// MessageId: NS_E_DVD_NO_VIDEO_STREAM +// +// MessageText: +// +// Windows Media Player is currently unable to play DVD video. Try decreasing +// the number of colors displayed on your monitor or decreasing the screen +// resolution. For additional solutions, click More Information to access the +// DVD Troubleshooter.%0 +// + NS_E_DVD_NO_VIDEO_STREAM = HRESULT($C00D116A); + {$EXTERNALSYM NS_E_DVD_NO_VIDEO_STREAM} + +// +// MessageId: NS_E_DVD_NO_AUDIO_STREAM +// +// MessageText: +// +// Windows Media Player cannot play DVD audio. Verify that your sound card is set up correctly, and then try again.%0 +// + NS_E_DVD_NO_AUDIO_STREAM = HRESULT($C00D116B); + {$EXTERNALSYM NS_E_DVD_NO_AUDIO_STREAM} + +// +// MessageId: NS_E_DVD_GRAPH_BUILDING +// +// MessageText: +// +// Windows Media Player cannot play DVD video. Close any open files and quit any other running programs, and then try again. If the problem continues, restart your computer.%0 +// + NS_E_DVD_GRAPH_BUILDING = HRESULT($C00D116C); + {$EXTERNALSYM NS_E_DVD_GRAPH_BUILDING} + +// +// MessageId: NS_E_DVD_NO_DECODER +// +// MessageText: +// +// Windows Media Player cannot play this DVD because a compatible DVD decoder is not installed on your computer.%0 +// + NS_E_DVD_NO_DECODER = HRESULT($C00D116D); + {$EXTERNALSYM NS_E_DVD_NO_DECODER} + +// +// MessageId: NS_E_DVD_PARENTAL +// +// MessageText: +// +// Windows Media Player cannot play this DVD segment because the segment has a parental rating higher than the rating you are authorized to view.%0 +// + NS_E_DVD_PARENTAL = HRESULT($C00D116E); + {$EXTERNALSYM NS_E_DVD_PARENTAL} + +// +// MessageId: NS_E_DVD_CANNOT_JUMP +// +// MessageText: +// +// Windows Media Player cannot skip to the requested location in the DVD at this time.%0 +// + NS_E_DVD_CANNOT_JUMP = HRESULT($C00D116F); + {$EXTERNALSYM NS_E_DVD_CANNOT_JUMP} + +// +// MessageId: NS_E_DVD_DEVICE_CONTENTION +// +// MessageText: +// +// Windows Media Player cannot play this DVD because it is currently in use by another program. Quit the other program that is using the DVD, and then try to play it again.%0 +// + NS_E_DVD_DEVICE_CONTENTION = HRESULT($C00D1170); + {$EXTERNALSYM NS_E_DVD_DEVICE_CONTENTION} + +// +// MessageId: NS_E_DVD_NO_VIDEO_MEMORY +// +// MessageText: +// +// Windows Media Player cannot play DVD video. Double-click Display in Control Panel to lower your screen resolution and color quality settings.%0 +// + NS_E_DVD_NO_VIDEO_MEMORY = HRESULT($C00D1171); + {$EXTERNALSYM NS_E_DVD_NO_VIDEO_MEMORY} + +// +// MessageId: NS_E_DVD_CANNOT_COPY_PROTECTED +// +// MessageText: +// +// Windows Media Player cannot copy this DVD because it is copy protected.%0 +// + NS_E_DVD_CANNOT_COPY_PROTECTED = HRESULT($C00D1172); + {$EXTERNALSYM NS_E_DVD_CANNOT_COPY_PROTECTED} + +// +// MessageId: NS_E_DVD_REQUIRED_PROPERTY_NOT_SET +// +// MessageText: +// +// One of more of the required properties has not been set.%0 +// + NS_E_DVD_REQUIRED_PROPERTY_NOT_SET = HRESULT($C00D1173); + {$EXTERNALSYM NS_E_DVD_REQUIRED_PROPERTY_NOT_SET} + +// +// MessageId: NS_E_DVD_INVALID_TITLE_CHAPTER +// +// MessageText: +// +// The specified title and/or chapter number does not exist on this DVD.%0 +// + NS_E_DVD_INVALID_TITLE_CHAPTER = HRESULT($C00D1174); + {$EXTERNALSYM NS_E_DVD_INVALID_TITLE_CHAPTER} + +// +// WMP PDA Error codes +// +// +// MessageId: NS_E_NO_CD_BURNER +// +// MessageText: +// +// A CD recorder (burner) was not detected. Connect a CD recorder, and try copying again.%0 +// + NS_E_NO_CD_BURNER = HRESULT($C00D1176); + {$EXTERNALSYM NS_E_NO_CD_BURNER} + +// +// MessageId: NS_E_DEVICE_IS_NOT_READY +// +// MessageText: +// +// Windows Media Player does not detect any storage media in the selected device. Insert media into the device.%0 +// + NS_E_DEVICE_IS_NOT_READY = HRESULT($C00D1177); + {$EXTERNALSYM NS_E_DEVICE_IS_NOT_READY} + +// +// MessageId: NS_E_PDA_UNSUPPORTED_FORMAT +// +// MessageText: +// +// Windows Media Player cannot play the specified file. Your portable device does not support the specified format.%0 +// + NS_E_PDA_UNSUPPORTED_FORMAT = HRESULT($C00D1178); + {$EXTERNALSYM NS_E_PDA_UNSUPPORTED_FORMAT} + +// +// MessageId: NS_E_NO_PDA +// +// MessageText: +// +// Windows Media Player cannot detect a connected portable device. Connect your portable device, and try again.%0 +// + NS_E_NO_PDA = HRESULT($C00D1179); + {$EXTERNALSYM NS_E_NO_PDA} + +// +// MessageId: NS_E_PDA_UNSPECIFIED_ERROR +// +// MessageText: +// +// Windows Media Player has encountered an error on the portable device.%0 +// + NS_E_PDA_UNSPECIFIED_ERROR = HRESULT($C00D117A); + {$EXTERNALSYM NS_E_PDA_UNSPECIFIED_ERROR} + +// +// MessageId: NS_E_MEMSTORAGE_BAD_DATA +// +// MessageText: +// +// Windows Media Player encountered an internal error in accessing a memory-based storage during a CD burning task.%0 +// + NS_E_MEMSTORAGE_BAD_DATA = HRESULT($C00D117B); + {$EXTERNALSYM NS_E_MEMSTORAGE_BAD_DATA} + +// +// MessageId: NS_E_PDA_FAIL_SELECT_DEVICE +// +// MessageText: +// +// Windows Media Player encountered an internal error when selecting a PDA or CD device.%0 +// + NS_E_PDA_FAIL_SELECT_DEVICE = HRESULT($C00D117C); + {$EXTERNALSYM NS_E_PDA_FAIL_SELECT_DEVICE} + +// +// MessageId: NS_E_PDA_FAIL_READ_WAVE_FILE +// +// MessageText: +// +// Windows Media Player failed to open or read data from a wave file.%0 +// + NS_E_PDA_FAIL_READ_WAVE_FILE = HRESULT($C00D117D); + {$EXTERNALSYM NS_E_PDA_FAIL_READ_WAVE_FILE} + +// +// MessageId: NS_E_IMAPI_LOSSOFSTREAMING +// +// MessageText: +// +// Windows Media Player did not copy all the selected items. The Player has +// reduced the recording speed of your CD drive to solve the problem. To copy +// all the selected items, insert a blank CD in the drive, and try again.%0 +// + NS_E_IMAPI_LOSSOFSTREAMING = HRESULT($C00D117E); + {$EXTERNALSYM NS_E_IMAPI_LOSSOFSTREAMING} + +// +// MessageId: NS_E_PDA_DEVICE_FULL +// +// MessageText: +// +// There is not enough storage space on the portable device to complete this operation. Delete some unneeded files on the portable device, and then try again.%0 +// + NS_E_PDA_DEVICE_FULL = HRESULT($C00D117F); + {$EXTERNALSYM NS_E_PDA_DEVICE_FULL} + +// +// MessageId: NS_E_FAIL_LAUNCH_ROXIO_PLUGIN +// +// MessageText: +// +// Windows Media Player cannot copy the files to the CD. Verify that a CD-R or +// CD-RW drive is connected to your computer, and then try again. If the problem +// continues, reinstall the Player.%0 +// + NS_E_FAIL_LAUNCH_ROXIO_PLUGIN = HRESULT($C00D1180); + {$EXTERNALSYM NS_E_FAIL_LAUNCH_ROXIO_PLUGIN} + +// +// MessageId: NS_E_PDA_DEVICE_FULL_IN_SESSION +// +// MessageText: +// +// Windows Media Player failed to copy some files to device because the device is out of space.%0 +// + NS_E_PDA_DEVICE_FULL_IN_SESSION = HRESULT($C00D1181); + {$EXTERNALSYM NS_E_PDA_DEVICE_FULL_IN_SESSION} + +// +// MessageId: NS_E_IMAPI_MEDIUM_INVALIDTYPE +// +// MessageText: +// +// The medium in the drive is invalid. Please insert a blank CD-R or a CD-RW into the drive, and then try again.%0 +// + NS_E_IMAPI_MEDIUM_INVALIDTYPE = HRESULT($C00D1182); + {$EXTERNALSYM NS_E_IMAPI_MEDIUM_INVALIDTYPE} + +// +// General Remapped Error codes in WMP +// +// +// MessageId: NS_E_WMP_PROTOCOL_PROBLEM +// +// MessageText: +// +// Windows Media Player could not open the specified URL. Be sure Windows Media Player is configured to use all available protocols, and then try again.%0 +// + NS_E_WMP_PROTOCOL_PROBLEM = HRESULT($C00D1194); + {$EXTERNALSYM NS_E_WMP_PROTOCOL_PROBLEM} + +// +// MessageId: NS_E_WMP_NO_DISK_SPACE +// +// MessageText: +// +// Windows Media Player cannot open the file because there is not enough disk space on your computer. Delete some unneeded files on your hard disk, and then try again.%0 +// + NS_E_WMP_NO_DISK_SPACE = HRESULT($C00D1195); + {$EXTERNALSYM NS_E_WMP_NO_DISK_SPACE} + +// +// MessageId: NS_E_WMP_LOGON_FAILURE +// +// MessageText: +// +// Windows Media Player cannot copy or play the file because the server denied access to it. Verify that you have access rights to the file, and then try again.%0 +// + NS_E_WMP_LOGON_FAILURE = HRESULT($C00D1196); + {$EXTERNALSYM NS_E_WMP_LOGON_FAILURE} + +// +// MessageId: NS_E_WMP_CANNOT_FIND_FILE +// +// MessageText: +// +// Windows Media Player cannot find the specified file. Be sure the path is +// typed correctly. If it is, the file does not exist at the specified location, +// or the computer where the file is stored is offline.%0 +// + NS_E_WMP_CANNOT_FIND_FILE = HRESULT($C00D1197); + {$EXTERNALSYM NS_E_WMP_CANNOT_FIND_FILE} + +// +// MessageId: NS_E_WMP_SERVER_INACCESSIBLE +// +// MessageText: +// +// Windows Media Player cannot connect to the server. The server name may be incorrect or the server is busy. Try again later.%0 +// + NS_E_WMP_SERVER_INACCESSIBLE = HRESULT($C00D1198); + {$EXTERNALSYM NS_E_WMP_SERVER_INACCESSIBLE} + +// +// MessageId: NS_E_WMP_UNSUPPORTED_FORMAT +// +// MessageText: +// +// Windows Media Player cannot play the file. The file is either corrupt or the Player does not support the format you are trying to play.%0 +// + NS_E_WMP_UNSUPPORTED_FORMAT = HRESULT($C00D1199); + {$EXTERNALSYM NS_E_WMP_UNSUPPORTED_FORMAT} + +// +// MessageId: NS_E_WMP_DSHOW_UNSUPPORTED_FORMAT +// +// MessageText: +// +// Windows Media Player cannot play the file. The file may be formatted with +// an unsupported codec, or the Internet security setting on your computer is +// set too high. Lower your browser's security setting, and then try again.%0 +// + NS_E_WMP_DSHOW_UNSUPPORTED_FORMAT = HRESULT($C00D119A); + {$EXTERNALSYM NS_E_WMP_DSHOW_UNSUPPORTED_FORMAT} + +// +// MessageId: NS_E_WMP_PLAYLIST_EXISTS +// +// MessageText: +// +// Windows Media Player cannot create the playlist because the name already exists. Type a different playlist name.%0 +// + NS_E_WMP_PLAYLIST_EXISTS = HRESULT($C00D119B); + {$EXTERNALSYM NS_E_WMP_PLAYLIST_EXISTS} + +// +// MessageId: NS_E_WMP_NONMEDIA_FILES +// +// MessageText: +// +// Windows Media Player could not delete the playlist because it contains +// non-digital media files. Any digital media files in the playlist were deleted. +// Use Windows Explorer to delete non-digital media files, and then try +// deleting the playlist again.%0 +// + NS_E_WMP_NONMEDIA_FILES = HRESULT($C00D119C); + {$EXTERNALSYM NS_E_WMP_NONMEDIA_FILES} + +// +// MessageId: NS_E_WMP_INVALID_ASX +// +// MessageText: +// +// Windows Media Player cannot play the file because the associated playlist is not valid.%0 +// + NS_E_WMP_INVALID_ASX = HRESULT($C00D119D); + {$EXTERNALSYM NS_E_WMP_INVALID_ASX} + +// +// MessageId: NS_E_WMP_ALREADY_IN_USE +// +// MessageText: +// +// Windows Media Player is already in use. Stop playing any content and close all Player dialog boxes and then try again.%0 +// + NS_E_WMP_ALREADY_IN_USE = HRESULT($C00D119E); + {$EXTERNALSYM NS_E_WMP_ALREADY_IN_USE} + +// +// MessageId: NS_E_WMP_IMAPI_FAILURE +// +// MessageText: +// +// Windows Media Player has encountered an unknown error with your recordable disc.%0 +// + NS_E_WMP_IMAPI_FAILURE = HRESULT($C00D119F); + {$EXTERNALSYM NS_E_WMP_IMAPI_FAILURE} + +// +// MessageId: NS_E_WMP_WMDM_FAILURE +// +// MessageText: +// +// Windows Media Player has encountered an unknown error with your portable device. Reconnect your portable device and try again.%0 +// + NS_E_WMP_WMDM_FAILURE = HRESULT($C00D11A0); + {$EXTERNALSYM NS_E_WMP_WMDM_FAILURE} + +// +// MessageId: NS_E_WMP_CODEC_NEEDED_WITH_4CC +// +// MessageText: +// +// The %s codec is required to play this file. To determine if this codec is available to download from the Web, click Web Help.%0 +// + NS_E_WMP_CODEC_NEEDED_WITH_4CC = HRESULT($C00D11A1); + {$EXTERNALSYM NS_E_WMP_CODEC_NEEDED_WITH_4CC} + +// +// MessageId: NS_E_WMP_CODEC_NEEDED_WITH_FORMATTAG +// +// MessageText: +// +// The audio codec identified by the format tag %s is required to play this file. To determine if this codec is available to download from the Web, click Web Help.%0 +// + NS_E_WMP_CODEC_NEEDED_WITH_FORMATTAG = HRESULT($C00D11A2); + {$EXTERNALSYM NS_E_WMP_CODEC_NEEDED_WITH_FORMATTAG} + +// +// MessageId: NS_E_WMP_MSSAP_NOT_AVAILABLE +// +// MessageText: +// +// To play this file, you must install the latest Windows XP service pack. To install the service pack from the Windows Update Web site, click Web Help.%0 +// + NS_E_WMP_MSSAP_NOT_AVAILABLE = HRESULT($C00D11A3); + {$EXTERNALSYM NS_E_WMP_MSSAP_NOT_AVAILABLE} + +// +// MessageId: NS_E_WMP_WMDM_INTERFACEDEAD +// +// MessageText: +// +// Windows Media Player no longer detects a portable device. Reconnect your portable device, and try again.%0 +// + NS_E_WMP_WMDM_INTERFACEDEAD = HRESULT($C00D11A4); + {$EXTERNALSYM NS_E_WMP_WMDM_INTERFACEDEAD} + +// +// MessageId: NS_E_WMP_WMDM_NOTCERTIFIED +// +// MessageText: +// +// Windows Media Player cannot copy the file because the portable device does not support protected files.%0 +// + NS_E_WMP_WMDM_NOTCERTIFIED = HRESULT($C00D11A5); + {$EXTERNALSYM NS_E_WMP_WMDM_NOTCERTIFIED} + +// +// MessageId: NS_E_WMP_WMDM_LICENSE_NOTEXIST +// +// MessageText: +// +// Windows Media Player cannot copy the file because a license for this file +// could not be found on your computer. If you obtained this file from a Web site, +// return to the site, and try downloading the file again.%0 +// + NS_E_WMP_WMDM_LICENSE_NOTEXIST = HRESULT($C00D11A6); + {$EXTERNALSYM NS_E_WMP_WMDM_LICENSE_NOTEXIST} + +// +// MessageId: NS_E_WMP_WMDM_LICENSE_EXPIRED +// +// MessageText: +// +// Windows Media Player cannot copy the file because the license for this file +// has expired. If you obtained this file from a Web site, return to the site, +// and try downloading the file again.%0 +// + NS_E_WMP_WMDM_LICENSE_EXPIRED = HRESULT($C00D11A7); + {$EXTERNALSYM NS_E_WMP_WMDM_LICENSE_EXPIRED} + +// +// MessageId: NS_E_WMP_WMDM_BUSY +// +// MessageText: +// +// The portable device is already in use. Wait until the current process finishes or quit other programs that may be using the portable device, and then try again.%0 +// + NS_E_WMP_WMDM_BUSY = HRESULT($C00D11A8); + {$EXTERNALSYM NS_E_WMP_WMDM_BUSY} + +// +// MessageId: NS_E_WMP_WMDM_NORIGHTS +// +// MessageText: +// +// Windows Media Player cannot copy the file because the license or device restricts it.%0 +// + NS_E_WMP_WMDM_NORIGHTS = HRESULT($C00D11A9); + {$EXTERNALSYM NS_E_WMP_WMDM_NORIGHTS} + +// +// MessageId: NS_E_WMP_WMDM_INCORRECT_RIGHTS +// +// MessageText: +// +// Windows Media Player cannot copy the file because the license associated with the file restricts it.%0 +// + NS_E_WMP_WMDM_INCORRECT_RIGHTS = HRESULT($C00D11AA); + {$EXTERNALSYM NS_E_WMP_WMDM_INCORRECT_RIGHTS} + +// +// MessageId: NS_E_WMP_IMAPI_GENERIC +// +// MessageText: +// +// Windows Media Player cannot copy files to the recordable disc.%0 +// + NS_E_WMP_IMAPI_GENERIC = HRESULT($C00D11AB); + {$EXTERNALSYM NS_E_WMP_IMAPI_GENERIC} + +// +// MessageId: NS_E_WMP_IMAPI_DEVICE_NOTPRESENT +// +// MessageText: +// +// Windows Media Player cannot copy files to the recordable disc. Verify that the CD-R or CD-RW drive is connected, and then try again.%0 +// + NS_E_WMP_IMAPI_DEVICE_NOTPRESENT = HRESULT($C00D11AD); + {$EXTERNALSYM NS_E_WMP_IMAPI_DEVICE_NOTPRESENT} + +// +// MessageId: NS_E_WMP_IMAPI_STASHINUSE +// +// MessageText: +// +// The CD-R or CD-RW drive may already be in use. Wait until the current process finishes or quit other programs that may be using the CD-R or CD-RW drive, and then try again.%0 +// + NS_E_WMP_IMAPI_STASHINUSE = HRESULT($C00D11AE); + {$EXTERNALSYM NS_E_WMP_IMAPI_STASHINUSE} + +// +// MessageId: NS_E_WMP_IMAPI_LOSS_OF_STREAMING +// +// MessageText: +// +// Windows Media Player cannot copy files to the recordable disc.%0 +// + NS_E_WMP_IMAPI_LOSS_OF_STREAMING = HRESULT($C00D11AF); + {$EXTERNALSYM NS_E_WMP_IMAPI_LOSS_OF_STREAMING} + +// +// MessageId: NS_E_WMP_SERVER_UNAVAILABLE +// +// MessageText: +// +// Windows Media Player cannot play the file because the server is busy. Try again later.%0 +// + NS_E_WMP_SERVER_UNAVAILABLE = HRESULT($C00D11B0); + {$EXTERNALSYM NS_E_WMP_SERVER_UNAVAILABLE} + +// +// MessageId: NS_E_WMP_FILE_OPEN_FAILED +// +// MessageText: +// +// Windows Media Player cannot open the file.%0 +// + NS_E_WMP_FILE_OPEN_FAILED = HRESULT($C00D11B1); + {$EXTERNALSYM NS_E_WMP_FILE_OPEN_FAILED} + +// +// MessageId: NS_E_WMP_VERIFY_ONLINE +// +// MessageText: +// +// To play the file, Windows Media Player must obtain a license from the Internet. Connect to the Internet, and then try again.%0 +// + NS_E_WMP_VERIFY_ONLINE = HRESULT($C00D11B2); + {$EXTERNALSYM NS_E_WMP_VERIFY_ONLINE} + +// +// MessageId: NS_E_WMP_SERVER_NOT_RESPONDING +// +// MessageText: +// +// Windows Media Player cannot play the file because the server is not responding. +// If you entered a URL or path to play the file, verify that it is correct. If you +// clicked a link to play the file, the link may not be valid.%0 +// + NS_E_WMP_SERVER_NOT_RESPONDING = HRESULT($C00D11B3); + {$EXTERNALSYM NS_E_WMP_SERVER_NOT_RESPONDING} + +// +// MessageId: NS_E_WMP_DRM_CORRUPT_BACKUP +// +// MessageText: +// +// Windows Media Player cannot restore your licenses because no backed up licenses were found on your computer.%0 +// + NS_E_WMP_DRM_CORRUPT_BACKUP = HRESULT($C00D11B4); + {$EXTERNALSYM NS_E_WMP_DRM_CORRUPT_BACKUP} + +// +// MessageId: NS_E_WMP_DRM_LICENSE_SERVER_UNAVAILABLE +// +// MessageText: +// +// To play the file, Windows Media Player must obtain a license from the Internet. However, the license server is currently not available. Try again later.%0 +// + NS_E_WMP_DRM_LICENSE_SERVER_UNAVAILABLE = HRESULT($C00D11B5); + {$EXTERNALSYM NS_E_WMP_DRM_LICENSE_SERVER_UNAVAILABLE} + +// +// MessageId: NS_E_WMP_NETWORK_FIREWALL +// +// MessageText: +// +// Windows Media Player cannot play the file. A network firewall may be preventing +// the Player from opening the file by using the UDP transport protocol. To play +// this file, try opening the file without specifying UDP.%0 +// + NS_E_WMP_NETWORK_FIREWALL = HRESULT($C00D11B6); + {$EXTERNALSYM NS_E_WMP_NETWORK_FIREWALL} + +// +// MessageId: NS_E_WMP_NO_REMOVABLE_MEDIA +// +// MessageText: +// +// Insert the removable media, and then try again.%0 +// + NS_E_WMP_NO_REMOVABLE_MEDIA = HRESULT($C00D11B7); + {$EXTERNALSYM NS_E_WMP_NO_REMOVABLE_MEDIA} + +// +// MessageId: NS_E_WMP_PROXY_CONNECT_TIMEOUT +// +// MessageText: +// +// Windows Media Player cannot play the file because the proxy server is not +// responding. The proxy server may be temporarily unavailable or your Player +// proxy settings may not be valid.%0 +// + NS_E_WMP_PROXY_CONNECT_TIMEOUT = HRESULT($C00D11B8); + {$EXTERNALSYM NS_E_WMP_PROXY_CONNECT_TIMEOUT} + +// +// MessageId: NS_E_WMP_NEED_UPGRADE +// +// MessageText: +// +// To play this file, you must upgrade to the latest version of Windows Media Player. +// To upgrade the Player, on the Help menu, click Check For Player Updates, and then +// follow the instructions.%0 +// + NS_E_WMP_NEED_UPGRADE = HRESULT($C00D11B9); + {$EXTERNALSYM NS_E_WMP_NEED_UPGRADE} + +// +// MessageId: NS_E_WMP_AUDIO_HW_PROBLEM +// +// MessageText: +// +// Windows Media Player cannot play the file because there is a problem with your +// sound device. There may not be a sound device installed on your computer, it may +// be in use by another program, or it may not be functioning properly.%0 +// + NS_E_WMP_AUDIO_HW_PROBLEM = HRESULT($C00D11BA); + {$EXTERNALSYM NS_E_WMP_AUDIO_HW_PROBLEM} + +// +// MessageId: NS_E_WMP_INVALID_PROTOCOL +// +// MessageText: +// +// Windows Media Player cannot play the file because the specified protocol is not +// supported. In the Open URL dialog, try opening the file using a different transport +// protocol (for example, "http:" or "rtsp:").%0 +// + NS_E_WMP_INVALID_PROTOCOL = HRESULT($C00D11BB); + {$EXTERNALSYM NS_E_WMP_INVALID_PROTOCOL} + +// +// MessageId: NS_E_WMP_INVALID_LIBRARY_ADD +// +// MessageText: +// +// Windows Media Player cannot add the file to Media Library because the file format is not supported.%0 +// + NS_E_WMP_INVALID_LIBRARY_ADD = HRESULT($C00D11BC); + {$EXTERNALSYM NS_E_WMP_INVALID_LIBRARY_ADD} + +// +// MessageId: NS_E_WMP_MMS_NOT_SUPPORTED +// +// MessageText: +// +// Windows Media Player cannot play the file because the specified protocol is not +// supported. In the Open URL dialog, try opening the file using a different transport +// protocol (for example, "mms:").%0 +// + NS_E_WMP_MMS_NOT_SUPPORTED = HRESULT($C00D11BD); + {$EXTERNALSYM NS_E_WMP_MMS_NOT_SUPPORTED} + +// +// MessageId: NS_E_WMP_NO_PROTOCOLS_SELECTED +// +// MessageText: +// +// Windows Media Player cannot play the file because there are no streaming protocols selected. Select one or more protocols, and then try again.%0 +// + NS_E_WMP_NO_PROTOCOLS_SELECTED = HRESULT($C00D11BE); + {$EXTERNALSYM NS_E_WMP_NO_PROTOCOLS_SELECTED} + +// +// MessageId: NS_E_WMP_GOFULLSCREEN_FAILED +// +// MessageText: +// +// To use the Full Screen command, you may need to adjust your Windows display settings. Open Display in Control Panel, and try setting Hardware acceleration to Full.%0 +// + NS_E_WMP_GOFULLSCREEN_FAILED = HRESULT($C00D11BF); + {$EXTERNALSYM NS_E_WMP_GOFULLSCREEN_FAILED} + +// +// MessageId: NS_E_WMP_NETWORK_ERROR +// +// MessageText: +// +// Windows Media Player cannot play the file because a network error occurred.%0 +// + NS_E_WMP_NETWORK_ERROR = HRESULT($C00D11C0); + {$EXTERNALSYM NS_E_WMP_NETWORK_ERROR} + +// +// MessageId: NS_E_WMP_CONNECT_TIMEOUT +// +// MessageText: +// +// Windows Media Player cannot play the file because the server is not responding. Verify that you are connected to the network, and then try again later.%0 +// + NS_E_WMP_CONNECT_TIMEOUT = HRESULT($C00D11C1); + {$EXTERNALSYM NS_E_WMP_CONNECT_TIMEOUT} + +// +// MessageId: NS_E_WMP_MULTICAST_DISABLED +// +// MessageText: +// +// Windows Media Player cannot play the file because the multicast protocol is +// not enabled. On the Tools menu, click Options, click the Network tab, and then +// select the Multicast check box.%0 +// + NS_E_WMP_MULTICAST_DISABLED = HRESULT($C00D11C2); + {$EXTERNALSYM NS_E_WMP_MULTICAST_DISABLED} + +// +// MessageId: NS_E_WMP_SERVER_DNS_TIMEOUT +// +// MessageText: +// +// Windows Media Player cannot play the file because a network problem occurred. Verify that you are connected to the network, and then try again later.%0 +// + NS_E_WMP_SERVER_DNS_TIMEOUT = HRESULT($C00D11C3); + {$EXTERNALSYM NS_E_WMP_SERVER_DNS_TIMEOUT} + +// +// MessageId: NS_E_WMP_PROXY_NOT_FOUND +// +// MessageText: +// +// Windows Media Player cannot play the file because the network proxy server could not be found. Verify your proxy settings, and then try again.%0 +// + NS_E_WMP_PROXY_NOT_FOUND = HRESULT($C00D11C4); + {$EXTERNALSYM NS_E_WMP_PROXY_NOT_FOUND} + +// +// MessageId: NS_E_WMP_TAMPERED_CONTENT +// +// MessageText: +// +// Windows Media Player cannot play the file because it is damaged or corrupted.%0 +// + NS_E_WMP_TAMPERED_CONTENT = HRESULT($C00D11C5); + {$EXTERNALSYM NS_E_WMP_TAMPERED_CONTENT} + +// +// MessageId: NS_E_WMP_OUTOFMEMORY +// +// MessageText: +// +// Your computer is running low on memory. Quit other programs, and then try again.%0 +// + NS_E_WMP_OUTOFMEMORY = HRESULT($C00D11C6); + {$EXTERNALSYM NS_E_WMP_OUTOFMEMORY} + +// +// MessageId: NS_E_WMP_AUDIO_CODEC_NOT_INSTALLED +// +// MessageText: +// +// Windows Media Player cannot play the file because the required audio codec is not installed on your computer.%0 +// + NS_E_WMP_AUDIO_CODEC_NOT_INSTALLED = HRESULT($C00D11C7); + {$EXTERNALSYM NS_E_WMP_AUDIO_CODEC_NOT_INSTALLED} + +// +// MessageId: NS_E_WMP_VIDEO_CODEC_NOT_INSTALLED +// +// MessageText: +// +// Windows Media Player cannot play the file because the required video codec is not installed on your computer.%0 +// + NS_E_WMP_VIDEO_CODEC_NOT_INSTALLED = HRESULT($C00D11C8); + {$EXTERNALSYM NS_E_WMP_VIDEO_CODEC_NOT_INSTALLED} + +// +// MessageId: NS_E_WMP_IMAPI_DEVICE_INVALIDTYPE +// +// MessageText: +// +// Windows Media Player cannot copy the files to the recordable disc.%0 +// + NS_E_WMP_IMAPI_DEVICE_INVALIDTYPE = HRESULT($C00D11C9); + {$EXTERNALSYM NS_E_WMP_IMAPI_DEVICE_INVALIDTYPE} + +// +// MessageId: NS_E_WMP_DRM_DRIVER_AUTH_FAILURE +// +// MessageText: +// +// Windows Media Player cannot play the licensed file because there is a problem with your sound device. Try installing a new device driver or use a different sound device.%0 +// + NS_E_WMP_DRM_DRIVER_AUTH_FAILURE = HRESULT($C00D11CA); + {$EXTERNALSYM NS_E_WMP_DRM_DRIVER_AUTH_FAILURE} + +// +// MessageId: NS_E_WMP_NETWORK_RESOURCE_FAILURE +// +// MessageText: +// +// Windows Media Player encountered a network problem. Restart the Player.%0 +// + NS_E_WMP_NETWORK_RESOURCE_FAILURE = HRESULT($C00D11CB); + {$EXTERNALSYM NS_E_WMP_NETWORK_RESOURCE_FAILURE} + +// +// MessageId: NS_E_WMP_UPGRADE_APPLICATION +// +// MessageText: +// +// Windows Media Player is not installed properly. Reinstall the Player.%0 +// + NS_E_WMP_UPGRADE_APPLICATION = HRESULT($C00D11CC); + {$EXTERNALSYM NS_E_WMP_UPGRADE_APPLICATION} + +// +// MessageId: NS_E_WMP_UNKNOWN_ERROR +// +// MessageText: +// +// Windows Media Player encountered an unknown error.%0 +// + NS_E_WMP_UNKNOWN_ERROR = HRESULT($C00D11CD); + {$EXTERNALSYM NS_E_WMP_UNKNOWN_ERROR} + +// +// MessageId: NS_E_WMP_INVALID_KEY +// +// MessageText: +// +// Windows Media Player cannot play the file because the required codec is not valid.%0 +// + NS_E_WMP_INVALID_KEY = HRESULT($C00D11CE); + {$EXTERNALSYM NS_E_WMP_INVALID_KEY} + +// +// MessageId: NS_E_WMP_CD_ANOTHER_USER +// +// MessageText: +// +// The CD drive is in use by another user. Wait for the operation to complete, and then try again.%0 +// + NS_E_WMP_CD_ANOTHER_USER = HRESULT($C00D11CF); + {$EXTERNALSYM NS_E_WMP_CD_ANOTHER_USER} + +// +// MessageId: NS_E_WMP_DRM_NEEDS_AUTHORIZATION +// +// MessageText: +// +// Windows Media Player cannot play the licensed file because the required security upgrade is not available for download.%0 +// + NS_E_WMP_DRM_NEEDS_AUTHORIZATION = HRESULT($C00D11D0); + {$EXTERNALSYM NS_E_WMP_DRM_NEEDS_AUTHORIZATION} + +// +// MessageId: NS_E_WMP_BAD_DRIVER +// +// MessageText: +// +// Windows Media Player cannot play the file because there may be a problem with your sound or video device. Try installing a new device driver.%0 +// + NS_E_WMP_BAD_DRIVER = HRESULT($C00D11D1); + {$EXTERNALSYM NS_E_WMP_BAD_DRIVER} + +// +// MessageId: NS_E_WMP_ACCESS_DENIED +// +// MessageText: +// +// Windows Media Player cannot access the file.%0 +// + NS_E_WMP_ACCESS_DENIED = HRESULT($C00D11D2); + {$EXTERNALSYM NS_E_WMP_ACCESS_DENIED} + +// +// MessageId: NS_E_WMP_LICENSE_RESTRICTS +// +// MessageText: +// +// Windows Media Player cannot copy the file to the device because the license restricts it.%0 +// + NS_E_WMP_LICENSE_RESTRICTS = HRESULT($C00D11D3); + {$EXTERNALSYM NS_E_WMP_LICENSE_RESTRICTS} + +// +// MessageId: NS_E_WMP_INVALID_REQUEST +// +// MessageText: +// +// Windows Media Player cannot perform the requested action at this time.%0 +// + NS_E_WMP_INVALID_REQUEST = HRESULT($C00D11D4); + {$EXTERNALSYM NS_E_WMP_INVALID_REQUEST} + +// +// MessageId: NS_E_WMP_CD_STASH_NO_SPACE +// +// MessageText: +// +// Windows Media Player cannot copy the files because there is not enough free +// disk space to store the temporary files. Delete some unneeded files on your hard +// disk, and then try again.%0 +// + NS_E_WMP_CD_STASH_NO_SPACE = HRESULT($C00D11D5); + {$EXTERNALSYM NS_E_WMP_CD_STASH_NO_SPACE} + +// +// MessageId: NS_E_WMP_DRM_NEW_HARDWARE +// +// MessageText: +// +// Windows Media Player cannot play the file because the associated license is +// either corrupted or not valid. The license may no longer be valid if you have +// replaced hardware components in your computer.%0 +// + NS_E_WMP_DRM_NEW_HARDWARE = HRESULT($C00D11D6); + {$EXTERNALSYM NS_E_WMP_DRM_NEW_HARDWARE} + +// +// MessageId: NS_E_WMP_DRM_INVALID_SIG +// +// MessageText: +// +// The required security upgrade cannot be validated. Try installing the latest +// Internet Explorer service pack. To install the service pack from the Windows +// Update Web site, click Web Help.%0 +// + NS_E_WMP_DRM_INVALID_SIG = HRESULT($C00D11D7); + {$EXTERNALSYM NS_E_WMP_DRM_INVALID_SIG} + +// +// MessageId: NS_E_WMP_DRM_CANNOT_RESTORE +// +// MessageText: +// +// Windows Media Player cannot restore your licenses because you have exceeded the restore limit for the day. Try again tomorrow.%0 +// + NS_E_WMP_DRM_CANNOT_RESTORE = HRESULT($C00D11D8); + {$EXTERNALSYM NS_E_WMP_DRM_CANNOT_RESTORE} + +// +// WMP CD Filter Error codes extension +// +// +// MessageId: NS_E_CD_NO_BUFFERS_READ +// +// MessageText: +// +// Windows Media Player encountered an error when reading the CD-ROM drive in digital mode. +// You can try to use digital mode again, or you can switch the Player to analog mode.%0 +// + NS_E_CD_NO_BUFFERS_READ = HRESULT($C00D11F8); + {$EXTERNALSYM NS_E_CD_NO_BUFFERS_READ} + +// +// MessageId: NS_E_CD_EMPTY_TRACK_QUEUE +// +// MessageText: +// +// No CD track was specified for playback.%0 +// + NS_E_CD_EMPTY_TRACK_QUEUE = HRESULT($C00D11F9); + {$EXTERNALSYM NS_E_CD_EMPTY_TRACK_QUEUE} + +// +// MessageId: NS_E_CD_NO_READER +// +// MessageText: +// +// The CD filter was not able to create the CD reader.%0 +// + NS_E_CD_NO_READER = HRESULT($C00D11FA); + {$EXTERNALSYM NS_E_CD_NO_READER} + +// +// MessageId: NS_E_CD_ISRC_INVALID +// +// MessageText: +// +// Invalid ISRC code.%0 +// + NS_E_CD_ISRC_INVALID = HRESULT($C00D11FB); + {$EXTERNALSYM NS_E_CD_ISRC_INVALID} + +// +// MessageId: NS_E_CD_MEDIA_CATALOG_NUMBER_INVALID +// +// MessageText: +// +// Invalid Media Catalog Number.%0 +// + NS_E_CD_MEDIA_CATALOG_NUMBER_INVALID = HRESULT($C00D11FC); + {$EXTERNALSYM NS_E_CD_MEDIA_CATALOG_NUMBER_INVALID} + +// +// MessageId: NS_E_SLOW_READ_DIGITAL_WITH_ERRORCORRECTION +// +// MessageText: +// +// Media Player has detected that your CD drive cannot play back audio CDs +// correctly because the drive is too slow with error correction turned on. Please +// turn off error correction for this drive.%0 +// + NS_E_SLOW_READ_DIGITAL_WITH_ERRORCORRECTION = HRESULT($C00D11FD); + {$EXTERNALSYM NS_E_SLOW_READ_DIGITAL_WITH_ERRORCORRECTION} + +// +// MessageId: NS_E_CD_SPEEDDETECT_NOT_ENOUGH_READS +// +// MessageText: +// +// The CD track is too small to make a good estimate of the CD's speed.%0 +// + NS_E_CD_SPEEDDETECT_NOT_ENOUGH_READS = HRESULT($C00D11FE); + {$EXTERNALSYM NS_E_CD_SPEEDDETECT_NOT_ENOUGH_READS} + +// +// MessageId: NS_E_CD_QUEUEING_DISABLED +// +// MessageText: +// +// Cannot queue the given CD track as queuing is disabled.%0 +// + NS_E_CD_QUEUEING_DISABLED = HRESULT($C00D11FF); + {$EXTERNALSYM NS_E_CD_QUEUEING_DISABLED} + +// +// WMP Policy error codes +// +// +// MessageId: NS_E_WMP_POLICY_VALUE_NOT_CONFIGURED +// +// MessageText: +// +// Media Player failed to read a policy. This can happen when the policy is not present in the registry or when there is a failure to read from the registry.%0 +// + NS_E_WMP_POLICY_VALUE_NOT_CONFIGURED = HRESULT($C00D122A); + {$EXTERNALSYM NS_E_WMP_POLICY_VALUE_NOT_CONFIGURED} + +// +//Background download plugin +// +// +// MessageId: NS_E_WMP_HWND_NOTFOUND +// +// MessageText: +// +// Windows Media Player main window not found. The download manager needs to find it to work properly. Please try to run Windows Media Player again.%0 +// + NS_E_WMP_HWND_NOTFOUND = HRESULT($C00D125C); + {$EXTERNALSYM NS_E_WMP_HWND_NOTFOUND} + +// +// MessageId: NS_E_BKGDOWNLOAD_WRONG_NO_FILES +// +// MessageText: +// +// Windows media player encountered a download with wrong number of files. +// This may happen if some other application is trying to create jobs with same +// signature as Windows Media Player.%0 +// + NS_E_BKGDOWNLOAD_WRONG_NO_FILES = HRESULT($C00D125D); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_WRONG_NO_FILES} + +// +// MessageId: NS_E_BKGDOWNLOAD_COMPLETECANCELLEDJOB +// +// MessageText: +// +// Windows Media Player tried to complete a download that was already cancelled. The file will not be available.%0 +// + NS_E_BKGDOWNLOAD_COMPLETECANCELLEDJOB = HRESULT($C00D125E); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_COMPLETECANCELLEDJOB} + +// +// MessageId: NS_E_BKGDOWNLOAD_CANCELCOMPLETEDJOB +// +// MessageText: +// +// Windows Media Player tried to cancel a download that was already completed. The file will not be removed.%0 +// + NS_E_BKGDOWNLOAD_CANCELCOMPLETEDJOB = HRESULT($C00D125F); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_CANCELCOMPLETEDJOB} + +// +// MessageId: NS_E_BKGDOWNLOAD_NOJOBPOINTER +// +// MessageText: +// +// Windows Media Player is trying to access an invalid download.%0 +// + NS_E_BKGDOWNLOAD_NOJOBPOINTER = HRESULT($C00D1260); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_NOJOBPOINTER} + +// +// MessageId: NS_E_BKGDOWNLOAD_INVALIDJOBSIGNATURE +// +// MessageText: +// +// This download was not created by Windows Media Player.%0 +// + NS_E_BKGDOWNLOAD_INVALIDJOBSIGNATURE = HRESULT($C00D1261); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_INVALIDJOBSIGNATURE} + +// +// MessageId: NS_E_BKGDOWNLOAD_FAILED_TO_CREATE_TEMPFILE +// +// MessageText: +// +// The Windows Media Player download manager failed to create a temporary file name. +// This may happen if the path in invalid or if the disk is full. Please check +// your system and try again.%0 +// + NS_E_BKGDOWNLOAD_FAILED_TO_CREATE_TEMPFILE = HRESULT($C00D1262); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_FAILED_TO_CREATE_TEMPFILE} + +// +// MessageId: NS_E_BKGDOWNLOAD_PLUGIN_FAILEDINITIALIZE +// +// MessageText: +// +// The Windows Media Player download manager plugin failed to initialize. This may happen if the system is out of resources. Please check your system and try again.%0 +// + NS_E_BKGDOWNLOAD_PLUGIN_FAILEDINITIALIZE = HRESULT($C00D1263); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_PLUGIN_FAILEDINITIALIZE} + +// +// MessageId: NS_E_BKGDOWNLOAD_PLUGIN_FAILEDTOMOVEFILE +// +// MessageText: +// +// The Windows Media Player download manager failed to move the file.%0 +// + NS_E_BKGDOWNLOAD_PLUGIN_FAILEDTOMOVEFILE = HRESULT($C00D1264); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_PLUGIN_FAILEDTOMOVEFILE} + +// +// MessageId: NS_E_BKGDOWNLOAD_CALLFUNCFAILED +// +// MessageText: +// +// Download manager failed to accomplish a task. This happened because the system has no resources to allocate.%0 +// + NS_E_BKGDOWNLOAD_CALLFUNCFAILED = HRESULT($C00D1265); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_CALLFUNCFAILED} + +// +// MessageId: NS_E_BKGDOWNLOAD_CALLFUNCTIMEOUT +// +// MessageText: +// +// The Windows Media Player download manager failed to accomplish a task because the task took too long to execute.%0 +// + NS_E_BKGDOWNLOAD_CALLFUNCTIMEOUT = HRESULT($C00D1266); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_CALLFUNCTIMEOUT} + +// +// MessageId: NS_E_BKGDOWNLOAD_CALLFUNCENDED +// +// MessageText: +// +// The Windows Media Player download manager failed to accomplish a task because +// Windows Media Player is terminating the service. The task will be recovered when +// Windows Media Player starts again.%0 +// + NS_E_BKGDOWNLOAD_CALLFUNCENDED = HRESULT($C00D1267); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_CALLFUNCENDED} + +// +// MessageId: NS_E_BKGDOWNLOAD_WMDUNPACKFAILED +// +// MessageText: +// +// The Windows Media Player download manager failed to unpack a WMD package that +// was transferred. The file will be deleted and the operation will not be +// successfully completed.%0 +// + NS_E_BKGDOWNLOAD_WMDUNPACKFAILED = HRESULT($C00D1268); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_WMDUNPACKFAILED} + +// +// MessageId: NS_E_BKGDOWNLOAD_FAILEDINITIALIZE +// +// MessageText: +// +// The Windows Media Player download manager failed to initialize. This may happen if the system is out of resources. Please check your system and try again.%0 +// + NS_E_BKGDOWNLOAD_FAILEDINITIALIZE = HRESULT($C00D1269); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_FAILEDINITIALIZE} + +// +// MessageId: NS_E_INTERFACE_NOT_REGISTERED_IN_GIT +// +// MessageText: +// +// Windows Media Player failed to access a required functionality. This could be caused by wrong system or media player dlls being loaded.%0 +// + NS_E_INTERFACE_NOT_REGISTERED_IN_GIT = HRESULT($C00D126A); + {$EXTERNALSYM NS_E_INTERFACE_NOT_REGISTERED_IN_GIT} + +// +// MessageId: NS_E_BKGDOWNLOAD_INVALID_FILE_NAME +// +// MessageText: +// +// Windows Media Player failed to get the file name of the requested download. The requested download will be canceled.%0 +// + NS_E_BKGDOWNLOAD_INVALID_FILE_NAME = HRESULT($C00D126B); + {$EXTERNALSYM NS_E_BKGDOWNLOAD_INVALID_FILE_NAME} + +// +//Image Graph Errors 4750 -- 4800 +// +// +// MessageId: NS_E_IMAGE_DOWNLOAD_FAILED +// +// MessageText: +// +// An error was encountered downloading the image.%0 +// + NS_E_IMAGE_DOWNLOAD_FAILED = HRESULT($C00D128E); + {$EXTERNALSYM NS_E_IMAGE_DOWNLOAD_FAILED} + +// +// UDRM errors +// +// +// MessageId: NS_E_WMP_UDRM_NOUSERLIST +// +// MessageText: +// +// There was a problem while trying to get the list of activated users for this machine. The License acquisition process will be stopped.%0 +// + NS_E_WMP_UDRM_NOUSERLIST = HRESULT($C00D12C0); + {$EXTERNALSYM NS_E_WMP_UDRM_NOUSERLIST} + +// +// MessageId: NS_E_WMP_DRM_NOT_ACQUIRING +// +// MessageText: +// +// The Windows Media Player is trying to acquire a license for a file that is not being used anymore. The License acquisition process will stop.%0 +// + NS_E_WMP_DRM_NOT_ACQUIRING = HRESULT($C00D12C1); + {$EXTERNALSYM NS_E_WMP_DRM_NOT_ACQUIRING} + +// +// String is too large +// +// +// MessageId: NS_E_WMP_BSTR_TOO_LONG +// +// MessageText: +// +// The parameter is invalid.%0 +// + NS_E_WMP_BSTR_TOO_LONG = HRESULT($C00D12F2); + {$EXTERNALSYM NS_E_WMP_BSTR_TOO_LONG} + +// +// Autoplay errors 4860 --- 4870 +// +// +// MessageId: NS_E_WMP_AUTOPLAY_INVALID_STATE +// +// MessageText: +// +// Invalid state for this request.%0 +// + NS_E_WMP_AUTOPLAY_INVALID_STATE = HRESULT($C00D12FC); + {$EXTERNALSYM NS_E_WMP_AUTOPLAY_INVALID_STATE} + +// +// CURL Errors 4900 -- 4949 +// +// +// MessageId: NS_E_CURL_NOTSAFE +// +// MessageText: +// +// The URL is not safe for the operation specified.%0 +// + NS_E_CURL_NOTSAFE = HRESULT($C00D1324); + {$EXTERNALSYM NS_E_CURL_NOTSAFE} + +// +// MessageId: NS_E_CURL_INVALIDCHAR +// +// MessageText: +// +// The URL contains one or more invalid characters.%0 +// + NS_E_CURL_INVALIDCHAR = HRESULT($C00D1325); + {$EXTERNALSYM NS_E_CURL_INVALIDCHAR} + +// +// MessageId: NS_E_CURL_INVALIDHOSTNAME +// +// MessageText: +// +// The URL contains an invalid hostname.%0 +// + NS_E_CURL_INVALIDHOSTNAME = HRESULT($C00D1326); + {$EXTERNALSYM NS_E_CURL_INVALIDHOSTNAME} + +// +// MessageId: NS_E_CURL_INVALIDPATH +// +// MessageText: +// +// The URL contains an invalid path.%0 +// + NS_E_CURL_INVALIDPATH = HRESULT($C00D1327); + {$EXTERNALSYM NS_E_CURL_INVALIDPATH} + +// +// MessageId: NS_E_CURL_INVALIDSCHEME +// +// MessageText: +// +// The URL contains an invalid scheme.%0 +// + NS_E_CURL_INVALIDSCHEME = HRESULT($C00D1328); + {$EXTERNALSYM NS_E_CURL_INVALIDSCHEME} + +// +// MessageId: NS_E_CURL_INVALIDURL +// +// MessageText: +// +// The URL is invalid.%0 +// + NS_E_CURL_INVALIDURL = HRESULT($C00D1329); + {$EXTERNALSYM NS_E_CURL_INVALIDURL} + +// +// MessageId: NS_E_CURL_CANTWALK +// +// MessageText: +// +// The URL would change the root.%0 +// + NS_E_CURL_CANTWALK = HRESULT($C00D132B); + {$EXTERNALSYM NS_E_CURL_CANTWALK} + +// +// MessageId: NS_E_CURL_INVALIDPORT +// +// MessageText: +// +// The URL port is invalid.%0 +// + NS_E_CURL_INVALIDPORT = HRESULT($C00D132C); + {$EXTERNALSYM NS_E_CURL_INVALIDPORT} + +// +// MessageId: NS_E_CURLHELPER_NOTADIRECTORY +// +// MessageText: +// +// The URL is not a directory.%0 +// + NS_E_CURLHELPER_NOTADIRECTORY = HRESULT($C00D132D); + {$EXTERNALSYM NS_E_CURLHELPER_NOTADIRECTORY} + +// +// MessageId: NS_E_CURLHELPER_NOTAFILE +// +// MessageText: +// +// The URL is not a file.%0 +// + NS_E_CURLHELPER_NOTAFILE = HRESULT($C00D132E); + {$EXTERNALSYM NS_E_CURLHELPER_NOTAFILE} + +// +// MessageId: NS_E_CURL_CANTDECODE +// +// MessageText: +// +// The URL contains characters that could not be decoded. The URL may be truncated or incomplete.%0 +// + NS_E_CURL_CANTDECODE = HRESULT($C00D132F); + {$EXTERNALSYM NS_E_CURL_CANTDECODE} + +// +// MessageId: NS_E_CURLHELPER_NOTRELATIVE +// +// MessageText: +// +// The specified relative URL is actually not a relative URL.%0 +// + NS_E_CURLHELPER_NOTRELATIVE = HRESULT($C00D1330); + {$EXTERNALSYM NS_E_CURLHELPER_NOTRELATIVE} + +// +// MessageId: NS_E_CURL_INVALIDBUFFERSIZE +// +// MessageText: +// +// The buffer is smaller than the size specified.%0 +// + NS_E_CURL_INVALIDBUFFERSIZE = HRESULT($C00D1355); + {$EXTERNALSYM NS_E_CURL_INVALIDBUFFERSIZE} + +// +// Subscription Service Errors 4950 -- 4969 +// +// +// MessageId: NS_E_SUBSCRIPTIONSERVICE_PLAYBACK_DISALLOWED +// +// MessageText: +// +// This content is provided by a music service. The content cannot be played, possibly because a valid license does not exist. Please contact the music service with questions.%0 +// + NS_E_SUBSCRIPTIONSERVICE_PLAYBACK_DISALLOWED = HRESULT($C00D1356); + {$EXTERNALSYM NS_E_SUBSCRIPTIONSERVICE_PLAYBACK_DISALLOWED} + +// +// Advanced Edit Dialog Errors 4970 -- 4989 +// +// +// MessageId: NS_E_ADVANCEDEDIT_TOO_MANY_PICTURES +// +// MessageText: +// +// Not all your images were saved to the file. Only 7MB of images may be saved to a media file.%0 +// + NS_E_ADVANCEDEDIT_TOO_MANY_PICTURES = HRESULT($C00D136A); + {$EXTERNALSYM NS_E_ADVANCEDEDIT_TOO_MANY_PICTURES} + + + +///////////////////////////////////////////////////////////////////////// +// +// Windows Media Server Errors +// +// IdRange = 5000 - 5999 +// +///////////////////////////////////////////////////////////////////////// + +// +// MessageId: NS_E_REDIRECT +// +// MessageText: +// +// The client redirected to another server.%0 +// + NS_E_REDIRECT = HRESULT($C00D1388); + {$EXTERNALSYM NS_E_REDIRECT} + +// +// MessageId: NS_E_STALE_PRESENTATION +// +// MessageText: +// +// The streaming media description is no longer current.%0 +// + NS_E_STALE_PRESENTATION = HRESULT($C00D1389); + {$EXTERNALSYM NS_E_STALE_PRESENTATION} + + +// Namespace Errors + +// +// MessageId: NS_E_NAMESPACE_WRONG_PERSIST +// +// MessageText: +// +// It is not possible to create a persistent namespace node under a transient parent node.%0 +// + NS_E_NAMESPACE_WRONG_PERSIST = HRESULT($C00D138A); + {$EXTERNALSYM NS_E_NAMESPACE_WRONG_PERSIST} + +// +// MessageId: NS_E_NAMESPACE_WRONG_TYPE +// +// MessageText: +// +// It is not possible to store a value in a namespace node that has a different value type.%0 +// + NS_E_NAMESPACE_WRONG_TYPE = HRESULT($C00D138B); + {$EXTERNALSYM NS_E_NAMESPACE_WRONG_TYPE} + +// +// MessageId: NS_E_NAMESPACE_NODE_CONFLICT +// +// MessageText: +// +// It is not possible to remove the root namespace node.%0 +// + NS_E_NAMESPACE_NODE_CONFLICT = HRESULT($C00D138C); + {$EXTERNALSYM NS_E_NAMESPACE_NODE_CONFLICT} + +// +// MessageId: NS_E_NAMESPACE_NODE_NOT_FOUND +// +// MessageText: +// +// The specified namespace node could not be found.%0 +// + NS_E_NAMESPACE_NODE_NOT_FOUND = HRESULT($C00D138D); + {$EXTERNALSYM NS_E_NAMESPACE_NODE_NOT_FOUND} + +// +// MessageId: NS_E_NAMESPACE_BUFFER_TOO_SMALL +// +// MessageText: +// +// The buffer supplied to hold namespace node string is too small.%0 +// + NS_E_NAMESPACE_BUFFER_TOO_SMALL = HRESULT($C00D138E); + {$EXTERNALSYM NS_E_NAMESPACE_BUFFER_TOO_SMALL} + +// +// MessageId: NS_E_NAMESPACE_TOO_MANY_CALLBACKS +// +// MessageText: +// +// The callback list on a namespace node is at the maximum size.%0 +// + NS_E_NAMESPACE_TOO_MANY_CALLBACKS = HRESULT($C00D138F); + {$EXTERNALSYM NS_E_NAMESPACE_TOO_MANY_CALLBACKS} + +// +// MessageId: NS_E_NAMESPACE_DUPLICATE_CALLBACK +// +// MessageText: +// +// It is not possible to register an already-registered callback on a namespace node.%0 +// + NS_E_NAMESPACE_DUPLICATE_CALLBACK = HRESULT($C00D1390); + {$EXTERNALSYM NS_E_NAMESPACE_DUPLICATE_CALLBACK} + +// +// MessageId: NS_E_NAMESPACE_CALLBACK_NOT_FOUND +// +// MessageText: +// +// Cannot find the callback in the namespace when attempting to remove the callback.%0 +// + NS_E_NAMESPACE_CALLBACK_NOT_FOUND = HRESULT($C00D1391); + {$EXTERNALSYM NS_E_NAMESPACE_CALLBACK_NOT_FOUND} + +// +// MessageId: NS_E_NAMESPACE_NAME_TOO_LONG +// +// MessageText: +// +// The namespace node name exceeds the allowed maximum length.%0 +// + NS_E_NAMESPACE_NAME_TOO_LONG = HRESULT($C00D1392); + {$EXTERNALSYM NS_E_NAMESPACE_NAME_TOO_LONG} + +// +// MessageId: NS_E_NAMESPACE_DUPLICATE_NAME +// +// MessageText: +// +// Cannot create a namespace node that already exists.%0 +// + NS_E_NAMESPACE_DUPLICATE_NAME = HRESULT($C00D1393); + {$EXTERNALSYM NS_E_NAMESPACE_DUPLICATE_NAME} + +// +// MessageId: NS_E_NAMESPACE_EMPTY_NAME +// +// MessageText: +// +// The namespace node name cannot be a null string.%0 +// + NS_E_NAMESPACE_EMPTY_NAME = HRESULT($C00D1394); + {$EXTERNALSYM NS_E_NAMESPACE_EMPTY_NAME} + +// +// MessageId: NS_E_NAMESPACE_INDEX_TOO_LARGE +// +// MessageText: +// +// Finding a child namespace node by index failed because the index exceeded the number of children.%0 +// + NS_E_NAMESPACE_INDEX_TOO_LARGE = HRESULT($C00D1395); + {$EXTERNALSYM NS_E_NAMESPACE_INDEX_TOO_LARGE} + +// +// MessageId: NS_E_NAMESPACE_BAD_NAME +// +// MessageText: +// +// The namespace node name is invalid.%0 +// + NS_E_NAMESPACE_BAD_NAME = HRESULT($C00D1396); + {$EXTERNALSYM NS_E_NAMESPACE_BAD_NAME} + +// +// MessageId: NS_E_NAMESPACE_WRONG_SECURITY +// +// MessageText: +// +// It is not possible to store a value in a namespace node that has a different security type.%0 +// + NS_E_NAMESPACE_WRONG_SECURITY = HRESULT($C00D1397); + {$EXTERNALSYM NS_E_NAMESPACE_WRONG_SECURITY} + + +// Cache Errors 5100-5199 + +// +// MessageId: NS_E_CACHE_ARCHIVE_CONFLICT +// +// MessageText: +// +// The archive request conflicts with other requests in progress.%0 +// + NS_E_CACHE_ARCHIVE_CONFLICT = HRESULT($C00D13EC); + {$EXTERNALSYM NS_E_CACHE_ARCHIVE_CONFLICT} + +// +// MessageId: NS_E_CACHE_ORIGIN_SERVER_NOT_FOUND +// +// MessageText: +// +// The specified origin server cannot be found.%0 +// + NS_E_CACHE_ORIGIN_SERVER_NOT_FOUND = HRESULT($C00D13ED); + {$EXTERNALSYM NS_E_CACHE_ORIGIN_SERVER_NOT_FOUND} + +// +// MessageId: NS_E_CACHE_ORIGIN_SERVER_TIMEOUT +// +// MessageText: +// +// The specified origin server is not responding.%0 +// + NS_E_CACHE_ORIGIN_SERVER_TIMEOUT = HRESULT($C00D13EE); + {$EXTERNALSYM NS_E_CACHE_ORIGIN_SERVER_TIMEOUT} + +// +// MessageId: NS_E_CACHE_NOT_BROADCAST +// +// MessageText: +// +// The internal code for HTTP status code 412 Precondition Failed due to not broadcast type.%0 +// + NS_E_CACHE_NOT_BROADCAST = HRESULT($C00D13EF); + {$EXTERNALSYM NS_E_CACHE_NOT_BROADCAST} + +// +// MessageId: NS_E_CACHE_CANNOT_BE_CACHED +// +// MessageText: +// +// The internal code for HTTP status code 403 Forbidden due to not cacheable.%0 +// + NS_E_CACHE_CANNOT_BE_CACHED = HRESULT($C00D13F0); + {$EXTERNALSYM NS_E_CACHE_CANNOT_BE_CACHED} + +// +// MessageId: NS_E_CACHE_NOT_MODIFIED +// +// MessageText: +// +// The internal code for HTTP status code 304 Not Modified.%0 +// + NS_E_CACHE_NOT_MODIFIED = HRESULT($C00D13F1); + {$EXTERNALSYM NS_E_CACHE_NOT_MODIFIED} + + +// Object Model Errors 5200-5299 + +// +// MessageId: NS_E_CANNOT_REMOVE_PUBLISHING_POINT +// +// MessageText: +// +// It is not possible to remove a cache or proxy publishing point.%0 +// + NS_E_CANNOT_REMOVE_PUBLISHING_POINT = HRESULT($C00D1450); + {$EXTERNALSYM NS_E_CANNOT_REMOVE_PUBLISHING_POINT} + +// +// MessageId: NS_E_CANNOT_REMOVE_PLUGIN +// +// MessageText: +// +// It is not possible to remove the last instance of a type of plug-in.%0 +// + NS_E_CANNOT_REMOVE_PLUGIN = HRESULT($C00D1451); + {$EXTERNALSYM NS_E_CANNOT_REMOVE_PLUGIN} + +// +// MessageId: NS_E_WRONG_PUBLISHING_POINT_TYPE +// +// MessageText: +// +// Cache and proxy publishing points do not support this property or method.%0 +// + NS_E_WRONG_PUBLISHING_POINT_TYPE = HRESULT($C00D1452); + {$EXTERNALSYM NS_E_WRONG_PUBLISHING_POINT_TYPE} + +// +// MessageId: NS_E_UNSUPPORTED_LOAD_TYPE +// +// MessageText: +// +// The plug-in does not support the specified load type.%0 +// + NS_E_UNSUPPORTED_LOAD_TYPE = HRESULT($C00D1453); + {$EXTERNALSYM NS_E_UNSUPPORTED_LOAD_TYPE} + +// +// MessageId: NS_E_INVALID_PLUGIN_LOAD_TYPE_CONFIGURATION +// +// MessageText: +// +// The plug-in does not support any load types. The plug-in must support at least one load type.%0 +// + NS_E_INVALID_PLUGIN_LOAD_TYPE_CONFIGURATION = HRESULT($C00D1454); + {$EXTERNALSYM NS_E_INVALID_PLUGIN_LOAD_TYPE_CONFIGURATION} + +// +// MessageId: NS_E_INVALID_PUBLISHING_POINT_NAME +// +// MessageText: +// +// The publishing point name is invalid.%0 +// + NS_E_INVALID_PUBLISHING_POINT_NAME = HRESULT($C00D1455); + {$EXTERNALSYM NS_E_INVALID_PUBLISHING_POINT_NAME} + +// +// MessageId: NS_E_TOO_MANY_MULTICAST_SINKS +// +// MessageText: +// +// Only one multicast data writer plug-in can be enabled for a publishing point.%0 +// + NS_E_TOO_MANY_MULTICAST_SINKS = HRESULT($C00D1456); + {$EXTERNALSYM NS_E_TOO_MANY_MULTICAST_SINKS} + +// +// MessageId: NS_E_PUBLISHING_POINT_INVALID_REQUEST_WHILE_STARTED +// +// MessageText: +// +// The requested operation cannot be completed while the publishing point is started.%0 +// + NS_E_PUBLISHING_POINT_INVALID_REQUEST_WHILE_STARTED = HRESULT($C00D1457); + {$EXTERNALSYM NS_E_PUBLISHING_POINT_INVALID_REQUEST_WHILE_STARTED} + +// +// MessageId: NS_E_MULTICAST_PLUGIN_NOT_ENABLED +// +// MessageText: +// +// A multicast data writer plug-in must be enabled in order for this operation to be completed.%0 +// + NS_E_MULTICAST_PLUGIN_NOT_ENABLED = HRESULT($C00D1458); + {$EXTERNALSYM NS_E_MULTICAST_PLUGIN_NOT_ENABLED} + +// +// MessageId: NS_E_INVALID_OPERATING_SYSTEM_VERSION +// +// MessageText: +// +// This feature requires Windows .NET Enterprise Server.%0 +// + NS_E_INVALID_OPERATING_SYSTEM_VERSION = HRESULT($C00D1459); + {$EXTERNALSYM NS_E_INVALID_OPERATING_SYSTEM_VERSION} + +// +// MessageId: NS_E_PUBLISHING_POINT_REMOVED +// +// MessageText: +// +// The requested operation cannot be completed because the specified publishing point has been removed.%0 +// + NS_E_PUBLISHING_POINT_REMOVED = HRESULT($C00D145A); + {$EXTERNALSYM NS_E_PUBLISHING_POINT_REMOVED} + +// +// MessageId: NS_E_INVALID_PUSH_PUBLISHING_POINT_START_REQUEST +// +// MessageText: +// +// Push publishing points are started when the encoder starts pushing the stream. This publishing point cannot be started by the server administrator.%0 +// + NS_E_INVALID_PUSH_PUBLISHING_POINT_START_REQUEST = HRESULT($C00D145B); + {$EXTERNALSYM NS_E_INVALID_PUSH_PUBLISHING_POINT_START_REQUEST} + +// +// MessageId: NS_E_UNSUPPORTED_LANGUAGE +// +// MessageText: +// +// The specified language is not supported.%0 +// + NS_E_UNSUPPORTED_LANGUAGE = HRESULT($C00D145C); + {$EXTERNALSYM NS_E_UNSUPPORTED_LANGUAGE} + +// +// MessageId: NS_E_WRONG_OS_VERSION +// +// MessageText: +// +// Windows Media Services will only run on Windows .NET Server and Windows .NET Enterprise Server.%0 +// + NS_E_WRONG_OS_VERSION = HRESULT($C00D145D); + {$EXTERNALSYM NS_E_WRONG_OS_VERSION} + +// +// MessageId: NS_E_PUBLISHING_POINT_STOPPED +// +// MessageText: +// +// The operation cannot be completed because the publishing point has been stopped.%0 +// + NS_E_PUBLISHING_POINT_STOPPED = HRESULT($C00D145E); + {$EXTERNALSYM NS_E_PUBLISHING_POINT_STOPPED} + + +// Playlist Errors 5300-5399 + +// +// MessageId: NS_E_PLAYLIST_ENTRY_ALREADY_PLAYING +// +// MessageText: +// +// The playlist entry is already playing.%0 +// + NS_E_PLAYLIST_ENTRY_ALREADY_PLAYING = HRESULT($C00D14B4); + {$EXTERNALSYM NS_E_PLAYLIST_ENTRY_ALREADY_PLAYING} + +// +// MessageId: NS_E_EMPTY_PLAYLIST +// +// MessageText: +// +// The playlist or directory you are requesting does not contain content.%0 +// + NS_E_EMPTY_PLAYLIST = HRESULT($C00D14B5); + {$EXTERNALSYM NS_E_EMPTY_PLAYLIST} + +// +// MessageId: NS_E_PLAYLIST_PARSE_FAILURE +// +// MessageText: +// +// The server was unable to parse the requested playlist file.%0 +// + NS_E_PLAYLIST_PARSE_FAILURE = HRESULT($C00D14B6); + {$EXTERNALSYM NS_E_PLAYLIST_PARSE_FAILURE} + +// +// MessageId: NS_E_PLAYLIST_UNSUPPORTED_ENTRY +// +// MessageText: +// +// The requested operation is not supported for this type of playlist entry.%0 +// + NS_E_PLAYLIST_UNSUPPORTED_ENTRY = HRESULT($C00D14B7); + {$EXTERNALSYM NS_E_PLAYLIST_UNSUPPORTED_ENTRY} + +// +// MessageId: NS_E_PLAYLIST_ENTRY_NOT_IN_PLAYLIST +// +// MessageText: +// +// Cannot jump to a playlist entry that is not inserted in the playlist.%0 +// + NS_E_PLAYLIST_ENTRY_NOT_IN_PLAYLIST = HRESULT($C00D14B8); + {$EXTERNALSYM NS_E_PLAYLIST_ENTRY_NOT_IN_PLAYLIST} + +// +// MessageId: NS_E_PLAYLIST_ENTRY_SEEK +// +// MessageText: +// +// Cannot seek to the desired playlist entry.%0 +// + NS_E_PLAYLIST_ENTRY_SEEK = HRESULT($C00D14B9); + {$EXTERNALSYM NS_E_PLAYLIST_ENTRY_SEEK} + +// +// MessageId: NS_E_PLAYLIST_RECURSIVE_PLAYLISTS +// +// MessageText: +// +// Cannot play recursive playlist.%0 +// + NS_E_PLAYLIST_RECURSIVE_PLAYLISTS = HRESULT($C00D14BA); + {$EXTERNALSYM NS_E_PLAYLIST_RECURSIVE_PLAYLISTS} + +// +// MessageId: NS_E_PLAYLIST_TOO_MANY_NESTED_PLAYLISTS +// +// MessageText: +// +// The number of nested playlists exceeded the limit the server can handle.%0 +// + NS_E_PLAYLIST_TOO_MANY_NESTED_PLAYLISTS = HRESULT($C00D14BB); + {$EXTERNALSYM NS_E_PLAYLIST_TOO_MANY_NESTED_PLAYLISTS} + +// +// MessageId: NS_E_PLAYLIST_SHUTDOWN +// +// MessageText: +// +// Cannot execute the requested operation because the playlist has been shut down by the Media Server.%0 +// + NS_E_PLAYLIST_SHUTDOWN = HRESULT($C00D14BC); + {$EXTERNALSYM NS_E_PLAYLIST_SHUTDOWN} + +// +// MessageId: NS_E_PLAYLIST_END_RECEDING +// +// MessageText: +// +// The playlist has ended while receding.%0 +// + NS_E_PLAYLIST_END_RECEDING = HRESULT($C00D14BD); + {$EXTERNALSYM NS_E_PLAYLIST_END_RECEDING} + +// +// MessageId: NS_I_PLAYLIST_CHANGE_RECEDING +// +// MessageText: +// +// The playlist change occurred while receding.%0 +// + NS_I_PLAYLIST_CHANGE_RECEDING = HRESULT($400D14BE); + {$EXTERNALSYM NS_I_PLAYLIST_CHANGE_RECEDING} + + +// Datapath Errors -- 5400 - 5499 + +// +// MessageId: NS_E_DATAPATH_NO_SINK +// +// MessageText: +// +// The data path does not have an associated data writer plug-in.%0 +// + NS_E_DATAPATH_NO_SINK = HRESULT($C00D1518); + {$EXTERNALSYM NS_E_DATAPATH_NO_SINK} + +// +// MessageId: NS_S_PUBLISHING_POINT_STARTED_WITH_FAILED_SINKS +// +// MessageText: +// +// The publishing point successfully started, but one or more of the requested data writer plug-ins failed.%0 +// + NS_S_PUBLISHING_POINT_STARTED_WITH_FAILED_SINKS = HRESULT($000D1519); + {$EXTERNALSYM NS_S_PUBLISHING_POINT_STARTED_WITH_FAILED_SINKS} + +// +// MessageId: NS_E_INVALID_PUSH_TEMPLATE +// +// MessageText: +// +// The specified push template is invalid.%0 +// + NS_E_INVALID_PUSH_TEMPLATE = HRESULT($C00D151A); + {$EXTERNALSYM NS_E_INVALID_PUSH_TEMPLATE} + +// +// MessageId: NS_E_INVALID_PUSH_PUBLISHING_POINT +// +// MessageText: +// +// The specified push publishing point is invalid.%0 +// + NS_E_INVALID_PUSH_PUBLISHING_POINT = HRESULT($C00D151B); + {$EXTERNALSYM NS_E_INVALID_PUSH_PUBLISHING_POINT} + +// +// MessageId: NS_E_CRITICAL_ERROR +// +// MessageText: +// +// The requested operation cannot be performed because the server or publishing point is in a critical error state.%0 +// + NS_E_CRITICAL_ERROR = HRESULT($C00D151C); + {$EXTERNALSYM NS_E_CRITICAL_ERROR} + +// +// MessageId: NS_E_NO_NEW_CONNECTIONS +// +// MessageText: +// +// The content can not be played because the server is not currently accepting connections. Try connecting at a later time.%0 +// + NS_E_NO_NEW_CONNECTIONS = HRESULT($C00D151D); + {$EXTERNALSYM NS_E_NO_NEW_CONNECTIONS} + +// +// MessageId: NS_E_WSX_INVALID_VERSION +// +// MessageText: +// +// The version of this playlist is not supported by the server.%0 +// + NS_E_WSX_INVALID_VERSION = HRESULT($C00D151E); + {$EXTERNALSYM NS_E_WSX_INVALID_VERSION} + +// +// MessageId: NS_E_HEADER_MISMATCH +// +// MessageText: +// +// The command does not apply to the current media header user by a server component.%0 +// + NS_E_HEADER_MISMATCH = HRESULT($C00D151F); + {$EXTERNALSYM NS_E_HEADER_MISMATCH} + +// +// MessageId: NS_E_PUSH_DUPLICATE_PUBLISHING_POINT_NAME +// +// MessageText: +// +// The specified publishing point name is already in use.%0 +// + NS_E_PUSH_DUPLICATE_PUBLISHING_POINT_NAME = HRESULT($C00D1520); + {$EXTERNALSYM NS_E_PUSH_DUPLICATE_PUBLISHING_POINT_NAME} + + +// Plugin Errors -- 5500 - 5599 + +// +// MessageId: NS_E_NO_SCRIPT_ENGINE +// +// MessageText: +// +// There is no script engine available for this file.%0 +// + NS_E_NO_SCRIPT_ENGINE = HRESULT($C00D157C); + {$EXTERNALSYM NS_E_NO_SCRIPT_ENGINE} + +// +// MessageId: NS_E_PLUGIN_ERROR_REPORTED +// +// MessageText: +// +// The plug-in has reported an error. See the Troubleshooting tab or the NT Application Event Log for details.%0 +// + NS_E_PLUGIN_ERROR_REPORTED = HRESULT($C00D157D); + {$EXTERNALSYM NS_E_PLUGIN_ERROR_REPORTED} + +// +// MessageId: NS_E_SOURCE_PLUGIN_NOT_FOUND +// +// MessageText: +// +// No enabled data source plug-in is available to access the requested content.%0 +// + NS_E_SOURCE_PLUGIN_NOT_FOUND = HRESULT($C00D157E); + {$EXTERNALSYM NS_E_SOURCE_PLUGIN_NOT_FOUND} + +// +// MessageId: NS_E_PLAYLIST_PLUGIN_NOT_FOUND +// +// MessageText: +// +// No enabled playlist parser plug-in is available to access the requested content.%0 +// + NS_E_PLAYLIST_PLUGIN_NOT_FOUND = HRESULT($C00D157F); + {$EXTERNALSYM NS_E_PLAYLIST_PLUGIN_NOT_FOUND} + +// +// MessageId: NS_E_DATA_SOURCE_ENUMERATION_NOT_SUPPORTED +// +// MessageText: +// +// The data source plug-in does not support enumeration.%0 +// + NS_E_DATA_SOURCE_ENUMERATION_NOT_SUPPORTED = HRESULT($C00D1580); + {$EXTERNALSYM NS_E_DATA_SOURCE_ENUMERATION_NOT_SUPPORTED} + +// +// MessageId: NS_E_MEDIA_PARSER_INVALID_FORMAT +// +// MessageText: +// +// The server cannot stream the selected file because it is either damaged or corrupt. Select a different file.%0 +// + NS_E_MEDIA_PARSER_INVALID_FORMAT = HRESULT($C00D1581); + {$EXTERNALSYM NS_E_MEDIA_PARSER_INVALID_FORMAT} + +// +// MessageId: NS_E_SCRIPT_DEBUGGER_NOT_INSTALLED +// +// MessageText: +// +// The plug-in cannot be enabled because a compatible script debugger is not installed +// on this system. Install a script debugger, or disable the script debugger option on the general +// tab of the plug-in's properties page and try again.%0 +// + NS_E_SCRIPT_DEBUGGER_NOT_INSTALLED = HRESULT($C00D1582); + {$EXTERNALSYM NS_E_SCRIPT_DEBUGGER_NOT_INSTALLED} + +// +// MessageId: NS_E_FEATURE_REQUIRES_ENTERPRISE_SERVER +// +// MessageText: +// +// The plug-in cannot be loaded because it requires Windows .NET Enterprise Server.%0 +// + NS_E_FEATURE_REQUIRES_ENTERPRISE_SERVER = HRESULT($C00D1583); + {$EXTERNALSYM NS_E_FEATURE_REQUIRES_ENTERPRISE_SERVER} + +// +// MessageId: NS_E_WIZARD_RUNNING +// +// MessageText: +// +// Another wizard is currently running. Please close the other wizard or wait until it finishes before attempting to run this wizard again.%0 +// + NS_E_WIZARD_RUNNING = HRESULT($C00D1584); + {$EXTERNALSYM NS_E_WIZARD_RUNNING} + +// +// MessageId: NS_E_INVALID_LOG_URL +// +// MessageText: +// +// Invalid log URL. Multicast logging URL must look like "http://servername/isapibackend.dll" .%0 +// + NS_E_INVALID_LOG_URL = HRESULT($C00D1585); + {$EXTERNALSYM NS_E_INVALID_LOG_URL} + +// +// MessageId: NS_E_INVALID_MTU_RANGE +// +// MessageText: +// +// Invalid MTU specified. The valid range for maximum packet size is between 36 and 65507 bytes .%0 +// + NS_E_INVALID_MTU_RANGE = HRESULT($C00D1586); + {$EXTERNALSYM NS_E_INVALID_MTU_RANGE} + +// +// MessageId: NS_E_INVALID_PLAY_STATISTICS +// +// MessageText: +// +// Invalid play statistics for logging .%0 +// + NS_E_INVALID_PLAY_STATISTICS = HRESULT($C00D1587); + {$EXTERNALSYM NS_E_INVALID_PLAY_STATISTICS} + +// +// MessageId: NS_E_LOG_NEED_TO_BE_SKIPPED +// +// MessageText: +// +// The log needs to be skipped .%0 +// + NS_E_LOG_NEED_TO_BE_SKIPPED = HRESULT($C00D1588); + {$EXTERNALSYM NS_E_LOG_NEED_TO_BE_SKIPPED} + +// +// MessageId: NS_E_HTTP_TEXT_DATACONTAINER_SIZE_LIMIT_EXCEEDED +// +// MessageText: +// +// The size of the data exceeded the limit the WMS HTTP Download Data Source plugin can handle.%0 +// + NS_E_HTTP_TEXT_DATACONTAINER_SIZE_LIMIT_EXCEEDED = HRESULT($C00D1589); + {$EXTERNALSYM NS_E_HTTP_TEXT_DATACONTAINER_SIZE_LIMIT_EXCEEDED} + +// +// MessageId: NS_E_PORT_IN_USE +// +// MessageText: +// +// One usage of each socket address (protocol/network address/port) is permitted. +// Verify that other services or applications are not attempting to use the same +// port and then try to enable the plug-in again.%0 +// + NS_E_PORT_IN_USE = HRESULT($C00D158A); + {$EXTERNALSYM NS_E_PORT_IN_USE} + +// +// MessageId: NS_E_PORT_IN_USE_HTTP +// +// MessageText: +// +// One usage of each socket address (protocol/network address/port) is permitted. +// Verify that other services (such as IIS) or applications are not attempting to use +// the same port and then try to enable the plug-in again.%0 +// + NS_E_PORT_IN_USE_HTTP = HRESULT($C00D158B); + {$EXTERNALSYM NS_E_PORT_IN_USE_HTTP} + +// +// MessageId: NS_E_HTTP_TEXT_DATACONTAINER_INVALID_SERVER_RESPONSE +// +// MessageText: +// +// The WMS HTTP Download Data Source plugin was unable to receive the remote server's response.%0 +// + NS_E_HTTP_TEXT_DATACONTAINER_INVALID_SERVER_RESPONSE = HRESULT($C00D158C); + {$EXTERNALSYM NS_E_HTTP_TEXT_DATACONTAINER_INVALID_SERVER_RESPONSE} + +// +// MessageId: NS_E_ARCHIVE_REACH_QUOTA +// +// MessageText: +// +// The archive plug-in has reached its quota.%0 +// + NS_E_ARCHIVE_REACH_QUOTA = HRESULT($C00D158D); + {$EXTERNALSYM NS_E_ARCHIVE_REACH_QUOTA} + +// +// MessageId: NS_E_ARCHIVE_ABORT_DUE_TO_BCAST +// +// MessageText: +// +// The archive plug-in aborted because the source was from broadcast.%0 +// + NS_E_ARCHIVE_ABORT_DUE_TO_BCAST = HRESULT($C00D158E); + {$EXTERNALSYM NS_E_ARCHIVE_ABORT_DUE_TO_BCAST} + +// +// MessageId: NS_E_ARCHIVE_GAP_DETECTED +// +// MessageText: +// +// The archive plug-in detected an interrupt in the source.%0 +// + NS_E_ARCHIVE_GAP_DETECTED = HRESULT($C00D158F); + {$EXTERNALSYM NS_E_ARCHIVE_GAP_DETECTED} + + + +///////////////////////////////////////////////////////////////////////// +// +// Windows Media Tools Errors +// +// IdRange = 7000 - 7999 +// +///////////////////////////////////////////////////////////////////////// + +// +// MessageId: NS_E_BAD_MARKIN +// +// MessageText: +// +// The mark-in time should be greater than 0 and less than the mark-out time.%0 +// + NS_E_BAD_MARKIN = HRESULT($C00D1B58); + {$EXTERNALSYM NS_E_BAD_MARKIN} + +// +// MessageId: NS_E_BAD_MARKOUT +// +// MessageText: +// +// The mark-out time should be greater than the mark-in time and less than the file duration.%0 +// + NS_E_BAD_MARKOUT = HRESULT($C00D1B59); + {$EXTERNALSYM NS_E_BAD_MARKOUT} + +// +// MessageId: NS_E_NOMATCHING_MEDIASOURCE +// +// MessageText: +// +// No matching media type is found in the source %1.%0 +// + NS_E_NOMATCHING_MEDIASOURCE = HRESULT($C00D1B5A); + {$EXTERNALSYM NS_E_NOMATCHING_MEDIASOURCE} + +// +// MessageId: NS_E_UNSUPPORTED_SOURCETYPE +// +// MessageText: +// +// The specified source type is not supported.%0 +// + NS_E_UNSUPPORTED_SOURCETYPE = HRESULT($C00D1B5B); + {$EXTERNALSYM NS_E_UNSUPPORTED_SOURCETYPE} + +// +// MessageId: NS_E_TOO_MANY_AUDIO +// +// MessageText: +// +// It is not possible to specify more than one audio input.%0 +// + NS_E_TOO_MANY_AUDIO = HRESULT($C00D1B5C); + {$EXTERNALSYM NS_E_TOO_MANY_AUDIO} + +// +// MessageId: NS_E_TOO_MANY_VIDEO +// +// MessageText: +// +// It is not possible to specify more than two video inputs.%0 +// + NS_E_TOO_MANY_VIDEO = HRESULT($C00D1B5D); + {$EXTERNALSYM NS_E_TOO_MANY_VIDEO} + +// +// MessageId: NS_E_NOMATCHING_ELEMENT +// +// MessageText: +// +// No matching element is found in the list.%0 +// + NS_E_NOMATCHING_ELEMENT = HRESULT($C00D1B5E); + {$EXTERNALSYM NS_E_NOMATCHING_ELEMENT} + +// +// MessageId: NS_E_MISMATCHED_MEDIACONTENT +// +// MessageText: +// +// The profile's media types must match the media types defined for the session.%0 +// + NS_E_MISMATCHED_MEDIACONTENT = HRESULT($C00D1B5F); + {$EXTERNALSYM NS_E_MISMATCHED_MEDIACONTENT} + +// +// MessageId: NS_E_CANNOT_DELETE_ACTIVE_SOURCEGROUP +// +// MessageText: +// +// It is not possible to remove an active source while encoding.%0 +// + NS_E_CANNOT_DELETE_ACTIVE_SOURCEGROUP = HRESULT($C00D1B60); + {$EXTERNALSYM NS_E_CANNOT_DELETE_ACTIVE_SOURCEGROUP} + +// +// MessageId: NS_E_AUDIODEVICE_BUSY +// +// MessageText: +// +// It is not possible to open the specified audio capture device because it is currently in use.%0 +// + NS_E_AUDIODEVICE_BUSY = HRESULT($C00D1B61); + {$EXTERNALSYM NS_E_AUDIODEVICE_BUSY} + +// +// MessageId: NS_E_AUDIODEVICE_UNEXPECTED +// +// MessageText: +// +// It is not possible to open the specified audio capture device because an unexpected error has occurred.%0 +// + NS_E_AUDIODEVICE_UNEXPECTED = HRESULT($C00D1B62); + {$EXTERNALSYM NS_E_AUDIODEVICE_UNEXPECTED} + +// +// MessageId: NS_E_AUDIODEVICE_BADFORMAT +// +// MessageText: +// +// The audio capture device does not support the specified audio format.%0 +// + NS_E_AUDIODEVICE_BADFORMAT = HRESULT($C00D1B63); + {$EXTERNALSYM NS_E_AUDIODEVICE_BADFORMAT} + +// +// MessageId: NS_E_VIDEODEVICE_BUSY +// +// MessageText: +// +// It is not possible to open the specified video capture device because it is currently in use.%0 +// + NS_E_VIDEODEVICE_BUSY = HRESULT($C00D1B64); + {$EXTERNALSYM NS_E_VIDEODEVICE_BUSY} + +// +// MessageId: NS_E_VIDEODEVICE_UNEXPECTED +// +// MessageText: +// +// It is not possible to open the specified video capture device because an unexpected error has occurred.%0 +// + NS_E_VIDEODEVICE_UNEXPECTED = HRESULT($C00D1B65); + {$EXTERNALSYM NS_E_VIDEODEVICE_UNEXPECTED} + +// +// MessageId: NS_E_INVALIDCALL_WHILE_ENCODER_RUNNING +// +// MessageText: +// +// This operation is not allowed while encoding.%0 +// + NS_E_INVALIDCALL_WHILE_ENCODER_RUNNING = HRESULT($C00D1B66); + {$EXTERNALSYM NS_E_INVALIDCALL_WHILE_ENCODER_RUNNING} + +// +// MessageId: NS_E_NO_PROFILE_IN_SOURCEGROUP +// +// MessageText: +// +// No profile is set for the source.%0 +// + NS_E_NO_PROFILE_IN_SOURCEGROUP = HRESULT($C00D1B67); + {$EXTERNALSYM NS_E_NO_PROFILE_IN_SOURCEGROUP} + +// +// MessageId: NS_E_VIDEODRIVER_UNSTABLE +// +// MessageText: +// +// The video capture driver returned an unrecoverable error. It is now in an unstable state.%0 +// + NS_E_VIDEODRIVER_UNSTABLE = HRESULT($C00D1B68); + {$EXTERNALSYM NS_E_VIDEODRIVER_UNSTABLE} + +// +// MessageId: NS_E_VIDCAPSTARTFAILED +// +// MessageText: +// +// It was not possible to start the video device.%0 +// + NS_E_VIDCAPSTARTFAILED = HRESULT($C00D1B69); + {$EXTERNALSYM NS_E_VIDCAPSTARTFAILED} + +// +// MessageId: NS_E_VIDSOURCECOMPRESSION +// +// MessageText: +// +// The video source does not support the requested output format or color depth.%0 +// + NS_E_VIDSOURCECOMPRESSION = HRESULT($C00D1B6A); + {$EXTERNALSYM NS_E_VIDSOURCECOMPRESSION} + +// +// MessageId: NS_E_VIDSOURCESIZE +// +// MessageText: +// +// The video source does not support the requested capture size.%0 +// + NS_E_VIDSOURCESIZE = HRESULT($C00D1B6B); + {$EXTERNALSYM NS_E_VIDSOURCESIZE} + +// +// MessageId: NS_E_ICMQUERYFORMAT +// +// MessageText: +// +// It was not possible to obtain output information from the video compressor.%0 +// + NS_E_ICMQUERYFORMAT = HRESULT($C00D1B6C); + {$EXTERNALSYM NS_E_ICMQUERYFORMAT} + +// +// MessageId: NS_E_VIDCAPCREATEWINDOW +// +// MessageText: +// +// It was not possible to create a video capture window.%0 +// + NS_E_VIDCAPCREATEWINDOW = HRESULT($C00D1B6D); + {$EXTERNALSYM NS_E_VIDCAPCREATEWINDOW} + +// +// MessageId: NS_E_VIDCAPDRVINUSE +// +// MessageText: +// +// There is already a stream active on this video device.%0 +// + NS_E_VIDCAPDRVINUSE = HRESULT($C00D1B6E); + {$EXTERNALSYM NS_E_VIDCAPDRVINUSE} + +// +// MessageId: NS_E_NO_MEDIAFORMAT_IN_SOURCE +// +// MessageText: +// +// No media format is set in source.%0 +// + NS_E_NO_MEDIAFORMAT_IN_SOURCE = HRESULT($C00D1B6F); + {$EXTERNALSYM NS_E_NO_MEDIAFORMAT_IN_SOURCE} + +// +// MessageId: NS_E_NO_VALID_OUTPUT_STREAM +// +// MessageText: +// +// Cannot find a valid output stream from the source.%0 +// + NS_E_NO_VALID_OUTPUT_STREAM = HRESULT($C00D1B70); + {$EXTERNALSYM NS_E_NO_VALID_OUTPUT_STREAM} + +// +// MessageId: NS_E_NO_VALID_SOURCE_PLUGIN +// +// MessageText: +// +// It was not possible to find a valid source plug-in for the specified source.%0 +// + NS_E_NO_VALID_SOURCE_PLUGIN = HRESULT($C00D1B71); + {$EXTERNALSYM NS_E_NO_VALID_SOURCE_PLUGIN} + +// +// MessageId: NS_E_NO_ACTIVE_SOURCEGROUP +// +// MessageText: +// +// No source is currently active.%0 +// + NS_E_NO_ACTIVE_SOURCEGROUP = HRESULT($C00D1B72); + {$EXTERNALSYM NS_E_NO_ACTIVE_SOURCEGROUP} + +// +// MessageId: NS_E_NO_SCRIPT_STREAM +// +// MessageText: +// +// No script stream is set in the current source.%0 +// + NS_E_NO_SCRIPT_STREAM = HRESULT($C00D1B73); + {$EXTERNALSYM NS_E_NO_SCRIPT_STREAM} + +// +// MessageId: NS_E_INVALIDCALL_WHILE_ARCHIVAL_RUNNING +// +// MessageText: +// +// This operation is not allowed while archiving.%0 +// + NS_E_INVALIDCALL_WHILE_ARCHIVAL_RUNNING = HRESULT($C00D1B74); + {$EXTERNALSYM NS_E_INVALIDCALL_WHILE_ARCHIVAL_RUNNING} + +// +// MessageId: NS_E_INVALIDPACKETSIZE +// +// MessageText: +// +// The setting for the maximum packet size is not valid.%0 +// + NS_E_INVALIDPACKETSIZE = HRESULT($C00D1B75); + {$EXTERNALSYM NS_E_INVALIDPACKETSIZE} + +// +// MessageId: NS_E_PLUGIN_CLSID_INVALID +// +// MessageText: +// +// The plug-in CLSID specified is not valid.%0 +// + NS_E_PLUGIN_CLSID_INVALID = HRESULT($C00D1B76); + {$EXTERNALSYM NS_E_PLUGIN_CLSID_INVALID} + +// +// MessageId: NS_E_UNSUPPORTED_ARCHIVETYPE +// +// MessageText: +// +// This archive type is not supported.%0 +// + NS_E_UNSUPPORTED_ARCHIVETYPE = HRESULT($C00D1B77); + {$EXTERNALSYM NS_E_UNSUPPORTED_ARCHIVETYPE} + +// +// MessageId: NS_E_UNSUPPORTED_ARCHIVEOPERATION +// +// MessageText: +// +// This archive operation is not supported.%0 +// + NS_E_UNSUPPORTED_ARCHIVEOPERATION = HRESULT($C00D1B78); + {$EXTERNALSYM NS_E_UNSUPPORTED_ARCHIVEOPERATION} + +// +// MessageId: NS_E_ARCHIVE_FILENAME_NOTSET +// +// MessageText: +// +// The local archive file name was not set.%0 +// + NS_E_ARCHIVE_FILENAME_NOTSET = HRESULT($C00D1B79); + {$EXTERNALSYM NS_E_ARCHIVE_FILENAME_NOTSET} + +// +// MessageId: NS_E_SOURCEGROUP_NOTPREPARED +// +// MessageText: +// +// The source is not yet prepared.%0 +// + NS_E_SOURCEGROUP_NOTPREPARED = HRESULT($C00D1B7A); + {$EXTERNALSYM NS_E_SOURCEGROUP_NOTPREPARED} + +// +// MessageId: NS_E_PROFILE_MISMATCH +// +// MessageText: +// +// Profiles on the sources do not match.%0 +// + NS_E_PROFILE_MISMATCH = HRESULT($C00D1B7B); + {$EXTERNALSYM NS_E_PROFILE_MISMATCH} + +// +// MessageId: NS_E_INCORRECTCLIPSETTINGS +// +// MessageText: +// +// The specified crop values are not valid.%0 +// + NS_E_INCORRECTCLIPSETTINGS = HRESULT($C00D1B7C); + {$EXTERNALSYM NS_E_INCORRECTCLIPSETTINGS} + +// +// MessageId: NS_E_NOSTATSAVAILABLE +// +// MessageText: +// +// No statistics are available at this time.%0 +// + NS_E_NOSTATSAVAILABLE = HRESULT($C00D1B7D); + {$EXTERNALSYM NS_E_NOSTATSAVAILABLE} + +// +// MessageId: NS_E_NOTARCHIVING +// +// MessageText: +// +// The encoder is not archiving.%0 +// + NS_E_NOTARCHIVING = HRESULT($C00D1B7E); + {$EXTERNALSYM NS_E_NOTARCHIVING} + +// +// MessageId: NS_E_INVALIDCALL_WHILE_ENCODER_STOPPED +// +// MessageText: +// +// This operation is only allowed during encoding.%0 +// + NS_E_INVALIDCALL_WHILE_ENCODER_STOPPED = HRESULT($C00D1B7F); + {$EXTERNALSYM NS_E_INVALIDCALL_WHILE_ENCODER_STOPPED} + +// +// MessageId: NS_E_NOSOURCEGROUPS +// +// MessageText: +// +// This SourceGroupCollection doesn't contain any SourceGroups.%0 +// + NS_E_NOSOURCEGROUPS = HRESULT($C00D1B80); + {$EXTERNALSYM NS_E_NOSOURCEGROUPS} + +// +// MessageId: NS_E_INVALIDINPUTFPS +// +// MessageText: +// +// This source does not have a frame rate of 30 fps. Therefore, it is not possible to apply the inverse telecine filter to the source.%0 +// + NS_E_INVALIDINPUTFPS = HRESULT($C00D1B81); + {$EXTERNALSYM NS_E_INVALIDINPUTFPS} + +// +// MessageId: NS_E_NO_DATAVIEW_SUPPORT +// +// MessageText: +// +// It is not possible to display your source or output video in the Video panel.%0 +// + NS_E_NO_DATAVIEW_SUPPORT = HRESULT($C00D1B82); + {$EXTERNALSYM NS_E_NO_DATAVIEW_SUPPORT} + +// +// MessageId: NS_E_CODEC_UNAVAILABLE +// +// MessageText: +// +// One or more codecs required to open this content could not be found.%0 +// + NS_E_CODEC_UNAVAILABLE = HRESULT($C00D1B83); + {$EXTERNALSYM NS_E_CODEC_UNAVAILABLE} + +// +// MessageId: NS_E_ARCHIVE_SAME_AS_INPUT +// +// MessageText: +// +// The archive file has the same name as an input file. Change one of the names before continuing.%0 +// + NS_E_ARCHIVE_SAME_AS_INPUT = HRESULT($C00D1B84); + {$EXTERNALSYM NS_E_ARCHIVE_SAME_AS_INPUT} + +// +// MessageId: NS_E_SOURCE_NOTSPECIFIED +// +// MessageText: +// +// The source has not been set up completely.%0 +// + NS_E_SOURCE_NOTSPECIFIED = HRESULT($C00D1B85); + {$EXTERNALSYM NS_E_SOURCE_NOTSPECIFIED} + +// +// MessageId: NS_E_NO_REALTIME_TIMECOMPRESSION +// +// MessageText: +// +// It is not possible to apply time compression to a broadcast session.%0 +// + NS_E_NO_REALTIME_TIMECOMPRESSION = HRESULT($C00D1B86); + {$EXTERNALSYM NS_E_NO_REALTIME_TIMECOMPRESSION} + +// +// MessageId: NS_E_UNSUPPORTED_ENCODER_DEVICE +// +// MessageText: +// +// It is not possible to open this device.%0 +// + NS_E_UNSUPPORTED_ENCODER_DEVICE = HRESULT($C00D1B87); + {$EXTERNALSYM NS_E_UNSUPPORTED_ENCODER_DEVICE} + +// +// MessageId: NS_E_UNEXPECTED_DISPLAY_SETTINGS +// +// MessageText: +// +// It is not possible to start encoding because the display size or color has changed since the current session was defined. Restore the previous settings or create a new session.%0 +// + NS_E_UNEXPECTED_DISPLAY_SETTINGS = HRESULT($C00D1B88); + {$EXTERNALSYM NS_E_UNEXPECTED_DISPLAY_SETTINGS} + +// +// MessageId: NS_E_NO_AUDIODATA +// +// MessageText: +// +// No audio data has been received for several seconds. Check the audio source and restart the encoder.%0 +// + NS_E_NO_AUDIODATA = HRESULT($C00D1B89); + {$EXTERNALSYM NS_E_NO_AUDIODATA} + +// +// MessageId: NS_E_INPUTSOURCE_PROBLEM +// +// MessageText: +// +// One or all of the specified sources are not working properly. Check that the sources are configured correctly.%0 +// + NS_E_INPUTSOURCE_PROBLEM = HRESULT($C00D1B8A); + {$EXTERNALSYM NS_E_INPUTSOURCE_PROBLEM} + +// +// MessageId: NS_E_WME_VERSION_MISMATCH +// +// MessageText: +// +// The supplied configuration file is not supported by this version of the encoder.%0 +// + NS_E_WME_VERSION_MISMATCH = HRESULT($C00D1B8B); + {$EXTERNALSYM NS_E_WME_VERSION_MISMATCH} + +// +// MessageId: NS_E_NO_REALTIME_PREPROCESS +// +// MessageText: +// +// It is not possible to use image preprocessing with live encoding.%0 +// + NS_E_NO_REALTIME_PREPROCESS = HRESULT($C00D1B8C); + {$EXTERNALSYM NS_E_NO_REALTIME_PREPROCESS} + +// +// MessageId: NS_E_NO_REPEAT_PREPROCESS +// +// MessageText: +// +// It is not possible to use two-pass encoding when the source is set to loop.%0 +// + NS_E_NO_REPEAT_PREPROCESS = HRESULT($C00D1B8D); + {$EXTERNALSYM NS_E_NO_REPEAT_PREPROCESS} + +// +// MessageId: NS_E_CANNOT_PAUSE_LIVEBROADCAST +// +// MessageText: +// +// It is not possible to pause encoding during a broadcast.%0 +// + NS_E_CANNOT_PAUSE_LIVEBROADCAST = HRESULT($C00D1B8E); + {$EXTERNALSYM NS_E_CANNOT_PAUSE_LIVEBROADCAST} + +// +// MessageId: NS_E_DRM_PROFILE_NOT_SET +// +// MessageText: +// +// A DRM profile has not been set for the current session.%0 +// + NS_E_DRM_PROFILE_NOT_SET = HRESULT($C00D1B8F); + {$EXTERNALSYM NS_E_DRM_PROFILE_NOT_SET} + +// +// MessageId: NS_E_DUPLICATE_DRMPROFILE +// +// MessageText: +// +// The profile ID is already used by a DRM profile. Specify a different profile ID.%0 +// + NS_E_DUPLICATE_DRMPROFILE = HRESULT($C00D1B90); + {$EXTERNALSYM NS_E_DUPLICATE_DRMPROFILE} + +// +// MessageId: NS_E_INVALID_DEVICE +// +// MessageText: +// +// The setting of the selected device does not support control for playing back tapes.%0 +// + NS_E_INVALID_DEVICE = HRESULT($C00D1B91); + {$EXTERNALSYM NS_E_INVALID_DEVICE} + +// +// MessageId: NS_E_SPEECHEDL_ON_NON_MIXEDMODE +// +// MessageText: +// +// You must specify a mixed voice and audio mode in order to use an optimization definition file.%0 +// + NS_E_SPEECHEDL_ON_NON_MIXEDMODE = HRESULT($C00D1B92); + {$EXTERNALSYM NS_E_SPEECHEDL_ON_NON_MIXEDMODE} + +// +// MessageId: NS_E_DRM_PASSWORD_TOO_LONG +// +// MessageText: +// +// The specified password is too long. Type a password with fewer than 8 characters.%0 +// + NS_E_DRM_PASSWORD_TOO_LONG = HRESULT($C00D1B93); + {$EXTERNALSYM NS_E_DRM_PASSWORD_TOO_LONG} + +// +// MessageId: NS_E_DEVCONTROL_FAILED_SEEK +// +// MessageText: +// +// It is not possible to seek to the specified mark-in point.%0 +// + NS_E_DEVCONTROL_FAILED_SEEK = HRESULT($C00D1B94); + {$EXTERNALSYM NS_E_DEVCONTROL_FAILED_SEEK} + +// +// MessageId: NS_E_INTERLACE_REQUIRE_SAMESIZE +// +// MessageText: +// +// When you choose to maintain the interlacing in your video, the output video size must match the input video size.%0 +// + NS_E_INTERLACE_REQUIRE_SAMESIZE = HRESULT($C00D1B95); + {$EXTERNALSYM NS_E_INTERLACE_REQUIRE_SAMESIZE} + +// +// MessageId: NS_E_TOO_MANY_DEVICECONTROL +// +// MessageText: +// +// Only one device control plug-in can control a device.%0 +// + NS_E_TOO_MANY_DEVICECONTROL = HRESULT($C00D1B96); + {$EXTERNALSYM NS_E_TOO_MANY_DEVICECONTROL} + +// +// MessageId: NS_E_NO_MULTIPASS_FOR_LIVEDEVICE +// +// MessageText: +// +// You must also enable storing content to hard disk temporarily in order to use two-pass encoding with the input device.%0 +// + NS_E_NO_MULTIPASS_FOR_LIVEDEVICE = HRESULT($C00D1B97); + {$EXTERNALSYM NS_E_NO_MULTIPASS_FOR_LIVEDEVICE} + +// +// MessageId: NS_E_MISSING_AUDIENCE +// +// MessageText: +// +// An audience is missing from the output stream configuration.%0 +// + NS_E_MISSING_AUDIENCE = HRESULT($C00D1B98); + {$EXTERNALSYM NS_E_MISSING_AUDIENCE} + +// +// MessageId: NS_E_AUDIENCE_CONTENTTYPE_MISMATCH +// +// MessageText: +// +// All audiences in the output tree must have the same content type.%0 +// + NS_E_AUDIENCE_CONTENTTYPE_MISMATCH = HRESULT($C00D1B99); + {$EXTERNALSYM NS_E_AUDIENCE_CONTENTTYPE_MISMATCH} + +// +// MessageId: NS_E_MISSING_SOURCE_INDEX +// +// MessageText: +// +// A source index is missing from the output stream configuration.%0 +// + NS_E_MISSING_SOURCE_INDEX = HRESULT($C00D1B9A); + {$EXTERNALSYM NS_E_MISSING_SOURCE_INDEX} + +// +// MessageId: NS_E_NUM_LANGUAGE_MISMATCH +// +// MessageText: +// +// The same source index in different audiences should have the same number of languages.%0 +// + NS_E_NUM_LANGUAGE_MISMATCH = HRESULT($C00D1B9B); + {$EXTERNALSYM NS_E_NUM_LANGUAGE_MISMATCH} + +// +// MessageId: NS_E_LANGUAGE_MISMATCH +// +// MessageText: +// +// The same source index in different audiences should have the same languages.%0 +// + NS_E_LANGUAGE_MISMATCH = HRESULT($C00D1B9C); + {$EXTERNALSYM NS_E_LANGUAGE_MISMATCH} + +// +// MessageId: NS_E_VBRMODE_MISMATCH +// +// MessageText: +// +// The same source index in different audiences should use the same VBR encoding mode.%0 +// + NS_E_VBRMODE_MISMATCH = HRESULT($C00D1B9D); + {$EXTERNALSYM NS_E_VBRMODE_MISMATCH} + +// +// MessageId: NS_E_INVALID_INPUT_AUDIENCE_INDEX +// +// MessageText: +// +// The bit rate index specified is not valid.%0 +// + NS_E_INVALID_INPUT_AUDIENCE_INDEX = HRESULT($C00D1B9E); + {$EXTERNALSYM NS_E_INVALID_INPUT_AUDIENCE_INDEX} + +// +// MessageId: NS_E_INVALID_INPUT_LANGUAGE +// +// MessageText: +// +// The specified language is not valid.%0 +// + NS_E_INVALID_INPUT_LANGUAGE = HRESULT($C00D1B9F); + {$EXTERNALSYM NS_E_INVALID_INPUT_LANGUAGE} + +// +// MessageId: NS_E_INVALID_INPUT_STREAM +// +// MessageText: +// +// The specified source type is not valid.%0 +// + NS_E_INVALID_INPUT_STREAM = HRESULT($C00D1BA0); + {$EXTERNALSYM NS_E_INVALID_INPUT_STREAM} + +// +// MessageId: NS_E_EXPECT_MONO_WAV_INPUT +// +// MessageText: +// +// The source must be a mono channel .wav file.%0 +// + NS_E_EXPECT_MONO_WAV_INPUT = HRESULT($C00D1BA1); + {$EXTERNALSYM NS_E_EXPECT_MONO_WAV_INPUT} + +// +// MessageId: NS_E_INPUT_WAVFORMAT_MISMATCH +// +// MessageText: +// +// All the source .wav files must have the same format.%0 +// + NS_E_INPUT_WAVFORMAT_MISMATCH = HRESULT($C00D1BA2); + {$EXTERNALSYM NS_E_INPUT_WAVFORMAT_MISMATCH} + +// +// MessageId: NS_E_RECORDQ_DISK_FULL +// +// MessageText: +// +// The hard disk being used for temporary storage of content has reached the minimum allowed disk space. Create more space on the hard disk and restart encoding.%0 +// + NS_E_RECORDQ_DISK_FULL = HRESULT($C00D1BA3); + {$EXTERNALSYM NS_E_RECORDQ_DISK_FULL} + +// +// MessageId: NS_E_NO_PAL_INVERSE_TELECINE +// +// MessageText: +// +// It is not possible to apply the inverse telecine feature to PAL content.%0 +// + NS_E_NO_PAL_INVERSE_TELECINE = HRESULT($C00D1BA4); + {$EXTERNALSYM NS_E_NO_PAL_INVERSE_TELECINE} + +// +// MessageId: NS_E_ACTIVE_SG_DEVICE_DISCONNECTED +// +// MessageText: +// +// A capture device in the current active source is no longer available.%0 +// + NS_E_ACTIVE_SG_DEVICE_DISCONNECTED = HRESULT($C00D1BA5); + {$EXTERNALSYM NS_E_ACTIVE_SG_DEVICE_DISCONNECTED} + +// +// MessageId: NS_E_ACTIVE_SG_DEVICE_CONTROL_DISCONNECTED +// +// MessageText: +// +// A device used in the current active source for device control is no longer available.%0 +// + NS_E_ACTIVE_SG_DEVICE_CONTROL_DISCONNECTED = HRESULT($C00D1BA6); + {$EXTERNALSYM NS_E_ACTIVE_SG_DEVICE_CONTROL_DISCONNECTED} + +// +// MessageId: NS_E_NO_FRAMES_SUBMITTED_TO_ANALYZER +// +// MessageText: +// +// No frames have been submitted to the analyzer for analysis.%0 +// + NS_E_NO_FRAMES_SUBMITTED_TO_ANALYZER = HRESULT($C00D1BA7); + {$EXTERNALSYM NS_E_NO_FRAMES_SUBMITTED_TO_ANALYZER} + +// +// MessageId: NS_E_INPUT_DOESNOT_SUPPORT_SMPTE +// +// MessageText: +// +// The source video does not support time codes.%0 +// + NS_E_INPUT_DOESNOT_SUPPORT_SMPTE = HRESULT($C00D1BA8); + {$EXTERNALSYM NS_E_INPUT_DOESNOT_SUPPORT_SMPTE} + +// +// MessageId: NS_E_NO_SMPTE_WITH_MULTIPLE_SOURCEGROUPS +// +// MessageText: +// +// It is not possible to generate a time code when there are multiple sources in a session.%0 +// + NS_E_NO_SMPTE_WITH_MULTIPLE_SOURCEGROUPS = HRESULT($C00D1BA9); + {$EXTERNALSYM NS_E_NO_SMPTE_WITH_MULTIPLE_SOURCEGROUPS} + +// +// MessageId: NS_E_BAD_CONTENTEDL +// +// MessageText: +// +// The voice codec optimization definition file can not be found or is corrupted.%0 +// + NS_E_BAD_CONTENTEDL = HRESULT($C00D1BAA); + {$EXTERNALSYM NS_E_BAD_CONTENTEDL} + +// +// MessageId: NS_E_INTERLACEMODE_MISMATCH +// +// MessageText: +// +// The same source index in different audiences should have the same interlace mode.%0 +// + NS_E_INTERLACEMODE_MISMATCH = HRESULT($C00D1BAB); + {$EXTERNALSYM NS_E_INTERLACEMODE_MISMATCH} + +// +// MessageId: NS_E_NONSQUAREPIXELMODE_MISMATCH +// +// MessageText: +// +// The same source index in different audiences should have the same nonsquare pixel mode.%0 +// + NS_E_NONSQUAREPIXELMODE_MISMATCH = HRESULT($C00D1BAC); + {$EXTERNALSYM NS_E_NONSQUAREPIXELMODE_MISMATCH} + +// +// MessageId: NS_E_SMPTEMODE_MISMATCH +// +// MessageText: +// +// The same source index in different audiences should have the same time code mode.%0 +// + NS_E_SMPTEMODE_MISMATCH = HRESULT($C00D1BAD); + {$EXTERNALSYM NS_E_SMPTEMODE_MISMATCH} + +// +// MessageId: NS_E_END_OF_TAPE +// +// MessageText: +// +// Either the end of the tape has been reached or there is no tape. Check the device and tape.%0 +// + NS_E_END_OF_TAPE = HRESULT($C00D1BAE); + {$EXTERNALSYM NS_E_END_OF_TAPE} + +// +// MessageId: NS_E_NO_MEDIA_IN_AUDIENCE +// +// MessageText: +// +// No audio or video input has been specified.%0 +// + NS_E_NO_MEDIA_IN_AUDIENCE = HRESULT($C00D1BAF); + {$EXTERNALSYM NS_E_NO_MEDIA_IN_AUDIENCE} + +// +// MessageId: NS_E_NO_AUDIENCES +// +// MessageText: +// +// The profile must contain a bit rate.%0 +// + NS_E_NO_AUDIENCES = HRESULT($C00D1BB0); + {$EXTERNALSYM NS_E_NO_AUDIENCES} + +// +// MessageId: NS_E_NO_AUDIO_COMPAT +// +// MessageText: +// +// You must specify at least one audio stream to be compatible with Windows Media Player 7.1.%0 +// + NS_E_NO_AUDIO_COMPAT = HRESULT($C00D1BB1); + {$EXTERNALSYM NS_E_NO_AUDIO_COMPAT} + +// +// MessageId: NS_E_INVALID_VBR_COMPAT +// +// MessageText: +// +// Using a VBR encoding mode is not compatible with Windows Media Player 7.1.%0 +// + NS_E_INVALID_VBR_COMPAT = HRESULT($C00D1BB2); + {$EXTERNALSYM NS_E_INVALID_VBR_COMPAT} + +// +// MessageId: NS_E_NO_PROFILE_NAME +// +// MessageText: +// +// You must specify a profile name.%0 +// + NS_E_NO_PROFILE_NAME = HRESULT($C00D1BB3); + {$EXTERNALSYM NS_E_NO_PROFILE_NAME} + +// +// MessageId: NS_E_INVALID_VBR_WITH_UNCOMP +// +// MessageText: +// +// It is not possible to use a VBR encoding mode with uncompressed audio or video.%0 +// + NS_E_INVALID_VBR_WITH_UNCOMP = HRESULT($C00D1BB4); + {$EXTERNALSYM NS_E_INVALID_VBR_WITH_UNCOMP} + +// +// MessageId: NS_E_MULTIPLE_VBR_AUDIENCES +// +// MessageText: +// +// It is not possible to use MBR encoding with VBR encoding.%0 +// + NS_E_MULTIPLE_VBR_AUDIENCES = HRESULT($C00D1BB5); + {$EXTERNALSYM NS_E_MULTIPLE_VBR_AUDIENCES} + +// +// MessageId: NS_E_UNCOMP_COMP_COMBINATION +// +// MessageText: +// +// It is not possible to mix uncompressed and compressed content in a session.%0 +// + NS_E_UNCOMP_COMP_COMBINATION = HRESULT($C00D1BB6); + {$EXTERNALSYM NS_E_UNCOMP_COMP_COMBINATION} + +// +// MessageId: NS_E_MULTIPLE_AUDIO_CODECS +// +// MessageText: +// +// All audiences must use the same audio codec.%0 +// + NS_E_MULTIPLE_AUDIO_CODECS = HRESULT($C00D1BB7); + {$EXTERNALSYM NS_E_MULTIPLE_AUDIO_CODECS} + +// +// MessageId: NS_E_MULTIPLE_AUDIO_FORMATS +// +// MessageText: +// +// All audiences should use the same audio format to be compatible with Windows Media Player 7.1.%0 +// + NS_E_MULTIPLE_AUDIO_FORMATS = HRESULT($C00D1BB8); + {$EXTERNALSYM NS_E_MULTIPLE_AUDIO_FORMATS} + +// +// MessageId: NS_E_AUDIO_BITRATE_STEPDOWN +// +// MessageText: +// +// The audio bit rate for an audience with a higher total bit rate must be greater than one with a lower total bit rate.%0 +// + NS_E_AUDIO_BITRATE_STEPDOWN = HRESULT($C00D1BB9); + {$EXTERNALSYM NS_E_AUDIO_BITRATE_STEPDOWN} + +// +// MessageId: NS_E_INVALID_AUDIO_PEAKRATE +// +// MessageText: +// +// The audio peak bit rate setting is not valid.%0 +// + NS_E_INVALID_AUDIO_PEAKRATE = HRESULT($C00D1BBA); + {$EXTERNALSYM NS_E_INVALID_AUDIO_PEAKRATE} + +// +// MessageId: NS_E_INVALID_AUDIO_PEAKRATE_2 +// +// MessageText: +// +// The audio peak bit rate setting must be greater than the audio bit rate setting.%0 +// + NS_E_INVALID_AUDIO_PEAKRATE_2 = HRESULT($C00D1BBB); + {$EXTERNALSYM NS_E_INVALID_AUDIO_PEAKRATE_2} + +// +// MessageId: NS_E_INVALID_AUDIO_BUFFERMAX +// +// MessageText: +// +// The setting for the maximum buffer size for audio is not valid.%0 +// + NS_E_INVALID_AUDIO_BUFFERMAX = HRESULT($C00D1BBC); + {$EXTERNALSYM NS_E_INVALID_AUDIO_BUFFERMAX} + +// +// MessageId: NS_E_MULTIPLE_VIDEO_CODECS +// +// MessageText: +// +// All audiences must use the same video codec.%0 +// + NS_E_MULTIPLE_VIDEO_CODECS = HRESULT($C00D1BBD); + {$EXTERNALSYM NS_E_MULTIPLE_VIDEO_CODECS} + +// +// MessageId: NS_E_MULTIPLE_VIDEO_SIZES +// +// MessageText: +// +// All audiences should use the same video size to be compatible with Windows Media Player 7.1.%0 +// + NS_E_MULTIPLE_VIDEO_SIZES = HRESULT($C00D1BBE); + {$EXTERNALSYM NS_E_MULTIPLE_VIDEO_SIZES} + +// +// MessageId: NS_E_INVALID_VIDEO_BITRATE +// +// MessageText: +// +// The video bit rate setting is not valid.%0 +// + NS_E_INVALID_VIDEO_BITRATE = HRESULT($C00D1BBF); + {$EXTERNALSYM NS_E_INVALID_VIDEO_BITRATE} + +// +// MessageId: NS_E_VIDEO_BITRATE_STEPDOWN +// +// MessageText: +// +// The video bit rate for an audience with a higher total bit rate must be greater than one with a lower total bit rate.%0 +// + NS_E_VIDEO_BITRATE_STEPDOWN = HRESULT($C00D1BC0); + {$EXTERNALSYM NS_E_VIDEO_BITRATE_STEPDOWN} + +// +// MessageId: NS_E_INVALID_VIDEO_PEAKRATE +// +// MessageText: +// +// The video peak bit rate setting is not valid.%0 +// + NS_E_INVALID_VIDEO_PEAKRATE = HRESULT($C00D1BC1); + {$EXTERNALSYM NS_E_INVALID_VIDEO_PEAKRATE} + +// +// MessageId: NS_E_INVALID_VIDEO_PEAKRATE_2 +// +// MessageText: +// +// The video peak bit rate setting must be greater than the video bit rate setting.%0 +// + NS_E_INVALID_VIDEO_PEAKRATE_2 = HRESULT($C00D1BC2); + {$EXTERNALSYM NS_E_INVALID_VIDEO_PEAKRATE_2} + +// +// MessageId: NS_E_INVALID_VIDEO_WIDTH +// +// MessageText: +// +// The video width setting is not valid.%0 +// + NS_E_INVALID_VIDEO_WIDTH = HRESULT($C00D1BC3); + {$EXTERNALSYM NS_E_INVALID_VIDEO_WIDTH} + +// +// MessageId: NS_E_INVALID_VIDEO_HEIGHT +// +// MessageText: +// +// The video height setting is not valid.%0 +// + NS_E_INVALID_VIDEO_HEIGHT = HRESULT($C00D1BC4); + {$EXTERNALSYM NS_E_INVALID_VIDEO_HEIGHT} + +// +// MessageId: NS_E_INVALID_VIDEO_FPS +// +// MessageText: +// +// The video frame rate setting is not valid.%0 +// + NS_E_INVALID_VIDEO_FPS = HRESULT($C00D1BC5); + {$EXTERNALSYM NS_E_INVALID_VIDEO_FPS} + +// +// MessageId: NS_E_INVALID_VIDEO_KEYFRAME +// +// MessageText: +// +// The video key frame setting is not valid.%0 +// + NS_E_INVALID_VIDEO_KEYFRAME = HRESULT($C00D1BC6); + {$EXTERNALSYM NS_E_INVALID_VIDEO_KEYFRAME} + +// +// MessageId: NS_E_INVALID_VIDEO_IQUALITY +// +// MessageText: +// +// The video image quality setting is not valid.%0 +// + NS_E_INVALID_VIDEO_IQUALITY = HRESULT($C00D1BC7); + {$EXTERNALSYM NS_E_INVALID_VIDEO_IQUALITY} + +// +// MessageId: NS_E_INVALID_VIDEO_CQUALITY +// +// MessageText: +// +// The video codec quality setting is not valid.%0 +// + NS_E_INVALID_VIDEO_CQUALITY = HRESULT($C00D1BC8); + {$EXTERNALSYM NS_E_INVALID_VIDEO_CQUALITY} + +// +// MessageId: NS_E_INVALID_VIDEO_BUFFER +// +// MessageText: +// +// The video buffer setting is not valid.%0 +// + NS_E_INVALID_VIDEO_BUFFER = HRESULT($C00D1BC9); + {$EXTERNALSYM NS_E_INVALID_VIDEO_BUFFER} + +// +// MessageId: NS_E_INVALID_VIDEO_BUFFERMAX +// +// MessageText: +// +// The setting for the maximum buffer size for video is not valid.%0 +// + NS_E_INVALID_VIDEO_BUFFERMAX = HRESULT($C00D1BCA); + {$EXTERNALSYM NS_E_INVALID_VIDEO_BUFFERMAX} + +// +// MessageId: NS_E_INVALID_VIDEO_BUFFERMAX_2 +// +// MessageText: +// +// The value of the video maximum buffer size setting must be greater than the video buffer size setting.%0 +// + NS_E_INVALID_VIDEO_BUFFERMAX_2 = HRESULT($C00D1BCB); + {$EXTERNALSYM NS_E_INVALID_VIDEO_BUFFERMAX_2} + +// +// MessageId: NS_E_INVALID_VIDEO_WIDTH_ALIGN +// +// MessageText: +// +// The alignment of the video width is not valid.%0 +// + NS_E_INVALID_VIDEO_WIDTH_ALIGN = HRESULT($C00D1BCC); + {$EXTERNALSYM NS_E_INVALID_VIDEO_WIDTH_ALIGN} + +// +// MessageId: NS_E_INVALID_VIDEO_HEIGHT_ALIGN +// +// MessageText: +// +// The alignment of the video height is not valid.%0 +// + NS_E_INVALID_VIDEO_HEIGHT_ALIGN = HRESULT($C00D1BCD); + {$EXTERNALSYM NS_E_INVALID_VIDEO_HEIGHT_ALIGN} + +// +// MessageId: NS_E_MULTIPLE_SCRIPT_BITRATES +// +// MessageText: +// +// All bit rates must have the same script bit rate.%0 +// + NS_E_MULTIPLE_SCRIPT_BITRATES = HRESULT($C00D1BCE); + {$EXTERNALSYM NS_E_MULTIPLE_SCRIPT_BITRATES} + +// +// MessageId: NS_E_INVALID_SCRIPT_BITRATE +// +// MessageText: +// +// The script bit rate specified is not valid.%0 +// + NS_E_INVALID_SCRIPT_BITRATE = HRESULT($C00D1BCF); + {$EXTERNALSYM NS_E_INVALID_SCRIPT_BITRATE} + +// +// MessageId: NS_E_MULTIPLE_FILE_BITRATES +// +// MessageText: +// +// All bit rates must have the same file transfer bit rate.%0 +// + NS_E_MULTIPLE_FILE_BITRATES = HRESULT($C00D1BD0); + {$EXTERNALSYM NS_E_MULTIPLE_FILE_BITRATES} + +// +// MessageId: NS_E_INVALID_FILE_BITRATE +// +// MessageText: +// +// The file transfer bit rate is not valid.%0 +// + NS_E_INVALID_FILE_BITRATE = HRESULT($C00D1BD1); + {$EXTERNALSYM NS_E_INVALID_FILE_BITRATE} + +// +// MessageId: NS_E_SAME_AS_INPUT_COMBINATION +// +// MessageText: +// +// All audiences in a profile should either be same as input or have video width and height specified.%0 +// + NS_E_SAME_AS_INPUT_COMBINATION = HRESULT($C00D1BD2); + {$EXTERNALSYM NS_E_SAME_AS_INPUT_COMBINATION} + +// +// MessageId: NS_E_SOURCE_CANNOT_LOOP +// +// MessageText: +// +// This source type does not support looping.%0 +// + NS_E_SOURCE_CANNOT_LOOP = HRESULT($C00D1BD3); + {$EXTERNALSYM NS_E_SOURCE_CANNOT_LOOP} + +// +// MessageId: NS_E_INVALID_FOLDDOWN_COEFFICIENTS +// +// MessageText: +// +// The fold-down value needs to be between -144 and 0.%0 +// + NS_E_INVALID_FOLDDOWN_COEFFICIENTS = HRESULT($C00D1BD4); + {$EXTERNALSYM NS_E_INVALID_FOLDDOWN_COEFFICIENTS} + +// +// MessageId: NS_E_DRMPROFILE_NOTFOUND +// +// MessageText: +// +// The specified DRM profile does not exist in the system.%0 +// + NS_E_DRMPROFILE_NOTFOUND = HRESULT($C00D1BD5); + {$EXTERNALSYM NS_E_DRMPROFILE_NOTFOUND} + +// +// MessageId: NS_E_INVALID_TIMECODE +// +// MessageText: +// +// The specified time code is not valid.%0 +// + NS_E_INVALID_TIMECODE = HRESULT($C00D1BD6); + {$EXTERNALSYM NS_E_INVALID_TIMECODE} + +// +// MessageId: NS_E_NO_AUDIO_TIMECOMPRESSION +// +// MessageText: +// +// It is not possible to apply time compression to a video-only session.%0 +// + NS_E_NO_AUDIO_TIMECOMPRESSION = HRESULT($C00D1BD7); + {$EXTERNALSYM NS_E_NO_AUDIO_TIMECOMPRESSION} + +// +// MessageId: NS_E_NO_TWOPASS_TIMECOMPRESSION +// +// MessageText: +// +// It is not possible to apply time compression to a session that is using two-pass encoding.%0 +// + NS_E_NO_TWOPASS_TIMECOMPRESSION = HRESULT($C00D1BD8); + {$EXTERNALSYM NS_E_NO_TWOPASS_TIMECOMPRESSION} + +// +// MessageId: NS_E_TIMECODE_REQUIRES_VIDEOSTREAM +// +// MessageText: +// +// It is not possible to generate a time code for an audio-only session.%0 +// + NS_E_TIMECODE_REQUIRES_VIDEOSTREAM = HRESULT($C00D1BD9); + {$EXTERNALSYM NS_E_TIMECODE_REQUIRES_VIDEOSTREAM} + +// +// MessageId: NS_E_NO_MBR_WITH_TIMECODE +// +// MessageText: +// +// It is not possible to generate a time code when you are encoding content at multiple bit rates.%0 +// + NS_E_NO_MBR_WITH_TIMECODE = HRESULT($C00D1BDA); + {$EXTERNALSYM NS_E_NO_MBR_WITH_TIMECODE} + +// +// MessageId: NS_E_INVALID_INTERLACEMODE +// +// MessageText: +// +// The video codec selected does not support maintaining interlacing in video.%0 +// + NS_E_INVALID_INTERLACEMODE = HRESULT($C00D1BDB); + {$EXTERNALSYM NS_E_INVALID_INTERLACEMODE} + +// +// MessageId: NS_E_INVALID_INTERLACE_COMPAT +// +// MessageText: +// +// Maintaining interlacing in video is not compatible with Windows Media Player 7.1.%0 +// + NS_E_INVALID_INTERLACE_COMPAT = HRESULT($C00D1BDC); + {$EXTERNALSYM NS_E_INVALID_INTERLACE_COMPAT} + +// +// MessageId: NS_E_INVALID_NONSQUAREPIXEL_COMPAT +// +// MessageText: +// +// Allowing nonsquare pixel output is not compatible with Windows Media Player 7.1.%0 +// + NS_E_INVALID_NONSQUAREPIXEL_COMPAT = HRESULT($C00D1BDD); + {$EXTERNALSYM NS_E_INVALID_NONSQUAREPIXEL_COMPAT} + +// +// MessageId: NS_E_INVALID_SOURCE_WITH_DEVICE_CONTROL +// +// MessageText: +// +// Only capture devices can be used with device control.%0 +// + NS_E_INVALID_SOURCE_WITH_DEVICE_CONTROL = HRESULT($C00D1BDE); + {$EXTERNALSYM NS_E_INVALID_SOURCE_WITH_DEVICE_CONTROL} + +// +// MessageId: NS_E_CANNOT_GENERATE_BROADCAST_INFO_FOR_QUALITYVBR +// +// MessageText: +// +// It is not possible to generate the stream format file if you are using +// quality-based VBR encoding for the audio or video stream. Instead use the +// Windows Media file generated after +// encoding to create the announcement file.%0 +// + NS_E_CANNOT_GENERATE_BROADCAST_INFO_FOR_QUALITYVBR = HRESULT($C00D1BDF); + {$EXTERNALSYM NS_E_CANNOT_GENERATE_BROADCAST_INFO_FOR_QUALITYVBR} + +// +// MessageId: NS_E_EXCEED_MAX_DRM_PROFILE_LIMIT +// +// MessageText: +// +// It is not possible to create a DRM profile because the maximum number of profiles has been reached. You must delete some DRM profiles before creating new ones.%0 +// + NS_E_EXCEED_MAX_DRM_PROFILE_LIMIT = HRESULT($C00D1BE0); + {$EXTERNALSYM NS_E_EXCEED_MAX_DRM_PROFILE_LIMIT} + +// +// MessageId: NS_E_DEVICECONTROL_UNSTABLE +// +// MessageText: +// +// The device is in an unstable state. Check that the device is functioning properly and a tape is in place. +// + NS_E_DEVICECONTROL_UNSTABLE = HRESULT($C00D1BE1); + {$EXTERNALSYM NS_E_DEVICECONTROL_UNSTABLE} + +// +// MessageId: NS_E_INVALID_PIXEL_ASPECT_RATIO +// +// MessageText: +// +// The pixel aspect ratio value must be between 1 and 255. +// + NS_E_INVALID_PIXEL_ASPECT_RATIO = HRESULT($C00D1BE2); + {$EXTERNALSYM NS_E_INVALID_PIXEL_ASPECT_RATIO} + +// +// MessageId: NS_E_AUDIENCE__LANGUAGE_CONTENTTYPE_MISMATCH +// +// MessageText: +// +// All streams with different languages in the same audience must have same properties.%0 +// + NS_E_AUDIENCE__LANGUAGE_CONTENTTYPE_MISMATCH = HRESULT($C00D1BE3); + {$EXTERNALSYM NS_E_AUDIENCE__LANGUAGE_CONTENTTYPE_MISMATCH} + +// +// MessageId: NS_E_INVALID_PROFILE_CONTENTTYPE +// +// MessageText: +// +// The profile must contain at least one audio or video stream.%0 +// + NS_E_INVALID_PROFILE_CONTENTTYPE = HRESULT($C00D1BE4); + {$EXTERNALSYM NS_E_INVALID_PROFILE_CONTENTTYPE} + +// +// MessageId: NS_E_TRANSFORM_PLUGIN_NOT_FOUND +// +// MessageText: +// +// The transform plug-in could not be found.%0 +// + NS_E_TRANSFORM_PLUGIN_NOT_FOUND = HRESULT($C00D1BE5); + {$EXTERNALSYM NS_E_TRANSFORM_PLUGIN_NOT_FOUND} + +// +// MessageId: NS_E_TRANSFORM_PLUGIN_INVALID +// +// MessageText: +// +// The transform plug-in is not valid. It may be damaged or you may not have the required permissions to access the plug-in.%0 +// + NS_E_TRANSFORM_PLUGIN_INVALID = HRESULT($C00D1BE6); + {$EXTERNALSYM NS_E_TRANSFORM_PLUGIN_INVALID} + +// +// MessageId: NS_E_EDL_REQUIRED_FOR_DEVICE_MULTIPASS +// +// MessageText: +// +// To use two-pass encoding, you must enable device control and setup an edit decision list (ED); that has at least one entry.%0 +// + NS_E_EDL_REQUIRED_FOR_DEVICE_MULTIPASS = HRESULT($C00D1BE7); + {$EXTERNALSYM NS_E_EDL_REQUIRED_FOR_DEVICE_MULTIPASS} + +// +// MessageId: NS_E_INVALID_VIDEO_WIDTH_FOR_INTERLACED_ENCODING +// +// MessageText: +// +// When you choose to maintain the interlacing in your video, the output video size must be a multiple of 4.%0 +// + NS_E_INVALID_VIDEO_WIDTH_FOR_INTERLACED_ENCODING = HRESULT($C00D1BE8); + {$EXTERNALSYM NS_E_INVALID_VIDEO_WIDTH_FOR_INTERLACED_ENCODING} + + +///////////////////////////////////////////////////////////////////////// +// +// DRM Specific Errors +// +// IdRange = 10000..10999 +///////////////////////////////////////////////////////////////////////// +// +// MessageId: NS_E_DRM_INVALID_APPLICATION +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact product support for this application.%0 +// + NS_E_DRM_INVALID_APPLICATION = HRESULT($C00D2711); + {$EXTERNALSYM NS_E_DRM_INVALID_APPLICATION} + +// +// MessageId: NS_E_DRM_LICENSE_STORE_ERROR +// +// MessageText: +// +// License storage is not working. Contact Microsoft product support.%0 +// + NS_E_DRM_LICENSE_STORE_ERROR = HRESULT($C00D2712); + {$EXTERNALSYM NS_E_DRM_LICENSE_STORE_ERROR} + +// +// MessageId: NS_E_DRM_SECURE_STORE_ERROR +// +// MessageText: +// +// Secure storage is not working. Contact Microsoft product support.%0 +// + NS_E_DRM_SECURE_STORE_ERROR = HRESULT($C00D2713); + {$EXTERNALSYM NS_E_DRM_SECURE_STORE_ERROR} + +// +// MessageId: NS_E_DRM_LICENSE_STORE_SAVE_ERROR +// +// MessageText: +// +// License acquisition did not work. Acquire a new license or contact the content provider for further assistance.%0 +// + NS_E_DRM_LICENSE_STORE_SAVE_ERROR = HRESULT($C00D2714); + {$EXTERNALSYM NS_E_DRM_LICENSE_STORE_SAVE_ERROR} + +// +// MessageId: NS_E_DRM_SECURE_STORE_UNLOCK_ERROR +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0 +// + NS_E_DRM_SECURE_STORE_UNLOCK_ERROR = HRESULT($C00D2715); + {$EXTERNALSYM NS_E_DRM_SECURE_STORE_UNLOCK_ERROR} + +// +// MessageId: NS_E_DRM_INVALID_CONTENT +// +// MessageText: +// +// The media file is corrupted. Contact the content provider to get a new file.%0 +// + NS_E_DRM_INVALID_CONTENT = HRESULT($C00D2716); + {$EXTERNALSYM NS_E_DRM_INVALID_CONTENT} + +// +// MessageId: NS_E_DRM_UNABLE_TO_OPEN_LICENSE +// +// MessageText: +// +// The license is corrupted. Acquire a new license.%0 +// + NS_E_DRM_UNABLE_TO_OPEN_LICENSE = HRESULT($C00D2717); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_OPEN_LICENSE} + +// +// MessageId: NS_E_DRM_INVALID_LICENSE +// +// MessageText: +// +// The license is corrupted or invalid. Acquire a new license%0 +// + NS_E_DRM_INVALID_LICENSE = HRESULT($C00D2718); + {$EXTERNALSYM NS_E_DRM_INVALID_LICENSE} + +// +// MessageId: NS_E_DRM_INVALID_MACHINE +// +// MessageText: +// +// Licenses cannot be copied from one computer to another. Use License Management to transfer licenses, or get a new license for the media file.%0 +// + NS_E_DRM_INVALID_MACHINE = HRESULT($C00D2719); + {$EXTERNALSYM NS_E_DRM_INVALID_MACHINE} + +// +// MessageId: NS_E_DRM_ENUM_LICENSE_FAILED +// +// MessageText: +// +// License storage is not working. Contact Microsoft product support.%0 +// + NS_E_DRM_ENUM_LICENSE_FAILED = HRESULT($C00D271B); + {$EXTERNALSYM NS_E_DRM_ENUM_LICENSE_FAILED} + +// +// MessageId: NS_E_DRM_INVALID_LICENSE_REQUEST +// +// MessageText: +// +// The media file is corrupted. Contact the content provider to get a new file.%0 +// + NS_E_DRM_INVALID_LICENSE_REQUEST = HRESULT($C00D271C); + {$EXTERNALSYM NS_E_DRM_INVALID_LICENSE_REQUEST} + +// +// MessageId: NS_E_DRM_UNABLE_TO_INITIALIZE +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0 +// + NS_E_DRM_UNABLE_TO_INITIALIZE = HRESULT($C00D271D); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_INITIALIZE} + +// +// MessageId: NS_E_DRM_UNABLE_TO_ACQUIRE_LICENSE +// +// MessageText: +// +// The license could not be acquired. Try again later.%0 +// + NS_E_DRM_UNABLE_TO_ACQUIRE_LICENSE = HRESULT($C00D271E); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_ACQUIRE_LICENSE} + +// +// MessageId: NS_E_DRM_INVALID_LICENSE_ACQUIRED +// +// MessageText: +// +// License acquisition did not work. Acquire a new license or contact the content provider for further assistance.%0 +// + NS_E_DRM_INVALID_LICENSE_ACQUIRED = HRESULT($C00D271F); + {$EXTERNALSYM NS_E_DRM_INVALID_LICENSE_ACQUIRED} + +// +// MessageId: NS_E_DRM_NO_RIGHTS +// +// MessageText: +// +// The requested operation cannot be performed on this file.%0 +// + NS_E_DRM_NO_RIGHTS = HRESULT($C00D2720); + {$EXTERNALSYM NS_E_DRM_NO_RIGHTS} + +// +// MessageId: NS_E_DRM_KEY_ERROR +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_KEY_ERROR = HRESULT($C00D2721); + {$EXTERNALSYM NS_E_DRM_KEY_ERROR} + +// +// MessageId: NS_E_DRM_ENCRYPT_ERROR +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0 +// + NS_E_DRM_ENCRYPT_ERROR = HRESULT($C00D2722); + {$EXTERNALSYM NS_E_DRM_ENCRYPT_ERROR} + +// +// MessageId: NS_E_DRM_DECRYPT_ERROR +// +// MessageText: +// +// The media file is corrupted. Contact the content provider to get a new file.%0 +// + NS_E_DRM_DECRYPT_ERROR = HRESULT($C00D2723); + {$EXTERNALSYM NS_E_DRM_DECRYPT_ERROR} + +// +// MessageId: NS_E_DRM_LICENSE_INVALID_XML +// +// MessageText: +// +// The license is corrupted. Acquire a new license.%0 +// + NS_E_DRM_LICENSE_INVALID_XML = HRESULT($C00D2725); + {$EXTERNALSYM NS_E_DRM_LICENSE_INVALID_XML} + +// +// MessageId: NS_S_DRM_LICENSE_ACQUIRED +// +// MessageText: +// +// Status message: The license was acquired.%0 +// + NS_S_DRM_LICENSE_ACQUIRED = HRESULT($000D2726); + {$EXTERNALSYM NS_S_DRM_LICENSE_ACQUIRED} + +// +// MessageId: NS_S_DRM_INDIVIDUALIZED +// +// MessageText: +// +// Status message: The security upgrade has been completed.%0 +// + NS_S_DRM_INDIVIDUALIZED = HRESULT($000D2727); + {$EXTERNALSYM NS_S_DRM_INDIVIDUALIZED} + +// +// MessageId: NS_E_DRM_NEEDS_INDIVIDUALIZATION +// +// MessageText: +// +// A security upgrade is required to perform the operation on this media file.%0 +// + NS_E_DRM_NEEDS_INDIVIDUALIZATION = HRESULT($C00D2728); + {$EXTERNALSYM NS_E_DRM_NEEDS_INDIVIDUALIZATION} + +// +// MessageId: NS_E_DRM_ALREADY_INDIVIDUALIZED +// +// MessageText: +// +// You already have the latest security components. No upgrade is necessary at this time.%0 +// + NS_E_DRM_ALREADY_INDIVIDUALIZED = HRESULT($C00D2729); + {$EXTERNALSYM NS_E_DRM_ALREADY_INDIVIDUALIZED} + +// +// MessageId: NS_E_DRM_ACTION_NOT_QUERIED +// +// MessageText: +// +// The application cannot perform this action. Contact product support for this application.%0 +// + NS_E_DRM_ACTION_NOT_QUERIED = HRESULT($C00D272A); + {$EXTERNALSYM NS_E_DRM_ACTION_NOT_QUERIED} + +// +// MessageId: NS_E_DRM_ACQUIRING_LICENSE +// +// MessageText: +// +// You cannot begin a new license acquisition process until the current one has been completed.%0 +// + NS_E_DRM_ACQUIRING_LICENSE = HRESULT($C00D272B); + {$EXTERNALSYM NS_E_DRM_ACQUIRING_LICENSE} + +// +// MessageId: NS_E_DRM_INDIVIDUALIZING +// +// MessageText: +// +// You cannot begin a new security upgrade until the current one has been completed.%0 +// + NS_E_DRM_INDIVIDUALIZING = HRESULT($C00D272C); + {$EXTERNALSYM NS_E_DRM_INDIVIDUALIZING} + +// +// MessageId: NS_E_DRM_PARAMETERS_MISMATCHED +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_PARAMETERS_MISMATCHED = HRESULT($C00D272F); + {$EXTERNALSYM NS_E_DRM_PARAMETERS_MISMATCHED} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_LICENSE_OBJECT +// +// MessageText: +// +// A license cannot be created for this media file. Reinstall the application.%0 +// + NS_E_DRM_UNABLE_TO_CREATE_LICENSE_OBJECT = HRESULT($C00D2730); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_LICENSE_OBJECT} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_INDI_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_INDI_OBJECT = HRESULT($C00D2731); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_INDI_OBJECT} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_ENCRYPT_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_ENCRYPT_OBJECT = HRESULT($C00D2732); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_ENCRYPT_OBJECT} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_DECRYPT_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_DECRYPT_OBJECT = HRESULT($C00D2733); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_DECRYPT_OBJECT} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_PROPERTIES_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_PROPERTIES_OBJECT = HRESULT($C00D2734); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_PROPERTIES_OBJECT} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_BACKUP_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_BACKUP_OBJECT = HRESULT($C00D2735); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_BACKUP_OBJECT} + +// +// MessageId: NS_E_DRM_INDIVIDUALIZE_ERROR +// +// MessageText: +// +// The security upgrade failed. Try again later.%0 +// + NS_E_DRM_INDIVIDUALIZE_ERROR = HRESULT($C00D2736); + {$EXTERNALSYM NS_E_DRM_INDIVIDUALIZE_ERROR} + +// +// MessageId: NS_E_DRM_LICENSE_OPEN_ERROR +// +// MessageText: +// +// License storage is not working. Contact Microsoft product support.%0 +// + NS_E_DRM_LICENSE_OPEN_ERROR = HRESULT($C00D2737); + {$EXTERNALSYM NS_E_DRM_LICENSE_OPEN_ERROR} + +// +// MessageId: NS_E_DRM_LICENSE_CLOSE_ERROR +// +// MessageText: +// +// License storage is not working. Contact Microsoft product support.%0 +// + NS_E_DRM_LICENSE_CLOSE_ERROR = HRESULT($C00D2738); + {$EXTERNALSYM NS_E_DRM_LICENSE_CLOSE_ERROR} + +// +// MessageId: NS_E_DRM_GET_LICENSE_ERROR +// +// MessageText: +// +// License storage is not working. Contact Microsoft product support.%0 +// + NS_E_DRM_GET_LICENSE_ERROR = HRESULT($C00D2739); + {$EXTERNALSYM NS_E_DRM_GET_LICENSE_ERROR} + +// +// MessageId: NS_E_DRM_QUERY_ERROR +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_QUERY_ERROR = HRESULT($C00D273A); + {$EXTERNALSYM NS_E_DRM_QUERY_ERROR} + +// +// MessageId: NS_E_DRM_REPORT_ERROR +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact product support for this application.%0 +// + NS_E_DRM_REPORT_ERROR = HRESULT($C00D273B); + {$EXTERNALSYM NS_E_DRM_REPORT_ERROR} + +// +// MessageId: NS_E_DRM_GET_LICENSESTRING_ERROR +// +// MessageText: +// +// License storage is not working. Contact Microsoft product support.%0 +// + NS_E_DRM_GET_LICENSESTRING_ERROR = HRESULT($C00D273C); + {$EXTERNALSYM NS_E_DRM_GET_LICENSESTRING_ERROR} + +// +// MessageId: NS_E_DRM_GET_CONTENTSTRING_ERROR +// +// MessageText: +// +// The media file is corrupted. Contact the content provider to get a new file.%0 +// + NS_E_DRM_GET_CONTENTSTRING_ERROR = HRESULT($C00D273D); + {$EXTERNALSYM NS_E_DRM_GET_CONTENTSTRING_ERROR} + +// +// MessageId: NS_E_DRM_MONITOR_ERROR +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Try again later.%0 +// + NS_E_DRM_MONITOR_ERROR = HRESULT($C00D273E); + {$EXTERNALSYM NS_E_DRM_MONITOR_ERROR} + +// +// MessageId: NS_E_DRM_UNABLE_TO_SET_PARAMETER +// +// MessageText: +// +// The application has made an invalid call to the Digital Rights Management component. Contact product support for this application.%0 +// + NS_E_DRM_UNABLE_TO_SET_PARAMETER = HRESULT($C00D273F); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_SET_PARAMETER} + +// +// MessageId: NS_E_DRM_INVALID_APPDATA +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_INVALID_APPDATA = HRESULT($C00D2740); + {$EXTERNALSYM NS_E_DRM_INVALID_APPDATA} + +// +// MessageId: NS_E_DRM_INVALID_APPDATA_VERSION +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact product support for this application.%0. +// + NS_E_DRM_INVALID_APPDATA_VERSION = HRESULT($C00D2741); + {$EXTERNALSYM NS_E_DRM_INVALID_APPDATA_VERSION} + +// +// MessageId: NS_E_DRM_BACKUP_EXISTS +// +// MessageText: +// +// Licenses are already backed up in this location.%0 +// + NS_E_DRM_BACKUP_EXISTS = HRESULT($C00D2742); + {$EXTERNALSYM NS_E_DRM_BACKUP_EXISTS} + +// +// MessageId: NS_E_DRM_BACKUP_CORRUPT +// +// MessageText: +// +// One or more backed-up licenses are missing or corrupt.%0 +// + NS_E_DRM_BACKUP_CORRUPT = HRESULT($C00D2743); + {$EXTERNALSYM NS_E_DRM_BACKUP_CORRUPT} + +// +// MessageId: NS_E_DRM_BACKUPRESTORE_BUSY +// +// MessageText: +// +// You cannot begin a new backup process until the current process has been completed.%0 +// + NS_E_DRM_BACKUPRESTORE_BUSY = HRESULT($C00D2744); + {$EXTERNALSYM NS_E_DRM_BACKUPRESTORE_BUSY} + +// +// MessageId: NS_S_DRM_MONITOR_CANCELLED +// +// MessageText: +// +// Status message: License monitoring has been cancelled.%0 +// + NS_S_DRM_MONITOR_CANCELLED = HRESULT($000D2746); + {$EXTERNALSYM NS_S_DRM_MONITOR_CANCELLED} + +// +// MessageId: NS_S_DRM_ACQUIRE_CANCELLED +// +// MessageText: +// +// Status message: License acquisition has been cancelled.%0 +// + NS_S_DRM_ACQUIRE_CANCELLED = HRESULT($000D2747); + {$EXTERNALSYM NS_S_DRM_ACQUIRE_CANCELLED} + +// +// MessageId: NS_E_DRM_LICENSE_UNUSABLE +// +// MessageText: +// +// The license is invalid. Contact the content provider for further assistance.%0 +// + NS_E_DRM_LICENSE_UNUSABLE = HRESULT($C00D2748); + {$EXTERNALSYM NS_E_DRM_LICENSE_UNUSABLE} + +// +// MessageId: NS_E_DRM_INVALID_PROPERTY +// +// MessageText: +// +// A required property was not set by the application. Contact product support for this application.%0. +// + NS_E_DRM_INVALID_PROPERTY = HRESULT($C00D2749); + {$EXTERNALSYM NS_E_DRM_INVALID_PROPERTY} + +// +// MessageId: NS_E_DRM_SECURE_STORE_NOT_FOUND +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component of this application. Try to acquire a license again.%0 +// + NS_E_DRM_SECURE_STORE_NOT_FOUND = HRESULT($C00D274A); + {$EXTERNALSYM NS_E_DRM_SECURE_STORE_NOT_FOUND} + +// +// MessageId: NS_E_DRM_CACHED_CONTENT_ERROR +// +// MessageText: +// +// A license cannot be found for this media file. Use License Management to transfer a license for this file from the original computer, or acquire a new license.%0 +// + NS_E_DRM_CACHED_CONTENT_ERROR = HRESULT($C00D274B); + {$EXTERNALSYM NS_E_DRM_CACHED_CONTENT_ERROR} + +// +// MessageId: NS_E_DRM_INDIVIDUALIZATION_INCOMPLETE +// +// MessageText: +// +// A problem occurred during the security upgrade. Try again later.%0 +// + NS_E_DRM_INDIVIDUALIZATION_INCOMPLETE = HRESULT($C00D274C); + {$EXTERNALSYM NS_E_DRM_INDIVIDUALIZATION_INCOMPLETE} + +// +// MessageId: NS_E_DRM_DRIVER_AUTH_FAILURE +// +// MessageText: +// +// Certified driver components are required to play this media file. Contact Windows Update to see whether updated drivers are available for your hardware.%0 +// + NS_E_DRM_DRIVER_AUTH_FAILURE = HRESULT($C00D274D); + {$EXTERNALSYM NS_E_DRM_DRIVER_AUTH_FAILURE} + +// +// MessageId: NS_E_DRM_NEED_UPGRADE_MSSAP +// +// MessageText: +// +// One or more of the Secure Audio Path components were not found or an entry point in those components was not found.%0 +// + NS_E_DRM_NEED_UPGRADE_MSSAP = HRESULT($C00D274E); + {$EXTERNALSYM NS_E_DRM_NEED_UPGRADE_MSSAP} + +// +// MessageId: NS_E_DRM_REOPEN_CONTENT +// +// MessageText: +// +// Status message: Reopen the file.%0 +// + NS_E_DRM_REOPEN_CONTENT = HRESULT($C00D274F); + {$EXTERNALSYM NS_E_DRM_REOPEN_CONTENT} + +// +// MessageId: NS_E_DRM_DRIVER_DIGIOUT_FAILURE +// +// MessageText: +// +// Certain driver functionality is required to play this media file. Contact Windows Update to see whether updated drivers are available for your hardware.%0 +// + NS_E_DRM_DRIVER_DIGIOUT_FAILURE = HRESULT($C00D2750); + {$EXTERNALSYM NS_E_DRM_DRIVER_DIGIOUT_FAILURE} + +// +// MessageId: NS_E_DRM_INVALID_SECURESTORE_PASSWORD +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_INVALID_SECURESTORE_PASSWORD = HRESULT($C00D2751); + {$EXTERNALSYM NS_E_DRM_INVALID_SECURESTORE_PASSWORD} + +// +// MessageId: NS_E_DRM_APPCERT_REVOKED +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_APPCERT_REVOKED = HRESULT($C00D2752); + {$EXTERNALSYM NS_E_DRM_APPCERT_REVOKED} + +// +// MessageId: NS_E_DRM_RESTORE_FRAUD +// +// MessageText: +// +// You cannot restore your license(s).%0 +// + NS_E_DRM_RESTORE_FRAUD = HRESULT($C00D2753); + {$EXTERNALSYM NS_E_DRM_RESTORE_FRAUD} + +// +// MessageId: NS_E_DRM_HARDWARE_INCONSISTENT +// +// MessageText: +// +// The licenses for your media files are corrupted. Contact Microsoft product support.%0 +// + NS_E_DRM_HARDWARE_INCONSISTENT = HRESULT($C00D2754); + {$EXTERNALSYM NS_E_DRM_HARDWARE_INCONSISTENT} + +// +// MessageId: NS_E_DRM_SDMI_TRIGGER +// +// MessageText: +// +// To transfer this media file, you must upgrade the application.%0 +// + NS_E_DRM_SDMI_TRIGGER = HRESULT($C00D2755); + {$EXTERNALSYM NS_E_DRM_SDMI_TRIGGER} + +// +// MessageId: NS_E_DRM_SDMI_NOMORECOPIES +// +// MessageText: +// +// You cannot make any more copies of this media file.%0 +// + NS_E_DRM_SDMI_NOMORECOPIES = HRESULT($C00D2756); + {$EXTERNALSYM NS_E_DRM_SDMI_NOMORECOPIES} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_HEADER_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_HEADER_OBJECT = HRESULT($C00D2757); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_HEADER_OBJECT} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_KEYS_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_KEYS_OBJECT = HRESULT($C00D2758); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_KEYS_OBJECT} + +// This error is never shown to user but needed for program logic. +// +// MessageId: NS_E_DRM_LICENSE_NOTACQUIRED +// +// MessageText: +// +// Unable to obtain license.%0 +// + NS_E_DRM_LICENSE_NOTACQUIRED = HRESULT($C00D2759); + {$EXTERNALSYM NS_E_DRM_LICENSE_NOTACQUIRED} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_CODING_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_CODING_OBJECT = HRESULT($C00D275A); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_CODING_OBJECT} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_STATE_DATA_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_STATE_DATA_OBJECT = HRESULT($C00D275B); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_STATE_DATA_OBJECT} + +// +// MessageId: NS_E_DRM_BUFFER_TOO_SMALL +// +// MessageText: +// +// The buffer supplied is not sufficient.%0. +// + NS_E_DRM_BUFFER_TOO_SMALL = HRESULT($C00D275C); + {$EXTERNALSYM NS_E_DRM_BUFFER_TOO_SMALL} + +// +// MessageId: NS_E_DRM_UNSUPPORTED_PROPERTY +// +// MessageText: +// +// The property requested is not supported.%0. +// + NS_E_DRM_UNSUPPORTED_PROPERTY = HRESULT($C00D275D); + {$EXTERNALSYM NS_E_DRM_UNSUPPORTED_PROPERTY} + +// +// MessageId: NS_E_DRM_ERROR_BAD_NET_RESP +// +// MessageText: +// +// The specified server cannot perform the requested operation.%0. +// + NS_E_DRM_ERROR_BAD_NET_RESP = HRESULT($C00D275E); + {$EXTERNALSYM NS_E_DRM_ERROR_BAD_NET_RESP} + +// +// MessageId: NS_E_DRM_STORE_NOTALLSTORED +// +// MessageText: +// +// Some of the licenses could not be stored.%0. +// + NS_E_DRM_STORE_NOTALLSTORED = HRESULT($C00D275F); + {$EXTERNALSYM NS_E_DRM_STORE_NOTALLSTORED} + +// +// MessageId: NS_E_DRM_SECURITY_COMPONENT_SIGNATURE_INVALID +// +// MessageText: +// +// The Digital Rights Management security upgrade component could not be validated. Contact Microsoft product support.%0 +// + NS_E_DRM_SECURITY_COMPONENT_SIGNATURE_INVALID = HRESULT($C00D2760); + {$EXTERNALSYM NS_E_DRM_SECURITY_COMPONENT_SIGNATURE_INVALID} + +// +// MessageId: NS_E_DRM_INVALID_DATA +// +// MessageText: +// +// Invalid or corrupt data was encountered.%0 +// + NS_E_DRM_INVALID_DATA = HRESULT($C00D2761); + {$EXTERNALSYM NS_E_DRM_INVALID_DATA} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CONTACT_SERVER +// +// MessageText: +// +// Unable to contact the server for the requested operation.%0 +// + NS_E_DRM_UNABLE_TO_CONTACT_SERVER = HRESULT($C00D2762); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CONTACT_SERVER} + +// +// MessageId: NS_E_DRM_UNABLE_TO_CREATE_AUTHENTICATION_OBJECT +// +// MessageText: +// +// A problem has occurred in the Digital Rights Management component. Contact Microsoft product support.%0. +// + NS_E_DRM_UNABLE_TO_CREATE_AUTHENTICATION_OBJECT = HRESULT($C00D2763); + {$EXTERNALSYM NS_E_DRM_UNABLE_TO_CREATE_AUTHENTICATION_OBJECT} + +// +// MessageId: NS_E_DRM_NOT_CONFIGURED +// +// MessageText: +// +// Not all of the necessary properties for DRM have been set.%0 +// + NS_E_DRM_NOT_CONFIGURED = HRESULT($C00D2764); + {$EXTERNALSYM NS_E_DRM_NOT_CONFIGURED} + +// +// MessageId: NS_E_DRM_DEVICE_ACTIVATION_CANCELED +// +// MessageText: +// +// The portable device does not have the security required to copy protected files +// to it. To obtain the additional security, try to copy the file to your portable +// device again. When a message appears, click OK.%0 +// + NS_E_DRM_DEVICE_ACTIVATION_CANCELED = HRESULT($C00D2765); + {$EXTERNALSYM NS_E_DRM_DEVICE_ACTIVATION_CANCELED} + + +// +// License Reasons Section +// Error Codes why a license is not usable. Reserve 10200..10300 for this purpose. +// 10200..10249 is for license reported reasons. 10250..10300 is for client detected reasons. +// + +// +// MessageId: NS_E_DRM_LICENSE_EXPIRED +// +// MessageText: +// +// The license for this file has expired and is no longer valid. Contact your content provider for further assistance.%0 +// + NS_E_DRM_LICENSE_EXPIRED = HRESULT($C00D27D8); + {$EXTERNALSYM NS_E_DRM_LICENSE_EXPIRED} + +// +// MessageId: NS_E_DRM_LICENSE_NOTENABLED +// +// MessageText: +// +// The license for this file is not valid yet, but will be at a future date.%0 +// + NS_E_DRM_LICENSE_NOTENABLED = HRESULT($C00D27D9); + {$EXTERNALSYM NS_E_DRM_LICENSE_NOTENABLED} + +// +// MessageId: NS_E_DRM_LICENSE_APPSECLOW +// +// MessageText: +// +// The license for this file requires a higher level of security than the player +// you are currently using has. Try using a different player or download a newer +// version of your current player.%0 +// + NS_E_DRM_LICENSE_APPSECLOW = HRESULT($C00D27DA); + {$EXTERNALSYM NS_E_DRM_LICENSE_APPSECLOW} + +// +// MessageId: NS_E_DRM_STORE_NEEDINDI +// +// MessageText: +// +// The license cannot be stored as it requires security upgrade of Digital Rights Management component.%0. +// + NS_E_DRM_STORE_NEEDINDI = HRESULT($C00D27DB); + {$EXTERNALSYM NS_E_DRM_STORE_NEEDINDI} + +// +// MessageId: NS_E_DRM_STORE_NOTALLOWED +// +// MessageText: +// +// Your machine does not meet the requirements for storing the license.%0. +// + NS_E_DRM_STORE_NOTALLOWED = HRESULT($C00D27DC); + {$EXTERNALSYM NS_E_DRM_STORE_NOTALLOWED} + +// +// MessageId: NS_E_DRM_LICENSE_APP_NOTALLOWED +// +// MessageText: +// +// The license for this file requires an upgraded version of your player or a different player.%0. +// + NS_E_DRM_LICENSE_APP_NOTALLOWED = HRESULT($C00D27DD); + {$EXTERNALSYM NS_E_DRM_LICENSE_APP_NOTALLOWED} + +// +// MessageId: NS_S_DRM_NEEDS_INDIVIDUALIZATION +// +// MessageText: +// +// A security upgrade is required to perform the operation on this media file.%0 +// + NS_S_DRM_NEEDS_INDIVIDUALIZATION = HRESULT($000D27DE); + {$EXTERNALSYM NS_S_DRM_NEEDS_INDIVIDUALIZATION} + +// +// MessageId: NS_E_DRM_LICENSE_CERT_EXPIRED +// +// MessageText: +// +// The license server's certificate expired. Make sure your system clock is set correctly. Contact your content provider for further assistance. %0. +// + NS_E_DRM_LICENSE_CERT_EXPIRED = HRESULT($C00D27DF); + {$EXTERNALSYM NS_E_DRM_LICENSE_CERT_EXPIRED} + +// +// MessageId: NS_E_DRM_LICENSE_SECLOW +// +// MessageText: +// +// The license for this file requires a higher level of security than the player +// you are currently using has. Try using a different player or download a newer +// version of your current player.%0 +// + NS_E_DRM_LICENSE_SECLOW = HRESULT($C00D27E0); + {$EXTERNALSYM NS_E_DRM_LICENSE_SECLOW} + +// +// MessageId: NS_E_DRM_LICENSE_CONTENT_REVOKED +// +// MessageText: +// +// The content owner for the license you just acquired is no longer supporting their content. Contact the content owner for a newer version of the content.%0 +// + NS_E_DRM_LICENSE_CONTENT_REVOKED = HRESULT($C00D27E1); + {$EXTERNALSYM NS_E_DRM_LICENSE_CONTENT_REVOKED} + +// +// MessageId: NS_E_DRM_LICENSE_NOSAP +// +// MessageText: +// +// The license for this file requires a feature that is not supported in your +// current player or operating system. You can try with newer version of your current +// player or contact your content provider for further assistance.%0 +// + NS_E_DRM_LICENSE_NOSAP = HRESULT($C00D280A); + {$EXTERNALSYM NS_E_DRM_LICENSE_NOSAP} + +// +// MessageId: NS_E_DRM_LICENSE_NOSVP +// +// MessageText: +// +// The license for this file requires a feature that is not supported in your current player or operating system. You can try with newer version of your current player or contact your content provider for further assistance.%0 +// + NS_E_DRM_LICENSE_NOSVP = HRESULT($C00D280B); + {$EXTERNALSYM NS_E_DRM_LICENSE_NOSVP} + +// +// MessageId: NS_E_DRM_LICENSE_NOWDM +// +// MessageText: +// +// The license for this file requires Windows Driver Model (WDM) audio drivers. Contact your sound card manufacturer for further assistance.%0 +// + NS_E_DRM_LICENSE_NOWDM = HRESULT($C00D280C); + {$EXTERNALSYM NS_E_DRM_LICENSE_NOWDM} + +// +// MessageId: NS_E_DRM_LICENSE_NOTRUSTEDCODEC +// +// MessageText: +// +// The license for this file requires a higher level of security than the player you are currently using has. Try using a different player or download a newer version of your current player.%0 +// + NS_E_DRM_LICENSE_NOTRUSTEDCODEC = HRESULT($C00D280D); + {$EXTERNALSYM NS_E_DRM_LICENSE_NOTRUSTEDCODEC} + + +// +// End of License Reasons Section +// + +// +// MessageId: NS_E_DRM_NEEDS_UPGRADE_TEMPFILE +// +// MessageText: +// +// An updated version of your media player is required to play the selected content.%0 +// + NS_E_DRM_NEEDS_UPGRADE_TEMPFILE = HRESULT($C00D283D); + {$EXTERNALSYM NS_E_DRM_NEEDS_UPGRADE_TEMPFILE} + +// +// MessageId: NS_E_DRM_NEED_UPGRADE_PD +// +// MessageText: +// +// A new version of the Digital Rights Management component is required. Contact product support for this application to get the latest version.%0 +// + NS_E_DRM_NEED_UPGRADE_PD = HRESULT($C00D283E); + {$EXTERNALSYM NS_E_DRM_NEED_UPGRADE_PD} + +// +// MessageId: NS_E_DRM_SIGNATURE_FAILURE +// +// MessageText: +// +// Failed to either create or verify the content header.%0 +// + NS_E_DRM_SIGNATURE_FAILURE = HRESULT($C00D283F); + {$EXTERNALSYM NS_E_DRM_SIGNATURE_FAILURE} + +// +// MessageId: NS_E_DRM_LICENSE_SERVER_INFO_MISSING +// +// MessageText: +// +// Could not read the necessary information from the system registry.%0 +// + NS_E_DRM_LICENSE_SERVER_INFO_MISSING = HRESULT($C00D2840); + {$EXTERNALSYM NS_E_DRM_LICENSE_SERVER_INFO_MISSING} + +// +// MessageId: NS_E_DRM_BUSY +// +// MessageText: +// +// The DRM subsystem is currently locked by another application or user. Try again later.%0 +// + NS_E_DRM_BUSY = HRESULT($C00D2841); + {$EXTERNALSYM NS_E_DRM_BUSY} + +// +// MessageId: NS_E_DRM_PD_TOO_MANY_DEVICES +// +// MessageText: +// +// There are too many target devices registered on the portable media.%0 +// + NS_E_DRM_PD_TOO_MANY_DEVICES = HRESULT($C00D2842); + {$EXTERNALSYM NS_E_DRM_PD_TOO_MANY_DEVICES} + +// +// MessageId: NS_E_DRM_INDIV_FRAUD +// +// MessageText: +// +// The security upgrade cannot be completed because the allowed number of daily upgrades has been exceeded. Try again tomorrow.%0 +// + NS_E_DRM_INDIV_FRAUD = HRESULT($C00D2843); + {$EXTERNALSYM NS_E_DRM_INDIV_FRAUD} + +// +// MessageId: NS_E_DRM_INDIV_NO_CABS +// +// MessageText: +// +// The security upgrade cannot be completed because the server is unable to perform the operation. Try again later.%0 +// + NS_E_DRM_INDIV_NO_CABS = HRESULT($C00D2844); + {$EXTERNALSYM NS_E_DRM_INDIV_NO_CABS} + +// +// MessageId: NS_E_DRM_INDIV_SERVICE_UNAVAILABLE +// +// MessageText: +// +// The security upgrade cannot be performed because the server is not available. Try again later.%0 +// + NS_E_DRM_INDIV_SERVICE_UNAVAILABLE = HRESULT($C00D2845); + {$EXTERNALSYM NS_E_DRM_INDIV_SERVICE_UNAVAILABLE} + +// +// MessageId: NS_E_DRM_RESTORE_SERVICE_UNAVAILABLE +// +// MessageText: +// +// Windows Media Player cannot restore your licenses because the server is not available. Try again later.%0 +// + NS_E_DRM_RESTORE_SERVICE_UNAVAILABLE = HRESULT($C00D2846); + {$EXTERNALSYM NS_E_DRM_RESTORE_SERVICE_UNAVAILABLE} + + + +///////////////////////////////////////////////////////////////////////// +// +// Windows Media Setup Specific Errors +// +// IdRange = 11000..11999 +///////////////////////////////////////////////////////////////////////// +// +// MessageId: NS_S_REBOOT_RECOMMENDED +// +// MessageText: +// +// The requested operation is successful. Some cleanup will not be complete until the system is rebooted.%0 +// + NS_S_REBOOT_RECOMMENDED = HRESULT($000D2AF8); + {$EXTERNALSYM NS_S_REBOOT_RECOMMENDED} + +// +// MessageId: NS_S_REBOOT_REQUIRED +// +// MessageText: +// +// The requested operation is successful. The system will not function correctly until the system is rebooted.%0 +// + NS_S_REBOOT_REQUIRED = HRESULT($000D2AF9); + {$EXTERNALSYM NS_S_REBOOT_REQUIRED} + +// +// MessageId: NS_E_REBOOT_RECOMMENDED +// +// MessageText: +// +// The requested operation failed. Some cleanup will not be complete until the system is rebooted.%0 +// + NS_E_REBOOT_RECOMMENDED = HRESULT($C00D2AFA); + {$EXTERNALSYM NS_E_REBOOT_RECOMMENDED} + +// +// MessageId: NS_E_REBOOT_REQUIRED +// +// MessageText: +// +// The requested operation failed. The system will not function correctly until the system is rebooted.%0 +// + NS_E_REBOOT_REQUIRED = HRESULT($C00D2AFB); + {$EXTERNALSYM NS_E_REBOOT_REQUIRED} + + +///////////////////////////////////////////////////////////////////////// +// +// Windows Media Networking Errors +// +// IdRange = 12000..12999 +///////////////////////////////////////////////////////////////////////// +// +// MessageId: NS_E_UNKNOWN_PROTOCOL +// +// MessageText: +// +// The specified protocol is not supported.%0 +// + NS_E_UNKNOWN_PROTOCOL = HRESULT($C00D2EE0); + {$EXTERNALSYM NS_E_UNKNOWN_PROTOCOL} + +// +// MessageId: NS_E_REDIRECT_TO_PROXY +// +// MessageText: +// +// The client is redirected to a proxy server.%0 +// + NS_E_REDIRECT_TO_PROXY = HRESULT($C00D2EE1); + {$EXTERNALSYM NS_E_REDIRECT_TO_PROXY} + +// +// MessageId: NS_E_INTERNAL_SERVER_ERROR +// +// MessageText: +// +// The server encountered an unexpected condition which prevented it from fulfilling the request.%0 +// + NS_E_INTERNAL_SERVER_ERROR = HRESULT($C00D2EE2); + {$EXTERNALSYM NS_E_INTERNAL_SERVER_ERROR} + +// +// MessageId: NS_E_BAD_REQUEST +// +// MessageText: +// +// The request could not be understood by the server.%0 +// + NS_E_BAD_REQUEST = HRESULT($C00D2EE3); + {$EXTERNALSYM NS_E_BAD_REQUEST} + +// +// MessageId: NS_E_ERROR_FROM_PROXY +// +// MessageText: +// +// The proxy experienced an error while attempting to contact the media server.%0 +// + NS_E_ERROR_FROM_PROXY = HRESULT($C00D2EE4); + {$EXTERNALSYM NS_E_ERROR_FROM_PROXY} + +// +// MessageId: NS_E_PROXY_TIMEOUT +// +// MessageText: +// +// The proxy did not receive a timely response while attempting to contact the media server.%0 +// + NS_E_PROXY_TIMEOUT = HRESULT($C00D2EE5); + {$EXTERNALSYM NS_E_PROXY_TIMEOUT} + +// +// MessageId: NS_E_SERVER_UNAVAILABLE +// +// MessageText: +// +// The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.%0 +// + NS_E_SERVER_UNAVAILABLE = HRESULT($C00D2EE6); + {$EXTERNALSYM NS_E_SERVER_UNAVAILABLE} + +// +// MessageId: NS_E_REFUSED_BY_SERVER +// +// MessageText: +// +// The server is refusing to fulfill the requested operation.%0 +// + NS_E_REFUSED_BY_SERVER = HRESULT($C00D2EE7); + {$EXTERNALSYM NS_E_REFUSED_BY_SERVER} + +// +// MessageId: NS_E_INCOMPATIBLE_SERVER +// +// MessageText: +// +// The server is not a compatible streaming media server.%0 +// + NS_E_INCOMPATIBLE_SERVER = HRESULT($C00D2EE8); + {$EXTERNALSYM NS_E_INCOMPATIBLE_SERVER} + +// +// MessageId: NS_E_MULTICAST_DISABLED +// +// MessageText: +// +// The content cannot be streamed because the Multicast protocol has been disabled.%0 +// + NS_E_MULTICAST_DISABLED = HRESULT($C00D2EE9); + {$EXTERNALSYM NS_E_MULTICAST_DISABLED} + +// +// MessageId: NS_E_INVALID_REDIRECT +// +// MessageText: +// +// The server redirected the player to an invalid location.%0 +// + NS_E_INVALID_REDIRECT = HRESULT($C00D2EEA); + {$EXTERNALSYM NS_E_INVALID_REDIRECT} + +// +// MessageId: NS_E_ALL_PROTOCOLS_DISABLED +// +// MessageText: +// +// The content cannot be streamed because all protocols have been disabled.%0 +// + NS_E_ALL_PROTOCOLS_DISABLED = HRESULT($C00D2EEB); + {$EXTERNALSYM NS_E_ALL_PROTOCOLS_DISABLED} + +// +// MessageId: NS_E_MSBD_NO_LONGER_SUPPORTED +// +// MessageText: +// +// The MSBD protocol is no longer supported. Please use HTTP to connect to the Windows Media stream.%0 +// + NS_E_MSBD_NO_LONGER_SUPPORTED = HRESULT($C00D2EEC); + {$EXTERNALSYM NS_E_MSBD_NO_LONGER_SUPPORTED} + +// +// MessageId: NS_E_PROXY_NOT_FOUND +// +// MessageText: +// +// The proxy server could not be located. Please check your proxy server configuration.%0 +// + NS_E_PROXY_NOT_FOUND = HRESULT($C00D2EED); + {$EXTERNALSYM NS_E_PROXY_NOT_FOUND} + +// +// MessageId: NS_E_CANNOT_CONNECT_TO_PROXY +// +// MessageText: +// +// Unable to establish a connection to the proxy server. Please check your proxy server configuration.%0 +// + NS_E_CANNOT_CONNECT_TO_PROXY = HRESULT($C00D2EEE); + {$EXTERNALSYM NS_E_CANNOT_CONNECT_TO_PROXY} + +// +// MessageId: NS_E_SERVER_DNS_TIMEOUT +// +// MessageText: +// +// Unable to locate the media server. The operation timed out.%0 +// + NS_E_SERVER_DNS_TIMEOUT = HRESULT($C00D2EEF); + {$EXTERNALSYM NS_E_SERVER_DNS_TIMEOUT} + +// +// MessageId: NS_E_PROXY_DNS_TIMEOUT +// +// MessageText: +// +// Unable to locate the proxy server. The operation timed out.%0 +// + NS_E_PROXY_DNS_TIMEOUT = HRESULT($C00D2EF0); + {$EXTERNALSYM NS_E_PROXY_DNS_TIMEOUT} + +// +// MessageId: NS_E_CLOSED_ON_SUSPEND +// +// MessageText: +// +// Media closed because Windows was shut down.%0 +// + NS_E_CLOSED_ON_SUSPEND = HRESULT($C00D2EF1); + {$EXTERNALSYM NS_E_CLOSED_ON_SUSPEND} + +// +// MessageId: NS_E_CANNOT_READ_PLAYLIST_FROM_MEDIASERVER +// +// MessageText: +// +// Unable to read the contents of a playlist file from a media server.%0 +// + NS_E_CANNOT_READ_PLAYLIST_FROM_MEDIASERVER = HRESULT($C00D2EF2); + {$EXTERNALSYM NS_E_CANNOT_READ_PLAYLIST_FROM_MEDIASERVER} + +// +// MessageId: NS_E_SESSION_NOT_FOUND +// +// MessageText: +// +// Session not found.%0 +// + NS_E_SESSION_NOT_FOUND = HRESULT($C00D2EF3); + {$EXTERNALSYM NS_E_SESSION_NOT_FOUND} + +// +// MessageId: NS_E_REQUIRE_STREAMING_CLIENT +// +// MessageText: +// +// Content requires a streaming media client.%0 +// + NS_E_REQUIRE_STREAMING_CLIENT = HRESULT($C00D2EF4); + {$EXTERNALSYM NS_E_REQUIRE_STREAMING_CLIENT} + +// +// MessageId: NS_E_PLAYLIST_ENTRY_HAS_CHANGED +// +// MessageText: +// +// A command applies to a previous playlist entry.%0 +// + NS_E_PLAYLIST_ENTRY_HAS_CHANGED = HRESULT($C00D2EF5); + {$EXTERNALSYM NS_E_PLAYLIST_ENTRY_HAS_CHANGED} + +// +// MessageId: NS_E_PROXY_ACCESSDENIED +// +// MessageText: +// +// The proxy server is denying access. The username and/or password might be incorrect.%0 +// + NS_E_PROXY_ACCESSDENIED = HRESULT($C00D2EF6); + {$EXTERNALSYM NS_E_PROXY_ACCESSDENIED} + +// +// MessageId: NS_E_PROXY_SOURCE_ACCESSDENIED +// +// MessageText: +// +// The proxy could not provide valid authentication credentials to the media server.%0 +// + NS_E_PROXY_SOURCE_ACCESSDENIED = HRESULT($C00D2EF7); + {$EXTERNALSYM NS_E_PROXY_SOURCE_ACCESSDENIED} + +// +// MessageId: NS_E_NETWORK_SINK_WRITE +// +// MessageText: +// +// The network sink failed to write data to the network.%0 +// + NS_E_NETWORK_SINK_WRITE = HRESULT($C00D2EF8); + {$EXTERNALSYM NS_E_NETWORK_SINK_WRITE} + +// +// MessageId: NS_E_FIREWALL +// +// MessageText: +// +// Packets are not being received from the server. The packets might be blocked by a filtering device, such as a network firewall.%0 +// + NS_E_FIREWALL = HRESULT($C00D2EF9); + {$EXTERNALSYM NS_E_FIREWALL} + +// +// MessageId: NS_E_MMS_NOT_SUPPORTED +// +// MessageText: +// +// The MMS protocol is not supported. Please use HTTP or RTSP to connect to the Windows Media stream.%0 +// + NS_E_MMS_NOT_SUPPORTED = HRESULT($C00D2EFA); + {$EXTERNALSYM NS_E_MMS_NOT_SUPPORTED} + +// +// MessageId: NS_E_SERVER_ACCESSDENIED +// +// MessageText: +// +// The Windows Media server is denying access. The username and/or password might be incorrect.%0 +// + NS_E_SERVER_ACCESSDENIED = HRESULT($C00D2EFB); + {$EXTERNALSYM NS_E_SERVER_ACCESSDENIED} + +// +// MessageId: NS_E_RESOURCE_GONE +// +// MessageText: +// +// The Publishing Point or file on the Windows Media Server is no longer available.%0 +// + NS_E_RESOURCE_GONE = HRESULT($C00D2EFC); + {$EXTERNALSYM NS_E_RESOURCE_GONE} + +// +// MessageId: NS_E_NO_EXISTING_PACKETIZER +// +// MessageText: +// +// There is no existing packetizer plugin for a stream.%0 +// + NS_E_NO_EXISTING_PACKETIZER = HRESULT($C00D2EFD); + {$EXTERNALSYM NS_E_NO_EXISTING_PACKETIZER} + +// +// MessageId: NS_E_BAD_SYNTAX_IN_SERVER_RESPONSE +// +// MessageText: +// +// The response from the media server could not be understood. This might be caused by an incompatible proxy server or media server.%0 +// + NS_E_BAD_SYNTAX_IN_SERVER_RESPONSE = HRESULT($C00D2EFE); + {$EXTERNALSYM NS_E_BAD_SYNTAX_IN_SERVER_RESPONSE} + +// +// MessageId: NS_I_RECONNECTED +// +// MessageText: +// +// The client is reconnected.%0 +// + NS_I_RECONNECTED = HRESULT($400D2EFF); + {$EXTERNALSYM NS_I_RECONNECTED} + +// +// MessageId: NS_E_RESET_SOCKET_CONNECTION +// +// MessageText: +// +// The Windows Media Server reset the network connection.%0 +// + NS_E_RESET_SOCKET_CONNECTION = HRESULT($C00D2F00); + {$EXTERNALSYM NS_E_RESET_SOCKET_CONNECTION} + +// +// MessageId: NS_I_NOLOG_STOP +// +// MessageText: +// +// Forcing a switch to a pending header on start.%0 +// + NS_I_NOLOG_STOP = HRESULT($400D2F01); + {$EXTERNALSYM NS_I_NOLOG_STOP} + +// +// MessageId: NS_E_TOO_MANY_HOPS +// +// MessageText: +// +// The request could not reach the media server (too many hops).%0 +// + NS_E_TOO_MANY_HOPS = HRESULT($C00D2F02); + {$EXTERNALSYM NS_E_TOO_MANY_HOPS} + +// +// MessageId: NS_I_EXISTING_PACKETIZER +// +// MessageText: +// +// There is already an existing packetizer plugin for the stream.%0 +// + NS_I_EXISTING_PACKETIZER = HRESULT($400D2F03); + {$EXTERNALSYM NS_I_EXISTING_PACKETIZER} + +// +// MessageId: NS_I_MANUAL_PROXY +// +// MessageText: +// +// The proxy setting is manual.%0 +// + NS_I_MANUAL_PROXY = HRESULT($400D2F04); + {$EXTERNALSYM NS_I_MANUAL_PROXY} + +// +// MessageId: NS_E_TOO_MUCH_DATA_FROM_SERVER +// +// MessageText: +// +// The server is sending too much data. The connection has been terminated.%0 +// + NS_E_TOO_MUCH_DATA_FROM_SERVER = HRESULT($C00D2F05); + {$EXTERNALSYM NS_E_TOO_MUCH_DATA_FROM_SERVER} + +// +// MessageId: NS_E_CONNECT_TIMEOUT +// +// MessageText: +// +// It was not possible to establish a connection to the media server in a timely manner. The media server may be down for maintenance, or it may be necessary to use a proxy server to access this media server.%0 +// + NS_E_CONNECT_TIMEOUT = HRESULT($C00D2F06); + {$EXTERNALSYM NS_E_CONNECT_TIMEOUT} + +// +// MessageId: NS_E_PROXY_CONNECT_TIMEOUT +// +// MessageText: +// +// It was not possible to establish a connection to the proxy server in a timely manner. Please check your proxy server configuration.%0 +// + NS_E_PROXY_CONNECT_TIMEOUT = HRESULT($C00D2F07); + {$EXTERNALSYM NS_E_PROXY_CONNECT_TIMEOUT} + +// +// MessageId: NS_E_SESSION_INVALID +// +// MessageText: +// +// Session not found.%0 +// + NS_E_SESSION_INVALID = HRESULT($C00D2F08); + {$EXTERNALSYM NS_E_SESSION_INVALID} + +// +// MessageId: NS_S_EOSRECEDING +// +// MessageText: +// +// EOS hit during rewinding.%0 +// + NS_S_EOSRECEDING = HRESULT($000D2F09); + {$EXTERNALSYM NS_S_EOSRECEDING} + +// +// MessageId: NS_E_PACKETSINK_UNKNOWN_FEC_STREAM +// +// MessageText: +// +// Unknown packet sink stream.%0 +// + NS_E_PACKETSINK_UNKNOWN_FEC_STREAM = HRESULT($C00D2F0A); + {$EXTERNALSYM NS_E_PACKETSINK_UNKNOWN_FEC_STREAM} + +// +// MessageId: NS_E_PUSH_CANNOTCONNECT +// +// MessageText: +// +// Unable to establish a connection to the server. Ensure Windows Media Services is started and the HTTP Server control protocol is properly enabled.%0 +// + NS_E_PUSH_CANNOTCONNECT = HRESULT($C00D2F0B); + {$EXTERNALSYM NS_E_PUSH_CANNOTCONNECT} + +// +// MessageId: NS_E_INCOMPATIBLE_PUSH_SERVER +// +// MessageText: +// +// The Server service that received the HTTP push request is not a compatible version of Windows Media Services (WMS). This error may indicate the push request was received by IIS instead of WMS. Ensure WMS is started and has the HTTP Server control protocol properly enabled and try again.%0 +// + NS_E_INCOMPATIBLE_PUSH_SERVER = HRESULT($C00D2F0C); + {$EXTERNALSYM NS_E_INCOMPATIBLE_PUSH_SERVER} + +// +// MessageId: NS_S_CHANGENOTICE +// +// MessageText: +// +// Internal.%0 +// + NS_S_CHANGENOTICE = HRESULT($000D2F0D); + {$EXTERNALSYM NS_S_CHANGENOTICE} + + +///////////////////////////////////////////////////////////////////////// +// +// Windows Media Client Media Services +// +// IdRange = 13000..13999 (0x32C8-0x36AF) +///////////////////////////////////////////////////////////////////////// +// +// MessageId: NS_E_END_OF_PLAYLIST +// +// MessageText: +// +// The playlist has reached its end.%0 +// + NS_E_END_OF_PLAYLIST = HRESULT($C00D32C8); + {$EXTERNALSYM NS_E_END_OF_PLAYLIST} + +// +// MessageId: NS_E_USE_FILE_SOURCE +// +// MessageText: +// +// Use file source.%0 +// + NS_E_USE_FILE_SOURCE = HRESULT($C00D32C9); + {$EXTERNALSYM NS_E_USE_FILE_SOURCE} + +// +// MessageId: NS_E_PROPERTY_NOT_FOUND +// +// MessageText: +// +// The property was not found.%0 +// + NS_E_PROPERTY_NOT_FOUND = HRESULT($C00D32CA); + {$EXTERNALSYM NS_E_PROPERTY_NOT_FOUND} + +// +// MessageId: NS_E_PROPERTY_READ_ONLY +// +// MessageText: +// +// The property is read only.%0 +// + NS_E_PROPERTY_READ_ONLY = HRESULT($C00D32CC); + {$EXTERNALSYM NS_E_PROPERTY_READ_ONLY} + +// +// MessageId: NS_E_TABLE_KEY_NOT_FOUND +// +// MessageText: +// +// The table key was not found.%0 +// + NS_E_TABLE_KEY_NOT_FOUND = HRESULT($C00D32CD); + {$EXTERNALSYM NS_E_TABLE_KEY_NOT_FOUND} + +// +// MessageId: NS_E_INVALID_QUERY_OPERATOR +// +// MessageText: +// +// Invalid query operator.%0 +// + NS_E_INVALID_QUERY_OPERATOR = HRESULT($C00D32CF); + {$EXTERNALSYM NS_E_INVALID_QUERY_OPERATOR} + +// +// MessageId: NS_E_INVALID_QUERY_PROPERTY +// +// MessageText: +// +// Invalid query property.%0 +// + NS_E_INVALID_QUERY_PROPERTY = HRESULT($C00D32D0); + {$EXTERNALSYM NS_E_INVALID_QUERY_PROPERTY} + +// +// MessageId: NS_E_PROPERTY_NOT_SUPPORTED +// +// MessageText: +// +// The property is not supported.%0 +// + NS_E_PROPERTY_NOT_SUPPORTED = HRESULT($C00D32D2); + {$EXTERNALSYM NS_E_PROPERTY_NOT_SUPPORTED} + +// +// MessageId: NS_E_SCHEMA_CLASSIFY_FAILURE +// +// MessageText: +// +// Schema classification failure.%0 +// + NS_E_SCHEMA_CLASSIFY_FAILURE = HRESULT($C00D32D4); + {$EXTERNALSYM NS_E_SCHEMA_CLASSIFY_FAILURE} + +// +// MessageId: NS_E_METADATA_FORMAT_NOT_SUPPORTED +// +// MessageText: +// +// The metadata format is not supported.%0 +// + NS_E_METADATA_FORMAT_NOT_SUPPORTED = HRESULT($C00D32D5); + {$EXTERNALSYM NS_E_METADATA_FORMAT_NOT_SUPPORTED} + +// +// MessageId: NS_E_METADATA_NO_EDITING_CAPABILITY +// +// MessageText: +// +// Cannot edit the metadata.%0 +// + NS_E_METADATA_NO_EDITING_CAPABILITY = HRESULT($C00D32D6); + {$EXTERNALSYM NS_E_METADATA_NO_EDITING_CAPABILITY} + +// +// MessageId: NS_E_METADATA_CANNOT_SET_LOCALE +// +// MessageText: +// +// Cannot set the locale id.%0 +// + NS_E_METADATA_CANNOT_SET_LOCALE = HRESULT($C00D32D7); + {$EXTERNALSYM NS_E_METADATA_CANNOT_SET_LOCALE} + +// +// MessageId: NS_E_METADATA_LANGUAGE_NOT_SUPORTED +// +// MessageText: +// +// The language is not supported in the format.%0 +// + NS_E_METADATA_LANGUAGE_NOT_SUPORTED = HRESULT($C00D32D8); + {$EXTERNALSYM NS_E_METADATA_LANGUAGE_NOT_SUPORTED} + +// +// MessageId: NS_E_METADATA_NO_RFC1766_NAME_FOR_LOCALE +// +// MessageText: +// +// There is no RFC1766 name translation for the supplied locale id.%0 +// + NS_E_METADATA_NO_RFC1766_NAME_FOR_LOCALE = HRESULT($C00D32D9); + {$EXTERNALSYM NS_E_METADATA_NO_RFC1766_NAME_FOR_LOCALE} + +// +// MessageId: NS_E_METADATA_NOT_AVAILABLE +// +// MessageText: +// +// The metadata (or metadata item) is not available.%0 +// + NS_E_METADATA_NOT_AVAILABLE = HRESULT($C00D32DA); + {$EXTERNALSYM NS_E_METADATA_NOT_AVAILABLE} + +// +// MessageId: NS_E_METADATA_CACHE_DATA_NOT_AVAILABLE +// +// MessageText: +// +// The cached metadata (or metadata item) is not available.%0 +// + NS_E_METADATA_CACHE_DATA_NOT_AVAILABLE = HRESULT($C00D32DB); + {$EXTERNALSYM NS_E_METADATA_CACHE_DATA_NOT_AVAILABLE} + +// +// MessageId: NS_E_METADATA_INVALID_DOCUMENT_TYPE +// +// MessageText: +// +// The metadata document is invalid.%0 +// + NS_E_METADATA_INVALID_DOCUMENT_TYPE = HRESULT($C00D32DC); + {$EXTERNALSYM NS_E_METADATA_INVALID_DOCUMENT_TYPE} + +// +// MessageId: NS_E_METADATA_IDENTIFIER_NOT_AVAILABLE +// +// MessageText: +// +// The metadata content identifier is not available.%0 +// + NS_E_METADATA_IDENTIFIER_NOT_AVAILABLE = HRESULT($C00D32DD); + {$EXTERNALSYM NS_E_METADATA_IDENTIFIER_NOT_AVAILABLE} + +// +// MessageId: NS_E_METADATA_CANNOT_RETRIEVE_FROM_OFFLINE_CACHE +// +// MessageText: +// +// Cannot retrieve metadata from the offline metadata cache.%0 +// + NS_E_METADATA_CANNOT_RETRIEVE_FROM_OFFLINE_CACHE = HRESULT($C00D32DE); + {$EXTERNALSYM NS_E_METADATA_CANNOT_RETRIEVE_FROM_OFFLINE_CACHE} + + + +/////////////////////////////////////////////////////////////////////////// +// +// ASFErr.h - definition of ASF HRESULT codes +// +//========================================================================= +// +// Microsoft Windows Media Technologies +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +//========================================================================= + + +// #define STATUS_SEVERITY(hr) (((hr) >> 30) & 0x3) + +/////////////////////////////////////////////////////////////////////////// +// +// Advanced Streaming Format (ASF) Errors (2000 - 2999) +// +// +// Values are 32 bit values layed out 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 +// +---+-+-+-----------------------+-------------------------------+ +// |Sev|C|R| Facility | Code | +// +---+-+-+-----------------------+-------------------------------+ +// +// where +// +// Sev - is the severity code +// +// 00 - Success +// 01 - Informational +// 10 - Warning +// 11 - Error +// +// C - is the Customer code flag +// +// R - is a reserved bit +// +// Facility - is the facility code +// +// Code - is the facility's status code +// +// + +// +// MessageId: ASF_E_BUFFEROVERRUN +// +// MessageText: +// +// An attempt was made to seek or position past the end of a buffer.%0 +// + ASF_E_BUFFEROVERRUN = HRESULT($C00D07D0); + {$EXTERNALSYM ASF_E_BUFFEROVERRUN} + +// +// MessageId: ASF_E_BUFFERTOOSMALL +// +// MessageText: +// +// The supplied input or output buffer was too small.%0 +// + ASF_E_BUFFERTOOSMALL = HRESULT($C00D07D1); + {$EXTERNALSYM ASF_E_BUFFERTOOSMALL} + +// +// MessageId: ASF_E_BADLANGUAGEID +// +// MessageText: +// +// The language ID was not found.%0 +// + ASF_E_BADLANGUAGEID = HRESULT($C00D07D2); + {$EXTERNALSYM ASF_E_BADLANGUAGEID} + +// +// MessageId: ASF_E_NOPAYLOADLENGTH +// +// MessageText: +// +// The multiple payload packet is missing the payload length.%0 +// + ASF_E_NOPAYLOADLENGTH = HRESULT($C00D07DB); + {$EXTERNALSYM ASF_E_NOPAYLOADLENGTH} + +// +// MessageId: ASF_E_TOOMANYPAYLOADS +// +// MessageText: +// +// The packet contains too many payloads.%0 +// + ASF_E_TOOMANYPAYLOADS = HRESULT($C00D07DC); + {$EXTERNALSYM ASF_E_TOOMANYPAYLOADS} + +// +// MessageId: ASF_E_PACKETCONTENTTOOLARGE +// +// MessageText: +// +// ASF_E_PACKETCONTENTTOOLARGE +// + ASF_E_PACKETCONTENTTOOLARGE = HRESULT($C00D07DE); + {$EXTERNALSYM ASF_E_PACKETCONTENTTOOLARGE} + +// +// MessageId: ASF_E_UNKNOWNPACKETSIZE +// +// MessageText: +// +// Expecting a fixed packet size but min. and max. are not equal.%0 +// + ASF_E_UNKNOWNPACKETSIZE = HRESULT($C00D07E0); + {$EXTERNALSYM ASF_E_UNKNOWNPACKETSIZE} + +// +// MessageId: ASF_E_INVALIDHEADER +// +// MessageText: +// +// ASF_E_INVALIDHEADER +// + ASF_E_INVALIDHEADER = HRESULT($C00D07E2); + {$EXTERNALSYM ASF_E_INVALIDHEADER} + +// +// MessageId: ASF_E_NOCLOCKOBJECT +// +// MessageText: +// +// The object does not have a valid clock object.%0 +// + ASF_E_NOCLOCKOBJECT = HRESULT($C00D07E6); + {$EXTERNALSYM ASF_E_NOCLOCKOBJECT} + +// +// MessageId: ASF_E_UNKNOWNCLOCKTYPE +// +// MessageText: +// +// ASF_E_UNKNOWNCLOCKTYPE +// + ASF_E_UNKNOWNCLOCKTYPE = HRESULT($C00D07EB); + {$EXTERNALSYM ASF_E_UNKNOWNCLOCKTYPE} + +// +// MessageId: ASF_E_OPAQUEPACKET +// +// MessageText: +// +// An attempt was made to restore or access an opaque packet.%0 +// + ASF_E_OPAQUEPACKET = HRESULT($C00D07ED); + {$EXTERNALSYM ASF_E_OPAQUEPACKET} + +// +// MessageId: ASF_E_WRONGVERSION +// +// MessageText: +// +// ASF_E_WRONGVERSION +// + ASF_E_WRONGVERSION = HRESULT($C00D07EE); + {$EXTERNALSYM ASF_E_WRONGVERSION} + +// +// MessageId: ASF_E_OVERFLOW +// +// MessageText: +// +// An attempt was made to store a value which was larger than then destination's maximum value.%0 +// + ASF_E_OVERFLOW = HRESULT($C00D07EF); + {$EXTERNALSYM ASF_E_OVERFLOW} + +// +// MessageId: ASF_E_NOTFOUND +// +// MessageText: +// +// The object was not found.%0 +// + ASF_E_NOTFOUND = HRESULT($C00D07F0); + {$EXTERNALSYM ASF_E_NOTFOUND} + +// +// Someone else is using MessageIds 2033 & 2034, so we skip them +// +// 2033 = NS_E_NOTHING_TO_DO +// 2034 = NS_E_NO_MULTICAST + +// +// MessageId: ASF_E_OBJECTTOOBIG +// +// MessageText: +// +// The object is too large to be processed in the requested manner.%0 +// + ASF_E_OBJECTTOOBIG = HRESULT($C00D07F3); + {$EXTERNALSYM ASF_E_OBJECTTOOBIG} + +// +// MessageId: ASF_E_UNEXPECTEDVALUE +// +// MessageText: +// +// A value was not set as expected.%0 +// + ASF_E_UNEXPECTEDVALUE = HRESULT($C00D07F4); + {$EXTERNALSYM ASF_E_UNEXPECTEDVALUE} + +// +// MessageId: ASF_E_INVALIDSTATE +// +// MessageText: +// +// The request is not valid in the object's current state.%0 +// + ASF_E_INVALIDSTATE = HRESULT($C00D07F5); + {$EXTERNALSYM ASF_E_INVALIDSTATE} + +// +// MessageId: ASF_E_NOLIBRARY +// +// MessageText: +// +// This object does not have a valid library pointer; it was not properly created or it has been Shutdown().%0 +// + ASF_E_NOLIBRARY = HRESULT($C00D07F6); + {$EXTERNALSYM ASF_E_NOLIBRARY} + +// +// MessageId: ASF_E_ALREADYINITIALIZED +// +// MessageText: +// +// This object has already been initialized; the setting cannot be changed.%0 +// + ASF_E_ALREADYINITIALIZED = HRESULT($C00D07F7); + {$EXTERNALSYM ASF_E_ALREADYINITIALIZED} + +// +// MessageId: ASF_E_INVALIDINIT +// +// MessageText: +// +// This object has not been initialized properly; that operation cannot be performed.%0 +// + ASF_E_INVALIDINIT = HRESULT($C00D07F8); + {$EXTERNALSYM ASF_E_INVALIDINIT} + +// +// MessageId: ASF_E_NOHEADEROBJECT +// +// MessageText: +// +// The ASF Header object could not be found.%0 +// + ASF_E_NOHEADEROBJECT = HRESULT($C00D07F9); + {$EXTERNALSYM ASF_E_NOHEADEROBJECT} + +// +// MessageId: ASF_E_NODATAOBJECT +// +// MessageText: +// +// The ASF Data object could not be found.%0 +// + ASF_E_NODATAOBJECT = HRESULT($C00D07FA); + {$EXTERNALSYM ASF_E_NODATAOBJECT} + +// +// MessageId: ASF_E_NOINDEXOBJECT +// +// MessageText: +// +// The ASF Index object could not be found.%0 +// + ASF_E_NOINDEXOBJECT = HRESULT($C00D07FB); + {$EXTERNALSYM ASF_E_NOINDEXOBJECT} + +// +// MessageId: ASF_E_NOSTREAMPROPS +// +// MessageText: +// +// A Stream Properties object with the correct stream number could not be found.%0 +// + ASF_E_NOSTREAMPROPS = HRESULT($C00D07FC); + {$EXTERNALSYM ASF_E_NOSTREAMPROPS} + +// +// MessageId: ASF_E_NOFILEPROPS +// +// MessageText: +// +// The File Properties object could not be found.%0 +// + ASF_E_NOFILEPROPS = HRESULT($C00D07FD); + {$EXTERNALSYM ASF_E_NOFILEPROPS} + +// +// MessageId: ASF_E_NOLANGUAGELIST +// +// MessageText: +// +// The Language List object could not be found.%0 +// + ASF_E_NOLANGUAGELIST = HRESULT($C00D07FE); + {$EXTERNALSYM ASF_E_NOLANGUAGELIST} + +// +// MessageId: ASF_E_NOINDEXPARAMETERS +// +// MessageText: +// +// The Index Parameters object could not be found.%0 +// + ASF_E_NOINDEXPARAMETERS = HRESULT($C00D07FF); + {$EXTERNALSYM ASF_E_NOINDEXPARAMETERS} + +// +// MessageId: ASF_E_UNSUPPORTEDERRORCONCEALMENT +// +// MessageText: +// +// The requested error concealment strategy is not supported by this component.%0 +// + ASF_E_UNSUPPORTEDERRORCONCEALMENT = HRESULT($C00D0800); + {$EXTERNALSYM ASF_E_UNSUPPORTEDERRORCONCEALMENT} + +// +// MessageId: ASF_E_INVALIDFLAGS +// +// MessageText: +// +// The flags for this object or set of objects are not properly set.%0 +// + ASF_E_INVALIDFLAGS = HRESULT($C00D0801); + {$EXTERNALSYM ASF_E_INVALIDFLAGS} + +// +// MessageId: ASF_E_BADDATADESCRIPTOR +// +// MessageText: +// +// One or more data descriptors is not properly set.%0 +// + ASF_E_BADDATADESCRIPTOR = HRESULT($C00D0802); + {$EXTERNALSYM ASF_E_BADDATADESCRIPTOR} + +// +// MessageId: ASF_E_BADINDEXINTERVAL +// +// MessageText: +// +// The index has an invalid time interval (probably zero).%0 +// + ASF_E_BADINDEXINTERVAL = HRESULT($C00D0803); + {$EXTERNALSYM ASF_E_BADINDEXINTERVAL} + +// +// MessageId: ASF_E_INVALIDTIME +// +// MessageText: +// +// The given time value is not valid.%0 +// + ASF_E_INVALIDTIME = HRESULT($C00D0804); + {$EXTERNALSYM ASF_E_INVALIDTIME} + +// +// MessageId: ASF_E_INVALIDINDEX +// +// MessageText: +// +// The given index value is not valid.%0 +// + ASF_E_INVALIDINDEX = HRESULT($C00D0805); + {$EXTERNALSYM ASF_E_INVALIDINDEX} + +// +// MessageId: ASF_E_STREAMNUMBERINUSE +// +// MessageText: +// +// The specified stream number is already in use.%0 +// + ASF_E_STREAMNUMBERINUSE = HRESULT($C00D0806); + {$EXTERNALSYM ASF_E_STREAMNUMBERINUSE} + +// +// MessageId: ASF_E_BADMEDIATYPE +// +// MessageText: +// +// The specified media type does not work with this component.%0 +// + ASF_E_BADMEDIATYPE = HRESULT($C00D0807); + {$EXTERNALSYM ASF_E_BADMEDIATYPE} + +// +// MessageId: ASF_E_WRITEFAILED +// +// MessageText: +// +// The object could not be written as specified.%0 +// + ASF_E_WRITEFAILED = HRESULT($C00D0808); + {$EXTERNALSYM ASF_E_WRITEFAILED} + +// +// MessageId: ASF_E_NOTENOUGHDESCRIPTORS +// +// MessageText: +// +// The given data unit requires a larger number of descriptors to be fully parsed.%0 +// + ASF_E_NOTENOUGHDESCRIPTORS = HRESULT($C00D0809); + {$EXTERNALSYM ASF_E_NOTENOUGHDESCRIPTORS} + +// +// MessageId: ASF_E_INDEXBLOCKUNLOADED +// +// MessageText: +// +// The index entries for the specified index block have been unloaded from memory and are not available.%0 +// + ASF_E_INDEXBLOCKUNLOADED = HRESULT($C00D080A); + {$EXTERNALSYM ASF_E_INDEXBLOCKUNLOADED} + +// +// MessageId: ASF_E_NOTENOUGHBANDWIDTH +// +// MessageText: +// +// The specified bandwidth is not large enough.%0 +// + ASF_E_NOTENOUGHBANDWIDTH = HRESULT($C00D080B); + {$EXTERNALSYM ASF_E_NOTENOUGHBANDWIDTH} + +// +// MessageId: ASF_E_EXCEEDEDMAXIMUMOBJECTSIZE +// +// MessageText: +// +// The object has exceeded its maximum size.%0 +// + ASF_E_EXCEEDEDMAXIMUMOBJECTSIZE = HRESULT($C00D080C); + {$EXTERNALSYM ASF_E_EXCEEDEDMAXIMUMOBJECTSIZE} + +// +// MessageId: ASF_E_BADDATAUNIT +// +// MessageText: +// +// The given data unit is corrupted, badly formatted, or otherwise not valid.%0 +// + ASF_E_BADDATAUNIT = HRESULT($C00D080D); + {$EXTERNALSYM ASF_E_BADDATAUNIT} + +// +// MessageId: ASF_E_HEADERSIZE +// +// MessageText: +// +// The ASF header has exceeded the specified maximum size.%0 +// + ASF_E_HEADERSIZE = HRESULT($C00D080E); + {$EXTERNALSYM ASF_E_HEADERSIZE} + + +/////////////////////////////////////////////////////////////////////////// +// +// Advanced Streaming Format (ASF) Success Codes (2000 - 2999) +// + +// +// MessageId: ASF_S_OPAQUEPACKET +// +// MessageText: +// +// ASF_S_OPAQUEPACKET +// + ASF_S_OPAQUEPACKET = HRESULT($000D07F0); + {$EXTERNALSYM ASF_S_OPAQUEPACKET} + + + +//*@@@+++@@@@****************************************************************** +// +// Microsoft Windows Media +// Copyright (C) Microsoft Corporation. All rights reserved. +// +//*@@@---@@@@****************************************************************** + + // This routine examines the file extension in the URL or file name that is passed + // in as an argument. The routine returns S_OK if the file extension is included in a + // set of file extensions that the SDK is typically able to handle. or NS_E_INVALID_NAME + // if the file extension is not included in that set. + // + // This routine cannot be used to determine with absolute certainty if the SDK can + // handle a particular URL, as this cannot be known until the URL is opened. + + function WMCheckURLExtension(pwszURL: PWideChar): HRESULT; stdcall; + {$EXTERNALSYM WMCheckURLExtension} + + // This routine examines the URL scheme that is passed in as an argument. The routine + // returns S_OK if the URL scheme is included in a set of URL schemes that the SDK is + // typically able to handle. or NS_E_INVALID_NAME if the URL scheme is not included in + // that set. + // + // This routine cannot be used to determine with absolute certainty if the SDK can + // handle a particular URL, as this cannot be known until the URL is opened. + + function WMCheckURLScheme(pwszURLScheme: PWideChar): HRESULT; stdcall; + {$EXTERNALSYM WMCheckURLScheme} + + // This routine returns S_OK if the data buffer looks like a file type that is supported + // by the SDK. It returns NS_E_INVALID_DATA if the data buffer cannot be handled by the SDK. + // This routine may return a false positive, but will not return a false negative. + + function WMValidateData(pbData: PBYTE; var pdwDataSize: LongWord): HRESULT; stdcall; + {$EXTERNALSYM WMValidateData} + + // This routine validates that a URL can be played in Offline mode. + // The parameter pwszLanguage can be set to a RFC-1766 language ID, or to NULL if + // any language is acceptable. + // The output parameter pfIsAvailableOffline is set to TRUE if the URL can be + // played in Offline mode. + + function WMIsAvailableOffline(pwszURL, pwszLanguage: PWideChar; out pfIsAvailableOffline: BOOL): HRESULT; stdcall; + {$EXTERNALSYM WMIsAvailableOffline} + + // This function examines a file and determines whether or not it is DRM protected. + function WMIsContentProtected(pwszFileName: PWideChar; out pfIsProtected: BOOL): HRESULT; stdcall; + {$EXTERNALSYM WMIsContentProtected} + + function WMCreateCertificate(out pUnkCert: IUnknown): HRESULT; stdcall; + {$EXTERNALSYM WMCreateCertificate} + function WMCreateWriter(pUnkCert: IUnknown; out ppWriter: IWMWriter): HRESULT; stdcall; + {$EXTERNALSYM WMCreateWriter} + function WMCreateReader(pUnkCert: IUnknown; dwRights: LongWord; out ppReader: IWMReader): HRESULT; stdcall; + {$EXTERNALSYM WMCreateReader} + function WMCreateSyncReader(pUnkCert: IUnknown; dwRights: LongWord; out ppSyncReader: IWMSyncReader): HRESULT; stdcall; + {$EXTERNALSYM WMCreateSyncReader} + function WMCreateEditor(out ppEditor: IWMMetadataEditor): HRESULT; stdcall; + {$EXTERNALSYM WMCreateEditor} + function WMCreateIndexer(out ppIndexer: IWMIndexer): HRESULT; stdcall; + {$EXTERNALSYM WMCreateIndexer} + function WMCreateBackupRestorer(pCallback: IUnknown; out ppBackup: IWMLicenseBackup): HRESULT; stdcall; + {$EXTERNALSYM WMCreateBackupRestorer} + function WMCreateProfileManager(out ppProfileManager: IWMProfileManager): HRESULT; stdcall; + {$EXTERNALSYM WMCreateProfileManager} + function WMCreateWriterFileSink(out ppSink: IWMWriterFileSink ): HRESULT; stdcall; + {$EXTERNALSYM WMCreateWriterFileSink} + function WMCreateWriterNetworkSink(out ppSink: IWMWriterNetworkSink): HRESULT; stdcall; + {$EXTERNALSYM WMCreateWriterNetworkSink} + function WMCreateWriterPushSink(out ppSink: IWMWriterPushSink): HRESULT; stdcall; + {$EXTERNALSYM WMCreateWriterPushSink} + + +implementation + +const + WMVCORE = 'WMVCORE.DLL'; + +{$IFDEF WMF9_DYNAMIC_LINK} +var + WMVCORELib: THandle = 0; + + _WMCheckURLExtension : function(pwszURL: PWideChar): HRESULT; stdcall; + _WMCheckURLScheme : function(pwszURLScheme: PWideChar): HRESULT; stdcall; + _WMValidateData : function(pbData: PBYTE; var pdwDataSize: LongWord): HRESULT; stdcall; + _WMIsAvailableOffline : function(pwszURL, pwszLanguage: PWideChar; out pfIsAvailableOffline: BOOL): HRESULT; stdcall; + _WMIsContentProtected : function(pwszFileName: PWideChar; out pfIsProtected: BOOL): HRESULT; stdcall; + _WMCreateCertificate : function(out pUnkCert: IUnknown): HRESULT; stdcall; + _WMCreateWriter : function(pUnkCert: IUnknown; out ppWriter: IWMWriter): HRESULT; stdcall; + _WMCreateReader : function(pUnkCert: IUnknown; dwRights: LongWord; out ppReader: IWMReader): HRESULT; stdcall; + _WMCreateSyncReader : function(pUnkCert: IUnknown; dwRights: LongWord; out ppSyncReader: IWMSyncReader): HRESULT; stdcall; + _WMCreateEditor : function(out ppEditor: IWMMetadataEditor): HRESULT; stdcall; + _WMCreateIndexer : function(out ppIndexer: IWMIndexer): HRESULT; stdcall; + _WMCreateBackupRestorer : function(pCallback: IUnknown; out ppBackup: IWMLicenseBackup): HRESULT; stdcall; + _WMCreateProfileManager : function(out ppProfileManager: IWMProfileManager): HRESULT; stdcall; + _WMCreateWriterFileSink : function(out ppSink: IWMWriterFileSink ): HRESULT; stdcall; + _WMCreateWriterNetworkSink : function(out ppSink: IWMWriterNetworkSink): HRESULT; stdcall; + _WMCreateWriterPushSink : function(out ppSink: IWMWriterPushSink): HRESULT; stdcall; + + function WMVCORELoaded: boolean; + begin + Result := (WMVCORELib <> 0); + end; + + function UnLoadWMVCORE: Boolean; + begin + Result:= True; + if WMVCORELoaded then + begin + Result := FreeLibrary(WMVCORELib); + _WMCheckURLExtension := nil; + _WMCheckURLScheme := nil; + _WMValidateData := nil; + _WMIsAvailableOffline := nil; + _WMIsContentProtected := nil; + _WMCreateCertificate := nil; + _WMCreateWriter := nil; + _WMCreateReader := nil; + _WMCreateSyncReader := nil; + _WMCreateEditor := nil; + _WMCreateIndexer := nil; + _WMCreateBackupRestorer := nil; + _WMCreateProfileManager := nil; + _WMCreateWriterFileSink := nil; + _WMCreateWriterNetworkSink := nil; + _WMCreateWriterPushSink := nil; + WMVCORELib := 0; + end; + end; + + function LoadWMVCORELib: boolean; + begin + Result := WMVCORELoaded; + if (not Result) then + begin + WMVCORELib := LoadLibrary(WMVCORE); + if WMVCORELoaded then + begin + _WMCheckURLExtension := GetProcAddress(WMVCORELib, 'WMCheckURLExtension'); + _WMCheckURLScheme := GetProcAddress(WMVCORELib, 'WMCheckURLScheme'); + _WMValidateData := GetProcAddress(WMVCORELib, 'WMValidateData'); + _WMIsAvailableOffline := GetProcAddress(WMVCORELib, 'WMIsAvailableOffline'); + _WMIsContentProtected := GetProcAddress(WMVCORELib, 'WMIsContentProtected'); + _WMCreateCertificate := GetProcAddress(WMVCORELib, 'WMCreateCertificate'); + _WMCreateWriter := GetProcAddress(WMVCORELib, 'WMCreateWriter'); + _WMCreateReader := GetProcAddress(WMVCORELib, 'WMCreateReader'); + _WMCreateSyncReader := GetProcAddress(WMVCORELib, 'WMCreateSyncReader'); + _WMCreateEditor := GetProcAddress(WMVCORELib, 'WMCreateEditor'); + _WMCreateIndexer := GetProcAddress(WMVCORELib, 'WMCreateIndexer'); + _WMCreateBackupRestorer := GetProcAddress(WMVCORELib, 'WMCreateBackupRestorer'); + _WMCreateProfileManager := GetProcAddress(WMVCORELib, 'WMCreateProfileManager'); + _WMCreateWriterFileSink := GetProcAddress(WMVCORELib, 'WMCreateWriterFileSink'); + _WMCreateWriterNetworkSink := GetProcAddress(WMVCORELib, 'WMCreateWriterNetworkSink'); + _WMCreateWriterPushSink := GetProcAddress(WMVCORELib, 'WMCreateWriterPushSink'); + Result:= Assigned(_WMCheckURLExtension) and Assigned(_WMCheckURLScheme) and + Assigned(_WMValidateData) and Assigned(_WMIsAvailableOffline) and + Assigned(_WMIsContentProtected) and Assigned(_WMCreateCertificate) and + Assigned(_WMCreateWriter) and Assigned(_WMCreateReader) and + Assigned(_WMCreateSyncReader) and Assigned(_WMCreateEditor) and + Assigned(_WMCreateIndexer) and Assigned(_WMCreateBackupRestorer) and + Assigned(_WMCreateProfileManager) and Assigned(_WMCreateWriterFileSink) and + Assigned(_WMCreateWriterNetworkSink) and Assigned(_WMCreateWriterPushSink); + if not Result then UnLoadWMVCORE; + end; + end; + end; + + function WMCheckURLExtension(pwszURL: PWideChar): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCheckURLExtension(pwszURL); + end; + + function WMCheckURLScheme(pwszURLScheme: PWideChar): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCheckURLScheme(pwszURLScheme); + end; + + function WMValidateData(pbData: PBYTE; var pdwDataSize: LongWord): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMValidateData(pbData, pdwDataSize); + end; + + function WMIsAvailableOffline(pwszURL, pwszLanguage: PWideChar; out pfIsAvailableOffline: BOOL): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMIsAvailableOffline(pwszURL, pwszLanguage, pfIsAvailableOffline); + end; + + function WMIsContentProtected(pwszFileName: PWideChar; out pfIsProtected: BOOL): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMIsContentProtected(pwszFileName, pfIsProtected); + end; + + function WMCreateCertificate(out pUnkCert: IUnknown): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateCertificate(pUnkCert); + end; + + function WMCreateWriter(pUnkCert: IUnknown; out ppWriter: IWMWriter): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateWriter(pUnkCert, ppWriter); + end; + + function WMCreateReader(pUnkCert: IUnknown; dwRights: LongWord; out ppReader: IWMReader): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateReader(pUnkCert, dwRights, ppReader); + end; + + function WMCreateSyncReader(pUnkCert: IUnknown; dwRights: LongWord; out ppSyncReader: IWMSyncReader): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateSyncReader(pUnkCert, dwRights, ppSyncReader); + end; + + function WMCreateEditor(out ppEditor: IWMMetadataEditor): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := WMCreateEditor(ppEditor); + end; + + function WMCreateIndexer(out ppIndexer: IWMIndexer): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateIndexer(ppIndexer); + end; + + function WMCreateBackupRestorer(pCallback: IUnknown; out ppBackup: IWMLicenseBackup): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateBackupRestorer(pCallback, ppBackup); + end; + + function WMCreateProfileManager(out ppProfileManager: IWMProfileManager): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateProfileManager(ppProfileManager); + end; + + function WMCreateWriterFileSink(out ppSink: IWMWriterFileSink ): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateWriterFileSink(ppSink); + end; + + function WMCreateWriterNetworkSink(out ppSink: IWMWriterNetworkSink): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateWriterNetworkSink(ppSink); + end; + + function WMCreateWriterPushSink(out ppSink: IWMWriterPushSink): HRESULT; stdcall; + begin + LoadWMVCORELib; + Result := _WMCreateWriterPushSink(ppSink); + end; + +{$ELSE} + function WMCheckURLExtension; external WMVCORE name 'WMCheckURLExtension'; + function WMCheckURLScheme; external WMVCORE name 'WMCheckURLScheme'; + function WMValidateData; external WMVCORE name 'WMValidateData'; + function WMIsAvailableOffline; external WMVCORE name 'WMIsAvailableOffline'; + + function WMIsContentProtected; external WMVCORE name 'WMIsContentProtected'; + function WMCreateCertificate; external WMVCORE name 'WMCreateCertificate'; + function WMCreateWriter; external WMVCORE name 'WMCreateWriter'; + function WMCreateReader; external WMVCORE name 'WMCreateReader'; + function WMCreateSyncReader; external WMVCORE name 'WMCreateSyncReader'; + function WMCreateEditor; external WMVCORE name 'WMCreateEditor'; + function WMCreateIndexer; external WMVCORE name 'WMCreateIndexer'; + function WMCreateBackupRestorer; external WMVCORE name 'WMCreateBackupRestorer'; + function WMCreateProfileManager; external WMVCORE name 'WMCreateProfileManager'; + function WMCreateWriterFileSink; external WMVCORE name 'WMCreateWriterFileSink'; + function WMCreateWriterNetworkSink; external WMVCORE name 'WMCreateWriterNetworkSink'; + function WMCreateWriterPushSink; external WMVCORE name 'WMCreateWriterPushSink'; +{$ENDIF} + +initialization +{$IFDEF WMF9_DYNAMIC_LINK} + _WMCheckURLExtension := nil; + _WMCheckURLScheme := nil; + _WMValidateData := nil; + _WMIsAvailableOffline := nil; + _WMIsContentProtected := nil; + _WMCreateCertificate := nil; + _WMCreateWriter := nil; + _WMCreateReader := nil; + _WMCreateSyncReader := nil; + _WMCreateEditor := nil; + _WMCreateIndexer := nil; + _WMCreateBackupRestorer := nil; + _WMCreateProfileManager := nil; + _WMCreateWriterFileSink := nil; + _WMCreateWriterNetworkSink := nil; + _WMCreateWriterPushSink := nil; +{$ENDIF} + +finalization +{$IFDEF WMF9_DYNAMIC_LINK} + UnLoadWMVCORE; +{$ENDIF} + +end. + + diff --git a/Game/Code/lib/DSPack/DirectX9/dxerr8.pas b/Game/Code/lib/DSPack/DirectX9/dxerr8.pas new file mode 100644 index 00000000..9a8c399f --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/dxerr8.pas @@ -0,0 +1,129 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* File: dxerr8.h *} +{* *} +{* Content: DirectX Error Library Include File *} +{* *} +{* DirectX 8.x Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 26-Jan-2003 *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{******************************************************************************) +{ } +{ 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 } +{ } +{******************************************************************************} + +unit DXErr8; + +interface + +{$HPPEMIT '#include "dxerr8.h"'} + +uses + Windows; + +(*==========================================================================; + * + * + * File: dxerr8.h + * Content: DirectX Error Library Include File + * + ****************************************************************************) + +// +// DXGetErrorString8 +// +// Desc: Converts an DirectX HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// DPLAY D3D8 D3DX8 DMUSIC DSOUND +// +// Return: Converted string +// + +const + //////////// DLL export definitions /////////////////////////////////////// + dxerr8dll = 'dxerr81ab.dll'; + {$EXTERNALSYM dxerr8dll} + +function DXGetErrorString8A(hr: HRESULT): PAnsiChar; stdcall; external dxerr8dll; +{$EXTERNALSYM DXGetErrorString8A} +function DXGetErrorString8W(hr: HRESULT): PWideChar; stdcall; external dxerr8dll; +{$EXTERNALSYM DXGetErrorString8W} + +function DXGetErrorString8(hr: HRESULT): PChar; stdcall; external dxerr8dll + name {$IFDEF UNICODE}'DXGetErrorString8W'{$ELSE}'DXGetErrorString8A'{$ENDIF}; +{$EXTERNALSYM DXGetErrorString8} + +// +// DXTrace +// +// Desc: Outputs a formatted error message to the debug stream +// +// Args: CHAR* strFile The current file, typically passed in using the +// __FILE__ macro. +// DWORD dwLine The current line number, typically passed in using the +// __LINE__ macro. +// HRESULT hr An HRESULT that will be traced to the debug stream. +// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) +// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. +// +// Return: The hr that was passed in. +// + +function DXTraceA(strFile: PAnsiChar; dwLine: DWORD; hr: HRESULT; strMsg: PAnsiChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr8dll; +{$EXTERNALSYM DXTraceA} +function DXTraceW(strFile: PWideChar; dwLine: DWORD; hr: HRESULT; strMsg: PWideChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr8dll; +{$EXTERNALSYM DXTraceW} + +function DXTrace(strFile: PChar; dwLine: DWORD; hr: HRESULT; strMsg: PChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr8dll + name {$IFDEF UNICODE}'DXTraceW'{$ELSE}'DXTraceA'{$ENDIF}; +{$EXTERNALSYM DXTrace} + +// +// Helper macros +// +(* +#if defined(DEBUG) | defined(_DEBUG) + #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) + #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) + #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#else + #define DXTRACE_MSG(str) (0L) + #define DXTRACE_ERR(str,hr) (hr) + #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr) +#endif +*) + +implementation + +end. + diff --git a/Game/Code/lib/DSPack/DirectX9/dxerr9.pas b/Game/Code/lib/DSPack/DirectX9/dxerr9.pas new file mode 100644 index 00000000..522e9ef1 --- /dev/null +++ b/Game/Code/lib/DSPack/DirectX9/dxerr9.pas @@ -0,0 +1,150 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* File: dxerr9.h *} +{* *} +{* Content: DirectX Error Library Include File *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 26-Jan-2003 *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi *} +{* *} +{******************************************************************************) +{ } +{ 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 } +{ } +{******************************************************************************} + +unit dxerr9; + +interface + +{$HPPEMIT '#include "dxerr9.h"'} + +uses + Windows; + +(*==========================================================================; + * + * + * File: dxerr9.h + * Content: DirectX Error Library Include File + * + ****************************************************************************) + +const + //////////// DLL export definitions /////////////////////////////////////// + dxerr9dll = 'dxerr9ab.dll'; + {$EXTERNALSYM dxerr9dll} + +// +// DXGetErrorString9 +// +// Desc: Converts a DirectX 9 or earlier HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: Converted string +// + +function DXGetErrorString9A(hr: HRESULT): PAnsiChar; stdcall; external dxerr9dll; +{$EXTERNALSYM DXGetErrorString9A} +function DXGetErrorString9W(hr: HRESULT): PWideChar; stdcall; external dxerr9dll; +{$EXTERNALSYM DXGetErrorString9W} + +function DXGetErrorString9(hr: HRESULT): PChar; stdcall; external dxerr9dll + name {$IFDEF UNICODE}'DXGetErrorString9W'{$ELSE}'DXGetErrorString9A'{$ENDIF}; +{$EXTERNALSYM DXGetErrorString9} + + +// +// DXGetErrorDescription9 +// +// Desc: Returns a string description of a DirectX 9 or earlier HRESULT +// +// Args: HRESULT hr Can be any error code from +// D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: String description +// +function DXGetErrorDescription9A(hr: HRESULT): PAnsiChar; stdcall; external dxerr9dll; +{$EXTERNALSYM DXGetErrorDescription9A} +function DXGetErrorDescription9W(hr: HRESULT): PWideChar; stdcall; external dxerr9dll; +{$EXTERNALSYM DXGetErrorDescription9W} + +function DXGetErrorDescription9(hr: HRESULT): PChar; stdcall; external dxerr9dll + name {$IFDEF UNICODE}'DXGetErrorDescription9W'{$ELSE}'DXGetErrorDescription9A'{$ENDIF}; +{$EXTERNALSYM DXGetErrorDescription9} + + +// +// DXTrace +// +// Desc: Outputs a formatted error message to the debug stream +// +// Args: CHAR* strFile The current file, typically passed in using the +// __FILE__ macro. +// DWORD dwLine The current line number, typically passed in using the +// __LINE__ macro. +// HRESULT hr An HRESULT that will be traced to the debug stream. +// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) +// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. +// +// Return: The hr that was passed in. +// + +function DXTraceA(strFile: PAnsiChar; dwLine: DWORD; hr: HRESULT; strMsg: PAnsiChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll; +{$EXTERNALSYM DXTraceA} +function DXTraceW(strFile: PWideChar; dwLine: DWORD; hr: HRESULT; strMsg: PWideChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll; +{$EXTERNALSYM DXTraceW} + +function DXTrace(strFile: PChar; dwLine: DWORD; hr: HRESULT; strMsg: PChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll + name {$IFDEF UNICODE}'DXTraceW'{$ELSE}'DXTraceA'{$ENDIF}; +{$EXTERNALSYM DXTrace} + +// +// Helper macros +// +(* +#if defined(DEBUG) | defined(_DEBUG) +#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) +#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) +#else +#define DXTRACE_MSG(str) (0L) +#define DXTRACE_ERR(str,hr) (hr) +#define DXTRACE_ERR_MSGBOX(str,hr) (hr) +#endif +*) + +implementation + +end. + diff --git a/Game/Code/lib/DSPack/UCaptureWDM.pas b/Game/Code/lib/DSPack/UCaptureWDM.pas new file mode 100644 index 00000000..107d296a --- /dev/null +++ b/Game/Code/lib/DSPack/UCaptureWDM.pas @@ -0,0 +1,406 @@ +// this unit based on the code sniplet from https://forums.embarcadero.com/thread.jspa?threadID=8341&tstart=359 +// and was modified by brunzel +// the original author is "harrie pearce" + + +unit UCaptureWDM; + +interface + +uses + Classes, Windows, DSPack, DirectShow9, DSUtil, SDL, ExtCtrls; + +type + TCaptureState = (csPlay, csStop, csDisbaled); + TList = array of string; + + TCapture = class(TObject) + private + SysDev: TSysDevEnum; + FilterGraph: TFilterGraph; + SampleGrabber: TSampleGrabber; + Filter: TFilter; + NullRenderer: TFilter; + DeviceIndex: Integer; + MediaType: Integer; + CaptureState: TCaptureState; + VideoMediaTypes: TEnumMediaType; + function PrepareGraph: Boolean; + public + Image: TImage; + constructor Create(DeviceID, MediaTypeID: integer); + destructor Destroy; override; + + procedure SelectDevice(Index: Integer); + procedure Play; + procedure Stop; + end; + + TSampleClass = class(TThread) + private + Capture: TCapture; + frame: Pointer; + width: integer; + height: integer; + capturing: boolean; + ready: boolean; + Error: boolean; + + procedure GetImage; + protected + procedure Execute; override; + public + FramePtr: PByteArray; + + constructor Create(DeviceID, MediaTypeID: integer); + destructor Destroy; override; + + function GetWidth: integer; + function GetHeight: integer; + property CapStatus: boolean read ready; + + procedure TriggerCapture; + procedure SelectDevice(Index: Integer); + procedure Start; + procedure Stop; + end; + + function GetCapDevices: TList; + function ListMediaTypes(DeviceID: integer): TList; + +implementation + +uses + Graphics, SyncObjs, SysUtils; + +function GetCapDevices: TList; +var + k: Integer; + tSysDev: TSysDevEnum; +begin + SetLength(Result, 0); + tSysDev := TSysDevEnum.Create(CLSID_VideoInputDeviceCategory); + + SetLength(Result, tSysDev.CountFilters); + for k := 0 to tSysDev.CountFilters - 1 do + Result[k] := tSysDev.Filters[k].FriendlyName; + + tSysDev.Free; +end; + +function ListMediaTypes(DeviceID: integer): TList; +var + PinList: TPinList; + tSysDev: TSysDevEnum; + Filter: TFilter; + FilterGraph: TFilterGraph; + VideoMediaTypes: TEnumMediaType; + k: Integer; + +begin + SetLength(Result, 0); + + tSysDev := TSysDevEnum.Create(CLSID_VideoInputDeviceCategory); + + FilterGraph := TFilterGraph.Create( nil ); + FilterGraph.Mode := gmCapture; + FilterGraph.Active := False; + FilterGraph.AutoCreate := False; + FilterGraph.GraphEdit := True; + + Filter := TFilter.Create( nil ); + Filter.FilterGraph := FilterGraph; + + Filter.BaseFilter.Moniker := tSysDev.GetMoniker(DeviceID); + Filter.FilterGraph.Active := true; + PinList := TPinList.Create(Filter as IBaseFilter); + VideoMediaTypes := TEnumMediaType.Create(PinList.First); + + SetLength(Result, VideoMediaTypes.Count); + for k := 0 to VideoMediaTypes.Count - 1 do + begin + Result[k] := VideoMediaTypes.MediaFormatDescription[k]; + //writeln(Result[k]); + //writeln(VideoMediaTypes.MediaFormatDescription[k]); + end; + + PinList.Free; + VideoMediaTypes.Free; + FilterGraph.Stop; + FilterGraph.ClearGraph; + FilterGraph.Active := False; + FilterGraph.Free; + Filter.Free; + tSysDev.Free; +end; + +constructor TSampleClass.Create(DeviceID, MediaTypeID: integer); +begin + inherited Create(true); + + Self.Priority := tpLower; + Self.FreeOnTerminate := false; + + Capture := TCapture.Create(DeviceID, MediaTypeID); + + width := 320; + height := 240; + + Capture.Image.Picture.Bitmap.SetSize(width, height); + Capture.Image.Picture.Bitmap.PixelFormat := pf24bit; + + GetMem(frame, width*height*3); + FramePtr := frame; + + capturing := false; + ready := true; + Error := false; + + Self.Resume; +end; + +destructor TSampleClass.Destroy; +begin + inherited; + + if(frame<>nil) then + FreeMem(frame); + frame := nil; + + Capture.Free; +end; + + +procedure TSampleClass.Execute; +begin + while not terminated do + begin + if capturing then + begin + ready := false; + GetImage; + + capturing := false; + ready := true; + + if Error then + Self.Terminate; + end; + Sleep(0); + end; +end; + +function TSampleClass.GetWidth: integer; +begin + Result := Capture.Image.Picture.Width; +end; + +function TSampleClass.GetHeight: integer; +begin + Result := Capture.Image.Picture.Height; +end; + +procedure TSampleClass.TriggerCapture; +begin + if ready then + begin + ready := false; + capturing := true; + end else + capturing := false; +end; + +procedure TSampleClass.GetImage; +var + y: integer; + w, h: integer; + PLine: PByteArray; + +begin + if (Capture.FilterGraph.State = gsPlaying) and (Capture.CaptureState = csPlay) then + begin + Capture.Image.Canvas.Lock; + try + try + Capture.SampleGrabber.GetBitmap(Capture.Image.Picture.Bitmap); + + w := Capture.Image.Picture.Width; + h := Capture.Image.Picture.Height; + + if (w<>width) or (h<>height) then + begin + FreeMem(frame); + frame := nil; + GetMem(frame, w*h*3); + width := w; + height := h; + end; + + FramePtr := frame; + for y := 0 to h - 1 do + begin + PLine := Capture.Image.Picture.Bitmap.ScanLine[h-y-1]; + move(PLine[0], FramePtr[y*w*3], w*3); + end; + except + Error := true; + end; + finally + Capture.Image.Canvas.Unlock; + end; + end; +end; + +procedure TSampleClass.SelectDevice(Index: Integer); +begin + Capture.SelectDevice(Index); +end; + +procedure TSampleClass.Start; +begin + Capture.Play; +end; + +procedure TSampleClass.Stop; +begin + Capture.Stop; +end; + + + +constructor TCapture.Create(DeviceID, MediaTypeID: integer); +var + i, j: Integer; + +begin + inherited Create; + + CaptureState := csStop; + DeviceIndex := DeviceID; + MediaType := MediaTypeID; + + SysDev := TSysDevEnum.Create(CLSID_VideoInputDeviceCategory); + + Image := TImage.Create( nil ); + FillRect(Image.Canvas.Handle, Image.ClientRect, GetStockObject(BLACK_BRUSH)); + + FilterGraph := TFilterGraph.Create( nil ); + FilterGraph.Mode := gmCapture; + FilterGraph.Active := False; + FilterGraph.AutoCreate := False; + FilterGraph.GraphEdit := True; + + SampleGrabber := TSampleGrabber.Create( nil ); + SampleGrabber.FilterGraph := FilterGraph; + + Filter := TFilter.Create( nil ); + Filter.FilterGraph := FilterGraph; + + NullRenderer := TFilter.Create( nil ); + NullRenderer.FilterGraph := FilterGraph; + + SysDev.SelectGUIDCategory(CLSID_ActiveMovieCategories); + + for i := 0 to SysDev.CountCategories - 1 do + begin + if SysDev.Categories[i].FriendlyName = 'DirectShow Filters' then + begin + SysDev.SelectIndexCategory(i); + if SysDev.CountFilters > 0 then + begin + for j := 0 to SysDev.CountFilters - 1 do + begin + if SysDev.Filters[j].FriendlyName = 'Null Renderer' then + begin + NullRenderer.BaseFilter.Moniker := SysDev.GetMoniker(j); + Break; + end; + end; + end; + Break; + end; + end; +end; + +destructor TCapture.Destroy; +begin + inherited; + VideoMediaTypes.Free; + FilterGraph.Stop; + FilterGraph.ClearGraph; + FilterGraph.Active := False; + Image.Free; + FilterGraph.Free; + SampleGrabber.Free; + Filter.Free; + NullRenderer.Free; + SysDev.Free; +end; + +function TCapture.PrepareGraph: Boolean; +var + PinList: TPinList; + +begin + Result := False; + SysDev.SelectGUIDCategory(CLSID_VideoInputDeviceCategory); + if SysDev.CountFilters > 0 then + begin + if DeviceIndex < SysDev.CountFilters then + begin + FilterGraph.ClearGraph; + FilterGraph.Active := False; + Filter.BaseFilter.Moniker := SysDev.GetMoniker(DeviceIndex); + + FilterGraph.Active := True; + + if Filter.FilterGraph <> nil then + begin + PinList := TPinList.Create(Filter as IBaseFilter); + if (VideoMediaTypes=nil) then + VideoMediaTypes := TEnumMediaType.Create(PinList.First) + else + VideoMediaTypes.Assign(PinList.First); + + with (PinList.First as IAMStreamConfig) do + SetFormat(VideoMediaTypes.Items[MediaType].AMMediaType^); + PinList.Free; + end; + + with FilterGraph as ICaptureGraphBuilder2 do + RenderStream(@PIN_CATEGORY_PREVIEW, nil, Filter as IBaseFilter, + SampleGrabber as IBaseFilter, NullRenderer as IbaseFilter); + Result := True; + end; + end; +end; + +procedure TCapture.SelectDevice(Index: Integer); +begin + DeviceIndex := Index; +end; + +procedure TCapture.Play; +begin + if FilterGraph.State <> gsPlaying then + begin + if PrepareGraph then + begin + FilterGraph.Play; + CaptureState := csPlay; + end; + end; +end; + +procedure TCapture.Stop; +begin + if (CaptureState = csPlay) or (FilterGraph.State = gsPlaying) or + (FilterGraph.State = gsPaused) then + begin + CaptureState := csStop; + FilterGraph.Stop; + FilterGraph.Active := False; + end; +end; + +end. \ No newline at end of file diff --git a/Game/Code/lib/acinerella/acinerella.c b/Game/Code/lib/acinerella/acinerella.c index 509346a7..5b0178e4 100644 --- a/Game/Code/lib/acinerella/acinerella.c +++ b/Game/Code/lib/acinerella/acinerella.c @@ -344,7 +344,10 @@ int CALL_CONVT ac_open( AC_BUFSIZE, 0, pacInstance, io_read, 0, io_seek); } - if(av_open_input_stream(&(((lp_ac_data)pacInstance)->pFormatCtx), + //Open the given input stream (the io structure) with the given format of the stream + //(fmt) and write the pointer to the new format context to the pFormatCtx variable + if (av_open_input_stream( + &(((lp_ac_data)pacInstance)->pFormatCtx), &(((lp_ac_data)pacInstance)->io), "", fmt, NULL) < 0) { return -1; @@ -386,11 +389,12 @@ void CALL_CONVT ac_close(lp_ac_instance pacInstance) { av_close_input_stream(((lp_ac_data)(pacInstance))->pFormatCtx); pacInstance->opened = 0; - /* - Auto freed by av_close_input_stream - if (((lp_ac_data)(pacInstance))->buffer) { + //If the seek proc has not been specified, the input buffer is not automatically + //freed, as ffmpeg didn't get the original pointer to the buffer + if (!((lp_ac_data)(pacInstance))->seek_proc && + ((lp_ac_data)(pacInstance))->buffer) { av_free(((lp_ac_data)(pacInstance))->buffer); - }*/ + } } } -- cgit v1.2.3