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 141 cerr <<
"## ERROR: Device '" << mConfig.
fDeviceSpec <<
"' not found" << endl;
159 <<
" -- only supports Ch1" << (maxNumChannels > 1 ? string(
"-Ch") + string(1,
char(maxNumChannels+
'0')) :
"") << endl;
180 {cerr <<
"## ERROR: Could not open file: " << mConfig.
fDolbyFilePath << endl;
return status;}
205 {cerr <<
"## ERROR: RenderTimeCodeFont failed for: " << mFormatDesc << endl;
return AJA_STATUS_UNSUPPORTED;}
212 #endif // defined(_DEBUG) 225 { cerr <<
"## ERROR: '" << mDevice.
GetDescription() <<
"' doesn't support " 230 { cerr <<
"## ERROR: '" << mDevice.
GetDescription() <<
"' doesn't support " 323 #ifdef NTV2_BUFFER_LOCKING 324 if (frameData.fVideoBuffer)
332 PLFAIL(
"Failed to allocate " <<
xHEX0N(AUDIOBYTES_MAX,8) <<
"-byte audio buffer");
335 #ifdef NTV2_BUFFER_LOCKING 336 if (frameData.fAudioBuffer)
339 mFrameDataRing.
Add (&frameData);
342 if (mDolbyFileIO.
IsOpen())
345 mBurstSamples = 6144;
346 mBurstMax = mBurstSamples * 2;
347 mBurstBuffer =
new uint16_t [mBurstMax];
348 mDolbyBuffer =
new uint16_t [mBurstMax];
357 vector<NTV2TestPatternSelect> testPatIDs;
367 mTestPatRasters.clear();
368 for (
size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
377 for (
size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
381 {
PLFAIL(
"Test pattern buffer " <<
DEC(tpNdx+1) <<
" of " <<
DEC(testPatIDs.size()) <<
": " 388 if (!testPatternGen.
DrawTestPattern (testPatIDs.at(tpNdx), mFormatDesc, mTestPatRasters.at(tpNdx)))
390 cerr <<
"## ERROR: DrawTestPattern " <<
DEC(tpNdx) <<
" failed: " << mFormatDesc << endl;
394 #ifdef NTV2_BUFFER_LOCKING 397 PLWARN(
"Test pattern buffer " <<
DEC(tpNdx+1) <<
" of " <<
DEC(testPatIDs.size()) <<
": failed to pre-lock");
438 mConsumerThread.
Start ();
459 ULWord goodXfers(0), badXfers(0), starves(0), noRoomWaits(0), startFrm(3);
471 {
PLFAIL(
"AutoCirculateInitForOutput failed"); mGlobalQuit =
true;}
499 {starves++;
continue;}
503 if (pFrameData->VideoBuffer())
504 outputXfer.
SetVideoBuffer (pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
505 if (pFrameData->AudioBuffer())
506 outputXfer.
SetAudioBuffer (pFrameData->AudioBuffer(), pFrameData->fNumAudioBytes);
511 {
if (++goodXfers == startFrm)
530 PLNOTE(
"Thread completed: " <<
DEC(goodXfers) <<
" xfers, " <<
DEC(badXfers) <<
" failed, " 531 <<
DEC(starves) <<
" starves, " <<
DEC(noRoomWaits) <<
" VBI waits");
545 mProducerThread.
Start();
553 NTV2DolbyPlayer * pApp (reinterpret_cast <NTV2DolbyPlayer *> (pContext));
562 ULWord freqNdx(0), testPatNdx(0), badTally(0);
563 double timeOfLastSwitch (0.0);
584 if (pFrameData->VideoBuffer())
585 pFrameData->fVideoBuffer.CopyFrom (mTestPatRasters.at(testPatNdx),
588 ULWord(pFrameData->fVideoBuffer.GetByteCount()));
590 const CRP188 rp188Info (mCurrentFrame++, 0, 0, 10, tcFormat);
597 if (pFrameData->VideoBuffer())
598 mTCBurner.
BurnTimeCode (pFrameData->VideoBuffer(), tcString.c_str(), 80);
599 TCDBG(
"F" <<
DEC0N(mCurrentFrame-1,6) <<
": " << tcF1 <<
": " << tcString);
602 if (pFrameData->AudioBuffer())
604 if (mDolbyFileIO.
IsOpen())
605 pFrameData->fNumAudioBytes =
AddDolby(*pFrameData);
609 pFrameData->fNumAudioBytes =
AddRamp(*pFrameData);
611 pFrameData->fNumAudioBytes =
AddTone(*pFrameData);
617 if (currentTime > timeOfLastSwitch + 4.0)
620 testPatNdx = (testPatNdx + 1) %
ULWord(mTestPatRasters.size());
622 timeOfLastSwitch = currentTime;
623 PLINFO(
"F" <<
DEC0N(mCurrentFrame,6) <<
": " << tcString <<
": tone=" << mToneFrequency <<
"Hz, pattern='" << tpNames.at(testPatNdx) <<
"'");
630 PLNOTE(
"Thread completed: " <<
DEC(mCurrentFrame) <<
" frame(s) produced, " <<
DEC(badTally) <<
" failed");
652 pFrequencies [0] = (mToneFrequency / 2.0);
653 for (
ULWord chan (1); chan < numChannels; chan++)
656 pFrequencies [chan] = pFrequencies [chan - 1] * 1.154782;
691 for (uint32_t samp(0); samp < numSamples; samp++)
693 for (uint32_t ch(0); ch < numChannels; ch++)
695 *audioBuffer = uint32_t(mRampSample) << 16;
701 return numSamples * numChannels * 4;
704 #if defined(DOLBY_FULL_PARSER) 721 if (!mDolbyFileIO.
IsOpen() || !mDolbyBuffer)
725 while (sampleOffset < numSamples)
727 if ((mBurstSize != 0) && (mBurstIndex < mBurstSamples))
729 if(mBurstOffset < mBurstSize)
733 if (mBurstIndex == 0)
739 else if (mBurstIndex == 1)
742 data0 = ((bsi.
bsmod & 0x7) << 8) | 0x0015;
743 data1 = mBurstSize * 2;
748 data0 = (uint32_t)(mBurstBuffer[mBurstOffset]);
749 data0 = ((data0 & 0x00ff) << 8) | ((data0 & 0xff00) >> 8);
751 data1 = (uint32_t)(mBurstBuffer[mBurstOffset]);
752 data1 = ((data1 & 0x00ff) << 8) | ((data1 & 0xff00) >> 8);
759 for (
ULWord i = 0; i < numChannels; i += 2)
761 audioBuffer[sampleOffset * numChannels + i] = data0;
762 audioBuffer[sampleOffset * numChannels + i + 1] = data1;
768 for (
ULWord i = 0; i < numChannels; i++)
770 audioBuffer[sampleOffset * numChannels + i] = 0;
792 cerr <<
"## ERROR: Dolby frame not found" << endl;
793 mDolbyFileIO.
Close();
797 if (!
ParseBSI(&mDolbyBuffer[1], sampleCount - 1, &bsi))
807 mDolbySize = sampleCount;
810 case 0: mDolbyBlocks = 1;
break;
811 case 1: mDolbyBlocks = 2;
break;
812 case 2: mDolbyBlocks = 3;
break;
813 case 3: mDolbyBlocks = 6;
break;
814 default:
goto silence;
818 while (numBlocks <= 6)
821 while (dolbyOffset < mDolbySize)
824 if (burstOffset >= mBurstMax)
826 cerr <<
"## ERROR: Dolby burst too large" << endl;
827 mDolbyFileIO.
Close();
832 mBurstBuffer[burstOffset] = mDolbyBuffer[dolbyOffset];
843 cerr <<
"## ERROR: Dolby frame not found" << endl;
844 mDolbyFileIO.
Close();
850 if (!
ParseBSI(&mDolbyBuffer[1], sampleCount - 1, &bsi))
856 cerr <<
"## ERROR: Dolby frame bad bsid = " << bsi.
bsid << endl;
860 mDolbySize = sampleCount;
867 numBlocks += mDolbyBlocks;
871 case 0: mDolbyBlocks = 1;
break;
872 case 1: mDolbyBlocks = 2;
break;
873 case 2: mDolbyBlocks = 3;
break;
874 case 3: mDolbyBlocks = 6;
break;
876 cerr <<
"## ERROR: Dolby frame bad numblkscod = " << bsi.
numblkscod << endl;
888 cerr <<
"## ERROR: Dolby frame unexpected convsync = " << bsi.
convsync << endl;
894 mBurstSize = burstOffset;
901 return numSamples * numChannels * 4;
905 memset(&audioBuffer[sampleOffset * numChannels], 0, (numSamples - sampleOffset) * numChannels * 4);
906 return numSamples * numChannels * 4;
917 bytes = mDolbyFileIO.
Read((uint8_t*)(&pInDolbyBuffer[0]), 2);
926 if ((mDolbyBuffer[0] == 0x7705) ||
927 (mDolbyBuffer[0] == 0x770b))
932 bytes = mDolbyFileIO.
Read((uint8_t*)(&pInDolbyBuffer[1]), 4);
937 uint32_t size = (uint32_t)mDolbyBuffer[1];
938 size = (((size & 0x00ff) << 8) | ((size & 0xff00) >> 8));
939 size = (size & 0x7ff) + 1;
942 uint32_t len = (size - 3) * 2;
943 bytes = mDolbyFileIO.
Read((uint8_t*)(&pInDolbyBuffer[3]), len);
955 if ((pInDolbyBuffer ==
NULL) || (pBsi ==
NULL))
976 if (pBsi->
acmod == 0x0)
996 if (pBsi->
acmod > 0x2)
1000 if ((pBsi->
acmod & 0x1) && (pBsi->
acmod > 0x2))
1005 if (pBsi->
acmod & 0x4)
1025 if (pBsi->
acmod == 0x0)
1045 else if (pBsi->
mixdef == 0x2)
1049 else if (pBsi->
mixdef == 0x3)
1127 uint32_t size = 8 * (pBsi->
mixdeflen + 2);
1128 size = (size + 7) / 8 * 8;
1132 if (!
GetBits(data, (size > 8)? 8 : size))
return false;
1138 if (pBsi->
acmod < 0x2)
1146 if (pBsi->
acmod == 0x0)
1175 for(blk = 0; blk < numblk; blk++)
1193 if (pBsi->
acmod == 0x2)
1198 if (pBsi->
acmod >= 0x6)
1209 if (pBsi->
acmod == 0x0)
1219 if (pBsi->
fscod < 0x3)
1249 uint32_t size = 8 * (pBsi->
addbsil + 1);
1253 if (!
GetBits(data, 8))
return false;
1265 mBitBuffer = pBuffer;
1273 static uint8_t bitMask[] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
1293 data |= ((*mBitBuffer >> mBitIndex) & bitMask[cb]) << bits;
1299 #else // DOLBY_FULL_PARSER 1313 if ((mConfig.fDolbyFile ==
NULL) || (mDolbyBuffer ==
NULL))
1317 while (sampleOffset < numSamples)
1320 if (mBurstIndex >= mBurstSamples)
1324 if (mBurstIndex == 0)
1327 uint32_t bytes = mConfig.fDolbyFile->Read((uint8_t*)(&mDolbyBuffer[0]), 2);
1332 bytes = mConfig.fDolbyFile->Read((uint8_t*)(&mDolbyBuffer[0]), 2);
1338 if ((mDolbyBuffer[0] != 0x7705) &&
1339 (mDolbyBuffer[0] != 0x770b))
1343 bytes = mConfig.fDolbyFile->Read((uint8_t*)(&mDolbyBuffer[1]), 4);
1348 uint32_t size = (uint32_t)mDolbyBuffer[1];
1349 size = (((size & 0x00ff) << 8) | ((size & 0xff00) >> 8)) + 1;
1352 uint32_t len = (size - 3) * 2;
1353 bytes = mConfig.fDolbyFile->Read((uint8_t*)(&mDolbyBuffer[3]), len);
1363 if (mBurstOffset < mBurstSize)
1367 if (mBurstIndex == 0)
1373 else if (mBurstIndex == 1)
1377 data1 = mBurstSize * 2;
1382 data0 = (uint32_t)(mDolbyBuffer[mBurstOffset]);
1383 data0 = ((data0 & 0x00ff) << 8) | ((data0 & 0xff00) >> 8);
1385 data1 = (uint32_t)(mDolbyBuffer[mBurstOffset]);
1386 data1 = ((data1 & 0x00ff) << 8) | ((data1 & 0xff00) >> 8);
1393 for (
ULWord i = 0; i < numChannels; i += 2)
1395 pInAudioBuffer[sampleOffset * numChannels + i] = data0;
1396 pInAudioBuffer[sampleOffset * numChannels + i + 1] = data1;
1402 for (
ULWord i = 0; i < numChannels; i++)
1404 pInAudioBuffer[sampleOffset * numChannels + i] = 0;
1412 return numSamples * numChannels * 4;
1416 memset(&pInAudioBuffer[sampleOffset * numChannels], 0, (numSamples - sampleOffset) * numChannels * 4);
1417 return numSamples * numChannels * 4;
1419 #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 SubscribeOutputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Causes me to be notified when an output vertical blanking interrupt is generated for the given output...
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 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). ...
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 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.
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 UnsubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Unregisters me so I'm no longer notified when an output VBI is signaled on the given output channel...
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.
ULWord GetFrameCount(void) const
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 AutoCirculate streaming for the specified channel that was previously initialized by CNTV2Card...
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 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 playback streaming, designating a contiguous block of frame buf...
#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]
std::vector< std::string > NTV2StringList
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.
std::string & lower(std::string &str)
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.