 |
AJA NTV2 SDK
18.0.0.2717
NTV2 SDK 18.0.0.2717
|
Go to the documentation of this file.
22 #define TCFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
23 #define TCWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
24 #define TCNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
25 #define TCINFO(_expr_) AJA_sINFO (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
26 #define TCDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
49 static const double gFrequencies [] = {250.0, 500.0, 1000.0, 2000.0};
51 static const double gAmplitudes [] = { 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85,
52 0.85, 0.80, 0.75, 0.70, 0.65, 0.60, 0.55, 0.50, 0.45, 0.40, 0.35, 0.30, 0.25, 0.20, 0.15, 0.10};
62 mToneFrequency (440.0),
94 delete [] mDolbyBuffer;
100 delete [] mBurstBuffer;
112 while (mProducerThread.
Active())
115 while (mConsumerThread.
Active())
122 #if defined(NTV2_BUFFER_LOCKING)
124 #endif // NTV2_BUFFER_LOCKING
144 if (!mDevice.
features().CanDoPlayback())
146 if (!mDevice.
features().GetNumHDMIVideoOutputs())
149 const UWord maxNumChannels (mDevice.
features().GetNumFrameStores());
157 <<
" -- only supports Ch1" << (maxNumChannels > 1 ? string(
"-Ch") + string(1,
char(maxNumChannels+
'0')) :
"") << endl;
169 if (mDevice.
features().CanDoMultiFormat())
178 {cerr <<
"## ERROR: Could not open file: " << mConfig.
fDolbyFilePath << endl;
return status;}
203 {cerr <<
"## ERROR: RenderTimeCodeFont failed for: " << mFormatDesc << endl;
return AJA_STATUS_UNSUPPORTED;}
208 if (mDevice.IsRemote())
209 cerr <<
"Device Description: " << mDevice.
GetDescription() << endl;
211 #endif // defined(_DEBUG)
224 { cerr <<
"## ERROR: '" << mDevice.
GetDisplayName() <<
"' doesn't support "
229 { cerr <<
"## ERROR: '" << mDevice.
GetDisplayName() <<
"' doesn't support "
267 if (mDevice.
features().GetNumAudioSystems() > 1)
271 if (!mDevice.
features().CanDoFrameStore1Display())
316 if (mConfig.WithVideo())
322 #ifdef NTV2_BUFFER_LOCKING
328 if (mConfig.WithAudio())
331 PLFAIL(
"Failed to allocate " <<
xHEX0N(AUDIOBYTES_MAX,8) <<
"-byte audio buffer");
334 #ifdef NTV2_BUFFER_LOCKING
338 mFrameDataRing.
Add (&frameData);
341 if (mDolbyFileIO.
IsOpen())
344 mBurstSamples = 6144;
345 mBurstMax = mBurstSamples * 2;
346 mBurstBuffer =
new uint16_t [mBurstMax];
347 mDolbyBuffer =
new uint16_t [mBurstMax];
356 vector<NTV2TestPatternSelect> testPatIDs;
366 mTestPatRasters.clear();
367 for (
size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
372 if (mFormatDesc.IsVANC())
376 for (
size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
380 {
PLFAIL(
"Test pattern buffer " <<
DEC(tpNdx+1) <<
" of " <<
DEC(testPatIDs.size()) <<
": "
387 if (!testPatternGen.
DrawTestPattern (testPatIDs.at(tpNdx), mFormatDesc, mTestPatRasters.at(tpNdx)))
389 cerr <<
"## ERROR: DrawTestPattern " <<
DEC(tpNdx) <<
" failed: " << mFormatDesc << endl;
393 #ifdef NTV2_BUFFER_LOCKING
396 PLWARN(
"Test pattern buffer " <<
DEC(tpNdx+1) <<
" of " <<
DEC(testPatIDs.size()) <<
": failed to pre-lock");
437 mConsumerThread.
Start ();
458 ULWord goodXfers(0), badXfers(0), starves(0), noRoomWaits(0);
470 {
PLFAIL(
"AutoCirculateInitForOutput failed"); mGlobalQuit =
true;}
471 else if (!mConfig.WithVideo())
494 {starves++;
continue;}
526 PLNOTE(
"Thread completed: " <<
DEC(goodXfers) <<
" xfers, " <<
DEC(badXfers) <<
" failed, "
527 <<
DEC(starves) <<
" starves, " <<
DEC(noRoomWaits) <<
" VBI waits");
541 mProducerThread.
Start();
558 ULWord freqNdx(0), testPatNdx(0), badTally(0);
559 double timeOfLastSwitch (0.0);
586 const CRP188 rp188Info (mCurrentFrame++, 0, 0, 10, tcFormat);
595 TCDBG(
"F" <<
DEC0N(mCurrentFrame-1,6) <<
": " << tcF1 <<
": " << tcString);
600 if (mDolbyFileIO.
IsOpen())
613 if (currentTime > timeOfLastSwitch + 4.0)
616 testPatNdx = (testPatNdx + 1) %
ULWord(mTestPatRasters.size());
618 timeOfLastSwitch = currentTime;
619 PLINFO(
"F" <<
DEC0N(mCurrentFrame,6) <<
": " << tcString <<
": tone=" << mToneFrequency <<
"Hz, pattern='" << tpNames.at(testPatNdx) <<
"'");
626 PLNOTE(
"Thread completed: " <<
DEC(mCurrentFrame) <<
" frame(s) produced, " <<
DEC(badTally) <<
" failed");
648 pFrequencies [0] = (mToneFrequency / 2.0);
649 for (
ULWord chan (1); chan < numChannels; chan++)
652 pFrequencies [chan] = pFrequencies [chan - 1] * 1.154782;
687 for (uint32_t samp(0); samp < numSamples; samp++)
689 for (uint32_t ch(0); ch < numChannels; ch++)
691 *audioBuffer = uint32_t(mRampSample) << 16;
697 return numSamples * numChannels * 4;
700 #if defined(DOLBY_FULL_PARSER)
717 if (!mDolbyFileIO.
IsOpen() || !mDolbyBuffer)
721 while (sampleOffset < numSamples)
723 if ((mBurstSize != 0) && (mBurstIndex < mBurstSamples))
725 if(mBurstOffset < mBurstSize)
729 if (mBurstIndex == 0)
735 else if (mBurstIndex == 1)
738 data0 = ((bsi.
bsmod & 0x7) << 8) | 0x0015;
739 data1 = mBurstSize * 2;
744 data0 = (uint32_t)(mBurstBuffer[mBurstOffset]);
745 data0 = ((data0 & 0x00ff) << 8) | ((data0 & 0xff00) >> 8);
747 data1 = (uint32_t)(mBurstBuffer[mBurstOffset]);
748 data1 = ((data1 & 0x00ff) << 8) | ((data1 & 0xff00) >> 8);
755 for (
ULWord i = 0; i < numChannels; i += 2)
757 audioBuffer[sampleOffset * numChannels + i] = data0;
758 audioBuffer[sampleOffset * numChannels + i + 1] = data1;
764 for (
ULWord i = 0; i < numChannels; i++)
766 audioBuffer[sampleOffset * numChannels + i] = 0;
788 cerr <<
"## ERROR: Dolby frame not found" << endl;
789 mDolbyFileIO.
Close();
793 if (!
ParseBSI(&mDolbyBuffer[1], sampleCount - 1, &bsi))
803 mDolbySize = sampleCount;
806 case 0: mDolbyBlocks = 1;
break;
807 case 1: mDolbyBlocks = 2;
break;
808 case 2: mDolbyBlocks = 3;
break;
809 case 3: mDolbyBlocks = 6;
break;
810 default:
goto silence;
814 while (numBlocks <= 6)
817 while (dolbyOffset < mDolbySize)
820 if (burstOffset >= mBurstMax)
822 cerr <<
"## ERROR: Dolby burst too large" << endl;
823 mDolbyFileIO.
Close();
828 mBurstBuffer[burstOffset] = mDolbyBuffer[dolbyOffset];
839 cerr <<
"## ERROR: Dolby frame not found" << endl;
840 mDolbyFileIO.
Close();
846 if (!
ParseBSI(&mDolbyBuffer[1], sampleCount - 1, &bsi))
852 cerr <<
"## ERROR: Dolby frame bad bsid = " << bsi.
bsid << endl;
856 mDolbySize = sampleCount;
863 numBlocks += mDolbyBlocks;
867 case 0: mDolbyBlocks = 1;
break;
868 case 1: mDolbyBlocks = 2;
break;
869 case 2: mDolbyBlocks = 3;
break;
870 case 3: mDolbyBlocks = 6;
break;
872 cerr <<
"## ERROR: Dolby frame bad numblkscod = " << bsi.
numblkscod << endl;
884 cerr <<
"## ERROR: Dolby frame unexpected convsync = " << bsi.
convsync << endl;
890 mBurstSize = burstOffset;
897 return numSamples * numChannels * 4;
901 memset(&audioBuffer[sampleOffset * numChannels], 0, (numSamples - sampleOffset) * numChannels * 4);
902 return numSamples * numChannels * 4;
913 bytes = mDolbyFileIO.
Read((uint8_t*)(&pInDolbyBuffer[0]), 2);
922 if ((mDolbyBuffer[0] == 0x7705) ||
923 (mDolbyBuffer[0] == 0x770b))
928 bytes = mDolbyFileIO.
Read((uint8_t*)(&pInDolbyBuffer[1]), 4);
933 uint32_t size = (uint32_t)mDolbyBuffer[1];
934 size = (((size & 0x00ff) << 8) | ((size & 0xff00) >> 8));
935 size = (size & 0x7ff) + 1;
938 uint32_t len = (size - 3) * 2;
939 bytes = mDolbyFileIO.
Read((uint8_t*)(&pInDolbyBuffer[3]), len);
951 if ((pInDolbyBuffer ==
NULL) || (pBsi ==
NULL))
972 if (pBsi->
acmod == 0x0)
992 if (pBsi->
acmod > 0x2)
996 if ((pBsi->
acmod & 0x1) && (pBsi->
acmod > 0x2))
1001 if (pBsi->
acmod & 0x4)
1021 if (pBsi->
acmod == 0x0)
1041 else if (pBsi->
mixdef == 0x2)
1045 else if (pBsi->
mixdef == 0x3)
1123 uint32_t size = 8 * (pBsi->
mixdeflen + 2);
1124 size = (size + 7) / 8 * 8;
1128 if (!
GetBits(data, (size > 8)? 8 : size))
return false;
1134 if (pBsi->
acmod < 0x2)
1142 if (pBsi->
acmod == 0x0)
1171 for(blk = 0; blk < numblk; blk++)
1189 if (pBsi->
acmod == 0x2)
1194 if (pBsi->
acmod >= 0x6)
1205 if (pBsi->
acmod == 0x0)
1215 if (pBsi->
fscod < 0x3)
1245 uint32_t size = 8 * (pBsi->
addbsil + 1);
1249 if (!
GetBits(data, 8))
return false;
1261 mBitBuffer = pBuffer;
1269 static uint8_t bitMask[] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
1289 data |= ((*mBitBuffer >> mBitIndex) & bitMask[cb]) << bits;
1295 #else // DOLBY_FULL_PARSER
1309 if ((mConfig.fDolbyFile ==
NULL) || (mDolbyBuffer ==
NULL))
1313 while (sampleOffset < numSamples)
1316 if (mBurstIndex >= mBurstSamples)
1320 if (mBurstIndex == 0)
1323 uint32_t bytes = mConfig.fDolbyFile->Read((uint8_t*)(&mDolbyBuffer[0]), 2);
1328 bytes = mConfig.fDolbyFile->Read((uint8_t*)(&mDolbyBuffer[0]), 2);
1334 if ((mDolbyBuffer[0] != 0x7705) &&
1335 (mDolbyBuffer[0] != 0x770b))
1339 bytes = mConfig.fDolbyFile->Read((uint8_t*)(&mDolbyBuffer[1]), 4);
1344 uint32_t size = (uint32_t)mDolbyBuffer[1];
1345 size = (((size & 0x00ff) << 8) | ((size & 0xff00) >> 8)) + 1;
1348 uint32_t len = (size - 3) * 2;
1349 bytes = mConfig.fDolbyFile->Read((uint8_t*)(&mDolbyBuffer[3]), len);
1359 if (mBurstOffset < mBurstSize)
1363 if (mBurstIndex == 0)
1369 else if (mBurstIndex == 1)
1373 data1 = mBurstSize * 2;
1378 data0 = (uint32_t)(mDolbyBuffer[mBurstOffset]);
1379 data0 = ((data0 & 0x00ff) << 8) | ((data0 & 0xff00) >> 8);
1381 data1 = (uint32_t)(mDolbyBuffer[mBurstOffset]);
1382 data1 = ((data1 & 0x00ff) << 8) | ((data1 & 0xff00) >> 8);
1389 for (
ULWord i = 0; i < numChannels; i += 2)
1391 pInAudioBuffer[sampleOffset * numChannels + i] = data0;
1392 pInAudioBuffer[sampleOffset * numChannels + i + 1] = data1;
1398 for (
ULWord i = 0; i < numChannels; i++)
1400 pInAudioBuffer[sampleOffset * numChannels + i] = 0;
1408 return numSamples * numChannels * 4;
1412 memset(&pInAudioBuffer[sampleOffset * numChannels], 0, (numSamples - sampleOffset) * numChannels * 4);
1413 return numSamples * numChannels * 4;
1415 #endif // else DOLBY_FULL_PARSER
virtual bool DrawTestPattern(const std::string &inTPName, const NTV2FormatDescriptor &inFormatDesc, NTV2Buffer &inBuffer)
Renders the given test pattern or color into a host raster buffer.
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 SetVANCMode(const NTV2VANCMode inVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the VANC mode for the given FrameStore.
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
virtual ~NTV2DolbyPlayer(void)
bool CanDoVideoFormat(const NTV2VideoFormat inVF)
@ NTV2_AUDIO_LOOPBACK_OFF
Embeds silence (zeroes) into the data stream.
virtual bool RouteOutputSignal(void)
Performs all widget/signal routing for playout.
@ NTV2_OUTPUTDESTINATION_HDMI1
@ NTV2_TestPatt_CheckField
@ NTV2_REFERENCE_SFP1_PTP
Specifies the PTP source on SFP 1.
#define NTV2_IS_VALID_TASK_MODE(__m__)
@ NTV2_CHANNEL2
Specifies channel or FrameStore 2 (or the 2nd item).
@ AJA_ThreadPriority_High
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.
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
@ NTV2_TestPatt_MultiBurst
std::string fDolbyFilePath
Optional path to Dolby audio source file.
I encapsulate the video, audio and anc host buffers used in the AutoCirculate demos....
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
bool GetRP188Reg(RP188_STRUCT &outRP188) const
Describes a user-space buffer on the host computer. I have an address and a length,...
Declares common audio macros and structs used in the SDK.
ULWord GetByteCount(void) const
AJALabelValuePairs Get(const bool inCompact=(0)) const
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
virtual void ConsumeFrames(void)
My consumer thread that repeatedly plays frames using AutoCirculate (until quit).
@ NTV2_AUDIO_FORMAT_DOLBY
AJA_EXPORT bool BurnTimeCode(void *pBaseVideoAddress, const std::string &inTimeCodeStr, const uint32_t inYPercent)
static const uint32_t AUDIOBYTES_MAX_48K(201 *1024)
The maximum number of bytes of 48KHz audio that can be transferred for a single frame....
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...
@ NTV2_AUDIOSYSTEM_1
This identifies the first Audio System.
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function to ...
Declares the NTV2TestPatternGen class.
@ NTV2_TestPatt_ColorBars100
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device.
#define DEC0N(__x__, __n__)
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
void EndProduceNextBuffer(void)
The producer thread calls this function to signal that it has finished populating the frame it obtain...
virtual AJAStatus SetUpHostBuffers(void)
Sets up my host video & audio buffers.
uint8_t mixdatabuffer[64]
bool Allocate(const size_t inByteCount, const bool inPageAligned=false)
Allocates (or re-allocates) my user-space storage using the given byte count. I assume full responsib...
virtual AJAStatus Run(void)
Runs me.
bool fDoMultiFormat
If true, enable device-sharing; otherwise take exclusive control of device.
Header file for NTV2DolbyPlayer demonstration class.
virtual bool SetTaskMode(const NTV2TaskMode inMode)
Sets the device's task mode.
virtual bool SetAudioLoopBack(const NTV2AudioLoopBack inMode, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Enables or disables NTV2AudioLoopBack mode for the given NTV2AudioSystem.
@ NTV2_CHANNEL1
Specifies channel or FrameStore 1 (or the first item).
virtual void SetBitBuffer(uint8_t *pBuffer, uint32_t size)
Set the bitstream buffer for bit retrieval.
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.
const char * NTV2FrameBufferFormatString(NTV2FrameBufferFormat fmt)
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
bool CanAcceptMoreOutputFrames(void) const
NTV2FrameRate
Identifies a particular video frame rate.
virtual bool GetTaskMode(NTV2TaskMode &outMode)
Retrieves the device's current task mode.
AJAStatus Open(const std::string &fileName, const int flags, const int properties)
NTV2Buffer & VideoBuffer(void)
virtual bool DMABufferLock(const NTV2Buffer &inBuffer, bool inMap=(0), bool inRDMA=(0))
Page-locks the given host buffer to reduce transfer time and CPU usage of DMA transfers.
NTV2InputXptID GetOutputDestInputXpt(const NTV2OutputDestination inOutputDest, const bool inIsSDI_DS2=false, const UWord inHDMI_Quadrant=99)
virtual class DeviceCapabilities & features(void)
virtual AJAStatus SetUpAudio(void)
Performs all audio setup.
static const ULWord gNumFrequencies(sizeof(gFrequencies)/sizeof(double))
NTV2DolbyPlayer(const DolbyPlayerConfig &inConfigData)
Constructs me using the given configuration settings.
virtual bool DMABufferUnlockAll()
Unlocks all previously-locked buffers used for DMA transfers.
virtual std::string GetDisplayName(void)
Answers with this device's display name.
I am similar to NTV2Player, but I demonstrate how to play/output 8 channels of audio tone (or ramp da...
Declares the AJAProcess class.
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
virtual AJAStatus SetUpVideo(void)
Performs all video setup.
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
AJAStatus Add(FrameDataPtr pInFrameData)
Appends a new frame buffer to me, increasing my frame storage capacity by one frame.
@ NTV2_VANCMODE_OFF
This identifies the mode in which there are no VANC lines in the frame buffer.
virtual bool GetNumberAudioChannels(ULWord &outNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Returns the current number of audio channels being captured or played by a given Audio System on the ...
@ NTV2_TestPatt_FlatField
static AJALabelValuePairs & append(AJALabelValuePairs &inOutTable, const std::string &inLabel, const std::string &inValue=std::string())
A convenience function that appends the given label and value strings to the provided AJALabelValuePa...
virtual std::string GetDescription(void) const
AJAStatus Seek(const int64_t distance, const AJAFileSetFlag flag) const
NTV2Buffer fVideoBuffer
Host video buffer.
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
Declares the CNTV2DeviceScanner class.
ULWord VideoBufferSize(void) const
bool SetOutputTimeCodes(const NTV2TimeCodes &inValues)
Intended for playout, replaces the contents of my acOutputTimeCodes member.
static size_t SetDefaultPageSize(void)
virtual bool SetHDMIOutAudioFormat(const NTV2AudioFormat inNewValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the HDMI output's audio format.
virtual void ToString(std::string &outAllLabelsAndValues) const
Answers with a multi-line string that contains the complete host system info table.
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.
bool CopyFrom(const void *pInSrcBuffer, const ULWord inByteCount)
Replaces my contents from the given memory buffer, resizing me to the new byte count.
NTV2VideoFormat fVideoFormat
The video format to use.
FrameDataPtr StartProduceNextBuffer(void)
The thread that's responsible for providing frames – the producer – calls this function to populate t...
virtual bool AutoCirculateGetStatus(const NTV2Channel inChannel, AUTOCIRCULATE_STATUS &outStatus)
Returns the current AutoCirculate status for the given channel.
ULWord fNumAudioBytes
Actual number of captured audio bytes.
@ NTV2_REFERENCE_FREERUN
Specifies the device's internal clock.
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
NTV2Channel fOutputChannel
The device channel to use.
AJALabelValuePairs Get(const bool inCompact=(0)) const
Renders a human-readable representation of me.
Configures an NTV2DolbyPlayer instance.
uint32_t blkmixcfginfo[6]
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
NTV2Buffer & AudioBuffer(void)
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
virtual uint32_t AddRamp(NTV2FrameData &inFrameData)
Inserts audio test ramp into the given NTV2FrameData's audio buffer.
@ NTV2_TestPatt_ColorBars75
virtual bool IsDeviceReady(const bool inCheckValid=(0))
static const ULWord kDemoAppSignature((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0))
void EndConsumeNextBuffer(void)
The consumer thread calls this function to signal that it has finished processing the frame it obtain...
uint16_t GetEndFrame(void) const
std::vector< std::string > NTV2StringList
virtual void ProduceFrames(void)
My producer thread that repeatedly produces video frames.
virtual uint32_t AddDolby(NTV2FrameData &inFrameData)
Inserts dolby audio into the given NTV2FrameData's audio buffer.
bool AddAudioTone(ULWord &outNumBytesWritten, NTV2Buffer &inAudioBuffer, ULWord &inOutCurrentSample, const ULWord inNumSamples, const double inSampleRate, const double inAmplitude, const double inFrequency, const ULWord inNumBits, const bool inByteSwap, const ULWord inNumChannels)
Fills the given buffer with 32-bit (ULWord) audio tone samples.
static AJA_FrameRate GetAJAFrameRate(const NTV2FrameRate inFrameRate)
The NTV2 test pattern generator.
NTV2Buffer fAudioBuffer
Host audio buffer.
uint32_t Read(uint8_t *pBuffer, const uint32_t length)
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 void Quit(void)
Gracefully stops me from running.
virtual bool SetHDMIOutAudioRate(const NTV2AudioRate inNewValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the HDMI output's audio rate.
virtual bool SetHDMIOutAudioSource2Channel(const NTV2AudioChannelPair inNewValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the HDMI output's 2-channel audio source.
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
virtual bool GetDolbyFrame(uint16_t *pInDolbyBuffer, uint32_t &numSamples)
Get a dolby audio frame from the input file.
std::string fDeviceSpec
The AJA device to use.
virtual uint32_t AddTone(NTV2FrameData &inFrameData)
Inserts audio tone (based on my current tone frequency) into the given NTV2FrameData's audio buffer.
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 ...
#define GetFrameBufferOutputXptFromChannel
virtual bool GetBits(uint32_t &data, uint32_t inBitCount)
Retreive the specified number of bits from the bitstream buffer.
This struct replaces the old RP188_STRUCT.
bool IsRGBFormat(const NTV2FrameBufferFormat format)
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 ...
static AJA_PixelFormat GetAJAPixelFormat(const NTV2PixelFormat inFormat)
ULWord GetAudioSamplesPerFrame(const NTV2FrameRate inFrameRate, const NTV2AudioRate inAudioRate, ULWord inCadenceFrame=0, bool inIsSMPTE372Enabled=false)
Returns the number of audio samples for a given video frame rate, audio sample rate,...
uint16_t GetStartFrame(void) const
virtual bool ParseBSI(uint16_t *pInDolbyBuffer, uint32_t numSamples, NTV2DolbyBSI *pBsi)
Parse the dolby audio bit stream information block.
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...
static const size_t CIRCULAR_BUFFER_SIZE(10)
Number of NTV2FrameData's in our ring.
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 ...
virtual bool GetAudioRate(NTV2AudioRate &outRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Returns the current NTV2AudioRate for the given Audio System.
static void ProducerThreadStatic(AJAThread *pThread, void *pContext)
This is the producer thread's static callback function that gets called when the producer thread star...
static const double gFrequencies[]
virtual bool GetFrameRate(NTV2FrameRate &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the AJA device's currently configured frame rate via its "value" parameter.
virtual bool DMAWriteFrame(const ULWord inFrameNumber, const ULWord *pInFrameBuffer, const ULWord inByteCount)
Transfers a single frame from the host to the AJA device.
double GetAudioSamplesPerSecond(const NTV2AudioRate inAudioRate)
Returns the audio sample rate as a number of audio samples per second.
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...
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
@ NTV2_TestPatt_MultiPattern
virtual void StartProducerThread(void)
Starts my producer thread.
NTV2PixelFormat fPixelFormat
The pixel format to use.
enum NTV2OutputCrosspointID NTV2OutputXptID
virtual AJAStatus SetPriority(AJAThreadPriority priority)
virtual bool AutoCirculateStart(const NTV2Channel inChannel, const ULWord64 inStartTime=0)
Starts AutoCirculating the specified channel that was previously initialized by CNTV2Card::AutoCircul...
static NTV2TestPatternNames getTestPatternNames(void)
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...
double FramesToSeconds(int64_t frames) const
virtual void StartConsumerThread(void)
Starts my consumer thread.
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
std::ostream & operator<<(std::ostream &ioStrm, const DolbyPlayerConfig &inObj)
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...
@ NTV2_TestPatt_LineSweep
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.
virtual AJAStatus SetUpTestPatternBuffers(void)
Creates my test pattern buffers.
virtual AJAStatus Start()
static const bool BUFFER_PAGE_ALIGNED((!(0)))
std::vector< AJALabelValuePair > AJALabelValuePairs
An ordered sequence of label/value pairs.
#define xHEX0N(__x__, __n__)
#define AJA_FAILURE(_status_)
@ NTV2_AUDIO_RATE_INVALID
@ NTV2_AudioChannel1_2
This selects audio channels 1 and 2 (Group 1 channels 1 and 2)
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.
bool CanDoFrameBufferFormat(const NTV2PixelFormat inPF)
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
static void ConsumerThreadStatic(AJAThread *pThread, void *pContext)
This is the consumer thread's static callback function that gets called when the consumer thread star...
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...
static const double gAmplitudes[]
bool GetRP188Str(std::string &sRP188) const
virtual void GetACStatus(AUTOCIRCULATE_STATUS &outStatus)
Provides status information about my output (playout) process.
NTV2TimeCodes fTimecodes
Map of TC indexes to NTV2_RP188 values.
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
static const uint32_t AUDIOBYTES_MAX_192K(824 *1024)
The maximum number of bytes of 192KHz audio that can be transferred for a single frame....
@ NTV2_OEM_TASKS
2: OEM (recommended): device configured by client application(s) with some driver involvement.
bool fDoRamp
If true, use audio ramp pattern instead of tone.
@ NTV2_AUDIOSYSTEM_INVALID
Declares the AJATimeBase class.