1 /* -LICENSE-START- 2 ** Copyright (c) 2009 Blackmagic Design 3 ** 4 ** Permission is hereby granted, free of charge, to any person or organization 5 ** obtaining a copy of the software and accompanying documentation covered by 6 ** this license (the "Software") to use, reproduce, display, distribute, 7 ** execute, and transmit the Software, and to prepare derivative works of the 8 ** Software, and to permit third-parties to whom the Software is furnished to 9 ** do so, all subject to the following: 10 ** 11 ** The copyright notices in the Software and this entire statement, including 12 ** the above license grant, this restriction and the following disclaimer, 13 ** must be included in all copies of the Software, in whole or in part, and 14 ** all derivative works of the Software, unless such copies or derivative 15 ** works are solely in the form of machine-executable object code generated by 16 ** a source language processor. 17 ** 18 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 ** DEALINGS IN THE SOFTWARE. 25 ** -LICENSE-END- 26 */ 27 /* DeckLinkAPI_v7_1.h */ 28 29 #ifndef __DeckLink_API_v7_1_h__ 30 #define __DeckLink_API_v7_1_h__ 31 32 #include "DeckLinkAPI.h" 33 34 // "B28131B6-59AC-4857-B5AC-CD75D5883E2F" 35 #define IID_IDeckLinkDisplayModeIterator_v7_1 (REFIID){0xB2,0x81,0x31,0xB6,0x59,0xAC,0x48,0x57,0xB5,0xAC,0xCD,0x75,0xD5,0x88,0x3E,0x2F} 36 37 // "AF0CD6D5-8376-435E-8433-54F9DD530AC3" 38 #define IID_IDeckLinkDisplayMode_v7_1 (REFIID){0xAF,0x0C,0xD6,0xD5,0x83,0x76,0x43,0x5E,0x84,0x33,0x54,0xF9,0xDD,0x53,0x0A,0xC3} 39 40 // "EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9" 41 #define IID_IDeckLinkVideoOutputCallback_v7_1 (REFIID){0xEB,0xD0,0x1A,0xFA,0xE4,0xB0,0x49,0xC6,0xA0,0x1D,0xED,0xB9,0xD1,0xB5,0x5F,0xD9} 42 43 // "7F94F328-5ED4-4E9F-9729-76A86BDC99CC" 44 #define IID_IDeckLinkInputCallback_v7_1 (REFIID){0x7F,0x94,0xF3,0x28,0x5E,0xD4,0x4E,0x9F,0x97,0x29,0x76,0xA8,0x6B,0xDC,0x99,0xCC} 45 46 // "AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5" 47 #define IID_IDeckLinkOutput_v7_1 (REFIID){0xAE,0x5B,0x3E,0x9B,0x4E,0x1E,0x45,0x35,0xB6,0xE8,0x48,0x0F,0xF5,0x2F,0x6C,0xE5} 48 49 // "2B54EDEF-5B32-429F-BA11-BB990596EACD" 50 #define IID_IDeckLinkInput_v7_1 (REFIID){0x2B,0x54,0xED,0xEF,0x5B,0x32,0x42,0x9F,0xBA,0x11,0xBB,0x99,0x05,0x96,0xEA,0xCD} 51 52 // "333F3A10-8C2D-43CF-B79D-46560FEEA1CE" 53 #define IID_IDeckLinkVideoFrame_v7_1 (REFIID){0x33,0x3F,0x3A,0x10,0x8C,0x2D,0x43,0xCF,0xB7,0x9D,0x46,0x56,0x0F,0xEE,0xA1,0xCE} 54 55 // "C8B41D95-8848-40EE-9B37-6E3417FB114B" 56 #define IID_IDeckLinkVideoInputFrame_v7_1 (REFIID){0xC8,0xB4,0x1D,0x95,0x88,0x48,0x40,0xEE,0x9B,0x37,0x6E,0x34,0x17,0xFB,0x11,0x4B} 57 58 // "C86DE4F6-A29F-42E3-AB3A-1363E29F0788" 59 #define IID_IDeckLinkAudioInputPacket_v7_1 (REFIID){0xC8,0x6D,0xE4,0xF6,0xA2,0x9F,0x42,0xE3,0xAB,0x3A,0x13,0x63,0xE2,0x9F,0x07,0x88} 60 61 #if defined(__cplusplus) 62 63 class IDeckLinkVideoFrame_v7_1; 64 class IDeckLinkDisplayModeIterator_v7_1; 65 class IDeckLinkDisplayMode_v7_1; 66 class IDeckLinkVideoInputFrame_v7_1; 67 class IDeckLinkAudioInputPacket_v7_1; 68 69 class IDeckLinkDisplayModeIterator_v7_1 : public IUnknown 70 { 71 public: 72 virtual HRESULT STDMETHODCALLTYPE Next (IDeckLinkDisplayMode_v7_1* *deckLinkDisplayMode) = 0; 73 }; 74 75 76 class IDeckLinkDisplayMode_v7_1 : public IUnknown 77 { 78 public: 79 virtual HRESULT STDMETHODCALLTYPE GetName (CFStringRef* name) = 0; 80 virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode () = 0; 81 virtual long STDMETHODCALLTYPE GetWidth () = 0; 82 virtual long STDMETHODCALLTYPE GetHeight () = 0; 83 virtual HRESULT STDMETHODCALLTYPE GetFrameRate (BMDTimeValue *frameDuration, BMDTimeScale *timeScale) = 0; 84 }; 85 86 class IDeckLinkVideoOutputCallback_v7_1 : public IUnknown 87 { 88 public: 89 virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted (IDeckLinkVideoFrame_v7_1* completedFrame, BMDOutputFrameCompletionResult result) = 0; 90 }; 91 92 class IDeckLinkInputCallback_v7_1 : public IUnknown 93 { 94 public: 95 virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived (IDeckLinkVideoInputFrame_v7_1* videoFrame, IDeckLinkAudioInputPacket_v7_1* audioPacket) = 0; 96 }; 97 98 // IDeckLinkOutput_v7_1. Created by QueryInterface from IDeckLink. 99 class IDeckLinkOutput_v7_1 : public IUnknown 100 { 101 public: 102 // Display mode predicates 103 virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDDisplayModeSupport *result) = 0; 104 virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator (IDeckLinkDisplayModeIterator_v7_1* *iterator) = 0; 105 106 107 // Video output 108 virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput (BMDDisplayMode displayMode) = 0; 109 virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput () = 0; 110 111 virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator (IDeckLinkMemoryAllocator* theAllocator) = 0; 112 virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame (int32_t width, int32_t height, int32_t rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1* *outFrame) = 0; 113 virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameFromBuffer (void* buffer, int32_t width, int32_t height, int32_t rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1* *outFrame) = 0; 114 115 virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync (IDeckLinkVideoFrame_v7_1* theFrame) = 0; 116 virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame (IDeckLinkVideoFrame_v7_1* theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale) = 0; 117 virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback (IDeckLinkVideoOutputCallback_v7_1* theCallback) = 0; 118 119 120 // Audio output 121 virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount) = 0; 122 virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput () = 0; 123 124 virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync (void* buffer, uint32_t sampleFrameCount, uint32_t *sampleFramesWritten) = 0; 125 126 virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll () = 0; 127 virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll () = 0; 128 virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples (void* buffer, uint32_t sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, uint32_t *sampleFramesWritten) = 0; 129 130 virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount (uint32_t *bufferedSampleCount) = 0; 131 virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples () = 0; 132 133 virtual HRESULT STDMETHODCALLTYPE SetAudioCallback (IDeckLinkAudioOutputCallback* theCallback) = 0; 134 135 136 // Output control 137 virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback (BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed) = 0; 138 virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback (BMDTimeValue stopPlaybackAtTime, BMDTimeValue *actualStopTime, BMDTimeScale timeScale) = 0; 139 virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock (BMDTimeScale desiredTimeScale, BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0; 140 }; 141 142 // IDeckLinkInput_v7_1. Created by QueryInterface from IDeckLink. 143 class IDeckLinkInput_v7_1 : public IUnknown 144 { 145 public: 146 virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDDisplayModeSupport *result) = 0; 147 virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator (IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0; 148 149 // Video input 150 virtual HRESULT STDMETHODCALLTYPE EnableVideoInput (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags) = 0; 151 virtual HRESULT STDMETHODCALLTYPE DisableVideoInput () = 0; 152 153 // Audio input 154 virtual HRESULT STDMETHODCALLTYPE EnableAudioInput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount) = 0; 155 virtual HRESULT STDMETHODCALLTYPE DisableAudioInput () = 0; 156 virtual HRESULT STDMETHODCALLTYPE ReadAudioSamples (void* buffer, uint32_t sampleFrameCount, uint32_t *sampleFramesRead, BMDTimeValue *audioPacketTime, BMDTimeScale timeScale) = 0; 157 virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount (uint32_t *bufferedSampleCount) = 0; 158 159 // Input control 160 virtual HRESULT STDMETHODCALLTYPE StartStreams () = 0; 161 virtual HRESULT STDMETHODCALLTYPE StopStreams () = 0; 162 virtual HRESULT STDMETHODCALLTYPE PauseStreams () = 0; 163 virtual HRESULT STDMETHODCALLTYPE SetCallback (IDeckLinkInputCallback_v7_1* theCallback) = 0; 164 }; 165 166 // IDeckLinkVideoFrame_v7_1. Created by IDeckLinkOutput::CreateVideoFrame. 167 class IDeckLinkVideoFrame_v7_1 : public IUnknown 168 { 169 public: 170 virtual long STDMETHODCALLTYPE GetWidth () = 0; 171 virtual long STDMETHODCALLTYPE GetHeight () = 0; 172 virtual long STDMETHODCALLTYPE GetRowBytes () = 0; 173 virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat () = 0; 174 virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags () = 0; 175 virtual HRESULT STDMETHODCALLTYPE GetBytes (void* *buffer) = 0; 176 }; 177 178 // IDeckLinkVideoInputFrame_v7_1. Provided by the IDeckLinkInput_v7_1 frame arrival callback. 179 class IDeckLinkVideoInputFrame_v7_1 : public IDeckLinkVideoFrame_v7_1 180 { 181 public: 182 virtual HRESULT STDMETHODCALLTYPE GetFrameTime (BMDTimeValue *frameTime, BMDTimeValue *frameDuration, BMDTimeScale timeScale) = 0; 183 }; 184 185 // IDeckLinkAudioInputPacket_v7_1. Provided by the IDeckLinkInput_v7_1 callback. 186 class IDeckLinkAudioInputPacket_v7_1 : public IUnknown 187 { 188 public: 189 virtual long STDMETHODCALLTYPE GetSampleCount () = 0; 190 virtual HRESULT STDMETHODCALLTYPE GetBytes (void* *buffer) = 0; 191 192 virtual HRESULT STDMETHODCALLTYPE GetAudioPacketTime (BMDTimeValue *packetTime, BMDTimeScale timeScale) = 0; 193 }; 194 195 #endif // defined(__cplusplus) 196 197 #endif // __DeckLink_API_v7_1_h__ 198 199