1 /* -LICENSE-START- 2 ** Copyright (c) 2019 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 28 #ifndef BMD_DECKLINKAPIDECKCONTROL_H 29 #define BMD_DECKLINKAPIDECKCONTROL_H 30 31 32 #ifndef BMD_CONST 33 #if defined(_MSC_VER) 34 #define BMD_CONST __declspec(selectany) static const 35 #else 36 #define BMD_CONST static const 37 #endif 38 #endif 39 40 #ifndef BMD_PUBLIC 41 #define BMD_PUBLIC 42 #endif 43 44 // Type Declarations 45 46 47 // Interface ID Declarations 48 49 BMD_CONST REFIID IID_IDeckLinkDeckControlStatusCallback = /* 53436FFB-B434-4906-BADC-AE3060FFE8EF */ {0x53,0x43,0x6F,0xFB,0xB4,0x34,0x49,0x06,0xBA,0xDC,0xAE,0x30,0x60,0xFF,0xE8,0xEF}; 50 BMD_CONST REFIID IID_IDeckLinkDeckControl = /* 8E1C3ACE-19C7-4E00-8B92-D80431D958BE */ {0x8E,0x1C,0x3A,0xCE,0x19,0xC7,0x4E,0x00,0x8B,0x92,0xD8,0x04,0x31,0xD9,0x58,0xBE}; 51 52 /* Enum BMDDeckControlMode - DeckControl mode */ 53 54 typedef uint32_t BMDDeckControlMode; 55 enum _BMDDeckControlMode { 56 bmdDeckControlNotOpened = 'ntop', 57 bmdDeckControlVTRControlMode = 'vtrc', 58 bmdDeckControlExportMode = 'expm', 59 bmdDeckControlCaptureMode = 'capm' 60 }; 61 62 /* Enum BMDDeckControlEvent - DeckControl event */ 63 64 typedef uint32_t BMDDeckControlEvent; 65 enum _BMDDeckControlEvent { 66 bmdDeckControlAbortedEvent = 'abte', // This event is triggered when a capture or edit-to-tape operation is aborted. 67 68 /* Export-To-Tape events */ 69 70 bmdDeckControlPrepareForExportEvent = 'pfee', // This event is triggered a few frames before reaching the in-point. IDeckLinkInput::StartScheduledPlayback() should be called at this point. 71 bmdDeckControlExportCompleteEvent = 'exce', // This event is triggered a few frames after reaching the out-point. At this point, it is safe to stop playback. 72 73 /* Capture events */ 74 75 bmdDeckControlPrepareForCaptureEvent = 'pfce', // This event is triggered a few frames before reaching the in-point. The serial timecode attached to IDeckLinkVideoInputFrames is now valid. 76 bmdDeckControlCaptureCompleteEvent = 'ccev' // This event is triggered a few frames after reaching the out-point. 77 }; 78 79 /* Enum BMDDeckControlVTRControlState - VTR Control state */ 80 81 typedef uint32_t BMDDeckControlVTRControlState; 82 enum _BMDDeckControlVTRControlState { 83 bmdDeckControlNotInVTRControlMode = 'nvcm', 84 bmdDeckControlVTRControlPlaying = 'vtrp', 85 bmdDeckControlVTRControlRecording = 'vtrr', 86 bmdDeckControlVTRControlStill = 'vtra', 87 bmdDeckControlVTRControlShuttleForward = 'vtsf', 88 bmdDeckControlVTRControlShuttleReverse = 'vtsr', 89 bmdDeckControlVTRControlJogForward = 'vtjf', 90 bmdDeckControlVTRControlJogReverse = 'vtjr', 91 bmdDeckControlVTRControlStopped = 'vtro' 92 }; 93 94 /* Enum BMDDeckControlStatusFlags - Deck Control status flags */ 95 96 typedef uint32_t BMDDeckControlStatusFlags; 97 enum _BMDDeckControlStatusFlags { 98 bmdDeckControlStatusDeckConnected = 1 << 0, 99 bmdDeckControlStatusRemoteMode = 1 << 1, 100 bmdDeckControlStatusRecordInhibited = 1 << 2, 101 bmdDeckControlStatusCassetteOut = 1 << 3 102 }; 103 104 /* Enum BMDDeckControlExportModeOpsFlags - Export mode flags */ 105 106 typedef uint32_t BMDDeckControlExportModeOpsFlags; 107 enum _BMDDeckControlExportModeOpsFlags { 108 bmdDeckControlExportModeInsertVideo = 1 << 0, 109 bmdDeckControlExportModeInsertAudio1 = 1 << 1, 110 bmdDeckControlExportModeInsertAudio2 = 1 << 2, 111 bmdDeckControlExportModeInsertAudio3 = 1 << 3, 112 bmdDeckControlExportModeInsertAudio4 = 1 << 4, 113 bmdDeckControlExportModeInsertAudio5 = 1 << 5, 114 bmdDeckControlExportModeInsertAudio6 = 1 << 6, 115 bmdDeckControlExportModeInsertAudio7 = 1 << 7, 116 bmdDeckControlExportModeInsertAudio8 = 1 << 8, 117 bmdDeckControlExportModeInsertAudio9 = 1 << 9, 118 bmdDeckControlExportModeInsertAudio10 = 1 << 10, 119 bmdDeckControlExportModeInsertAudio11 = 1 << 11, 120 bmdDeckControlExportModeInsertAudio12 = 1 << 12, 121 bmdDeckControlExportModeInsertTimeCode = 1 << 13, 122 bmdDeckControlExportModeInsertAssemble = 1 << 14, 123 bmdDeckControlExportModeInsertPreview = 1 << 15, 124 bmdDeckControlUseManualExport = 1 << 16 125 }; 126 127 /* Enum BMDDeckControlError - Deck Control error */ 128 129 typedef uint32_t BMDDeckControlError; 130 enum _BMDDeckControlError { 131 bmdDeckControlNoError = 'noer', 132 bmdDeckControlModeError = 'moer', 133 bmdDeckControlMissedInPointError = 'mier', 134 bmdDeckControlDeckTimeoutError = 'dter', 135 bmdDeckControlCommandFailedError = 'cfer', 136 bmdDeckControlDeviceAlreadyOpenedError = 'dalo', 137 bmdDeckControlFailedToOpenDeviceError = 'fder', 138 bmdDeckControlInLocalModeError = 'lmer', 139 bmdDeckControlEndOfTapeError = 'eter', 140 bmdDeckControlUserAbortError = 'uaer', 141 bmdDeckControlNoTapeInDeckError = 'nter', 142 bmdDeckControlNoVideoFromCardError = 'nvfc', 143 bmdDeckControlNoCommunicationError = 'ncom', 144 bmdDeckControlBufferTooSmallError = 'btsm', 145 bmdDeckControlBadChecksumError = 'chks', 146 bmdDeckControlUnknownError = 'uner' 147 }; 148 149 // Forward Declarations 150 151 class IDeckLinkDeckControlStatusCallback; 152 class IDeckLinkDeckControl; 153 154 /* Interface IDeckLinkDeckControlStatusCallback - Deck control state change callback. */ 155 156 class BMD_PUBLIC IDeckLinkDeckControlStatusCallback : public IUnknown 157 { 158 public: 159 virtual HRESULT TimecodeUpdate (/* in */ BMDTimecodeBCD currentTimecode) = 0; 160 virtual HRESULT VTRControlStateChanged (/* in */ BMDDeckControlVTRControlState newState, /* in */ BMDDeckControlError error) = 0; 161 virtual HRESULT DeckControlEventReceived (/* in */ BMDDeckControlEvent event, /* in */ BMDDeckControlError error) = 0; 162 virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0; 163 164 protected: ~IDeckLinkDeckControlStatusCallback()165 virtual ~IDeckLinkDeckControlStatusCallback () {} // call Release method to drop reference count 166 }; 167 168 /* Interface IDeckLinkDeckControl - Deck Control main interface */ 169 170 class BMD_PUBLIC IDeckLinkDeckControl : public IUnknown 171 { 172 public: 173 virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0; 174 virtual HRESULT Close (/* in */ bool standbyOn) = 0; 175 virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0; 176 virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0; 177 virtual HRESULT SendCommand (/* in */ uint8_t *inBuffer, /* in */ uint32_t inBufferSize, /* out */ uint8_t *outBuffer, /* out */ uint32_t *outDataSize, /* in */ uint32_t outBufferSize, /* out */ BMDDeckControlError *error) = 0; 178 virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0; 179 virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0; 180 virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0; 181 virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0; 182 virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0; 183 virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; 184 virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; 185 virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0; 186 virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0; 187 virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; 188 virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; 189 virtual HRESULT GetTimecodeString (/* out */ CFStringRef *currentTimeCode, /* out */ BMDDeckControlError *error) = 0; 190 virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0; 191 virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0; 192 virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0; 193 virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0; 194 virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0; 195 virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0; 196 virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0; 197 virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0; 198 virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0; 199 virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0; 200 virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0; 201 virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0; 202 virtual HRESULT Abort (void) = 0; 203 virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0; 204 virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0; 205 virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback *callback) = 0; 206 207 protected: ~IDeckLinkDeckControl()208 virtual ~IDeckLinkDeckControl () {} // call Release method to drop reference count 209 }; 210 211 /* Functions */ 212 213 extern "C" { 214 215 216 } 217 218 219 #endif /* defined(BMD_DECKLINKAPIDECKCONTROL_H) */ 220