// -*- Mode: C++ -*-
/*++

Copyright (c) 1998 Microsoft Corporation

Abstract:

    Interface definitions for Windows Multimedia Runtime components

--*/

cpp_quote("#include \"danim.h\"")

[
    uuid(a1b046bc-4ad2-11d2-b953-3078302c2030),
    lcid(0x0000),
    version(1.0)
]
library WindowsMultimediaRuntime
{
    importlib("STDOLE2.TLB");
    importlib("DANIM.TLB");
    
    interface IMMBehavior;
    interface IMMTimeline;
    interface IMMPlayer;
    interface IMMFactory;
    
    typedef enum {
        MM_PLAY_EVENT,
        MM_STOP_EVENT,
        MM_REPEAT_EVENT,
        MM_AUTOREVERSE_EVENT,
        MM_PAUSE_EVENT,
        MM_RESUME_EVENT,
    } MM_EVENT_TYPE ;

    [
        object,
        uuid(dc2f58e6-4ad2-11d2-b953-3078302c2030),
        dual,
        pointer_default(unique)
    ]
    interface IMMEventCB : IUnknown
    {
        HRESULT OnEvent([in] double eventTime,
                        [in] IMMBehavior *,
                        [in] MM_EVENT_TYPE et);
    }

    typedef enum {
        MM_PLAYING_STATE,
        MM_STOPPED_STATE,
        MM_PAUSED_STATE,
    } MM_STATE;

    typedef enum {
        MM_START_ABSOLUTE,
        MM_START_EVENT,
        MM_START_WITH,
        MM_START_AFTER,
    } MM_START_TYPE;
    
    typedef enum {
        MM_STOP_ABSOLUTE,
        MM_STOP_WITH
    } MM_STOP_TYPE;
    
    [
        object,
        uuid(18b4a8b2-5f36-11d2-b957-3078302c2030),
        dual,
        pointer_default(unique)
    ]
    interface IMMBehavior : IDispatch
    {
        [propget] HRESULT ID([out, retval] BSTR *);
        [propput] HRESULT ID([in] BSTR);
        
        [propget] HRESULT StartOffset([out, retval] float *);
        [propput] HRESULT StartOffset([in] float);
        
        [propget] HRESULT Duration([out, retval] float *);
        [propput] HRESULT Duration([in] float);
        
        [propget] HRESULT Repeat([out, retval] LONG *);
        [propput] HRESULT Repeat([in] LONG);
        
        [propget] HRESULT AutoReverse([out, retval] VARIANT_BOOL *);
        [propput] HRESULT AutoReverse([in] VARIANT_BOOL);
        
        [propget] HRESULT RepeatDur([out, retval] float *);
        [propput] HRESULT RepeatDur([in] float);

        [propget] HRESULT EndOffset([out, retval] float *);
        [propput] HRESULT EndOffset([in] float);
        
        [propget] HRESULT EaseIn([out, retval] float *);
        [propput] HRESULT EaseIn([in] float);

        [propget] HRESULT EaseInStart([out, retval] float *);
        [propput] HRESULT EaseInStart([in] float);

        [propget] HRESULT EaseOut([out, retval] float *);
        [propput] HRESULT EaseOut([in] float);

        [propget] HRESULT EaseOutEnd([out, retval] float *);
        [propput] HRESULT EaseOutEnd([in] float);

        [propget] HRESULT EventCB([out, retval] IMMEventCB **);
        [propput] HRESULT EventCB([in] IMMEventCB *);

        [propget] HRESULT TotalTime([out, retval] float *);

        HRESULT Begin(VARIANT_BOOL bAfterOffset);
        HRESULT End();
        HRESULT Pause();
        HRESULT Run();
        HRESULT Seek([in] double lTime);

        [propget] HRESULT CurrentTime([out, retval] double * d);

        [propget] HRESULT PlayState([out, retval] MM_STATE *);
        
        [propget] HRESULT DABehavior([out, retval] IDABehavior **);

        HRESULT GetDABehavior(REFIID iid, void ** retobj);
    }

    // Flags for the endsync property.
    enum {
        MM_ENDSYNC_NONE    = 0x00000000,
        MM_ENDSYNC_FIRST   = 0x00000001,
        MM_ENDSYNC_LAST    = 0x00000002,
    } ;

    [
        object,
        uuid(03030490-4ad3-11d2-b953-3078302c2030),
        dual,
        pointer_default(unique)
    ]
    interface IMMTimeline : IMMBehavior
    {
        HRESULT AddBehavior([in] IMMBehavior * bvr,
                            [in] MM_START_TYPE st,
                            [in] IMMBehavior * basebvr);
        HRESULT RemoveBehavior([in] IMMBehavior * bvr);

        HRESULT AddView([in] IDAView * view,
                        [in] IUnknown *pUnk,
                        [in] IDAImage * img,
                        [in] IDASound * snd);

        [propget] HRESULT EndSync([out, retval] DWORD * flags);
        [propput] HRESULT EndSync([in] DWORD flags);
    }


    [
        object,
        uuid(abc4aa1c-5bbc-11d2-b957-3078302c2030),
        dual,
        pointer_default(unique)
    ]
    interface IMMPlayer : IDispatch
    {
        [propget] HRESULT ID([out, retval] BSTR *);
        [propput] HRESULT ID([in] BSTR);
        
        HRESULT Play();
        HRESULT Stop();
        HRESULT Pause();
        HRESULT Resume();
        
        [propget] HRESULT PlayerState([out, retval] MM_STATE *);
        
        [propget] HRESULT CurrentTime([out, retval] double * d);

        HRESULT SetPosition([in] double lTime);
        HRESULT SetDirection([in] VARIANT_BOOL bForward);

        [propget] HRESULT Behavior([out, retval] IMMBehavior ** bvr);
        [propget] HRESULT View([out, retval] IDAView ** v);

    }


    [
        object,
        uuid(083a2970-4ad3-11d2-b953-3078302c2030),
        dual,
        hidden,
        pointer_default(unique)
    ]
    interface IMMFactory : IDispatch
    {
        HRESULT CreateBehavior([in] BSTR id,
                               [in] IDABehavior *bvr,
                               [out, retval] IMMBehavior **ppOut);
        HRESULT CreateTimeline([in] BSTR id,
                               [out, retval] IMMTimeline **ppOut);
        HRESULT CreatePlayer([in] BSTR id,
                             [in] IMMBehavior * bvr,
                             [in] IDAView *v,
                             [out, retval] IMMPlayer **ppOut);
    }

    [
        uuid(0c02242c-4ad3-11d2-b953-3078302c2030)
    ]
    coclass MMFactory
    {
        [default] interface IMMFactory;
    };
}