// ap.idl : IDL source for VMRAllocPresenter.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (ap.tlb) and marshalling code.

//=====================================================================


import "unknwn.idl";

cpp_quote("#ifdef DSHOW_INDEPENDENT")
typedef struct _AMMediaType {
   GUID     majortype;
   GUID     subtype;
   BOOL     bFixedSizeSamples;
   BOOL     bTemporalCompression;
   ULONG    lSampleSize;
   GUID     formattype;
   IUnknown *pUnk;
   ULONG    cbFormat;
   [size_is(cbFormat)] BYTE * pbFormat;
} AM_MEDIA_TYPE;
cpp_quote ("#endif")

cpp_quote("#if 0")
// This is temporary hack to get around the fact thatI don't know how to persuade
// MIDL to allow forward declarations.
typedef DWORD*    LPDIRECTDRAW7;
typedef DWORD*    LPDIRECTDRAWSURFACE7;
cpp_quote ("#endif")

cpp_quote("#include <ddraw.h>")


interface IVMRSurface;
interface IVMRSurfaceAllocator;
interface IVMRSurfaceAllocatorInternal;
interface IVMRSurfaceAllocatorNotify;
interface IVMRWindowlessControl;


import "oaidl.idl";
import "ocidl.idl";


[
    object,
    uuid(a9849bbe-9ec8-4263-b764-62730f0d15d0),
    helpstring("IVMRSurfaceAllocator Interface"),
    pointer_default(unique)
]
interface IVMRSurface : IUnknown
{
    HRESULT IsSurfaceLocked();

    HRESULT LockSurface(
            [out] BYTE** lpSurface
            );

    HRESULT UnlockSurface();

    HRESULT GetSurface(
            [out] LPDIRECTDRAWSURFACE7 *lplpSurface
            );
};


[
    object,
    uuid(31ce832e-4484-458b-8cca-f4d7e3db0b52),
    helpstring("IVMRSurfaceAllocator Interface"),
    pointer_default(unique)
]
interface IVMRSurfaceAllocator : IUnknown
{
    HRESULT AllocateSurfaces(
            [in] const AM_MEDIA_TYPE* pmt,
            [in] [out] DWORD* lpdwBackBuffers,
            [out] AM_MEDIA_TYPE **ppmt
            );

    HRESULT FreeSurfaces(
            );

    HRESULT GetNextSurface(
            [out] LPDIRECTDRAWSURFACE7 *lplpSurface,
            [in] DWORD dwSurfaceFlags
            );
};

[
    object,
    uuid(26716b2e-9b79-4a48-8ddf-a8131183803b),

    helpstring("IVMRSurfaceAllocatorInternal Interface"),
    pointer_default(unique)
]
interface IVMRSurfaceAllocatorInternal : IVMRSurfaceAllocator
{
    HRESULT AdviseNotify(
            [in] IVMRSurfaceAllocatorNotify* lpIVMRSurfaceAllocatorNotify
            );
};

[
    object,
    uuid(aada05a8-5a4e-4729-af0b-cea27aed51e2),

    helpstring("IVMRSurfaceAllocatorNotify Interface"),
    pointer_default(unique)
]
interface IVMRSurfaceAllocatorNotify : IUnknown
{
    HRESULT AdviseSurfaceAllocator(
            [in] IVMRSurfaceAllocator* lpIVRMSurfaceAllocator
            );

    HRESULT SetDDrawDevice(
            [in] LPDIRECTDRAW7 lpDDrawDevice
            );

    HRESULT ChangeDDrawDevice(
            [in] LPDIRECTDRAW7 lpDDrawDevice
            );

    HRESULT RestoreDDrawSurfaces(
            );
};


[
    object,
    uuid(0eb1088c-4dcd-46f0-878f-39dae86a51b7),

    helpstring("IVMRWindowlessControl Interface"),
    pointer_default(unique)
]
interface IVMRWindowlessControl : IUnknown
{
    //
    //////////////////////////////////////////////////////////
    // Video size and position information
    //////////////////////////////////////////////////////////
    //
    HRESULT GetNativeVideoSize(
            [in] LONG* lpWidth,
            [in] LONG* lpHeight,
            [in] LONG* lpARWidth,
            [in] LONG* lpARHeight
            );

    HRESULT GetMinIdealVideoSize(
            [in] LONG* lpWidth,
            [in] LONG* lpHeight
            );

    HRESULT GetMaxIdealVideoSize(
            [in] LONG* lpWidth,
            [in] LONG* lpHeight
            );

    HRESULT SetVideoPosition(
            [in] const LPRECT lpSRCRect,
            [in] const LPRECT lpDSTRect
            );

    HRESULT GetVideoPosition(
            [out] LPRECT lpSRCRect,
            [out] LPRECT lpDSTRect
            );

    HRESULT GetAspectRatioMode(
            [out] DWORD* lpAspectRatioMode
            );

    HRESULT SetAspectRatioMode(
            [in] DWORD AspectRatioMode
            );

    //
    //////////////////////////////////////////////////////////
    // Display and clipping management
    //////////////////////////////////////////////////////////
    //
    HRESULT SetVideoClippingWindow(
            [in] HWND hwnd
            );

    HRESULT RepaintVideo(
            [in] HWND hwnd,
            [in] HDC hdc
            );

    HRESULT DisplayModeChanged();


    //
    //////////////////////////////////////////////////////////
    // Color control
    //////////////////////////////////////////////////////////
    //
    HRESULT SetBorderColor(
            [in] COLORREF Clr
            );

    HRESULT GetBorderColor(
            [out] COLORREF* lpClr
            );

    HRESULT SetColorKey(
            [in] COLORREF Clr
            );

    HRESULT GetColorKey(
            [out] COLORREF* lpClr
            );
};


[
    uuid(529b581a-2f2c-4a77-be9b-d8866d48dd4c),
    version(1.0),
    helpstring("Allocator/Presenter 1.0 Type Library")
]
library ALLOCATORPRESENTERLib
{
    importlib("stdole2.tlb");

    [
        uuid(33eb53cc-58c1-403e-92b3-732ebcf98017),
        helpstring("AllocatorPresenter Class")
    ]
    coclass AllocPresenter
    {
        [default] interface IVMRSurfaceAllocatorInternal;
    };
};

