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 157 <<
" -- only supports Ch1" << (maxNumChannels > 1 ? string(
"-Ch") + string(1,
char(maxNumChannels+
'0')) :
"") << endl;
178 {cerr <<
"## ERROR: Could not open file: " << mConfig.
fDolbyFilePath << endl;
return status;}
203 {cerr <<
"## ERROR: RenderTimeCodeFont failed for: " << mFormatDesc << endl;
return AJA_STATUS_UNSUPPORTED;}
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 " 322 #ifdef NTV2_BUFFER_LOCKING 323 if (frameData.fVideoBuffer)
331 PLFAIL(
"Failed to allocate " <<
xHEX0N(AUDIOBYTES_MAX,8) <<
"-byte audio buffer");
334 #ifdef NTV2_BUFFER_LOCKING 335 if (frameData.fAudioBuffer)
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++)
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;}
494 {starves++;
continue;}
498 if (pFrameData->VideoBuffer())
499 outputXfer.
SetVideoBuffer (pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
500 if (pFrameData->AudioBuffer())
501 outputXfer.
SetAudioBuffer (pFrameData->AudioBuffer(), pFrameData->fNumAudioBytes);
526 PLNOTE(
"Thread completed: " <<
DEC(goodXfers) <<
" xfers, " <<
DEC(badXfers) <<
" failed, " 527 <<
DEC(starves) <<
" starves, " <<
DEC(noRoomWaits) <<
" VBI waits");
541 mProducerThread.
Start();
549 NTV2DolbyPlayer * pApp (reinterpret_cast <NTV2DolbyPlayer *> (pContext));
558 ULWord freqNdx(0), testPatNdx(0), badTally(0);
559 double timeOfLastSwitch (0.0);
580 if (pFrameData->VideoBuffer())
581 pFrameData->fVideoBuffer.CopyFrom (mTestPatRasters.at(testPatNdx),
584 pFrameData->fVideoBuffer.GetByteCount());
586 const CRP188 rp188Info (mCurrentFrame++, 0, 0, 10, tcFormat);
593 if (pFrameData->VideoBuffer())
594 mTCBurner.
BurnTimeCode (pFrameData->VideoBuffer(), tcString.c_str(), 80);
595 TCDBG(
"F" <<
DEC0N(mCurrentFrame-1,6) <<
": " << tcF1 <<
": " << tcString);
598 if (pFrameData->AudioBuffer())
600 if (mDolbyFileIO.
IsOpen())
601 pFrameData->fNumAudioBytes =
AddDolby(*pFrameData);
605 pFrameData->fNumAudioBytes =
AddRamp(*pFrameData);
607 pFrameData->fNumAudioBytes =
AddTone(*pFrameData);
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
bool SetOutputTimeCodes(const NTV2TimeCodes &inValues)
Intended for playout, replaces the contents of my acOutputTimeCodes member.
AJALabelValuePairs Get(const bool inCompact=(0)) const
Renders a human-readable representation of me.
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
double FramesToSeconds(int64_t frames) const
virtual bool SetTaskMode(const NTV2TaskMode inMode)
Sets the device's task mode.
virtual bool GetDolbyFrame(uint16_t *pInDolbyBuffer, uint32_t &numSamples)
Get a dolby audio frame from the input file.
static const bool BUFFER_PAGE_ALIGNED((!(0)))
static void ProducerThreadStatic(AJAThread *pThread, void *pContext)
This is the producer thread's static callback function that gets called when the producer thread star...
#define NTV2_IS_VALID_TASK_MODE(__m__)
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.
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 AJAStatus Run(void)
Runs me.
AJAStatus Add(FrameDataPtr pInFrameData)
Appends a new frame buffer to me, increasing my frame storage capacity by one frame.
The NTV2 test pattern generator.
#define DEC0N(__x__, __n__)
static const double gAmplitudes[]
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.
virtual bool IsDeviceReady(const bool inCheckValid=(0))
uint8_t mixdatabuffer[64]
#define AJA_FAILURE(_status_)
Declares the NTV2TestPatternGen class.
AJALabelValuePairs Get(const bool inCompact=(0)) const
virtual bool GetAudioRate(NTV2AudioRate &outRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Returns the current NTV2AudioRate for the given Audio System.
virtual AJAStatus SetUpHostBuffers(void)
Sets up my host video & audio buffers.
virtual bool DMAWriteFrame(const ULWord inFrameNumber, const ULWord *pInFrameBuffer, const ULWord inByteCount)
Transfers a single frame from the host to the AJA device.
UWord GetNumHDMIVideoOutputs(void)
virtual AJAStatus SetUpAudio(void)
Performs all audio setup.
std::vector< AJALabelValuePair > AJALabelValuePairs
An ordered sequence of label/value pairs.
virtual AJAStatus SetPriority(AJAThreadPriority priority)
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function t...
virtual AJAStatus SetUpVideo(void)
Performs all video setup.
I am similar to NTV2Player, but I demonstrate how to play/output 8 channels of audio tone (or ramp da...
bool CanAcceptMoreOutputFrames(void) const
UWord firstFrame(void) const
bool CanDoFrameStore1Display(void)
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
virtual AJAStatus Start()
void EndConsumeNextBuffer(void)
The consumer thread calls this function to signal that it has finished processing the frame it obtain...
Declares common audio macros and structs used in the SDK.
std::string fDeviceSpec
The AJA device to use.
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.
virtual class DeviceCapabilities & features(void)
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device...
Declares the AJATimeBase class.
This struct replaces the old RP188_STRUCT.
UWord GetNumAudioSystems(void)
virtual bool IsRemote(void) const
virtual bool GetTaskMode(NTV2TaskMode &outMode)
Retrieves the device's current task mode.
bool WithAudio(void) const
virtual bool SetHDMIOutAudioRate(const NTV2AudioRate inNewValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the HDMI output's audio rate.
static AJA_PixelFormat GetAJAPixelFormat(const NTV2PixelFormat inFormat)
NTV2FrameRate
Identifies a particular video frame rate.
virtual bool DrawTestPattern(const std::string &inTPName, const NTV2FormatDescriptor &inFormatDesc, NTV2Buffer &inBuffer)
Renders the given test pattern or color into a host raster buffer.
static const ULWord gNumFrequencies(sizeof(gFrequencies)/sizeof(double))
virtual std::string GetDescription(void) const
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
NTV2InputXptID GetOutputDestInputXpt(const NTV2OutputDestination inOutputDest, const bool inIsSDI_DS2=false, const UWord inHDMI_Quadrant=99)
virtual bool IsOpen(void) const
virtual void ConsumeFrames(void)
My consumer thread that repeatedly plays frames using AutoCirculate (until quit). ...
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 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 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 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.
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 std::string GetDisplayName(void)
Answers with this device's display name.
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.
AJAStatus Open(const std::string &fileName, const int flags, const int properties)
NTV2DolbyPlayer(const DolbyPlayerConfig &inConfigData)
Constructs me using the given configuration settings.
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
This selects audio channels 1 and 2 (Group 1 channels 1 and 2)
NTV2PixelFormat fPixelFormat
The pixel format to use.
2: OEM (recommended): device configured by client application(s) with some driver involvement...
Configures an NTV2DolbyPlayer instance.
std::vector< std::string > NTV2StringList
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. Worst case, assuming 16 channels of audio (max), 4 bytes per sample, and 67 msec per frame (assuming the lowest possible frame rate of 14.98 fps)... 48,000 samples per second requires 3,204 samples x 4 bytes/sample x 16 = 205,056 bytes 201K will suffice, with 768 bytes to spare.
NTV2VideoFormat fVideoFormat
The video format to use.
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Embeds silence (zeroes) into the data stream.
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
virtual void Quit(void)
Gracefully stops me from running.
virtual uint32_t AddTone(NTV2FrameData &inFrameData)
Inserts audio tone (based on my current tone frequency) into the given NTV2FrameData's audio buffer...
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
virtual bool DMABufferUnlockAll()
Unlocks all previously-locked buffers used for DMA transfers.
Specifies the PTP source on SFP 1.
Specifies channel or FrameStore 2 (or the 2nd item).
virtual void StartProducerThread(void)
Starts my producer thread.
AJAStatus Seek(const int64_t distance, const AJAFileSetFlag flag) const
virtual AJAStatus SetUpTestPatternBuffers(void)
Creates my test pattern buffers.
UWord GetNumFrameStores(void)
Declares the CNTV2DeviceScanner class.
std::ostream & operator<<(std::ostream &ioStrm, const DolbyPlayerConfig &inObj)
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...
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.
Declares the AJAProcess class.
std::string fDolbyFilePath
Optional path to Dolby audio source file.
Describes a user-space buffer on the host computer. I have an address and a length, plus some optional attributes (allocated by SDK?, page-aligned? etc.).
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).
bool fDoMultiFormat
If true, enable device-sharing; otherwise take exclusive control of device.
static NTV2TestPatternNames getTestPatternNames(void)
uint16_t GetEndFrame(void) const
NTV2Buffer & AudioBuffer(void)
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...
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 ...
bool fDoRamp
If true, use audio ramp pattern instead of tone.
Header file for NTV2DolbyPlayer demonstration class.
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...
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 ...
NTV2Channel fOutputChannel
The device channel to use.
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...
double GetAudioSamplesPerSecond(const NTV2AudioRate inAudioRate)
Returns the audio sample rate as a number of audio samples per second.
virtual bool ParseBSI(uint16_t *pInDolbyBuffer, uint32_t numSamples, NTV2DolbyBSI *pBsi)
Parse the dolby audio bit stream information block.
virtual void StartConsumerThread(void)
Starts my consumer thread.
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
NTV2OutputXptID GetFrameStoreOutputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsRGB=false, const bool inIs425=false)
virtual bool SetHDMIOutAudioFormat(const NTV2AudioFormat inNewValue, const NTV2Channel inWhichHDMIOut=NTV2_CHANNEL1)
Sets the HDMI output's audio format.
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, and frame number. This is useful since AJA devices use fixed audio sample rates (typically 48KHz), and some video frame rates will necessarily result in some frames having more audio samples than others.
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...
virtual uint32_t AddRamp(NTV2FrameData &inFrameData)
Inserts audio test ramp into the given NTV2FrameData's audio buffer.
virtual bool RouteOutputSignal(void)
Performs all widget/signal routing for playout.
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__)
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 AJAStatus Init(void)
Initializes me and prepares me to Run.
virtual bool GetFrameRate(NTV2FrameRate &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the AJA device's currently configured frame rate via its "value" parameter.
static AJA_FrameRate GetAJAFrameRate(const NTV2FrameRate inFrameRate)
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.
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
virtual void GetACStatus(AUTOCIRCULATE_STATUS &outStatus)
Provides status information about my output (playout) process.
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
uint32_t Read(uint8_t *pBuffer, const uint32_t length)
bool GetRP188Reg(RP188_STRUCT &outRP188) const
virtual bool GetBits(uint32_t &data, uint32_t inBitCount)
Retreive the specified number of bits from the bitstream buffer.
static size_t SetDefaultPageSize(void)
uint32_t blkmixcfginfo[6]
bool CanDoVideoFormat(const NTV2VideoFormat inVF)
UWord lastFrame(void) const
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
const char * NTV2FrameBufferFormatString(NTV2FrameBufferFormat fmt)
bool GetRP188Str(std::string &sRP188) const
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. Worst case, assuming 8 channels of audio (max), 4 bytes per sample, and 67 msec per frame (assuming the lowest possible frame rate of 14.98 fps)... 96,000 samples per second requires 12,864 samples x 4 bytes/sample x 16 = 823,296 bytes 824K will suffice.
bool WithVideo(void) const
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
static const double gFrequencies[]
virtual bool SetVANCMode(const NTV2VANCMode inVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the VANC mode for the given FrameStore.
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 ToString(std::string &outAllLabelsAndValues) const
Answers with a multi-line string that contains the complete host system info table.
enum NTV2OutputCrosspointID NTV2OutputXptID
uint16_t GetStartFrame(void) const
bool CanDoMultiFormat(void)
This identifies the mode in which there are no VANC lines in the frame buffer.
virtual ~NTV2DolbyPlayer(void)
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
virtual void SetBitBuffer(uint8_t *pBuffer, uint32_t size)
Set the bitstream buffer for bit retrieval.
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.