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