2 ** Copyright (c) 2019 Blackmagic Design
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:
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.
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.
28 #ifndef BMD_DECKLINKAPIDECKCONTROL_H
29 #define BMD_DECKLINKAPIDECKCONTROL_H
34 #define BMD_CONST __declspec(selectany) static const
36 #define BMD_CONST static const
47 // Interface ID Declarations
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};
52 /* Enum BMDDeckControlMode - DeckControl mode */
54 typedef uint32_t BMDDeckControlMode;
55 enum _BMDDeckControlMode {
56 bmdDeckControlNotOpened = 'ntop',
57 bmdDeckControlVTRControlMode = 'vtrc',
58 bmdDeckControlExportMode = 'expm',
59 bmdDeckControlCaptureMode = 'capm'
62 /* Enum BMDDeckControlEvent - DeckControl event */
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.
68 /* Export-To-Tape events */
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.
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.
79 /* Enum BMDDeckControlVTRControlState - VTR Control state */
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'
94 /* Enum BMDDeckControlStatusFlags - Deck Control status flags */
96 typedef uint32_t BMDDeckControlStatusFlags;
97 enum _BMDDeckControlStatusFlags {
98 bmdDeckControlStatusDeckConnected = 1 << 0,
99 bmdDeckControlStatusRemoteMode = 1 << 1,
100 bmdDeckControlStatusRecordInhibited = 1 << 2,
101 bmdDeckControlStatusCassetteOut = 1 << 3
104 /* Enum BMDDeckControlExportModeOpsFlags - Export mode flags */
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
127 /* Enum BMDDeckControlError - Deck Control error */
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'
149 // Forward Declarations
151 class IDeckLinkDeckControlStatusCallback;
152 class IDeckLinkDeckControl;
154 /* Interface IDeckLinkDeckControlStatusCallback - Deck control state change callback. */
156 class BMD_PUBLIC IDeckLinkDeckControlStatusCallback : public IUnknown
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;
165 virtual ~IDeckLinkDeckControlStatusCallback () {} // call Release method to drop reference count
168 /* Interface IDeckLinkDeckControl - Deck Control main interface */
170 class BMD_PUBLIC IDeckLinkDeckControl : public IUnknown
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;
208 virtual ~IDeckLinkDeckControl () {} // call Release method to drop reference count
219 #endif /* defined(BMD_DECKLINKAPIDECKCONTROL_H) */