26 mSingleDevice (
false),
63 while (mPlayThread.
Active())
66 while (mCaptureThread.
Active())
109 {cerr <<
"## ERROR: Input device '" << mConfig.
fDeviceSpec <<
"' is in use by another application" << endl;
return AJA_STATUS_BUSY;}
116 {cerr <<
"## ERROR: Output device '" << mConfig.
fDeviceSpec2 <<
"' is in use by another application" << endl;
return AJA_STATUS_BUSY;}
195 cerr <<
"Input Device Desc: " << mInputDevice.
GetDescription() << endl;
197 cerr <<
"Output Device Desc: " << mOutputDevice.
GetDescription() << endl;
200 BURNINFO(
"Configuration: " << mConfig);
439 if (!frameData.fVideoBuffer.Allocate (vidBuffSizeBytes,
true))
441 BURNFAIL(
"Failed to allocate " <<
xHEX0N(vidBuffSizeBytes,8) <<
"-byte video buffer");
452 if (frameData.AudioBuffer())
453 frameData.fAudioBuffer.Fill(
ULWord(0));
456 mFrameDataRing.
Add(&frameData);
584 ULWord goodXfers(0), badXfers(0), starves(0), noRoomWaits(0);
607 {
BURNFAIL(
"AutoCirculateInitForOutput failed"); mGlobalQuit =
true;}
620 {starves++;
continue;}
623 outputXferInfo.
SetVideoBuffer (pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
624 if (pFrameData->AudioBuffer())
625 outputXferInfo.
SetAudioBuffer(pFrameData->AudioBuffer(), pFrameData->AudioBufferSize());
650 BURNNOTE(
"Thread completed: " <<
DEC(goodXfers) <<
" xfers, " <<
DEC(badXfers) <<
" failed, " 651 <<
DEC(starves) <<
" ring starves, " <<
DEC(noRoomWaits) <<
" device starves");
668 mCaptureThread.
Start();
691 ULWord goodXfers(0), badXfers(0), ringFulls(0), devWaits(0);
714 {
BURNFAIL(
"AutoCirculateInitForInput failed"); mGlobalQuit =
true;}
731 {ringFulls++;
continue;}
733 inputXferInfo.
SetVideoBuffer(pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
734 if (pFrameData->AudioBuffer())
735 inputXferInfo.
SetAudioBuffer(pFrameData->AudioBuffer(), pFrameData->AudioBufferSize());
759 mTCBurner.
BurnTimeCode (pFrameData->VideoBuffer(), tcStr.c_str(), 80);
776 BURNNOTE(
"Thread completed: " <<
DEC(goodXfers) <<
" xfers, " <<
DEC(badXfers) <<
" failed, " 777 <<
DEC(ringFulls) <<
" ring full(s), " <<
DEC(devWaits) <<
" device waits");
795 switch (inInputSource)
816 if (regNum && mInputDevice.
ReadRegister(regNum, regValue) && regValue &
BIT(16))
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
virtual bool SetTaskMode(const NTV2TaskMode inMode)
Sets the device's task mode.
virtual void CaptureFrames(void)
Repeatedly captures frames using AutoCirculate (until global quit flag set).
Declares common types used in the ajabase library.
virtual bool SetAudioLoopBack(const NTV2AudioLoopBack inMode, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Enables or disables NTV2AudioLoopBack mode for the given NTV2AudioSystem.
Specifies the device's internal clock.
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=(0))
Sets the device's clock reference source. See Video Output Clocking & Synchronization for more inform...
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
virtual void Quit(void)
Gracefully stops me from running.
AJAStatus Add(FrameDataPtr pInFrameData)
Appends a new frame buffer to me, increasing my frame storage capacity by one frame.
virtual bool InputSignalHasTimecode(void)
Returns true if the current input signal has timecode embedded in it; otherwise returns false...
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=(!(0)), const bool inKeepVancSettings=(0), const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
ULWord GetCapturedAudioByteCount(void) const
virtual bool IsDeviceReady(const bool inCheckValid=(0))
#define AJA_FAILURE(_status_)
static void CaptureThreadStatic(AJAThread *pThread, void *pContext)
This is the capture thread's static callback function that gets called when the capture thread runs...
virtual AJAStatus SetPriority(AJAThreadPriority priority)
static void PlayThreadStatic(AJAThread *pThread, void *pContext)
This is the playout thread's static callback function that gets called when the playout thread runs...
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function t...
Obtain audio samples from the audio that's embedded in the video HANC.
if(!(riid==IID_IUnknown) &&!(riid==IID_IClassFactory))
bool CanAcceptMoreOutputFrames(void) const
bool SetOutputTimeCode(const NTV2_RP188 &inTimecode, const NTV2TCIndex inTCIndex=NTV2_TCINDEX_SDI1)
Intended for playout, sets one element of my acOutputTimeCodes member.
virtual void RouteOutputSignal(void)
Sets up board routing for playout.
virtual void StartPlayThread(void)
Starts my playout thread.
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
virtual AJAStatus Start()
virtual bool EnableInputInterrupt(const NTV2Channel channel=NTV2_CHANNEL1)
Allows the CNTV2Card instance to wait for and respond to input vertical blanking interrupts originati...
virtual bool SubscribeInputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Causes me to be notified when an input vertical blanking interrupt occurs on the given input channel...
void EndConsumeNextBuffer(void)
The consumer thread calls this function to signal that it has finished processing the frame it obtain...
virtual void RouteInputSignal(void)
Sets up board routing for capture.
virtual bool AutoCirculateGetStatus(const NTV2Channel inChannel, AUTOCIRCULATE_STATUS &outStatus)
Returns the current AutoCirculate status for the given channel.
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=(!(0)), NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
std::string fDeviceSpec2
Second AJA device to use (Burn4KQuadrant or BurnBoardToBoard only)
virtual class DeviceCapabilities & features(void)
virtual AJAStatus SetupOutputVideo(void)
Sets up everything I need for playing 4K video.
virtual bool EnableOutputInterrupt(const NTV2Channel channel=NTV2_CHANNEL1)
Allows the CNTV2Card instance to wait for and respond to output vertical blanking interrupts originat...
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
This identifies the 5th Audio System.
Identifies the 2nd SDI video input.
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device...
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
NTV2ACFrameRange fOutputFrames
Playout frame count or range.
This struct replaces the old RP188_STRUCT.
#define NTV2_AUDIOSIZE_MAX
virtual bool IsRemote(void) const
virtual bool GetTaskMode(NTV2TaskMode &outMode)
Retrieves the device's current task mode.
virtual bool SetAudioSystemInputSource(const NTV2AudioSystem inAudioSystem, const NTV2AudioSource inAudioSource, const NTV2EmbeddedAudioInput inEmbeddedInput)
Sets the audio source for the given NTV2AudioSystem on the device.
NTV2PixelFormat fPixelFormat
The pixel format to use.
static AJA_PixelFormat GetAJAPixelFormat(const NTV2PixelFormat inFormat)
NTV2Channel fOutputChannel
The output channel to use.
NTV2FrameRate
Identifies a particular video frame rate.
virtual bool SetLTCInputEnable(const bool inEnable)
Enables or disables the ability for the device to read analog LTC on the reference input connector...
Header file for the NTV2Burn4KQuadrant demonstration class.
Playout (output) mode, which reads from device SDRAM.
virtual std::string GetDescription(void) const
virtual AJAStatus SetupInputAudio(void)
Sets up everything I need for capturing audio.
virtual bool SetMode(const NTV2Channel inChannel, const NTV2Mode inNewValue, const bool inIsRetail=(!(0)))
Determines if a given FrameStore on the AJA device will be used to capture or playout video...
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
virtual bool UnsubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Unregisters me so I'm no longer notified when an output VBI is signaled on the given output channel...
static bool GetFirstDeviceFromArgument(const std::string &inArgument, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command li...
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
bool HasBiDirectionalSDI(void)
const AUTOCIRCULATE_TRANSFER_STATUS & GetTransferStatus(void) const
Returns a constant reference to my AUTOCIRCULATE_TRANSFER_STATUS.
virtual bool AutoCirculateTransfer(const NTV2Channel inChannel, AUTOCIRCULATE_TRANSFER &transferInfo)
Transfers all or part of a frame as specified in the given AUTOCIRCULATE_TRANSFER object to/from the ...
virtual bool SetRP188SourceFilter(const NTV2Channel inSDIInput, const UWord inFilterValue)
Sets the RP188 DBB filter for the given SDI input.
virtual bool AcquireStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
ULWord GetProcessedFrameCount(void) const
void SetAbortFlag(const bool *pAbortFlag)
Tells me the boolean variable I should monitor such that when it gets set to "true" will cause any th...
Identifies the 3rd SDI video input.
virtual NTV2VideoFormat GetInputVideoFormat(const NTV2InputSource inVideoSource=NTV2_INPUTSOURCE_SDI1, const bool inIsProgressive=(0))
Returns the video format of the signal that is present on the given input source. ...
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
2: OEM (recommended): device configured by client application(s) with some driver involvement...
static size_t DefaultPageSize(void)
virtual bool SetSDIOutputAudioSystem(const NTV2Channel inSDIOutputConnector, const NTV2AudioSystem inAudioSystem)
Sets the device's NTV2AudioSystem that will provide audio for the given SDI output's audio embedder...
virtual AJAStatus Run(void)
Runs me.
Embeds silence (zeroes) into the data stream.
Configures an NTV2Burn or NTV2FieldBurn instance.
Specifies channel or FrameStore 8 (or the 8th item).
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
Specifies channel or FrameStore 2 (or the 2nd item).
virtual NTV2DeviceID GetDeviceID(void)
Specifies the SDI In 1 connector.
UWord GetNumFrameStores(void)
Declares the CNTV2DeviceScanner class.
Identifies the 4th SDI video input.
static ULWord GetRP188RegisterForInput(const NTV2InputSource inInputSource)
Returns the RP188 DBB register number to use for the given NTV2InputSource.
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device...
std::string fDeviceSpec
The AJA device to use.
virtual bool AutoCirculateStop(const NTV2Channel inChannel, const bool inAbort=(0))
Stops AutoCirculate for the given channel, and releases the on-device frame buffers that were allocat...
Declares the AJAProcess class.
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=(0))
Connects the given widget signal input (sink) to the given widget signal output (source).
virtual bool UnsubscribeInputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Unregisters me so I'm no longer notified when an input VBI is signaled on the given input channel...
NTV2InputSource
Identifies a specific video input source.
Instances of me can capture 4K/UHD video from one 4-channel AJA device, burn timecode into one quadra...
bool IsRGBFormat(const NTV2FrameBufferFormat format)
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
virtual bool SetAudioBufferSize(const NTV2AudioBufferSize inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Changes the size of the audio buffer that is used for a given Audio System in the AJA device...
void EndProduceNextBuffer(void)
The producer thread calls this function to signal that it has finished populating the frame it obtain...
This identifies the first Audio System.
virtual bool WaitForOutputVerticalInterrupt(const NTV2Channel inChannel=NTV2_CHANNEL1, UWord inRepeatCount=1)
Efficiently sleeps the calling thread/process until the next one or more field (interlaced video) or ...
bool WithAudio(void) const
static const size_t CIRCULAR_BUFFER_SIZE(10)
Number of NTV2FrameData's in our ring.
static const ULWord kDemoAppSignature((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0))
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
FrameDataPtr StartProduceNextBuffer(void)
The thread that's responsible for providing frames – the producer – calls this function to populate...
bool GetInputTimeCodes(NTV2TimeCodeList &outValues) const
Intended for capture, answers with the timecodes captured in my acTransferStatus member's acFrameStam...
static bool Get4KInputFormat(NTV2VideoFormat &inOutVideoFormat)
Given a video format, if all 4 inputs are the same and promotable to 4K, this function does the promo...
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
NTV2ACFrameRange fInputFrames
Ingest frame count or range.
bool fSuppressVideo
If true, suppress video; otherwise include video.
Specifies channel or FrameStore 1 (or the first item).
virtual bool AutoCirculateStart(const NTV2Channel inChannel, const ULWord64 inStartTime=0)
Starts AutoCirculating the specified channel that was previously initialized by CNTV2Card::AutoCircul...
bool CanDoFrameBufferFormat(const NTV2PixelFormat inPF)
virtual bool SubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Causes me to be notified when an output vertical blanking interrupt is generated for the given output...
virtual bool AutoCirculateInitForOutput(const NTV2Channel inChannel, const UWord inFrameCount=7, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_INVALID, const ULWord inOptionFlags=0, const UByte inNumChannels=1, const UWord inStartFrameNumber=0, const UWord inEndFrameNumber=0)
Prepares for subsequent AutoCirculate playout, designating a contiguous block of frame buffers on the...
#define xHEX0N(__x__, __n__)
virtual bool SetEnableVANCData(const bool inVANCenabled, const bool inTallerVANC, const NTV2Standard inStandard, const NTV2FrameGeometry inGeometry, const NTV2Channel inChannel=NTV2_CHANNEL1)
virtual AJAStatus SetupOutputAudio(void)
Sets up everything I need for playing audio.
AJA_EXPORT bool BurnTimeCode(void *pBaseVideoAddress, const std::string &inTimeCodeStr, const uint32_t inYPercent)
I encapsulate the video, audio and anc host buffers used in the AutoCirculate demos. I'm a more modern version of the AVDataBuffer.
virtual AJAStatus SetupHostBuffers(void)
Sets up my circular buffers.
bool HasAvailableInputFrame(void) const
Specifies channel or FrameStore 4 (or the 4th item).
NTV2Channel fInputChannel
The input channel to use.
Specifies channel or FrameStore 5 (or the 5th item).
virtual AJAStatus SetupInputVideo(void)
Sets up everything I need for capturing 4K video.
NTV2TCIndex fTimecodeSource
Timecode source to use.
bool GetRP188Reg(RP188_STRUCT &outRP188) const
bool IsRunning(void) const
virtual void PlayFrames(void)
Repeatedly plays out frames using AutoCirculate (until global quit flag set).
static size_t SetDefaultPageSize(void)
NTV2Burn4KQuadrant(const BurnConfig &inConfig)
Constructs me using the given configuration settings.
Specifies channel or FrameStore 6 (or the 6th item).
UWord GetMaxAudioChannels(void)
virtual bool AutoCirculateInitForInput(const NTV2Channel inChannel, const UWord inFrameCount=7, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_INVALID, const ULWord inOptionFlags=0, const UByte inNumChannels=1, const UWord inStartFrameNumber=0, const UWord inEndFrameNumber=0)
Prepares for subsequent AutoCirculate ingest, designating a contiguous block of frame buffers on the ...
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
Specifies channel or FrameStore 7 (or the 7th item).
bool GetRP188Str(std::string &sRP188) const
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Identifies the 1st SDI video input.
virtual bool SetNumberAudioChannels(const ULWord inNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the number of audio channels to be concurrently captured or played for a given Audio System on t...
virtual void StartCaptureThread(void)
Starts my capture thread.
virtual bool WaitForInputVerticalInterrupt(const NTV2Channel inChannel=NTV2_CHANNEL1, UWord inRepeatCount=1)
Efficiently sleeps the calling thread/process until the next one or more field (interlaced video) or ...
bool CanDoMultiFormat(void)
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Specifies channel or FrameStore 3 (or the 3rd item).
virtual void GetACStatus(AUTOCIRCULATE_STATUS &outInputStatus, AUTOCIRCULATE_STATUS &outOutputStatus)
Provides status information about my input (capture) and output (playout) processes.
virtual ~NTV2Burn4KQuadrant()
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.