/* -LICENSE-START-
** Copyright (c) 2009 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
** 
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
** 
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/

/* Forward Declarations */

interface IDeckLinkInputCallback_v7_3;
interface IDeckLinkOutput_v7_3;
interface IDeckLinkInput_v7_3;
interface IDeckLinkVideoInputFrame_v7_3;

/* End Forward Declarations */


/* Interface IDeckLinkInputCallback - Frame arrival callback. */

[
    object,
    uuid(FD6F311D-4D00-444B-9ED4-1F25B5730AD0),
    helpstring("Frame arrival callback.")
] interface IDeckLinkInputCallback_v7_3 : IUnknown
{
    HRESULT VideoInputFormatChanged([in] BMDVideoInputFormatChangedEvents notificationEvents, [in] IDeckLinkDisplayMode_v7_6 *newDisplayMode, [in] BMDDetectedVideoInputFormatFlags detectedSignalFlags);
    HRESULT VideoInputFrameArrived([in] IDeckLinkVideoInputFrame_v7_3 *videoFrame, [in] IDeckLinkAudioInputPacket *audioPacket);
};

/* End Interface IDeckLinkInputCallback */


/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */

[
    object,
    uuid(271C65E3-C323-4344-A30F-D908BCB20AA3),
    local, 
    helpstring("Created by QueryInterface from IDeckLink.")
] interface IDeckLinkOutput_v7_3 : IUnknown
{
    HRESULT DoesSupportVideoMode(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result);
    HRESULT GetDisplayModeIterator([out] IDeckLinkDisplayModeIterator_v7_6 **iterator);

    HRESULT SetScreenPreviewCallback([in] IDeckLinkScreenPreviewCallback *previewCallback);

    /* Video Output */

    HRESULT EnableVideoOutput(BMDDisplayMode displayMode, BMDVideoOutputFlags flags);
    HRESULT DisableVideoOutput(void);

    HRESULT SetVideoOutputFrameMemoryAllocator([in] IDeckLinkMemoryAllocator *theAllocator);
    HRESULT CreateVideoFrame(int width, int height, int rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, [out] IDeckLinkMutableVideoFrame_v7_6 **outFrame);
    HRESULT CreateAncillaryData(BMDPixelFormat pixelFormat, [out] IDeckLinkVideoFrameAncillary **outBuffer);

    HRESULT DisplayVideoFrameSync([in] IDeckLinkVideoFrame_v7_6 *theFrame);
    HRESULT ScheduleVideoFrame([in] IDeckLinkVideoFrame_v7_6 *theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale);
    HRESULT SetScheduledFrameCompletionCallback([in] IDeckLinkVideoOutputCallback *theCallback);
    HRESULT GetBufferedVideoFrameCount([out] unsigned int *bufferedFrameCount);

    /* Audio Output */

    HRESULT EnableAudioOutput(BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned int channelCount, BMDAudioOutputStreamType streamType);
    HRESULT DisableAudioOutput(void);

    HRESULT WriteAudioSamplesSync([in] void *buffer, unsigned int sampleFrameCount, [out] unsigned int *sampleFramesWritten);

    HRESULT BeginAudioPreroll(void);
    HRESULT EndAudioPreroll(void);
    HRESULT ScheduleAudioSamples([in] void *buffer, unsigned int sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, [out] unsigned int *sampleFramesWritten);

    HRESULT GetBufferedAudioSampleFrameCount([out] unsigned int *bufferedSampleFrameCount);
    HRESULT FlushBufferedAudioSamples(void);

    HRESULT SetAudioCallback([in] IDeckLinkAudioOutputCallback *theCallback);

    /* Output Control */

    HRESULT StartScheduledPlayback(BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed);
    HRESULT StopScheduledPlayback(BMDTimeValue stopPlaybackAtTime, [out] BMDTimeValue *actualStopTime, BMDTimeScale timeScale);
    HRESULT IsScheduledPlaybackRunning([out] BOOL *active);
    HRESULT GetHardwareReferenceClock(BMDTimeScale desiredTimeScale, [out] BMDTimeValue *elapsedTimeSinceSchedulerBegan);
};

/* End Interface IDeckLinkOutput */

/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */

[
    object,
    uuid(4973F012-9925-458C-871C-18774CDBBECB),
    helpstring("Created by QueryInterface from IDeckLink.")
] interface IDeckLinkInput_v7_3 : IUnknown
{
    HRESULT DoesSupportVideoMode(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result);
    HRESULT GetDisplayModeIterator([out] IDeckLinkDisplayModeIterator_v7_6 **iterator);

    HRESULT SetScreenPreviewCallback([in] IDeckLinkScreenPreviewCallback *previewCallback);

    /* Video Input */

    HRESULT EnableVideoInput(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags);
    HRESULT DisableVideoInput(void);
    HRESULT GetAvailableVideoFrameCount([out] unsigned int *availableFrameCount);

    /* Audio Input */

    HRESULT EnableAudioInput(BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned int channelCount);
    HRESULT DisableAudioInput(void);
    HRESULT GetAvailableAudioSampleFrameCount([out] unsigned int *availableSampleFrameCount);

    /* Input Control */

    HRESULT StartStreams(void);
    HRESULT StopStreams(void);
    HRESULT PauseStreams(void);
    HRESULT FlushStreams(void);
    HRESULT SetCallback([in] IDeckLinkInputCallback_v7_3 *theCallback);
};

/* End Interface IDeckLinkInput */


/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */

[
    object,
    uuid(CF317790-2894-11DE-8C30-0800200C9A66),
    local, 
    helpstring("Provided by the IDeckLinkVideoInput frame arrival callback.")
] interface IDeckLinkVideoInputFrame_v7_3 : IDeckLinkVideoFrame_v7_6
{
    HRESULT GetStreamTime([out] BMDTimeValue *frameTime, [out] BMDTimeValue *frameDuration, BMDTimeScale timeScale);
};

/* End Interface IDeckLinkVideoInputFrame */

