2 ** Copyright (c) 2015 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
43 // Interface ID Declarations
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};
48 /* Enum BMDDeckControlMode - DeckControl mode */
50 typedef uint32_t BMDDeckControlMode;
51 enum _BMDDeckControlMode {
52 bmdDeckControlNotOpened = /* 'ntop' */ 0x6E746F70,
53 bmdDeckControlVTRControlMode = /* 'vtrc' */ 0x76747263,
54 bmdDeckControlExportMode = /* 'expm' */ 0x6578706D,
55 bmdDeckControlCaptureMode = /* 'capm' */ 0x6361706D
58 /* Enum BMDDeckControlEvent - DeckControl event */
60 typedef uint32_t BMDDeckControlEvent;
61 enum _BMDDeckControlEvent {
62 bmdDeckControlAbortedEvent = /* 'abte' */ 0x61627465, // This event is triggered when a capture or edit-to-tape operation is aborted.
64 /* Export-To-Tape events */
66 bmdDeckControlPrepareForExportEvent = /* 'pfee' */ 0x70666565, // This event is triggered a few frames before reaching the in-point. IDeckLinkInput::StartScheduledPlayback() should be called at this point.
67 bmdDeckControlExportCompleteEvent = /* 'exce' */ 0x65786365, // This event is triggered a few frames after reaching the out-point. At this point, it is safe to stop playback.
71 bmdDeckControlPrepareForCaptureEvent = /* 'pfce' */ 0x70666365, // This event is triggered a few frames before reaching the in-point. The serial timecode attached to IDeckLinkVideoInputFrames is now valid.
72 bmdDeckControlCaptureCompleteEvent = /* 'ccev' */ 0x63636576 // This event is triggered a few frames after reaching the out-point.
75 /* Enum BMDDeckControlVTRControlState - VTR Control state */
77 typedef uint32_t BMDDeckControlVTRControlState;
78 enum _BMDDeckControlVTRControlState {
79 bmdDeckControlNotInVTRControlMode = /* 'nvcm' */ 0x6E76636D,
80 bmdDeckControlVTRControlPlaying = /* 'vtrp' */ 0x76747270,
81 bmdDeckControlVTRControlRecording = /* 'vtrr' */ 0x76747272,
82 bmdDeckControlVTRControlStill = /* 'vtra' */ 0x76747261,
83 bmdDeckControlVTRControlShuttleForward = /* 'vtsf' */ 0x76747366,
84 bmdDeckControlVTRControlShuttleReverse = /* 'vtsr' */ 0x76747372,
85 bmdDeckControlVTRControlJogForward = /* 'vtjf' */ 0x76746A66,
86 bmdDeckControlVTRControlJogReverse = /* 'vtjr' */ 0x76746A72,
87 bmdDeckControlVTRControlStopped = /* 'vtro' */ 0x7674726F
90 /* Enum BMDDeckControlStatusFlags - Deck Control status flags */
92 typedef uint32_t BMDDeckControlStatusFlags;
93 enum _BMDDeckControlStatusFlags {
94 bmdDeckControlStatusDeckConnected = 1 << 0,
95 bmdDeckControlStatusRemoteMode = 1 << 1,
96 bmdDeckControlStatusRecordInhibited = 1 << 2,
97 bmdDeckControlStatusCassetteOut = 1 << 3
100 /* Enum BMDDeckControlExportModeOpsFlags - Export mode flags */
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
123 /* Enum BMDDeckControlError - Deck Control error */
125 typedef uint32_t BMDDeckControlError;
126 enum _BMDDeckControlError {
127 bmdDeckControlNoError = /* 'noer' */ 0x6E6F6572,
128 bmdDeckControlModeError = /* 'moer' */ 0x6D6F6572,
129 bmdDeckControlMissedInPointError = /* 'mier' */ 0x6D696572,
130 bmdDeckControlDeckTimeoutError = /* 'dter' */ 0x64746572,
131 bmdDeckControlCommandFailedError = /* 'cfer' */ 0x63666572,
132 bmdDeckControlDeviceAlreadyOpenedError = /* 'dalo' */ 0x64616C6F,
133 bmdDeckControlFailedToOpenDeviceError = /* 'fder' */ 0x66646572,
134 bmdDeckControlInLocalModeError = /* 'lmer' */ 0x6C6D6572,
135 bmdDeckControlEndOfTapeError = /* 'eter' */ 0x65746572,
136 bmdDeckControlUserAbortError = /* 'uaer' */ 0x75616572,
137 bmdDeckControlNoTapeInDeckError = /* 'nter' */ 0x6E746572,
138 bmdDeckControlNoVideoFromCardError = /* 'nvfc' */ 0x6E766663,
139 bmdDeckControlNoCommunicationError = /* 'ncom' */ 0x6E636F6D,
140 bmdDeckControlBufferTooSmallError = /* 'btsm' */ 0x6274736D,
141 bmdDeckControlBadChecksumError = /* 'chks' */ 0x63686B73,
142 bmdDeckControlUnknownError = /* 'uner' */ 0x756E6572
145 // Forward Declarations
147 class IDeckLinkDeckControlStatusCallback;
148 class IDeckLinkDeckControl;
150 /* Interface IDeckLinkDeckControlStatusCallback - Deck control state change callback. */
152 class IDeckLinkDeckControlStatusCallback : public IUnknown
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;
161 virtual ~IDeckLinkDeckControlStatusCallback () {} // call Release method to drop reference count
164 /* Interface IDeckLinkDeckControl - Deck Control main interface */
166 class IDeckLinkDeckControl : public IUnknown
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 */ const char **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;
204 virtual ~IDeckLinkDeckControl () {} // call Release method to drop reference count
215 #endif /* defined(BMD_DECKLINKAPIDECKCONTROL_H) */