/* -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-
*/
/* DeckLinkAPI_v7_1.idl */

	interface IDeckLinkDisplayModeIterator_v7_1;
	interface IDeckLinkDisplayMode_v7_1;
	interface IDeckLinkVideoFrame_v7_1;
	interface IDeckLinkVideoInputFrame_v7_1;
	interface IDeckLinkAudioInputPacket_v7_1;
	
	[object, uuid(B28131B6-59AC-4857-B5AC-CD75D5883E2F),
	 helpstring("IDeckLinkDisplayModeIterator_v7_1 enumerates over supported input/output display modes.")]
	interface IDeckLinkDisplayModeIterator_v7_1 : IUnknown
	{
		HRESULT		Next ([out] IDeckLinkDisplayMode_v7_1** deckLinkDisplayMode);
	};


	[object, uuid(AF0CD6D5-8376-435E-8433-54F9DD530AC3),
	 helpstring("IDeckLinkDisplayMode_v7_1 represents a display mode")]
	interface IDeckLinkDisplayMode_v7_1 : IUnknown
	{
		HRESULT				GetName ([out] BSTR* name);
		BMDDisplayMode		GetDisplayMode ();
		long				GetWidth ();
		long				GetHeight ();
		HRESULT				GetFrameRate ([out] BMDTimeValue *frameDuration, [out] BMDTimeScale *timeScale);
	};
	
	[object, uuid(EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9),
     helpstring("IDeckLinkVideoOutputCallback. Frame completion callback.")]
    interface IDeckLinkVideoOutputCallback_v7_1 : IUnknown
    {
        HRESULT		ScheduledFrameCompleted ([in] IDeckLinkVideoFrame_v7_1* completedFrame, [in] BMDOutputFrameCompletionResult result);
    };
	
    [object, uuid(7F94F328-5ED4-4E9F-9729-76A86BDC99CC),
     helpstring("IDeckLinkInputCallback_v7_1. Frame arrival callback.")]
    interface IDeckLinkInputCallback_v7_1 : IUnknown
    {
        HRESULT		VideoInputFrameArrived ([in] IDeckLinkVideoInputFrame_v7_1* videoFrame, [in] IDeckLinkAudioInputPacket_v7_1* audioPacket);
    };
	

    [object, uuid(AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5), local,
     helpstring("IDeckLinkOutput_v7_1.  Created by QueryInterface from IDeckLink.")]
    interface IDeckLinkOutput_v7_1 : IUnknown
    {
		HRESULT		DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result);
		HRESULT		GetDisplayModeIterator ([out] IDeckLinkDisplayModeIterator_v7_1 **iterator);
		
		// Video output
        HRESULT		EnableVideoOutput (BMDDisplayMode displayMode);
        HRESULT		DisableVideoOutput ();
		
		HRESULT		SetVideoOutputFrameMemoryAllocator ([in] IDeckLinkMemoryAllocator* theAllocator);
        HRESULT		CreateVideoFrame (int width, int height, int rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1** outFrame);
        HRESULT		CreateVideoFrameFromBuffer (void* buffer, int width, int height, int rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1** outFrame);

        HRESULT		DisplayVideoFrameSync (IDeckLinkVideoFrame_v7_1* theFrame);
        HRESULT		ScheduleVideoFrame (IDeckLinkVideoFrame_v7_1* theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale);
        HRESULT		SetScheduledFrameCompletionCallback ([in] IDeckLinkVideoOutputCallback_v7_1* theCallback);
		
		// Audio output
		HRESULT		EnableAudioOutput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned int channelCount);
		HRESULT		DisableAudioOutput ();
		
		HRESULT		WriteAudioSamplesSync (void* buffer, unsigned int sampleFrameCount, [out] unsigned int *sampleFramesWritten);
		
		HRESULT		BeginAudioPreroll ();
		HRESULT		EndAudioPreroll ();
		HRESULT		ScheduleAudioSamples (void* buffer, unsigned int sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, [out] unsigned int *sampleFramesWritten);
		
		HRESULT		GetBufferedAudioSampleFrameCount ( [out] unsigned int *bufferedSampleCount);
		HRESULT		FlushBufferedAudioSamples ();
		
		HRESULT		SetAudioCallback ( [in] IDeckLinkAudioOutputCallback* theCallback);
		
		// Output control
        HRESULT		StartScheduledPlayback (BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed);
        HRESULT		StopScheduledPlayback (BMDTimeValue stopPlaybackAtTime, BMDTimeValue *actualStopTime, BMDTimeScale timeScale);
        HRESULT		GetHardwareReferenceClock (BMDTimeScale desiredTimeScale, BMDTimeValue *elapsedTimeSinceSchedulerBegan);
    };

    [object, uuid(2B54EDEF-5B32-429F-BA11-BB990596EACD),
     helpstring("IDeckLinkInput_v7_1.  Created by QueryInterface from IDeckLink.")]
    interface IDeckLinkInput_v7_1 : IUnknown
    {
		HRESULT		DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result);
		HRESULT		GetDisplayModeIterator ([out] IDeckLinkDisplayModeIterator_v7_1 **iterator);
		
		// Video input
		HRESULT		EnableVideoInput (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags);
		HRESULT		DisableVideoInput ();
		
		// Audio input
		HRESULT		EnableAudioInput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned int channelCount);
		HRESULT		DisableAudioInput ();
		HRESULT		ReadAudioSamples (void* buffer, unsigned int sampleFrameCount, [out] unsigned int *sampleFramesRead, [out] BMDTimeValue *audioPacketTime, BMDTimeScale timeScale);
		HRESULT		GetBufferedAudioSampleFrameCount ( [out] unsigned int *bufferedSampleCount);
		
		// Input control
		HRESULT		StartStreams ();
		HRESULT		StopStreams ();
		HRESULT		PauseStreams ();
		HRESULT		SetCallback ([in] IDeckLinkInputCallback_v7_1* theCallback);
    };
	
	[object, uuid(333F3A10-8C2D-43CF-B79D-46560FEEA1CE), local,
     helpstring("IDeckLinkVideoFrame_v7_1.  Created by IDeckLinkVideoOutput::CreateVideoFrame.")]
    interface IDeckLinkVideoFrame_v7_1 : IUnknown
    {
        long				GetWidth ();
        long				GetHeight ();
        long				GetRowBytes ();
        BMDPixelFormat		GetPixelFormat ();
        BMDFrameFlags		GetFlags ();
        HRESULT				GetBytes (void* *buffer);
    };
	
	[object, uuid(C8B41D95-8848-40EE-9B37-6E3417FB114B), local,
     helpstring("IDeckLinkVideoInputFrame_v7_1.  Provided by the IDeckLinkVideoInput frame arrival callback.")]
    interface IDeckLinkVideoInputFrame_v7_1 : IDeckLinkVideoFrame_v7_1
    {
        HRESULT				GetFrameTime (BMDTimeValue *frameTime, BMDTimeValue *frameDuration, BMDTimeScale timeScale);
    };
	
	[object, uuid(C86DE4F6-A29F-42E3-AB3A-1363E29F0788), local,
     helpstring("IDeckLinkAudioInputPacket_v7_1.  Provided by the IDeckLinkInput callback.")]
    interface IDeckLinkAudioInputPacket_v7_1 : IUnknown
    {
		long				GetSampleCount ();
		HRESULT				GetBytes (void* *buffer);
		HRESULT				GetAudioPacketTime (BMDTimeValue *packetTime, BMDTimeScale timeScale);
    };
	
