DeckLinkAPIDeckControl.h 12 KB

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