try ppa tar

This commit is contained in:
Ward Nakchbandi 2023-03-08 17:17:36 +03:00
parent 45f52913ac
commit 16147058f9
196 changed files with 6 additions and 104452 deletions

View File

@ -1,181 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA boards.
//
////////////////////////////////////////////////////////////
//
// Filename: driverdbg.h
// Purpose: Macros used for debugging the ntv2driver.
// Notes:
//
///////////////////////////////////////////////////////////////
#define MSG(string, args...) printk(KERN_ALERT string , ##args)
#define SHOW_DMA_CTL_STRUCT(p) \
do { \
MSG("DMAControl Struct %p\n" \
"\tframeNumber\t%d\n" \
"\tframeBuffer\t%p\n" \
"\tframeOffsetSrc\t%d\n" \
"\tframeOffsetDest\t%d\n" \
"\tnumBytes\t%d\n" \
"\tdownSample\t%d\n" \
"\tlinePitch\t%d\n" \
"\tpoll\t%d\n", \
&p, \
p.frameNumber, p.frameBuffer, p.frameOffsetSrc, p.frameOffsetDest, \
p.numBytes, p.downSample, p.linePitch, p.poll ); \
} while (0)
#define SHOW_AUTOCIRCULATE_DATA_STRUCT(p) \
do { \
MSG("AutoCirculateData Struct %p\n" \
"\tcommand\t%d\n" \
"\tchannelSpec\t%d\n" \
"\tlVal1\t%ld\n" \
"\tlVal2\t%ld\n" \
"\tbVal1\t%d\n" \
"\tbVal2\t%d\n" \
"\tpvVal1\t%p\n" \
"\tpvVal2\t%p\n" \
&p, \
p.eCommand, p.channelSpec, p.lVal1, p.lVal2, \
p.bVal1, p.bVal2, p.pvVal1, p.pvVal2 ); \
} while (0)
#define SHOW_INTERNAL_AUTOCIRCULATE_STRUCT(p) \
do { \
MSG("Internal AutoCirculate Struct 0x%p\n" \
"\tstate\t%d\n" \
"\tchannelSpec\t%d\n" \
"\trecording\t%ld\n" \
"\tcurrentFrame\t%ld\n" \
"\tstartFrame\t%ld\n" \
"\tendFrame\t%ld\n" \
"\tactiveFrame\t%ld\n" \
"\tactiveFrameRegister\t%ld\n" \
"\tcirculateWithAudio\t%d\n" \
"\tcirculateWithRP188\t%d\n" \
"\tcirculateWithColorCorrection\t%d\n" \
"\tcirculateWithVidProc\t%d\n" \
"\tcirculateWithCustomAncData\t%d\n" \
"\tenableFbfChange\t%d\n" \
"\tenableFboChange\t%d\n" \
"\tstartTimeStamp\t0x%llx\n" \
"\tstartAudioClockTimeStamp\t0x%llx\n" \
"\tframesProcessed\t%ld\n" \
"\tdroppedFrames\t%ld\n" \
"\tPlus some frameStampStuff\n", \
p, \
p->state, \
p->channelSpec, \
(long)p->recording, \
(long)p->currentFrame, \
(long)p->startFrame, \
(long)p->endFrame, \
(long)p->activeFrame, \
(long)p->activeFrameRegister, \
(int)p->circulateWithAudio, \
(int)p->circulateWithRP188, \
(int)p->circulateWithColorCorrection, \
(int)p->circulateWithVidProc, \
(int)p->circulateWithCustomAncData, \
(int)p->enableFbfChange, \
(int)p->enableFboChange, \
p->startTimeStamp, \
p->startAudioClockTimeStamp, \
(long)p->framesProcessed, \
(long)p->droppedFrames \
); \
} while (0)
#define SHOW_FRAME_STAMP_STRUCT(p) \
do { \
MSG("FRAME_STAMP_STRUCT\t%p\n" \
"\tchannelSpec\t\t%d\n" \
"\tframeTime\t\t%lld\n" \
"\tframe\t\t\t%ld\n" \
"\taudioClockTimeStamp\t%lld\n" \
"\taudioExpectedAddress\t%ld\n" \
"\taudioInStartAddress\t%ld\n" \
"\taudioInStopAddress\t%ld\n" \
"\taudioOutStopAddress\t%ld\n" \
"\taudioOutStartAddress\t%ld\n" \
"\tbytesRead\t\t%ld\n" \
"\tstartSample\t\t%ld\n" \
"\t------------------\t\n" \
"\tcurrentTime\t\t\t%lld\n" \
"\tcurrentFrame\t\t\t%ld\n" \
"\tRP188 Data unavailable\n" \
"\tcurrentFrameTime\t\t%lld\n" \
"\taudioClockCurrentTime\t\t%lld\n" \
"\tcurrentAudioExpectedAddress\t%ld\n" \
"\tcurrentAudioStartAddress\t%ld\n" \
"\tcurrentFieldCount\t\t%ld\n" \
"\tcurrentLineCount\t\t%ld\n" \
"\tcurrentReps\t\t\t%ld\n" \
"\tcurrenthUser\t\t\t%ld\n", \
p, \
p->channelSpec, p->frameTime, (long)p->frame, \
p->audioClockTimeStamp, (long)p->audioExpectedAddress, \
(long)p->audioInStartAddress, (long)p->audioInStopAddress, \
(long)p->audioOutStopAddress, (long)p->audioOutStartAddress, \
(long)p->bytesRead, (long)p->startSample, \
\
p->currentTime, (long)p->currentFrame, p->currentFrameTime, \
p->audioClockCurrentTime, (long)p->currentAudioExpectedAddress, \
(long)p->currentAudioStartAddress, \
(long)p->currentFieldCount, (long)p->currentLineCount,\
(long)p->currentReps, (long)p->currenthUser\
); \
} while (0)
#define SHOW_INTERNAL_FRAME_STAMP_STRUCT(p) \
do { \
MSG("INTERNAL_FRAME_STAMP_STRUCT\t%p\n" \
"\tframeTime\t\t%lld\n" \
"\taudioClockTimeStamp\t%lld\n" \
"\taudioExpectedAddress\t%ld\n" \
"\taudioInStartAddress\t%ld\n" \
"\taudioInStopAddress\t%ld\n" \
"\taudioOutStopAddress\t%ld\n" \
"\taudioOutStartAddress\t%ld\n" \
"\tbytesRead\t\t%ld\n" \
"\tstartSample\t\t%ld\n" \
"\t------------------\t\n" \
"\tRP188 Data unavailable\n" \
"\tvalidCount\t\t%ld\n" \
"\trepeatCount\t\t%ld\n" \
"\thUser\t\t\t%ld\n", \
p, \
p->frameTime, \
p->audioClockTimeStamp, (long)p->audioExpectedAddress, \
(long)p->audioInStartAddress, (long)p->audioInStopAddress, \
(long)p->audioOutStopAddress, (long)p->audioOutStartAddress, \
(long)p->bytesRead, (long)p->startSample, \
\
(long)p->validCount, (long)p->repeatCount,\
(long)p->hUser\
); \
} while (0)
#define SHOW_DMA_IOCTL(s) \
{ \
MSG("Received " #s " for boardNumber %d\n", boardNumber); \
SHOW_DMA_CTL_STRUCT(param); \
char *bufInfo = (param.frameBuffer) ? "User mode buffer\n" : "Driver allocated buffer\n"; \
MSG("%s", bufInfo); \
}
#define SHOULD_SHOW_DMA_DEBUG_MESSAGE(frameNumber, audioFrameNumber) \
( \
(MsgsEnabled(NTV2_DRIVER_DMA_AUDIO_DEBUG_MESSAGES) && ((frameNumber) == (audioFrameNumber))) \
|| (MsgsEnabled(NTV2_DRIVER_DMA_VIDEO_DEBUG_MESSAGES) && ((frameNumber) != (audioFrameNumber))) \
)

View File

@ -1,80 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
// Backported from 2.6 kernel so we can do wait_event_interruptible_timeout().
#ifndef _NTV2_LINUX_WAIT_H
#define _NTV2_LINUX_WAIT_H
#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/list.h>
#include <linux/stddef.h>
#include <linux/spinlock.h>
#include <asm/system.h>
#define __wait_event_timeout(wq, condition, ret) \
do { \
wait_queue_t __wait; \
init_waitqueue_entry(&__wait, current); \
\
add_wait_queue(&wq, &__wait); \
for (;;) { \
set_current_state(TASK_UNINTERRUPTIBLE); \
if (condition) \
break; \
ret = schedule_timeout(ret); \
if (!ret) \
break; \
} \
current->state = TASK_RUNNING; \
remove_wait_queue(&wq, &__wait); \
} while (0)
#define wait_event_timeout(wq, condition, timeout) \
({ \
long __ret = timeout; \
if (!(condition)) \
__wait_event_timeout(wq, condition, __ret); \
__ret; \
})
#define __wait_event_interruptible_timeout(wq, condition, ret) \
do { \
wait_queue_t __wait; \
init_waitqueue_entry(&__wait, current); \
\
add_wait_queue(&wq, &__wait); \
for (;;) { \
set_current_state(TASK_INTERRUPTIBLE); \
if (condition) \
break; \
if (!signal_pending(current)) { \
ret = schedule_timeout(ret); \
if (!ret) \
break; \
continue; \
} \
ret = -ERESTARTSYS; \
break; \
} \
current->state = TASK_RUNNING; \
remove_wait_queue(&wq, &__wait); \
} while (0)
#define wait_event_interruptible_timeout(wq, condition, timeout) \
({ \
long __ret = timeout; \
if (!(condition)) \
__wait_event_interruptible_timeout(wq, condition, __ret); \
__ret; \
})
#endif /* __KERNEL__ */
#endif

View File

@ -1,338 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2dma.h
// Purpose: ntv2 driver dma engines
//
///////////////////////////////////////////////////////////////
#ifndef NTV2DMA_HEADER
#define NTV2DMA_HEADER
#ifdef AJA_RDMA
struct nvidia_p2p_page_table;
struct nvidia_p2p_dma_mapping;
#endif
#define DMA_NUM_ENGINES 4
#define DMA_NUM_CONTEXTS 2
#define DMA_TRANSFERCOUNT_64 0x10000000
#define DMA_TRANSFERCOUNT_TOHOST 0x80000000
#define DMA_TRANSFERCOUNT_BYTES 4
#define DMA_DESCRIPTOR_PAGES_MAX 1024
typedef enum _NTV2DmaMethod
{
DmaMethodIllegal,
DmaMethodAja,
DmaMethodNwl,
DmaMethodXlnx
} NTV2DmaMethod;
typedef enum _NTV2DmaState
{
DmaStateUnknown, // not configured
DmaStateConfigure, // configure engine
DmaStateIdle, // waiting for work
DmaStateSetup, // setup dma transfer
DmaStateTransfer, // dma transfer
DmaStateFinish, // finish dma
DmaStateRelease, // release resources
DmaStateDead // engine has failed
} NTV2DmaState;
// aja descriptors
typedef struct _dmaDescriptor32
{
ULWord ulHostAddress;
ULWord ulLocalAddress;
ULWord ulTransferCount;
ULWord ulNextAddress;
} DMA_DESCRIPTOR32, *PDMA_DESCRIPTOR32;
typedef struct _dmaDescriptor64
{
ULWord ulHostAddressLow;
ULWord ulLocalAddress;
ULWord ulTransferCount;
ULWord ulNextAddressLow;
ULWord ulHostAddressHigh;
ULWord ulNextAddressHigh;
ULWord ulReserved0;
ULWord ulReserved1;
} DMA_DESCRIPTOR64, *PDMA_DESCRIPTOR64;
// nwl dma descriptor
typedef struct _nwlDmaDescriptor
{
ULWord ulControl; // descriptor processing/interrupt control
ULWord ulTransferCount; // number of bytes to transfer
ULWord64 llHostAddress; // system address
ULWord64 llLocalAddress; // card address
ULWord64 llNextAddress; // next descriptor address (0 = last)
} NWL_DESCRIPTOR, *PNWL_DESCRIPTOR;
// xilinx descriptor
typedef struct _xlnxDmaDescriptor
{
ULWord ulControl; // descriptor processing/interrupt control
ULWord ulTransferCount; // transfer length in bytes
ULWord64 llSrcAddress; // source address
ULWord64 llDstAddress; // destination address
ULWord64 llNextAddress; // next desc address
} XLNX_DESCRIPTOR, *PXLNX_DESCRIPTOR;
// dma page map
typedef struct _dmaPageRoot
{
struct list_head bufferHead; // locked buffer list
spinlock_t bufferLock; // lock buffer list
bool lockAuto; // automatically lock buffers
bool lockMap; // automatically map buffers
LWord64 lockCounter; // lock access counter
LWord64 lockTotalSize; // current locked bytes
LWord64 lockMaxSize; // maximum locked bytes
} DMA_PAGE_ROOT, *PDMA_PAGE_ROOT;
typedef struct _dmaPageBuffer
{
struct list_head bufferEntry; // locked buffer list
LWord refCount; // reference count
void* pUserAddress; // user buffer address
ULWord userSize; // user buffer size
ULWord direction; // dma direction
bool pageLock; // pages are locked
bool busMap; // bus is mapped (p2p)
bool sgMap; // segment mapped
bool sgHost; // segment map synced to host
ULWord numPages; // pages locked
struct page** pPageList; // page lock list
ULWord pageListSize; // page list allocation
ULWord numSgs; // pages mapped
struct scatterlist* pSgList; // scatter gather list
ULWord sgListSize; // scatter list allocation
LWord64 lockCount; // lock access count
LWord64 lockSize; // locked bytes
bool rdma; // use nvidia rdma
#ifdef AJA_RDMA
ULWord64 rdmaAddress; // rdma gpu aligned buffer address
ULWord64 rdmaOffset; // rdma gpu aligned offset
ULWord64 rdmaLen; // rdma buffer length
ULWord64 rdmaAlignedLen; // rdma gpu aligned buffer length
struct nvidia_p2p_page_table* rdmaPage;
struct nvidia_p2p_dma_mapping* rdmaMap;
#endif
} DMA_PAGE_BUFFER, *PDMA_PAGE_BUFFER;
// dma transfer parameters
typedef struct _dmaParams
{
ULWord deviceNumber; // device number
PDMA_PAGE_ROOT pPageRoot; // dma locked page cache
bool toHost; // transfer to host
NTV2DMAEngine dmaEngine; // dma engine
NTV2Channel videoChannel; // video channel for frame size
PVOID pVidUserVa; // user video buffer
ULWord64 videoBusAddress; // p2p video bus address
ULWord videoBusSize; // p2p video bus size
ULWord64 messageBusAddress; // p2p message bus address
ULWord messageData; // p2p message data
ULWord videoFrame; // card video frame
ULWord vidNumBytes; // number of bytes per segment
ULWord frameOffset; // card video offset
ULWord vidUserPitch; // user buffer pitch
ULWord vidFramePitch; // card frame pitch
ULWord numSegments; // number of segments
PVOID pAudUserVa; // audio user buffer
NTV2AudioSystem audioSystem; // audio system target
ULWord audNumBytes; // number of audio bytes
ULWord audOffset; // card audio offset
PVOID pAncF1UserVa; // anc field 1 user buffer
ULWord ancF1Frame; // anc field 1 frame
ULWord ancF1NumBytes; // number of anc field 1 bytes
ULWord ancF1Offset; // anc field 1 frame offset
PVOID pAncF2UserVa; // anc field 2 user buffer
ULWord ancF2Frame; // anc field 2 frame
ULWord ancF2NumBytes; // number of anc field 2 bytes
ULWord ancF2Offset; // anc field 2 frame offset
ULWord audioSystemCount; // number of multi-link audio systems
} DMA_PARAMS, *PDMA_PARAMS;
// video scatter list to descriptor map
typedef struct _dmaVideoSegment
{
ULWord cardAddress; // card address
ULWord cardSize; // card total transfer size
ULWord cardPitch; // card segment pitch
ULWord systemPitch; // system segment pitch
ULWord segmentSize; // segment size
ULWord segmentCount; // segment count
bool invertImage; // invert segments
ULWord64 transferAddress; // scatter transfer address
ULWord transferSize; // scatter transfer size
ULWord systemOffset; // system bytes transferred
ULWord segmentIndex; // segment transfer index
} DMA_VIDEO_SEGMENT, *PDMA_VIDEO_SEGMENT;
// audio scatter list to descriptor map
#define MAX_NUM_AUDIO_LINKS 4
typedef struct _dmaAudioSegment
{
//ULWord engIndex;
ULWord systemSize; // dma system buffer size
ULWord transferSize; // audio transfer size
ULWord ringAddress[MAX_NUM_AUDIO_LINKS]; // ring buffer address
ULWord ringCount; // number of rings
ULWord ringSize; // ring buffer size
ULWord64 pageAddress; // page address
ULWord pageSize; // page size
ULWord audioStart; // audio transfer start offset
ULWord audioSize; // audio size
ULWord ringIndex; // transfer ring index
ULWord systemOffset; // system transfer bytes
ULWord pageOffset; // page transfer bytes
ULWord audioOffset; // audio transfer bytes
} DMA_AUDIO_SEGMENT, *PDMA_AUDIO_SEGMENT;
// anc scatter list to descriptor map
typedef struct _dmaAncSegment
{
ULWord ancAddress; // anc buffer address
ULWord ancSize; // anc buffer size
ULWord64 transferAddress; // scatter transfer address
ULWord transferSize; // scatter transfer size
ULWord systemOffset; // system bytes transferred
ULWord transferOffset; // scatter bytes transferred
} DMA_ANC_SEGMENT, *PDMA_ANC_SEGMENT;
// dma transfer context
typedef struct _dmaContext_
{
ULWord deviceNumber; // device number
ULWord engIndex; // engine index
char* engName; // engine name string
ULWord conIndex; // context index
ULWord dmaIndex; // dma index
bool dmaC2H; // dma to host
bool conInit; // context initialized
bool inUse; // context acquired
bool doVideo; // dma video buffer (transfer data)
bool doAudio; // dma audio buffer (transfer data)
bool doAncF1; // dma ancillary field 1 buffer (transfer data)
bool doAncF2; // dma ancillary field 2 buffer (transfer data)
bool doMessage; // dma gma message (transfer data)
PDMA_PAGE_BUFFER pVideoPageBuffer; // video page buffer
PDMA_PAGE_BUFFER pAudioPageBuffer; // audio page buffer
PDMA_PAGE_BUFFER pAncF1PageBuffer; // anc field 1 page buffer
PDMA_PAGE_BUFFER pAncF2PageBuffer; // anc field 2 page buffer
DMA_PAGE_BUFFER videoPageBuffer; // default video page buffer
DMA_PAGE_BUFFER audioPageBuffer; // default audio page buffer
DMA_PAGE_BUFFER ancF1PageBuffer; // default anc field 1 page buffer
DMA_PAGE_BUFFER ancF2PageBuffer; // default anc field 2 page buffer
DMA_VIDEO_SEGMENT dmaVideoSegment; // video segment data (transfer data)
DMA_AUDIO_SEGMENT dmaAudioSegment; // audio segment data (transfer data)
DMA_ANC_SEGMENT dmaAncF1Segment; // ancillary field 1 segment data (transfer data)
DMA_ANC_SEGMENT dmaAncF2Segment; // ancillary field 2 segment data (transfer data)
ULWord64 messageBusAddress; // gma message bus target address
ULWord messageCardAddress; // gma message frame buffer source address
} DMA_CONTEXT, *PDMA_CONTEXT;
// dma engine parameters
typedef struct _dmaEngine_
{
ULWord deviceNumber; // device number
ULWord engIndex; // engine index
char* engName; // engine name string
bool engInit; // engine initialized
bool dmaEnable; // transfer enable
NTV2DmaMethod dmaMethod; // dma method
ULWord dmaIndex; // dma index
bool dmaC2H; // dma to host
ULWord maxVideoSize; // maximum video transfer size
ULWord maxVideoPages; // maximum video pages
ULWord maxAudioSize; // maximum audio transfer size
ULWord maxAudioPages; // maximum audio pages
ULWord maxAncSize; // maximum anc transfer size
ULWord maxAncPages; // maximum anc pages
ULWord maxDescriptors; // maximum number of descriptors
bool transferP2P; // is p2p transfer;
NTV2DmaState state; // dma engine state
spinlock_t engineLock; // engine data structure lock
unsigned long engineFlags; // engine lock flags
struct semaphore contextSemaphore; // context traffic control
struct semaphore transferSemaphore; // hardware traffic control
wait_queue_head_t transferEvent; // dma transfer complete event
volatile unsigned long transferDone; // dma transfer done bit
DMA_CONTEXT dmaContext[DMA_NUM_CONTEXTS]; // dma transfer context
PVOID pDescriptorVirtual[DMA_DESCRIPTOR_PAGES_MAX]; // virtual descriptor aligned address
dma_addr_t descriptorPhysical[DMA_DESCRIPTOR_PAGES_MAX]; // physical descriptor aligned address
ULWord numDescriptorPages; // number of allocated descriptor pages
LWord64 programStartCount; // count program hardware dma starts
LWord64 programCompleteCount; // count program hardware dma completes
LWord64 programDescriptorCount; // count program hardware descriptors
LWord64 programErrorCount; // count program errors
LWord64 programBytes; // count program hardware bytes transferred
LWord64 programStartTime; // program transfer start time
LWord64 programStopTime; // program transfer stop time
LWord64 programTime; // sum program hardware transfer time
LWord64 interruptCount; // count dma interrupts
LWord64 scTransferCount; // count to card transfers
LWord64 scRdmaCount; // count gpu to card transfers
LWord64 scErrorCount; // count errors
LWord64 scDescriptorCount; // count descriptors
LWord64 scTransferBytes; // sum bytes transferred
LWord64 scTransferTime; // sum software transfer time
LWord64 scLockWaitTime; // sum page lock time
LWord64 scLockTime; // sum page lock time
LWord64 scDmaWaitTime; // sum wait for dma hardware time
LWord64 scDmaTime; // sum hardware dma time
LWord64 scUnlockTime; // sum page unlock time
LWord64 scHardTime; // sum hardware dma time
LWord64 scLastDisplayTime; // last stat display time
LWord64 csTransferCount; // count from card transfers
LWord64 csRdmaCount; // count card to gpu transfers
LWord64 csErrorCount;
LWord64 csDescriptorCount;
LWord64 csTransferBytes;
LWord64 csTransferTime;
LWord64 csLockWaitTime;
LWord64 csLockTime;
LWord64 csDmaWaitTime;
LWord64 csDmaTime;
LWord64 csUnlockTime;
LWord64 csHardTime;
LWord64 csLastDisplayTime;
} DMA_ENGINE, *PDMA_ENGINE;
int dmaInit(ULWord deviceNumber);
void dmaRelease(ULWord deviceNumber);
int dmaPageRootInit(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot);
void dmaPageRootRelease(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot);
int dmaPageRootAdd(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot,
PVOID pAddress, ULWord size, bool rdma, bool map);
int dmaPageRootRemove(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot,
PVOID pAddress, ULWord size);
int dmaPageRootPrune(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot, ULWord size);
void dmaPageRootAuto(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot,
bool lockAuto, bool lockMap, ULWord64 maxSize);
PDMA_PAGE_BUFFER dmaPageRootFind(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot,
PVOID pAddress, ULWord size);
void dmaPageRootFree(ULWord deviceNumber, PDMA_PAGE_ROOT pRoot, PDMA_PAGE_BUFFER pBuffer);
int dmaEnable(ULWord deviceNumber);
void dmaDisable(ULWord deviceNumber);
int dmaTransfer(PDMA_PARAMS pDmaParams);
int dmaTargetP2P(ULWord deviceNumber, NTV2_DMA_P2P_CONTROL_STRUCT* pParams);
void dmaInterrupt(ULWord deviceNumber, ULWord intStatus);
#endif

View File

@ -1,104 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA OEM boards.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2driver.h
// Purpose: Main headerfile for driver.
// Notes: PCI Device IDs, memory sizes, fops prototypes
//
///////////////////////////////////////////////////////////////
#ifndef NTV2_DRIVER_HEADER
#define NTV2_DRIVER_HEADER
#include <linux/fs.h>
// Defines
#define NTV2_MAJOR 0
#define ntv2_spin_lock_irqsave(l, f) spin_lock_irqsave((l), (f))
#define ntv2_spin_unlock_irqrestore(l, f) spin_unlock_irqrestore((l), (f))
// the VendorID/DeviceID for the hardware
#define NTV2_VENDOR_ID 0xF1D0
#define NTV2_DEVICE_ID_CORVID1 0xDAFE
#define NTV2_DEVICE_ID_LHI 0xDAFF
#define NTV2_DEVICE_ID_IOEXPRESS 0xDB00
#define NTV2_DEVICE_ID_CORVID22 0xDB01
#define NTV2_DEVICE_ID_KONA3G 0xDB02
#define NTV2_DEVICE_ID_CORVID3G 0xDB03
#define NTV2_DEVICE_ID_KONA3G_QUAD 0xDB04
#define NTV2_DEVICE_ID_LHE_PLUS 0xDB05
#define NTV2_DEVICE_ID_IOXT 0xDB06
#define NTV2_DEVICE_ID_KONA3G_P2P 0xDB07
#define NTV2_DEVICE_ID_KONA3G_QUAD_P2P 0xDB08
#define NTV2_DEVICE_ID_CORVID24 0xDB09
#define NTV2_DEVICE_ID_TTAP 0xDB11
#define NTV2_DEVICE_ID_KONA4 0xEB0B
#define NTV2_DEVICE_ID_KONA4_UFC 0xEB0C
#define NTV2_DEVICE_ID_CORVID88 0xEB0D
#define NTV2_DEVICE_ID_CORVID44 0xEB0E
#define NTV2_DEVICE_ID_CORVIDHEVC_MB31 0xEB15
#define NTV2_DEVICE_ID_CORVIDHEVC_K7 0xEB16
#define NTV2_DEVICE_ID_CORVIDHDBT 0xEB18
#define NTV2_DEVICE_ID_CORVID446 0xEB19
#define NTV2_DEVICE_ID_KONAIP_CH1SFP 0xEB1A
#define NTV2_DEVICE_ID_KONAIP_PHANTOM 0xEB1B
#define NTV2_DEVICE_ID_KONAIP_CH2SFP 0xEB1C
#define NTV2_DEVICE_ID_IO4KPLUS 0xEB1D
#define NTV2_DEVICE_ID_IOIP 0xEB1E
#define NTV2_DEVICE_ID_KONA5 0xEB1F
#define NTV2_DEVICE_ID_KONA5IP 0xEB20
#define NTV2_DEVICE_ID_KONA1 0xEB23
#define NTV2_DEVICE_ID_KONAHDMI 0xEB24
#define NTV2_DEVICE_ID_CORVID44_12g 0xEB25
#define NTV2_DEVICE_ID_TTAPPRO 0xEB26
#define NTV2_DEVICE_ID_IOX3 0xEB27
#define PRIVATIZE(name) AJANTV2_ ## name
// The kernel has only one namespace, so make the NTV2Params global
// structure have a unique name per boardtype. Access function for
// this per-board data is provided also.
#define NTV2Params PRIVATIZE(NTV2Params)
#define NTV2ModuleParams PRIVATIZE(NTV2ModuleParams)
#define MapFrameBuffers PRIVATIZE(MapFrameBuffers)
#define NumDmaDriverBuffers PRIVATIZE(NumDmaDriverBuffers)
int init_module(void);
void cleanup_module(void);
loff_t ntv2_lseek(struct file *file, loff_t off, int whence);
ssize_t ntv2_read(struct file *file, char *buf, size_t count, loff_t *f_pos);
ssize_t ntv2_write(struct file *file, const char *buf, size_t count, loff_t *f_pos);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
long ntv2_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
#else
int ntv2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
#endif
int ntv2_mmap(struct file *file,struct vm_area_struct* vma);
int ntv2_open(struct inode *minode, struct file *mfile);
int ntv2_release(struct inode *minode, struct file *mfile);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
#define smp_mb__before_clear_bit smp_mb__before_atomic
#define smp_mb__after_clear_bit smp_mb__after_atomic
#endif
#endif // NTV2_DRIVER_HEADER
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* tab-width: 4
* End:
*/

View File

@ -1,278 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA OEM boards.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2driverautocirculate.h
// Purpose: Header file for autocirculate methods.
// Notes:
//
///////////////////////////////////////////////////////////////
#ifndef NTV2DRIVERAUTOCIRCULATE_H
#define NTV2DRIVERAUTOCIRCULATE_H
#include "ntv2dma.h"
#include "../ntv2kona.h"
//////////////////////////////////////////////////////////////////////////////////////
// Defines
//////////////////////////////////////////////////////////////////////////////////////
#define ILLEGAL_CHANNELSPEC(channelSpec) (((unsigned)channelSpec > (unsigned)NTV2CROSSPOINT_INPUT8) || (channelSpec == NTV2CROSSPOINT_MATTE) || (channelSpec == NTV2CROSSPOINT_FGKEY))
//#define NUM_CIRCULATE_FRAMES 128 // intended to exceed highest configuration number; KiPro currently uses 99 frame buffers
#define NUM_CIRCULATORS 18 // number of 'channels' which have auto-circulate capability
#define TIMECODE_ARRAY_SIZE 18
#define NTV2_INVALID_FRAME 0xFFFFFFFF
//////////////////////////////////////////////////////////////////////////////////////
// Typedefs
//////////////////////////////////////////////////////////////////////////////////////
typedef struct {
NTV2ColorCorrectionMode mode;
UWord saturationValue; /// only used in 3way color correction mode.
ULWord ccLookupTables[NTV2_COLORCORRECTOR_TABLESIZE/4]; /// R,G, and B lookup tables already formated for our hardware.
} INTERNAL_ColorCorrectionInfo;
typedef struct
{
//! Processor RDTSC at time of play or record.
LWord64 frameTime;
//! 48kHz clock in reg 28 extended to 64 bits
ULWord64 audioClockTimeStamp; // Register 28 with Wrap Logic
//! The address that was used to transfer
ULWord audioExpectedAddress;
//! For record - first position in buffer of audio (includes base offset)
ULWord audioInStartAddress; // AudioInAddress at the time this Frame was stamped.
//! For record - end position (exclusive) in buffer of audio (includes base offset)
ULWord audioInStopAddress; // AudioInAddress at the Frame AFTER this Frame was stamped.
//! For play - first position in buffer of audio
ULWord audioOutStopAddress; // AudioOutAddress at the time this Frame was stamped.
//! For play - end position (exclusive) in buffer of audio
ULWord audioOutStartAddress; // AudioOutAddress at the Frame AFTER this Frame was stamped.
ULWord audioPreWrapBytes; // For DMA Transfer
ULWord audioPostWrapBytes;
//! Total audio and video bytes transfered
ULWord bytesRead;
/** The actaul start sample when this frame was started in VBI
* This may be used to check sync against audioInStartAddress (Play) or
* audioOutStartAddress (Record). In record it will always be equal, but
* in playback if the clocks drift or the user supplies non aligned
* audio sizes, then this will give the current difference from expected
* vs actual position. To be useful, play audio must be clocked in at
* the correct rate.
*/
ULWord startSample;
//! Associated timecode (RP-188)
RP188_STRUCT rp188;
//! Valid counts from n..0 in the isr. Set to n when valid
LWord validCount; // Used to throttle record and playback, See AutoCirculate Method in driver
//! Repeat is set to n at beginning of DMA. Moved to repeat on completion.
LWord repeatCount; // Used to throttle record and playback, See AutoCirculate Method in driver
//! Opaque user variable
ULWord64 hUser; // A user cookie returned by frame stamp
NTV2FrameBufferFormat frameBufferFormat;
NTV2VideoFrameBufferOrientation frameBufferOrientation;
INTERNAL_ColorCorrectionInfo colorCorrectionInfo;
AutoCircVidProcInfo vidProcInfo;
NTV2RoutingTable ntv2RoutingTable;
AUTOCIRCULATE_TASK_STRUCT taskInfo;
AutoCircGenericTask taskArray[AUTOCIRCULATE_TASK_MAX_TASKS];
bool videoTransferPending;
INTERNAL_TIMECODE_STRUCT internalTCArray;
INTERNAL_SDI_STATUS_STRUCT internalSDIStatusArray;
ULWord frameFlags;
ULWord ancTransferSize;
ULWord ancField2TransferSize;
ULWord auxData[NTV2_HDMIAuxMaxFrames*NTV2_HDMIAuxDataSize/4];
ULWord auxDataSize;
} INTERNAL_FRAME_STAMP_STRUCT;
typedef struct
{
NTV2AutoCirculateState state;
NTV2Crosspoint channelSpec;
bool recording;
LWord currentFrame;
LWord startFrame;
LWord endFrame;
LWord activeFrame;
LWord activeFrameRegister;
bool circulateWithAudio;
bool circulateWithRP188;
bool circulateWithColorCorrection;
bool circulateWithVidProc;
bool circulateWithCustomAncData;
bool circulateWithHDMIAux;
bool circulateWithFields;
bool enableFbfChange;
bool enableFboChange;
LWord64 startTimeStamp;
ULWord64 startAudioClockTimeStamp;
ULWord framesProcessed;
ULWord droppedFrames;
ULWord nextFrame;
INTERNAL_FRAME_STAMP_STRUCT frameStamp[NTV2_MAX_FRAMEBUFFERS];
ULWord nextAudioOutputAddress;
ULWord transferFrame;
ULWord audioTransferOffset;
ULWord audioTransferSize;
ULWord audioStartSample;
ULWord audioDropsRequired;
ULWord audioDropsCompleted;
ULWord ancTransferOffset;
ULWord ancTransferSize;
ULWord ancField2TransferOffset;
ULWord ancField2TransferSize;
LWord64 lastInterruptTime;
LWord64 prevInterruptTime;
ULWord64 lastAudioClockTimeStamp;
LWord64 startTime;
bool circulateWithLTC;
AUTOCIRCULATE_TASK_STRUCT recordTaskInfo;
AutoCircGenericTask recordTaskArray[AUTOCIRCULATE_TASK_MAX_TASKS];
INTERNAL_TIMECODE_STRUCT timeCodeArray[TIMECODE_ARRAY_SIZE];
LWord timeCodeIndex;
LWord timeCodeDelay;
ULWord deviceNumber;
NTV2AudioSystem audioSystem;
LWord channelCount;
// Keep track of interrupt timing per channel
LWord64 VBIRDTSC;
LWord64 VBILastRDTSC;
ULWord VBIAudioOut;
bool startAudioNextFrame;
bool stopAudioNextFrame;
ULWord audioSystemCount;
} INTERNAL_AUTOCIRCULATE_STRUCT;
//////////////////////////////////////////////////////////////////////////////////////
// Prototypes
//////////////////////////////////////////////////////////////////////////////////////
// Initialize all Auto Circulators -- done at driver load time.
int AutoCirculateInitialize(ULWord boardNumber);
int AutoCirculateControl(ULWord boardNumber, AUTOCIRCULATE_DATA *acData);
int AutoCirculateStatus(ULWord boardNumber, AUTOCIRCULATE_STATUS_STRUCT *acStatus);
int AutoCirculateStatus_Ex(ULWord boardNumber, AUTOCIRCULATE_STATUS *acStatus);
int AutoCirculateFrameStamp(ULWord boardNumber, AUTOCIRCULATE_FRAME_STAMP_COMBO_STRUCT *frameStampCombo);
int AutoCirculateCaptureTask(ULWord boardNumber, AUTOCIRCULATE_FRAME_STAMP_COMBO_STRUCT *pFrameStampCombo);
int AutoCirculateTransfer(ULWord boardNumber, AUTOCIRCULATE_TRANSFER_COMBO_STRUCT *acXferCombo);
int AutoCirculateTransfer_Ex(ULWord boardNumber, PDMA_PAGE_ROOT pPageRoot, AUTOCIRCULATE_TRANSFER *acXferCombo);
//
// Workhorse functions
//
int OemAutoCirculateInit ( ULWord boardNumber,
NTV2Crosspoint channelSpec,
LWord lStartFrameNum,
LWord lEndFrameNum,
NTV2AudioSystem audioSystem,
LWord lChanelCount,
bool bWithAudio,
bool bWithRP188,
bool bFbfChange,
bool bFboChange,
bool bWithColorCorrection,
bool bWithVidProc,
bool bWithCustomAncData,
bool bWithLTC,
bool bWithFields,
bool bWithHDMIAux,
bool bWithASPlus1,
bool bWithASPlus2,
bool bWithASPlus3
);
ULWord GetAudioFrameBufferNumber(ULWord boardNumber, ULWord boardID, NTV2AudioSystem audioSystem);
ULWord GetAudioTransferInfo(ULWord boardNumber, NTV2AudioSystem audioSystem, ULWord currentOffset,ULWord numBytesToTransfer,ULWord* preWrapBytes,ULWord* postWrapBytes);
ULWord GetAudioSamplesPerFrame(ULWord boardNumber, NTV2AudioSystem audioSystem, ULWord cadenceFrame, ULWord granularity, bool fieldMode);
ULWord GetAudioReadOffset(ULWord boardNumber, NTV2AudioSystem audioSystem);
NTV2AudioRate GetAudioRate(ULWord boardNumber, NTV2AudioSystem audioSystem);
ULWord GetAudioSamplesPerSecond(ULWord boardNumber, NTV2AudioSystem audioSystem);
ULWord GetAudioWrapAddress(ULWord boardNumber, NTV2AudioSystem audioSystem);
NTV2AudioBufferSize GetAudioBufferSize(ULWord boardNumber, NTV2AudioSystem audioSystem);
ULWord GetAudioLastIn(ULWord boardNumber, NTV2AudioSystem audioSystem);
ULWord GetAudioLastOut(ULWord boardNumber, NTV2AudioSystem audioSystem);
int OemAutoCirculateMessage(ULWord boardNumber, NTV2Crosspoint channelSpec, ULWord frameNumber);
void oemAutoCirculateTransferFields(ULWord deviceNumber,
INTERNAL_AUTOCIRCULATE_STRUCT* pAuto,
DMA_PARAMS* pDmaParams,
ULWord frameNumber, bool drop);
ULWord Get2MFrameSize(ULWord boardNumber, NTV2Channel channel);
bool BoardIs2MCompatible(ULWord boardNumber);
void OemAutoCirculate(ULWord boardNumber, NTV2Crosspoint channelSpec);
int OemAutoCirculateStart (ULWord boardNumber, NTV2Crosspoint channelSpec, ULWord64 startTime);
int OemAutoCirculateStop (ULWord boardNumber, NTV2Crosspoint channelSpec);
int OemAutoCirculateAbort (ULWord boardNumber, NTV2Crosspoint channelSpec);
int OemAutoCirculatePause (ULWord boardNumber, NTV2Crosspoint channelSpec, bool bPlay, bool bClearDF);
int OemAutoCirculateFlush (ULWord boardNumber, NTV2Crosspoint channelSpec, bool bClearDF);
int OemAutoCirculatePreroll (ULWord boardNumber, NTV2Crosspoint channelSpec, LWord lPrerollFrames);
void OemAutoCirculateReset (ULWord boardNumber, NTV2Crosspoint channelSpec);
LWord OemAutoCirculateFindNextAvailFrame(INTERNAL_AUTOCIRCULATE_STRUCT* pAuto);
void SetAudioPlaybackMode(ULWord boardNumber, NTV2_GlobalAudioPlaybackMode mode);
NTV2_GlobalAudioPlaybackMode GetAudioPlaybackMode(ULWord boardNumber);
ULWord GetNumFrameBuffers(ULWord boardNumber, ULWord boardID);
void OemAutoCirculateSetupNTV2Routing(ULWord boardNumber, NTV2RoutingTable* pNTV2RoutingTable);
void oemAutoCirculateWriteHDMIAux(ULWord deviceNumber, ULWord* pAuxData, ULWord auxDataSize);
NTV2VideoFormat GetNTV2VideoFormat(UByte status, UByte frameRateHiBit);
ULWord DownloadLinearLUTToHW (ULWord boardNumber, NTV2Channel channel, int bank);
ULWord64 GetAudioClock(ULWord boardNumber);
void CopyFrameStampOldToNew(const FRAME_STAMP_STRUCT * pInOldStruct, FRAME_STAMP * pOutNewStruct);
int AutoCirculateFrameStampImmediate(ULWord deviceNumber, FRAME_STAMP * pInOutFrameStamp, NTV2_RP188 * pOutTimecodeArray);
bool oemAutoCirculateCanDoFieldMode(ULWord deviceNumber, NTV2Crosspoint channelSpec);
#endif // NTV2DRIVERAUTOCIRCULATE_H

View File

@ -1,24 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA boards.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2driverbigphysarea.h
// Purpose: Header file to enable support for optional BIGPHYSAREA kernel patch.
//
///////////////////////////////////////////////////////////////
#ifndef NTV2DRIVERBIGPHYSAREA_HEADER
#define NTV2DRIVERBIGPHYSAREA_HEADER
// Define this only if you've installed the bigphysarea patch
// If not, comment out only this single line:
//#define USE_BIGPHYSAREA
#endif

View File

@ -1,27 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA boards.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2driverdbgmsgctl.c
// Purpose: Header file for dynamic debug message control
// Notes:
//
///////////////////////////////////////////////////////////////
#ifndef NTV2DRIVERDEBUGMSGCTL_H
#define NTV2DRIVERDEBUGMSGCTL_H
bool MsgsEnabled(NTV2_DriverDebugMessageSet msgSet);
int ControlDebugMessages( NTV2_DriverDebugMessageSet msgSet,
bool enable);
void ShowDebugMessageControl(NTV2_DriverDebugMessageSet msgSet);
#endif

View File

@ -1,29 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA devices.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2driverstatus.h
// Purpose: Header file for getting versions
// Notes: Origin: ntv2status.cpp. Doesn't have all functions
// from that file.
//
///////////////////////////////////////////////////////////////
#ifndef NTV2DRIVERSTATUS_HEADER
#define NTV2DRIVERSTATUS_HEADER
void getDeviceVersionString(ULWord deviceNumber, char *deviceVersionString, ULWord strMax);
void getPCIFPGAVersionString(ULWord deviceNumber, char *pcifpgaVersionString, ULWord strMax);
NTV2DeviceID getDeviceID(ULWord deviceNumber);
void getDeviceIDString(ULWord deviceNumber, char *deviceIDString, ULWord strMax);
void getDriverVersionString(char *driverVersionString, ULWord strMax);
void getDeviceSerialNumberString(ULWord deviceNumber, char *deviceIDString, ULWord strMax);
#endif

View File

@ -1,28 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA OEM boards.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2drivertask.h
// Purpose: Header file for autocirculate methods.
// Notes:
//
///////////////////////////////////////////////////////////////
#ifndef NTV2DRIVERTASK_H
#define NTV2DRIVERTASK_H
bool InitTaskArray(AutoCircGenericTask* pTaskArray, ULWord numTasks);
ULWord CopyTaskArray(AutoCircGenericTask* pDstArray, ULWord dstSize, ULWord dstMax,
const AutoCircGenericTask* pSrcArray, ULWord srcSize, ULWord srcNum);
//bool DoTaskArray(INTERNAL_AUTOCIRCULATE_STRUCT* pAuto, AutoCircGenericTask* pTaskArray, ULWord numTasks);
#endif // NTV2DRIVERTASK_H

View File

@ -1,31 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA devices.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2kona2.h
// Purpose: Header Kona2 specific functions.
//
///////////////////////////////////////////////////////////////
#ifndef NTV2KONA2_HEADER
#define NTV2KONA2_HEADER
#include "../ntv2system.h"
bool GetConverterOutFormat(ULWord deviceNumber, NTV2VideoFormat* format);
NTV2VideoFormat GetDeviceVideoFormat(ULWord deviceNumber, NTV2Channel channel);
uint32_t ntv2ReadRegCon32(Ntv2SystemContext* context, uint32_t regNum);
bool ntv2ReadRegMSCon32(Ntv2SystemContext* context, uint32_t regNum, uint32_t* regValue, RegisterMask mask, RegisterShift shift);
bool ntv2WriteRegCon32(Ntv2SystemContext* context, uint32_t regNum, uint32_t regValue);
bool ntv2WriteRegMSCon32(Ntv2SystemContext* context, uint32_t regNum, uint32_t regValue, RegisterMask mask, RegisterShift shift);
uint32_t ntv2ReadVirtRegCon32(Ntv2SystemContext* context, uint32_t regNum);
bool ntv2WriteVirtRegCon32(Ntv2SystemContext* context, uint32_t regNum, uint32_t data);
#endif

View File

@ -1,53 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA devices.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2serial.h
// Purpose: Serial port control header.
//
///////////////////////////////////////////////////////////////
#ifndef NTV2SERIAL_HEADER
#define NTV2SERIAL_HEADER
#include "ntv2system.h"
#define NTV2_TTY_NAME "ttyNTV"
struct ntv2_serial {
int index;
char name[80];
Ntv2SystemContext* system_context;
Ntv2Register uart_reg;
Ntv2Register route_reg;
u32 route_mask;
bool uart_enable;
spinlock_t state_lock;
struct uart_port uart_port;
bool busy;
};
struct ntv2_serial *ntv2_serial_open(Ntv2SystemContext* sys_con,
const char *name, int index);
void ntv2_serial_close(struct ntv2_serial *ntv2_ser);
int ntv2_serial_configure(struct ntv2_serial *ntv2_ser,
Ntv2Register uart_reg,
Ntv2Register route_reg,
u32 route_mask);
int ntv2_serial_enable(struct ntv2_serial *ntv2_ser);
int ntv2_serial_disable(struct ntv2_serial *ntv2_ser);
bool ntv2_serial_active(struct ntv2_serial *ntv2_ser);
int ntv2_serial_interrupt(struct ntv2_serial *ntv2_ser);
#endif

View File

@ -1,889 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA devices.
//
////////////////////////////////////////////////////////////
//
// Filename: registerio.h
// Purpose: Read/write real and virtual registers header file
// Notes:
//
///////////////////////////////////////////////////////////////
#ifndef REGISTERIO_H
#define REGISTERIO_H
#include <linux/wait.h>
//As of 2.6.26 semaphore is in include/linux
#include <linux/version.h>
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25))
# include <linux/semaphore.h>
#else
# include <asm/semaphore.h>
#endif
// Some kernel version sensitive macro-rama
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
#define NTV2_LINUX_IRQ_SHARED_FLAG IRQF_SHARED
#define NTV2_LINUX_IRQ_SAMPLE_RANDOM_FLAG IRQF_SAMPLE_RANDOM
#else
#define NTV2_LINUX_IRQ_SHARED_FLAG SA_SHIRQ
#define NTV2_LINUX_IRQ_SAMPLE_RANDOM_FLAG SA_SAMPLE_RANDOM
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
#define NTV2_LINUX_PCI_REG_DRIVER_FUNC(x) pci_register_driver(x)
#else
#define NTV2_LINUX_PCI_REG_DRIVER_FUNC(x) pci_module_init(x)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
# define NTV2_LINUX_SG_INIT_TABLE_FUNC(x,y) sg_init_table((x),(y))
#else
# define NTV2_LINUX_SG_INIT_TABLE_FUNC(x,y) memset((x),0,sizeof(struct scatterlist) * (y));
#endif
#include "ntv2driverautocirculate.h"
#include "../ntv2hdmiin.h"
#include "../ntv2hdmiin4.h"
#include "../ntv2kona.h"
#include "../ntv2setup.h"
// clean old stuff
#define FGVCROSSPOINTMASK (BIT_0+BIT_1+BIT_2+BIT_3)
#define FGVCROSSPOINTSHIFT (0)
#define BGVCROSSPOINTMASK (BIT_4+BIT_5+BIT_6+BIT_7)
#define BGVCROSSPOINTSHIFT (4)
#define FGKCROSSPOINTMASK (BIT_8+BIT_9+BIT_10+BIT_11)
#define FGKCROSSPOINTSHIFT (8)
#define BGKCROSSPOINTMASK (BIT_12+BIT_13+BIT_14+BIT_15)
#define BGKCROSSPOINTSHIFT (12)
#define VIDPROCMUX1MASK (BIT_0+BIT_1)
#define VIDPROCMUX1SHIFT (0)
#define VIDPROCMUX2MASK (BIT_2+BIT_3)
#define VIDPROCMUX2SHIFT (2)
#define VIDPROCMUX3MASK (BIT_4+BIT_5)
#define VIDPROCMUX3SHIFT (4)
#define VIDPROCMUX4MASK (BIT_6+BIT_7)
#define VIDPROCMUX4SHIFT (6)
#define VIDPROCMUX5MASK (BIT_8+BIT_9)
#define VIDPROCMUX5SHIFT (8)
// Comment out SOFTWARE_UART_FIFO define to turn off software FIFO completely.
//# define SOFTWARE_UART_FIFO
# ifdef SOFTWARE_UART_FIFO
// Comment out either UARTRXFIFOSIZE or UARTTXFIFOSIZE to disable
// Rx or Tx software FIFO.
# define UARTRXFIFOSIZE 20
# define UARTTXFIFOSIZE 20
# endif // SOFTWARE_UART_FIFO
//#define FPGA_REQ_FOR_DMA (eFPGAVideoProc)
//#define NTV2_MAX_FPGA (eFPGAVideoProc)
#define NTV2_MAX_HDMI_MONITOR 4
// Singleton module params
typedef struct ntv2_module_private
{
int NTV2Major;
UWord numNTV2Devices;
char * name;
char * driverName;
ULWord intrBitLut[eNumInterruptTypes];
struct class *class;
// uart driver
struct uart_driver *uart_driver;
u32 uart_max;
atomic_t uart_index;
} NTV2ModulePrivateParams;
typedef enum
{
eIrqFpga = 0,
eNumNTV2IRQDevices
} ntv2_irq_device_t;
// Define interrupt control, dma, and flash register bits
enum
{
kIntOutputVBLEnable = BIT (0),
kIntInput1VBLEnable = BIT (1),
kIntInput2VBLEnable = BIT (2),
kIntAudioWrapEnable = BIT (3),
kIntAudioOutWrapEnable = BIT (4),
kIntAudioInWrapEnable = BIT (5),
kIntAuxVerticalEnable = BIT (11),
// Status register
kIntOutput1VBLActive = BIT (31),
kIntOutput1VBLClear = BIT (31),
kIntInput1VBLActive = BIT (30),
kintInput1VBLClear = BIT (30),
kIntInput2VBLActive = BIT (29),
kIntInput2VBLClear = BIT (29),
kIntAudioWrapActive = BIT (28),
kIntAudioWrapClear = BIT (28),
kIntAudioOutWrapActive = BIT (27),
kIntAudioOutWrapClear = BIT (27),
kIntUartTx2Active = BIT (26),
kIntUartTx2Clear = BIT (26),
kIntOutput2VBLActive = BIT (8),
kIntOutput2VBLClear = BIT (23),
kIntOutput3VBLActive = BIT (7),
kIntOutput3VBLClear = BIT (22),
kIntOutput4VBLActive = BIT (6),
kIntOutput4VBL = BIT (21),
kIntAuxVerticalActive = BIT (12),
kIntAuxVerticalClear = BIT (12),
kIntI2C2Active = BIT (13),
kIntI2C2Clear = BIT (13),
kIntI2C1Active = BIT (14),
kIntI2C1Clear = BIT (14),
// Status register 2
kIntInput3VBLActive = BIT (30),
kIntInput3VBLClear = BIT (30),
kIntInput4VBLActive = BIT (29),
kIntInput4VBLClear = BIT (29),
kIntInput5VBLActive = BIT (28),
kIntInput5VBLClear = BIT (28),
kIntInput6VBLActive = BIT (27),
kIntInput6VBLClear = BIT (27),
kIntInput7VBLActive = BIT (26),
kIntInput7VBLClear = BIT (26),
kIntInput8VBLActive = BIT (25),
kIntInput8VBLClear = BIT (25),
kIntOutput5VBLActive = BIT (31),
kIntOutput5VBLClear = BIT (19),
kIntOutput6VBLActive = BIT (24),
kIntOutput6VBLClear = BIT (18),
kIntOutput7VBLActive = BIT (23),
kIntOutput7VBLClear = BIT (17),
kIntOutput8VBLActive = BIT (22),
kIntOutput8VBLClear = BIT (16),
kIntDma1Enable = BIT (0),
kIntDma2Enable = BIT (1),
kIntDma3Enable = BIT (2),
kIntDma4Enable = BIT (3),
kIntBusErrEnable = BIT (4),
kIntDmaEnableMask = BIT (0) + BIT (1) + BIT (2) + BIT (3) + BIT (4),
kIntValidation = BIT (26),
kIntDMA1 = BIT (27),
kIntDMA2 = BIT (28),
kIntDMA3 = BIT (29),
kIntDMA4 = BIT (30),
kIntBusErr = BIT (31),
kIntDmaMask = BIT (27) + BIT (28) + BIT (29) + BIT (30) + BIT (31),
kIntPBChange = BIT (0),
kIntLowPower = BIT (1),
kIntDisplayFifo = BIT (2),
kIntSATAChange = BIT (3), // CF Presence Detect Change in Bones product ....
kIntTemp1High = BIT (4),
kIntTemp2High = BIT (5),
kIntPowerButtonChange = BIT (6),
kIntCPLDMask = BIT (0) + BIT (1) + BIT (2) + BIT (3) + BIT (4) + BIT(5) + BIT(6),
kDma1Go = BIT (0),
kDma2Go = BIT (1),
kDma3Go = BIT (2),
kDma4Go = BIT (3),
kRegDMAToHostBit = BIT (31),
kRegDMAAudioModeBit = BIT (30),
kRegFlashResetBit = BIT (10),
kRegFlashDoneBit = BIT (9),
kRegFlashPgmRdyBit = BIT (8),
kRegFlashDataMask = BIT (7) + BIT (6) + BIT (5) + BIT (4) + BIT (3) + BIT (2) + BIT (1) + BIT (0)
};
// The ntv2_irq_device_t enums must match up with the array of function
// pointers below.
// Params that are per-device
typedef struct ntv2_private
{
struct pci_dev *pci_dev;
ULWord deviceNumber;
ULWord busNumber;
ULWord pci_device;
char name[16];
struct cdev cdev;
// Base Address Values
unsigned long _unmappedBAR0Address;
unsigned long _mappedBAR0Address;
ULWord _BAR0MemorySize;
unsigned long _unmappedBAR1Address;
unsigned long _mappedBAR1Address;
ULWord _BAR1MemorySize;
unsigned long _unmappedBAR2Address;
unsigned long _mappedBAR2Address;
ULWord _BAR2MemorySize;
// Holds the number of hardware registers this device supports
// Obtained from ntv2devicefeatures.cpp
ULWord _numberOfHWRegisters;
// Reserved HighMem DMA Buffer if needed.
// used when setting boot option mem = totalmem-16Megs for SD or 64 Megs for HD.
// this is NumDmaDriverBuffers frames worth.
// These are the video registers
unsigned long _VideoAddress;
ULWord _VideoMemorySize;
// The NWL dma registers actually live in BAR0, but usually BAR0 is used to map
// the video control registers, so use a different set of variables for NWL to avoid confusion.
unsigned long _NwlAddress;
ULWord _NwlMemorySize;
// The Xlnx dma registers live in 64K BAR1.
unsigned long _XlnxAddress;
ULWord _XlnxMemorySize;
// The bigphysarea kernel patch returns a virtual address to contiguous LowMem
unsigned long _dmaBuffer;
caddr_t _virtBuffer;
ULWord _bigphysBufferSize; // # of bytes allocated.
// Pointers to Channel 1 and Channel 2 Frame Buffers
// This pointer along with the value of _pCh1Control or _pCh1Control
// register to address a given frame in the frame buffer.
// unsigned long* _Ch1BaseAddress;
// unsigned long* _Ch2BaseAddress;
// Registers - See hdntv.pdf or Ntv2.pdf for details.
unsigned long _pGlobalControl;
unsigned long _pGlobalControl2;
// clean old stuff
unsigned long _pVideoProcessingControl;
unsigned long _pVideoProcessingCrossPointControl;
// interrupt
unsigned long _pInterruptControl;
unsigned long _pInterruptControl2;
unsigned long _pStatus;
unsigned long _pStatus2;
// audio control
unsigned long _pAudioControl;
unsigned long _pAudioSource;
unsigned long _pAudioLastOut;
unsigned long _pAudioLastIn;
unsigned long _pAudio2Control;
unsigned long _pAudio2Source;
unsigned long _pAudio2LastOut;
unsigned long _pAudio2LastIn;
unsigned long _pAudio3Control;
unsigned long _pAudio3Source;
unsigned long _pAudio3LastOut;
unsigned long _pAudio3LastIn;
unsigned long _pAudio4Control;
unsigned long _pAudio4Source;
unsigned long _pAudio4LastOut;
unsigned long _pAudio4LastIn;
unsigned long _pAudio5Control;
unsigned long _pAudio5Source;
unsigned long _pAudio5LastOut;
unsigned long _pAudio5LastIn;
unsigned long _pAudio6Control;
unsigned long _pAudio6Source;
unsigned long _pAudio6LastOut;
unsigned long _pAudio6LastIn;
unsigned long _pAudio7Control;
unsigned long _pAudio7Source;
unsigned long _pAudio7LastOut;
unsigned long _pAudio7LastIn;
unsigned long _pAudio8Control;
unsigned long _pAudio8Source;
unsigned long _pAudio8LastOut;
unsigned long _pAudio8LastIn;
unsigned long _pAudioSampleCounter;
// aja dma registers
unsigned long _pDMA1HostAddress;
unsigned long _pDMA1LocalAddress;
unsigned long _pDMA1TransferCount;
unsigned long _pDMA1NextDescriptor;
unsigned long _pDMA2HostAddress;
unsigned long _pDMA2LocalAddress;
unsigned long _pDMA2TransferCount;
unsigned long _pDMA2NextDescriptor;
unsigned long _pDMA3HostAddress;
unsigned long _pDMA3LocalAddress;
unsigned long _pDMA3TransferCount;
unsigned long _pDMA3NextDescriptor;
unsigned long _pDMA4HostAddress;
unsigned long _pDMA4LocalAddress;
unsigned long _pDMA4TransferCount;
unsigned long _pDMA4NextDescriptor;
unsigned long _pDMA1HostAddressHigh;
unsigned long _pDMA1NextDescriptorHigh;
unsigned long _pDMA2HostAddressHigh;
unsigned long _pDMA2NextDescriptorHigh;
unsigned long _pDMA3HostAddressHigh;
unsigned long _pDMA3NextDescriptorHigh;
unsigned long _pDMA4HostAddressHigh;
unsigned long _pDMA4NextDescriptorHigh;
unsigned long _pDMAControlStatus;
unsigned long _pDMAInterruptControl;
bool _bMultiChannel;
unsigned long _pDeviceID; // device ID register
# ifdef SOFTWARE_UART_FIFO
# ifdef UARTTXFIFOSIZE
unsigned long _pUARTTransmitData;
# endif
# ifdef UARTRXFIFOSIZE
unsigned long _pUARTReceiveData;
# endif
unsigned long _pUARTControl;
# ifdef UARTTXFIFOSIZE
unsigned long _pUARTTransmitData2;
# endif
# ifdef UARTRXFIFOSIZE
unsigned long _pUARTReceiveData2;
# endif
unsigned long _pUARTControl2;
# endif // SOFTWARE_UART_FIFO
NTV2DeviceID _DeviceID; // device ID value
wait_queue_head_t _interruptWait[eNumInterruptTypes];
ULWord64 _interruptCount[eNumInterruptTypes];
unsigned long _interruptHappened[eNumInterruptTypes];
struct semaphore _I2CMutex;
// dma engines
NTV2DmaMethod _dmaMethod;
DMA_ENGINE _dmaEngine[DMA_NUM_ENGINES];
ULWord _dmaNumEngines;
struct semaphore _dmaSerialSemaphore;
int _numXlnxH2CEngines;
int _numXlnxC2HEngines;
// Autocirculate stuff.
INTERNAL_AUTOCIRCULATE_STRUCT _AutoCirculate[NUM_CIRCULATORS];
NTV2Crosspoint _LkUpAcChanSpecGivenEngine[NUM_CIRCULATORS];
//audio clock!
ULWord _ulNumberOfWrapsOfClockSampleCounter;//The software sample counter is 64 bit...
// So this keeps track of the number of wraps
// around of the 32-bit HW counter.
ULWord _ulLastClockSampleCounter; //value the register had last time it was read;
spinlock_t _registerSpinLock;
spinlock_t _autoCirculateLock;
spinlock_t _virtualRegisterLock;
spinlock_t _nwlRegisterLock[NUM_NWL_REGS];
spinlock_t _p2pInterruptControlRegisterLock;
spinlock_t _audioClockLock;
spinlock_t _bankAndRegisterAccessLock;
struct semaphore _mailBoxSemaphore;
NTV2_GlobalAudioPlaybackMode _globalAudioPlaybackMode;
ULWord _videoBitfileProgramming;
bool _startAudioNextFrame;
bool _bitFileInfoSet[eFPGA_NUM_FPGAs];
BITFILE_INFO_STRUCT bitFileInfo[eFPGA_NUM_FPGAs];
VirtualProcAmpRegisters _virtualProcAmpRegisters;
HardwareProcAmpRegisterImage _hwProcAmpRegisterImage;
# ifdef SOFTWARE_UART_FIFO
# ifdef UARTRXFIFOSIZE
spinlock_t uartRxFifoLock;
UByte uartRxFifo[UARTRXFIFOSIZE];
ULWord uartRxFifoSize;
bool uartRxFifoOverrun;
spinlock_t uartRxFifoLock2;
UByte uartRxFifo2[UARTRXFIFOSIZE];
ULWord uartRxFifoSize2;
bool uartRxFifoOverrun2;
# endif
# ifdef UARTTXFIFOSIZE
spinlock_t uartTxFifoLock;
UByte uartTxFifo[UARTTXFIFOSIZE];
ULWord uartTxFifoSize;
spinlock_t uartTxFifoLock2;
UByte uartTxFifo2[UARTTXFIFOSIZE];
ULWord uartTxFifoSize2;
# endif
# endif // SOFTWARE_UART_FIFO
unsigned int _ntv2IRQ[eNumNTV2IRQDevices];
ULWord _audioSyncTolerance;
ULWord _dmaSerialize;
ULWord _syncChannels;
NTV2Crosspoint _syncChannel1;
NTV2Crosspoint _syncChannel2;
// Virtual registers
ULWord _virtualRegisterMem[MAX_NUM_VIRTUAL_REGISTERS];
//
// Control panel additions
//
ULWord _ApplicationPID; // 10184
ULWord _ApplicationCode; // 10185
ULWord _ApplicationReferenceCount; // 10326 and 10327
ULWord _VirtualMailBoxTimeoutNS; // 10478 // Units are 100 ns, not nanoseconds!
// P2P - Peer to peer messaging
unsigned long _pMessageChannel1; // control register kerenel address
unsigned long _pMessageChannel2;
unsigned long _pMessageChannel3;
unsigned long _pMessageChannel4;
unsigned long _pMessageChannel5;
unsigned long _pMessageChannel6;
unsigned long _pMessageChannel7;
unsigned long _pMessageChannel8;
unsigned long _pPhysicalMessageChannel1; // control registere bus address
unsigned long _pPhysicalMessageChannel2;
unsigned long _pPhysicalMessageChannel3;
unsigned long _pPhysicalMessageChannel4;
unsigned long _pPhysicalMessageChannel5;
unsigned long _pPhysicalMessageChannel6;
unsigned long _pPhysicalMessageChannel7;
unsigned long _pPhysicalMessageChannel8;
unsigned long _pMessageInterruptStatus; // kerenel address
unsigned long _pMessageInterruptControl;
unsigned long _pPhysicalOutputChannel1; // bus address
unsigned long _pPhysicalOutputChannel2;
unsigned long _pPhysicalOutputChannel3;
unsigned long _pPhysicalOutputChannel4;
unsigned long _pPhysicalOutputChannel5;
unsigned long _pPhysicalOutputChannel6;
unsigned long _pPhysicalOutputChannel7;
unsigned long _pPhysicalOutputChannel8;
unsigned long _FrameAperturePhysicalAddress; // bus
unsigned long _FrameApertureBaseAddress; // kernel
ULWord _FrameApertureBaseSize;
unsigned long _pFrameApertureOffset;
ULWord _PCIDeviceControlOffset;
Ntv2SystemContext systemContext;
// struct ntv2_genlock *m_pGenlockMonitor;
struct ntv2_hdmiin *m_pHDMIInputMonitor[NTV2_MAX_HDMI_MONITOR];
struct ntv2_hdmiin4 *m_pHDMIIn4Monitor[NTV2_MAX_HDMI_MONITOR];
struct ntv2_hdmiout4 *m_pHDMIOut4Monitor[NTV2_MAX_HDMI_MONITOR];
struct ntv2_serial *m_pSerialPort;
struct ntv2_mcap *m_pBitstream;
struct ntv2_setup *m_pSetupMonitor;
bool registerEnable;
bool serialActive;
#if defined(AJA_HEVC)
unsigned long _hevcDevNum;
#endif
ULWord _AncF2StartMemory[NTV2_MAX_NUM_CHANNELS];
ULWord _AncF2StopMemory[NTV2_MAX_NUM_CHANNELS];
ULWord _AncF2Size[NTV2_MAX_NUM_CHANNELS];
} NTV2PrivateParams;
NTV2ModulePrivateParams * getNTV2ModuleParams(void);
NTV2PrivateParams * getNTV2Params(unsigned int deviceNumber);
// Null mask and null shift for ReadRegister and WriteRegister
//
#define NO_MASK (0xFFFFFFFF)
#define NO_SHIFT (0)
#define NTV2REGWRITEMODEMASK (BIT_20+BIT_21)
#define NTV2REGWRITEMODESHIFT (20)
#define NTV2LEDSTATEMASK (BIT_16+BIT_17+BIT_18+BIT_19)
#define NTV2LEDSTATESHIFT (16)
// Billions and billions of prototypes for reading and writing registers
//
ULWord READ_REGISTER_ULWord( unsigned long address);
ULWord READ_REGISTER_UWord( unsigned long address);
ULWord READ_REGISTER_UByte( unsigned long address);
void WRITE_REGISTER_ULWord( unsigned long address, ULWord regValue);
void WRITE_REGISTER_UWord( unsigned long address, ULWord regValue);
void WRITE_REGISTER_UByte( unsigned long address, ULWord regValue);
void GetActiveFrameBufferSize(ULWord deviceNumber,NTV2FrameDimensions * frameBufferSize);
// Write a single register with mask and shift
void WriteRegister( ULWord deviceNumber,
ULWord registerNumber,
ULWord registerValue,
ULWord registerMask,
ULWord registerShift);
// Write a group of registers as a block
void WriteRegisterBufferULWord( ULWord deviceNumber,
ULWord registerNumber,
ULWord* sourceData,
ULWord sourceDataSizeULWords);
ULWord ReadRegister(ULWord deviceNumber,ULWord registerNumber, ULWord registerMask, ULWord registerShift);
// old stuff
void WriteVideoProcessingControl(ULWord deviceNumber,ULWord value);
ULWord ReadVideoProcessingControl(ULWord deviceNumber);
void WriteVideoProcessingControlCrosspoint(ULWord deviceNumber,ULWord value);
ULWord ReadVideoProcessingControlCrosspoint(ULWord deviceNumber);
void SetBackgroundKeyCrosspoint(ULWord deviceNumber, NTV2Crosspoint crosspoint);
void SetBackgroundVideoCrosspoint(ULWord deviceNumber, NTV2Crosspoint crosspoint);
void SetForegroundKeyCrosspoint(ULWord deviceNumber, NTV2Crosspoint crosspoint);
void SetForegroundVideoCrosspoint(ULWord deviceNumber, NTV2Crosspoint crosspoint);
void WriteInterruptRegister(ULWord deviceNumber ,ULWord value);
ULWord ReadInterruptRegister(ULWord deviceNumber);
ULWord ReadStatusRegister(ULWord deviceNumber);
void WriteInterrupt2Register(ULWord deviceNumber ,ULWord value);
ULWord ReadInterrupt2Register(ULWord deviceNumber);
ULWord ReadStatus2Register(ULWord deviceNumber);
void SetRegisterWriteMode(ULWord deviceNumber, NTV2Channel channel, NTV2RegisterWriteMode value);
NTV2RegisterWriteMode GetRegisterWriteMode(ULWord deviceNumber, NTV2Channel channel);
void SetLEDState(ULWord deviceNumber,ULWord value);
ULWord GetLEDState(ULWord deviceNumber);
void SetSingleLED(ULWord deviceNumber,ULWord bitNum);
void ClearSingleLED(ULWord deviceNumber,ULWord bitNum);
// audio out last
ULWord ReadAudioLastOut(ULWord deviceNumber);
ULWord ReadAudioLastOut2(ULWord deviceNumber);
ULWord ReadAudioLastOut3(ULWord deviceNumber);
ULWord ReadAudioLastOut4(ULWord deviceNumber);
ULWord ReadAudioLastOut5(ULWord deviceNumber);
ULWord ReadAudioLastOut6(ULWord deviceNumber);
ULWord ReadAudioLastOut7(ULWord deviceNumber);
ULWord ReadAudioLastOut8(ULWord deviceNumber);
// audio in last
ULWord ReadAudioLastIn(ULWord deviceNumber);
ULWord ReadAudioLastIn2(ULWord deviceNumber);
ULWord ReadAudioLastIn3(ULWord deviceNumber);
ULWord ReadAudioLastIn4(ULWord deviceNumber);
ULWord ReadAudioLastIn5(ULWord deviceNumber);
ULWord ReadAudioLastIn6(ULWord deviceNumber);
ULWord ReadAudioLastIn7(ULWord deviceNumber);
ULWord ReadAudioLastIn8(ULWord deviceNumber);
ULWord ReadAudioSampleCounter(ULWord deviceNumber);
void AvInterruptControl(ULWord deviceNumber,
INTERRUPT_ENUMS eInterruptType, // Which interrupt
ULWord enable); // 0: disable, nonzero: enable
void ClearInput1VerticalInterrupt(ULWord deviceNumber);
void ClearInput2VerticalInterrupt(ULWord deviceNumber);
void ClearInput3VerticalInterrupt(ULWord deviceNumber);
void ClearInput4VerticalInterrupt(ULWord deviceNumber);
void ClearInput5VerticalInterrupt(ULWord deviceNumber);
void ClearInput6VerticalInterrupt(ULWord deviceNumber);
void ClearInput7VerticalInterrupt(ULWord deviceNumber);
void ClearInput8VerticalInterrupt(ULWord deviceNumber);
void ClearOutputVerticalInterrupt(ULWord deviceNumber);
void ClearOutput2VerticalInterrupt(ULWord deviceNumber);
void ClearOutput3VerticalInterrupt(ULWord deviceNumber);
void ClearOutput4VerticalInterrupt(ULWord deviceNumber);
void ClearOutput5VerticalInterrupt(ULWord deviceNumber);
void ClearOutput6VerticalInterrupt(ULWord deviceNumber);
void ClearOutput7VerticalInterrupt(ULWord deviceNumber);
void ClearOutput8VerticalInterrupt(ULWord deviceNumber);
void ClearAudioInterrupt(ULWord deviceNumber);
void ClearUartRxInterrupt(ULWord deviceNumber);
void ClearUartTxInterrupt(ULWord deviceNumber);
void ClearUartTxInterrupt2(ULWord deviceNumber);
ULWord ReadDeviceIDRegister(ULWord deviceNumber);
//////////////////////////////////////////////////////////////////
// Aja methods
//
ULWord ReadDMARegister(ULWord deviceNumber, ULWord regNum);
void WriteDMARegister(ULWord deviceNumber, ULWord regNum, ULWord value);
bool ConfigureDMAChannels(ULWord deviceNumber);
void WriteDMAHostAddressLow(ULWord deviceNumber, ULWord index, ULWord value);
void WriteDMAHostAddressHigh(ULWord deviceNumber, ULWord index, ULWord value);
void WriteDMALocalAddress(ULWord deviceNumber, ULWord index, ULWord value);
void WriteDMATransferCount(ULWord deviceNumber, ULWord index, ULWord value);
void WriteDMANextDescriptorLow(ULWord deviceNumber, ULWord index, ULWord value);
void WriteDMANextDescriptorHigh(ULWord deviceNumber, ULWord index, ULWord value);
ULWord ReadDMAControlStatus(ULWord deviceNumber);
void WriteDMAControlStatus(ULWord deviceNumber,ULWord value);
void SetDMAEngineStatus(ULWord deviceNumber, int index, bool enable);
int GetDMAEngineStatus(ULWord deviceNumber, int index);
ULWord ReadDMAInterruptControl(ULWord deviceNumber);
void WriteDMAInterruptControl(ULWord deviceNumber, ULWord value);
void EnableDMAInterrupt(ULWord deviceNumber, NTV2DMAInterruptMask interruptMask);
void DisableDMAInterrupt(ULWord deviceNumber, NTV2DMAInterruptMask interruptMask);
void ClearDMAInterrupt(ULWord deviceNumber, NTV2DMAStatusBits clearBit);
void ClearDMAInterrupts(ULWord deviceNumber);
//////////////////////////////////////////////////////////////////
// Nwl methods
//
ULWord ReadNwlRegister(ULWord deviceNumber, ULWord regNum);
void WriteNwlRegister(ULWord deviceNumber, ULWord regNum, ULWord value);
bool ConfigureNwlChannels(ULWord deviceNumber);
bool IsNwlChannel(ULWord deviceNumber, bool bC2H, int index);
void WriteNwlCommonControlStatus(ULWord deviceNumber, ULWord value);
void WriteNwlControlStatus(ULWord deviceNumber, bool bC2H, ULWord index, ULWord value);
void WriteNwlChainStartAddressLow(ULWord deviceNumber, bool bC2H, ULWord index, ULWord value);
void WriteNwlChainStartAddressHigh(ULWord deviceNumber, bool bC2H, ULWord index, ULWord value);
ULWord ReadNwlCommonControlStatus(ULWord deviceNumber);
ULWord ReadNwlCapabilities(ULWord deviceNumber, bool bC2H, ULWord index);
ULWord ReadNwlControlStatus(ULWord deviceNumber, bool bC2H, ULWord index);
ULWord ReadNwlHardwareTime(ULWord deviceNumber, bool bC2H, ULWord index);
ULWord ReadNwlChainCompleteByteCount(ULWord deviceNumber, bool bC2H, ULWord index);
void ResetNwlHardware(ULWord deviceNumber, bool bC2H, ULWord index);
void EnableNwlUserInterrupt(ULWord deviceNumber);
void DisableNwlUserInterrupt(ULWord deviceNumber);
void EnableNwlDmaInterrupt(ULWord deviceNumber);
void DisableNwlDmaInterrupt(ULWord deviceNumber);
void ClearNwlUserInterrupt(ULWord deviceNumber);
void ClearNwlS2C0Interrupt(ULWord deviceNumber);
void ClearNwlC2S0Interrupt(ULWord deviceNumber);
void ClearNwlS2C1Interrupt(ULWord deviceNumber);
void ClearNwlC2S1Interrupt(ULWord deviceNumber);
//////////////////////////////////////////////////////////////////
// Xlnx methods
//
ULWord ReadXlnxRegister(ULWord deviceNumber, ULWord regNum);
void WriteXlnxRegister(ULWord deviceNumber, ULWord regNum, ULWord value);
bool ConfigureXlnxChannels(ULWord deviceNumber);
bool IsXlnxChannel(ULWord deviceNumber, bool bC2H, int index);
ULWord XlnxChannelRegBase(ULWord deviceNumber, bool bC2H, int index);
ULWord XlnxSgdmaRegBase(ULWord deviceNumber, bool bC2H, int index);
ULWord XlnxConfigRegBase(ULWord deviceNumber);
ULWord XlnxIrqRegBase(ULWord deviceNumber);
ULWord XlnxIrqBitMask(ULWord deviceNumber, bool bC2H, int index);
void EnableXlnxUserInterrupt(ULWord deviceNumber, int index);
void DisableXlnxUserInterrupt(ULWord deviceNumber, int index);
ULWord ReadXlnxUserInterrupt(ULWord deviceNumber);
bool IsXlnxUserInterrupt(ULWord deviceNumber, int index, ULWord intReg);
void EnableXlnxDmaInterrupt(ULWord deviceNumber, bool bC2H, int index);
void DisableXlnxDmaInterrupt(ULWord deviceNumber, bool bC2H, int index);
void EnableXlnxDmaInterrupts(ULWord deviceNumber);
void DisableXlnxDmaInterrupts(ULWord deviceNumber);
void DisableXlnxInterrupts(ULWord deviceNumber);
ULWord ReadXlnxDmaInterrupt(ULWord deviceNumber);
bool IsXlnxDmaInterrupt(ULWord deviceNumber, bool bC2H, int index, ULWord intReg);
bool StartXlnxDma(ULWord deviceNumber, bool bC2H, int index);
bool StopXlnxDma(ULWord deviceNumber, bool bC2H, int index);
void StopAllXlnxDma(ULWord deviceNumber);
ULWord ReadXlnxDmaStatus(ULWord deviceNumber, bool bC2H, int index);
ULWord ClearXlnxDmaStatus(ULWord deviceNumber, bool bC2H, int index);
bool IsXlnxDmaActive(ULWord status);
bool IsXlnxDmaError(ULWord status);
bool WaitXlnxDmaActive(ULWord deviceNumber, bool bC2H, int index, bool active);
void WriteXlnxDmaEngineStartLow(ULWord deviceNumber, bool bC2H, int index, ULWord addressLow);
void WriteXlnxDmaEngineStartHigh(ULWord deviceNumber, bool bC2H, int index, ULWord addressHigh);
void WriteXlnxDmaEngineStartAdjacent(ULWord deviceNumber, bool bC2H, int index, ULWord adjacent);
ULWord ReadXlnxPerformanceCycleCount(ULWord deviceNumber, bool bC2H, int index);
ULWord ReadXlnxPerformanceDataCount(ULWord deviceNumber, bool bC2H, int index);
ULWord ReadXlnxMaxReadRequestSize(ULWord deviceNumber);
//////////////////////////////////////////////////////////////////
// Interrupt methods
//
void EnableAllInterrupts(ULWord deviceNumber);
void DisableAllInterrupts(ULWord deviceNumber);
void StopAllDMAEngines(ULWord deviceNumber);
////////////////////////////////////////////////////////////////////////////////////////////
// LTC methods (reuses RP188 structure)
void SetLTCData (ULWord deviceNumber, NTV2Channel channel, RP188_STRUCT rp188Data);
void GetLTCData (ULWord deviceNumber, NTV2Channel channel, RP188_STRUCT* rp188Data);
////////////////////////////////////////////////////////////////////////////////////////////
// OEM RP188 methods
void SetRP188Data (ULWord deviceNumber, NTV2Channel channel, RP188_STRUCT rp188Data);
void GetRP188Data (ULWord deviceNumber, NTV2Channel channel, RP188_STRUCT* rp188Data);
////////////////////////////////////////////////////////////////////////////////////////////
// OEM Custom Ancillary Data methods
void SetCustomAncillaryDataMode(ULWord deviceNumber, NTV2Channel channel, bool bEnable);
void SetCustomAncillaryData (ULWord deviceNumber, NTV2Channel channel, CUSTOM_ANC_STRUCT *customAncInfo);
////////////////////////////////////////////////////////////////////////////////////////////
// OEM UART methods
void Init422Uart(ULWord deviceNumber);
#ifdef SOFTWARE_UART_FIFO
#ifdef UARTRXFIFOSIZE
ULWord ReadUARTReceiveData(ULWord deviceNumber);
ULWord ReadUARTReceiveData2(ULWord deviceNumber);
#endif
#ifdef UARTTXFIFOSIZE
void WriteUARTTransmitData(ULWord deviceNumber,ULWord value);
void WriteUARTTransmitData2(ULWord deviceNumber,ULWord value);
#endif
ULWord ReadUARTControl(ULWord deviceNumber);
ULWord ReadUARTControl2(ULWord deviceNumber);
#endif // SOFTWARE_UART_FIFO
//////////////////////////////////////////////////////////////////
// OEM Color Correction Methods
//
void SetColorCorrectionMode(ULWord deviceNumber, NTV2Channel channel, NTV2ColorCorrectionMode mode);
ULWord GetColorCorrectionMode(ULWord deviceNumber, NTV2Channel channel);
void SetColorCorrectionOutputBank (ULWord deviceNumber, NTV2Channel channel, ULWord bank);
ULWord GetColorCorrectionOutputBank (ULWord deviceNumber, NTV2Channel channel);
void SetColorCorrectionHostAccessBank (ULWord deviceNumber, NTV2ColorCorrectionHostAccessBank value);
NTV2ColorCorrectionHostAccessBank GetColorCorrectionHostAccessBank (ULWord deviceNumber, NTV2Channel channel);
void SetColorCorrectionSaturation (ULWord deviceNumber, NTV2Channel channel, ULWord value);
ULWord GetColorCorrectionSaturation (ULWord deviceNumber, NTV2Channel channel);
//////////////////////////////////////////////////////////////////
// Utility methods
//
bool IsSaveRecallRegister(ULWord deviceNumber, ULWord regNum);
void GetDeviceSerialNumberWords(ULWord deviceNumber, ULWord *low, ULWord *high);
void itoa64(ULWord64 i, char *buffer);
inline void interruptHousekeeping(NTV2PrivateParams* pNTV2Params, INTERRUPT_ENUMS interrupt);
void InitDNXAddressLUT(unsigned long address);
//////////////////////////////////////////////////////////////////
// P2P methods
//
ULWord ReadMessageChannel1(ULWord deviceNumber);
ULWord ReadMessageChannel2(ULWord deviceNumber);
ULWord ReadMessageChannel3(ULWord deviceNumber);
ULWord ReadMessageChannel4(ULWord deviceNumber);
ULWord ReadMessageChannel5(ULWord deviceNumber);
ULWord ReadMessageChannel6(ULWord deviceNumber);
ULWord ReadMessageChannel7(ULWord deviceNumber);
ULWord ReadMessageChannel8(ULWord deviceNumber);
ULWord ReadMessageInterruptStatus(ULWord deviceNumber);
ULWord ReadMessageInterruptControl(ULWord deviceNumber);
void EnableMessageChannel1Interrupt(ULWord deviceNumber);
void DisableMessageChannel1Interrupt(ULWord deviceNumber);
void ClearMessageChannel1Interrupt(ULWord deviceNumber);
void EnableMessageChannel2Interrupt(ULWord deviceNumber);
void DisableMessageChannel2Interrupt(ULWord deviceNumber);
void ClearMessageChannel2Interrupt(ULWord deviceNumber);
void EnableMessageChannel3Interrupt(ULWord deviceNumber);
void DisableMessageChannel3Interrupt(ULWord deviceNumber);
void ClearMessageChannel3Interrupt(ULWord deviceNumber);
void EnableMessageChannel4Interrupt(ULWord deviceNumber);
void DisableMessageChannel4Interrupt(ULWord deviceNumber);
void ClearMessageChannel4Interrupt(ULWord deviceNumber);
void EnableMessageChannel5Interrupt(ULWord deviceNumber);
void DisableMessageChannel5Interrupt(ULWord deviceNumber);
void ClearMessageChannel5Interrupt(ULWord deviceNumber);
void EnableMessageChannel6Interrupt(ULWord deviceNumber);
void DisableMessageChannel6Interrupt(ULWord deviceNumber);
void ClearMessageChannel6Interrupt(ULWord deviceNumber);
void EnableMessageChannel7Interrupt(ULWord deviceNumber);
void DisableMessageChannel7Interrupt(ULWord deviceNumber);
void ClearMessageChannel7Interrupt(ULWord deviceNumber);
void EnableMessageChannel8Interrupt(ULWord deviceNumber);
void DisableMessageChannel8Interrupt(ULWord deviceNumber);
void ClearMessageChannel8Interrupt(ULWord deviceNumber);
ULWord ReadFrameApertureOffset(ULWord deviceNumber);
void WriteFrameApertureOffset(ULWord deviceNumber, ULWord value);
void WriteFrameAperture(ULWord deviceNumber, ULWord offset, ULWord value);
bool DeviceCanDoP2P(ULWord deviceNumber);
void SetLUTEnable(ULWord deviceNumber, NTV2Channel channel, ULWord enable);
void SetLUTV2HostAccessBank(ULWord deviceNumber, NTV2ColorCorrectionHostAccessBank value);
void SetLUTV2OutputBank(ULWord deviceNumber, NTV2Channel channel, ULWord bank);
ULWord GetLUTV2OutputBank(ULWord deviceNumber, NTV2Channel channel);
ULWord ntv2_getRoundedUpTimeoutJiffies(ULWord timeOutMs);
#endif // !REGISTERIO_H

View File

@ -1,78 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2anc.h
// Purpose: Common RP188
//
///////////////////////////////////////////////////////////////
#ifndef NTV2ANC_HEADER
#define NTV2ANC_HEADER
#include "ntv2kona.h"
bool SetupAncExtractor(Ntv2SystemContext* context, NTV2Channel channel);
bool EnableAncExtractor(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool SetAncExtWriteParams(Ntv2SystemContext* context, NTV2Channel channel, ULWord frameNumber);
bool SetAncExtField2WriteParams(Ntv2SystemContext* context, NTV2Channel channel, ULWord frameNumber);
bool EnableAncExtHancY(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool EnableAncExtHancC(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool EnableAncExtVancY(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool EnableAncExtVancC(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool SetAncExtSDDemux(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool SetAncExtProgressive(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool SetAncExtSynchro(Ntv2SystemContext* context, NTV2Channel channel);
bool SetAncExtField1StartAddr(Ntv2SystemContext* context, NTV2Channel channel, ULWord addr);
bool SetAncExtLSBEnable(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool SetAncExtField1StartAddr(Ntv2SystemContext* context, NTV2Channel channel, ULWord addr);
bool SetAncExtField1EndAddr(Ntv2SystemContext* context, NTV2Channel channel, ULWord addr);
bool SetAncExtField2StartAddr(Ntv2SystemContext* context, NTV2Channel channel, ULWord addr);
bool SetAncExtField2EndAddr(Ntv2SystemContext* context, NTV2Channel channel, ULWord addr);
bool SetAncExtField1CutoffLine(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool SetAncExtField2CutoffLine(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool IsAncExtOverrun(Ntv2SystemContext* context, NTV2Channel channel);
ULWord GetAncExtField1Bytes(Ntv2SystemContext* context, NTV2Channel channel);
bool IsAncExtField1Overrun(Ntv2SystemContext* context, NTV2Channel channel);
ULWord GetAncExtField2Bytes(Ntv2SystemContext* context, NTV2Channel channel);
bool IsAncExtField2Overrun(Ntv2SystemContext* context, NTV2Channel channel);
bool SetAncExtField1StartLine(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool SetAncExtField2StartLine(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool SetAncExtTotalFrameLines(Ntv2SystemContext* context, NTV2Channel channel, ULWord totalFrameLines);
bool SetAncExtFidLow(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool SetAncExtFidHi(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool SetAncExtField1AnalogStartLine(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool SetAncExtField2AnalogStartLine(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool SetAncExtField1AnalogYFilter(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineFilter);
bool SetAncExtField2AnalogYFilter(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineFilter);
bool SetAncExtField1AnalogCFilter(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineFilter);
bool SetAncExtField2AnalogCFilter(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineFilter);
bool SetupAncInserter(Ntv2SystemContext* context, NTV2Channel channel);
bool EnableAncInserter(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool SetAncInsReadParams(Ntv2SystemContext* context, NTV2Channel channel, ULWord frameNumber, ULWord field1Size);
bool SetAncInsReadField2Params(Ntv2SystemContext* context, NTV2Channel channel, ULWord frameNumber, ULWord field2Size);
bool SetAncInsField1Bytes(Ntv2SystemContext* context, NTV2Channel channel, ULWord numberOfBytes);
bool SetAncInsField2Bytes(Ntv2SystemContext* context, NTV2Channel channel, ULWord numberOfBytes);
bool EnableAncInsHancY(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool EnableAncInsHancC(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool EnableAncInsVancY(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool EnableAncInsVancC(Ntv2SystemContext* context, NTV2Channel channel, bool bEnable);
bool SetAncInsProgressive(Ntv2SystemContext* context, NTV2Channel channel, bool isProgressive);
bool SetAncInsSDPacketSplit(Ntv2SystemContext* context, NTV2Channel channel, bool inEnable);
bool SetAncInsField1StartAddr(Ntv2SystemContext* context, NTV2Channel channel, ULWord startAddr);
bool SetAncInsField2StartAddr(Ntv2SystemContext* context, NTV2Channel channel, ULWord startAddr);
bool SetAncInsHancPixelDelay(Ntv2SystemContext* context, NTV2Channel channel, ULWord numberOfPixels);
bool SetAncInsVancPixelDelay(Ntv2SystemContext* context, NTV2Channel channel, ULWord numberOfPixels);
bool SetAncInsField1ActiveLine(Ntv2SystemContext* context, NTV2Channel channel, ULWord activeLineNumber);
bool SetAncInsField2ActiveLine(Ntv2SystemContext* context, NTV2Channel channel, ULWord activeLineNumber);
bool SetAncInsHActivePixels(Ntv2SystemContext* context, NTV2Channel channel, ULWord numberOfActiveLinePixels);
bool SetAncInsHTotalPixels(Ntv2SystemContext* context, NTV2Channel channel, ULWord numberOfLinePixels);
bool SetAncInsTotalLines(Ntv2SystemContext* context, NTV2Channel channel, ULWord numberOfLines);
bool SetAncInsFidHi(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
bool SetAncInsFidLow(Ntv2SystemContext* context, NTV2Channel channel, ULWord lineNumber);
#endif

View File

@ -1,57 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
//========================================================================
//
// ntv2audio.h
//
//==========================================================================
#ifndef NTV2AUDIO_H
#define NTV2AUDIO_H
#include "ntv2system.h"
#include "ntv2publicinterface.h"
#define NTV2_AUDIOSAMPLESIZE (sizeof(uint32_t))
#define NTV2_AUDIO_WRAPADDRESS 0xFF000
#define NTV2_AUDIO_WRAPADDRESS_MEDIUM (0xFF000*2)
#define NTV2_AUDIO_WRAPADDRESS_BIG (0xFF000*4)
#define NTV2_AUDIO_WRAPADDRESS_BIGGER (0xFF000*8) // used with KiPro Mini 99 video buffers
#define NTV2_AUDIO_READBUFFEROFFSET 0x100000
#define NTV2_AUDIO_READBUFFEROFFSET_MEDIUM (0x100000*2)
#define NTV2_AUDIO_READBUFFEROFFSET_BIG (0x100000*4)
void StartAudioPlayback(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
void StopAudioPlayback(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
bool IsAudioPlaybackStopped(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
bool IsAudioPlaying(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
void PauseAudioPlayback(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
void UnPauseAudioPlayback(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
bool IsAudioPlaybackPaused(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
void StartAudioCapture(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
void StopAudioCapture(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
bool IsAudioCaptureStopped(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
uint32_t GetNumAudioChannels(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
uint32_t oemAudioSampleAlign(Ntv2SystemContext* context, NTV2AudioSystem audioSystem, uint32_t ulReadSample);
uint32_t GetAudioLastOut(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
uint32_t GetAudioLastIn(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
uint32_t GetAudioSamplesPerFrame(Ntv2SystemContext* context,
NTV2AudioSystem audioSystem,
uint32_t cadenceFrame,
bool fieldMode);
NTV2AudioRate GetAudioRate(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
uint32_t GetAudioSamplesPerSecond(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
uint32_t GetAudioTransferInfo(Ntv2SystemContext* context,
NTV2AudioSystem audioSystem,
uint32_t currentOffset,
uint32_t numBytesToTransfer,
uint32_t* preWrapBytes,
uint32_t* postWrapBytes);
uint32_t GetAudioWrapAddress(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
bool GetAudioBufferSize(Ntv2SystemContext* context, NTV2AudioSystem audioSystem, NTV2AudioBufferSize *value);
uint32_t GetAudioReadOffset(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
uint32_t GetAudioFrameBufferNumber(Ntv2SystemContext* context, NTV2AudioSystem audioSystem);
#endif

View File

@ -1,219 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
//========================================================================
//
// ntv2dev_autocirc.h
//
//==========================================================================
#ifndef NTV2AUTOCIRC_H
#define NTV2AUTOCIRC_H
#include "ntv2system.h"
#include "ntv2publicinterface.h"
#include "ntv2rp188.h"
#define NUM_CIRCULATORS 18 // number of 'channels' which have auto-circulate capability
#define NUM_CIRCULATE_FRAMES 64
#define ILLEGAL_CHANNELSPEC(channelSpec) (((unsigned)channelSpec > (unsigned)NTV2CROSSPOINT_INPUT8) || (channelSpec == NTV2CROSSPOINT_MATTE) || (channelSpec == NTV2CROSSPOINT_FGKEY))
#define NTV2_INVALID_FRAME 0xFFFFFFFF
typedef struct {
NTV2ColorCorrectionMode mode;
uint32_t saturationValue; /// only used in 3way color correction mode
uint32_t ccLookupTables[NTV2_COLORCORRECTOR_TABLESIZE/4]; /// R,G,B lookup tables formated for hardware
} INTERNAL_COLOR_CORRECTION_STRUCT;
typedef struct {
//! Processor RDTSC at time of play or record.
int64_t frameTime;
//! 48kHz clock in reg 28 extended to 64 bits
uint64_t audioClockTimeStamp; // Register 28 with Wrap Logic
//! The address that was used to transfer
uint32_t audioExpectedAddress;
//! For record - first position in buffer of audio (includes base offset)
uint32_t audioInStartAddress; // AudioInAddress at the time this Frame was stamped.
//! For record - end position (exclusive) in buffer of audio (includes base offset)
uint32_t audioInStopAddress; // AudioInAddress at the Frame AFTER this Frame was stamped.
//! For play - first position in buffer of audio
uint32_t audioOutStopAddress; // AudioOutAddress at the time this Frame was stamped.
//! For play - end position (exclusive) in buffer of audio
uint32_t audioOutStartAddress; // AudioOutAddress at the Frame AFTER this Frame was stamped.
uint32_t audioPreWrapBytes; // For DMA Transfer
uint32_t audioPostWrapBytes;
//! Total audio and video bytes transfered
uint32_t bytesRead;
/** The actaul start sample when this frame was started in VBI
* This may be used to check sync against audioInStartAddress (Play) or
* audioOutStartAddress (Record). In record it will always be equal, but
* in playback if the clocks drift or the user supplies non aligned
* audio sizes, then this will give the current difference from expected
* vs actual position. To be useful, play audio must be clocked in at
* the correct rate.
*/
uint32_t startSample;
//! Associated timecode (RP-188)
RP188_STRUCT rp188;
//! Valid counts from n..0 in the isr. Set to n when valid (n being the number of times (VBIs) to play this frame before advancing to the next.
// So, 0 indicates a not-ready frame, 1 indicates a normal ready frame, and >1 indicates a preroll condition.
int32_t validCount; // Used to throttle record and playback, See AutoCirculate Method in driver
//! Repeat is set to n at beginning of DMA. Moved to repeat on completion.
int32_t repeatCount; // Used to throttle record and playback, See AutoCirculate Method in driver
//! Opaque user variable
uint64_t hUser; // A user cookie returned by frame stamp
bool videoTransferPending; // p2p transfer in progress
uint32_t frameFlags; // p2p and field flags
NTV2FrameBufferFormat frameBufferFormat;
NTV2VideoFrameBufferOrientation frameBufferOrientation;
INTERNAL_COLOR_CORRECTION_STRUCT colorCorrectionInfo;
AutoCircVidProcInfo vidProcInfo;
CUSTOM_ANC_STRUCT customAncInfo;
NTV2RoutingTable xena2RoutingTable;
INTERNAL_TIMECODE_STRUCT internalTCArray;
INTERNAL_SDI_STATUS_STRUCT internalSDIStatusArray;
// Anc frame info
uint32_t ancTransferSize;
uint32_t ancField2TransferSize;
uint32_t auxData[NTV2_HDMIAuxMaxFrames*NTV2_HDMIAuxDataSize/4];
uint32_t auxDataSize;
} INTERNAL_FRAME_STAMP_STRUCT;
typedef struct {
Ntv2SystemContext* pSysCon;
void* pFunCon;
NTV2AutoCirculateState state;
NTV2Crosspoint channelSpec;
NTV2DMAEngine DMAEngine;
bool recording;
int32_t currentFrame;
int32_t startFrame;
int32_t endFrame;
int32_t activeFrame;
int32_t activeFrameRegister;
int32_t nextFrame;
bool circulateWithAudio;
bool circulateWithRP188;
bool circulateWithColorCorrection;
bool circulateWithVidProc;
bool circulateWithCustomAncData;
bool enableFbfChange;
bool enableFboChange;
int64_t startTimeStamp;
uint64_t startAudioClockTimeStamp;
uint32_t framesProcessed;
uint32_t droppedFrames;
uint32_t nextTransferFrame;
INTERNAL_FRAME_STAMP_STRUCT frameStamp[MAX_FRAMEBUFFERS];
uint32_t nextAudioOutputAddress;
uint32_t audioStartSample;
uint32_t audioDropsRequired;
uint32_t audioDropsCompleted;
int64_t lastInterruptTime;
int64_t prevInterruptTime;
uint64_t lastAudioClockTimeStamp;
int64_t startTime;
bool circulateWithLTC;
NTV2AudioSystem audioSystem;
int32_t channelCount;
bool videoTransferPending;
bool startAudioNextFrame;
bool stopAudioNextFrame;
int64_t VBIRDTSC;
int64_t VBILastRDTSC;
uint32_t VBIAudioOut;
uint32_t transferFrame;
uint32_t audioTransferOffset;
uint32_t audioTransferSize;
uint32_t ancTransferOffset;
uint32_t ancField2TransferOffset;
uint32_t ancTransferSize;
uint32_t ancField2TransferSize;
bool circulateWithHDMIAux;
bool circulateWithFields;
} INTERNAL_AUTOCIRCULATE_STRUCT;
typedef struct ntv2autocirc
{
Ntv2SystemContext* pSysCon;
void* pFunCon;
NTV2DeviceID deviceID;
INTERNAL_AUTOCIRCULATE_STRUCT autoCirculate[NUM_CIRCULATORS];
NTV2Channel ancInputChannel[NTV2_MAX_NUM_CHANNELS];
NTV2_GlobalAudioPlaybackMode globalAudioPlaybackMode;
NTV2Crosspoint syncChannel1;
NTV2Crosspoint syncChannel2;
bool startAudioNextFrame;
bool stopAudioNextFrame;
bool bMultiChannel;
} NTV2AutoCirc;
Ntv2Status AutoCirculateControl(NTV2AutoCirc* pAutoCirc, AUTOCIRCULATE_DATA* psControl);
Ntv2Status AutoCirculateInit(NTV2AutoCirc* pAutoCirc,
NTV2Crosspoint lChannelSpec, int32_t lStartFrameNum,
int32_t lEndFrameNum, NTV2AudioSystem lAudioSystem,
int32_t lChannelCount, bool bWithAudio,
bool bWithRP188, bool bFbfChange,
bool bFboChange , bool bWithColorCorrection,
bool bWithVidProc, bool bWithCustomAncData,
bool bWithLTC, bool bWithFields,
bool bWithHDMIAux);
Ntv2Status AutoCirculateStart(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec, int64_t startTime);
Ntv2Status AutoCirculateStop(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec);
Ntv2Status AutoCirculateAbort(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec);
Ntv2Status AutoCirculatePause(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec, bool bPlay, bool bClearDF);
Ntv2Status AutoCirculateFlush(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec, bool bClearDF);
Ntv2Status AutoCirculatePreroll(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec, int32_t lPrerollFrames);
Ntv2Status AutoCirculateSetActiveFrame(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec, int32_t lActiveFrame);
void AutoCirculateReset(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec);
Ntv2Status AutoCirculateGetStatus(NTV2AutoCirc* pAutoCirc, AUTOCIRCULATE_STATUS* pUserOutBuffer);
Ntv2Status AutoCirculateGetFrameStamp(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec, int32_t ulFrameNum,
FRAME_STAMP_STRUCT *pFrameStamp);
Ntv2Status AutoCirculateTransfer(NTV2AutoCirc* pAutoCirc,
AUTOCIRCULATE_TRANSFER* pTransferStruct);
Ntv2Status AutoCirclateAudioPlaybackMode(NTV2AutoCirc* pAutoCirc,
NTV2AudioSystem audioSystem,
NTV2_GlobalAudioPlaybackMode mode);
uint32_t AutoCirculateGetBufferLevel(INTERNAL_AUTOCIRCULATE_STRUCT* pAuto);
bool AutoCirculateFindNextAvailFrame(INTERNAL_AUTOCIRCULATE_STRUCT* pAuto);
void AutoBeginAutoCirculateTransfer(uint32_t frameNumber,
AUTOCIRCULATE_TRANSFER *pTransferStruct,
INTERNAL_AUTOCIRCULATE_STRUCT *pAuto);
void AutoCompleteAutoCirculateTransfer(uint32_t frameNumber, AUTOCIRCULATE_TRANSFER_STATUS *pUserOutBuffer,
INTERNAL_AUTOCIRCULATE_STRUCT *pAuto,
bool updateValid, bool transferPending);
void AutoCirculateMessage(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec, uint32_t frameNumber);
void AutoCirculateTransferFields(INTERNAL_AUTOCIRCULATE_STRUCT* pAuto,
AUTOCIRCULATE_TRANSFER* pTransfer,
uint32_t frameNumber, bool drop);
bool AutoCirculate(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec, int32_t isrTimeStamp);
bool AutoIsAutoCirculateInterrupt(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec);
int32_t KAUTO_NEXTFRAME(int32_t __dwCurFrame_, INTERNAL_AUTOCIRCULATE_STRUCT* __pAuto_);
int32_t KAUTO_PREVFRAME(int32_t __dwCurFrame_, INTERNAL_AUTOCIRCULATE_STRUCT* __pAuto_);
void AutoCirculateSetupColorCorrector(NTV2AutoCirc* pAutoCirc,
NTV2Crosspoint channelSpec,
INTERNAL_COLOR_CORRECTION_STRUCT *ccInfo);
void AutoCirculateSetupXena2Routing(NTV2AutoCirc* pAutoCirc, NTV2RoutingTable* pXena2Routing);
void AutoCirculateWriteHDMIAux(NTV2AutoCirc* pAutoCirc, uint32_t* pAuxData, uint32_t auxDataSize);
bool AutoCirculateDmaAudioSetup(INTERNAL_AUTOCIRCULATE_STRUCT* pAuto);
bool AutoCirculateCanDoFieldMode(INTERNAL_AUTOCIRCULATE_STRUCT* pAuto);
bool AutoDropSyncFrame(NTV2AutoCirc* pAutoCirc, NTV2Crosspoint channelSpec);
void AutoCirculateSetupVidProc(NTV2AutoCirc* pAutoCirc,
NTV2Crosspoint channelSpec,
AutoCircVidProcInfo* vidProcInfo);
void AutoCirculateTransferColorCorrectorInfo(NTV2AutoCirc* pAutoCirc,
INTERNAL_COLOR_CORRECTION_STRUCT* ccInternalInfo,
NTV2ColorCorrectionInfo* ccTransferInfo);
bool AutoCirculateP2PCopy(NTV2AutoCirc* pAutoCirc,
PAUTOCIRCULATE_P2P_STRUCT pDriverBuffer,
PAUTOCIRCULATE_P2P_STRUCT pUserBuffer,
bool bToDriver);
void AutoCopyFrameStampOldToNew(const FRAME_STAMP_STRUCT * pInOldStruct, FRAME_STAMP * pOutNewStruct);
bool AutoCirculateFrameStampImmediate(NTV2AutoCirc* pAutoCirc, FRAME_STAMP * pInOutFrameStamp);
#endif

View File

@ -1,58 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
//========================================================================
//
// ntv2autodma.h
//
//==========================================================================
#ifndef NTV2AUTODMA_H
#define NTV2AUTODMA_H
#include "ntv2system.h"
#include "ntv2publicinterface.h"
// dma transfer parameters
typedef struct _autoDmaParams
{
bool toHost; // transfer to host
NTV2DMAEngine dmaEngine; // dma engine
NTV2Channel videoChannel; // video channel for frame size
void* pVidUserVa; // user video buffer
uint64_t videoBusAddress; // p2p video bus address
uint32_t videoBusSize; // p2p video bus size
uint64_t messageBusAddress; // p2p message bus address
uint32_t messageData; // p2p message data
uint32_t videoFrame; // card video frame
uint32_t vidNumBytes; // number of bytes per segment
uint32_t frameOffset; // card video offset
uint32_t vidUserPitch; // user buffer pitch
uint32_t vidFramePitch; // card frame pitch
uint32_t numSegments; // number of segments
void* pAudUserVa; // audio user buffer
NTV2AudioSystem audioSystem; // audio system target
uint32_t audNumBytes; // number of audio bytes
uint32_t audOffset; // card audio offset
void* pAncF1UserVa; // anc field 1 user buffer
uint32_t ancF1Frame; // anc field 1 frame
uint32_t ancF1NumBytes; // number of anc field 1 bytes
uint32_t ancF1Offset; // anc field 1 frame offset
void* pAncF2UserVa; // anc field 2 user buffer
uint32_t ancF2Frame; // anc field 2 frame
uint32_t ancF2NumBytes; // number of anc field 2 bytes
uint32_t ancF2Offset; // anc field 2 frame offset
} AUTO_DMA_PARAMS, *PAUTO_DMA_PARAMS;
// STUBS
// Real device drivers and fake devices must implement:
Ntv2Status AutoDmaTransfer(void* pContext, PAUTO_DMA_PARAMS pDmaParams);
int64_t AutoGetAudioClock(void* pContext);
bool AutoBoardCanDoP2P(void* pContext); // P2P-related
uint64_t AutoGetFrameAperturePhysicalAddress(void* pContext); // P2P only
uint32_t AutoGetFrameApertureBaseSize(void* pContext); // P2P only
void AutoWriteFrameApertureOffset(void* pContext, uint32_t value); // P2P only
uint64_t AutoGetMessageAddress(void* pContext, NTV2Channel channel); // P2P only
#endif // NTV2AUTODMA_H

View File

@ -1,189 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2commonreg.h
// Purpose: HDMI version 4 common register functions
//
///////////////////////////////////////////////////////////////
#ifndef NTV2HDMI4REG_HEADER
#define NTV2HDMI4REG_HEADER
#include "ntv2system.h"
#include "ajatypes.h"
#define NTV2_EXPAND(x) x
#define NTV2_REG_ARGS(a1, a2, a3, a4, a5, a6, a7, a8, aN, ...) aN
#define NTV2_REG(reg, ...) \
static const uint32_t reg[] = { NTV2_EXPAND(NTV2_REG_ARGS(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1)), __VA_ARGS__ }
#define NTV2_FLD(field, size, shift) \
static const uint32_t field = (((size) << 16) | (shift))
#define NTV2_CON(con, value) enum { con = (value) }
#define NTV2_REG_COUNT(reg) (reg[0])
#define NTV2_REG_NUM(reg, index) (((index) < NTV2_REG_COUNT(reg))? reg[(index) + 1] : 0)
#define NTV2_FLD_SIZE(field) ((field) >> 16)
#define NTV2_FLD_SHIFT(field) ((field) & 0xffff)
#define NTV2_FLD_MASK(field) ((((uint32_t)0x1 << NTV2_FLD_SIZE(field)) - 1) << NTV2_FLD_SHIFT(field))
#define NTV2_FLD_GET(field, value) ((((uint32_t)value) & NTV2_FLD_MASK(field)) >> NTV2_FLD_SHIFT(field))
#define NTV2_FLD_SET(field, value) ((((uint32_t)value) << NTV2_FLD_SHIFT(field)) & NTV2_FLD_MASK(field))
/* video standard */
NTV2_CON(ntv2_video_standard_1080i, 0);
NTV2_CON(ntv2_video_standard_720p, 1);
NTV2_CON(ntv2_video_standard_525i, 2);
NTV2_CON(ntv2_video_standard_625i, 3);
NTV2_CON(ntv2_video_standard_1080p, 4);
NTV2_CON(ntv2_video_standard_2048x1556, 5);
NTV2_CON(ntv2_video_standard_2048x1080p, 6);
NTV2_CON(ntv2_video_standard_2048x1080i, 7);
NTV2_CON(ntv2_video_standard_3840x2160p, 8);
NTV2_CON(ntv2_video_standard_4096x2160p, 9);
NTV2_CON(ntv2_video_standard_3840_hfr, 10);
NTV2_CON(ntv2_video_standard_4096_hfr, 11);
NTV2_CON(ntv2_video_standard_7680, 12);
NTV2_CON(ntv2_video_standard_8192, 13);
NTV2_CON(ntv2_video_standard_3840i, 14);
NTV2_CON(ntv2_video_standard_4096i, 15);
NTV2_CON(ntv2_video_standard_none, 16);
/* video frame rate */
NTV2_CON(ntv2_frame_rate_none, 0);
NTV2_CON(ntv2_frame_rate_6000, 1);
NTV2_CON(ntv2_frame_rate_5994, 2);
NTV2_CON(ntv2_frame_rate_3000, 3);
NTV2_CON(ntv2_frame_rate_2997, 4);
NTV2_CON(ntv2_frame_rate_2500, 5);
NTV2_CON(ntv2_frame_rate_2400, 6);
NTV2_CON(ntv2_frame_rate_2398, 7);
NTV2_CON(ntv2_frame_rate_5000, 8);
NTV2_CON(ntv2_frame_rate_4800, 9);
NTV2_CON(ntv2_frame_rate_4795, 10);
NTV2_CON(ntv2_frame_rate_12000, 11);
NTV2_CON(ntv2_frame_rate_11988, 12);
NTV2_CON(ntv2_frame_rate_1500, 13);
NTV2_CON(ntv2_frame_rate_1400, 14);
/* color space */
NTV2_CON(ntv2_color_space_yuv422, 0);
NTV2_CON(ntv2_color_space_rgb444, 1);
NTV2_CON(ntv2_color_space_yuv444, 2);
NTV2_CON(ntv2_color_space_yuv420, 3);
NTV2_CON(ntv2_color_space_none, 4);
/* color depth */
NTV2_CON(ntv2_color_depth_8bit, 0);
NTV2_CON(ntv2_color_depth_10bit, 1);
NTV2_CON(ntv2_color_depth_12bit, 2);
NTV2_CON(ntv2_color_depth_none, 3);
/* reference source */
NTV2_CON(ntv2_ref_source_external, 0);
NTV2_CON(ntv2_ref_source_input_1, 1);
NTV2_CON(ntv2_ref_source_input_2, 2);
NTV2_CON(ntv2_ref_source_freerun, 3);
NTV2_CON(ntv2_ref_source_analog, 4);
NTV2_CON(ntv2_ref_source_hdmi, 5);
NTV2_CON(ntv2_ref_source_input_3, 6);
NTV2_CON(ntv2_ref_source_input_4, 7);
NTV2_CON(ntv2_ref_source_input_5, 8);
NTV2_CON(ntv2_ref_source_input_6, 9);
NTV2_CON(ntv2_ref_source_input_7, 10);
NTV2_CON(ntv2_ref_source_input_8, 11);
NTV2_CON(ntv2_ref_source_sfp1_ptp, 12);
NTV2_CON(ntv2_ref_source_sfp1_pcr, 13);
NTV2_CON(ntv2_ref_source_sfp2_ptp, 14);
NTV2_CON(ntv2_ref_source_sfp2_pcr, 15);
/* reference standard */
NTV2_CON(ntv2_ref_standard_unknown, 0);
NTV2_CON(ntv2_ref_standard_525, 1);
NTV2_CON(ntv2_ref_standard_625, 2);
NTV2_CON(ntv2_ref_standard_750, 3);
NTV2_CON(ntv2_ref_standard_1125, 4);
/* aspect ratio */
NTV2_CON(ntv2_aspect_ratio_unknown, 0);
NTV2_CON(ntv2_aspect_ratio_nodata, 1);
NTV2_CON(ntv2_aspect_ratio_4x3, 2);
NTV2_CON(ntv2_aspect_ratio_16x9, 3);
/* colorimetry */
NTV2_CON(ntv2_colorimetry_unknown, 0);
NTV2_CON(ntv2_colorimetry_nodata, 1);
NTV2_CON(ntv2_colorimetry_170m, 2);
NTV2_CON(ntv2_colorimetry_bt709, 3);
NTV2_CON(ntv2_colorimetry_xvycc_601, 4);
NTV2_CON(ntv2_colorimetry_xvycc_709, 5);
NTV2_CON(ntv2_colorimetry_adobe_601, 6);
NTV2_CON(ntv2_colorimetry_adobe_rgb, 7);
NTV2_CON(ntv2_colorimetry_bt2020_cl, 8);
NTV2_CON(ntv2_colorimetry_bt2020, 9);
NTV2_CON(ntv2_colorimetry_dcip3_d65, 10);
/* quantization */
NTV2_CON(ntv2_quantization_unknown, 0);
NTV2_CON(ntv2_quantization_default, 1);
NTV2_CON(ntv2_quantization_limited, 2);
NTV2_CON(ntv2_quantization_full, 3);
/* hdr eotf */
NTV2_CON(ntv2_hdr_eotf_sdr, 0);
NTV2_CON(ntv2_hdr_eotf_hdr, 1);
NTV2_CON(ntv2_hdr_eotf_st2084, 2);
NTV2_CON(ntv2_hdr_eotf_hlg, 3);
/* audio rate */
NTV2_CON(ntv2_audio_rate_48, 0);
NTV2_CON(ntv2_audio_rate_96, 1);
NTV2_CON(ntv2_audio_rate_192, 2);
/* audio format */
NTV2_CON(ntv2_audio_format_lpcm, 0);
NTV2_CON(ntv2_audio_format_dolby, 1);
uint32_t ntv2_reg_read(Ntv2SystemContext* context, const uint32_t *reg, uint32_t index);
void ntv2_reg_write(Ntv2SystemContext* context, const uint32_t *reg, uint32_t index, uint32_t data);
void ntv2_reg_rmw(Ntv2SystemContext* context, const uint32_t *reg, uint32_t index, uint32_t data, uint32_t mask);
uint32_t ntv2_regnum_read(Ntv2SystemContext* context, uint32_t regnum);
void ntv2_regnum_write(Ntv2SystemContext* context, uint32_t regnum, uint32_t data);
void ntv2_regnum_rmw(Ntv2SystemContext* context, uint32_t regnum, uint32_t data, uint32_t mask);
uint32_t ntv2_vreg_read(Ntv2SystemContext* context, const uint32_t *reg, uint32_t index);
void ntv2_vreg_write(Ntv2SystemContext* context, const uint32_t *reg, uint32_t index, uint32_t data);
void ntv2_vreg_rmw(Ntv2SystemContext* context, const uint32_t *reg, uint32_t index, uint32_t data, uint32_t mask);
uint32_t ntv2_vregnum_read(Ntv2SystemContext* context, uint32_t regnum);
void ntv2_vregnum_write(Ntv2SystemContext* context, uint32_t regnum, uint32_t data);
void ntv2_vregnum_rmw(Ntv2SystemContext* context, uint32_t regnum, uint32_t data, uint32_t mask);
const char* ntv2_video_standard_name(uint32_t standard);
const char* ntv2_frame_rate_name(uint32_t rate);
const char* ntv2_color_space_name(uint32_t color_space);
const char* ntv2_color_depth_name(uint32_t color_depth);
const char* ntv2_ref_source_name(uint32_t ref_source);
const char* ntv2_ref_standard_name(uint32_t ref_source);
const char* ntv2_hdr_eotf_name(uint32_t eotf);
const char* ntv2_audio_rate_name(uint32_t rate);
const char* ntv2_audio_format_name(uint32_t format);
uint32_t ntv2_video_standard_width(uint32_t video_standard);
uint32_t ntv2_video_standard_height(uint32_t video_standard);
uint32_t ntv2_video_standard_lines(uint32_t video_standard);
bool ntv2_video_standard_progressive(uint32_t video_standard);
uint32_t ntv2_frame_rate_duration(uint32_t frame_rate);
uint32_t ntv2_frame_rate_scale(uint32_t frame_rate);
uint32_t ntv2_ref_standard_lines(uint32_t ref_lines);
uint32_t ntv2_diff(uint32_t opa, uint32_t opb);
#endif

View File

@ -1,116 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2dispalyid.h
// Purpose: HDMI edid parser
//
///////////////////////////////////////////////////////////////
#ifndef NTV2_DISPLAYID_H
#define NTV2_DISPLAYID_H
#include "ntv2system.h"
enum ntv2_displayid_protocol
{
ntv2_displayid_protocol_unknown,
ntv2_displayid_protocol_dvi, /* no CEA-861 extension (therefore, no audio, RGB only) */
ntv2_displayid_protocol_hdmiv1, /* adds CEA-861 extension rev 1, timing only */
ntv2_displayid_protocol_hdmi, /* adds CEA-861 extension rev >1, audio, YCbCr and DeepColor options */
ntv2_displayid_protocol_size
};
struct ntv2_displayid_video
{
enum ntv2_displayid_protocol protocol; /* DVI vs HDMI */
bool underscan; /* true if sink device underscans IT video formats by default */
bool ycbcr_444; /* true if sink device supports YCbCr 4:4:4 in addition to RGB */
bool ycbcr_422; /* true if sink device supports YCbCr 4:2:2 in addition to RGB */
bool ycbcr_420; /* true if sink device supports YCbCr 4:2:0 in addition to RGB */
bool dc_48bit; /* true if sink device supports 48-bit (16 bits per component) RGB */
bool dc_36bit; /* true if sink device supports 36-bit (12 bits per component) RGB */
bool dc_30bit; /* true if sink device supports 30-bit (10 bits per component) RGB */
bool dc_y444; /* true if the 48-bit, 36-bit, and 30-bit flags ALSO apply to YCbCr inputs */
uint32_t max_clock_freq; /* maximum TMDS clock frequency supported by sink device (MHz / 0 = unknown) */
bool graphics; /* true if sink device has special graphics processing */
bool photo; /* true if sink device has special photo processing */
bool cinema; /* true if sink device has special cinema processing */
bool game; /* true if sink device has special game processing */
uint32_t video_latency; /* video latency (mSec / 0 = unknown) */
uint32_t audio_latency; /* audio latency (mSec / 0 = unknown) */
uint32_t int_video_latency; /* interlaced video latency (mSec / 0 = unknown) */
uint32_t int_audio_latency; /* interlaced audio latency (mSec / 0 = unknown) */
bool quad_30; /* true if sink device supports 1920x2160 29.97/30 */
bool quad_25; /* true if sink device supports 1920x2160 25 */
bool quad_24; /* true if sink device supports 1920x2160 23.98/24 */
bool four_24; /* true if sink device supports 2048x2160 24 */
uint32_t max_tmds_csc; /* maximum TMDS character rate supported above 340 Mcsc (0 = not supported) */
bool osd_disparity; /* true if sink supports receiving 3d osd displarity in the hf-vsif */
bool dual_view; /* true if sink supports 3d dual view */
bool indep_view; /* true if sink supports 3d independent view */
bool lte_scramble; /* true if sink supports scrambling below 340 Mcsc */
bool rr_capable; /* true if sink supports scdc read request */
bool scdc_present; /* true if sink supports scdc */
bool dc_30bit_420; /* true if sink supports 30 bit 420 */
bool dc_36bit_420; /* true if sink supports 36 bit 420 */
bool dc_48bit_420; /* true if sink supports 48 bit 420 */
};
struct ntv2_displayid_audio
{
enum ntv2_displayid_protocol protocol; /* DVI vs HDMI */
bool basic_audio; /* true if sink device supports basic audio */
uint32_t num_lpcm_channels; /* max number of channels from LPCM Short Audio Descriptors (if present) */
};
/**
* HDMI EDID register callback function
*
* Callback to obtain EDID register data.
*
* @param[in] pContext Callback context
* @param[in] blockNum Register block number
* @param[in] regNum Register number within the block
* @param[out] regVal Register value
* @return AJA_STATUS_SUCCESS if register read works
*/
typedef bool ntv2_displayid_callback(void* context, uint8_t block_num, uint8_t reg_num, uint8_t* reg_val);
struct ntv2_displayid
{
struct ntv2_displayid_video video;
struct ntv2_displayid_audio audio;
ntv2_displayid_callback* callback;
void* context;
};
#ifdef __cplusplus
extern "C"
{
#endif
void ntv2_displayid_config(struct ntv2_displayid* ntv2_did, ntv2_displayid_callback* callback, void* context);
void ntv2_displayid_clear(struct ntv2_displayid* ntv2_did);
bool ntv2_displayid_update(struct ntv2_displayid* ntv2_did);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,61 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2genlock.h
// Purpose: Genlock monitor
//
///////////////////////////////////////////////////////////////
#ifndef NTV2GENLOCK_HEADER
#define NTV2GENLOCK_HEADER
#include "ntv2system.h"
#define NTV2_GENLOCK_STRING_SIZE 80
enum ntv2_genlock_mode {
ntv2_genlock_mode_unknown,
ntv2_genlock_mode_zero,
ntv2_genlock_mode_ntsc_27mhz,
ntv2_genlock_mode_size
};
struct ntv2_genlock {
int index;
char name[NTV2_GENLOCK_STRING_SIZE];
Ntv2SystemContext* system_context;
Ntv2SpinLock state_lock;
Ntv2Thread monitor_task;
bool monitor_enable;
Ntv2Event monitor_event;
uint32_t ref_source;
uint32_t gen_source;
bool ref_locked;
bool gen_locked;
uint32_t ref_lines;
uint32_t ref_rate;
uint32_t gen_lines;
uint32_t gen_rate;
uint8_t page_address;
};
struct ntv2_genlock *ntv2_genlock_open(Ntv2SystemContext* sys_con,
const char *name, int index);
void ntv2_genlock_close(struct ntv2_genlock *ntv2_gen);
Ntv2Status ntv2_genlock_configure(struct ntv2_genlock *ntv2_gen);
Ntv2Status ntv2_genlock_enable(struct ntv2_genlock *ntv2_gen);
Ntv2Status ntv2_genlock_disable(struct ntv2_genlock *ntv2_gen);
Ntv2Status ntv2_genlock_program(struct ntv2_genlock *ntv2_gen,
enum ntv2_genlock_mode mode);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2hdmiedid.h
// Purpose: HDMI edid repository
//
///////////////////////////////////////////////////////////////
#ifndef NTV2HDMIEDID_HEADER
#define NTV2HDMIEDID_HEADER
#include "ntv2system.h"
#define NTV2_HDMIEDID_SIZE 256
#define NTV2_HDMIEDID_STRING_SIZE 80
enum ntv2_edid_type {
ntv2_edid_type_unknown,
ntv2_edid_type_konahdmi_20,
ntv2_edid_type_konahdmi_13,
ntv2_edid_type_corvidhbr,
ntv2_edid_type_io4k,
ntv2_edid_type_io4kplus,
ntv2_edid_type_iox3,
ntv2_edid_type_size
};
struct ntv2_hdmiedid {
int index;
char name[NTV2_HDMIEDID_STRING_SIZE];
Ntv2SystemContext* system_context;
enum ntv2_edid_type edid_type;
int port_index;
uint8_t edid_data[NTV2_HDMIEDID_SIZE];
uint32_t edid_size;
};
struct ntv2_hdmiedid *ntv2_hdmiedid_open(Ntv2SystemContext* sys_con,
const char *name, int index);
void ntv2_hdmiedid_close(struct ntv2_hdmiedid *ntv2_hed);
Ntv2Status ntv2_hdmiedid_configure(struct ntv2_hdmiedid *ntv2_hed,
enum ntv2_edid_type type,
int port_index);
uint8_t *ntv2_hdmi_get_edid_data(struct ntv2_hdmiedid *ntv2_hed);
uint32_t ntv2_hdmi_get_edid_size(struct ntv2_hdmiedid *ntv2_hed);
#endif

View File

@ -1,111 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// NTV2 Linux v2.6 Device Driver for AJA devices.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2hdmiin.h
// Purpose: Header Kona2/Xena2 specific functions.
//
///////////////////////////////////////////////////////////////
#ifndef NTV2HDMIIN_HEADER
#define NTV2HDMIIN_HEADER
#include "ntv2system.h"
#include "ntv2hdmiedid.h"
#define NTV2_STRING_SIZE 80
struct ntv2_hdmiin_format {
uint32_t video_standard;
uint32_t frame_rate;
uint32_t frame_flags;
uint32_t pixel_flags;
};
struct ntv2_hdmiin {
int index;
char name[NTV2_STRING_SIZE];
Ntv2SystemContext* system_context;
struct ntv2_hdmiedid* edid;
Ntv2SpinLock state_lock;
Ntv2Thread monitor_task;
bool monitor_enable;
Ntv2Event monitor_event;
uint8_t i2c_device;
uint8_t i2c_hpa_default;
uint8_t i2c_color_default;
uint32_t i2c_reset_count;
uint32_t lock_error_count;
struct ntv2_hdmiin_format dvi_format;
struct ntv2_hdmiin_format hdmi_format;
struct ntv2_hdmiin_format video_format;
uint32_t relock_reports;
bool hdmi_mode;
bool hdcp_mode;
bool derep_mode;
bool uhd_mode;
bool interlaced_mode;
bool pixel_double_mode;
bool yuv_mode;
bool deep_color_10bit;
bool deep_color_12bit;
bool prefer_yuv;
bool prefer_rgb;
uint32_t horizontal_tol;
uint32_t vertical_tol;
bool cable_present;
bool clock_present;
bool input_locked;
bool avi_packet_present;
bool vsi_packet_present;
uint32_t h_active_pixels;
uint32_t h_total_pixels;
uint32_t h_front_porch_pixels;
uint32_t h_sync_pixels;
uint32_t h_back_porch_pixels;
uint32_t v_total_lines0;
uint32_t v_total_lines1;
uint32_t v_active_lines0;
uint32_t v_active_lines1;
uint32_t v_sync_lines0;
uint32_t v_sync_lines1;
uint32_t v_front_porch_lines0;
uint32_t v_front_porch_lines1;
uint32_t v_back_porch_lines0;
uint32_t v_back_porch_lines1;
uint32_t v_frequency;
uint32_t tmds_frequency;
uint32_t color_space;
uint32_t color_depth;
uint32_t aspect_ratio;
uint32_t colorimetry;
uint32_t quantization;
};
struct ntv2_hdmiin *ntv2_hdmiin_open(Ntv2SystemContext* sys_con,
const char *name, int index);
void ntv2_hdmiin_close(struct ntv2_hdmiin *ntv2_hin);
Ntv2Status ntv2_hdmiin_configure(struct ntv2_hdmiin *ntv2_hin,
enum ntv2_edid_type edid_type, int port_index);
Ntv2Status ntv2_hdmiin_enable(struct ntv2_hdmiin *ntv2_hin);
Ntv2Status ntv2_hdmiin_disable(struct ntv2_hdmiin *ntv2_hin);
void ntv2_hdmiin_set_active(struct ntv2_hdmiin *ntv2_hin, bool active);
#endif

View File

@ -1,75 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2hdmiin4.h
// Purpose: HDMI input monitor version 4
//
///////////////////////////////////////////////////////////////
#ifndef NTV2HDMIIN4_HEADER
#define NTV2HDMIIN4_HEADER
#include "ntv2system.h"
#include "ntv2hdmiedid.h"
#define NTV2_HDMIIN4_STRING_SIZE 80
struct ntv2_hdmiin4 {
int index;
char name[NTV2_HDMIIN4_STRING_SIZE];
Ntv2SystemContext* system_context;
struct ntv2_hdmiedid* edid;
Ntv2SpinLock state_lock;
Ntv2Thread monitor_task;
bool monitor_enable;
Ntv2Event monitor_event;
uint32_t horizontal_tol;
uint32_t vertical_tol;
uint32_t video_control;
uint32_t video_detect0;
uint32_t video_detect1;
uint32_t video_detect2;
uint32_t video_detect3;
uint32_t video_detect4;
uint32_t video_detect5;
uint32_t video_detect6;
uint32_t video_detect7;
uint32_t tmds_rate;
bool input_locked;
bool hdmi_mode;
uint32_t video_standard;
uint32_t frame_rate;
uint32_t color_space;
uint32_t color_depth;
uint32_t aspect_ratio;
uint32_t colorimetry;
uint32_t quantization;
bool audio_swap;
bool audio_resample;
uint32_t format_clock_count;
uint32_t format_raster_count;
};
struct ntv2_hdmiin4 *ntv2_hdmiin4_open(Ntv2SystemContext* sys_con,
const char *name, int index);
void ntv2_hdmiin4_close(struct ntv2_hdmiin4 *ntv2_hin);
Ntv2Status ntv2_hdmiin4_configure(struct ntv2_hdmiin4 *ntv2_hin,
enum ntv2_edid_type edid_type,
int port_index);
Ntv2Status ntv2_hdmiin4_enable(struct ntv2_hdmiin4 *ntv2_hin);
Ntv2Status ntv2_hdmiin4_disable(struct ntv2_hdmiin4 *ntv2_hin);
#endif

View File

@ -1,113 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2hdmiout4.h
// Purpose: HDMI output monitor version 4
//
///////////////////////////////////////////////////////////////
#ifndef NTV2HDMIOUT4_HEADER
#define NTV2HDMIOUT4_HEADER
#include "ntv2system.h"
#include "ntv2displayid.h"
#define NTV2_HDMIOUT4_STRING_SIZE 80
struct ntv2_hdmiout4 {
int index;
char name[NTV2_HDMIOUT4_STRING_SIZE];
Ntv2SystemContext* system_context;
Ntv2SpinLock state_lock;
Ntv2Thread monitor_task;
bool monitor_enable;
Ntv2Event monitor_event;
struct ntv2_displayid edid;
uint32_t hot_plug_count;
uint32_t hdmi_config;
uint32_t hdmi_source;
uint32_t hdmi_control;
uint32_t hdmi_hdr;
uint32_t hdr_green_primary;
uint32_t hdr_blue_primary;
uint32_t hdr_red_primary;
uint32_t hdr_white_point;
uint32_t hdr_master_luminance;
uint32_t hdr_light_level;
uint32_t hdr_control;
bool hdmi_mode;
bool scdc_mode;
bool scdc_active;
bool output_enable;
bool sink_present;
bool force_hpd;
bool force_config;
bool prefer_420;
bool hdr_enable;
bool dolby_vision;
bool crop_enable;
bool full_range;
bool sd_wide;
uint32_t video_standard;
uint32_t frame_rate;
uint32_t color_space;
uint32_t color_depth;
uint32_t audio_input;
bool audio_upper;
bool audio_swap;
uint32_t audio_channels;
uint32_t audio_select;
uint32_t audio_rate;
uint32_t audio_format;
uint8_t avi_vic;
uint8_t hdmi_vic;
uint32_t scdc_sink_scramble;
uint32_t scdc_sink_clock;
uint32_t scdc_sink_valid_ch0;
uint32_t scdc_sink_valid_ch1;
uint32_t scdc_sink_valid_ch2;
uint32_t scdc_sink_error_ch0;
uint32_t scdc_sink_error_ch1;
uint32_t scdc_sink_error_ch2;
char* vendor_name;
char* product_name;
};
#ifdef __cplusplus
extern "C"
{
#endif
struct ntv2_hdmiout4 *ntv2_hdmiout4_open(Ntv2SystemContext* sys_con,
const char *name, int index);
void ntv2_hdmiout4_close(struct ntv2_hdmiout4 *ntv2_hout);
Ntv2Status ntv2_hdmiout4_configure(struct ntv2_hdmiout4 *ntv2_hout);
Ntv2Status ntv2_hdmiout4_enable(struct ntv2_hdmiout4 *ntv2_hout);
Ntv2Status ntv2_hdmiout4_disable(struct ntv2_hdmiout4 *ntv2_hout);
Ntv2Status ntv2_hdmiout4_write_info_frame(struct ntv2_hdmiout4 *ntv2_hout,
uint32_t size,
uint8_t *data);
Ntv2Status ntv2_hdmiout4_clear_info_frames(struct ntv2_hdmiout4 *ntv2_hout);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,313 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2hin4reg.h
// Purpose: HDMI input monitor version 4
//
///////////////////////////////////////////////////////////////
#ifndef NTV2_HIN4REG_H
#define NTV2_HIN4REG_H
#include "ntv2commonreg.h"
#include "ntv2virtualregisters.h"
/* hdmi input status */
NTV2_REG(ntv2_reg_hdmiin_input_status, 126, 0x1d15, 0x2515); /* hdmi input status register */
NTV2_FLD(ntv2_fld_hdmiin_locked, 1, 0);
NTV2_FLD(ntv2_fld_hdmiin_stable, 1, 1);
NTV2_FLD(ntv2_fld_hdmiin_rgb, 1, 2);
NTV2_FLD(ntv2_fld_hdmiin_deep_color, 1, 3);
NTV2_FLD(ntv2_fld_hdmiin_video_code, 6, 4); /* ntv2 video standard v2 */
NTV2_FLD(ntv2_fld_hdmiin_lhi_ycbcr_mode, 1, 10);
NTV2_FLD(ntv2_fld_hdmiin_lhi_10bit_mode, 1, 11);
NTV2_FLD(ntv2_fld_hdmiin_audio_2ch, 1, 12); /* 2 audio channels (vs 8) */
NTV2_FLD(ntv2_fld_hdmiin_progressive, 1, 13);
NTV2_FLD(ntv2_fld_hdmiin_video_sd, 1, 14); /* video pixel clock sd (not hd or 3g) */
NTV2_FLD(ntv2_fld_hdmiin_video_74_25, 1, 15); /* not used */
NTV2_FLD(ntv2_fld_hdmiin_audio_rate, 4, 16);
NTV2_FLD(ntv2_fld_hdmiin_audio_word_length, 4, 20);
NTV2_FLD(ntv2_fld_hdmiin_video_format, 3, 24); /* really ntv2 standard */
NTV2_FLD(ntv2_fld_hdmiin_dvi, 1, 27); /* input dvi (vs hdmi) */
NTV2_FLD(ntv2_fld_hdmiin_video_rate, 4, 28); /* ntv2 video rate */
/* hdmi control */
NTV2_REG(ntv2_reg_hdmi_control, 127, 0x1d16, 0x2516); /* hdmi audio status register */
NTV2_FLD(ntv2_fld_hdmiout_force_config, 1, 1); /* force output config (ignore edid) */
NTV2_FLD(ntv2_fld_hdmiin_audio_pair, 2, 2); /* hdmi input audio pair select */
NTV2_FLD(ntv2_fld_hdmiin_rate_convert_enable, 1, 4); /* hdmi input audio sample rate converter enable */
NTV2_FLD(ntv2_fld_hdmiin_channel34_swap_disable, 1, 5); /* hdmi input audio channel 3/4 swap disable */
NTV2_FLD(ntv2_fld_hdmiout_channel34_swap_disable, 1, 6); /* hdmi output audio channel 3/4 swap disable */
NTV2_FLD(ntv2_fld_hdmiout_prefer_420, 1, 7); /* hdmi output prefer 4K/UHD 420 */
NTV2_FLD(ntv2_fld_hdmiout_audio_format, 2, 8); /* hdmi output audio format */
NTV2_FLD(ntv2_fld_hdmiin_color_depth, 2, 12); /* hdmi input bit depth */
NTV2_FLD(ntv2_fld_hdmiin_color_space, 2, 14); /* hdmi input color space */
NTV2_FLD(ntv2_fld_hdmi_polarity, 4, 16); /* hdmi polarity? */
NTV2_FLD(ntv2_fld_hdmiout_source_select, 4, 20); /* output audio source select */
NTV2_FLD(ntv2_fld_hdmiout_crop_enable, 1, 24); /* crop 2k -> hd 4k -> uhd */
NTV2_FLD(ntv2_fld_hdmiout_force_hpd, 1, 25); /* force hpd */
NTV2_FLD(ntv2_fld_hdmiout_deep_12bit, 1, 26); /* deep color 12 bit */
NTV2_FLD(ntv2_fld_hdmi_debug, 1, 27); /* debug output enable */
NTV2_FLD(ntv2_fld_hdmi_disable_update, 1, 28); /* disable update loop */
NTV2_FLD(ntv2_fld_hdmiout_channel_select, 2, 29); /* output audio channel select */
NTV2_FLD(ntv2_fld_hdmi_protocol, 1, 30); /* hdmi protocol? */
NTV2_FLD(ntv2_fld_hdmiin_full_range, 1, 31); /* hdmi input quantization full range */
NTV2_REG(ntv2_reg_hdmiin4_auxdata, 0x1c00, 0x1c00, 0x2400); /* hdmi aux data */
NTV2_CON(ntv2_con_auxdata_size, 8); /* aux data register length */
NTV2_CON(ntv2_con_auxdata_count, 32); /* number of aux data slots */
NTV2_CON(ntv2_con_header_type_nodata, 0x00); /* aux header type */
NTV2_CON(ntv2_con_header_type_vendor_specific, 0x81);
NTV2_CON(ntv2_con_header_type_video_info, 0x82);
NTV2_CON(ntv2_con_header_type_source_product, 0x83);
NTV2_CON(ntv2_con_header_type_audio_info, 0x84);
NTV2_CON(ntv2_con_header_type_drm_info, 0x87);
NTV2_REG(ntv2_reg_hdmiin4_videocontrol, 0x1d00, 0x1d00, 0x2500); /* hdmi control/status */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_scrambledetect, 1, 0); /* scdc 2.0 scramble detect */
NTV2_CON(ntv2_con_hdmiin4_scrambledetect_false, 0x0); /* scramble not detected */
NTV2_CON(ntv2_con_hdmiin4_scrambledetect_true, 0x1); /* scramble detected */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_descramblemode, 1, 1); /* scdc 2.0 descamble mode */
NTV2_CON(ntv2_con_hdmiin4_descramblemode_disable, 0x0); /* descramble disable */
NTV2_CON(ntv2_con_hdmiin4_descramblemode_enable, 0x1); /* descramble enable */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_scdcratedetect, 1, 2); /* scdc hdmi receive > 3.4 gbps */
NTV2_CON(ntv2_con_hdmiin4_scdcratedetect_low, 0x0); /* scdc hdmi receive rate < 3.4 gbps */
NTV2_CON(ntv2_con_hdmiin4_scdcratedetect_high, 0x1); /* scdc hdmi receive rate > 3.4 gbps */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_scdcratemode, 1, 3); /* scdc hdmi mode > 3.4 gbps */
NTV2_CON(ntv2_con_hdmiin4_scdcratemode_low, 0x0); /* scdc hdmi mode rate < 3.4 gbps */
NTV2_CON(ntv2_con_hdmiin4_scdcratemode_high, 0x1); /* scdc hdmi mode rate > 3.4 gbps */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_420mode, 1, 5); /* 420 mode */
NTV2_CON(ntv2_con_hdmiin4_420mode_disable, 0x0); /* 420 disable */
NTV2_CON(ntv2_con_hdmiin4_420mode_enable, 0x1); /* 420 enable */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_pixelsperclock, 3, 8); /* pixels per clock */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_hsyncdivide, 1, 12); /* hsync divide mode */
NTV2_CON(ntv2_con_hdmiin4_hsyncdivide_none, 0x0); /* no hsync divide */
NTV2_CON(ntv2_con_hdmiin4_hsyncdivide_2, 0x1); /* divide hsync by 2 */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_audioswapmode, 1, 13); /* audio channel 34 swap */
NTV2_CON(ntv2_con_hdmiin4_audioswapmode_enable, 0x0); /* swap */
NTV2_CON(ntv2_con_hdmiin4_audioswapmode_disable, 0x1); /* no swap */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_audioresamplemode, 1, 14); /* audio resample mode */
NTV2_CON(ntv2_con_hdmiin4_audioresamplemode_enable, 0x0); /* enable */
NTV2_CON(ntv2_con_hdmiin4_audioresamplemode_disable, 0x1); /* disable */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_linerate, 5, 16); /* line rate */
NTV2_CON(ntv2_con_hdmiin4_linerate_none, 0x0); /* undetected */
NTV2_CON(ntv2_con_hdmiin4_linerate_5940mhz, 0x1); /* 5940 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_2970mhz, 0x2); /* 2970 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_1485mhz, 0x3); /* 1485 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_742mhz, 0x4); /* 742 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_270mhz, 0x5); /* 270 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_3712mhz, 0x6); /* 3712 mhz 10 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_1856mhz, 0x7); /* 1856 mhz 10 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_928mhz, 0x8); /* 928 mhz 10 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_337mhz, 0x9); /* 337 mhz 10 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_4455mhz, 0xa); /* 4455 mhz 12 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_2227mhz, 0xb); /* 2227 mhz 12 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_1113mhz, 0xc); /* 1113 mhz 12 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_405mhz, 0xd); /* 405 mhz 12 bit */
NTV2_CON(ntv2_con_hdmiin4_linerate_556mhz, 0xe); /* 556 mhz */
NTV2_CON(ntv2_con_hdmiin4_linerate_540mhz, 0xf); /* 540 mhz */
NTV2_CON(ntv2_con_hdmiin4_linerate_250mhz, 0x10); /* 250 mhz */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_deserializerlock, 3, 24); /* deserializers lock state */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_inputlock, 1, 27); /* input lock state */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_hdmi5vdetect, 1, 28); /* hdmi detect state */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_hotplugmode, 1, 29); /* hot plug mode */
NTV2_CON(ntv2_con_hdmiin4_hotplugmode_disable, 0x0); /* disable edid */
NTV2_CON(ntv2_con_hdmiin4_hotplugmode_enable, 0x1); /* enable edid */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_resetdone, 1, 30); /* rx reset done */
NTV2_FLD(ntv2_fld_hdmiin4_videocontrol_reset, 1, 31); /* rx reset */
NTV2_REG(ntv2_reg_hdmiin4_videodetect0, 0x1d01, 0x1d01, 0x2501); /* video detect 0 register */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect0_colordepth, 2, 0); /* color depth */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect0_colorspace, 2, 2); /* color space */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect0_scanmode, 1, 4); /* video scan mode */
NTV2_CON(ntv2_con_hdmiin4_scanmode_interlaced, 0x0); /* interlaced */
NTV2_CON(ntv2_con_hdmiin4_scanmode_progressive, 0x1); /* progressive */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect0_interfacemode, 1, 5); /* interface mode */
NTV2_CON(ntv2_con_hdmiin4_interfacemode_hdmi, 0x0); /* hdmi */
NTV2_CON(ntv2_con_hdmiin4_interfacemode_dvi, 0x1); /* dvi */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect0_syncpolarity, 1, 6); /* sync polarity */
NTV2_CON(ntv2_con_hdmiin4_syncpolarity_activelow, 0x0); /* active low */
NTV2_CON(ntv2_con_hdmiin4_syncpolarity_activehigh, 0x1); /* active high */
NTV2_REG(ntv2_reg_hdmiin4_videodetect1, 0x1d02, 0x1d02, 0x2502); /* video detect 1 register */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect1_hsyncstart, 16, 0); /* horizontal sync start */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect1_hsyncend, 16, 16); /* horizontal sync end */
NTV2_REG(ntv2_reg_hdmiin4_videodetect2, 0x1d03, 0x1d03, 0x2503); /* video detect 2 register */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect2_hdestart, 16, 0); /* horizontal de start */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect2_htotal, 16, 16); /* horizontal total */
NTV2_REG(ntv2_reg_hdmiin4_videodetect3, 0x1d04, 0x1d04, 0x2504); /* video detect 3 register */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect3_vtransf1, 16, 0); /* vertical transistion field 1 */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect3_vtransf2, 16, 16); /* vertical transistion field 2 */
NTV2_REG(ntv2_reg_hdmiin4_videodetect4, 0x1d05, 0x1d05, 0x2505); /* video detect 4 register */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect4_vsyncstartf1, 16, 0); /* vertical sync start field 1 */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect4_vsyncendf1, 16, 16); /* virtical sync end field 1 */
NTV2_REG(ntv2_reg_hdmiin4_videodetect5, 0x1d06, 0x1d06, 0x2506); /* video detect 5 register */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect5_vdestartf1, 16, 0); /* vertical de start field 1 */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect5_vdestartf2, 16, 16); /* vertical de start field 2 */
NTV2_REG(ntv2_reg_hdmiin4_videodetect6, 0x1d07, 0x1d07, 0x2507); /* video detect 6 register */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect6_vsyncstartf2, 16, 0); /* vertical sync start field 2 */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect6_vsyncendf2, 16, 16); /* virtical sync end field 2 */
NTV2_REG(ntv2_reg_hdmiin4_videodetect7, 0x1d08, 0x1d08, 0x2508); /* video detect 7 register */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect7_vtotalf1, 16, 0); /* vertical total field 1 */
NTV2_FLD(ntv2_fld_hdmiin4_videodetect7_vtotalf2, 16, 16); /* vertical total field 2 */
NTV2_REG(ntv2_reg_hdmiin4_auxcontrol, 0x1d09, 0x1d09, 0x2509); /* video detect 9 register */
NTV2_FLD(ntv2_fld_hdmiin4_auxcontrol_auxactive, 1, 0); /* aux data active bank */
NTV2_CON(ntv2_con_hdmiin4_auxactive_bank0, 0x0); /* bank 0 */
NTV2_CON(ntv2_con_hdmiin4_auxactive_bank1, 0x1); /* bank 1 */
NTV2_FLD(ntv2_fld_hdmiin4_auxcontrol_auxread, 1, 1); /* aux data read bank */
NTV2_CON(ntv2_con_hdmiin4_auxread_bank0, 0x0); /* bank 0 */
NTV2_CON(ntv2_con_hdmiin4_auxread_bank1, 0x1); /* bank 1 */
NTV2_FLD(ntv2_fld_hdmiin4_auxcontrol_auxwrite, 1, 2); /* aux data write bank */
NTV2_CON(ntv2_con_hdmiin4_auxwrite_bank0, 0x0); /* bank 0 */
NTV2_CON(ntv2_con_hdmiin4_auxwrite_bank1, 0x1); /* bank 1 */
NTV2_FLD(ntv2_fld_hdmiin4_auxcontrol_bank0count, 8, 8); /* aux bank 0 packet count */
NTV2_FLD(ntv2_fld_hdmiin4_auxcontrol_bank1count, 8, 16); /* aux bank 1 packet count */
NTV2_REG(ntv2_reg_hdmiin4_receiverstatus, 0x1d0a, 0x1d0a, 0x250a); /* rx status */
NTV2_FLD(ntv2_fld_hdmiin4_receiverstatus_errorcount, 24, 0); /* rx error count */
NTV2_REG(ntv2_reg_hdmiin4_auxpacketignore0, 0x1d0b, 0x1d0b, 0x250b); /* aux packet ignore 0 */
NTV2_REG(ntv2_reg_hdmiin4_auxpacketignore1, 0x1d0c, 0x1d0c, 0x250c); /* aux packet ignore 1 */
NTV2_REG(ntv2_reg_hdmiin4_auxpacketignore2, 0x1d0d, 0x1d0d, 0x250d); /* aux packet ignore 2 */
NTV2_REG(ntv2_reg_hdmiin4_auxpacketignore3, 0x1d0e, 0x1d0e, 0x250e); /* aux packet ignore 3 */
NTV2_REG(ntv2_reg_hdmiin4_redrivercontrol, 0x1d0f, 0x1d0f, 0x250f); /* hdmi redriver control */
NTV2_FLD(ntv2_fld_hdmiin4_redrivercontrol_power, 1, 0); /* power */
NTV2_CON(ntv2_con_hdmiin4_power_disable, 0x0); /* power disable */
NTV2_CON(ntv2_con_hdmiin4_power_enable, 0x1); /* power enable */
NTV2_FLD(ntv2_fld_hdmiin4_redrivercontrol_pinmode, 1, 1); /* pin mode */
NTV2_CON(ntv2_con_hdmiin4_pinmode_disable, 0x0); /* pin disable */
NTV2_CON(ntv2_con_hdmiin4_pinmode_enable, 0x1); /* pin enable */
NTV2_FLD(ntv2_fld_hdmiin4_redrivercontrol_vodrange, 1, 2); /* differential voltage range */
NTV2_CON(ntv2_con_hdmiin4_vodrange_low, 0x0); /* voltage swing low */
NTV2_CON(ntv2_con_hdmiin4_vodrange_high, 0x1); /* voltage swing high */
NTV2_FLD(ntv2_fld_hdmiin4_redrivercontrol_deemphasis, 2, 4); /* deemphasis */
NTV2_CON(ntv2_con_hdmiin4_deemphasis_0d0db, 0x0); /* 0 db */
NTV2_CON(ntv2_con_hdmiin4_deemphasis_3d5db, 0x1); /* 3.5 db */
NTV2_CON(ntv2_con_hdmiin4_deemphasis_6d0db, 0x2); /* 6 db */
NTV2_CON(ntv2_con_hdmiin4_deemphasis_9d5db, 0x3); /* 9.5 db */
NTV2_FLD(ntv2_fld_hdmiin4_redrivercontrol_preemphasis, 2, 8); /* preemphasis */
NTV2_CON(ntv2_con_hdmiin4_preemphasis_0d0db, 0x0); /* 0 db */
NTV2_CON(ntv2_con_hdmiin4_preemphasis_1d6db, 0x1); /* 1.6 db */
NTV2_CON(ntv2_con_hdmiin4_preemphasis_3d5db, 0x2); /* 3.5 db */
NTV2_CON(ntv2_con_hdmiin4_preemphasis_6d0db, 0x3); /* 6 db */
NTV2_FLD(ntv2_fld_hdmiin4_redrivercontrol_boost, 4, 12); /* boost */
NTV2_CON(ntv2_con_hdmiin4_boost_00d25db, 0x0); /* 0.25 db */
NTV2_CON(ntv2_con_hdmiin4_boost_00d80db, 0x1); /* 0.80 db */
NTV2_CON(ntv2_con_hdmiin4_boost_01d10db, 0x2); /* 1.1 db */
NTV2_CON(ntv2_con_hdmiin4_boost_02d20db, 0x3); /* 2.2 db */
NTV2_CON(ntv2_con_hdmiin4_boost_04d10db, 0x4); /* 4.1 db */
NTV2_CON(ntv2_con_hdmiin4_boost_07d10db, 0x5); /* 7.1 db */
NTV2_CON(ntv2_con_hdmiin4_boost_09d00db, 0x6); /* 9.0 db */
NTV2_CON(ntv2_con_hdmiin4_boost_10d30db, 0x7); /* 10.3 db */
NTV2_CON(ntv2_con_hdmiin4_boost_11d80db, 0x8); /* 11.8 db */
NTV2_CON(ntv2_con_hdmiin4_boost_13d90db, 0x9); /* 13.9 db */
NTV2_CON(ntv2_con_hdmiin4_boost_15d30db, 0xa); /* 15.3 db */
NTV2_CON(ntv2_con_hdmiin4_boost_16d90db, 0xb); /* 16.9 db */
NTV2_CON(ntv2_con_hdmiin4_boost_17d90db, 0xc); /* 17.9 db */
NTV2_CON(ntv2_con_hdmiin4_boost_19d20db, 0xd); /* 19.2 db */
NTV2_CON(ntv2_con_hdmiin4_boost_20d50db, 0xe); /* 20.5 db */
NTV2_CON(ntv2_con_hdmiin4_boost_22d20db, 0xf); /* 22.2 db */
NTV2_REG(ntv2_reg_hdmiin4_refclockfrequency, 0x1d10, 0x1d10, 0x2510); /* reference clock frequency */
NTV2_REG(ntv2_reg_hdmiin4_tmdsclockfrequency, 0x1d11, 0x1d11, 0x2511); /* tmds clock frequency */
NTV2_REG(ntv2_reg_hdmiin4_rxclockfrequency, 0x1d12, 0x1d12, 0x2512); /* rx clock frequency */
NTV2_REG(ntv2_reg_hdmiin4_rxoversampling, 0x1d13, 0x1d13, 0x2513); /* rx oversampling */
NTV2_FLD(ntv2_fld_hdmiin4_rxoversampling_ratiofraction, 10, 0); /* oversampling ratio fraction */
NTV2_FLD(ntv2_fld_hdmiin4_rxoversampling_ratiointeger, 4, 10); /* oversampling ratio integer */
NTV2_FLD(ntv2_fld_hdmiin4_rxoversampling_mode, 2, 16); /* oversampling mode */
NTV2_CON(ntv2_con_hdmiin4_mode_none, 0x0); /* no oversampling */
NTV2_CON(ntv2_con_hdmiin4_mode_asynchronous, 0x1); /* asynchronous oversampling */
NTV2_CON(ntv2_con_hdmiin4_mode_synchronous, 0x2); /* synchronous oversampling */
NTV2_REG(ntv2_kona_reg_hdmiin4_edid, 0x1d1d, 0x1d1d, 0x251d);
NTV2_FLD(ntv2_kona_fld_hdmiin4_edid_write_data, 8, 0);
NTV2_FLD(ntv2_kona_fld_hdmiin4_edid_read_data, 8, 8);
NTV2_FLD(ntv2_kona_fld_hdmiin4_edid_address, 8, 16);
NTV2_FLD(ntv2_kona_fld_hdmiin4_edid_write_enable, 1, 24);
NTV2_FLD(ntv2_kona_fld_hdmiin4_edid_busy, 1, 25);
NTV2_REG(ntv2_reg_hdmiin4_croplocation, 0x1d1e, 0x1d1e, 0x251e); /* crop location */
NTV2_FLD(ntv2_fld_hdmiin4_croplocation_start, 16, 0); /* crop start location */
NTV2_FLD(ntv2_fld_hdmiin4_croplocation_end, 16, 16); /* crop end location */
NTV2_REG(ntv2_reg_hdmiin4_pixelcontrol, 0x1d1f, 0x1d1f, 0x251f); /* pixel control */
NTV2_FLD(ntv2_fld_hdmiin4_pixelcontrol_lineinterleave, 1, 0); /* line interleave */
NTV2_CON(ntv2_con_hdmiin4_lineinterleave_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiin4_lineinterleave_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiin4_pixelcontrol_pixelinterleave, 1, 1); /* pixel interleave */
NTV2_CON(ntv2_con_hdmiin4_pixelinterleave_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiin4_pixelinterleave_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiin4_pixelcontrol_420convert, 1, 2); /* 420 to 422 conversion */
NTV2_CON(ntv2_con_hdmiin4_420convert_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiin4_420convert_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiin4_pixelcontrol_cropmode, 1, 3); /* crop mode */
NTV2_CON(ntv2_con_hdmiin4_cropmode_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiin4_cropmode_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiin4_pixelcontrol_hlinefilter, 1, 4); /* horizontal line filter mode */
NTV2_CON(ntv2_con_hdmiin4_hlinefilter_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiin4_hlinefilter_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiin4_pixelcontrol_clockratio, 4, 8); /* core clock to data clock ratio */
NTV2_REG(ntv2_vreg_hdmiin4_avi_info, kVRegHDMIInAviInfo1,
kVRegHDMIInAviInfo1,
kVRegHDMIInAviInfo2); /* avi info data */
NTV2_FLD(ntv2_fld_hdmiin4_colorimetry, 4, 0); /* colorimetry */
NTV2_FLD(ntv2_fld_hdmiin4_dolby_vision, 1, 4); /* dolby vision detected */
NTV2_REG(ntv2_vreg_hdmiin4_drm_info, kVRegHDMIInDrmInfo1,
kVRegHDMIInDrmInfo1,
kVRegHDMIInDrmInfo2); /* drm info data */
NTV2_FLD(ntv2_fld_hdmiin4_drm_present, 1, 0); /* drm info frame present */
NTV2_FLD(ntv2_fld_hdmiin4_drm_eotf, 4, 8); /* electro optical transfer function */
NTV2_FLD(ntv2_fld_hdmiin4_drm_metadata_id, 4, 12); /* metadata descriptor id */
NTV2_REG(ntv2_vreg_hdmiin4_drm_green, kVRegHDMIInDrmGreenPrimary1,
kVRegHDMIInDrmGreenPrimary1,
kVRegHDMIInDrmGreenPrimary2); /* drm green primary */
NTV2_FLD(ntv2_fld_hdmiin4_drm_green_x, 16, 0); /* green primary x */
NTV2_FLD(ntv2_fld_hdmiin4_drm_green_y, 16, 16); /* green primary y */
NTV2_REG(ntv2_vreg_hdmiin4_drm_blue, kVRegHDMIInDrmBluePrimary1,
kVRegHDMIInDrmBluePrimary1,
kVRegHDMIInDrmBluePrimary2); /* drm blue primary */
NTV2_FLD(ntv2_fld_hdmiin4_drm_blue_x, 16, 0); /* blue primary x */
NTV2_FLD(ntv2_fld_hdmiin4_drm_blue_y, 16, 16); /* blue primary y */
NTV2_REG(ntv2_vreg_hdmiin4_drm_red, kVRegHDMIInDrmRedPrimary1,
kVRegHDMIInDrmRedPrimary1,
kVRegHDMIInDrmRedPrimary2); /* drm red primary */
NTV2_FLD(ntv2_fld_hdmiin4_drm_red_x, 16, 0); /* red primary x */
NTV2_FLD(ntv2_fld_hdmiin4_drm_red_y, 16, 16); /* red primary y */
NTV2_REG(ntv2_vreg_hdmiin4_drm_white, kVRegHDMIInDrmWhitePoint1,
kVRegHDMIInDrmWhitePoint1,
kVRegHDMIInDrmWhitePoint2); /* drm white point */
NTV2_FLD(ntv2_fld_hdmiin4_drm_white_x, 16, 0); /* white point x */
NTV2_FLD(ntv2_fld_hdmiin4_drm_white_y, 16, 16); /* white point y */
NTV2_REG(ntv2_vreg_hdmiin4_drm_luma, kVRegHDMIInDrmMasteringLuminence1,
kVRegHDMIInDrmMasteringLuminence1,
kVRegHDMIInDrmMasteringLuminence2); /* drm luminence level */
NTV2_FLD(ntv2_fld_hdmiin4_drm_luma_max, 16, 0); /* luminence max */
NTV2_FLD(ntv2_fld_hdmiin4_drm_luma_min, 16, 16); /* luminence min */
NTV2_REG(ntv2_vreg_hdmiin4_drm_light, kVRegHDMIInDrmLightLevel1,
kVRegHDMIInDrmLightLevel1,
kVRegHDMIInDrmLightLevel2); /* drm light level */
NTV2_FLD(ntv2_fld_hdmiin4_drm_light_content_max, 16, 0); /* light level content max */
NTV2_FLD(ntv2_fld_hdmiin4_drm_light_average_max, 16, 16); /* light level average max */
#endif

View File

@ -1,740 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
#ifndef NTV2_HINREG_H
#define NTV2_HINREG_H
#include "ntv2commonreg.h"
/* video frame flags */
NTV2_CON(ntv2_kona_frame_none, 0x00000000);
NTV2_CON(ntv2_kona_frame_picture_progressive, 0x00000001); /* picture progressive */
NTV2_CON(ntv2_kona_frame_picture_interlaced, 0x00000002); /* picture interlaced */
NTV2_CON(ntv2_kona_frame_transport_progressive, 0x00000004); /* transport progressive */
NTV2_CON(ntv2_kona_frame_transport_interlaced, 0x00000008); /* transport interlaced */
NTV2_CON(ntv2_kona_frame_sd, 0x00000010); /* clock sd */
NTV2_CON(ntv2_kona_frame_hd, 0x00000020); /* clock hd */
NTV2_CON(ntv2_kona_frame_3g, 0x00000040); /* clock 3g */
NTV2_CON(ntv2_kona_frame_3ga, 0x00000100); /* sdi transport 3ga */
NTV2_CON(ntv2_kona_frame_3gb, 0x00000200); /* sdi transport 3gb */
NTV2_CON(ntv2_kona_frame_dual_link, 0x00000400); /* sdi transport smpte 372 4444 */
NTV2_CON(ntv2_kona_frame_line_interleaved, 0x00000800); /* sdi transport smpte 372 >30 fps */
NTV2_CON(ntv2_kona_frame_square_division, 0x00001000); /* transport square division */
NTV2_CON(ntv2_kona_frame_sample_interleaved, 0x00002000); /* transport sample interleaved */
NTV2_CON(ntv2_kona_frame_4x3, 0x00100000); /* 4x3 aspect */
NTV2_CON(ntv2_kona_frame_16x9, 0x00200000); /* 16x9 aspect */
/* video pixel flags */
NTV2_CON(ntv2_kona_pixel_none, 0x00000000);
NTV2_CON(ntv2_kona_pixel_yuv, 0x00000001); /* yuv color space */
NTV2_CON(ntv2_kona_pixel_rgb, 0x00000002); /* rgb color space */
NTV2_CON(ntv2_kona_pixel_full, 0x00000004); /* full range black - white */
NTV2_CON(ntv2_kona_pixel_smpte, 0x00000008); /* smpte range black - white */
NTV2_CON(ntv2_kona_pixel_rec601, 0x00000010); /* rec 601 color standard */
NTV2_CON(ntv2_kona_pixel_rec709, 0x00000020); /* rec 709 color standard */
NTV2_CON(ntv2_kona_pixel_rec2020, 0x00000040); /* rec 2020 color standard */
NTV2_CON(ntv2_kona_pixel_adobe, 0x00000080); /* adobe color standard */
NTV2_CON(ntv2_kona_pixel_420, 0x00000100); /* 420 component format */
NTV2_CON(ntv2_kona_pixel_422, 0x00000200); /* 422 component format */
NTV2_CON(ntv2_kona_pixel_444, 0x00000400); /* 444 component format */
NTV2_CON(ntv2_kona_pixel_4444, 0x00000800); /* 4444 component format */
NTV2_CON(ntv2_kona_pixel_4224, 0x00001000); /* 4224 component format */
NTV2_CON(ntv2_kona_pixel_8bit, 0x00010000); /* 8 bit component resolution */
NTV2_CON(ntv2_kona_pixel_10bit, 0x00020000); /* 10 bit component resolution */
NTV2_CON(ntv2_kona_pixel_12bit, 0x00040000); /* 12 bit component resolution */
NTV2_CON(ntv2_kona_pixel_16bit, 0x00080000); /* 16 bit component resolution */
/* hdmi input status */
NTV2_REG(ntv2_kona_reg_hdmiin_input_status, 126, 0x2c13, 0x3013); /* hdmi input status register */
NTV2_FLD(ntv2_kona_fld_hdmiin_locked, 1, 0);
NTV2_FLD(ntv2_kona_fld_hdmiin_stable, 1, 1);
NTV2_FLD(ntv2_kona_fld_hdmiin_rgb, 1, 2);
NTV2_FLD(ntv2_kona_fld_hdmiin_deep_color, 1, 3);
NTV2_FLD(ntv2_kona_fld_hdmiin_video_code, 6, 4); /* ntv2 video standard v2 */
NTV2_FLD(ntv2_kona_fld_hdmiin_lhi_ycbcr_mode, 1, 10);
NTV2_FLD(ntv2_kona_fld_hdmiin_lhi_10bit_mode, 1, 11);
NTV2_FLD(ntv2_kona_fld_hdmiin_audio_2ch, 1, 12); /* 2 audio channels (vs 8) */
NTV2_FLD(ntv2_kona_fld_hdmiin_progressive, 1, 13);
NTV2_FLD(ntv2_kona_fld_hdmiin_video_sd, 1, 14); /* video pixel clock sd (not hd or 3g) */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_74_25, 1, 15); /* not used */
NTV2_FLD(ntv2_kona_fld_hdmiin_audio_rate, 4, 16);
NTV2_FLD(ntv2_kona_fld_hdmiin_audio_word_length, 4, 20);
NTV2_FLD(ntv2_kona_fld_hdmiin_video_format, 3, 24); /* really ntv2 standard */
NTV2_FLD(ntv2_kona_fld_hdmiin_dvi, 1, 27); /* input dvi (vs hdmi) */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_rate, 4, 28); /* ntv2 video rate */
/* hdmi control */
NTV2_REG(ntv2_reg_hdmi_control, 127, 0x2c14, 0x3014); /* hdmi audio status register */
NTV2_FLD(ntv2_kona_fld_hdmiout_force_config, 1, 1); /* force output config (ignore edid) */
NTV2_FLD(ntv2_kona_fld_hdmiin_audio_pair, 2, 2); /* hdmi input audio pair select */
NTV2_FLD(ntv2_kona_fld_hdmiin_rate_convert_enable, 1, 4); /* hdmi input audio sample rate converter enable */
NTV2_FLD(ntv2_kona_fld_hdmiin_channel34_swap_disable, 1, 5); /* hdmi input audio channel 3/4 swap disable */
NTV2_FLD(ntv2_kona_fld_hdmiout_channel34_swap_disable, 1, 6); /* hdmi output audio channel 3/4 swap disable */
NTV2_FLD(ntv2_kona_fld_hdmiout_prefer_420, 1, 7); /* hdmi output prefer 4K/UHD 420 */
NTV2_FLD(ntv2_kona_fld_hdmiout_audio_format, 2, 8); /* hdmi output audio format */
NTV2_FLD(ntv2_kona_fld_hdmiin_color_depth, 2, 12); /* hdmi input bit depth */
NTV2_FLD(ntv2_kona_fld_hdmiin_color_space, 2, 14); /* hdmi input color space */
NTV2_FLD(ntv2_kona_fld_hdmi_polarity, 4, 16); /* hdmi polarity? */
NTV2_FLD(ntv2_kona_fld_hdmiout_source_select, 4, 20); /* output audio source select */
NTV2_FLD(ntv2_kona_fld_hdmiout_crop_enable, 1, 24); /* crop 2k -> hd 4k -> uhd */
NTV2_FLD(ntv2_kona_fld_hdmiout_force_hpd, 1, 25); /* force hpd */
NTV2_FLD(ntv2_kona_fld_hdmiout_deep_12bit, 1, 26); /* deep color 12 bit */
NTV2_FLD(ntv2_kona_fld_hdmi_debug, 1, 27); /* debug output enable */
NTV2_FLD(ntv2_kona_fld_hdmi_disable_update, 1, 28); /* disable update loop */
NTV2_FLD(ntv2_kona_fld_hdmiout_channel_select, 2, 29); /* output audio channel select */
NTV2_FLD(ntv2_kona_fld_hdmi_protocol, 1, 30); /* hdmi protocol? */
NTV2_FLD(ntv2_kona_fld_hdmiin_full_range, 1, 31); /* hdmi input quantization full range */
/* hdmi input video mode */
NTV2_CON(ntv2_kona_hdmiin_video_mode_hdsdi, 0x0); /* hd-sdi */
NTV2_CON(ntv2_kona_hdmiin_video_mode_sdsdi, 0x1); /* sd_sdi */
NTV2_CON(ntv2_kona_hdmiin_video_mode_3gsdi, 0x2); /* 3g-sdi */
/* hdmi input video map */
NTV2_CON(ntv2_kona_hdmiin_video_map_422_10bit, 0x0); /* yuv 422 10 bit */
NTV2_CON(ntv2_kona_hdmiin_video_map_444_10bit, 0x1); /* yuv/rgb 444 10 bit */
/* hdmi input video standard */
NTV2_CON(ntv2_kona_hdmiin_video_standard_1080i, 0x0); /* 1080i */
NTV2_CON(ntv2_kona_hdmiin_video_standard_720p, 0x1); /* 720p */
NTV2_CON(ntv2_kona_hdmiin_video_standard_525i, 0x2); /* 525i */
NTV2_CON(ntv2_kona_hdmiin_video_standard_625i, 0x3); /* 625i */
NTV2_CON(ntv2_kona_hdmiin_video_standard_1080p, 0x4); /* 1080p */
NTV2_CON(ntv2_kona_hdmiin_video_standard_4k, 0x5); /* 4K */
NTV2_CON(ntv2_kona_hdmiin_video_standard_2205p, 0x6); /* 3D frame packed mode */
NTV2_CON(ntv2_kona_hdmiin_video_standard_none, 0x7); /* undefined */
/* hdmi input frame rate */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_none, 0x0); /* undefined */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_6000, 0x1); /* 60.00 */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_5994, 0x2); /* 59.94 */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_3000, 0x3); /* 30.00 */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_2997, 0x4); /* 29.97 */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_2500, 0x5); /* 25.00 */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_2400, 0x6); /* 24.00 */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_2398, 0x7); /* 23.98 */
NTV2_CON(ntv2_kona_hdmiin_frame_rate_5000, 0x8); /* 50.00 */
/* hdmi 3d structure */
NTV2_CON(ntv2_kona_hdmiin_3d_frame_packing, 0x0); /* 0000 frame packing */
NTV2_CON(ntv2_kona_hdmiin_3d_field_alternative, 0x1); /* 0001 field alternative */
NTV2_CON(ntv2_kona_hdmiin_3d_line_alternative, 0x2); /* 0010 line alternative */
NTV2_CON(ntv2_kona_hdmiin_3d_side_by_side_full, 0x3); /* 0011 side by side full */
NTV2_CON(ntv2_kona_hdmiin_3d_l_depth, 0x4); /* 0100 L + depth */
NTV2_CON(ntv2_kona_hdmiin_3d_l_d_g, 0x5); /* 0101 L + depth + graphics -depth */
NTV2_CON(ntv2_kona_hdmiin_3d_top_bottom, 0x6); /* 0110 top bottom */
NTV2_CON(ntv2_kona_hdmiin_3d_side_by_side_half, 0x8); /* 1000 side by side half */
/* hdmi input control */
NTV2_REG(ntv2_kona_reg_hdmiin_i2c_control, 360, 0x2c00, 0x3000); /* hdmi input i2c control register */
NTV2_FLD(ntv2_kona_fld_hdmiin_subaddress, 8, 0); /* i2c subaddress (8-bit register on device) */
NTV2_FLD(ntv2_kona_fld_hdmiin_device_address, 7, 8); /* i2c device address (hdmiin_addr) */
NTV2_FLD(ntv2_kona_fld_hdmiin_read_disable, 1, 16); /* i2c read disable bit */
NTV2_FLD(ntv2_kona_fld_hdmiin_write_busy, 1, 20); /* i2c write busy bit */
NTV2_FLD(ntv2_kona_fld_hdmiin_i2c_error, 1, 21); /* i2c error bit */
NTV2_FLD(ntv2_kona_fld_hdmiin_i2c_busy, 1, 22); /* i2c busy bit */
NTV2_FLD(ntv2_kona_fld_hdmiin_i2c_reset, 1, 24); /* i2c reset bit */
NTV2_FLD(ntv2_kona_fld_hdmiin_ram_data_ready, 1, 28); /* i2c ram data ready bit */
NTV2_REG(ntv2_kona_reg_hdmiin_i2c_data, 361, 0x2c01, 0x3001); /* hdmi input data register */
NTV2_FLD(ntv2_kona_fld_hdmiin_data_out, 8, 0); /* i2c data to write to selected subaddress */
NTV2_FLD(ntv2_kona_fld_hdmiin_data_in, 8, 8); /* i2c data read from selected subaddress */
NTV2_REG(ntv2_kona_reg_hdmiin_video_setup, 362, 0x2c02, 0x3002); /* hdmi input video setup regiser */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_mode, 2, 0); /* video mode (hdmiin_video_mode) */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_map, 2, 2); /* video map (hdmiin_video_map) */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_420, 1, 4); /* 420 video input */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_standard, 3, 8); /* video standard select (hdmiin_video_standard) */
NTV2_FLD(ntv2_kona_fld_hdmiin_frame_rate, 4, 16); /* frame rate select (Hz) (hdmiin_frame_rate) */
NTV2_FLD(ntv2_kona_fld_hdmiin_3d_structure, 4, 20); /* 3D frame structure (hdmi_3d) */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_4k, 1, 28); /* 4K video input */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_progressive, 1, 29); /* progressive video input */
NTV2_FLD(ntv2_kona_fld_hdmiin_video_3d, 1, 30); /* 3D video input */
NTV2_FLD(ntv2_kona_fld_hdmiin_3d_frame_pack_enable, 1, 31); /* enable special 3D frame-packed mode */
NTV2_REG(ntv2_kona_reg_hdmiin_hsync_duration, 363, 0x2c03, 0x3003); /* hdmi input horizontal sync and back porch regiser */
NTV2_REG(ntv2_kona_reg_hdmiin_h_active, 364, 0x2c04, 0x3004); /* hdmi input horizontal active regiser */
NTV2_REG(ntv2_kona_reg_hdmiin_vsync_duration_fld1, 365, 0x2c05, 0x3005); /* hdmi input vertical sync and back porch regiser, field 1 */
NTV2_REG(ntv2_kona_reg_hdmiin_vsync_duration_fld2, 366, 0x2c06, 0x3006); /* hdmi input vertical sync and back porch regiser, field 2 */
NTV2_REG(ntv2_kona_reg_hdmiin_v_active_fld1, 367, 0x2c07, 0x3007); /* hdmi input vertical active regiser, field 1 */
NTV2_REG(ntv2_kona_reg_hdmiin_v_active_fld2, 368, 0x2c08, 0x3008); /* hdmi input vertical active regiser, field 2 */
NTV2_REG(ntv2_kona_reg_hdmiin_video_status, 369, 0x2c09, 0x3009); /* hdmi input video status regiser 1 */
NTV2_FLD(ntv2_kona_fld_hdmiin_det_frame_rate, 4, 0); /* detected frame rate (hdmiin_frame_rate) */
NTV2_FLD(ntv2_kona_fld_hdmiin_det_video_standard, 3, 8); /* detected video standard (hdmiin_video_standard) */
NTV2_FLD(ntv2_kona_fld_hdmiin_ident_valid, 1, 16); /* identification valid */
NTV2_FLD(ntv2_kona_fld_hdmiin_hv_locked, 1, 17); /* HV Locked */
NTV2_FLD(ntv2_kona_fld_hdmiin_hd_74mhz, 1, 18); /* HD 74.xx vs 27 Mhz clock */
NTV2_FLD(ntv2_kona_fld_hdmiin_det_progressive, 1, 19); /* detected progressive */
NTV2_REG(ntv2_kona_reg_hdmiin_horizontal_data, 370, 0x2c0a, 0x300a); /* hdmi input H pixel data */
NTV2_FLD(ntv2_kona_fld_hdmiin_h_total_pixels, 16, 0); /* H total pixels per line */
NTV2_FLD(ntv2_kona_fld_hdmiin_h_active_pixels, 16, 16); /* H active pixels per line */
NTV2_REG(ntv2_kona_reg_hdmiin_hblank_data0, 371, 0x2c0b, 0x300b); /* hdmi input H blanking data */
NTV2_FLD(ntv2_kona_fld_hdmiin_h_front_porch_pixels, 16, 0); /* H front porch pixels */
NTV2_FLD(ntv2_kona_fld_hdmiin_h_back_porch_pixels, 16, 16); /* H back porch pixels */
NTV2_REG(ntv2_kona_reg_hdmiin_hblank_data1, 372, 0x2c0c, 0x300c); /* hdmi input H Blanking data */
NTV2_FLD(ntv2_kona_fld_hdmiin_hsync_pixels, 16, 0); /* H sync pixels */
NTV2_FLD(ntv2_kona_fld_hdmiin_hblank_pixels, 16, 16); /* H blank pixels */
NTV2_REG(ntv2_kona_reg_hdmiin_vertical_data_fld1, 373, 0x2c0c, 0x300d); /* hdmi input field 1 V data */
NTV2_REG(ntv2_kona_reg_hdmiin_vertical_data_fld2, 374, 0x2c0e, 0x300e); /* hdmi input field 2 V data */
NTV2_FLD(ntv2_kona_fld_hdmiin_v_total_lines, 16, 0); /* V total lines field 1,2 */
NTV2_FLD(ntv2_kona_fld_hdmiin_v_active_lines, 16, 16); /* V active lines field 1,2 */
NTV2_REG(ntv2_kona_reg_hdmiin_color_depth, 375, 0x2c0f, 0x300f); /* hdmi input color depth */
NTV2_FLD(ntv2_kona_fld_hdmiin_deep_color_detect, 1, 6); /* detected deep color */
/* i2c register / value data */
struct ntv2_reg_value {
uint8_t address;
uint8_t value;
};
/* hdmi i2c device addresses */
static const uint8_t device_io_bank = 0x4c; /* hdmi chip io register bank */
static const uint8_t device_hdmi_bank = 0x34; /* hdmi chip hdmi register bank */
static const uint8_t device_cec_bank = 0x40; /* hdmi chip cec register bank */
static const uint8_t device_cp_bank = 0x22; /* hdmi chip cp register bank */
static const uint8_t device_repeater_bank = 0x32; /* hdmi chip repeater register bank */
static const uint8_t device_edid_bank = 0x36; /* hdmi chip edid register bank */
static const uint8_t device_dpll_bank = 0x26; /* hdmi chip dpll register bank */
static const uint8_t device_info_bank = 0x3e; /* hdmi chip info frame register bank */
static const uint8_t device_subaddress_all = 0xff;
/* hdmi i2c data registers and bit masks */
static const uint8_t packet_detect_reg = 0x60;
static const uint8_t packet_detect_avi_mask = 0x01;
static const uint8_t packet_detect_vsi_mask = 0x10;
static const uint8_t clock_detect_reg = 0x6a;
static const uint8_t clock_tmdsa_present_mask = 0x10;
static const uint8_t clock_tmdsa_lock_mask = 0x40;
static const uint8_t clock_sync_lock_mask = 0x02;
static const uint8_t clock_regen_lock_mask = 0x01;
static const uint8_t tmds_lock_detect_reg = 0x6b;
static const uint8_t tmds_lock_detect_mask = 0x40;
static const uint8_t tmds_lock_clear_reg = 0x6c;
static const uint8_t tmds_lock_clear_mask = 0x40;
static const uint8_t cable_detect_reg = 0x6f;
static const uint8_t cable_detect_mask = 0x01;
static const uint8_t tmds_frequency_detect_reg = 0x83;
static const uint8_t tmds_frequency_detect_mask = 0x02;
static const uint8_t tmds_frequency_clear_reg = 0x85;
static const uint8_t tmds_frequency_clear_mask = 0x02;
static const uint8_t io_color_reg = 0x02;
static const uint8_t io_color_space_mask = 0x06;
static const uint8_t hdmi_hpa_reg = 0x6c;
static const uint8_t hdmi_hpa_manual_mask = 0x01;
static const uint8_t hdmi_mode_reg = 0x05;
static const uint8_t hdmi_mode_mask = 0x80;
static const uint8_t hdmi_encrypted_mask = 0x40;
static const uint8_t deep_color_mode_reg = 0x0b;
static const uint8_t deep_color_10bit_mask = 0x40;
static const uint8_t deep_color_12bit_mask = 0x80;
static const uint8_t derep_mode_reg = 0x41;
static const uint8_t derep_mode_mask = 0x1f;
static const uint8_t defilter_lock_detect_reg = 0x07;
static const uint8_t defilter_locked_mask = 0x20;
static const uint8_t vfilter_locked_mask = 0x80;
static const uint8_t interlaced_detect_reg = 0x0b;
static const uint8_t interlaced_mask = 0x20;
static const uint8_t tristate_reg = 0x15;
static const uint8_t tristate_disable_outputs = 0x9e;
static const uint8_t tristate_enable_outputs = 0x80;
static const uint8_t vsi_infoframe_packet_id = 0xec;
static const uint8_t vsi_infoframe_version = 0xed;
static const uint8_t vsi_infoframe_length = 0xee;
static const uint8_t vsi_infoframe_checksum = 0x54;
static const uint8_t vsi_infoframe_byte1 = 0x55;
static const uint8_t vsi_video_format_mask4 = 0xe0;
static const uint8_t vsi_video_format_shift4 = 0x05;
static const uint8_t vsi_3d_structure_mask5 = 0xf0;
static const uint8_t vsi_3d_structure_shift5 = 0x04;
static const uint8_t avi_infoframe_packet_id = 0xe0;
static const uint8_t avi_infoframe_version = 0xe1;
static const uint8_t avi_infoframe_length = 0xe2;
static const uint8_t avi_infoframe_checksum = 0x00;
static const uint8_t avi_infoframe_byte1 = 0x01;
static const uint8_t avi_scan_data_mask1 = 0x03;
static const uint8_t avi_scan_data_shift1 = 0x00;
static const uint8_t avi_bar_data_mask1 = 0x0c;
static const uint8_t avi_bar_data_shift1 = 0x02;
static const uint8_t avi_active_format_mask1 = 0x10;
static const uint8_t avi_active_format_shift1 = 0x04;
static const uint8_t avi_color_component_mask1 = 0x60;
static const uint8_t avi_color_component_shift1 = 0x05;
static const uint8_t avi_active_aspect_mask2 = 0x0f;
static const uint8_t avi_active_aspect_shift2 = 0x00;
static const uint8_t avi_frame_aspect_ratio_mask2 = 0x30;
static const uint8_t avi_frame_aspect_ratio_shift2 = 0x04;
static const uint8_t avi_colorimetry_mask2 = 0xc0;
static const uint8_t avi_colorimetry_shift2 = 0x06;
static const uint8_t avi_nonuniform_scaling_mask3 = 0x03;
static const uint8_t avi_nonuniform_scaling_shift3 = 0x00;
static const uint8_t avi_quantization_range_mask3 = 0x0c;
static const uint8_t avi_quantization_range_shift3 = 0x02;
static const uint8_t avi_extended_colorimetry_mask3 = 0x70;
static const uint8_t avi_extended_colorimetry_shift3 = 0x04;
static const uint8_t avi_it_content_mask3 = 0x80;
static const uint8_t avi_it_content_shift3 = 0x07;
static const uint8_t avi_vic_mask4 = 0x7f;
static const uint8_t avi_vic_shift4 = 0x00;
static const uint8_t avi_pixel_repetition_mask5 = 0x0f;
static const uint8_t avi_pixel_repetition_shift5 = 0x00;
static const uint8_t avi_it_content_type_mask5 = 0x30;
static const uint8_t avi_it_content_type_shift5 = 0x04;
static const uint8_t avi_ycc_quant_range_mask5 = 0xc0;
static const uint8_t avi_ycc_quant_range_shift5 = 0x06;
/* info frame data values */
static const uint8_t vsi_packet_id = 0x81;
static const uint8_t vsi_version = 0x01;
static const uint8_t vsi_format_none = 0x00;
static const uint8_t vsi_format_extended = 0x01;
static const uint8_t vsi_format_3d = 0x02;
static const uint8_t vsi_vic_reserved = 0x00;
static const uint8_t vsi_vic_3840x2160_30 = 0x01;
static const uint8_t vsi_vic_3840x2160_25 = 0x02;
static const uint8_t vsi_vic_3840x2160_24 = 0x03;
static const uint8_t vsi_vic_4096x2160_24 = 0x04;
static const uint8_t avi_packet_id = 0x82;
static const uint8_t avi_version = 0x02;
static const uint8_t avi_scan_nodata = 0x00;
static const uint8_t avi_scan_ovderscanned = 0x01;
static const uint8_t avi_scan_underscanned = 0x02;
static const uint8_t avi_scan_future = 0x03;
static const uint8_t avi_bar_nodata = 0x00;
static const uint8_t avi_bar_vertical = 0x01;
static const uint8_t avi_bar_horizontal = 0x02;
static const uint8_t avi_bar_both = 0x03;
static const uint8_t avi_color_comp_rgb = 0x00;
static const uint8_t avi_color_comp_422 = 0x01;
static const uint8_t avi_color_comp_444 = 0x02;
static const uint8_t avi_color_comp_420 = 0x03;
static const uint8_t avi_frame_aspect_nodata = 0x00;
static const uint8_t avi_frame_aspect_4x3 = 0x01;
static const uint8_t avi_frame_aspect_16x9 = 0x02;
static const uint8_t avi_frame_aspect_future = 0x03;
static const uint8_t avi_colorimetry_nodata = 0x00;
static const uint8_t avi_colorimetry_smpte170m = 0x01;
static const uint8_t avi_colorimetry_itu_r709 = 0x02;
static const uint8_t avi_colorimetry_extended = 0x03;
static const uint8_t avi_active_aspect_nodata = 0x00;
static const uint8_t avi_active_aspect_reserved = 0x01;
static const uint8_t avi_active_aspect_box_16x9_top = 0x02;
static const uint8_t avi_active_aspect_box_14x9_top = 0x03;
static const uint8_t avi_active_aspect_box_16x9_cen = 0x04;
static const uint8_t avi_active_aspect_coded_frame = 0x08;
static const uint8_t avi_active_aspect_4x3_cen = 0x09;
static const uint8_t avi_active_aspect_16x9_cen = 0x0a;
static const uint8_t avi_active_aspect_14x9_cen = 0x0b;
static const uint8_t avi_active_aspect_4x3_cen_14x9 = 0x0d;
static const uint8_t avi_active_aspect_16x9_cen_14x9 = 0x0e;
static const uint8_t avi_active_aspect_16x9_cen_4x3 = 0x0f;
static const uint8_t avi_nonuniform_scaling_nodata = 0x00;
static const uint8_t avi_nonuniform_scaling_horiz = 0x01;
static const uint8_t avi_nonuniform_scaling_vert = 0x02;
static const uint8_t avi_nonuniform_scaling_both = 0x03;
static const uint8_t avi_rgb_quant_range_default = 0x00;
static const uint8_t avi_rgb_quant_range_limited = 0x01;
static const uint8_t avi_rgb_quant_range_full = 0x02;
static const uint8_t avi_rgb_quant_range_reserved = 0x03;
static const uint8_t avi_ext_colorimetry_xv_ycc601 = 0x00;
static const uint8_t avi_ext_colorimetry_xv_ycc709 = 0x01;
static const uint8_t avi_ext_colorimetry_s_ycc601 = 0x02;
static const uint8_t avi_ext_colorimetry_adobe_601 = 0x03;
static const uint8_t avi_ext_colorimetry_adobe_rgb = 0x04;
static const uint8_t avi_ext_colorimetry_ycc2020 = 0x05;
static const uint8_t avi_ext_colorimetry_rgb2020 = 0x06;
static const uint8_t avi_ext_colorimetry_reserved = 0x07;
static const uint8_t avi_it_type_graphics = 0x00;
static const uint8_t avi_it_type_photo = 0x01;
static const uint8_t avi_it_type_cinema = 0x02;
static const uint8_t avi_it_type_game = 0x03;
static const uint8_t avi_ycc_quant_range_limited = 0x00;
static const uint8_t avi_ycc_quant_range_full = 0x01;
static const uint8_t avi_ycc_quant_range_reserved = 0x02;
static const uint8_t avi_ycc_quant_range_reserved1 = 0x03;
/* Establish register bank mappings. Note that the actual I2C bus addresses end up */
/* being right shifted by 1 from the addresses used here and in the chip docs. */
static struct ntv2_reg_value init_io0[] =
{
{ 0xf4, 0x80 }, /* CEC Map Registers, I2C Address = 80 */
{ 0xf5, 0x7C }, /* Info Frame Map Registers, I2C Address = 7C */
{ 0xf8, 0x4c }, /* DPLL Map Registers, I2C Address = 4C */
{ 0xf9, 0x64 }, /* Repeater Map Registers, I2C Address = 64 */
{ 0xfa, 0x6c }, /* EDID Map Registers, I2C Address = 6C */
{ 0xfb, 0x68 }, /* HDMI Map Registers, I2C Address = 68 */
{ 0xfd, 0x44 } /* CP Map Registers, I2C Address = 44 */
};
static int init_io0_size = sizeof(init_io0) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_hdmi1[] =
/* HDMI Register - I2C address = 0x68 */
/* ADI Recommended write */
{
{ 0xC0, 0x03 }, /* Recommended ADI write, documentation from script */
{ 0x4C, 0x44 }, /* %%%%% Set NEW_VS_PARAM (improves vertical filter locking) */
/* %%%%% "Recommended writes" added 7/14/14 */
{ 0x03, 0x98 },
{ 0x10, 0xA5 },
{ 0x45, 0x04 },
{ 0x3D, 0x10 },
{ 0x3e, 0x69 },
{ 0x3F, 0x46 },
{ 0x4E, 0xFE },
{ 0x4f, 0x08 },
{ 0x50, 0x00 },
{ 0x57, 0xa3 },
{ 0x58, 0x07 },
{ 0x93, 0x03 },
{ 0x5A, 0x80 },
//> { 0x6C, 0x14 }, /* Auto-assert HPD 100ms after (EDID active & cable detect) */
{ 0x6C, 0x54 }, /* Auto-assert HPD 100ms after (EDID active & cable detect) */
{ 0x0d, 0x02 } /* Set TMDS frequency change tolerance to 2MHz */
};
static int init_hdmi1_size = sizeof(init_hdmi1) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_io2_non4k[] =
/* IO registers - I2C address = 0x98 */
{
{ 0x00, 0x02 }, /* ADI Recommended Write */
{ 0x01, 0x06 }, /* ADI Recommended Write */
{ 0x02, 0xf2 }, /* %%%%% INP_COLOR_SPACE[3:0], Address 0x02[7:4] = 1111 */
/* 1111: Input color space depends on color space reported by HDMI block */
/* ALT_GAMMA, Address 0x02[3] */
/* 0 (default) No conversion */
/* 1 YUV601 to YUV709 conversion if input is YUV601, YUV709 to YUV601 conversion if input is YUV709 */
/* OP_656_RANGE, IO, Address 0x02[2] */
/* 0 (default) Enables full output range (0 to 255) */
/* 1 Enables limited output range (16 to 235) */
/* RGB_OUT, IO, Address 0x02[1] */
/* 0 (default) YPbPr color space output */
/* 1 RGB color space output */
/* ALT_DATA_SAT, IO, Address 0x02[0] */
/* 0 (default) Data saturator enabled or disabled according to OP_656_RANGE setting */
/* 1 Reverses OP_656_RANGE decision to enable or disable the data saturator */
{ 0x03, 0x42 }, /* 36 Bit SDR Mode, RGB, Non-4K mode */
/* Register changes to 0x54 for 4K mode */
{ 0x04, 0x00 }, /* OP_CH_SEL[2:0], Address 0x04[7:5] = 000 P[35:24] Y/G, P[23:12] U/CrCb/B, P[11:0] V/R */
/* XTAL_FREQ_SEL[1:0], Address 0x04[2:1] = 00, 27 Mhz */
/* 4K mode requires 0x62 */
{ 0x05, 0x38 }, /* F_OUT_SEL, IO, Address 0x05[4], Select DE or FIELD signal to be output on the DE pin */
/* 0 (default) Selects DE output on DE pin */
/* 1 Selects FIELD output on DE pin */
/* DATA_BLANK_EN, IO, Address 0x05[3], A control to blank data during video blanking sections */
/* 0 Do not blank data during horizontal and vertical blanking periods */
/* 1 (default) Blank data during horizontal and vertical blanking periods */
/* AVCODE_INSERT_EN, IO, Address 0x05[2], Select AV code insertion into the data stream */
/* 0 Does not insert AV codes into data stream */
/* 1 (default) Inserts AV codes into data stream */
/* REPL_AV_CODE, IO, Address 0x05[1], duplicate AV codes and insertion on all output stream data channels */
/* 0 (default) Outputs complete SAV/EAV codes on all channels, Channel A, Channel B, and Channel C */
/* 1 Spreads AV code across three channels, Channel B and C contain the first two ten bit words, 0x3FF and 0x000 */
/* Channel A contains the final two 10-bit words 0x00 and 0xXYZ */
/* OP_SWAP_CB_CR, IO, Address 0x05[0], Controls the swapping of Cr and Cb data on the pixel buses */
/* 0 (default) Outputs Cr and Cb as per OP_FORMAT_SEL */
/* 1 Inverts the order of Cb and Cr in the interleaved data stream */
{ 0x06, 0xa6 }, /* VS_OUT_SEL, Address 0x06[7], Select the VSync or FIELD signal to be output on the VS/FIELD/ALSB pin */
/* 0 Selects FIELD output on VS/FIELD/ALSB pin */
/* 1 (default) Selects VSync output on VS/FIELD/ALSB pin */
/* INV_F_POL, Address 0x06[3], controls polarity of the DE signal */
/* 0 (default) Negative FIELD/DE polarity */
/* 1 Positive FIELD/DE polarity */
/* INV_VS_POL, IO, Address 0x06[2] Controls polarity of the VS/FIELD/ALSB signal */
/* 0 (default) Negative polarity VS/FIELD/ALSB */
/* 1 Positive polarity VS/FIELD/ALSB */
/* INV_HS_POL, Address 0x06[1], Controls polarity of the HS signal */
/* 0 (default) Negative polarity HS */
/* 1 Positive polarity HS */
/* INV_LLC_POL, Address 0x06[0], Controls the polarity of the LLC */
/* 0 (default) Does not invert LLC */
/* 1 Inverts LLC */
{ 0x0c, 0x42 }, /* Power up part */
{ 0x14, 0x3F }, /* DR_STR[1:0], IO, Address 0x14[5:4] */
/* 00 Reserved */
/* 01 Medium low (2 */
/* 10 (default) Medium high (3 */
/* 11 High (4 */
/* DR_STR_CLK[1:0], IO, Address 0x14[3:2] */
/* 00 Reserved */
/* 01 Medium low (2 for LLC up to 60 MHz */
/* 10 (default) Medium high (3 for LLC from 44 MHz to 105 MHz */
/* 11 High (4 for LLC greater than 100 MHz */
/* DR_STR_SYNC[1:0], IO, Address 0x14[1:0] */
/* 00 Reserved */
/* 01 Medium low (2 */
/* 10 (default) Medium high (3 */
/* 11 High (4 */
{ 0x15, 0x80 }, /* Disable Tristate of Pins */
/*!! { 0x19, 0xC0 }, %%%%% LLC DLL phase */
{ 0x20, 0x04 }, /* HPA_MAN_VALUE_A, IO, Address 0x20[7] */
/* A manual control for the value of HPA on Port A, Valid only if HPA_MANUAL is set to 1 */
/* 0 - 0 V applied to HPA_A pin */
/* 1 (default) High level applied to HPA_A pin */
/* HPA_MAN_VALUE_B, IO, Address 0x20[6] */
/* A manual control for the value of HPB on Port A, Valid only if HPA_MANUAL is set to 1 */
/* 0 - 0 V applied to HPA_B pin */
/* 1 (default) High level applied to HPA_B pin */
/* HPA_TRISTATE_A, IO, Address 0x20[3] Tristates HPA output pin for Port A */
/* 0 (default) HPA_A pin active */
/* 1 Tristates HPA_A pin */
/* HPA_TRISTATE_B, IO, Address 0x20[2] Tristates HPA output pin for Port B */
/* 0 (default) HPA_B pin active */
/* 1 Tristates HPA_B pin */
{ 0x33, 0x40 }, /* LLC DLL MUX enable */
{ 0xdd, 0x00 }, /* Normal LLC frequency = 0x00 for non-4K modes */
/* LLC Half frequence = 0xA0 for 4K modes */
{ 0xE7, 0x00 }, /* default: ADI Recommended Write per PCN 15_0178 */
{ 0x6e, 0x40 }, /* %%%%% TMDSPLL_LCK_A_MB1 enable to catch PLL loss of lock (enables INT1) */
{ 0x86, 0x02 } /* %%%%% NEW_TMDS_FREQ_MB1 enable to catch frequency changes */
};
static int init_io2_non4k_size = sizeof(init_io2_non4k) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_io2_4k[] =
/* IO registers - I2C address = 0x98 */
{
// { 0x00, 0x02 }, /* ADI Recommended Write */
// { 0x01, 0x06 }, /* ADI Recommended Write */
{ 0x00, 0x19 }, /* ADI Recommended Write per PCN 15_0178 */
{ 0x01, 0x05 }, /* ADI Recommended Write per PCN 15_0178 */
{ 0x02, 0xf2 }, /* INP_COLOR_SPACE[3:0], Address 0x02[7:4] = 1111 */
/* 1111: Input color space depends on color space reported by HDMI block */
/* ALT_GAMMA, Address 0x02[3] */
/* 0 (default) No conversion */
/* 1 YUV601 to YUV709 conversion if input is YUV601, YUV709 to YUV601 conversion if input is YUV709 */
/* OP_656_RANGE, IO, Address 0x02[2] */
/* 0 (default) Enables full output range (0 to 255) */
/* 1 Enables limited output range (16 to 235) */
/* RGB_OUT, IO, Address 0x02[1] */
/* 0 (default) YPbPr color space output */
/* 1 RGB color space output */
/* ALT_DATA_SAT, IO, Address 0x02[0] */
/* 0 (default) Data saturator enabled or disabled according to OP_656_RANGE setting */
/* 1 Reverses OP_656_RANGE decision to enable or disable the data saturator */
{ 0x03, 0x54 }, /* 36 Bit SDR Mode, RGB, Non-4K mode */
/* Register changes to 0x54 for 4K mode */
{ 0x04, 0x62 }, /* OP_CH_SEL[2:0], Address 0x04[7:5] = 000 P[35:24] Y/G, P[23:12] U/CrCb/B, P[11:0] V/R */
/* XTAL_FREQ_SEL[1:0], Address 0x04[2:1] = 00, 27 Mhz */
/* 4K mode requires 0x62 */
{ 0x05, 0x38 }, /* F_OUT_SEL, IO, Address 0x05[4], Select DE or FIELD signal to be output on the DE pin */
/* 0 (default) Selects DE output on DE pin */
/* 1 Selects FIELD output on DE pin */
/* DATA_BLANK_EN, IO, Address 0x05[3], A control to blank data during video blanking sections */
/* 0 Do not blank data during horizontal and vertical blanking periods */
/* 1 (default) Blank data during horizontal and vertical blanking periods */
/* AVCODE_INSERT_EN, IO, Address 0x05[2], Select AV code insertion into the data stream */
/* 0 Does not insert AV codes into data stream */
/* 1 (default) Inserts AV codes into data stream */
/* REPL_AV_CODE, IO, Address 0x05[1], duplicate AV codes and insertion on all output stream data channels */
/* 0 (default) Outputs complete SAV/EAV codes on all channels, Channel A, Channel B, and Channel C */
/* 1 Spreads AV code across three channels, Channel B and C contain the first two ten bit words, 0x3FF and 0x000 */
/* Channel A contains the final two 10-bit words 0x00 and 0xXYZ */
/* OP_SWAP_CB_CR, IO, Address 0x05[0], Controls the swapping of Cr and Cb data on the pixel buses */
/* 0 (default) Outputs Cr and Cb as per OP_FORMAT_SEL */
/* 1 Inverts the order of Cb and Cr in the interleaved data stream */
{ 0x06, 0xa6 }, /* VS_OUT_SEL, Address 0x06[7], Select the VSync or FIELD signal to be output on the VS/FIELD/ALSB pin */
/* 0 Selects FIELD output on VS/FIELD/ALSB pin */
/* 1 (default) Selects VSync output on VS/FIELD/ALSB pin */
/* INV_F_POL, Address 0x06[3], controls polarity of the DE signal */
/* 0 (default) Negative FIELD/DE polarity */
/* 1 Positive FIELD/DE polarity */
/* INV_VS_POL, IO, Address 0x06[2] Controls polarity of the VS/FIELD/ALSB signal */
/* 0 (default) Negative polarity VS/FIELD/ALSB */
/* 1 Positive polarity VS/FIELD/ALSB */
/* INV_HS_POL, Address 0x06[1], Controls polarity of the HS signal */
/* 0 (default) Negative polarity HS */
/* 1 Positive polarity HS */
/* INV_LLC_POL, Address 0x06[0], Controls the polarity of the LLC */
/* 0 (default) Does not invert LLC */
/* 1 Inverts LLC */
{ 0x0c, 0x42 }, /* Power up part */
{ 0x14, 0x3F }, /* DR_STR[1:0], IO, Address 0x14[5:4] */
/* 00 Reserved */
/* 01 Medium low (2 */
/* 10 (default) Medium high (3 */
/* 11 High (4 */
/* DR_STR_CLK[1:0], IO, Address 0x14[3:2] */
/* 00 Reserved */
/* 01 Medium low (2 for LLC up to 60 MHz */
/* 10 (default) Medium high (3 for LLC from 44 MHz to 105 MHz */
/* 11 High (4 for LLC greater than 100 MHz */
/* DR_STR_SYNC[1:0], IO, Address 0x14[1:0] */
/* 00 Reserved */
/* 01 Medium low (2 */
/* 10 (default) Medium high (3 */
/* 11 High (4 */
{ 0x15, 0x80 }, /* Disable Tristate of Pins */
/*!! { 0x19, 0x80 }, %%%%% LLC DLL phase */
{ 0x33, 0x40 }, /* LLC DLL MUX enable */
// { 0xdd, 0xA0 } /* Normal LLC frequency = 0x00 for non-4K modes */
/* LLC Half frequence = 0xA0 for 4K modes */
{ 0xdd, 0x00 }, /* ADI Recommended Write per PCN 15_0178 */
{ 0xE7, 0x04 } /* ADI Recommended Write per PCN 15_0178 */
};
static int init_io2_4k_size = sizeof(init_io2_4k) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_cp3[] =
/* %%%%% CP Register - I2C address = 0x44 */
{
{ 0xba, 0x00 }, /* No HDMI FreeRun */
{ 0x6c, 0x00 }, /* CP clamp disable */
{ 0x69, 0x10 },
{ 0x68, 0x00 }
};
static int init_cp3_size = sizeof(init_cp3) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_rep4[] =
/* Repeater Map Registers - I2C address = 0x64 */
{
{ 0x40, 0x81 }, /* BCAPS */
{ 0x74, 0x03 } /* Enable EDID */
};
static int init_rep4_size = sizeof(init_rep4) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_dpll5_non4k[] =
/* DPLL Registers - I2C address = 0x4C */
{
{ 0xb5, 0x01 }, /* Setting MCLK to 256Fs */
{ 0xc3, 0x00 }, /* ADI Recommended Settings (NormFreq) */
{ 0xcf, 0x00 }, /* ADI Recommended Settings (NormFreq) */
{ 0xdb, 0x00 } /* default: ADI Recommended Write per PCN 15_0178 */
};
static int init_dpll5_non4k_size = sizeof(init_dpll5_non4k) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_dpll5_4k[] =
/* DPLL Registers - I2C address = 0x4C */
{
{ 0xb5, 0x01 }, /* Setting MCLK to 256Fs */
{ 0xc3, 0x80 }, /* ADI Recommended Settings (NormFreq) */
{ 0xcf, 0x03 }, /* ADI Recommended Settings (NormFreq) */
{ 0xdb, 0x80 } /* ADI Recommended Write per PCN 15_0178 */
};
static int init_dpll5_4k_size = sizeof(init_dpll5_4k) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_hdmi6[] =
/* HDMI Registers - I2C address = 0x68 */
{
{ 0x00, 0x00 }, /* BG_MEAS_PORT_SEL[2:0], Addr 68 (HDMI), Address 0x00[5:3] */
/* 000 (default) Port A */
/* 001 Port B */
{ 0x01, 0x01 }, /* TERM_AUTO, Address 0x01[0] */
/* This bit allows the user to select automatic or manual control of clock termination */
/* If automatic mode termination is enabled, then termination on the port HDMI_PORT_SELECT[1:0] is enabled */
/* 0 (default) Disable termination automatic control */
/* 1 Enable termination automatic control */
{ 0x02, 0x01 }, /* EN_BG_PORT_A, Address 0x02[0] */
/* 0 (default) Port disabled, unless selected with HDMI_PORT_SELECT[2:0] */
/* 1 Port enabled in background mode */
/* EN_BG_PORT_B, Address 0x02[1] */
/* 0 (default) Port disabled, unless selected with HDMI_PORT_SELECT[2:0] */
/* 1 Port enabled in background mode */
{ 0x03, 0x58 }, /* I2SOUTMODE[1:0], Address 0x03[6:5] */
/* 00 (default) I2S mode */
/* 01 Right justified */
/* 10 Left justified */
/* 11 Raw SPDIF (IEC60958) mode */
/* I2SBITWIDTH[4:0], Address 0x03[4:0] */
/* 11000 24 bits */
{ 0x14, 0x31 }, /* Audio mute triggers: turn off MT_MSK_PARITY_ERROR and also */
{ 0x15, 0xff }, /* turn off bits 7,6,3,2 in r14 which are undocumented */
{ 0x16, 0xff }, /* but must be 1 per defaults; this fixes iOS audio input. */
//> { 0x6c, 0x01 }, /* HPA_MANUAL, Address 0x6C[0] */
{ 0x6c, 0x54 }, /* HPA_MANUAL, Address 0x6C[0] */
/* Manual control enable for the HPA output pins */
/* Manual control is determined by the HPA_MAN_VALUE_A */
/* 1 HPA takes its value from HPA_MAN_VALUE_A */
{ 0x3e, 0x69 },
{ 0x3f, 0x46 },
{ 0x4e, 0x7e },
{ 0x4f, 0x42 },
{ 0x57, 0xa3 },
{ 0x58, 0x07 },
{ 0x83, 0xfc }, /* CLOCK_TERMB_DISABLE, Address 0x83[1] */
/* Disable clock termination on Port B, Can be used when TERM_AUTO set to 0 */
/* 0 Enable Termination Port B */
/* 1 (default) Disable Termination Port B */
/* CLOCK_TERMA_DISABLE, Address 0x83[0] */
/* Disable clock termination on Port A, Can be used when TERM_AUTO set to 0 */
/* 0 Enable Termination Port A */
/* 1 (default) Disable Termination Port A */
/* Note - TERM_AUTO, Address 0x01[0] set to 1 which overrides this bit */
/* Required for TMDS frequency 27Mhz and below */
{ 0x89, 0x03 },
{ 0x84, 0x03 },
{ 0x85, 0x11 }, /* ADI Recommended Write */
{ 0x9C, 0x80 }, /* ADI Recommended Write */
{ 0x9C, 0xC0 }, /* ADI Recommended Write */
{ 0x9C, 0x00 }, /* ADI Recommended Write */
{ 0x85, 0x11 }, /* ADI Recommended Write */
{ 0x86, 0x9B }, /* ADI Recommended Write */
{ 0x9b, 0x03 }
};
static int init_hdmi6_size = sizeof(init_hdmi6) / sizeof(struct ntv2_reg_value);
static struct ntv2_reg_value init_hdmi8[] =
/* HDMI Registers - I2C address = 0x68 */
{
{ 0x6c, 0x54 } /* HPA_MANUAL, Address 0x6C[0] */
/* 0 (default)HPA takes its value based on HPA_AUTO_INT_EDID */
/* HPA_AUTO_INT_EDID[1:0],Address 0x6C[2:1] */
/* HPA_AUTO_INT_EDID[1:0] */
/* 10 */
/* HPA of an HDMI port asserted high after two conditions met */
/* 1. Internal EDID is active for that port */
/* 2. Delayed version of cable detect signal CABLE_DET_X_RAW for that port is high */
/* HPA of an HDMI port immediately deasserted after either of these two conditions are met: */
/* 1. Internal EDID is de-activated for that port */
/* 2. Cable detect signal CABLE_DET_X_RAW for that port is low */
/* HPA of a specific HDMI port deasserted low immediately after internal E-EDID is de-activated */
};
static int init_hdmi8_size = sizeof(init_hdmi8) / sizeof(struct ntv2_reg_value);
#endif

View File

@ -1,377 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2hout4reg.h
// Purpose: HDMI output monitor version 4
//
///////////////////////////////////////////////////////////////
#ifndef NTV2_HOUT4REG_H
#define NTV2_HOUT4REG_H
#include "ntv2commonreg.h"
#include "ntv2virtualregisters.h"
#include "ntv2enums.h"
/* control and status */
NTV2_REG(ntv2_reg_control_status, 48); /* control status */
NTV2_FLD(ntv2_fld_control_reference_source, 4, 24); /* hardware reference source */
NTV2_FLD(ntv2_fld_control_reference_present, 1, 30); /* reference source present */
NTV2_FLD(ntv2_fld_control_genlock_locked, 1, 31); /* genlock locked */
/* hdmi output configuration register */
NTV2_REG(ntv2_reg_hdmiout_output_config, 125); /* hdmi output config */
NTV2_FLD(ntv2_fld_hdmiout_video_standard, 4, 0); /* video standard */
NTV2_FLD(ntv2_fld_hdmiout_audio_group_select, 1, 5); /* audio upper group select */
NTV2_FLD(ntv2_fld_hdmiout_tx_bypass, 1, 7); /* v2 tx bypass? */
NTV2_FLD(ntv2_fld_hdmiout_rgb, 1, 8); /* rgb color space (not yuv) */
NTV2_FLD(ntv2_fld_hdmiout_frame_rate, 4, 9); /* frame rate */
NTV2_FLD(ntv2_fld_hdmiout_progressive, 1, 13); /* progressive? */
NTV2_FLD(ntv2_fld_hdmiout_deep_color, 1, 14); /* 10 bit deep color (not 8 bit) */
NTV2_FLD(ntv2_fld_hdmiout_yuv_444, 1, 15); /* yuv 444 mode */
NTV2_FLD(ntv2_fld_hdmiout_audio_format, 2, 16); /* hdmi output audio format */
NTV2_FLD(ntv2_fld_hdmiout_sampling, 2, 18); /* sampling? */
NTV2_FLD(ntv2_fld_hdmiout_vobd, 2, 20); /* hardware bit depth */
NTV2_FLD(ntv2_fld_hdmiout_source_rgb, 1, 23); /* source is rgb? */
NTV2_FLD(ntv2_fld_hdmiout_power_down, 1, 25); /* power down? */
NTV2_FLD(ntv2_fld_hdmiout_tx_enable, 1, 26); /* io4K tx enable */
NTV2_FLD(ntv2_fld_hdmiout_rx_enable, 1, 27); /* io4K rx enable */
NTV2_FLD(ntv2_fld_hdmiout_full_range, 1, 28); /* full range rgb (not smpte) */
NTV2_FLD(ntv2_fld_hdmiout_audio_8ch, 1, 29); /* 8 audio channels (not 2) */
NTV2_FLD(ntv2_fld_hdmiout_dvi, 1, 30); /* dvi mode (vs hdmi) */
/* hdmi input status */
NTV2_REG(ntv2_reg_hdmiin_input_status, 126); /* hdmi input status register */
NTV2_FLD(ntv2_fld_hdmiin_locked, 1, 0);
NTV2_FLD(ntv2_fld_hdmiin_stable, 1, 1);
NTV2_FLD(ntv2_fld_hdmiin_rgb, 1, 2);
NTV2_FLD(ntv2_fld_hdmiin_deep_color, 1, 3);
NTV2_FLD(ntv2_fld_hdmiin_video_code, 6, 4); /* ntv2 video standard v2 */
NTV2_FLD(ntv2_fld_hdmiin_lhi_ycbcr_mode, 1, 10);
NTV2_FLD(ntv2_fld_hdmiin_lhi_10bit_mode, 1, 11);
NTV2_FLD(ntv2_fld_hdmiin_audio_2ch, 1, 12); /* 2 audio channels (vs 8) */
NTV2_FLD(ntv2_fld_hdmiin_progressive, 1, 13);
NTV2_FLD(ntv2_fld_hdmiin_video_sd, 1, 14); /* video pixel clock sd (not hd or 3g) */
NTV2_FLD(ntv2_fld_hdmiin_video_74_25, 1, 15); /* not used */
NTV2_FLD(ntv2_fld_hdmiin_audio_rate, 4, 16);
NTV2_FLD(ntv2_fld_hdmiin_audio_word_length, 4, 20);
NTV2_FLD(ntv2_fld_hdmiin_video_format, 3, 24); /* really ntv2 standard */
NTV2_FLD(ntv2_fld_hdmiin_dvi, 1, 27); /* input dvi (vs hdmi) */
NTV2_FLD(ntv2_fld_hdmiin_video_rate, 4, 28); /* ntv2 video rate */
/* hdmi control */
NTV2_REG(ntv2_reg_hdmi_control, 127); /* hdmi audio status register */
NTV2_FLD(ntv2_fld_hdmiout_force_config, 1, 1); /* force output config (ignore edid) */
NTV2_FLD(ntv2_fld_hdmiin_audio_pair, 2, 2); /* hdmi input audio pair select */
NTV2_FLD(ntv2_fld_hdmiin_rate_convert_enable, 1, 4); /* hdmi input audio sample rate converter enable */
NTV2_FLD(ntv2_fld_hdmiin_channel34_swap_disable, 1, 5); /* hdmi input audio channel 3/4 swap disable */
NTV2_FLD(ntv2_fld_hdmiout_channel34_swap_disable, 1, 6); /* hdmi output audio channel 3/4 swap disable */
NTV2_FLD(ntv2_fld_hdmiout_prefer_420, 1, 7); /* hdmi output prefer 4K/UHD 420 */
NTV2_FLD(ntv2_fld_hdmiin_color_depth, 2, 12); /* hdmi input bit depth */
NTV2_FLD(ntv2_fld_hdmiin_color_space, 2, 14); /* hdmi input color space */
NTV2_FLD(ntv2_fld_hdmiout_audio_rate, 2, 16); /* audio rate */
NTV2_FLD(ntv2_fld_hdmiout_source_select, 4, 20); /* output audio source select */
NTV2_FLD(ntv2_fld_hdmiout_crop_enable, 1, 24); /* crop 2k -> hd 4k -> uhd */
NTV2_FLD(ntv2_fld_hdmiout_force_hpd, 1, 25); /* force hpd */
NTV2_FLD(ntv2_fld_hdmiout_deep_12bit, 1, 26); /* deep color 12 bit */
NTV2_FLD(ntv2_fld_hdmi_debug, 1, 27); /* debug output enable */
NTV2_FLD(ntv2_fld_hdmi_disable_update, 1, 28); /* disable update loop */
NTV2_FLD(ntv2_fld_hdmiout_channel_select, 2, 29); /* output audio channel select */
NTV2_FLD(ntv2_fld_hdmi_protocol, 1, 30); /* hdmi protocol? */
NTV2_FLD(ntv2_fld_hdmiin_full_range, 1, 31); /* hdmi input quantization full range */
NTV2_REG(ntv2_reg_hdmi_output_status1, kVRegHDMIOutStatus1); /* hdmi otuput status */
NTV2_FLD(ntv2_fld_hdmiout_status_video_standard, 4, 0); /* video standard */
NTV2_FLD(ntv2_fld_hdmiout_status_frame_rate, 4, 4); /* video frame rate */
NTV2_FLD(ntv2_fld_hdmiout_status_bit_depth, 4, 8); /* video bit depth */
NTV2_FLD(ntv2_fld_hdmiout_status_color_rgb, 1, 12); /* video color rgb */
NTV2_FLD(ntv2_fld_hdmiout_status_range_full, 1, 13); /* video range full */
NTV2_FLD(ntv2_fld_hdmiout_status_pixel_420, 1, 14); /* video pixel 420 */
NTV2_FLD(ntv2_fld_hdmiout_status_protocol, 1, 15); /* dvi mode (vs hdmi) */
NTV2_FLD(ntv2_fld_hdmiout_status_audio_format, 4, 16); /* audio format */
NTV2_FLD(ntv2_fld_hdmiout_status_audio_rate, 4, 20); /* audio rate */
NTV2_FLD(ntv2_fld_hdmiout_status_audio_channels, 4, 24); /* audio channels */
/* hdmi source register */
NTV2_REG(ntv2_reg_hdmiout_cross_group6, 141); /* crosspoint group 6 */
NTV2_FLD(ntv2_fld_hdmiout_hdmi_source, 7, 16); /* hdmi source */
NTV2_FLD(ntv2_fld_hdmiout_hdmi_rgb, 1, 23); /* rgb color space (not yuv) */
// hdr parameters
NTV2_REG(ntv2_reg_hdr_green_primary, 330); /* hdr green primary register */
NTV2_FLD(ntv2_fld_hdr_primary_x, 16, 0); /* rgb primary x value */
NTV2_FLD(ntv2_fld_hdr_primary_y, 16, 16); /* rgb primary y value */
NTV2_REG(ntv2_reg_hdr_blue_primary, 331); /* hdr blue primary register */
NTV2_REG(ntv2_reg_hdr_red_primary, 332); /* hdr red primary register */
NTV2_REG(ntv2_reg_hdr_white_point, 333); /* hdr white point register */
NTV2_FLD(ntv2_fld_hdr_white_point_x, 16, 0); /* white point x value */
NTV2_FLD(ntv2_fld_hdr_white_point_y, 16, 16); /* white point y value */
NTV2_REG(ntv2_reg_hdr_master_luminance, 334); /* hdr mastering luminance register */
NTV2_FLD(ntv2_fld_hdr_luminance_max, 16, 0); /* luminance maximun value */
NTV2_FLD(ntv2_fld_hdr_luminance_min, 16, 16); /* luminance minimum value */
NTV2_REG(ntv2_reg_hdr_light_level, 335); /* hdr light level register */
NTV2_FLD(ntv2_fld_hdr_content_light_max, 16, 0); /* content light level maximun value */
NTV2_FLD(ntv2_fld_hdr_frame_average_max, 16, 16); /* franme average level maximum value */
/* hdr control */
NTV2_REG(ntv2_reg_hdr_control, 336); /* hdr control register */
NTV2_FLD(ntv2_fld_hdr_constant_luminance, 1, 0); /* constant luminance */
NTV2_FLD(ntv2_fld_hdr_dci_colorimetry, 1, 5); /* dci colorimetry */
NTV2_FLD(ntv2_fld_hdr_dolby_vision_enable, 1, 6); /* dolby vision enable */
NTV2_FLD(ntv2_fld_hdr_enable, 1, 7); /* hdr enable */
NTV2_FLD(ntv2_fld_hdr_transfer_function, 8, 16); /* electro optical transfer function */
NTV2_FLD(ntv2_fld_hdr_metadata_id, 8, 24); /* metadata descriptor id */
/* hdmi output control registers */
NTV2_REG(ntv2_reg_hdmiout4_videocontrol, 0x1d40); /* hdmi control/status */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_scrambleMode, 1, 1); /* scdc 2.0 scramble mode */
NTV2_CON(ntv2_con_hdmiout4_scramblemode_disable, 0x0); /* scramble disable */
NTV2_CON(ntv2_con_hdmiout4_scramblemode_enable, 0x1); /* scramble enable */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_tranceivermode, 1, 3); /* transceiver mode */
NTV2_CON(ntv2_con_hdmiout4_tranceivermode_disable, 0x0); /* tranceiver disable */
NTV2_CON(ntv2_con_hdmiout4_tranceivermode_enable, 0x1); /* tranceiver enable */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_420mode, 1, 5); /* 420 mode */
NTV2_CON(ntv2_con_hdmiout4_420mode_disable, 0x0); /* 420 disable */
NTV2_CON(ntv2_con_hdmiout4_420mode_enable, 0x1); /* 420 enable */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_pixelsperclock, 3, 8); /* pixels per clock */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_pixelreplicate, 1, 11); /* pixel replicate */
NTV2_CON(ntv2_con_hdmiout4_pixelreplicate_disable, 0x0); /* replicate disable */
NTV2_CON(ntv2_con_hdmiout4_pixelreplicate_enable, 0x1); /* replicate enable */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_replicatefactor, 4, 12); /* pixels replicate factor */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_linerate, 5, 16); /* line rate */
NTV2_CON(ntv2_con_hdmiout4_linerate_none, 0x0); /* undetected */
NTV2_CON(ntv2_con_hdmiout4_linerate_5940mhz, 0x1); /* 5940 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_2970mhz, 0x2); /* 2970 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_1485mhz, 0x3); /* 1485 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_742mhz, 0x4); /* 742 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_270mhz, 0x5); /* 270 mhz 8 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_3712mhz, 0x6); /* 3712 mhz 10 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_1856mhz, 0x7); /* 1856 mhz 10 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_928mhz, 0x8); /* 928 mhz 10 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_337mhz, 0x9); /* 337 mhz 10 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_4455mhz, 0xa); /* 4455 mhz 12 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_2227mhz, 0xb); /* 2227 mhz 12 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_1113mhz, 0xc); /* 1113 mhz 12 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_405mhz, 0xd); /* 405 mhz 12 bit */
NTV2_CON(ntv2_con_hdmiout4_linerate_556mhz, 0xe); /* 556 mhz */
NTV2_CON(ntv2_con_hdmiout4_linerate_540mhz, 0xf); /* 540 mhz */
NTV2_CON(ntv2_con_hdmiout4_linerate_250mhz, 0x10); /* 250 mhz */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_audiomode, 1, 26); /* audio mode */
NTV2_CON(ntv2_con_hdmiout4_audiomode_disable, 0x0); /* audio disable */
NTV2_CON(ntv2_con_hdmiout4_audiomode_enable, 0x1); /* audio enable */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_txlockstate, 1, 27); /* tx lock state */
NTV2_CON(ntv2_con_hdmiout4_txlockstate_unlocked, 0x0); /* tx unlocked */
NTV2_CON(ntv2_con_hdmiout4_txlockstate_locked, 0x1); /* tx locked */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_txconfigmode, 1, 28); /* tx configuration mode */
NTV2_CON(ntv2_con_hdmiout4_txconfigmode_active, 0x0); /* tx config active */
NTV2_CON(ntv2_con_hdmiout4_txconfigmode_valid, 0x1); /* tx config valid */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_sinkpresent, 1, 29); /* sink present */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_resetdone, 1, 30); /* rx reset done */
NTV2_FLD(ntv2_fld_hdmiout4_videocontrol_reset, 1, 31); /* rx reset */
NTV2_REG(ntv2_reg_hdmiout4_videosetup0, 0x1d41); /* video setup 0 register */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup0_colordepth, 2, 0); /* color depth */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup0_colorspace, 2, 2); /* color space */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup0_scanmode, 1, 4); /* video scan mode */
NTV2_CON(ntv2_con_hdmiout4_scanmode_interlaced, 0x0); /* interlaced */
NTV2_CON(ntv2_con_hdmiout4_scanmode_progressive, 0x1); /* progressive */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup0_interfacemode, 1, 5); /* interface mode */
NTV2_CON(ntv2_con_hdmiout4_interfacemode_hdmi, 0x0); /* hdmi */
NTV2_CON(ntv2_con_hdmiout4_interfacemode_dvi, 0x1); /* dvi */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup0_syncpolarity, 1, 6); /* sync polarity */
NTV2_CON(ntv2_con_hdmiout4_syncpolarity_activelow, 0x0); /* active low */
NTV2_CON(ntv2_con_hdmiout4_syncpolarity_activehigh, 0x1); /* active high */
NTV2_REG(ntv2_reg_hdmiout4_videosetup1, 0x1d42); /* video setup 1 register */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup1_hsyncstart, 16, 0); /* horizontal sync start */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup1_hsyncend, 16, 16); /* horizontal sync end */
NTV2_REG(ntv2_reg_hdmiout4_videosetup2, 0x1d43); /* video setup 2 register */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup2_hdestart, 16, 0); /* horizontal de start */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup2_htotal, 16, 16); /* horizontal total */
NTV2_REG(ntv2_reg_hdmiout4_videosetup3, 0x1d44); /* video setup 3 register */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup3_vtransf1, 16, 0); /* vertical transistion field 1 */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup3_vtransf2, 16, 16); /* vertical transistion field 2 */
NTV2_REG(ntv2_reg_hdmiout4_videosetup4, 0x1d45); /* video setup 4 register */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup4_vsyncstartf1, 16, 0); /* vertical sync start field 1 */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup4_vsyncendf1, 16, 16); /* virtical sync end field 1 */
NTV2_REG(ntv2_reg_hdmiout4_videosetup5, 0x1d46); /* video setup 5 register */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup5_vdestartf1, 16, 0); /* vertical de start field 1 */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup5_vdestartf2, 16, 16); /* vertical de start field 2 */
NTV2_REG(ntv2_reg_hdmiout4_videosetup6, 0x1d47); /* video setup 6 register */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup6_vsyncstartf2, 16, 0); /* vertical sync start field 2 */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup6_vsyncendf2, 16, 16); /* virtical sync end field 2 */
NTV2_REG(ntv2_reg_hdmiout4_videosetup7, 0x1d48); /* video setup 7 register */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup7_vtotalf1, 16, 0); /* vertical total field 1 */
NTV2_FLD(ntv2_fld_hdmiout4_videosetup7_vtotalf2, 16, 16); /* vertical total field 2 */
NTV2_REG(ntv2_reg_hdmiout4_auxcontrol, 0x1d49); /* aux data control */
NTV2_FLD(ntv2_fld_hdmiout4_auxcontrol_auxdata, 8, 0); /* aux data */
NTV2_FLD(ntv2_fld_hdmiout4_auxcontrol_auxaddress, 11, 8); /* aux address */
NTV2_FLD(ntv2_fld_hdmiout4_auxcontrol_auxwrite, 1, 20); /* aux write */
NTV2_REG(ntv2_reg_hdmiout4_audiocontrol, 0x1d4b); /* audio data control */
NTV2_FLD(ntv2_fld_hdmiout4_audiocontrol_source, 4, 0); /* source */
NTV2_FLD(ntv2_fld_hdmiout4_audiocontrol_group_select, 1, 4); /* upper/lower 8 source channels */
NTV2_CON(ntv2_con_hdmiout4_group_select_lower, 0x0); /* lower 8 channels */
NTV2_CON(ntv2_con_hdmiout4_group_select_upper, 0x1); /* upper 8 channels */
NTV2_FLD(ntv2_fld_hdmiout4_audiocontrol_num_channels, 1, 5); /* 8/2 channel output */
NTV2_CON(ntv2_con_hdmiout4_num_channels_2, 0x0); /* 2 channel audio */
NTV2_CON(ntv2_con_hdmiout4_num_channels_8, 0x1); /* 8 channel audio */
NTV2_FLD(ntv2_fld_hdmiout4_audiocontrol_audioswapmode, 1, 6); /* audio channel 3/4 swap */
NTV2_CON(ntv2_con_hdmiout4_audioswapmode_enable, 0x0); /* swap */
NTV2_CON(ntv2_con_hdmiout4_audioswapmode_disable, 0x1); /* no swap */
NTV2_FLD(ntv2_fld_hdmiout4_audiocontrol_channel_select, 2, 8); /* 2 channel select */
NTV2_FLD(ntv2_fld_hdmiout4_audiocontrol_audio_format, 2, 12); /* encode format */
NTV2_CON(ntv2_con_hdmiout4_audio_format_lpcm, 0x0); /* lpcm data */
NTV2_CON(ntv2_con_hdmiout4_audio_format_dolby, 0x1); /* dolby encoded data */
NTV2_FLD(ntv2_fld_hdmiout4_audiocontrol_audio_rate, 2, 14); /* sample rate */
NTV2_CON(ntv2_con_hdmiout4_audio_rate_48, 0x0); /* 48 khz */
NTV2_CON(ntv2_con_hdmiout4_audio_rate_96, 0x1); /* 96 khz */
NTV2_CON(ntv2_con_hdmiout4_audio_rate_192, 0x2); /* 192 khz */
NTV2_REG(ntv2_reg_hdmiout4_redrivercontrol, 0x1d4f); /* hdmi redriver control */
NTV2_FLD(ntv2_fld_hdmiout4_redrivercontrol_power, 1, 0); /* power */
NTV2_CON(ntv2_con_hdmiout4_power_disable, 0x0); /* power disable */
NTV2_CON(ntv2_con_hdmiout4_power_enable, 0x1); /* power enable */
NTV2_FLD(ntv2_fld_hdmiout4_redrivercontrol_pinmode, 1, 1); /* pin mode */
NTV2_CON(ntv2_con_hdmiout4_pinmode_disable, 0x0); /* pin disable */
NTV2_CON(ntv2_con_hdmiout4_pinmode_enable, 0x1); /* pin enable */
NTV2_FLD(ntv2_fld_hdmiout4_redrivercontrol_vodrange, 1, 2); /* differential voltage range */
NTV2_CON(ntv2_con_hdmiout4_vodrange_low, 0x0); /* voltage swing low */
NTV2_CON(ntv2_con_hdmiout4_vodrange_high, 0x1); /* voltage swing high */
NTV2_FLD(ntv2_fld_hdmiout4_redrivercontrol_deemphasis, 2, 4); /* deemphasis */
NTV2_CON(ntv2_con_hdmiout4_deemphasis_0d0db, 0x0); /* 0 db */
NTV2_CON(ntv2_con_hdmiout4_deemphasis_3d5db, 0x1); /* 3.5 db */
NTV2_CON(ntv2_con_hdmiout4_deemphasis_6d0db, 0x2); /* 6 db */
NTV2_CON(ntv2_con_hdmiout4_deemphasis_9d5db, 0x3); /* 9.5 db */
NTV2_FLD(ntv2_fld_hdmiout4_redrivercontrol_preemphasis, 2, 8); /* preemphasis */
NTV2_CON(ntv2_con_hdmiout4_preemphasis_0d0db, 0x0); /* 0 db */
NTV2_CON(ntv2_con_hdmiout4_preemphasis_1d6db, 0x1); /* 1.6 db */
NTV2_CON(ntv2_con_hdmiout4_preemphasis_3d5db, 0x2); /* 3.5 db */
NTV2_CON(ntv2_con_hdmiout4_preemphasis_6d0db, 0x3); /* 6 db */
NTV2_FLD(ntv2_fld_hdmiout4_redrivercontrol_boost, 4, 12); /* boost */
NTV2_CON(ntv2_con_hdmiout4_boost_00d25db, 0x0); /* 0.25 db */
NTV2_CON(ntv2_con_hdmiout4_boost_00d80db, 0x1); /* 0.80 db */
NTV2_CON(ntv2_con_hdmiout4_boost_01d10db, 0x2); /* 1.1 db */
NTV2_CON(ntv2_con_hdmiout4_boost_02d20db, 0x3); /* 2.2 db */
NTV2_CON(ntv2_con_hdmiout4_boost_04d10db, 0x4); /* 4.1 db */
NTV2_CON(ntv2_con_hdmiout4_boost_07d10db, 0x5); /* 7.1 db */
NTV2_CON(ntv2_con_hdmiout4_boost_09d00db, 0x6); /* 9.0 db */
NTV2_CON(ntv2_con_hdmiout4_boost_10d30db, 0x7); /* 10.3 db */
NTV2_CON(ntv2_con_hdmiout4_boost_11d80db, 0x8); /* 11.8 db */
NTV2_CON(ntv2_con_hdmiout4_boost_13d90db, 0x9); /* 13.9 db */
NTV2_CON(ntv2_con_hdmiout4_boost_15d30db, 0xa); /* 15.3 db */
NTV2_CON(ntv2_con_hdmiout4_boost_16d90db, 0xb); /* 16.9 db */
NTV2_CON(ntv2_con_hdmiout4_boost_17d90db, 0xc); /* 17.9 db */
NTV2_CON(ntv2_con_hdmiout4_boost_19d20db, 0xd); /* 19.2 db */
NTV2_CON(ntv2_con_hdmiout4_boost_20d50db, 0xe); /* 20.5 db */
NTV2_CON(ntv2_con_hdmiout4_boost_22d20db, 0xf); /* 22.2 db */
NTV2_REG(ntv2_reg_hdmiout4_refclockfrequency, 0x1d50); /* reference clock frequency */
NTV2_REG(ntv2_reg_hdmiout4_tmdsclockfrequency, 0x1d51); /* tmds clock frequency */
NTV2_REG(ntv2_reg_hdmiout4_txclockfrequency, 0x1d52); /* tx clock frequency */
NTV2_REG(ntv2_reg_hdmiout4_fpllclockfrequency, 0x1d53); /* fpll clock frequency */
NTV2_REG(ntv2_reg_hdmiout4_audio_cts1, 0x1d54); /* audio clock cts 1 */
NTV2_REG(ntv2_reg_hdmiout4_audio_cts2, 0x1d55); /* audio clock cts 2 */
NTV2_REG(ntv2_reg_hdmiout4_audio_cts3, 0x1d56); /* audio clock cts 3 */
NTV2_REG(ntv2_reg_hdmiout4_audio_cts4, 0x1d57); /* audio clock cts 4 */
NTV2_REG(ntv2_reg_hdmiout4_audio_n, 0x1d58); /* audio clock n */
NTV2_REG(ntv2_reg_hdmiout4_croplocation, 0x1d5e); /* crop location */
NTV2_FLD(ntv2_fld_hdmiout4_croplocation_start, 16, 0); /* crop start location */
NTV2_FLD(ntv2_fld_hdmiout4_croplocation_end, 16, 16); /* crop end location */
NTV2_REG(ntv2_reg_hdmiout4_pixelcontrol, 0x1d5f); /* pixel control */
NTV2_FLD(ntv2_fld_hdmiout4_pixelcontrol_lineinterleave, 1, 0); /* line interleave */
NTV2_CON(ntv2_con_hdmiout4_lineinterleave_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiout4_lineinterleave_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiout4_pixelcontrol_pixelinterleave, 1, 1); /* pixel interleave */
NTV2_CON(ntv2_con_hdmiout4_pixelinterleave_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiout4_pixelinterleave_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiout4_pixelcontrol_420convert, 1, 2); /* 420 to 422 conversion */
NTV2_CON(ntv2_con_hdmiout4_420convert_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiout4_420convert_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiout4_pixelcontrol_cropmode, 1, 3); /* crop mode */
NTV2_CON(ntv2_con_hdmiout4_cropmode_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiout4_cropmode_enable, 0x1); /* enable */
NTV2_REG(ntv2_reg_hdmiout4_i2ccontrol, 0x1d60); /* i2c control */
NTV2_FLD(ntv2_fld_hdmiout4_i2ccontrol_writedata, 8, 0); /* write data */
NTV2_FLD(ntv2_fld_hdmiout4_i2ccontrol_subaddress, 8, 8); /* i2c sub-address */
NTV2_FLD(ntv2_fld_hdmiout4_i2ccontrol_devaddress, 7, 16); /* i2c device address */
NTV2_FLD(ntv2_fld_hdmiout4_i2ccontrol_read, 1, 23); /* read (not write) */
NTV2_FLD(ntv2_fld_hdmiout4_i2ccontrol_readdata, 8, 24); /* read data */
NTV2_REG(ntv2_reg_hdmiout4_i2cedid, 0x1d61); /* edid read control */
NTV2_FLD(ntv2_fld_hdmiout4_i2cedid_subaddress, 8, 0); /* edid sub-address */
NTV2_FLD(ntv2_fld_hdmiout4_i2cedid_readdata, 8, 8); /* read data */
NTV2_FLD(ntv2_fld_hdmiout4_i2cedid_update, 1, 16); /* trigger edid update */
NTV2_FLD(ntv2_fld_hdmiout4_i2cedid_done, 1, 17); /* i2c engine done */
NTV2_FLD(ntv2_fld_hdmiout4_i2cedid_present, 1, 27); /* sink present */
NTV2_FLD(ntv2_fld_hdmiout4_i2cedid_hotplugcount, 4, 28); /* hot plug count */
/* hdmi output scdc i2c registers */
NTV2_CON(ntv2_dev_hdmiout4_sink, 0x54); /* sink device address */
NTV2_CON(ntv2_reg_hdmiout4_sinkversion, 0x01); /* sink version */
NTV2_CON(ntv2_reg_hdmiout4_sourceversion, 0x02); /* source version */
NTV2_CON(ntv2_reg_hdmiout4_updateflags0, 0x10); /* update flags */
NTV2_FLD(ntv2_fld_hdmiout4_updateflags0_statusupdate, 1, 0); /* status flags register has changed */
NTV2_FLD(ntv2_fld_hdmiout4_updateflags0_cedupdate, 1, 1); /* character error detection update */
NTV2_FLD(ntv2_fld_hdmiout4_updateflags0_rrtest, 1, 2); /* read request test ack */
NTV2_CON(ntv2_reg_hdmiout4_updateflags1, 0x11); /* update flags */
NTV2_CON(ntv2_reg_hdmiout4_tmdsconfig, 0x20); /* tmds configuration */
NTV2_FLD(ntv2_fld_hdmiout4_tmdsconfig_scamblemode, 1, 0); /* sink scamble mode */
NTV2_CON(ntv2_con_hdmiout4_scamblemode_disable, 0x0); /* disable */
NTV2_CON(ntv2_con_hdmiout4_scamblemode_enable, 0x1); /* enable */
NTV2_FLD(ntv2_fld_hdmiout4_tmdsconfig_clockratio, 1, 1); /* tmds bit clock ratio */
NTV2_CON(ntv2_con_hdmiout4_clockratio_10, 0x0); /* 1/10 */
NTV2_CON(ntv2_con_hdmiout4_clockratio_40, 0x1); /* 1/40 */
NTV2_CON(ntv2_reg_hdmiout4_scamblerstatus, 0x21); /* scrambler status */
NTV2_FLD(ntv2_fld_hdmiout4_scamblerstatus_scrambledetect, 1, 0); /* sink detects scrambling */
NTV2_CON(ntv2_reg_hdmiout4_scdcconfig, 0x30); /* scdc config */
NTV2_FLD(ntv2_fld_hdmiout4_scdcconfig_readmode, 1, 0); /* read request mode */
NTV2_CON(ntv2_con_hdmiout4_readmode_poll, 0x0); /* source polls */
NTV2_CON(ntv2_con_hdmiout4_readmode_request, 0x1); /* source uses read requests */
NTV2_CON(ntv2_reg_hdmiout4_scdcstatus0, 0x40); /* scdc status 0 */
NTV2_FLD(ntv2_fld_hdmiout4_scdcstatus0_clockdetect, 1, 0); /* clock detected */
NTV2_FLD(ntv2_fld_hdmiout4_scdcstatus0_ch0lock, 1, 1); /* channel 0 locked */
NTV2_FLD(ntv2_fld_hdmiout4_scdcstatus0_ch1lock, 1, 2); /* channel 1 locked */
NTV2_FLD(ntv2_fld_hdmiout4_scdcstatus0_ch2lock, 1, 3); /* channel 2 locked */
NTV2_CON(ntv2_reg_hdmiout4_scdcstatus1, 0x41); /* scdc status 1 */
NTV2_CON(ntv2_reg_hdmiout4_ch0errorlow, 0x50); /* channel 0 error count low */
NTV2_FLD(ntv2_fld_hdmiout4_ch0errorlow_count, 8, 0); /* count */
NTV2_CON(ntv2_reg_hdmiout4_ch0errorhigh, 0x51); /* channel 0 error count high */
NTV2_FLD(ntv2_fld_hdmiout4_ch0errorhigh_count, 7, 0); /* count */
NTV2_FLD(ntv2_fld_hdmiout4_ch0errorhigh_valid, 1, 7); /* valid */
NTV2_CON(ntv2_reg_hdmiout4_ch1errorlow, 0x52); /* channel 1 error count low */
NTV2_FLD(ntv2_fld_hdmiout4_ch1errorlow_count, 8, 0); /* count */
NTV2_CON(ntv2_reg_hdmiout4_ch1errorhigh, 0x53); /* channel 1 error count high */
NTV2_FLD(ntv2_fld_hdmiout4_ch1errorhigh_count, 7, 0); /* count */
NTV2_FLD(ntv2_fld_hdmiout4_ch1errorhigh_valid, 1, 7); /* valid */
NTV2_CON(ntv2_reg_hdmiout4_ch2errorlow, 0x54); /* channel 2 error count low */
NTV2_FLD(ntv2_fld_hdmiout4_ch2errorlow_count, 8, 0); /* count */
NTV2_CON(ntv2_reg_hdmiout4_ch2errorhigh, 0x55); /* channel 3 error count high */
NTV2_FLD(ntv2_fld_hdmiout4_ch2errorhigh_count, 7, 0); /* count */
NTV2_FLD(ntv2_fld_hdmiout4_ch2errorhigh_valid, 1, 7); /* valid */
NTV2_CON(ntv2_reg_hdmiout4_errorchecksum, 0x55); /* checksum of all channel errors */
#endif

View File

@ -1,54 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2infoframe.h
// Purpose: HDMI info frame parser
//
///////////////////////////////////////////////////////////////
#ifndef NTV2_INFOFRAME_H
#define NTV2_INFOFRAME_H
#include "ntv2system.h"
struct ntv2_avi_info_data {
uint32_t video_standard;
uint32_t frame_rate;
uint32_t color_space;
uint32_t aspect_ratio;
uint32_t colorimetry;
uint32_t quantization;
};
struct ntv2_drm_info_data {
uint32_t eotf;
uint32_t metadata_id;
uint32_t primary_x0;
uint32_t primary_y0;
uint32_t primary_x1;
uint32_t primary_y1;
uint32_t primary_x2;
uint32_t primary_y2;
uint32_t white_point_x;
uint32_t white_point_y;
uint32_t luminance_max;
uint32_t luminance_min;
uint32_t content_level_max;
uint32_t frameavr_level_max;
};
struct ntv2_vsp_info_data {
uint32_t hdmi_video_format;
uint32_t hdmi_vic;
uint32_t dolby_vision;
};
bool ntv2_aux_to_avi_info(uint32_t *aux_data, uint32_t aux_size, struct ntv2_avi_info_data *avi_data);
bool ntv2_aux_to_drm_info(uint32_t *aux_data, uint32_t aux_size, struct ntv2_drm_info_data *drm_data);
bool ntv2_aux_to_vsp_info(uint32_t *aux_data, uint32_t aux_size, struct ntv2_vsp_info_data *vsp_data);
#endif

View File

@ -1,145 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2kona.h
// Purpose: Common configuration and status
//
///////////////////////////////////////////////////////////////
#ifndef NTV2KONA_HEADER
#define NTV2KONA_HEADER
#include "ntv2system.h"
#include "ntv2devicefeatures.h"
#include "ntv2xpt.h"
#include "ntv2vpid.h"
#include "ntv2rp188.h"
#include "ntv2anc.h"
///////////////////////
//board format routines
NTV2VideoFormat GetBoardVideoFormat(Ntv2SystemContext* context, NTV2Channel channel);
NTV2Standard GetStandard(Ntv2SystemContext* context, NTV2Channel channel);
NTV2FrameGeometry GetFrameGeometry(Ntv2SystemContext* context, NTV2Channel channel);
NTV2FrameRate GetFrameRate(Ntv2SystemContext* context, NTV2Channel channel);
bool IsProgressiveStandard(Ntv2SystemContext* context, NTV2Channel channel);
bool GetSmpte372(Ntv2SystemContext* context, NTV2Channel channel);
bool GetQuadFrameEnable(Ntv2SystemContext* context, NTV2Channel channel);
bool Get4kSquaresEnable (Ntv2SystemContext* context, NTV2Channel channel);
bool Get425FrameEnable (Ntv2SystemContext* context, NTV2Channel channel);
bool Get12GTSIFrameEnable (Ntv2SystemContext* context, NTV2Channel channel);
bool GetQuadQuadFrameEnable(Ntv2SystemContext* context, NTV2Channel channel);
bool GetQuadQuadSquaresEnable(Ntv2SystemContext* context, NTV2Channel channel);
bool IsMultiFormatActive (Ntv2SystemContext* context);
bool GetEnable4KDCPSFOutMode(Ntv2SystemContext* context);
NTV2FrameBufferFormat GetFrameBufferFormat(Ntv2SystemContext* context, NTV2Channel channel);
void SetFrameBufferFormat(Ntv2SystemContext* context, NTV2Channel channel, NTV2FrameBufferFormat value);
NTV2VideoFrameBufferOrientation GetFrameBufferOrientation(Ntv2SystemContext* context, NTV2Channel channel);
void SetFrameBufferOrientation(Ntv2SystemContext* context, NTV2Channel channel, NTV2VideoFrameBufferOrientation value);
bool GetConverterOutStandard(Ntv2SystemContext* context, NTV2Standard* value);
bool ReadFSHDRRegValues(Ntv2SystemContext* context, NTV2Channel channel, HDRDriverValues* hdrRegValues);
///////////////////////
NTV2Mode GetMode(Ntv2SystemContext* context, NTV2Channel channel);
void SetMode(Ntv2SystemContext* context, NTV2Channel channel, NTV2Mode value);
uint32_t GetOutputFrame(Ntv2SystemContext* context, NTV2Channel channel);
void SetOutputFrame(Ntv2SystemContext* context, NTV2Channel channel, uint32_t value);
uint32_t GetInputFrame(Ntv2SystemContext* context, NTV2Channel channel);
void SetInputFrame(Ntv2SystemContext* context, NTV2Channel channel, uint32_t value);
uint32_t GetPCIAccessFrame(Ntv2SystemContext* context, NTV2Channel channel);
void SetPCIAccessFrame(Ntv2SystemContext* context, NTV2Channel channel, uint32_t value);
bool Get2piCSC(Ntv2SystemContext* context, NTV2Channel channel);
bool Set2piCSC(Ntv2SystemContext* context, NTV2Channel channel, bool enable);
NTV2FrameBufferFormat GetDualLink5PixelFormat(Ntv2SystemContext* context);
void SetDualLink5PixelFormat(Ntv2SystemContext* context, NTV2FrameBufferFormat value);
ULWord GetHWFrameBufferSize(Ntv2SystemContext* context, NTV2Channel channel);
ULWord GetFrameBufferSize(Ntv2SystemContext* context, NTV2Channel channel);
///////////////////////
bool FieldDenotesStartOfFrame(Ntv2SystemContext* context, NTV2Crosspoint channelSpec);
bool IsFieldID0(Ntv2SystemContext* context, NTV2Crosspoint xpt);
///////////////////////
//sdi routines
bool SetVideoOutputStandard(Ntv2SystemContext* context, NTV2Channel channel);
bool SetSDIOutStandard(Ntv2SystemContext* context, NTV2Channel channel, NTV2Standard value);
bool SetSDIOut_2Kx1080Enable(Ntv2SystemContext* context, NTV2Channel channel, bool enable);
bool GetSDIOut3GEnable(Ntv2SystemContext* context, NTV2Channel channel, bool* enable);
bool SetSDIOut3GEnable(Ntv2SystemContext* context, NTV2Channel channel, bool enable);
bool GetSDIOut3GbEnable(Ntv2SystemContext* context, NTV2Channel channel, bool* enable);
bool SetSDIOut3GbEnable(Ntv2SystemContext* context, NTV2Channel channel, bool enable);
bool GetSDIOut6GEnable(Ntv2SystemContext* context, NTV2Channel channel, bool* enable);
bool SetSDIOut6GEnable(Ntv2SystemContext* context, NTV2Channel channel, bool enable);
bool GetSDIOut12GEnable(Ntv2SystemContext* context, NTV2Channel channel, bool* enable);
bool SetSDIOut12GEnable(Ntv2SystemContext* context, NTV2Channel channel, bool enable);
bool GetSDIOutRGBLevelAConversion(Ntv2SystemContext* context, NTV2Channel channel, bool* enable);
bool GetSDIOutLevelAtoLevelBConversion(Ntv2SystemContext* context, NTV2Channel channel, bool* enable);
bool GetSDIInLevelBtoLevelAConversion(Ntv2SystemContext* context, NTV2Channel channel, bool* enable);
bool GetSDIIn6GEnable(Ntv2SystemContext* context, NTV2Channel channel);
bool GetSDIIn12GEnable(Ntv2SystemContext* context, NTV2Channel channel);
///////////////////////
//hdmi routines
bool SetLHiHDMIOutputStandard(Ntv2SystemContext* context);
bool SetHDMIOutputStandard(Ntv2SystemContext* context);
bool SetHDMIV2LevelBEnable(Ntv2SystemContext* context, bool enable);
bool SetMultiRasterInputStandard(Ntv2SystemContext* context, NTV2Standard mrStandard, NTV2Channel mrChannel);
bool SetEnableMultiRasterCapture(Ntv2SystemContext* context, bool bEnable);
bool HasMultiRasterWidget(Ntv2SystemContext* context);
bool IsMultiRasterEnabled(Ntv2SystemContext* context);
///////////////////////
//hdr routines
bool EnableHDMIHDR(Ntv2SystemContext* context, bool inEnableHDMIHDR);
bool GetEnableHDMIHDR(Ntv2SystemContext* context);
bool SetHDRData(Ntv2SystemContext* context, HDRDriverValues inRegisterValues);
bool GetHDRData(Ntv2SystemContext* context, HDRDriverValues* inRegisterValues);
///////////////////////
//analog routines
bool SetLHiAnalogOutputStandard(Ntv2SystemContext* context);
///////////////////////
//converter routines
bool GetK2ConverterOutFormat(Ntv2SystemContext* context, NTV2VideoFormat* format);
///////////////////////
//input routines
bool GetSourceVideoFormat(Ntv2SystemContext* context, NTV2VideoFormat* format, NTV2OutputXptID crosspoint, bool* quadMode, bool* quadQuadMode, HDRDriverValues* hdrRegValues);
NTV2VideoFormat GetInputVideoFormat(Ntv2SystemContext* context, NTV2Channel channel);
NTV2VideoFormat GetHDMIInputVideoFormat(Ntv2SystemContext* context);
NTV2VideoFormat GetAnalogInputVideoFormat(Ntv2SystemContext* context);
///////////////////////
//interrupt routines
bool UpdateAudioMixerGainFromRotaryEncoder(Ntv2SystemContext* context);
///////////////////////
//util routines
ULWord IsScanGeometry2Kx1080(NTV2ScanGeometry scanGeometry);
bool IsVideoFormat2Kx1080(NTV2VideoFormat videoFormat);
NTV2Crosspoint GetNTV2CrosspointChannelForIndex(ULWord index);
ULWord GetIndexForNTV2CrosspointChannel(NTV2Crosspoint channel);
NTV2Crosspoint GetNTV2CrosspointInputForIndex(ULWord index);
ULWord GetIndexForNTV2CrosspointInput(NTV2Crosspoint channel);
NTV2Crosspoint GetNTV2CrosspointForIndex(ULWord index);
ULWord GetIndexForNTV2Crosspoint(NTV2Crosspoint channel);
NTV2Channel GetNTV2ChannelForNTV2Crosspoint(NTV2Crosspoint crosspoint);
NTV2VideoFormat GetVideoFormatFromState(NTV2Standard standard, NTV2FrameRate frameRate, ULWord is2Kx1080, ULWord smpte372Enabled);
NTV2Standard GetNTV2StandardFromVideoFormat(NTV2VideoFormat videoFormat);
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(NTV2VideoFormat videoFormat);
NTV2Channel GetOutXptChannel(NTV2OutputCrosspointID inXpt, bool multiFormatActive);
NTV2Standard GetStandardFromScanGeometry(NTV2ScanGeometry scanGeometry, ULWord progressive);
NTV2VideoFormat GetQuadSizedVideoFormat(NTV2VideoFormat videoFormat);
NTV2VideoFormat Get12GVideoFormat(NTV2VideoFormat videoFormat);
NTV2VideoFormat GetQuadQuadSizedVideoFormat(NTV2VideoFormat videoFormat);
NTV2VideoFormat GetHDSizedVideoFormat(NTV2VideoFormat videoFormat);
bool HDRIsChanging(HDRDriverValues inCurrentHDR, HDRDriverValues inNewHDR);
#endif

View File

@ -1,84 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2mcap.h
// Purpose: Xilinx bitfile loading
//
///////////////////////////////////////////////////////////////
#ifndef NTV2MCAP_HEADER
#define NTV2MCAP_HEADER
#include "ntv2system.h"
/* mcap register map */
#define MCAP_EXT_CAP_HEADER 0x00
#define MCAP_VEND_SPEC_HEADER 0x04
#define MCAP_FPGA_JTAG_ID 0x08
#define MCAP_FPGA_BIT_VERSION 0x0C
#define MCAP_STATUS 0x10
#define MCAP_CONTROL 0x14
#define MCAP_DATA 0x18
#define MCAP_READ_DATA_0 0x1C
#define MCAP_READ_DATA_1 0x20
#define MCAP_READ_DATA_2 0x24
#define MCAP_READ_DATA_3 0x28
/* mcap control register bit map */
#define MCAP_CTRL_CONFIG_ENABLE_MASK (1 << 0)
#define MCAP_CTRL_READ_ENABLE_MASK (1 << 1)
#define MCAP_CTRL_CONFIG_RESET_MASK (1 << 4)
#define MCAP_CTRL_MODULE_RESET_MASK (1 << 5)
#define MCAP_CTRL_PCI_REQUEST_MASK (1 << 8)
#define MCAP_CTRL_BAR_ENABLE_MASK (1 << 12)
#define MCAP_CTRL_WRITE_ENABLE_MASK (1 << 16)
/* mcap status register bit map */
#define MCAP_STS_ERR_MASK (1 << 0)
#define MCAP_STS_EOS_MASK (1 << 1)
#define MCAP_STS_REG_READ_CMP_MASK (1 << 4)
#define MCAP_STS_REG_READ_COUNT_MASK (7 << 5)
#define MCAP_STS_REG_READ_COUNT_SHIFT (5)
#define MCAP_STS_FIFO_OVERFLOW_MASK (1 << 8)
#define MCAP_STS_FIFO_OCCUPANCY_MASK (15 << 12)
#define MCAP_STS_FIFO_OCCUPANCY_SHIFT (12)
#define MCAP_STS_CONFIG_RELEASE_MASK (1 << 24)
/* mcap pci extended capability id */
#define MCAP_EXT_CAP_ID 0xB
/* mcap timeout counts */
#define MCAP_EOS_RETRY_COUNT 10
#define MCAP_EOS_LOOP_COUNT 100
/* mcap bit data fill */
#define MCAP_NOOP_VAL 0x2000000
#define NTV2_MCAP_STRING_SIZE 80
struct ntv2_mcap {
char name[NTV2_MCAP_STRING_SIZE];
Ntv2SystemContext* system_context;
int32_t reg_base;
bool fragment;
};
struct ntv2_mcap *ntv2_mcap_open(Ntv2SystemContext *sys_con, const char *name);
void ntv2_mcap_close(struct ntv2_mcap *ntv2_mc);
Ntv2Status ntv2_mcap_configure(struct ntv2_mcap *ntv2_mc);
Ntv2Status ntv2_mcap_config_reset(struct ntv2_mcap *ntv2_mc);
Ntv2Status ntv2_mcap_module_reset(struct ntv2_mcap *ntv2_mc);
Ntv2Status ntv2_mcap_full_reset(struct ntv2_mcap *ntv2_mc);
Ntv2Status ntv2_mcap_write_bitstream(struct ntv2_mcap *ntv2_mc, void* data,
uint32_t bytes, bool fragment, bool swap);
Ntv2Status ntv2_mcap_read_register(struct ntv2_mcap *ntv2_mc, uint32_t offset, uint32_t* data);
#endif

View File

@ -1,22 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2pciconfig.h
// Purpose: PCI configuration space utility
//
///////////////////////////////////////////////////////////////
#ifndef NTV2PCICONFIG_HEADER
#define NTV2PCICONFIG_HEADER
#include "ntv2system.h"
int32_t ntv2PciFindCapability(Ntv2SystemContext* pSysCon, uint32_t cap_id);
int32_t ntv2PciFindExtCapability(Ntv2SystemContext* pSysCon, uint32_t ext_id);
uint32_t ntv2ReadPciMaxReadRequestSize(Ntv2SystemContext* pSysCon);
Ntv2Status ntv2WritePciMaxReadRequestSize(Ntv2SystemContext* pSysCon, uint32_t reqSize);
#endif

View File

@ -1,69 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2rp188.h
// Purpose: Common RP188
//
///////////////////////////////////////////////////////////////
#ifndef NTV2RP188_HEADER
#define NTV2RP188_HEADER
#include "ntv2kona.h"
typedef struct {
RP188_STRUCT TCInOut1;
RP188_STRUCT TCInOut2;
RP188_STRUCT TCInOut3;
RP188_STRUCT TCInOut4;
RP188_STRUCT LTCEmbedded1;
RP188_STRUCT LTCAnalog1;
RP188_STRUCT LTCEmbedded2;
RP188_STRUCT LTCAnalog2;
RP188_STRUCT TCInOut5;
RP188_STRUCT TCInOut6;
RP188_STRUCT TCInOut7;
RP188_STRUCT TCInOut8;
RP188_STRUCT LTCEmbedded3;
RP188_STRUCT LTCEmbedded4;
RP188_STRUCT LTCEmbedded5;
RP188_STRUCT LTCEmbedded6;
RP188_STRUCT LTCEmbedded7;
RP188_STRUCT LTCEmbedded8;
RP188_STRUCT TCInOut1_2;
RP188_STRUCT TCInOut2_2;
RP188_STRUCT TCInOut3_2;
RP188_STRUCT TCInOut4_2;
RP188_STRUCT TCInOut5_2;
RP188_STRUCT TCInOut6_2;
RP188_STRUCT TCInOut7_2;
RP188_STRUCT TCInOut8_2;
} INTERNAL_TIMECODE_STRUCT;
typedef struct {
NTV2SDIInputStatus SDIStatus1;
NTV2SDIInputStatus SDIStatus2;
NTV2SDIInputStatus SDIStatus3;
NTV2SDIInputStatus SDIStatus4;
NTV2SDIInputStatus SDIStatus5;
NTV2SDIInputStatus SDIStatus6;
NTV2SDIInputStatus SDIStatus7;
NTV2SDIInputStatus SDIStatus8;
} INTERNAL_SDI_STATUS_STRUCT;
bool InitRP188(Ntv2SystemContext* context);
extern bool CopyRP188HardwareToFrameStampTCArray(Ntv2SystemContext* context, INTERNAL_TIMECODE_STRUCT* tcStruct);
bool CopyFrameStampTCArrayToHardware(Ntv2SystemContext* context, INTERNAL_TIMECODE_STRUCT* acFrameStampTCArray);
bool CopyNTV2TimeCodeArrayToFrameStampTCArray(INTERNAL_TIMECODE_STRUCT * tcStruct, NTV2_RP188 * pInTCArray, ULWord inMaxBytes);
bool CopyFrameStampTCArrayToNTV2TimeCodeArray(INTERNAL_TIMECODE_STRUCT * tcStruct, NTV2_RP188 * pOutTCArray, ULWord inMaxBytes);
void SetRP188Mode(Ntv2SystemContext* context, NTV2Channel channel, NTV2_RP188Mode value);
bool GetReceivedTCForChannel(Ntv2SystemContext* context, NTV2Channel channel, RP188_STRUCT* LTCIn, RP188_STRUCT* VITC1In, RP188_STRUCT* VITC2In);
bool GetReceivedAnalogLTC(Ntv2SystemContext* context, RP188_STRUCT* LTCAnalog1In, RP188_STRUCT* LTCAnalog2In);
bool CopyFrameStampSDIStatusArrayToNTV2SDIStatusArray(INTERNAL_SDI_STATUS_STRUCT * tcStruct, NTV2SDIInputStatus * pOutTCArray, ULWord inMaxBytes);
bool CopySDIStatusHardwareToFrameStampSDIStatusArray(Ntv2SystemContext* context, INTERNAL_SDI_STATUS_STRUCT* sdiStruct);
bool CopyFrameRP188ToHardware(Ntv2SystemContext* context, RP188_STRUCT* rp188);
#endif

View File

@ -1,36 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2setup.h
// Purpose: Monitor and setup outputs, vpid and other stuff
//
///////////////////////////////////////////////////////////////
#ifndef NTV2SETUP_HEADER
#define NTV2SETUP_HEADER
#include "ntv2system.h"
#define NTV2_SETUP_STRING_SIZE 80
struct ntv2_setup {
int index;
char name[NTV2_SETUP_STRING_SIZE];
Ntv2SystemContext* system_context;
Ntv2SpinLock state_lock;
Ntv2Thread monitor_task;
bool monitor_enable;
Ntv2Event monitor_event;
};
struct ntv2_setup *ntv2_setup_open(Ntv2SystemContext* sys_con, const char *name);
void ntv2_setup_close(struct ntv2_setup *ntv2_setterupper);
Ntv2Status ntv2_setup_configure(struct ntv2_setup *ntv2_setterupper);
Ntv2Status ntv2_setup_enable(struct ntv2_setup *ntv2_setterupper);
Ntv2Status ntv2_setup_disable(struct ntv2_setup *ntv2_setterupper);
#endif

View File

@ -1,569 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
///////////////////////////////////////////////////////////////
//
// Device Driver for AJA OEM devices.
//
////////////////////////////////////////////////////////////
//
// Filename: ntv2system.h
// Purpose: NTV2 system function abstraction
// Notes:
//
///////////////////////////////////////////////////////////////
#ifndef NTV2SYSTEM_H
#define NTV2SYSTEM_H
#define NTV2_MEMORY_ALIGN_DEFAULT 64
#define NTV2_MEMORY_ALIGN_MAX 4096
#if defined(AJAVirtual)
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "ajatypes.h"
// virtual return codes
typedef int Ntv2Status;
#define NTV2_STATUS_SUCCESS (0)
#define NTV2_STATUS_FAIL (-1)
#define NTV2_STATUS_NO_DEVICE (-2)
#define NTV2_STATUS_BAD_STATE (-3)
#define NTV2_STATUS_BAD_PARAMETER (-4)
#define NTV2_STATUS_NO_MEMORY (-5)
#define NTV2_STATUS_BUSY (-6)
#define NTV2_STATUS_IO_ERROR (-7)
#define NTV2_STATUS_TIMEOUT (-8)
#define NTV2_STATUS_NO_RESOURCES (-9)
// virtual try/catch
#define NTV2_TRY if (true)
#define NTV2_CATCH if (false)
// virtual system context
typedef struct ntv2_system_context
{
} Ntv2SystemContext;
// virtual register abstraction
typedef void* Ntv2Register;
//MRBILL #define ntv2WriteRegister32(reg, value)
//MRBILL #define ntv2ReadRegister32(reg)
// virtual message abstraction
#define ntv2Message(string, ...) printf(string, __VA_ARGS__)
// virtual spinlock abstraction
typedef struct ntv2_spinlock
{
} Ntv2SpinLock;
// virtual interrupt lock abstraction
typedef struct ntv2_interrupt_lock
{
} Ntv2InterruptLock;
// virtual memory abstraction
typedef void* Ntv2DmaAddress;
typedef struct ntv2_dma_memory
{
void* pAddress;
Ntv2DmaAddress dmaAddress;
uint32_t size;
} Ntv2DmaMemory;
// virtual user buffer abstraction
typedef struct ntv2_user_buffer
{
void* pAddress;
uint32_t size;
bool write;
} Ntv2UserBuffer;
// virtual dpc task abstraction
typedef unsigned long Ntv2DpcData;
typedef void Ntv2DpcTask(Ntv2DpcData data);
typedef struct ntv2_dpc
{
} Ntv2Dpc;
// virtual event abstraction
typedef struct ntv2_event
{
} Ntv2Event;
// virtual semaphore abstraction
typedef struct ntv2_semaphore
{
} Ntv2Semaphore;
// virtual thread abstraction
typedef void Ntv2ThreadTask(void* pContext);
typedef struct ntv2_thread
{
const char* pName;
Ntv2ThreadTask* pFunc;
void* pContext;
bool run;
} Ntv2Thread;
//endif // defined(AJAVirtual)
#elif defined(MSWindows)
#define NO_STRICT
#include <ntifs.h>
#include <ntddk.h>
#include <wmilib.h>
#pragma warning(disable:4201)
#include <wdf.h>
#pragma warning(default:4201)
//#define NTSTRSAFE_LIB
#include <ntstrsafe.h>
#include <ntddser.h>
#if !defined (__cplusplus)
typedef unsigned char bool;
#define true 1
#define false 0
#endif
#include "ajatypes.h"
#include "ntv2publicinterface.h"
// windows return codes
typedef NTSTATUS Ntv2Status;
#define NTV2_STATUS_SUCCESS (STATUS_SUCCESS)
#define NTV2_STATUS_FAIL (STATUS_UNSUCCESSFUL)
#define NTV2_STATUS_NO_DEVICE (STATUS_NO_SUCH_DEVICE)
#define NTV2_STATUS_BAD_STATE (STATUS_INVALID_DEVICE_STATE)
#define NTV2_STATUS_BAD_PARAMETER (STATUS_INVALID_PARAMETER)
#define NTV2_STATUS_NO_MEMORY (STATUS_NO_MEMORY)
#define NTV2_STATUS_BUSY (STATUS_DEVICE_BUSY)
#define NTV2_STATUS_IO_ERROR (STATUS_IO_DEVICE_ERROR)
#define NTV2_STATUS_TIMEOUT (STATUS_IO_TIMEOUT)
#define NTV2_STATUS_NO_RESOURCES (STATUS_INSUFFICIENT_RESOURCES)
// windows system context
typedef struct ntv2_system_context
{
uint32_t devNum; // device number
WDFDRIVER wdfDriver; // wdf driver
WDFDEVICE wdfDevice; // wdf device
WDFINTERRUPT wdfInterrupt; // wdf interrupt
WDFDMAENABLER wdfDmaEnabler; // wdf dma enabler
ULONG busNumber; // device pci bus number
BUS_INTERFACE_STANDARD BusInterface; // windows bus interface
PBUS_INTERFACE_STANDARD pBusInterface; // bus interface pointer
} Ntv2SystemContext;
// windows register abstraction
typedef uint8_t* Ntv2Register;
#define ntv2WriteRegister32(reg, value) WRITE_REGISTER_ULONG((ULONG*)(reg), (ULONG)(value))
#define ntv2ReadRegister32(reg) READ_REGISTER_ULONG((ULONG*)(reg))
// windows message abstraction
#define ntv2Message(string, ...) DbgPrint(string, __VA_ARGS__)
// windows spinlock abstraction
typedef struct ntv2_spinlock
{
KSPIN_LOCK lock;
KIRQL irql;
} Ntv2SpinLock;
// windows interrupt lock abstraction
typedef struct ntv2_interrupt_lock
{
WDFINTERRUPT wdfInterrupt;
bool locked;
} Ntv2InterruptLock;
// windows memory abstraction
typedef int64_t Ntv2DmaAddress;
typedef struct ntv2_dma_memory
{
WDFCOMMONBUFFER wdfCommonBuffer;
PVOID pAddress;
Ntv2DmaAddress dmaAddress;
uint32_t size;
} Ntv2DmaMemory;
// windows user buffer abstraction
typedef struct ntv2_user_buffer
{
PVOID pAddress;
uint32_t size;
bool write;
} Ntv2UserBuffer;
// windows dpc task abstraction
typedef uint64_t Ntv2DpcData;
typedef void Ntv2DpcTask(Ntv2DpcData data);
typedef struct ntv2_dpc
{
WDFDPC wdfDpc;
} Ntv2Dpc;
// windows event abstraction
typedef struct ntv2_event
{
KEVENT event;
} Ntv2Event;
// windows semaphore abstraction
typedef struct ntv2_semaphore
{
KSEMAPHORE semaphore;
} Ntv2Semaphore;
// windows thread abstraction
typedef void Ntv2ThreadTask(void* pContext);
typedef struct ntv2_thread
{
PKTHREAD pTask;
const char *pName;
Ntv2ThreadTask* pFunc;
void *pContext;
bool run;
} Ntv2Thread;
//endif // defined(MSWindows)
#elif defined(AJAMac)
#include "ajatypes.h"
#if defined(NTV2_BUILDING_DRIVER)
#include <IOKit/IOLocks.h>
#include <IOKit/IOLib.h>
#include "MacLog.h"
#endif
// Mac return codes
typedef IOReturn Ntv2Status;
#define NTV2_STATUS_SUCCESS (kIOReturnSuccess)
#define NTV2_STATUS_FAIL (kIOReturnError)
#define NTV2_STATUS_NO_DEVICE (kIOReturnNoDevice)
#define NTV2_STATUS_BAD_STATE (kIOReturnInvalid)
#define NTV2_STATUS_BAD_PARAMETER (kIOReturnBadArgument)
#define NTV2_STATUS_NO_MEMORY (kIOReturnNoMemory)
#define NTV2_STATUS_BUSY (kIOReturnBusy)
#define NTV2_STATUS_IO_ERROR (kIOReturnIPCError)
#define NTV2_STATUS_TIMEOUT (kIOReturnTimeout)
#define NTV2_STATUS_NO_RESOURCES (kIOReturnNoResources)
// windows message abstraction
#define ntv2Message(string, ...) DebugLog(string, __VA_ARGS__)
// Mac system context
typedef void* ntv2_mac_driver_ref;
typedef struct ntv2_system_context
{
ntv2_mac_driver_ref macDriverRef;
} Ntv2SystemContext;
// Mac register abstraction
typedef uint8_t* Ntv2Register;
// Mac spinlock abstraction
//class IOSimpleLock;
typedef struct ntv2_spinlock
{
IOSimpleLock* lock;
} Ntv2SpinLock;
// Mac event abstraction
//class IORecursiveLock;
typedef struct ntv2_event
{
IORecursiveLock* pRecursiveLock;
bool flag;
} Ntv2Event;
// Mac thread abstraction
typedef void Ntv2ThreadTask(void* pContext);
typedef struct ntv2_thread
{
thread_t pTask;
const char *pName;
Ntv2ThreadTask* pFunc;
void *pContext;
bool run;
} Ntv2Thread;
//endif // defined(AJAMac)
#elif defined(AJALinux)
// linux system headers
#if defined(CONFIG_SMP)
#define __SMP__
#endif
#include <linux/version.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/pci.h>
#include <linux/cdev.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/time.h>
#include <linux/kthread.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include "ajatypes.h"
// linux return codes
typedef int Ntv2Status;
#define NTV2_STATUS_SUCCESS (0)
#define NTV2_STATUS_FAIL (-EAGAIN)
#define NTV2_STATUS_NO_DEVICE (-ENODEV)
#define NTV2_STATUS_BAD_STATE (-EPERM)
#define NTV2_STATUS_BAD_PARAMETER (-EINVAL)
#define NTV2_STATUS_NO_MEMORY (-ENOMEM)
#define NTV2_STATUS_BUSY (-EBUSY)
#define NTV2_STATUS_IO_ERROR (-EIO)
#define NTV2_STATUS_TIMEOUT (-ETIME)
#define NTV2_STATUS_NO_RESOURCES (-ENOMEM)
// linux system context
typedef struct ntv2_system_context
{
uint32_t devNum; // device number
struct pci_dev* pDevice; // linux pci device
uint32_t busNumber; // pci bus number
} Ntv2SystemContext;
// linux register abstraction
typedef void __iomem* Ntv2Register;
#define ntv2WriteRegister32(reg, value) iowrite32((uint32_t)(value), (void*)(reg))
#define ntv2ReadRegister32(reg) ioread32((void*)(reg))
// linux message abstraction
#define ntv2Message(string, ...) printk(KERN_ALERT string, __VA_ARGS__)
// linux spinlock abstraction
typedef struct ntv2_spinlock
{
spinlock_t lock;
} Ntv2SpinLock;
// linux interrupt lock abstraction
typedef struct ntv2_interrupt_lock
{
spinlock_t lock;
unsigned long flags;
} Ntv2InterruptLock;
// linux memory abstraction
typedef dma_addr_t Ntv2DmaAddress;
typedef struct ntv2_dma_memory
{
struct pci_dev* pDevice;
void* pAddress;
Ntv2DmaAddress dmaAddress;
uint32_t size;
} Ntv2DmaMemory;
// linux user buffer abstraction
typedef struct ntv2_user_buffer
{
void* pAddress;
uint32_t size;
bool write;
} Ntv2UserBuffer;
// linux dpc task abstraction
typedef unsigned long Ntv2DpcData;
typedef void Ntv2DpcTask(Ntv2DpcData data);
typedef struct ntv2_dpc
{
struct tasklet_struct tasklet;
} Ntv2Dpc;
// linux event abstraction
typedef struct ntv2_event
{
wait_queue_head_t event;
bool flag;
} Ntv2Event;
// linux semaphore abstraction
typedef struct ntv2_semaphore
{
struct semaphore semaphore;
} Ntv2Semaphore;
// linux thread abstraction
typedef void Ntv2ThreadTask(void* pContext);
typedef struct ntv2_thread
{
const char* pName;
struct task_struct* pTask;
Ntv2ThreadTask* pFunc;
void* pContext;
bool run;
} Ntv2Thread;
#endif // defined(AJALinux)
#if defined (AJAMac)
// Mac register read/write
uint32_t ntv2ReadRegister32(Ntv2SystemContext* context, uint32_t regNum);
void ntv2WriteRegister32(Ntv2SystemContext* context, uint32_t regNum, uint32_t regValue);
#endif
uint32_t ntv2ReadRegister(Ntv2SystemContext* context, uint32_t regnNum);
bool ntv2ReadRegisterMS(Ntv2SystemContext* context, uint32_t regnum, uint32_t* data, uint32_t regMask, uint32_t regShift);
bool ntv2WriteRegister(Ntv2SystemContext* context, uint32_t regnum, uint32_t data);
bool ntv2WriteRegisterMS(Ntv2SystemContext* context, uint32_t regnum, uint32_t data, uint32_t regMask, uint32_t regShift);
uint32_t ntv2ReadVirtualRegister(Ntv2SystemContext* context, uint32_t regNum);
bool ntv2WriteVirtualRegister(Ntv2SystemContext* context, uint32_t regNum, uint32_t data);
// spinlock functions
bool ntv2SpinLockOpen(Ntv2SpinLock* pSpinLock, Ntv2SystemContext* pSysCon);
void ntv2SpinLockClose(Ntv2SpinLock* pSpinLock);
void ntv2SpinLockAcquire(Ntv2SpinLock* pSpinLock);
void ntv2SpinLockRelease(Ntv2SpinLock* pSpinLock);
// memory functions
void* ntv2MemoryAlloc(uint32_t size);
void ntv2MemoryFree(void* pAddress, uint32_t size);
// event functions
bool ntv2EventOpen(Ntv2Event* pEvent, Ntv2SystemContext* pSysCon);
void ntv2EventClose(Ntv2Event* pEvent);
void ntv2EventSignal(Ntv2Event* pEvent);
void ntv2EventClear(Ntv2Event* pEvent);
bool ntv2EventWaitForSignal(Ntv2Event* pEvent, int64_t timeout, bool alert);
// sleep function
void ntv2TimeSleep(int64_t microseconds);
// kernel thread
bool ntv2ThreadOpen(Ntv2Thread* pThread, Ntv2SystemContext* pSysCon, const char* pName);
void ntv2ThreadClose(Ntv2Thread* pThread);
bool ntv2ThreadRun(Ntv2Thread* pThread, Ntv2ThreadTask* pTask, void* pContext);
void ntv2ThreadStop(Ntv2Thread* pThread);
const char* ntv2ThreadGetName(Ntv2Thread* pThread);
bool ntv2ThreadShouldStop(Ntv2Thread* pThread);
void ntv2ThreadExit(Ntv2Thread* pThread);
// pci configuration space
Ntv2Status ntv2ReadPciConfig(Ntv2SystemContext* pSysCon, void* pData, int32_t offset, int32_t size);
Ntv2Status ntv2WritePciConfig(Ntv2SystemContext* pSysCon, void* pData, int32_t offset, int32_t size);
#if defined(MSWindows) || defined(AJALinux) || defined(AJAVirtual)
// interrupt lock functions
bool ntv2InterruptLockOpen(Ntv2InterruptLock* pInterruptLock, Ntv2SystemContext* pSysCon);
void ntv2InterruptLockClose(Ntv2InterruptLock* pInterruptLock);
void ntv2InterruptLockAcquire(Ntv2InterruptLock* pInterruptLock);
void ntv2InterruptLockRelease(Ntv2InterruptLock* pInterruptLock);
// dma functions
bool ntv2DmaMemoryAlloc(Ntv2DmaMemory* pDmaMemory, Ntv2SystemContext* pSysCon, uint32_t size);
void ntv2DmaMemoryFree(Ntv2DmaMemory* pDmaMemory);
void* ntv2DmaMemoryVirtual(Ntv2DmaMemory* pDmaMemory);
Ntv2DmaAddress ntv2DmaMemoryPhysical(Ntv2DmaMemory* pDmaMemory);
uint32_t ntv2DmaMemorySize(Ntv2DmaMemory* pDmaMemory);
// user buffer functions
bool ntv2UserBufferPrepare(Ntv2UserBuffer* pUserBuffer, Ntv2SystemContext* pSysCon, uint64_t address, uint32_t size, bool write);
void ntv2UserBufferRelease(Ntv2UserBuffer* pUserBuffer);
bool ntv2UserBufferCopyTo(Ntv2UserBuffer* pDstBuffer, uint32_t dstOffset, void* pSrcAddress, uint32_t size);
bool ntv2UserBufferCopyFrom(Ntv2UserBuffer* pSrcBuffer, uint32_t srcOffset, void* pDstAddress, uint32_t size);
// dpc task functions
bool ntv2DpcOpen(Ntv2Dpc* pDpc, Ntv2SystemContext* pSysCon, Ntv2DpcTask* pDpcTask, Ntv2DpcData dpcData);
void ntv2DpcClose(Ntv2Dpc* pDpc);
void ntv2DpcSchedule(Ntv2Dpc* pDpc);
// semaphore functions
bool ntv2SemaphoreOpen(Ntv2Semaphore* pSemaphore, Ntv2SystemContext* pSysCon, uint32_t count);
void ntv2SemaphoreClose(Ntv2Semaphore* pSemaphore);
bool ntv2SemaphoreDown(Ntv2Semaphore* pSemaphore, int64_t timeout);
void ntv2SemaphoreUp(Ntv2Semaphore* pSemaphore);
// time functions
int64_t ntv2TimeCounter(void);
int64_t ntv2TimeFrequency(void);
int64_t ntv2Time100ns(void);
#endif // defined(MSWindows) || defined(AJALinux)
#endif // NTV2SYSTEM_H

View File

@ -1,38 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
//========================================================================
//
// ntv2video.h
//
//==========================================================================
#ifndef NTV2VIDEO_H
#define NTV2VIDEO_H
#include "ntv2system.h"
#include "ntv2publicinterface.h"
void SetRegisterWritemode(Ntv2SystemContext* context, NTV2RegisterWriteMode value, NTV2Channel channel);
int64_t GetFramePeriod(Ntv2SystemContext* context, NTV2Channel channel);
void SetColorCorrectionHostAccessBank(Ntv2SystemContext* context, NTV2ColorCorrectionHostAccessBank value);
NTV2ColorCorrectionHostAccessBank GetColorCorrectionHostAccessBank(Ntv2SystemContext* context, NTV2Channel channel);
void SetColorCorrectionSaturation(Ntv2SystemContext* context, NTV2Channel channel, uint32_t value);
uint32_t GetColorCorrectionSaturation(Ntv2SystemContext* context, NTV2Channel channel);
void SetColorCorrectionOutputBank(Ntv2SystemContext* context, NTV2Channel channel, uint32_t bank);
uint32_t GetColorCorrectionOutputBank(Ntv2SystemContext* context, NTV2Channel channel);
void SetLUTV2HostAccessBank(Ntv2SystemContext* context, NTV2ColorCorrectionHostAccessBank value);
void SetLUTV2OutputBank(Ntv2SystemContext* context, NTV2Channel channel, uint32_t bank);
uint32_t GetLUTV2OutputBank(Ntv2SystemContext* context, NTV2Channel channel);
void SetColorCorrectionMode(Ntv2SystemContext* context, NTV2Channel channel, NTV2ColorCorrectionMode mode);
NTV2ColorCorrectionMode GetColorCorrectionMode(Ntv2SystemContext* context, NTV2Channel channel);
void SetForegroundVideoCrosspoint(Ntv2SystemContext* context, NTV2Crosspoint crosspoint);
void SetForegroundKeyCrosspoint(Ntv2SystemContext* context, NTV2Crosspoint crosspoint);
void SetBackgroundVideoCrosspoint(Ntv2SystemContext* context, NTV2Crosspoint crosspoint);
void SetBackgroundKeyCrosspoint(Ntv2SystemContext* context, NTV2Crosspoint crosspoint);
#endif

View File

@ -1,34 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2vpid.h
// Purpose: Common VPID
//
///////////////////////////////////////////////////////////////
#ifndef NTV2VPID_HEADER
#define NTV2VPID_HEADER
#include "ntv2system.h"
#include "ntv2vpidfromspec.h"
#include "ntv2xptlookup.h"
#include "ntv2kona.h"
VPIDChannel GetChannelFrom425XPT(ULWord index);
bool ReadSDIInVPID(Ntv2SystemContext* context, NTV2Channel channel, ULWord* valueA, ULWord* valueB);
bool SetSDIOutVPID(Ntv2SystemContext* context, NTV2Channel channel, ULWord valueA, ULWord valueB);
bool AdjustFor4KDC(Ntv2SystemContext* context, VPIDControl* pControl);
bool FindVPID(Ntv2SystemContext* context, NTV2OutputXptID startingXpt, VPIDControl* pControl);
bool SetVPIDOutput(Ntv2SystemContext* context, NTV2Channel channel);
#endif

View File

@ -1,41 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
////////////////////////////////////////////////////////////
//
// Filename: ntv2xpt.h
// Purpose: Common XPT
//
///////////////////////////////////////////////////////////////
#ifndef NTV2XPT_HEADER
#define NTV2XPT_HEADER
#include "ntv2system.h"
#include "ntv2xptlookup.h"
#include "ntv2kona.h"
bool FindSDIOutputSource(Ntv2SystemContext* context, NTV2OutputXptID* source, NTV2Channel channel);
bool FindAnalogOutputSource(Ntv2SystemContext* context, NTV2OutputXptID* source);
bool FindHDMIOutputSource(Ntv2SystemContext* context, NTV2OutputXptID* source, NTV2Channel channel);
bool FindCrosspointSource(Ntv2SystemContext* context, NTV2OutputXptID* source, NTV2OutputXptID crosspoint);
NTV2XptLookupEntry GetCrosspointIDInput(NTV2OutputXptID crosspointID);
bool GetXptSDIOutInputSelect(Ntv2SystemContext* context, NTV2Channel channel, NTV2OutputXptID* value);
bool GetXptSDIOutDS2InputSelect(Ntv2SystemContext* context, NTV2Channel channel, NTV2OutputXptID* value);
bool SetXptSDIOutInputSelect(Ntv2SystemContext* context, NTV2Channel channel, NTV2OutputXptID value);
bool GetXptConversionModInputSelect(Ntv2SystemContext* context, NTV2OutputXptID* value);
bool GetXptDuallinkInInputSelect(Ntv2SystemContext* context, NTV2Channel channel, NTV2OutputXptID* value);
bool GetXptAnalogOutInputSelect(Ntv2SystemContext* context, NTV2OutputXptID* value);
bool GetXptFrameBuffer1InputSelect(Ntv2SystemContext* context, NTV2OutputXptID* value);
bool GetXptFrameBuffer2InputSelect(Ntv2SystemContext* context, NTV2OutputXptID* value);
bool GetXptHDMIOutInputSelect(Ntv2SystemContext* context, NTV2OutputXptID* value);
bool GetXptHDMIOutQ2InputSelect(Ntv2SystemContext* context, NTV2OutputXptID* value);
bool GetXptHDMIOutQ3InputSelect(Ntv2SystemContext* context, NTV2OutputXptID* value);
bool GetXptHDMIOutQ4InputSelect(Ntv2SystemContext* context, NTV2OutputXptID* value);
bool GetXptMultiLinkOutInputSelect(Ntv2SystemContext* context, NTV2Channel channel, NTV2OutputXptID* value);
#endif

View File

@ -1,77 +0,0 @@
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2004 - 2021 AJA Video Systems, Inc.
*/
#ifndef NTV2_XPT_LOOKUP_H
#define NTV2_XPT_LOOKUP_H
typedef struct
{
ULWord registerNumber;
ULWord registerMask;
UByte registerShift;
} NTV2XptLookupEntry;
#define XPT_SDI_IN_1 (0x0700)
#define XPT_SDI_IN_2 (0x0701)
#define XPT_SDI_IN_3 (0x0702)
#define XPT_SDI_IN_4 (0x0703)
#define XPT_SDI_IN_5 (0x0704)
#define XPT_SDI_IN_6 (0x0705)
#define XPT_SDI_IN_7 (0x0706)
#define XPT_SDI_IN_8 (0x0707)
#define XPT_SDI_IN_1_DS2 (0x0708)
#define XPT_SDI_IN_2_DS2 (0x0709)
#define XPT_SDI_IN_3_DS2 (0x070A)
#define XPT_SDI_IN_4_DS2 (0x070B)
#define XPT_SDI_IN_5_DS2 (0x070C)
#define XPT_SDI_IN_6_DS2 (0x070D)
#define XPT_SDI_IN_7_DS2 (0x070E)
#define XPT_SDI_IN_8_DS2 (0x070F)
#define XPT_FB_YUV_1 (0x0600)
#define XPT_FB_YUV_2 (0x0601)
#define XPT_FB_YUV_3 (0x0602)
#define XPT_FB_YUV_4 (0x0603)
#define XPT_FB_YUV_5 (0x0604)
#define XPT_FB_YUV_6 (0x0605)
#define XPT_FB_YUV_7 (0x0606)
#define XPT_FB_YUV_8 (0x0607)
#define XPT_FB_RGB_1 (0x0608)
#define XPT_FB_RGB_2 (0x0609)
#define XPT_FB_RGB_3 (0x060A)
#define XPT_FB_RGB_4 (0x060B)
#define XPT_FB_RGB_5 (0x060C)
#define XPT_FB_RGB_6 (0x060D)
#define XPT_FB_RGB_7 (0x060E)
#define XPT_FB_RGB_8 (0x060F)
#define XPT_FB_425_YUV_1 (0x0610)
#define XPT_FB_425_YUV_2 (0x0611)
#define XPT_FB_425_YUV_3 (0x0612)
#define XPT_FB_425_YUV_4 (0x0613)
#define XPT_FB_425_YUV_5 (0x0614)
#define XPT_FB_425_YUV_6 (0x0615)
#define XPT_FB_425_YUV_7 (0x0616)
#define XPT_FB_425_YUV_8 (0x0617)
#define XPT_FB_425_RGB_1 (0x0618)
#define XPT_FB_425_RGB_2 (0x0619)
#define XPT_FB_425_RGB_3 (0x061A)
#define XPT_FB_425_RGB_4 (0x061B)
#define XPT_FB_425_RGB_5 (0x061C)
#define XPT_FB_425_RGB_6 (0x061D)
#define XPT_FB_425_RGB_7 (0x061E)
#define XPT_FB_425_RGB_8 (0x061F)
#define XPT_HDMI_IN (0x0500)
#define XPT_HDMI_IN_Q2 (0x0501)
#define XPT_HDMI_IN_Q3 (0x0502)
#define XPT_HDMI_IN_Q4 (0x0503)
#define XPT_ANALOG_IN (0x0400)
#define XPT_4K_DC (0x0300)
#endif // NTV2_XPT_LOOKUP_H

View File

@ -1,124 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_cea608.h
@brief Declares the AJAAncillaryData_Cea608 class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_CEA608_H
#define AJA_ANCILLARYDATA_CEA608_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
/**
@brief This is the base class for handling CEA-608 caption data packets.
**/
class AJAExport AJAAncillaryData_Cea608 : public AJAAncillaryData
{
public:
AJAAncillaryData_Cea608 (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The object to be cloned.
**/
AJAAncillaryData_Cea608 (const AJAAncillaryData_Cea608 & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the object to be cloned.
**/
AJAAncillaryData_Cea608 (const AJAAncillaryData_Cea608 * pInClone);
/**
@brief My copy constructor.
@param[in] pInData A valid pointer to the object to be cloned.
**/
AJAAncillaryData_Cea608 (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_Cea608 (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_Cea608 & operator = (const AJAAncillaryData_Cea608 & inRHS);
virtual inline AJAAncillaryData_Cea608 * Clone (void) const {return new AJAAncillaryData_Cea608 (this);} ///< @return A clone of myself.
/**
@brief Set the CEA608 payload bytes.
@note This function assumes the caller has already added parity.
@param[in] inByte1 Specifies the first byte of the pair.
@param[in] inByte2 Specifies the second byte of the pair.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetCEA608Bytes (const uint8_t inByte1, const uint8_t inByte2);
/**
@brief Answers with the CEA608 payload bytes.
@param[out] outByte1 Receives the first byte of the pair (includes parity).
@param[out] outByte2 Receives the second byte of the pair (includes parity).
@param[out] outIsValid Receives 'true' if returned data is valid.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetCEA608Bytes (uint8_t & outByte1, uint8_t & outByte2, bool & outIsValid) const;
/**
@brief Sets the CEA608 payload characters. Uses the least significant 7 bits of the input values
and adds odd parity.
@param[in] inChar1 Specifies the first character of the pair.
@param[in] inChar2 Specifies the second character of the pair.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetCEA608Characters (const uint8_t inChar1, const uint8_t inChar2);
/**
@brief Answers with the CEA608 payload characters.
@param[out] outChar1 Receives the first character of the pair (after stripping odd parity).
@param[out] outChar2 Receives the second character of the pair (after stripping odd parity).
@param[out] outIsValid Receives 'true' if the returned characters are valid; otherwise 'false'.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetCEA608Characters (uint8_t & outChar1, uint8_t & outChar2, bool & outIsValid) const;
/**
@brief Set/Clear bit 7 of a byte to make odd parity.
@param[in] inValue Specifies the 7-bit input value.
@return The least-significant 7 bits of the input byte with bit 7 set or cleared to make odd parity.
**/
static uint8_t AddOddParity (const uint8_t inValue);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
protected:
void Init (void); // NOT virtual - called by constructors
// Note: if you make a change to the local member data, be sure to ALSO make the appropriate
// changes in the Init() and operator= methods!
uint8_t m_char1; // the 1st character in this field
uint8_t m_char2; // the 2nd character in this field
}; // AJAAncillaryData_Cea608
#endif // AJA_ANCILLARYDATA_CEA608_H

View File

@ -1,181 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_cea608_line21.h
@brief Declares the AJAAncillaryData_Cea608_line21 class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_CEA608_LINE21_H
#define AJA_ANCILLARYDATA_CEA608_LINE21_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
#include "ancillarydata_cea608.h"
// Line 21 ("Analog") Packet IDs
const uint8_t AJAAncillaryData_Cea608_Line21_DID = AJAAncillaryData_AnalogSID;
const uint8_t AJAAncillaryData_Cea608_Line21_SID = AJAAncillaryData_AnalogDID;
const uint32_t AJAAncillaryData_Cea608_Line21_PayloadSize = 720; // note: assumes we're only using this for SD (720 pixels/line)
/**
@brief This class handles "analog" (Line 21) based CEA-608 caption data packets.
**/
class AJAExport AJAAncillaryData_Cea608_Line21 : public AJAAncillaryData_Cea608
{
public:
AJAAncillaryData_Cea608_Line21 (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The object to be cloned.
**/
AJAAncillaryData_Cea608_Line21 (const AJAAncillaryData_Cea608_Line21 & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the object to be cloned.
**/
AJAAncillaryData_Cea608_Line21 (const AJAAncillaryData_Cea608_Line21 * pInClone);
/**
@brief My copy constructor.
@param[in] pInData A valid pointer to the object to be cloned.
**/
AJAAncillaryData_Cea608_Line21 (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_Cea608_Line21 (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_Cea608_Line21 & operator = (const AJAAncillaryData_Cea608_Line21 & inRHS);
virtual inline AJAAncillaryData_Cea608_Line21 * Clone (void) const {return new AJAAncillaryData_Cea608_Line21 (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Generate the payload data from the "local" ancillary data.
@note This method is overridden for the specific Anc data type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GeneratePayloadData (void);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
protected:
void Init (void); // NOT virtual - called by constructors
virtual AJAStatus AllocEncodeBuffer (void);
// Encode methods ported/stolen from ntv2closedcaptioning.cpp
/**
@brief Initializes the payload buffer with all of the "static" pixels, e.g. run-in clock, pre- and post- black, etc.
@param[in] inLineStartOffset Pixel count from beginning of line (buffer) to the start of the waveform.
@param[out] outDataStartOffset Receives the pixel count from beginning of line (buffer) to the first data pixel
(required by the AJAAncillaryData_Cea608_Line21::EncodeLine function).
@return AJA_STATUS_SUCCESS if successful, or AJA_STATUS_FAIL if payload not allocated or wrong size.
**/
virtual AJAStatus InitEncodeBuffer (const uint32_t inLineStartOffset, uint32_t & outDataStartOffset);
/**
@brief Encode and insert the given 8-bit characters into the (already initialized) payload buffer.
@param[in] inChar1 Specifies the 8-bit "1st" character on the line.
@param[in] inChar2 Specifies the 8-bit "2nd" character on the line.
@param[in] inDataStartOffset Specifies the pixel count from beginning of line (buffer) to the first data pixel.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus EncodeLine (const uint8_t inChar1, const uint8_t inChar2, const uint32_t inDataStartOffset);
/**
@brief Encodes a single 8-bit character from just after the transition to the first bit until just before the transition from the last bit.
@param[in] ptr Pointer to the location in buffer where the encoding should start.
@param[in] inChar Specifies the 8-bit character to encode.
@return Pointer to next pixel in the buffer following the end of the encoded byte.
**/
virtual uint8_t * EncodeCharacter (uint8_t * ptr, const uint8_t inChar);
/**
@brief Encodes a single bit transition from the "from" level to the "to" level.
@param[in] ptr ptr to the location in buffer where the encoding should start
@param[in] inStartLevel Specifies the beginning level (0=low, >0=high).
@param[in] inEndLevel Specifies the ending level (0=low, >0=high).
@return Pointer to next pixel in the buffer following the end of the encoded transition.
**/
virtual uint8_t * EncodeTransition (uint8_t * ptr, const uint8_t inStartLevel, const uint8_t inEndLevel);
// Decode methods ported/stolen from ntv2closedcaptioning.cpp
/**
@brief Decodes the payload to extract the two captioning characters.
The caller must check \c outGotClock to determine whether a valid CEA-608 ("Line 21")
waveform was found: lack of captioning waveform does NOT return an error!
@param[out] outChar1 Receives data byte 1 (set to 0xFF if no clock or data is found).
@param[out] outChar2 Receives data byte 2 (set to 0xFF if no clock or data is found).
@param[out] outGotClock Receives 'true' if a valid CEA-608 ("Line 21") clock waveform was found.
@return AJA_STATUS_SUCCESS if successful, or AJA_STATUS_FAIL if payload not allocated or wrong size.
**/
virtual AJAStatus DecodeLine (uint8_t & outChar1, uint8_t & outChar2, bool & outGotClock) const;
/**
@brief Checks for the existence of a CEA-608 "analog" waveform and, if found, returns a pointer
to the start of the data bits.
@param[in] pInLine The start of the payload buffer.
@param[out] outGotClock Receives 'true' if a valid CEA-608 ("Line 21") clock waveform was found.
@return Pointer to the middle of the first data bit (used by DecodeCharacters function).
**/
static const uint8_t * CheckDecodeClock (const uint8_t * pInLine, bool & outGotClock);
/**
@brief Decodes the two CEA-608 data characters for this line.
@param[in] ptr Points to the middle of the first data bit in the waveform
(i.e. the one following the '1' start bit).
@param[out] outChar1 Receives data byte 1.
@param[out] outChar2 Receives data byte 2.
@return AJA_STATUS_SUCCESS if successful.
@note This function returns the parity bit of each character in the MS bit position.
It makes no calculation or value judgment as to the correctness of the parity.
**/
static AJAStatus DecodeCharacters (const uint8_t * ptr, uint8_t & outChar1, uint8_t & outChar2);
protected:
// Note: if you make a change to the local member data, be sure to ALSO make the appropriate
// changes in the Init() and operator= methods!
bool m_bEncodeBufferInitialized; ///< @brief Set 'true' after successfully allocating and initializing the m_payload buffer for encoding
uint32_t m_dataStartOffset; ///< @brief Offset into the encode buffer where data starts
}; // AJAAncillaryData_Cea608_Line21
#endif // AJA_ANCILLARYDATA_CEA608_LINE21_H

View File

@ -1,114 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_cea608_vanc.h
@brief Declares the AJAAncillaryData_Cea608_Vanc class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_CEA608_VANC_H
#define AJA_ANCILLARYDATA_CEA608_VANC_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
#include "ancillarydata_cea608.h"
// CEA-608 (SMPTE 334) Ancillary Packet
const uint8_t AJAAncillaryData_Cea608_Vanc_DID = 0x61;
const uint8_t AJAAncillaryData_Cea608_Vanc_SID = 0x02;
const uint32_t AJAAncillaryData_Cea608_Vanc_PayloadSize = 3; // constant 3 bytes
/**
@brief This class handles VANC-based CEA-608 caption data packets (not "analog" Line 21).
**/
class AJAExport AJAAncillaryData_Cea608_Vanc : public AJAAncillaryData_Cea608
{
public:
AJAAncillaryData_Cea608_Vanc (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_Cea608_Vanc (const AJAAncillaryData_Cea608_Vanc & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_Cea608_Vanc (const AJAAncillaryData_Cea608_Vanc * pInClone);
/**
@brief Constructs me from a generic AJAAncillaryData object.
@param[in] pInData A valid pointer to the AJAAncillaryData object.
**/
AJAAncillaryData_Cea608_Vanc (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_Cea608_Vanc (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_Cea608_Vanc & operator = (const AJAAncillaryData_Cea608_Vanc & inRHS);
virtual inline AJAAncillaryData_Cea608_Vanc * Clone (void) const {return new AJAAncillaryData_Cea608_Vanc (this);} ///< @return A clone of myself.
/**
@brief Sets my SMPTE 334 (CEA608) field/line numbers.
@param[in] inIsF2 Specifies the field number ('true' for F2, 'false' for F1).
@param[in] inLineNum Specifies the line number (see SMPTE 334-1 for details).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetLine (const bool inIsF2, const uint8_t inLineNum);
virtual inline uint16_t GetLineNumber (void) const {return m_lineNum;} ///< @return My current SMPTE 334 (CEA608) line number.
virtual inline bool IsField2 (void) const {return m_isF2;} ///< @return True if my current Field ID is Field 2; otherwise false.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Generate the payload data from my "local" ancillary data.
@note This method is overridden for the specific Anc data type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GeneratePayloadData (void);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
virtual AJAStatus GetLine (uint8_t & outFieldNum, uint8_t & outLineNum) const; ///< @deprecated Use AJAAncillaryData_Cea608_Vanc::GetLineNumber or AJAAncillaryData_Cea608_Vanc::IsField2 instead.
protected:
void Init (void); // NOT virtual - called by constructors
// Note: if you make a change to the local member data, be sure to ALSO make the appropriate
// changes in the Init() and operator= methods!
bool m_isF2; // F2 if true; otherwise F1
uint8_t m_lineNum; // 525i: 0 = line 9 (field 1) or line 272 (field 2)
// 625i: 0 = line 5 (field 1) or line 318 (field 2)
}; // AJAAncillaryData_Cea608_Vanc
#endif // AJA_ANCILLARYDATA_CEA608_VANC_H

View File

@ -1,93 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_cea708.h
@brief Declares the AJAAncillaryData_Cea708 class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_CEA708_H
#define AJA_ANCILLARYDATA_CEA708_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
// SMPTE 334 Ancillary Packet
const uint8_t AJAAncillaryData_CEA708_DID = 0x61;
const uint8_t AJAAncillaryData_CEA708_SID = 0x01;
/**
@brief This class handles CEA-708 SMPTE 334 packets.
**/
class AJAExport AJAAncillaryData_Cea708 : public AJAAncillaryData
{
public:
AJAAncillaryData_Cea708 (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The object to be cloned.
**/
AJAAncillaryData_Cea708 (const AJAAncillaryData_Cea708 & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the object to be cloned.
**/
AJAAncillaryData_Cea708 (const AJAAncillaryData_Cea708 * pInClone);
/**
@brief My copy constructor.
@param[in] pInData A valid pointer to the object to be cloned.
**/
AJAAncillaryData_Cea708 (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_Cea708 (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_Cea708 & operator = (const AJAAncillaryData_Cea708 & inRHS);
virtual inline AJAAncillaryData_Cea708 * Clone (void) const {return new AJAAncillaryData_Cea708 (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Generate the payload data from the "local" ancillary data.
@note This method is overridden for the specific Anc data type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GeneratePayloadData (void);
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
protected:
void Init (void); // NOT virtual - called by constructors
// Note: if you make a change to the local member data, be sure to ALSO make the appropriate
// changes in the Init() and operator= methods!
}; // AJAAncillaryData_Cea708
#endif // AJA_ANCILLARYDATA_CEA708_H

View File

@ -1,94 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_framestatusinfo524D.h
@brief Declares the AJAAncillaryData_FrameStatusInfo524D class.
@copyright (C) 2012-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_FRAMESTATUSINFO524D_H
#define AJA_ANCILLARYDATA_FRAMESTATUSINFO524D_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
// Ancillary Packet generated by the Canon C300, so far, the C500
const uint8_t AJAAncillaryData_FrameStatusInfo524D_DID = 0x52;
const uint8_t AJAAncillaryData_FrameStatusInfo524D_SID = 0x4D;
/**
@brief This class handles "524D" Frame Status Information packets.
**/
class AJA_EXPORT AJAAncillaryData_FrameStatusInfo524D : public AJAAncillaryData
{
public:
AJAAncillaryData_FrameStatusInfo524D (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_FrameStatusInfo524D (const AJAAncillaryData_FrameStatusInfo524D & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_FrameStatusInfo524D (const AJAAncillaryData_FrameStatusInfo524D * pInClone);
/**
@brief Constructs me from a generic AJAAncillaryData object.
@param[in] pInData A valid pointer to the AJAAncillaryData object.
**/
AJAAncillaryData_FrameStatusInfo524D (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_FrameStatusInfo524D (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_FrameStatusInfo524D & operator = (const AJAAncillaryData_FrameStatusInfo524D & inRHS);
virtual inline AJAAncillaryData_FrameStatusInfo524D * Clone (void) const {return new AJAAncillaryData_FrameStatusInfo524D (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
virtual inline bool IsRecording (void) const {return m_IsRecording;} ///< @return The remote camera's recording state.
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
protected:
void Init (void); // NOT virtual - called by constructors
private:
bool m_IsRecording;
};
#endif // AJA_ANCILLARYDATA_FRAMESTATUSINFO524D_H

View File

@ -1,94 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_framestatusinfo5251.h
@brief Declares the AJAAncillaryData_FrameStatusInfo5251 class.
@copyright (C) 2012-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_FRAMESTATUSINFO5251_H
#define AJA_ANCILLARYDATA_FRAMESTATUSINFO5251_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
// Ancillary Packet generated by the Canon C500
const uint8_t AJAAncillaryData_FrameStatusInfo5251_DID = 0x52;
const uint8_t AJAAncillaryData_FrameStatusInfo5251_SID = 0x51;
/**
@brief This class handles "5251" Frame Status Information packets.
**/
class AJA_EXPORT AJAAncillaryData_FrameStatusInfo5251 : public AJAAncillaryData
{
public:
AJAAncillaryData_FrameStatusInfo5251 (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_FrameStatusInfo5251 (const AJAAncillaryData_FrameStatusInfo5251 & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_FrameStatusInfo5251 (const AJAAncillaryData_FrameStatusInfo5251 * pInClone);
/**
@brief Constructs me from a generic AJAAncillaryData object.
@param[in] pInData A valid pointer to the AJAAncillaryData object.
**/
AJAAncillaryData_FrameStatusInfo5251 (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_FrameStatusInfo5251 (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_FrameStatusInfo5251 & operator = (const AJAAncillaryData_FrameStatusInfo5251 & inRHS);
virtual inline AJAAncillaryData_FrameStatusInfo5251 * Clone (void) const {return new AJAAncillaryData_FrameStatusInfo5251 (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
virtual inline bool IsRecording (void) const {return m_IsRecording;} ///< @return True if the remote camera is recording.
virtual inline bool IsValidFrame (void) const {return m_IsValidFrame;} ///< @return True if the remote camera's outbound frame is valid for capture.
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
protected:
void Init (void); // NOT virtual - called by constructors
private:
bool m_IsRecording;
bool m_IsValidFrame;
}; // AJAAncillaryData_FrameStatusInfo5251
#endif // AJA_ANCILLARYDATA_FRAMESTATUSINFO5251_H

View File

@ -1,84 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_hdr_hdr10.h
@brief Declares the AJAAncillaryData_HDR_HDR10 class.
@copyright (C) 2012-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_HDR_HDR10_H
#define AJA_ANCILLARYDATA_HDR_HDR10_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
const uint8_t AJAAncillaryData_HDR_HDR10_DID = 0xC0;
const uint8_t AJAAncillaryData_HDR_HDR10_SID = 0x00;
/**
@brief This class handles "5251" Frame Status Information packets.
**/
class AJA_EXPORT AJAAncillaryData_HDR_HDR10 : public AJAAncillaryData
{
public:
AJAAncillaryData_HDR_HDR10 (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_HDR_HDR10 (const AJAAncillaryData_HDR_HDR10 & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_HDR_HDR10 (const AJAAncillaryData_HDR_HDR10 * pInClone);
/**
@brief Constructs me from a generic AJAAncillaryData object.
@param[in] pInData A valid pointer to the AJAAncillaryData object.
**/
AJAAncillaryData_HDR_HDR10 (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_HDR_HDR10 (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_HDR_HDR10 & operator = (const AJAAncillaryData_HDR_HDR10 & inRHS);
virtual inline AJAAncillaryData_HDR_HDR10 * Clone (void) const {return new AJAAncillaryData_HDR_HDR10 (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
protected:
void Init (void); // NOT virtual - called by constructors
}; // AJAAncillaryData_HDR_HDR10
#endif // AJA_ANCILLARYDATA_HDR_HDR10_H

View File

@ -1,84 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_hdr_hlg.h
@brief Declares the AJAAncillaryData_HDR_HLG class.
@copyright (C) 2012-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_HDR_HLG_H
#define AJA_ANCILLARYDATA_HDR_HLG_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
const uint8_t AJAAncillaryData_HDR_HLG_DID = 0xC0;
const uint8_t AJAAncillaryData_HDR_HLG_SID = 0x00;
/**
@brief This class handles "5251" Frame Status Information packets.
**/
class AJA_EXPORT AJAAncillaryData_HDR_HLG : public AJAAncillaryData
{
public:
AJAAncillaryData_HDR_HLG (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_HDR_HLG (const AJAAncillaryData_HDR_HLG & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_HDR_HLG (const AJAAncillaryData_HDR_HLG * pInClone);
/**
@brief Constructs me from a generic AJAAncillaryData object.
@param[in] pInData A valid pointer to the AJAAncillaryData object.
**/
AJAAncillaryData_HDR_HLG (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_HDR_HLG (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_HDR_HLG & operator = (const AJAAncillaryData_HDR_HLG & inRHS);
virtual inline AJAAncillaryData_HDR_HLG * Clone (void) const {return new AJAAncillaryData_HDR_HLG (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
protected:
void Init (void); // NOT virtual - called by constructors
}; // AJAAncillaryData_HDR_HLG
#endif // AJA_ANCILLARYDATA_HDR_HLG_H

View File

@ -1,84 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_hdr_sdr.h
@brief Declares the AJAAncillaryData_HDR_SDR class.
@copyright (C) 2012-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_HDR_SDR_H
#define AJA_ANCILLARYDATA_HDR_SDR_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
const uint8_t AJAAncillaryData_HDR_SDR_DID = 0xC0;
const uint8_t AJAAncillaryData_HDR_SDR_SID = 0x00;
/**
@brief This class handles "5251" Frame Status Information packets.
**/
class AJA_EXPORT AJAAncillaryData_HDR_SDR : public AJAAncillaryData
{
public:
AJAAncillaryData_HDR_SDR (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_HDR_SDR (const AJAAncillaryData_HDR_SDR & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the AJAAncillaryData object to be cloned.
**/
AJAAncillaryData_HDR_SDR (const AJAAncillaryData_HDR_SDR * pInClone);
/**
@brief Constructs me from a generic AJAAncillaryData object.
@param[in] pInData A valid pointer to the AJAAncillaryData object.
**/
AJAAncillaryData_HDR_SDR (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_HDR_SDR (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_HDR_SDR & operator = (const AJAAncillaryData_HDR_SDR & inRHS);
virtual inline AJAAncillaryData_HDR_SDR * Clone (void) const {return new AJAAncillaryData_HDR_SDR (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
protected:
void Init (void); // NOT virtual - called by constructors
}; // AJAAncillaryData_HDR_SDR
#endif // AJA_ANCILLARYDATA_HDR_SDR_H

View File

@ -1,317 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_timecode.h
@brief Declares the AJAAncillaryData_Timecode class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_TIMECODE_H
#define AJA_ANCILLARYDATA_TIMECODE_H
#include "ajabase/common/timecode.h"
#include "ajabase/common/timebase.h"
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
enum AJAAncillaryData_Timecode_Format
{
AJAAncillaryData_Timecode_Format_Unknown, // not set (usually defaults to 30 fps)
AJAAncillaryData_Timecode_Format_60fps, // 60/59.94 fps format ("NTSC")
AJAAncillaryData_Timecode_Format_50fps, // 50 fps format ("PAL")
AJAAncillaryData_Timecode_Format_48fps, // 48/47.95 fps format
AJAAncillaryData_Timecode_Format_30fps, // 30/29.97 fps format ("NTSC")
AJAAncillaryData_Timecode_Format_25fps, // 25 fps format ("PAL")
AJAAncillaryData_Timecode_Format_24fps // 24/23.98 fps format
};
/**
@brief This is the base class for the AJAAncillaryData_Timecode_ATC and AJAAncillaryData_Timecode_VITC
classes, because they share the same "payload" data (i.e. timecode) and only differ in the transport
(ancillary packets vs. "analog" coding).
@note Do not instantiate a "pure" AJAAncillaryData_Timecode object. Always use the subclasses.
**/
class AJAExport AJAAncillaryData_Timecode : public AJAAncillaryData
{
public:
AJAAncillaryData_Timecode ();
AJAAncillaryData_Timecode (const AJAAncillaryData_Timecode & inClone);
AJAAncillaryData_Timecode (const AJAAncillaryData_Timecode * pClone);
AJAAncillaryData_Timecode (const AJAAncillaryData *pData);
virtual inline ~AJAAncillaryData_Timecode () {}
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_Timecode & operator = (const AJAAncillaryData_Timecode & inRHS);
virtual inline AJAAncillaryData_Timecode * Clone (void) const {return new AJAAncillaryData_Timecode (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Generate the payload data from the "local" ancillary data.
@note This method is overridden for the specific Anc data type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GeneratePayloadData (void) {return AJA_STATUS_SUCCESS;}
/**
@brief Sets my raw "time" hex values.
@param[in] inDigitNum Specifies the index (0-7) of time digits in "transmission" order:
0 = 1st (frame units) digit, 1 = 2nd digit, ... 7 = last (hour tens) digit.
@param[in] inHexValue Specifies the hex value (least significant 4 bits) to be set.
@param[in] inMask Optionally specifies which bits to set: (1 = set bit to new value, 0 = retain current bit value).
Defaults to 0x0F.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetTimeHexValue (const uint8_t inDigitNum, const uint8_t inHexValue, const uint8_t inMask = 0x0f);
/**
@brief Answers with my current raw "time" hex values.
@param[in] inDigitNum Specifies the index (0-7) of the time digit of interest, in "transmission" order:
0 = 1st (frame units) digit, 1 = 2nd digit, ... 7 = last (hour tens) digit.
@param[out] outHexValue Receives the hex value (least significant 4 bits) to be set.
@param[in] inMask Optionally specifies which bits to receive: (1 = set bit to new value, 0 = retain current bit value).
Defaults to 0x0F.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetTimeHexValue (uint8_t inDigitNum, uint8_t & outHexValue, uint8_t inMask = 0x0f) const;
/**
@brief Sets my timecode "time" using discrete BCD digits.
@param[in] inHourTens Specifies the hours "tens" digit value.
@param[in] inHourOnes Specifies the hours "ones" digit value.
@param[in] inMinTens Specifies the minutes "tens" digit value.
@param[in] inMinOnes Specifies the minutes "ones" digit value.
@param[in] inSecsTens Specifies the seconds "tens" digit value.
@param[in] inSecsOnes Specifies the seconds "ones" digit value.
@param[in] inFrameTens Specifies the frame "tens" digit value.
@param[in] inFrameOnes Specifies the frame "ones" digit value.
@note Each digit is masked to the number of bits allotted in the payload. Note that the digit order is reversed!
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetTimeDigits ( const uint8_t inHourTens, const uint8_t inHourOnes,
const uint8_t inMinTens, const uint8_t inMinOnes,
const uint8_t inSecsTens, const uint8_t inSecsOnes,
const uint8_t inFrameTens, const uint8_t inFrameOnes);
/**
@brief Answers with my current timecode "time" as discrete BCD digits.
@param[out] outHourTens Specifies the hours "tens" digit value.
@param[out] outHourOnes Specifies the hours "ones" digit value.
@param[out] outMinTens Specifies the minutes "tens" digit value.
@param[out] outMinOnes Specifies the minutes "ones" digit value.
@param[out] outSecsTens Specifies the seconds "tens" digit value.
@param[out] outSecsOnes Specifies the seconds "ones" digit value.
@param[out] outFrameTens Specifies the frame "tens" digit value.
@param[out] outFrameOnes Specifies the frame "ones" digit value.
@note Each digit is masked to the number of bits allotted in the payload. Note that the digit order is reversed!
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetTimeDigits ( uint8_t & outHourTens, uint8_t & outHourOnes,
uint8_t & outMinTens, uint8_t & outMinOnes,
uint8_t & outSecsTens, uint8_t & outSecsOnes,
uint8_t & outFrameTens, uint8_t & outFrameOnes) const;
/**
@brief Sets my timecode "time" with hours, minutes, seconds, frames (in decimal, not BCD digits).
@param[in] inFormat Specifies a valid AJAAncillaryData_Timecode_Format.
@param[in] inHours Specifies the hours value, which must be less than 24.
@param[in] inMinutes Specifies the minutes value, which must be less than 60.
@param[in] inSeconds Specifies the seconds value, which must be less than 60.
@param[in] inFrames Specifies the frame value, which must be less than the frame rate.
@note This method takes into account the "FieldID" bit for HFR timecode formats (e.g. p50, p59.94, p60, etc.).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetTime (const AJAAncillaryData_Timecode_Format inFormat, const uint32_t inHours,
const uint32_t inMinutes, const uint32_t inSeconds, const uint32_t inFrames);
/**
@brief Answers with my current timecode "time" as individual hour, minute, second, and frame components (in decimal, not BCD digits).
@param[in] inFormat Specifies a valid AJAAncillaryData_Timecode_Format.
@param[out] outHours Receives the hours value.
@param[out] outMinutes Receives the minutes value.
@param[out] outSeconds Receives the seconds value.
@param[out] outFrames Receives the frame value.
@note This method takes into account the "FieldID" bit for HFR timecode formats (e.g. p50, p59.94, p60, etc.).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetTime (const AJAAncillaryData_Timecode_Format inFormat, uint32_t & outHours,
uint32_t & outMinutes, uint32_t & outSeconds, uint32_t & outFrames) const;
/**
@brief Sets my timecode "time" from an AJATimeCode.
@param[in] inTimecode Specifies the timecode.
@param[in] inTimeBase Specifies the time base (frame rate) associated with the specified timecode.
@param[in] inIsDropFrame Specify 'true' for dropframe; otherwise false.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetTimecode (const AJATimeCode & inTimecode, const AJATimeBase & inTimeBase, const bool inIsDropFrame);
/**
@brief Answers with my timecode "time" as an AJATimeCode.
@param[out] outTimecode Receives the timecode.
@param[out] outTimeBase Receives the time base (frame rate).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetTimecode (AJATimeCode & outTimecode, AJATimeBase & outTimeBase) const;
/**
@brief Sets my raw "Binary Group" hex values.
@param[in] digitNum the index (0 - 7) of the Binary Group value in "transmission" order, i.e. 0 = 1st (BG1) digit, 1 = 2nd digit, ..., 7 = last (BG7) digit
@param[in] hexValue the hex value (ls 4 bits) to be set/get
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetBinaryGroupHexValue (uint8_t digitNum, uint8_t hexValue, uint8_t mask = 0x0f);
virtual AJAStatus GetBinaryGroupHexValue (uint8_t digitNum, uint8_t& hexValue, uint8_t mask = 0x0f) const;
/**
@brief Sets my binary group values.
@param[in] bg8 binary group values (only the ls 4 bits of each value are retained) - note that the BG order is reversed!)
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetBinaryGroups (uint8_t bg8, uint8_t bg7, uint8_t bg6, uint8_t bg5, uint8_t bg4, uint8_t bg3, uint8_t bg2, uint8_t bg1);
virtual AJAStatus GetBinaryGroups (uint8_t& bg8, uint8_t& bg7, uint8_t& bg6, uint8_t& bg5, uint8_t& bg4, uint8_t& bg3, uint8_t& bg2, uint8_t& bg1) const;
/**
@brief Sets my FieldID flag.
@param[in] bFlag false = field 1 (0), true = field 2 (1)
@param[in] tcFmt AJAAncillaryData_Timecode_Format associated with timecode (default is handled as 30-frame timecode).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetFieldIdFlag (bool bFlag, AJAAncillaryData_Timecode_Format tcFmt = AJAAncillaryData_Timecode_Format_Unknown);
virtual AJAStatus GetFieldIdFlag (bool& bFlag, AJAAncillaryData_Timecode_Format tcFmt = AJAAncillaryData_Timecode_Format_Unknown) const;
/**
@brief Sets my drop frame flag.
@param[in] bFlag false = non-dropframe format, true = drop frame
@param[in] tcFmt AJAAncillaryData_Timecode_Format associated with timecode (default is handled as 30-frame timecode).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetDropFrameFlag (bool bFlag, AJAAncillaryData_Timecode_Format tcFmt = AJAAncillaryData_Timecode_Format_Unknown);
virtual AJAStatus GetDropFrameFlag (bool& bFlag, AJAAncillaryData_Timecode_Format tcFmt = AJAAncillaryData_Timecode_Format_Unknown) const;
/**
@brief Sets my color frame flag.
@param[in] bFlag false = no relation between color frames and timecode values, true = timecode values are aligned with color frames (see SMPTE-12M).
@param[in] tcFmt AJAAncillaryData_Timecode_Format associated with timecode (default is handled as 30-frame timecode).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetColorFrameFlag (bool bFlag, AJAAncillaryData_Timecode_Format tcFmt = AJAAncillaryData_Timecode_Format_Unknown);
virtual AJAStatus GetColorFrameFlag (bool& bFlag, AJAAncillaryData_Timecode_Format tcFmt = AJAAncillaryData_Timecode_Format_Unknown) const;
/**
@brief Sets my binary group flag (3 bits).
@param[in] inBGFlag Specifies the BG Flag value (only the least significant 3 bits are retained).
@param[in] inFormat Specifies the timecode format associated with timecode (default is handled as 30-frame timecode).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetBinaryGroupFlag (const uint8_t inBGFlag, const AJAAncillaryData_Timecode_Format inFormat = AJAAncillaryData_Timecode_Format_Unknown);
/**
@brief Answers with my current binary group flag (3 bits).
@param[out] outBGFlag Specifies the BG Flag value (only the least significant 3 bits are retained).
@param[in] inFormat Specifies the timecode format associated with timecode (default is handled as 30-frame timecode).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetBinaryGroupFlag (uint8_t & outBGFlag, const AJAAncillaryData_Timecode_Format inFormat = AJAAncillaryData_Timecode_Format_Unknown) const;
/**
@param[in] pInAncData A valid pointer to an AJAAncillaryData instance.
@return The AJAAncillaryDataType if I recognize this ancillary data (or unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@return A string containing my human-readable timecode.
**/
virtual std::string TimecodeString (void) const;
/**
@brief Get the timecode format that matches the input timebase.
@param[in] inTimeBase Specifies the time base (frame rate) associated with the specified timecode.
@return The AJAAncillaryData_Timecode_Format that corresponds to the input timebase, returns AJAAncillaryData_Timecode_Format_Unknown when no match found.
**/
static AJAAncillaryData_Timecode_Format GetTimecodeFormatFromTimeBase (const AJATimeBase & inTimeBase);
protected:
void Init (void); // NOT virtual - called by constructors
// Which timecode digits go in which elements of timeDigits[]
// Note that this is the same order as received/transmitted, i.e. ls digits FIRST!
enum
{
kTcFrameUnits = 0,
kTcFrameTens = 1,
kTcSecondUnits = 2,
kTcSecondTens = 3,
kTcMinuteUnits = 4,
kTcMinuteTens = 5,
kTcHourUnits = 6,
kTcHourTens = 7,
kNumTimeDigits = 8
};
// Which binary groups go in which elements of binaryGroup[]?
// Note that this is the same order as received/transmitted, i.e. ls digits FIRST!
enum
{
kBg1 = 0,
kBg2 = 1,
kBg3 = 2,
kBg4 = 3,
kBg5 = 4,
kBg6 = 5,
kBg7 = 6,
kBg8 = 7,
kNumBinaryGroups = 8
};
// Note: if you make a change to the local member data, be sure to ALSO make the appropriate
// changes in the Init() and operator= methods!
// The timecode data is stored as "raw" hex nibbles of data, split up between "time" values and "binary group" values.
// This means that sundry "flags" which take advantage of unused time bits (e.g. bits 2 and 3 of the hour tens digit)
// are kept with the hex digit data, and only parsed in or out by the appropriate Set()/Get() methods.
uint8_t m_timeDigits[kNumTimeDigits]; // the 8 hex values of the time data, in order of received/transmitted (i.e. ls digits first)
uint8_t m_binaryGroup[kNumBinaryGroups]; // the 8 hex values of the "Binary Groups", in order from BG1 - BG8
}; // AJAAncillaryData_Timecode
/**
@brief Writes a human-readable rendition of the given AJAAncillaryData_Timecode into the given output stream.
@param inOutStream Specifies the output stream to be written.
@param[in] inAncData Specifies the AJAAncillaryData_Timecode to be rendered into the output stream.
@return A non-constant reference to the specified output stream.
**/
inline std::ostream & operator << (std::ostream & inOutStream, const AJAAncillaryData_Timecode & inAncData) {return inAncData.Print (inOutStream);}
#endif // AJA_ANCILLARYDATA_TIMECODE_H

View File

@ -1,148 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_timecode_atc.h
@brief Declares the AJAAncillaryData_Timecode_ATC class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_TIMECODE_ATC_H
#define AJA_ANCILLARYDATA_TIMECODE_ATC_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
#include "ancillarydata_timecode.h"
// SMPTE 12M Ancillary Packet (formerly "RP-188")
const uint8_t AJAAncillaryData_SMPTE12M_DID = 0x60;
const uint8_t AJAAncillaryData_SMPTE12M_SID = 0x60;
const uint32_t AJAAncillaryData_SMPTE12M_PayloadSize = 16; // constant 16 bytes
// see SMPTE 12M-2 Table 2
enum AJAAncillaryData_Timecode_ATC_DBB1PayloadType
{
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_LTC = 0x00,
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_VITC1 = 0x01,
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_VITC2 = 0x02,
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_ReaderFilmData = 0x06,
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_ReaderProdData = 0x07,
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_LocalVideoData = 0x7D,
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_LocalFilmData = 0x7E,
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_LocalProdData = 0x7F,
AJAAncillaryData_Timecode_ATC_DBB1PayloadType_Unknown = 0xFF
};
/**
@brief I am the ATC-specific (analog) subclass of the AJAAncillaryData_Timecode class.
**/
class AJAExport AJAAncillaryData_Timecode_ATC : public AJAAncillaryData_Timecode
{
public:
AJAAncillaryData_Timecode_ATC (); ///< @brief My default constructor.
/**
@brief My copy constructor.
@param[in] inClone The object to be cloned.
**/
AJAAncillaryData_Timecode_ATC (const AJAAncillaryData_Timecode_ATC & inClone);
/**
@brief My copy constructor.
@param[in] pInClone A valid pointer to the object to be cloned.
**/
AJAAncillaryData_Timecode_ATC (const AJAAncillaryData_Timecode_ATC * pInClone);
/**
@brief My copy constructor.
@param[in] pInData A valid pointer to the object to be cloned.
**/
AJAAncillaryData_Timecode_ATC (const AJAAncillaryData * pInData);
virtual ~AJAAncillaryData_Timecode_ATC (); ///< @brief My destructor.
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_Timecode_ATC & operator = (const AJAAncillaryData_Timecode_ATC & inRHS);
virtual inline AJAAncillaryData_Timecode_ATC * Clone (void) const {return new AJAAncillaryData_Timecode_ATC (this);} ///< @return A clone of myself.
/**
* Set/Get the Distributed Binary Bits
*
* @param[in] dbb1 DBB bits
* @return AJA_STATUS_SUCCESS
*/
virtual AJAStatus SetDBB1(uint8_t dbb1);
virtual AJAStatus GetDBB1(uint8_t& dbb1) const;
virtual AJAStatus SetDBB2(uint8_t dbb2);
virtual AJAStatus GetDBB2(uint8_t& dbb2) const;
virtual AJAStatus SetDBB(uint8_t dbb1, uint8_t dbb2);
virtual AJAStatus GetDBB(uint8_t& dbb1, uint8_t& dbb2) const;
/**
@brief Sets my payload type.
@param[in] inType Specifies the payload type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetDBB1PayloadType (const AJAAncillaryData_Timecode_ATC_DBB1PayloadType inType);
/**
@brief Answers with my current payload type.
@param[out] outType Receives my payload type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetDBB1PayloadType (AJAAncillaryData_Timecode_ATC_DBB1PayloadType & outType) const;
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Generate the payload data from the "local" ancillary data.
@note This method is overridden for the specific Anc data type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GeneratePayloadData (void);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@param[in] pInAncData A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
@return AJAAncillaryDataType if I recognize this Anc data (or AJAAncillaryDataType_Unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
protected:
void Init (void); // NOT virtual - called by constructors
// Note: if you make a change to the local member data, be sure to ALSO make the appropriate
// changes in the Init() and operator= methods!
uint8_t m_dbb1; // "Distributed Binary Bits" - only transported by ATC
uint8_t m_dbb2; //
}; // AJAAncillaryData_Timecode_ATC
#endif // AJA_ANCILLARYDATA_TIMECODE_ATC_H

View File

@ -1,124 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydata_timecode_vitc.h
@brief Declares the AJAAncillaryData_Timecode_VITC class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATA_TIMECODE_VITC_H
#define AJA_ANCILLARYDATA_TIMECODE_VITC_H
#include "ancillarydatafactory.h"
#include "ancillarydata.h"
#include "ancillarydata_timecode.h"
// comment this out to use older "NTV2" VITC Encode algorithm
// leave defined to use "D-VITC" parameters as defined in SMPTE-266M
#define USE_SMPTE_266M
// VITC ("Analog") Packet IDs
const uint8_t AJAAncillaryData_VITC_DID = AJAAncillaryData_AnalogSID;
const uint8_t AJAAncillaryData_VITC_SID = AJAAncillaryData_AnalogDID;
const uint32_t AJAAncillaryData_VITC_PayloadSize = 720; // note: assumes we're only using this for SD (720 pixels/line)
enum AJAAncillaryData_Timecode_VITC_Type
{
AJAAncillaryData_Timecode_VITC_Type_Unknown = 0,
AJAAncillaryData_Timecode_VITC_Type_Timecode = 1, // CRC == 0x00
AJAAncillaryData_Timecode_VITC_Type_FilmData = 2, // RP-201 Film Data (CRC == 0xFF)
AJAAncillaryData_Timecode_VITC_Type_ProdData = 3 // RP-201 Production Data (CRC == 0x0F)
};
/**
@brief This is the VITC-specific subclass of the AJAAncillaryData_Timecode class.
**/
class AJAExport AJAAncillaryData_Timecode_VITC : public AJAAncillaryData_Timecode
{
public:
AJAAncillaryData_Timecode_VITC ();
AJAAncillaryData_Timecode_VITC (const AJAAncillaryData_Timecode_VITC & clone);
AJAAncillaryData_Timecode_VITC (const AJAAncillaryData_Timecode_VITC * pClone);
AJAAncillaryData_Timecode_VITC (const AJAAncillaryData * pData);
virtual ~AJAAncillaryData_Timecode_VITC () {}
virtual void Clear (void); ///< @brief Frees my allocated memory, if any, and resets my members to their default values.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryData_Timecode_VITC & operator = (const AJAAncillaryData_Timecode_VITC & inRHS);
virtual inline AJAAncillaryData_Timecode_VITC * Clone (void) const {return new AJAAncillaryData_Timecode_VITC (this);} ///< @return A clone of myself.
/**
@brief Parses out (interprets) the "local" ancillary data from my payload data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus ParsePayloadData (void);
/**
@brief Generate the payload data from the "local" ancillary data.
@note This method is overridden for the specific Anc data type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GeneratePayloadData (void);
virtual inline AJAAncillaryData_Timecode_VITC_Type GetVITCDataType (void) const {return m_vitcType;} ///< @return The "type" of received VITC data based on the parsed CRC.
/**
@brief Sets my VITC data type.
@param[in] inType Specifies my new VITC data type.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SetVITCDataType (const AJAAncillaryData_Timecode_VITC_Type inType);
/**
@brief Streams a human-readable representation of me to the given output stream.
@param inOutStream Specifies the output stream.
@param[in] inDetailed Specify 'true' for a detailed representation; otherwise use 'false' for a brief one.
@return The given output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = false) const;
/**
@param[in] pInAncData A valid pointer to an AJAAncillaryData instance.
@return The AJAAncillaryDataType if I recognize this ancillary data (or unknown if unrecognized).
**/
static AJAAncillaryDataType RecognizeThisAncillaryData (const AJAAncillaryData * pInAncData);
/**
@param[in] inType Specifies the VITC data type.
@return A string containing a human-readable representation of the given VITC data type.
**/
static std::string VITCTypeToString (const AJAAncillaryData_Timecode_VITC_Type inType);
protected:
void Init (void); // NOT virtual - called by constructors
// Encode methods ported/stolen from ntv2vitc.cpp
bool DecodeLine (const uint8_t * pInLine);
AJAStatus EncodeLine (uint8_t * pOutLine) const;
#ifdef USE_SMPTE_266M
#else
void DoVITCBitPair(uint8_t *pLine, uint32_t& pixelIndex, bool bPrevBit, bool bBit0, bool bBit1, bool bDropBit);
#endif
// Note: if you make a change to the local member data, be sure to ALSO make the appropriate
// changes in the Init() and operator= methods!
AJAAncillaryData_Timecode_VITC_Type m_vitcType; ///< @brief The "type" of VITC received or to be transmitted
}; // AJAAncillaryData_Timecode_VITC
#endif // AJA_ANCILLARYDATA_TIMECODE_VITC_H

View File

@ -1,59 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarydatafactory.h
@brief Declaration of the AJAAncillaryDataFactory class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYDATAFACTORY_H
#define AJA_ANCILLARYDATAFACTORY_H
#include "ancillarydata.h"
/**
@brief Use my AJAAncillaryDataFactory::GuessAncillaryDataType method to determine what kind of
ancillary data is being held by a (generic) ::AJAAncillaryData object.
Use my AJAAncillaryDataFactory::Create method to instantiate a new ::AJAAncillaryData
object specific to a given type.
**/
class AJAExport AJAAncillaryDataFactory
{
public:
/**
@brief Creates a new particular subtype of ::AJAAncillaryData object.
@param[in] inAncType Specifies the subtype of ::AJAAncillaryData object (subclass) to instantiate.
@param[in] inAncData Supplies an existing ::AJAAncillaryData object to clone from.
@return A pointer to the new instance; or NULL upon failure.
**/
static AJAAncillaryData * Create (const AJAAncillaryDataType inAncType, const AJAAncillaryData & inAncData);
/**
@brief Creates a new ::AJAAncillaryData object having a particular subtype.
@param[in] inAncType Type of ::AJAAncillaryData object (subclass) to instantiate.
@param[in] pInAncData Optionally supplies an existing ::AJAAncillaryData object to clone from.
@return A pointer to the new instance; or NULL upon failure.
**/
static AJAAncillaryData * Create (const AJAAncillaryDataType inAncType, const AJAAncillaryData * pInAncData = NULL);
/**
@brief Given a generic ::AJAAncillaryData object, attempts to guess what kind of specific
::AJAAncillaryData object it might be from its raw packet data.
@param[in] inAncData An ::AJAAncillaryData object that contains "raw" packet data.
@return The guessed ::AJAAncillaryDataType (or ::AJAAncillaryDataType_Unknown if no idea...).
**/
static AJAAncillaryDataType GuessAncillaryDataType (const AJAAncillaryData & inAncData);
/**
@brief Given a generic ::AJAAncillaryData object, attempts to guess what kind of specific
::AJAAncillaryData object from its raw packet data.
@param[in] pInAncData A valid, non-NULL pointer to an ::AJAAncillaryData object that contains
"raw" packet data.
@return The guessed ::AJAAncillaryDataType (or ::AJAAncillaryDataType_Unknown if no idea...).
**/
static AJAAncillaryDataType GuessAncillaryDataType (const AJAAncillaryData * pInAncData);
}; // AJAAncillaryDataFactory
#endif // AJA_ANCILLARYDATAFACTORY_H

View File

@ -1,671 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ancillarylist.h
@brief Declares the AJAAncillaryList class.
@copyright (C) 2010-2021 AJA Video Systems, Inc.
**/
#ifndef AJA_ANCILLARYLIST_H
#define AJA_ANCILLARYLIST_H
#include "ancillarydata.h"
#include "ntv2formatdescriptor.h"
#include <list>
#include <map>
#include <set>
// used for "match any" searches and counts
const uint8_t AJAAncillaryDataWildcard_DID = 0xFF;
const uint8_t AJAAncillaryDataWildcard_SID = 0xFF;
/**
@brief Associates certain frame line numbers with specific types of "raw" or "analog" ancillary data.
For example, you may wish to associate line 21 (in 525i) with ::AJAAncillaryDataType_Cea608_Line21.
@note This facility is ONLY used by AJAAncillaryList::AddReceivedAncillaryData to identify captured
"raw" data (AJAAncillaryDataCoding_Analog).
**/
typedef std::map <uint16_t, AJAAncillaryDataType> AJAAncillaryAnalogTypeMap;
typedef std::vector<ULWordSequence> AJAU32Pkts; ///< @brief Ordered sequence of U32 RTP packets (U32s in network byte order)
typedef AJAU32Pkts::const_iterator AJAU32PktsConstIter; ///< @brief Handy const iterator over AJAU32Pkts
typedef AJAU32Pkts::iterator AJAU32PktsIter; ///< @brief Handy non-const iterator over AJAU32Pkts
typedef UByteSequence AJAAncPktCounts; ///< @brief Ordered sequence of SMPTE Anc packet counts
typedef AJAAncPktCounts::const_iterator AJAAncPktCountsConstIter; ///< @brief Handy const iterator over AJAAncPktCounts
class CNTV2Card;
typedef std::set<AJAAncPktDIDSID> AJAAncPktDIDSIDSet; ///< @brief Set of distinct packet DID/SIDs (New in SDK 16.0)
typedef AJAAncPktDIDSIDSet::const_iterator AJAAncPktDIDSIDSetConstIter; ///< @brief Handy const iterator for AJAAncPktDIDSIDSet (New in SDK 16.0)
typedef AJAAncPktDIDSIDSet::iterator AJAAncPktDIDSIDSetIter; ///< @brief Handy non-const iterator for AJAAncPktDIDSIDSet (New in SDK 16.0)
/**
@brief I am an ordered collection of AJAAncillaryData instances which represent one or more SMPTE 291
data packets that were captured from, or destined to be played into, one video field or frame.
I can be built from the ancillary data received by the hardware during one field/frame, and/or
built "from scratch" and used as the source of outgoing ancillary data to hardware.
By default, packets (::AJAAncillaryData instances) remain in the order added to me.
Use my AJAAncillaryList::SortListByDID, AJAAncillaryList::SortListBySID or AJAAncillaryList::SortListByLocation
methods to sort my packets by DID, SDID or location.
@warning I am not thread-safe! When any of my non-const instance methods are called by one thread,
do not call any of my other instance methods from any other thread.
**/
class AJAExport AJAAncillaryList
{
public: // CLASS METHODS
/**
@name Create from Device Buffers (Capture/Ingest)
**/
///@{
/**
@brief Returns all packets found in the VANC lines of the given NTV2 frame buffer.
@param[in] inFrameBuffer Specifies the NTV2 frame buffer (or at least the portion containing the VANC lines).
@param[in] inFormatDesc Describes the frame buffer (pixel format, video standard, etc.).
@param[out] outPackets Receives the packets found.
@param[in] inFrameNum If non-zero, specifies/sets the frame identifier for the packets.
@return AJA_STATUS_SUCCESS if successful.
@bug The ::AJAAncillaryDataLink in the ::AJAAncillaryDataLocation in each of the returned packets
is currently ::AJAAncillaryDataLink_A, which will be incorrect if, for example, the FrameStore
that delivered the \c inFrameBuffer was sourced from the "B" link of a Dual-Link SDI source.
**/
static AJAStatus SetFromVANCData (const NTV2_POINTER & inFrameBuffer,
const NTV2FormatDescriptor & inFormatDesc,
AJAAncillaryList & outPackets,
const uint32_t inFrameNum = 0);
/**
@brief Returns all ancillary data packets found in the given F1 and F2 ancillary data buffers.
@param[in] inF1AncBuffer Specifies the F1 ancillary data buffer.
@param[in] inF2AncBuffer Specifies the F2 ancillary data buffer.
@param[out] outPackets Receives the packet list.
@param[in] inFrameNum If non-zero, replaces the frame identifier of new packets that have a zero frame ID.
@return AJA_STATUS_SUCCESS if successful.
**/
static AJAStatus SetFromDeviceAncBuffers (const NTV2_POINTER & inF1AncBuffer,
const NTV2_POINTER & inF2AncBuffer,
AJAAncillaryList & outPackets,
const uint32_t inFrameNum = 0);
#if !defined(NTV2_DEPRECATE_15_2)
static inline AJAStatus SetFromSDIAncData (const NTV2_POINTER & inF1, const NTV2_POINTER & inF2, AJAAncillaryList & outPkts) {return SetFromDeviceAncBuffers(inF1, inF2, outPkts);} ///< @deprecated Use SetFromDeviceAncBuffers instead.
static inline AJAStatus SetFromIPAncData (const NTV2_POINTER & inF1, const NTV2_POINTER & inF2, AJAAncillaryList & outPkts) {return SetFromDeviceAncBuffers(inF1, inF2, outPkts);} ///< @deprecated Use SetFromDeviceAncBuffers instead.
#endif // !defined(NTV2_DEPRECATE_15_2)
///@}
/**
@name Global Configuration
**/
///@{
/**
@brief Clears my global Analog Ancillary Data Type map.
@return AJA_STATUS_SUCCESS if successful.
**/
static AJAStatus ClearAnalogAncillaryDataTypeMap (void);
/**
@brief Copies the given map to the global Analog Ancillary Data Type map.
@param[in] inMap The map to copy.
@return AJA_STATUS_SUCCESS if successful.
**/
static AJAStatus SetAnalogAncillaryDataTypeMap (const AJAAncillaryAnalogTypeMap & inMap);
/**
@brief Returns a copy of the global Analog Ancillary Data Type map.
@param[out] outMap Receives a copy of the map.
@return AJA_STATUS_SUCCESS if successful.
**/
static AJAStatus GetAnalogAncillaryDataTypeMap (AJAAncillaryAnalogTypeMap & outMap);
/**
@brief Sets (or changes) the map entry for the designated line to the designated type.
@param[in] inLineNum Specifies the frame line number to be added or changed.
@param[in] inType Specifies the ancillary data type to be associated with this line.
Use AJAAncillaryDataType_Unknown to remove any associations with the line.
@return AJA_STATUS_SUCCESS if successful.
**/
static AJAStatus SetAnalogAncillaryDataTypeForLine (const uint16_t inLineNum, const AJAAncillaryDataType inType);
/**
@brief Answers with the ancillary data type associated with the designated line.
@param[in] inLineNum Specifies the frame line number of interest.
@return The ancillary data type associated with the designated line, if any;
otherwise AJAAncillaryDataType_Unknown if the line has no association.
**/
static AJAAncillaryDataType GetAnalogAncillaryDataTypeForLine (const uint16_t inLineNum);
/**
@brief Sets whether or not zero-length packets are included or not.
@param[in] inExclude Specify true to exclude zero-length packets.
**/
static void SetIncludeZeroLengthPackets (const bool inExclude);
static uint32_t GetExcludedZeroLengthPacketCount (void); ///< @return The current number of zero-length packets that have been excluded
static void ResetExcludedZeroLengthPacketCount (void); ///< @brief Resets my tally of excluded zero-length packets to zero.
static bool IsIncludingZeroLengthPackets (void); ///< @return True if zero-length packets are included; otherwise false.
///@}
public: // INSTANCE METHODS
/**
@name Construction, Destruction, Assignment & Copying
**/
///@{
AJAAncillaryList (); ///< @brief Instantiate and initialize with a default set of values.
inline AJAAncillaryList (const AJAAncillaryList & inRHS) {*this = inRHS;} ///< @brief My copy constructor.
virtual ~AJAAncillaryList (); ///< @brief My destructor.
/**
@brief Assignment operator -- replaces my contents with the right-hand-side value.
@param[in] inRHS The value to be assigned to me.
@return A reference to myself.
**/
virtual AJAAncillaryList & operator = (const AJAAncillaryList & inRHS);
///@}
/**
@name Fetching, Searching & Enumerating Packets
**/
///@{
/**
@brief Answers with the number of AJAAncillaryData objects I contain (any/all types).
@return The number of AJAAncillaryData objects I contain.
**/
virtual inline uint32_t CountAncillaryData (void) const {return uint32_t(m_ancList.size());}
/**
@return True if I'm empty; otherwise false.
**/
virtual inline bool IsEmpty (void) const {return !CountAncillaryData();}
/**
@brief Answers with the AJAAncillaryData object at the given index.
@param[in] inIndex Specifies the zero-based index position.
@return The AJAAncillaryData object at the given index (or NULL if not found).
@note The AJAAncillaryList owns the returned object. If the list gets Cleared or deleted, the returned pointer will become invalid.
**/
virtual AJAAncillaryData * GetAncillaryDataAtIndex (const uint32_t inIndex) const;
/**
@brief Answers with the number of AJAAncillaryData objects having the given type.
@param[in] inMatchType Specifies the AJAAncillaryDataType to match.
@return The number of AJAAncillaryData objects having the given type.
**/
virtual uint32_t CountAncillaryDataWithType (const AJAAncillaryDataType inMatchType) const;
/**
@brief Answers with the AJAAncillaryData object having the given type and index.
@param[in] inMatchType Specifies the AJAAncillaryDataType to match.
@param[in] inIndex Specifies the desired instance of the given type (use zero for the first one).
@return The AJAAncillaryData object (or NULL if not found).
@note The AJAAncillaryList owns the returned object. If the list gets Cleared or deleted, the returned pointer will become invalid.
**/
virtual AJAAncillaryData * GetAncillaryDataWithType (const AJAAncillaryDataType inMatchType, const uint32_t inIndex = 0) const;
/**
@brief Answers with the number of AncillaryData objects having the given DataID and SecondaryID.
@param[in] inDID Specifies the DataID to match. Use AJAAncillaryDataWildcard_DID to match any/all DIDs.
@param[in] inSID Specifies the secondary ID to match. Use AJAAncillaryDataWildcard_SID to match any/all SIDs.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual uint32_t CountAncillaryDataWithID (const uint8_t inDID, const uint8_t inSID) const;
/**
@brief Answers with the AJAAncillaryData object having the given DataID and SecondaryID, at the given index.
@param[in] inDID DataID to match (use AJAAncillaryDataWildcard_DID to match "any" DID)
@param[in] inSID Secondary ID to match (use AJAAncillaryDataWildcard_SID to match "any" SID)
@param[in] inIndex Specifies which instance among those having the given DID and SID (use zero for the first one).
@return The AJAAncillaryData object having the given DID, SID and index.
@note The AJAAncillaryList owns the returned object. If the list gets Cleared or deleted, the returned pointer will become invalid.
**/
virtual AJAAncillaryData * GetAncillaryDataWithID (const uint8_t inDID, const uint8_t inSID, const uint32_t inIndex = 0) const;
virtual AJAAncPktDIDSIDSet GetAncillaryPacketIDs (void) const; ///< @return The set of DID/SID pairs of all of my packets. (New in SDK 16.0)
///@}
/**
@name Adding & Removing Packets
**/
///@{
/**
@brief Removes and frees all of my AJAAncillaryData objects.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus Clear (void);
/**
@brief Adds (appends) a copy (using AJAAncillaryData::Clone) of the given list's packet objects to me.
@param[in] inPackets Specifies the AJAAncillaryList containing the packets to be copied and added to me.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus AddAncillaryData (const AJAAncillaryList & inPackets);
/**
@brief Adds (appends) a copy (using AJAAncillaryData::Clone) of the AJAAncillaryData object to me.
@param[in] pInAncData Specifies the AJAAncillaryData object to be copied and added to me.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus AddAncillaryData (const AJAAncillaryData * pInAncData);
/**
@brief Adds a copy of the AJAAncillaryData object to me.
@param[in] inAncData Specifies the AJAAncillaryData object to be copied and added to me.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual inline AJAStatus AddAncillaryData (const AJAAncillaryData & inAncData) {return AddAncillaryData(&inAncData);}
/**
@brief Removes all copies of the AJAAncillaryData object from me.
@note The given AJAAncillaryData object is not freed/deleted -- it's only removed from my list.
@param[in] pInAncData Specifies the AJAAncillaryData object to remove.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus RemoveAncillaryData (AJAAncillaryData * pInAncData);
/**
@brief Removes all copies of the AJAAncillaryData object from me and deletes the object itself.
@param[in] pInAncData Specifies the AJAAncillaryData object to remove and delete.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus DeleteAncillaryData (AJAAncillaryData * pInAncData);
///@}
/**
@name Operations
**/
///@{
/**
@brief Sort the AncillaryDataList by DataID (DID) value.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SortListByDID (void);
/**
@brief Sort the AncillaryDataList by Secondary ID (SID) value.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SortListBySID (void);
/**
@brief Sort the AncillaryDataList by "location", i.e. where in the video (field, line num, HANC/VANC)
the data came from or will be inserted to.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus SortListByLocation (void);
/**
@brief Compares me with another list.
@param[in] inCompareList Specifies the other list to be compared with me.
@param[in] inIgnoreLocation If true, don't compare each packet's AJAAncillaryDataLocation info. Defaults to true.
@param[in] inIgnoreChecksum If true, don't compare each packet's checksums. Defaults to true.
@return AJA_STATUS_SUCCESS if equal; otherwise AJA_STATUS_FAIL.
@note The sort order of each list, to be considered identical, must be the same.
**/
virtual AJAStatus Compare (const AJAAncillaryList & inCompareList, const bool inIgnoreLocation = true, const bool inIgnoreChecksum = true) const;
/**
@brief Compares me with another list and returns a std::string that contains a human-readable explanation
of the first difference found (if any).
@param[in] inCompareList Specifies the other list to be compared with me.
@param[in] inIgnoreLocation If true, don't compare each packet's AJAAncillaryDataLocation info. Defaults to true.
@param[in] inIgnoreChecksum If true, don't compare each packet's checksums. Defaults to true.
@return A string that contains a human-readable explanation of the first difference found (if any);
or an empty string if the lists are identical.
@note The sort order of each list, to be considered identical, must be the same.
**/
virtual std::string CompareWithInfo (const AJAAncillaryList & inCompareList, const bool inIgnoreLocation = true, const bool inIgnoreChecksum = true) const;
///@}
/**
@name Transmit to AJA Hardware (Playout)
**/
///@{
/**
@brief Answers with the sizes of the buffers (one for field 1, one for field 2) needed to hold the anc data inserter
"transmit" data for all of my AJAAncillaryData objects.
@param[in] inIsProgressive Specify true for insertion into Progressive (transport) frames, or false for interlaced or psf.
@param[in] inF2StartLine For interlaced/psf frames, specifies the line number where "field 2" begins; otherwise ignored.
@param[out] outF1ByteCount Receives the size (in bytes) of the buffer needed to hold the "Field 1" anc data.
@param[out] outF2ByteCount Receives the size (in bytes) of the buffer needed to hold the "Field 2" anc data.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetAncillaryDataTransmitSize (const bool inIsProgressive, const uint32_t inF2StartLine,
uint32_t & outF1ByteCount, uint32_t & outF2ByteCount);
/**
@brief Builds one or two ancillary data buffers (one for field 1, one for field 2) with the anc data inserter
"transmit" data for all of my AJAAncillaryData objects.
@param[in] inIsProgressive Specify true for insertion into Progressive (transport) frames, or false for interlaced or psf.
@param[in] inF2StartLine For interlaced/psf frames, specifies the line number where "field 2" begins; otherwise ignored.
@param pOutF1AncData Specifies the valid, non-NULL starting address of the "Field 1" ancillary data buffer.
Note that this buffer is written for Progressive frames.
@param[in] inF1ByteCountMax Specifies the capacity (in bytes) of the Field 1 buffer (may be larger than needed).
@param pOutF2AncData Specifies the valid, non-NULL starting address of the "Field 2" ancillary data buffer.
Note that this buffer is not written for Progressive frames.
@param[in] inF2ByteCountMax Specifies the capacity (in bytes) of the Field 2 buffer (may be larger than needed).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetAncillaryDataTransmitData (const bool inIsProgressive, const uint32_t inF2StartLine,
uint8_t * pOutF1AncData, const uint32_t inF1ByteCountMax,
uint8_t * pOutF2AncData, const uint32_t inF2ByteCountMax);
/**
@brief Encodes my AJAAncillaryData packets into the given buffers in the default \ref ancgumpformat .
The buffer contents are replaced; the unused remainder, if any, will be zeroed.
@param F1Buffer Specifies the buffer memory into which Field 1's anc data will be written.
@param F2Buffer Specifies the buffer memory into which Field 2's anc data will be written.
@param inIsProgressive Specify true to designate the output ancillary data stream as progressive;
otherwise, specify false. Defaults to true (is progressive).
@param[in] inF2StartLine For interlaced/psf frames, specifies the line number where Field 2 begins; otherwise ignored.
Defaults to zero (progressive). For interlaced video, see NTV2SmpteLineNumber::GetLastLine .
@note This function has a side-effect of automatically sorting my packets by ascending location before encoding.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetTransmitData (NTV2_POINTER & F1Buffer, NTV2_POINTER & F2Buffer,
const bool inIsProgressive = true, const uint32_t inF2StartLine = 0);
virtual inline AJAStatus GetSDITransmitData (NTV2_POINTER & F1Buffer, NTV2_POINTER & F2Buffer,
const bool inIsProgressive = true, const uint32_t inF2StartLine = 0)
{return GetTransmitData(F1Buffer, F2Buffer, inIsProgressive, inF2StartLine);} ///< @deprecated An alias for GetTransmitData
/**
@brief Writes my AJAAncillaryData objects into the given tall/taller frame buffer having the given raster/format.
@param inFrameBuffer Specifies the frame buffer memory on the host to modify.
@param[in] inFormatDesc Describes the frame buffer's raster and pixel format.
@note Before writing, I automatically sort my packets by location.
@return AJA_STATUS_SUCCESS if successful.
@bug Currently ignores each packet's horizontal offset (assumes AJAAncDataHorizOffset_Anywhere).
**/
virtual AJAStatus GetVANCTransmitData (NTV2_POINTER & inFrameBuffer, const NTV2FormatDescriptor & inFormatDesc);
/**
@brief Explicitly encodes my AJAAncillaryData packets into the given buffers in \ref ancrtpformat .
The buffer contents are replaced; the unused remainder, if any, will be zeroed.
@param F1Buffer Specifies the buffer memory into which Field 1's IP/RTP data will be written.
@param F2Buffer Specifies the buffer memory into which Field 2's IP/RTP data will be written.
@param[in] inIsProgressive Specify true to designate the output ancillary data stream as progressive;
otherwise, specify false. Defaults to true (is progressive).
@param[in] inF2StartLine For interlaced/psf frames, specifies the line number where Field 2 begins; otherwise ignored.
Defaults to zero (progressive).
@note This function has the following side-effects:
- Sorts my packets by ascending location before encoding.
- Calls AJAAncillaryData::GenerateTransmitData on each of my packets.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetIPTransmitData (NTV2_POINTER & F1Buffer, NTV2_POINTER & F2Buffer,
const bool inIsProgressive = true, const uint32_t inF2StartLine = 0);
/**
@brief Answers with the number of bytes required to store IP/RTP for my AJAAncillaryData packets in \ref ancrtpformat .
@param[out] outF1ByteCount Receives the requisite byte count for Field 1's IP/RTP packet data.
@param[out] outF2ByteCount Receives the requisite byte count for Field 1's IP/RTP packet data.
@param[in] inIsProgressive Specify true to designate the output ancillary data stream as progressive;
otherwise, specify false. Defaults to true (is progressive).
@param[in] inF2StartLine For interlaced/psf frames, specifies the line number where Field 2 begins; otherwise ignored.
Defaults to zero (progressive).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetIPTransmitDataLength (uint32_t & outF1ByteCount, uint32_t & outF2ByteCount,
const bool inIsProgressive = true, const uint32_t inF2StartLine = 0);
/**
@brief Answers true if multiple RTP packets will be transmitted/encoded.
The default behavior is to transmit/encode a single RTP packet.
@return True if multiple RTP packets are allowed to be encoded; otherwise false.
**/
virtual inline bool AllowMultiRTPTransmit (void) const {return m_xmitMultiRTP;}
/**
@brief Determines if multiple RTP packets will be encoded for playout (via GetIPTransmitData).
The default behavior is to transmit/encode a single RTP packet.
@param[in] inAllow Specify true to allow encoding more than one RTP packet into the destination Anc buffer.
Specify false to transmit/encode a single RTP packet (the default).
**/
virtual inline void SetAllowMultiRTPTransmit (const bool inAllow) {m_xmitMultiRTP = inAllow;}
#if !defined(NTV2_DEPRECATE_15_5)
/**
@deprecated Use SetAllowMultiRTPTransmit with the 4-parameter version of this function.
**/
virtual NTV2_DEPRECATED_f(AJAStatus GetIPTransmitData (NTV2_POINTER & F1Buffer, NTV2_POINTER & F2Buffer,
const bool inIsProgressive, const uint32_t inF2StartLine,
const bool inSingleRTPPkt))
{ const bool oldValue(AllowMultiRTPTransmit());
SetAllowMultiRTPTransmit(!inSingleRTPPkt);
const AJAStatus result(GetIPTransmitData(F1Buffer, F2Buffer, inIsProgressive, inF2StartLine));
SetAllowMultiRTPTransmit(oldValue);
return result;
}
/**
@deprecated Use SetAllowMultiRTPTransmit with the 4-parameter version of this function.
**/
virtual NTV2_DEPRECATED_f(AJAStatus GetIPTransmitDataLength (uint32_t & outF1ByteCount, uint32_t & outF2ByteCount,
const bool inIsProgressive, const uint32_t inF2StartLine,
const bool inSingleRTPPkt))
{ const bool oldValue(AllowMultiRTPTransmit());
SetAllowMultiRTPTransmit(!inSingleRTPPkt);
const AJAStatus result(GetIPTransmitDataLength(outF1ByteCount, outF2ByteCount, inIsProgressive, inF2StartLine));
SetAllowMultiRTPTransmit(oldValue);
return result;
}
#endif // !defined(NTV2_DEPRECATE_15_5)
///@}
/**
@name Receive from AJA Hardware (Ingest)
**/
///@{
/**
@brief Parse "raw" ancillary data bytes received from hardware (ingest) -- see \ref ancgumpformat --
into separate AJAAncillaryData objects and appends them to me.
@param[in] pInReceivedData Specifies a valid, non-NULL address of the first byte of "raw" ancillary data received by an AncExtractor widget.
@param[in] inByteCount Specifies the number of bytes of data in the specified buffer to process.
@param[in] inFrameNum If non-zero, replaces the frame identifier of new packets that have a zero frame ID.
@details For each packet parsed from the received data, AJAAncillaryDataFactory::GuessAncillaryDataType
is called to ascertain the packet's AJAAncillaryDataType, then AJAAncillaryDataFactory::Create
is used to instantiate the specific AJAAncillaryData subclass instance.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus AddReceivedAncillaryData (const uint8_t * pInReceivedData, const uint32_t inByteCount, const uint32_t inFrameNum = 0);
/**
@brief Parse a "raw" RTP packet received from hardware (ingest) in network byte order into separate
AJAAncillaryData objects and appends them to me.
@param[in] inReceivedData The received packet words in network byte order.
@details For each packet parsed from the received data, AJAAncillaryDataFactory::GuessAncillaryDataType
is called to ascertain the packet's AJAAncillaryDataType, then AJAAncillaryDataFactory::Create
is used to instantiate the specific AJAAncillaryData subclass instance.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus AddReceivedAncillaryData (const ULWordSequence & inReceivedData);
/**
@brief Adds the packet that originated in the VANC lines of an NTV2 frame buffer to my list.
@param[in] inPacketWords Specifies the "raw" 16-bit User Data Words of the packet to be added. The first
six elements must be 0x0000, 0x03ff, 0x03ff, DID, SDID, DC, data words, and CS.
Each word will have its upper byte masked off.
@param[in] inLocation Specifies where the packet was found.
@param[in] inFrameNum If non-zero, specifies/sets the frame identifier for the added packets.
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus AddVANCData (const UWordSequence & inPacketWords,
const AJAAncillaryDataLocation & inLocation,
const uint32_t inFrameNum = 0);
/**
@brief Answers true if multiple RTP packets are allowed for capture/receive.
The default behavior is to process all (multiple) received RTP packets.
@return True if multiple RTP packets are allowed to be decoded; otherwise false.
**/
virtual inline bool AllowMultiRTPReceive (void) const {return m_rcvMultiRTP;}
/**
@brief Determines if more than one RTP packet will be processed/decoded (via AddReceivedAncillaryData).
@param[in] inAllow Specify true to allow processing/decoding multiple RTP packets from the receiving Anc buffer.
Specify false to only process/decode the first RTP packet found in the receiving Anc buffer.
**/
virtual inline void SetAllowMultiRTPReceive (const bool inAllow) {m_rcvMultiRTP = inAllow;}
/**
@brief Answers if checksum errors are to be ignored or not.
The default behavior is to not ignore them.
@note This applies to capture/ingest (i.e. AddReceivedAncillaryData methods).
@return True if ignoring checksum errors; otherwise false.
**/
virtual inline bool IgnoreChecksumErrors (void) const {return m_ignoreCS;}
/**
@brief Determines if checksum errors encountered during capture/ingest
(via AddReceivedAncillaryData) will be ignored or not.
@param[in] inIgnore Specify true to ignore checksum errors; otherwise use false.
**/
virtual inline void SetIgnoreChecksumErrors (const bool inIgnore) {m_ignoreCS = inIgnore;}
#if !defined(NTV2_DEPRECATE_14_2)
/**
@deprecated Use the 2-parameter version of this function instead.
**/
virtual NTV2_DEPRECATED_f(AJAStatus AddVANCData (const UWordSequence & inPacketWords, const uint16_t inLineNum,
const AJAAncillaryDataVideoStream inStream = AJAAncillaryDataChannel_Y));
#endif // !defined(NTV2_DEPRECATE_14_2)
/**
@brief Sends a "ParsePayloadData" command to all of my AJAAncillaryData objects.
@return AJA_STATUS_SUCCESS if all items parse successfully; otherwise the last failure result.
**/
virtual AJAStatus ParseAllAncillaryData (void);
///@}
/**
@name Printing & Debugging
**/
///@{
/**
@brief Dumps a human-readable description of every packet in my list to the given output stream.
@param[in] inDetailed If true, include some of the packet data; otherwise omit packet data.
Defaults to true.
@return The specified output stream.
**/
virtual std::ostream & Print (std::ostream & inOutStream, const bool inDetailed = true) const;
///@}
protected:
friend class CNTV2Card; // CNTV2Card's member functions can call AJAAncillaryList's private & protected member functions
typedef std::list <AJAAncillaryData *> AJAAncillaryDataList;
typedef AJAAncillaryDataList::const_iterator AJAAncDataListConstIter; ///< @brief Handy const iterator for iterating over members of an AJAAncillaryDataList.
typedef AJAAncillaryDataList::iterator AJAAncDataListIter; ///< @brief Handy non-const iterator for iterating over members of an AJAAncillaryDataList.
virtual inline AJAAncillaryDataType GetAnalogAncillaryDataType (const AJAAncillaryData & inAncData) {return GetAnalogAncillaryDataTypeForLine(inAncData.GetLocationLineNumber());}
static bool BufferHasGUMPData (const NTV2_POINTER & inBuffer);
/**
@brief Appends whatever can be decoded from the given device Anc buffer to the AJAAncillaryList.
@param[in] inAncBuffer Specifies the Anc buffer to be parsed.
@param outPacketList The AJAAncillaryList to be appended to, for whatever packets are found in the buffer.
@param[in] inFrameNum If non-zero, replaces the frame identifier of packets that have a zero frame ID.
@note Called by SetFromDeviceAncBuffers, once for the F1 buffer, another time for the F2 buffer.
@return AJA_STATUS_SUCCESS if successful, including if no Anc packets are found and added to the list.
**/
static AJAStatus AddFromDeviceAncBuffer (const NTV2_POINTER & inAncBuffer,
AJAAncillaryList & outPacketList,
const uint32_t inFrameNum = 0);
/**
@brief Answers with my F1 & F2 SMPTE anc packets encoded as RTP ULWordSequences.
The returned ULWords are already network-byte-order, ready to encapsulate into an RTP packet buffer.
@param[out] outF1U32Pkts Receives my F1 AJAU32Pkts, containing zero or more RTP ULWordSequences.
@param[out] outF2U32Pkts Receives my F1 AJAU32Pkts, containing zero or more RTP ULWordSequences.
@param[out] outF1AncCounts Receives my F1 SMPTE Anc packet counts for each of the returned F1 RTP packets (in outF1U32Pkts).
@param[out] outF2AncCounts Receives my F2 SMPTE Anc packet counts for each of the returned F2 RTP packets (in outF2U32Pkts).
@param[in] inIsProgressive Specify false for interlace; true for progressive/Psf.
@param[in] inF2StartLine For interlaced/psf frames, specifies the line number where Field 2 begins; otherwise ignored.
Defaults to zero (progressive).
@return AJA_STATUS_SUCCESS if successful.
**/
virtual AJAStatus GetRTPPackets (AJAU32Pkts & outF1U32Pkts,
AJAU32Pkts & outF2U32Pkts,
AJAAncPktCounts & outF1AncCounts,
AJAAncPktCounts & outF2AncCounts,
const bool inIsProgressive,
const uint32_t inF2StartLine);
/**
@brief Fills the buffer with the given RTP packets.
@param theBuffer The buffer to be filled. An empty/NULL buffer is permitted, and
will copy no data, but instead will return the byte count that
otherwise would've been written.
@param[out] outBytesWritten Receives the total bytes written into the buffer (or that would
be written if given a non-NULL buffer).
@param[in] inRTPPkts The RTP packets, a vector of zero or more RTP ULWordSequences.
@param[in] inAncCounts The per-RTP-packet anc packet counts.
@param[in] inIsF2 Specify false for Field1 (or progressive or Psf); true for Field2.
@param[in] inIsProgressive Specify false for interlace; true for progressive/Psf.
@return AJA_STATUS_SUCCESS if successful.
**/
static AJAStatus WriteRTPPackets (NTV2_POINTER & theBuffer,
uint32_t & outBytesWritten,
const AJAU32Pkts & inRTPPkts,
const AJAAncPktCounts & inAncCounts,
const bool inIsF2,
const bool inIsProgressive);
private:
AJAAncillaryDataList m_ancList; ///< @brief My packet list
bool m_rcvMultiRTP; ///< @brief True: Rcv 1 RTP pkt per Anc pkt; False: Rcv 1 RTP pkt for all Anc pkts
bool m_xmitMultiRTP; ///< @brief True: Xmit 1 RTP pkt per Anc pkt; False: Xmit 1 RTP pkt for all Anc pkts
bool m_ignoreCS; ///< @brief True: ignore checksum errors; False: don't ignore CS errors
}; // AJAAncillaryList
/**
@brief Writes a human-readable rendition of the given AJAAncillaryList into the given output stream.
@param inOutStream Specifies the output stream to be written.
@param[in] inList Specifies the AJAAncillaryList to be rendered into the output stream.
@return A non-constant reference to the specified output stream.
**/
inline std::ostream & operator << (std::ostream & inOutStream, const AJAAncillaryList & inList) {return inList.Print(inOutStream);}
/**
@brief Writes the given AJAU32Pkts object into the given output stream in a human-readable format.
@param inOutStream Specifies the output stream to be written.
@param[in] inPkts Specifies the AJAU32Pkts object to be rendered into the output stream.
@return A non-constant reference to the specified output stream.
**/
AJAExport std::ostream & operator << (std::ostream & inOutStream, const AJAU32Pkts & inPkts);
/**
@brief Writes the given AJAAncPktDIDSIDSet set into the given output stream in a human-readable format.
@param inOutStream Specifies the output stream to be written.
@param[in] inSet Specifies the AJAAncPktDIDSIDSet to be rendered into the output stream.
@return A non-constant reference to the specified output stream.
**/
AJAExport std::ostream & operator << (std::ostream & inOutStream, const AJAAncPktDIDSIDSet & inSet); // New in SDK 16.0
#endif // AJA_ANCILLARYLIST_H

View File

@ -1,217 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ajarefptr.h
@copyright (C) 2013-2021 AJA Video Systems, Inc. All rights reserved.
@brief Defines the AJARefPtr template class.
**/
#if !defined (__AJAREFPTR__)
#define __AJAREFPTR__
#include "../system/atomic.h"
/**
@brief I am the referent object that maintains the reference count and
the pointer to the underlying object whose lifespan I manage.
@note I am not designed to be used as a superclass, therefore, none of
my methods are virtual.
**/
template <class TRef>
class Referent
{
// Instance Methods
public:
// Constructor
Referent (TRef * ptr);
// Reference Count Management
void AddRef () throw ();
void RemoveRef () throw ();
// Access To Underlying Object
TRef * get () const throw();
// Instance Data
private:
uint32_t m_nCount; // Reference count
TRef * m_pointer; // Pointer to underlying object I refer to
}; // Referent
template <class TRef>
Referent <TRef>::Referent (TRef * ptr)
: m_nCount (1),
m_pointer (ptr)
{
}
template <class TRef>
void Referent <TRef>::AddRef (void) throw ()
{
AJAAtomic::Increment(&m_nCount);
}
template <class TRef>
void Referent <TRef>::RemoveRef (void) throw ()
{
if (m_nCount > 0)
{
if (AJAAtomic::Decrement(&m_nCount) == 0)
{
delete m_pointer;
m_pointer = 0;
delete this;
}
}
}
template <class TRef>
TRef * Referent <TRef>::get (void) const throw ()
{
return m_pointer;
}
/**
@brief I am a reference-counted pointer template class.
I am intended to be a proxy for an underlying object,
whose lifespan is automatically managed by the Referent
template class that I work with.
@note Be sure not to create more than one of me using the same
object pointer or else a double-free will ensue.
**/
template <class TRef>
class AJARefPtr
{
public:
typedef TRef element_type;
// Construction & Destruction
explicit AJARefPtr (TRef * ptr = NULL) throw ();
AJARefPtr (const AJARefPtr<TRef>& obToCopy ) throw ();
~AJARefPtr () throw ();
// Assignment
AJARefPtr<TRef>& operator = (const AJARefPtr<TRef>& inRHS) throw ();
AJARefPtr<TRef>& operator = (TRef * pobRHS) throw ();
// Comparison
bool operator == (const AJARefPtr< TRef > & inRHS) const throw ();
bool operator != (const AJARefPtr< TRef > & inRHS) const throw ();
bool operator < (const AJARefPtr< TRef > & inRHS) const throw ();
// Dereferencing
TRef & operator * () const throw ();
TRef * operator -> () const throw ();
TRef * get () const throw ();
// Testing
operator bool () const throw ();
private:
Referent <element_type> * m_pRef; // My referent
}; // AJARefPtr
template <class TRef>
AJARefPtr <TRef>::AJARefPtr (TRef * ptr) throw () : m_pRef (new Referent <element_type> (ptr))
{
}
template <class TRef>
AJARefPtr <TRef>::AJARefPtr (const AJARefPtr <TRef> & obToCopy) throw () : m_pRef (obToCopy.m_pRef)
{
m_pRef->AddRef ();
}
template <class TRef>
AJARefPtr <TRef> & AJARefPtr <TRef>::operator = (const AJARefPtr <TRef> & inRHS) throw ()
{
if (*this != inRHS)
{
if (m_pRef)
m_pRef->RemoveRef ();
m_pRef = inRHS.m_pRef;
m_pRef->AddRef ();
}
return *this;
}
template <class TRef>
AJARefPtr <TRef> & AJARefPtr <TRef>::operator = (TRef * pobRHS) throw ()
{
if (pobRHS != get ())
{
if (m_pRef)
m_pRef->RemoveRef ();
m_pRef = new Referent <element_type> (pobRHS);
}
return *this;
}
template <class TRef>
AJARefPtr <TRef>::~AJARefPtr () throw ()
{
m_pRef->RemoveRef ();
}
template <class TRef>
bool AJARefPtr <TRef>::operator == (const AJARefPtr <TRef> & inRHS) const throw ()
{
return get() == inRHS.get();
}
template <class TRef>
bool AJARefPtr <TRef>::operator != (const AJARefPtr <TRef> & inRHS) const throw ()
{
return get() != inRHS.get ();
}
template <class TRef>
bool AJARefPtr <TRef>::operator < (const AJARefPtr <TRef> & inRHS) const throw ()
{
return get() < inRHS.get ();
}
template <class TRef>
TRef & AJARefPtr <TRef>::operator * () const throw ()
{
return *(m_pRef->get());
}
template <class TRef>
TRef * AJARefPtr <TRef>::operator -> () const throw ()
{
return m_pRef ? m_pRef->get () : NULL;
}
template <class TRef>
TRef * AJARefPtr <TRef>::get () const throw ()
{
return m_pRef ? m_pRef->get () : NULL;
}
template <class TRef>
AJARefPtr <TRef>::operator bool () const throw ()
{
return m_pRef && m_pRef->get () != 0;
}
#endif // __AJAREFPTR__

View File

@ -1,27 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file audioutilities.h
@brief Declaration of AJA_GenerateAudioTone function.
@copyright (C) 2012-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_AUDIOUTILS_H
#define AJA_AUDIOUTILS_H
#include "public.h"
#define AJA_MAX_AUDIO_CHANNELS 16
uint32_t AJA_EXPORT AJA_GenerateAudioTone (
uint32_t* audioBuffer,
uint32_t numSamples,
uint32_t numChannels,
uint32_t numBits,
uint32_t& cycleSample,
double sampleRate,
double* amplitude,
double* frequency,
bool endianConvert);
#endif

View File

@ -1,138 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file buffer.h
@brief Implementation of AJABuffer class.
@copyright (C) 2010-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_BUFFER_H
#define AJA_BUFFER_H
#include "public.h"
/**
* Class that represents a memory buffer.
*/
class AJA_EXPORT AJABuffer
{
public:
AJABuffer();
virtual ~AJABuffer();
/**
* Attach a preallocated buffer.
*
* @param[in] pBuffer Address of the memory to attach.
* @param[in] size Size of the memory region.
* @return AJA_STATUS_SUCCESS Buffer successfully attached
* AJA_STATUS_FAIL Attach failed
*/
AJAStatus AttachBuffer(uint8_t* pBuffer, size_t size);
/**
* Allocate memory from the system.
*
* @param[in] size Size of the memory buffer.
* @param[in] alignment Memory buffer alignment in bytes.
* @param[in] pName Name of shared memory buffer to attach.
* @return AJA_STATUS_SUCCESS Buffer successfully allocated
* AJA_STATUS_FAIL Allocation failed
*/
AJAStatus AllocateBuffer(size_t size, size_t alignment = 0, char* pName = NULL);
/**
* Free allocated memory back to the system
*
* @return AJA_STATUS_SUCCESS Buffer successfully freed
* AJA_STATUS_FAIL Free failed
*/
AJAStatus FreeBuffer();
/**
* Get the buffer address.
*
* @return Address of the buffer.
*/
uint8_t* GetBuffer();
uint32_t* GetUINT32Buffer();
/**
* Get the buffer size.
*
* @return Size of the buffer.
*/
size_t GetBufferSize();
/**
* Get the buffer alignment.
*
* @return Alignment of the buffer in bytes.
*/
size_t GetBufferAlignment();
/**
* Get the name of the shared buffer.
*
* @return Name of the shared buffer, NULL if not shared.
*/
const char* GetBufferName();
/**
* Set the offset of the data in the buffer.
*
* @param[in] offset Offset of the data.
* @return AJA_STATUS_SUCCESS Data offset set
* AJA_STATUS_RANGE Data offset + data size > buffer size
*/
AJAStatus SetDataOffset(size_t offset);
/**
* Get the offset of the data in the buffer.
*
* @return Offset of the data.
*/
size_t GetDataOffset();
/**
* Set the size of the data region in the buffer
*
* @param[in] size Size of the data.
* @return AJA_STATUS_SUCCESS Size set
* AJA_STATUS_RANGE Data offset + data size > buffer size
*/
AJAStatus SetDataSize(size_t size);
/**
* Get the size of the data region in the buffer.
*
* @return Size of the data.
*/
size_t GetDataSize();
/**
* Get the address of the data region in the buffer.
*
* @return Address of the data.
*/
uint8_t* GetData();
private:
void ComputeAlignment();
uint8_t* mpAllocate;
size_t mAllocateSize;
size_t mAllocateAlignment;
char* mpAllocateName;
uint8_t* mpBuffer;
size_t mBufferSize;
size_t mBufferAlignment;
size_t mDataOffset;
size_t mDataSize;
};
#endif

View File

@ -1,232 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file bytestream.h
@brief Declaration of AJAByteStream class.
@copyright (C) 2012-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_BYTESTREAM_H
#define AJA_BYTESTREAM_H
#include <stddef.h>
#include <string.h>
#include "ajabase/common/types.h"
class AJAByteStream {
public:
AJAByteStream(void *buf = NULL, size_t pos = 0);
size_t Pos() const;
void *Buffer() const;
void Reset();
void Seek(size_t val); // Seeks to an absolute position
void SeekFwd(size_t val); // Seeks forward n bytes
void SeekRev(size_t val); // Seeks backwards n bytes
void Set(uint8_t val, size_t bytes);
void Write(const void *buf, size_t bytes);
void Write8(uint8_t val);
void Write16LE(uint16_t val);
void Write16BE(uint16_t val);
void Write32LE(uint32_t val);
void Write32BE(uint32_t val);
void Write64LE(uint64_t val);
void Write64BE(uint64_t val);
void Read(void *buf, size_t LEn);
uint8_t Read8();
uint16_t Read16LE();
uint16_t Read16BE();
uint32_t Read32LE();
uint32_t Read32BE();
uint64_t Read64LE();
uint64_t Read64BE();
private:
uint8_t *b; // Beginning buffer position
uint8_t *c; // Current buffer position
};
inline AJAByteStream::AJAByteStream(void *buf, size_t pos) : b((uint8_t *)buf) {
Seek(pos);
}
inline size_t AJAByteStream::Pos() const {
return (size_t)(c - b);
}
inline void *AJAByteStream::Buffer() const {
return b;
}
inline void AJAByteStream::Reset() {
c = b;
return;
}
inline void AJAByteStream::Seek(size_t val) {
c = b + val;
return;
}
inline void AJAByteStream::SeekFwd(size_t val) {
c += val;
return;
}
inline void AJAByteStream::SeekRev(size_t val) {
c -= val;
return;
}
inline void AJAByteStream::Set(uint8_t val, size_t bytes) {
uint8_t *last = c + bytes;
while(c != last) *c++ = val;
return;
}
inline void AJAByteStream::Write(const void *buf, size_t bytes) {
memcpy(c, buf, bytes);
c += bytes;
return;
}
inline void AJAByteStream::Write8(uint8_t val) {
*c++ = val;
return;
}
inline void AJAByteStream::Write16LE(uint16_t val) {
c[0] = val & 0xFF;
c[1] = (val >> 8) & 0xFF;
c += 2;
return;
}
inline void AJAByteStream::Write16BE(uint16_t val) {
c[0] = (val >> 8) & 0xFF;
c[1] = val & 0xFF;
c += 2;
return;
}
inline void AJAByteStream::Write32LE(uint32_t val) {
c[0] = val & 0xFF;
c[1] = (val >> 8) & 0xFF;
c[2] = (val >> 16) & 0xFF;
c[3] = (val >> 24) & 0xFF;
c += 4;
return;
}
inline void AJAByteStream::Write32BE(uint32_t val) {
c[0] = (val >> 24) & 0xFF;
c[1] = (val >> 16) & 0xFF;
c[2] = (val >> 8) & 0xFF;
c[3] = val & 0xFF;
c += 4;
return;
}
inline void AJAByteStream::Write64LE(uint64_t val) {
c[0] = val & 0xFF;
c[1] = (val >> 8) & 0xFF;
c[2] = (val >> 16) & 0xFF;
c[3] = (val >> 24) & 0xFF;
c[4] = (val >> 32) & 0xFF;
c[5] = (val >> 40) & 0xFF;
c[6] = (val >> 48) & 0xFF;
c[7] = (val >> 56) & 0xFF;
c += 8;
return;
}
inline void AJAByteStream::Write64BE(uint64_t val) {
c[0] = (val >> 56) & 0xFF;
c[1] = (val >> 48) & 0xFF;
c[2] = (val >> 40) & 0xFF;
c[3] = (val >> 32) & 0xFF;
c[4] = (val >> 24) & 0xFF;
c[5] = (val >> 16) & 0xFF;
c[6] = (val >> 8) & 0xFF;
c[7] = val & 0xFF;
c += 8;
return;
}
inline void AJAByteStream::Read(void *buf, size_t bytes) {
uint8_t *last = c + bytes, *o = (uint8_t *)buf;
while(c != last) *o++ = *c++;
return;
}
inline uint8_t AJAByteStream::Read8() {
return *c++;
}
inline uint16_t AJAByteStream::Read16LE() {
uint16_t ret;
ret = (uint16_t)c[0];
ret |= (uint16_t)c[1] << 8;
c += 2;
return ret;
}
inline uint16_t AJAByteStream::Read16BE() {
uint16_t ret;
ret = (uint16_t)c[0] << 8;
ret |= (uint16_t)c[1];
c += 2;
return ret;
}
inline uint32_t AJAByteStream::Read32LE() {
uint32_t ret;
ret = (uint32_t)c[0];
ret |= (uint32_t)c[1] << 8;
ret |= (uint32_t)c[2] << 16;
ret |= (uint32_t)c[3] << 24;
c += 4;
return ret;
}
inline uint32_t AJAByteStream::Read32BE() {
uint32_t ret;
ret = (uint32_t)c[0] << 24;
ret |= (uint32_t)c[1] << 16;
ret |= (uint32_t)c[2] << 8;
ret |= (uint32_t)c[3];
c += 4;
return ret;
}
inline uint64_t AJAByteStream::Read64LE() {
uint64_t ret;
ret = (uint64_t)c[0];
ret |= (uint64_t)c[1] << 8;
ret |= (uint64_t)c[2] << 16;
ret |= (uint64_t)c[3] << 24;
ret |= (uint64_t)c[4] << 32;
ret |= (uint64_t)c[5] << 40;
ret |= (uint64_t)c[6] << 48;
ret |= (uint64_t)c[7] << 56;
c += 8;
return ret;
}
inline uint64_t AJAByteStream::Read64BE() {
uint64_t ret;
ret = (uint64_t)c[0] << 56;
ret |= (uint64_t)c[1] << 48;
ret |= (uint64_t)c[2] << 40;
ret |= (uint64_t)c[3] << 32;
ret |= (uint64_t)c[4] << 24;
ret |= (uint64_t)c[5] << 16;
ret |= (uint64_t)c[6] << 8;
ret |= (uint64_t)c[7];
c += 8;
return ret;
}
#endif /* ifndef AJA_BYTESTREAM_H */

View File

@ -1,327 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file circularbuffer.h
@brief Declaration of AJACircularBuffer template class.
@copyright (C) 2012-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_CIRCULAR_BUFFER_H
#define AJA_CIRCULAR_BUFFER_H
#include "ajabase/common/public.h"
#include "ajabase/system/lock.h"
#include "ajabase/system/event.h"
/**
@brief I am a circular frame buffer that simplifies implementing a type-safe producer/consumer
model for processing frame-based streaming media. I can be used with any client-defined
"frame", be it a struct or class. To use me:
-# Instantiate me.
-# Initialize me by calling my Add method, adding client-defined frames for me to manage.
-# Spawn a producer thread and a consumer thread.
-# The producer thread repeatedly calls my StartProduceNextBuffer, puts data in the frame,
then calls EndProduceNextBuffer when finished.
-# The consumer thread repeatedly calls my StartConsumeNextBuffer, processes data in the frame,
then calls EndConsumeNextBuffer when finished.
**/
template <typename FrameDataPtr>
class AJACircularBuffer
{
public:
/**
@brief My default constructor.
**/
AJACircularBuffer ();
/**
@brief My destructor.
**/
virtual ~AJACircularBuffer ();
/**
@brief Tells me the boolean variable I should monitor such that when it gets set to "true" will cause
any threads waiting on my events/locks to gracefully exit.
@param[in] pAbortFlag Specifies the valid, non-NULL address of a boolean variable that, when it becomes "true",
will cause threads waiting on me to exit gracefully.
**/
inline void SetAbortFlag (const bool * pAbortFlag)
{
mAbortFlag = pAbortFlag;
}
/**
@brief Retrieves the size count of the circular buffer, i.e. how far the tail pointer is behind the head pointer.
@return The number of frames that I contain.
*/
inline unsigned int GetCircBufferCount (void) const
{
return mCircBufferCount;
}
/**
@brief Returns "true" if I'm empty -- i.e., if my tail and head are in the same place.
@return True if I contain no frames.
**/
inline bool IsEmpty (void) const
{
return GetCircBufferCount () == 0;
}
/**
@brief Returns my frame storage capacity, which reflects how many times my Add method has been called.
@return My frame capacity.
**/
inline unsigned int GetNumFrames (void) const
{
return (unsigned int) mFrames.size ();
}
/**
@brief Appends a new frame buffer to me, increasing my frame storage capacity by one frame.
@param[in] pInFrameData Specifies the FrameDataPtr to be added to me.
@return AJA_STATUS_SUCCESS Frame successfully added.
AJA_STATUS_FAIL Frame failed to add.
**/
AJAStatus Add (FrameDataPtr pInFrameData)
{
mFrames.push_back(pInFrameData);
AJALock* lock = new AJALock;
mLocks.push_back(lock);
return (mFrames.size() == mLocks.size() && lock) ? AJA_STATUS_SUCCESS
: AJA_STATUS_FAIL;
}
/**
@brief The thread that's responsible for providing frames -- the producer -- calls this function
to populate the the returned FrameDataPtr.
@return A pointer (of the type in the template argument) to the next frame to be filled by the
producer thread.
**/
FrameDataPtr StartProduceNextBuffer (void)
{
while (1)
{
if( !WaitForLockOrAbort(&mDataBufferLock) )
return NULL;
if ( mCircBufferCount == mFrames.size() )
{
mDataBufferLock.Unlock();
if( !WaitForEventOrAbort(&mNotFullEvent) )
return NULL;
continue;
}
break;
}
if( !WaitForLockOrAbort(mLocks[mHead]) ) return NULL;
mFillIndex = mHead;
mHead = (mHead+1)%((unsigned int)(mFrames.size()));
mCircBufferCount++;
if( mCircBufferCount == mFrames.size() )
mNotFullEvent.SetState(false);
mDataBufferLock.Unlock();
return mFrames[mFillIndex];
}
/**
@brief The producer thread calls this function to signal that it has finished populating the frame
it obtained from a prior call to StartProduceNextBuffer. This releases the frame, making it
available for processing by the consumer thread.
**/
void EndProduceNextBuffer (void);
/**
@brief The thread that's responsible for processing incoming frames -- the consumer -- calls this
function to obtain the next available frame.
@return A pointer (of the type in the template argument) to the next frame to be processed by the
consumer thread.
**/
FrameDataPtr StartConsumeNextBuffer (void)
{
while (1)
{
if( !WaitForLockOrAbort(&mDataBufferLock) )
return NULL;
if ( mCircBufferCount == 0 )
{
mDataBufferLock.Unlock();
if( !WaitForEventOrAbort(&mNotEmptyEvent) )
return NULL;
continue;
}
break;
}
if( !WaitForLockOrAbort(mLocks[mTail]) )
return NULL;
mEmptyIndex = mTail;
mTail = (mTail+1)%((unsigned int)mFrames.size());
mCircBufferCount--;
if( mCircBufferCount == 0 )
mNotEmptyEvent.SetState(false);
mDataBufferLock.Unlock();
return mFrames[mEmptyIndex];
}
/**
@brief The consumer thread calls this function to signal that it has finished processing the frame it
obtained from a prior call to StartConsumeNextBuffer. This releases the frame, making it available
for filling by the producer thread.
**/
void EndConsumeNextBuffer (void);
/**
@brief Clears my frame collection, their locks, everything.
@note This is not thread-safe. Thus, before calling this method, be sure all locks have been released and
producer/consumer threads using me have terminated.
**/
void Clear (void);
private:
typedef std::vector <AJALock *> AJALockVector;
std::vector <FrameDataPtr> mFrames; ///< @brief My ordered frame collection
AJALockVector mLocks; ///< @brief My per-frame locks, to control access to each frame
unsigned int mHead; ///< @brief My current "head" pointer, an index into my frame collection
unsigned int mTail; ///< @brief My current "tail" pointer, an index into my frame collection
unsigned int mCircBufferCount; ///< @brief My current size, the distance between my "head" and "tail"
AJAEvent mNotFullEvent; ///< @brief An event that signals when I transition from being full to not full
AJAEvent mNotEmptyEvent; ///< @brief An event that signals when I transition from empty to having at least one frame
AJALock mDataBufferLock; ///< @brief Protects my "head" and "tail" members
unsigned int mFillIndex; ///< @brief Index where frames are added to me
unsigned int mEmptyIndex; ///< @brief Index where frames are removed from me
const bool * mAbortFlag; ///< @brief Optional pointer to a boolean that clients can set to break threads waiting on me
/**
@brief Waits for the given event with a timeout, and abort the wait if mAbortFlag is set.
@param[in] ajaEvent Specifies a valid, non-NULL AJAEvent object to trigger on.
@return True if the event triggers successfully; false otherwise.
**/
bool WaitForEventOrAbort (AJAEvent * ajaEvent);
/**
@brief Wait for mutex with a timeout and check to see if mAbortFlag is set.
@param[in] ajaEvent Specifies a valid, non-NULL AJALock (mutex) object to wait on.
@return True if mutex is received; otherwise false.
**/
bool WaitForLockOrAbort (AJALock * ajaEvent);
}; // AJACircularBuffer
template <typename FrameDataPtr>
AJACircularBuffer <FrameDataPtr>::AJACircularBuffer ()
: mHead (0),
mTail (0),
mCircBufferCount (0),
mFillIndex (0),
mEmptyIndex (0),
mAbortFlag (NULL)
{
}
template <typename FrameDataPtr>
AJACircularBuffer <FrameDataPtr>::~AJACircularBuffer ()
{
Clear ();
}
template<typename FrameDataPtr>
void AJACircularBuffer<FrameDataPtr>::EndProduceNextBuffer()
{
mLocks[mFillIndex]->Unlock();
mNotEmptyEvent.SetState(true);
}
template<typename FrameDataPtr>
void AJACircularBuffer<FrameDataPtr>::EndConsumeNextBuffer()
{
mLocks[mEmptyIndex]->Unlock();
mNotFullEvent.SetState(true);
}
template<typename FrameDataPtr>
bool AJACircularBuffer<FrameDataPtr>::WaitForEventOrAbort(AJAEvent* ajaEvent)
{
const unsigned int timeout = 100;
do {
AJAStatus status = ajaEvent->WaitForSignal(timeout);
if (status == AJA_STATUS_TIMEOUT)
if ( mAbortFlag )
if ( *mAbortFlag )
return false;
if (status == AJA_STATUS_FAIL)
return false;
if (status == AJA_STATUS_SUCCESS )
break;
} while(1);
return true;
}
template<typename FrameDataPtr>
bool AJACircularBuffer<FrameDataPtr>::WaitForLockOrAbort(AJALock* ajaLock)
{
const unsigned int timeout = 100;
do {
AJAStatus status = ajaLock->Lock(timeout);
if (status == AJA_STATUS_TIMEOUT)
if ( mAbortFlag )
if ( *mAbortFlag)
return false;
if (status == AJA_STATUS_FAIL)
return false;
if (status == AJA_STATUS_SUCCESS )
break;
} while(1);
return true;
}
template<typename FrameDataPtr>
void AJACircularBuffer<FrameDataPtr>::Clear (void)
{
for (AJALockVector::iterator iter (mLocks.begin()); iter != mLocks.end(); ++iter)
delete *iter;
mLocks.clear();
mFrames.clear();
mHead = mTail = mFillIndex = mEmptyIndex = mCircBufferCount = 0;
mAbortFlag = NULL;
}
#endif // AJA_CIRCULAR_BUFFER_H

View File

@ -1,16 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file cli_utils.h
@brief Declaration of GetNumber, GetString and GetCharAsInt functions.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_CLI_UTILS_H
#define AJA_CLI_UTILS_H
/*
* This file has been removed the functionality is available elsewhere in ajabase
* see common.h
*/
#endif // AJA_CLI_UTILS_H

View File

@ -1,284 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file common.h
@brief Private include file for all ajabase sources.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_COMMON_H
#define AJA_COMMON_H
#if defined(AJA_WINDOWS)
#pragma warning(disable:4996)
#pragma warning(disable:4800)
#endif
#include "ajabase/common/export.h"
#include "ajabase/common/public.h"
#include "ajabase/system/debug.h"
#include <set>
namespace aja
{
static std::string WHITESPACE = " \t\n\r";
/**
* Replaces all occurrences of a substring within a string with a new string
*
* @param[in,out] str The string to modify
* @param[in] from The substring to look for
* @param[in] to The string to replace the substring with
* @return Reference to the modified STL string
*/
AJA_EXPORT std::string& replace(std::string& str, const std::string& from, const std::string& to);
// NOTE: these sto* functions are ment to be similar to the C++11 functions of the same name
// one big difference is that these do not throw exceptions on errors and instead return
// 0 like the underlying strtol function does.
/**
* Convert string to integer
*
* @param[in] str The string to get the int value of
* @param[in,out] idx Pointer to an object of type size_t, whose value is set by the function
* to the position of the next character in str after the numerical value.
* This parameter can also be a null pointer, in which case it is not used.
* @param[in] base Numerical base that determines the valid characters and their interpretation.
* If this is 0, the base is determined by the format (like strtol).
* @return The int value of the input str
*/
AJA_EXPORT int stoi(const std::string& str, std::size_t* idx=0, int base = 10);
/**
* Convert string to long
*
* @param[in] str The string to get the long value of
* @param[in,out] idx Pointer to an object of type size_t, whose value is set by the function
* to the position of the next character in str after the numerical value.
* This parameter can also be a null pointer, in which case it is not used.
* @param[in] base Numerical base that determines the valid characters and their interpretation.
* If this is 0, the base is determined by the format (like strtol).
* @return The long value of the input str
*/
AJA_EXPORT long stol(const std::string& str, std::size_t* idx=0, int base = 10);
/**
* Convert string to long long
*
* @param[in] str The string to get the long long value of
* @param[in,out] idx Pointer to an object of type size_t, whose value is set by the function
* to the position of the next character in str after the numerical value.
* This parameter can also be a null pointer, in which case it is not used.
* @param[in] base Numerical base that determines the valid characters and their interpretation.
* If this is 0, the base is determined by the format (like strtol).
* @return The long long value of the input str
*/
//AJA_EXPORT long long stoll(const std::string& str, std::size_t* idx=0, int base = 10);
/**
* Convert string to unsigned long
*
* @param[in] str The string to get the unsigned long value of
* @param[in,out] idx Pointer to an object of type size_t, whose value is set by the function
* to the position of the next character in str after the numerical value.
* This parameter can also be a null pointer, in which case it is not used.
* @param[in] base Numerical base that determines the valid characters and their interpretation.
* If this is 0, the base is determined by the format (like strtol).
* @return The unsigned long value of the input str
*/
AJA_EXPORT unsigned long stoul(const std::string& str, std::size_t* idx=0, int base = 10);
/**
* Convert string to unsigned long long
*
* @param[in] str The string to get the unsigned long long value of
* @param[in,out] idx Pointer to an object of type size_t, whose value is set by the function
* to the position of the next character in str after the numerical value.
* This parameter can also be a null pointer, in which case it is not used.
* @param[in] base Numerical base that determines the valid characters and their interpretation.
* If this is 0, the base is determined by the format (like strtol).
* @return The unsigned long long value of the input str
*/
//AJA_EXPORT unsigned long long stoull(const std::string& str, std::size_t* idx=0, int base = 10);
/**
* Convert string to float
*
* @param[in] str The string to get the float value of
* @param[in,out] idx Pointer to an object of type size_t, whose value is set by the function
* to the position of the next character in str after the numerical value.
* This parameter can also be a null pointer, in which case it is not used.
* @return The float value of the input str
*/
AJA_EXPORT float stof(const std::string& str, std::size_t* idx=0);
/**
* Convert string to double
*
* @param[in] str The string to get the double value of
* @param[in,out] idx Pointer to an object of type size_t, whose value is set by the function
* to the position of the next character in str after the numerical value.
* This parameter can also be a null pointer, in which case it is not used.
* @return The double value of the input str
*/
AJA_EXPORT double stod(const std::string& str, std::size_t* idx=0);
/**
* Convert string to long double
*
* @param[in] str The string to get the long double value of
* @param[in,out] idx Pointer to an object of type size_t, whose value is set by the function
* to the position of the next character in str after the numerical value.
* This parameter can also be a null pointer, in which case it is not used.
* @return The long double value of the input str
*/
AJA_EXPORT long double stold(const std::string& str, std::size_t* idx=0);
/**
* Convert numerical value to string
*
* @param[in] val The numerical value to convert
* @return A string representing the passed value
*/
AJA_EXPORT std::string to_string(bool val);
AJA_EXPORT std::string to_string(int val);
AJA_EXPORT std::string to_string(long val);
//AJA_EXPORT std::string to_string(long long val);
AJA_EXPORT std::string to_string(unsigned val);
AJA_EXPORT std::string to_string(unsigned long val);
//AJA_EXPORT std::string to_string(unsigned long long val);
AJA_EXPORT std::string to_string(float val);
AJA_EXPORT std::string to_string(double val);
AJA_EXPORT std::string to_string(long double val);
/**
* Convert string to wstring
*
* @param[in] str The string to convert
* @param[out] wstr The wstring to convert to
* @return true if success else false
*/
AJA_EXPORT bool string_to_wstring(const std::string& str, std::wstring& wstr);
/**
* Convert wstring to string
*
* @param[in] wstr The wstring to convert
* @param[out] str The string to convert to
* @return true if success else false
*/
AJA_EXPORT bool wstring_to_string(const std::wstring& wstr, std::string& str);
/**
* Convert string to cstring
*
* @param[in] str The string to convert
* @param[out] c_str The char buffer to use as a c string
* @param[in] c_str_size The size of the passed in c_str buffer in bytes
* @return true if success else false
*/
AJA_EXPORT bool string_to_cstring (const std::string & str, char * c_str, size_t c_str_size);
/**
* Splits a string into substrings at a character delimiter
*
* @param[in] str The string to split into parts
* @param[in] delim The character delimiter to split the string at
* @param[out] elems A vector of strings that contains all the substrings
*/
AJA_EXPORT void split (const std::string & str, const char delim, std::vector<std::string> & elems);
/**
* Splits a string into substrings at a character delimiter
*
* @param[in] str The string to split into parts
* @param[in] delim The character delimiter to split the string at
* @return A vector of strings that contains all the substrings
*/
AJA_EXPORT std::vector<std::string> split (const std::string & str, const char delim);
/**
* Splits a string into substrings at a string delimiter
*
* @param[in] inStr The string to split into parts
* @param[in] inDelim The delimiter string to split the string at
* @return A vector of strings that contains all the substrings
*/
AJA_EXPORT std::vector<std::string> split (const std::string & inStr, const std::string & inDelim);
/**
* Converts the passed string to lowercase
*
* @param[in,out] str The string to make lowercase
* @return Reference to the modified STL string
*/
AJA_EXPORT std::string & lower (std::string & str);
/**
* Converts the passed string to uppercase
*
* @param[in,out] str The string to make uppercase
* @return Reference to the modified STL string
*/
AJA_EXPORT std::string & upper (std::string & str);
/**
* Strips the leading whitespace characters from the string
*
* @param[in,out] str The string to strip leading characters from
* @param[in] ws The whitespace characters to strip
* @return Reference to the modified STL string
*/
AJA_EXPORT std::string & lstrip (std::string & str, const std::string & ws = aja::WHITESPACE);
/**
* Strips the trailing whitespace characters from the string
*
* @param[in,out] str The string to strip trailing characters from
* @param[in] ws The whitespace characters to strip
* @return Reference to the modified STL string
*/
AJA_EXPORT std::string & rstrip (std::string & str, const std::string & ws = aja::WHITESPACE);
/**
* Strips the leading & trailing whitespace characters from the string
*
* @param[in,out] str The string to strip leading & trailing characters from
* @param[in] ws The whitespace characters to strip
* @return Reference to the modified STL string
*/
AJA_EXPORT std::string & strip (std::string & str, const std::string & ws = aja::WHITESPACE);
/**
* Join a vector of strings separated by a string delimiter
*
* @param[in] parts The vector of strings to join together
* @param[in] delim The string delimiter that will separate the strings
* @return The joined string made up of the parts concatinated with delimiter string
*/
AJA_EXPORT std::string join (const std::vector<std::string> & parts, const std::string & delim=" ");
/**
* Join a set of strings separated by a string delimiter
*
* @param[in] parts The set of strings to join together
* @param[in] delim The string delimiter that will separate the strings
* @return The joined string made up of the parts concatinated with delimiter string
*/
AJA_EXPORT std::string join (const std::set<std::string> & parts, const std::string & delim=" ");
/**
* Like strncpy() but always adds a null-character at last index of target string
*
* @param[in,out] target Pointer to the destination array where the content is to be copied.
* @param[in] source C string to be copied.
* @param[in] num Maximum number of characters to be copied from source.
* @param[in] maxSize Maximum size of the destination array pointed to by target.
* @return target is returned
*/
AJA_EXPORT char* safer_strncpy(char* target, const char* source, size_t num, size_t maxSize);
} //end aja namespace
#endif // AJA_COMMON_H

View File

@ -1,485 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file dpx_hdr.h
@brief Declaration of DpxHdr class adapted from STwo's dpx file I/O.
@copyright (C) 2015-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef DPX_HDR_H
#define DPX_HDR_H
#include "public.h"
#include "ajabase/common/types.h"
#include "ajabase/system/system.h"
#include <string>
#define DPX_C_MAGIC 0x53445058 /**< little-endian magic number */
#define DPX_C_MAGIC_BE 0x58504453 /**< big-endian magic number */
#define DPX_C_VERSION "V1.0"
#define DPX_C_UNDEFINED_FLOAT 0xffffffff /**< DPX undefined float */
#define SWAP16(e,v) ((e) ? htons(v) : (v))
#define SWAP32(e,v) ((e) ? htonl(v) : (v))
#define SWAPR32(e,v) ((e) ? htonf(v) : (v))
#define UNSWAP16(e,v) ((e) ? ntohs(v) : (v))
#define UNSWAP32(e,v) ((e) ? ntohl(v) : (v))
#define UNSWAPR32(e,v) ((e) ? ntohf(v) : (v))
#define DPX_VALID(p) \
((p) && (((p)->file_info.magic_num==DPX_C_MAGIC) || \
((p)->file_info.magic_num==DPX_C_MAGIC_BE)))
#define DPX_IS_BE(p) \
((p) && ((p)->file_info.magic_num == DPX_C_MAGIC_BE))
#define DPX_C_IMAGE_ELEM_DESC_RGB 50
#define DPX_C_IMAGE_ELEM_DESC_RGBA 51
#define DPX_C_IMAGE_ELEM_DESC_ARGB 52
#define DPX_C_IMAGE_ELEM_DESC_422 100
#define DPX_C_IMAGE_ELEM_DESC_444 102
typedef struct dpx_file_info_struct
{
uint32_t magic_num; /* magic number 0x53445058 (SDPX) or 0x58504453 (XPDS) */
uint32_t offset; /* offset to image data in bytes */
uint8_t vers[8]; /* which header format version is being used (v1.0)*/
uint32_t file_size; /* file size in bytes */
uint32_t ditto_key; /* read time short cut - 0 = same, 1 = new */
uint32_t gen_hdr_size; /* generic header length in bytes */
uint32_t ind_hdr_size; /* industry header length in bytes */
uint32_t user_data_size;/* user-defined data length in bytes */
uint8_t file_name[100]; /* iamge file name */
uint8_t create_time[24]; /* file creation date "yyyy:mm:dd:hh:mm:ss:LTZ" */
uint8_t creator[100]; /* file creator's name */
uint8_t project[200]; /* project name */
uint8_t copyright[200]; /* right to use or copyright info */
uint32_t key; /* encryption ( FFFFFFFF = unencrypted ) */
union
{
uint8_t Reserved[104]; /* reserved field TBD (need to pad) */
struct
{
uint32_t tcFrame; /* Timecode as a frame number */
uint32_t filenum; /* FileNumber of preallocated files */
uint8_t rid;
uint8_t sid;
uint8_t tid;
uint8_t pad;
} s2;
} resv;
} DPX_file_info_t;
typedef struct dpx_image_element_struct
{
uint32_t data_sign; /* data sign (0 = unsigned, 1 = signed ) */
/* "Core set images are unsigned" */
uint32_t ref_low_data; /* reference low data code value */
float ref_low_quantity; /* reference low quantity represented */
uint32_t ref_high_data; /* reference high data code value */
float ref_high_quantity; /* reference high quantity represented */
uint8_t descriptor; /* descriptor for image element */
uint8_t transfer; /* transfer uint8_tacteristics for element */
uint8_t colorimetric; /* colormetric specification for element */
uint8_t bit_size; /* bit size for element */
uint16_t packing; /* packing for element */
uint16_t encoding; /* encoding for element */
uint32_t data_offset; /* offset to data of element */
uint32_t eol_padding; /* end of line padding used in element */
uint32_t eo_image_padding; /* end of image padding used in element */
uint8_t description[32]; /* description of element */
} DPX_image_element_t;
typedef struct dpx_image_info_struct
{
uint16_t orientation; /* image orientation */
uint16_t element_number; /* number of image elements */
uint32_t pixels_per_line; /* or x value */
uint32_t lines_per_image_ele; /* or y value, per element */
DPX_image_element_t image_element[8];
uint8_t reserved[52]; /* reserved for future use (padding) */
} DPX_image_info_t;
typedef struct dpx_image_source_struct
{
uint32_t x_offset; /* X offset */
uint32_t y_offset; /* Y offset */
float x_center; /* X center */
float y_center; /* Y center */
uint32_t x_orig_size; /* X original size */
uint32_t y_orig_size; /* Y original size */
uint8_t file_name[100]; /* source image file name */
uint8_t creation_time[24]; /* source image creation date and time */
uint8_t input_dev[32]; /* input device name */
uint8_t input_serial[32]; /* input device serial number */
uint16_t border[4]; /* border validity (XL, XR, YT, YB) */
uint32_t pixel_aspect[2]; /* pixel aspect ratio (H:V) */
uint8_t reserved[28]; /* reserved for future use (padding) */
} DPX_image_source_t;
typedef struct dpx_motion_picture_film_header_struct
{
uint8_t film_mfg_id[2]; /* film manufacturer ID code (2 digits from film edge code) */
uint8_t film_type[2]; /* file type (2 digits from film edge code) */
uint8_t offset[2]; /* offset in perfs (2 digits from film edge code)*/
uint8_t prefix[6]; /* prefix (6 digits from film edge code) */
uint8_t count[4]; /* count (4 digits from film edge code)*/
uint8_t format[32]; /* format (i.e. academy) */
uint32_t frame_position; /* frame position in sequence */
uint32_t sequence_len; /* sequence length in frames */
uint32_t held_count; /* held count (1 = default) */
float frame_rate; /* frame rate of original in frames/sec */
float shutter_angle; /* shutter angle of camera in degrees */
uint8_t frame_id[32]; /* frame identification (i.e. keyframe) */
uint8_t slate_info[100]; /* slate information */
uint8_t reserved[56]; /* reserved for future use (padding) */
} DPX_film_t;
typedef struct dpx_television_header_struct
{
uint32_t tim_code; /* SMPTE time code */
uint32_t userBits; /* SMPTE user bits */
uint8_t interlace; /* interlace ( 0 = noninterlaced, 1 = 2:1 interlace*/
uint8_t field_num; /* field number */
uint8_t video_signal; /* video signal standard (table 4)*/
uint8_t unused; /* used for byte alignment only */
float hor_sample_rate; /* horizontal sampling rate in Hz */
float ver_sample_rate; /* vertical sampling rate in Hz */
float frame_rate; /* temporal sampling rate or frame rate in Hz */
float time_offset; /* time offset from sync to first pixel */
float gamma; /* gamma value */
float black_level; /* black level code value */
float black_gain; /* black gain */
float break_point; /* breakpoint */
float white_level; /* reference white level code value */
float integration_times; /* integration time(s) */
uint8_t reserved[76]; /* reserved for future use (padding) */
} DPX_television_t;
typedef struct dpx_header_struct
{
DPX_file_info_t file_info;
DPX_image_info_t image_info;
DPX_image_source_t image_source;
DPX_film_t film_header;
DPX_television_t tv_header;
#ifdef NTV4_RAID_SUPPORT
uint8_t reserved[2048];
#endif
} DPX_header_t;
uint32_t AJA_EXPORT dpx_get_u32(const uint32_t *ptr, bool BE );
void AJA_EXPORT dpx_set_u32(uint32_t *ptr, bool BE, uint32_t val );
uint16_t AJA_EXPORT dpx_get_u16(const uint16_t *ptr, bool BE );
void AJA_EXPORT dpx_set_u16(uint16_t *ptr, bool BE, uint16_t val );
float AJA_EXPORT dpx_get_r32(const float *ptr, bool BE );
void AJA_EXPORT dpx_set_r32(float *ptr, bool BE, float val );
#define FLD_OFFET( TYPE,field) \
((uint32_t)(&(((TYPE *)0)->field)))
#define DPX_GET_U32(hdr,fld) \
DPX_VALID(hdr) ? \
dpx_get_u32(&(hdr)->fld,DPX_IS_BE(hdr)) : \
(uint32_t)(-1)
#define DPX_SET_U32(hdr,fld,val) \
do { \
if ( DPX_VALID(hdr)) \
dpx_set_u32(&(hdr)->fld,DPX_IS_BE(hdr),val); \
} while(0)
#define DPX_GET_R32(hdr,fld) \
DPX_VALID(hdr) ? \
dpx_get_r32(&(hdr)->fld,DPX_IS_BE(hdr)) : \
(float)(0xffffffff)
#define DPX_SET_R32(hdr,fld,val) \
do { \
if ( DPX_VALID(hdr)) \
dpx_set_r32(&(hdr)->fld,DPX_IS_BE(hdr),val); \
} while(0)
#define DPX_GET_U16(hdr,fld) \
DPX_VALID(hdr) ? \
dpx_get_u16(&(hdr)->fld,DPX_IS_BE(hdr)) : \
(uint16_t)(-1)
#define DPX_SET_U16(hdr,fld,val) \
do { \
if ( DPX_VALID(hdr)) \
dpx_set_u16(&(hdr)->fld,DPX_IS_BE(hdr),val); \
} while(0)
#define DPX_GET_U8(hdr,fld) \
DPX_VALID(hdr) ? (hdr)->fld : (uint8_t)(-1)
#define DPX_SET_U8(hdr,fld,val) \
if ( DPX_VALID(hdr)) \
(hdr)->fld = val
#define DPX_SET_TEXT(hdr,fld,buf,len) \
if ( DPX_VALID(hdr)) \
memcpy((void*)&((hdr)->fld),(const void*)buf,len)
#define DPX_GET_TEXT(hdr,fld,buf,len) \
DPX_VALID(hdr) ? \
memcpy((void*)buf,(const void*)&((hdr)->fld),len) : \
memset((void*)buf,0xff,len)
class AJA_EXPORT DpxHdr
{
public:
DpxHdr(void) { init(DPX_C_MAGIC_BE); }
~DpxHdr();
DpxHdr& operator=(const DpxHdr& rhs);
void init(uint32_t endianness);
bool valid() const;
bool IsBigEndian() { return DPX_IS_BE(&m_hdr); }
std::string get_fi_time_stamp() const;
void set_fi_time_stamp();
void set_s2_tcframe(uint32_t frame);
size_t get_s2_tcframe() const;
uint32_t get_s2_filenumber() const;
void set_s2_filenumber(uint32_t fr);
void set_s2_ids(uint8_t rid, uint8_t sid, uint8_t tid);
void get_s2_ids(uint8_t *rid, uint8_t *sid, uint8_t *tid) const;
size_t get_file_size();
size_t get_generic_hdr_size();
size_t get_industry_hdr_size();
size_t get_user_hdr_size();
// File Info access
//
size_t get_fi_image_offset() const;
void set_fi_image_offset(size_t offs );
size_t get_fi_file_size() const;
void set_fi_file_size(size_t offs );
std::string get_fi_version() const;
void set_fi_version(const std::string& str);
std::string get_fi_file_name() const;
void set_fi_file_name(const std::string& str);
std::string get_fi_creator() const;
void set_fi_creator(const std::string& str);
std::string get_fi_create_time() const;
void set_fi_create_time(const std::string& str);
std::string get_fi_project() const;
void set_fi_project(const std::string& str);
std::string get_fi_copyright() const;
void set_fi_copyright(const std::string& str);
// Image Info
void set_ii_orientation(uint16_t orientation );
uint16_t get_ii_orientation() const;
void set_ii_element_number(uint16_t element_number );
uint16_t get_ii_element_number() const;
void set_ii_pixels(uint32_t pixels );
size_t get_ii_pixels() const;
void set_ii_lines(uint32_t lines );
size_t get_ii_lines(void ) const;
size_t get_ii_image_size()
{
// Note: Incorrect for some configs
uint32_t expectedSize = -1;
if (get_ie_descriptor() == 50)
{
if ( get_ie_bit_size() == 10 )
expectedSize = (uint32_t)(get_ii_pixels() * get_ii_lines() * 4);
else
expectedSize = (uint32_t)(get_ii_pixels() * get_ii_lines() * 6); // 16 bit
}
else if (get_ie_descriptor() == 100)
{
if (get_ii_pixels() % 48 == 0)
expectedSize = (uint32_t)(get_ii_pixels() * get_ii_lines() * 8 / 3);
else
expectedSize = (uint32_t)(((get_ii_pixels()/48+1)*48) * get_ii_lines() * 8 / 3);
}
// rowBytes = (( width % 48 == 0 ) ? width : (((width / 48 ) + 1) * 48)) * 8 / 3;
if (0 == get_fi_file_size())
{
return (0);
}
uint32_t sizeInFile = (uint32_t)(get_fi_file_size() - get_fi_image_offset());
if ( sizeInFile < expectedSize)
return sizeInFile;
else
return expectedSize;
}
// Image Element
void set_ie_data_sign (uint32_t sign, int i=0);
size_t get_ie_data_sign(int i = 0);
void set_ie_ref_low_data(uint32_t data, int i=0);
size_t get_ie_ref_low_data(int i = 0) const;
void set_ie_ref_high_data(uint32_t data, int i=0);
size_t get_ie_ref_high_data(int i = 0) const;
void set_ie_ref_low_quantity(float data, int i=0);
float get_ie_ref_low_quantity(int i = 0) const;
void set_ie_ref_high_quantity(float data, int i=0);
float get_ie_ref_high_quantity(int i = 0) const;
void set_ie_descriptor(uint8_t desc, int i = 0);
uint8_t get_ie_descriptor(int i = 0) const;
void set_ie_transfer(uint8_t trans, int i = 0);
uint8_t get_ie_transfer(int i = 0) const;
void set_ie_colorimetric(uint8_t c, int i = 0);
uint8_t get_ie_colorimetric(int i = 0) const;
void set_ie_bit_size(uint8_t bits, int i = 0);
uint8_t get_ie_bit_size(int i = 0) const;
void set_ie_packing(uint16_t pack, int i = 0);
uint16_t get_ie_packing (int i = 0) const;
void set_ie_encoding(uint16_t enc, int i = 0);
uint16_t get_ie_encoding(int i = 0) const;
void set_ie_data_offset(uint32_t offs, int i = 0);
uint32_t get_ie_data_offset (int i = 0) const;
void set_ie_eol_padding(uint32_t padding, int i = 0);
uint32_t get_ie_eol_padding(int i = 0) const;
void set_ie_eo_image_padding(uint32_t padding, int i = 0);
uint32_t get_ie_eo_image_padding(int i = 0) const;
std::string get_ie_description(int i=0) const;
void set_ie_description(const std::string& str, int i = 0);
// Image Source access.
std::string get_is_filename() const;
void set_is_filename(const std::string& str);
std::string get_is_creation_time() const;
void set_is_creation_time(const std::string& str);
std::string get_is_input_device() const;
void set_is_input_device(const std::string& str);
std::string get_is_input_serial() const;
void set_is_input_serial(const std::string& str);
// Film header
std::string get_film_mfg_id() const;
void set_film_mfg_id(const std::string& str);
std::string get_film_type() const;
void set_film_type(const std::string& str);
std::string get_film_offset() const;
void set_film_offset(const std::string& str);
std::string get_film_prefix() const;
void set_film_prefix(const std::string& str);
std::string get_film_count() const;
void set_film_count(const std::string& str);
std::string get_film_format() const;
void set_film_format(const std::string& str);
size_t get_film_frame_position() const;
void set_film_frame_position(size_t pos );
size_t get_film_sequence_len() const;
void set_film_sequence_len(size_t len );
size_t get_film_held_count() const;
void set_film_held_count(size_t count );
float get_film_frame_rate () const;
void set_film_frame_rate (float len );
float get_film_shutter_angle() const;
void set_film_shutter_angle(float );
std::string get_film_frame_id() const;
void set_film_frame_id(const std::string& str);
std::string get_film_slate_info() const;
void set_film_slate_info(const std::string& str);
// TV header
size_t get_tv_timecode() const;
void set_tv_timecode(size_t tc);
size_t get_tv_userbits() const;
void set_tv_userbits(size_t tc);
float get_tv_frame_rate() const;
void set_tv_frame_rate(float fr);
uint8_t get_tv_interlace() const;
void set_tv_interlace(uint8_t interlace);
const DPX_header_t& GetHdr(void) const
{
return (m_hdr);
}
DPX_header_t& GetHdr(void)
{
return (m_hdr);
}
size_t GetHdrSize(void) const
{
return (sizeof(DPX_header_t));
}
private:
DPX_header_t m_hdr;
};
#endif // DPX_HDR_H

View File

@ -1,138 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file dpxfileio.h
@brief Declaration of the AJADPXFileIO class, for low level file I/O.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_DPXFILEIO_H
#define AJA_DPXFILEIO_H
#include "ajabase/common/dpx_hdr.h"
#include "ajabase/common/types.h"
/**
* Class to support low level I/O for DPX files.
* @ingroup AJAFileIO
*/
class AJADPXFileIO : public DpxHdr
{
// Public Instance Methods
public:
/**
@brief Constructs a DPX file IO object.
@note Do not call this method without first calling the SetPath method.
**/
AJA_EXPORT AJADPXFileIO ();
AJA_EXPORT virtual ~AJADPXFileIO ();
/**
@brief Returns the list of DPX files that were found at the destination.
**/
AJA_EXPORT std::vector<std::string> & GetFileList ();
/**
@brief Returns the number of DPX files in the location specified by the path.
**/
AJA_EXPORT uint32_t GetFileCount () const;
/**
@brief Returns the index in the file list of the next file to be read.
**/
AJA_EXPORT uint32_t GetIndex () const;
/**
@brief Returns the current setting of the loop play control.
**/
AJA_EXPORT bool GetLoopMode () const;
/**
@brief Returns the current setting of the pause control.
**/
AJA_EXPORT bool GetPauseMode () const;
/**
@brief Returns the current path to the DPX files to be read.
**/
AJA_EXPORT std::string GetPath () const;
/**
@brief Read only the header from the specified file in the DPX sequence.
@param[in] inIndex Specifies the index number of the file to read.
0 <= outIndex <= FileCount
**/
AJA_EXPORT AJAStatus Read (const uint32_t inIndex);
/**
@brief Read the next file in the DPX sequence.
@param[out] outBuffer Receives the DPX file image payload.
@param[in] inBufferSize Specifies the maximum number of bytes to store in outBuffer.
@param[out] outIndex Receives the index number of the file read.
0 <= outIndex <= FileCount
**/
AJA_EXPORT AJAStatus Read (uint8_t & outBuffer,
const uint32_t inBufferSize,
uint32_t & outIndex);
/**
@brief Specifies an ordered list of DPX files to read.
**/
void SetFileList (std::vector<std::string> & list);
/**
@brief Specifies the index in the file list of the next file to be read.
**/
AJA_EXPORT AJAStatus SetIndex (const uint32_t & index);
/**
@brief Specifies the setting of the loop play control.
If true, the last file of a sequence is followed by the first file.
If false, attempting to read beyond the end of a sequence is an error.
**/
AJA_EXPORT void SetLoopMode (bool mode);
/**
@brief Specifies the setting of the pause control.
If true, pause mode will take effect.
If false, pause mode is canceled.
**/
AJA_EXPORT void SetPauseMode (bool mode);
/**
@brief Change the path to the DPX files to be read.
@param[in] inPath Specifies the path to where the DPX files are located.
The file count will change to reflect the number of
files present in the new location.
**/
AJA_EXPORT AJAStatus SetPath (const std::string & inPath);
/**
@brief Write a DPX file.
@param[in] inBuffer Specifies the DPX file image payload.
#param[in] inBufferSize Specifies the number of payload bytes in inBuffer.
#param[in] inIndex Specifies the index number to be appended to the file name.
**/
AJA_EXPORT AJAStatus Write (const uint8_t & inBuffer,
const uint32_t inBufferSize,
const uint32_t & inIndex) const;
// Protected Instance Methods
protected:
// Private Member Data
private:
bool mPathSet; /// True if the path to use has been set, else false
bool mLoopMode; /// True if last sequence frame is followed by the first
bool mPauseMode; /// True if currently paused, else false
std::string mPath; /// Location of the files to read
uint32_t mFileCount; /// Number of DPX files in the path
uint32_t mCurrentIndex; /// Index into the vector below of the next file to read
std::vector<std::string> mFileList; /// File names of all the DPX files in the path
}; // AJADPXFileIO
#endif // AJA_DPXFILEIO_H

View File

@ -1,37 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file export.h
@brief Declares system-dependent import/export macros and libraries.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_EXPORT_H
#define AJA_EXPORT_H
#ifdef MSWindows
#ifndef AJASTATIC
#if defined(AJADLL) || defined(AJA_WINDLL)
#pragma warning (disable : 4251)
#if defined(AJADLL_BUILD) || defined(AJA_DLL_BUILD)
#define AJAExport __declspec(dllexport) // ajantv2 way
#define AJA_EXPORT __declspec(dllexport) // ajabase way
#else
#define AJAExport __declspec(dllimport) // ajantv2 way
#define AJA_EXPORT __declspec(dllimport) // ajabase way
#endif
#else
#define AJAExport // ajantv2 way
#define AJA_EXPORT // ajabase way
#ifndef AJA_NO_AUTOIMPORT
#endif
#endif
#else
#define AJAExport // ajantv2 way
#define AJA_EXPORT // ajabase way
#endif
#else
#define AJAExport // ajantv2 way
#define AJA_EXPORT // ajabase way
#endif
#endif // AJA_EXPORT_H

View File

@ -1,33 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file guid.h
@brief Generates a new, unique UUID as an STL string.
@copyright (C) 2015-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_GUID_H
#define AJA_GUID_H
#include <string>
#include "public.h"
extern "C"
{
#if defined(AJA_WINDOWS)
#include <rpc.h>
#elif defined(AJA_LINUX)
#include <stdio.h>
#else
#include <uuid/uuid.h>
#endif
}
/**
* Generates a uuid.
*
* @return An STL string that contains the new UUID.
*/
std::string AJA_EXPORT CreateGuid (void);
#endif // AJA_GUID_H

View File

@ -1,618 +0,0 @@
/** \file options_popt.h
* \ingroup popt
*/
/* This file is a port of the popt library for use with the AJA SDK.
* The code for the library was consolidated into a .h and .cpp file
* to simplify building demonstration applications. Not all the features
* of popt have been tested. Only simple command line parameter parsing
* was needed for the SDK, but popt was ported to allow enhancing our
* applications with additional functionality as needed.
*/
/* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
file accompanying popt source distributions, available from
ftp://ftp.rpm.org/pub/rpm/dist. */
/* Here is the contents of the COPYING file:
*/
/*
Copyright (c) 1998 Red Hat Software
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
#ifndef H_POPT
#define H_POPT
#include <stdio.h> /* for FILE * */
#include "export.h"
#define POPT_OPTION_DEPTH 10
/** \ingroup popt
* \name Arg type identifiers
*/
#define POPT_ARG_NONE 0U /*!< no arg */
#define POPT_ARG_STRING 1U /*!< arg will be saved as string */
#define POPT_ARG_INT 2U /*!< arg ==> int */
#define POPT_ARG_LONG 3U /*!< arg ==> long */
#define POPT_ARG_INCLUDE_TABLE 4U /*!< arg points to table */
#define POPT_ARG_CALLBACK 5U /*!< table-wide callback... must be
set first in table; arg points
to callback, descrip points to
callback data to pass */
#define POPT_ARG_INTL_DOMAIN 6U /*!< set the translation domain
for this table and any
included tables; arg points
to the domain string */
#define POPT_ARG_VAL 7U /*!< arg should take value val */
#define POPT_ARG_FLOAT 8U /*!< arg ==> float */
#define POPT_ARG_DOUBLE 9U /*!< arg ==> double */
#define POPT_ARG_LONGLONG 10U /*!< arg ==> long long */
#define POPT_ARG_MAINCALL 16U+11U /*!< EXPERIMENTAL: return (*arg) (argc, argv) */
#define POPT_ARG_ARGV 12U /*!< dupe'd arg appended to realloc'd argv array. */
#define POPT_ARG_SHORT 13U /*!< arg ==> short */
#define POPT_ARG_BITSET 16U+14U /*!< arg ==> bit set */
#define POPT_ARG_MASK 0x000000FFU
#define POPT_GROUP_MASK 0x0000FF00U
/** \ingroup popt
* \name Arg modifiers
*/
#define POPT_ARGFLAG_ONEDASH 0x80000000U /*!< allow -longoption */
#define POPT_ARGFLAG_DOC_HIDDEN 0x40000000U /*!< don't show in help/usage */
#define POPT_ARGFLAG_STRIP 0x20000000U /*!< strip this arg from argv(only applies to long args) */
#define POPT_ARGFLAG_OPTIONAL 0x10000000U /*!< arg may be missing */
#define POPT_ARGFLAG_OR 0x08000000U /*!< arg will be or'ed */
#define POPT_ARGFLAG_NOR 0x09000000U /*!< arg will be nor'ed */
#define POPT_ARGFLAG_AND 0x04000000U /*!< arg will be and'ed */
#define POPT_ARGFLAG_NAND 0x05000000U /*!< arg will be nand'ed */
#define POPT_ARGFLAG_XOR 0x02000000U /*!< arg will be xor'ed */
#define POPT_ARGFLAG_NOT 0x01000000U /*!< arg will be negated */
#define POPT_ARGFLAG_LOGICALOPS \
(POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR)
#define POPT_BIT_SET (POPT_ARG_VAL|POPT_ARGFLAG_OR)
/*!< set arg bit(s) */
#define POPT_BIT_CLR (POPT_ARG_VAL|POPT_ARGFLAG_NAND)
/*!< clear arg bit(s) */
#define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000U /*!< show default value in --help */
#define POPT_ARGFLAG_RANDOM 0x00400000U /*!< random value in [1,arg] */
#define POPT_ARGFLAG_TOGGLE 0x00200000U /*!< permit --[no]opt prefix toggle */
/** \ingroup popt
* \name Callback modifiers
*/
#define POPT_CBFLAG_PRE 0x80000000U /*!< call the callback before parse */
#define POPT_CBFLAG_POST 0x40000000U /*!< call the callback after parse */
#define POPT_CBFLAG_INC_DATA 0x20000000U /*!< use data from the include line,
not the subtable */
#define POPT_CBFLAG_SKIPOPTION 0x10000000U /*!< don't callback with option */
#define POPT_CBFLAG_CONTINUE 0x08000000U /*!< continue callbacks with option */
/** \ingroup popt
* \name Error return values
*/
#define POPT_ERROR_NOARG -10 /*!< missing argument */
#define POPT_ERROR_BADOPT -11 /*!< unknown option */
#define POPT_ERROR_OPTSTOODEEP -13 /*!< aliases nested too deeply */
#define POPT_ERROR_BADQUOTE -15 /*!< error in paramter quoting */
#define POPT_ERROR_ERRNO -16 /*!< errno set, use strerror(errno) */
#define POPT_ERROR_BADNUMBER -17 /*!< invalid numeric value */
#define POPT_ERROR_OVERFLOW -18 /*!< number too large or too small */
#define POPT_ERROR_BADOPERATION -19 /*!< mutually exclusive logical operations requested */
#define POPT_ERROR_NULLARG -20 /*!< opt->arg should not be NULL */
#define POPT_ERROR_MALLOC -21 /*!< memory allocation failed */
#define POPT_ERROR_BADCONFIG -22 /*!< config file failed sanity test */
/** \ingroup popt
* \name poptBadOption() flags
*/
#define POPT_BADOPTION_NOALIAS (1U << 0) /*!< don't go into an alias */
/** \ingroup popt
* \name poptGetContext() flags
*/
#define POPT_CONTEXT_NO_EXEC (1U << 0) /*!< ignore exec expansions */
#define POPT_CONTEXT_KEEP_FIRST (1U << 1) /*!< pay attention to argv[0] */
#define POPT_CONTEXT_POSIXMEHARDER (1U << 2) /*!< options can't follow args */
#define POPT_CONTEXT_ARG_OPTS (1U << 4) /*!< return args as options with value 0 */
/** \ingroup popt
*/
struct poptOption {
const char * longName; /*!< may be NULL */
char shortName; /*!< may be NUL */
unsigned int argInfo;
void * arg; /*!< depends on argInfo */
int val; /*!< 0 means don't return, just update flag */
const char * descrip; /*!< description for autohelp -- may be NULL */
const char * argDescrip; /*!< argument description for autohelp */
};
/** \ingroup popt
* A popt alias argument for poptAddAlias().
*/
struct poptAlias {
const char * longName; /*!< may be NULL */
char shortName; /*!< may be NUL */
int argc;
const char ** argv; /*!< must be free()able */
};
/** \ingroup popt
* A popt alias or exec argument for poptAddItem().
*/
typedef struct poptItem_s {
struct poptOption option; /*!< alias/exec name(s) and description. */
int argc; /*!< (alias) no. of args. */
const char ** argv; /*!< (alias) args, must be free()able. */
} * poptItem;
/** \ingroup popt
* \name Auto-generated help/usage
*/
/**
* Empty table marker to enable displaying popt alias/exec options.
*/
extern struct poptOption poptAliasOptions[];
#define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptions, \
0, "Options implemented via popt alias/exec:", NULL },
/**
* Auto help table options.
*/
extern struct poptOption poptHelpOptions[];
extern struct poptOption * poptHelpOptionsI18N;
#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
0, "Help options:", NULL },
#define POPT_TABLEEND { NULL, '\0', 0, NULL, 0, NULL, NULL }
/** \ingroup popt
*/
typedef struct poptContext_s * poptContext;
/** \ingroup popt
*/
#ifndef __cplusplus
typedef struct poptOption * poptOption;
#endif
/** \ingroup popt
*/
enum poptCallbackReason {
POPT_CALLBACK_REASON_PRE = 0,
POPT_CALLBACK_REASON_POST = 1,
POPT_CALLBACK_REASON_OPTION = 2
};
#ifdef __cplusplus
extern "C" {
#endif
/** \ingroup popt
* Table callback prototype.
* @param con context
* @param reason reason for callback
* @param opt option that triggered callback
* @param arg argument
* @param data argument data
*/
typedef void (*poptCallbackType) (poptContext con,
enum poptCallbackReason reason,
const struct poptOption * opt,
const char * arg,
const void * data);
/** \ingroup popt
* Destroy context.
* @param con context
* @return NULL always
*/
poptContext poptFreeContext(poptContext con);
/** \ingroup popt
* Initialize popt context.
* @param name context name (usually argv[0] program name)
* @param argc no. of arguments
* @param argv argument array
* @param options address of popt option table
* @param flags or'd POPT_CONTEXT_* bits
* @return initialized popt context
*/
poptContext poptGetContext(
const char * name,
int argc, const char ** argv,
const struct poptOption * options,
unsigned int flags);
/** \ingroup popt
* Destroy context (alternative implementation).
* @param con context
* @return NULL always
*/
poptContext poptFini(poptContext con);
/** \ingroup popt
* Initialize popt context (alternative implementation).
* This routine does poptGetContext() and then poptReadConfigFiles().
* @param argc no. of arguments
* @param argv argument array
* @param options address of popt option table
* @param configPaths colon separated file path(s) to read.
* @return initialized popt context (NULL on error).
*/
poptContext poptInit(int argc, const char ** argv,
const struct poptOption * options,
const char * configPaths);
/** \ingroup popt
* Reinitialize popt context.
* @param con context
*/
void poptResetContext(poptContext con);
/** \ingroup popt
* Return value of next option found.
* @param con context
* @return next option val, -1 on last item, POPT_ERROR_* on error
*/
int poptGetNextOpt(poptContext con);
/** \ingroup popt
* Return next option argument (if any).
* @param con context
* @return option argument, NULL if no argument is available
*/
char * poptGetOptArg(poptContext con);
/** \ingroup popt
* Return next argument.
* @param con context
* @return next argument, NULL if no argument is available
*/
const char * poptGetArg(/*@null@*/poptContext con);
/** \ingroup popt
* Peek at current argument.
* @param con context
* @return current argument, NULL if no argument is available
*/
const char * poptPeekArg(poptContext con);
/** \ingroup popt
* Return remaining arguments.
* @param con context
* @return argument array, NULL terminated
*/
const char ** poptGetArgs(poptContext con);
/** \ingroup popt
* Return the option which caused the most recent error.
* @param con context
* @param flags option flags
* @return offending option
*/
const char * poptBadOption(poptContext con, unsigned int flags);
/** \ingroup popt
* Add arguments to context.
* @param con context
* @param argv argument array, NULL terminated
* @return 0 on success, POPT_ERROR_OPTSTOODEEP on failure
*/
int poptStuffArgs(poptContext con, const char ** argv);
/** \ingroup popt
* Add alias to context.
* @todo Pass alias by reference, not value.
* @note This function is deprecated. Use poptAddItem instead.
* @param con context
* @param alias alias to add
* @param flags (unused)
* @return 0 on success
*/
int poptAddAlias(poptContext con, struct poptAlias alias, int flags);
/** \ingroup popt
* Add alias/exec item to context.
* @param con context
* @param newItem alias/exec item to add
* @param flags 0 for alias, 1 for exec
* @return 0 on success
*/
int poptAddItem(poptContext con, poptItem newItem, int flags);
/** \ingroup popt
* Perform sanity checks on a file path.
* @param fn file name
* @return 0 on OK, 1 on NOTOK.
*/
int poptSaneFile(const char * fn);
/**
* Read a file into a buffer.
* @param fn file name
* @retval *bp buffer (malloc'd) (or NULL)
* @retval *nbp no. of bytes in buffer (including final NUL) (or NULL)
* @param flags 1 to trim escaped newlines
* return 0 on success
*/
int poptReadFile(const char * fn, char ** bp,
size_t * nbp, int flags);
#define POPT_READFILE_TRIMNEWLINES 1
/** \ingroup popt
* Read configuration file.
* @param con context
* @param fn file name to read
* @return 0 on success, POPT_ERROR_ERRNO on failure
*/
int poptReadConfigFile(poptContext con, const char * fn);
/** \ingroup popt
* Read configuration file(s).
* Colon separated files to read, looping over poptReadConfigFile().
* Note that an '@' character preceeding a path in the list will
* also perform additional sanity checks on the file before reading.
* @param con context
* @param paths colon separated file name(s) to read
* @return 0 on success, POPT_ERROR_BADCONFIG on failure
*/
int poptReadConfigFiles(poptContext con, const char * paths);
/** \ingroup popt
* Read default configuration from /etc/popt and $HOME/.popt.
* @param con context
* @param useEnv (unused)
* @return 0 on success, POPT_ERROR_ERRNO on failure
*/
int poptReadDefaultConfig(poptContext con, int useEnv);
/** \ingroup popt
* Duplicate an argument array.
* @note: The argument array is malloc'd as a single area, so only argv must
* be free'd.
*
* @param argc no. of arguments
* @param argv argument array
* @retval argcPtr address of returned no. of arguments
* @retval argvPtr address of returned argument array
* @return 0 on success, POPT_ERROR_NOARG on failure
*/
int poptDupArgv(int argc, const char **argv,
int * argcPtr,
const char *** argvPtr);
/** \ingroup popt
* Parse a string into an argument array.
* The parse allows ', ", and \ quoting, but ' is treated the same as " and
* both may include \ quotes.
* @note: The argument array is malloc'd as a single area, so only argv must
* be free'd.
*
* @param s string to parse
* @retval argcPtr address of returned no. of arguments
* @retval argvPtr address of returned argument array
*/
int poptParseArgvString(const char * s,
int * argcPtr, const char *** argvPtr);
/** \ingroup popt
* Parses an input configuration file and returns an string that is a
* command line. For use with popt. You must free the return value when done.
*
* Given the file:
\verbatim
# this line is ignored
# this one too
aaa
bbb
ccc
bla=bla
this_is = fdsafdas
bad_line=
reall bad line
reall bad line = again
5555= 55555
test = with lots of spaces
\endverbatim
*
* The result is:
\verbatim
--aaa --bbb --ccc --bla="bla" --this_is="fdsafdas" --5555="55555" --test="with lots of spaces"
\endverbatim
*
* Passing this to poptParseArgvString() yields an argv of:
\verbatim
'--aaa'
'--bbb'
'--ccc'
'--bla=bla'
'--this_is=fdsafdas'
'--5555=55555'
'--test=with lots of spaces'
\endverbatim
*
* @bug NULL is returned if file line is too long.
* @bug Silently ignores invalid lines.
*
* @param fp file handle to read
* @param argstrp return string of options (malloc'd)
* @param flags unused
* @return 0 on success
* @see poptParseArgvString
*/
int poptConfigFileToString(FILE *fp, char ** argstrp, int flags);
/** \ingroup popt
* Return formatted error string for popt failure.
* @param error popt error
* @return error string
*/
const char * poptStrerror(const int error);
/** \ingroup popt
* Limit search for executables.
* @param con context
* @param path single path to search for executables
* @param allowAbsolute absolute paths only?
*/
void poptSetExecPath(poptContext con, const char * path, int allowAbsolute);
/** \ingroup popt
* Print detailed description of options.
* @param con context
* @param fp ouput file handle
* @param flags (unused)
*/
void poptPrintHelp(poptContext con, FILE * fp, int flags);
/** \ingroup popt
* Print terse description of options.
* @param con context
* @param fp ouput file handle
* @param flags (unused)
*/
void poptPrintUsage(poptContext con, FILE * fp, int flags);
/** \ingroup popt
* Provide text to replace default "[OPTION...]" in help/usage output.
* @param con context
* @param text replacement text
*/
void poptSetOtherOptionHelp(poptContext con, const char * text);
/** \ingroup popt
* Return argv[0] from context.
* @param con context
* @return argv[0]
*/
const char * poptGetInvocationName(poptContext con);
/** \ingroup popt
* Shuffle argv pointers to remove stripped args, returns new argc.
* @param con context
* @param argc no. of args
* @param argv arg vector
* @return new argc
*/
int poptStrippedArgv(poptContext con, int argc, char ** argv);
/**
* Add a string to an argv array.
* @retval *argvp argv array
* @param argInfo (unused)
* @param val string arg to add (using strdup)
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
*/
int poptSaveString(const char *** argvp, unsigned int argInfo,
const char * val);
/**
* Save a long long, performing logical operation with value.
* @warning Alignment check may be too strict on certain platorms.
* @param arg integer pointer, aligned on int boundary.
* @param argInfo logical operation (see POPT_ARGFLAG_*)
* @param aLongLong value to use
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
*/
int poptSaveLongLong(long long * arg, unsigned int argInfo,
long long aLongLong);
/**
* Save a long, performing logical operation with value.
* @warning Alignment check may be too strict on certain platorms.
* @param arg integer pointer, aligned on int boundary.
* @param argInfo logical operation (see POPT_ARGFLAG_*)
* @param aLong value to use
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
*/
int poptSaveLong(long * arg, unsigned int argInfo, long aLong);
/**
* Save a short integer, performing logical operation with value.
* @warning Alignment check may be too strict on certain platorms.
* @param arg short pointer, aligned on short boundary.
* @param argInfo logical operation (see POPT_ARGFLAG_*)
* @param aLong value to use
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
*/
int poptSaveShort(short * arg, unsigned int argInfo, long aLong);
/**
* Save an integer, performing logical operation with value.
* @warning Alignment check may be too strict on certain platorms.
* @param arg integer pointer, aligned on int boundary.
* @param argInfo logical operation (see POPT_ARGFLAG_*)
* @param aLong value to use
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
*/
int poptSaveInt(int * arg, unsigned int argInfo, long aLong);
/* The bit set typedef. */
typedef struct poptBits_s {
unsigned int bits[1];
} * poptBits;
#define _POPT_BITS_N 1024U /* estimated population */
#define _POPT_BITS_M ((3U * _POPT_BITS_N) / 2U)
#define _POPT_BITS_K 16U /* no. of linear hash combinations */
extern unsigned int _poptBitsN;
extern unsigned int _poptBitsM;
extern unsigned int _poptBitsK;
int poptBitsAdd(poptBits bits, const char * s);
int poptBitsChk(poptBits bits, const char * s);
int poptBitsClr(poptBits bits);
int poptBitsDel(poptBits bits, const char * s);
int poptBitsIntersect(poptBits * ap, const poptBits b);
int poptBitsUnion(poptBits * ap, const poptBits b);
int poptBitsArgs(poptContext con, poptBits * ap);
/**
* Save a string into a bit set (experimental).
* @retval *bits bit set (lazily malloc'd if NULL)
* @param argInfo logical operation (see POPT_ARGFLAG_*)
* @param s string to add to bit set
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
*/
int poptSaveBits(poptBits * bitsp, unsigned int argInfo,
const char * s);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,174 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file performance.h
@brief Declaration of the AJAPerformance class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_PERFORMANCE_H
#define AJA_PERFORMANCE_H
/////////////////////////////
// Includes
/////////////////////////////
#include "ajabase/common/timer.h"
#include <string>
#include <map>
typedef std::map<std::string, uint64_t> AJAPerformanceExtraMap;
/////////////////////////////
// Declarations
/////////////////////////////
class AJAExport AJAPerformance
{
public:
/**
* Constructor
*
* @param[in] name The name for the performance object.
* @param[in] precision The Precision units to use.
* @param[in] skipEntries The number of entries to skip over before tracking performance,
* the idea here is to skip over any "warm-up" period.
*/
AJAPerformance(const std::string& name,
AJATimerPrecision precision = AJATimerPrecisionMilliseconds,
uint64_t skipEntries = 0);
/**
* Constructor
*
* @param[in] name The name for the performance object.
* @param[in] values Extra values that can be stored along with performance info.
* @param[in] precision The Precision units to use.
* @param[in] skipEntries The number of entries to skip over before tracking performance,
* the idea here is to skip over any "warm-up" period.
*/
AJAPerformance(const std::string& name, const AJAPerformanceExtraMap& values,
AJATimerPrecision precision = AJATimerPrecisionMilliseconds,
uint64_t skipEntries = 0);
/**
* Constructor
*
* @param[in] precision The Precision units to use.
* @param[in] skipEntries The number of entries to skip over before tracking performance,
* the idea here is to skip over any "warm-up" period.
*/
AJAPerformance(AJATimerPrecision precision = AJATimerPrecisionMilliseconds,
uint64_t skipEntries = 0);
~AJAPerformance(void);
/**
* Set extra values that can be stored along with performance info
*
* @param[in] values The extra values to assign to this object
*/
void SetExtras(const AJAPerformanceExtraMap& values);
/**
* Start the timer of the performance object
*/
void Start(void);
/**
* Stop the timer of the performance object and updates the performance stats:
* number of entries, min time, max time, total time
*/
void Stop(void);
/**
* Print out a performance report to AJADebug
* @param[in] name Name to use in printout, if empty will use the name passed in constructor
* @param[in] pFileName The source filename reporting the performace.
* @param[in] lineNumber The line number in the source file reporting the performance.
*/
void Report(const std::string& name = "", const char *pFileName = NULL, int32_t lineNumber = -1);
/**
* Returns the name for the performance object that was set in the constructor
*/
std::string Name(void);
/**
* Returns the Precision units set in the constructor
*/
AJATimerPrecision Precision(void);
/**
* Returns the number of times that the start/stop pair has been called
*/
uint64_t Entries(void);
/**
* Returns the total elapsed time between all start/stop pairs (in Precision units)
*/
uint64_t TotalTime(void);
/**
* Returns the minimum time between all start/stop pairs (in Precision units)
*/
uint64_t MinTime(void);
/**
* Returns the maximum time between all start/stop pairs (in Precision units)
*/
uint64_t MaxTime(void);
/**
* Returns the mean (average) time of all start/stop pairs (in Precision units)
*/
double Mean(void);
/**
* Returns the variance of all start/stop pairs (in Precision units)
*/
double Variance(void);
/**
* Returns the standard deviation of all start/stop pairs (in Precision units)
*/
double StandardDeviation(void);
/**
* Returns a map of any extra values stored in the performance object
*/
const AJAPerformanceExtraMap Extras(void);
private:
AJATimer mTimer;
std::string mName;
uint64_t mTotalTime;
uint64_t mEntries;
uint64_t mMinTime;
uint64_t mMaxTime;
double mMean;
double mM2;
uint64_t mNumEntriesToSkipAtStart;
AJAPerformanceExtraMap mExtras;
};
// Helper functions to track/report many performance timers and store in a map
typedef std::map<std::string, AJAPerformance> AJAPerformanceTracking;
extern bool AJAPerformanceTracking_start(AJAPerformanceTracking& stats,
std::string key,
AJATimerPrecision precision = AJATimerPrecisionMilliseconds,
uint64_t skipEntries = 0);
extern bool AJAPerformanceTracking_start(AJAPerformanceTracking& stats,
std::string key, const AJAPerformanceExtraMap& extras,
AJATimerPrecision precision = AJATimerPrecisionMilliseconds,
uint64_t skipEntries = 0);
extern bool AJAPerformanceTracking_stop(AJAPerformanceTracking& stats, std::string key);
extern bool AJAPerformanceTracking_report(AJAPerformanceTracking& stats, std::string title = "",
const char *pFileName = NULL, int32_t lineNumber = -1);
#endif // AJA_PERFORMANCE_H
//////////////////////// End of performance.h ///////////////////////

View File

@ -1,178 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file pixelformat.h
@brief Contains the declaration of the AJAPixelFormat class.
@copyright (C) 2010-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef _PixelFormat_Defined_
#define _PixelFormat_Defined_
#include "ajabase/common/videotypes.h"
#define IS_CION_RAW(pixFmt) (pixFmt >= AJA_PixelFormat_RAW10 && pixFmt <= AJA_PixelFormat_RAW10_HS)
enum AJAScaleType
{
AJAScaleTypeNone = 0,
AJAScaleType1280To1920 = 1 << 0,
AJAScaleType960To1280 = 1 << 1,
AJAScaleType1440To1920 = 1 << 2,
AJAScaleTypeQRez = 1 << 3,
AJAScaleTypeHDV = AJAScaleType960To1280 | AJAScaleType1440To1920,
AJAScaleTypeDVCPro = AJAScaleType960To1280 | AJAScaleType1280To1920
};
/**
@class AJAPixelFormat pixelformat.h "streams/common/pixelformat.h"
@brief Storage and utility class for AJA_PixelFormat defines.
This class provides a means of storing and querying facts about the various AJA_PixelFormat values.
**/
class AJA_EXPORT AJAPixelFormat
{
public:
AJAPixelFormat();
AJAPixelFormat(AJA_PixelFormat format);
virtual ~AJAPixelFormat();
/**
* Set current format value.
*
* @param[in] format new AJA_PixelFormat.
*/
void Set(AJA_PixelFormat format);
/**
* Query current format value.
*
* @return current AJA_PixelFormat value.
*/
AJA_PixelFormat Query(void);
/**
* Query current fourCC value.
*
* @return current FourCC value.
*/
uint32_t QueryFourCC(void);
/**
* Query display name.
*
* @return current display name.
*/
const char* QueryDisplayName(void);
/**
* Query RGB.
*
* @return whether or not current format is RGB.
*/
bool QueryRgb(void);
/**
* Query max bit depth per component for specified format
*
* @return bit depth per component for specified format
*/
uint32_t QueryBitDepth();
/**
* Query Scale Type.
*
* @return what type of scale format uses if any.
*/
AJAScaleType QueryScaleType(void);
/**
* Static method to get number of possible formats
* Useful for filling out GUI's
*
* @return number of possible formats
*/
static int QueryNumberPossibleFormats();
/**
* Static method to get a format out of table of all possible formats
*
* @param[in] index Zero-based index value.
* @param[out] fmt Receives format for index.
* Unmodified if index out of bounds.
* @return true if index within bounds
*/
static bool QueryFormatAtIndex(int index,AJAPixelFormat& fmt);
/**
* Static method to see if a source and target resolution are scalable
*
* @param[in] bitmapWidth width of the bitmap in PC memory
* @param[in] wireWidth width of the bitmap in Kona memory
* @param[in] xAspect Horizontal component of aspect ratio
* @param[in] yAspect Vertical component of aspect ratio
* @param[in] pMatchingFormat Pixel format used for matching
* @param[out] pScalingFormat Receives scaling pixel format
* @return returns true if one of the pixel formats will suffice for scaling
*/
static bool QueryIsScalable(uint32_t bitmapWidth,uint32_t wireWidth,uint32_t xAspect,uint32_t yAspect,
AJA_PixelFormat *pMatchingFormat,AJA_PixelFormat *pScalingFormat);
/**
* Static method to convert scaled x resolution
*
* @param[in] scaleType type of scaling to be done
* @param[in] xIn either the wire or bitmap resolution
* @param[out] xOut the corrected resolution
* @return returns true if conversion occurred
*/
static bool ConvertWidth(AJAScaleType scaleType,int xIn,int &xOut);
/**
* Static method to convert aspect ratio from wire to bitmap
*
* @param[in] scaleType Type of scaling to be done
* @param[in] hIn Horizontal value to convert
* @param[in] vIn Vertical value to convert
* @param[out] hOut Converted horizontal value
* @param[out] vOut Converted vertical value
* @return True if conversion occurred
*/
static bool ConvertAspect(AJAScaleType scaleType,int hIn, int vIn, int &hOut,int &vOut);
/**
* Static method to provide a suggested scaling type and primary pixel format
*
* @param[in] xWire wire resolution
* @param[in] xBitmap bitmap resolution
* @param[out] primaryFormat unscaled pixel format
* @param[out] scaleType type of scaling that needs to occur
* @return returns true if conversion occurred
*/
static bool QueryScaleType(int xWire,int xBitmap,AJA_PixelFormat &primaryFormat,AJAScaleType &scaleType);
/**
* Static method to provide expanded width for width-scaled rasters (e.g. DVCPro, HDV)
*
* @param[in] scaledWidth width of scaled raster prior to full-width video expansion
* @param[in] height height of scaled raster
* @return returns expanded width if input raster size matches known scaled raster type, otherwise returns input (scaledWidth)
*/
static int QueryFullScaleWidth(int scaledWidth, int height);
/**
* Static method to provide associated pixel format (e.g. DVCPro, HDV)
*
* @param[in] scaledWidth width of scaled raster prior to full-width video expansion
* @param[in] height height of scaled raster
* @return returns associated pixel format
*/
static AJA_PixelFormat QueryScaledPixelFormat(int scaledWidth, int height);
protected:
AJA_PixelFormat m_format;
};
#endif // _PixelFormat_Defined_

View File

@ -1,21 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file public.h
@brief Master header for the ajabase library.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_PUBLIC_H
#define AJA_PUBLIC_H
#include "ajabase/common/export.h"
#include <string>
#include <list>
#include <vector>
#include <map>
#include "ajabase/common/types.h"
#if defined(AJA_USE_CPLUSPLUS11)
#include <mutex>
#endif
#endif // AJA_PUBLIC_H

View File

@ -1,64 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file rawfile.h
@brief Defines data structures used to read and write AJA raw files.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_RAWFILE_H
#define AJA_RAWFILE_H
const uint32_t AJAAudioHeaderTag = AJA_FOURCC('a','j','a','h');
const uint32_t AJAVideoHeaderTag = AJA_FOURCC('a','j','v','h');
const uint32_t AJAAudioDataTag = AJA_FOURCC('a','j','a','d');
const uint32_t AJAVideoDataTag = AJA_FOURCC('a','j','v','d');
#pragma pack(push,1)
struct AJARawAudioHeader
{
uint32_t tag; // should be AJAAudioHeaderTag
int64_t size; // sizeof(AJARawAudioHeader)
int64_t scale; // video frame scale for timecode, ie. 30000
int64_t duration; // video frame duration for timecode, ie. 1001
int64_t timecode; // video frame offset of first sample
uint32_t rate; // number of samples per second, ie. 48000
uint32_t channels; // number of channels, ie. 2,4,8, etc.
uint32_t bigEndian; // non-zero if samples are in big endian format
uint32_t sampleSize; // number of bytes per sample, ie. 2,3,4
uint32_t isFloat; // non-zero if samples are in floating point format
// crank this out to 1024 bytes for additional future stuff
uint32_t reserved[(1024 - (sizeof(uint32_t) * 6) - (sizeof(int64_t) * 4)) / sizeof(uint32_t)];
};
struct AJARawVideoHeader
{
uint32_t tag; // should be AJAVideoHeaderTag
int64_t size; // sizeof(AJARawVideoHeader)
int64_t scale; // video frame scale for timecode, ie. 30000
int64_t duration; // video frame duration for timecode, ie. 1001
int64_t timecode; // video frame offset of first sample
uint32_t fourcc; // fourcc of video frames, this format implies fixed bytes per frame
uint32_t xRes; // x resolution of video frames, ie. 1920
uint32_t yRes; // y resolution of video frames, ie. 1080
uint32_t bytesPerFrame; // number of bytes per frame of video, all frames are the same
uint32_t aspectX; // x aspect of video frames, ie. 1
uint32_t aspectY; // y aspect of video frames, ie. 1
uint32_t interlace; // interlace of frames, 0-progressive, 1-lower, 2-upper
// crank this out to 1024 bytes for additional future stuff
uint32_t reserved[(1024 - (sizeof(uint32_t) * 8) - (sizeof(int64_t) * 4)) / sizeof(uint32_t)];
};
struct AJARawDataHeader
{
uint32_t tag; // should be AJAVideoDataTag or AJAAudioDataTag
int64_t size; // if size is zero, go to end of file with this chunk
};
#pragma pack(pop)
#endif // AJA_RAWFILE_H

View File

@ -1,95 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file testpatterngen.h
@brief Declares the AJATestPatternGen class.
@copyright (C) 2010-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_TESTPATTERN_GEN
#define AJA_TESTPATTERN_GEN
#if !defined(NTV2_DEPRECATE_15_0)
#include "types.h"
#include "videotypes.h"
#include "videoutilities.h"
#include <vector>
typedef std::vector<uint8_t> AJATestPatternBuffer;
enum AJATestPatternSelect
{
AJA_TestPatt_ColorBars100,
AJA_TestPatt_ColorBars75,
AJA_TestPatt_Ramp,
AJA_TestPatt_MultiBurst,
AJA_TestPatt_LineSweep,
AJA_TestPatt_CheckField,
AJA_TestPatt_FlatField,
AJA_TestPatt_MultiPattern,
AJA_TestPatt_Black,
AJA_TestPatt_White,
AJA_TestPatt_Border,
AJA_TestPatt_LinearRamp,
AJA_TestPatt_SlantRamp,
AJA_TestPatt_ZonePlate,
AJA_TestPatt_ColorQuadrant,
AJA_TestPatt_ColorQuadrantBorder,
AJA_TestPatt_ColorQuadrantTSI,
AJA_TestPatt_All
};
//*********************************************************************************
// CTestPattern
class AJA_EXPORT AJATestPatternGen
{
// Construction
public:
AJATestPatternGen();
// Implementation
public:
virtual ~AJATestPatternGen();
virtual bool DrawTestPattern(AJATestPatternSelect pattNum, uint32_t frameWidth, uint32_t frameHeight, AJA_PixelFormat pixelFormat, AJATestPatternBuffer &testPatternBuffer);
virtual bool DrawTestPattern(AJATestPatternSelect pattNum, uint32_t frameWidth, uint32_t frameHeight,
AJA_PixelFormat pixelFormat, AJA_BayerColorPhase phase, AJATestPatternBuffer &testPatternBuffer);
void setSignalMask(AJASignalMask signalMask) { _signalMask = signalMask;}
AJASignalMask getSignalMask() { return _signalMask;}
void setSliderValue(double sliderValue) { _sliderValue = sliderValue;}
double getSliderValue() { return _sliderValue;}
protected:
virtual bool DrawSegmentedTestPattern();
virtual bool DrawYCbCrFrame(uint16_t Y, uint16_t Cb, uint16_t Cr);
virtual bool DrawBorderFrame();
virtual bool DrawLinearRampFrame();
virtual bool DrawSlantRampFrame();
virtual bool DrawZonePlateFrame();
virtual bool DrawQuandrantBorderFrame();
virtual bool DrawColorQuandrantFrame();
virtual bool DrawColorQuandrantTSIFrame();
protected:
AJATestPatternSelect _patternNumber;
uint32_t _frameWidth;
uint32_t _frameHeight;
uint32_t _linePitch;
uint32_t _dataLinePitch;
uint32_t _bufferSize;
uint8_t* _pTestPatternBuffer;
uint32_t* _pPackedLineBuffer;
uint16_t* _pUnPackedLineBuffer;
double _sliderValue;
AJASignalMask _signalMask;
AJA_PixelFormat _pixelFormat;
AJA_BayerColorPhase _bayerPhase;
}; // AJATestPatternGen
#endif // !defined(NTV2_DEPRECATE_15_0)
#endif // AJA_TESTPATTERN_GEN

View File

@ -1,393 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file timebase.h
@brief Declares the AJATimeBase class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef TIMEBASE_H
#define TIMEBASE_H
#include "ajabase/common/public.h"
#include "ajabase/common/videotypes.h"
/**
* Class provides high resolution time base conversion
* @ingroup AJAGroupSystem
*/
class AJA_EXPORT AJATimeBase
{
public:
AJATimeBase();
/**
* Construct the time base class.
*
* @param[in] ajaFrameRate Frame rate define found in videotypes.h
*/
AJATimeBase(AJA_FrameRate ajaFrameRate);
/**
* Construct the time base class.
*
* @param[in] frameTimeScale Time units per second (units/second)
* @param[in] frameDuration Time units per frame (units/frame)
*/
AJATimeBase(int64_t frameTimeScale, int64_t frameDuration);
/**
* Construct the time base class.
*
* @param[in] frameTimeScale Time units per second (units/second)
* @param[in] frameDuration Time units per frame (units/frame)
* @param[in] audioRate Audio sample rate (samples/second)
*/
AJATimeBase(int64_t frameTimeScale, int64_t frameDuration, int64_t audioRate);
/**
* Copy constructor
*
* @param[in] other AJATimeBase to copy
*/
AJATimeBase(const AJATimeBase &other);
virtual ~AJATimeBase();
/**
* Set to default value.
*/
void SetToDefault(void);
/**
* Set the video frame rate to use in conversions.
*
* The frame rate is specified as frameTimeScale/frameDuration = frames/second.
*
* @param[in] frameTimeScale Time units per second (units/second)
* @param[in] frameDuration Time units per frame (units/frame)
*/
void SetFrameRate(int64_t frameTimeScale, int64_t frameDuration);
/**
* Set the video frame rate to use in conversions.
*
* The frame rate is specified Frame rate define found in videotypes.h
*
* @param[in] ajaFrameRate AJA_FrameRate
*/
void SetAJAFrameRate(AJA_FrameRate ajaFrameRate);
/**
* Get the video frame rate used in conversions.
*
* The frame rate is specified as frameTimeScale/frameDuration = frames/seconds.
*
* @param[out] frameTimeScale Time units per second (units/second)
* @param[out] frameDuration Time units per frame (units/frame)
*/
void GetFrameRate(int64_t& frameTimeScale, int64_t& frameDuration) const;
void GetFrameRate(uint32_t& frameTimeScale, uint32_t& frameDuration) const;
/**
* Get the video frame time scale used in conversions.
*
* @return frameTimeScale Time units per second (units/second)
*/
int64_t GetFrameTimeScale(void) const;
/**
* Set the video frame duration used in conversions.
*
* @param[in] timeScale Time units per second (units/second)
*/
void SetFrameTimeScale(int64_t timeScale);
/**
* Get the video frame duration used in conversions.
*
* @return frameDuration Time units per frame (units/frame)
*/
int64_t GetFrameDuration(void) const;
/**
* Set the audio sample rate to use in conversions.
*
* @param[in] rate Audio rate in samples/second.
*/
void SetAudioRate(int64_t rate);
/**
* Get the audio sample rate used in conversions.
*
* @return Audio rate in samples/second.
*/
int64_t GetAudioRate() const;
/**
* Get the AJA_FrameRate which is close to the current value, return unknown if not close.
*
* @return AJA_FrameRate value, may be unknown
*/
AJA_FrameRate GetAJAFrameRate(void) const;
/**
* Set the system tick rate to use in conversions.
*
* @param[in] rate System tick rate in ticks/second.
* 0 == system native rate.
*/
void SetTickRate(int64_t rate);
/**
* Get the system tick rate used in conversions.
*
* @return Tick rate in ticks/second.
*/
int64_t GetTickRate() const;
/**
* Convert video frames to audio samples.
*
* @param[in] frames Video frame count to convert.
* @param[in] round Round the result.
* @return Audio sample count.
*/
int64_t FramesToSamples(int64_t frames, bool round = false) const;
/**
* Convert video frames to system ticks.
*
* @param[in] frames Video frame count to convert.
* @param[in] round Round the result.
* @return System tick count.
*/
int64_t FramesToTicks(int64_t frames, bool round = false) const;
/**
* Convert video frames to time in seconds.
*
* @param[in] frames Video frame count to convert.
* @return Time in seconds.
*/
double FramesToSeconds(int64_t frames) const;
/**
* Convert time scale units to time in seconds.
*
* @param[in] num Time scale units to convert.
* @return Time in seconds.
*/
double ScaleUnitsToSeconds(int64_t num) const;
/**
* Convert video frames to time in microseconds.
*
* @param[in] frames Video frame count to convert.
* @param[in] round Round the result.
* @return Time in microseconds.
*/
int64_t FramesToMicroseconds(int64_t frames, bool round = false) const;
/**
* Convert audio samples to video frames.
*
* @param[in] samples Audio sample count to convert.
* @param[in] round Round the result.
* @return Video frame count.
*/
int64_t SamplesToFrames(int64_t samples, bool round = false) const;
/**
* Convert audio samples to system ticks.
*
* @param[in] samples Audio sample count to convert.
* @param[in] round Round the result.
* @return System tick count.
*/
int64_t SamplesToTicks(int64_t samples, bool round = false) const;
/**
* Convert audio samples to time in seconds.
*
* @param[in] samples Sample count to convert.
* @return Time in seconds.
*/
double SamplesToSeconds(int64_t samples);
/**
* Convert audio samples to time in microseconds.
*
* @param[in] samples Sample count to convert.
* @param[in] round Round the result.
* @return Time in microseconds.
*/
int64_t SamplesToMicroseconds(int64_t samples, bool round = false);
/**
* Convert system ticks to video frames.
*
* @param[in] ticks System tick count to convert.
* @param[in] round Round the result.
* @return Video frame count.
*/
int64_t TicksToFrames(int64_t ticks, bool round = false);
/**
* Convert system ticks to audio samples.
*
* @param[in] ticks System tick count to convert.
* @param[in] round Round the result.
* @return Audio sample count.
*/
int64_t TicksToSamples(int64_t ticks, bool round = false);
/**
* Convert system ticks to time in seconds.
*
* @param[in] ticks System tick count to convert.
* @return Time in seconds.
*/
double TicksToSeconds(int64_t ticks);
/**
* Convert system ticks to time in microseconds.
*
* @param[in] ticks System tick count to convert.
* @param[in] round Round the result.
* @return Time in microseconds.
*/
int64_t TicksToMicroseconds(int64_t ticks, bool round = false);
/**
* Convert time in seconds to video frames.
*
* @param[in] seconds Time in seconds.
* @param[in] round Round the result.
* @return Video frame count.
*/
int64_t SecondsToFrames(double seconds, bool round = false);
/**
* Convert time in seconds to audio samples.
*
* @param[in] seconds Time in seconds.
* @param[in] round Round the result.
* @return Audio sample count.
*/
int64_t SecondsToSamples(double seconds, bool round = false);
/**
* Convert time in seconds to system ticks.
*
* @param[in] seconds Time in seconds.
* @param[in] round Round the result.
* @return System tick count.
*/
int64_t SecondsToTicks(double seconds, bool round = false);
/**
* Convert microseconds to video frames.
*
* @param[in] microseconds System tick count to convert.
* @param[in] round Round the result.
* @return Video frame count.
*/
int64_t MicrosecondsToFrames(int64_t microseconds, bool round = false);
/**
* Convert microseconds to audio samples.
*
* @param[in] microseconds System tick count to convert.
* @param[in] round Round the result.
* @return Audio sample count.
*/
int64_t MicrosecondsToSamples(int64_t microseconds, bool round = false);
/**
* Convert microseconds to system ticks.
*
* @param[in] microseconds System tick count to convert.
* @param[in] round Round the result.
* @return Time in microseconds.
*/
int64_t MicrosecondsToTicks(int64_t microseconds, bool round = false);
/**
* Get the current value of the system tick count.
*
* @return System tick count.
*/
int64_t GetSystemTicks();
/**
* Returns if timebases are reasonably close
*
* @param[in] timeBase Time base to compare.
* @return True if the same or close (returns false if either duration is zero).
*/
bool IsCloseTo(const AJATimeBase &timeBase) const;
/**
* Returns if timebases are reasonably close
*
* @param[in] frameTimeScale Time scale to compare.
* @param[in] frameDuration Time duration to compare.
* @return True if the same or close (returns false if either duration is zero).
*/
bool IsCloseTo(int64_t frameTimeScale, int64_t frameDuration) const;
/**
* Test if the timescale is not a simple multiple of the duration
*
* The intent is that even ratios are "non-drop", otherwise the timebase is "drop frame"
* In this sense, this method can be thought of as equivalent to IsDropFrame()
*
* @return True if the timescale/duration ratio has a non-zero fraction, i.e. "drop frame".
*/
bool IsNonIntegralRatio(void) const;
/**
* Returns frames per second
*
* @return frames per second
*/
float GetFramesPerSecond(void) const;
double GetFramesPerSecondDouble(void) const;
AJATimeBase& operator=(const AJATimeBase &t);
bool operator==(const AJATimeBase &val) const;
bool operator!=(const AJATimeBase &val) const;
/**
* Convert time in seconds to microseconds.
*
* @param[in] seconds Time in seconds.
* @param[in] round Round the result.
* @return Time in microseconds.
*/
static int64_t SecondsToMicroseconds(double seconds, bool round = false);
/**
* Convert microseconds to time in seconds.
*
* @param[in] microseconds System tick count to convert.
* @return Time in seconds.
*/
static double MicrosecondsToSeconds(int64_t microseconds);
static int64_t Convert(int64_t inValue, int64_t inRate, int64_t outRate, bool round, bool large);
static int64_t Convert(int64_t inValue, int64_t inScale, int64_t inDuration,
int64_t outScale, int64_t outDuration, bool round, bool large);
private:
void SetAJAFrameRatePrivate(AJA_FrameRate ajaFrameRate);
int64_t mFrameTimeScale;
int64_t mFrameDuration;
int64_t mAudioRate;
int64_t mTickRate;
};
#endif

View File

@ -1,219 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file timecode.h
@brief Declares the AJATimeCode class.
@copyright (C) 2010-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_TIMECODE_H
#define AJA_TIMECODE_H
#include "ajabase/common/timebase.h"
/** \class AJATimeCode timecode.h
* \brief Utility class for timecodes.
*
* This is a storage and conversion class for timecodes.
*/
class AJA_EXPORT AJATimeCode
{
public:
AJATimeCode();
AJATimeCode(uint32_t frame);
AJATimeCode(const std::string &str, const AJATimeBase& timeBase, bool bDropFrame, bool bStdTc=false);
AJATimeCode(const std::string &str, const AJATimeBase& timeBase);
AJATimeCode(const AJATimeCode& other);
virtual ~AJATimeCode();
/**
* Query string showing timecode for current frame count given the passed parameters.
*
* @param[out] str string in which to place timecode.
* @param[in] timeBase frame rate from which to calculate string.
* @param[in] bDropFrame drop frame value for string.
*/
void QueryString(std::string &str, const AJATimeBase& timeBase, bool bDropFrame);
void QueryString(char *pString, const AJATimeBase& timeBase, bool bDropFrame); ///< @deprecated Use QueryString(std::string) instead.
/**
* Query SMPTE string showing timecode for current frame count given the passed parameters.
*
* @param[out] pString buffer in which to place string.
* @param[in] timeBase frame rate from which to calculate string.
* @param[in] bDropFrame drop frame value for string.
*/
void QuerySMPTEString(char *pString, const AJATimeBase& timeBase, bool bDropFrame);
/**
* Query SMPTE string byte count.
*
* @return number of bytes in SMPTE timecode string.
*/
static int QuerySMPTEStringSize(void);
/**
* Query frame number.
*
* @return frame number.
*/
uint32_t QueryFrame(void) const;
/**
* Query HFR divide-by-two flag.
*
* @return bStdTc Return true when using standard TC notation for HFR (e.g 01:00:00:59 -> 01:00:00:29*), set to true by default
*/
bool QueryStdTimecodeForHfr() { return m_stdTimecodeForHfr; }
/**
* Query hmsf values showing timecode for current frame count given the passed parameters.
*
* @param[out] h place in which to put hours value.
* @param[out] m place in which to put minutes value.
* @param[out] s place in which to put seconds value.
* @param[out] f place in which to put frames value.
* @param[in] timeBase frame rate from which to calculate string.
* @param[in] bDropFrame drop frame value for string.
*/
void QueryHmsf(uint32_t &h, uint32_t &m, uint32_t &s, uint32_t &f, const AJATimeBase& timeBase, bool bDropFrame) const;
/**
* Set current frame number.
*
* @param[in] frame new frame number.
*/
void Set(uint32_t frame);
/**
* Set current frame number.
*
* @param[in] str xx:xx:xx:xx style string representing new frame number.
* @param[in] timeBase frame rate associated with pString.
*/
void Set(const std::string &str, const AJATimeBase& timeBase);
/**
* Set current frame number. A variant which may have junk in the string.
*
* @param[in] str xx:xx:xx:xx style string representing new frame number.
* @param[in] timeBase frame rate associated with pString.
* @param[in] bDrop true if drop frame
*/
void SetWithCleanup(const std::string &str, const AJATimeBase& timeBase, bool bDrop);
/**
* Set current frame number.
*
* @param[in] str xx:xx:xx:xx style string representing new frame number.
* @param[in] timeBase frame rate associated with pString.
* @param[in] bDropFrame true if forcing dropframe, false otherwise.
*/
void Set(const std::string &str, const AJATimeBase& timeBase, bool bDropFrame);
/**
* Set current frame number.
*
* @param[in] h hours value.
* @param[in] m minutes value.
* @param[in] s seconds value.
* @param[in] f frames value.
* @param[in] timeBase frame rate associated with hmsf.
* @param[in] bDropFrame true if forcing dropframe, false otherwise.
*/
void SetHmsf(uint32_t h, uint32_t m, uint32_t s, uint32_t f, const AJATimeBase& timeBase, bool bDropFrame);
/**
* Set timecode via a SMPTE string.
*
* @param[in] pBufr pointer to string.
* @param[in] timeBase time base associated with string.
*/
void SetSMPTEString(const char *pBufr, const AJATimeBase& timeBase);
/**
* Set timecode via RP188 bytes.
*
* @param[in] inDBB Specifies the DBB bits of the RP188 struct.
* @param[in] inLo Specifies the lo-order 32-bit word of the RP188 struct.
* @param[in] inHi Specifies the hi-order 32-bit word of the RP188 struct.
* @param[in] inTimeBase Specifies the time base to use.
*/
void SetRP188 (const uint32_t inDBB, const uint32_t inLo, const uint32_t inHi, const AJATimeBase & inTimeBase);
/**
* Get RP188 register values using the given timebase, and drop frame.
*
* @param[in] pDbb If non-NULL, points to the variable to receive the DBB component.
* @param[in] pLow If non-NULL, points to the variable to receive the low byte component.
* @param[in] pHigh If non-NULL, points to the variable to receive the high byte component.
* @param[in] timeBase Specifies the AJATimeBase to use.
* @param[in] bDrop Specify true if forcing drop-frame; otherwise false.
* @bug Unimplemented.
* @todo Needs to be implemented.
*/
void QueryRP188(uint32_t *pDbb, uint32_t *pLow, uint32_t *pHigh, const AJATimeBase& timeBase, bool bDrop);
/**
* Get RP188 register values using the given timebase, and drop frame.
*
* @param[out] outDBB Receives the DBB component.
* @param[out] outLo Receives the low byte component.
* @param[out] outHi Receives the high byte component.
* @param[in] timeBase Specifies the AJATimeBase to use.
* @param[in] bDrop Specify true if forcing drop-frame; otherwise false.
* @bug Unimplemented.
* @todo Needs to be implemented.
*/
void QueryRP188(uint32_t & outDBB, uint32_t & outLo, uint32_t & outHi, const AJATimeBase & timeBase, const bool bDrop);
/**
* Set HFR divide-by-two flag.
*
* @param[in] bStdTc Set true when using standard TC notation for HFR (e.g 01:00:00:59 -> 01:00:00:29*), set to true by default
*/
void SetStdTimecodeForHfr(bool bStdTc) {m_stdTimecodeForHfr = bStdTc;}
/**
* Query string showing timecode for current frame count given the passed parameters.
*
* @param[in] str string with timecode
*/
static bool QueryIsDropFrame(const std::string &str);
static int QueryStringSize(void); ///< @deprecated Not needed when using std::string.
/**
* Query if rp188 data is drop frame or not
*
* @param[in] inDBB Specifies the DBB bits of the RP188 struct.
* @param[in] inLo Specifies the lo-order 32-bit word of the RP188 struct.
* @param[in] inHi Specifies the hi-order 32-bit word of the RP188 struct.
*/
static bool QueryIsRP188DropFrame (const uint32_t inDBB, const uint32_t inLo, const uint32_t inHi);
AJATimeCode& operator=(const AJATimeCode &val);
AJATimeCode& operator+=(const AJATimeCode &val);
AJATimeCode& operator-=(const AJATimeCode &val);
AJATimeCode& operator+=(const int32_t val);
AJATimeCode& operator-=(const int32_t val);
const AJATimeCode operator+(const AJATimeCode &val) const;
const AJATimeCode operator+(const int32_t val) const;
const AJATimeCode operator-(const AJATimeCode &val) const;
const AJATimeCode operator-(const int32_t val) const;
bool operator==(const AJATimeCode &val) const;
bool operator<(const AJATimeCode &val) const;
bool operator<(const int32_t val) const;
bool operator>(const AJATimeCode &val) const;
bool operator>(const int32_t val) const;
bool operator!=(const AJATimeCode &val) const;
uint32_t m_frame;
bool m_stdTimecodeForHfr;
protected:
private:
};
#endif // AJA_TIMECODE_H

View File

@ -1,69 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file timecodeburn.h
@brief Declares the AJATimeCodeBurn class.
@copyright (C) 2012-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_TIMECODEBURN_H
#define AJA_TIMECODEBURN_H
#include "public.h"
//#include "ajabase/common/types.h"
#include "ajabase/common/videotypes.h"
/**
* Class to support burning a simple timecode over raster.
* @ingroup AJATimeCodeBurn
*/
class AJATimeCodeBurn
{
public:
AJA_EXPORT AJATimeCodeBurn(void);
AJA_EXPORT virtual ~AJATimeCodeBurn(void);
/**
* Render a small set of characters for timecode ahead of time...This needs to be called before
* BurnTimeCode or BurnTimeCode will fail.
*
* @param[in] pixelFormat Specifies the pixel format of the rendering buffer.
* @param[in] numPixels Specifies the raster bitmap width.
* @param[in] numLines Specifies the raster bitmap height.
*/
AJA_EXPORT bool RenderTimeCodeFont (AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines);
/**
* Burns a timecode in with simple font 00:00:00;00.
*
*
* @param[in] pBaseVideoAddress Base address of Raster
* @param[in] inTimeCodeStr A string containing something like "00:00:00:00"
* @param[in] inYPercent Percent down the screen. If 0, will make it 80.
* @returns True if successful; otherwise false.
*/
AJA_EXPORT bool BurnTimeCode (void * pBaseVideoAddress, const std::string & inTimeCodeStr, const uint32_t inYPercent);
/**
* DEPRECATED: Use std::string version of this function.
*/
AJA_EXPORT bool BurnTimeCode (char * pBaseVideoAddress, const char * pTimeCodeString, const uint32_t percentY);
protected:
void CopyDigit (int digitOffset,char *pFrameBuff);
void writeV210Pixel (char **pBytePtr, int x, int c, int y);
void writeYCbCr10PackedPlanerPixel (char **pBytePtr, int x, int y);
private:
bool _bRendered; // set 'true' when Burn-In character map has been rendered
char * _pCharRenderMap; // ptr to rendered Burn-In character set
AJA_PixelFormat _charRenderPixelFormat; // frame buffer format of rendered characters
int _charRenderHeight; // frame height for which rendered characters were rendered
int _charRenderWidth; // frame width for which rendered characters were rendered
int _charWidthBytes; // rendered character width in bytes
int _charHeightLines; // rendered character height in frame lines
int _charPositionX; // offset (in bytes) from left side of screen to first burn-in character
int _charPositionY; // offset (in lines) from top of screen to top of burn-in characters
int _rowBytes;
};
#endif

View File

@ -1,97 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file timer.h
@brief Declares the AJATimer class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_TIMER_H
#define AJA_TIMER_H
#include "ajabase/common/public.h"
enum AJATimerPrecision
{
AJATimerPrecisionMilliseconds,
AJATimerPrecisionMicroseconds,
AJATimerPrecisionNanoseconds
};
/**
* Class to support timing of events
* @ingroup AJAGroupSystem
*/
class AJA_EXPORT AJATimer
{
public:
AJATimer(AJATimerPrecision precision = AJATimerPrecisionMilliseconds);
virtual ~AJATimer();
/**
* Start the timer.
*/
void Start();
/**
* Stop the timer.
*/
void Stop();
/**
* Reset the timer.
*/
void Reset();
/**
* Get the elapsed time.
*
* If the timer is running, return the elapsed time since Start() was called. If Stop()
* has been called, return the time between Start() and Stop().
*
* @return The elapsed time in selected timer precision units
*/
uint32_t ElapsedTime();
/**
* Check for timeout.
*
* Timeout checks the ElapsedTime() and returns true if it is greater than interval.
*
* @param interval Timeout interval in selected timer precision units.
* @return true if elapsed time greater than interval.
*/
bool Timeout(uint32_t interval);
/**
* Is the timer running.
*
* @return true if timer is running.
*/
bool IsRunning(void);
/**
* Return the timer precision enum.
*
* @return precision enum that was used in the constructor.
*/
AJATimerPrecision Precision(void);
/**
* Return the display string for the given timer precision enum.
*
* @param precision The precision enum to get the display string for.
* @param longName If true the string is set to a long description, otherwise an abbreviation.
* @return string description
*/
static std::string PrecisionName(AJATimerPrecision precision, bool longName = true);
private:
uint64_t mStartTime;
uint64_t mStopTime;
bool mRun;
AJATimerPrecision mPrecision;
};
#endif // AJA_TIMER_H

View File

@ -1,375 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file types.h
@brief Declares common types used in the ajabase library.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_TYPES_H
#define AJA_TYPES_H
#define AJA_USE_CPLUSPLUS11 // If defined, use C++11 features (requires C++11 compiler)
#if defined(AJA_WINDOWS)
#if !defined(NULL)
#define NULL (0)
#endif
#define AJA_PAGE_SIZE (4096)
#define AJA_MAX_PATH (256)
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef signed __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#if defined(_WIN64)
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#define AJA_OS_64
#else
typedef signed __int32 intptr_t;
typedef unsigned __int32 uintptr_t;
#define AJA_OS_32
#endif
#define AJA_LITTLE_ENDIAN
// This adds the ability to format 64-bit entities
#if defined(_MSC_VER) && _MSC_VER >= 1900 // VS2015 or later:
#include <inttypes.h> // Prevent duplicate macro definition warnings
#endif
# define __PRI64_PREFIX "ll"
// Macros for printing format specifiers.
#ifndef PRId64
#define PRId64 __PRI64_PREFIX "d"
#endif
#ifndef PRIi64
#define PRIi64 __PRI64_PREFIX "i"
#endif
#ifndef PRIu64
#define PRIu64 __PRI64_PREFIX "u"
#endif
#ifndef PRIo64
#define PRIo64 __PRI64_PREFIX "o"
#endif
#ifndef PRIx64
#define PRIx64 __PRI64_PREFIX "x"
#endif
// Synonyms for library functions with different names on different platforms
#define ajasnprintf(_str_, _maxbytes_, _format_, ...) _snprintf( _str_, _maxbytes_, _format_, __VA_ARGS__ )
#define ajavsnprintf(_str_, _maxbytes_, _format_, ...) vsprintf_s( _str_, _maxbytes_, _format_, __VA_ARGS__ )
#define ajastrcasecmp(_str1_, _str2_) _stricmp( _str1_, _str2_ )
#define ajawcscasecmp(_str1_, _str2_) _wcsicmp( _str1_, _str2_ )
#endif // defined(AJA_WINDOWS)
#if defined(AJA_LINUX)
#if !defined(NULL)
#define NULL (0)
#endif
#if defined(AJA_USE_CPLUSPLUS11)
#undef AJA_USE_CPLUSPLUS11 // Linux c++11-in-SDK TBD
#endif
#define AJA_PAGE_SIZE (4096)
#define AJA_MAX_PATH (4096)
#if defined(MODULE)
// We're building the code as a kernel module
#include <linux/kernel.h>
#include <linux/string.h> // memset, etc.
#include <linux/version.h>
#if defined(x86_64)
typedef long int intptr_t;
// Not sure which version number should be used here
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18))
typedef unsigned long int uintptr_t;
#endif
#elif !defined(powerpc)
typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif
#else
#include <endian.h>
#include <stdint.h> // Pull in userland defines
#ifdef __x86_64__
#define AJA_OS_64
#else
#define AJA_OS_32
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define AJA_LITTLE_ENDIAN
#else
#define AJA_BIG_ENDIAN
#endif
// This adds the ability to format 64-bit entities
#if CPU_ARCH == x86_64
# define __PRI64_PREFIX "l"
# define __PRIPTR_PREFIX "l"
#else
# define __PRI64_PREFIX "ll"
# define __PRIPTR_PREFIX
#endif
// Macros for printing format specifiers.
#ifndef PRId64
#define PRId64 __PRI64_PREFIX "d"
#endif
#ifndef PRIi64
#define PRIi64 __PRI64_PREFIX "i"
#endif
#ifndef PRIu64
#define PRIu64 __PRI64_PREFIX "u"
#endif
#ifndef PRIo64
#define PRIo64 __PRI64_PREFIX "o"
#endif
#ifndef PRIx64
#define PRIx64 __PRI64_PREFIX "x"
#endif
#endif // MODULE
// Synonyms for library functions with different names on different platforms
#define ajasnprintf(_str_, _maxbytes_, _format_, ...) snprintf( _str_, _maxbytes_, _format_, __VA_ARGS__ )
#define ajavsnprintf(_str_, _maxbytes_, _format_, ...) vsnprintf( _str_, _maxbytes_, _format_, __VA_ARGS__ )
#define ajastrcasecmp(_str1_, _str2_) strcasecmp( _str1_, _str2_ )
#define ajawcscasecmp(_str1_, _str2_) wcscasecmp( _str1_, _str2_ )
#endif // defined(AJA_LINUX)
// NOTE:
// In order to get universal binaries compiling need to add the following defines
// to the project that uses this file.
// PER_ARCH_CFLAGS_i386 = -Dx86=1
// PER_ARCH_CFLAGS_x86_64 = -Dx86_64=1
// see: http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/64bitPorting/building/building.html
#if defined(AJA_MAC)
#define AJA_PAGE_SIZE (4096)
#define AJA_MAX_PATH (1024)
#define AJA_LITTLE_ENDIAN
#include <stdint.h>
#ifdef __LP64__
#define AJA_OS_64
#else
#define AJA_OS_32
#endif
// This adds the ability to format 64-bit entities
#ifdef x86_64
# define __PRI64_PREFIX "l"
# define __PRIPTR_PREFIX "l"
#else
# define __PRI64_PREFIX "ll"
# define __PRIPTR_PREFIX
#endif
// Macros for printing format specifiers.
#ifndef PRId64
#define PRId64 __PRI64_PREFIX "d"
#endif
#ifndef PRIi64
#define PRIi64 __PRI64_PREFIX "i"
#endif
#ifndef PRIu64
#define PRIu64 __PRI64_PREFIX "u"
#endif
#ifndef PRIo64
#define PRIo64 __PRI64_PREFIX "o"
#endif
#ifndef PRIx64
#define PRIx64 __PRI64_PREFIX "x"
#endif
// Synonyms for library functions with different names on different platforms
#define ajasnprintf(_str_, _maxbytes_, _format_, ...) snprintf( _str_, _maxbytes_, _format_, __VA_ARGS__ )
#define ajavsnprintf(_str_, _maxbytes_, _format_, ...) vsnprintf( _str_, _maxbytes_, _format_, __VA_ARGS__ )
#define ajastrcasecmp(_str1_, _str2_) strcasecmp( _str1_, _str2_ )
#define ajawcscasecmp(_str1_, _str2_) wcscasecmp( _str1_, _str2_ )
#ifndef EXCLUDE_WCHAR
#include <wchar.h>
inline wchar_t wcstoupper(wchar_t c)
{
// probably needs to be more robust
wchar_t newChar = c;
if (c >= (wchar_t)L'a' && c <= (wchar_t)L'z')
newChar = c - (L'a' - L'A');
return newChar;
}
inline int wcscasecmp(const wchar_t *string1,const wchar_t *string2)
{
int retVal = 0;
int str1Len = (int)wcslen(string1);
int str2Len = (int)wcslen(string2);
if(str1Len > str2Len)
retVal = 1;
else if(str1Len < str2Len)
retVal = -1;
else //same length
{
bool match = true;
for(int i=0;i<str1Len;i++)
{
if(wcstoupper(string1[i]) != wcstoupper(string2[i]))
{
match = false;
break;
}
}
if(!match)
retVal = -1; //or could be 1 not sure which is best
}
return retVal;
}
#endif
#endif // defined(AJA_MAC)
#if !defined(NULL_PTR)
#define NULL_PTR (0)
#endif
/**
* Macro to define a FourCC. Example: AJA_FCC("dvc ")
*/
#if defined(AJA_LITTLE_ENDIAN)
#define AJA_FCC(a) \
( ((uint32_t)(((uint8_t *)(a))[3]) << 0) + \
((uint32_t)(((uint8_t *)(a))[2]) << 8) + \
((uint32_t)(((uint8_t *)(a))[1]) << 16) + \
((uint32_t)(((uint8_t *)(a))[0]) << 24) )
#else
#define AJA_FCC(a) \
( ((uint32_t)(((uint8_t *)(a))[0]) << 0) + \
((uint32_t)(((uint8_t *)(a))[1]) << 8) + \
((uint32_t)(((uint8_t *)(a))[2]) << 16) + \
((uint32_t)(((uint8_t *)(a))[3]) << 24) )
#endif
/**
* Macro to define a FourCC. Example: AJA_FOURCC('d','v','c',' ')
* AJA_FOURCC_2(0x24)
*/
#if defined(AJA_LITTLE_ENDIAN)
#define AJA_FOURCC(a,b,c,d) \
( (((uint32_t)(a)) << 24) + \
(((uint32_t)(b)) << 16) + \
(((uint32_t)(c)) << 8) + \
(((uint32_t)(d)) << 0) )
#else
#define AJA_FOURCC(a,b,c,d) \
( (((uint32_t)(a)) << 0) + \
(((uint32_t)(b)) << 8) + \
(((uint32_t)(c)) << 16) + \
(((uint32_t)(d)) << 24) )
#endif
#define AJA_FOURCC_2(a) (AJA_FOURCC(a,0,0,0))
/**
* Standard api return code
*/
#define AJA_SUCCESS(_status_) (_status_ >= 0)
#define AJA_FAILURE(_status_) (_status_ < 0)
/**
@defgroup AJAGroupStatus AJA_STATUS
Defines return code status. Successful return codes are greater than 0.
**/
///@{
typedef enum
{
AJA_STATUS_TRUE = 1, /**< Result was true */
AJA_STATUS_SUCCESS = 0, /**< Function succeeded */
AJA_STATUS_FAIL =-1, /**< Function failed */
AJA_STATUS_UNKNOWN =-2, /**< Unknown status */
AJA_STATUS_TIMEOUT =-3, /**< A wait timed out */
AJA_STATUS_RANGE =-4, /**< A parameter was out of range */
AJA_STATUS_INITIALIZE =-5, /**< The object has not been initialized */
AJA_STATUS_NULL =-6, /**< A pointer parameter was NULL */
AJA_STATUS_OPEN =-7, /**< Something failed to open */
AJA_STATUS_IO =-8, /**< An IO operation failed */
AJA_STATUS_DISABLED =-9, /**< Device is disabled */
AJA_STATUS_BUSY =-10, /**< Device is busy */
AJA_STATUS_BAD_PARAM =-11, /**< Bad parameter value */
AJA_STATUS_FEATURE =-12, /**< A required device feature does not exist */
AJA_STATUS_UNSUPPORTED =-13, /**< Parameters are valid but not supported */
AJA_STATUS_READONLY =-14, /**< Write is not supported */
AJA_STATUS_WRITEONLY =-15, /**< Read is not supported */
AJA_STATUS_MEMORY =-16, /**< Memory allocation failed */
AJA_STATUS_ALIGN =-17, /**< Parameter not properly aligned */
AJA_STATUS_FLUSH =-18, /**< Something has been flushed */
AJA_STATUS_NOINPUT =-19, /**< No input detected */
AJA_STATUS_SURPRISE_REMOVAL =-20, /**< Hardware communication failed */
AJA_STATUS_NOT_FOUND =-21, /**< Something wasn't found */
// Sequence errors
AJA_STATUS_NOBUFFER =-100, /**< No free buffers, all are scheduled or in use */
AJA_STATUS_INVALID_TIME =-101, /**< Invalid schedule time */
AJA_STATUS_NOSTREAM =-102, /**< No stream found */
AJA_STATUS_TIMEEXPIRED =-103, /**< Scheduled time is too late */
AJA_STATUS_BADBUFFERCOUNT =-104, /**< Buffer count out of bounds */
AJA_STATUS_BADBUFFERSIZE =-105, /**< Buffer size out of bounds */
AJA_STATUS_STREAMCONFLICT =-106, /**< Another stream is using resources */
AJA_STATUS_NOTINITIALIZED =-107, /**< Streams not initialized */
AJA_STATUS_STREAMRUNNING =-108, /**< Streams is running, should be stopped */
// Other
AJA_STATUS_REBOOT = -109, /**< Device requires reboot */
AJA_STATUS_POWER_CYCLE = -110 /**< Device requires a machine power-cycle */
} AJAStatus;
///@}
// Use to silence "unused parameter" warnings
#define AJA_UNUSED(_x_) (void)_x_;
#define AJA_CHECK_NULL(_ptr_, _res_) { if (__ptr__ == NULL) { return _res_; } }
#define AJA_RETURN_STATUS(_status_) { const AJAStatus s = _status_; if (s != AJA_STATUS_SUCCESS) { return s; } }
#ifndef NUMELMS
#define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
#endif
#define AJA_ENDIAN_SWAP16(_data_) ( ((uint16_t(_data_) << 8) & uint16_t(0xff00)) | \
((uint16_t(_data_) >> 8) & uint16_t(0x00ff)) )
#define AJA_ENDIAN_SWAP32(_data_) ( ((uint32_t(_data_) << 24) & uint32_t(0xff000000)) | \
((uint32_t(_data_) << 8) & uint32_t(0x00ff0000)) | \
((uint32_t(_data_) >> 8) & uint32_t(0x0000ff00)) | \
((uint32_t(_data_) >> 24) & uint32_t(0x000000ff)) )
#define AJA_ENDIAN_SWAP64(_data_) ( ((uint64_t(_data_) << 56) & uint64_t(0xff00000000000000)) | \
((uint64_t(_data_) << 40) & uint64_t(0x00ff000000000000)) | \
((uint64_t(_data_) << 24) & uint64_t(0x0000ff0000000000)) | \
((uint64_t(_data_) << 8) & uint64_t(0x000000ff00000000)) | \
((uint64_t(_data_) >> 8) & uint64_t(0x00000000ff000000)) | \
((uint64_t(_data_) >> 24) & uint64_t(0x0000000000ff0000)) | \
((uint64_t(_data_) >> 40) & uint64_t(0x000000000000ff00)) | \
((uint64_t(_data_) >> 56) & uint64_t(0x00000000000000ff)) )
#endif // AJA_TYPES_H

View File

@ -1,286 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file videotypes.h
@brief Declares the enumeration constants used in the ajabase library.
@copyright (C) 2010-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_VIDEODEFINES
#define AJA_VIDEODEFINES
enum AJA_VideoFormat
{
AJA_VideoFormat_Unknown, // 0
AJA_VideoFormat_525i_2997, // 1 525
AJA_VideoFormat_525p_5994,
AJA_VideoFormat_525i_2398,
AJA_VideoFormat_525_2400,
AJA_VideoFormat_525psf_2997,
AJA_VideoFormat_625psf_2500, // 6 625
AJA_VideoFormat_625i_2500,
AJA_VideoFormat_720p_2398, // 8 HD - 720
AJA_VideoFormat_720p_2400,
AJA_VideoFormat_720p_2500,
AJA_VideoFormat_720p_2997,
AJA_VideoFormat_720p_3000,
AJA_VideoFormat_720p_5000,
AJA_VideoFormat_720p_5994,
AJA_VideoFormat_720p_6000,
AJA_VideoFormat_1080i_2500, // 16 HD 1080i
AJA_VideoFormat_1080i_2997,
AJA_VideoFormat_1080i_3000,
AJA_VideoFormat_1080psf_2398, // 19 HD 1080psf
AJA_VideoFormat_1080psf_2400,
AJA_VideoFormat_1080psf_2500,
AJA_VideoFormat_1080psf_2997,
AJA_VideoFormat_1080psf_3000,
AJA_VideoFormat_1080p_2398, // 24 HD 1080p
AJA_VideoFormat_1080p_2400,
AJA_VideoFormat_1080p_2500,
AJA_VideoFormat_1080p_2997,
AJA_VideoFormat_1080p_3000,
AJA_VideoFormat_1080p_5000,
AJA_VideoFormat_1080p_5994,
AJA_VideoFormat_1080p_6000,
AJA_VideoFormat_2K_1080psf_2398, // 32 2Kx1080psf
AJA_VideoFormat_2K_1080psf_2400,
AJA_VideoFormat_2K_1080psf_2500,
AJA_VideoFormat_2K_1080psf_2997,
AJA_VideoFormat_2K_1080psf_3000,
AJA_VideoFormat_2K_1080p_2398, // 37 2Kx1080p
AJA_VideoFormat_2K_1080p_2400,
AJA_VideoFormat_2K_1080p_2500,
AJA_VideoFormat_2K_1080p_2997,
AJA_VideoFormat_2K_1080p_3000,
AJA_VideoFormat_2K_1080p_4795,
AJA_VideoFormat_2K_1080p_4800,
AJA_VideoFormat_2K_1080p_5000,
AJA_VideoFormat_2K_1080p_5994,
AJA_VideoFormat_2K_1080p_6000,
AJA_VideoFormat_2K_1556psf_1498, //2Kx1556
AJA_VideoFormat_2K_1556psf_1500,
AJA_VideoFormat_2K_1556psf_2398,
AJA_VideoFormat_2K_1556psf_2400,
AJA_VideoFormat_2K_1556psf_2500,
AJA_VideoFormat_2K_1556psf_2997,
AJA_VideoFormat_2K_1556psf_3000,
AJA_VideoFormat_Quad_1080psf_2398, // 54 UltaHD
AJA_VideoFormat_Quad_1080psf_2400,
AJA_VideoFormat_Quad_1080psf_2500,
AJA_VideoFormat_Quad_1080psf_2997,
AJA_VideoFormat_Quad_1080psf_3000,
AJA_VideoFormat_Quad_1080p_2398, // 59
AJA_VideoFormat_Quad_1080p_2400,
AJA_VideoFormat_Quad_1080p_2500,
AJA_VideoFormat_Quad_1080p_2997,
AJA_VideoFormat_Quad_1080p_3000,
AJA_VideoFormat_Quad_1080p_5000,
AJA_VideoFormat_Quad_1080p_5994,
AJA_VideoFormat_Quad_1080p_6000,
AJA_VideoFormat_4K_1080psf_2398, // 67 4K
AJA_VideoFormat_4K_1080psf_2400,
AJA_VideoFormat_4K_1080psf_2500,
AJA_VideoFormat_4K_1080psf_2997,
AJA_VideoFormat_4K_1080psf_3000,
AJA_VideoFormat_4K_1080p_2398,
AJA_VideoFormat_4K_1080p_2400,
AJA_VideoFormat_4K_1080p_2500,
AJA_VideoFormat_4K_1080p_2997,
AJA_VideoFormat_4K_1080p_3000,
AJA_VideoFormat_4K_1080p_4795,
AJA_VideoFormat_4K_1080p_4800,
AJA_VideoFormat_4K_1080p_5000,
AJA_VideoFormat_4K_1080p_5994,
AJA_VideoFormat_4K_1080p_6000,
// UHD2 (8K)
AJA_VideoFormat_4x3840x2160p_2398,
AJA_VideoFormat_4x3840x2160p_2400,
AJA_VideoFormat_4x3840x2160p_2500,
AJA_VideoFormat_4x3840x2160p_2997,
AJA_VideoFormat_4x3840x2160p_3000,
AJA_VideoFormat_4x3840x2160p_5000,
AJA_VideoFormat_4x3840x2160p_5994,
AJA_VideoFormat_4x3840x2160p_6000,
// UHD2 (8K)
AJA_VideoFormat_4x4096x2160p_2398,
AJA_VideoFormat_4x4096x2160p_2400,
AJA_VideoFormat_4x4096x2160p_2500,
AJA_VideoFormat_4x4096x2160p_2997,
AJA_VideoFormat_4x4096x2160p_3000,
AJA_VideoFormat_4x4096x2160p_4795,
AJA_VideoFormat_4x4096x2160p_4800,
AJA_VideoFormat_4x4096x2160p_5000,
AJA_VideoFormat_4x4096x2160p_5994,
AJA_VideoFormat_4x4096x2160p_6000,
AJA_VideoFormat_Size
};
enum AJA_PixelFormat
{
AJA_PixelFormat_Unknown,
AJA_PixelFormat_YCbCr10, /**< Pixel format YCbCr 10 bit */
AJA_PixelFormat_YCbCr8, /**< Pixel format YCbCr 8 bit */
AJA_PixelFormat_ARGB8, /**< Pixel format ARGB 8 bit */
AJA_PixelFormat_RGBA8, /**< Pixel format RGBA 8 bit */
AJA_PixelFormat_RGB10, /**< Pixel format RGB 10 bit */
AJA_PixelFormat_YUY28, /**< Pixel format YUY2 8 bit */
AJA_PixelFormat_ABGR8, /**< Pixel format ABGR 8 bit */
AJA_PixelFormat_RGB_DPX, /**< Pixel format RGB DPX */
AJA_PixelFormat_YCbCr_DPX, /**< Pixel format YCrCb DPX */
AJA_PixelFormat_DVCPRO, /**< Pixel format DVCPRO */
AJA_PixelFormat_QREZ, /**< Pixel format QREZ */
AJA_PixelFormat_HDV, /**< Pixel format HDV */
AJA_PixelFormat_RGB8_PACK, /**< Pixel format RGB 8 bit packed */
AJA_PixelFormat_BGR8_PACK, /**< Pixel format BGR 8 bit packed */
AJA_PixelFormat_YCbCrA10, /**< Pixel format YCbCrA 10 bit */
AJA_PixelFormat_RGB_DPX_LE, /**< Pixel format RGB DPX little endian */
AJA_PixelFormat_RGB12, /**< Pixel format RGB 12 bit */
AJA_PixelFormat_RGB12P, /**< Pixel format RGB 12 bit packed */
AJA_PixelFormat_PRORES_DVPRO, /**< Pixel format PRORES DVPRO */
AJA_PixelFormat_PRORES_HDV, /**< Pixel format PRORES HDV */
AJA_PixelFormat_RGB10_PACK, /**< Pixel format RGB 10 bit packed */
AJA_PixelFormat_YCbCr12_444, /**< Pixel format YCrCb 12 bit 444 */
AJA_PixelFormat_YCbCr12_422, /**< Pixel format YCbCr 12 bit 422 */
AJA_PixelFormat_RGB16, /**< Pixel format RGB 16 bit */
AJA_PixelFormat_YCbCr10_4K_RQ, /**< Pixel format YCbCr 10 bit 4K right quadrant */
AJA_PixelFormat_BAYER10_DPX_LJ, /**< Pixel format Bayer 10 bit DPX Left Justified */
AJA_PixelFormat_BAYER12_DPX_LJ, /**< Pixel format Bayer 12 bit DPX Left Justified */
AJA_PixelFormat_BAYER10_HS, /**< Pixel format Bayer 10 bit */
AJA_PixelFormat_BAYER12_HS, /**< Pixel format Bayer 12 bit */
AJA_PixelFormat_BAYER12_PACK_HS, /**< Pixel format Bayer 12 bit packed */
AJA_PixelFormat_RAW10, /**< Pixel format RAW 10 bit fully packed */
AJA_PixelFormat_RAW10_HS, /**< Pixel format RAW 10 bit fully packed, high speed */
AJA_PixelFormat_YCBCR10_420PL, /**< Pixel format YCbCr 10 bit 420 packed planer */
AJA_PixelFormat_YCBCR10_422PL, /**< Pixel format YCbCr 10 bit 422 packed planer */
AJA_PixelFormat_YCBCR8_420PL, /**< Pixel format YCbCr 8 bit 420 packed planer */
AJA_PixelFormat_YCBCR8_422PL, /**< Pixel format YCbCr 8 bit 422 packed planer */
AJA_PixelFormat_YCBCR8_420PL3, /**< Pixel format YCbCr 8 bit 420 planar */
AJA_PixelFormat_YCBCR8_422PL3, /**< Pixel format YCbCr 8 bit 422 planar */
AJA_PixelFormat_YCBCR10_420PL3LE, /**< Pixel format YCbCr 10 bit 420 little-endian planar */
AJA_PixelFormat_YCBCR10_422PL3LE, /**< Pixel format YCbCr 10 bit 422 little-endian planar */
/// SMPTE 2022-6/211/OpenCL related....not actually pixel formats on any board...
AJA_PixelFormat_S0226_720p50,
AJA_PixelFormat_S0226_720p60,
AJA_PixelFormat_S0226_1080i30,
AJA_PixelFormat_S0226_1080i25,
AJA_PixelFormat_S0226_1080p30,
AJA_PixelFormat_S0226_1080p25,
AJA_PixelFormat_S0226_1080p24,
AJA_PixelFormat_S0226_525i30,
AJA_PixelFormat_S0226_625i25,
AJA_PixelFormat_RFC4175_720p,
AJA_PixelFormat_RFC4175_1080i,
AJA_PixelFormat_RFC4175_1080p,
AJA_PixelFormat_RFC4175_525i30,
AJA_PixelFormat_RFC4175_625i25,
AJA_PixelFormat_RFC4175_2160p,
AJA_PixelFormat_RGB10_3DLUT,
AJA_PixelFormat_Size
};
enum AJA_BayerColorPhase
{
AJA_BayerColorPhase_Unknown,
AJA_BayerColorPhase_RedGreen,
AJA_BayerColorPhase_GreenRed,
AJA_BayerColorPhase_BlueGreen,
AJA_BayerColorPhase_GreenBlue,
AJA_BayerColorPhase_Size
};
enum AJA_FrameRate
{
AJA_FrameRate_Unknown,
AJA_FrameRate_1498,
AJA_FrameRate_1500,
AJA_FrameRate_1798,
AJA_FrameRate_1800,
AJA_FrameRate_1898,
AJA_FrameRate_1900,
AJA_FrameRate_2398,
AJA_FrameRate_2400,
AJA_FrameRate_2500,
AJA_FrameRate_2997,
AJA_FrameRate_3000,
AJA_FrameRate_4795,
AJA_FrameRate_4800,
AJA_FrameRate_5000,
AJA_FrameRate_5994,
AJA_FrameRate_6000,
AJA_FrameRate_10000,
AJA_FrameRate_11988,
AJA_FrameRate_12000,
AJA_FrameRate_Size
};
enum AJA_VideoConversion
{
AJA_VideoConversion_Unknown,
AJA_VideoConversion_1080i_5994to525_5994,
AJA_VideoConversion_1080i_2500to625_2500,
AJA_VideoConversion_720p_5994to525_5994,
AJA_VideoConversion_720p_5000to625_2500,
AJA_VideoConversion_525_5994to1080i_5994,
AJA_VideoConversion_525_5994to720p_5994,
AJA_VideoConversion_625_2500to1080i_2500,
AJA_VideoConversion_625_2500to720p_5000,
AJA_VideoConversion_720p_5000to1080i_2500,
AJA_VideoConversion_720p_5994to1080i_5994,
AJA_VideoConversion_720p_6000to1080i_3000,
AJA_VideoConversion_1080i2398to525_2398,
AJA_VideoConversion_1080i2398to525_2997,
AJA_VideoConversion_1080i_2500to720p_5000,
AJA_VideoConversion_1080i_5994to720p_5994,
AJA_VideoConversion_1080i_3000to720p_6000,
AJA_VideoConversion_1080i_2398to720p_2398,
AJA_VideoConversion_720p_2398to1080i_2398,
AJA_VideoConversion_525_2398to1080i_2398,
AJA_VideoConversion_525_5994to525_5994,
AJA_VideoConversion_625_2500to625_2500,
AJA_VideoConversion_525_5994to525psf_2997,
AJA_VideoConversion_625_5000to625psf_2500,
AJA_VideoConversion_1080i_5000to1080psf_2500,
AJA_VideoConversion_1080i_5994to1080psf_2997,
AJA_VideoConversion_1080i_6000to1080psf_3000,
AJA_VideoConversion_Size
};
enum AJA_HdrColorimetry // compare R2HdrColorimetry
{
AJA_HdrColor_Auto,
AJA_HdrColor_SDR,
AJA_HdrColor_P3,
AJA_HdrColor_2020,
AJA_HdrColor_Custom
};
enum AJA_HdrTransfer // compare R2HdrTransfer
{
AJA_HdrTrans_Auto,
AJA_HdrTrans_SDR,
AJA_HdrTrans_HLG,
AJA_HdrTrans_PQ,
};
enum AJA_HdrLuminance // compare R2HdrLuminance
{
AJA_Luminance_Auto,
AJA_Luminance_YCbCr,
AJA_Luminance_ICtCp
};
#endif // AJA_VIDEODEFINES

View File

@ -1,381 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file videoutilities.h
@brief Declares the ajabase library's video utility functions.
@copyright (C) 2010-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_VIDEOUTILS_H
#define AJA_VIDEOUTILS_H
#include "public.h"
#include "videotypes.h"
#define DEFAULT_PATT_GAIN 0.9 // some patterns pay attention to this...
#define HD_NUMCOMPONENTPIXELS_2K 2048
#define HD_NUMCOMPONENTPIXELS_1080_2K 2048
#define HD_NUMCOMPONENTPIXELS_1080 1920
#define CCIR601_10BIT_BLACK 64
#define CCIR601_10BIT_WHITE 940
#define CCIR601_10BIT_CHROMAOFFSET 512
#define CCIR601_8BIT_BLACK 16
#define CCIR601_8BIT_WHITE 235
#define CCIR601_8BIT_CHROMAOFFSET 128
#define MIN_RGB_8BIT 0
#define MAX_RGB_8BIT 255
#define MIN_RGB_10BIT 0
#define MAX_RGB_10BIT 1023
#define MIN_RGB_16BIT 0
#define MAX_RGB_16BIT 65535
// line pitch is in bytes.
#define FRAME_0_BASE (0x0)
#define FRAME_1080_10BIT_LINEPITCH (1280*4)
#define FRAME_1080_8BIT_LINEPITCH (1920*2)
#define FRAME_QUADHD_10BIT_SIZE (FRAME_1080_10BIT_LINEPITCH*2160)
#define FRAME_QUADHD_8BIT_SIZE (FRAME_1080_8BIT_LINEPITCH*2160)
#define FRAME_BASE(__frameNum__,__frameSize__) ((__frameNum__)*(__frameSize__))
// NOTE: Changed the "(__x__) < MIN_RGB_nBIT" comparisons to "(__x__) <= MIN_RGB_nBIT"
// in the following three macros to eliminate gcc "comparison always true" warnings
// when __x__ is an unsigned value.
#if !defined(ClipRGB_8BIT)
#define ClipRGB_8BIT(__x__) ((__x__) > MAX_RGB_8BIT ? (MAX_RGB_8BIT) \
: ((__x__) <= MIN_RGB_8BIT ? (MIN_RGB_8BIT) \
: (__x__)))
#endif
#if !defined(ClipRGB_10BIT)
#define ClipRGB_10BIT(__x__) ((__x__) > MAX_RGB_10BIT ? (MAX_RGB_10BIT) \
: ((__x__) <= MIN_RGB_10BIT ? (MIN_RGB_10BIT) \
: (__x__)))
#endif
#define MIN_YCBCR_10BIT 4
#define MAX_YCBCR_10BIT 1019
#define ClipYCbCr_10BIT(X) ((X) > MAX_YCBCR_10BIT ? (MAX_YCBCR_10BIT) : ((X) < MIN_YCBCR_10BIT ? (MIN_YCBCR_10BIT) : (X)))
typedef enum {
AJA_SIGNALMASK_NONE=0, // Output Black.
AJA_SIGNALMASK_Y=1 , // Output Y if set, else Output Y=0x40
AJA_SIGNALMASK_Cb=2 , // Output Cb if set, elso Output Cb to 0x200
AJA_SIGNALMASK_Cr=4 , // Output Cr if set, elso Output Cr to 0x200
AJA_SIGNALMASK_ALL=1+2+4 // Output Cr if set, elso Output Cr to 0x200
} AJASignalMask;
typedef struct {
uint8_t Blue;
uint8_t Green;
uint8_t Red;
uint8_t Alpha;
} AJA_RGBAlphaPixel;
typedef struct {
uint8_t Alpha;
uint8_t Red;
uint8_t Green;
uint8_t Blue;
} AJA_AlphaRGBPixel;
typedef struct {
uint16_t Blue;
uint16_t Green;
uint16_t Red;
uint16_t Alpha;
} AJA_RGBAlpha10BitPixel;
typedef struct {
uint16_t Blue;
uint16_t Green;
uint16_t Red;
uint16_t Alpha;
} AJA_RGBAlpha16BitPixel;
typedef struct
{
uint16_t Alpha;
uint16_t cb;
uint16_t y;
uint16_t cr;
} AJA_YCbCr10BitAlphaPixel;
typedef struct
{
uint16_t cb;
uint16_t y;
uint16_t cr;
} AJA_YCbCr10BitPixel;
void AJA_EXPORT createVideoFrame( uint32_t *buffer , uint64_t frameNumber, AJA_PixelFormat pixFmt, uint32_t lines, uint32_t pixels, uint32_t linepitch, uint16_t y, uint16_t cb, uint16_t cr );
uint32_t AJA_EXPORT AJA_CalcRowBytesForFormat(AJA_PixelFormat format, uint32_t width);
void AJA_EXPORT AJA_UnPack10BitYCbCrBuffer(uint32_t* packedBuffer, uint16_t* ycbcrBuffer, uint32_t numPixels);
void AJA_EXPORT AJA_PackTo10BitYCbCrBuffer(uint16_t *ycbcrBuffer, uint32_t *packedBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_PackTo10BitYCbCrDPXBuffer( uint16_t *ycbcrBuffer, uint32_t *packedBuffer,uint32_t numPixels ,bool bigEndian = true);
void AJA_EXPORT AJA_PackRGB10BitFor10BitRGB(AJA_RGBAlpha10BitPixel* rgba10BitBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_PackRGB10BitFor10BitRGBPacked(AJA_RGBAlpha10BitPixel* rgba10BitBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_PackRGB10BitFor10BitDPX(AJA_RGBAlpha10BitPixel* rgba10BitBuffer,uint32_t numPixels, bool bigEndian=true);
void AJA_EXPORT AJA_UnPack10BitDPXtoRGBAlpha10BitPixel(AJA_RGBAlpha10BitPixel* rgba10BitBuffer,uint32_t* DPXLinebuffer ,uint32_t numPixels, bool bigEndian=true);
void AJA_EXPORT AJA_UnPack10BitDPXtoRGBAlphaBitPixel(uint8_t* rgbaBuffer,uint32_t* DPXLinebuffer ,uint32_t numPixels, bool bigEndian=true);
void AJA_EXPORT AJA_RePackLineDataForYCbCrDPX(uint32_t *packedycbcrLine, uint32_t numULWords);
void AJA_EXPORT AJA_MakeUnPacked8BitYCbCrBuffer( uint8_t* buffer, uint8_t Y , uint8_t Cb , uint8_t Cr,uint32_t numPixels );
void AJA_EXPORT AJA_MakeUnPacked10BitYCbCrBuffer(uint16_t* buffer, uint16_t Y , uint16_t Cb , uint16_t Cr,uint32_t numPixels);
void AJA_EXPORT AJA_ConvertLineto8BitYCbCr(uint16_t * ycbcr10BitBuffer, uint8_t * ycbcr8BitBuffer, uint32_t numPixels);
void AJA_EXPORT AJA_ConvertLineToYCbCr422(AJA_RGBAlphaPixel * RGBLine, uint16_t* YCbCrLine, int32_t numPixels , int32_t startPixel, bool fUseSDMatrix);
void AJA_EXPORT AJA_ConvertLineto10BitRGB(uint16_t * ycbcrBuffer, AJA_RGBAlpha10BitPixel * rgbaBuffer,uint32_t numPixels,bool fUseSDMatrix);
void AJA_EXPORT AJA_ConvertLinetoRGB(uint8_t * ycbcrBuffer, AJA_RGBAlphaPixel * rgbaBuffer, uint32_t numPixels, bool fUseSDMatrix);
void AJA_EXPORT AJA_ConvertLinetoRGB(uint16_t * ycbcrBuffer, AJA_RGBAlphaPixel * rgbaBuffer, uint32_t numPixels, bool fUseSDMatrix);
void AJA_EXPORT AJA_ConvertLineto16BitRGB(uint16_t * ycbcrBuffer, AJA_RGBAlpha16BitPixel * rgbaBuffer, uint32_t numPixels, bool fUseSDMatrix);
void AJA_EXPORT AJA_Convert16BitRGBtoBayer10BitDPXLJ(AJA_RGBAlpha16BitPixel * rgbaBuffer, uint32_t * bayerBuffer,
uint32_t numPixels, uint32_t line, AJA_BayerColorPhase phase = AJA_BayerColorPhase_RedGreen);
void AJA_EXPORT AJA_Convert16BitRGBtoBayer12BitDPXLJ(AJA_RGBAlpha16BitPixel * rgbaBuffer, uint32_t * bayerBuffer,
uint32_t numPixels, uint32_t line, AJA_BayerColorPhase phase = AJA_BayerColorPhase_RedGreen);
void AJA_EXPORT AJA_Convert16BitRGBtoBayer10BitDPXPacked(AJA_RGBAlpha16BitPixel * rgbaBuffer, uint8_t * bayerBuffer,
uint32_t numPixels, uint32_t line, AJA_BayerColorPhase phase = AJA_BayerColorPhase_RedGreen);
void AJA_EXPORT AJA_Convert16BitRGBtoBayer12BitDPXPacked(AJA_RGBAlpha16BitPixel * rgbaBuffer, uint8_t * bayerBuffer,
uint32_t numPixels, uint32_t line, AJA_BayerColorPhase phase = AJA_BayerColorPhase_RedGreen);
void AJA_EXPORT AJA_ConvertARGBToRGBA(uint8_t* rgbaBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_ConvertARGBToABGR(uint8_t* rgbaBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_ConvertARGBToRGB(uint8_t* rgbaBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_ConvertARGBToBGR(uint8_t* rgbaBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_Convert16BitARGBTo16BitRGB(AJA_RGBAlpha16BitPixel *rgbaLineBuffer ,uint16_t * rgbLineBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_Convert16BitARGBTo12BitRGBPacked(AJA_RGBAlpha16BitPixel *rgbaLineBuffer ,uint8_t * rgbLineBuffer,uint32_t numPixels);
void AJA_EXPORT AJA_Convert8BitYCbCrToYUY2(uint8_t * ycbcrBuffer, uint32_t numPixels);
void AJA_EXPORT AJA_ConvertUnpacked10BitYCbCrToPixelFormat(uint16_t *unPackedBuffer, uint32_t *packedBuffer, uint32_t numPixels, AJA_PixelFormat pixelFormat);
void AJA_EXPORT AJA_ConvertPixelFormatToRGBA(uint32_t *buffer, AJA_RGBAlphaPixel* rgbBuffer, uint32_t numPixels, AJA_PixelFormat pixelFormat,bool bIsSD = false);
void AJA_EXPORT AJA_MaskUnPacked10BitYCbCrBuffer(uint16_t* ycbcrUnPackedBuffer, uint16_t signalMask , uint32_t numPixels);
void AJA_EXPORT AJA_ReSampleLine(AJA_RGBAlphaPixel *Input, AJA_RGBAlphaPixel *Output, uint16_t startPixel, uint16_t endPixel, int32_t numInputPixels, int32_t numOutputPixels);
void AJA_EXPORT AJA_ReSampleLine(int16_t *Input, int16_t *Output, uint16_t startPixel, uint16_t endPixel, int32_t numInputPixels, int32_t numOutputPixels);
void AJA_EXPORT AJA_ReSampleYCbCrSampleLine(int16_t *Input, int16_t *Output, int32_t numInputPixels, int32_t numOutputPixels);
void AJA_EXPORT AJA_ReSampleAudio(int16_t *Input, int16_t *Output, uint16_t startPixel, uint16_t endPixel, int32_t numInputPixels, int32_t numOutputPixels, int16_t channelInterleaveMulitplier=1);
void AJA_EXPORT WriteLineToBuffer(AJA_PixelFormat pixelFormat, uint32_t currentLine, uint32_t numPixels, uint32_t linePitch,
uint8_t* pOutputBuffer,uint32_t* pPackedLineBuffer);
void AJA_EXPORT WriteLineToBuffer(AJA_PixelFormat pixelFormat, AJA_BayerColorPhase bayerPhase, uint32_t currentLine,
uint32_t numPixels, uint32_t linePitch, uint8_t* pOutputBuffer,uint32_t* pPackedLineBuffer);
void AJA_EXPORT AJA_ConvertRGBAlpha10LineToYCbCr422(AJA_RGBAlpha10BitPixel * RGBLine,
uint16_t* YCbCrLine,
int32_t numPixels ,
int32_t startPixel,
bool fUseRGBFullRange=false);
inline int16_t AJA_FixedRound(int32_t inFix)
{
int16_t retValue;
if ( inFix < 0 )
{
retValue = (int16_t)(-((-inFix+0x8000)>>16));
}
else
{
retValue = (int16_t)((inFix + 0x8000)>>16);
}
return retValue;
}
inline void AJA_SDConvert10BitYCbCrto10BitRGB(AJA_YCbCr10BitAlphaPixel *pSource,
AJA_RGBAlpha10BitPixel *pTarget)
{
int32_t Red,Green,Blue;
int32_t ConvertedY;
ConvertedY = 0x12A15*((int32_t)pSource->y - CCIR601_10BIT_BLACK);
Red = AJA_FixedRound(ConvertedY +
0x19895*((int32_t)(pSource->cr-CCIR601_10BIT_CHROMAOFFSET)));
pTarget->Red = (uint16_t)ClipRGB_10BIT(Red);
Blue = AJA_FixedRound(ConvertedY +
0x20469*((int32_t)(pSource->cb-CCIR601_10BIT_CHROMAOFFSET) ));
pTarget->Blue = (uint16_t)ClipRGB_10BIT(Blue);
Green = AJA_FixedRound(ConvertedY -
0x644A*((int32_t)(pSource->cb-CCIR601_10BIT_CHROMAOFFSET) ) -
0xD01F*((int32_t)(pSource->cr-CCIR601_10BIT_CHROMAOFFSET) ));
pTarget->Green = (uint16_t)ClipRGB_10BIT(Green);
pTarget->Alpha = pSource->Alpha;
}
inline void AJA_HDConvert10BitYCbCrto10BitRGB(AJA_YCbCr10BitAlphaPixel *pSource,
AJA_RGBAlpha10BitPixel *pTarget)
{
int32_t Red,Green,Blue;
int32_t ConvertedY;
ConvertedY = 0x12ACF*((int32_t)pSource->y - CCIR601_10BIT_BLACK);
Red = AJA_FixedRound(ConvertedY +
0x1DF71*((int32_t)(pSource->cr-CCIR601_10BIT_CHROMAOFFSET)));
pTarget->Red = (uint16_t)ClipRGB_10BIT(Red);
Blue = AJA_FixedRound(ConvertedY +
0x22A86*((int32_t)(pSource->cb-CCIR601_10BIT_CHROMAOFFSET) ));
pTarget->Blue = (uint16_t)ClipRGB_10BIT(Blue);
Green = AJA_FixedRound(ConvertedY -
0x3806*((int32_t)(pSource->cb-CCIR601_10BIT_CHROMAOFFSET) ) -
0x8C32*((int32_t)(pSource->cr-CCIR601_10BIT_CHROMAOFFSET) ));
pTarget->Green = (uint16_t)ClipRGB_10BIT(Green);
pTarget->Alpha = pSource->Alpha;
}
inline void AJA_SDConvert10BitYCbCrtoRGB(AJA_YCbCr10BitAlphaPixel *pSource,
AJA_RGBAlphaPixel *pTarget)
{
int32_t Red,Green,Blue;
int32_t ConvertedY;
ConvertedY = 0x4A86*((int32_t)pSource->y - CCIR601_10BIT_BLACK);
Red = AJA_FixedRound(ConvertedY +
0x6626*((int32_t)(pSource->cr-CCIR601_10BIT_CHROMAOFFSET)));
pTarget->Red = (uint8_t)ClipRGB_8BIT(Red);
Blue = AJA_FixedRound(ConvertedY +
0x811B*((int32_t)(pSource->cb-CCIR601_10BIT_CHROMAOFFSET) ));
pTarget->Blue = (uint8_t)ClipRGB_8BIT(Blue);
Green = AJA_FixedRound(ConvertedY -
0x1913*((int32_t)(pSource->cb-CCIR601_10BIT_CHROMAOFFSET) ) -
0x3408*((int32_t)(pSource->cr-CCIR601_10BIT_CHROMAOFFSET) ));
pTarget->Green = (uint8_t)ClipRGB_8BIT(Green);
pTarget->Alpha = (uint8_t)pSource->Alpha;
}
inline void AJA_HDConvert10BitYCbCrtoRGB(AJA_YCbCr10BitAlphaPixel *pSource,
AJA_RGBAlphaPixel *pTarget)
{
int32_t Red,Green,Blue;
int32_t ConvertedY;
ConvertedY = (0x12ACF>>2)*((int32_t)pSource->y - CCIR601_10BIT_BLACK);
Red = AJA_FixedRound(ConvertedY +
(0x1DF71>>2)*((int32_t)(pSource->cr-CCIR601_10BIT_CHROMAOFFSET)));
pTarget->Red = (uint8_t)ClipRGB_8BIT(Red);
Blue = AJA_FixedRound(ConvertedY +
(0x22A86>>2)*((int32_t)(pSource->cb-CCIR601_10BIT_CHROMAOFFSET) ));
pTarget->Blue = (uint8_t)ClipRGB_8BIT(Blue);
Green = AJA_FixedRound(ConvertedY -
(0x3806>>2)*((int32_t)(pSource->cb-CCIR601_10BIT_CHROMAOFFSET) ) -
(0x8C32>>2)*((int32_t)(pSource->cr-CCIR601_10BIT_CHROMAOFFSET) ));
pTarget->Green = (uint8_t)ClipRGB_8BIT(Green);
pTarget->Alpha = (uint8_t)pSource->Alpha;
}
typedef void (*AJA_ConvertRGBAlphatoYCbCr)(AJA_RGBAlphaPixel * pSource, AJA_YCbCr10BitPixel * pTarget);
inline void AJA_SDConvertRGBAlphatoYCbCr(AJA_RGBAlphaPixel * pSource, AJA_YCbCr10BitPixel * pTarget)
{
int32_t Y,Cb,Cr;
Y = CCIR601_10BIT_BLACK + (((int32_t)0x41BC*pSource->Red +
(int32_t)0x810F*pSource->Green +
(int32_t)0x1910*pSource->Blue )>>14);
pTarget->y = (uint16_t)Y;
Cb = CCIR601_10BIT_CHROMAOFFSET + (((int32_t)-0x25F1*pSource->Red -
(int32_t)0x4A7E*pSource->Green +
(int32_t)0x7070*pSource->Blue )>>14);
pTarget->cb = uint16_t(Cb&0x3FF);
Cr = CCIR601_10BIT_CHROMAOFFSET + (((int32_t)0x7070*pSource->Red -
(int32_t)0x5E27*pSource->Green -
(int32_t)0x1249*pSource->Blue )>>14);
pTarget->cr = uint16_t(Cr&0x3FF);
}
inline void AJA_HDConvertRGBAlphatoYCbCr(AJA_RGBAlphaPixel * pSource, AJA_YCbCr10BitPixel * pTarget)
{
int32_t Y,Cb,Cr;
Y = CCIR601_10BIT_BLACK + (((int32_t)0x2E8A*pSource->Red +
(int32_t)0x9C9F*pSource->Green +
(int32_t)0x0FD2*pSource->Blue )>>14);
pTarget->y = (uint16_t)Y;
Cb = CCIR601_10BIT_CHROMAOFFSET + (((int32_t)-0x18F4*pSource->Red -
(int32_t)0x545B*pSource->Green +
(int32_t)0x6DA9*pSource->Blue )>>14);
pTarget->cb = uint16_t(Cb&0x3FF);
Cr = CCIR601_10BIT_CHROMAOFFSET + (((int32_t)0x6D71*pSource->Red -
(int32_t)0x6305*pSource->Green -
(int32_t)0x0A06*pSource->Blue )>>14);
pTarget->cr = uint16_t(Cr&0x3FF);
}
inline void AJA_HDConvertRGBAlpha10toYCbCr(AJA_RGBAlpha10BitPixel * pSource, AJA_YCbCr10BitPixel * pTarget,bool rgbFullRange)
{
double dY,dCb,dCr;
int32_t Y,Cb,Cr;
if ( rgbFullRange)
{
dY = (double(pSource->Red ) * 0.182068) +
(double(pSource->Green) * 0.612427) +
(double(pSource->Blue ) * 0.061829);
Y = CCIR601_10BIT_BLACK + int32_t(dY); /// should do rounding
pTarget->y = uint16_t(Y&0x3FF);
dCb = (double(pSource->Red ) * (-0.100342)) +
(double(pSource->Green) * (-0.337585)) +
(double(pSource->Blue ) * (0.437927));
Cb = CCIR601_10BIT_CHROMAOFFSET + int32_t(dCb);
pTarget->cb = uint16_t(Cb&0x3FF);
dCr = (double(pSource->Red ) * (0.437927)) +
(double(pSource->Green) * (-0.397766)) +
(double(pSource->Blue ) * (-0.040161));
Cr = CCIR601_10BIT_CHROMAOFFSET + int32_t(dCr);
pTarget->cr = uint16_t(Cr&0x3FF);
}
else
{
dY = (double(pSource->Red ) * 0.212585) +
(double(pSource->Green) * 0.715210) +
(double(pSource->Blue ) * 0.072205);
Y = int32_t(dY);
pTarget->y = uint16_t(Y&0x3FF);
dCb = (double(pSource->Red ) * (-0.117188)) +
(double(pSource->Green) * (-0.394226)) +
(double(pSource->Blue ) * (0.511414));
Cb = CCIR601_10BIT_CHROMAOFFSET + int32_t(dCb);
pTarget->cb = uint16_t(Cb&0x3FF);
dCr = (double(pSource->Red ) * (0.511414)) +
(double(pSource->Green) * (-0.464508)) +
(double(pSource->Blue ) * (-0.046906));
Cr = CCIR601_10BIT_CHROMAOFFSET + int32_t(dCr);
pTarget->cr = uint16_t(Cr&0x3FF);
}
}
#endif // AJA_VIDEOUTILS_H

View File

@ -1,83 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file wavewriter.h
@brief Declares the AJAWavWriter class.
@copyright (C) 2010-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJAWAVEWRITER_H
#define AJAWAVEWRITER_H
#include "public.h"
#include "ajabase/system/file_io.h"
class AJA_EXPORT AJAWavWriterAudioFormat
{
public:
AJAWavWriterAudioFormat(const int inChannelCount = 2, const int inSampleRate = 48000, const int inSampleSizeBits = 16)
: channelCount (inChannelCount),
sampleRate (inSampleRate),
sampleSize (inSampleSizeBits)
{
}
int channelCount;
int sampleRate;
int sampleSize;
};
class AJA_EXPORT AJAWavWriterVideoFormat
{
public:
AJAWavWriterVideoFormat() { rateDuration = 30000; rateScale = 1001; }
uint32_t rateDuration;
uint32_t rateScale;
};
enum AJAWavWriterChunkFlag
{
AJAWavWriterChunkFlagStandard = 1 << 0,
AJAWavWriterChunkFlagBextV1 = 1 << 1
};
class AJA_EXPORT AJAWavWriter : public AJAFileIO
{
public:
AJAWavWriter(const std::string & name,
const AJAWavWriterAudioFormat & audioFormat = AJAWavWriterAudioFormat(),
const AJAWavWriterVideoFormat & videoFormat = AJAWavWriterVideoFormat(),
const std::string & startTimecode = "00:00:00;00", AJAWavWriterChunkFlag flags = AJAWavWriterChunkFlagStandard,
bool useFloatNotPCM = false);
bool open();
void close();
uint32_t write(const char* data, uint32_t len);
protected:
AJAStatus Open(const std::string& fileName, int flags, AJAFileProperties properties);
AJAStatus Close(void);
private:
uint32_t writeRawData(const char* data,uint32_t len);
uint32_t writeRawData(char* data,uint32_t len);
uint32_t writeRaw_uint8_t(uint8_t value, uint32_t count=1);
uint32_t writeRaw_uint16_t(uint16_t value, uint32_t count=1);
uint32_t writeRaw_uint32_t(uint32_t value, uint32_t count=1);
void writeHeader();
std::string mFileName;
AJAWavWriterAudioFormat mAudioFormat;
AJAWavWriterVideoFormat mVideoFormat;
std::string mStartTimecode;
AJAWavWriterChunkFlag mFlags;
bool mLittleEndian;
int32_t mSizeOfHeader;
bool mUseFloatData;
};
#endif // AJAWAVEWRITER_H

View File

@ -1,92 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file ip_socket.h
@brief Declares the AJAIPSocket class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_IP_SOCKET_H
#define AJA_IP_SOCKET_H
/////////////////////////////
// Includes
/////////////////////////////
#include "ajabase/common/public.h"
#include "ajabase/system/system.h"
#include "ajabase/system/lock.h"
#include <string>
#include <map>
#if defined(AJA_LINUX) || defined(AJA_MAC)
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <netinet/in.h>
#include <netdb.h>
#include <poll.h>
#include <sys/socket.h>
#elif defined(AJA_WINDOWS)
typedef int socklen_t;
#endif
/////////////////////////////
// Typedefs
/////////////////////////////
// The key is the IP address, while the second member is the interface name
typedef std::map<std::string, std::string> IPAddressContainerType;
/////////////////////////////
// Declarations
/////////////////////////////
/**
* Class which initializes any TCP/IP stack requirements for the target OS.
*/
class AJA_EXPORT AJAIPSocket
{
public:
AJAIPSocket(void);
virtual ~AJAIPSocket(void);
bool Initialize(void);
bool Deinitialize(void);
virtual AJAStatus Open(const std::string& ipAddress, uint16_t port);
bool IsOpen(void);
bool Shutdown(int how);
bool Close(void);
bool SetSocketOption(int option, const void* pValue);
bool GetHostIPAddresses(
IPAddressContainerType& ipv4AddressContainer,
IPAddressContainerType& ipv6AddressContainer);
virtual uint32_t Poll(
uint8_t* pData,
uint32_t dataLength,
struct sockaddr_in& client,
int timeout);
virtual uint32_t Read(
uint8_t* pData,
uint32_t dataLength,
struct sockaddr_in& client);
virtual uint32_t Write(
const uint8_t* pData,
uint32_t dataLength,
struct sockaddr_in& targetAddress);
protected:
struct sockaddr_in mSocketAddress;
socklen_t mSocketLength;
int mSocket;
bool IsInstantiated(void);
private:
static AJALock mMutex;
static uint32_t mInstantiationCount;
};
#endif // AJA_IP_SOCKET_H

View File

@ -1,41 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file tcp_socket.h
@brief Declares the AJATCPSocket class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_TCP_SOCKET_H
#define AJA_TCP_SOCKET_H
/////////////////////////////
// Includes
/////////////////////////////
#include "ajabase/network/ip_socket.h"
/////////////////////////////
// Declarations
/////////////////////////////
class AJA_EXPORT AJATCPSocket : public AJAIPSocket
{
public:
AJATCPSocket(void);
virtual ~AJATCPSocket(void);
AJAStatus Open(const std::string& ipAddress, uint16_t port);
AJAStatus Connect(const std::string& ipAddress, uint16_t port);
AJAStatus Listen(void);
int Accept(void);
uint32_t Read(uint8_t* pData, uint32_t dataLength);
uint32_t Write(const uint8_t* pData, uint32_t dataLength);
private:
uint32_t Read(uint8_t* pData, uint32_t dataLength, struct sockaddr_in& client);
uint32_t Write(const uint8_t* pData, uint32_t dataLength, struct sockaddr_in& targetAddress);
};
#endif // AJA_TCP_SOCKET_H

View File

@ -1,43 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file udp_socket.h
@brief Declares the AJAUDPSocket class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_UDP_SOCKET_H
#define AJA_UDP_SOCKET_H
/////////////////////////////
// Includes
/////////////////////////////
#include "ajabase/network/ip_socket.h"
/////////////////////////////
// Declarations
/////////////////////////////
class AJA_EXPORT AJAUDPSocket : public AJAIPSocket
{
public:
AJAUDPSocket(void);
virtual ~AJAUDPSocket(void);
AJAStatus Open(const std::string& ipAddress, uint16_t port);
uint32_t Poll(
uint8_t* pData,
uint32_t dataLength,
struct sockaddr_in& client,
int timeout);
uint32_t Read(uint8_t* pData, uint32_t dataLength, struct sockaddr_in& client);
uint32_t Write(
const uint8_t* pData,
uint32_t dataLength,
struct sockaddr_in& targetAddress);
private:
};
#endif // AJA_UDP_SOCKET_H

View File

@ -1,64 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file persistence/persistence.h
@brief Declares the AJAPersistence class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJAPersistence_H
#define AJAPersistence_H
#include <string>
#include <vector>
#include "ajabase/system/info.h"
enum AJAPersistenceType
{
AJAPersistenceTypeInt,
AJAPersistenceTypeBool,
AJAPersistenceTypeDouble,
AJAPersistenceTypeString, //std::string not C string
AJAPersistenceTypeBlob,
//add any new ones above here
AJAPersistenceTypeEnd
};
/**
* Class used to talk to the board in such a way as to maintain a persistant state
* across apps and reboots.
*/
class AJAPersistence
{
public:
AJAPersistence();
AJAPersistence(const std::string& appID, const std::string& deviceType="", const std::string& deviceNumber="", bool bSharePrefFile=false);
virtual ~AJAPersistence();
void SetParams(const std::string& appID="", const std::string& deviceType="", const std::string& deviceNumber="", bool bSharePrefFile=false);
void GetParams(std::string& appID, std::string& deviceType, std::string& deviceNumber, bool& bSharePrefFile);
bool SetValue(const std::string& key, void *value, AJAPersistenceType type, size_t blobBytes = 0);
bool GetValue(const std::string& key, void *value, AJAPersistenceType type, size_t blobBytes = 0);
bool FileExists();
bool ClearPrefFile();
bool DeletePrefFile();
bool GetValuesInt(const std::string& keyQuery, std::vector<std::string>& keys, std::vector<int>& values);
bool GetValuesBool(const std::string& keyQuery, std::vector<std::string>& keys, std::vector<bool>& values);
bool GetValuesDouble(const std::string& keyQuery, std::vector<std::string>& keys, std::vector<double>& values);
bool GetValuesString(const std::string& keyQuery, std::vector<std::string>& keys, std::vector<std::string>& values);
private:
std::string mappId;
std::string mboardId;
bool mSharedPrefFile;
std::string mserialNumber;
std::string mstateKeyName;
AJASystemInfo mSysInfo;
};
#endif // AJAPersistence_H

View File

@ -1,33 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file pnp/linux/pnpimpl.h
@brief Declares the AJAPnpImpl class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_PNP_IMPL_H
#define AJA_PNP_IMPL_H
#include "ajabase/pnp/pnp.h"
class AJAPnpImpl
{
public:
AJAPnpImpl();
virtual ~AJAPnpImpl(void);
AJAStatus Install(AJAPnpCallback callback, void* refCon, uint32_t devices);
AJAStatus Uninstall(void);
AJAPnpCallback GetCallback();
void* GetRefCon();
uint32_t GetPnpDevices();
private:
void* mRefCon;
AJAPnpCallback mCallback;
uint32_t mDevices;
};
#endif // AJA_PNP_IMPL_H

View File

@ -1,96 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file devicenotifier.h
@brief Declares the MacOS-specific KonaNotifier and DeviceNotifier classes, which invoke
a client-registered callback function when devices are attached and/or detached.
@copyright (C) 2011-2021 AJA Video Systems, Inc.
**/
#if !defined (__DEVICE_NOTIFIER_H__)
#define __DEVICE_NOTIFIER_H__
#include <CoreFoundation/CoreFoundation.h>
#include <Carbon/Carbon.h>
#include <IOKit/IOMessage.h>
#include <IOKit/usb/IOUSBLib.h>
#include <vector>
#include <map>
#include <list>
#define kAJADeviceInitialOpen 0xAA1
#define kAJADeviceTerminate 0xAA2
/**
@brief Mac-specific device add/change/remove event notification callback function.
**/
typedef void (*DeviceClientCallback)(unsigned long message, void * refcon);
/**
@brief Mac-specific class that notifies clients when AJA devices are attached/detached, etc.
**/
class DeviceNotifier
{
// Instance Methods
public:
DeviceNotifier (DeviceClientCallback callback, void *refcon);
virtual ~DeviceNotifier ();
virtual bool Install (CFMutableDictionaryRef dict = NULL);
virtual void Uninstall ();
// alternate way to set callback
virtual void SetCallback (DeviceClientCallback callback, void *refcon);
protected:
// override these
inline virtual CFMutableDictionaryRef CreateMatchingDictionary () {return NULL;}
virtual CFMutableDictionaryRef CreateMatchingDictionary (CFStringRef deviceDriverName);
// callbacks
virtual void DeviceAdded (io_iterator_t iterator);
virtual void DeviceRemoved (io_iterator_t iterator);
virtual void DeviceChanged (io_service_t unitService, natural_t messageType, void* message);
// util
virtual void AddGeneralInterest (io_object_t service);
// Class Methods
public:
//static void SetDebugLogging (const uint64_t inWhichUserClientCommands);
static std::string MessageTypeToStr (const natural_t messageType);
// Non-Public Class Methods
static void DeviceAddedCallback ( DeviceNotifier* thisObject, io_iterator_t iterator);
static void DeviceRemovedCallback ( DeviceNotifier* thisObject, io_iterator_t iterator);
static void DeviceChangedCallback ( DeviceNotifier * thisObject,
io_service_t unitService,
natural_t messageType,
void * message);
// Instance Data
protected:
void * m_refcon;
DeviceClientCallback m_clientCallback;
mach_port_t m_masterPort;
IONotificationPortRef m_notificationPort;
CFMutableDictionaryRef m_matchingDictionary;
std::list<io_object_t> m_deviceMatchList;
std::list<io_object_t> m_deviceInterestList;
}; // DeviceNotifier
/**
@brief Subclass of DeviceNotifier that notifies clients when Kona/Corvid/Io/TTap devices are attached/detached.
**/
class KonaNotifier : public DeviceNotifier
{
public:
inline KonaNotifier (DeviceClientCallback callback, void *refcon)
: DeviceNotifier (callback, refcon) {}
inline virtual ~KonaNotifier () {}
virtual bool Install (CFMutableDictionaryRef dict = NULL);
};
#endif // __DEVICE_NOTIFIER_H__

View File

@ -1,50 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file pnp/mac/masterport.h
@brief Declares the MasterPort class.
@copyright (C) 2013-2021 AJA Video Systems, Inc. All rights reserved.
**/
#if !defined (__MASTERPORT_H__)
#define __MASTERPORT_H__
// Includes
#include "ajabase/common/ajarefptr.h"
#include <IOKit/IOKitLib.h>
#include <assert.h>
/**
@brief I'm a wrapper class for IONotificationPortRef that provides automatic clean-up.
**/
class MasterPort;
typedef AJARefPtr <MasterPort> MasterPortPtr;
class MasterPort
{
// Class Methods
public:
static IONotificationPortRef Get (void);
static MasterPortPtr GetInstance (void);
private:
static bool Create (MasterPortPtr & outObj);
// Instance Methods
public:
virtual ~MasterPort ();
virtual inline IONotificationPortRef GetPortRef (void) const {return mpMasterPort;}
virtual inline operator IONotificationPortRef () const {return GetPortRef ();}
virtual inline bool IsOkay (void) const {return GetPortRef () ? true : false;}
private:
explicit MasterPort ();
inline MasterPort (const MasterPort & inObj) {if (&inObj != this) assert (false);}
inline MasterPort & operator = (const MasterPort & inRHS) {if (&inRHS != this) assert (false); return *this;}
// Instance Data
private:
IONotificationPortRef mpMasterPort; /// My master port reference
}; // MasterPort
#endif // __MASTERPORT_H__

View File

@ -1,37 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file pnp/mac/pnpimpl.h
@brief Declares the AJAPnpImpl class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_PNP_IMPL_H
#define AJA_PNP_IMPL_H
#include "ajabase/pnp/pnp.h"
class DeviceNotifier;
class AJAPnpImpl
{
public:
AJAPnpImpl();
virtual ~AJAPnpImpl(void);
AJAStatus Install (AJAPnpCallback callback, void* refCon, uint32_t devices);
AJAStatus Uninstall (void);
inline AJAPnpCallback GetCallback() const {return mCallback;}
inline void * GetRefCon() const {return mRefCon;}
inline uint32_t GetPnpDevices() const {return mDevices;}
private:
void* mRefCon;
AJAPnpCallback mCallback;
uint32_t mDevices;
DeviceNotifier* mPciDevices;
};
#endif // AJA_PNP_IMPL_H

View File

@ -1,131 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file pnp/pnp.h
@brief Declares the AJAPnp (plug-and-play) class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_PNP_H
#define AJA_PNP_H
#include "ajabase/common/public.h"
typedef enum
{
AJA_Pnp_PciVideoDevices = (1 << 0),
AJA_Pnp_UsbSerialDevices = (1 << 1),
AJA_Pnp_FireWireDevices = (1 << 2)
} AJAPnpDevice;
typedef enum
{
AJA_Pnp_DeviceAdded,
AJA_Pnp_DeviceRemoved,
AJA_Pnp_DeviceOnline,
AJA_Pnp_DeviceOffline,
AJA_Pnp_DeviceGoingToSleep,
AJA_Pnp_DeviceWakingUp
} AJAPnpMessage;
/**
@brief If installed (see AJAPnp::Install) in an AJAPnp instance, this function is called when
an AJA device is attached/detached, powered on/off, etc.
@param[in] inMessage Specifies the message (i.e., added, removed, etc.).
@param[in] inRefCon Specifies the reference cookie that was passed to AJAPnp::Install.
**/
typedef void (*AJAPnpCallback)(AJAPnpMessage inMessage, void * inRefCon);
// forward declarations.
class AJAPnpImpl;
/**
@brief This is a platform-agnostic plug-and-play class that notifies a client when AJA devices are
attached/detached, powered on/off, sleep/wake, etc.
@ingroup AJAGroupPnp
@bug This class has no Linux implementation.
**/
class AJA_EXPORT AJAPnp
{
public: // INSTANCE METHODS
/**
* @brief Default constructor.
*/
AJAPnp();
/**
* @brief Default destructor.
*/
virtual ~AJAPnp();
/**
* @brief Installs the given plug-n-play notification callback function, replacing any callback function that
* may have been installed previously. If any matching devices are attached to the host, the callback
* function is immediately called for each attached device with the AJA_Pnp_DeviceAdded message.
*
* @param[in] callback Specifies a pointer to a client-defined function to be called when AJA devices
* sleep/wake or are attached/detached to/from the host. If non-NULL, must be valid.
* @param[in] refCon Specifies a pointer-sized reference cookie that gets passed to the callback function.
* Defaults to NULL.
* @param[in] devices Specifies a bit mask that filters which devices to include/ignore (see implementation).
* Use zero (the default) to see all possible devices.
*
* @bug The current Windows implementation doesn't automatically invoke the callback for each attached device.
* As a workaround, the caller must explicitly enumerate the devices immediately before or after calling
* this function.
*
* @return AJA_STATUS_SUCCESS Install succeeded
* AJA_STATUS_FAIL Install failed
*/
virtual AJAStatus Install(AJAPnpCallback callback, void* refCon= NULL, uint32_t devices = 0);
/**
* @return the address of the currently-installed callback (NULL if none installed).
*/
virtual AJAPnpCallback GetCallback() const;
/**
* @brief Uninstalls any previously-installed callback notifier.
* @return AJA_STATUS_SUCCESS Uninstall succeeded
* AJA_STATUS_FAIL Uninstall failed
*/
virtual AJAStatus Uninstall();
/**
* @return the currently installed reference cookie.
*/
virtual void* GetRefCon() const;
/**
* @return the current bit mask that filters which devices to include or ignore (see implementation).
*/
virtual uint32_t GetPnpDevices() const;
private: // INSTANCE METHODS
/**
* @brief Hidden copy constructor.
*
* @param[in] inObjToCopy Specifies the object to be copied.
**/
AJAPnp (const AJAPnp & inObjToCopy);
/**
* @brief Hidden assignment operator.
*
* @param[in] inObjToCopy Specifies the object to be copied.
**/
virtual AJAPnp & operator= (const AJAPnp & inObjToCopy);
private: // INSTANCE DATA
AJAPnpImpl * mpImpl; ///< @brief My platform-specific implementation object
}; // AJAPnp
#endif // AJA_PNP_H

View File

@ -1,41 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file pnp/windows/pnpimpl.h
@brief Declares the AJAPnpImpl class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_PNP_IMPL_H
#define AJA_PNP_IMPL_H
#include <Windows.h>
#include "ajabase/pnp/pnp.h"
class AJAPnpImpl
{
public:
AJAPnpImpl();
virtual ~AJAPnpImpl(void);
AJAStatus Install(AJAPnpCallback callback, void* refCon, uint32_t devices);
AJAStatus Uninstall(void);
AJAPnpCallback GetCallback();
void* GetRefCon();
uint32_t GetPnpDevices();
void AddSignaled();
void RemoveSignaled();
private:
void* mRefCon;
AJAPnpCallback mCallback;
uint32_t mDevices;
HANDLE mAddEventHandle;
HANDLE mAddWaitHandle;
HANDLE mRemoveEventHandle;
HANDLE mRemoveWaitHandle;
bool mbInstalled;
};
#endif // AJA_PNP_IMPL_H

View File

@ -1,134 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file atomic.h
@brief Declares the AJAAtomic class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_ATOMIC_H
#define AJA_ATOMIC_H
#include "ajabase/common/public.h"
/**
* Collection of system independent atomic functions.
* @ingroup AJAGroupSystem
*/
class AJA_EXPORT AJAAtomic
{
public:
AJAAtomic();
virtual ~AJAAtomic();
/**
* Exchange the pointer value with the target.
*
* @param[in,out] pTarget The target of the exchange.
* @param[in] pValue The value to exchange with the target.
* @return The value of the target before the exchange.
*/
static void* Exchange(void* volatile* pTarget, void* pValue);
/**
* Exchange the integer value with the target.
*
* @param[in,out] pTarget The target of the exchange.
* @param[in] value The value to exchange with the target.
* @return The value of the target before the exchange.
*/
static int32_t Exchange(int32_t volatile* pTarget, int32_t value);
/**
* Increment the integer target.
*
* @param[in, out] pTarget The target to increment.
* @return The target value post increment.
*/
static int32_t Increment(int32_t volatile* pTarget);
/**
* Decrement the integer target.
*
* @param[in,out] pTarget The target to decrement.
* @return The target value post decrement.
*/
static int32_t Decrement(int32_t volatile* pTarget);
/**
* Exchange unsigned integer value and target.
*
* @param[in,out] pTarget The target of the exchange.
* @param[in] value The value to exchange with the target.
* @return The value of the target before the exchange.
*/
static uint32_t Exchange(uint32_t volatile* pTarget, uint32_t value);
/**
* Increment the unsigned integer target.
*
* @param[in,out] pTarget The target to increment.
* @return The target value post increment.
*/
static uint32_t Increment(uint32_t volatile* pTarget);
/**
* Decrement the unsigned integer target.
*
* @param[in,out] pTarget The target to decrement.
* @return The target value post decrement.
*/
static uint32_t Decrement(uint32_t volatile* pTarget);
/**
* Exchange the integer value with the target.
*
* @param[in,out] pTarget The target of the exchange.
* @param[in] value The value to exchange with the target.
* @return The value of the target before the exchange.
*/
static int64_t Exchange(int64_t volatile* pTarget, int64_t value);
/**
* Increment the integer target.
*
* @param[in, out] pTarget The target to increment.
* @return The target value post increment.
*/
static int64_t Increment(int64_t volatile* pTarget);
/**
* Decrement the integer target.
*
* @param[in,out] pTarget The target to decrement.
* @return The target value post decrement.
*/
static int64_t Decrement(int64_t volatile* pTarget);
/**
* Exchange unsigned integer value and target.
*
* @param[in,out] pTarget The target of the exchange.
* @param[in] value The value to exchange with the target.
* @return The value of the target before the exchange.
*/
static uint64_t Exchange(uint64_t volatile* pTarget, uint64_t value);
/**
* Increment the unsigned integer target.
*
* @param[in,out] pTarget The target to increment.
* @return The target value post increment.
*/
static uint64_t Increment(uint64_t volatile* pTarget);
/**
* Decrement the unsigned integer target.
*
* @param[in,out] pTarget The target to decrement.
* @return The target value post decrement.
*/
static uint64_t Decrement(uint64_t volatile* pTarget);
};
#endif // AJAAtomic

View File

@ -1,733 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file debug.h
@brief Declares the AJADebug class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_DEBUG_H
#define AJA_DEBUG_H
#include <stdio.h>
#include <sstream>
#include "ajabase/common/public.h"
#include "ajabase/system/debugshare.h"
/** @defgroup AJAGroupMacro AJA Debug Macros
* The macros are used to generate messages and assertions.
* @ingroup AJAGroupDebug
* @{
*/
/** @def AJA_ASSERT(_expression_)
* Assert if _expression_ is false.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _expression_ Boolean expression that should be false only in an exceptional condition.
*/
/** @def AJA_REPORT(_index_, _severity_, _format_)
* Report debug messages to active destinations.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Send message to this destination index.
* @param[in] _severity_ Severity (::AJADebugSeverity) of the message to report.
* @param[in] _format_ Format parameters passed to vsprintf. The first is the format itself.
*/
#if defined(AJA_WINDOWS)
#if defined(AJA_DEBUG)
#define AJA_ASSERT(_expression_) \
if (!(_expression_)) AJADebug::AssertWithMessage(__FILE__, __LINE__, #_expression_);
#define AJA_PRINT(...) \
AJADebug::Report(0, AJA_DebugSeverity_Debug, NULL, 0, __VA_ARGS__)
#else
#define AJA_ASSERT(_expression_)
#define AJA_PRINT(...)
#endif
#define AJA_REPORT(_index_, _severity_, ...) \
AJADebug::Report(_index_, _severity_, __FILE__, __LINE__, __VA_ARGS__);
#elif defined(AJA_LINUX)
#if defined(AJA_DEBUG)
#define AJA_ASSERT(_expression_) \
if(!(_expression_)) AJADebug::AssertWithMessage(NULL, 0, #_expression_);
#define AJA_PRINT(...) \
AJADebug::Report(0, AJA_DebugSeverity_Error, NULL, 0, __VA_ARGS__)
#else
#define AJA_ASSERT(_expression_)
#define AJA_PRINT(...)
#endif
#define AJA_REPORT(_index_, _severity_, ...) \
AJADebug::Report(_index_, _severity_, __FILE__, __LINE__, __VA_ARGS__);
#elif defined(AJA_MAC)
#if defined(AJA_DEBUG)
#define AJA_ASSERT(_expression_) \
if (!(_expression_)) AJADebug::AssertWithMessage(__FILE__, __LINE__, #_expression_);
#if !defined (AJA_PRINTTYPE)
#define AJA_PRINTTYPE 0
#endif // if AJA_PRINTTYPE undefined
#if (AJA_PRINTTYPE==0)
#define AJA_PRINT(...) \
AJADebug::Report(0, AJA_DebugSeverity_Error, NULL, 0, __VA_ARGS__)
#elif (AJA_PRINTTYPE==1)
#include <stdio.h>
#define AJA_PRINT(_format_...) printf(_format_)
#elif (AJA_PRINTTYPE==3)
#include <stdio.h>
#define AJA_PRINT(_format_...) fprintf(stderr, _format_)
#elif (AJA_PRINTTYPE==4)
#include <syslog.h>
#include <stdarg.h>
#define AJA_PRINT(_format_...) syslog(LOG_ERR, _format_)
#endif
#else
#define AJA_ASSERT(_expression_)
#define AJA_PRINT(...)
#endif
#define AJA_REPORT(_index_, _severity_, ...) \
AJADebug::Report(_index_, _severity_, __FILE__, __LINE__, __VA_ARGS__);
#else
#if defined(AJA_DEBUG)
#define AJA_ASSERT(_expression_) \
if(!(_expression_)) AJADebug::AssertWithMessage(NULL, 0, #_expression_);
#define AJA_PRINT(_format_,...) \
AJADebug::Report(0, AJA_DebugSeverity_Error, NULL, 0, _format_)
#else
#define AJA_ASSERT(_expression_)
#define AJA_PRINT(_format_,...)
#endif
#define AJA_REPORT(_index_, _severity_, _format_) \
AJADebug::Report(_index_, _severity_, NULL, 0, _format_);
#endif
// Handy ostream-based macros...
#define AJA_sASSERT(_expr_) do { std::ostringstream __ss__; __ss__ << #_expr_; \
AJADebug::AssertWithMessage(__FILE__, __LINE__, __ss__.str()); \
} while (false)
/** @def AJA_sREPORT(_index_, _severity_, _expr_)
* Report a message to active destinations using the given <tt>std::ostream</tt> expression.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Specifies the message classification as an ::AJADebugUnit.
* @param[in] _severity_ Severity (::AJADebugSeverity) of the message to report.
* @param[in] _expr_ The message to report, as a <tt>std::ostream</tt> expression (e.g. <tt>"Foo" << std::hex << 3500</tt>).
*/
#define AJA_sREPORT(_index_,_severity_,_expr_) do {std::ostringstream __ss__; __ss__ << _expr_; \
AJADebug::Report((_index_), (_severity_), __FILE__, __LINE__, __ss__.str()); \
} while (false)
/** @def AJA_sEMERGENCY(_index_, _expr_)
* Reports a ::AJA_DebugSeverity_Emergency message to active destinations using the given std::ostream expression.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Specifies the message classification as an ::AJADebugUnit.
* @param[in] _expr_ The message to report, as a <tt>std::ostream</tt> expression.
*/
#define AJA_sEMERGENCY(_index_,_expr_) AJA_sREPORT((_index_), AJA_DebugSeverity_Emergency, _expr_)
/** @def AJA_sALERT(_index_, _expr_)
* Reports a ::AJA_DebugSeverity_Alert message to active destinations using the given <tt>std::ostream</tt> expression.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Specifies the message classification as an ::AJADebugUnit.
* @param[in] _expr_ The message to report, as a <tt>std::ostream</tt> expression.
*/
#define AJA_sALERT(_index_,_expr_) AJA_sREPORT((_index_), AJA_DebugSeverity_Alert, _expr_)
/** @def AJA_sERROR(_index_, _expr_)
* Reports a ::AJA_DebugSeverity_Error message to active destinations using the given <tt>std::ostream</tt> expression.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Specifies the message classification as an ::AJADebugUnit.
* @param[in] _expr_ The message to report, as a <tt>std::ostream</tt> expression.
*/
#define AJA_sERROR(_index_,_expr_) AJA_sREPORT((_index_), AJA_DebugSeverity_Error, _expr_)
/** @def AJA_sWARNING(_index_, _expr_)
* Reports a ::AJA_DebugSeverity_Warning message to active destinations using the given <tt>std::ostream</tt> expression.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Specifies the message classification as an ::AJADebugUnit.
* @param[in] _expr_ The message to report, as a <tt>std::ostream</tt> expression.
*/
#define AJA_sWARNING(_index_,_expr_) AJA_sREPORT((_index_), AJA_DebugSeverity_Warning, _expr_)
/** @def AJA_sNOTICE(_index_, _expr_)
* Reports a ::AJA_DebugSeverity_Notice message to active destinations using the given <tt>std::ostream</tt> expression.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Specifies the message classification as an ::AJADebugUnit.
* @param[in] _expr_ The message to report, as a <tt>std::ostream</tt> expression.
*/
#define AJA_sNOTICE(_index_,_expr_) AJA_sREPORT((_index_), AJA_DebugSeverity_Notice, _expr_)
/** @def AJA_sINFO(_index_, _expr_)
* Reports a ::AJA_DebugSeverity_Info message to active destinations using the given <tt>std::ostream</tt> expression.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Specifies the message classification as an ::AJADebugUnit.
* @param[in] _expr_ The message to report, as a <tt>std::ostream</tt> expression.
*/
#define AJA_sINFO(_index_,_expr_) AJA_sREPORT((_index_), AJA_DebugSeverity_Info, _expr_)
/** @def AJA_sDEBUG(_index_, _expr_)
* Reports a ::AJA_DebugSeverity_Debug message to active destinations using the given <tt>std::ostream</tt> expression.
* @hideinitializer
*
* This macro provides the file name and line number of the reporting module.
*
* @param[in] _index_ Specifies the message classification as an ::AJADebugUnit.
* @param[in] _expr_ The message to report, as a <tt>std::ostream</tt> expression.
*/
#define AJA_sDEBUG(_index_,_expr_) AJA_sREPORT((_index_), AJA_DebugSeverity_Debug, _expr_)
/** @} */
// forward declarations
class AJAMemory;
/**
* @param[in] inStatus The AJAStatus value of interest.
* @return A string containing the given AJAStatus value as human-readable text.
*/
AJA_EXPORT std::string AJAStatusToString (const AJAStatus inStatus);
/**
* Debug class to generate debug output and assertions.
* @ingroup AJAGroupDebug
*/
class AJA_EXPORT AJADebug
{
public:
AJADebug() {}
virtual ~AJADebug() {}
/**
* @return The debug facility's version number.
*/
static uint32_t Version (void); // New in SDK 16.0
/**
* @return The size of the debug facility's shared memory region.
*/
static uint32_t TotalBytes (void); // New in SDK 16.0
/**
* Initialize the debug system.
*
* Invoke before reporting debug messages.
*
* @param[in] incrementRefCount If true will increment the ref count in the shared memory,
* NOTE that this should only be true when used in something that is
* processing the log messages, like ajalogger.
*
* @return AJA_STATUS_SUCCESS Debug system initialized
* AJA_STATUS_FAIL Initialization failed
*/
static AJAStatus Open (bool incrementRefCount = false);
/**
* Release resources used by the debug system.
*
* Invoke before application terminates.
*
* @param[in] decrementRefCount If true will decrement the ref count in the shared memory,
* NOTE that this should only be true when used in something that is
* processing the log messages, like ajalogger.
*
* @return AJA_STATUS_SUCCESS Debug system closed
* AJA_STATUS_FAIL Close failed
*/
static AJAStatus Close (bool decrementRefCount = false);
/**
* Enable delivery of messages to the destination index.
*
* @param[in] index Specify the message destinations for this group index.
* @param[in] destination Bit array of message destinations (@link AJA_DEBUG_DESTINATION@endlink).
* @return AJA_STATUS_SUCCESS Destination enabled
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
*/
static AJAStatus Enable (int32_t index, uint32_t destination = AJA_DEBUG_DESTINATION_NONE);
/**
* Disable delivery of messages to the destination index.
*
* @param[in] index Specify the message destinations for this group index.
* @param[in] destination Bit array of message destinations (@link AJA_DEBUG_DESTINATION@endlink).
* @return AJA_STATUS_SUCCESS Destination disabled
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
*/
static AJAStatus Disable (int32_t index, uint32_t destination = AJA_DEBUG_DESTINATION_NONE);
/**
* Enable delivery of messages to the destination index.
*
* @param[in] index Specify the message destinations for this index.
* @param[in] destination Bit array of message destinations (@link AJA_DEBUG_DESTINATION@endlink).
* @return AJA_STATUS_SUCCESS Destination disabled
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
*/
static AJAStatus SetDestination (int32_t index, uint32_t destination = AJA_DEBUG_DESTINATION_NONE);
/**
* Get the destination associated with a debug group.
*
* @param[in] inGroup Index of the group destination to return.
* @param[out] outDestination Receives the current destination
* @return AJA_STATUS_SUCCESS Destination disabled
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetDestination (const int32_t inGroup, uint32_t & outDestination);
/**
* @param[in] index The destination index of interest.
* @return True if the debug facility is open, and the destination index is valid and active; otherwise false.
*/
static bool IsActive (int32_t index);
/**
* @return True if the debug facility is open; otherwise false.
*/
static bool IsOpen (void);
/**
* @return True if this class was built with AJA_DEBUG defined; otherwise false.
*/
static bool IsDebugBuild (void);
/**
* Report debug message to the specified destination index.
*
* @param[in] index Report the message to this destination index.
* @param[in] severity Severity (::AJA_DEBUG_SEVERITY) of the message to report.
* @param[in] pFileName The source filename reporting the message.
* @param[in] lineNumber The line number in the source file reporting the message.
* @param[in] ... Format parameters to be passed to vsprintf. The first is the format itself.
*/
static void Report (int32_t index, int32_t severity, const char* pFileName, int32_t lineNumber, ...);
/**
* Report debug message to the specified destination index.
*
* @param[in] index Report the message to this destination index.
* @param[in] severity Severity (::AJA_DEBUG_SEVERITY) of the message to report.
* @param[in] pFileName The source filename reporting the message.
* @param[in] lineNumber The line number in the source file reporting the message.
* @param[in] message The message to report.
*/
static void Report (int32_t index, int32_t severity, const char* pFileName, int32_t lineNumber, const std::string& message);
/**
* Assert that an unexpected error has occurred.
*
* @param[in] pFileName The source file name reporting the assertion.
* @param[in] lineNumber The line number in the source file reporting the assertion.
* @param[in] pExpression Expression that caused the assertion.
*/
static void AssertWithMessage (const char* pFileName, int32_t lineNumber, const std::string& pExpression);
/**
* @return The capacity of the debug logging facility's message ring.
*/
static uint32_t MessageRingCapacity (void); // New in SDK 16.0
/**
* Get the reference count for the number of clients accessing shared debug info
*
* @param[out] outRefCount Receives the current client reference count.
* @return AJA_STATUS_SUCCESS Reference count returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetClientReferenceCount (int32_t & outRefCount);
/**
* Set the reference count for the number of clients accessing shared debug info
* NOTE: in normal circumstances this should never be used, if set to 0 or less
* the debug system will be closed (shared memory cleaned up)
*
* @param[in] refCount The client reference count to set.
* @return AJA_STATUS_SUCCESS Reference count set
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
*/
static AJAStatus SetClientReferenceCount (int32_t refCount);
/**
* Get the sequence number of the latest message
*
* @param[out] outSequenceNumber Receives the current sequence number.
* @return AJA_STATUS_SUCCESS Sequence number returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetSequenceNumber (uint64_t & outSequenceNumber);
/**
* Get the sequence number recorded in the message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outSequenceNumber Receives the sequence number recorded in the message.
* @return AJA_STATUS_SUCCESS Group index returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessageSequenceNumber (const uint64_t sequenceNumber, uint64_t & outSequenceNumber);
/**
* Get the group index that reported the message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outGroupIndex Receives the group that reported the message.
* @return AJA_STATUS_SUCCESS Group index returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessageGroup (const uint64_t sequenceNumber, int32_t & outGroupIndex);
/**
* Get the destination of the message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outDestination Receives the destination of the message.
* @return AJA_STATUS_SUCCESS Destination returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessageDestination (const uint64_t sequenceNumber, uint32_t & outDestination);
/**
* Get the time the message was reported.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outTime Receives the time the message was reported.
* @return AJA_STATUS_SUCCESS message time returned
* AJA_STATUS_OPEN debug system not open
* AJA_STATUS_RANGE index out of range
* AJA_STATUS_NULL null output pointer
*/
static AJAStatus GetMessageTime (const uint64_t sequenceNumber, uint64_t & outTime);
/**
* Get the wall clock time the message was reported.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outTime Receives the wall clock time the message was reported, as returned from time()
* @return AJA_STATUS_SUCCESS message time returned
* AJA_STATUS_OPEN debug system not open
* AJA_STATUS_RANGE index out of range
* AJA_STATUS_NULL null output pointer
*/
static AJAStatus GetMessageWallClockTime (const uint64_t sequenceNumber, int64_t & outTime);
/**
* Get the source file name that reported the message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outFileName Receives the source file name that reported the message.
* @return AJA_STATUS_SUCCESS Message file name returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessageFileName (const uint64_t sequenceNumber, std::string & outFileName);
/**
* Get the source line number that reported the message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outLineNumber Receives the source line number that reported the message.
* @return AJA_STATUS_SUCCESS Sequence number returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessageLineNumber (const uint64_t sequenceNumber, int32_t & outLineNumber);
/**
* Get the severity of the reported message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outSeverity Receives the severity of the reported message.
* @return AJA_STATUS_SUCCESS Message severity returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessageSeverity (const uint64_t sequenceNumber, int32_t & outSeverity);
/**
* Get the message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outMessage Receives the message text
* @return AJA_STATUS_SUCCESS Message text returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessageText (const uint64_t sequenceNumber, std::string & outMessage);
/**
* Get the Process Id that reported the message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outPid Process Id that reported the message.
* @return AJA_STATUS_SUCCESS message time returned
* AJA_STATUS_OPEN debug system not open
* AJA_STATUS_RANGE index out of range
* AJA_STATUS_NULL null output pointer
*/
static AJAStatus GetProcessId (const uint64_t sequenceNumber, uint64_t & outPid);
/**
* Get the Thread Id that reported the message.
*
* @param[in] sequenceNumber Sequence number of the message.
* @param[out] outTid Receives the thread Id that reported the message.
* @return AJA_STATUS_SUCCESS message time returned
* AJA_STATUS_OPEN debug system not open
* AJA_STATUS_RANGE index out of range
* AJA_STATUS_NULL null output pointer
*/
static AJAStatus GetThreadId (const uint64_t sequenceNumber, uint64_t & outTid);
/**
* Get the number of messages accepted into the ring since creation.
*
* @param[out] outCount Receives the number of messages
* @return AJA_STATUS_SUCCESS Number of messages returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessagesAccepted (uint64_t & outCount);
/**
* Get the number of messages ignored and not put into the ring since creation.
*
* @param[out] outCount Receives the number of messages
* @return AJA_STATUS_SUCCESS Number of messages returned
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_RANGE Index out of range
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus GetMessagesIgnored (uint64_t & outCount);
/**
* @param[in] severity The Severity of interest.
* @return A human-readable string containing the name associated with the given Severity value.
*/
static const std::string & SeverityName (const int32_t severity);
/**
* @param[in] group The Message Group of interest.
* @return A human-readable string containing the name associated with the given Message Group.
*/
static const std::string & GroupName (const int32_t group);
/**
* Write group state to a file.
*
* @param[in] pFileName The group state file name.
* @return AJA_STATUS_SUCCESS State saved
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus SaveState (const char * pFileName);
/**
* Read group state from a file.
*
* @param[in] pFileName The group state file name.
* @return AJA_STATUS_SUCCESS State restored
* AJA_STATUS_OPEN Debug system not open
* AJA_STATUS_NULL Null output pointer
*/
static AJAStatus RestoreState (const char * pFileName);
/**
* @return The capacity of the debug facility's stats buffer.
*/
static uint32_t StatsCapacity (void); // New in SDK 16.0
/**
* @return True if stats are supported; otherwise false.
*/
static bool HasStats (void); // New in SDK 16.0
/**
* Registers/adds new stat, prepares for first use.
*
* @param[in] inKey The timer/counter key to be registered/allocated.
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatAllocate (const uint32_t inKey); // New in SDK 16.0
/**
* Unregisters/deletes the given stat.
*
* @param[in] inKey The timer/counter to be unregistered/deleted.
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatFree (const uint32_t inKey); // New in SDK 16.0
/**
* Answers if the given stat is allocated (in use).
*
* @param[in] inKey The timer/counter of interest.
* @return True if stat is allocated; otherwise false.
*/
static bool StatIsAllocated (const uint32_t inKey); // New in SDK 16.0
/**
* Resets/clears the given timer/counter stat.
*
* @param[in] inKey The timer/counter of interest.
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatReset (const uint32_t inKey); // New in SDK 16.0
/**
* Starts the given timer stat by recording the host OS' high-resolution clock.
*
* @param[in] inKey The timer of interest.
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatTimerStart (const uint32_t inKey); // New in SDK 16.0
/**
* Stops the given timer stat, storing the elapsed time since the last Start call
* into the timer's deque of elapsed times.
*
* @param[in] inKey The timer of interest.
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatTimerStop (const uint32_t inKey); // New in SDK 16.0
/**
* Increments the given counter stat.
*
* @param[in] inKey The counter of interest.
* @param[in] inIncrement Optionally specifies the increment value. Defaults to 1.
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatCounterIncrement (const uint32_t inKey, const uint32_t inIncrement = 1); // New in SDK 16.0
/**
* Records a new value for the stat.
*
* @param[in] inKey The counter of interest.
* @param[in] inValue Specifies the value.
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatSetValue (const uint32_t inKey, const uint32_t inValue); // New in SDK 16.0
/**
* Answers with the given stat's info.
*
* @param[in] inKey The timer/counter of interest.
* @param[out] outInfo Receives the timer/counter info.
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatGetInfo (const uint32_t inKey, AJADebugStat & outInfo); // New in SDK 16.0
/**
* Answers with the given stat's info.
*
* @param[out] outKeys Receives the list of allocated stats.
* @param[out] outSeqNum Receives the list change sequence number (to detect if the list changed).
* @return AJA_STATUS_SUCCESS if successful.
*/
static AJAStatus StatGetKeys (std::vector<uint32_t> & outKeys, uint32_t & outSeqNum); // New in SDK 16.0
/**
* Get the current time at the debug rate.
*
* @return The current time in debug ticks.
*/
static int64_t DebugTime (void);
// Old APIs
static const char* GetSeverityString (int32_t severity);
static const char* GetGroupString (int32_t group);
static AJAStatus GetDestination (int32_t index, uint32_t* pDestination) {return pDestination ? GetDestination(index, *pDestination) : AJA_STATUS_NULL;}
static AJAStatus GetClientReferenceCount (int32_t* pRefCount) {return pRefCount ? GetClientReferenceCount(*pRefCount) : AJA_STATUS_NULL;}
static AJAStatus GetSequenceNumber (uint64_t* pSequenceNumber) {return pSequenceNumber ? GetSequenceNumber(*pSequenceNumber) : AJA_STATUS_NULL;}
static AJAStatus GetMessageSequenceNumber (uint64_t sequenceNumber, uint64_t *pSequenceNumber) {return pSequenceNumber ? GetMessageSequenceNumber(sequenceNumber, *pSequenceNumber) : AJA_STATUS_NULL;}
static AJAStatus GetMessageGroup (uint64_t sequenceNumber, int32_t* pGroupIndex) {return pGroupIndex ? GetMessageGroup(sequenceNumber, *pGroupIndex) : AJA_STATUS_NULL;}
static AJAStatus GetMessageDestination (uint64_t sequenceNumber, uint32_t* pDestination) {return pDestination ? GetMessageDestination(sequenceNumber, *pDestination) : AJA_STATUS_NULL;}
static AJAStatus GetMessageTime (uint64_t sequenceNumber, uint64_t* pTime) {return pTime ? GetMessageTime(sequenceNumber, *pTime) : AJA_STATUS_NULL;}
static AJAStatus GetMessageWallClockTime (uint64_t sequenceNumber, int64_t *pTime) {return pTime ? GetMessageWallClockTime(sequenceNumber, *pTime) : AJA_STATUS_NULL;}
static AJAStatus GetMessageFileName (uint64_t sequenceNumber, const char** ppFileName);
static AJAStatus GetMessageLineNumber (uint64_t sequenceNumber, int32_t* pLineNumber) {return pLineNumber ? GetMessageLineNumber(sequenceNumber, *pLineNumber) : AJA_STATUS_NULL;}
static AJAStatus GetMessageSeverity (uint64_t sequenceNumber, int32_t* pSeverity) {return pSeverity ? GetMessageSeverity(sequenceNumber, *pSeverity) : AJA_STATUS_NULL;}
static AJAStatus GetMessageText (uint64_t sequenceNumber, const char** ppMessage);
static AJAStatus GetProcessId (uint64_t sequenceNumber, uint64_t* pPid) {return pPid ? GetProcessId(sequenceNumber, *pPid) : AJA_STATUS_NULL;}
static AJAStatus GetThreadId (uint64_t sequenceNumber, uint64_t* pTid) {return pTid ? GetThreadId(sequenceNumber, *pTid) : AJA_STATUS_NULL;}
static AJAStatus GetMessagesAccepted (uint64_t* pCount) {return pCount ? GetMessagesAccepted(*pCount) : AJA_STATUS_NULL;}
static AJAStatus GetMessagesIgnored (uint64_t* pCount) {return pCount ? GetMessagesIgnored(*pCount) : AJA_STATUS_NULL;}
// Other APIs
static void * GetPrivateDataLoc (void);
static size_t GetPrivateDataLen (void);
}; // AJADebug
std::ostream & operator << (std::ostream & oss, const AJADebugStat & inStat);
#endif // AJA_DEBUG_H

View File

@ -1,302 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file debugshare.h
@brief Declares the constants used for sharing debug messages. These structures are used
to gather debug messages and share them with the applications that report and log.
@note This file is shared with drivers written in c.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_DEBUGSHARE_H
#define AJA_DEBUGSHARE_H
/**
* The list of debug message severity codes.
* @ingroup AJAGroupDebug
*/
///@{
typedef enum _AJADebugSeverity
{
AJA_DebugSeverity_Emergency = 0, /**< System is unusable */
AJA_DebugSeverity_Alert = 1, /**< Action must be taken immediately */
AJA_DebugSeverity_Assert = 2, /**< Assert conditions */
AJA_DebugSeverity_Error = 3, /**< Error conditions */
AJA_DebugSeverity_Warning = 4, /**< Warning conditions */
AJA_DebugSeverity_Notice = 5, /**< Normal but significant condition */
AJA_DebugSeverity_Info = 6, /**< Informational */
AJA_DebugSeverity_Debug = 7, /**< Debug-level messages */
AJA_DebugSeverity_Size = 8 /**< Size of severity enum, must be last */
} AJADebugSeverity;
///@}
/**
* The list of debug message groups.
* @ingroup AJAGroupDebug
*/
///@{
typedef enum _AJADebugUnit
{
AJA_DebugUnit_Unknown = 0,
AJA_DebugUnit_Critical = 1,
AJA_DebugUnit_DriverGeneric = 2,
AJA_DebugUnit_ServiceGeneric = 3,
AJA_DebugUnit_UserGeneric = 4,
AJA_DebugUnit_VideoGeneric = 5,
AJA_DebugUnit_AudioGeneric = 6,
AJA_DebugUnit_TimecodeGeneric = 7,
AJA_DebugUnit_AncGeneric = 8,
AJA_DebugUnit_RoutingGeneric = 9,
AJA_DebugUnit_StatsGeneric = 10,
AJA_DebugUnit_Enumeration = 11,
AJA_DebugUnit_Application = 12,
AJA_DebugUnit_QuickTime = 13,
AJA_DebugUnit_ControlPanel = 14,
AJA_DebugUnit_Watcher = 15,
AJA_DebugUnit_Plugins = 16,
AJA_DebugUnit_CCLine21Decode = 17,
AJA_DebugUnit_CCLine21Encode = 18,
AJA_DebugUnit_CC608DataQueue = 19,
AJA_DebugUnit_CC608MsgQueue = 20,
AJA_DebugUnit_CC608Decode = 21,
AJA_DebugUnit_CC608DecodeChannel = 22,
AJA_DebugUnit_CC608DecodeScreen = 23,
AJA_DebugUnit_CC608Encode = 24,
AJA_DebugUnit_CC708Decode = 25,
AJA_DebugUnit_CC708Service = 26,
AJA_DebugUnit_CC708ServiceBlockQueue = 27,
AJA_DebugUnit_CC708Window = 28,
AJA_DebugUnit_CC708Encode = 29,
AJA_DebugUnit_CCFont = 30,
AJA_DebugUnit_SMPTEAnc = 31,
AJA_DebugUnit_AJAAncData = 32,
AJA_DebugUnit_AJAAncList = 33,
AJA_DebugUnit_Testing = 34,
AJA_DebugUnit_PnP = 35,
AJA_DebugUnit_Persistence = 36,
AJA_DebugUnit_Avid = 37,
AJA_DebugUnit_DriverInterface = 38,
AJA_DebugUnit_AutoCirculate = 39,
AJA_DebugUnit_NMOS = 40,
AJA_DebugUnit_App_DiskRead = 41,
AJA_DebugUnit_App_DiskWrite = 42,
AJA_DebugUnit_App_Decode = 43,
AJA_DebugUnit_App_Encode = 44,
AJA_DebugUnit_App_DMA = 45,
AJA_DebugUnit_App_Screen = 46,
AJA_DebugUnit_App_User1 = 47,
AJA_DebugUnit_App_User2 = 48,
AJA_DebugUnit_Anc2110Xmit = 49,
AJA_DebugUnit_Anc2110Rcv = 50,
AJA_DebugUnit_DemoPlayout = 51,
AJA_DebugUnit_DemoCapture = 52,
AJA_DebugUnit_CSC = 53,
AJA_DebugUnit_LUT = 54,
AJA_DebugUnit_Cables = 55,
AJA_DebugUnit_RPCServer = 56,
AJA_DebugUnit_RPCClient = 57,
AJA_DebugUnit_Firmware = 58,
// to add a new unit:
//
// if there is an unused unit below:
//
// * rename the next available unused and move above this comment block
// * make sure the enum starts with "AJA_DebugUnit_"
// * update the value of AJA_DebugUnit_FirstUnused with the value of the new next available unused
//
// else if there are not any unused units below:
//
// * add the new unit above this message block with the next available index
// * make sure the enum starts with "AJA_DebugUnit_"
// * increment AJA_DebugUnit_Size by 1
//
// if no more unused units
// * set AJA_DebugUnit_FirstUnused to the same value as AJA_DebugUnit_Size
//
AJA_DebugUnit_FirstUnused = 59,
AJA_DebugUnit_Unused_59 = AJA_DebugUnit_FirstUnused,
AJA_DebugUnit_Unused_60 = 60,
AJA_DebugUnit_Unused_61 = 61,
AJA_DebugUnit_Unused_62 = 62,
AJA_DebugUnit_Unused_63 = 63,
AJA_DebugUnit_Unused_64 = 64,
AJA_DebugUnit_Unused_65 = 65,
AJA_DebugUnit_Unused_66 = 66,
AJA_DebugUnit_Unused_67 = 67,
AJA_DebugUnit_Unused_68 = 68,
AJA_DebugUnit_Unused_69 = 69,
AJA_DebugUnit_Unused_70 = 70,
AJA_DebugUnit_Unused_71 = 71,
AJA_DebugUnit_Unused_72 = 72,
AJA_DebugUnit_Unused_73 = 73,
AJA_DebugUnit_Unused_74 = 74,
AJA_DebugUnit_Unused_75 = 75,
AJA_DebugUnit_Unused_76 = 76,
AJA_DebugUnit_Unused_77 = 77,
AJA_DebugUnit_Unused_78 = 78,
AJA_DebugUnit_Unused_79 = 79,
AJA_DebugUnit_Unused_80 = 80,
AJA_DebugUnit_Unused_81 = 81,
AJA_DebugUnit_Unused_82 = 82,
AJA_DebugUnit_Unused_83 = 83,
AJA_DebugUnit_Unused_84 = 84,
AJA_DebugUnit_Size = 85
} AJADebugUnit;
///@}
/**
@defgroup AJAUnitDestination AJA_DEBUG_DESTINATION
Bit definitions that specify the destination of a debug message.
@ingroup AJAGroupDebug
Use logical OR for multiple destinations.
**/
///@{
#define AJA_DEBUG_DESTINATION_NONE 0 /**< Unknown destination, used as default */
#define AJA_DEBUG_DESTINATION_DEBUG 0x00000001 /**< Send message to the debug window */
#define AJA_DEBUG_DESTINATION_CONSOLE 0x00000002 /**< Send message to the console */
#define AJA_DEBUG_DESTINATION_LOG 0x00000004 /**< Send message to a log file */
#define AJA_DEBUG_DESTINATION_DRIVER 0x00000008 /**< Send message directly to driver output (driver messages only) */
///@}
/**
@defgroup AJAGroupVarious AJA_DEBUG
Various parameters that define the characteristics of the shared debug memory space.
SDK 16.0 introduced a new stats measurement feature that still allows logging to work in pre-16.0 clients.
@ingroup AJAGroupDebug
**/
///@{
#define AJA_DEBUG_MAGIC_ID AJA_FOURCC('D','B','U','G') /**< Magic identifier of the debug system */
#define AJA_DEBUG_VERSION 110 /**< Version of the debug system */
#define AJA_DEBUG_UNIT_ARRAY_SIZE 65536 /**< Number of unit destinations */
#define AJA_DEBUG_SEVERITY_ARRAY_SIZE 64 /**< Number of severity destinations */
#define AJA_DEBUG_MAX_NUM_STATS 256 /**< Max number of individual stats measurements (multiple of 64) */
#define AJA_DEBUG_STAT_DEQUE_SIZE 11
#define AJA_DEBUG_MESSAGE_MAX_SIZE 512 /**< Maximum size of a message */
#define AJA_DEBUG_MESSAGE_RING_SIZE 4096 /**< Size of the message ring */
#define AJA_DEBUG_FILE_NAME_MAX_SIZE 512 /**< Maximum size of a file name */
#define AJA_DEBUG_SHARE_NAME "aja-shm-debug" /**< Name of the shared memory for the debug messages */
#define AJA_DEBUG_TICK_RATE 1000000 /**< Resolution of debug time in ticks/second */
#define AJA_DEBUG_STATE_FILE_VERSION 510 /**< Version number of the state file format */
///@}
/**
Structure representing the debug message.
@ingroup AJAGroupDebug
**/
// using a 16 byte alignment for arm64 atomic operations to work properly
#pragma pack(push, 16)
typedef struct _AJADebugMessage
{
uint64_t sequenceNumber; /**< Sequence number of this message */
int64_t time; /**< Time this message was generated (microseconds) */
int64_t wallTime; /**< Time this message was generated as returned by time() */
int32_t groupIndex; /**< Group that generated this message */
uint32_t destinationMask; /**< Destination of the message */
int32_t severity; /**< Severity of the message */
int32_t lineNumber; /**< Source file line number that generated this message */
uint64_t pid; /**< Process ID that generated the message */
uint64_t tid; /**< Thread ID that generated the message */
char fileName[AJA_DEBUG_FILE_NAME_MAX_SIZE]; /**< Source file name that generated this message */
char messageText[AJA_DEBUG_MESSAGE_MAX_SIZE]; /**< Text generated for this message */
} AJADebugMessage;
/**
64-byte structure representing an unsigned 32-bit measurement (timer, counter or data value).
As a timer, it stores minimum, maximum and average elapsed time in microseconds.
As a data value, it stores minimum, maximum, moving average value, and last update usec timestamp.
As a counter, it can increment or decrement, with or without rollover/rollunder.
@ingroup AJAGroupDebug
**/
class AJADebugStat
{
public:
uint32_t fMin; /**< Smallest value yet seen. (Fixed at 0xFFFFFFFF and unused for counters.) */
uint32_t fMax; /**< Largest value yet seen. (Fixed at zero and unused for counters.) */
uint32_t fCount; /**< Update/change count */
uint64_t fLastTimeStamp; /**< Timestamp (start time for timer, zero if not running; last update time for counter or data value) */
uint32_t fValues[AJA_DEBUG_STAT_DEQUE_SIZE]; /**< Deque that provides an 11-sample moving average. (Unused for counters.) */
AJADebugStat() {Reset();}
void Reset (void)
{
fMin = 0xFFFFFFFF;
fMax = fCount = 0;
fLastTimeStamp = 0;
for (size_t n(0); n < AJA_DEBUG_STAT_DEQUE_SIZE; n++)
fValues[n] = 0;
}
double Average(void) const; /**< Returns the average of the stored values */
uint64_t Sum (const size_t inNum = 0) const; /**< Returns the sum of the first "inNum" stored values */
void Start (void); /**< Starts a timer by setting fLastTimeStamp to the high-resolution host OS system timestamp */
/**
* Stops the timer, stores the elapsed time in the deque, bumps fCount, and clears fLastTimeStamp.
* Also updates fMin and/or fMax if necessary.
*/
void Stop (void);
/**
* Increments fCount by the given amount, and sets fLastTimeStamp.
* @param[in] inIncrement Optionally specifies a different increment value. Defaults to 1.
* @param[in] inRollOver Optionally controls if overflow is permitted. Defaults to true.
*/
void Increment (const uint32_t inIncrement = 1, const bool inRollOver = true);
/**
* Decrements fCount by the given amount, and sets fLastTimeStamp.
* @param[in] inDecrement Optionally specifies a different increment value. Defaults to 1.
* @param[in] inRollUnder Optionally controls if underflow is permitted. Defaults to true.
*/
void Decrement (const uint32_t inDecrement = 1, const bool inRollUnder = true);
/**
* Inserts the given value into the deque, bumps fCount, and sets fLastTimeStamp to the current time.
* @param[in] inValue Specifies the value to store.
* @param[in] inStamp Optionally specifies whether to set the timestamp or not. Defaults to true.
*/
void SetValue (const uint32_t inValue, const bool inStamp = true);
};
/**
Structure representing the shared debug groups and messages.
@ingroup AJAGroupDebug
**/
typedef struct _AJADebugShare
{
uint32_t magicId; /**< Magic cookie identifier used to id this as an AJADebugShare structure */
uint32_t version; /**< Version of the debug system */
uint64_t volatile writeIndex; /**< Write index for the message ring */
int32_t volatile clientRefCount; /**< A count of current number of clients using structure*/
uint32_t messageRingCapacity; /**< The number of messages that can be in the ring */
uint32_t messageTextCapacity; /**< The maximum text capacity of message in bytes */
uint32_t messageFileNameCapacity; /**< The maximum text capacity of message filename in bytes */
uint32_t unitArraySize; /**< The number of unit destinations */
uint64_t volatile statsMessagesAccepted; /**< The number of messages accepted into the ring since creation */
uint64_t volatile statsMessagesIgnored; /**< The number of messages ignored since creation, filtered out */
uint32_t statCapacity; /**< The number of stats that can be stored, or zero if no stat facility (new in SDK 16) */
uint32_t volatile statAllocChanges; /**< Number of changes to statAllocMask (new in SDK 16.0) */
uint64_t statAllocMask[AJA_DEBUG_MAX_NUM_STATS/64]; /**< Stats allocation bitmask, 1 bit per stats measurement (new in SDK 16.0) */
uint32_t reserved[128 - 1 - 1 - 2*AJA_DEBUG_MAX_NUM_STATS/64]; /**< Reserved (was [128] in version 110) */
uint32_t unitArray[AJA_DEBUG_UNIT_ARRAY_SIZE]; /**< Array of message destinations by unit */
AJADebugMessage messageRing[AJA_DEBUG_MESSAGE_RING_SIZE]; /**< Message ring holding current message data */
AJADebugStat stats[AJA_DEBUG_MAX_NUM_STATS]; /**< Per-stat measurement data (new in v111) */
} AJADebugShare;
#pragma pack(pop)
#endif // AJA_DEBUGSHARE_H

View File

@ -1,44 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file diskstatus.h
@brief Declares the AJADiskStatus class.
@copyright (C) 2013-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_DISK_STATUS_H
#define AJA_DISK_STATUS_H
#include "ajabase/common/public.h"
typedef enum
{
AJADiskStatusUnitTypeByte,
AJADiskStatusUnitTypeKiloByte,
AJADiskStatusUnitTypeMegaByte,
AJADiskStatusUnitTypeGigaByte
} AJADiskStatusUnitType;
/**
* System independent disk status.
* @ingroup AJAGroupSystem
*/
class AJA_EXPORT AJADiskStatus
{
public:
AJADiskStatus();
virtual ~AJADiskStatus();
/**
* Get the available free space and total drive space for path.
*
* @param[in] dirPath Path to the volume to get space info about.
* @param[out] freeSpace Available free space on volume in unitType units, is untouched if return is false.
* @param[out] totalSpace Total space on volume in unitType units, is untouched if return is false.
* @param[in] unitType Unit of measure for space values, B, KB, MB, GB
* @return true if successfully got space info for path, false for failure.
*/
static bool GetFreeAndTotalSpace(const char* dirPath, double& freeSpace, double& totalSpace, AJADiskStatusUnitType unitType = AJADiskStatusUnitTypeGigaByte);
};
#endif // AJA_DISK_STATUS_H

View File

@ -1,142 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file event.h
@brief Declares the AJAEvent class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_EVENT_H
#define AJA_EVENT_H
#include "ajabase/common/public.h"
#include <string>
// forward declarations.
class AJAEventImpl;
/**
* System independent event class for signaling between threads.
* @ingroup AJAGroupSystem
*/
class AJA_EXPORT AJAEvent
{
public:
friend AJA_EXPORT AJAStatus AJAWaitForEvents(AJAEvent*, uint32_t, bool, uint32_t);
/**
* Constructor obtains an event object from the system.
*
* The event is automatically reset when the first waiting thread is released. Set manualReset
* to control the reset with the api. Specify a name if the event is to be shared system wide.
*
* @param[in] manualReset true if event must be reset by caller.
* false if event automatically reset.
* @param[in] name Name of a shared lock object.
*/
AJAEvent(bool manualReset = true, const std::string& name = "");
virtual ~AJAEvent();
/**
* Set the event to the signaled state.
*
* @return AJA_STATUS_SUCCESS Event signaled
* AJA_STATUS_FAIL Signal failed
* AJA_STATUS_OPEN Event not initialized
*/
virtual AJAStatus Signal();
/**
* Set the event to a non signaled state.
*
* @return AJA_STATUS_SUCCESS Event cleared
* AJA_STATUS_FAIL Clear failed
* AJA_STATUS_OPEN Event not initialized
*/
virtual AJAStatus Clear();
/**
* Set the event to the state specified by the parameter signaled.
*
* @param[in] signaled True to signal, false to clear
* @return AJA_STATUS_SUCCESS State set
* AJA_STATUS_FAIL State not set
* AJA_STATUS_OPEN Event not initialized
*/
virtual AJAStatus SetState(bool signaled = true);
/**
* Get the current state of the event.
*
* @param[out] pSignaled True if signaled
* @return AJA_STATUS_SUCCESS State available
* AJA_STATUS_OPEN Event not initialized
* AJA_STATUS_FAIL Event error
*/
virtual AJAStatus GetState(bool* pSignaled);
/**
* Set the manual reset state.
*
* @param[in] manualReset True to enable manual signal reset, False to enabled automatically reset of signal
* @return AJA_STATUS_SUCCESS Manual reset state set
* AJA_STATUS_FAIL Manual reset state not set
*/
virtual AJAStatus SetManualReset(bool manualReset);
/**
* Get the manual reset state.
*
* @param[out] pManualReset True indicates manually reset of signal is required, False indicates it is automatic
* @return AJA_STATUS_SUCCESS Manual reset state initialized
* AJA_STATUS_FAIL Manual reset state not initialized
*/
virtual AJAStatus GetManualReset(bool* pManualReset);
/**
* Wait for the event to be signaled.
*
* @param[in] timeout Wait timeout in milliseconds.
* @return AJA_STATUS_SUCCESS Event was signaled
* AJA_STATUS_TIMEOUT Event wait timeout
* AJA_STATUS_OPEN Event not initialized
* AJA_STATUS_FAIL Event error
*/
virtual AJAStatus WaitForSignal(uint32_t timeout = 0xffffffff);
/**
* Get the system event object.
*
* @param[out] pEventObject The system event object
* @return AJA_STATUS_SUCCESS Event object returned
* AJA_STATUS_OPEN Event not initialized
*/
virtual AJAStatus GetEventObject(uint64_t* pEventObject);
private:
AJAEventImpl* mpImpl;
};
/**
* Wait for a list of events to be signaled.
* @relates AJAEvent
*
* The wait can terminate when one or all of the events in the list is signaled.
*
* @param[in] pList An array of events (AJAEventPtr).
* @param[in] numEvents Number of events in the event array.
* @param[in] all true to wait for all events to be signaled.
* @param[in] timeout Wait timeout in milliseconds (0xffffffff infinite).
* @return AJA_STATUS_SUCCESS events signaled
* AJA_STATUS_TIMEOUT event wait timeout
* AJA_STATUS_OPEN event not initialized
* AJA_STATUS_RANGE numEvents out of range
* AJA_STATUS_FAIL event error
*/
AJA_EXPORT AJAStatus AJAWaitForEvents( AJAEvent* pList,
uint32_t numEvents,
bool all = true,
uint32_t timeout = 0xffffffff);
#endif // AJA_EVENT_H

View File

@ -1,322 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file file_io.h
@brief Declares the AJAFileIO class.
@copyright (C) 2011-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_FILE_IO_H
#define AJA_FILE_IO_H
#include "ajabase/common/types.h"
#include "ajabase/common/public.h"
#include "ajabase/system/system.h"
#include <vector>
#include <string>
#if defined(AJA_WINDOWS)
const char AJA_PATHSEP = '\\';
const wchar_t AJA_PATHSEP_WIDE = L'\\';
#else
const char AJA_PATHSEP = '/';
const wchar_t AJA_PATHSEP_WIDE = L'/';
#endif
typedef enum
{
eAJACreateAlways = 1,
eAJACreateNew = 2,
eAJATruncateExisting = 4,
eAJAReadOnly = 8,
eAJAWriteOnly = 16,
eAJAReadWrite = 32
} AJAFileCreationFlags;
typedef enum
{
eAJABuffered = 1,
eAJAUnbuffered = 2,
eAJANoCaching = 4
} AJAFileProperties;
typedef enum
{
eAJASeekSet,
eAJASeekCurrent,
eAJASeekEnd
} AJAFileSetFlag;
/**
* The File I/O class proper.
* @ingroup AJAGroupSystem
*/
class AJA_EXPORT AJAFileIO
{
public:
AJAFileIO();
~AJAFileIO();
/**
* Open a file.
*
* @param[in] fileName The fully qualified file name
* @param[in] flags The way in which the file is opened
* @param[in] properties Indicates whether the file is buffered or not
*
* @return AJA_STATUS_SUCCESS A file has been successfully opened
* AJA_STATUS_FAIL A file could not be opened
*/
AJAStatus Open(
const std::string & fileName,
const int flags,
const int properties);
AJAStatus Open(
const std::wstring & fileName,
const int flags,
const int properties);
/**
* Close a file.
*
* @return AJA_STATUS_SUCCESS The file was successfully closed
* AJA_STATUS_FAIL The file could not be closed
*/
AJAStatus Close();
/**
* Tests for a valid open file.
*
* @return bool 'true' if a valid file is available
*/
bool IsOpen();
/**
* Read the contents of the file.
*
* @param[out] pBuffer The buffer to be written to
* @param[in] length The number of bytes to be read
*
* @return uint32_t The number of bytes actually read
*/
uint32_t Read(uint8_t* pBuffer, const uint32_t length);
/**
* Read the contents of the file.
*
* @param[out] buffer The buffer to be written to
* @param[in] length The number of bytes to be read
*
* @return uint32_t The number of bytes actually read
*/
uint32_t Read(std::string& buffer, const uint32_t length);
/**
* Write the contents of the file.
*
* @param[in] pBuffer The buffer to be written out
* @param[in] length The number of bytes to be written
*
* @return uint32_t The number of bytes actually written
*/
uint32_t Write(const uint8_t* pBuffer, const uint32_t length) const;
/**
* Write the contents of the file.
*
* @param[in] buffer The buffer to be written out
*
* @return uint32_t The number of bytes actually written
*/
uint32_t Write(const std::string& buffer) const;
/**
* Flush the cache
*
* @return AJA_STATUS_SUCCESS Was able to sync file
*/
AJAStatus Sync();
/**
* Truncates the file.
*
* @param[in] offset The size offset of the file
*
* @return AJA_STATUS_SUCCESS Was able to truncate file
*/
AJAStatus Truncate(int32_t offset);
/**
* Retrieves the offset of the file pointer from the start of a file.
*
* @return int64_t The position of the file pointer, -1 if error
*/
int64_t Tell();
/**
* Moves the offset of the file pointer.
*
* @param[in] distance The distance to move the file pointer
* @param[in] flag Describes from whence to move the file pointer
*
* @return AJA_STATUS_SUCCESS The position of the file pointer was moved
*/
AJAStatus Seek(const int64_t distance, const AJAFileSetFlag flag) const;
/**
* Get some basic file info
*
* @param[out] createTime Time of file creation, measured in seconds since 1970
* @param[out] modTime Last time file was modified, measured in seconds since 1970
* @param[out] size Size of the file in bytes
*
* @return AJA_STATUS_SUCCESS Was able to get info from the file
*/
AJAStatus FileInfo(int64_t& createTime, int64_t& modTime, int64_t& size);
AJAStatus FileInfo(int64_t& createTime, int64_t& modTime, int64_t& size, std::string& filePath);
/**
* Test file to see if it exists
*
* @param[in] fileName The fully qualified file name
*
* @return bool true if file exists
*/
static bool FileExists(const std::wstring& fileName);
static bool FileExists(const std::string& fileName);
/**
* Remove the file for the system
*
* @param[in] fileName The fully qualified file name
*
* @return AJA_STATUS_SUCCESS The file was successfully deleteed
* AJA_STATUS_FAIL The file could not be deleted
*/
static AJAStatus Delete(const std::string& fileName);
static AJAStatus Delete(const std::wstring& fileName);
/**
* Retrieves a set of files from a directory.
* Changes the current directory.
*
* @param[in] directory The path to the directory
* @param[in] filePattern The pattern within the directory to match
* @param[out] fileContainer The files that match the file pattern
*
* @return AJA_STATUS_SUCCESS The returned container has a size > 0
*/
static AJAStatus ReadDirectory(
const std::string& directory,
const std::string& filePattern,
std::vector<std::string>& fileContainer);
static AJAStatus ReadDirectory(
const std::wstring& directory,
const std::wstring& filePattern,
std::vector<std::wstring>& fileContainer);
/**
* Tests if a directory contains a file that matches the pattern.
* Does not change the current directory.
*
* @param[in] directory The path to the directory
* @param[in] filePattern The pattern within the directory to match
*
* @return AJA_STATUS_SUCCESS If the directory has at least one matching file
*/
static AJAStatus DoesDirectoryContain(
const std::string& directory,
const std::string& filePattern);
static AJAStatus DoesDirectoryContain(
const std::wstring& directory,
const std::wstring& filePattern);
/**
* Tests if a directory exists.
* Does not change the current directory.
*
* @param[in] directory The path to the directory
*
* @return AJA_STATUS_SUCCESS If and only if the directory exists
*/
static AJAStatus DoesDirectoryExist(const std::string& directory);
static AJAStatus DoesDirectoryExist(const std::wstring& directory);
/**
* Tests if a directory is empty.
* Does not change the current directory.
*
* @param[in] directory The path to the directory
*
* @return AJA_STATUS_SUCCESS If and only if the directory contains no files
*/
static AJAStatus IsDirectoryEmpty(const std::string& directory);
static AJAStatus IsDirectoryEmpty(const std::wstring& directory);
/**
* Retrieves a path to the temp directory
*
* @param[out] directory The path to the temp directory
*
* @return AJA_STATUS_SUCCESS If and only if a temp directory found
*/
static AJAStatus TempDirectory(std::string& directory); // New in SDK 16.0
static AJAStatus TempDirectory(std::wstring& directory); // New in SDK 16.0
/**
* Retrieves the path to the current working directory
*
* @param[out] directory Path of the current working directory
*
* @return AJA_STATUS_SUCCESS If and only if current working directory retrieved.
*/
static AJAStatus GetWorkingDirectory(std::string& directory); // New in SDK 16.0
static AJAStatus GetWorkingDirectory(std::wstring& directory); // New in SDK 16.0
/**
* Retrieves the directory name from the specified path.
*
* @param[in] path Path from which to extract the directory name
*
* @param[out] directory Path of the directory extracted from specified path
*
* @return AJA_STATUS_SUCCESS If and only if the directory name is extracted
*/
static AJAStatus GetDirectoryName(const std::string& path, std::string& directory); // New in SDK 16.0
static AJAStatus GetDirectoryName(const std::wstring& path, std::wstring& directory); // New in SDK 16.0
/**
* Retrieves the filename (with extension) from the specified path.
*
* @param[in] path Path from which to extract the filename
*
* @param[out] filename Filename extracted from specified path
*
* @return AJA_STATUS_SUCCESS If and only if the filename is extracted
*/
static AJAStatus GetFileName(const std::string& path, std::string& filename); // New in SDK 16.0
static AJAStatus GetFileName(const std::wstring& path, std::wstring& filename); // New in SDK 16.0
#if defined(AJA_WINDOWS)
void *GetHandle(void) {return mFileDescriptor;}
#else
void *GetHandle(void) {return NULL;}
#endif
private:
#if defined(AJA_WINDOWS)
HANDLE mFileDescriptor;
#else
FILE* mpFile;
#endif
};
#endif // AJA_FILE_IO_H

View File

@ -1,192 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file info.h
@brief Declares the AJASystemInfo class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_INFO_H
#define AJA_INFO_H
#include "ajabase/common/public.h"
#include <vector>
#include <map>
#include <string>
// forward declarations
class AJASystemInfoImpl;
enum AJASystemInfoMemoryUnit
{
AJA_SystemInfoMemoryUnit_Bytes,
AJA_SystemInfoMemoryUnit_Kilobytes,
AJA_SystemInfoMemoryUnit_Megabytes,
AJA_SystemInfoMemoryUnit_Gigabytes,
AJA_SystemInfoMemoryUnit_LAST
};
enum AJASystemInfoTag
{
AJA_SystemInfoTag_System_Model,
AJA_SystemInfoTag_System_Bios,
AJA_SystemInfoTag_System_Name,
AJA_SystemInfoTag_System_BootTime,
AJA_SystemInfoTag_OS_ProductName,
AJA_SystemInfoTag_OS_Version,
AJA_SystemInfoTag_OS_VersionBuild,
AJA_SystemInfoTag_OS_KernelVersion,
AJA_SystemInfoTag_CPU_Type,
AJA_SystemInfoTag_CPU_NumCores,
AJA_SystemInfoTag_Mem_Total,
AJA_SystemInfoTag_Mem_Used,
AJA_SystemInfoTag_Mem_Free,
AJA_SystemInfoTag_GPU_Type,
AJA_SystemInfoTag_Path_UserHome,
AJA_SystemInfoTag_Path_PersistenceStoreUser,
AJA_SystemInfoTag_Path_PersistenceStoreSystem,
AJA_SystemInfoTag_Path_Applications,
AJA_SystemInfoTag_Path_Utilities,
AJA_SystemInfoTag_Path_Firmware,
AJA_SystemInfoTag_LAST
};
enum AJASystemInfoSections
{
AJA_SystemInfoSection_CPU = 0x00000001 << 0,
AJA_SystemInfoSection_GPU = 0x00000001 << 1,
AJA_SystemInfoSection_Mem = 0x00000001 << 2,
AJA_SystemInfoSection_OS = 0x00000001 << 3,
AJA_SystemInfoSection_Path = 0x00000001 << 4,
AJA_SystemInfoSection_System = 0x00000001 << 5,
AJA_SystemInfoSection_None = 0x00000000,
AJA_SystemInfoSection_All = 0xFFFFFFFF
};
typedef std::pair<std::string, std::string> AJALabelValuePair; ///< @brief A pair of strings comprising a label and a value
typedef std::vector<AJALabelValuePair> AJALabelValuePairs; ///< @brief An ordered sequence of label/value pairs
typedef AJALabelValuePairs::const_iterator AJALabelValuePairsConstIter;
/**
* Class for getting common information about the system.
* @ingroup AJAGroupSystem
*
*
*/
class AJA_EXPORT AJASystemInfo
{
public: // Instance Methods
/**
* @brief Default constructor that instantiates the platform-specific implementation,
* then calls Rescan.
* @param[in] inUnits Optionally specifies the AJASystemInfoMemoryUnit to use.
* Defaults to "megabytes".
* @param[in] sections The sections of the info structure to rescan, bitwise OR the desired sections
* or use AJA_SystemInfoSection_All (the default) for all sections or
* AJA_SystemInfoSection_None for no sections. In the case of AJA_SystemInfoSection_None
* only the labels are set, no scanning is done at initialization.
*/
AJASystemInfo (const AJASystemInfoMemoryUnit inUnits = AJA_SystemInfoMemoryUnit_Megabytes,
AJASystemInfoSections sections = AJA_SystemInfoSection_All);
virtual ~AJASystemInfo();
/**
* Rescans the host system.
* @param[in] sections The sections of the info structure to rescan, bitwise OR the desired sections
* or use AJA_SystemInfoSection_All (the default) for all sections or
* AJA_SystemInfoSection_None for no sections. In the case of AJA_SystemInfoSection_None
* only the labels are set, no scanning is done.
*/
virtual AJAStatus Rescan (AJASystemInfoSections sections = AJA_SystemInfoSection_All);
/**
* @brief Answers with the host system info value string for the given AJASystemInfoTag.
* @param[in] inTag The AJASystemInfoTag of interest
* @param[out] outValue Receives the value string
* @return AJA_SUCCESS if successful
*/
virtual AJAStatus GetValue(const AJASystemInfoTag inTag, std::string & outValue) const;
/**
* @brief Answers with the host system info label string for the given AJASystemInfoTag.
* @param[in] inTag The AJASystemInfoTag of interest
* @param[out] outLabel Receives the label string
* @return AJA_SUCCESS if successful
*/
virtual AJAStatus GetLabel(const AJASystemInfoTag inTag, std::string & outLabel) const;
/**
* @brief Answers with a multi-line string that contains the complete host system info table.
* @param[out] outAllLabelsAndValues Receives the string
*/
virtual void ToString (std::string & outAllLabelsAndValues) const;
/**
* @return A multi-line string containing the complete host system info table.
* @param[in] inValueWrapLen Optionally specifies the maximum width of the "value" column,
* in characters. Zero, the default, disables wrapping.
* (However, wrapping always occurs on line-breaks (e.g. CRLF, LF, CR, etc.)).
* @param[in] inGutterWidth Optionally specifies the gap ("gutter") between the "label"
* and "value" columns, in character spaces. Defaults to 3 spaces.
*/
virtual std::string ToString (const size_t inValueWrapLen = 0, const size_t inGutterWidth = 3) const;
public: // Class Methods
/**
* @brief Generates a multi-line string from a "table" of label/value pairs that, when displayed
* in a monospaced font, appears as a neat, two-column table.
* @param[in] inLabelValuePairs The AJALabelValuePairs to be formatted as a table.
* @param[in] inValueWrapLen Optionally specifies the maximum width of the "value" column,
* in characters. Zero, the default, disables any/all wrapping.
* (However, wrapping always occurs on line-breaks (e.g. CRLF, LF, CR, etc.)).
* @param[in] inGutterWidth Optionally specifies the gap ("gutter") between the "label"
* and "value" columns, in character spaces. Defaults to 3 spaces.
* @return A multi-line string containing the formatted AJALabelValuePairs table.
* @bug Multi-byte UTF8 characters need to be counted as one character.
*/
static std::string ToString (const AJALabelValuePairs & inLabelValuePairs, const size_t inValueWrapLen = 0, const size_t inGutterWidth = 3);
/**
* @brief A convenience function that appends the given label and value strings to the
* provided AJALabelValuePairs table.
* @param inOutTable The AJALabelValuePairs table to be modified.
* @param[in] inLabel Specifies the label string to use.
* @param[in] inValue Specifies the value string to use. If empty, treat "inLabel" as a section heading.
* @return A reference to the given AJALabelValuePairs.
*/
static inline AJALabelValuePairs & append (AJALabelValuePairs & inOutTable, const std::string & inLabel, const std::string & inValue = std::string())
{inOutTable.push_back(AJALabelValuePair(inLabel,inValue)); return inOutTable;}
private: // Instance Data
AJASystemInfoImpl* mpImpl;
};
/**
@brief Streams a human-readable representation of the AJASystemInfo into the given output stream.
@param outStream The stream into which the given AJASystemInfo will be printed.
@param[in] inData The AJASystemInfo to be streamed.
@return A reference to the given "outStream".
**/
AJA_EXPORT std::ostream & operator << (std::ostream & outStream, const AJASystemInfo & inData);
/**
@brief Streams a human-readable representation of the AJALabelValuePair into the given output stream.
@param outStream The stream into which the given AJALabelValuePair will be printed.
@param[in] inData The AJALabelValuePair to be streamed.
@return A reference to the given "outStream".
**/
AJA_EXPORT std::ostream & operator << (std::ostream & outStream, const AJALabelValuePair & inData);
/**
@brief Streams a human-readable representation of the AJALabelValuePairs into the given output stream.
@param outStream The stream into which the given AJALabelValuePairs will be printed.
@param[in] inData The AJALabelValuePairs to be streamed.
@return A reference to the given "outStream".
**/
AJA_EXPORT std::ostream & operator << (std::ostream & outStream, const AJALabelValuePairs & inData);
#endif // AJA_INFO_H

View File

@ -1,43 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file linux/eventimpl.h
@brief Declares the AJAEventImpl class.
@copyright (C) 2010-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_EVENT_IMPL_H
#define AJA_EVENT_IMPL_H
#include "ajabase/system/system.h"
#include "ajabase/common/common.h"
#include "ajabase/system/event.h"
class AJAEventImpl
{
public:
AJAEventImpl(bool manualReset, const std::string& name);
virtual ~AJAEventImpl(void);
AJAStatus Signal(void);
AJAStatus Clear(void);
AJAStatus SetState(bool signaled = true);
AJAStatus GetState(bool* pSignaled);
AJAStatus SetManualReset(bool manualReset);
AJAStatus GetManualReset(bool* pManualReset);
AJAStatus WaitForSignal(uint32_t timeout = 0xffffffff);
virtual AJAStatus GetEventObject(uint64_t* pEventObject);
private:
pthread_mutex_t mMutex;
pthread_cond_t mCondVar;
bool mSignaled;
bool mManualReset;
};
#endif // AJA_EVENT_IMPL_H

View File

@ -1,29 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file linux/infoimpl.h
@brief Declares the AJASystemInfoImpl class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_INFO_IMPL_H
#define AJA_INFO_IMPL_H
#include "ajabase/common/common.h"
#include "ajabase/system/info.h"
class AJASystemInfoImpl
{
public:
AJASystemInfoImpl(int units);
virtual ~AJASystemInfoImpl();
virtual AJAStatus Rescan(AJASystemInfoSections sections);
std::map<int, std::string> mLabelMap;
std::map<int, std::string> mValueMap;
int mMemoryUnits;
};
#endif // AJA_INFO_IMPL_H

View File

@ -1,36 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file linux/lockimpl.h
@brief Declares the AJALockImpl class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_LOCK_IMPL_H
#define AJA_LOCK_IMPL_H
#include <pthread.h>
#include <semaphore.h>
#include "ajabase/system/system.h"
#include "ajabase/common/common.h"
#include "ajabase/system/lock.h"
class AJALockImpl
{
public:
AJALockImpl(const char* pName);
virtual ~AJALockImpl();
AJAStatus Lock(uint32_t uTimeout = 0xffffffff);
AJAStatus Unlock();
private:
const char* mName;
pthread_t mOwner;
int mRefCount;
pthread_mutex_t mMutex; // For protecting the member variables
};
#endif // AJA_LOCK_IMPL_H

View File

@ -1,29 +0,0 @@
/* SPDX-License-Identifier: MIT */
/**
@file linux/processimpl.h
@brief Declares the AJAProcessImpl class.
@copyright (C) 2009-2021 AJA Video Systems, Inc. All rights reserved.
**/
#ifndef AJA_PROCESS_IMPL_H
#define AJA_PROCESS_IMPL_H
#include "ajabase/system/system.h"
#include "ajabase/common/common.h"
#include "ajabase/system/process.h"
class AJAProcessImpl
{
public:
AJAProcessImpl();
virtual ~AJAProcessImpl();
static uint64_t GetPid();
static bool IsValid(uint64_t pid);
static bool Activate(uint64_t handle);
static bool Activate(const char* pWindow);
};
#endif // AJA_PROCESS_IMPL_H

Some files were not shown because too many files have changed in this diff Show More