diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI.h b/DeckLinkSDK/Mac/include/DeckLinkAPI.h new file mode 100644 index 00000000..e9070c88 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI.h @@ -0,0 +1,1332 @@ +/* -LICENSE-START- + ** Copyright (c) 2022 Blackmagic Design + ** + ** Permission is hereby granted, free of charge, to any person or organization + ** obtaining a copy of the software and accompanying documentation (the + ** "Software") to use, reproduce, display, distribute, sub-license, execute, + ** and transmit the Software, and to prepare derivative works of the Software, + ** and to permit third-parties to whom the Software is furnished to do so, in + ** accordance with: + ** + ** (1) if the Software is obtained from Blackmagic Design, the End User License + ** Agreement for the Software Development Kit ("EULA") available at + ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or + ** + ** (2) if the Software is obtained from any third party, such licensing terms + ** as notified by that third party, + ** + ** and all subject to the following: + ** + ** (3) the copyright notices in the Software and this entire statement, + ** including the above license grant, this restriction and the following + ** disclaimer, must be included in all copies of the Software, in whole or in + ** part, and all derivative works of the Software, unless such copies or + ** derivative works are solely in the form of machine-executable object code + ** generated by a source language processor. + ** + ** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + ** DEALINGS IN THE SOFTWARE. + ** + ** A copy of the Software is available free of charge at + ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. + ** + ** -LICENSE-END- + */ + + +#ifndef BMD_DECKLINKAPI_H +#define BMD_DECKLINKAPI_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +#ifndef BMD_PUBLIC + #define BMD_PUBLIC +#endif + +/* DeckLink API */ + +#include +#include +#include + +#include "DeckLinkAPITypes.h" +#include "DeckLinkAPIModes.h" +#include "DeckLinkAPIDiscovery.h" +#include "DeckLinkAPIConfiguration.h" +#include "DeckLinkAPIDeckControl.h" + +#include "DeckLinkAPIStreaming.h" + +#define BLACKMAGIC_DECKLINK_API_MAGIC 1 + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkVideoOutputCallback = /* 20AA5225-1958-47CB-820B-80A8D521A6EE */ { 0x20,0xAA,0x52,0x25,0x19,0x58,0x47,0xCB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE }; +BMD_CONST REFIID IID_IDeckLinkInputCallback = /* C6FCE4C9-C4E4-4047-82FB-5D238232A902 */ { 0xC6,0xFC,0xE4,0xC9,0xC4,0xE4,0x40,0x47,0x82,0xFB,0x5D,0x23,0x82,0x32,0xA9,0x02 }; +BMD_CONST REFIID IID_IDeckLinkEncoderInputCallback = /* ACF13E61-F4A0-4974-A6A7-59AFF6268B31 */ { 0xAC,0xF1,0x3E,0x61,0xF4,0xA0,0x49,0x74,0xA6,0xA7,0x59,0xAF,0xF6,0x26,0x8B,0x31 }; +BMD_CONST REFIID IID_IDeckLinkMemoryAllocator = /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ { 0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8 }; +BMD_CONST REFIID IID_IDeckLinkAudioOutputCallback = /* 403C681B-7F46-4A12-B993-2BB127084EE6 */ { 0x40,0x3C,0x68,0x1B,0x7F,0x46,0x4A,0x12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6 }; +BMD_CONST REFIID IID_IDeckLinkIterator = /* 50FB36CD-3063-4B73-BDBB-958087F2D8BA */ { 0x50,0xFB,0x36,0xCD,0x30,0x63,0x4B,0x73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA }; +BMD_CONST REFIID IID_IDeckLinkAPIInformation = /* 7BEA3C68-730D-4322-AF34-8A7152B532A4 */ { 0x7B,0xEA,0x3C,0x68,0x73,0x0D,0x43,0x22,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4 }; +BMD_CONST REFIID IID_IDeckLinkOutput = /* BE2D9020-461E-442F-84B7-E949CB953B9D */ { 0xBE,0x2D,0x90,0x20,0x46,0x1E,0x44,0x2F,0x84,0xB7,0xE9,0x49,0xCB,0x95,0x3B,0x9D }; +BMD_CONST REFIID IID_IDeckLinkInput = /* C21CDB6E-F414-46E4-A636-80A566E0ED37 */ { 0xC2,0x1C,0xDB,0x6E,0xF4,0x14,0x46,0xE4,0xA6,0x36,0x80,0xA5,0x66,0xE0,0xED,0x37 }; +BMD_CONST REFIID IID_IDeckLinkHDMIInputEDID = /* ABBBACBC-45BC-4665-9D92-ACE6E5A97902 */ { 0xAB,0xBB,0xAC,0xBC,0x45,0xBC,0x46,0x65,0x9D,0x92,0xAC,0xE6,0xE5,0xA9,0x79,0x02 }; +BMD_CONST REFIID IID_IDeckLinkEncoderInput = /* F222551D-13DF-4FD8-B587-9D4F19EC12C9 */ { 0xF2,0x22,0x55,0x1D,0x13,0xDF,0x4F,0xD8,0xB5,0x87,0x9D,0x4F,0x19,0xEC,0x12,0xC9 }; +BMD_CONST REFIID IID_IDeckLinkVideoFrame = /* 3F716FE0-F023-4111-BE5D-EF4414C05B17 */ { 0x3F,0x71,0x6F,0xE0,0xF0,0x23,0x41,0x11,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17 }; +BMD_CONST REFIID IID_IDeckLinkMutableVideoFrame = /* 69E2639F-40DA-4E19-B6F2-20ACE815C390 */ { 0x69,0xE2,0x63,0x9F,0x40,0xDA,0x4E,0x19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90 }; +BMD_CONST REFIID IID_IDeckLinkVideoFrame3DExtensions = /* DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7 */ { 0xDA,0x0F,0x7E,0x4A,0xED,0xC7,0x48,0xA8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7 }; +BMD_CONST REFIID IID_IDeckLinkVideoFrameMetadataExtensions = /* E232A5B7-4DB4-44C9-9152-F47C12E5F051 */ { 0xE2,0x32,0xA5,0xB7,0x4D,0xB4,0x44,0xC9,0x91,0x52,0xF4,0x7C,0x12,0xE5,0xF0,0x51 }; +BMD_CONST REFIID IID_IDeckLinkVideoInputFrame = /* 05CFE374-537C-4094-9A57-680525118F44 */ { 0x05,0xCF,0xE3,0x74,0x53,0x7C,0x40,0x94,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44 }; +BMD_CONST REFIID IID_IDeckLinkAncillaryPacket = /* CC5BBF7E-029C-4D3B-9158-6000EF5E3670 */ { 0xCC,0x5B,0xBF,0x7E,0x02,0x9C,0x4D,0x3B,0x91,0x58,0x60,0x00,0xEF,0x5E,0x36,0x70 }; +BMD_CONST REFIID IID_IDeckLinkAncillaryPacketIterator = /* 3FC8994B-88FB-4C17-968F-9AAB69D964A7 */ { 0x3F,0xC8,0x99,0x4B,0x88,0xFB,0x4C,0x17,0x96,0x8F,0x9A,0xAB,0x69,0xD9,0x64,0xA7 }; +BMD_CONST REFIID IID_IDeckLinkVideoFrameAncillaryPackets = /* 6C186C0F-459E-41D8-AEE2-4812D81AEE68 */ { 0x6C,0x18,0x6C,0x0F,0x45,0x9E,0x41,0xD8,0xAE,0xE2,0x48,0x12,0xD8,0x1A,0xEE,0x68 }; +BMD_CONST REFIID IID_IDeckLinkVideoFrameAncillary = /* 732E723C-D1A4-4E29-9E8E-4A88797A0004 */ { 0x73,0x2E,0x72,0x3C,0xD1,0xA4,0x4E,0x29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04 }; +BMD_CONST REFIID IID_IDeckLinkEncoderPacket = /* B693F36C-316E-4AF1-B6C2-F389A4BCA620 */ { 0xB6,0x93,0xF3,0x6C,0x31,0x6E,0x4A,0xF1,0xB6,0xC2,0xF3,0x89,0xA4,0xBC,0xA6,0x20 }; +BMD_CONST REFIID IID_IDeckLinkEncoderVideoPacket = /* 4E7FD944-E8C7-4EAC-B8C0-7B77F80F5AE0 */ { 0x4E,0x7F,0xD9,0x44,0xE8,0xC7,0x4E,0xAC,0xB8,0xC0,0x7B,0x77,0xF8,0x0F,0x5A,0xE0 }; +BMD_CONST REFIID IID_IDeckLinkEncoderAudioPacket = /* 49E8EDC8-693B-4E14-8EF6-12C658F5A07A */ { 0x49,0xE8,0xED,0xC8,0x69,0x3B,0x4E,0x14,0x8E,0xF6,0x12,0xC6,0x58,0xF5,0xA0,0x7A }; +BMD_CONST REFIID IID_IDeckLinkH265NALPacket = /* 639C8E0B-68D5-4BDE-A6D4-95F3AEAFF2E7 */ { 0x63,0x9C,0x8E,0x0B,0x68,0xD5,0x4B,0xDE,0xA6,0xD4,0x95,0xF3,0xAE,0xAF,0xF2,0xE7 }; +BMD_CONST REFIID IID_IDeckLinkAudioInputPacket = /* E43D5870-2894-11DE-8C30-0800200C9A66 */ { 0xE4,0x3D,0x58,0x70,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66 }; +BMD_CONST REFIID IID_IDeckLinkScreenPreviewCallback = /* B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438 */ { 0xB1,0xD3,0xF4,0x9A,0x85,0xFE,0x4C,0x5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38 }; +BMD_CONST REFIID IID_IDeckLinkCocoaScreenPreviewCallback = /* D174152F-8F96-4C07-83A5-DD5F5AF0A2AA */ { 0xD1,0x74,0x15,0x2F,0x8F,0x96,0x4C,0x07,0x83,0xA5,0xDD,0x5F,0x5A,0xF0,0xA2,0xAA }; +BMD_CONST REFIID IID_IDeckLinkGLScreenPreviewHelper = /* 504E2209-CAC7-4C1A-9FB4-C5BB6274D22F */ { 0x50,0x4E,0x22,0x09,0xCA,0xC7,0x4C,0x1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F }; +BMD_CONST REFIID IID_IDeckLinkMetalScreenPreviewHelper = /* 1AB252C5-DACB-4AE8-A58B-5320DE9CE373 */ { 0x1A,0xB2,0x52,0xC5,0xDA,0xCB,0x4A,0xE8,0xA5,0x8B,0x53,0x20,0xDE,0x9C,0xE3,0x73 }; +BMD_CONST REFIID IID_IDeckLinkNotificationCallback = /* B002A1EC-070D-4288-8289-BD5D36E5FF0D */ { 0xB0,0x02,0xA1,0xEC,0x07,0x0D,0x42,0x88,0x82,0x89,0xBD,0x5D,0x36,0xE5,0xFF,0x0D }; +BMD_CONST REFIID IID_IDeckLinkNotification = /* B85DF4C8-BDF5-47C1-8064-28162EBDD4EB */ { 0xB8,0x5D,0xF4,0xC8,0xBD,0xF5,0x47,0xC1,0x80,0x64,0x28,0x16,0x2E,0xBD,0xD4,0xEB }; +BMD_CONST REFIID IID_IDeckLinkProfileAttributes = /* 17D4BF8E-4911-473A-80A0-731CF6FF345B */ { 0x17,0xD4,0xBF,0x8E,0x49,0x11,0x47,0x3A,0x80,0xA0,0x73,0x1C,0xF6,0xFF,0x34,0x5B }; +BMD_CONST REFIID IID_IDeckLinkProfileIterator = /* 29E5A8C0-8BE4-46EB-93AC-31DAAB5B7BF2 */ { 0x29,0xE5,0xA8,0xC0,0x8B,0xE4,0x46,0xEB,0x93,0xAC,0x31,0xDA,0xAB,0x5B,0x7B,0xF2 }; +BMD_CONST REFIID IID_IDeckLinkProfile = /* 16093466-674A-432B-9DA0-1AC2C5A8241C */ { 0x16,0x09,0x34,0x66,0x67,0x4A,0x43,0x2B,0x9D,0xA0,0x1A,0xC2,0xC5,0xA8,0x24,0x1C }; +BMD_CONST REFIID IID_IDeckLinkProfileCallback = /* A4F9341E-97AA-4E04-8935-15F809898CEA */ { 0xA4,0xF9,0x34,0x1E,0x97,0xAA,0x4E,0x04,0x89,0x35,0x15,0xF8,0x09,0x89,0x8C,0xEA }; +BMD_CONST REFIID IID_IDeckLinkProfileManager = /* 30D41429-3998-4B6D-84F8-78C94A797C6E */ { 0x30,0xD4,0x14,0x29,0x39,0x98,0x4B,0x6D,0x84,0xF8,0x78,0xC9,0x4A,0x79,0x7C,0x6E }; +BMD_CONST REFIID IID_IDeckLinkStatus = /* 5F558200-4028-49BC-BEAC-DB3FA4A96E46 */ { 0x5F,0x55,0x82,0x00,0x40,0x28,0x49,0xBC,0xBE,0xAC,0xDB,0x3F,0xA4,0xA9,0x6E,0x46 }; +BMD_CONST REFIID IID_IDeckLinkKeyer = /* 89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3 */ { 0x89,0xAF,0xCA,0xF5,0x65,0xF8,0x42,0x1E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3 }; +BMD_CONST REFIID IID_IDeckLinkVideoConversion = /* 3BBCB8A2-DA2C-42D9-B5D8-88083644E99A */ { 0x3B,0xBC,0xB8,0xA2,0xDA,0x2C,0x42,0xD9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A }; +BMD_CONST REFIID IID_IDeckLinkDeviceNotificationCallback = /* 4997053B-0ADF-4CC8-AC70-7A50C4BE728F */ { 0x49,0x97,0x05,0x3B,0x0A,0xDF,0x4C,0xC8,0xAC,0x70,0x7A,0x50,0xC4,0xBE,0x72,0x8F }; +BMD_CONST REFIID IID_IDeckLinkDiscovery = /* CDBF631C-BC76-45FA-B44D-C55059BC6101 */ { 0xCD,0xBF,0x63,0x1C,0xBC,0x76,0x45,0xFA,0xB4,0x4D,0xC5,0x50,0x59,0xBC,0x61,0x01 }; + +/* Enum BMDVideoOutputFlags - Flags to control the output of ancillary data along with video. */ + +typedef uint32_t BMDVideoOutputFlags; +enum _BMDVideoOutputFlags { + bmdVideoOutputFlagDefault = 0, + bmdVideoOutputVANC = 1 << 0, + bmdVideoOutputVITC = 1 << 1, + bmdVideoOutputRP188 = 1 << 2, + bmdVideoOutputDualStream3D = 1 << 4, + bmdVideoOutputSynchronizeToPlaybackGroup = 1 << 6 +}; + +/* Enum BMDSupportedVideoModeFlags - Flags to describe supported video modes */ + +typedef uint32_t BMDSupportedVideoModeFlags; +enum _BMDSupportedVideoModeFlags { + bmdSupportedVideoModeDefault = 0, + bmdSupportedVideoModeKeying = 1 << 0, + bmdSupportedVideoModeDualStream3D = 1 << 1, + bmdSupportedVideoModeSDISingleLink = 1 << 2, + bmdSupportedVideoModeSDIDualLink = 1 << 3, + bmdSupportedVideoModeSDIQuadLink = 1 << 4, + bmdSupportedVideoModeInAnyProfile = 1 << 5 +}; + +/* Enum BMDPacketType - Type of packet */ + +typedef uint32_t BMDPacketType; +enum _BMDPacketType { + bmdPacketTypeStreamInterruptedMarker = /* 'sint' */ 0x73696E74, // A packet of this type marks the time when a video stream was interrupted, for example by a disconnected cable + bmdPacketTypeStreamData = /* 'sdat' */ 0x73646174 // Regular stream data +}; + +/* Enum BMDFrameFlags - Frame flags */ + +typedef uint32_t BMDFrameFlags; +enum _BMDFrameFlags { + bmdFrameFlagDefault = 0, + bmdFrameFlagFlipVertical = 1 << 0, + bmdFrameContainsHDRMetadata = 1 << 1, + + /* Flags that are applicable only to instances of IDeckLinkVideoInputFrame */ + + bmdFrameCapturedAsPsF = 1 << 30, + bmdFrameHasNoInputSource = 1 << 31 +}; + +/* Enum BMDVideoInputFlags - Flags applicable to video input */ + +typedef uint32_t BMDVideoInputFlags; +enum _BMDVideoInputFlags { + bmdVideoInputFlagDefault = 0, + bmdVideoInputEnableFormatDetection = 1 << 0, + bmdVideoInputDualStream3D = 1 << 1, + bmdVideoInputSynchronizeToCaptureGroup = 1 << 2 +}; + +/* Enum BMDVideoInputFormatChangedEvents - Bitmask passed to the VideoInputFormatChanged notification to identify the properties of the input signal that have changed */ + +typedef uint32_t BMDVideoInputFormatChangedEvents; +enum _BMDVideoInputFormatChangedEvents { + bmdVideoInputDisplayModeChanged = 1 << 0, + bmdVideoInputFieldDominanceChanged = 1 << 1, + bmdVideoInputColorspaceChanged = 1 << 2 +}; + +/* Enum BMDDetectedVideoInputFormatFlags - Flags passed to the VideoInputFormatChanged notification to describe the detected video input signal */ + +typedef uint32_t BMDDetectedVideoInputFormatFlags; +enum _BMDDetectedVideoInputFormatFlags { + bmdDetectedVideoInputYCbCr422 = 1 << 0, + bmdDetectedVideoInputRGB444 = 1 << 1, + bmdDetectedVideoInputDualStream3D = 1 << 2, + bmdDetectedVideoInput12BitDepth = 1 << 3, + bmdDetectedVideoInput10BitDepth = 1 << 4, + bmdDetectedVideoInput8BitDepth = 1 << 5 +}; + +/* Enum BMDDeckLinkCapturePassthroughMode - Enumerates whether the video output is electrically connected to the video input or if the clean switching mode is enabled */ + +typedef uint32_t BMDDeckLinkCapturePassthroughMode; +enum _BMDDeckLinkCapturePassthroughMode { + bmdDeckLinkCapturePassthroughModeDisabled = /* 'pdis' */ 0x70646973, + bmdDeckLinkCapturePassthroughModeDirect = /* 'pdir' */ 0x70646972, + bmdDeckLinkCapturePassthroughModeCleanSwitch = /* 'pcln' */ 0x70636C6E +}; + +/* Enum BMDOutputFrameCompletionResult - Frame Completion Callback */ + +typedef uint32_t BMDOutputFrameCompletionResult; +enum _BMDOutputFrameCompletionResult { + bmdOutputFrameCompleted, + bmdOutputFrameDisplayedLate, + bmdOutputFrameDropped, + bmdOutputFrameFlushed +}; + +/* Enum BMDReferenceStatus - GenLock input status */ + +typedef uint32_t BMDReferenceStatus; +enum _BMDReferenceStatus { + bmdReferenceUnlocked = 0, + bmdReferenceNotSupportedByHardware = 1 << 0, + bmdReferenceLocked = 1 << 1 +}; + +/* Enum BMDAudioFormat - Audio Format */ + +typedef uint32_t BMDAudioFormat; +enum _BMDAudioFormat { + bmdAudioFormatPCM = /* 'lpcm' */ 0x6C70636D // Linear signed PCM samples +}; + +/* Enum BMDAudioSampleRate - Audio sample rates supported for output/input */ + +typedef uint32_t BMDAudioSampleRate; +enum _BMDAudioSampleRate { + bmdAudioSampleRate48kHz = 48000 +}; + +/* Enum BMDAudioSampleType - Audio sample sizes supported for output/input */ + +typedef uint32_t BMDAudioSampleType; +enum _BMDAudioSampleType { + bmdAudioSampleType16bitInteger = 16, + bmdAudioSampleType32bitInteger = 32 +}; + +/* Enum BMDAudioOutputStreamType - Audio output stream type */ + +typedef uint32_t BMDAudioOutputStreamType; +enum _BMDAudioOutputStreamType { + bmdAudioOutputStreamContinuous, + bmdAudioOutputStreamContinuousDontResample, + bmdAudioOutputStreamTimestamped +}; + +/* Enum BMDAncillaryPacketFormat - Ancillary packet format */ + +typedef uint32_t BMDAncillaryPacketFormat; +enum _BMDAncillaryPacketFormat { + bmdAncillaryPacketFormatUInt8 = /* 'ui08' */ 0x75693038, + bmdAncillaryPacketFormatUInt16 = /* 'ui16' */ 0x75693136, + bmdAncillaryPacketFormatYCbCr10 = /* 'v210' */ 0x76323130 +}; + +/* Enum BMDTimecodeFormat - Timecode formats for frame metadata */ + +typedef uint32_t BMDTimecodeFormat; +enum _BMDTimecodeFormat { + bmdTimecodeRP188VITC1 = /* 'rpv1' */ 0x72707631, // RP188 timecode where DBB1 equals VITC1 (line 9) + bmdTimecodeRP188VITC2 = /* 'rp12' */ 0x72703132, // RP188 timecode where DBB1 equals VITC2 (line 9 for progressive or line 571 for interlaced/PsF) + bmdTimecodeRP188LTC = /* 'rplt' */ 0x72706C74, // RP188 timecode where DBB1 equals LTC (line 10) + bmdTimecodeRP188HighFrameRate = /* 'rphr' */ 0x72706872, // RP188 timecode where DBB1 is an HFRTC (SMPTE ST 12-3), the only timecode allowing the frame value to go above 30 + bmdTimecodeRP188Any = /* 'rp18' */ 0x72703138, // Convenience for capture, returning the first valid timecode in {HFRTC (if supported), VITC1, VITC2, LTC } + bmdTimecodeVITC = /* 'vitc' */ 0x76697463, + bmdTimecodeVITCField2 = /* 'vit2' */ 0x76697432, + bmdTimecodeSerial = /* 'seri' */ 0x73657269 +}; + +/* Enum BMDAnalogVideoFlags - Analog video display flags */ + +typedef uint32_t BMDAnalogVideoFlags; +enum _BMDAnalogVideoFlags { + bmdAnalogVideoFlagCompositeSetup75 = 1 << 0, + bmdAnalogVideoFlagComponentBetacamLevels = 1 << 1 +}; + +/* Enum BMDAudioOutputAnalogAESSwitch - Audio output Analog/AESEBU switch */ + +typedef uint32_t BMDAudioOutputAnalogAESSwitch; +enum _BMDAudioOutputAnalogAESSwitch { + bmdAudioOutputSwitchAESEBU = /* 'aes ' */ 0x61657320, + bmdAudioOutputSwitchAnalog = /* 'anlg' */ 0x616E6C67 +}; + +/* Enum BMDVideoOutputConversionMode - Video/audio conversion mode */ + +typedef uint32_t BMDVideoOutputConversionMode; +enum _BMDVideoOutputConversionMode { + bmdNoVideoOutputConversion = /* 'none' */ 0x6E6F6E65, + bmdVideoOutputLetterboxDownconversion = /* 'ltbx' */ 0x6C746278, + bmdVideoOutputAnamorphicDownconversion = /* 'amph' */ 0x616D7068, + bmdVideoOutputHD720toHD1080Conversion = /* '720c' */ 0x37323063, + bmdVideoOutputHardwareLetterboxDownconversion = /* 'HWlb' */ 0x48576C62, + bmdVideoOutputHardwareAnamorphicDownconversion = /* 'HWam' */ 0x4857616D, + bmdVideoOutputHardwareCenterCutDownconversion = /* 'HWcc' */ 0x48576363, + bmdVideoOutputHardware720p1080pCrossconversion = /* 'xcap' */ 0x78636170, + bmdVideoOutputHardwareAnamorphic720pUpconversion = /* 'ua7p' */ 0x75613770, + bmdVideoOutputHardwareAnamorphic1080iUpconversion = /* 'ua1i' */ 0x75613169, + bmdVideoOutputHardwareAnamorphic149To720pUpconversion = /* 'u47p' */ 0x75343770, + bmdVideoOutputHardwareAnamorphic149To1080iUpconversion = /* 'u41i' */ 0x75343169, + bmdVideoOutputHardwarePillarbox720pUpconversion = /* 'up7p' */ 0x75703770, + bmdVideoOutputHardwarePillarbox1080iUpconversion = /* 'up1i' */ 0x75703169 +}; + +/* Enum BMDVideoInputConversionMode - Video input conversion mode */ + +typedef uint32_t BMDVideoInputConversionMode; +enum _BMDVideoInputConversionMode { + bmdNoVideoInputConversion = /* 'none' */ 0x6E6F6E65, + bmdVideoInputLetterboxDownconversionFromHD1080 = /* '10lb' */ 0x31306C62, + bmdVideoInputAnamorphicDownconversionFromHD1080 = /* '10am' */ 0x3130616D, + bmdVideoInputLetterboxDownconversionFromHD720 = /* '72lb' */ 0x37326C62, + bmdVideoInputAnamorphicDownconversionFromHD720 = /* '72am' */ 0x3732616D, + bmdVideoInputLetterboxUpconversion = /* 'lbup' */ 0x6C627570, + bmdVideoInputAnamorphicUpconversion = /* 'amup' */ 0x616D7570 +}; + +/* Enum BMDVideo3DPackingFormat - Video 3D packing format */ + +typedef uint32_t BMDVideo3DPackingFormat; +enum _BMDVideo3DPackingFormat { + bmdVideo3DPackingSidebySideHalf = /* 'sbsh' */ 0x73627368, + bmdVideo3DPackingLinebyLine = /* 'lbyl' */ 0x6C62796C, + bmdVideo3DPackingTopAndBottom = /* 'tabo' */ 0x7461626F, + bmdVideo3DPackingFramePacking = /* 'frpk' */ 0x6672706B, + bmdVideo3DPackingLeftOnly = /* 'left' */ 0x6C656674, + bmdVideo3DPackingRightOnly = /* 'righ' */ 0x72696768 +}; + +/* Enum BMDIdleVideoOutputOperation - Video output operation when not playing video */ + +typedef uint32_t BMDIdleVideoOutputOperation; +enum _BMDIdleVideoOutputOperation { + bmdIdleVideoOutputBlack = /* 'blac' */ 0x626C6163, + bmdIdleVideoOutputLastFrame = /* 'lafa' */ 0x6C616661 +}; + +/* Enum BMDVideoEncoderFrameCodingMode - Video frame coding mode */ + +typedef uint32_t BMDVideoEncoderFrameCodingMode; +enum _BMDVideoEncoderFrameCodingMode { + bmdVideoEncoderFrameCodingModeInter = /* 'inte' */ 0x696E7465, + bmdVideoEncoderFrameCodingModeIntra = /* 'intr' */ 0x696E7472 +}; + +/* Enum BMDDNxHRLevel - DNxHR Levels */ + +typedef uint32_t BMDDNxHRLevel; +enum _BMDDNxHRLevel { + bmdDNxHRLevelSQ = /* 'dnsq' */ 0x646E7371, + bmdDNxHRLevelLB = /* 'dnlb' */ 0x646E6C62, + bmdDNxHRLevelHQ = /* 'dnhq' */ 0x646E6871, + bmdDNxHRLevelHQX = /* 'dhqx' */ 0x64687178, + bmdDNxHRLevel444 = /* 'd444' */ 0x64343434 +}; + +/* Enum BMDLinkConfiguration - Video link configuration */ + +typedef uint32_t BMDLinkConfiguration; +enum _BMDLinkConfiguration { + bmdLinkConfigurationSingleLink = /* 'lcsl' */ 0x6C63736C, + bmdLinkConfigurationDualLink = /* 'lcdl' */ 0x6C63646C, + bmdLinkConfigurationQuadLink = /* 'lcql' */ 0x6C63716C +}; + +/* Enum BMDDeviceInterface - Device interface type */ + +typedef uint32_t BMDDeviceInterface; +enum _BMDDeviceInterface { + bmdDeviceInterfacePCI = /* 'pci ' */ 0x70636920, + bmdDeviceInterfaceUSB = /* 'usb ' */ 0x75736220, + bmdDeviceInterfaceThunderbolt = /* 'thun' */ 0x7468756E +}; + +/* Enum BMDColorspace - Colorspace */ + +typedef uint32_t BMDColorspace; +enum _BMDColorspace { + bmdColorspaceRec601 = /* 'r601' */ 0x72363031, + bmdColorspaceRec709 = /* 'r709' */ 0x72373039, + bmdColorspaceRec2020 = /* '2020' */ 0x32303230 +}; + +/* Enum BMDDynamicRange - SDR or HDR */ + +typedef uint32_t BMDDynamicRange; +enum _BMDDynamicRange { + bmdDynamicRangeSDR = 0, // Standard Dynamic Range in accordance with SMPTE ST 2036-1 + bmdDynamicRangeHDRStaticPQ = 1 << 29, // High Dynamic Range PQ in accordance with SMPTE ST 2084 + bmdDynamicRangeHDRStaticHLG = 1 << 30 // High Dynamic Range HLG in accordance with ITU-R BT.2100-0 +}; + +/* Enum BMDDeckLinkHDMIInputEDIDID - DeckLink HDMI Input EDID ID */ + +typedef uint32_t BMDDeckLinkHDMIInputEDIDID; +enum _BMDDeckLinkHDMIInputEDIDID { + + /* Integers */ + + bmdDeckLinkHDMIInputEDIDDynamicRange = /* 'HIDy' */ 0x48494479 // Parameter is of type BMDDynamicRange. Default is (bmdDynamicRangeSDR|bmdDynamicRangeHDRStaticPQ) +}; + +/* Enum BMDDeckLinkFrameMetadataID - DeckLink Frame Metadata ID */ + +typedef uint32_t BMDDeckLinkFrameMetadataID; +enum _BMDDeckLinkFrameMetadataID { + + /* Colorspace Metadata - Integers */ + + bmdDeckLinkFrameMetadataColorspace = /* 'cspc' */ 0x63737063, // Colorspace of video frame (see BMDColorspace) + + /* HDR Metadata - Integers */ + + bmdDeckLinkFrameMetadataHDRElectroOpticalTransferFunc = /* 'eotf' */ 0x656F7466, // EOTF in range 0-7 as per CEA 861.3 + + /* HDR Metadata - Floats */ + + bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedX = /* 'hdrx' */ 0x68647278, // Red display primaries in range 0.0 - 1.0 + bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedY = /* 'hdry' */ 0x68647279, // Red display primaries in range 0.0 - 1.0 + bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenX = /* 'hdgx' */ 0x68646778, // Green display primaries in range 0.0 - 1.0 + bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenY = /* 'hdgy' */ 0x68646779, // Green display primaries in range 0.0 - 1.0 + bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueX = /* 'hdbx' */ 0x68646278, // Blue display primaries in range 0.0 - 1.0 + bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueY = /* 'hdby' */ 0x68646279, // Blue display primaries in range 0.0 - 1.0 + bmdDeckLinkFrameMetadataHDRWhitePointX = /* 'hdwx' */ 0x68647778, // White point in range 0.0 - 1.0 + bmdDeckLinkFrameMetadataHDRWhitePointY = /* 'hdwy' */ 0x68647779, // White point in range 0.0 - 1.0 + bmdDeckLinkFrameMetadataHDRMaxDisplayMasteringLuminance = /* 'hdml' */ 0x68646D6C, // Max display mastering luminance in range 1 cd/m2 - 65535 cd/m2 + bmdDeckLinkFrameMetadataHDRMinDisplayMasteringLuminance = /* 'hmil' */ 0x686D696C, // Min display mastering luminance in range 0.0001 cd/m2 - 6.5535 cd/m2 + bmdDeckLinkFrameMetadataHDRMaximumContentLightLevel = /* 'mcll' */ 0x6D636C6C, // Maximum Content Light Level in range 1 cd/m2 - 65535 cd/m2 + bmdDeckLinkFrameMetadataHDRMaximumFrameAverageLightLevel = /* 'fall' */ 0x66616C6C // Maximum Frame Average Light Level in range 1 cd/m2 - 65535 cd/m2 +}; + +/* Enum BMDProfileID - Identifies a profile */ + +typedef uint32_t BMDProfileID; +enum _BMDProfileID { + bmdProfileOneSubDeviceFullDuplex = /* '1dfd' */ 0x31646664, + bmdProfileOneSubDeviceHalfDuplex = /* '1dhd' */ 0x31646864, + bmdProfileTwoSubDevicesFullDuplex = /* '2dfd' */ 0x32646664, + bmdProfileTwoSubDevicesHalfDuplex = /* '2dhd' */ 0x32646864, + bmdProfileFourSubDevicesHalfDuplex = /* '4dhd' */ 0x34646864 +}; + +/* Enum BMDHDMITimecodePacking - Packing form of timecode on HDMI */ + +typedef uint32_t BMDHDMITimecodePacking; +enum _BMDHDMITimecodePacking { + bmdHDMITimecodePackingIEEEOUI000085 = 0x00008500, + bmdHDMITimecodePackingIEEEOUI080046 = 0x08004601, + bmdHDMITimecodePackingIEEEOUI5CF9F0 = 0x5CF9F003 +}; + +/* Enum BMDInternalKeyingAncillaryDataSource - Source for VANC and timecode data when performing internal keying */ + +typedef uint32_t BMDInternalKeyingAncillaryDataSource; +enum _BMDInternalKeyingAncillaryDataSource { + bmdInternalKeyingUsesAncillaryDataFromInputSignal = /* 'ikai' */ 0x696B6169, + bmdInternalKeyingUsesAncillaryDataFromKeyFrame = /* 'ikak' */ 0x696B616B +}; + +/* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ + +typedef uint32_t BMDDeckLinkAttributeID; +enum _BMDDeckLinkAttributeID { + + /* Flags */ + + BMDDeckLinkSupportsInternalKeying = /* 'keyi' */ 0x6B657969, + BMDDeckLinkSupportsExternalKeying = /* 'keye' */ 0x6B657965, + BMDDeckLinkSupportsInputFormatDetection = /* 'infd' */ 0x696E6664, + BMDDeckLinkHasReferenceInput = /* 'hrin' */ 0x6872696E, + BMDDeckLinkHasSerialPort = /* 'hspt' */ 0x68737074, + BMDDeckLinkHasAnalogVideoOutputGain = /* 'avog' */ 0x61766F67, + BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain = /* 'ovog' */ 0x6F766F67, + BMDDeckLinkHasVideoInputAntiAliasingFilter = /* 'aafl' */ 0x6161666C, + BMDDeckLinkHasBypass = /* 'byps' */ 0x62797073, + BMDDeckLinkSupportsClockTimingAdjustment = /* 'ctad' */ 0x63746164, + BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset = /* 'frin' */ 0x6672696E, + BMDDeckLinkSupportsSMPTELevelAOutput = /* 'lvla' */ 0x6C766C61, + BMDDeckLinkSupportsAutoSwitchingPPsFOnInput = /* 'apsf' */ 0x61707366, + BMDDeckLinkSupportsDualLinkSDI = /* 'sdls' */ 0x73646C73, + BMDDeckLinkSupportsQuadLinkSDI = /* 'sqls' */ 0x73716C73, + BMDDeckLinkSupportsIdleOutput = /* 'idou' */ 0x69646F75, + BMDDeckLinkVANCRequires10BitYUVVideoFrames = /* 'vioY' */ 0x76696F59, // Legacy product requires v210 active picture for IDeckLinkVideoFrameAncillaryPackets or 10-bit VANC + BMDDeckLinkHasLTCTimecodeInput = /* 'hltc' */ 0x686C7463, + BMDDeckLinkSupportsHDRMetadata = /* 'hdrm' */ 0x6864726D, + BMDDeckLinkSupportsColorspaceMetadata = /* 'cmet' */ 0x636D6574, + BMDDeckLinkSupportsHDMITimecode = /* 'htim' */ 0x6874696D, + BMDDeckLinkSupportsHighFrameRateTimecode = /* 'HFRT' */ 0x48465254, + BMDDeckLinkSupportsSynchronizeToCaptureGroup = /* 'stcg' */ 0x73746367, + BMDDeckLinkSupportsSynchronizeToPlaybackGroup = /* 'stpg' */ 0x73747067, + + /* Integers */ + + BMDDeckLinkMaximumAudioChannels = /* 'mach' */ 0x6D616368, + BMDDeckLinkMaximumAnalogAudioInputChannels = /* 'iach' */ 0x69616368, + BMDDeckLinkMaximumAnalogAudioOutputChannels = /* 'aach' */ 0x61616368, + BMDDeckLinkNumberOfSubDevices = /* 'nsbd' */ 0x6E736264, + BMDDeckLinkSubDeviceIndex = /* 'subi' */ 0x73756269, + BMDDeckLinkPersistentID = /* 'peid' */ 0x70656964, + BMDDeckLinkDeviceGroupID = /* 'dgid' */ 0x64676964, + BMDDeckLinkTopologicalID = /* 'toid' */ 0x746F6964, + BMDDeckLinkVideoOutputConnections = /* 'vocn' */ 0x766F636E, // Returns a BMDVideoConnection bit field + BMDDeckLinkVideoInputConnections = /* 'vicn' */ 0x7669636E, // Returns a BMDVideoConnection bit field + BMDDeckLinkAudioOutputConnections = /* 'aocn' */ 0x616F636E, // Returns a BMDAudioConnection bit field + BMDDeckLinkAudioInputConnections = /* 'aicn' */ 0x6169636E, // Returns a BMDAudioConnection bit field + BMDDeckLinkVideoIOSupport = /* 'vios' */ 0x76696F73, // Returns a BMDVideoIOSupport bit field + BMDDeckLinkDeckControlConnections = /* 'dccn' */ 0x6463636E, // Returns a BMDDeckControlConnection bit field + BMDDeckLinkDeviceInterface = /* 'dbus' */ 0x64627573, // Returns a BMDDeviceInterface + BMDDeckLinkAudioInputRCAChannelCount = /* 'airc' */ 0x61697263, + BMDDeckLinkAudioInputXLRChannelCount = /* 'aixc' */ 0x61697863, + BMDDeckLinkAudioOutputRCAChannelCount = /* 'aorc' */ 0x616F7263, + BMDDeckLinkAudioOutputXLRChannelCount = /* 'aoxc' */ 0x616F7863, + BMDDeckLinkProfileID = /* 'prid' */ 0x70726964, // Returns a BMDProfileID + BMDDeckLinkDuplex = /* 'dupx' */ 0x64757078, + BMDDeckLinkMinimumPrerollFrames = /* 'mprf' */ 0x6D707266, + BMDDeckLinkSupportedDynamicRange = /* 'sudr' */ 0x73756472, + + /* Floats */ + + BMDDeckLinkVideoInputGainMinimum = /* 'vigm' */ 0x7669676D, + BMDDeckLinkVideoInputGainMaximum = /* 'vigx' */ 0x76696778, + BMDDeckLinkVideoOutputGainMinimum = /* 'vogm' */ 0x766F676D, + BMDDeckLinkVideoOutputGainMaximum = /* 'vogx' */ 0x766F6778, + BMDDeckLinkMicrophoneInputGainMinimum = /* 'migm' */ 0x6D69676D, + BMDDeckLinkMicrophoneInputGainMaximum = /* 'migx' */ 0x6D696778, + + /* Strings */ + + BMDDeckLinkSerialPortDeviceName = /* 'slpn' */ 0x736C706E, + BMDDeckLinkVendorName = /* 'vndr' */ 0x766E6472, + BMDDeckLinkDisplayName = /* 'dspn' */ 0x6473706E, + BMDDeckLinkModelName = /* 'mdln' */ 0x6D646C6E, + BMDDeckLinkDeviceHandle = /* 'devh' */ 0x64657668 +}; + +/* Enum BMDDeckLinkAPIInformationID - DeckLinkAPI information ID */ + +typedef uint32_t BMDDeckLinkAPIInformationID; +enum _BMDDeckLinkAPIInformationID { + + /* Integer or String */ + + BMDDeckLinkAPIVersion = /* 'vers' */ 0x76657273 +}; + +/* Enum BMDDeckLinkStatusID - DeckLink Status ID */ + +typedef uint32_t BMDDeckLinkStatusID; +enum _BMDDeckLinkStatusID { + + /* Integers */ + + bmdDeckLinkStatusDetectedVideoInputMode = /* 'dvim' */ 0x6476696D, + bmdDeckLinkStatusDetectedVideoInputFormatFlags = /* 'dvff' */ 0x64766666, + bmdDeckLinkStatusDetectedVideoInputFieldDominance = /* 'dvfd' */ 0x64766664, + bmdDeckLinkStatusDetectedVideoInputColorspace = /* 'dscl' */ 0x6473636C, + bmdDeckLinkStatusDetectedVideoInputDynamicRange = /* 'dsdr' */ 0x64736472, + bmdDeckLinkStatusDetectedSDILinkConfiguration = /* 'dslc' */ 0x64736C63, + bmdDeckLinkStatusCurrentVideoInputMode = /* 'cvim' */ 0x6376696D, + bmdDeckLinkStatusCurrentVideoInputPixelFormat = /* 'cvip' */ 0x63766970, + bmdDeckLinkStatusCurrentVideoInputFlags = /* 'cvif' */ 0x63766966, + bmdDeckLinkStatusCurrentVideoOutputMode = /* 'cvom' */ 0x63766F6D, + bmdDeckLinkStatusCurrentVideoOutputFlags = /* 'cvof' */ 0x63766F66, + bmdDeckLinkStatusPCIExpressLinkWidth = /* 'pwid' */ 0x70776964, + bmdDeckLinkStatusPCIExpressLinkSpeed = /* 'plnk' */ 0x706C6E6B, + bmdDeckLinkStatusLastVideoOutputPixelFormat = /* 'opix' */ 0x6F706978, + bmdDeckLinkStatusReferenceSignalMode = /* 'refm' */ 0x7265666D, + bmdDeckLinkStatusReferenceSignalFlags = /* 'reff' */ 0x72656666, + bmdDeckLinkStatusBusy = /* 'busy' */ 0x62757379, + bmdDeckLinkStatusInterchangeablePanelType = /* 'icpt' */ 0x69637074, + bmdDeckLinkStatusDeviceTemperature = /* 'dtmp' */ 0x64746D70, + + /* Flags */ + + bmdDeckLinkStatusVideoInputSignalLocked = /* 'visl' */ 0x7669736C, + bmdDeckLinkStatusReferenceSignalLocked = /* 'refl' */ 0x7265666C, + + /* Bytes */ + + bmdDeckLinkStatusReceivedEDID = /* 'edid' */ 0x65646964 +}; + +/* Enum BMDDeckLinkVideoStatusFlags - */ + +typedef uint32_t BMDDeckLinkVideoStatusFlags; +enum _BMDDeckLinkVideoStatusFlags { + bmdDeckLinkVideoStatusPsF = 1 << 0, + bmdDeckLinkVideoStatusDualStream3D = 1 << 1 +}; + +/* Enum BMDDuplexMode - Duplex of the device */ + +typedef uint32_t BMDDuplexMode; +enum _BMDDuplexMode { + bmdDuplexFull = /* 'dxfu' */ 0x64786675, + bmdDuplexHalf = /* 'dxha' */ 0x64786861, + bmdDuplexSimplex = /* 'dxsp' */ 0x64787370, + bmdDuplexInactive = /* 'dxin' */ 0x6478696E +}; + +/* Enum BMDPanelType - The type of interchangeable panel */ + +typedef uint32_t BMDPanelType; +enum _BMDPanelType { + bmdPanelNotDetected = /* 'npnl' */ 0x6E706E6C, + bmdPanelTeranexMiniSmartPanel = /* 'tmsm' */ 0x746D736D +}; + +/* Enum BMDDeviceBusyState - Current device busy state */ + +typedef uint32_t BMDDeviceBusyState; +enum _BMDDeviceBusyState { + bmdDeviceCaptureBusy = 1 << 0, + bmdDevicePlaybackBusy = 1 << 1, + bmdDeviceSerialPortBusy = 1 << 2 +}; + +/* Enum BMDVideoIOSupport - Device video input/output support */ + +typedef uint32_t BMDVideoIOSupport; +enum _BMDVideoIOSupport { + bmdDeviceSupportsCapture = 1 << 0, + bmdDeviceSupportsPlayback = 1 << 1 +}; + +/* Enum BMD3DPreviewFormat - Linked Frame preview format */ + +typedef uint32_t BMD3DPreviewFormat; +enum _BMD3DPreviewFormat { + bmd3DPreviewFormatDefault = /* 'defa' */ 0x64656661, + bmd3DPreviewFormatLeftOnly = /* 'left' */ 0x6C656674, + bmd3DPreviewFormatRightOnly = /* 'righ' */ 0x72696768, + bmd3DPreviewFormatSideBySide = /* 'side' */ 0x73696465, + bmd3DPreviewFormatTopBottom = /* 'topb' */ 0x746F7062 +}; + +/* Enum BMDNotifications - Events that can be subscribed through IDeckLinkNotification */ + +typedef uint32_t BMDNotifications; +enum _BMDNotifications { + bmdPreferencesChanged = /* 'pref' */ 0x70726566, + bmdStatusChanged = /* 'stat' */ 0x73746174 +}; + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLinkVideoOutputCallback; +class IDeckLinkInputCallback; +class IDeckLinkEncoderInputCallback; +class IDeckLinkMemoryAllocator; +class IDeckLinkAudioOutputCallback; +class IDeckLinkIterator; +class IDeckLinkAPIInformation; +class IDeckLinkOutput; +class IDeckLinkInput; +class IDeckLinkHDMIInputEDID; +class IDeckLinkEncoderInput; +class IDeckLinkVideoFrame; +class IDeckLinkMutableVideoFrame; +class IDeckLinkVideoFrame3DExtensions; +class IDeckLinkVideoFrameMetadataExtensions; +class IDeckLinkVideoInputFrame; +class IDeckLinkAncillaryPacket; +class IDeckLinkAncillaryPacketIterator; +class IDeckLinkVideoFrameAncillaryPackets; +class IDeckLinkVideoFrameAncillary; +class IDeckLinkEncoderPacket; +class IDeckLinkEncoderVideoPacket; +class IDeckLinkEncoderAudioPacket; +class IDeckLinkH265NALPacket; +class IDeckLinkAudioInputPacket; +class IDeckLinkScreenPreviewCallback; +class IDeckLinkCocoaScreenPreviewCallback; +class IDeckLinkGLScreenPreviewHelper; +class IDeckLinkMetalScreenPreviewHelper; +class IDeckLinkNotificationCallback; +class IDeckLinkNotification; +class IDeckLinkProfileAttributes; +class IDeckLinkProfileIterator; +class IDeckLinkProfile; +class IDeckLinkProfileCallback; +class IDeckLinkProfileManager; +class IDeckLinkStatus; +class IDeckLinkKeyer; +class IDeckLinkVideoConversion; +class IDeckLinkDeviceNotificationCallback; +class IDeckLinkDiscovery; + +/* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */ + +class BMD_PUBLIC IDeckLinkVideoOutputCallback : public IUnknown +{ +public: + virtual HRESULT ScheduledFrameCompleted (/* in */ IDeckLinkVideoFrame* completedFrame, /* in */ BMDOutputFrameCompletionResult result) = 0; + virtual HRESULT ScheduledPlaybackHasStopped (void) = 0; + +protected: + virtual ~IDeckLinkVideoOutputCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkInputCallback - Frame arrival callback. */ + +class BMD_PUBLIC IDeckLinkInputCallback : public IUnknown +{ +public: + virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode* newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0; + +protected: + virtual ~IDeckLinkInputCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkEncoderInputCallback - Frame arrival callback. */ + +class BMD_PUBLIC IDeckLinkEncoderInputCallback : public IUnknown +{ +public: + virtual HRESULT VideoInputSignalChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode* newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + virtual HRESULT VideoPacketArrived (/* in */ IDeckLinkEncoderVideoPacket* videoPacket) = 0; + virtual HRESULT AudioPacketArrived (/* in */ IDeckLinkEncoderAudioPacket* audioPacket) = 0; + +protected: + virtual ~IDeckLinkEncoderInputCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkMemoryAllocator - Memory allocator for video frames. */ + +class BMD_PUBLIC IDeckLinkMemoryAllocator : public IUnknown +{ +public: + virtual HRESULT AllocateBuffer (/* in */ uint32_t bufferSize, /* out */ void** allocatedBuffer) = 0; + virtual HRESULT ReleaseBuffer (/* in */ void* buffer) = 0; + virtual HRESULT Commit (void) = 0; + virtual HRESULT Decommit (void) = 0; +}; + +/* Interface IDeckLinkAudioOutputCallback - Optional callback to allow audio samples to be pulled as required. */ + +class BMD_PUBLIC IDeckLinkAudioOutputCallback : public IUnknown +{ +public: + virtual HRESULT RenderAudioSamples (/* in */ bool preroll) = 0; +}; + +/* Interface IDeckLinkIterator - Enumerates installed DeckLink hardware */ + +class BMD_PUBLIC IDeckLinkIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLink** deckLinkInstance) = 0; +}; + +/* Interface IDeckLinkAPIInformation - DeckLinkAPI attribute interface */ + +class BMD_PUBLIC IDeckLinkAPIInformation : public IUnknown +{ +public: + virtual HRESULT GetFlag (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ bool* value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ int64_t* value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ double* value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ CFStringRef* value) = 0; + +protected: + virtual ~IDeckLinkAPIInformation () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ + +class BMD_PUBLIC IDeckLinkOutput : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDVideoConnection connection /* If a value of bmdVideoConnectionUnspecified is specified, the caller does not care about the connection */, /* in */ BMDDisplayMode requestedMode, /* in */ BMDPixelFormat requestedPixelFormat, /* in */ BMDVideoOutputConversionMode conversionMode, /* in */ BMDSupportedVideoModeFlags flags, /* out */ BMDDisplayMode* actualMode, /* out */ bool* supported) = 0; + virtual HRESULT GetDisplayMode (/* in */ BMDDisplayMode displayMode, /* out */ IDeckLinkDisplayMode** resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator** iterator) = 0; + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback* previewCallback) = 0; + + /* Video Output */ + + virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0; + virtual HRESULT DisableVideoOutput (void) = 0; + virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator* theAllocator) = 0; + virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame** outFrame) = 0; + virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary** outBuffer) = 0; // Use of IDeckLinkVideoFrameAncillaryPackets is preferred + virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame* theFrame) = 0; + virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame* theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback* theCallback) = 0; + virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t* bufferedFrameCount) = 0; + + /* Audio Output */ + + virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0; + virtual HRESULT DisableAudioOutput (void) = 0; + virtual HRESULT WriteAudioSamplesSync (/* in */ void* buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t* sampleFramesWritten) = 0; + virtual HRESULT BeginAudioPreroll (void) = 0; + virtual HRESULT EndAudioPreroll (void) = 0; + virtual HRESULT ScheduleAudioSamples (/* in */ void* buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t* sampleFramesWritten) = 0; + virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t* bufferedSampleFrameCount) = 0; + virtual HRESULT FlushBufferedAudioSamples (void) = 0; + virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback* theCallback) = 0; + + /* Output Control */ + + virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0; + virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue* actualStopTime, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool* active) = 0; + virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* streamTime, /* out */ double* playbackSpeed) = 0; + virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus* referenceStatus) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* hardwareTime, /* out */ BMDTimeValue* timeInFrame, /* out */ BMDTimeValue* ticksPerFrame) = 0; + virtual HRESULT GetFrameCompletionReferenceTimestamp (/* in */ IDeckLinkVideoFrame* theFrame, /* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* frameCompletionTimestamp) = 0; + +protected: + virtual ~IDeckLinkOutput () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */ + +class BMD_PUBLIC IDeckLinkInput : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDVideoConnection connection /* If a value of bmdVideoConnectionUnspecified is specified, the caller does not care about the connection */, /* in */ BMDDisplayMode requestedMode, /* in */ BMDPixelFormat requestedPixelFormat, /* in */ BMDVideoInputConversionMode conversionMode, /* in */ BMDSupportedVideoModeFlags flags, /* out */ BMDDisplayMode* actualMode, /* out */ bool* supported) = 0; + virtual HRESULT GetDisplayMode (/* in */ BMDDisplayMode displayMode, /* out */ IDeckLinkDisplayMode** resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator** iterator) = 0; + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback* previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t* availableFrameCount) = 0; + virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator* theAllocator) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t* availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback* theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* hardwareTime, /* out */ BMDTimeValue* timeInFrame, /* out */ BMDTimeValue* ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkInput () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkHDMIInputEDID - Created by QueryInterface from IDeckLink. Releasing all references will restore EDID to default */ + +class BMD_PUBLIC IDeckLinkHDMIInputEDID : public IUnknown +{ +public: + virtual HRESULT SetInt (/* in */ BMDDeckLinkHDMIInputEDIDID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkHDMIInputEDIDID cfgID, /* out */ int64_t* value) = 0; + virtual HRESULT WriteToEDID (void) = 0; + +protected: + virtual ~IDeckLinkHDMIInputEDID () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkEncoderInput - Created by QueryInterface from IDeckLink. */ + +class BMD_PUBLIC IDeckLinkEncoderInput : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDVideoConnection connection /* If a value of bmdVideoConnectionUnspecified is specified, the caller does not care about the connection */, /* in */ BMDDisplayMode requestedMode, /* in */ BMDPixelFormat requestedCodec, /* in */ uint32_t requestedCodecProfile, /* in */ BMDSupportedVideoModeFlags flags, /* out */ bool* supported) = 0; + virtual HRESULT GetDisplayMode (/* in */ BMDDisplayMode displayMode, /* out */ IDeckLinkDisplayMode** resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator** iterator) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailablePacketsCount (/* out */ uint32_t* availablePacketsCount) = 0; + virtual HRESULT SetMemoryAllocator (/* in */ IDeckLinkMemoryAllocator* theAllocator) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioFormat audioFormat, /* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t* availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkEncoderInputCallback* theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* hardwareTime, /* out */ BMDTimeValue* timeInFrame, /* out */ BMDTimeValue* ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkEncoderInput () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */ + +class BMD_PUBLIC IDeckLinkVideoFrame : public IUnknown +{ +public: + virtual long GetWidth (void) = 0; + virtual long GetHeight (void) = 0; + virtual long GetRowBytes (void) = 0; + virtual BMDPixelFormat GetPixelFormat (void) = 0; + virtual BMDFrameFlags GetFlags (void) = 0; + virtual HRESULT GetBytes (/* out */ void** buffer) = 0; + virtual HRESULT GetTimecode (/* in */ BMDTimecodeFormat format, /* out */ IDeckLinkTimecode** timecode) = 0; + virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary** ancillary) = 0; // Use of IDeckLinkVideoFrameAncillaryPackets is preferred + +protected: + virtual ~IDeckLinkVideoFrame () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */ + +class BMD_PUBLIC IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame +{ +public: + virtual HRESULT SetFlags (/* in */ BMDFrameFlags newFlags) = 0; + virtual HRESULT SetTimecode (/* in */ BMDTimecodeFormat format, /* in */ IDeckLinkTimecode* timecode) = 0; + virtual HRESULT SetTimecodeFromComponents (/* in */ BMDTimecodeFormat format, /* in */ uint8_t hours, /* in */ uint8_t minutes, /* in */ uint8_t seconds, /* in */ uint8_t frames, /* in */ BMDTimecodeFlags flags) = 0; + virtual HRESULT SetAncillaryData (/* in */ IDeckLinkVideoFrameAncillary* ancillary) = 0; + virtual HRESULT SetTimecodeUserBits (/* in */ BMDTimecodeFormat format, /* in */ BMDTimecodeUserBits userBits) = 0; + +protected: + virtual ~IDeckLinkMutableVideoFrame () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoFrame3DExtensions - Optional interface implemented on IDeckLinkVideoFrame to support 3D frames */ + +class BMD_PUBLIC IDeckLinkVideoFrame3DExtensions : public IUnknown +{ +public: + virtual BMDVideo3DPackingFormat Get3DPackingFormat (void) = 0; + virtual HRESULT GetFrameForRightEye (/* out */ IDeckLinkVideoFrame** rightEyeFrame) = 0; + +protected: + virtual ~IDeckLinkVideoFrame3DExtensions () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoFrameMetadataExtensions - Optional interface implemented on IDeckLinkVideoFrame to support frame metadata such as HDR information */ + +class BMD_PUBLIC IDeckLinkVideoFrameMetadataExtensions : public IUnknown +{ +public: + virtual HRESULT GetInt (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ int64_t* value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ double* value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ bool* value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ CFStringRef* value) = 0; + virtual HRESULT GetBytes (/* in */ BMDDeckLinkFrameMetadataID metadataID, /* out */ void* buffer /* optional */, /* in, out */ uint32_t* bufferSize) = 0; + +protected: + virtual ~IDeckLinkVideoFrameMetadataExtensions () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */ + +class BMD_PUBLIC IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame +{ +public: + virtual HRESULT GetStreamTime (/* out */ BMDTimeValue* frameTime, /* out */ BMDTimeValue* frameDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue* frameTime, /* out */ BMDTimeValue* frameDuration) = 0; + +protected: + virtual ~IDeckLinkVideoInputFrame () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkAncillaryPacket - On output, user needs to implement this interface */ + +class BMD_PUBLIC IDeckLinkAncillaryPacket : public IUnknown +{ +public: + virtual HRESULT GetBytes (/* in */ BMDAncillaryPacketFormat format /* For output, only one format need be offered */, /* out */ const void** data /* Optional */, /* out */ uint32_t* size /* Optional */) = 0; + virtual uint8_t GetDID (void) = 0; + virtual uint8_t GetSDID (void) = 0; + virtual uint32_t GetLineNumber (void) = 0; // On output, zero is auto + virtual uint8_t GetDataStreamIndex (void) = 0; // Usually zero. Can only be 1 if non-SD and the first data stream is completely full + +protected: + virtual ~IDeckLinkAncillaryPacket () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkAncillaryPacketIterator - Enumerates ancillary packets */ + +class BMD_PUBLIC IDeckLinkAncillaryPacketIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLinkAncillaryPacket** packet) = 0; + +protected: + virtual ~IDeckLinkAncillaryPacketIterator () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoFrameAncillaryPackets - Obtained through QueryInterface on an IDeckLinkVideoFrame object. */ + +class BMD_PUBLIC IDeckLinkVideoFrameAncillaryPackets : public IUnknown +{ +public: + virtual HRESULT GetPacketIterator (/* out */ IDeckLinkAncillaryPacketIterator** iterator) = 0; + virtual HRESULT GetFirstPacketByID (/* in */ uint8_t DID, /* in */ uint8_t SDID, /* out */ IDeckLinkAncillaryPacket** packet) = 0; + virtual HRESULT AttachPacket (/* in */ IDeckLinkAncillaryPacket* packet) = 0; // Implement IDeckLinkAncillaryPacket to output your own + virtual HRESULT DetachPacket (/* in */ IDeckLinkAncillaryPacket* packet) = 0; + virtual HRESULT DetachAllPackets (void) = 0; + +protected: + virtual ~IDeckLinkVideoFrameAncillaryPackets () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoFrameAncillary - Use of IDeckLinkVideoFrameAncillaryPackets is preferred. Obtained through QueryInterface on an IDeckLinkVideoFrame object. */ + +class BMD_PUBLIC IDeckLinkVideoFrameAncillary : public IUnknown +{ +public: + virtual HRESULT GetBufferForVerticalBlankingLine (/* in */ uint32_t lineNumber, /* out */ void** buffer) = 0; // Pixels/rowbytes is same as display mode, except for above HD where it's 1920 pixels for UHD modes and 2048 pixels for DCI modes + virtual BMDPixelFormat GetPixelFormat (void) = 0; + virtual BMDDisplayMode GetDisplayMode (void) = 0; + +protected: + virtual ~IDeckLinkVideoFrameAncillary () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkEncoderPacket - Interface to encapsulate an encoded packet. */ + +class BMD_PUBLIC IDeckLinkEncoderPacket : public IUnknown +{ +public: + virtual HRESULT GetBytes (/* out */ void** buffer) = 0; + virtual long GetSize (void) = 0; + virtual HRESULT GetStreamTime (/* out */ BMDTimeValue* frameTime, /* in */ BMDTimeScale timeScale) = 0; + virtual BMDPacketType GetPacketType (void) = 0; + +protected: + virtual ~IDeckLinkEncoderPacket () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkEncoderVideoPacket - Provided by the IDeckLinkEncoderInput video packet arrival callback. */ + +class BMD_PUBLIC IDeckLinkEncoderVideoPacket : public IDeckLinkEncoderPacket +{ +public: + virtual BMDPixelFormat GetPixelFormat (void) = 0; + virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue* frameTime, /* out */ BMDTimeValue* frameDuration) = 0; + virtual HRESULT GetTimecode (/* in */ BMDTimecodeFormat format, /* out */ IDeckLinkTimecode** timecode) = 0; + +protected: + virtual ~IDeckLinkEncoderVideoPacket () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkEncoderAudioPacket - Provided by the IDeckLinkEncoderInput audio packet arrival callback. */ + +class BMD_PUBLIC IDeckLinkEncoderAudioPacket : public IDeckLinkEncoderPacket +{ +public: + virtual BMDAudioFormat GetAudioFormat (void) = 0; + +protected: + virtual ~IDeckLinkEncoderAudioPacket () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkH265NALPacket - Obtained through QueryInterface on an IDeckLinkEncoderVideoPacket object */ + +class BMD_PUBLIC IDeckLinkH265NALPacket : public IDeckLinkEncoderVideoPacket +{ +public: + virtual HRESULT GetUnitType (/* out */ uint8_t* unitType) = 0; + virtual HRESULT GetBytesNoPrefix (/* out */ void** buffer) = 0; + virtual long GetSizeNoPrefix (void) = 0; + +protected: + virtual ~IDeckLinkH265NALPacket () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkAudioInputPacket - Provided by the IDeckLinkInput callback. */ + +class BMD_PUBLIC IDeckLinkAudioInputPacket : public IUnknown +{ +public: + virtual long GetSampleFrameCount (void) = 0; + virtual HRESULT GetBytes (/* out */ void** buffer) = 0; + virtual HRESULT GetPacketTime (/* out */ BMDTimeValue* packetTime, /* in */ BMDTimeScale timeScale) = 0; + +protected: + virtual ~IDeckLinkAudioInputPacket () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */ + +class BMD_PUBLIC IDeckLinkScreenPreviewCallback : public IUnknown +{ +public: + virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame* theFrame) = 0; + +protected: + virtual ~IDeckLinkScreenPreviewCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkCocoaScreenPreviewCallback - Screen preview callback for Cocoa-based applications. Created with CreateCocoaScreenPreview */ + +class BMD_PUBLIC IDeckLinkCocoaScreenPreviewCallback : public IDeckLinkScreenPreviewCallback +{ +public: + +protected: + virtual ~IDeckLinkCocoaScreenPreviewCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance on platforms with native COM support or from CreateOpenGLScreenPreviewHelper/CreateOpenGL3ScreenPreviewHelper on other platforms. */ + +class BMD_PUBLIC IDeckLinkGLScreenPreviewHelper : public IUnknown +{ +public: + + /* Methods must be called with OpenGL context set */ + + virtual HRESULT InitializeGL (void) = 0; + virtual HRESULT PaintGL (void) = 0; + virtual HRESULT SetFrame (/* in */ IDeckLinkVideoFrame* theFrame) = 0; + virtual HRESULT Set3DPreviewFormat (/* in */ BMD3DPreviewFormat previewFormat) = 0; + +protected: + virtual ~IDeckLinkGLScreenPreviewHelper () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkMetalScreenPreviewHelper - Created with CreateMetalScreenPreviewHelper(). */ + +class BMD_PUBLIC IDeckLinkMetalScreenPreviewHelper : public IUnknown +{ +public: + virtual HRESULT Initialize (/* in */ void* device) = 0; + virtual HRESULT Draw (/* in */ void* cmdBuffer, /* in */ void* renderPassDescriptor, /* in */ void* viewport) = 0; + virtual HRESULT SetFrame (/* in */ IDeckLinkVideoFrame* theFrame) = 0; + virtual HRESULT Set3DPreviewFormat (/* in */ BMD3DPreviewFormat previewFormat) = 0; + +protected: + virtual ~IDeckLinkMetalScreenPreviewHelper () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkNotificationCallback - DeckLink Notification Callback Interface */ + +class BMD_PUBLIC IDeckLinkNotificationCallback : public IUnknown +{ +public: + virtual HRESULT Notify (/* in */ BMDNotifications topic, /* in */ uint64_t param1, /* in */ uint64_t param2) = 0; +}; + +/* Interface IDeckLinkNotification - DeckLink Notification interface */ + +class BMD_PUBLIC IDeckLinkNotification : public IUnknown +{ +public: + virtual HRESULT Subscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback* theCallback) = 0; + virtual HRESULT Unsubscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback* theCallback) = 0; + +protected: + virtual ~IDeckLinkNotification () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkProfileAttributes - Created by QueryInterface from an IDeckLinkProfile, or from IDeckLink. When queried from IDeckLink, interrogates the active profile */ + +class BMD_PUBLIC IDeckLinkProfileAttributes : public IUnknown +{ +public: + virtual HRESULT GetFlag (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ bool* value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ int64_t* value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ double* value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ CFStringRef* value) = 0; + +protected: + virtual ~IDeckLinkProfileAttributes () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkProfileIterator - Enumerates IDeckLinkProfile interfaces */ + +class BMD_PUBLIC IDeckLinkProfileIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLinkProfile** profile) = 0; + +protected: + virtual ~IDeckLinkProfileIterator () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkProfile - Represents the active profile when queried from IDeckLink */ + +class BMD_PUBLIC IDeckLinkProfile : public IUnknown +{ +public: + virtual HRESULT GetDevice (/* out */ IDeckLink** device) = 0; // Device affected when this profile becomes active + virtual HRESULT IsActive (/* out */ bool* isActive) = 0; + virtual HRESULT SetActive (void) = 0; // Activating a profile will also change the profile on all devices enumerated by GetPeers. Activation is not complete until IDeckLinkProfileCallback::ProfileActivated is called + virtual HRESULT GetPeers (/* out */ IDeckLinkProfileIterator** profileIterator) = 0; // Profiles of other devices activated with this profile + +protected: + virtual ~IDeckLinkProfile () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkProfileCallback - Receive notifications about profiles related to this device */ + +class BMD_PUBLIC IDeckLinkProfileCallback : public IUnknown +{ +public: + virtual HRESULT ProfileChanging (/* in */ IDeckLinkProfile* profileToBeActivated, /* in */ bool streamsWillBeForcedToStop) = 0; // Called before this device changes profile. User has an opportunity for teardown if streamsWillBeForcedToStop + virtual HRESULT ProfileActivated (/* in */ IDeckLinkProfile* activatedProfile) = 0; // Called after this device has been activated with a new profile + +protected: + virtual ~IDeckLinkProfileCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkProfileManager - Created by QueryInterface from IDeckLink when a device has multiple optional profiles */ + +class BMD_PUBLIC IDeckLinkProfileManager : public IUnknown +{ +public: + virtual HRESULT GetProfiles (/* out */ IDeckLinkProfileIterator** profileIterator) = 0; // All available profiles for this device + virtual HRESULT GetProfile (/* in */ BMDProfileID profileID, /* out */ IDeckLinkProfile** profile) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkProfileCallback* callback) = 0; + +protected: + virtual ~IDeckLinkProfileManager () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkStatus - DeckLink Status interface */ + +class BMD_PUBLIC IDeckLinkStatus : public IUnknown +{ +public: + virtual HRESULT GetFlag (/* in */ BMDDeckLinkStatusID statusID, /* out */ bool* value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkStatusID statusID, /* out */ int64_t* value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkStatusID statusID, /* out */ double* value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkStatusID statusID, /* out */ CFStringRef* value) = 0; + virtual HRESULT GetBytes (/* in */ BMDDeckLinkStatusID statusID, /* out */ void* buffer, /* in, out */ uint32_t* bufferSize) = 0; + +protected: + virtual ~IDeckLinkStatus () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkKeyer - DeckLink Keyer interface */ + +class BMD_PUBLIC IDeckLinkKeyer : public IUnknown +{ +public: + virtual HRESULT Enable (/* in */ bool isExternal) = 0; + virtual HRESULT SetLevel (/* in */ uint8_t level) = 0; + virtual HRESULT RampUp (/* in */ uint32_t numberOfFrames) = 0; + virtual HRESULT RampDown (/* in */ uint32_t numberOfFrames) = 0; + virtual HRESULT Disable (void) = 0; + +protected: + virtual ~IDeckLinkKeyer () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoConversion - Created with CoCreateInstance. */ + +class BMD_PUBLIC IDeckLinkVideoConversion : public IUnknown +{ +public: + virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame* srcFrame, /* in */ IDeckLinkVideoFrame* dstFrame) = 0; + +protected: + virtual ~IDeckLinkVideoConversion () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkDeviceNotificationCallback - DeckLink device arrival/removal notification callbacks */ + +class BMD_PUBLIC IDeckLinkDeviceNotificationCallback : public IUnknown +{ +public: + virtual HRESULT DeckLinkDeviceArrived (/* in */ IDeckLink* deckLinkDevice) = 0; + virtual HRESULT DeckLinkDeviceRemoved (/* in */ IDeckLink* deckLinkDevice) = 0; + +protected: + virtual ~IDeckLinkDeviceNotificationCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkDiscovery - DeckLink device discovery */ + +class BMD_PUBLIC IDeckLinkDiscovery : public IUnknown +{ +public: + virtual HRESULT InstallDeviceNotifications (/* in */ IDeckLinkDeviceNotificationCallback* deviceNotificationCallback) = 0; + virtual HRESULT UninstallDeviceNotifications (void) = 0; + +protected: + virtual ~IDeckLinkDiscovery () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + BMD_PUBLIC IDeckLinkIterator* CreateDeckLinkIteratorInstance(void); + BMD_PUBLIC IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance(void); + BMD_PUBLIC IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance(void); + BMD_PUBLIC IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper(void); + BMD_PUBLIC IDeckLinkGLScreenPreviewHelper* CreateOpenGL3ScreenPreviewHelper(void); // Requires OpenGL 3.2 support and provides improved performance and color handling + BMD_PUBLIC IDeckLinkCocoaScreenPreviewCallback* CreateCocoaScreenPreview(/* in */ void* /* (NSView*)*/ parentView); + BMD_PUBLIC IDeckLinkMetalScreenPreviewHelper* CreateMetalScreenPreviewHelper(void); + BMD_PUBLIC IDeckLinkVideoConversion* CreateVideoConversionInstance(void); + BMD_PUBLIC IDeckLinkVideoFrameAncillaryPackets* CreateVideoFrameAncillaryPacketsInstance(void); // For use when creating a custom IDeckLinkVideoFrame without wrapping IDeckLinkOutput::CreateVideoFrame + +} + + + +#endif /* defined(__cplusplus) */ +#endif /* defined(BMD_DECKLINKAPI_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration.h b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration.h new file mode 100644 index 00000000..9f2a1453 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration.h @@ -0,0 +1,269 @@ +/* -LICENSE-START- +** Copyright (c) 2022 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPICONFIGURATION_H +#define BMD_DECKLINKAPICONFIGURATION_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +#ifndef BMD_PUBLIC + #define BMD_PUBLIC +#endif + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkConfiguration = /* 912F634B-2D4E-40A4-8AAB-8D80B73F1289 */ { 0x91,0x2F,0x63,0x4B,0x2D,0x4E,0x40,0xA4,0x8A,0xAB,0x8D,0x80,0xB7,0x3F,0x12,0x89 }; +BMD_CONST REFIID IID_IDeckLinkEncoderConfiguration = /* 138050E5-C60A-4552-BF3F-0F358049327E */ { 0x13,0x80,0x50,0xE5,0xC6,0x0A,0x45,0x52,0xBF,0x3F,0x0F,0x35,0x80,0x49,0x32,0x7E }; + +/* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */ + +typedef uint32_t BMDDeckLinkConfigurationID; +enum _BMDDeckLinkConfigurationID { + + /* Serial port Flags */ + + bmdDeckLinkConfigSwapSerialRxTx = /* 'ssrt' */ 0x73737274, + + /* Video Input/Output Integers */ + + bmdDeckLinkConfigHDMI3DPackingFormat = /* '3dpf' */ 0x33647066, + bmdDeckLinkConfigBypass = /* 'byps' */ 0x62797073, + bmdDeckLinkConfigClockTimingAdjustment = /* 'ctad' */ 0x63746164, + + /* Audio Input/Output Flags */ + + bmdDeckLinkConfigAnalogAudioConsumerLevels = /* 'aacl' */ 0x6161636C, + bmdDeckLinkConfigSwapHDMICh3AndCh4OnInput = /* 'hi34' */ 0x68693334, + bmdDeckLinkConfigSwapHDMICh3AndCh4OnOutput = /* 'ho34' */ 0x686F3334, + + /* Video Output Flags */ + + bmdDeckLinkConfigFieldFlickerRemoval = /* 'fdfr' */ 0x66646672, + bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion = /* 'to59' */ 0x746F3539, + bmdDeckLinkConfig444SDIVideoOutput = /* '444o' */ 0x3434346F, + bmdDeckLinkConfigBlackVideoOutputDuringCapture = /* 'bvoc' */ 0x62766F63, + bmdDeckLinkConfigLowLatencyVideoOutput = /* 'llvo' */ 0x6C6C766F, + bmdDeckLinkConfigDownConversionOnAllAnalogOutput = /* 'caao' */ 0x6361616F, + bmdDeckLinkConfigSMPTELevelAOutput = /* 'smta' */ 0x736D7461, + bmdDeckLinkConfigRec2020Output = /* 'rec2' */ 0x72656332, // Ensure output is Rec.2020 colorspace + bmdDeckLinkConfigQuadLinkSDIVideoOutputSquareDivisionSplit = /* 'SDQS' */ 0x53445153, + bmdDeckLinkConfigOutput1080pAsPsF = /* 'pfpr' */ 0x70667072, + + /* Video Output Integers */ + + bmdDeckLinkConfigVideoOutputConnection = /* 'vocn' */ 0x766F636E, + bmdDeckLinkConfigVideoOutputConversionMode = /* 'vocm' */ 0x766F636D, + bmdDeckLinkConfigAnalogVideoOutputFlags = /* 'avof' */ 0x61766F66, + bmdDeckLinkConfigReferenceInputTimingOffset = /* 'glot' */ 0x676C6F74, + bmdDeckLinkConfigVideoOutputIdleOperation = /* 'voio' */ 0x766F696F, + bmdDeckLinkConfigDefaultVideoOutputMode = /* 'dvom' */ 0x64766F6D, + bmdDeckLinkConfigDefaultVideoOutputModeFlags = /* 'dvof' */ 0x64766F66, + bmdDeckLinkConfigSDIOutputLinkConfiguration = /* 'solc' */ 0x736F6C63, + bmdDeckLinkConfigHDMITimecodePacking = /* 'htpk' */ 0x6874706B, + bmdDeckLinkConfigPlaybackGroup = /* 'plgr' */ 0x706C6772, + + /* Video Output Floats */ + + bmdDeckLinkConfigVideoOutputComponentLumaGain = /* 'oclg' */ 0x6F636C67, + bmdDeckLinkConfigVideoOutputComponentChromaBlueGain = /* 'occb' */ 0x6F636362, + bmdDeckLinkConfigVideoOutputComponentChromaRedGain = /* 'occr' */ 0x6F636372, + bmdDeckLinkConfigVideoOutputCompositeLumaGain = /* 'oilg' */ 0x6F696C67, + bmdDeckLinkConfigVideoOutputCompositeChromaGain = /* 'oicg' */ 0x6F696367, + bmdDeckLinkConfigVideoOutputSVideoLumaGain = /* 'oslg' */ 0x6F736C67, + bmdDeckLinkConfigVideoOutputSVideoChromaGain = /* 'oscg' */ 0x6F736367, + + /* Video Input Flags */ + + bmdDeckLinkConfigVideoInputScanning = /* 'visc' */ 0x76697363, // Applicable to H264 Pro Recorder only + bmdDeckLinkConfigUseDedicatedLTCInput = /* 'dltc' */ 0x646C7463, // Use timecode from LTC input instead of SDI stream + bmdDeckLinkConfigSDIInput3DPayloadOverride = /* '3dds' */ 0x33646473, + bmdDeckLinkConfigCapture1080pAsPsF = /* 'cfpr' */ 0x63667072, + + /* Video Input Integers */ + + bmdDeckLinkConfigVideoInputConnection = /* 'vicn' */ 0x7669636E, + bmdDeckLinkConfigAnalogVideoInputFlags = /* 'avif' */ 0x61766966, + bmdDeckLinkConfigVideoInputConversionMode = /* 'vicm' */ 0x7669636D, + bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame = /* 'pdif' */ 0x70646966, + bmdDeckLinkConfigVANCSourceLine1Mapping = /* 'vsl1' */ 0x76736C31, + bmdDeckLinkConfigVANCSourceLine2Mapping = /* 'vsl2' */ 0x76736C32, + bmdDeckLinkConfigVANCSourceLine3Mapping = /* 'vsl3' */ 0x76736C33, + bmdDeckLinkConfigCapturePassThroughMode = /* 'cptm' */ 0x6370746D, + bmdDeckLinkConfigCaptureGroup = /* 'cpgr' */ 0x63706772, + + /* Video Input Floats */ + + bmdDeckLinkConfigVideoInputComponentLumaGain = /* 'iclg' */ 0x69636C67, + bmdDeckLinkConfigVideoInputComponentChromaBlueGain = /* 'iccb' */ 0x69636362, + bmdDeckLinkConfigVideoInputComponentChromaRedGain = /* 'iccr' */ 0x69636372, + bmdDeckLinkConfigVideoInputCompositeLumaGain = /* 'iilg' */ 0x69696C67, + bmdDeckLinkConfigVideoInputCompositeChromaGain = /* 'iicg' */ 0x69696367, + bmdDeckLinkConfigVideoInputSVideoLumaGain = /* 'islg' */ 0x69736C67, + bmdDeckLinkConfigVideoInputSVideoChromaGain = /* 'iscg' */ 0x69736367, + + /* Keying Integers */ + + bmdDeckLinkConfigInternalKeyingAncillaryDataSource = /* 'ikas' */ 0x696B6173, + + /* Audio Input Flags */ + + bmdDeckLinkConfigMicrophonePhantomPower = /* 'mphp' */ 0x6D706870, + + /* Audio Input Integers */ + + bmdDeckLinkConfigAudioInputConnection = /* 'aicn' */ 0x6169636E, + + /* Audio Input Floats */ + + bmdDeckLinkConfigAnalogAudioInputScaleChannel1 = /* 'ais1' */ 0x61697331, + bmdDeckLinkConfigAnalogAudioInputScaleChannel2 = /* 'ais2' */ 0x61697332, + bmdDeckLinkConfigAnalogAudioInputScaleChannel3 = /* 'ais3' */ 0x61697333, + bmdDeckLinkConfigAnalogAudioInputScaleChannel4 = /* 'ais4' */ 0x61697334, + bmdDeckLinkConfigDigitalAudioInputScale = /* 'dais' */ 0x64616973, + bmdDeckLinkConfigMicrophoneInputGain = /* 'micg' */ 0x6D696367, + + /* Audio Output Integers */ + + bmdDeckLinkConfigAudioOutputAESAnalogSwitch = /* 'aoaa' */ 0x616F6161, + + /* Audio Output Floats */ + + bmdDeckLinkConfigAnalogAudioOutputScaleChannel1 = /* 'aos1' */ 0x616F7331, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel2 = /* 'aos2' */ 0x616F7332, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel3 = /* 'aos3' */ 0x616F7333, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel4 = /* 'aos4' */ 0x616F7334, + bmdDeckLinkConfigDigitalAudioOutputScale = /* 'daos' */ 0x64616F73, + bmdDeckLinkConfigHeadphoneVolume = /* 'hvol' */ 0x68766F6C, + + /* Device Information Strings */ + + bmdDeckLinkConfigDeviceInformationLabel = /* 'dila' */ 0x64696C61, + bmdDeckLinkConfigDeviceInformationSerialNumber = /* 'disn' */ 0x6469736E, + bmdDeckLinkConfigDeviceInformationCompany = /* 'dico' */ 0x6469636F, + bmdDeckLinkConfigDeviceInformationPhone = /* 'diph' */ 0x64697068, + bmdDeckLinkConfigDeviceInformationEmail = /* 'diem' */ 0x6469656D, + bmdDeckLinkConfigDeviceInformationDate = /* 'dida' */ 0x64696461, + + /* Deck Control Integers */ + + bmdDeckLinkConfigDeckControlConnection = /* 'dcco' */ 0x6463636F +}; + +/* Enum BMDDeckLinkEncoderConfigurationID - DeckLink Encoder Configuration ID */ + +typedef uint32_t BMDDeckLinkEncoderConfigurationID; +enum _BMDDeckLinkEncoderConfigurationID { + + /* Video Encoder Integers */ + + bmdDeckLinkEncoderConfigPreferredBitDepth = /* 'epbr' */ 0x65706272, + bmdDeckLinkEncoderConfigFrameCodingMode = /* 'efcm' */ 0x6566636D, + + /* HEVC/H.265 Encoder Integers */ + + bmdDeckLinkEncoderConfigH265TargetBitrate = /* 'htbr' */ 0x68746272, + + /* DNxHR/DNxHD Compression ID */ + + bmdDeckLinkEncoderConfigDNxHRCompressionID = /* 'dcid' */ 0x64636964, + + /* DNxHR/DNxHD Level */ + + bmdDeckLinkEncoderConfigDNxHRLevel = /* 'dlev' */ 0x646C6576, + + /* Encoded Sample Decriptions */ + + bmdDeckLinkEncoderConfigMPEG4SampleDescription = /* 'stsE' */ 0x73747345, // Full MPEG4 sample description (aka SampleEntry of an 'stsd' atom-box). Useful for MediaFoundation, QuickTime, MKV and more + bmdDeckLinkEncoderConfigMPEG4CodecSpecificDesc = /* 'esds' */ 0x65736473 // Sample description extensions only (atom stream, each with size and fourCC header). Useful for AVFoundation, VideoToolbox, MKV and more +}; + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLinkConfiguration; +class IDeckLinkEncoderConfiguration; + +/* Interface IDeckLinkConfiguration - DeckLink Configuration interface */ + +class BMD_PUBLIC IDeckLinkConfiguration : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool* value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t* value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double* value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ CFStringRef value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ CFStringRef* value) = 0; + virtual HRESULT WriteConfigurationToPreferences (void) = 0; + +protected: + virtual ~IDeckLinkConfiguration () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkEncoderConfiguration - DeckLink Encoder Configuration interface. Obtained from IDeckLinkEncoderInput */ + +class BMD_PUBLIC IDeckLinkEncoderConfiguration : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ bool* value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ int64_t* value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ double* value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* in */ CFStringRef value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ CFStringRef* value) = 0; + virtual HRESULT GetBytes (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ void* buffer /* optional */, /* in, out */ uint32_t* bufferSize) = 0; + +protected: + virtual ~IDeckLinkEncoderConfiguration () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + + +#endif /* defined(__cplusplus) */ +#endif /* defined(BMD_DECKLINKAPICONFIGURATION_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_11.h b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_11.h new file mode 100644 index 00000000..ea19f8db --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_11.h @@ -0,0 +1,84 @@ +/* -LICENSE-START- +** Copyright (c) 2017 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPICONFIGURATION_v10_11_H +#define BMD_DECKLINKAPICONFIGURATION_v10_11_H + +#include "DeckLinkAPIConfiguration.h" + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkConfiguration_v10_11 = /* EF90380B-4AE5-4346-9077-E288E149F129 */ {0xEF,0x90,0x38,0x0B,0x4A,0xE5,0x43,0x46,0x90,0x77,0xE2,0x88,0xE1,0x49,0xF1,0x29}; + +/* Enum BMDDeckLinkConfigurationID_v10_11 - DeckLink Configuration ID */ + +typedef uint32_t BMDDeckLinkConfigurationID_v10_11; +enum _BMDDeckLinkConfigurationID_v10_11 { + + /* Video Input/Output Integers */ + + bmdDeckLinkConfigDuplexMode_v10_11 = 'dupx', +}; + +// Forward Declarations + +class IDeckLinkConfiguration_v10_11; + +/* Interface IDeckLinkConfiguration_v10_11 - DeckLink Configuration interface */ + +class IDeckLinkConfiguration_v10_11 : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ CFStringRef value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ CFStringRef *value) = 0; + virtual HRESULT WriteConfigurationToPreferences (void) = 0; + +protected: + virtual ~IDeckLinkConfiguration_v10_11 () {} // call Release method to drop reference count +}; + + +#endif /* defined(BMD_DECKLINKAPICONFIGURATION_v10_11_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_2.h b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_2.h new file mode 100644 index 00000000..b0e0dbc9 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_2.h @@ -0,0 +1,73 @@ +/* -LICENSE-START- +** Copyright (c) 2014 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPICONFIGURATION_v10_2_H +#define BMD_DECKLINKAPICONFIGURATION_v10_2_H + +#include "DeckLinkAPIConfiguration.h" + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkConfiguration_v10_2 = /* C679A35B-610C-4D09-B748-1D0478100FC0 */ {0xC6,0x79,0xA3,0x5B,0x61,0x0C,0x4D,0x09,0xB7,0x48,0x1D,0x04,0x78,0x10,0x0F,0xC0}; + +// Forward Declarations + +class IDeckLinkConfiguration_v10_2; + +/* Interface IDeckLinkConfiguration_v10_2 - DeckLink Configuration interface */ + +class IDeckLinkConfiguration_v10_2 : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ CFStringRef value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ CFStringRef *value) = 0; + virtual HRESULT WriteConfigurationToPreferences (void) = 0; + +protected: + virtual ~IDeckLinkConfiguration_v10_2 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPICONFIGURATION_v10_2_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_4.h b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_4.h new file mode 100644 index 00000000..7d3215de --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_4.h @@ -0,0 +1,75 @@ +/* -LICENSE-START- +** Copyright (c) 2015 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPICONFIGURATION_v10_4_H +#define BMD_DECKLINKAPICONFIGURATION_v10_4_H + +#include "DeckLinkAPIConfiguration.h" + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkConfiguration_v10_4 = /* 1E69FCF6-4203-4936-8076-2A9F4CFD50CB */ {0x1E,0x69,0xFC,0xF6,0x42,0x03,0x49,0x36,0x80,0x76,0x2A,0x9F,0x4C,0xFD,0x50,0xCB}; + +// +// Forward Declarations + +class IDeckLinkConfiguration_v10_4; + +/* Interface IDeckLinkConfiguration_v10_4 - DeckLink Configuration interface */ + +class IDeckLinkConfiguration_v10_4 : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ CFStringRef value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ CFStringRef *value) = 0; + virtual HRESULT WriteConfigurationToPreferences (void) = 0; + +protected: + virtual ~IDeckLinkConfiguration_v10_4 () {} // call Release method to drop reference count +}; + + +#endif /* defined(BMD_DECKLINKAPICONFIGURATION_v10_4_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_5.h b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_5.h new file mode 100644 index 00000000..b67572d4 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_5.h @@ -0,0 +1,73 @@ +/* -LICENSE-START- +** Copyright (c) 2015 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPICONFIGURATION_v10_5_H +#define BMD_DECKLINKAPICONFIGURATION_v10_5_H + +#include "DeckLinkAPIConfiguration.h" + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkEncoderConfiguration_v10_5 = /* 67455668-0848-45DF-8D8E-350A77C9A028 */ {0x67,0x45,0x56,0x68,0x08,0x48,0x45,0xDF,0x8D,0x8E,0x35,0x0A,0x77,0xC9,0xA0,0x28}; + +// Forward Declarations + +class IDeckLinkConfiguration_v10_5; + +/* Interface IDeckLinkEncoderConfiguration_v10_5 - DeckLink Encoder Configuration interface. Obtained from IDeckLinkEncoderInput */ + +class IDeckLinkEncoderConfiguration_v10_5 : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ double *value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* in */ CFStringRef value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkEncoderConfigurationID cfgID, /* out */ CFStringRef *value) = 0; + virtual HRESULT GetDecoderConfigurationInfo (/* out */ void *buffer, /* in */ long bufferSize, /* out */ long *returnedSize) = 0; + +protected: + virtual ~IDeckLinkEncoderConfiguration_v10_5 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPICONFIGURATION_v10_5_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_9.h b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_9.h new file mode 100644 index 00000000..04a6a45c --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIConfiguration_v10_9.h @@ -0,0 +1,75 @@ +/* -LICENSE-START- +** Copyright (c) 2017 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPICONFIGURATION_v10_9_H +#define BMD_DECKLINKAPICONFIGURATION_v10_9_H + +#include "DeckLinkAPIConfiguration.h" + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkConfiguration_v10_9 = /* CB71734A-FE37-4E8D-8E13-802133A1C3F2 */ {0xCB,0x71,0x73,0x4A,0xFE,0x37,0x4E,0x8D,0x8E,0x13,0x80,0x21,0x33,0xA1,0xC3,0xF2}; + +// +// Forward Declarations + +class IDeckLinkConfiguration_v10_9; + +/* Interface IDeckLinkConfiguration_v10_9 - DeckLink Configuration interface */ + +class IDeckLinkConfiguration_v10_9 : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ CFStringRef value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ CFStringRef *value) = 0; + virtual HRESULT WriteConfigurationToPreferences (void) = 0; + +protected: + virtual ~IDeckLinkConfiguration_v10_9 () {} // call Release method to drop reference count +}; + + +#endif /* defined(BMD_DECKLINKAPICONFIGURATION_v10_9_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIDeckControl.h b/DeckLinkSDK/Mac/include/DeckLinkAPIDeckControl.h new file mode 100644 index 00000000..f946af20 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIDeckControl.h @@ -0,0 +1,223 @@ +/* -LICENSE-START- +** Copyright (c) 2022 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIDECKCONTROL_H +#define BMD_DECKLINKAPIDECKCONTROL_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +#ifndef BMD_PUBLIC + #define BMD_PUBLIC +#endif + +// Type Declarations + + +// Interface ID Declarations + +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 }; +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 }; + +/* Enum BMDDeckControlMode - DeckControl mode */ + +typedef uint32_t BMDDeckControlMode; +enum _BMDDeckControlMode { + bmdDeckControlNotOpened = /* 'ntop' */ 0x6E746F70, + bmdDeckControlVTRControlMode = /* 'vtrc' */ 0x76747263, + bmdDeckControlExportMode = /* 'expm' */ 0x6578706D, + bmdDeckControlCaptureMode = /* 'capm' */ 0x6361706D +}; + +/* Enum BMDDeckControlEvent - DeckControl event */ + +typedef uint32_t BMDDeckControlEvent; +enum _BMDDeckControlEvent { + bmdDeckControlAbortedEvent = /* 'abte' */ 0x61627465, // This event is triggered when a capture or edit-to-tape operation is aborted. + + /* Export-To-Tape events */ + + bmdDeckControlPrepareForExportEvent = /* 'pfee' */ 0x70666565, // This event is triggered a few frames before reaching the in-point. IDeckLinkInput::StartScheduledPlayback should be called at this point. + bmdDeckControlExportCompleteEvent = /* 'exce' */ 0x65786365, // This event is triggered a few frames after reaching the out-point. At this point, it is safe to stop playback. Upon reception of this event the deck's control mode is set back to bmdDeckControlVTRControlMode. + + /* Capture events */ + + bmdDeckControlPrepareForCaptureEvent = /* 'pfce' */ 0x70666365, // This event is triggered a few frames before reaching the in-point. The serial timecode attached to IDeckLinkVideoInputFrames is now valid. + bmdDeckControlCaptureCompleteEvent = /* 'ccev' */ 0x63636576 // This event is triggered a few frames after reaching the out-point. Upon reception of this event the deck's control mode is set back to bmdDeckControlVTRControlMode. +}; + +/* Enum BMDDeckControlVTRControlState - VTR Control state */ + +typedef uint32_t BMDDeckControlVTRControlState; +enum _BMDDeckControlVTRControlState { + bmdDeckControlNotInVTRControlMode = /* 'nvcm' */ 0x6E76636D, + bmdDeckControlVTRControlPlaying = /* 'vtrp' */ 0x76747270, + bmdDeckControlVTRControlRecording = /* 'vtrr' */ 0x76747272, + bmdDeckControlVTRControlStill = /* 'vtra' */ 0x76747261, + bmdDeckControlVTRControlShuttleForward = /* 'vtsf' */ 0x76747366, + bmdDeckControlVTRControlShuttleReverse = /* 'vtsr' */ 0x76747372, + bmdDeckControlVTRControlJogForward = /* 'vtjf' */ 0x76746A66, + bmdDeckControlVTRControlJogReverse = /* 'vtjr' */ 0x76746A72, + bmdDeckControlVTRControlStopped = /* 'vtro' */ 0x7674726F +}; + +/* Enum BMDDeckControlStatusFlags - Deck Control status flags */ + +typedef uint32_t BMDDeckControlStatusFlags; +enum _BMDDeckControlStatusFlags { + bmdDeckControlStatusDeckConnected = 1 << 0, + bmdDeckControlStatusRemoteMode = 1 << 1, + bmdDeckControlStatusRecordInhibited = 1 << 2, + bmdDeckControlStatusCassetteOut = 1 << 3 +}; + +/* Enum BMDDeckControlExportModeOpsFlags - Export mode flags */ + +typedef uint32_t BMDDeckControlExportModeOpsFlags; +enum _BMDDeckControlExportModeOpsFlags { + bmdDeckControlExportModeInsertVideo = 1 << 0, + bmdDeckControlExportModeInsertAudio1 = 1 << 1, + bmdDeckControlExportModeInsertAudio2 = 1 << 2, + bmdDeckControlExportModeInsertAudio3 = 1 << 3, + bmdDeckControlExportModeInsertAudio4 = 1 << 4, + bmdDeckControlExportModeInsertAudio5 = 1 << 5, + bmdDeckControlExportModeInsertAudio6 = 1 << 6, + bmdDeckControlExportModeInsertAudio7 = 1 << 7, + bmdDeckControlExportModeInsertAudio8 = 1 << 8, + bmdDeckControlExportModeInsertAudio9 = 1 << 9, + bmdDeckControlExportModeInsertAudio10 = 1 << 10, + bmdDeckControlExportModeInsertAudio11 = 1 << 11, + bmdDeckControlExportModeInsertAudio12 = 1 << 12, + bmdDeckControlExportModeInsertTimeCode = 1 << 13, + bmdDeckControlExportModeInsertAssemble = 1 << 14, + bmdDeckControlExportModeInsertPreview = 1 << 15, + bmdDeckControlUseManualExport = 1 << 16 +}; + +/* Enum BMDDeckControlError - Deck Control error */ + +typedef uint32_t BMDDeckControlError; +enum _BMDDeckControlError { + bmdDeckControlNoError = /* 'noer' */ 0x6E6F6572, + bmdDeckControlModeError = /* 'moer' */ 0x6D6F6572, + bmdDeckControlMissedInPointError = /* 'mier' */ 0x6D696572, + bmdDeckControlDeckTimeoutError = /* 'dter' */ 0x64746572, + bmdDeckControlCommandFailedError = /* 'cfer' */ 0x63666572, + bmdDeckControlDeviceAlreadyOpenedError = /* 'dalo' */ 0x64616C6F, + bmdDeckControlFailedToOpenDeviceError = /* 'fder' */ 0x66646572, + bmdDeckControlInLocalModeError = /* 'lmer' */ 0x6C6D6572, + bmdDeckControlEndOfTapeError = /* 'eter' */ 0x65746572, + bmdDeckControlUserAbortError = /* 'uaer' */ 0x75616572, + bmdDeckControlNoTapeInDeckError = /* 'nter' */ 0x6E746572, + bmdDeckControlNoVideoFromCardError = /* 'nvfc' */ 0x6E766663, + bmdDeckControlNoCommunicationError = /* 'ncom' */ 0x6E636F6D, + bmdDeckControlBufferTooSmallError = /* 'btsm' */ 0x6274736D, + bmdDeckControlBadChecksumError = /* 'chks' */ 0x63686B73, + bmdDeckControlUnknownError = /* 'uner' */ 0x756E6572 +}; + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLinkDeckControlStatusCallback; +class IDeckLinkDeckControl; + +/* Interface IDeckLinkDeckControlStatusCallback - Deck control state change callback. */ + +class BMD_PUBLIC IDeckLinkDeckControlStatusCallback : public IUnknown +{ +public: + virtual HRESULT TimecodeUpdate (/* in */ BMDTimecodeBCD currentTimecode) = 0; + virtual HRESULT VTRControlStateChanged (/* in */ BMDDeckControlVTRControlState newState, /* in */ BMDDeckControlError error) = 0; + virtual HRESULT DeckControlEventReceived (/* in */ BMDDeckControlEvent event, /* in */ BMDDeckControlError error) = 0; + virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0; + +protected: + virtual ~IDeckLinkDeckControlStatusCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkDeckControl - Deck Control main interface */ + +class BMD_PUBLIC IDeckLinkDeckControl : public IUnknown +{ +public: + virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT Close (/* in */ bool standbyOn) = 0; + virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode* mode, /* out */ BMDDeckControlVTRControlState* vtrControlState, /* out */ BMDDeckControlStatusFlags* flags) = 0; + virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0; + 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; + virtual HRESULT Play (/* out */ BMDDeckControlError* error) = 0; + virtual HRESULT Stop (/* out */ BMDDeckControlError* error) = 0; + virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError* error) = 0; + virtual HRESULT Eject (/* out */ BMDDeckControlError* error) = 0; + virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT StepForward (/* out */ BMDDeckControlError* error) = 0; + virtual HRESULT StepBack (/* out */ BMDDeckControlError* error) = 0; + virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT GetTimecodeString (/* out */ CFStringRef* currentTimeCode, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode** currentTimecode, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD* currentTimecode, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0; + virtual HRESULT GetPreroll (/* out */ uint32_t* prerollSeconds) = 0; + virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0; + virtual HRESULT GetExportOffset (/* out */ int32_t* exportOffsetFields) = 0; + virtual HRESULT GetManualExportOffset (/* out */ int32_t* deckManualExportOffsetFields) = 0; + virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0; + virtual HRESULT GetCaptureOffset (/* out */ int32_t* captureOffsetFields) = 0; + virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT GetDeviceID (/* out */ uint16_t* deviceId, /* out */ BMDDeckControlError* error) = 0; + virtual HRESULT Abort (void) = 0; + virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError* error) = 0; + virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError* error) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback* callback) = 0; + +protected: + virtual ~IDeckLinkDeckControl () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + + +#endif /* defined(__cplusplus) */ +#endif /* defined(BMD_DECKLINKAPIDECKCONTROL_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIDiscovery.h b/DeckLinkSDK/Mac/include/DeckLinkAPIDiscovery.h new file mode 100644 index 00000000..d0ac6ddf --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIDiscovery.h @@ -0,0 +1,79 @@ +/* -LICENSE-START- +** Copyright (c) 2022 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIDISCOVERY_H +#define BMD_DECKLINKAPIDISCOVERY_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +#ifndef BMD_PUBLIC + #define BMD_PUBLIC +#endif + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLink = /* C418FBDD-0587-48ED-8FE5-640F0A14AF91 */ { 0xC4,0x18,0xFB,0xDD,0x05,0x87,0x48,0xED,0x8F,0xE5,0x64,0x0F,0x0A,0x14,0xAF,0x91 }; + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLink; + +/* Interface IDeckLink - Represents a DeckLink device */ + +class BMD_PUBLIC IDeckLink : public IUnknown +{ +public: + virtual HRESULT GetModelName (/* out */ CFStringRef* modelName) = 0; + virtual HRESULT GetDisplayName (/* out */ CFStringRef* displayName) = 0; + +protected: + virtual ~IDeckLink () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + + +#endif /* defined(__cplusplus) */ +#endif /* defined(BMD_DECKLINKAPIDISCOVERY_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch.cpp b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch.cpp new file mode 100644 index 00000000..abb03ac2 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch.cpp @@ -0,0 +1,245 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ +/* DeckLinkAPIDispatch.cpp */ + +#include "DeckLinkAPI.h" +#include + +#if BLACKMAGIC_DECKLINK_API_MAGIC != 1 + #error The DeckLink API version of DeckLinkAPIDispatch.cpp is not the same version as DeckLinkAPI.h +#endif + +#define kDeckLinkAPI_BundlePath "/Library/Frameworks/DeckLinkAPI.framework" + + +typedef IDeckLinkIterator* (*CreateIteratorFunc)(void); +typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void); +typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void); +typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGL3ScreenPreviewHelperFunc)(void); +typedef IDeckLinkMetalScreenPreviewHelper* (*CreateMetalScreenPreviewHelperFunc)(void); +typedef IDeckLinkCocoaScreenPreviewCallback* (*CreateCocoaScreenPreviewFunc)(void*); +typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void); +typedef IDeckLinkDiscovery* (*CreateDeckLinkDiscoveryInstanceFunc)(void); +typedef IDeckLinkVideoFrameAncillaryPackets* (*CreateVideoFrameAncillaryPacketsInstanceFunc)(void); + +static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT; +static CFBundleRef gDeckLinkAPIBundleRef = NULL; +static CreateIteratorFunc gCreateIteratorFunc = NULL; +static CreateAPIInformationFunc gCreateAPIInformationFunc = NULL; +static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL; +static CreateOpenGL3ScreenPreviewHelperFunc gCreateOpenGL3PreviewFunc = NULL; +static CreateMetalScreenPreviewHelperFunc gCreateMetalPreviewFunc = NULL; +static CreateCocoaScreenPreviewFunc gCreateCocoaPreviewFunc = NULL; +static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL; +static CreateDeckLinkDiscoveryInstanceFunc gCreateDeckLinkDiscoveryFunc= NULL; +static CreateVideoFrameAncillaryPacketsInstanceFunc gCreateVideoFrameAncillaryPacketsFunc = NULL; + + +static void InitDeckLinkAPI (void) +{ + CFURLRef bundleURL; + + bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kDeckLinkAPI_BundlePath), kCFURLPOSIXPathStyle, true); + if (bundleURL != NULL) + { + gDeckLinkAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); + if (gDeckLinkAPIBundleRef != NULL) + { + gCreateIteratorFunc = (CreateIteratorFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkIteratorInstance_0004")); + gCreateAPIInformationFunc = (CreateAPIInformationFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkAPIInformationInstance_0001")); + gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateOpenGLScreenPreviewHelper_0001")); + gCreateOpenGL3PreviewFunc = (CreateOpenGL3ScreenPreviewHelperFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateOpenGL3ScreenPreviewHelper_0001")); + gCreateMetalPreviewFunc = (CreateMetalScreenPreviewHelperFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateMetalScreenPreviewHelper_0001")); + gCreateCocoaPreviewFunc = (CreateCocoaScreenPreviewFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateCocoaScreenPreview_0001")); + gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateVideoConversionInstance_0001")); + gCreateDeckLinkDiscoveryFunc = (CreateDeckLinkDiscoveryInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkDiscoveryInstance_0003")); + gCreateVideoFrameAncillaryPacketsFunc = (CreateVideoFrameAncillaryPacketsInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateVideoFrameAncillaryPacketsInstance_0001")); + } + CFRelease(bundleURL); + } +} + +bool IsDeckLinkAPIPresent (void) +{ + // If the DeckLink API bundle was successfully loaded, return this knowledge to the caller + if (gDeckLinkAPIBundleRef != NULL) + return true; + + return false; +} + +IDeckLinkIterator* CreateDeckLinkIteratorInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateIteratorFunc == NULL) + return NULL; + + return gCreateIteratorFunc(); +} + +IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateAPIInformationFunc == NULL) + return NULL; + + return gCreateAPIInformationFunc(); +} + +IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateOpenGLPreviewFunc == NULL) + return NULL; + + return gCreateOpenGLPreviewFunc(); +} + +IDeckLinkGLScreenPreviewHelper* CreateOpenGL3ScreenPreviewHelper (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateOpenGL3PreviewFunc == NULL) + return NULL; + + return gCreateOpenGL3PreviewFunc(); +} + +IDeckLinkMetalScreenPreviewHelper* CreateMetalScreenPreviewHelper (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateMetalPreviewFunc == NULL) + return NULL; + + return gCreateMetalPreviewFunc(); +} + +IDeckLinkCocoaScreenPreviewCallback* CreateCocoaScreenPreview (void* parentView) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateCocoaPreviewFunc == NULL) + return NULL; + + return gCreateCocoaPreviewFunc(parentView); +} + +IDeckLinkVideoConversion* CreateVideoConversionInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateVideoConversionFunc == NULL) + return NULL; + + return gCreateVideoConversionFunc(); +} + +IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateDeckLinkDiscoveryFunc == NULL) + return NULL; + + return gCreateDeckLinkDiscoveryFunc(); +} + +IDeckLinkVideoFrameAncillaryPackets* CreateVideoFrameAncillaryPacketsInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateVideoFrameAncillaryPacketsFunc == NULL) + return NULL; + + return gCreateVideoFrameAncillaryPacketsFunc(); +} + + +#define kBMDStreamingAPI_BundlePath "/Library/Application Support/Blackmagic Design/Streaming/BMDStreamingAPI.bundle" + +typedef IBMDStreamingDiscovery* (*CreateDiscoveryFunc)(void); +typedef IBMDStreamingH264NALParser* (*CreateNALParserFunc)(void); + +static pthread_once_t gBMDStreamingOnceControl = PTHREAD_ONCE_INIT; +static CFBundleRef gBMDStreamingAPIBundleRef = NULL; +static CreateDiscoveryFunc gCreateDiscoveryFunc = NULL; +static CreateNALParserFunc gCreateNALParserFunc = NULL; + +static void InitBMDStreamingAPI(void) +{ + CFURLRef bundleURL; + + bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kBMDStreamingAPI_BundlePath), kCFURLPOSIXPathStyle, true); + if (bundleURL != NULL) + { + gBMDStreamingAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); + if (gBMDStreamingAPIBundleRef != NULL) + { + gCreateDiscoveryFunc = (CreateDiscoveryFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingDiscoveryInstance_0002")); + gCreateNALParserFunc = (CreateNALParserFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingH264NALParser_0001")); + } + + CFRelease(bundleURL); + } +} + +IBMDStreamingDiscovery* CreateBMDStreamingDiscoveryInstance() +{ + pthread_once(&gBMDStreamingOnceControl, InitBMDStreamingAPI); + + if (gCreateDiscoveryFunc == NULL) + return NULL; + + return gCreateDiscoveryFunc(); +} + +IBMDStreamingH264NALParser* CreateBMDStreamingH264NALParser() +{ + pthread_once(&gBMDStreamingOnceControl, InitBMDStreamingAPI); + + if (gCreateNALParserFunc == NULL) + return NULL; + + return gCreateNALParserFunc(); +} diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v10_11.cpp b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v10_11.cpp new file mode 100644 index 00000000..b7afbeb4 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v10_11.cpp @@ -0,0 +1,219 @@ +/* -LICENSE-START- +** Copyright (c) 2019 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ +/* DeckLinkAPIDispatch.cpp */ + +#include "DeckLinkAPI_v10_11.h" +#include + +#if BLACKMAGIC_DECKLINK_API_MAGIC != 1 + #error The DeckLink API version of DeckLinkAPIDispatch.cpp is not the same version as DeckLinkAPI.h +#endif + +#define kDeckLinkAPI_BundlePath "/Library/Frameworks/DeckLinkAPI.framework" + + +typedef IDeckLinkIterator* (*CreateIteratorFunc)(void); +typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void); +typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void); +typedef IDeckLinkCocoaScreenPreviewCallback* (*CreateCocoaScreenPreviewFunc)(void*); +typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void); +typedef IDeckLinkDiscovery* (*CreateDeckLinkDiscoveryInstanceFunc)(void); +typedef IDeckLinkVideoFrameAncillaryPackets* (*CreateVideoFrameAncillaryPacketsInstanceFunc)(void); + +static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT; +static CFBundleRef gDeckLinkAPIBundleRef = NULL; +static CreateIteratorFunc gCreateIteratorFunc = NULL; +static CreateAPIInformationFunc gCreateAPIInformationFunc = NULL; +static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL; +static CreateCocoaScreenPreviewFunc gCreateCocoaPreviewFunc = NULL; +static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL; +static CreateDeckLinkDiscoveryInstanceFunc gCreateDeckLinkDiscoveryFunc= NULL; +static CreateVideoFrameAncillaryPacketsInstanceFunc gCreateVideoFrameAncillaryPacketsFunc = NULL; + + +static void InitDeckLinkAPI (void) +{ + CFURLRef bundleURL; + + bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kDeckLinkAPI_BundlePath), kCFURLPOSIXPathStyle, true); + if (bundleURL != NULL) + { + gDeckLinkAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); + if (gDeckLinkAPIBundleRef != NULL) + { + gCreateIteratorFunc = (CreateIteratorFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkIteratorInstance_0003")); + gCreateAPIInformationFunc = (CreateAPIInformationFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkAPIInformationInstance_0001")); + gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateOpenGLScreenPreviewHelper_0001")); + gCreateCocoaPreviewFunc = (CreateCocoaScreenPreviewFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateCocoaScreenPreview_0001")); + gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateVideoConversionInstance_0001")); + gCreateDeckLinkDiscoveryFunc = (CreateDeckLinkDiscoveryInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkDiscoveryInstance_0002")); + gCreateVideoFrameAncillaryPacketsFunc = (CreateVideoFrameAncillaryPacketsInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateVideoFrameAncillaryPacketsInstance_0001")); + } + CFRelease(bundleURL); + } +} + +bool IsDeckLinkAPIPresent_v10_11 (void) +{ + // If the DeckLink API bundle was successfully loaded, return this knowledge to the caller + if (gDeckLinkAPIBundleRef != NULL) + return true; + + return false; +} + +IDeckLinkIterator* CreateDeckLinkIteratorInstance_v10_11 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateIteratorFunc == NULL) + return NULL; + + return gCreateIteratorFunc(); +} + +IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance_v10_11 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateAPIInformationFunc == NULL) + return NULL; + + return gCreateAPIInformationFunc(); +} + +IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper_v10_11 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateOpenGLPreviewFunc == NULL) + return NULL; + + return gCreateOpenGLPreviewFunc(); +} + +IDeckLinkCocoaScreenPreviewCallback* CreateCocoaScreenPreview_v10_11 (void* parentView) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateCocoaPreviewFunc == NULL) + return NULL; + + return gCreateCocoaPreviewFunc(parentView); +} + +IDeckLinkVideoConversion* CreateVideoConversionInstance_v10_11 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateVideoConversionFunc == NULL) + return NULL; + + return gCreateVideoConversionFunc(); +} + +IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance_v10_11 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateDeckLinkDiscoveryFunc == NULL) + return NULL; + + return gCreateDeckLinkDiscoveryFunc(); +} + +IDeckLinkVideoFrameAncillaryPackets* CreateVideoFrameAncillaryPacketsInstance_v10_11 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateVideoFrameAncillaryPacketsFunc == NULL) + return NULL; + + return gCreateVideoFrameAncillaryPacketsFunc(); +} + + +#define kBMDStreamingAPI_BundlePath "/Library/Application Support/Blackmagic Design/Streaming/BMDStreamingAPI.bundle" + +typedef IBMDStreamingDiscovery* (*CreateDiscoveryFunc)(void); +typedef IBMDStreamingH264NALParser* (*CreateNALParserFunc)(void); + +static pthread_once_t gBMDStreamingOnceControl = PTHREAD_ONCE_INIT; +static CFBundleRef gBMDStreamingAPIBundleRef = NULL; +static CreateDiscoveryFunc gCreateDiscoveryFunc = NULL; +static CreateNALParserFunc gCreateNALParserFunc = NULL; + +static void InitBMDStreamingAPI(void) +{ + CFURLRef bundleURL; + + bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kBMDStreamingAPI_BundlePath), kCFURLPOSIXPathStyle, true); + if (bundleURL != NULL) + { + gBMDStreamingAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); + if (gBMDStreamingAPIBundleRef != NULL) + { + gCreateDiscoveryFunc = (CreateDiscoveryFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingDiscoveryInstance_0002")); + gCreateNALParserFunc = (CreateNALParserFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingH264NALParser_0001")); + } + + CFRelease(bundleURL); + } +} + +IBMDStreamingDiscovery* CreateBMDStreamingDiscoveryInstance_v10_11() +{ + pthread_once(&gBMDStreamingOnceControl, InitBMDStreamingAPI); + + if (gCreateDiscoveryFunc == NULL) + return NULL; + + return gCreateDiscoveryFunc(); +} + +IBMDStreamingH264NALParser* CreateBMDStreamingH264NALParser_v10_11() +{ + pthread_once(&gBMDStreamingOnceControl, InitBMDStreamingAPI); + + if (gCreateNALParserFunc == NULL) + return NULL; + + return gCreateNALParserFunc(); +} diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v10_8.cpp b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v10_8.cpp new file mode 100644 index 00000000..2da795ad --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v10_8.cpp @@ -0,0 +1,206 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ +/* DeckLinkAPIDispatch.cpp */ + +#include "DeckLinkAPI.h" +#include + +#if BLACKMAGIC_DECKLINK_API_MAGIC != 1 +#error The DeckLink API version of DeckLinkAPIDispatch.cpp is not the same version as DeckLinkAPI.h +#endif + +#define kDeckLinkAPI_BundlePath "/Library/Frameworks/DeckLinkAPI.framework" + + +typedef IDeckLinkIterator* (*CreateIteratorFunc)(void); +typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void); +typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void); +typedef IDeckLinkCocoaScreenPreviewCallback* (*CreateCocoaScreenPreviewFunc)(void*); +typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void); +typedef IDeckLinkDiscovery* (*CreateDeckLinkDiscoveryInstanceFunc)(void); + +static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT; +static CFBundleRef gDeckLinkAPIBundleRef = NULL; +static CreateIteratorFunc gCreateIteratorFunc = NULL; +static CreateAPIInformationFunc gCreateAPIInformationFunc = NULL; +static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL; +static CreateCocoaScreenPreviewFunc gCreateCocoaPreviewFunc = NULL; +static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL; +static CreateDeckLinkDiscoveryInstanceFunc gCreateDeckLinkDiscoveryFunc = NULL; + + +static void InitDeckLinkAPI(void) +{ + CFURLRef bundleURL; + + bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kDeckLinkAPI_BundlePath), kCFURLPOSIXPathStyle, true); + if (bundleURL != NULL) + { + gDeckLinkAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); + if (gDeckLinkAPIBundleRef != NULL) + { + gCreateIteratorFunc = (CreateIteratorFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkIteratorInstance_0002")); + gCreateAPIInformationFunc = (CreateAPIInformationFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkAPIInformationInstance_0001")); + gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateOpenGLScreenPreviewHelper_0001")); + gCreateCocoaPreviewFunc = (CreateCocoaScreenPreviewFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateCocoaScreenPreview_0001")); + gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateVideoConversionInstance_0001")); + gCreateDeckLinkDiscoveryFunc = (CreateDeckLinkDiscoveryInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkDiscoveryInstance_0001")); + } + CFRelease(bundleURL); + } +} + +bool IsDeckLinkAPIPresent(void) +{ + // If the DeckLink API bundle was successfully loaded, return this knowledge to the caller + if (gDeckLinkAPIBundleRef != NULL) + return true; + + return false; +} + +IDeckLinkIterator* CreateDeckLinkIteratorInstance(void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateIteratorFunc == NULL) + return NULL; + + return gCreateIteratorFunc(); +} + +IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance(void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateAPIInformationFunc == NULL) + return NULL; + + return gCreateAPIInformationFunc(); +} + +IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper(void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateOpenGLPreviewFunc == NULL) + return NULL; + + return gCreateOpenGLPreviewFunc(); +} + +IDeckLinkCocoaScreenPreviewCallback* CreateCocoaScreenPreview(void* parentView) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateCocoaPreviewFunc == NULL) + return NULL; + + return gCreateCocoaPreviewFunc(parentView); +} + +IDeckLinkVideoConversion* CreateVideoConversionInstance(void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateVideoConversionFunc == NULL) + return NULL; + + return gCreateVideoConversionFunc(); +} + +IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance(void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateDeckLinkDiscoveryFunc == NULL) + return NULL; + + return gCreateDeckLinkDiscoveryFunc(); +} + + +#define kBMDStreamingAPI_BundlePath "/Library/Application Support/Blackmagic Design/Streaming/BMDStreamingAPI.bundle" + +typedef IBMDStreamingDiscovery* (*CreateDiscoveryFunc)(void); +typedef IBMDStreamingH264NALParser* (*CreateNALParserFunc)(void); + +static pthread_once_t gBMDStreamingOnceControl = PTHREAD_ONCE_INIT; +static CFBundleRef gBMDStreamingAPIBundleRef = NULL; +static CreateDiscoveryFunc gCreateDiscoveryFunc = NULL; +static CreateNALParserFunc gCreateNALParserFunc = NULL; + +static void InitBMDStreamingAPI(void) +{ + CFURLRef bundleURL; + + bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kBMDStreamingAPI_BundlePath), kCFURLPOSIXPathStyle, true); + if (bundleURL != NULL) + { + gBMDStreamingAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); + if (gBMDStreamingAPIBundleRef != NULL) + { + gCreateDiscoveryFunc = (CreateDiscoveryFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingDiscoveryInstance_0001")); + gCreateNALParserFunc = (CreateNALParserFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingH264NALParser_0001")); + } + + CFRelease(bundleURL); + } +} + +IBMDStreamingDiscovery* CreateBMDStreamingDiscoveryInstance() +{ + pthread_once(&gBMDStreamingOnceControl, InitBMDStreamingAPI); + + if (gCreateDiscoveryFunc == NULL) + return NULL; + + return gCreateDiscoveryFunc(); +} + +IBMDStreamingH264NALParser* CreateBMDStreamingH264NALParser() +{ + pthread_once(&gBMDStreamingOnceControl, InitBMDStreamingAPI); + + if (gCreateNALParserFunc == NULL) + return NULL; + + return gCreateNALParserFunc(); +} diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v7_6.cpp b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v7_6.cpp new file mode 100644 index 00000000..0ee2d73c --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v7_6.cpp @@ -0,0 +1,118 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ +/* DeckLinkAPIDispatch_v7_6.cpp */ + +#include "DeckLinkAPI_v7_6.h" +#include + +#define kDeckLinkAPI_BundlePath "/Library/Frameworks/DeckLinkAPI.framework" + +typedef IDeckLinkIterator* (*CreateIteratorFunc_v7_6)(void); +typedef IDeckLinkGLScreenPreviewHelper_v7_6* (*CreateOpenGLScreenPreviewHelperFunc_v7_6)(void); +typedef IDeckLinkCocoaScreenPreviewCallback_v7_6* (*CreateCocoaScreenPreviewFunc_v7_6)(void*); +typedef IDeckLinkVideoConversion_v7_6* (*CreateVideoConversionInstanceFunc_v7_6)(void); + +static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT; +static CFBundleRef gBundleRef = NULL; +static CreateIteratorFunc_v7_6 gCreateIteratorFunc = NULL; +static CreateOpenGLScreenPreviewHelperFunc_v7_6 gCreateOpenGLPreviewFunc = NULL; +static CreateCocoaScreenPreviewFunc_v7_6 gCreateCocoaPreviewFunc = NULL; +static CreateVideoConversionInstanceFunc_v7_6 gCreateVideoConversionFunc = NULL; + + +static void InitDeckLinkAPI_v7_6 (void) +{ + CFURLRef bundleURL; + + bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kDeckLinkAPI_BundlePath), kCFURLPOSIXPathStyle, true); + if (bundleURL != NULL) + { + gBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); + if (gBundleRef != NULL) + { + gCreateIteratorFunc = (CreateIteratorFunc_v7_6)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("CreateDeckLinkIteratorInstance")); + gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc_v7_6)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("CreateOpenGLScreenPreviewHelper")); + gCreateCocoaPreviewFunc = (CreateCocoaScreenPreviewFunc_v7_6)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("CreateCocoaScreenPreview")); + gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc_v7_6)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("CreateVideoConversionInstance")); + } + CFRelease(bundleURL); + } +} + +IDeckLinkIterator* CreateDeckLinkIteratorInstance_v7_6 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI_v7_6); + + if (gCreateIteratorFunc == NULL) + return NULL; + + return gCreateIteratorFunc(); +} + +IDeckLinkGLScreenPreviewHelper_v7_6* CreateOpenGLScreenPreviewHelper_v7_6 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI_v7_6); + + if (gCreateOpenGLPreviewFunc == NULL) + return NULL; + + return gCreateOpenGLPreviewFunc(); +} + +IDeckLinkCocoaScreenPreviewCallback_v7_6* CreateCocoaScreenPreview_v7_6 (void* parentView) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI_v7_6); + + if (gCreateCocoaPreviewFunc == NULL) + return NULL; + + return gCreateCocoaPreviewFunc(parentView); +} + +IDeckLinkVideoConversion_v7_6* CreateVideoConversionInstance_v7_6 (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI_v7_6); + + if (gCreateVideoConversionFunc == NULL) + return NULL; + + return gCreateVideoConversionFunc(); +} + diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v8_0.cpp b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v8_0.cpp new file mode 100644 index 00000000..af16c219 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIDispatch_v8_0.cpp @@ -0,0 +1,144 @@ +/* -LICENSE-START- +** Copyright (c) 2011 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ +/* DeckLinkAPIDispatch.cpp */ + +#include "DeckLinkAPI_v8_0.h" +#include + +#if BLACKMAGIC_DECKLINK_API_MAGIC != 1 + #error The DeckLink API version of DeckLinkAPIDispatch.cpp is not the same version as DeckLinkAPI.h +#endif + +#define kDeckLinkAPI_BundlePath "/Library/Frameworks/DeckLinkAPI.framework" + +typedef IDeckLinkIterator_v8_0* (*CreateIteratorFunc)(void); +typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void); +typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void); +typedef IDeckLinkCocoaScreenPreviewCallback* (*CreateCocoaScreenPreviewFunc)(void*); +typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void); + +static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT; +static CFBundleRef gDeckLinkAPIBundleRef = NULL; +static CreateIteratorFunc gCreateIteratorFunc = NULL; +static CreateAPIInformationFunc gCreateAPIInformationFunc = NULL; +static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL; +static CreateCocoaScreenPreviewFunc gCreateCocoaPreviewFunc = NULL; +static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL; + + +static void InitDeckLinkAPI (void) +{ + CFURLRef bundleURL; + + bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kDeckLinkAPI_BundlePath), kCFURLPOSIXPathStyle, true); + if (bundleURL != NULL) + { + gDeckLinkAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); + if (gDeckLinkAPIBundleRef != NULL) + { + gCreateIteratorFunc = (CreateIteratorFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkIteratorInstance_0001")); + gCreateAPIInformationFunc = (CreateAPIInformationFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkAPIInformationInstance_0001")); + gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateOpenGLScreenPreviewHelper_0001")); + gCreateCocoaPreviewFunc = (CreateCocoaScreenPreviewFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateCocoaScreenPreview_0001")); + gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateVideoConversionInstance_0001")); + } + CFRelease(bundleURL); + } +} + +bool IsDeckLinkAPIPresent (void) +{ + // If the DeckLink API bundle was successfully loaded, return this knowledge to the caller + if (gDeckLinkAPIBundleRef != NULL) + return true; + + return false; +} + +IDeckLinkIterator_v8_0* CreateDeckLinkIteratorInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateIteratorFunc == NULL) + return NULL; + + return gCreateIteratorFunc(); +} + +IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateAPIInformationFunc == NULL) + return NULL; + + return gCreateAPIInformationFunc(); +} + +IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateOpenGLPreviewFunc == NULL) + return NULL; + + return gCreateOpenGLPreviewFunc(); +} + +IDeckLinkCocoaScreenPreviewCallback* CreateCocoaScreenPreview (void* parentView) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateCocoaPreviewFunc == NULL) + return NULL; + + return gCreateCocoaPreviewFunc(parentView); +} + +IDeckLinkVideoConversion* CreateVideoConversionInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateVideoConversionFunc == NULL) + return NULL; + + return gCreateVideoConversionFunc(); +} + diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIModes.h b/DeckLinkSDK/Mac/include/DeckLinkAPIModes.h new file mode 100644 index 00000000..4b0fb1ae --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIModes.h @@ -0,0 +1,289 @@ +/* -LICENSE-START- +** Copyright (c) 2022 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIMODES_H +#define BMD_DECKLINKAPIMODES_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +#ifndef BMD_PUBLIC + #define BMD_PUBLIC +#endif + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkDisplayModeIterator = /* 9C88499F-F601-4021-B80B-032E4EB41C35 */ { 0x9C,0x88,0x49,0x9F,0xF6,0x01,0x40,0x21,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35 }; +BMD_CONST REFIID IID_IDeckLinkDisplayMode = /* 3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78 */ { 0x3E,0xB2,0xC1,0xAB,0x0A,0x3D,0x45,0x23,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78 }; + +/* Enum BMDDisplayMode - BMDDisplayMode enumerates the video modes supported. */ + +typedef uint32_t BMDDisplayMode; +enum _BMDDisplayMode { + + /* SD Modes */ + + bmdModeNTSC = /* 'ntsc' */ 0x6E747363, + bmdModeNTSC2398 = /* 'nt23' */ 0x6E743233, // 3:2 pulldown + bmdModePAL = /* 'pal ' */ 0x70616C20, + bmdModeNTSCp = /* 'ntsp' */ 0x6E747370, + bmdModePALp = /* 'palp' */ 0x70616C70, + + /* HD 1080 Modes */ + + bmdModeHD1080p2398 = /* '23ps' */ 0x32337073, + bmdModeHD1080p24 = /* '24ps' */ 0x32347073, + bmdModeHD1080p25 = /* 'Hp25' */ 0x48703235, + bmdModeHD1080p2997 = /* 'Hp29' */ 0x48703239, + bmdModeHD1080p30 = /* 'Hp30' */ 0x48703330, + bmdModeHD1080p4795 = /* 'Hp47' */ 0x48703437, + bmdModeHD1080p48 = /* 'Hp48' */ 0x48703438, + bmdModeHD1080p50 = /* 'Hp50' */ 0x48703530, + bmdModeHD1080p5994 = /* 'Hp59' */ 0x48703539, + bmdModeHD1080p6000 = /* 'Hp60' */ 0x48703630, // N.B. This _really_ is 60.00 Hz. + bmdModeHD1080p9590 = /* 'Hp95' */ 0x48703935, + bmdModeHD1080p96 = /* 'Hp96' */ 0x48703936, + bmdModeHD1080p100 = /* 'Hp10' */ 0x48703130, + bmdModeHD1080p11988 = /* 'Hp11' */ 0x48703131, + bmdModeHD1080p120 = /* 'Hp12' */ 0x48703132, + bmdModeHD1080i50 = /* 'Hi50' */ 0x48693530, + bmdModeHD1080i5994 = /* 'Hi59' */ 0x48693539, + bmdModeHD1080i6000 = /* 'Hi60' */ 0x48693630, // N.B. This _really_ is 60.00 Hz. + + /* HD 720 Modes */ + + bmdModeHD720p50 = /* 'hp50' */ 0x68703530, + bmdModeHD720p5994 = /* 'hp59' */ 0x68703539, + bmdModeHD720p60 = /* 'hp60' */ 0x68703630, + + /* 2K Modes */ + + bmdMode2k2398 = /* '2k23' */ 0x326B3233, + bmdMode2k24 = /* '2k24' */ 0x326B3234, + bmdMode2k25 = /* '2k25' */ 0x326B3235, + + /* 2K DCI Modes */ + + bmdMode2kDCI2398 = /* '2d23' */ 0x32643233, + bmdMode2kDCI24 = /* '2d24' */ 0x32643234, + bmdMode2kDCI25 = /* '2d25' */ 0x32643235, + bmdMode2kDCI2997 = /* '2d29' */ 0x32643239, + bmdMode2kDCI30 = /* '2d30' */ 0x32643330, + bmdMode2kDCI4795 = /* '2d47' */ 0x32643437, + bmdMode2kDCI48 = /* '2d48' */ 0x32643438, + bmdMode2kDCI50 = /* '2d50' */ 0x32643530, + bmdMode2kDCI5994 = /* '2d59' */ 0x32643539, + bmdMode2kDCI60 = /* '2d60' */ 0x32643630, + bmdMode2kDCI9590 = /* '2d95' */ 0x32643935, + bmdMode2kDCI96 = /* '2d96' */ 0x32643936, + bmdMode2kDCI100 = /* '2d10' */ 0x32643130, + bmdMode2kDCI11988 = /* '2d11' */ 0x32643131, + bmdMode2kDCI120 = /* '2d12' */ 0x32643132, + + /* 4K UHD Modes */ + + bmdMode4K2160p2398 = /* '4k23' */ 0x346B3233, + bmdMode4K2160p24 = /* '4k24' */ 0x346B3234, + bmdMode4K2160p25 = /* '4k25' */ 0x346B3235, + bmdMode4K2160p2997 = /* '4k29' */ 0x346B3239, + bmdMode4K2160p30 = /* '4k30' */ 0x346B3330, + bmdMode4K2160p4795 = /* '4k47' */ 0x346B3437, + bmdMode4K2160p48 = /* '4k48' */ 0x346B3438, + bmdMode4K2160p50 = /* '4k50' */ 0x346B3530, + bmdMode4K2160p5994 = /* '4k59' */ 0x346B3539, + bmdMode4K2160p60 = /* '4k60' */ 0x346B3630, + bmdMode4K2160p9590 = /* '4k95' */ 0x346B3935, + bmdMode4K2160p96 = /* '4k96' */ 0x346B3936, + bmdMode4K2160p100 = /* '4k10' */ 0x346B3130, + bmdMode4K2160p11988 = /* '4k11' */ 0x346B3131, + bmdMode4K2160p120 = /* '4k12' */ 0x346B3132, + + /* 4K DCI Modes */ + + bmdMode4kDCI2398 = /* '4d23' */ 0x34643233, + bmdMode4kDCI24 = /* '4d24' */ 0x34643234, + bmdMode4kDCI25 = /* '4d25' */ 0x34643235, + bmdMode4kDCI2997 = /* '4d29' */ 0x34643239, + bmdMode4kDCI30 = /* '4d30' */ 0x34643330, + bmdMode4kDCI4795 = /* '4d47' */ 0x34643437, + bmdMode4kDCI48 = /* '4d48' */ 0x34643438, + bmdMode4kDCI50 = /* '4d50' */ 0x34643530, + bmdMode4kDCI5994 = /* '4d59' */ 0x34643539, + bmdMode4kDCI60 = /* '4d60' */ 0x34643630, + bmdMode4kDCI9590 = /* '4d95' */ 0x34643935, + bmdMode4kDCI96 = /* '4d96' */ 0x34643936, + bmdMode4kDCI100 = /* '4d10' */ 0x34643130, + bmdMode4kDCI11988 = /* '4d11' */ 0x34643131, + bmdMode4kDCI120 = /* '4d12' */ 0x34643132, + + /* 8K UHD Modes */ + + bmdMode8K4320p2398 = /* '8k23' */ 0x386B3233, + bmdMode8K4320p24 = /* '8k24' */ 0x386B3234, + bmdMode8K4320p25 = /* '8k25' */ 0x386B3235, + bmdMode8K4320p2997 = /* '8k29' */ 0x386B3239, + bmdMode8K4320p30 = /* '8k30' */ 0x386B3330, + bmdMode8K4320p4795 = /* '8k47' */ 0x386B3437, + bmdMode8K4320p48 = /* '8k48' */ 0x386B3438, + bmdMode8K4320p50 = /* '8k50' */ 0x386B3530, + bmdMode8K4320p5994 = /* '8k59' */ 0x386B3539, + bmdMode8K4320p60 = /* '8k60' */ 0x386B3630, + + /* 8K DCI Modes */ + + bmdMode8kDCI2398 = /* '8d23' */ 0x38643233, + bmdMode8kDCI24 = /* '8d24' */ 0x38643234, + bmdMode8kDCI25 = /* '8d25' */ 0x38643235, + bmdMode8kDCI2997 = /* '8d29' */ 0x38643239, + bmdMode8kDCI30 = /* '8d30' */ 0x38643330, + bmdMode8kDCI4795 = /* '8d47' */ 0x38643437, + bmdMode8kDCI48 = /* '8d48' */ 0x38643438, + bmdMode8kDCI50 = /* '8d50' */ 0x38643530, + bmdMode8kDCI5994 = /* '8d59' */ 0x38643539, + bmdMode8kDCI60 = /* '8d60' */ 0x38643630, + + /* PC Modes */ + + bmdMode640x480p60 = /* 'vga6' */ 0x76676136, + bmdMode800x600p60 = /* 'svg6' */ 0x73766736, + bmdMode1440x900p50 = /* 'wxg5' */ 0x77786735, + bmdMode1440x900p60 = /* 'wxg6' */ 0x77786736, + bmdMode1440x1080p50 = /* 'sxg5' */ 0x73786735, + bmdMode1440x1080p60 = /* 'sxg6' */ 0x73786736, + bmdMode1600x1200p50 = /* 'uxg5' */ 0x75786735, + bmdMode1600x1200p60 = /* 'uxg6' */ 0x75786736, + bmdMode1920x1200p50 = /* 'wux5' */ 0x77757835, + bmdMode1920x1200p60 = /* 'wux6' */ 0x77757836, + bmdMode1920x1440p50 = /* '1945' */ 0x31393435, + bmdMode1920x1440p60 = /* '1946' */ 0x31393436, + bmdMode2560x1440p50 = /* 'wqh5' */ 0x77716835, + bmdMode2560x1440p60 = /* 'wqh6' */ 0x77716836, + bmdMode2560x1600p50 = /* 'wqx5' */ 0x77717835, + bmdMode2560x1600p60 = /* 'wqx6' */ 0x77717836, + + /* Special Modes */ + + bmdModeUnknown = /* 'iunk' */ 0x69756E6B +}; + +/* Enum BMDFieldDominance - BMDFieldDominance enumerates settings applicable to video fields. */ + +typedef uint32_t BMDFieldDominance; +enum _BMDFieldDominance { + bmdUnknownFieldDominance = 0, + bmdLowerFieldFirst = /* 'lowr' */ 0x6C6F7772, + bmdUpperFieldFirst = /* 'uppr' */ 0x75707072, + bmdProgressiveFrame = /* 'prog' */ 0x70726F67, + bmdProgressiveSegmentedFrame = /* 'psf ' */ 0x70736620 +}; + +/* Enum BMDPixelFormat - Video pixel formats supported for output/input */ + +typedef uint32_t BMDPixelFormat; +enum _BMDPixelFormat { + bmdFormatUnspecified = 0, + bmdFormat8BitYUV = /* '2vuy' */ 0x32767579, + bmdFormat10BitYUV = /* 'v210' */ 0x76323130, + bmdFormat8BitARGB = 32, + bmdFormat8BitBGRA = /* 'BGRA' */ 0x42475241, + bmdFormat10BitRGB = /* 'r210' */ 0x72323130, // Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10 + bmdFormat12BitRGB = /* 'R12B' */ 0x52313242, // Big-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component + bmdFormat12BitRGBLE = /* 'R12L' */ 0x5231324C, // Little-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component + bmdFormat10BitRGBXLE = /* 'R10l' */ 0x5231306C, // Little-endian 10-bit RGB with SMPTE video levels (64-940) + bmdFormat10BitRGBX = /* 'R10b' */ 0x52313062, // Big-endian 10-bit RGB with SMPTE video levels (64-940) + bmdFormatH265 = /* 'hev1' */ 0x68657631, // High Efficiency Video Coding (HEVC/h.265) + + /* AVID DNxHR */ + + bmdFormatDNxHR = /* 'AVdh' */ 0x41566468 +}; + +/* Enum BMDDisplayModeFlags - Flags to describe the characteristics of an IDeckLinkDisplayMode. */ + +typedef uint32_t BMDDisplayModeFlags; +enum _BMDDisplayModeFlags { + bmdDisplayModeSupports3D = 1 << 0, + bmdDisplayModeColorspaceRec601 = 1 << 1, + bmdDisplayModeColorspaceRec709 = 1 << 2, + bmdDisplayModeColorspaceRec2020 = 1 << 3 +}; + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLinkDisplayModeIterator; +class IDeckLinkDisplayMode; + +/* Interface IDeckLinkDisplayModeIterator - Enumerates over supported input/output display modes. */ + +class BMD_PUBLIC IDeckLinkDisplayModeIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLinkDisplayMode** deckLinkDisplayMode) = 0; + +protected: + virtual ~IDeckLinkDisplayModeIterator () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkDisplayMode - Represents a display mode */ + +class BMD_PUBLIC IDeckLinkDisplayMode : public IUnknown +{ +public: + virtual HRESULT GetName (/* out */ CFStringRef* name) = 0; + virtual BMDDisplayMode GetDisplayMode (void) = 0; + virtual long GetWidth (void) = 0; + virtual long GetHeight (void) = 0; + virtual HRESULT GetFrameRate (/* out */ BMDTimeValue* frameDuration, /* out */ BMDTimeScale* timeScale) = 0; + virtual BMDFieldDominance GetFieldDominance (void) = 0; + virtual BMDDisplayModeFlags GetFlags (void) = 0; + +protected: + virtual ~IDeckLinkDisplayMode () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + + +#endif /* defined(__cplusplus) */ +#endif /* defined(BMD_DECKLINKAPIMODES_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIStreaming.h b/DeckLinkSDK/Mac/include/DeckLinkAPIStreaming.h new file mode 100644 index 00000000..5ef156e7 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIStreaming.h @@ -0,0 +1,383 @@ +/* -LICENSE-START- +** Copyright (c) 2022 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPISTREAMING_H +#define BMD_DECKLINKAPISTREAMING_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +#ifndef BMD_PUBLIC + #define BMD_PUBLIC +#endif + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IBMDStreamingDeviceNotificationCallback = /* F9531D64-3305-4B29-A387-7F74BB0D0E84 */ { 0xF9,0x53,0x1D,0x64,0x33,0x05,0x4B,0x29,0xA3,0x87,0x7F,0x74,0xBB,0x0D,0x0E,0x84 }; +BMD_CONST REFIID IID_IBMDStreamingH264InputCallback = /* 823C475F-55AE-46F9-890C-537CC5CEDCCA */ { 0x82,0x3C,0x47,0x5F,0x55,0xAE,0x46,0xF9,0x89,0x0C,0x53,0x7C,0xC5,0xCE,0xDC,0xCA }; +BMD_CONST REFIID IID_IBMDStreamingDiscovery = /* 2C837444-F989-4D87-901A-47C8A36D096D */ { 0x2C,0x83,0x74,0x44,0xF9,0x89,0x4D,0x87,0x90,0x1A,0x47,0xC8,0xA3,0x6D,0x09,0x6D }; +BMD_CONST REFIID IID_IBMDStreamingVideoEncodingMode = /* 1AB8035B-CD13-458D-B6DF-5E8F7C2141D9 */ { 0x1A,0xB8,0x03,0x5B,0xCD,0x13,0x45,0x8D,0xB6,0xDF,0x5E,0x8F,0x7C,0x21,0x41,0xD9 }; +BMD_CONST REFIID IID_IBMDStreamingMutableVideoEncodingMode = /* 19BF7D90-1E0A-400D-B2C6-FFC4E78AD49D */ { 0x19,0xBF,0x7D,0x90,0x1E,0x0A,0x40,0x0D,0xB2,0xC6,0xFF,0xC4,0xE7,0x8A,0xD4,0x9D }; +BMD_CONST REFIID IID_IBMDStreamingVideoEncodingModePresetIterator = /* 7AC731A3-C950-4AD0-804A-8377AA51C6C4 */ { 0x7A,0xC7,0x31,0xA3,0xC9,0x50,0x4A,0xD0,0x80,0x4A,0x83,0x77,0xAA,0x51,0xC6,0xC4 }; +BMD_CONST REFIID IID_IBMDStreamingDeviceInput = /* 24B6B6EC-1727-44BB-9818-34FF086ACF98 */ { 0x24,0xB6,0xB6,0xEC,0x17,0x27,0x44,0xBB,0x98,0x18,0x34,0xFF,0x08,0x6A,0xCF,0x98 }; +BMD_CONST REFIID IID_IBMDStreamingH264NALPacket = /* E260E955-14BE-4395-9775-9F02CC0A9D89 */ { 0xE2,0x60,0xE9,0x55,0x14,0xBE,0x43,0x95,0x97,0x75,0x9F,0x02,0xCC,0x0A,0x9D,0x89 }; +BMD_CONST REFIID IID_IBMDStreamingAudioPacket = /* D9EB5902-1AD2-43F4-9E2C-3CFA50B5EE19 */ { 0xD9,0xEB,0x59,0x02,0x1A,0xD2,0x43,0xF4,0x9E,0x2C,0x3C,0xFA,0x50,0xB5,0xEE,0x19 }; +BMD_CONST REFIID IID_IBMDStreamingMPEG2TSPacket = /* 91810D1C-4FB3-4AAA-AE56-FA301D3DFA4C */ { 0x91,0x81,0x0D,0x1C,0x4F,0xB3,0x4A,0xAA,0xAE,0x56,0xFA,0x30,0x1D,0x3D,0xFA,0x4C }; +BMD_CONST REFIID IID_IBMDStreamingH264NALParser = /* 5867F18C-5BFA-4CCC-B2A7-9DFD140417D2 */ { 0x58,0x67,0xF1,0x8C,0x5B,0xFA,0x4C,0xCC,0xB2,0xA7,0x9D,0xFD,0x14,0x04,0x17,0xD2 }; + +/* Enum BMDStreamingDeviceMode - Device modes */ + +typedef uint32_t BMDStreamingDeviceMode; +enum _BMDStreamingDeviceMode { + bmdStreamingDeviceIdle = /* 'idle' */ 0x69646C65, + bmdStreamingDeviceEncoding = /* 'enco' */ 0x656E636F, + bmdStreamingDeviceStopping = /* 'stop' */ 0x73746F70, + bmdStreamingDeviceUnknown = /* 'munk' */ 0x6D756E6B +}; + +/* Enum BMDStreamingEncodingFrameRate - Encoded frame rates */ + +typedef uint32_t BMDStreamingEncodingFrameRate; +enum _BMDStreamingEncodingFrameRate { + + /* Interlaced rates */ + + bmdStreamingEncodedFrameRate50i = /* 'e50i' */ 0x65353069, + bmdStreamingEncodedFrameRate5994i = /* 'e59i' */ 0x65353969, + bmdStreamingEncodedFrameRate60i = /* 'e60i' */ 0x65363069, + + /* Progressive rates */ + + bmdStreamingEncodedFrameRate2398p = /* 'e23p' */ 0x65323370, + bmdStreamingEncodedFrameRate24p = /* 'e24p' */ 0x65323470, + bmdStreamingEncodedFrameRate25p = /* 'e25p' */ 0x65323570, + bmdStreamingEncodedFrameRate2997p = /* 'e29p' */ 0x65323970, + bmdStreamingEncodedFrameRate30p = /* 'e30p' */ 0x65333070, + bmdStreamingEncodedFrameRate50p = /* 'e50p' */ 0x65353070, + bmdStreamingEncodedFrameRate5994p = /* 'e59p' */ 0x65353970, + bmdStreamingEncodedFrameRate60p = /* 'e60p' */ 0x65363070 +}; + +/* Enum BMDStreamingEncodingSupport - Output encoding mode supported flag */ + +typedef uint32_t BMDStreamingEncodingSupport; +enum _BMDStreamingEncodingSupport { + bmdStreamingEncodingModeNotSupported = 0, + bmdStreamingEncodingModeSupported, + bmdStreamingEncodingModeSupportedWithChanges +}; + +/* Enum BMDStreamingVideoCodec - Video codecs */ + +typedef uint32_t BMDStreamingVideoCodec; +enum _BMDStreamingVideoCodec { + bmdStreamingVideoCodecH264 = /* 'H264' */ 0x48323634 +}; + +/* Enum BMDStreamingH264Profile - H264 encoding profile */ + +typedef uint32_t BMDStreamingH264Profile; +enum _BMDStreamingH264Profile { + bmdStreamingH264ProfileHigh = /* 'high' */ 0x68696768, + bmdStreamingH264ProfileMain = /* 'main' */ 0x6D61696E, + bmdStreamingH264ProfileBaseline = /* 'base' */ 0x62617365 +}; + +/* Enum BMDStreamingH264Level - H264 encoding level */ + +typedef uint32_t BMDStreamingH264Level; +enum _BMDStreamingH264Level { + bmdStreamingH264Level12 = /* 'lv12' */ 0x6C763132, + bmdStreamingH264Level13 = /* 'lv13' */ 0x6C763133, + bmdStreamingH264Level2 = /* 'lv2 ' */ 0x6C763220, + bmdStreamingH264Level21 = /* 'lv21' */ 0x6C763231, + bmdStreamingH264Level22 = /* 'lv22' */ 0x6C763232, + bmdStreamingH264Level3 = /* 'lv3 ' */ 0x6C763320, + bmdStreamingH264Level31 = /* 'lv31' */ 0x6C763331, + bmdStreamingH264Level32 = /* 'lv32' */ 0x6C763332, + bmdStreamingH264Level4 = /* 'lv4 ' */ 0x6C763420, + bmdStreamingH264Level41 = /* 'lv41' */ 0x6C763431, + bmdStreamingH264Level42 = /* 'lv42' */ 0x6C763432 +}; + +/* Enum BMDStreamingH264EntropyCoding - H264 entropy coding */ + +typedef uint32_t BMDStreamingH264EntropyCoding; +enum _BMDStreamingH264EntropyCoding { + bmdStreamingH264EntropyCodingCAVLC = /* 'EVLC' */ 0x45564C43, + bmdStreamingH264EntropyCodingCABAC = /* 'EBAC' */ 0x45424143 +}; + +/* Enum BMDStreamingAudioCodec - Audio codecs */ + +typedef uint32_t BMDStreamingAudioCodec; +enum _BMDStreamingAudioCodec { + bmdStreamingAudioCodecAAC = /* 'AAC ' */ 0x41414320 +}; + +/* Enum BMDStreamingEncodingModePropertyID - Encoding mode properties */ + +typedef uint32_t BMDStreamingEncodingModePropertyID; +enum _BMDStreamingEncodingModePropertyID { + + /* Integers, Video Properties */ + + bmdStreamingEncodingPropertyVideoFrameRate = /* 'vfrt' */ 0x76667274, // Uses values of type BMDStreamingEncodingFrameRate + bmdStreamingEncodingPropertyVideoBitRateKbps = /* 'vbrt' */ 0x76627274, + + /* Integers, H264 Properties */ + + bmdStreamingEncodingPropertyH264Profile = /* 'hprf' */ 0x68707266, + bmdStreamingEncodingPropertyH264Level = /* 'hlvl' */ 0x686C766C, + bmdStreamingEncodingPropertyH264EntropyCoding = /* 'hent' */ 0x68656E74, + + /* Flags, H264 Properties */ + + bmdStreamingEncodingPropertyH264HasBFrames = /* 'hBfr' */ 0x68426672, + + /* Integers, Audio Properties */ + + bmdStreamingEncodingPropertyAudioCodec = /* 'acdc' */ 0x61636463, + bmdStreamingEncodingPropertyAudioSampleRate = /* 'asrt' */ 0x61737274, + bmdStreamingEncodingPropertyAudioChannelCount = /* 'achc' */ 0x61636863, + bmdStreamingEncodingPropertyAudioBitRateKbps = /* 'abrt' */ 0x61627274 +}; + +#if defined(__cplusplus) + +// Forward Declarations + +class IBMDStreamingDeviceNotificationCallback; +class IBMDStreamingH264InputCallback; +class IBMDStreamingDiscovery; +class IBMDStreamingVideoEncodingMode; +class IBMDStreamingMutableVideoEncodingMode; +class IBMDStreamingVideoEncodingModePresetIterator; +class IBMDStreamingDeviceInput; +class IBMDStreamingH264NALPacket; +class IBMDStreamingAudioPacket; +class IBMDStreamingMPEG2TSPacket; +class IBMDStreamingH264NALParser; + +/* Interface IBMDStreamingDeviceNotificationCallback - Device notification callbacks. */ + +class BMD_PUBLIC IBMDStreamingDeviceNotificationCallback : public IUnknown +{ +public: + virtual HRESULT StreamingDeviceArrived (/* in */ IDeckLink* device) = 0; + virtual HRESULT StreamingDeviceRemoved (/* in */ IDeckLink* device) = 0; + virtual HRESULT StreamingDeviceModeChanged (/* in */ IDeckLink* device, /* in */ BMDStreamingDeviceMode mode) = 0; + +protected: + virtual ~IBMDStreamingDeviceNotificationCallback () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingH264InputCallback - H264 input callbacks. */ + +class BMD_PUBLIC IBMDStreamingH264InputCallback : public IUnknown +{ +public: + virtual HRESULT H264NALPacketArrived (/* in */ IBMDStreamingH264NALPacket* nalPacket) = 0; + virtual HRESULT H264AudioPacketArrived (/* in */ IBMDStreamingAudioPacket* audioPacket) = 0; + virtual HRESULT MPEG2TSPacketArrived (/* in */ IBMDStreamingMPEG2TSPacket* tsPacket) = 0; + virtual HRESULT H264VideoInputConnectorScanningChanged (void) = 0; + virtual HRESULT H264VideoInputConnectorChanged (void) = 0; + virtual HRESULT H264VideoInputModeChanged (void) = 0; + +protected: + virtual ~IBMDStreamingH264InputCallback () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingDiscovery - Installs device notifications */ + +class BMD_PUBLIC IBMDStreamingDiscovery : public IUnknown +{ +public: + virtual HRESULT InstallDeviceNotifications (/* in */ IBMDStreamingDeviceNotificationCallback* theCallback) = 0; + virtual HRESULT UninstallDeviceNotifications (void) = 0; + +protected: + virtual ~IBMDStreamingDiscovery () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingVideoEncodingMode - Represents an encoded video mode. */ + +class BMD_PUBLIC IBMDStreamingVideoEncodingMode : public IUnknown +{ +public: + virtual HRESULT GetName (/* out */ CFStringRef* name) = 0; + virtual unsigned int GetPresetID (void) = 0; + virtual unsigned int GetSourcePositionX (void) = 0; + virtual unsigned int GetSourcePositionY (void) = 0; + virtual unsigned int GetSourceWidth (void) = 0; + virtual unsigned int GetSourceHeight (void) = 0; + virtual unsigned int GetDestWidth (void) = 0; + virtual unsigned int GetDestHeight (void) = 0; + virtual HRESULT GetFlag (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* out */ bool* value) = 0; + virtual HRESULT GetInt (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* out */ int64_t* value) = 0; + virtual HRESULT GetFloat (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* out */ double* value) = 0; + virtual HRESULT GetString (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* out */ CFStringRef* value) = 0; + virtual HRESULT CreateMutableVideoEncodingMode (/* out */ IBMDStreamingMutableVideoEncodingMode** newEncodingMode) = 0; // Creates a mutable copy of the encoding mode + +protected: + virtual ~IBMDStreamingVideoEncodingMode () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingMutableVideoEncodingMode - Represents a mutable encoded video mode. */ + +class BMD_PUBLIC IBMDStreamingMutableVideoEncodingMode : public IBMDStreamingVideoEncodingMode +{ +public: + virtual HRESULT SetSourceRect (/* in */ uint32_t posX, /* in */ uint32_t posY, /* in */ uint32_t width, /* in */ uint32_t height) = 0; + virtual HRESULT SetDestSize (/* in */ uint32_t width, /* in */ uint32_t height) = 0; + virtual HRESULT SetFlag (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* in */ bool value) = 0; + virtual HRESULT SetInt (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT SetFloat (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* in */ double value) = 0; + virtual HRESULT SetString (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* in */ CFStringRef value) = 0; + +protected: + virtual ~IBMDStreamingMutableVideoEncodingMode () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingVideoEncodingModePresetIterator - Enumerates encoding mode presets */ + +class BMD_PUBLIC IBMDStreamingVideoEncodingModePresetIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IBMDStreamingVideoEncodingMode** videoEncodingMode) = 0; + +protected: + virtual ~IBMDStreamingVideoEncodingModePresetIterator () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingDeviceInput - Created by QueryInterface from IDeckLink */ + +class BMD_PUBLIC IBMDStreamingDeviceInput : public IUnknown +{ +public: + + /* Input modes */ + + virtual HRESULT DoesSupportVideoInputMode (/* in */ BMDDisplayMode inputMode, /* out */ bool* result) = 0; + virtual HRESULT GetVideoInputModeIterator (/* out */ IDeckLinkDisplayModeIterator** iterator) = 0; + virtual HRESULT SetVideoInputMode (/* in */ BMDDisplayMode inputMode) = 0; + virtual HRESULT GetCurrentDetectedVideoInputMode (/* out */ BMDDisplayMode* detectedMode) = 0; + + /* Capture modes */ + + virtual HRESULT GetVideoEncodingMode (/* out */ IBMDStreamingVideoEncodingMode** encodingMode) = 0; + virtual HRESULT GetVideoEncodingModePresetIterator (/* in */ BMDDisplayMode inputMode, /* out */ IBMDStreamingVideoEncodingModePresetIterator** iterator) = 0; + virtual HRESULT DoesSupportVideoEncodingMode (/* in */ BMDDisplayMode inputMode, /* in */ IBMDStreamingVideoEncodingMode* encodingMode, /* out */ BMDStreamingEncodingSupport* result, /* out */ IBMDStreamingVideoEncodingMode** changedEncodingMode) = 0; + virtual HRESULT SetVideoEncodingMode (/* in */ IBMDStreamingVideoEncodingMode* encodingMode) = 0; + + /* Input control */ + + virtual HRESULT StartCapture (void) = 0; + virtual HRESULT StopCapture (void) = 0; + virtual HRESULT SetCallback (/* in */ IUnknown* theCallback) = 0; + +protected: + virtual ~IBMDStreamingDeviceInput () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingH264NALPacket - Represent an H.264 NAL packet */ + +class BMD_PUBLIC IBMDStreamingH264NALPacket : public IUnknown +{ +public: + virtual long GetPayloadSize (void) = 0; + virtual HRESULT GetBytes (/* out */ void** buffer) = 0; + virtual HRESULT GetBytesWithSizePrefix (/* out */ void** buffer) = 0; // Contains a 32-bit unsigned big endian size prefix + virtual HRESULT GetDisplayTime (/* in */ uint64_t requestedTimeScale, /* out */ uint64_t* displayTime) = 0; + virtual HRESULT GetPacketIndex (/* out */ uint32_t* packetIndex) = 0; // Deprecated + +protected: + virtual ~IBMDStreamingH264NALPacket () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingAudioPacket - Represents a chunk of audio data */ + +class BMD_PUBLIC IBMDStreamingAudioPacket : public IUnknown +{ +public: + virtual BMDStreamingAudioCodec GetCodec (void) = 0; + virtual long GetPayloadSize (void) = 0; + virtual HRESULT GetBytes (/* out */ void** buffer) = 0; + virtual HRESULT GetPlayTime (/* in */ uint64_t requestedTimeScale, /* out */ uint64_t* playTime) = 0; + virtual HRESULT GetPacketIndex (/* out */ uint32_t* packetIndex) = 0; // Deprecated + +protected: + virtual ~IBMDStreamingAudioPacket () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingMPEG2TSPacket - Represent an MPEG2 Transport Stream packet */ + +class BMD_PUBLIC IBMDStreamingMPEG2TSPacket : public IUnknown +{ +public: + virtual long GetPayloadSize (void) = 0; + virtual HRESULT GetBytes (/* out */ void** buffer) = 0; + +protected: + virtual ~IBMDStreamingMPEG2TSPacket () {} // call Release method to drop reference count +}; + +/* Interface IBMDStreamingH264NALParser - For basic NAL parsing */ + +class BMD_PUBLIC IBMDStreamingH264NALParser : public IUnknown +{ +public: + virtual HRESULT IsNALSequenceParameterSet (/* in */ IBMDStreamingH264NALPacket* nal) = 0; + virtual HRESULT IsNALPictureParameterSet (/* in */ IBMDStreamingH264NALPacket* nal) = 0; + virtual HRESULT GetProfileAndLevelFromSPS (/* in */ IBMDStreamingH264NALPacket* nal, /* out */ uint32_t* profileIdc, /* out */ uint32_t* profileCompatability, /* out */ uint32_t* levelIdc) = 0; + +protected: + virtual ~IBMDStreamingH264NALParser () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + BMD_PUBLIC IBMDStreamingDiscovery* CreateBMDStreamingDiscoveryInstance(void); + BMD_PUBLIC IBMDStreamingH264NALParser* CreateBMDStreamingH264NALParser(void); + +} + + + +#endif /* defined(__cplusplus) */ +#endif /* defined(BMD_DECKLINKAPISTREAMING_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIStreaming_v10_11.h b/DeckLinkSDK/Mac/include/DeckLinkAPIStreaming_v10_11.h new file mode 100644 index 00000000..9ac9e499 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIStreaming_v10_11.h @@ -0,0 +1,59 @@ +/* -LICENSE-START- +** Copyright (c) 2018 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPISTREAMING_H +#define BMD_DECKLINKAPISTREAMING_H + +#ifndef BMD_PUBLIC + #define BMD_PUBLIC +#endif + + +/* Functions */ + +extern "C" { + + IBMDStreamingDiscovery* BMD_PUBLIC CreateBMDStreamingDiscoveryInstance_v10_11 (void); + IBMDStreamingH264NALParser* BMD_PUBLIC CreateBMDStreamingH264NALParser_v10_11 (void); + +} + + +#endif /* defined(BMD_DECKLINKAPISTREAMING_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPITypes.h b/DeckLinkSDK/Mac/include/DeckLinkAPITypes.h new file mode 100644 index 00000000..8437eb4c --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPITypes.h @@ -0,0 +1,132 @@ +/* -LICENSE-START- +** Copyright (c) 2022 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPITYPES_H +#define BMD_DECKLINKAPITYPES_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +#ifndef BMD_PUBLIC + #define BMD_PUBLIC +#endif + +// Type Declarations + +typedef int64_t BMDTimeValue; +typedef int64_t BMDTimeScale; +typedef uint32_t BMDTimecodeBCD; +typedef uint32_t BMDTimecodeUserBits; + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkTimecode = /* BC6CFBD3-8317-4325-AC1C-1216391E9340 */ { 0xBC,0x6C,0xFB,0xD3,0x83,0x17,0x43,0x25,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40 }; + +/* Enum BMDTimecodeFlags - Timecode flags */ + +typedef uint32_t BMDTimecodeFlags; +enum _BMDTimecodeFlags { + bmdTimecodeFlagDefault = 0, + bmdTimecodeIsDropFrame = 1 << 0, + bmdTimecodeFieldMark = 1 << 1, + bmdTimecodeColorFrame = 1 << 2, + bmdTimecodeEmbedRecordingTrigger = 1 << 3, // On SDI recording trigger utilises a user-bit. + bmdTimecodeRecordingTriggered = 1 << 4 +}; + +/* Enum BMDVideoConnection - Video connection types */ + +typedef uint32_t BMDVideoConnection; +enum _BMDVideoConnection { + bmdVideoConnectionUnspecified = 0, + bmdVideoConnectionSDI = 1 << 0, + bmdVideoConnectionHDMI = 1 << 1, + bmdVideoConnectionOpticalSDI = 1 << 2, + bmdVideoConnectionComponent = 1 << 3, + bmdVideoConnectionComposite = 1 << 4, + bmdVideoConnectionSVideo = 1 << 5 +}; + +/* Enum BMDAudioConnection - Audio connection types */ + +typedef uint32_t BMDAudioConnection; +enum _BMDAudioConnection { + bmdAudioConnectionEmbedded = 1 << 0, + bmdAudioConnectionAESEBU = 1 << 1, + bmdAudioConnectionAnalog = 1 << 2, + bmdAudioConnectionAnalogXLR = 1 << 3, + bmdAudioConnectionAnalogRCA = 1 << 4, + bmdAudioConnectionMicrophone = 1 << 5, + bmdAudioConnectionHeadphones = 1 << 6 +}; + +/* Enum BMDDeckControlConnection - Deck control connections */ + +typedef uint32_t BMDDeckControlConnection; +enum _BMDDeckControlConnection { + bmdDeckControlConnectionRS422Remote1 = 1 << 0, + bmdDeckControlConnectionRS422Remote2 = 1 << 1 +}; + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLinkTimecode; + +/* Interface IDeckLinkTimecode - Used for video frame timecode representation. */ + +class BMD_PUBLIC IDeckLinkTimecode : public IUnknown +{ +public: + virtual BMDTimecodeBCD GetBCD (void) = 0; + virtual HRESULT GetComponents (/* out */ uint8_t* hours, /* out */ uint8_t* minutes, /* out */ uint8_t* seconds, /* out */ uint8_t* frames) = 0; + virtual HRESULT GetString (/* out */ CFStringRef* timecode) = 0; + virtual BMDTimecodeFlags GetFlags (void) = 0; + virtual HRESULT GetTimecodeUserBits (/* out */ BMDTimecodeUserBits* userBits) = 0; + +protected: + virtual ~IDeckLinkTimecode () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + + +#endif /* defined(__cplusplus) */ +#endif /* defined(BMD_DECKLINKAPITYPES_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIVersion.h b/DeckLinkSDK/Mac/include/DeckLinkAPIVersion.h new file mode 100644 index 00000000..679ef925 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIVersion.h @@ -0,0 +1,50 @@ +/* -LICENSE-START- + * ** Copyright (c) 2014 Blackmagic Design + * ** + * ** Permission is hereby granted, free of charge, to any person or organization + * ** obtaining a copy of the software and accompanying documentation (the + * ** "Software") to use, reproduce, display, distribute, sub-license, execute, + * ** and transmit the Software, and to prepare derivative works of the Software, + * ** and to permit third-parties to whom the Software is furnished to do so, in + * ** accordance with: + * ** + * ** (1) if the Software is obtained from Blackmagic Design, the End User License + * ** Agreement for the Software Development Kit (“EULA”) available at + * ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or + * ** + * ** (2) if the Software is obtained from any third party, such licensing terms + * ** as notified by that third party, + * ** + * ** and all subject to the following: + * ** + * ** (3) the copyright notices in the Software and this entire statement, + * ** including the above license grant, this restriction and the following + * ** disclaimer, must be included in all copies of the Software, in whole or in + * ** part, and all derivative works of the Software, unless such copies or + * ** derivative works are solely in the form of machine-executable object code + * ** generated by a source language processor. + * ** + * ** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + * ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + * ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + * ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * ** DEALINGS IN THE SOFTWARE. + * ** + * ** A copy of the Software is available free of charge at + * ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. + * ** + * ** -LICENSE-END- + * */ + +/* DeckLinkAPIVersion.h */ + +#ifndef __DeckLink_API_Version_h__ +#define __DeckLink_API_Version_h__ + +#define BLACKMAGIC_DECKLINK_API_VERSION 0x0c040200 +#define BLACKMAGIC_DECKLINK_API_VERSION_STRING "12.4.2" + +#endif // __DeckLink_API_Version_h__ + diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIVideoEncoderInput_v10_11.h b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoEncoderInput_v10_11.h new file mode 100644 index 00000000..8921b353 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoEncoderInput_v10_11.h @@ -0,0 +1,88 @@ +/* -LICENSE-START- +** Copyright (c) 2017 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIVIDEOENCODERINPUT_v10_11_H +#define BMD_DECKLINKAPIVIDEOENCODERINPUT_v10_11_H + +#include "DeckLinkAPI.h" +#include "DeckLinkAPI_v10_11.h" + +// Type Declarations + +BMD_CONST REFIID IID_IDeckLinkEncoderInput_v10_11 = /* 270587DA-6B7D-42E7-A1F0-6D853F581185 */ {0x27,0x05,0x87,0xDA,0x6B,0x7D,0x42,0xE7,0xA1,0xF0,0x6D,0x85,0x3F,0x58,0x11,0x85}; + +/* Interface IDeckLinkEncoderInput_v10_11 - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkEncoderInput_v10_11 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport_v10_11 *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailablePacketsCount (/* out */ uint32_t *availablePacketsCount) = 0; + virtual HRESULT SetMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioFormat audioFormat, /* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkEncoderInputCallback *theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkEncoderInput_v10_11 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPIVIDEOENCODERINPUT_v10_11_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v10_11.h b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v10_11.h new file mode 100644 index 00000000..0a287f8c --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v10_11.h @@ -0,0 +1,91 @@ +/* -LICENSE-START- +** Copyright (c) 2017 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIVIDEOINPUT_v10_11_H +#define BMD_DECKLINKAPIVIDEOINPUT_v10_11_H + +#include "DeckLinkAPI.h" +#include "DeckLinkAPI_v10_11.h" +#include "DeckLinkAPIVideoInput_v11_5_1.h" + +// Type Declarations + +BMD_CONST REFIID IID_IDeckLinkInput_v10_11 = /* AF22762B-DFAC-4846-AA79-FA8883560995 */ {0xAF,0x22,0x76,0x2B,0xDF,0xAC,0x48,0x46,0xAA,0x79,0xFA,0x88,0x83,0x56,0x09,0x95}; + +/* Interface IDeckLinkInput_v10_11 - DeckLink input interface. */ + +class IDeckLinkInput_v10_11 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport_v10_11 *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0; + virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback_v11_5_1 *theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkInput_v10_11 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPIVIDEOINPUT_v10_11_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v11_4.h b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v11_4.h new file mode 100644 index 00000000..4879fc2a --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v11_4.h @@ -0,0 +1,90 @@ +/* -LICENSE-START- +** Copyright (c) 2019 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIVIDEOINPUT_v11_4_H +#define BMD_DECKLINKAPIVIDEOINPUT_v11_4_H + +#include "DeckLinkAPI.h" +#include "DeckLinkAPIVideoInput_v11_5_1.h" + +// Type Declarations + +BMD_CONST REFIID IID_IDeckLinkInput_v11_4 = /* 2A88CF76-F494-4216-A7EF-DC74EEB83882 */ { 0x2A,0x88,0xCF,0x76,0xF4,0x94,0x42,0x16,0xA7,0xEF,0xDC,0x74,0xEE,0xB8,0x38,0x82 }; + +/* Interface IDeckLinkInput_v11_4 - Created by QueryInterface from IDeckLink. */ + +class BMD_PUBLIC IDeckLinkInput_v11_4 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDVideoConnection connection /* If a value of 0 is specified, the caller does not care about the connection */, /* in */ BMDDisplayMode requestedMode, /* in */ BMDPixelFormat requestedPixelFormat, /* in */ BMDSupportedVideoModeFlags flags, /* out */ bool* supported) = 0; + virtual HRESULT GetDisplayMode (/* in */ BMDDisplayMode displayMode, /* out */ IDeckLinkDisplayMode** resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator** iterator) = 0; + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback* previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t* availableFrameCount) = 0; + virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator* theAllocator) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t* availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback_v11_5_1* theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* hardwareTime, /* out */ BMDTimeValue* timeInFrame, /* out */ BMDTimeValue* ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkInput_v11_4 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPIVIDEOINPUT_v11_4_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v11_5_1.h b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v11_5_1.h new file mode 100644 index 00000000..51fb5172 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoInput_v11_5_1.h @@ -0,0 +1,102 @@ +/* -LICENSE-START- +** Copyright (c) 2020 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIVIDEOINPUT_v11_5_1_H +#define BMD_DECKLINKAPIVIDEOINPUT_v11_5_1_H + +#include "DeckLinkAPI.h" + +// Type Declarations + +BMD_CONST REFIID IID_IDeckLinkInputCallback_v11_5_1 = /* DD04E5EC-7415-42AB-AE4A-E80C4DFC044A */ { 0xDD, 0x04, 0xE5, 0xEC, 0x74, 0x15, 0x42, 0xAB, 0xAE, 0x4A, 0xE8, 0x0C, 0x4D, 0xFC, 0x04, 0x4A }; +BMD_CONST REFIID IID_IDeckLinkInput_v11_5_1 = /* 9434C6E4-B15D-4B1C-979E-661E3DDCB4B9 */ { 0x94, 0x34, 0xC6, 0xE4, 0xB1, 0x5D, 0x4B, 0x1C, 0x97, 0x9E, 0x66, 0x1E, 0x3D, 0xDC, 0xB4, 0xB9 }; + +/* Interface IDeckLinkInputCallback_v11_5_1 - Frame arrival callback. */ + +class BMD_PUBLIC IDeckLinkInputCallback_v11_5_1 : public IUnknown +{ +public: + virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode* newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0; + +protected: + virtual ~IDeckLinkInputCallback_v11_5_1 () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkInput_v11_5_1 - Created by QueryInterface from IDeckLink. */ + +class BMD_PUBLIC IDeckLinkInput_v11_5_1 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDVideoConnection connection /* If a value of bmdVideoConnectionUnspecified is specified, the caller does not care about the connection */, /* in */ BMDDisplayMode requestedMode, /* in */ BMDPixelFormat requestedPixelFormat, /* in */ BMDVideoInputConversionMode conversionMode, /* in */ BMDSupportedVideoModeFlags flags, /* out */ BMDDisplayMode* actualMode, /* out */ bool* supported) = 0; + virtual HRESULT GetDisplayMode (/* in */ BMDDisplayMode displayMode, /* out */ IDeckLinkDisplayMode** resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator** iterator) = 0; + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback* previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t* availableFrameCount) = 0; + virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator* theAllocator) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t* availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback_v11_5_1* theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* hardwareTime, /* out */ BMDTimeValue* timeInFrame, /* out */ BMDTimeValue* ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkInput_v11_5_1 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPIVIDEOINPUT_v11_5_1_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIVideoOutput_v10_11.h b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoOutput_v10_11.h new file mode 100644 index 00000000..22a13a5d --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoOutput_v10_11.h @@ -0,0 +1,108 @@ +/* -LICENSE-START- +** Copyright (c) 2017 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIVIDEOOUTPUT_v10_11_H +#define BMD_DECKLINKAPIVIDEOOUTPUT_v10_11_H + +#include "DeckLinkAPI.h" +#include "DeckLinkAPI_v10_11.h" + +// Type Declarations + +BMD_CONST REFIID IID_IDeckLinkOutput_v10_11 = /* CC5C8A6E-3F2F-4B3A-87EA-FD78AF300564 */ {0xCC,0x5C,0x8A,0x6E,0x3F,0x2F,0x4B,0x3A,0x87,0xEA,0xFD,0x78,0xAF,0x30,0x05,0x64}; + +/* Interface IDeckLinkOutput_v10_11 - DeckLink output interface. */ + +class IDeckLinkOutput_v10_11 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoOutputFlags flags, /* out */ BMDDisplayModeSupport_v10_11 *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Output */ + + virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0; + virtual HRESULT DisableVideoOutput (void) = 0; + + virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame **outFrame) = 0; + virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame *theFrame) = 0; + virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0; + virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0; + + /* Audio Output */ + + virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0; + virtual HRESULT DisableAudioOutput (void) = 0; + + virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT BeginAudioPreroll (void) = 0; + virtual HRESULT EndAudioPreroll (void) = 0; + virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0; + virtual HRESULT FlushBufferedAudioSamples (void) = 0; + + virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + /* Output Control */ + + virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0; + virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0; + virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0; + virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus *referenceStatus) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + virtual HRESULT GetFrameCompletionReferenceTimestamp (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *frameCompletionTimestamp) = 0; + +protected: + virtual ~IDeckLinkOutput_v10_11 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPIVIDEOOUTPUT_v10_11_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPIVideoOutput_v11_4.h b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoOutput_v11_4.h new file mode 100644 index 00000000..14d65ac2 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPIVideoOutput_v11_4.h @@ -0,0 +1,101 @@ +/* -LICENSE-START- +** Copyright (c) 2019 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIVIDEOOUTPUT_v11_4_H +#define BMD_DECKLINKAPIVIDEOOUTPUT_v11_4_H + +#include "DeckLinkAPI.h" + +// Type Declarations + +BMD_CONST REFIID IID_IDeckLinkOutput_v11_4 = /* 065A0F6C-C508-4D0D-B919-F5EB0EBFC96B */ { 0x06,0x5A,0x0F,0x6C,0xC5,0x08,0x4D,0x0D,0xB9,0x19,0xF5,0xEB,0x0E,0xBF,0xC9,0x6B }; + +/* Interface IDeckLinkOutput_v11_4 - Created by QueryInterface from IDeckLink. */ + +class BMD_PUBLIC IDeckLinkOutput_v11_4 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDVideoConnection connection /* If a value of 0 is specified, the caller does not care about the connection */, /* in */ BMDDisplayMode requestedMode, /* in */ BMDPixelFormat requestedPixelFormat, /* in */ BMDSupportedVideoModeFlags flags, /* out */ BMDDisplayMode* actualMode, /* out */ bool* supported) = 0; + virtual HRESULT GetDisplayMode (/* in */ BMDDisplayMode displayMode, /* out */ IDeckLinkDisplayMode** resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator** iterator) = 0; + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback* previewCallback) = 0; + + /* Video Output */ + + virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0; + virtual HRESULT DisableVideoOutput (void) = 0; + virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator* theAllocator) = 0; + virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame** outFrame) = 0; + virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary** outBuffer) = 0; // Use of IDeckLinkVideoFrameAncillaryPackets is preferred + virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame* theFrame) = 0; + virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame* theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback* theCallback) = 0; + virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t* bufferedFrameCount) = 0; + + /* Audio Output */ + + virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0; + virtual HRESULT DisableAudioOutput (void) = 0; + virtual HRESULT WriteAudioSamplesSync (/* in */ void* buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t* sampleFramesWritten) = 0; + virtual HRESULT BeginAudioPreroll (void) = 0; + virtual HRESULT EndAudioPreroll (void) = 0; + virtual HRESULT ScheduleAudioSamples (/* in */ void* buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t* sampleFramesWritten) = 0; + virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t* bufferedSampleFrameCount) = 0; + virtual HRESULT FlushBufferedAudioSamples (void) = 0; + virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback* theCallback) = 0; + + /* Output Control */ + + virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0; + virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue* actualStopTime, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool* active) = 0; + virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* streamTime, /* out */ double* playbackSpeed) = 0; + virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus* referenceStatus) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* hardwareTime, /* out */ BMDTimeValue* timeInFrame, /* out */ BMDTimeValue* ticksPerFrame) = 0; + virtual HRESULT GetFrameCompletionReferenceTimestamp (/* in */ IDeckLinkVideoFrame* theFrame, /* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue* frameCompletionTimestamp) = 0; + +protected: + virtual ~IDeckLinkOutput_v11_4 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPIVIDEOOUTPUT_v11_4_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_11.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_11.h new file mode 100644 index 00000000..d9ef54e5 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_11.h @@ -0,0 +1,135 @@ +/* -LICENSE-START- +** Copyright (c) 2018 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v10_11_H +#define BMD_DECKLINKAPI_v10_11_H + +#include "DeckLinkAPI.h" + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkAttributes_v10_11 = /* ABC11843-D966-44CB-96E2-A1CB5D3135C4 */ {0xAB,0xC1,0x18,0x43,0xD9,0x66,0x44,0xCB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4}; +BMD_CONST REFIID IID_IDeckLinkNotification_v10_11 = /* 0A1FB207-E215-441B-9B19-6FA1575946C5 */ {0x0A,0x1F,0xB2,0x07,0xE2,0x15,0x44,0x1B,0x9B,0x19,0x6F,0xA1,0x57,0x59,0x46,0xC5}; + +/* Enum BMDDisplayModeSupport_v10_11 - Output mode supported flags */ + +typedef uint32_t BMDDisplayModeSupport_v10_11; +enum _BMDDisplayModeSupport_v10_11 { + bmdDisplayModeNotSupported_v10_11 = 0, + bmdDisplayModeSupported_v10_11, + bmdDisplayModeSupportedWithConversion_v10_11 +}; + +/* Enum BMDDuplexMode_v10_11 - Duplex for configurable ports */ + +typedef uint32_t BMDDuplexMode_v10_11; +enum _BMDDuplexMode_v10_11 { + bmdDuplexModeFull_v10_11 = 'fdup', + bmdDuplexModeHalf_v10_11 = 'hdup' +}; + +/* Enum BMDDeckLinkAttributeID_v10_11 - DeckLink Attribute ID */ + +enum _BMDDeckLinkAttributeID_v10_11 { + + /* Flags */ + + BMDDeckLinkSupportsDuplexModeConfiguration_v10_11 = 'dupx', + BMDDeckLinkSupportsHDKeying_v10_11 = 'keyh', + + /* Integers */ + + BMDDeckLinkPairedDevicePersistentID_v10_11 = 'ppid', + BMDDeckLinkSupportsFullDuplex_v10_11 = 'fdup', +}; + +enum _BMDDeckLinkStatusID_v10_11 { + bmdDeckLinkStatusDuplexMode_v10_11 = 'dupx', +}; + +typedef uint32_t BMDDuplexStatus_v10_11; +enum _BMDDuplexStatus_v10_11 { + bmdDuplexFullDuplex_v10_11 = 'fdup', + bmdDuplexHalfDuplex_v10_11 = 'hdup', + bmdDuplexSimplex_v10_11 = 'splx', + bmdDuplexInactive_v10_11 = 'inac', +}; + +#if defined(__cplusplus) + +/* Interface IDeckLinkAttributes_v10_11 - DeckLink Attribute interface */ + +class BMD_PUBLIC IDeckLinkAttributes_v10_11 : public IUnknown +{ +public: + virtual HRESULT GetFlag (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ bool *value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ double *value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ CFStringRef *value) = 0; + +protected: + virtual ~IDeckLinkAttributes_v10_11 () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkNotification_v10_11 - DeckLink Notification interface */ + +class BMD_PUBLIC IDeckLinkNotification_v10_11 : public IUnknown +{ +public: + virtual HRESULT Subscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0; + virtual HRESULT Unsubscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0; +}; + +/* Functions */ + +extern "C" { + + IDeckLinkIterator* BMD_PUBLIC CreateDeckLinkIteratorInstance_v10_11 (void); + IDeckLinkDiscovery* BMD_PUBLIC CreateDeckLinkDiscoveryInstance_v10_11 (void); + IDeckLinkAPIInformation* BMD_PUBLIC CreateDeckLinkAPIInformationInstance_v10_11 (void); + IDeckLinkGLScreenPreviewHelper* BMD_PUBLIC CreateOpenGLScreenPreviewHelper_v10_11 (void); + IDeckLinkCocoaScreenPreviewCallback* BMD_PUBLIC CreateCocoaScreenPreview_v10_11 (void* /* (NSView*) */ parentView); + IDeckLinkVideoConversion* BMD_PUBLIC CreateVideoConversionInstance_v10_11 (void); + IDeckLinkVideoFrameAncillaryPackets* BMD_PUBLIC CreateVideoFrameAncillaryPacketsInstance_v10_11 (void); // For use when creating a custom IDeckLinkVideoFrame without wrapping IDeckLinkOutput::CreateVideoFrame + +} + +#endif // defined(__cplusplus) +#endif /* defined(BMD_DECKLINKAPI_v10_11_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_2.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_2.h new file mode 100644 index 00000000..20eedd28 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_2.h @@ -0,0 +1,68 @@ +/* -LICENSE-START- +** Copyright (c) 2014 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v10_2_H +#define BMD_DECKLINKAPI_v10_2_H + +#include "DeckLinkAPI.h" + +// Type Declarations + +/* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */ + +typedef uint32_t BMDDeckLinkConfigurationID_v10_2; +enum _BMDDeckLinkConfigurationID_v10_2 { + /* Video output flags */ + + bmdDeckLinkConfig3GBpsVideoOutput_v10_2 = '3gbs', +}; + +/* Enum BMDAudioConnection_v10_2 - Audio connection types */ + +typedef uint32_t BMDAudioConnection_v10_2; +enum _BMDAudioConnection_v10_2 { + bmdAudioConnectionEmbedded_v10_2 = 'embd', + bmdAudioConnectionAESEBU_v10_2 = 'aes ', + bmdAudioConnectionAnalog_v10_2 = 'anlg', + bmdAudioConnectionAnalogXLR_v10_2 = 'axlr', + bmdAudioConnectionAnalogRCA_v10_2 = 'arca' +}; + +#endif /* defined(BMD_DECKLINKAPI_v10_2_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_4.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_4.h new file mode 100644 index 00000000..fa5892dd --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_4.h @@ -0,0 +1,58 @@ +/* -LICENSE-START- +** Copyright (c) 2015 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v10_4_H +#define BMD_DECKLINKAPI_v10_4_H + +#include "DeckLinkAPI.h" + +// Type Declarations + +/* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */ + +typedef uint32_t BMDDeckLinkConfigurationID_v10_4; +enum _BMDDeckLinkConfigurationID_v10_4 { + + /* Video output flags */ + + bmdDeckLinkConfigSingleLinkVideoOutput_v10_4 = /* 'sglo' */ 0x73676C6F, +}; + +#endif /* defined(BMD_DECKLINKAPI_v10_4_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_5.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_5.h new file mode 100644 index 00000000..40ce330f --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_5.h @@ -0,0 +1,59 @@ +/* -LICENSE-START- +** Copyright (c) 2015 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v10_5_H +#define BMD_DECKLINKAPI_v10_5_H + +#include "DeckLinkAPI.h" + +// Type Declarations + +/* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ + +typedef uint32_t BMDDeckLinkAttributeID_v10_5; +enum _BMDDeckLinkAttributeID_v10_5 { + + /* Integers */ + + BMDDeckLinkDeviceBusyState_v10_5 = /* 'dbst' */ 0x64627374, +}; + +#endif /* defined(BMD_DECKLINKAPI_v10_5_H) */ + diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_6.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_6.h new file mode 100644 index 00000000..67082779 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_6.h @@ -0,0 +1,64 @@ +/* -LICENSE-START- +** Copyright (c) 2016 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v10_6_H +#define BMD_DECKLINKAPI_v10_6_H + +#include "DeckLinkAPI.h" + +// Type Declarations + +/* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ + +typedef uint32_t BMDDeckLinkAttributeID_c10_6; +enum _BMDDeckLinkAttributeID_v10_6 { + + /* Flags */ + + BMDDeckLinkSupportsDesktopDisplay_v10_6 = 'extd', +}; + +typedef uint32_t BMDIdleVideoOutputOperation_v10_6; +enum _BMDIdleVideoOutputOperation_v10_6 { + bmdIdleVideoOutputDesktop_v10_6 = 'desk' +}; + + +#endif /* defined(BMD_DECKLINKAPI_v10_6_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_9.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_9.h new file mode 100644 index 00000000..8b6b4b20 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v10_9.h @@ -0,0 +1,58 @@ +/* -LICENSE-START- +** Copyright (c) 2017 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v10_9_H +#define BMD_DECKLINKAPI_v10_9_H + +#include "DeckLinkAPI.h" + +// Type Declarations + +/* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ + +typedef uint32_t BMDDeckLinkConfigurationID_v10_9; +enum _BMDDeckLinkConfigurationID_v10_9 { + + /* Flags */ + + bmdDeckLinkConfig1080pNotPsF_v10_9 = 'fpro', +}; + +#endif /* defined(BMD_DECKLINKAPI_v10_9_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v11_5.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v11_5.h new file mode 100644 index 00000000..a7115ae3 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v11_5.h @@ -0,0 +1,113 @@ +/* -LICENSE-START- +** Copyright (c) 2020 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v11_5_H +#define BMD_DECKLINKAPI_v11_5_H + +#include "DeckLinkAPI.h" + +BMD_CONST REFIID IID_IDeckLinkVideoFrameMetadataExtensions_v11_5 = /* D5973DC9-6432-46D0-8F0B-2496F8A1238F */ {0xD5,0x97,0x3D,0xC9,0x64,0x32,0x46,0xD0,0x8F,0x0B,0x24,0x96,0xF8,0xA1,0x23,0x8F}; + +/* Enum BMDDeckLinkFrameMetadataID - DeckLink Frame Metadata ID */ + +typedef uint32_t BMDDeckLinkFrameMetadataID_v11_5; +enum _BMDDeckLinkFrameMetadataID_v11_5 { + bmdDeckLinkFrameMetadataCintelFilmType_v11_5 = /* 'cfty' */ 0x63667479, // Current film type + bmdDeckLinkFrameMetadataCintelFilmGauge_v11_5 = /* 'cfga' */ 0x63666761, // Current film gauge + bmdDeckLinkFrameMetadataCintelKeykodeLow_v11_5 = /* 'ckkl' */ 0x636B6B6C, // Raw keykode value - low 64 bits + bmdDeckLinkFrameMetadataCintelKeykodeHigh_v11_5 = /* 'ckkh' */ 0x636B6B68, // Raw keykode value - high 64 bits + bmdDeckLinkFrameMetadataCintelTile1Size_v11_5 = /* 'ct1s' */ 0x63743173, // Size in bytes of compressed raw tile 1 + bmdDeckLinkFrameMetadataCintelTile2Size_v11_5 = /* 'ct2s' */ 0x63743273, // Size in bytes of compressed raw tile 2 + bmdDeckLinkFrameMetadataCintelTile3Size_v11_5 = /* 'ct3s' */ 0x63743373, // Size in bytes of compressed raw tile 3 + bmdDeckLinkFrameMetadataCintelTile4Size_v11_5 = /* 'ct4s' */ 0x63743473, // Size in bytes of compressed raw tile 4 + bmdDeckLinkFrameMetadataCintelImageWidth_v11_5 = /* 'IWPx' */ 0x49575078, // Width in pixels of image + bmdDeckLinkFrameMetadataCintelImageHeight_v11_5 = /* 'IHPx' */ 0x49485078, // Height in pixels of image + bmdDeckLinkFrameMetadataCintelLinearMaskingRedInRed_v11_5 = /* 'mrir' */ 0x6D726972, // Red in red linear masking parameter + bmdDeckLinkFrameMetadataCintelLinearMaskingGreenInRed_v11_5 = /* 'mgir' */ 0x6D676972, // Green in red linear masking parameter + bmdDeckLinkFrameMetadataCintelLinearMaskingBlueInRed_v11_5 = /* 'mbir' */ 0x6D626972, // Blue in red linear masking parameter + bmdDeckLinkFrameMetadataCintelLinearMaskingRedInGreen_v11_5 = /* 'mrig' */ 0x6D726967, // Red in green linear masking parameter + bmdDeckLinkFrameMetadataCintelLinearMaskingGreenInGreen_v11_5 = /* 'mgig' */ 0x6D676967, // Green in green linear masking parameter + bmdDeckLinkFrameMetadataCintelLinearMaskingBlueInGreen_v11_5 = /* 'mbig' */ 0x6D626967, // Blue in green linear masking parameter + bmdDeckLinkFrameMetadataCintelLinearMaskingRedInBlue_v11_5 = /* 'mrib' */ 0x6D726962, // Red in blue linear masking parameter + bmdDeckLinkFrameMetadataCintelLinearMaskingGreenInBlue_v11_5 = /* 'mgib' */ 0x6D676962, // Green in blue linear masking parameter + bmdDeckLinkFrameMetadataCintelLinearMaskingBlueInBlue_v11_5 = /* 'mbib' */ 0x6D626962, // Blue in blue linear masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingRedInRed_v11_5 = /* 'mlrr' */ 0x6D6C7272, // Red in red log masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingGreenInRed_v11_5 = /* 'mlgr' */ 0x6D6C6772, // Green in red log masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingBlueInRed_v11_5 = /* 'mlbr' */ 0x6D6C6272, // Blue in red log masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingRedInGreen_v11_5 = /* 'mlrg' */ 0x6D6C7267, // Red in green log masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingGreenInGreen_v11_5 = /* 'mlgg' */ 0x6D6C6767, // Green in green log masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingBlueInGreen_v11_5 = /* 'mlbg' */ 0x6D6C6267, // Blue in green log masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingRedInBlue_v11_5 = /* 'mlrb' */ 0x6D6C7262, // Red in blue log masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingGreenInBlue_v11_5 = /* 'mlgb' */ 0x6D6C6762, // Green in blue log masking parameter + bmdDeckLinkFrameMetadataCintelLogMaskingBlueInBlue_v11_5 = /* 'mlbb' */ 0x6D6C6262, // Blue in blue log masking parameter + bmdDeckLinkFrameMetadataCintelFilmFrameRate_v11_5 = /* 'cffr' */ 0x63666672, // Film frame rate + bmdDeckLinkFrameMetadataCintelOffsetToApplyHorizontal_v11_5 = /* 'otah' */ 0x6F746168, // Horizontal offset (pixels) to be applied to image + bmdDeckLinkFrameMetadataCintelOffsetToApplyVertical_v11_5 = /* 'otav' */ 0x6F746176, // Vertical offset (pixels) to be applied to image + bmdDeckLinkFrameMetadataCintelGainRed_v11_5 = /* 'LfRd' */ 0x4C665264, // Red gain parameter to apply after log + bmdDeckLinkFrameMetadataCintelGainGreen_v11_5 = /* 'LfGr' */ 0x4C664772, // Green gain parameter to apply after log + bmdDeckLinkFrameMetadataCintelGainBlue_v11_5 = /* 'LfBl' */ 0x4C66426C, // Blue gain parameter to apply after log + bmdDeckLinkFrameMetadataCintelLiftRed_v11_5 = /* 'GnRd' */ 0x476E5264, // Red lift parameter to apply after log and gain + bmdDeckLinkFrameMetadataCintelLiftGreen_v11_5 = /* 'GnGr' */ 0x476E4772, // Green lift parameter to apply after log and gain + bmdDeckLinkFrameMetadataCintelLiftBlue_v11_5 = /* 'GnBl' */ 0x476E426C, // Blue lift parameter to apply after log and gain + bmdDeckLinkFrameMetadataCintelHDRGainRed_v11_5 = /* 'HGRd' */ 0x48475264, // Red gain parameter to apply to linear data for HDR Combination + bmdDeckLinkFrameMetadataCintelHDRGainGreen_v11_5 = /* 'HGGr' */ 0x48474772, // Green gain parameter to apply to linear data for HDR Combination + bmdDeckLinkFrameMetadataCintelHDRGainBlue_v11_5 = /* 'HGBl' */ 0x4847426C, // Blue gain parameter to apply to linear data for HDR Combination + bmdDeckLinkFrameMetadataCintel16mmCropRequired_v11_5 = /* 'c16c' */ 0x63313663, // The image should be cropped to 16mm size + bmdDeckLinkFrameMetadataCintelInversionRequired_v11_5 = /* 'cinv' */ 0x63696E76, // The image should be colour inverted + bmdDeckLinkFrameMetadataCintelFlipRequired_v11_5 = /* 'cflr' */ 0x63666C72, // The image should be flipped horizontally + bmdDeckLinkFrameMetadataCintelFocusAssistEnabled_v11_5 = /* 'cfae' */ 0x63666165, // Focus Assist is currently enabled + bmdDeckLinkFrameMetadataCintelKeykodeIsInterpolated_v11_5 = /* 'kkii' */ 0x6B6B6969 // The keykode for this frame is interpolated from nearby keykodes +}; + +/* Interface IDeckLinkVideoFrameMetadataExtensions - Optional interface implemented on IDeckLinkVideoFrame to support frame metadata such as HDMI HDR information */ + +class BMD_PUBLIC IDeckLinkVideoFrameMetadataExtensions_v11_5 : public IUnknown +{ +public: + virtual HRESULT GetInt (/* in */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, /* out */ int64_t *value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, /* out */ double *value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, /* out */ bool *value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, /* out */ CFStringRef *value) = 0; + +protected: + virtual ~IDeckLinkVideoFrameMetadataExtensions_v11_5 () {} // call Release method to drop reference count +}; + +#endif /* defined(BMD_DECKLINKAPI_v11_5_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v11_5_1.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v11_5_1.h new file mode 100644 index 00000000..a406f000 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v11_5_1.h @@ -0,0 +1,57 @@ +/* -LICENSE-START- +** Copyright (c) 2020 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v11_5_1_H +#define BMD_DECKLINKAPI_v11_5_1_H + +#include "DeckLinkAPI.h" + +/* Enum BMDDeckLinkStatusID - DeckLink Status ID */ + +typedef uint32_t BMDDeckLinkStatusID_v11_5_1; +enum _BMDDeckLinkStatusID_v11_5_1 { + + /* Video output flags */ + + bmdDeckLinkStatusDetectedVideoInputFlags_v11_5_1 = /* 'dvif' */ 0x64766966, + +}; + +#endif /* defined(BMD_DECKLINKAPI_v11_5_1_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_1.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_1.h new file mode 100644 index 00000000..5f4f1353 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_1.h @@ -0,0 +1,212 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ +/* DeckLinkAPI_v7_1.h */ + +#ifndef __DeckLink_API_v7_1_h__ +#define __DeckLink_API_v7_1_h__ + +#include "DeckLinkAPI.h" +#include "DeckLinkAPI_v10_11.h" + +// "B28131B6-59AC-4857-B5AC-CD75D5883E2F" +#define IID_IDeckLinkDisplayModeIterator_v7_1 (REFIID){0xB2,0x81,0x31,0xB6,0x59,0xAC,0x48,0x57,0xB5,0xAC,0xCD,0x75,0xD5,0x88,0x3E,0x2F} + +// "AF0CD6D5-8376-435E-8433-54F9DD530AC3" +#define IID_IDeckLinkDisplayMode_v7_1 (REFIID){0xAF,0x0C,0xD6,0xD5,0x83,0x76,0x43,0x5E,0x84,0x33,0x54,0xF9,0xDD,0x53,0x0A,0xC3} + +// "EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9" +#define IID_IDeckLinkVideoOutputCallback_v7_1 (REFIID){0xEB,0xD0,0x1A,0xFA,0xE4,0xB0,0x49,0xC6,0xA0,0x1D,0xED,0xB9,0xD1,0xB5,0x5F,0xD9} + +// "7F94F328-5ED4-4E9F-9729-76A86BDC99CC" +#define IID_IDeckLinkInputCallback_v7_1 (REFIID){0x7F,0x94,0xF3,0x28,0x5E,0xD4,0x4E,0x9F,0x97,0x29,0x76,0xA8,0x6B,0xDC,0x99,0xCC} + +// "AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5" +#define IID_IDeckLinkOutput_v7_1 (REFIID){0xAE,0x5B,0x3E,0x9B,0x4E,0x1E,0x45,0x35,0xB6,0xE8,0x48,0x0F,0xF5,0x2F,0x6C,0xE5} + +// "2B54EDEF-5B32-429F-BA11-BB990596EACD" +#define IID_IDeckLinkInput_v7_1 (REFIID){0x2B,0x54,0xED,0xEF,0x5B,0x32,0x42,0x9F,0xBA,0x11,0xBB,0x99,0x05,0x96,0xEA,0xCD} + +// "333F3A10-8C2D-43CF-B79D-46560FEEA1CE" +#define IID_IDeckLinkVideoFrame_v7_1 (REFIID){0x33,0x3F,0x3A,0x10,0x8C,0x2D,0x43,0xCF,0xB7,0x9D,0x46,0x56,0x0F,0xEE,0xA1,0xCE} + +// "C8B41D95-8848-40EE-9B37-6E3417FB114B" +#define IID_IDeckLinkVideoInputFrame_v7_1 (REFIID){0xC8,0xB4,0x1D,0x95,0x88,0x48,0x40,0xEE,0x9B,0x37,0x6E,0x34,0x17,0xFB,0x11,0x4B} + +// "C86DE4F6-A29F-42E3-AB3A-1363E29F0788" +#define IID_IDeckLinkAudioInputPacket_v7_1 (REFIID){0xC8,0x6D,0xE4,0xF6,0xA2,0x9F,0x42,0xE3,0xAB,0x3A,0x13,0x63,0xE2,0x9F,0x07,0x88} + +#if defined(__cplusplus) + +class IDeckLinkVideoFrame_v7_1; +class IDeckLinkDisplayModeIterator_v7_1; +class IDeckLinkDisplayMode_v7_1; +class IDeckLinkVideoInputFrame_v7_1; +class IDeckLinkAudioInputPacket_v7_1; + +class IDeckLinkDisplayModeIterator_v7_1 : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE Next (IDeckLinkDisplayMode_v7_1* *deckLinkDisplayMode) = 0; +}; + + +class IDeckLinkDisplayMode_v7_1 : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE GetName (CFStringRef* name) = 0; + virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode () = 0; + virtual long STDMETHODCALLTYPE GetWidth () = 0; + virtual long STDMETHODCALLTYPE GetHeight () = 0; + virtual HRESULT STDMETHODCALLTYPE GetFrameRate (BMDTimeValue *frameDuration, BMDTimeScale *timeScale) = 0; +}; + +class IDeckLinkVideoOutputCallback_v7_1 : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted (IDeckLinkVideoFrame_v7_1* completedFrame, BMDOutputFrameCompletionResult result) = 0; +}; + +class IDeckLinkInputCallback_v7_1 : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived (IDeckLinkVideoInputFrame_v7_1* videoFrame, IDeckLinkAudioInputPacket_v7_1* audioPacket) = 0; +}; + +// IDeckLinkOutput_v7_1. Created by QueryInterface from IDeckLink. +class IDeckLinkOutput_v7_1 : public IUnknown +{ +public: + // Display mode predicates + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDDisplayModeSupport_v10_11 *result) = 0; + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator (IDeckLinkDisplayModeIterator_v7_1* *iterator) = 0; + + + // Video output + virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput (BMDDisplayMode displayMode) = 0; + virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput () = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator (IDeckLinkMemoryAllocator* theAllocator) = 0; + virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame (int32_t width, int32_t height, int32_t rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1* *outFrame) = 0; + virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameFromBuffer (void* buffer, int32_t width, int32_t height, int32_t rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1* *outFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync (IDeckLinkVideoFrame_v7_1* theFrame) = 0; + virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame (IDeckLinkVideoFrame_v7_1* theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale) = 0; + virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback (IDeckLinkVideoOutputCallback_v7_1* theCallback) = 0; + + + // Audio output + virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount) = 0; + virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput () = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync (void* buffer, uint32_t sampleFrameCount, uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll () = 0; + virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll () = 0; + virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples (void* buffer, uint32_t sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount (uint32_t *bufferedSampleCount) = 0; + virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples () = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioCallback (IDeckLinkAudioOutputCallback* theCallback) = 0; + + + // Output control + virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback (BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed) = 0; + virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback (BMDTimeValue stopPlaybackAtTime, BMDTimeValue *actualStopTime, BMDTimeScale timeScale) = 0; + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock (BMDTimeScale desiredTimeScale, BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0; +}; + +// IDeckLinkInput_v7_1. Created by QueryInterface from IDeckLink. +class IDeckLinkInput_v7_1 : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDDisplayModeSupport_v10_11 *result) = 0; + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator (IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0; + + // Video input + virtual HRESULT STDMETHODCALLTYPE EnableVideoInput (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags) = 0; + virtual HRESULT STDMETHODCALLTYPE DisableVideoInput () = 0; + + // Audio input + virtual HRESULT STDMETHODCALLTYPE EnableAudioInput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount) = 0; + virtual HRESULT STDMETHODCALLTYPE DisableAudioInput () = 0; + virtual HRESULT STDMETHODCALLTYPE ReadAudioSamples (void* buffer, uint32_t sampleFrameCount, uint32_t *sampleFramesRead, BMDTimeValue *audioPacketTime, BMDTimeScale timeScale) = 0; + virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount (uint32_t *bufferedSampleCount) = 0; + + // Input control + virtual HRESULT STDMETHODCALLTYPE StartStreams () = 0; + virtual HRESULT STDMETHODCALLTYPE StopStreams () = 0; + virtual HRESULT STDMETHODCALLTYPE PauseStreams () = 0; + virtual HRESULT STDMETHODCALLTYPE SetCallback (IDeckLinkInputCallback_v7_1* theCallback) = 0; +}; + +// IDeckLinkVideoFrame_v7_1. Created by IDeckLinkOutput::CreateVideoFrame. +class IDeckLinkVideoFrame_v7_1 : public IUnknown +{ +public: + virtual long STDMETHODCALLTYPE GetWidth () = 0; + virtual long STDMETHODCALLTYPE GetHeight () = 0; + virtual long STDMETHODCALLTYPE GetRowBytes () = 0; + virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat () = 0; + virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags () = 0; + virtual HRESULT STDMETHODCALLTYPE GetBytes (void* *buffer) = 0; +}; + +// IDeckLinkVideoInputFrame_v7_1. Provided by the IDeckLinkInput_v7_1 frame arrival callback. +class IDeckLinkVideoInputFrame_v7_1 : public IDeckLinkVideoFrame_v7_1 +{ +public: + virtual HRESULT STDMETHODCALLTYPE GetFrameTime (BMDTimeValue *frameTime, BMDTimeValue *frameDuration, BMDTimeScale timeScale) = 0; +}; + +// IDeckLinkAudioInputPacket_v7_1. Provided by the IDeckLinkInput_v7_1 callback. +class IDeckLinkAudioInputPacket_v7_1 : public IUnknown +{ +public: + virtual long STDMETHODCALLTYPE GetSampleCount () = 0; + virtual HRESULT STDMETHODCALLTYPE GetBytes (void* *buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAudioPacketTime (BMDTimeValue *packetTime, BMDTimeScale timeScale) = 0; +}; + +#endif // defined(__cplusplus) + +#endif // __DeckLink_API_v7_1_h__ + diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_3.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_3.h new file mode 100644 index 00000000..8634e9c8 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_3.h @@ -0,0 +1,186 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +/* DeckLinkAPI_v7_3.h */ + +#ifndef __DeckLink_API_v7_3_h__ +#define __DeckLink_API_v7_3_h__ + +#include "DeckLinkAPI.h" +#include "DeckLinkAPI_v7_6.h" + +/* Interface ID Declarations */ + +#define IID_IDeckLinkInputCallback_v7_3 /* FD6F311D-4D00-444B-9ED4-1F25B5730AD0 */ (REFIID){0xFD,0x6F,0x31,0x1D,0x4D,0x00,0x44,0x4B,0x9E,0xD4,0x1F,0x25,0xB5,0x73,0x0A,0xD0} +#define IID_IDeckLinkOutput_v7_3 /* 271C65E3-C323-4344-A30F-D908BCB20AA3 */ (REFIID){0x27,0x1C,0x65,0xE3,0xC3,0x23,0x43,0x44,0xA3,0x0F,0xD9,0x08,0xBC,0xB2,0x0A,0xA3} +#define IID_IDeckLinkInput_v7_3 /* 4973F012-9925-458C-871C-18774CDBBECB */ (REFIID){0x49,0x73,0xF0,0x12,0x99,0x25,0x45,0x8C,0x87,0x1C,0x18,0x77,0x4C,0xDB,0xBE,0xCB} +#define IID_IDeckLinkVideoInputFrame_v7_3 /* CF317790-2894-11DE-8C30-0800200C9A66 */ (REFIID){0xCF,0x31,0x77,0x90,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66} + +/* End Interface ID Declarations */ + +#if defined(__cplusplus) + +/* Forward Declarations */ + +class IDeckLinkVideoInputFrame_v7_3; + +/* End Forward Declarations */ + + +/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkOutput_v7_3 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, /* out */ BMDDisplayModeSupport_v10_11 *result) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Output */ + + virtual HRESULT EnableVideoOutput (BMDDisplayMode displayMode, BMDVideoOutputFlags flags) = 0; + virtual HRESULT DisableVideoOutput (void) = 0; + + virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + virtual HRESULT CreateVideoFrame (int32_t width, int32_t height, int32_t rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0; + virtual HRESULT CreateAncillaryData (BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0; + virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale) = 0; + virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0; + virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0; + + /* Audio Output */ + + virtual HRESULT EnableAudioOutput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount, BMDAudioOutputStreamType streamType) = 0; + virtual HRESULT DisableAudioOutput (void) = 0; + + virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT BeginAudioPreroll (void) = 0; + virtual HRESULT EndAudioPreroll (void) = 0; + virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, uint32_t sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0; + virtual HRESULT FlushBufferedAudioSamples (void) = 0; + + virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + /* Output Control */ + + virtual HRESULT StartScheduledPlayback (BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed) = 0; + virtual HRESULT StopScheduledPlayback (BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, BMDTimeScale timeScale) = 0; + virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0; + virtual HRESULT GetHardwareReferenceClock (BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0; + +protected: + virtual ~IDeckLinkOutput_v7_3 () {}; // call Release method to drop reference count +}; + +/* End Interface IDeckLinkOutput */ + + +/* Interface IDeckLinkInputCallback - Frame arrival callback. */ + +class IDeckLinkInputCallback_v7_3 : public IUnknown +{ +public: + virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode_v7_6 *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame_v7_3 *videoFrame, /* in */ IDeckLinkAudioInputPacket *audioPacket) = 0; + +protected: + virtual ~IDeckLinkInputCallback_v7_3 () {}; // call Release method to drop reference count +}; + +/* End Interface IDeckLinkInputCallback */ + + +/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkInput_v7_3 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, /* out */ BMDDisplayModeSupport_v10_11 *result) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback_v7_3 *theCallback) = 0; + +protected: + virtual ~IDeckLinkInput_v7_3 () {}; // call Release method to drop reference count +}; + +/* End Interface IDeckLinkInput */ + +/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */ + +class IDeckLinkVideoInputFrame_v7_3 : public IDeckLinkVideoFrame_v7_6 +{ +public: + virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration, BMDTimeScale timeScale) = 0; + +protected: + virtual ~IDeckLinkVideoInputFrame_v7_3 () {}; // call Release method to drop reference count +}; + +/* End Interface IDeckLinkVideoInputFrame */ + +#endif // defined(__cplusplus) +#endif // __DeckLink_API_v7_3_h__ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_6.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_6.h new file mode 100644 index 00000000..df9e0071 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_6.h @@ -0,0 +1,435 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +/* DeckLinkAPI_v7_6.h */ + +#ifndef __DeckLink_API_v7_6_h__ +#define __DeckLink_API_v7_6_h__ + +#include "DeckLinkAPI.h" +#include "DeckLinkAPI_v10_11.h" + +// Interface ID Declarations + +#define IID_IDeckLinkVideoOutputCallback_v7_6 /* E763A626-4A3C-49D1-BF13-E7AD3692AE52 */ (REFIID){0xE7,0x63,0xA6,0x26,0x4A,0x3C,0x49,0xD1,0xBF,0x13,0xE7,0xAD,0x36,0x92,0xAE,0x52} +#define IID_IDeckLinkInputCallback_v7_6 /* 31D28EE7-88B6-4CB1-897A-CDBF79A26414 */ (REFIID){0x31,0xD2,0x8E,0xE7,0x88,0xB6,0x4C,0xB1,0x89,0x7A,0xCD,0xBF,0x79,0xA2,0x64,0x14} +#define IID_IDeckLinkDisplayModeIterator_v7_6 /* 455D741F-1779-4800-86F5-0B5D13D79751 */ (REFIID){0x45,0x5D,0x74,0x1F,0x17,0x79,0x48,0x00,0x86,0xF5,0x0B,0x5D,0x13,0xD7,0x97,0x51} +#define IID_IDeckLinkDisplayMode_v7_6 /* 87451E84-2B7E-439E-A629-4393EA4A8550 */ (REFIID){0x87,0x45,0x1E,0x84,0x2B,0x7E,0x43,0x9E,0xA6,0x29,0x43,0x93,0xEA,0x4A,0x85,0x50} +#define IID_IDeckLinkOutput_v7_6 /* 29228142-EB8C-4141-A621-F74026450955 */ (REFIID){0x29,0x22,0x81,0x42,0xEB,0x8C,0x41,0x41,0xA6,0x21,0xF7,0x40,0x26,0x45,0x09,0x55} +#define IID_IDeckLinkInput_v7_6 /* 300C135A-9F43-48E2-9906-6D7911D93CF1 */ (REFIID){0x30,0x0C,0x13,0x5A,0x9F,0x43,0x48,0xE2,0x99,0x06,0x6D,0x79,0x11,0xD9,0x3C,0xF1} +#define IID_IDeckLinkTimecode_v7_6 /* EFB9BCA6-A521-44F7-BD69-2332F24D9EE6 */ (REFIID){0xEF,0xB9,0xBC,0xA6,0xA5,0x21,0x44,0xF7,0xBD,0x69,0x23,0x32,0xF2,0x4D,0x9E,0xE6} +#define IID_IDeckLinkVideoFrame_v7_6 /* A8D8238E-6B18-4196-99E1-5AF717B83D32 */ (REFIID){0xA8,0xD8,0x23,0x8E,0x6B,0x18,0x41,0x96,0x99,0xE1,0x5A,0xF7,0x17,0xB8,0x3D,0x32} +#define IID_IDeckLinkMutableVideoFrame_v7_6 /* 46FCEE00-B4E6-43D0-91C0-023A7FCEB34F */ (REFIID){0x46,0xFC,0xEE,0x00,0xB4,0xE6,0x43,0xD0,0x91,0xC0,0x02,0x3A,0x7F,0xCE,0xB3,0x4F} +#define IID_IDeckLinkVideoInputFrame_v7_6 /* 9A74FA41-AE9F-47AC-8CF4-01F42DD59965 */ (REFIID){0x9A,0x74,0xFA,0x41,0xAE,0x9F,0x47,0xAC,0x8C,0xF4,0x01,0xF4,0x2D,0xD5,0x99,0x65} +#define IID_IDeckLinkScreenPreviewCallback_v7_6 /* 373F499D-4B4D-4518-AD22-6354E5A5825E */ (REFIID){0x37,0x3F,0x49,0x9D,0x4B,0x4D,0x45,0x18,0xAD,0x22,0x63,0x54,0xE5,0xA5,0x82,0x5E} +#define IID_IDeckLinkCocoaScreenPreviewCallback_v7_6 /* D174152F-8F96-4C07-83A5-DD5F5AF0A2AA */ (REFIID){0xD1,0x74,0x15,0x2F,0x8F,0x96,0x4C,0x07,0x83,0xA5,0xDD,0x5F,0x5A,0xF0,0xA2,0xAA} +#define IID_IDeckLinkGLScreenPreviewHelper_v7_6 /* BA575CD9-A15E-497B-B2C2-F9AFE7BE4EBA */ (REFIID){0xBA,0x57,0x5C,0xD9,0xA1,0x5E,0x49,0x7B,0xB2,0xC2,0xF9,0xAF,0xE7,0xBE,0x4E,0xBA} +#define IID_IDeckLinkVideoConversion_v7_6 /* 3EB504C9-F97D-40FE-A158-D407D48CB53B */ (REFIID){0x3E,0xB5,0x04,0xC9,0xF9,0x7D,0x40,0xFE,0xA1,0x58,0xD4,0x07,0xD4,0x8C,0xB5,0x3B} +#define IID_IDeckLinkConfiguration_v7_6 /* B8EAD569-B764-47F0-A73F-AE40DF6CBF10 */ (REFIID){0xB8,0xEA,0xD5,0x69,0xB7,0x64,0x47,0xF0,0xA7,0x3F,0xAE,0x40,0xDF,0x6C,0xBF,0x10} + + +#if defined(__cplusplus) + +/* Enum BMDVideoConnection - Video connection types */ + +typedef uint32_t BMDVideoConnection_v7_6; +enum _BMDVideoConnection_v7_6 { + bmdVideoConnectionSDI_v7_6 = 'sdi ', + bmdVideoConnectionHDMI_v7_6 = 'hdmi', + bmdVideoConnectionOpticalSDI_v7_6 = 'opti', + bmdVideoConnectionComponent_v7_6 = 'cpnt', + bmdVideoConnectionComposite_v7_6 = 'cmst', + bmdVideoConnectionSVideo_v7_6 = 'svid' +}; + + +// Forward Declarations + +class IDeckLinkVideoOutputCallback_v7_6; +class IDeckLinkInputCallback_v7_6; +class IDeckLinkDisplayModeIterator_v7_6; +class IDeckLinkDisplayMode_v7_6; +class IDeckLinkOutput_v7_6; +class IDeckLinkInput_v7_6; +class IDeckLinkTimecode_v7_6; +class IDeckLinkVideoFrame_v7_6; +class IDeckLinkMutableVideoFrame_v7_6; +class IDeckLinkVideoInputFrame_v7_6; +class IDeckLinkScreenPreviewCallback_v7_6; +class IDeckLinkCocoaScreenPreviewCallback_v7_6; +class IDeckLinkGLScreenPreviewHelper_v7_6; +class IDeckLinkVideoConversion_v7_6; + + +/* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */ + +class IDeckLinkVideoOutputCallback_v7_6 : public IUnknown +{ +public: + virtual HRESULT ScheduledFrameCompleted (/* in */ IDeckLinkVideoFrame_v7_6 *completedFrame, /* in */ BMDOutputFrameCompletionResult result) = 0; + virtual HRESULT ScheduledPlaybackHasStopped (void) = 0; + +protected: + virtual ~IDeckLinkVideoOutputCallback_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkInputCallback - Frame arrival callback. */ + +class IDeckLinkInputCallback_v7_6 : public IUnknown +{ +public: + virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode_v7_6 *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame_v7_6* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0; + +protected: + virtual ~IDeckLinkInputCallback_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkDisplayModeIterator - enumerates over supported input/output display modes. */ + +class IDeckLinkDisplayModeIterator_v7_6 : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLinkDisplayMode_v7_6 **deckLinkDisplayMode) = 0; + +protected: + virtual ~IDeckLinkDisplayModeIterator_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkDisplayMode - represents a display mode */ + +class IDeckLinkDisplayMode_v7_6 : public IUnknown +{ +public: + virtual HRESULT GetName (/* out */ CFStringRef *name) = 0; + virtual BMDDisplayMode GetDisplayMode (void) = 0; + virtual long GetWidth (void) = 0; + virtual long GetHeight (void) = 0; + virtual HRESULT GetFrameRate (/* out */ BMDTimeValue *frameDuration, /* out */ BMDTimeScale *timeScale) = 0; + virtual BMDFieldDominance GetFieldDominance (void) = 0; + +protected: + virtual ~IDeckLinkDisplayMode_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkOutput_v7_6 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* out */ BMDDisplayModeSupport_v10_11 *result) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0; + + /* Video Output */ + + virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0; + virtual HRESULT DisableVideoOutput (void) = 0; + + virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0; + virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0; + virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback_v7_6 *theCallback) = 0; + virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0; + + /* Audio Output */ + + virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0; + virtual HRESULT DisableAudioOutput (void) = 0; + + virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT BeginAudioPreroll (void) = 0; + virtual HRESULT EndAudioPreroll (void) = 0; + virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0; + virtual HRESULT FlushBufferedAudioSamples (void) = 0; + + virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + /* Output Control */ + + virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0; + virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0; + virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkOutput_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkInput_v7_6 - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkInput_v7_6 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* out */ BMDDisplayModeSupport_v10_11 *result) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback_v7_6 *theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkInput_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkTimecode - Used for video frame timecode representation. */ + +class IDeckLinkTimecode_v7_6 : public IUnknown +{ +public: + virtual BMDTimecodeBCD GetBCD (void) = 0; + virtual HRESULT GetComponents (/* out */ uint8_t *hours, /* out */ uint8_t *minutes, /* out */ uint8_t *seconds, /* out */ uint8_t *frames) = 0; + virtual HRESULT GetString (/* out */ CFStringRef *timecode) = 0; + virtual BMDTimecodeFlags GetFlags (void) = 0; + +protected: + virtual ~IDeckLinkTimecode_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */ + +class IDeckLinkVideoFrame_v7_6 : public IUnknown +{ +public: + virtual long GetWidth (void) = 0; + virtual long GetHeight (void) = 0; + virtual long GetRowBytes (void) = 0; + virtual BMDPixelFormat GetPixelFormat (void) = 0; + virtual BMDFrameFlags GetFlags (void) = 0; + virtual HRESULT GetBytes (/* out */ void **buffer) = 0; + + virtual HRESULT GetTimecode (BMDTimecodeFormat format, /* out */ IDeckLinkTimecode_v7_6 **timecode) = 0; + virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary **ancillary) = 0; + +protected: + virtual ~IDeckLinkVideoFrame_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */ + +class IDeckLinkMutableVideoFrame_v7_6 : public IDeckLinkVideoFrame_v7_6 +{ +public: + virtual HRESULT SetFlags (BMDFrameFlags newFlags) = 0; + + virtual HRESULT SetTimecode (BMDTimecodeFormat format, /* in */ IDeckLinkTimecode_v7_6 *timecode) = 0; + virtual HRESULT SetTimecodeFromComponents (BMDTimecodeFormat format, uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t frames, BMDTimecodeFlags flags) = 0; + virtual HRESULT SetAncillaryData (/* in */ IDeckLinkVideoFrameAncillary *ancillary) = 0; + +protected: + virtual ~IDeckLinkMutableVideoFrame_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */ + +class IDeckLinkVideoInputFrame_v7_6 : public IDeckLinkVideoFrame_v7_6 +{ +public: + virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration, BMDTimeScale timeScale) = 0; + virtual HRESULT GetHardwareReferenceTimestamp (BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0; + +protected: + virtual ~IDeckLinkVideoInputFrame_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */ + +class IDeckLinkScreenPreviewCallback_v7_6 : public IUnknown +{ +public: + virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0; + +protected: + virtual ~IDeckLinkScreenPreviewCallback_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkCocoaScreenPreviewCallback - Screen preview callback for Cocoa-based applications */ + +class IDeckLinkCocoaScreenPreviewCallback_v7_6 : public IDeckLinkScreenPreviewCallback_v7_6 +{ +public: + +protected: + virtual ~IDeckLinkCocoaScreenPreviewCallback_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */ + +class IDeckLinkGLScreenPreviewHelper_v7_6 : public IUnknown +{ +public: + + /* Methods must be called with OpenGL context set */ + + virtual HRESULT InitializeGL (void) = 0; + virtual HRESULT PaintGL (void) = 0; + virtual HRESULT SetFrame (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0; + +protected: + virtual ~IDeckLinkGLScreenPreviewHelper_v7_6 () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkVideoConversion - Created with CoCreateInstance(). */ + +class IDeckLinkVideoConversion_v7_6 : public IUnknown +{ +public: + virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame_v7_6* srcFrame, /* in */ IDeckLinkVideoFrame_v7_6* dstFrame) = 0; + +protected: + virtual ~IDeckLinkVideoConversion_v7_6 () {}; // call Release method to drop reference count +}; + +/* Interface IDeckLinkConfiguration - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkConfiguration_v7_6 : public IUnknown +{ +public: + virtual HRESULT GetConfigurationValidator (/* out */ IDeckLinkConfiguration_v7_6 **configObject) = 0; + virtual HRESULT WriteConfigurationToPreferences (void) = 0; + + /* Video Output Configuration */ + + virtual HRESULT SetVideoOutputFormat (/* in */ BMDVideoConnection_v7_6 videoOutputConnection) = 0; + virtual HRESULT IsVideoOutputActive (/* in */ BMDVideoConnection_v7_6 videoOutputConnection, /* out */ bool *active) = 0; + + virtual HRESULT SetAnalogVideoOutputFlags (/* in */ BMDAnalogVideoFlags analogVideoFlags) = 0; + virtual HRESULT GetAnalogVideoOutputFlags (/* out */ BMDAnalogVideoFlags *analogVideoFlags) = 0; + + virtual HRESULT EnableFieldFlickerRemovalWhenPaused (/* in */ bool enable) = 0; + virtual HRESULT IsEnabledFieldFlickerRemovalWhenPaused (/* out */ bool *enabled) = 0; + + virtual HRESULT Set444And3GBpsVideoOutput (/* in */ bool enable444VideoOutput, /* in */ bool enable3GbsOutput) = 0; + virtual HRESULT Get444And3GBpsVideoOutput (/* out */ bool *is444VideoOutputEnabled, /* out */ bool *threeGbsOutputEnabled) = 0; + + virtual HRESULT SetVideoOutputConversionMode (/* in */ BMDVideoOutputConversionMode conversionMode) = 0; + virtual HRESULT GetVideoOutputConversionMode (/* out */ BMDVideoOutputConversionMode *conversionMode) = 0; + + virtual HRESULT Set_HD1080p24_to_HD1080i5994_Conversion (/* in */ bool enable) = 0; + virtual HRESULT Get_HD1080p24_to_HD1080i5994_Conversion (/* out */ bool *enabled) = 0; + + /* Video Input Configuration */ + + virtual HRESULT SetVideoInputFormat (/* in */ BMDVideoConnection_v7_6 videoInputFormat) = 0; + virtual HRESULT GetVideoInputFormat (/* out */ BMDVideoConnection_v7_6 *videoInputFormat) = 0; + + virtual HRESULT SetAnalogVideoInputFlags (/* in */ BMDAnalogVideoFlags analogVideoFlags) = 0; + virtual HRESULT GetAnalogVideoInputFlags (/* out */ BMDAnalogVideoFlags *analogVideoFlags) = 0; + + virtual HRESULT SetVideoInputConversionMode (/* in */ BMDVideoInputConversionMode conversionMode) = 0; + virtual HRESULT GetVideoInputConversionMode (/* out */ BMDVideoInputConversionMode *conversionMode) = 0; + + virtual HRESULT SetBlackVideoOutputDuringCapture (/* in */ bool blackOutInCapture) = 0; + virtual HRESULT GetBlackVideoOutputDuringCapture (/* out */ bool *blackOutInCapture) = 0; + + virtual HRESULT Set32PulldownSequenceInitialTimecodeFrame (/* in */ uint32_t aFrameTimecode) = 0; + virtual HRESULT Get32PulldownSequenceInitialTimecodeFrame (/* out */ uint32_t *aFrameTimecode) = 0; + + virtual HRESULT SetVancSourceLineMapping (/* in */ uint32_t activeLine1VANCsource, /* in */ uint32_t activeLine2VANCsource, /* in */ uint32_t activeLine3VANCsource) = 0; + virtual HRESULT GetVancSourceLineMapping (/* out */ uint32_t *activeLine1VANCsource, /* out */ uint32_t *activeLine2VANCsource, /* out */ uint32_t *activeLine3VANCsource) = 0; + + /* Audio Input Configuration */ + + virtual HRESULT SetAudioInputFormat (/* in */ BMDAudioConnection audioInputFormat) = 0; + virtual HRESULT GetAudioInputFormat (/* out */ BMDAudioConnection *audioInputFormat) = 0; +}; + + + +/* Functions */ + +extern "C" { + + IDeckLinkIterator* CreateDeckLinkIteratorInstance_v7_6 (void); + IDeckLinkGLScreenPreviewHelper_v7_6* CreateOpenGLScreenPreviewHelper_v7_6 (void); + IDeckLinkCocoaScreenPreviewCallback_v7_6* CreateCocoaScreenPreview_v7_6 (void* /* (NSView*) */ parentView); + IDeckLinkVideoConversion_v7_6* CreateVideoConversionInstance_v7_6 (void); + +}; + + +#endif // defined(__cplusplus) +#endif // __DeckLink_API_v7_6_h__ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_9.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_9.h new file mode 100644 index 00000000..4ea8e58f --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v7_9.h @@ -0,0 +1,104 @@ +/* -LICENSE-START- +** Copyright (c) 2010 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +/* DeckLinkAPI_v7_9.h */ + +#ifndef __DeckLink_API_v7_9_h__ +#define __DeckLink_API_v7_9_h__ + +#include "DeckLinkAPI.h" + +// Interface ID Declarations + +#define IID_IDeckLinkDeckControl_v7_9 /* A4D81043-0619-42B7-8ED6-602D29041DF7 */ (REFIID){0xA4,0xD8,0x10,0x43,0x06,0x19,0x42,0xB7,0x8E,0xD6,0x60,0x2D,0x29,0x04,0x1D,0xF7} + + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLinkDeckControl_v7_9; + + +/* Interface IDeckLinkDeckControl_v7_9 - Deck Control main interface */ + +class IDeckLinkDeckControl_v7_9 : public IUnknown +{ +public: + virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Close (/* in */ bool standbyOn) = 0; + virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0; + virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0; + virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecodeString (/* out */ BMDstring *currentTimeCode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0; + virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0; + virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0; + virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0; + virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0; + virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0; + virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0; + virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Abort (void) = 0; + virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback *callback) = 0; + +protected: + virtual ~IDeckLinkDeckControl_v7_9 () {}; // call Release method to drop reference count +}; + + +#endif // defined(__cplusplus) +#endif // __DeckLink_API_v7_9_h__ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v8_0.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v8_0.h new file mode 100644 index 00000000..0239ab61 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v8_0.h @@ -0,0 +1,76 @@ +/* -LICENSE-START- +** Copyright (c) 2011 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v8_0_H +#define BMD_DECKLINKAPI_v8_0_H + +#include "DeckLinkAPI.h" + +// Interface ID Declarations + +#define IID_IDeckLink_v8_0 /* 62BFF75D-6569-4E55-8D4D-66AA03829ABC */ (REFIID){0x62,0xBF,0xF7,0x5D,0x65,0x69,0x4E,0x55,0x8D,0x4D,0x66,0xAA,0x03,0x82,0x9A,0xBC} +#define IID_IDeckLinkIterator_v8_0 /* 74E936FC-CC28-4A67-81A0-1E94E52D4E69 */ (REFIID){0x74,0xE9,0x36,0xFC,0xCC,0x28,0x4A,0x67,0x81,0xA0,0x1E,0x94,0xE5,0x2D,0x4E,0x69} + +#if defined (__cplusplus) + +/* Interface IDeckLink_v8_0 - represents a DeckLink device */ + +class IDeckLink_v8_0 : public IUnknown +{ +public: + virtual HRESULT GetModelName (/* out */ CFStringRef *modelName) = 0; +}; + +/* Interface IDeckLinkIterator_v8_0 - enumerates installed DeckLink hardware */ + +class IDeckLinkIterator_v8_0 : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLink_v8_0 **deckLinkInstance) = 0; +}; + +extern "C" { + IDeckLinkIterator_v8_0* CreateDeckLinkIteratorInstance_v8_0 (void); +}; + + +#endif // defined __cplusplus + +#endif /* defined(BMD_DECKLINKAPI_v8_0_H) */ diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v8_1.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v8_1.h new file mode 100644 index 00000000..33c77f55 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v8_1.h @@ -0,0 +1,124 @@ +/* -LICENSE-START- + ** Copyright (c) 2011 Blackmagic Design + ** + ** Permission is hereby granted, free of charge, to any person or organization + ** obtaining a copy of the software and accompanying documentation (the + ** "Software") to use, reproduce, display, distribute, sub-license, execute, + ** and transmit the Software, and to prepare derivative works of the Software, + ** and to permit third-parties to whom the Software is furnished to do so, in + ** accordance with: + ** + ** (1) if the Software is obtained from Blackmagic Design, the End User License + ** Agreement for the Software Development Kit (“EULA”) available at + ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or + ** + ** (2) if the Software is obtained from any third party, such licensing terms + ** as notified by that third party, + ** + ** and all subject to the following: + ** + ** (3) the copyright notices in the Software and this entire statement, + ** including the above license grant, this restriction and the following + ** disclaimer, must be included in all copies of the Software, in whole or in + ** part, and all derivative works of the Software, unless such copies or + ** derivative works are solely in the form of machine-executable object code + ** generated by a source language processor. + ** + ** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + ** DEALINGS IN THE SOFTWARE. + ** + ** A copy of the Software is available free of charge at + ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. + ** + ** -LICENSE-END- + */ + +#ifndef BMD_DECKLINKAPI_v8_1_H +#define BMD_DECKLINKAPI_v8_1_H + +#include "DeckLinkAPI.h" + + +// Interface ID Declarations + +#define IID_IDeckLinkDeckControlStatusCallback_v8_1 /* E5F693C1-4283-4716-B18F-C1431521955B */ (REFIID){0xE5,0xF6,0x93,0xC1,0x42,0x83,0x47,0x16,0xB1,0x8F,0xC1,0x43,0x15,0x21,0x95,0x5B} +#define IID_IDeckLinkDeckControl_v8_1 /* 522A9E39-0F3C-4742-94EE-D80DE335DA1D */ (REFIID){0x52,0x2A,0x9E,0x39,0x0F,0x3C,0x47,0x42,0x94,0xEE,0xD8,0x0D,0xE3,0x35,0xDA,0x1D} + + +/* Enum BMDDeckControlVTRControlState_v8_1 - VTR Control state */ + +typedef uint32_t BMDDeckControlVTRControlState_v8_1; +enum _BMDDeckControlVTRControlState_v8_1 { + bmdDeckControlNotInVTRControlMode_v8_1 = 'nvcm', + bmdDeckControlVTRControlPlaying_v8_1 = 'vtrp', + bmdDeckControlVTRControlRecording_v8_1 = 'vtrr', + bmdDeckControlVTRControlStill_v8_1 = 'vtra', + bmdDeckControlVTRControlSeeking_v8_1 = 'vtrs', + bmdDeckControlVTRControlStopped_v8_1 = 'vtro' +}; + + +/* Interface IDeckLinkDeckControlStatusCallback_v8_1 - Deck control state change callback. */ + +class IDeckLinkDeckControlStatusCallback_v8_1 : public IUnknown +{ +public: + virtual HRESULT TimecodeUpdate (/* in */ BMDTimecodeBCD currentTimecode) = 0; + virtual HRESULT VTRControlStateChanged (/* in */ BMDDeckControlVTRControlState_v8_1 newState, /* in */ BMDDeckControlError error) = 0; + virtual HRESULT DeckControlEventReceived (/* in */ BMDDeckControlEvent event, /* in */ BMDDeckControlError error) = 0; + virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0; + +protected: + virtual ~IDeckLinkDeckControlStatusCallback_v8_1 () {}; // call Release method to drop reference count +}; + +/* Interface IDeckLinkDeckControl_v8_1 - Deck Control main interface */ + +class IDeckLinkDeckControl_v8_1 : public IUnknown +{ +public: + virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Close (/* in */ bool standbyOn) = 0; + virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState_v8_1 *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0; + virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0; + 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; + virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecodeString (/* out */ CFStringRef *currentTimeCode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0; + virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0; + virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0; + virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0; + virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0; + virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0; + virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0; + virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Abort (void) = 0; + virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback_v8_1 *callback) = 0; + +protected: + virtual ~IDeckLinkDeckControl_v8_1 () {}; // call Release method to drop reference count +}; + + +#endif // BMD_DECKLINKAPI_v8_1_H diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v9_2.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v9_2.h new file mode 100644 index 00000000..e06210d9 --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v9_2.h @@ -0,0 +1,96 @@ +/* -LICENSE-START- +** Copyright (c) 2012 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v9_2_H +#define BMD_DECKLINKAPI_v9_2_H + +#include "DeckLinkAPI.h" +#include "DeckLinkAPI_v10_11.h" +#include "DeckLinkAPIVideoInput_v11_5_1.h" + + +// Interface ID Declarations + +#define IID_IDeckLinkInput_v9_2 /* 6D40EF78-28B9-4E21-990D-95BB7750A04F */ (REFIID){0x6D,0x40,0xEF,0x78,0x28,0xB9,0x4E,0x21,0x99,0x0D,0x95,0xBB,0x77,0x50,0xA0,0x4F} + + +#if defined(__cplusplus) + +/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkInput_v9_2 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport_v10_11 *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback_v11_5_1 *theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkInput_v9_2 () {}; // call Release method to drop reference count +}; + + +#endif // defined(__cplusplus) +#endif // BMD_DECKLINKAPI_v9_2_H diff --git a/DeckLinkSDK/Mac/include/DeckLinkAPI_v9_9.h b/DeckLinkSDK/Mac/include/DeckLinkAPI_v9_9.h new file mode 100644 index 00000000..095a1fed --- /dev/null +++ b/DeckLinkSDK/Mac/include/DeckLinkAPI_v9_9.h @@ -0,0 +1,115 @@ +/* -LICENSE-START- +** Copyright (c) 2013 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation (the +** "Software") to use, reproduce, display, distribute, sub-license, execute, +** and transmit the Software, and to prepare derivative works of the Software, +** and to permit third-parties to whom the Software is furnished to do so, in +** accordance with: +** +** (1) if the Software is obtained from Blackmagic Design, the End User License +** Agreement for the Software Development Kit (“EULA”) available at +** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or +** +** (2) if the Software is obtained from any third party, such licensing terms +** as notified by that third party, +** +** and all subject to the following: +** +** (3) the copyright notices in the Software and this entire statement, +** including the above license grant, this restriction and the following +** disclaimer, must be included in all copies of the Software, in whole or in +** part, and all derivative works of the Software, unless such copies or +** derivative works are solely in the form of machine-executable object code +** generated by a source language processor. +** +** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** +** A copy of the Software is available free of charge at +** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. +** +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_v9_9_H +#define BMD_DECKLINKAPI_v9_9_H + +#include "DeckLinkAPI.h" +#include "DeckLinkAPI_v10_11.h" + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkOutput_v9_9 = /* A3EF0963-0862-44ED-92A9-EE89ABF431C7 */ {0xA3,0xEF,0x09,0x63,0x08,0x62,0x44,0xED,0x92,0xA9,0xEE,0x89,0xAB,0xF4,0x31,0xC7}; + + +#if defined(__cplusplus) + +// Forward Declarations +class IDeckLinkOutput_v9_9; + +/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkOutput_v9_9 : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoOutputFlags flags, /* out */ BMDDisplayModeSupport_v10_11 *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Output */ + + virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0; + virtual HRESULT DisableVideoOutput (void) = 0; + + virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame **outFrame) = 0; + virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame *theFrame) = 0; + virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0; + virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0; + + /* Audio Output */ + + virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0; + virtual HRESULT DisableAudioOutput (void) = 0; + + virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT BeginAudioPreroll (void) = 0; + virtual HRESULT EndAudioPreroll (void) = 0; + virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0; + virtual HRESULT FlushBufferedAudioSamples (void) = 0; + + virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + /* Output Control */ + + virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0; + virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0; + virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0; + virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus *referenceStatus) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkOutput_v9_9 () {}; // call Release method to drop reference count +}; + +#endif // defined(__cplusplus) +#endif /* defined(BMD_DECKLINKAPI_v9_9_H) */ + diff --git a/Sony9PinRemote/README.md b/Sony9PinRemote/README.md new file mode 100644 index 00000000..f45b5a1e --- /dev/null +++ b/Sony9PinRemote/README.md @@ -0,0 +1,458 @@ +# Sony9PinRemote + +RS422 Sony 9-Pin Protocol Remote Controller of VTRs for Arduino + +## Usage + +```C++ +#include + +Sony9PinRemote::Controller deck; + +void setup() +{ + // serial should be set and attach as follows + Serial1.begin(Sony9PinSerial::BAUDRATE, Sony9PinSerial::CONFIG); + delay(2000); + + deck.attach(Serial1); + + // get device status + deck.status_sense(); + if (deck.parse_until(1000)) // wait until response comes (timeout = 1000ms) + { + if (!deck.is_media_exist()) + Serial.println("ERROR: there is no media!"); + + if (!deck.is_remote_enabled()) + Serial.println("ERROR: remote control is disabled!"); + + if (!deck.is_disk_available()) + Serial.println("ERROR: removable media is not available!"); + + if (!deck.is_stopping()) + { + deck.stop(); + deck.parse_until(1000); + } + + deck.device_type(); + if (deck.parse_until(1000)) + { + Serial.print("device type = "); + Serial.println(deck.device(), HEX); + } + else + Serial.println("ERROR: device type request failed!!"); + } + else + { + Serial.println("ERROR: device status request failed!!"); + } +} + +void loop() +{ + // receive and parse reponse packet + deck.parse(); + + // if previous command has completed (response has come) + if (deck.ready()) + { + static bool b = false; + if (b) deck.play(); + else deck.stop(); + b = !b; + delay(2000); + } +} +``` + +## Connection + +We need five pins of RS422/485 output at least (TX+, TX-, RX+, RX-, and GND) to connect to a deck controller with Sony 9 Pin protocol. General pin connection can be like this. But this may be changed depending on the controller. + +![connection_breakouts](assets/connection_breakouts.png) + +If you want to connect to the deck controller from your PC, the connection will be like this. + +![connection_breakouts](assets/connection_pc_to_deck.png) + + +## References + +- P.30 of [HyperDeck Manual](https://documents.blackmagicdesign.com/UserManuals/HyperDeckManual.pdf) +- [command list](https://www.drastic.tv/support-59/legacysoftwarehardware/37-miscellaneous-legacy/180-vvcr-422-serial-protocol) +- [connection diagrams](http://www.dspj.co.jp/~manuals/mergingtechnologies/PMX_v5/EnglishManual/Sony9pin%20Wiring%20Chart.pdf) + + + +## Supported Commands + +- X : Supported +- \* : Supported Encoding Only +- Blank : Not Supported + + +| | Command (HEX) | Response (HEX) | Note | +|---|---------------------------------|------------------------------------|--------------------------------------| +| X | [00 0C] Local Disable | [10 01] Ack | | +| X | [00 11] Device Type Request | [12 11] Device Type | | +| X | [00 1D] Local Enable | [10 01] Ack | | +| X | [20 00] Stop | [10 01] Ack | | +| X | [20 01] Play | [10 01] Ack | | +| X | [20 02] Record | [10 01] Ack | | +| X | [20 04] Standby Off | [10 01] Ack | | +| X | [20 05] Standby On | [10 01] Ack | | +| X | [20 0F] Eject | [10 01] Ack | | +| X | [20 10] Fast Fwd | [10 01] Ack | | +| X | [2X 11] Jog Fwd | [10 01] Ack | | +| X | [2X 12] Var Fwd | [10 01] Ack | | +| X | [2X 13] Shuttle Fwd | [10 01] Ack | | +| X | [20 14] Frame Step Fwd | [10 01] Ack | | +| X | [20 20] Fast Reverse | [10 01] Ack | | +| X | [20 20] Rewind | [10 01] Ack | | +| X | [2X 21] Jog Rev | [10 01] Ack | | +| X | [2X 22] Var Rev | [10 01] Ack | | +| X | [2X 23] Shuttle Rev | [10 01] Ack | | +| X | [20 24] Frame Step Rev | [10 01] Ack | | +| X | [20 30] Preroll | [10 01] Ack | | +| X | [24 31] Cue up with Data | [10 01] Ack | | +| X | [20 34] Sync Play | [10 01] Ack | | +| X | [21 38] Prog Speed Play + | [10 01] Ack | | +| X | [21 39] Prog Speed Play - | [10 01] Ack | | +| X | [20 40] Preview | [10 01] Ack | | +| X | [20 41] Review | [10 01] Ack | | +| X | [20 42] Auto Edit | [10 01] Ack | | +| X | [20 43] Outpoint Preview | [10 01] Ack | | +| | [2X 54] Anti-Clog Timer Disable | [10 01] Ack | Command/Response Data format unknown | +| | [2X 55] Anti-Clog Timer Enable | [10 01] Ack | Command/Response Data format unknown | +| X | [2X 5C] DMC Set Forward | [10 01] Ack | | +| X | [2X 5D] DMC Set Reverse | [10 01] Ack | | +| X | [20 60] Full EE Off | [10 01] Ack | | +| X | [20 61] Full EE On | [10 01] Ack | | +| X | [20 63] Select EE On | [10 01] Ack | | +| X | [20 64] Edit Off | [10 01] Ack | | +| X | [20 65] Edit On | [10 01] Ack | | +| X | [20 6A] Freeze Off | [10 01] Ack | | +| X | [20 6B] Freeze On | [10 01] Ack | | +| X | [44 00] Timer-1 Preset | [10 01] Ack | | +| X | [44 04] Time Code Preset | [10 01] Ack | | +| X | [44 05] User Bit Preset | [10 01] Ack | | +| X | [40 08] Timer-1 Reset | [10 01] Ack | | +| X | [40 10] In Entry | [10 01] Ack | | +| X | [40 11] Out Entry | [10 01] Ack | | +| X | [40 12] Audio In Entry | [10 01] Ack | | +| X | [40 13] Audio Out Entry | [10 01] Ack | | +| X | [44 14] In Data Preset | [10 01] Ack | | +| X | [44 15] Out Data Preset | [10 01] Ack | | +| | [4? 16] Audio In Data Preset | [10 01] Ack | Command/Response Data format unknown | +| | [4? 17] Audio Out Data Preset | [10 01] Ack | Command/Response Data format unknown | +| X | [40 18] In + Shift | [10 01] Ack | | +| X | [40 19] In - Shift | [10 01] Ack | | +| X | [40 1A] Out + Shift | [10 01] Ack | | +| X | [40 1B] Out - Shift | [10 01] Ack | | +| X | [40 1C] Audio In + Shift | [10 01] Ack | | +| X | [40 1D] Audio In - Shift | [10 01] Ack | | +| X | [40 1E] Audio Out + Shift | [10 01] Ack | | +| X | [40 1F] Audio Out - Shift | [10 01] Ack | | +| X | [40 20] In Flag Reset | [10 01] Ack | | +| X | [40 21] Out Flag Reset | [10 01] Ack | | +| X | [40 22] Audio In Flag Reset | [10 01] Ack | | +| X | [40 23] Audio Out Flag Reset | [10 01] Ack | | +| X | [40 24] In Recall | [10 01] Ack | | +| X | [40 25] Out Recall | [10 01] Ack | | +| X | [40 26] Audio In Recall | [10 01] Ack | | +| X | [40 27] Audio Out Recall | [10 01] Ack | | +| X | [40 2D] Lost Lock Reset | [10 01] Ack | | +| X | [4X 30] Edit Preset | [10 01] Ack | | +| X | [44 31] Preroll time preset | [10 01] Ack | | +| X | [41 32] Tape/Audo Select | [10 01] Ack | | +| X | [41 33] Servo Ref Select | [10 01] Ack | | +| X | [41 34] Head Select | [10 01] Ack | | +| X | [41 35] Color Frame select | [10 01] Ack | | +| X | [41 36] Timer Mode Select | [10 01] Ack | | +| X | [41 37] Input Check | [10 01] Ack | | +| X | [41 3A] Edit Field Select | [10 01] Ack | | +| X | [41 3B] Freeze Mode Select | [10 01] Ack | | +| | [4X 3E] Record Inhibit | [10 01] Ack | Command/Response Data format unknown | +| X | [40 40] Auto Mode Off | [10 01] Ack | | +| X | [40 41] Auto Mode On | [10 01] Ack | | +| X | [40 42] Spot Erase Off | [10 01] Ack | | +| X | [40 43] Spot Erase On | [10 01] Ack | | +| X | [40 44] Audio Split Off | [10 01] Ack | | +| X | [40 45] Audio Split On | [10 01] Ack | | +| | [4X 98] Output H Phase | [10 01] Ack | Command/Response Data format unknown | +| | [4X 9B] Output Video Phase | [10 01] Ack | Command/Response Data format unknown | +| | [4X A0] Audio Input Level | [10 01] Ack | Command/Response Data format unknown | +| | [4X A1] Audio Output Level | [10 01] Ack | Command/Response Data format unknown | +| | [4X A2] Audio Adv Level | [10 01] Ack | Command/Response Data format unknown | +| | [4X A8] Audio Output Phase | [10 01] Ack | Command/Response Data format unknown | +| | [4X A9] Audio Adv Out Phase | [10 01] Ack | Command/Response Data format unknown | +| | [4X AA] Cross Fade Time Preset | [10 01] Ack | Command/Response Data format unknown | +| | [4X B8] Local Key Map | [10 01] Ack | Command/Response Data format unknown | +| X | [42 F8] Still Off time | [10 01] Ack | | +| X | [42 FA] Stby Off time | [10 01] Ack | | +| X | [61 0A] TC Gen Sense | Multiple responses as follows | | +| X | | [78 08] Gen Time and UB Data | | +| X | | [74 08] Gen Time Data | | +| X | | [74 09] Gen User Bits Data | | +| X | [61 0C] Current Time Sense | Multiple responses as follows | | +| X | | [74 00] Timer-1 (CTL Counter) Data | | +| X | | [74 01] Timer-2 (CTL Counter) Data | | +| X | | [74 04] LTC Time | | +| X | | [78 04] LTC Time and UB Data | | +| X | | [74 05] LTC User Bits Data | | +| X | | [78 06] VITC Time + UB Data | | +| X | | [74 06] VITC Time | | +| X | | [74 07] VITC User Bits Data | | +| X | | [78 14] LTC Interpolated Time + UB | | +| X | | [74 14] LTC Interpolated Time | | +| X | | [74 15] LTC Interpolated UB Data | | +| X | | [78 16] Hold VITC Time + UB | | +| X | | [74 16] Hold VITC Time | | +| X | | [74 17] Hold VITC User Bits Data | | +| X | [60 10] In Data Sense | [74 10] In Data | | +| X | [60 11] Out Data Sense | [74 11] Out Data | | +| * | [60 12] Audio In Data Sense | [74 12] Audio In Data | Response Data format unknown | +| * | [60 13] Audio Out Data Sense | [74 13] Audio Out Data | Response Data format unknown | +| X | [61 20] Status Sense | [7X 20] Status Data | | +| * | [61 21] Extended VTR Status | [7X 21] Extended Status Data | Response Data format unknown | +| * | [62 23] Signal Control Sense | [7X 23] Signal Control Data | Response Data format unknown | +| | [6X 28] Local Key Map Sense | [7X 28] Local Key Map | Command/Response Data format unknown | +| * | [61 2A] Head Meter Sense | [7X 2A] Head Meter Data | Response Data format unknown | +| * | [60 2B] Remaining Time Sense | [76 2B] Remaining Time | Response Data format unknown | +| * | [60 2E] Cmd Speed Sense | [7X 2E] Cmd Speed Data | Response Data format unknown | +| * | [61 30] Edit Preset Sense | [7X 30] Edit Preset Status | Response Data format unknown | +| X | [60 31] Preroll Time Sense | [74 31] Preroll Time | | +| X | [60 36] Timer Mode Sense | [71 36] Timer Mode Status | | +| * | [60 3E] Record Inhibit Sens | [72 3E] Record Inhibit Status | Response Data format unknown | +| * | [60 52] DA Inp Emph Sense | [71 52] DA Input Emphasis Data | Response Data format unknown | +| * | [60 53] DA PB Emph Sense | [71 53] DA Playback Emphasis Data | Response Data format unknown | +| * | [60 58] DA Samp. Freq. Sense | [71 58] DA Sampling Frequency Data | Response Data format unknown | +| * | [61 AA] Cross Fade Time Sense | [7X AA] Cross Fade Time Data | Response Data format unknown | + +### BlackMagic Advanced Media Protocol + +| | Command (HEX) | Response (HEX) | Note | +|---|----------------------------------|------------------------------------|-------------------------------------| +| X | [08 02] Bmd Seek To Timeline Pos | [10 01] Ack | | +| X | [20 29] Clear Playlist | [10 01] Ack | | +| | [4F 16] Append Preset | [10 01] Ack | Data format unknown | +| X | [41 42] Set Playback Loop | [10 01] Ack | | +| X | [41 44] Set Stop Mode | [10 01] Ack | | +| X | [81 03] Bmd Seek Relative Clip | [10 01] Ack | | +| X | [A1 01] Auto Skip | [10 01] Ack | | +| | [AX 15] List Next ID | [10 01] Ack | Data format unknown | + +## Enable Debug Logger + +You can see the debug log when you insert following line before include `Sony9PinRemote`. + +``` C++ +#define SONY9PINREMOTE_DEBUGLOG_ENABLE +#include +``` + + +## APIs + +```C++ +// Sony9PinRemote::Controller +void attach(StreamType& s, const bool force_send = false) +void parse(); +bool parse_until(const uint32_t timeout_ms); +bool ready() const; +bool available() const; +uint16_t device() const; +const Status& status() const; +const Errors& errors() const; +size_t error_count() const; +// 0 - System Control +void local_disable(); +void device_type(); +void lock_enable(); +// 2 - Transport Control +void stop(); +void play(); +void record(); +void standby_off(); +void standby_on(); +void eject(); +void fast_forward(); +void jog_forward(const uint8_t data1, const uint8_t data2 = 0); +void var_forward(const uint8_t data1, const uint8_t data2 = 0); +void shuttle_forward(const uint8_t data1, const uint8_t data2 = 0); +void fast_reverse(); +void rewind(); +void jog_reverse(const uint8_t data1, const uint8_t data2 = 0); +void var_reverse(const uint8_t data1, const uint8_t data2 = 0); +void shuttle_reverse(const uint8_t data1, const uint8_t data2 = 0); +void preroll(); +void cue_up_with_data(const uint8_t hours, const uint8_t minutes, const uint8_t seconds, const uint8_t frames); +void sync_play(); +void prog_speed_play_plus(const uint8_t v); +void prog_speed_play_minus(const uint8_t v); +void preview(); +void review(); +// void auto_edit(); +void outpoint_preview(); +void dmc_set_fwd(const uint8_t data1, const uint8_t data2); +void dmc_set_rev(const uint8_t data1, const uint8_t data2); +void full_ee_off(); +void full_ee_on(); +void select_ee_on(); +void clearPlaylist(); +// 4 - Preset/Select Control +void in_entry(); +void out_entry(); +void in_data_preset(const uint8_t hours, const uint8_t minutes, const uint8_t seconds, const uint8_t frames); +void out_data_preset(const uint8_t hours, const uint8_t minutes, const uint8_t seconds, const uint8_t frames); +void in_shift_plus(); +void in_shift_minus(); +void out_shift_plus(); +void out_shift_minus(); +void in_reset(); +void out_reset(); +void a_in_reset(); +void a_out_reset(); +void preroll_prset(const uint8_t hours, const uint8_t minutes, const uint8_t seconds, const uint8_t frames); +void auto_mode_off(); +void auto_mode_on(); +void input_check(uint8_t v); +void set_playback_loop(const bool b_enable, const uint8_t mode = LoopMode::SINGLE_CLIP); +void set_stop_mode(const uint8_t stop_mode); +// void append_preset(); +// 6 - Sense Request +void tc_gen_sense(const uint8_t data1); +void ub_gen_sense(const uint8_t data1); +void tc_ub_gen_sense(const uint8_t data1); +void in_data_sense(); +void out_data_sense(); +void a_in_data_sense(); +void a_out_data_sense(); +void status_sense(const uint8_t start = 0, const uint8_t size = 9); +void speed_sense(); +void preroll_time_sense(); +void timer_mode_sense(); +void record_inhibit_sense(); +// A - Advanced Media Protocol +void auto_skip(const int8_t n); +// void list_next_id(); +// Blackmagic Extensions +// void bmd_seek_to_timeline_position(const uint16_t pos) +// void bmd_seek_relative_clip(const int8_t index) +// status check +bool is_media_exist() const; +bool is_remote_enabled() const; +bool is_disk_available() const; +bool is_stopping() const; +bool is_rewinding() const; +bool is_forwarding() const; +bool is_recoding() const; +bool is_playing() const; +bool is_servo_lock() const; +bool is_shuttle() const; +bool is_jog() const; +bool is_var() const; +bool is_reverse() const; +bool is_paused() const; +bool is_auto_mode() const; +bool is_a_out_set() const; +bool is_a_in_set() const; +bool is_out_set() const; +bool is_in_set() const; +bool is_select_ee() const; +bool is_full_ee() const; +bool is_lamp_still() const; +bool is_lamp_fwd() const; +bool is_lamp_rev() const; +bool is_near_eot() const; +bool is_eot() const; +``` + +### Configuration + +```C++ +namespace LoopMode +{ + enum : uint8_t + { + SINGLE_CLIP, + TIMELINE + }; +} + +namespace StopMode +{ + enum : uint8_t + { + OFF, + FREEZE_ON_LAST_FRAME, + FREEZE_ON_NEXT_CLIP, + SHOW_BLACK + }; +} +``` + +### Response Structs + +```C++ +struct Errors +{ + bool b_unknown_cmd; + bool b_checksum_error; + bool b_parity_error; + bool b_buffer_overrun; + bool b_framing_error; + bool b_timeout; +}; + +struct Status +{ + // byte 0 + bool b_cassette_out; + bool b_local; + // byte 1 + bool b_standby; + bool b_stop; + bool b_rewind; + bool b_forward; + bool b_record; + bool b_play; + // byte 2 + bool b_servo_lock; + bool b_shuttle; + bool b_jog; + bool b_var; + bool b_direction; + bool b_still; + // byte 3 + bool b_auto_mode; + bool b_a_out_set; + bool b_a_in_set; + bool b_out_set; + bool b_in_set; + // byte 4 + bool b_select_ee; + bool b_full_ee; + // byte 6 + bool b_lamp_still; + bool b_lamp_fwd; + bool b_lamp_rev; + // byte 8 + bool b_near_eot; + bool b_eot; +}; +``` + +## Embedded Libraries + +- [ArxContainer v0.4.0](https://github.com/hideakitai/ArxContainer) +- [ArxTypeTraits v0.2.3](https://github.com/hideakitai/ArxTypeTraits) +- [DebugLog v0.6.2](https://github.com/hideakitai/DebugLog) + + +## License + +MIT diff --git a/Sony9PinRemote/Sony9PinRemote.h b/Sony9PinRemote/Sony9PinRemote.h new file mode 100644 index 00000000..019f3265 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote.h @@ -0,0 +1,1169 @@ +#ifndef HT_RS422_SONY9PINREMOTE_H +#define HT_RS422_SONY9PINREMOTE_H + +#ifdef ARDUINO +#include +#endif +#include + +#if defined(ARDUINO) || defined(OF_VERSION_MAJOR) || defined(QT_VERSION) +#define SONY9PINREMOTE_ENABLE_STREAM +#endif + +#include "Sony9PinRemote/Types.h" +#include "Sony9PinRemote/Encoder.h" +#include "Sony9PinRemote/Decoder.h" + +#ifdef SONY9PINREMOTE_DEBUGLOG_ENABLE +#include "Sony9PinRemote/util/DebugLog/DebugLogEnable.h" +#else +#include "Sony9PinRemote/util/DebugLog/DebugLogDisable.h" +#endif + +namespace sony9pin { + +#ifdef SONY9PINREMOTE_ENABLE_STREAM + +// Arduino +#ifdef ARDUINO +using StreamType = Stream; +#define SONY9PINREMOTE_STREAM_WRITE(data, size) \ + if (size > 0) { \ + if (b_force_send || !b_wait_for_response) { \ + stream->write(data, size); \ + b_wait_for_response = true; \ + } \ + } +#define SONY9PINREMOTE_STREAM_READ(data, size) stream->readBytes(data, size) +#define SONY9PINREMOTE_STREAM_AVAILABLE() stream->available() +#define SONY9PINREMOTE_STREAM_FLUSH() stream->flush() +#define SONY9PINREMOTE_ELAPSED_MILLIS() millis() +namespace serial { + static constexpr size_t BAUDRATE {38400}; + static constexpr size_t CONFIG {SERIAL_8O1}; +} // namespace serial + +// openFrameworks +#elif defined(OF_VERSION_MAJOR) +using StreamType = ofSerial; +#define SONY9PINREMOTE_STREAM_WRITE(data, size) \ + if (size > 0) { \ + if (b_force_send || !b_wait_for_response) { \ + stream->writeBytes(data, size); \ + b_wait_for_response = true; \ + } \ + } +#define SONY9PINREMOTE_STREAM_READ(data, size) stream->readBytes(data, size) +#define SONY9PINREMOTE_STREAM_AVAILABLE() stream->available() +#define SONY9PINREMOTE_STREAM_FLUSH() stream->flush() +#define SONY9PINREMOTE_ELAPSED_MILLIS() ofGetElapsedTimeMillis() +namespace serial { + static constexpr size_t BAUDRATE {38400}; + // static constexpr size_t CONFIG {SERIAL_8O1}; +} // namespace serial + +// Qt +#elif defined(QT_VERSION) +#include +using StreamType = QSerialPort; +#define SONY9PINREMOTE_STREAM_WRITE(data, size) \ + if (size > 0) { \ + if (b_force_send || !b_wait_for_response) { \ + stream->write((const char*)data, size); \ + if (!stream->waitForBytesWritten()) { \ + LOG_ERROR("Writing to serial FAILED"); \ + } \ + b_wait_for_response = true; \ + } \ + } +#define SONY9PINREMOTE_STREAM_READ(data, size) stream->read((char*)data, size) +#define SONY9PINREMOTE_STREAM_AVAILABLE() stream->waitForReadyRead(1) ? stream->bytesAvailable() : 0 +#define SONY9PINREMOTE_STREAM_FLUSH() stream->flush() +#define SONY9PINREMOTE_ELAPSED_MILLIS() uint32_t((double)(clock()) / (CLOCKS_PER_SEC / 1000)) +namespace serial { + static constexpr size_t BAUDRATE {QSerialPort::Baud38400}; + // static constexpr size_t CONFIG {SERIAL_8O1}; +} // namespace serial + +#endif // ARDUINO / OF_VERSION_MAIJOR / QT_VERSION +// Not Supported +#else // SONY9PINREMOTE_ENABLE_STREAM + +#error THIS PLATFORM IS NOT SUPPORTED + +#endif // SONY9PINREMOTE_ENABLE_STREAM + +class Controller { + // reference + // https://en.wikipedia.org/wiki/9-Pin_Protocol + // https://www.drastic.tv/support-59/legacysoftwarehardware/37-miscellaneous-legacy/180-vvcr-422-serial-protocol + + StreamType* stream; + Encoder encoder; + Decoder decoder; + + uint16_t dev_type {0xFFFF}; + Status sts; + Errors err; + size_t err_count {0}; + + uint8_t status_start {0}; + uint8_t status_size {10}; + + bool b_force_send {false}; + bool b_wait_for_response {false}; + +public: + void attach(StreamType& s, const bool force_send = false) { + b_force_send = force_send; + stream = &s; + SONY9PINREMOTE_STREAM_FLUSH(); + while (const size_t size = SONY9PINREMOTE_STREAM_AVAILABLE()) { + uint8_t* data = new uint8_t[size]; + SONY9PINREMOTE_STREAM_READ(data, size); + delete[] data; + } + } + + bool parse() { + while (const size_t size = SONY9PINREMOTE_STREAM_AVAILABLE()) { + uint8_t* data = new uint8_t[size]; + SONY9PINREMOTE_STREAM_READ(data, size); + for (size_t i = 0; i < size; ++i) { + if (decoder.feed(data[i])) { + // store the data which is useful if it can be referred anytime we want + switch (decoder.cmd1()) { + case Cmd1::SYSTEM_CONTROL_RETURN: { + switch (decoder.cmd2()) { + case SystemControlReturn::NAK: { + err_count++; + err = decoder.nak(); + break; + } + case SystemControlReturn::DEVICE_TYPE: { + dev_type = decoder.device_type(); + break; + } + } + } + // Fallthrough + case Cmd1::SENSE_RETURN: { + if (decoder.cmd2() == SenseReturn::STATUS_DATA) { + // decode status based on requested range by `status_sense()` + sts = decoder.status_sense(status_start, status_size); + } + break; + } + default: + break; + } + b_wait_for_response = false; + delete[] data; + return true; + } + } + delete[] data; + } + return false; + } + + bool parse_until(const uint32_t timeout_ms) { + const uint32_t begin_ms = SONY9PINREMOTE_ELAPSED_MILLIS(); + while (true) { + if (parse()) + return true; + if (SONY9PINREMOTE_ELAPSED_MILLIS() > begin_ms + timeout_ms) + return false; + } + } + + bool ready() const { return b_force_send ? true : (!decoder.busy() && !b_wait_for_response); } + bool available() const { return decoder.available(); } + + uint16_t device_type() const { return dev_type; } + const Status& status() const { return sts; } + const Errors& errors() const { return err; } + size_t error_count() const { return err_count; } + + // =============== 0 - System Control =============== + + void local_disable() { + auto packet = encoder.local_disable(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void device_type_request() { + auto packet = encoder.device_type_request(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void local_enable() { + auto packet = encoder.local_enable(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + // =============== 2 - Transport Control =============== + + void stop() { + auto packet = encoder.stop(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void play() { + auto packet = encoder.play(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void record() { + auto packet = encoder.record(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void standby_off() { + auto packet = encoder.standby_off(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void standby_on() { + auto packet = encoder.standby_on(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void eject() { + auto packet = encoder.eject(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void fast_forward() { + auto packet = encoder.fast_forward(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void jog_forward(const uint8_t data1, const uint8_t data2 = 0) { + auto packet = encoder.jog_forward(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void var_forward(const uint8_t data1, const uint8_t data2 = 0) { + auto packet = encoder.var_forward(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void shuttle_forward(const uint8_t data1, const uint8_t data2 = 0) { + auto packet = encoder.shuttle_forward(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void frame_step_forward() { + auto packet = encoder.frame_step_forward(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void fast_reverse() { + auto packet = encoder.fast_reverse(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void rewind() { + auto packet = encoder.rewind(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void jog_reverse(const uint8_t data1, const uint8_t data2 = 0) { + auto packet = encoder.jog_reverse(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void var_reverse(const uint8_t data1, const uint8_t data2 = 0) { + auto packet = encoder.var_reverse(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void shuttle_reverse(const uint8_t data1, const uint8_t data2 = 0) { + auto packet = encoder.shuttle_reverse(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void frame_step_reverse() { + auto packet = encoder.frame_step_reverse(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void preroll() { + auto packet = encoder.preroll(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void cue_up_with_data(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff) { + auto packet = encoder.cue_up_with_data(hh, mm, ss, ff); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void sync_play() { + auto packet = encoder.sync_play(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void prog_speed_play_plus(const uint8_t v) { + auto packet = encoder.prog_speed_play_plus(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void prog_speed_play_minus(const uint8_t v) { + auto packet = encoder.prog_speed_play_minus(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void preview() { + auto packet = encoder.preview(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void review() { + auto packet = encoder.review(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void auto_edit() { + auto packet = encoder.auto_edit(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void outpoint_preview() { + auto packet = encoder.outpoint_preview(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void anti_clog_timer_disable() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.anti_clog_timer_disable(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void anti_clog_timer_enable() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.anti_clog_timer_enable(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void dmc_set_fwd(const uint8_t data1, const uint8_t data2) { + auto packet = encoder.dmc_set_fwd(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void dmc_set_rev(const uint8_t data1, const uint8_t data2) { + auto packet = encoder.dmc_set_rev(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void full_ee_off() { + auto packet = encoder.full_ee_off(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void full_ee_on() { + auto packet = encoder.full_ee_on(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void select_ee_on() { + auto packet = encoder.select_ee_on(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void edit_off() { + auto packet = encoder.edit_off(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void edit_on() { + auto packet = encoder.edit_on(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void freeze_off() { + auto packet = encoder.freeze_off(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void freeze_on() { + auto packet = encoder.freeze_on(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + // =============== 4 - Preset/Select Control =============== + + void timer1_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff, const bool is_df) { + auto packet = encoder.timer1_preset(hh, mm, ss, ff, is_df); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void time_code_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff, const bool is_df) { + auto packet = encoder.time_code_preset(hh, mm, ss, ff, is_df); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void user_bit_preset(const uint8_t data1, const uint8_t data2, const uint8_t data3, const uint8_t data4) { + auto packet = encoder.user_bit_preset(data1, data2, data3, data4); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void timer1_reset() { + auto packet = encoder.timer1_reset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void in_entry() { + auto packet = encoder.in_entry(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void out_entry() { + auto packet = encoder.out_entry(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_in_entry() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_in_entry(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_out_entry() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_out_entry(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void in_data_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff) { + auto packet = encoder.in_data_preset(hh, mm, ss, ff); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void out_data_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff) { + auto packet = encoder.out_data_preset(hh, mm, ss, ff); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_in_data_preset() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_in_data_preset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_out_data_preset() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_out_data_preset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void in_shift_plus() { + auto packet = encoder.in_shift_plus(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void in_shift_minus() { + auto packet = encoder.in_shift_minus(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void out_shift_plus() { + auto packet = encoder.out_shift_plus(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void out_shift_minus() { + auto packet = encoder.out_shift_minus(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_in_shift_plus() { + auto packet = encoder.audio_in_shift_plus(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_in_shift_minus() { + auto packet = encoder.audio_in_shift_minus(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_out_shift_plus() { + auto packet = encoder.audio_out_shift_plus(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_out_shift_minus() { + auto packet = encoder.audio_out_shift_minus(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void in_flag_reset() { + auto packet = encoder.in_flag_reset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void out_flag_reset() { + auto packet = encoder.out_flag_reset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_in_flag_reset() { + auto packet = encoder.audio_in_flag_reset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_out_flag_reset() { + auto packet = encoder.audio_out_flag_reset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void in_recall() { + auto packet = encoder.in_recall(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void out_recall() { + auto packet = encoder.out_recall(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_in_recall() { + auto packet = encoder.audio_in_recall(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_out_recall() { + auto packet = encoder.audio_out_recall(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void lost_lock_reset() { + auto packet = encoder.lost_lock_reset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void edit_preset(const uint8_t data1, const uint8_t data2) { + // TODO: more user-friendly arguments? + auto packet = encoder.edit_preset(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void preroll_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff) { + auto packet = encoder.preroll_preset(hh, mm, ss, ff); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void tape_audio_select(const uint8_t v) { + auto packet = encoder.tape_audio_select(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void servo_ref_select(const uint8_t v) { + auto packet = encoder.servo_ref_select(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void head_select(const uint8_t v) { + auto packet = encoder.head_select(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void color_frame_select(const uint8_t v) { + auto packet = encoder.color_frame_select(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void timer_mode_select(const TimerMode tm) { + auto packet = encoder.timer_mode_select(tm); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void input_check(const uint8_t v) { + auto packet = encoder.input_check(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void edit_field_select(const uint8_t v) { + auto packet = encoder.edit_field_select(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void freeze_mode_select(const uint8_t v) { + auto packet = encoder.freeze_mode_select(v); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void record_inhibit() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.record_inhibit(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void auto_mode_off() { + auto packet = encoder.auto_mode_off(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void auto_mode_on() { + auto packet = encoder.auto_mode_on(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void spot_erase_off() { + auto packet = encoder.spot_erase_off(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void spot_erase_on() { + auto packet = encoder.spot_erase_on(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_split_off() { + auto packet = encoder.audio_split_off(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_split_on() { + auto packet = encoder.audio_split_on(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void output_h_phase() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.output_h_phase(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void output_video_phase() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.output_video_phase(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_input_level() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_input_level(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_output_level() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_output_level(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_adv_level() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_adv_level(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_output_phase() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_output_phase(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_adv_output_phase() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.audio_adv_output_phase(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void cross_fade_time_preset() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.cross_fade_time_preset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void local_key_map() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.local_key_map(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void still_off_time(const uint8_t data1, const uint8_t data2) { + // TODO: more user-friendly arguments? + auto packet = encoder.still_off_time(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void stby_off_time(const uint8_t data1, const uint8_t data2) { + // TODO: more user-friendly arguments? + auto packet = encoder.stby_off_time(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + // =============== 6 - Sense Request =============== + + void tc_gen_sense(const uint8_t data1) { + auto packet = encoder.tc_gen_sense(data1); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + void tc_gen_sense_tc() { + tc_gen_sense(TcGenData::TC); + } + void tc_gen_sense_ub() { + tc_gen_sense(TcGenData::UB); + } + void tc_ub_gen_sense_tc_and_ub() { + tc_gen_sense(TcGenData::TC_UB); + } + + void current_time_sense(const uint8_t data1) { + auto packet = encoder.current_time_sense(data1); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + void current_time_sense_timer1() { + using namespace CurrentTimeSenseFlag; + current_time_sense(TIMER_1); + } + void current_time_sense_timer2() { + using namespace CurrentTimeSenseFlag; + current_time_sense(TIMER_2); + } + void current_time_sense_ltc_tc_ub() { + using namespace CurrentTimeSenseFlag; + current_time_sense(LTC_UB | LTC_TC); + } + void current_time_sense_ltc_tc() { + using namespace CurrentTimeSenseFlag; + current_time_sense(LTC_TC); + } + void current_time_sense_ltc_ub() { + using namespace CurrentTimeSenseFlag; + current_time_sense(LTC_UB); + } + void current_time_sense_vitc_tc_ub() { + using namespace CurrentTimeSenseFlag; + current_time_sense(VITC_UB | VITC_TC); + } + void current_time_sense_vitc_tc() { + using namespace CurrentTimeSenseFlag; + current_time_sense(VITC_TC); + } + void current_time_sense_vitc_ub() { + using namespace CurrentTimeSenseFlag; + current_time_sense(VITC_UB); + } + // TODO: should confirm if ltc interpolated flag, currently same as LTC + void current_time_sense_ltc_interpolated_tc_ub() { + using namespace CurrentTimeSenseFlag; + current_time_sense(LTC_UB | LTC_TC); + } + void current_time_sense_ltc_interpolated_tc() { + using namespace CurrentTimeSenseFlag; + current_time_sense(LTC_TC); + } + void current_time_sense_ltc_interpolated_ub() { + using namespace CurrentTimeSenseFlag; + current_time_sense(LTC_UB); + } + + void in_data_sense() { + auto packet = encoder.in_data_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void out_data_sense() { + auto packet = encoder.out_data_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_in_data_sense() { + auto packet = encoder.audio_in_data_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void audio_out_data_sense() { + auto packet = encoder.audio_out_data_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void status_sense(const uint8_t start = 0, const uint8_t size = 10) { + status_start = start; + status_size = size; + auto packet = encoder.status_sense(start, size); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void extended_vtr_status(const uint8_t data1) { + auto packet = encoder.extended_vtr_status(data1); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void signal_control_sense(const uint8_t data1, const uint8_t data2) { + auto packet = encoder.signal_control_sense(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void local_keymap_sense() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.local_keymap_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void head_meter_sense(const uint8_t data1) { + auto packet = encoder.head_meter_sense(data1); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void remaining_time_sense() { + auto packet = encoder.remaining_time_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void cmd_speed_sense() { + auto packet = encoder.cmd_speed_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void edit_preset_sense(const uint8_t data1) { + auto packet = encoder.edit_preset_sense(data1); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void preroll_time_sense() { + auto packet = encoder.preroll_time_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void timer_mode_sense() { + auto packet = encoder.timer_mode_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void record_inhibit_sense() { + auto packet = encoder.record_inhibit_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void da_inp_emph_sense() { + auto packet = encoder.da_inp_emph_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void da_pb_emph_sense() { + auto packet = encoder.da_pb_emph_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void da_samp_freq_sense() { + auto packet = encoder.da_samp_freq_sense(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void cross_fade_time_sense(const uint8_t data1) { + auto packet = encoder.cross_fade_time_sense(data1); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + // =============== A - BlackMagic Advanced Media Protocol =============== + + void bmd_seek_to_timeline_pos(const uint8_t data1, const uint8_t data2) { + // TODO: more user-friendly arguments? + auto packet = encoder.bmd_seek_to_timeline_pos(data1, data2); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void clear_playlist() { + auto packet = encoder.clear_playlist(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void append_preset() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.append_preset(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void set_playback_loop(const bool b_enable, const uint8_t mode = LoopMode::SINGLE_CLIP) { + auto packet = encoder.set_playback_loop(b_enable, mode); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void set_stop_mode(const uint8_t stop_mode) { + auto packet = encoder.set_stop_mode(stop_mode); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void bmd_seek_relative_clip(const int8_t index) { + auto packet = encoder.bmd_seek_relative_clip(index); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void auto_skip(const int8_t n) { + auto packet = encoder.auto_skip(n); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + void list_next_id() { + // TODO: NOT IMPLEMENTED + auto packet = encoder.list_next_id(); + SONY9PINREMOTE_STREAM_WRITE(packet.data(), packet.size()); + } + + // =============== 1 - System Control Return =============== + + bool ack() const { return decoder.ack(); } + Errors nak() const { return decoder.nak(); } + uint16_t device_tpe() const { return decoder.device_type(); } + + // =============== 7 - Sense Return =============== + + // Generic timecode/userbits response without packet check + TimeCodeAndUserBits timecode_userbits() const { return decoder.timecode_userbits(); } + TimeCode timecode() const { return decoder.timecode(); } + UserBits userbits() const { return decoder.userbits(); } + + // Responses to 61.0A Gen Time Sense (with packet check) + TimeCodeAndUserBits gen_tc_ub() const { return decoder.gen_tc_ub(); } + TimeCode gen_tc() const { return decoder.gen_tc(); } + UserBits gen_ub() const { return decoder.gen_ub(); } + + // Responses to 61.0C Current Time Sense (with packet check) + TimeCodeAndUserBits timer1_tc_ub() const { return decoder.timer1_tc_ub(); } + TimeCode timer1_tc() const { return decoder.timer1_tc(); } + TimeCodeAndUserBits timer2_tc_ub() const { return decoder.timer2_tc_ub(); } + TimeCode timer2_tc() const { return decoder.timer2_tc(); } + TimeCodeAndUserBits ltc_tc_ub() const { return decoder.ltc_tc_ub(); } + TimeCode ltc_tc() const { return decoder.ltc_tc(); } + UserBits ltc_ub() const { return decoder.ltc_ub(); } + TimeCodeAndUserBits vitc_tc_ub() const { return decoder.vitc_tc_ub(); } + TimeCode vitc_tc() const { return decoder.vitc_tc(); } + UserBits vitc_ub() const { return decoder.vitc_ub(); } + TimeCodeAndUserBits ltc_interpolated_tc_ub() const { return decoder.ltc_interpolated_tc_ub(); } + TimeCode ltc_interpolated_tc() const { return decoder.ltc_interpolated_tc(); } + UserBits ltc_interpolated_ub() const { return decoder.ltc_interpolated_ub(); } + TimeCodeAndUserBits hold_vitc_tc_ub() const { return decoder.hold_vitc_tc_ub(); } + TimeCode hold_vitc_tc() const { return decoder.hold_vitc_tc(); } + UserBits hold_vitc_ub() const { return decoder.hold_vitc_ub(); } + + // Responses to other sense requests + TimeCode in_data() const { return decoder.in_data(); } + TimeCode out_data() const { return decoder.out_data(); } + Status status_sense() const { return decoder.status_sense(status_start, status_size); } + TimeCode preroll_time() const { return decoder.preroll_time(); } + TimerMode timer_mode() const { return decoder.timer_mode(); } + + // =============== Nak Checker =============== + + bool is_nak_unknown_command() const { return err.b_unknown_cmd; } + bool is_nak_checksum_error() const { return err.b_checksum_error; } + bool is_nak_parity_error() const { return err.b_parity_error; } + bool is_nak_buffer_overrun() const { return err.b_buffer_overrun; } + bool is_nak_framing_error() const { return err.b_framing_error; } + bool is_nak_timeout() const { return err.b_timeout; } + + // =============== Status Checker =============== + + // byte 0 + bool is_media_exist() const { return !sts.b_cassette_out; } // set if no ssd is present + bool is_servo_ref_exist() const { return !sts.b_servo_ref_missing; } // set if servo reference is absent + bool is_remote_enabled() const { return !sts.b_local; } // set if remote is disabled (local control) + // byte 1 + bool is_disk_available() const { return sts.b_standby; } // set if a disk is available + bool is_stopping() const { return sts.b_stop; } // When the machine is in full stop, this is 1. The thread state depends on the tape/ee and standby settings. + bool is_ejecting() const { return sts.b_eject; } // When the tape is ejecting this is 1. + bool is_fast_reverse() const { return sts.b_rewind; } // When the machine is in fast reverse this is 1. + bool is_fast_forward() const { return sts.b_forward; } // When the machine is in fast forward this is 1. + bool is_recoding() const { return sts.b_record; } // This bit goes from 0 to 1 some number of frames after the machine starts recording. For the DVR2000 we measured 5 frames. Others have varying delays on the record status. + bool is_playing() const { return sts.b_play; } // This bit goes from 0 to 1 some number of frames after the machine starts playing. For the DVR2000 we measured 5 frames. Others have varying delays on the play status. + // byte 2 + bool is_servo_locked() const { return sts.b_servo_lock; } // 1 indicates servos are locked. This is a necessary condition for an edit to occur correctly. + bool is_tso_mode() const { return sts.b_tso_mode; } // Bit is 1 in tape speed override: in this mode, audio and video are still locked though speed is off play speed by +/- up to 15%. + bool is_shuttle() const { return sts.b_shuttle; } + bool is_jog() const { return sts.b_jog; } + bool is_var() const { return sts.b_var; } + bool is_reverse() const { return sts.b_direction; } // clear if playback is forwarding, set if playback is reversing + bool is_paused() const { return sts.b_still; } // set if playback is paused, or if in input preview mode + bool is_cue_up() const { return sts.b_cue_up; } + // byte 3 + bool is_auto_mode() const { return sts.b_auto_mode; } // set if in Auto Mode + bool is_freezing() const { return sts.b_freeze_on; } + bool is_cf_mode() const { return sts.b_cf_mode; } + bool is_audio_out_set() const { return sts.b_audio_out_set; } + bool is_audio_in_set() const { return sts.b_audio_in_set; } + bool is_out_set() const { return sts.b_out_set; } + bool is_in_set() const { return sts.b_in_set; } + // byte 4 + bool is_select_ee() const { return sts.b_select_ee; } // set if in input preview mode + bool is_full_ee() const { return sts.b_full_ee; } + bool is_edit() const { return sts.b_edit; } + bool is_review() const { return sts.b_review; } + bool is_auto_edit() const { return sts.b_auto_edit; } + bool is_preview() const { return sts.b_preview; } + bool is_preroll() const { return sts.b_preroll; } + // byte 5 + bool is_insert() const { return sts.b_insert; } + bool is_assemble() const { return sts.b_assemble; } + bool is_video() const { return sts.b_video; } + bool is_a4() const { return sts.b_a4; } + bool is_a3() const { return sts.b_a3; } + bool is_a2() const { return sts.b_a2; } + bool is_a1() const { return sts.b_a1; } + // byte 6 + bool is_lamp_still() const { return sts.b_lamp_still; } // set according to playback speed and direction + bool is_lamp_fwd() const { return sts.b_lamp_fwd; } + bool is_lamp_rev() const { return sts.b_lamp_rev; } + bool is_srch_led_8() const { return sts.b_srch_led_8; } + bool is_srch_led_4() const { return sts.b_srch_led_4; } + bool is_srch_led_2() const { return sts.b_srch_led_2; } + bool is_srch_led_1() const { return sts.b_srch_led_1; } + // byte 7 + bool is_aud_split() const { return sts.b_aud_split; } + bool is_syn_act() const { return sts.b_sync_act; } + bool is_spot_erase() const { return sts.b_spot_erase; } + bool is_in_out() const { return sts.b_in_out; } + // byte 8 + bool is_buzzer() const { return sts.b_buzzer; } + bool is_lost_lock() const { return sts.b_lost_lock; } + bool is_near_eot() const { return sts.b_near_eot; } // set if total space left on available SSDs is less than 3 minutes + bool is_eot() const { return sts.b_eot; } // set if total space left on available SSDs is less than 30 seconds + bool is_cf_lock() const { return sts.b_cf_lock; } + bool is_svo_alarm() const { return sts.b_svo_alarm; } + bool is_sys_alarm() const { return sts.b_sys_alarm; } + bool is_rec_inhib() const { return sts.b_rec_inhib; } + // byte 9 + bool is_fnc_abort() const { return sts.b_fnc_abort; } + + // =============== Utilities =============== + + void print_nak() { + PRINTLN(""); + if (err.b_unknown_cmd) PRINTLN("Unknown Command"); + if (err.b_checksum_error) PRINTLN("Checksum Error"); + if (err.b_parity_error) PRINTLN("Parity Error"); + if (err.b_buffer_overrun) PRINTLN("Buffer Overrun"); + if (err.b_framing_error) PRINTLN("Framing Error"); + if (err.b_timeout) PRINTLN("Timeout"); + } + + void print_status() { + PRINTLN(""); + PRINTLN("=================="); + PRINTLN("------byte 0------"); + PRINTLN("Cassette Out : ", sts.b_cassette_out); + PRINTLN("Servo Ref Mis: ", sts.b_servo_ref_missing); + PRINTLN("Local : ", sts.b_local); + PRINTLN("------byte 1------"); + PRINTLN("Standby : ", sts.b_standby); + PRINTLN("Stop : ", sts.b_stop); + PRINTLN("Eject : ", sts.b_eject); + PRINTLN("Rewind : ", sts.b_rewind); + PRINTLN("Forward : ", sts.b_forward); + PRINTLN("Record : ", sts.b_record); + PRINTLN("Play : ", sts.b_play); + PRINTLN("------byte 2------"); + PRINTLN("Servo Lock : ", sts.b_servo_lock); + PRINTLN("TSO Mode : ", sts.b_tso_mode); + PRINTLN("Shuttle : ", sts.b_shuttle); + PRINTLN("Jog : ", sts.b_jog); + PRINTLN("Var : ", sts.b_var); + PRINTLN("Direction : ", sts.b_direction); + PRINTLN("Still : ", sts.b_still); + PRINTLN("Cue Up : ", sts.b_cue_up); + PRINTLN("------byte 3------"); + PRINTLN("Auto Mode : ", sts.b_auto_mode); + PRINTLN("Freeze On : ", sts.b_freeze_on); + PRINTLN("CF Mode : ", sts.b_cf_mode); + PRINTLN("Audio Out Set: ", sts.b_audio_out_set); + PRINTLN("Audio In Set : ", sts.b_audio_in_set); + PRINTLN("Out Set : ", sts.b_out_set); + PRINTLN("In Set : ", sts.b_in_set); + PRINTLN("------byte 4------"); + PRINTLN("Select EE : ", sts.b_select_ee); + PRINTLN("Full EE : ", sts.b_full_ee); + PRINTLN("Edit : ", sts.b_edit); + PRINTLN("Review : ", sts.b_review); + PRINTLN("Auto Edit : ", sts.b_auto_edit); + PRINTLN("Preview : ", sts.b_preview); + PRINTLN("Preroll : ", sts.b_preroll); + PRINTLN("------byte 5------"); + PRINTLN("Insert : ", sts.b_insert); + PRINTLN("Assemble : ", sts.b_assemble); + PRINTLN("Video : ", sts.b_video); + PRINTLN("A4 : ", sts.b_a4); + PRINTLN("A3 : ", sts.b_a3); + PRINTLN("A2 : ", sts.b_a2); + PRINTLN("A1 : ", sts.b_a1); + PRINTLN("------byte 6------"); + PRINTLN("Lamp Still : ", sts.b_lamp_still); + PRINTLN("Lamp Fwd : ", sts.b_lamp_fwd); + PRINTLN("Lamp Rev : ", sts.b_lamp_rev); + PRINTLN("SRCH Led 8 : ", sts.b_srch_led_8); + PRINTLN("SRCH Led 4 : ", sts.b_srch_led_4); + PRINTLN("SRCH Led 2 : ", sts.b_srch_led_2); + PRINTLN("SRCH Led 1 : ", sts.b_srch_led_1); + PRINTLN("------byte 7------"); + PRINTLN("AUD Split : ", sts.b_aud_split); + PRINTLN("Sync Act : ", sts.b_sync_act); + PRINTLN("Spot Erase : ", sts.b_spot_erase); + PRINTLN("In Out : ", sts.b_in_out); + PRINTLN("------byte 8------"); + PRINTLN("Buzzer : ", sts.b_buzzer); + PRINTLN("Lost Lock : ", sts.b_lost_lock); + PRINTLN("Near EOT : ", sts.b_near_eot); + PRINTLN("EOT : ", sts.b_eot); + PRINTLN("CF Lock : ", sts.b_cf_lock); + PRINTLN("SVO Alarm : ", sts.b_svo_alarm); + PRINTLN("Sys Alarm : ", sts.b_sys_alarm); + PRINTLN("Rec Inhibit : ", sts.b_rec_inhib); + PRINTLN("------byte 9------"); + PRINTLN("FNC Abort : ", sts.b_fnc_abort); + PRINTLN("=================="); + } + + void print_gen_tc_ub() const { print_timecode_userbits(gen_tc_ub()); } + void print_gen_tc() const { print_timecode(gen_tc()); } + void print_gen_ub() const { print_userbits(gen_ub()); } + + void print_timecode_userbits() const { print_timecode_userbits(timecode_userbits()); } + void print_timecode() const { print_timecode(timecode()); } + void print_userbits() const { print_userbits(userbits()); } + void print_timer1_tc_ub() const { print_timecode_userbits(timer1_tc_ub()); } + void print_timer1_tc() const { print_timecode(timer1_tc()); } + void print_timer2_tc_ub() const { print_timecode_userbits(timer2_tc_ub()); } + void print_timer2_tc() const { print_timecode(timer2_tc()); } + void print_ltc_tc_ub() const { print_timecode_userbits(ltc_tc_ub()); } + void print_ltc_tc() const { print_timecode(ltc_tc()); } + void print_ltc_ub() const { print_userbits(ltc_ub()); } + void print_vitc_tc_ub() const { print_timecode_userbits(vitc_tc_ub()); } + void print_vitc_tc() const { print_timecode(vitc_tc()); } + void print_vitc_ub() const { print_userbits(vitc_ub()); } + void print_interpolated_ltc_tc_ub() const { print_timecode_userbits(ltc_interpolated_tc_ub()); } + void print_interpolated_ltc_tc() const { print_timecode(ltc_interpolated_tc()); } + void print_interpolated_ltc_ub() const { print_userbits(ltc_interpolated_ub()); } + void print_hold_vitc_tc_ub() const { print_timecode_userbits(hold_vitc_tc_ub()); } + void print_hold_vitc_tc() const { print_timecode(hold_vitc_tc()); } + void print_hold_vitc_ub() const { print_userbits(hold_vitc_ub()); } + + void print_in_data() const { print_timecode(in_data()); } + void print_out_data() const { print_timecode(out_data()); } + void print_preroll_time() const { print_timecode(preroll_time()); } + +private: + void print_timecode_userbits(const TimeCodeAndUserBits& tcub) const { + print_timecode(tcub.tc); + print_userbits(tcub.ub); + } + + void print_timecode(const TimeCode& tc) const { + PRINTLN("TimeCode:", (int)tc.hour, ":", (int)tc.minute, ":", (int)tc.second, ";", (int)tc.frame, ", CF:", (bool)tc.is_cf, "DF:", (bool)tc.is_df); + } + + void print_userbits(const UserBits& ub) const { + PRINTLN("UserBits:", ub.bytes[0], ub.bytes[1], ub.bytes[2], ub.bytes[3]); + } +}; + +} // namespace sony9pin + +namespace Sony9PinRemote = sony9pin; +namespace Sony9PinDevice = Sony9PinRemote::DeviceType; +namespace Sony9PinSerial = Sony9PinRemote::serial; + +#include "Sony9PinRemote/util/DebugLog/DebugLogRestoreState.h" + +#endif // HT_RS422_SONY9PINREMOTE_H diff --git a/Sony9PinRemote/Sony9PinRemote/Decoder.h b/Sony9PinRemote/Sony9PinRemote/Decoder.h new file mode 100644 index 00000000..bfdb96ba --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/Decoder.h @@ -0,0 +1,713 @@ +#pragma once +#ifndef SONY9PINREMOTE_DECODER_H +#define SONY9PINREMOTE_DECODER_H + +#ifdef ARDUINO +#include +#endif +#include + +#include "Types.h" + +#include "util/ArxTypeTraits/ArxTypeTraits.h" +#include "util/ArxContainer/ArxContainer.h" +#include "util/DebugLog/DebugLog.h" + +#ifdef SONY9PINREMOTE_DEBUGLOG_ENABLE +#include "util/DebugLog/DebugLogEnable.h" +#else +#include "util/DebugLog/DebugLogDisable.h" +#endif + +namespace sony9pin { + +#define SONY9PIN_RESPONSE_CHECK(c1, c2, sz, ret) \ + { \ + bool is_success = true; \ + if (!available()) { \ + LOG_ERROR("No response available"); \ + is_success = false; \ + } else { \ + LOG_INFO( \ + DebugLogBase::HEX, \ + "Response cmd1:", (uint8_t)cmd1(), \ + "cmd2:", cmd2(), \ + "size:", size()); \ + if (!(cmd1() == c1) || !(cmd2() == c2)) { \ + LOG_ERROR( \ + DebugLogBase::HEX, \ + "Packet type mismatch:", \ + (uint8_t)cmd1(), "!=", (uint8_t)c1, \ + "or", \ + cmd2(), "!=", c2); \ + is_success = false; \ + } \ + if (size() != sz) { \ + LOG_ERROR( \ + DebugLogBase::DEC, \ + "Packet size not correct:", \ + size(), "should be", sz); \ + is_success = false; \ + } \ + } \ + if (!is_success) return ret; \ + } + +class Decoder { + uint8_t buffer[MAX_PACKET_SIZE]; + uint8_t next_size {0}; + uint8_t curr_size {0}; + +public: + bool available() const { + return !empty() && (curr_size == next_size); + } + + bool busy() const { + return !empty() && (curr_size < next_size); + } + + Cmd1 cmd1() const { + return available() ? (Cmd1)(buffer[0] & (uint8_t)HeaderMask::CMD1) : Cmd1::NA; + } + + uint8_t cmd2() const { + return available() ? buffer[1] : 0xFF; + } + + uint8_t data(const uint8_t i) { + return available() ? buffer[i + 2] : 0x00; + } + const uint8_t* data() const { + return available() ? buffer + 2 : nullptr; + } + + uint8_t size() const { + return available() ? next_size - 3 : 0; + } + + void clear() { + memset(buffer, 0, MAX_PACKET_SIZE); + next_size = 0; + curr_size = 0; + } + + bool feed(const uint8_t d) { + if (curr_size >= next_size) { // next or unexpected response + clear(); + } + + if (next_size == 0) { // header byte + uint8_t type = d & (uint8_t)HeaderMask::CMD1; + uint8_t size = d & (uint8_t)HeaderMask::SIZE; + + if ((type == (uint8_t)Cmd1::SYSTEM_CONTROL_RETURN) || + (type == (uint8_t)Cmd1::SENSE_RETURN)) { + next_size = size + 3; // header + cmd2 + size + checksum + buffer[curr_size++] = d; + } else { // this is not response headr + LOG_ERROR(DebugLogBase::HEX, "Packet is not response:", type); + clear(); + } + } else if (curr_size < next_size) { + buffer[curr_size++] = d; + + if (curr_size == next_size) { + uint8_t checksum = 0; + for (uint8_t i = 0; i < curr_size - 1; ++i) + checksum += buffer[i]; + + if (d == checksum) { + return true; + } else { + LOG_ERROR(DebugLogBase::HEX, "Checksum not matched:", checksum, "should be", d); + clear(); + } + } + } else { + LOG_ERROR("Unexpected: won't come here"); + clear(); + } + + return false; + } + + // =============== 1 - System Control Return =============== + + // 10.01 ACK + // Returned by the device when a command has been successfully received. + // Although the ACK indicates that the device has begun processing that command, + // it does not necessarily mean that the command was completed and the device is + // in the required state. + bool ack() const { + SONY9PIN_RESPONSE_CHECK(Cmd1::SYSTEM_CONTROL_RETURN, SystemControlReturn::ACK, 0, false); + return true; + } + + // 11.12.XX NAK + // When an error has be detected, the device will return the NAK (negative acknowledgement) + // with the following error status in the third byte of the return. + // If the reason for the device's failure is unknown, then this byte will be zero. + // + // NAK Return Byte 3 (XX): + // BIT DESCRIPTION + // 0 Unknown command was received. Check the command in this document and check your hardware. + // 1 Not used. + // 2 A checksum error occurs when the last byte of the command is not equal to all the + // previous bytes added together and logically 'anded' with FF hex. + // 3 Not used. + // 4 A parity error occurs when one or more of the bytes in a command do not have + // an odd parity bit transmitted with them. This indicates a serial setup problem, + // or hardware/cabling problem. + // 5 Overrun error indicates that the command has overrun the device's internal command + // buffer, and that the command cannot be used. This is an error internal to the device + // that should not occur unless more than one command per frame is sent. + // 6 A framing error indicates a serial setup or hardware problem with the controller. + // 7 A time out occurs when a command takes too long to be sent between bytes, + // or a checksum is sent too late. + Errors nak() const { + Errors errs; + SONY9PIN_RESPONSE_CHECK(Cmd1::SYSTEM_CONTROL_RETURN, SystemControlReturn::NAK, 1, errs); + errs.b_unknown_cmd = buffer[2] & NakMask::UNKNOWN_CMD; + errs.b_checksum_error = buffer[2] & NakMask::CHECKSUM_ERROR; + errs.b_parity_error = buffer[2] & NakMask::PARITY_ERROR; + errs.b_buffer_overrun = buffer[2] & NakMask::BUFFER_OVERRUN; + errs.b_framing_error = buffer[2] & NakMask::FRAMING_ERROR; + errs.b_timeout = buffer[2] & NakMask::TIMEOUT; + return errs; + } + + // 12.11 DEVICE TYPE + // Returns the type of device connected and configured. + // VTR Model Data-1 Data-2 + // Drastic VVCR FE 01 + // JVC BR-S822U F0 1F + // Panasonic AG-7750 A0 81 + // Panasonic AU-65 A0 15 + // Pioneer VDR-1000A F0 15 + // Sony BVW-75 20 25 + // Sony PVW-2800 20 41 + uint16_t device_type() const { + uint16_t dev_no = 0xFFFF; + SONY9PIN_RESPONSE_CHECK(Cmd1::SYSTEM_CONTROL_RETURN, SystemControlReturn::DEVICE_TYPE, 2, dev_no); + dev_no = ((uint16_t)buffer[2] << 8) | (uint16_t)buffer[3]; + return dev_no; + } + + // =============== 7 - Sense Return =============== + + // Responses to 61.0A TC Gen Sense + + // 78.08 GENERATOR TC& mp; UB + // Returned with the TIME and UB data of the TC generated by the device.DATA DATA - + // 1 through DATA - 4 are time data and DATA - 4 through DATA - 8 are User Bit data. + // For the data format, refer to the CUE UP WITH DATA command and U - BIT PRESET. + TimeCodeAndUserBits gen_tc_ub() const { + TimeCodeAndUserBits tcub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::GEN_TC_UB, 8, tcub); + decode_to_timecode(tcub.tc); + decode_to_userbits(tcub.ub); + return tcub; + } + + // 74.08 GENERATOR TC DATA + // Returned with the TC TIME data, generated by the device. + // For the data format, refer to the CUE UP WITH DATA command. + TimeCode gen_tc() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::GEN_TC, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 74.09 GENERATOR UB DATA + // Returned with the UB data of the TC generated by the device. + // For the data format, refer to the U-BIT PRESET. + UserBits gen_ub() const { + UserBits ub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::GEN_UB, 4, ub); + decode_to_userbits(ub); + return ub; + } + + // ===== Responses to 61.0C Current Time Sense ===== + // + // TIME DATA FORMAT + // Time Data Return Format : https://www.drastic.tv/images/protocol/p_tdata.gif + // + // 1. DATA-1/BIT-6:DF FLAG ("1" DF, "0" NDF) + // When the device receives the CURRENT TIME SENSE 61.0C command, + // and has been set to the DB mode, the device will be set to 1. + // When the device receives the TIME CODE PRESET 44.04 command, and the TIME CODE GENERATOR + // has been set to the DF mode, the device will be set to 1. + // + // 2. DATA-1/BIT-7: CF FLAG (1 CF ON, 0 CF OFF) + // When the device receives the CURRENT TIME SENSE 61.0C command, and has been set to + // the CG mode, the device will be set to 1. + + /// Generic response for timecode + userbits without packet check + TimeCodeAndUserBits timecode_userbits() const { + TimeCodeAndUserBits tcub; + decode_to_timecode(tcub.tc); + decode_to_userbits(tcub.ub); + return tcub; + } + TimeCode timecode() const { + TimeCode tc; + decode_to_timecode(tc); + return tc; + } + UserBits userbits() const { + UserBits ub; + decode_to_userbits(ub); + return ub; + } + + // 74.00 TIMER-1 + // Returned with the CTL counter data. At this time, the BIT-6 of DATA-1 is DATA set to 1, + // and 0, when the device CTL counter is set to DF/NDF mode. For the data format, + // refer to the CUE UP WITH DATA command. + TimeCodeAndUserBits timer1_tc_ub() const { + TimeCodeAndUserBits tcub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::TIMER_1, 8, tcub); + decode_to_timecode(tcub.tc); + decode_to_userbits(tcub.ub); + return tcub; + } + TimeCode timer1_tc() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::TIMER_1, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 74.01 TIMER-2 + // Returned with the CTL counter data. At this time, the BIT-6 of DATA-1 is DATA set to 1, + // and 0, when the device CTL counter is set to DF/NDF mode. For the data format, + // refer to the CUE UP WITH DATA command. + TimeCodeAndUserBits timer2_tc_ub() const { + TimeCodeAndUserBits tcub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::TIMER_2, 8, tcub); + decode_to_timecode(tcub.tc); + decode_to_userbits(tcub.ub); + return tcub; + } + TimeCode timer2_tc() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::TIMER_2, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 78.04 LTC TIME ∓ UB + // Returned with data that is added to DATA-1 to DATA-4 as LTC TIME DATA UB DATA and DATA-5 + // to DATA-8 as LTC UB DATA. For the data format, + // refer to the CUE UP WITH DATA and U-BIT PRESET command. + TimeCodeAndUserBits ltc_tc_ub() const { + TimeCodeAndUserBits tcub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::LTC_TC_UB, 8, tcub); + decode_to_timecode(tcub.tc); + decode_to_userbits(tcub.ub); + return tcub; + } + + // 74.04 LTC TIME DATA + // When the LTC TIME DATA device is requested, and the LTC data is read correctly, + // this command is returned to the controller with four data items. + // For the data format, refer to the CUE UP WITH DATA command. + TimeCode ltc_tc() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::LTC_TC, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 74.05 LTC UB DATA + // Returned with the LTC UB DATA. For the data format, refer to the U-BIT PRESET 44.05 command. + UserBits ltc_ub() const { + UserBits ub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::LTC_UB, 4, ub); + decode_to_userbits(ub); + return ub; + } + + // 78.06 VITC TIME ∓ UB + // Returned with data that is added to DATA-1 to DATA-4 as VITC TIME DATA DATA and DATA-5 + // to DATA-8 as VITC UB DATA. + // For the data format, refer to the CUE UP WITH DATA and U-BIT PRESET command. + TimeCodeAndUserBits vitc_tc_ub() const { + TimeCodeAndUserBits tcub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::VITC_TC_UB, 8, tcub); + decode_to_timecode(tcub.tc); + decode_to_userbits(tcub.ub); + return tcub; + } + + // 74.06 VITC TIME DATA + // Returned with the VITC TIME DATA. + // For the data format, refer to the CUE UP WITH DATA 24.31 command. + TimeCode vitc_tc() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::VITC_TC, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 74.07 ITC TIME DATA + UserBits vitc_ub() const { + UserBits ub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::VITC_UB, 4, ub); + decode_to_userbits(ub); + return ub; + } + + // 78.14 LTC INTERPOLATED TIME + UB + // When the device's LTC TIME DATA and UB DATA is requested, and the INTERPOLATED LTC data + // is played back by the device, corrected by the CTL, or read TIME ∓ UB DATA incorrectly, + // this command will be returned to the controller with data added to DATA-1 to DATA-4 + // as LTC TIME DATA, and DATA-5 to DATA-8 as LTC UB DATA. + // For the data format, refer to the CUE UP WITH DATA and U-BIT PRESET command. + TimeCodeAndUserBits ltc_interpolated_tc_ub() const { + TimeCodeAndUserBits tcub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::LTC_INTERPOLATED_TC_UB, 8, tcub); + decode_to_timecode(tcub.tc); + decode_to_userbits(tcub.ub); + return tcub; + } + + // 74.14 LTC INTERPOLATED TIME + // When the device LTC TIME DATA is requested, if the data of LTC played INTERPOLATED back + // by the device is corrected by the CTL or it is read incorrectly, + // this TIME DATA command will be returned to the controller with the LTC TIME data. + // For the data format, refer to the CUE UP WITH DATA command. + TimeCode ltc_interpolated_tc() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::LTC_INTERPOLATED_TC, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 74.15 LTC TIME UB + UserBits ltc_interpolated_ub() const { + UserBits ub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::LTC_INTERPOLATED_UB, 4, ub); + decode_to_userbits(ub); + return ub; + } + + // 78.16 VITC HOLD TIME + // When the VITC TIME DATA and VITC UB DATA of the device are ∓ UB DATA requested and + // read incorrectly, this command will be returned to the controller with data which is + // added to DATA-1 to DATA-4 as VITC TIME DATA and DATA-5 to DATA-8 as VITC UB DATA. + // For the data format, refer to the CUE UP WITH DATA and U-BIT PRESET command. + TimeCodeAndUserBits hold_vitc_tc_ub() const { + TimeCodeAndUserBits tcub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::HOLD_VITC_TC_UB, 8, tcub); + decode_to_timecode(tcub.tc); + decode_to_userbits(tcub.ub); + return tcub; + } + + // 74.16 VITC HOLD TIME + // When the device VITC TIME DATA is requested, and is read correctly, this DATA command + // will be returned to the controller with the VITC TIME DATA. + // For the data format, refer to the CUE UP WITH DATA command. + TimeCode hold_vitc_tc() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::HOLD_VITC_TC, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 74.17 VITC HOLD UB + UserBits hold_vitc_ub() const { + UserBits ub; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::HOLD_VITC_UB, 4, ub); + decode_to_userbits(ub); + return ub; + } + + // Responses to other sense requests + + // 74.10 IN DATA + // Returned with the in point data. + // For the data format, refer to the CUE UP WITH DATA command. + TimeCode in_data() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::IN_DATA, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 74.11 OUT DATA + // Returned with the out point data. + // For the data format, refer to the CUE UP WITH DATA command. + TimeCode out_data() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::OUT_DATA, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 61.20 STATUS SENSE + // Requests the device status. The device will respond with the STATUS DATA + // 7X .20 command according to the contents of DATA-1 of the controller command. + // + // DATA-1 + // MSD (Bit7~4): Indicates the initial DATA No.l of the 7X .20 STATUS DATA to be returned. + // LSD (Bit3~0): Indicates the number of data bytes in 7X .20 STATUS DATA to be returned. + // ex. When the DATA-1 is 34. + // The device will return four bytes starting from the third byte, + // i.e. DATA No.3 to DATA No.6 of the 74 .20 STATUS DATA + // + // STATUS RETURN TABLE + // figure. Status Return Chart : https://www.drastic.tv/images/protocol/p_stats.gif + // Note: * indicates a bit not set to 1 on a PLAYER device. + // + // DATA-0 + // BIT-0 LOCAL + // This bit will be set to 1 when the device will only accept commands from the controller, and not the panel. + // BIT-2 HARDWARE ERROR + // This bit will be set to 1 when a hardware error occurs in the device. + // BIT-5 CASSETTE OUT + // The removable media is not present in the device. + // + // DATA-1 + // BIT-0 PLAY + // This bit will be set to 1 when the device goes into the PLAY, REC or EDIT mode, or the device is in the CAPSTAN OVERRIDE mode. + // BIT-1 RECORD + // This bit will be set to 1 when the device goes into the REC mode, or when the DATA-4/BIT-4 : EDIT is set to 1. + // BIT-2 FAST FORWARD + // This bit will be set to 1 when the device goes into the FAST FORWARD mode. + // BIT-3 REWIND + // This bit will be set to 1 when the device goes into the FAST REVERSE mode. + // BIT-4 EJECT + // This bit will be set to 1 when the device ejects its media. + // BIT-5 STOP + // This bit will be set to 1 when the device is in stop mode. + // BIT-6 TENSION RELEASE + // This bit will be set to 1 when the device is in idle mode. + // BIT-6 STANDBY ON + // This bit will be set to 1 when the device is in standby mode. + // + // DATA-2 + // BIT-0 CUE UP COMPLETE + // This bit will be set to 1 when the device completes a CUE UP WITH DATA command and the material is at the requested position. + // BIT-1 STILL + // This bit will be set to 1 when the device is stopped and displays the current frame of media. + // BIT-2 REVERSE/FORWARD + // This bit will be set to 1 when the device is outputting its material in reverse of the normal order. When moving in the normal direction, it will be 0. + // BIT-3 VAR MODE + // This bit will be set to 1 when the device goes into the VAR command mode. + // BIT-4 JOG MODE + // This bit will be set to 1 when the device goes into the JOG command mode. + // BIT-5 SHUTTLE MODE + // This bit will be set to 1 when the device goes into the SHUTTLE command mode. + // BIT-7 SERVO LOCK + // This bit will be set to 1 when the playback or record is servo locked with the input or reference sync. + // + // DATA-3 + // BIT-0 IN + // Set to 1 if an in point has been set. + // BIT-1 OUT + // Set to 1 if an out point has been set. + // BIT-7 AUTO MODE + // Set to 1 if the device has been placed in AUTO mode. + // + // DATA-4 + // BIT-0 PRE-ROLL OR CUE UP COMPLETE + // This bit will be set to 1 when the device goes into the PRE-ROLL and CUE-UP modes (a PRE-ROLL is also performed in the auto-edit, preview and review modes). + // BIT-1 REVIEW + // This bit will be set to 1 when the device is in REVIEW mode. + // BIT-2 AUTO EDIT + // This bit will be set to 1 when the device is preform an AUTO EDIT. + // BIT-3 PREVIEW + // This bit will be set to 1 when the device is in the PREVIEW mode. + // BIT-4 EDIT MODE + // Both the bit and the DATA-1/BIT-1 : REC will be set to 1 when the device is in EDIT mode (between EDIT ON and EDIT OFF or AUTO EDIT between the in and out points). + // BIT-6 FULL EE ON + // This bit will be set to 1 when the device is in full edit to edit mode. + // BIT-7 SELECTED EE + // This bit will be set to 1 when the device is in 'Selected Edit To Edit' mode. + // + // DATA-6 (Not supported on most devices) + // BIT-4 LAMP REVERSE + // This bit will be set to 1 when the device is searching backwards. + // BIT-5 LAMP FORWARD + // This bit will be set to 1 when the device is searching forwards. + // BIT-4 LAMP STILL + // This bit will be set to 1 when the device has finished searching. + // + // DATA-7 + // BIT-0 IN-OUT STATUS + // This bit will be set to 1 in the device PREVIEW or AUTO EDIT mode and the material is running between the in point and out point. + // BIT-4 SYNC ACTIVE + // This bit will be set to 1 in the device sensing valid sync on the device's input. + // + // DATA-8 + // BIT-0 RECORD INHIBIT + // If this bit is set to 1, record/edit commands will be ignored. + // BIT-4 END OF TAPE + // Set to 1 if the device has reached the end of its media. + // BIT-5 NEAR END + // Set to 1 if the device is near the end of its media. + Status status_sense(const uint8_t start = 0, const uint8_t sz = 10) const { + Status sts; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::STATUS_DATA, sz, sts); + for (uint8_t i = start; i < start + sz; ++i) { + size_t idx = 2 + i - start; + switch (i) { + case 0: { // byte 0 + sts.b_cassette_out = buffer[idx] & StatusMask::CASSETTE_OUT; + sts.b_servo_ref_missing = buffer[idx] & StatusMask::SERVO_REF_MISSING; + sts.b_local = buffer[idx] & StatusMask::LOCAL; + break; + } + case 1: { // byte 1 + sts.b_standby = buffer[idx] & StatusMask::STANDBY; + sts.b_stop = buffer[idx] & StatusMask::STOP; + sts.b_eject = buffer[idx] & StatusMask::EJECT; + sts.b_rewind = buffer[idx] & StatusMask::REWIND; + sts.b_forward = buffer[idx] & StatusMask::FORWARD; + sts.b_record = buffer[idx] & StatusMask::RECORD; + sts.b_play = buffer[idx] & StatusMask::PLAY; + break; + } + case 2: { // byte 2 + sts.b_servo_lock = buffer[idx] & StatusMask::SERVO_LOCK; + sts.b_tso_mode = buffer[idx] & StatusMask::TSO_MODE; + sts.b_shuttle = buffer[idx] & StatusMask::SHUTTLE; + sts.b_jog = buffer[idx] & StatusMask::JOG; + sts.b_var = buffer[idx] & StatusMask::VAR; + sts.b_direction = buffer[idx] & StatusMask::DIRECTION; + sts.b_still = buffer[idx] & StatusMask::STILL; + sts.b_cue_up = buffer[idx] & StatusMask::CUE_UP; + break; + } + case 3: { // byte 3 + sts.b_auto_mode = buffer[idx] & StatusMask::AUTO_MODE; + sts.b_freeze_on = buffer[idx] & StatusMask::FREEZE_ON; + sts.b_cf_mode = buffer[idx] & StatusMask::CF_MODE; + sts.b_audio_out_set = buffer[idx] & StatusMask::AUDIO_OUT_SET; + sts.b_audio_in_set = buffer[idx] & StatusMask::AUDIO_IN_SET; + sts.b_out_set = buffer[idx] & StatusMask::OUT_SET; + sts.b_in_set = buffer[idx] & StatusMask::IN_SET; + break; + } + case 4: { // byte 4 + sts.b_select_ee = buffer[idx] & StatusMask::SELECT_EE; + sts.b_full_ee = buffer[idx] & StatusMask::FULL_EE; + sts.b_edit = buffer[idx] & StatusMask::EDIT_SET; + sts.b_review = buffer[idx] & StatusMask::REVIEW_SET; + sts.b_auto_edit = buffer[idx] & StatusMask::AUTO_EDIT_SET; + sts.b_preview = buffer[idx] & StatusMask::PREVIEW_SET; + sts.b_preroll = buffer[idx] & StatusMask::PREROLL_SET; + break; + } + case 5: { // byte 5 + sts.b_insert = buffer[idx] & StatusMask::INSERT_SET; + sts.b_assemble = buffer[idx] & StatusMask::ASSEMBLE_SET; + sts.b_video = buffer[idx] & StatusMask::VIDEO_SET; + sts.b_a4 = buffer[idx] & StatusMask::A4_SET; + sts.b_a3 = buffer[idx] & StatusMask::A3_SET; + sts.b_a2 = buffer[idx] & StatusMask::A2_SET; + sts.b_a1 = buffer[idx] & StatusMask::A1_SET; + break; + } + case 6: { // byte 6 + sts.b_lamp_still = buffer[idx] & StatusMask::LAMP_STILL; + sts.b_lamp_fwd = buffer[idx] & StatusMask::LAMP_FWD; + sts.b_lamp_rev = buffer[idx] & StatusMask::LAMP_REV; + sts.b_srch_led_8 = buffer[idx] & StatusMask::SRCH_LED_8; + sts.b_srch_led_4 = buffer[idx] & StatusMask::SRCH_LED_4; + sts.b_srch_led_2 = buffer[idx] & StatusMask::SRCH_LED_2; + sts.b_srch_led_1 = buffer[idx] & StatusMask::SRCH_LED_1; + break; + } + case 7: { // byte 8 + sts.b_aud_split = buffer[idx] & StatusMask::AUD_SPLIT; + sts.b_sync_act = buffer[idx] & StatusMask::SYNC_ACT; + sts.b_spot_erase = buffer[idx] & StatusMask::SPOT_ERASE; + sts.b_in_out = buffer[idx] & StatusMask::IN_OUT; + break; + } + case 8: { // byte 8 + sts.b_buzzer = buffer[idx] & StatusMask::BUZZER; + sts.b_lost_lock = buffer[idx] & StatusMask::LOST_LOCK; + sts.b_near_eot = buffer[idx] & StatusMask::NEAR_EOT; + sts.b_eot = buffer[idx] & StatusMask::EOT; + sts.b_cf_lock = buffer[idx] & StatusMask::CF_LOCK; + sts.b_svo_alarm = buffer[idx] & StatusMask::SVO_ALARM; + sts.b_sys_alarm = buffer[idx] & StatusMask::SYS_ALARM; + sts.b_rec_inhib = buffer[idx] & StatusMask::REC_INHIB; + break; + } + case 9: { // byte 9 + sts.b_fnc_abort = buffer[idx] & StatusMask::FNC_ABORT; + break; + } + default: { + break; + } + } + } + + return sts; + } + + // 60.30 PRE-ROLL TIME + // This command is used for requesting the current pre-roll duration. + // For the SENSE return data format, see the CUE UP WITH DATA command. + // Send: 60 30 90 + // Returns: 74 30 00 05 00 00 A9 (Pre-roll is five seconds) + TimeCode preroll_time() const { + TimeCode tc; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::PREROLL_TIME, 4, tc); + decode_to_timecode(tc); + return tc; + } + + // 71.36 TIMER MODE + // Refer to the TIMER MODE SENSE command. + TimerMode timer_mode() const { + TimerMode tm = TimerMode::NA; + SONY9PIN_RESPONSE_CHECK(Cmd1::SENSE_RETURN, SenseReturn::TIMER_MODE_STATUS, 1, tm); + switch (buffer[2]) { + case 0x00: tm = TimerMode::TIME_CODE; break; + case 0x01: tm = TimerMode::CTL_COUNTER; break; + default: tm = TimerMode::NA; break; + } + return tm; + } + +private: + template + inline auto from_bcd_to_dec(const T& n) const + -> typename std::enable_if::value, size_t>::type { + return n - 6 * (n >> 4); + } + + bool empty() const { + return curr_size == 0; + } + + void decode_to_timecode(TimeCode& tc) const { + tc.is_cf = buffer[2] & 0b10000000; + tc.is_df = buffer[2] & 0b01000000; + tc.frame = from_bcd_to_dec(buffer[2] & 0x3F); + tc.second = from_bcd_to_dec(buffer[3] & 0x7F); + tc.minute = from_bcd_to_dec(buffer[4] & 0x7F); + tc.hour = from_bcd_to_dec(buffer[5] & 0x3F); + } + + void decode_to_userbits(UserBits& ub, const size_t offset = 0) const { + for (size_t i = 0; i < 4; ++i) + ub.bytes[i] = buffer[2 + offset + i]; + } +}; + +} // namespace sony9pin + +#include "util/DebugLog/DebugLogRestoreState.h" + +#endif // SONY9PINREMOTE_DECODER_H diff --git a/Sony9PinRemote/Sony9PinRemote/Encoder.h b/Sony9PinRemote/Sony9PinRemote/Encoder.h new file mode 100644 index 00000000..8ad6ccf1 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/Encoder.h @@ -0,0 +1,1425 @@ +#pragma once +#ifndef SONY9PINREMOTE_ENCODER_H +#define SONY9PINREMOTE_ENCODER_H + +#include "Types.h" +#include "util/ArxTypeTraits/ArxTypeTraits.h" +#include "util/ArxContainer/ArxContainer.h" +#include "util/DebugLog/DebugLog.h" + +#ifdef SONY9PINREMOTE_DEBUGLOG_ENABLE +#include "util/DebugLog/DebugLogEnable.h" +#else +#include "util/DebugLog/DebugLogDisable.h" +#endif + +namespace sony9pin { + +namespace util { + template + struct remove_reference { using type = T; }; + template + struct remove_reference { using type = T; }; + template + struct remove_reference { using type = T; }; + + template + constexpr T&& forward(typename remove_reference::type& t) noexcept { + return static_cast(t); + } + template + constexpr T&& forward(typename remove_reference::type&& t) noexcept { + return static_cast(t); + } +} // namespace util + +class Encoder { +public: +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11 + using Packet = std::vector; +#else // Do not have libstdc++11 + using Packet = arx::vector; +#endif // Do not have libstdc++11 + + // =============== 0 - System Control =============== + + // 00.0C LOCAL DISABLE + // When receiving this command, all local operational functions of the device will be disabled. + // This includes front panel transport controls, but not front panel setup controls. + // Send: 00 0C 0C + // Returns: 10 01 11 + // HyperDeck NOTE: NOT SUPPORTED + Packet local_disable() { + LOG_INFO(" "); + return encode(Cmd1::SYSTEM_CONTROL, SystemCtrl::LOCAL_DISABLE); + } + + // 00.11 DEVICE TYPE + // When the device receives the DEVICE TYPE REQUEST command + // REQUEST the DEVICE TYPE return with 2 bytes data will be returned: + // Return: 12.11 DEVICE TYPE + // Send: 00 11 11 + // Returns: 12 11 FE 01 22 + Packet device_type_request() { + LOG_INFO(" "); + return encode(Cmd1::SYSTEM_CONTROL, SystemCtrl::DEVICE_TYPE); + } + + // 00.1D LOCAL ENABLE + // When receiving this command, the front panel operation of the device will be enabled. + // When the device is initially powered on, it will be set to the LOCAL ENABLE state. + // Send: 00 1D 1D + // Returns: 10 01 11 + // HyperDeck NOTE: NOT SUPPORTED + Packet local_enable() { + LOG_INFO(" "); + return encode(Cmd1::SYSTEM_CONTROL, SystemCtrl::LOCAL_ENABLE); + } + + // =============== 2 - Transport Control =============== + + // 20.00 STOP + // Stop the device and pass the device's input to the device's output. + // Cease all processing of the current material. + // Send: 20 00 20 + // Returns: 10 01 11 + Packet stop() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::STOP); + } + + // 20.01 PLAY + // Plays from the current position at normal play speed for the material. + // Send: 20 01 21 + // Returns: 10 01 11 + Packet play() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::PLAY); + } + + // 20.02 RECORD + // Records from the current position at normal play speed. + // Send: 20 02 22 + // Returns: 10 01 11 + Packet record() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::RECORD); + } + + // 20.04 STANDBY OFF + // The STANDBY OFF command places the device in a stop state, passing all material from the current inputs to the outputs. This should be sent after a stop command to place the device in a fully idle state. + // Send: 20 04 24 + // Returns: 10 01 11 + Packet standby_off() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::STANDBY_OFF); + } + + // 20.05 STANDBY ON + // Places the device in ready, pause mode. The current material is ready for use and the current material, if possible, is presented at the output. + // Send: 20 05 25 + // Returns: 10 01 11 + Packet standby_on() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::STANDBY_ON); + } + + // 20.0F EJECT + // If the device supports removable media, remove the media from the device. + // Send: 20 0F 2F + // Returns: 10 01 11 + Packet eject() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::EJECT); + } + + // 20.10 FAST FORWARD + // Moves forward through the material at the highest allowable speed + // (Usually FORWARD 32 to 90 times play speed). + // Send: 20 10 30 + // Returns: 10 01 11 + Packet fast_forward() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::FAST_FWD); + } + + // NOTE: For the commands that follow + // + // When receiving one of the following commands (JOG, VAR or SHUTTLE), + // the device will play forward or backward according to the speed data. + // When the command byte low nibble is 1 and only DATA-1 is used, + // the material speed is defined as follows: + // TAPE SPEED=10(N/32-2) + // N : SPEED DATA OF DATA-1 (DECIMAL) + // + // When the command byte low nibble is 2 and both DATA-1 and DATA-2 are used, + // the material speed is more precise. In this case the tape speed will is defined as follows: + // TAPE SPEED= 10(N/32-2) + N'/256 {10(N+1/32-2) -10(N+1/32-2) } + // N : SPEED DATA OF DATA-1 + // N' : SPEED DATA OF DATA-2 + // + // for example: + // Send: 21 11 40 48 (Jog @ play speed) + // Send: 21 11 20 52 (Jog @ half play speed) + // Send: 21 13 42 76 (Shuttle @ slightly faster than play speed) + // Send: 21 11 3E 70 (Jog @ slightly slower than play speed) + // Send: 21 11 4A 7C (Jog @ two times reverse play speed) + // Send: 21 13 66 9A (Shuttle @ fifteen times play speed) + + // 2X.11 JOG FORWARD + // Move forward through the material, + // usually with varying speeds sent by the FORWARD controller for fine positioning. + // Send: 21 11 40 48 (Jog @ play speed) + Packet jog_forward(const uint8_t data1, const uint8_t data2 = 0) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::JOG_FWD, data1, data2); + } + + // 2X.12 VAR FORWARD * + // Move forward through the material, while creating the smoothest possible FORWARD + // output of the material. This 'smoothing' process may slightly vary the requested speed. + // Send: 21 11 20 52 (Jog @ half play speed) + Packet var_forward(const uint8_t data1, const uint8_t data2 = 0) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::VAR_FWD, data1, data2); + } + + // 2X.13 SHUTTLE FORWARD + // Move forward through the material, at the exact play speed, regardless of FORWARD results. + // Usually used for visual searching. + // Send: 21 13 42 76 (Shuttle @ slightly faster than play speed) + Packet shuttle_forward(const uint8_t data1, const uint8_t data2 = 0) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::SHUTTLE_FWD, data1, data2); + } + + // 20.14 FRAME STEP * + // Move the device's material one frame (actual or logical depending on the FORWARD media) + // forward and pause. + // Send: 20 14 34 + // Returns: 10 01 11 + Packet frame_step_forward() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::FRAME_STEP_FWD); + } + + // 20.20 FAST REVERSE + // Moves backward through the material at the highest allowable speed + // (Usually REWIND 32 to 90 times play speed). + // Send: 20 20 40 + // Returns: 10 01 11 + Packet fast_reverse() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::FAST_REVERSE); + } + + // 20.20 Rewind + // same as FAST REVERSE + Packet rewind() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::REWIND); + } + + // 2X.11 JOG REVERSE + // Move backward through the material, usually with varying speeds sent + // by the REVERSE controller, for fine positioning. + // Send: 21 11 3E 70 (Jog @ slightly slower than play speed) + Packet jog_reverse(const uint8_t data1, const uint8_t data2 = 0) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::JOG_REV, data1, data2); + } + + // 2X.12 VAR REVERSE * + // Move backward through the material, while to creating the smoothest possible REVERSE output + // of the material. This 'smoothing' process may vary the speed slightly from the requested speed. + // Send: 21 11 4A 7C (Jog @ two times reverse play speed) + Packet var_reverse(const uint8_t data1, const uint8_t data2 = 0) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::VAR_REV, data1, data2); + } + + // 2X.13 SHUTTLE REVERSE + // Move backward through the material, at the exact play speed, regardless of REVERSE results. + // Usually used for visual searching. + // Send: 21 13 66 9A (Shuttle @ fifteen times play speed)20.30 PRE-ROLL * + // Positions the device at the current in point (IN ENTRY) minus the length of the current + // pre-roll (PRE-ROLL TIME PRESET). + // Send: 20 30 50 + // Returns: 10 01 11 + Packet shuttle_reverse(const uint8_t data1, const uint8_t data2 = 0) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::SHUTTLE_REV, data1, data2); + } + + // 20.24 Frame Step Reverse + // Move the device's material one frame (actual or logical depending on the REVERSE media) + // backward and pause. + // REPLY: ACK + Packet frame_step_reverse() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::FRAME_STEP_REV); + } + + // 20.30 Preroll + // Positions the device at the current in point (IN ENTRY) + // minus the length of the current pre-roll (PRE-ROLL TIME PRESET). + // REPLY: ACK + Packet preroll() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::PREROLL); + } + + // 24.31 CUE UP WITH DATA * + // Cues up the device to the position defined by DATA-1 to DATA-4. Once the DATA device + // begins cueing, the PRE-ROLL/CUE-UP data bit (Byte 4, Bit 0) will be set on in + // the STATUS return. Upon successful completion, the CUE-UP COMPLETE data bit (Byte 2, Bit 0) + // will be set ON and the PRE-ROLL/CUE UP data bit will be set OFF. If the device is unable to + // seek to that point, then the PRE-ROLL/CUE-UP data bit will be set OFF and the CUE-UP + // COMPLETE will NOT be set ON. + // Cue up with data format + // figure. Time Data Format : https://www.drastic.tv/images/protocol/p_cwdata.gif + // Send: 24 13 58 16 02 A7 (Cue to 2 hours, 16 minutes, 58 seconds, 13 frames) + // Returns: 10 01 11 + // Send: 24 24 36 52 21 F1 (Cue to 21 hours, 52 minutes, 36 seconds, 24 frames) + // Returns: 10 01 11 + Packet cue_up_with_data(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::CUE_UP_WITH_DATA, ff, ss, mm, hh); + } + + // 20.34 Sync Play + // UNKNOWN + // REPLY: ACK + Packet sync_play() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::SYNC_PLAY); + } + + // 21.38 Prog Speed Play + + // UNKNOWN + // REPLY: ACK + Packet prog_speed_play_plus(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::PROG_SPEED_PLAY_PLUS, v); + } + + // 21.39 Prog Speed Play - + // DESCRIPTION: + // UNKNOWN + // REPLY: ACK + Packet prog_speed_play_minus(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::PROG_SPEED_PLAY_MINUS, v); + } + + // 20.40 PREVIEW * + // Play the current edit. Cue the device to the pre-roll point + // (in point minus pre-roll duration), play the device through the in point to the point + // two seconds (assuming a two second post-roll) after the out point. + // Send: 20 40 60 + // Returns: 10 01 11 + Packet preview() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::PREVIEW); + } + + // 20.41 REVIEW * + // Play the last edit. + // Cue the device to the last pre-roll point (last in point minus pre-roll duration), + // play the device through the last in point to the point two seconds + // (assuming a two second post-roll) after the last out point. + // Send: 20 41 61 + // Returns: 10 01 11 + Packet review() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::REVIEW); + } + + // 20.42 AUTO EDIT * + // Pre-roll the device to the pre-roll point (in point minus the pre-roll). + // Play the device from the pre-roll point to the in point. At the in point, begin recording + // the selected material (as per EDIT PRESET) from the in point to the out point. + // Upon reaching the out point, play the material after the out point for two seconds. + // Send: 20 42 62 + // Returns: 10 01 11 + Packet auto_edit() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::AUTO_EDIT); + } + + // 20.43 Outpoint Preview + // UNKNOWN + // REPLY: ACK + Packet outpoint_preview() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::OUTPOINT_PREVIEW); + } + + // 2X.54 Anti-Clog Timer Disable + // UNKNOWN + // REPLY: ACK + Packet anti_clog_timer_disable() { + LOG_INFO(" "); + // return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::ANTI_CLOG_TIMER_DISABLE); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 2X.55 Anti-Clog Timer Enable + // UNKNOWN + // REPLY: ACK + Packet anti_clog_timer_enable() { + LOG_INFO(" "); + // return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::ANTI_CLOG_TIMER_ENABLE); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 2X.5C DMC Set Forward + // UNKNOWN + // REPLY: ACK + Packet dmc_set_fwd(const uint8_t data1, const uint8_t data2) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::DMC_SET_FWD, data1, data2); + } + + // 2X.5D DMC Set Reverse + // UNKNOWN + // REPLY: ACK + Packet dmc_set_rev(const uint8_t data1, const uint8_t data2) { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::DMC_SET_REV, data1, data2); + } + + // 20.60 FULL EE OFF + // Full 'Edit To Edit' mode off attempts to pass all material from the device to the output. + // This device has no effect on the current EDIT PRESET, but it does set all channels to + // the device, unless the device is in an idle state. + // Send: 20 60 80 + // Returns: 10 01 11 + Packet full_ee_off() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::FULL_EE_OFF); + } + + // 20.61 FULL EE ON + // Full 'Edit to Edit' mode on attempts to pass all inputs to the device to the device's output. + // This device has no effect on the current EDIT PRESET but it does set all channels to + // the device's inputs. + // Send: 20 61 81 + // Returns: 10 01 11 + Packet full_ee_on() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::FULL_EE_ON); + } + + // 20.63 SELECT EE ON + // Sets each EDIT PRESET channel assigned by the DATA-1 of the EDIT PRESET command to the edit + // to edit mode. All selected channels are passed through from the device's inputs to + // the device's outputs. To clear the SELECTED EE mode, use the EE OFF or the EDIT OFF command. + // Send: 20 63 83 + // Returns: 10 01 11 + Packet select_ee_on() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::SELECT_EE_ON); + } + + // 20.64 EDIT OFF + // An EDIT OFF completes an edit in progress, or resets the channels on a preview started + // with a SELECT EE ON. The edit is initiated by an EDIT ON command that begins recording + // on the device's channels that were selected with the EDIT PRESET command. + // The EDIT OFF command stops the recording exactly 8 (default setting for EDIT OFF) frames + // after the command is received. + // Send: 20 64 84 + // Returns: 10 01 11 + Packet edit_off() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::EDIT_OFF); + } + + // 20.65 EDIT ON + // The EDIT ON command initiates the recording of an edit setup by EDIT PRESET, + // exactly 8 (default setting for EDIT ON) frames after the command is received. + // Normally, to create an edit, all devices in the edit are pre-rolled, each device is + // placed in play mode, and the speed of each device is adjusted until all devices are + // running synchronously. Eight frames before the recording device's in point, + // and EDIT ON command is sent to begin recording. Eight frames before the device's out point, + // an EDIT OFF command is sent to end the edit. + // Send: 20 65 84 + // Returns: 10 01 11 + Packet edit_on() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::EDIT_ON); + } + + // 20.6A Freeze Off + // UNKNOWN + // REPLY: ACK + Packet freeze_off() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::FREEZE_OFF); + } + + // 20.6B Freeze On + // UNKNOWN + // REPLY: ACK + Packet freeze_on() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::FREEZE_ON); + } + + // =============== 4 - Preset/Select Control =============== + + // 44.00 TIMER-1 PRESET + // This command presets the device's control (CTL) counter to the value which has been given by + // the DATA-1 to DATA-4 bytes in the command. For the data format, refer to the CUE UP WITH DATA + // command. The mode of the Drop Frame (DF) or Non Drop Frame (NDF) is decided according to + // bit-6 of DATA-1: DATA 1, BIT 6 Drop Frame + // 0 OFF 1 ON + // Send: 44 00 00 10 20 01 75 (CTL counter set to 1 hour, 20 minutes, 10 seconds, 0 frames) + // Returns: 10 01 11 + Packet timer1_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff, const bool is_df) { + LOG_INFO(" "); + const uint8_t h = from_dec_to_bcd(hh); + const uint8_t m = from_dec_to_bcd(mm); + const uint8_t s = from_dec_to_bcd(ss); + uint8_t f = from_dec_to_bcd(ff); + f |= (uint8_t)is_df << 6; // 0: non-drop, 1: drop + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::TIMER_1_PRESET, f, s, m, h); + } + + // 44.04 TIME CODE PRESET + // Presets the value, given by DATA-1 to DATA-4, to the time code start of the PRESET time code + // generator. This command will only effect devices capable of recording time code independent + // of the inputs. For the data format, refer to the CUE UP WITH DATA command. The mode of the + // Drop Frame (DF) or Non Drop Frame (NDF) is decided according to bit-6 of DATA-1: + // DATA 1, BIT 6 Drop Frame + // 0 OFF 1 ON + // Send: 44 04 00 15 30 00 75 (Preset TC set to 30 minutes, 15 seconds, 0 frames) + // Returns: 10 01 11 + Packet time_code_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff, const bool is_df) { + LOG_INFO(" "); + const uint8_t h = from_dec_to_bcd(hh); + const uint8_t m = from_dec_to_bcd(mm); + const uint8_t s = from_dec_to_bcd(ss); + uint8_t f = from_dec_to_bcd(ff); + f |= (uint8_t)is_df << 6; // 0: non-drop, 1: drop + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::TIME_CODE_PRESET, f, s, m, h); + } + + // 44.05 USER-BIT PRESET + // Presets the user bit values in the time code recording of the device, if the device supports + // user bits, to the value given by DATA-1 to DATA-4 as follows: + // Send: 44 05 60 63 44 45 95 (Set UB to 06364454) + // Returns: 10 01 11 + Packet user_bit_preset(const uint8_t data1, const uint8_t data2, const uint8_t data3, const uint8_t data4) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::USER_BIT_PRESET, data1, data2, data3, data4); + } + + // 40.08 TIMER-1 RESET + // Resets the control (CTL) counter to zero. + // Send: 40 08 48 + // Returns: 10 01 11 + Packet timer1_reset() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::TIMER_1_RESET); + } + + // 40.10 IN ENTRY + // Store the current position of the device as the in point for the next edit. + // Send: 40 10 50 + // Returns: 10 01 11 + Packet in_entry() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::IN_ENTRY); + } + + // 40.11 OUT ENTRY + // Store the current position of the device as the out point for the next edit. + // Send: 40 11 51 + // Returns: 10 01 11 + Packet out_entry() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::OUT_ENTRY); + } + + // 40.12 Audio In Entry + // UNKNOWN + // REPLY: ACK + Packet audio_in_entry() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_IN_ENTRY); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 40.13 Audio Out Entry + // UNKNOWN + // REPLY: ACK + Packet audio_out_entry() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_OUT_ENTRY); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 44.14 IN PRESET + // Set the in point for the next edit to the time specified by DATA-1 through DATA-4. + // See the CUE UP WITH DATA command for the data format. + // Send: 44 14 21 16 25 04 68 (Set in point to 4 hours, 25 minutes, 16 seconds, 21 frames) + // Returns: 10 01 11 + Packet in_data_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff) { + LOG_INFO(" "); + const uint8_t h = from_dec_to_bcd(hh); + const uint8_t m = from_dec_to_bcd(mm); + const uint8_t s = from_dec_to_bcd(ss); + const uint8_t f = from_dec_to_bcd(ff); + // f |= (uint8_t)is_df << 6; // 0: non-drop, 1: drop + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::IN_DATA_PRESET, f, s, m, h); + } + + // 44.15 OUT PRESET + // Set the out point for the next edit to the time specified by DATA-1 through DATA-4. + // See the CUE UP WITH DATA command for the data format. + // Send: 44 15 05 09 27 04 92 (Set out point to 4 hours, 27 minutes, 9 seconds, 5 frames) + // Returns: 10 01 11 + Packet out_data_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff) { + LOG_INFO(" "); + const uint8_t h = from_dec_to_bcd(hh); + const uint8_t m = from_dec_to_bcd(mm); + const uint8_t s = from_dec_to_bcd(ss); + const uint8_t f = from_dec_to_bcd(ff); + // f |= (uint8_t)is_df << 6; // 0: non-drop, 1: drop + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::OUT_DATA_PRESET, f, s, m, h); + } + + // 4?.16 Audio In Data Preset + // UNKNOWN + // REPLY: ACK + Packet audio_in_data_preset() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_IN_DATA_PRESET); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4?.17 Audio Out Data Preset + // UNKNOWN + // REPLY: ACK + Packet audio_out_data_preset() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_OUT_DATA_PRESET); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 40.18 IN SHIFT + * + // Adds one frame to the current in point time code value. + // Send: 40 18 58 + // Returns: 10 01 11 + Packet in_shift_plus() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::IN_SHIFT_PLUS); + } + + // 40.19 IN SHIFT - * + // Subtracts one frame from the current in point time code value. + // Send: 40 19 59 + // Returns: 10 01 11 + Packet in_shift_minus() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::IN_SHIFT_MINUS); + } + + // 40.1A OUT SHIFT + * + // Adds one frame to the current out point time code value. + // Send: 40 1A 5A + // Returns: 10 01 11 + Packet out_shift_plus() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::OUT_SHIFT_PLUS); + } + + // 40.1B OUT SHIFT - * + // Subtracts one frame from the current out point time code value. + // Send: 40 1B 5B + // Returns: 10 01 11 + Packet out_shift_minus() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::OUT_SHIFT_MINUS); + } + + // 40.1C Audio In Shift + + // UNKNOWN + // REPLY: ACK + Packet audio_in_shift_plus() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_IN_SHIFT_PLUS); + } + + // 40.1D Audio In Shift - + // UNKNOWN + // REPLY: ACK + Packet audio_in_shift_minus() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_IN_SHIFT_MINUS); + } + + // 40.1E Audio Out Shift + + // UNKNOWN + // REPLY: ACK + Packet audio_out_shift_plus() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_OUT_SHIFT_PLUS); + } + + // 40.1F Audio Out Shift - + // UNKNOWN + // REPLY: ACK + Packet audio_out_shift_minus() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_OUT_SHIFT_MINUS); + } + + // 40.20 IN RESET * + // Reset the value of the in point to zero. + // Send: 40 20 60 + // Returns: 10 01 11 + Packet in_flag_reset() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::IN_FLAG_RESET); + } + + // 40.21 OUT RESET * + // Reset the value of the out point to zero. + // Send: 40 21 61 + // Returns: 10 01 11 + Packet out_flag_reset() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::OUT_FLAG_RESET); + } + + // 40.22 Audio In Flag Reset + // UNKNOWN + // REPLY: ACK + Packet audio_in_flag_reset() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_IN_FLAG_RESET); + } + + // 40.23 Audio In Flag Reset + // UNKNOWN + // REPLY: ACK + Packet audio_out_flag_reset() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_OUT_FLAG_RESET); + } + + // 40.24 IN RECALL + // Sets the current in point to the last in point that was set. Whenever the in point is changed + // or used, a backup copy of the time code is saved. This time code can be recovered by the + // IN RECALL command. + // Send: 40 24 64 + // Returns: 10 01 11 + Packet in_recall() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::IN_RECALL); + } + + // 40.25 OUT RECALL + // Sets the current out point to the last in point that was set. Whenever the out point is + // changed or used, a backup copy of the time code is saved. This time code can be recovered + // by the OUT RECALL command. + // Send: 40 25 65 + // Returns: 10 01 11 + Packet out_recall() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::OUT_RECALL); + } + + // 40.26 Audio In Recall + // UNKNOWN + // REPLY: ACK + Packet audio_in_recall() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_IN_RECALL); + } + + // 40.27 Audio Out Recall + // UNKNOWN + // REPLY: ACK + Packet audio_out_recall() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_OUT_RECALL); + } + + // 40.2D Lost Lock Reset + // UNKNOWN + // REPLY: ACK + Packet lost_lock_reset() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::LOST_LOCK_RESET); + } + + // 41.30 EDIT PRESET + // This command is used for selecting the edit mode and selection of preset audio and video channels. + // DATA-1: + // Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 + // Insert Assemble Video TC A2 (Cue) A1 (Cue) + // DATA-2: + // Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 + // DA4 DA3 DA2 DA1 + // when the 41.30 command is used, the audio channels are set as per the table in the Edit : + // Setup menu.When the 42.30 command is used and Bit1 or Bit0 of Data - 1 are "1", + // the Cue channel is selected. + // Send: 41 30 62 D3 (Insert Video and Audio-2 in next edit) + // Returns: 10 01 11 + Packet edit_preset(const uint8_t data1, const uint8_t data2) { + LOG_INFO(" "); + // TODO: more user-friendly arguments? + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::EDIT_PRESET, data1, data2); + } + + // 44.31 PRE-ROLL TIME + // Presets the duration of the pre-roll to the length given by the DATA-1 to PRESET DATA-4. + // For the data format, refer to the CUE UP WITH DATA command. + // Send: 44 31 00 05 00 00 7A (Set the pre-roll duration to 5 seconds) + // Returns: 10 01 11 + Packet preroll_preset(const uint8_t hh, const uint8_t mm, const uint8_t ss, const uint8_t ff) { + LOG_INFO(" "); + const uint8_t h = from_dec_to_bcd(hh); + const uint8_t m = from_dec_to_bcd(mm); + const uint8_t s = from_dec_to_bcd(ss); + const uint8_t f = from_dec_to_bcd(ff); + // f |= (uint8_t)is_df << 6; // 0: non-drop, 1: drop + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::PREROLL_PRESET, f, s, m, h); + } + + // 41.32 Tape/Audio Select + // UNKNOWN + // REPLY: ACK + Packet tape_audio_select(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::TAPE_AUDIO_SELECT, v); + } + + // 41.33 Servo Ref Select + // DESCRIPTION: + // UNKNOWN + // REPLY: ACK + Packet servo_ref_select(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::SERVO_REF_SELECT, v); + } + + // 41.34 Head Select + // UNKNOWN + // REPLY: ACK + Packet head_select(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::HEAD_SELECT, v); + } + + // 41.35 Color Frame Select + // UNKNOWN + // REPLY: ACK + Packet color_frame_select(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::COLOR_FRAME_SELECT, v); + } + + // 41.36 TIMER MODE SELECT + // Selects the default timer to return, by the DATA-1 value as follows: + // DATA - 1 + // 00 : Time Code + // 01 : Control(CTL) Counter + // FF : device setting dependent. + // Send: 41 36 11 88 (Set the device to time code head) + // Returns: 10 01 11 + Packet timer_mode_select(const TimerMode tm) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::TIMER_MODE_SELECT, (uint8_t)tm); + } + + // 41.37 Input Check + // UNKNOWN + // REPLY: ACK + Packet input_check(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::INPUT_CHECK, v); + } + + // 41.3A Edit Field Select + // UNKNOWN + // REPLY: ACK + Packet edit_field_select(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::EDIT_FIELD_SELECT, v); + } + + // 41.3B Freeze Mode Select + // UNKNOWN + // REPLY: ACK + Packet freeze_mode_select(const uint8_t v) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::FREEZE_MODE_SELECT, v); + } + + // 4X.3E Record Inhibit + // UNKNOWN + // REPLY: ACK + Packet record_inhibit() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::RECORD_INHIBIT); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 40.40 AUTO MODE OFF + // This command switches the device from AUTO mode. + // Send: 40 40 80 + // Returns: 10 01 11 + Packet auto_mode_off() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUTO_MODE_OFF); + } + + // 40.41 AUTO MODE ON + // This command switches the device to AUTO mode. + // Send: 40 41 81 + // Returns: 10 01 11 + Packet auto_mode_on() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUTO_MODE_ON); + } + + // 40.42 Spot Erase Off + // UNKNOWN + // REPLY: ACK + Packet spot_erase_off() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::SPOT_ERASE_OFF); + } + + // 40.43 Spot Erase On + // UNKNOWN + // REPLY: ACK + Packet spot_erase_on() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::SPOT_ERASE_ON); + } + + // 40.44 Audio Split Off + // UNKNOWN + // REPLY: ACK + Packet audio_split_off() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_SPLIT_OFF); + } + + // 40.45 Audio Split On + // UNKNOWN + // REPLY: ACK + Packet audio_split_on() { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_SPLIT_OFF); + } + + // 4X.98 Output H Phase + // UNKNOWN + // REPLY: ACK + Packet output_h_phase() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::OUTPUT_H_PHASE); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4X.9B Output Video Phase + // UNKNOWN + // REPLY: ACK + Packet output_video_phase() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::OUTPUT_VIDEO_PHASE); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4X.A0 Audio Input Level + // UNKNOWN + // REPLY: ACK + Packet audio_input_level() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_INPUT_LEVEL); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4X.A1 Audio Output Level + // UNKNOWN + // REPLY: ACK + Packet audio_output_level() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_OUTPUT_LEVEL); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4X.A2 Audio Adv Level + // UNKNOWN + // REPLY: ACK + Packet audio_adv_level() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_ADV_LEVEL); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4X.A8 Audio Output Phase + // UNKNOWN + // REPLY: ACK + Packet audio_output_phase() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_OUTPUT_PHASE); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4X.A9 Audio Adv Output PHase + // UNKNOWN + // REPLY: ACK + Packet audio_adv_output_phase() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::AUDIO_ADV_OUTPUT_PHASE); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4X.AA Cross Fade Time Preset + // UNKNOWN + // REPLY: ACK + Packet cross_fade_time_preset() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::CROSS_FADE_TIME_PRESET); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 4X.B8 Local Key Map + // When the slave receives the 00.1D Local Enable command, the control panel may be used + // according to the local key map that was set by this command. When the slave receives + // the 00.0C Local Disable command all the keys, buttons, and adjustment controls + // on the control panel are disabled. The Eject button can always be used. + // If the slave receives the 41.B8 command, the local key map is preset by the block level + // in accordance with DATA-1. IF it receives the 4X.B8 command ( X > 2 ) The local key map is + // preset by the Switch level. + // + // Block Level switches : + // ------------------------------------------------------------------------------------------- + // Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 + // Tracking Monitor Audio Video Transport + // Control Control Control Control Control + // + // "1" : This function will be enabled when in remote + // "0" : This function will be disabled in remote. + // When DATA - 2 or more are added, control data with two bytes per each block assigned + // by DATA - 1 are added following DATA - 1. + // + // At present the transport switches are defined as follows : + // ------------------------------------------------------------------------------------------- + // + // Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 + // 1st Byte Execute Preroll Search Rec Play Stop Standby + // 2nd Byte Var Jog Shuttle + // + // None of the other blocks have any switches assigned, but rather operate as follows : + // Video Control : Video phase and Sync phase can be adjusted on the system menu in remote mode. + // Audio Control : Audio levels and output phase can be adjusted on the Audio : DA out menu in remote mode. + // Monitor Control : the wfm monitor output selection on the system + // : wfm monitor menu and the montior level adjustments and monitor out selection on the system + // : audio monitor menu can be adjusted in remote mode. + // Tracking Control : Tracking adjustments in the system + // : tracking menu can be made in remote mode. + // REPLY: ACK + Packet local_key_map() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::LOCAL_KEY_MAP); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 42.F8 Still Off Time + // UNKNOWN + // REPLY: ACK + Packet still_off_time(const uint8_t data1, const uint8_t data2) { + LOG_INFO(" "); + // TODO: more user-friendly arguments? + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::STILL_OFF_TIME, data1, data2); + } + + // 42.FA Stby Off Time + // UNKNOWN + // REPLY: ACK + Packet stby_off_time(const uint8_t data1, const uint8_t data2) { + LOG_INFO(" "); + // TODO: more user-friendly arguments? + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::STBY_OFF_TIME, data1, data2); + } + + // =============== 6 - Sense Request =============== + + // 61.0A TC GENERATOR DATA + // Request the type of time code data the device is generating, + // based on the type SENSE of data required. + // It will then respond according to the contents of DATA-1. + // DATA-1 = 01: Request for GEN TC -> GEN TIME DATA 74.08 Respond + // DATA-1 = 10: Request for GEN UB -> GEN UB DATA 74.09 Respond + // DATA-1 = 11: Request for GEN TC & UB -> GEN TC & UB DATA 78.08 Respond + // Send: 61 0A 11 7C + // Returns: 10 01 11 + Packet tc_gen_sense(const uint8_t data1) { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::TC_GEN_SENSE, data1); + } + Packet tc_gen_sense_tc() { + return tc_gen_sense(TcGenData::TC); + } + Packet tc_gen_sense_ub() { + return tc_gen_sense(TcGenData::UB); + } + Packet tc_ub_gen_sense_tc_and_ub() { + return tc_gen_sense(TcGenData::TC_UB); + } + + // 61.0C CURRENT TIME + // Requests the time data or user bit. The device will respond according to the SENSE DATA-1 contents, indicated by the CURRENT TIME SENSE RETURN chart. + // Send: 61 0C 04 11 (Request CTL counter position) + // Returns : 74 00 01 02 03 04 7E(Return 04 : 03 : 02 : 01) + // Send : 61 0C 03 11(Request LTC or VITC time code position) + // Returns : 74 14 10 20 30 24 7E(Return 24 : 30 : 20 : 10 LTC Interpolated w / CTL) + // Send : 61 0C 02 10(Request LTC or VITC time code position) + // Returns : 78 16 12 25 00 00 10 56 9A C5(Return 24 : 30 : 20 : 10 LTC Interpolated w / CTL) + // + // REPLY: based on CURRENT TIME SENSE RETURN chart + // https://www.drastic.tv/images/protocol/p_tcrtn.gif + Packet current_time_sense(const uint8_t data1) { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::CURRENT_TIME_SENSE, data1); + } + + // 60.10 IN DATA SENSE + // Requests the current in point. + // See the CUE UP WITH DATA command for the time code return format. + // Send: 60 10 70 + // Returns: 74 10 10 20 30 24 7E (Return in point of 24:30:20:10) + Packet in_data_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::IN_DATA_SENSE); + } + + // 60.11 OUT DATA SENSE + // Requests the current out point. + // See the CUE UP WITH DATA command for the time code return format. + // Send: 60 11 71 + // Returns: 74 11 24 30 20 10 7F (Return in point of 10:20:30:24) + Packet out_data_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::OUT_DATA_SENSE); + } + + // 60.12 Audio In Data Sense + // UNKNOWN + // REPLY: A_IN_DATA + Packet audio_in_data_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::AUDIO_IN_DATA_SENSE); + } + + // 60.13 Audio Out Data Sense + // UNKNOWN + // REPLY: A_OUT_DATA + Packet audio_out_data_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::AUDIO_OUT_DATA_SENSE); + } + + // 61.20 STATUS SENSE + // Requests the device status. The device will respond with the STATUS DATA + // 7X.20 command according to the contents of DATA-1 of the controller command. + // DATA-1 + // MSD (Bit7~4): Indicates the initial DATA No.l of the 7X.20 STATUS DATA to be returned. + // LSD (Bit3~0): Indicates the number of data bytes in 7X.20 STATUS DATA to be returned. + // ex. When the DATA-1 is 34. + // The device will return four bytes starting from the third byte, + // i.e. DATA No.3 to DATA No.6 of the 74.20 STATUS DATA + // REPLY: STATUS_DATA as above + Packet status_sense(const uint8_t start = 0, const uint8_t size = 10) { + LOG_INFO(" "); + const uint8_t v = size | (start << 4); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::STATUS_SENSE, v); + } + + // 60.21 Extended VTR Status + // UNKNOWN + // REPLY: ACK + Packet extended_vtr_status(const uint8_t data1) { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::EXTENDED_VTR_STATUS, data1); + } + + // 62.23 Signal Control Sense + // UNKNOWN + // REPLY: ACK + Packet signal_control_sense(const uint8_t data1, const uint8_t data2) { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::SIGNAL_CONTROL_SENSE, data1, data2); + } + + // 6X.28 Local Key Map Sense + // UNKNOWN + // REPLY: ACK + Packet local_keymap_sense() { + LOG_INFO(" "); + // return encode(Cmd1::SENSE_REQUEST, SenseRequest::LOCAL_KEYMAP_SENSE); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 61.2A Head Meter Sense + // UNKNOWN + // REPLY: ACK + Packet head_meter_sense(const uint8_t data1) { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::HEAD_METER_SENSE, data1); + } + + // 60.2B Remaining Time Sense + // UNKNOWN + // REPLY: ACK + Packet remaining_time_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::REMAINING_TIME_SENSE); + } + + // 60.2E Cmd Speed Sense + // UNKNOWN + // REPLY: SPEED_DATA + Packet cmd_speed_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::CMD_SPEED_SENSE); + } + + // 61.30 Edit Preset Sense + // UNKNOWN + // REPLY: ACK + Packet edit_preset_sense(const uint8_t data1) { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::EDIT_PRESET_SENSE, data1); + } + + // 60.30 PRE-ROLL TIME + // This command is used for requesting the current pre-roll duration. + // For the SENSE return data format, see the CUE UP WITH DATA command. + // Send: 60 30 90 + // Returns: 74 30 00 05 00 00 A9 (Pre-roll is five seconds) + Packet preroll_time_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::PREROLL_TIME_SENSE); + } + + // 60.36 TIMER MODE + // This command is used for requesting the device's default timer SENSE return type, + // based on return DATA-1: + // DATA-1 : 00: Time Code + // 01: Control (CTL) Counter + // Send: 60 36 96 + // Returns: 71 36 00 A6 (Sense mode time code) + Packet timer_mode_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::TIMER_MODE_SENSE); + } + + // 60.3E Record Inhibit Sense + // UNKNOWN + // REPLY: RECORD_INHIBIT_STATUS + Packet record_inhibit_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::RECORD_INHIBIT_SENSE); + } + + // 60.52 DA Inp Emph Sense + // UNKNOWN + // REPLY: RECORD_INHIBIT_STATUS + Packet da_inp_emph_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::DA_INPUT_EMPHASIS_SENSE); + } + + // 60.53 DA PB Emph Sense + // UNKNOWN + // REPLY: RECORD_INHIBIT_STATUS + Packet da_pb_emph_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::DA_PLAYBACK_EMPHASIS_SENSE); + } + + // 60.58 DA Samp. Freq. Sense + // UNKNOWN + // REPLY: RECORD_INHIBIT_STATUS + Packet da_samp_freq_sense() { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::DA_SAMPLING_FREQUENCY_SENSE); + } + + // 61.AA Cross Fade Time Sense + // UNKNOWN + // REPLY: RECORD_INHIBIT_STATUS + Packet cross_fade_time_sense(const uint8_t data1) { + LOG_INFO(" "); + return encode(Cmd1::SENSE_REQUEST, SenseRequest::CROSS_FADE_TIME_SENSE, data1); + } + + // =============== A - BlackMagic Advanced Media Protocol =============== + + // 08.02 BmdSeekToTimelinePosition + // 16-bit little endian fractional position [0..65535] + // REPLY: ACK + Packet bmd_seek_to_timeline_pos(const uint8_t data1, const uint8_t data2) { + LOG_INFO(" "); + // TODO: more user-friendly arguments? + return encode(Cmd1::SYSTEM_CONTROL, SystemCtrl::BMD_SEEK_TO_TIMELINE_POS, data1, data2); + } + + // 20.29 ClearPlaylist + // UNKNOWN + // REPLY: ACK + Packet clear_playlist() { + LOG_INFO(" "); + return encode(Cmd1::TRANSPORT_CONTROL, TransportCtrl::CLEAR_PLAYLIST); + } + + // 4F.16 AppendPreset + // 2 Bytes for the length N of the clip name + // N Bytes for each character of the clip name + // 4 Byte in point timecode (format is FFSSMMHH) + // 4 Byte out point timecode (format is FFSSMMHH) + // REPLY: ACK + Packet append_preset() { + LOG_INFO(" "); + // return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::APPEND_PRESET); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + + // 41.42 SetPlaybackLoop + // Bit0 loop mode enable, 0 = false, 1 = true + // Bit1 is single clip/timeline, 0 = single clip, 1 = timeline + // REPLY: ACK + Packet set_playback_loop(const bool b_enable, const uint8_t mode = LoopMode::SINGLE_CLIP) { + LOG_INFO(" "); + const uint8_t v = (uint8_t)b_enable | ((uint8_t)(mode & 0x01) << 1); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::SET_PLAYBACK_LOOP, v); + } + + // 41.44 SetStopMode + // 0 = Off + // 1 = Freeze on last frame of Timeline (not clip) + // 2 = Freeze on next clip of Timeline (not clip) + // 3 = Show black + // REPLY: ACK + Packet set_stop_mode(const uint8_t stop_mode) { + LOG_INFO(" "); + return encode(Cmd1::PRESET_SELECT_CONTROL, PresetSelectCtrl::SET_STOP_MODE, stop_mode); + } + + // 81.03 BmdSeekRelativeClip + // One-byte signed integer, which is the number of clips to skip (negative for backwards). + // REPLY: ACK + Packet bmd_seek_relative_clip(const int8_t index) { + LOG_INFO(" "); + return encode(Cmd1::BMD_EXTENSION, BmdExtensions::SEEK_RELATIVE_CLIP, index); + } + + // A1.01 AutoSkip + // 8-bit signed number of clips to skip from current clip + // REPLY: ACK + Packet auto_skip(const int8_t n) { + LOG_INFO(" "); + return encode(Cmd1::BMD_ADVANCED_MEDIA_PRTCL, BmdAdvancedMediaProtocol::AUTO_SKIP, (uint8_t)n); + } + + // AX.15 ListNextID + // when x = 0, single clip request + // when x = 1, # clips can be specified in the encode data + // REPLY: IDListing + Packet list_next_id() { + LOG_INFO(" "); + // return encode(Cmd1::BMD_ADVANCED_MEDIA_PRTCL, BmdAdvancedMediaProtocol::LIST_NEXT_ID); + // TODO: NOT IMPLEMENTED + LOG_WARN("NOT IMPLEMENTED"); + return Packet(); + } + +private: + Packet encode(Packet& packet, uint8_t& crc) { + packet.emplace_back(crc); + // Serial.println(crc, HEX); + return packet; + } + + template + Packet encode(Packet& packet, uint8_t& crc, const uint8_t arg, Args&&... args) { + packet.emplace_back(arg); + crc += arg; + // Serial.print(arg, HEX); + // Serial.print(" "); + return encode(packet, crc, util::forward(args)...); + } + + template + Packet encode(const Cmd1 cmd1, const Cmd2 cmd2, Args&&... args) { + uint8_t size = sizeof...(args); + uint8_t header = (uint8_t)cmd1 | (size & 0x0F); + uint8_t crc = header + (uint8_t)cmd2; + Packet packet; + packet.emplace_back(header); + packet.emplace_back((uint8_t)cmd2); + // Serial.print(" : encode data = "); + // Serial.print(header, HEX); + // Serial.print(" "); + // Serial.print((uint8_t)cmd2, HEX); + // Serial.print(" "); + return encode(packet, crc, util::forward(args)...); + } + + template + inline auto from_dec_to_bcd(const T& n) + -> typename std::enable_if::value, size_t>::type { + return n + 6 * (n / 10); + } +}; + +} // namespace sony9pin + +#include "util/DebugLog/DebugLogRestoreState.h" + +#endif // SONY9PINREMOTE_ENCODER_H diff --git a/Sony9PinRemote/Sony9PinRemote/Types.h b/Sony9PinRemote/Sony9PinRemote/Types.h new file mode 100644 index 00000000..1713697c --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/Types.h @@ -0,0 +1,504 @@ +#ifndef HT_RS422_SONY9PINREMOTE_TYPES_H +#define HT_RS422_SONY9PINREMOTE_TYPES_H + +#ifdef ARDUINO +#include +#endif +#include + +namespace sony9pin { + +// =============== Common Constants =============== + +static constexpr uint8_t MAX_PACKET_SIZE {15 + 3}; + +// =============== Cmd1 Lists =============== + +enum class Cmd1 : uint8_t { + SYSTEM_CONTROL = 0x00, // ---> device + SYSTEM_CONTROL_RETURN = 0x10, // <--- device + TRANSPORT_CONTROL = 0x20, // ---> device + PRESET_SELECT_CONTROL = 0x40, // ---> device + SENSE_REQUEST = 0x60, // ---> device + SENSE_RETURN = 0x70, // <--- device + BMD_EXTENSION = 0x80, // <--> device + BMD_ADVANCED_MEDIA_PRTCL = 0xA0, // <--> device + NA = 0xFF +}; + +// =============== Cmd2 lists =============== + +// ===== 0 - System Control ===== +namespace SystemCtrl { + enum : uint8_t { + LOCAL_DISABLE = 0x0C, + DEVICE_TYPE = 0x11, + LOCAL_ENABLE = 0x1D, + // Black Magic Advanced Media Protocol + BMD_SEEK_TO_TIMELINE_POS = 0x02, + }; +} + +// ===== 1 - System Control Return ===== +namespace SystemControlReturn { + enum : uint8_t { + ACK = 0x01, // auto parse + NAK = 0x12, // auto parse + DEVICE_TYPE = 0x11, // auto parse + }; +} + +// ===== 2 - Transport Control ===== +namespace TransportCtrl { + enum : uint8_t { + STOP = 0x00, + PLAY = 0x01, + RECORD = 0x02, + STANDBY_OFF = 0x04, + STANDBY_ON = 0x05, + EJECT = 0x0F, + FAST_FWD = 0x10, + JOG_FWD = 0x11, + VAR_FWD = 0x12, + SHUTTLE_FWD = 0x13, + FRAME_STEP_FWD = 0x14, + FAST_REVERSE = 0x20, + REWIND = 0x20, + JOG_REV = 0x21, + VAR_REV = 0x22, + SHUTTLE_REV = 0x23, + FRAME_STEP_REV = 0x24, + PREROLL = 0x30, + CUE_UP_WITH_DATA = 0x31, + SYNC_PLAY = 0x34, + PROG_SPEED_PLAY_PLUS = 0x38, + PROG_SPEED_PLAY_MINUS = 0x39, + PREVIEW = 0x40, + REVIEW = 0x41, + AUTO_EDIT = 0x42, + OUTPOINT_PREVIEW = 0x43, + ANTI_CLOG_TIMER_DISABLE = 0x54, // TODO: NOT IMPLEMENTED + ANTI_CLOG_TIMER_ENABLE = 0x55, // TODO: NOT IMPLEMENTED + DMC_SET_FWD = 0x5C, + DMC_SET_REV = 0x5D, + FULL_EE_OFF = 0x60, + FULL_EE_ON = 0x61, + SELECT_EE_ON = 0x63, + EDIT_OFF = 0x64, + EDIT_ON = 0x65, + FREEZE_OFF = 0x6A, + FREEZE_ON = 0x6B, + // BlackMagic Advanced Media Protocol + CLEAR_PLAYLIST = 0x29, + }; +} + +// ===== 4 - Preset/Select Control ===== +namespace PresetSelectCtrl { + enum : uint8_t { + TIMER_1_PRESET = 0x00, + TIME_CODE_PRESET = 0x04, + USER_BIT_PRESET = 0x05, + TIMER_1_RESET = 0x08, + IN_ENTRY = 0x10, + OUT_ENTRY = 0x11, + AUDIO_IN_ENTRY = 0x12, + AUDIO_OUT_ENTRY = 0x13, + IN_DATA_PRESET = 0x14, + OUT_DATA_PRESET = 0x15, + AUDIO_IN_DATA_PRESET = 0x16, // TODO: NOT IMPLEMENTED + AUDIO_OUT_DATA_PRESET = 0x17, // TODO: NOT IMPLEMENTED + IN_SHIFT_PLUS = 0x18, + IN_SHIFT_MINUS = 0x19, + OUT_SHIFT_PLUS = 0x1A, + OUT_SHIFT_MINUS = 0x1B, + AUDIO_IN_SHIFT_PLUS = 0x1C, + AUDIO_IN_SHIFT_MINUS = 0x1D, + AUDIO_OUT_SHIFT_PLUS = 0x1E, + AUDIO_OUT_SHIFT_MINUS = 0x1F, + IN_FLAG_RESET = 0x20, + OUT_FLAG_RESET = 0x21, + AUDIO_IN_FLAG_RESET = 0x22, + AUDIO_OUT_FLAG_RESET = 0x23, + IN_RECALL = 0x24, + OUT_RECALL = 0x25, + AUDIO_IN_RECALL = 0x26, + AUDIO_OUT_RECALL = 0x27, + LOST_LOCK_RESET = 0x2D, + EDIT_PRESET = 0x30, + PREROLL_PRESET = 0x31, + TAPE_AUDIO_SELECT = 0x32, + SERVO_REF_SELECT = 0x33, + HEAD_SELECT = 0x34, + COLOR_FRAME_SELECT = 0x35, + TIMER_MODE_SELECT = 0x36, + INPUT_CHECK = 0x37, + EDIT_FIELD_SELECT = 0x3A, + FREEZE_MODE_SELECT = 0x3B, + RECORD_INHIBIT = 0x3E, // TODO: NOT IMPLEMENTED + AUTO_MODE_OFF = 0x40, + AUTO_MODE_ON = 0x41, + SPOT_ERASE_OFF = 0x42, + SPOT_ERASE_ON = 0x43, + AUDIO_SPLIT_OFF = 0x44, + AUDIO_SPLIT_ON = 0x45, + OUTPUT_H_PHASE = 0x98, // TODO: NOT IMPLEMENTED + OUTPUT_VIDEO_PHASE = 0x9B, // TODO: NOT IMPLEMENTED + AUDIO_INPUT_LEVEL = 0xA0, // TODO: NOT IMPLEMENTED + AUDIO_OUTPUT_LEVEL = 0xA1, // TODO: NOT IMPLEMENTED + AUDIO_ADV_LEVEL = 0xA2, // TODO: NOT IMPLEMENTED + AUDIO_OUTPUT_PHASE = 0xA8, // TODO: NOT IMPLEMENTED + AUDIO_ADV_OUTPUT_PHASE = 0xA9, // TODO: NOT IMPLEMENTED + CROSS_FADE_TIME_PRESET = 0xAA, // TODO: NOT IMPLEMENTED + LOCAL_KEY_MAP = 0xB8, // TODO: NOT IMPLEMENTED + STILL_OFF_TIME = 0xF8, + STBY_OFF_TIME = 0xFA, + // BlackMagic Advanced Media Protocol + APPEND_PRESET = 0x16, // TODO: NOT IMPLEMENTED + SET_PLAYBACK_LOOP = 0x42, + SET_STOP_MODE = 0x44 + }; +} + +// ===== 6 - Sense Request ===== +namespace SenseRequest { + enum : uint8_t { + TC_GEN_SENSE = 0x0A, + CURRENT_TIME_SENSE = 0x0C, + IN_DATA_SENSE = 0x10, + OUT_DATA_SENSE = 0x11, + AUDIO_IN_DATA_SENSE = 0x12, + AUDIO_OUT_DATA_SENSE = 0x13, + STATUS_SENSE = 0x20, + EXTENDED_VTR_STATUS = 0x21, + SIGNAL_CONTROL_SENSE = 0x23, + LOCAL_KEYMAP_SENSE = 0x28, + HEAD_METER_SENSE = 0x2A, + REMAINING_TIME_SENSE = 0x2B, + CMD_SPEED_SENSE = 0x2E, + EDIT_PRESET_SENSE = 0x30, + PREROLL_TIME_SENSE = 0x31, + TIMER_MODE_SENSE = 0x36, + RECORD_INHIBIT_SENSE = 0x3E, + DA_INPUT_EMPHASIS_SENSE = 0x52, + DA_PLAYBACK_EMPHASIS_SENSE = 0x53, + DA_SAMPLING_FREQUENCY_SENSE = 0x58, + CROSS_FADE_TIME_SENSE = 0xAA, + }; +} + +// ===== 7 - Sense Reply ===== +namespace SenseReturn { + enum : uint8_t { + TIMER_1 = 0x00, + TIMER_2 = 0x01, + LTC_TC_UB = 0x04, // size == 8 + LTC_TC = 0x04, // size == 4 + LTC_UB = 0x05, + VITC_TC_UB = 0x06, // size == 8 + VITC_TC = 0x06, // size == 4 + VITC_UB = 0x07, + GEN_TC_UB = 0x08, // size == 8 + GEN_TC = 0x08, // size == 4 + GEN_UB = 0x09, + IN_DATA = 0x10, + OUT_DATA = 0x11, + AUDIO_IN_DATA = 0x12, + AUDIO_OUT_DATA = 0x13, + LTC_INTERPOLATED_TC_UB = 0x14, // size == 8 + LTC_INTERPOLATED_TC = 0x14, // size == 4 + LTC_INTERPOLATED_UB = 0x15, + HOLD_VITC_TC_UB = 0x16, // size == 8 + HOLD_VITC_TC = 0x16, // size == 4 + HOLD_VITC_UB = 0x17, + STATUS_DATA = 0x20, + EXTENDED_STATUS_DATA = 0x21, + SIGNAL_CONTROL_DATA = 0x23, + LOCAL_KEYMAP = 0x28, + HEAD_METER_DATA = 0x2A, + REMAINING_TIME = 0x2B, + CMD_SPEED_DATA = 0x2E, + EDIT_PRESET_STATUS = 0x30, + PREROLL_TIME = 0x31, + TIMER_MODE_STATUS = 0x36, + RECORD_INHIBIT_STATUS = 0x3E, + DA_INPUT_EMPHASIS_DATA = 0x52, + DA_PLAYBACK_EMPHASIS_DATA = 0x53, + DA_SAMPLING_FREQUENCY_DATA = 0x58, + CROSS_FADE_TIME_DATA = 0xAA, + }; +} + +// ===== 8 - BlackMagic Extensions ===== +namespace BmdExtensions { + enum : uint8_t { + SEEK_RELATIVE_CLIP = 0x03, + }; +} + +// ===== A - BlackMagic Advanced Media Protocol ===== +namespace BmdAdvancedMediaProtocol { + enum : uint8_t { + AUTO_SKIP = 0x01, + LIST_NEXT_ID = 0x15, // TODO: NOT IMPLEMENTED + }; +} + +// =============== Bit Masks =============== + +namespace HeaderMask { + enum : uint8_t { + CMD1 = 0b11110000, + SIZE = 0b00001111, + }; +} + +namespace NakMask { + enum : uint8_t { + UNKNOWN_CMD = 0b00000001, + NOT_USED_1 = 0b00000010, + CHECKSUM_ERROR = 0b00000100, + NOT_USED_3 = 0b00001000, + PARITY_ERROR = 0b00010000, + BUFFER_OVERRUN = 0b00100000, + FRAMING_ERROR = 0b01000000, + TIMEOUT = 0b10000000 + }; +} + +namespace StatusMask { + enum : uint8_t { + // byte 0 + CASSETTE_OUT = 0b00100000, + SERVO_REF_MISSING = 0b00010000, + LOCAL = 0b00000001, + // byte 1 + STANDBY = 0b10000000, + STOP = 0b00100000, + EJECT = 0b00010000, + REWIND = 0b00001000, + FORWARD = 0b00000100, + RECORD = 0b00000010, + PLAY = 0b00000001, + // byte 2 + SERVO_LOCK = 0b10000000, + TSO_MODE = 0b01000000, + SHUTTLE = 0b00100000, + JOG = 0b00010000, + VAR = 0b00001000, + DIRECTION = 0b00000100, + STILL = 0b00000010, + CUE_UP = 0b00000001, + // byte 3 + AUTO_MODE = 0b10000000, + FREEZE_ON = 0b01000000, + CF_MODE = 0b00010000, + AUDIO_OUT_SET = 0b00001000, + AUDIO_IN_SET = 0b00000100, + OUT_SET = 0b00000010, + IN_SET = 0b00000001, + // byte 4 + SELECT_EE = 0b10000000, + FULL_EE = 0b01000000, + EDIT_SET = 0b00010000, + REVIEW_SET = 0b00001000, + AUTO_EDIT_SET = 0b00000100, + PREVIEW_SET = 0b00000010, + PREROLL_SET = 0b00000001, + // byte 5 + INSERT_SET = 0b01000000, + ASSEMBLE_SET = 0b00100000, + VIDEO_SET = 0b00010000, + A4_SET = 0b00001000, + A3_SET = 0b00000100, + A2_SET = 0b00000010, + A1_SET = 0b00000001, + // byte 6 + LAMP_STILL = 0b01000000, + LAMP_FWD = 0b00100000, + LAMP_REV = 0b00010000, + SRCH_LED_8 = 0b00001000, + SRCH_LED_4 = 0b00000100, + SRCH_LED_2 = 0b00000010, + SRCH_LED_1 = 0b00000001, + // byte 7 + AUD_SPLIT = 0b00100000, + SYNC_ACT = 0b00010000, + SPOT_ERASE = 0b00000100, + IN_OUT = 0b00000001, + // byte 8 + BUZZER = 0b10000000, + LOST_LOCK = 0b01000000, + NEAR_EOT = 0b00100000, + EOT = 0b00010000, + CF_LOCK = 0b00001000, + SVO_ALARM = 0b00000100, + SYS_ALARM = 0b00000010, + REC_INHIB = 0b00000001, + // byte 9 + FNC_ABORT = 0b10000000, + }; +} + +// =============== Data Structs for Decoder =============== + +struct Errors { + bool b_unknown_cmd {false}; + bool b_checksum_error {false}; + bool b_parity_error {false}; + bool b_buffer_overrun {false}; + bool b_framing_error {false}; + bool b_timeout {false}; +}; + +struct Status { + // byte 0 + bool b_cassette_out {false}; // set if no ssd is present + bool b_servo_ref_missing {false}; // set if servo reference is absent + bool b_local {false}; // set if remote is disabled (local control) + // byte 1 + bool b_standby {false}; // set if a disk is available + bool b_stop {false}; // When the machine is in full stop, this is 1. The thread state depends on the tape/ee and standby settings. + bool b_eject {false}; // When the tape is ejecting this is 1. + bool b_rewind {false}; // When the machine is in fast reverse this is 1. + bool b_forward {false}; // When the machine is in fast forward this is 1. + bool b_record {false}; // This bit goes from 0 to 1 some number of frames after the machine starts recording. For the DVR2000 we measured 5 frames. Others have varying delays on the record status. + bool b_play {false}; // This bit goes from 0 to 1 some number of frames after the machine starts playing. For the DVR2000 we measured 5 frames. Others have varying delays on the play status. + // byte 2 + bool b_servo_lock {false}; // 1 indicates servos are locked. This is a necessary condition for an edit to occur correctly. + bool b_tso_mode {false}; // Bit is 1 in tape speed override: in this mode, audio and video are still locked though speed is off play speed by +/- up to 15%. + bool b_shuttle {false}; + bool b_jog {false}; + bool b_var {false}; + bool b_direction {false}; // clear if playback is forwarding〝set if playback is reversing + bool b_still {false}; // set if playback is paused, or if in input preview mode + bool b_cue_up {false}; + // byte 3 + bool b_auto_mode {false}; // set if in Auto Mode + bool b_freeze_on {false}; + bool b_cf_mode {false}; + bool b_audio_out_set {false}; + bool b_audio_in_set {false}; + bool b_out_set {false}; + bool b_in_set {false}; + // byte 4 + bool b_select_ee {false}; // set if in input preview mode + bool b_full_ee {false}; + bool b_edit {false}; + bool b_review {false}; + bool b_auto_edit {false}; + bool b_preview {false}; + bool b_preroll {false}; + // byte 5 + bool b_insert {false}; + bool b_assemble {false}; + bool b_video {false}; + bool b_a4 {false}; + bool b_a3 {false}; + bool b_a2 {false}; + bool b_a1 {false}; + // byte 6 + bool b_lamp_still {false}; // set according to playback speed and direction + bool b_lamp_fwd {false}; + bool b_lamp_rev {false}; + bool b_srch_led_8 {false}; + bool b_srch_led_4 {false}; + bool b_srch_led_2 {false}; + bool b_srch_led_1 {false}; + // byte 7 + bool b_aud_split {false}; + bool b_sync_act {false}; + bool b_spot_erase {false}; + bool b_in_out {false}; + // byte 8 + bool b_buzzer {false}; + bool b_lost_lock {false}; + bool b_near_eot {false}; // set if total space left on available SSDs is less than 3 minutes + bool b_eot {false}; // set if total space left on available SSDs is less than 30 seconds + bool b_cf_lock {false}; + bool b_svo_alarm {false}; + bool b_sys_alarm {false}; + bool b_rec_inhib {false}; + // byte 9 + bool b_fnc_abort {false}; +}; + +struct TimeCode { + uint8_t frame {0}; + uint8_t second {0}; + uint8_t minute {0}; + uint8_t hour {0}; + bool is_cf {false}; + bool is_df {false}; +}; + +union UserBits { + uint8_t bytes[4]; + uint32_t i {0}; +}; + +struct TimeCodeAndUserBits { + TimeCode tc; + UserBits ub; +}; + +// =============== Mode / Flag Structs =============== + +// 12.11 DEVICE TYPE +namespace DeviceType { + enum : uint16_t { + BLACKMAGIC_HYPERDECK_STUDIO_MINI_NTSC = 0xF0E0, + BLACKMAGIC_HYPERDECK_STUDIO_MINI_PAL = 0xF1E0, + BLACKMAGIC_HYPERDECK_STUDIO_MINI_24P = 0xF2E0, + }; +} + +// 41.36 TIMER MODE SELECT +enum class TimerMode : uint8_t { + TIME_CODE = 0x00, + CTL_COUNTER = 0x01, + NA = 0xFF, +}; + +// 61.0A TC Generator Data Types +namespace TcGenData { + enum : uint8_t { + TC = 0x01, // 74.08 GEN TIME DATA Respond + UB = 0x10, // 74.09 GEN UB DATA Respond + TC_UB = 0x11 // 78.08 GEN TC & UB DATA Respond + }; +} + +// 61.0C CURRENT TIME +namespace CurrentTimeSenseFlag { + enum : uint8_t { + LTC_TC = 0x01, + VITC_TC = 0x02, + TIMER_1 = 0x04, + TIMER_2 = 0x08, + LTC_UB = 0x10, + VITC_UB = 0x20, + }; +} + +// 41.42 SetPlaybackLoop (BlackMagiconly) +namespace LoopMode { + enum : uint8_t { + SINGLE_CLIP, + TIMELINE + }; +} + +// 41.44 SetStopMode (BlackMagic only) +namespace StopMode { + enum : uint8_t { + OFF, + FREEZE_ON_LAST_FRAME, + FREEZE_ON_NEXT_CLIP, + SHOW_BLACK + }; +} + +} // namespace sony9pin + +#endif // HT_RS422_SONY9PINREMOTE_TYPES_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer.h b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer.h new file mode 100644 index 00000000..9b9494ff --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer.h @@ -0,0 +1,769 @@ +#pragma once + +#ifndef ARX_RINGBUFFER_H +#define ARX_RINGBUFFER_H + +#include "ArxContainer/has_include.h" +#include "ArxContainer/has_libstdcplusplus.h" + +#ifdef ARDUINO +#include +#endif + +#include "ArxContainer/replace_minmax_macros.h" +#include "ArxContainer/initializer_list.h" + +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11 + +#include +#include +#include +#include + +#else // Do not have libstdc++11 + +#include + +#ifndef ARX_VECTOR_DEFAULT_SIZE +#define ARX_VECTOR_DEFAULT_SIZE 16 +#endif // ARX_VECTOR_DEFAULT_SIZE + +#ifndef ARX_DEQUE_DEFAULT_SIZE +#define ARX_DEQUE_DEFAULT_SIZE 16 +#endif // ARX_DEQUE_DEFAULT_SIZE + +#ifndef ARX_MAP_DEFAULT_SIZE +#define ARX_MAP_DEFAULT_SIZE 16 +#endif // ARX_MAP_DEFAULT_SIZE + +namespace arx { + +namespace container { + namespace detail { + template + T&& move(T& t) { return static_cast(t); } + } // namespace detail +} // namespace container + +template +class RingBuffer { + class Iterator { + friend RingBuffer; + + T* ptr {nullptr}; // pointer to the first element + int pos {0}; + + Iterator() {} + Iterator(T* ptr, int pos) + : ptr(ptr), pos(pos) {} + + public: + Iterator(const Iterator& it) { + this->ptr = it.ptr; + this->pos = it.pos; + } + + Iterator(Iterator&& it) { + this->ptr = container::detail::move(it.ptr); + this->pos = container::detail::move(it.pos); + } + + int index() const { + if (pos >= 0) + return pos % N; + else + return N - (abs(pos) % (N + 1)); + } + + int index_with_offset(const int i) const { + const int p = pos + i; + if (p >= 0) + return p % N; + else + return N - (abs(p) % (N + 1)); + } + + T& operator*() { + return *(ptr + index()); + } + const T& operator*() const { + return *(ptr + index()); + } + T* operator->() { + return ptr + index(); + } + const T* operator->() const { + return ptr + index(); + } + + Iterator operator+(const Iterator& rhs) { + Iterator it(this->ptr, this->pos + rhs.pos); + return it; + } + Iterator operator+(const int n) { + Iterator it(this->ptr, this->pos + n); + return it; + } + Iterator operator-(const Iterator& rhs) { + Iterator it(this->ptr, this->pos - rhs.pos); + return it; + } + Iterator operator-(const int n) { + Iterator it(this->ptr, this->pos - n); + return it; + } + Iterator& operator+=(const Iterator& rhs) { + this->pos += rhs.pos; + return *this; + } + Iterator& operator+=(const int n) { + this->pos += n; + return *this; + } + Iterator& operator-=(const Iterator& rhs) { + this->pos -= rhs.pos; + return *this; + } + Iterator& operator-=(const int n) { + this->pos -= n; + return *this; + } + + // prefix increment/decrement + Iterator& operator++() { + ++pos; + return *this; + } + Iterator& operator--() { + --pos; + return *this; + } + // postfix increment/decrement + Iterator operator++(int) { + Iterator it = *this; + ++pos; + return it; + } + Iterator operator--(int) { + Iterator it = *this; + --pos; + return it; + } + + Iterator& operator=(const Iterator& rhs) { + this->ptr = rhs.ptr; + this->pos = rhs.pos; + return *this; + } + Iterator& operator=(Iterator&& rhs) { + this->ptr = container::detail::move(rhs.ptr); + this->pos = container::detail::move(rhs.pos); + return *this; + } + + bool operator==(const Iterator& rhs) const { + return (rhs.ptr == ptr) && (rhs.pos == pos); + } + bool operator!=(const Iterator& rhs) const { + return !(*this == rhs); + } + bool operator<(const Iterator& rhs) const { + return pos < rhs.pos; + } + bool operator<=(const Iterator& rhs) const { + return pos <= rhs.pos; + } + bool operator>(const Iterator& rhs) const { + return pos > rhs.pos; + } + bool operator>=(const Iterator& rhs) const { + return pos >= rhs.pos; + } + + private: + int raw_pos() const { + return pos; + } + + void set(const int i) { + pos = i; + } + + void reset() { + pos = 0; + } + }; + +protected: + friend class Iterator; + + T queue_[N]; + Iterator head_; + Iterator tail_; + +public: + using iterator = Iterator; + using const_iterator = const Iterator; + + RingBuffer() + : queue_() + , head_(queue_, 0) + , tail_(queue_, 0) { + } + + RingBuffer(std::initializer_list lst) + : queue_() + , head_(queue_, 0) + , tail_(queue_, 0) { + for (auto it = lst.begin(); it != lst.end(); ++it) { + push_back(*it); + } + } + + // copy + explicit RingBuffer(const RingBuffer& r) + : queue_() + , head_(r.head_) + , tail_(r.tail_) { + for (size_t i = 0; i < r.size(); ++i) + queue_[i] = r.queue_[i]; + } + RingBuffer& operator=(const RingBuffer& r) { + head_ = r.head_; + tail_ = r.tail_; + for (size_t i = 0; i < r.size(); ++i) + queue_[i] = r.queue_[i]; + return *this; + } + + // move + RingBuffer(RingBuffer&& r) { + head_ = container::detail::move(r.head_); + tail_ = container::detail::move(r.tail_); + for (size_t i = 0; i < r.size(); ++i) + queue_[i] = container::detail::move(r.queue_[i]); + } + + RingBuffer& operator=(RingBuffer&& r) { + head_ = container::detail::move(r.head_); + tail_ = container::detail::move(r.tail_); + for (size_t i = 0; i < r.size(); ++i) + queue_[i] = container::detail::move(r.queue_[i]); + return *this; + } + + virtual ~RingBuffer() {} + + size_t capacity() const { return N; }; + size_t size() const { return abs(tail_.raw_pos() - head_.raw_pos()); } + inline const T* data() const { return &(get(head_)); } + T* data() { return &(get(head_)); } + bool empty() const { return tail_ == head_; } + void clear() { + head_.reset(); + tail_.reset(); + } + + void pop() { + pop_front(); + } + void pop_front() { + if (size() == 0) return; + if (size() == 1) + clear(); + else + increment_head(); + } + void pop_back() { + if (size() == 0) return; + if (size() == 1) + clear(); + else + decrement_tail(); + } + + void push(const T& data) { + push_back(data); + } + void push(T&& data) { + push_back(data); + } + void push_back(const T& data) { + get(tail_) = data; + increment_tail(); + }; + void push_back(T&& data) { + get(tail_) = data; + increment_tail(); + }; + void push_front(const T& data) { + get(head_) = data; + decrement_head(); + }; + void push_front(T&& data) { + get(head_) = data; + decrement_head(); + }; + void emplace(const T& data) { push(data); } + void emplace(T&& data) { push(data); } + void emplace_back(const T& data) { push_back(data); } + void emplace_back(T&& data) { push_back(data); } + + const T& front() const { return get(head_); }; + T& front() { return get(head_); }; + + const T& back() const { return get(size() - 1); } + T& back() { return get(size() - 1); } + + const T& operator[](size_t index) const { return get((int)index); } + T& operator[](size_t index) { return get((int)index); } + + iterator begin() { return empty() ? Iterator() : head_; } + iterator end() { return empty() ? Iterator() : tail_; } + const_iterator begin() const { return empty() ? Iterator() : head_; } + const_iterator end() const { return empty() ? Iterator() : tail_; } + + iterator erase(const iterator& p) { + if (!is_valid(p)) return end(); + + iterator it_last = begin() + size() - 1; + for (iterator it = p; it != it_last; ++it) + *it = *(it + 1); + *it_last = T(); + decrement_tail(); + return empty() ? end() : p; + } + + void resize(size_t sz) { + size_t s = size(); + if (sz > size()) { + for (size_t i = 0; i < sz - s; ++i) push(T()); + } else if (sz < size()) { + for (size_t i = 0; i < s - sz; ++i) pop(); + } + } + + void assign(const_iterator first, const_iterator end) { + clear(); + while (first != end) push(*(first++)); + } + + void assign(const T* first, const T* end) { + clear(); + // T* it = first; + while (first != end) push(*(first++)); + } + + void shrink_to_fit() { + // dummy + } + + void reserve(size_t n) { + (void)n; + // dummy + } + + void fill(const T& v) { + iterator it = begin(); + while (it != end()) { + *it = v; + ++it; + } + } + + void insert(const_iterator pos, const_iterator first, const_iterator last) { + if (pos != end()) { + size_t sz = 0; + { + for (iterator it = first; it != last; ++it) ++sz; + } + iterator it = end() + sz - 1; + for (int i = sz; i > 0; --i, --it) + *it = *(it - sz); + it = pos; + for (size_t i = 0; i < sz; ++i) + *it = *(first + i); + } else { + for (iterator it = first; it != last; ++it) + push_back(*it); + } + } + + void insert(const_iterator pos, const T* first, const T* last) { + if (pos != end()) { + size_t sz = 0; + { + for (const T* it = first; it != last; ++it) ++sz; + } + iterator it = end() + sz - 1; + for (int i = sz; i > 0; --i, --it) + *it = *(it - sz); + it = pos; + for (size_t i = 0; i < sz; ++i) + *it = *(first + i); + } else { + for (const T* it = first; it != last; ++it) + push_back(*it); + } + } + +private: + T& get(const Iterator& it) { + return queue_[it.index()]; + } + const T& get(const Iterator& it) const { + return queue_[it.index()]; + } + T& get(const int index) { + return queue_[head_.index_with_offset(index)]; + } + const T& get(const int index) const { + return queue_[head_.index_with_offset(index)]; + } + + T* ptr(const Iterator& it) { + return (T*)(queue_ + it.index()); + } + const T* ptr(const Iterator& it) const { + return (T*)(queue_ + it.index()); + } + T* ptr(const int index) { + return (T*)(queue_ + head_.index_with_offset(index)); + } + const T* ptr(const int index) const { + return (T*)(queue_ + head_.index_with_offset(index)); + } + + void increment_head() { + ++head_; + resolve_overflow(); + } + void increment_tail() { + ++tail_; + resolve_overflow(); + if (size() > N) + increment_head(); + } + void decrement_head() { + --head_; + resolve_overflow(); + if (size() > N) + decrement_tail(); + } + void decrement_tail() { + --tail_; + resolve_overflow(); + } + + void resolve_overflow() { + if (empty()) + clear(); + else if (head_.raw_pos() > tail_.raw_pos()) { + // the same value will be obtained regardless of which of the head tail overflows + int len = (INT_MAX - head_.raw_pos()) + (tail_.raw_pos() - INT_MIN); + clear(); + tail_.set(len); + } + } + + bool is_valid(const iterator& it) { + return (it.raw_pos() >= head_.raw_pos()) && (it.raw_pos() < tail_.raw_pos()); + } +}; + +template +bool operator==(const RingBuffer& x, const RingBuffer& y) { + if (x.size() != y.size()) return false; + for (size_t i = 0; i < x.size(); ++i) + if (x[i] != y[i]) return false; + return true; +} + +template +bool operator!=(const RingBuffer& x, const RingBuffer& y) { + return !(x == y); +} + +template +struct vector : public RingBuffer { + using iterator = typename RingBuffer::iterator; + using const_iterator = typename RingBuffer::const_iterator; + + vector() + : RingBuffer() {} + vector(std::initializer_list lst) + : RingBuffer(lst) {} + + // copy + vector(const vector& r) + : RingBuffer(r) {} + + vector& operator=(const vector& r) { + RingBuffer::operator=(r); + return *this; + } + + // move + vector(vector&& r) + : RingBuffer(r) {} + + vector& operator=(vector&& r) { + RingBuffer::operator=(r); + return *this; + } + + virtual ~vector() {} + +private: + using RingBuffer::pop; + using RingBuffer::pop_front; + using RingBuffer::push; + using RingBuffer::push_front; + using RingBuffer::emplace; + using RingBuffer::fill; +}; + +template +struct array : public RingBuffer { + using iterator = typename RingBuffer::iterator; + using const_iterator = typename RingBuffer::const_iterator; + + array() + : RingBuffer() {} + array(std::initializer_list lst) + : RingBuffer(lst) {} + + // copy + array(const array& r) + : RingBuffer(r) {} + + array& operator=(const array& r) { + RingBuffer::operator=(r); + return *this; + } + + // move + array(array&& r) + : RingBuffer(r) {} + + array& operator=(array&& r) { + RingBuffer::operator=(r); + return *this; + } + + virtual ~array() {} + +private: + using RingBuffer::pop; + using RingBuffer::pop_front; + using RingBuffer::push; + using RingBuffer::push_front; + using RingBuffer::emplace; +}; + +template +struct deque : public RingBuffer { + using iterator = typename RingBuffer::iterator; + using const_iterator = typename RingBuffer::const_iterator; + + deque() + : RingBuffer() {} + deque(std::initializer_list lst) + : RingBuffer(lst) {} + + // copy + deque(const deque& r) + : RingBuffer(r) {} + + deque& operator=(const deque& r) { + RingBuffer::operator=(r); + return *this; + } + + // move + deque(deque&& r) + : RingBuffer(r) {} + + deque& operator=(deque&& r) { + RingBuffer::operator=(r); + return *this; + } + + virtual ~deque() {} + +private: + using RingBuffer::capacity; + using RingBuffer::pop; + using RingBuffer::push; + using RingBuffer::emplace; + using RingBuffer::assign; + using RingBuffer::begin; + using RingBuffer::end; + using RingBuffer::fill; +}; + +template +struct pair { + T1 first; + T2 second; +}; + +template +pair make_pair(const T1& t1, const T2& t2) { + return {t1, t2}; +}; + +template +bool operator==(const pair& x, const pair& y) { + return (x.first == y.first) && (x.second == y.second); +} + +template +bool operator!=(const pair& x, const pair& y) { + return !(x == y); +} + +template +struct map : public RingBuffer, N> { + using iterator = typename RingBuffer, N>::iterator; + using const_iterator = typename RingBuffer, N>::const_iterator; + using base = RingBuffer, N>; + + map() + : base() {} + map(std::initializer_list > lst) + : base(lst) {} + + // copy + map(const map& r) + : base(r) {} + + map& operator=(const map& r) { + base::operator=(r); + return *this; + } + + // move + map(map&& r) + : RingBuffer(r) {} + + map& operator=(map&& r) { + base::operator=(r); + return *this; + } + + virtual ~map() {} + + const_iterator find(const Key& key) const { + for (size_t i = 0; i < this->size(); ++i) { + const_iterator it = this->begin() + i; + if (key == it->first) + return it; + } + return this->end(); + } + + iterator find(const Key& key) { + for (size_t i = 0; i < this->size(); ++i) { + iterator it = this->begin() + i; + if (key == it->first) + return it; + } + return this->end(); + } + + pair insert(const Key& key, const T& t) { + bool b {false}; + iterator it = find(key); + if (it == this->end()) { + this->push(make_pair(key, t)); + b = true; + it = this->begin() + this->size() - 1; + } + return {it, b}; + } + + pair insert(const pair& p) { + bool b {false}; + iterator it = find(p.first); + if (it == this->end()) { + this->push(p); + b = true; + it = this->begin() + this->size() - 1; + } + return {it, b}; + } + + pair emplace(const Key& key, const T& t) { + return insert(key, t); + } + + pair emplace(const pair& p) { + return insert(p); + } + + const T& at(const Key& key) const { + // iterator it = find(key); + // if (it != this->end()) return it->second; + // return T(); + return find(key)->second; + } + + T& at(const Key& key) { + // iterator it = find(key); + // if (it != this->end()) return it->second; + // return T(); + return find(key)->second; + } + + iterator erase(const iterator& it) { + iterator i = (iterator)find(it->first); + return base::erase(i); + } + + iterator erase(const Key& key) { + iterator i = find(key); + return base::erase(i); + } + + iterator erase(const size_t index) { + if (index < this->size()) { + iterator it = this->begin() + index; + erase(it); + } + return this->end(); + } + + T& operator[](const Key& key) { + iterator it = find(key); + if (it != this->end()) return it->second; + + insert(::arx::make_pair(key, T())); + return this->back().second; + } + +private: + using base::assign; + using base::back; + using base::capacity; + using base::data; + using base::emplace_back; + using base::front; + using base::pop; + using base::pop_back; + using base::pop_front; + using base::push; + using base::push_back; + using base::push_front; + using base::resize; + using base::shrink_to_fit; + using base::fill; +}; + +} // namespace arx + +template +using ArxRingBuffer = arx::RingBuffer; + +#endif // Do not have libstdc++11 +#endif // ARX_RINGBUFFER_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/has_include.h b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/has_include.h new file mode 100644 index 00000000..d605d711 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/has_include.h @@ -0,0 +1,30 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_HAS_INCLUDE_H +#define ARX_TYPE_TRAITS_HAS_INCLUDE_H + + // Check whether __has_include is available, but also check the GCC + // version (__has_include was introduced in gcc 5) to catch + // environments (such as ESP8266) where gcc is old, but some system + // header provides a fake __has_include. We also need to check + // against __clang__ here, since clang pretends to be GCC + // 4.something and would otherwise be detected incorrectly here... + #if !defined(__has_include) || defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__) + #if defined(ARDUINO_ARCH_ESP8266) + // ESP8266 does not have a working __has_include, but we + // know it does have a working libstdc++ with all the + // headers we care about, so provide a fake has_include + #define ARX_SYSTEM_HAS_INCLUDE(x) 1 + #elif defined(ARDUINO_SAM_DUE) + // Arduino DUE's GCC version is 4.8.3 (GCC < 5.0). + // If libstdc++ is used, std::function causes error + // so currently we disable libstdc++ and use ArxTypeTraits + #define ARX_SYSTEM_HAS_INCLUDE(x) 0 + #else + #error "Compiler does not support __has_include, please report a bug against the ArxTypeTraits library about this." + #endif + #else + #define ARX_SYSTEM_HAS_INCLUDE(x) __has_include(x) + #endif + +#endif // ARX_TYPE_TRAITS_HAS_INCLUDE_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/has_libstdcplusplus.h b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/has_libstdcplusplus.h new file mode 100644 index 00000000..23f2b26c --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/has_libstdcplusplus.h @@ -0,0 +1,35 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H +#define ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H + +#if !defined(ARX_HAVE_LIBSTDCPLUSPLUS) + #if ARX_SYSTEM_HAS_INCLUDE() && !defined(ARDUINO_spresense_ast) + #include + #if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION) + // For gcc's libstdc++ and clang's libc++, assume that + // __cplusplus tells us what the standard includes support + #define ARX_HAVE_LIBSTDCPLUSPLUS __cplusplus + #elif defined(_CPPLIB_VER) + #if _CPPLIB_VER > 650 + #define ARX_HAVE_LIBSTDCPLUSPLUS 201703L // C++17 + #elif _CPPLIB_VER == 650 + #define ARX_HAVE_LIBSTDCPLUSPLUS 201402L // C++14 + #elif _CPPLIB_VER >= 610 + #define ARX_HAVE_LIBSTDCPLUSPLUS 201103L // C++11 + #else + #define ARX_HAVE_LIBSTDCPLUSPLUS 199711L // C++98 + #endif + #elif defined(__UCLIBCXX_MAJOR__) + // For uclibc++, assume C++98 support only. + #define ARX_HAVE_LIBSTDCPLUSPLUS 199711L + #else + #error "Unknown C++ library found, please report a bug against the ArxTypeTraits library about this." + #endif + #else + // Assume no standard library is available at all (e.g. on AVR) + #define ARX_HAVE_LIBSTDCPLUSPLUS 0 + #endif +#endif + +#endif // ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/initializer_list.h b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/initializer_list.h new file mode 100644 index 00000000..374aa272 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/initializer_list.h @@ -0,0 +1,32 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_INITIALIZER_H +#define ARX_TYPE_TRAITS_INITIALIZER_H + +// Initializer_list *must* be defined in std, so take extra care to only +// define it when is really not available (e.g. +// ArduinoSTL is C++98 but *does* define ) and not +// already defined (e.g. by ArxContainer). +#if ARX_SYSTEM_HAS_INCLUDE() +#include +#else +namespace std { +template +class initializer_list { +private: + const T* array; + size_t len; + initializer_list(const T* a, size_t l) + : array(a), len(l) {} + +public: + initializer_list() + : array(nullptr), len(0) {} + size_t size() const { return len; } + const T* begin() const { return array; } + const T* end() const { return array + len; } +}; +} // namespace std +#endif + +#endif // ARX_TYPE_TRAITS_INITIALIZER_LIST_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/replace_minmax_macros.h b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/replace_minmax_macros.h new file mode 100644 index 00000000..f8ff86e5 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/ArxContainer/replace_minmax_macros.h @@ -0,0 +1,35 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H +#define ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H + +// Make sure Arduino.h is actually included, since otherwise it might be +// included later and break *uses* of the min/max methods, rather than +// the declarations of it. +#ifdef ARDUINO + #include +#endif + +// These macros are defined by Arduino.h on some platforms, and conflict +// with min/max methods defined or included by ArxTypeTraits, so replace +// them with macros here. +#ifdef max + #undef max + template + constexpr auto max(T1 x, T2 y) + -> decltype(x + y) + { + return (x > y) ? x : y; + } +#endif +#ifdef min + #undef min + template + constexpr auto min(T1 x, T2 y) + -> decltype(x + y) + { + return (x < y) ? x : y; + } +#endif + +#endif // ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/README.md b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/README.md new file mode 100644 index 00000000..c06c0b83 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/README.md @@ -0,0 +1,194 @@ +# ArxContainer + +C++ container-like classes (`vector`, `array`, `deque`, `map` etc.) for Arduino which cannot use STL + +## Note + +- `ArxContainer` is C++ container-__like__ classes for Arduino + - Containers in this library is defined inside namespace `arx` instad of `std` (e.g. `arx::vector`) + - All of the functions is not supported currently +- If standard libraries are available, automatically use `std` version instead of `arx` version + + +## Supported Container Types + +- `vector` +- `array` +- `map` (`pair`) +- `deque` + + +## Supported Boards + +`arx` version of containers are enabled only if you use following architecture. +In other borads, `arx` version is disabled and standard libraries (`std` version) will be imported (because they can use them). + +- AVR (Uno, Nano, Mega, etc.) +- MEGAAVR (Uno WiFi, Nano Ecery, etc.) +- SAM (Due) + + +## Usage + +### vector + +```C++ +// initialize with initializer_list +arx::vector vs {1, 2, 3}; + +// add contents +for (size_t i = 4; i <= 5; ++i) + vs.push_back(i); + +// index access +for (size_t i = 0; i < vs.size(); ++i) + Serial.println(vs[i]); + +// range-based access +for (const auto& v : vs) + Serial.println(v); +``` + +### array + +```C++ +// initialize with initializer_list +arx::array arr {1, 2, 3}; + +// fill +arr.fill(123); + +// index access +for (size_t i = 0; i < arr.size(); ++i) + Serial.println(arr[i]); + +// range-based access +for (const auto& a : arr) + Serial.println(a); +``` + +### map + +``` C++ +// initialize with initializer_list +arx::map mp {{"one", 1}, {"two", 2}}; + +// add contents +mp.insert("three", 3); +mp["four"] = 4; + +// range based access +for (const auto& m : mp) +{ + Serial.print("{"); + Serial.print(m.first); Serial.print(","); + Serial.print(m.second); + Serial.println("}"); +} + +// key access +Serial.print("one = "); Serial.println(mp["one"]); +Serial.print("two = "); Serial.println(mp["two"]); +Serial.print("three = "); Serial.println(mp["three"]); +Serial.print("four = "); Serial.println(mp["four"]); +``` + +### deque + +```C++ +// initialize with initializer_list +arx::deque dq {1, 2, 3}; + +// add contents +for (int i = 4; i <= 5; ++i) + dq.push_back(i); + +// index access +for (int i = 0; i < dq.size(); ++i) + Serial.print(dq[i]); +``` + + +## Detail + +`ArxContainer` is C++ container-__like__ classes for Arduino. +This library is based on `arx::RingBuffer` and `arx::xxxx` is limited-size container. +`arx::RingBuffer` can be used as: + +```C++ +ArxRingBuffer buffer; + +buffer.push(1); +buffer.push(2); +buffer.push(3); + +for(size_t i = 0; i < buffer.size(); ++i) + Serial.println(buffer[i]); + +buffer.pop(); + +for(auto& b : buffer) + Serial.println(b); +``` + +`arx::xxxx` are derived from `RingBuffer` and defined as: + +``` C++ +namespace arx { + template + struct vector : public RingBuffer + + template + struct array : public RingBuffer + + template + struct map : public RingBuffer, N> + + template + struct deque : public RingBuffer +} +``` + +So range-based loop cannot be applyed to `arx::deque` (iterator is not continuous because it is based on `RingBuffer`). + + +### Manage Size Limit of Container + +Global default size of container can be changed by defining these macros before `#include `. + +``` C++ +#define ARX_VECTOR_DEFAULT_SIZE XX // default: 16 +#define ARX_MAP_DEFAULT_SIZE XX // default: 16 +#define ARX_DEQUE_DEFAULT_SIZE XX // default: 16 +``` + +Or you can change each container size by template argument. + +``` C++ +arx::vector vs; +arx::map ms; +arx::deque ds; +``` + +## Roadmap + +This library will be updated if I want to use more container interfaces on supported boards shown above. +PRs are welcome! + + +## Used Inside of + +- [Packetizer](https://github.com/hideakitai/Packetizer) +- [MsgPack](https://github.com/hideakitai/MsgPack) +- [ArduinoOSC](https://github.com/hideakitai/ArduinoOSC) +- [ArtNet](https://github.com/hideakitai/ArtNet) +- [Tween](https://github.com/hideakitai/Tween) +- [TimeProfiler](https://github.com/hideakitai/TimeProfiler) +- [TaskManager](https://github.com/hideakitai/TaskManager) +- [ArxStringUtils](https://github.com/hideakitai/ArxStringUtils) +- [Debouncer](https://github.com/hideakitai/Debouncer) + + +## License + +MIT diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/library.json b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/library.json new file mode 100644 index 00000000..baf2512f --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/library.json @@ -0,0 +1,18 @@ +{ + "name": "ArxContainer", + "keywords": "ringbuffer, vector, deque, map", + "description": "C++ container-like classes (vector, map, etc.) for Arduino which cannot use STL", + "repository": { + "type": "git", + "url": "https://github.com/hideakitai/ArxContainer.git" + }, + "authors": { + "name": "Hideaki Tai", + "url": "https://github.com/hideakitai", + "maintainer": true + }, + "version": "0.4.0", + "license": "MIT", + "frameworks": "arduino", + "platforms": "*" +} diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/library.properties b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/library.properties new file mode 100644 index 00000000..c04d5698 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxContainer/library.properties @@ -0,0 +1,9 @@ +name=ArxContainer +version=0.4.0 +author=hideakitai +maintainer=hideakitai +sentence=C++ container-like classes (vector, map, etc.) for Arduino which cannot use STL +paragraph=C++ container-like classes (vector, map, etc.) for Arduino which cannot use STL +category=Data Storage +url=https://github.com/hideakitai/ArxContainer +architectures=* diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits.h b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits.h new file mode 100644 index 00000000..f9633161 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits.h @@ -0,0 +1,38 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_H +#define ARX_TYPE_TRAITS_H + +#include "ArxTypeTraits/has_include.h" +#include "ArxTypeTraits/has_libstdcplusplus.h" + +// Make sure std namespace exists +namespace std { } + +// Import everything from the std namespace into arx::std, so that +// anything we import rather than define is also available through +// arx::stdx. +// This includes everything yet to be defined, so we can do this early +// (and must do so, to allow e.g. the C++14 additions in the arx::std +// namespace to reference the C++11 stuff from the system headers. +namespace arx { + namespace stdx { + using namespace ::std; + } +} + +// Import everything from arx::std back into the normal std namespace. +// This ensures that you can just use `std::foo` everywhere and you get +// the standard library version if it is available, falling back to arx +// versions for things not supplied by the standard library. Only when +// you really need the arx version (e.g. for constexpr numeric_limits +// when also using ArduinoSTL), you need to qualify with arx::stdx:: +namespace std { + using namespace ::arx::stdx; +} + +#include "ArxTypeTraits/replace_minmax_macros.h" + +#include "ArxTypeTraits/type_traits.h" + +#endif // ARX_TYPE_TRAITS_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/functional.h b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/functional.h new file mode 100644 index 00000000..ed25943e --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/functional.h @@ -0,0 +1,165 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_FUNCTIONAL_H +#define ARX_TYPE_TRAITS_FUNCTIONAL_H + +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11 + +#include + +#else // Do not have libstdc++11 + +// If we have a header, include it and assume it has placement new +// (for AVR this has always been true, MEGAAVR does not have placement +// new now, but will probably get it before is added). +// This also handles the case where ArduinoSTL is used, which defines an +// inline placement new which would conflict with the below definition. +#if ARX_SYSTEM_HAS_INCLUDE() +#include +#else +// When there is no header, there might be a header, but +// not all Arduino platform (versions) define a placement new operator +// in there. +// However, it is hard to detect whether it is or is not defined, but +// the versions that do define it, do not define it inline in the +// header, so we can just define it inline here without conflicts. +// Note that there is no need to include anything to declare the +// non-placement new operators, since those are implicit. +inline void* operator new (const size_t size, void* ptr) noexcept { (void)size; return ptr; } +#endif + +namespace arx { namespace stdx { + + // reference: + // stack overflow https://stackoverflow.com/questions/32074410/stdfunction-bind-like-type-erasure-without-standard-c-library + + template + class function; + + template + class function + { + struct vtable_t + { + void (*mover)(void* src, void* dest); + void (*destroyer)(void*); + R (*invoke)(void const* t, Args&&... args); + + template + static vtable_t const* get() + { + static const vtable_t table = + { + // mover + [] (void* src, void* dest) + { + new(dest) T(move(*static_cast(src))); + }, + // destroyer + [] (void* t) + { + static_cast(t)->~T(); + }, + // invoke + [] (void const* t, Args&&... args) -> R + { + return (*static_cast(t))(std::forward(args)...); + } + }; + return &table; + } + }; + + vtable_t const* table {nullptr}; + void* data {nullptr}; + + public: + + template < + class Func, + class dF = typename std::decay::type, + typename enable_if {}>::type* = nullptr, + typename enable_if ::type, R>{}>::type* = nullptr + > + function(const Func& f) + : table(vtable_t::template get()) + { + data = reinterpret_cast(new Func(f)); + } + function(const function& o) + : table(o.table) + { + data = o.data; + } + function(function&& o) + : table(o.table) + { + if (table) table->mover(o.data, data); + } + function() + { + } + ~function() + { + if (table) table->destroyer(data); + } + + function& operator= (const function& o) + { + this->~function(); + new(this) function(move(o)); + return *this; + } + function& operator= (function&& o) + { + this->~function(); + new(this) function(move(o)); + return *this; + } + function& operator= (std::nullptr_t p) + { + (void)p; + this->~function(); + return *this; + } + + explicit operator bool() const + { + return table; + } + + R operator()(Args...args) const + { + return table->invoke(data, forward(args)...); + } + }; + + template + inline bool operator== (const function& f, std::nullptr_t) + { + return !static_cast(f); + } + + template + inline bool operator== (std::nullptr_t, const function& f) + { + return !static_cast(f); + } + + template + inline bool operator!= (const function& f, std::nullptr_t) + { + return static_cast(f); + } + + template + inline bool operator!= (std::nullptr_t, const function& f) + { + return static_cast(f); + } + +} } // namespace arx::std + +#endif // Do not have libstdc++11 + +#endif // ARX_TYPE_TRAITS_FUNCTIONAL_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/has_include.h b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/has_include.h new file mode 100644 index 00000000..d605d711 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/has_include.h @@ -0,0 +1,30 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_HAS_INCLUDE_H +#define ARX_TYPE_TRAITS_HAS_INCLUDE_H + + // Check whether __has_include is available, but also check the GCC + // version (__has_include was introduced in gcc 5) to catch + // environments (such as ESP8266) where gcc is old, but some system + // header provides a fake __has_include. We also need to check + // against __clang__ here, since clang pretends to be GCC + // 4.something and would otherwise be detected incorrectly here... + #if !defined(__has_include) || defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__) + #if defined(ARDUINO_ARCH_ESP8266) + // ESP8266 does not have a working __has_include, but we + // know it does have a working libstdc++ with all the + // headers we care about, so provide a fake has_include + #define ARX_SYSTEM_HAS_INCLUDE(x) 1 + #elif defined(ARDUINO_SAM_DUE) + // Arduino DUE's GCC version is 4.8.3 (GCC < 5.0). + // If libstdc++ is used, std::function causes error + // so currently we disable libstdc++ and use ArxTypeTraits + #define ARX_SYSTEM_HAS_INCLUDE(x) 0 + #else + #error "Compiler does not support __has_include, please report a bug against the ArxTypeTraits library about this." + #endif + #else + #define ARX_SYSTEM_HAS_INCLUDE(x) __has_include(x) + #endif + +#endif // ARX_TYPE_TRAITS_HAS_INCLUDE_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/has_libstdcplusplus.h b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/has_libstdcplusplus.h new file mode 100644 index 00000000..23f2b26c --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/has_libstdcplusplus.h @@ -0,0 +1,35 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H +#define ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H + +#if !defined(ARX_HAVE_LIBSTDCPLUSPLUS) + #if ARX_SYSTEM_HAS_INCLUDE() && !defined(ARDUINO_spresense_ast) + #include + #if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION) + // For gcc's libstdc++ and clang's libc++, assume that + // __cplusplus tells us what the standard includes support + #define ARX_HAVE_LIBSTDCPLUSPLUS __cplusplus + #elif defined(_CPPLIB_VER) + #if _CPPLIB_VER > 650 + #define ARX_HAVE_LIBSTDCPLUSPLUS 201703L // C++17 + #elif _CPPLIB_VER == 650 + #define ARX_HAVE_LIBSTDCPLUSPLUS 201402L // C++14 + #elif _CPPLIB_VER >= 610 + #define ARX_HAVE_LIBSTDCPLUSPLUS 201103L // C++11 + #else + #define ARX_HAVE_LIBSTDCPLUSPLUS 199711L // C++98 + #endif + #elif defined(__UCLIBCXX_MAJOR__) + // For uclibc++, assume C++98 support only. + #define ARX_HAVE_LIBSTDCPLUSPLUS 199711L + #else + #error "Unknown C++ library found, please report a bug against the ArxTypeTraits library about this." + #endif + #else + // Assume no standard library is available at all (e.g. on AVR) + #define ARX_HAVE_LIBSTDCPLUSPLUS 0 + #endif +#endif + +#endif // ARX_TYPE_TRAITS_HAS_LIBSTDCPLUSPLUS_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/initializer_list.h b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/initializer_list.h new file mode 100644 index 00000000..b1cd74f3 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/initializer_list.h @@ -0,0 +1,30 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_INITIALIZER_H +#define ARX_TYPE_TRAITS_INITIALIZER_H + +// Initializer_list *must* be defined in std, so take extra care to only +// define it when is really not available (e.g. +// ArduinoSTL is C++98 but *does* define ) and not +// already defined (e.g. by ArxContainer). +#if ARX_SYSTEM_HAS_INCLUDE() +#include +#else +namespace std { + template + class initializer_list + { + private: + const T* array; + size_t len; + initializer_list(const T* a, size_t l) : array(a), len(l) {} + public: + initializer_list() : array(nullptr), len(0) {} + size_t size() const { return len; } + const T *begin() const { return array; } + const T *end() const { return array + len; } + }; +} // namespace std +#endif + +#endif // ARX_TYPE_TRAITS_INITIALIZER_LIST_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/replace_minmax_macros.h b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/replace_minmax_macros.h new file mode 100644 index 00000000..f8ff86e5 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/replace_minmax_macros.h @@ -0,0 +1,35 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H +#define ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H + +// Make sure Arduino.h is actually included, since otherwise it might be +// included later and break *uses* of the min/max methods, rather than +// the declarations of it. +#ifdef ARDUINO + #include +#endif + +// These macros are defined by Arduino.h on some platforms, and conflict +// with min/max methods defined or included by ArxTypeTraits, so replace +// them with macros here. +#ifdef max + #undef max + template + constexpr auto max(T1 x, T2 y) + -> decltype(x + y) + { + return (x > y) ? x : y; + } +#endif +#ifdef min + #undef min + template + constexpr auto min(T1 x, T2 y) + -> decltype(x + y) + { + return (x < y) ? x : y; + } +#endif + +#endif // ARX_TYPE_TRAITS_REPLACE_MINMAX_MACROS_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/tuple.h b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/tuple.h new file mode 100644 index 00000000..2c13d953 --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/tuple.h @@ -0,0 +1,82 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_TUPLE_H +#define ARX_TYPE_TRAITS_TUPLE_H + +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11 + +#include + +#else // Do not have libstdc++11 + +namespace arx { namespace stdx { + + // https://theolizer.com/cpp-school2/cpp-school2-15/ + // https://wandbox.org/permlink/C0BWIzjqg4iO3kKZ + + template + struct tuple + { + tuple() {} + }; + + template + class tuple : public tuple + { + template friend struct get_helper; + tFirst mMember; + public: + tuple(tFirst const& iFirst, tRest const&... iRest) + : tuple(iRest...) + , mMember(iFirst) + { } + constexpr tuple() {} + }; + + template + struct get_helper { }; + template + struct get_helper<0, tFirst, tRest...> + { + typedef tFirst type; + static type& get(tuple& iTuple) + { + return iTuple.mMember; + } + }; + template + struct get_helper + { + typedef typename get_helper::type type; + static type& get(tuple& iTuple) + { + return get_helper::get(iTuple); + } + }; + + template + typename get_helper::type& get(tuple& iTuple) + { + return get_helper::get(iTuple); + } + + template class tuple_size; + template class tuple_size; + template class tuple_size; + template class tuple_size; + template + class tuple_size > + : public integral_constant {}; + + template + auto make_tuple(Types&&... args) + -> std::tuple::type...> + { + return std::tuple::type...>(std::forward::type>(args)...); + } + +} } // namespace arx::std + +#endif // Do not have libstdc++11 + +#endif // ARX_TYPE_TRAITS_TUPLE_H diff --git a/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/type_traits.h b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/type_traits.h new file mode 100644 index 00000000..ff41693a --- /dev/null +++ b/Sony9PinRemote/Sony9PinRemote/util/ArxTypeTraits/ArxTypeTraits/type_traits.h @@ -0,0 +1,638 @@ +#pragma once + +#ifndef ARX_TYPE_TRAITS_TYPE_TRAITS_H +#define ARX_TYPE_TRAITS_TYPE_TRAITS_H + +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 199711L // Have libstdc++98 + +#include + +#else // Do not have libstdc++98 + +namespace arx { namespace stdx { + + template + void swap(T& a, T& b) + { + T t = move(a); + a = move(b); + b = move(t); + } +} } // namespace arx::stdx + +#endif // Do not have libstdc++98 + + +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201103L // Have libstdc++11 + +#include +#include + +#else // Do not have libstdc++11 + +#include +#include +#include + +namespace arx { namespace stdx { + + using nullptr_t = decltype(nullptr); + + // numeric_limits + + template + struct numeric_limits + { + static constexpr T max() { return T(); } + static constexpr T min() { return T(); } + }; + template <> constexpr bool numeric_limits::max() { return true; } + template <> constexpr char numeric_limits::max() { return CHAR_MAX; } + template <> constexpr signed char numeric_limits::max() { return SCHAR_MAX; } + template <> constexpr unsigned char numeric_limits::max() { return UCHAR_MAX; } +#ifndef ARDUINO_spresense_ast + template <> constexpr wchar_t numeric_limits::max() { return WCHAR_MAX; } + // template <> constexpr char8_t numeric_limits::max() { return UCHAR_MAX; } +#endif + template <> constexpr char16_t numeric_limits::max() { return UINT_LEAST16_MAX; } + template <> constexpr char32_t numeric_limits::max() { return UINT_LEAST32_MAX; } + template <> constexpr short numeric_limits::max() { return SHRT_MAX; } + template <> constexpr unsigned short numeric_limits::max() { return USHRT_MAX; } + template <> constexpr int numeric_limits::max() { return INT_MAX; } + template <> constexpr unsigned int numeric_limits::max() { return UINT_MAX; } + template <> constexpr long numeric_limits::max() { return LONG_MAX; } + template <> constexpr unsigned long numeric_limits::max() { return ULONG_MAX; } + // template <> constexpr long long numeric_limits::max() { return LLONG_MAX; } + // template <> constexpr unsigned long long numeric_limits::max() { return ULLONG_MAX; } + template <> constexpr float numeric_limits::max() { return FLT_MAX; } + template <> constexpr double numeric_limits::max() { return DBL_MAX; } + template <> constexpr long double numeric_limits::max() { return LDBL_MAX; } + + template <> constexpr bool numeric_limits::min() { return false; } + template <> constexpr char numeric_limits::min() { return CHAR_MIN; } + template <> constexpr signed char numeric_limits::min() { return SCHAR_MIN; } + template <> constexpr unsigned char numeric_limits::min() { return 0; } +#ifndef ARDUINO_spresense_ast + template <> constexpr wchar_t numeric_limits::min() { return WCHAR_MIN; } + // template <> constexpr char8_t numeric_limits::min() { return 0; } +#endif + template <> constexpr char16_t numeric_limits::min() { return 0; } + template <> constexpr char32_t numeric_limits::min() { return 0; } + template <> constexpr short numeric_limits::min() { return SHRT_MIN; } + template <> constexpr unsigned short numeric_limits::min() { return 0; } + template <> constexpr int numeric_limits::min() { return INT_MIN; } + template <> constexpr unsigned int numeric_limits::min() { return 0; } + template <> constexpr long numeric_limits::min() { return LONG_MIN; } + template <> constexpr unsigned long numeric_limits::min() { return 0; } + // template <> constexpr long long numeric_limits::min() { return LLONG_MIN; } + // template <> constexpr unsigned long long numeric_limits::min() { return 0; } + template <> constexpr float numeric_limits::min() { return FLT_MIN; } + template <> constexpr double numeric_limits::min() { return DBL_MIN; } + template <> constexpr long double numeric_limits::min() { return LDBL_MIN; } + + + // integral_constant + + template + struct integral_constant + { + static constexpr T value = v; + using value_type = T; + using type = integral_constant; + constexpr operator value_type() const noexcept { return value; } + constexpr value_type operator()() const noexcept { return value; } + }; + + using true_type = integral_constant; + using false_type = integral_constant; + + + template + T declval(); // no implementation + + + template + struct enable_if; + template + struct enable_if { using type = T; }; + + + template + struct conditional { using type = T; }; + template + struct conditional { using type = F; }; + + + template struct remove_cv { using type = T; }; + template struct remove_cv { using type = T; }; + template struct remove_cv { using type = T; }; + template struct remove_cv { using type = T; }; + + template struct remove_const { using type = T; }; + template struct remove_const { using type = T; }; + + template struct remove_volatile { using type = T; }; + template struct remove_volatile { using type = T; }; + + template struct remove_pointer { using type = T; }; + template struct remove_pointer { using type = T; }; + template struct remove_pointer { using type = T; }; + template struct remove_pointer { using type = T; }; + template struct remove_pointer { using type = T; }; + + template struct remove_reference { using type = T; }; + template struct remove_reference { using type = T; }; + template struct remove_reference { using type = T; }; + + template struct remove_extent { typedef T type; }; + template struct remove_extent { typedef T type; }; + template struct remove_extent { typedef T type; }; + + + template + constexpr T&& forward(typename remove_reference::type& t) noexcept + { + return static_cast(t); + } + template + constexpr T&& forward(typename remove_reference::type&& t) noexcept + { + return static_cast(t); + } + + + namespace detail + { + template + struct type_identity { using type = T; }; + template + auto try_add_pointer(int) -> type_identity::type*>; + template + auto try_add_pointer(...) -> type_identity; + } + template + struct add_pointer : decltype(detail::try_add_pointer(0)) {}; + + + template + struct is_same : false_type {}; + template + struct is_same : true_type {}; + + + template + struct is_integral : false_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + template <> struct is_integral : true_type {}; + + + template + struct is_floating_point : false_type {}; + template <> struct is_floating_point : true_type {}; + template <> struct is_floating_point : true_type {}; + template <> struct is_floating_point : true_type {}; + + + template + struct is_arithmetic + : conditional< + is_integral::value || is_floating_point::value, + true_type, + false_type + >::type + {}; + + + namespace detail + { + template ::value> + struct is_signed : integral_constant {}; + template + struct is_signed : false_type {}; + } + template + struct is_signed : detail::is_signed::type {}; + + + namespace detail + { + template::value> + struct is_unsigned : integral_constant {}; + template + struct is_unsigned : false_type {}; + } + template + struct is_unsigned : detail::is_unsigned::type {}; + + + template struct is_pointer_helper : false_type {}; + template struct is_pointer_helper : true_type {}; + template struct is_pointer : is_pointer_helper::type> {}; + + + template + struct is_array : false_type {}; + template + struct is_array : true_type {}; + template + struct is_array : true_type {}; + + + namespace details + { + template + struct Tester { using type = void; }; + template + using void_t = typename Tester::type; + templateclass Z, class, class...Ts> + struct can_apply : false_type{}; + templateclass Z, class...Ts> + struct can_apply>, Ts...> : true_type{}; + + template + using try_convert = decltype(To{declval()}); + } + templateclass Z, class...Ts> + using can_apply = details::can_apply; + + template + struct is_convertible + : conditional < + can_apply ::value + , true_type + , typename conditional < + is_arithmetic::value && is_arithmetic::value, + true_type, + false_type + >::type + >::type + {}; + + template<> + struct is_convertible : true_type{}; + + + // primary template + template + struct is_function : false_type { }; + // specialization for regular functions + template + struct is_function : true_type {}; + // specialization for variadic functions such as printf + template + struct is_function : true_type {}; + // specialization for function types that have cv-qualifiers + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + // specialization for function types that have ref-qualifiers + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + template + struct is_function : true_type {}; + + + template + struct is_empty : public integral_constant { }; + + + template + class decay + { + typedef typename remove_reference::type U; + public: + typedef typename conditional< + is_array::value, + typename remove_extent::type*, + typename conditional< + is_function::value, + typename add_pointer::type, + typename remove_cv::type + >::type + >::type type; + }; + + + namespace details + { + template struct tag { using type=T; }; + template using type_t = typename Tag::type; + + template + using invoke_t = decltype( declval()(declval()...) ); + + template + struct result_of {}; + template + struct result_of>> + : tag > + {}; + } + template + using result_of = details::result_of; + +} } // namespace arx::stdx + +#endif // Do not have libstdc++11 + + +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201402L // Have libstdc++14 + +#else // Do not have libstdc++14 + +namespace arx { namespace stdx { + + // `move` must be declared before including `functional.h` + // C++14 constexpr version should be inside of C++14, + // but moved before `functional.h` + template + constexpr typename remove_reference::type&& move(T&& t) noexcept + { + return static_cast::type&&>(t); + } + +} } // namespace arx::stdx + +#endif // Do not have libstdc++14 + + +#include "initializer_list.h" +#include "tuple.h" +#include "functional.h" + +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201402L // Have libstdc++14 + // Nothing to include here, relevant header files were already included + // for C++11 above. +#else // Do not have libstdc++14 + +namespace arx { namespace stdx { + + template + using enable_if_t = typename enable_if::type; + + template + using decay_t = typename decay::type; + + template + using remove_cv_t = typename remove_cv::type; + template + using remove_const_t = typename remove_const::type; + template + using remove_volatile_t = typename remove_volatile::type; + template + using remove_reference_t = typename remove_reference::type; + template + using remove_pointer_t = typename remove_pointer::type; + + template + struct integer_sequence + { + using type = integer_sequence; + using value_type = T; + static constexpr size_t size() noexcept { return sizeof...(Ts); } + }; + template + using index_sequence = integer_sequence; + + // https://stackoverflow.com/questions/17424477/implementation-c14-make-integer-sequence + + template + struct concat_impl; + template + using concat = typename concat_impl::type; + + template + struct concat_impl , index_sequence> + : index_sequence {}; + template + struct make_index_sequence_impl; + template + using make_index_sequence = typename make_index_sequence_impl::type; + template + struct make_index_sequence_impl + : concat, make_index_sequence > {}; + template<> + struct make_index_sequence_impl <0> : index_sequence<>{}; + template<> + struct make_index_sequence_impl <1> : index_sequence<0>{}; + + template + using index_sequence_for = make_index_sequence; + +} } // namespace arx::stdx + +#endif // Do not have libstdc++14 + + +#if ARX_HAVE_LIBSTDCPLUSPLUS >= 201703L // Have libstdc++17 + // Nothing to include here, relevant header files were already included + // for C++11 above. +#else // Do not have libstdc++17 + +namespace arx { namespace stdx { + + template + struct Tester { using type = void; }; + template + using void_t = typename Tester::type; + + template + struct disjunction : false_type {}; + template + struct disjunction : Arg::type {}; + template + struct disjunction : conditional>::type {}; + + template + struct conjunction : true_type {}; + template + struct conjunction : Arg::type {}; + template + struct conjunction : conditional, Arg>::type {}; + + template + struct negation : integral_constant {}; + + // https://qiita.com/_EnumHack/items/92e6e135174f1f781dbb + // without decltype(auto) + + template + constexpr auto apply_impl(F&& f, Tuple&& t, index_sequence) + -> decltype(f(get(forward(t))...)) + { + return f(get(forward(t))...); + } + template + constexpr auto apply(F&& f, Tuple&& t) + -> decltype(apply_impl( + forward(f), + forward(t), + make_index_sequence>::value>{} + )) + { + return apply_impl( + forward(f), + forward(t), + make_index_sequence>::value>() + ); + } + +} } // namespace arx::stdx + +#endif // Do not have libstdc++17 + + +#if ARX_HAVE_LIBSTDCPLUSPLUS > 201703L // Have libstdc++2a + // Nothing to include here, relevant header files were already included + // for C++11 above. +#else // Do not have libstdc++2a + +namespace arx { namespace stdx { + + template + struct remove_cvref + { + typedef remove_cv_t> type; + }; + + template< class T > + using remove_cvref_t = typename remove_cvref::type; + +} } // namespace arx::stdx +#endif // Do not have libstdc++2a + + +namespace arx { // others + + template class Check, class... T> + struct is_detected_impl : std::false_type {}; + template