AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
ntv2player.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2player.h"
9 #include "ntv2debug.h"
10 #include "ntv2devicescanner.h"
11 #include "ntv2audiodefines.h"
12 #include "ntv2testpatterngen.h"
14 #include "ajabase/system/process.h"
15 #include "ajabase/system/file_io.h"
19 #include <fstream> // For ifstream
20 
21 using namespace std;
22 
23 //#define NTV2_BUFFER_LOCKING // Define this to pre-lock video/audio buffers in kernel
24 
25 // Convenience macros for EZ logging:
26 #define TCFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
27 #define TCWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
28 #define TCNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
29 #define TCINFO(_expr_) AJA_sINFO (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
30 #define TCDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
31 
37 static ULWord gAncMaxSizeBytes (NTV2_ANCSIZE_MAX); // Max per-frame anc buffer size, in bytes
38 
47 static const uint32_t gAudMaxSizeBytes (256 * 1024); // Max per-frame audio buffer size, in bytes
48 
49 static const bool BUFFER_PAGE_ALIGNED (true);
50 
51 // Audio tone generator data
52 static const double gFrequencies [] = {250.0, 500.0, 1000.0, 2000.0};
53 static const ULWord gNumFrequencies (sizeof(gFrequencies) / sizeof(double));
54 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,
55  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};
56 
57 
59  : mConfig (inConfig),
60  mConsumerThread (),
61  mProducerThread (),
62  mDevice (),
63  mSavedTaskMode (NTV2_TASK_MODE_INVALID),
64  mCurrentFrame (0),
65  mCurrentSample (0),
66  mToneFrequency (440.0),
67  mAudioSystem (NTV2_AUDIOSYSTEM_INVALID),
68  mFormatDesc (),
69  mTCIndexes (),
70  mGlobalQuit (false),
71  mTCBurner (),
72  mHostBuffers (),
73  mFrameDataRing (),
74  mTestPatRasters ()
75 {
76 }
77 
78 
80 {
81  // Stop my playout and producer threads, then destroy them...
82  Quit();
83 
84  mDevice.UnsubscribeOutputVerticalEvent(mConfig.fOutputChannel); // Unsubscribe from output VBI event
85 } // destructor
86 
87 
88 void NTV2Player::Quit (void)
89 {
90  // Set the global 'quit' flag, and wait for the threads to go inactive...
91  mGlobalQuit = true;
92 
93  while (mProducerThread.Active())
94  AJATime::Sleep(10);
95 
96  while (mConsumerThread.Active())
97  AJATime::Sleep(10);
98 
99 #if defined(NTV2_BUFFER_LOCKING)
100  mDevice.DMABufferUnlockAll();
101 #endif // NTV2_BUFFER_LOCKING
102  if (!mConfig.fDoMultiFormat && mDevice.IsOpen())
103  {
105  if (NTV2_IS_VALID_TASK_MODE(mSavedTaskMode))
106  mDevice.SetEveryFrameServices(mSavedTaskMode); // Restore prior task mode
107  }
108 } // Quit
109 
110 
112 {
113  AJAStatus status (AJA_STATUS_SUCCESS);
114 
115  // Open the device...
117  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl; return AJA_STATUS_OPEN;}
118 
119  if (!mDevice.IsDeviceReady(false))
120  {cerr << "## ERROR: Device '" << mDevice.GetDisplayName() << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
121  if (!mDevice.features().CanDoPlayback())
122  {cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' is capture-only" << endl; return AJA_STATUS_FEATURE;}
123 
124  const UWord maxNumChannels (mDevice.features().GetNumFrameStores());
125 
126  // Beware -- some older devices (e.g. Corvid1) can only output from FrameStore 2...
127  if ((mConfig.fOutputChannel == NTV2_CHANNEL1) && (!mDevice.features().CanDoFrameStore1Display()))
128  mConfig.fOutputChannel = NTV2_CHANNEL2;
129  if (UWord(mConfig.fOutputChannel) >= maxNumChannels)
130  {
131  cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' can't use Ch" << DEC(mConfig.fOutputChannel+1)
132  << " -- only supports Ch1" << (maxNumChannels > 1 ? string("-Ch") + string(1, char(maxNumChannels+'0')) : "") << endl;
133  return AJA_STATUS_UNSUPPORTED;
134  }
135 
136  if (!mConfig.fAncDataFilePath.empty())
138  {
139  cerr << "## ERROR: Anc data file '" << mConfig.fAncDataFilePath << "' not found" << endl;
140  return AJA_STATUS_NOT_FOUND;
141  }
142 
143  if (!mConfig.fDoMultiFormat)
144  {
145  mDevice.GetEveryFrameServices(mSavedTaskMode); // Save the current task mode
147  return AJA_STATUS_BUSY; // Device is in use by another app -- fail
148  }
149  mDevice.SetEveryFrameServices(NTV2_OEM_TASKS); // Set OEM service level
150 
151  if (mDevice.features().CanDoMultiFormat())
152  mDevice.SetMultiFormatMode(mConfig.fDoMultiFormat);
153  else
154  mConfig.fDoMultiFormat = false;
155 
156  // Set up the video and audio...
157  status = SetUpVideo();
158  if (AJA_FAILURE(status))
159  return status;
160  status = mConfig.WithAudio() ? SetUpAudio() : AJA_STATUS_SUCCESS;
161  if (AJA_FAILURE(status))
162  return status;
163 
164  // Set up the circular buffers, and the test pattern buffers...
165  status = SetUpHostBuffers();
166  if (AJA_FAILURE(status))
167  return status;
168  status = SetUpTestPatternBuffers();
169  if (AJA_FAILURE(status))
170  return status;
171 
172  // Set up the device signal routing...
173  if (!RouteOutputSignal())
174  return AJA_STATUS_FAIL;
175 
176  // Lastly, prepare my AJATimeCodeBurn instance...
177  if (!mTCBurner.RenderTimeCodeFont (CNTV2DemoCommon::GetAJAPixelFormat(mConfig.fPixelFormat), mFormatDesc.numPixels, mFormatDesc.numLines))
178  {cerr << "## ERROR: RenderTimeCodeFont failed for: " << mFormatDesc << endl; return AJA_STATUS_UNSUPPORTED;}
179 
180  // Ready to go...
181  #if defined(_DEBUG)
182  cerr << mConfig;
183  if (mDevice.IsRemote())
184  cerr << "Device Description: " << mDevice.GetDescription() << endl;
185  cerr << endl;
186  #endif // defined(_DEBUG)
187  return AJA_STATUS_SUCCESS;
188 
189 } // Init
190 
191 
193 {
194  // Configure the device to output the requested video format...
195  if (mConfig.fVideoFormat == NTV2_FORMAT_UNKNOWN)
196  return AJA_STATUS_BAD_PARAM;
197  if (!mDevice.features().CanDoVideoFormat(mConfig.fVideoFormat))
198  { cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' doesn't support "
199  << ::NTV2VideoFormatToString(mConfig.fVideoFormat) << endl;
200  return AJA_STATUS_UNSUPPORTED;
201  }
202  if (!mDevice.features().CanDoFrameBufferFormat(mConfig.fPixelFormat))
203  { cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' doesn't support "
204  << ::NTV2FrameBufferFormatString(mConfig.fPixelFormat) << endl;
205  return AJA_STATUS_UNSUPPORTED;
206  }
207 
208  // This demo doesn't playout dual-link RGB over SDI -- only YCbCr.
209  // Check that this device has a CSC to convert RGB to YUV...
210  if (::IsRGBFormat(mConfig.fPixelFormat)) // If RGB FBF...
211  if (UWord(mConfig.fOutputChannel) > mDevice.features().GetNumCSCs()) // No CSC for this channel?
212  {cerr << "## ERROR: No CSC for channel " << DEC(mConfig.fOutputChannel+1) << " to convert RGB pixel format" << endl;
213  return AJA_STATUS_UNSUPPORTED;}
214 
215  if (!mDevice.features().CanDo3GLevelConversion() && mConfig.fDoABConversion && ::IsVideoFormatA(mConfig.fVideoFormat))
216  mConfig.fDoABConversion = false;
217  if (mConfig.fDoABConversion)
219 
220  // Keep the raster description handy...
221  mFormatDesc = NTV2FormatDescriptor(mConfig.fVideoFormat, mConfig.fPixelFormat);
222  if (!mFormatDesc.IsValid())
223  return AJA_STATUS_FAIL;
224 
225  // Turn on the FrameStore (to read frame buffer memory and transmit video)...
226  mDevice.EnableChannel(mConfig.fOutputChannel);
227 
228  // This demo assumes VANC is disabled...
229  mDevice.SetVANCMode(NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
231 
232  // Set the FrameStore video format...
233  mDevice.SetVideoFormat (mConfig.fVideoFormat, false, false, mConfig.fOutputChannel);
234 
235  // Set the frame buffer pixel format for the device FrameStore...
236  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mConfig.fPixelFormat);
237 
238  // The output interrupt is Enabled by default, but on some platforms, you must subscribe to it
239  // in order to be able to wait on its event/semaphore...
241 
242  // Check if HDR anc is permissible...
243  if (IS_KNOWN_AJAAncDataType(mConfig.fTransmitHDRType) && !mDevice.features().CanDoCustomAnc())
244  {cerr << "## WARNING: HDR Anc requested, but device can't do custom anc" << endl;
246 
247  // Get current per-field maximum Anc buffer size...
250 
251  // Set output clock reference...
252  mDevice.SetReference(mDevice.features().CanDo2110() ? NTV2_REFERENCE_SFP1_PTP : NTV2_REFERENCE_FREERUN);
253 
254  // At this point, video setup is complete (except for widget signal routing).
255  return AJA_STATUS_SUCCESS;
256 
257 } // SetUpVideo
258 
259 
261 {
262  uint16_t numAudioChannels (mDevice.features().GetMaxAudioChannels());
263 
264  // If there are 2048 pixels on a line instead of 1920, reduce the number of audio channels
265  // This is because HANC is narrower, and has space for only 8 channels
266  if (NTV2_IS_2K_1080_VIDEO_FORMAT(mConfig.fVideoFormat) && numAudioChannels > 8)
267  numAudioChannels = 8;
268 
269  mAudioSystem = NTV2_AUDIOSYSTEM_1; // Use NTV2_AUDIOSYSTEM_1...
270  if (mDevice.features().GetNumAudioSystems() > 1) // ...but if the device has more than one audio system...
271  mAudioSystem = ::NTV2ChannelToAudioSystem(mConfig.fOutputChannel); // ...base it on the channel
272  // However, there are a few older devices that have only 1 audio system,
273  // yet 2 frame stores (or must use channel 2 for playout)...
274  if (!mDevice.features().CanDoFrameStore1Display())
275  mAudioSystem = NTV2_AUDIOSYSTEM_1;
276 
277  mDevice.SetNumberAudioChannels (numAudioChannels, mAudioSystem);
278  mDevice.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
279 
280  // How big should the on-device audio buffer be? 1MB? 2MB? 4MB? 8MB?
281  // For this demo, 4MB will work best across all platforms (Windows, Mac & Linux)...
282  mDevice.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
283 
284  // Set the SDI output audio embedders to embed audio samples from the output of mAudioSystem...
285  mDevice.SetSDIOutputAudioSystem (mConfig.fOutputChannel, mAudioSystem);
286  mDevice.SetSDIOutputDS2AudioSystem (mConfig.fOutputChannel, mAudioSystem);
287 
288  // If the last app using the device left it in E-E mode (input passthru), then loopback
289  // must be disabled --- otherwise the output audio will be pass-thru SDI input audio...
290  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, mAudioSystem);
291 
292  if (!mConfig.fDoMultiFormat && mDevice.features().GetNumHDMIVideoOutputs())
293  {
297  }
298 
299  return AJA_STATUS_SUCCESS;
300 
301 } // SetUpAudio
302 
303 
305 {
306  CNTV2DemoCommon::SetDefaultPageSize(); // Set host-specific page size
307 
308  // Let my circular buffer know when it's time to quit...
309  mFrameDataRing.SetAbortFlag (&mGlobalQuit);
310 
311  // Allocate and add each in-host NTV2FrameData to my circular buffer member variable...
312  mHostBuffers.reserve(CIRCULAR_BUFFER_SIZE);
313  while (mHostBuffers.size() < CIRCULAR_BUFFER_SIZE)
314  {
315  mHostBuffers.push_back(NTV2FrameData()); // Make a new NTV2FrameData...
316  NTV2FrameData & frameData(mHostBuffers.back()); // ...and get a reference to it
317 
318  // Allocate a page-aligned video buffer
319  if (mConfig.WithVideo())
320  if (!frameData.fVideoBuffer.Allocate (mFormatDesc.GetTotalBytes(), BUFFER_PAGE_ALIGNED))
321  {
322  PLFAIL("Failed to allocate " << xHEX0N(mFormatDesc.GetTotalBytes(),8) << "-byte video buffer");
323  return AJA_STATUS_MEMORY;
324  }
325  #ifdef NTV2_BUFFER_LOCKING
326  if (frameData.fVideoBuffer)
327  mDevice.DMABufferLock(frameData.fVideoBuffer, true);
328  #endif
329 
330  // Allocate a page-aligned audio buffer (if transmitting audio)
331  if (mConfig.WithAudio())
333  {
334  PLFAIL("Failed to allocate " << xHEX0N(gAudMaxSizeBytes,8) << "-byte audio buffer");
335  return AJA_STATUS_MEMORY;
336  }
337  #ifdef NTV2_BUFFER_LOCKING
338  if (frameData.fAudioBuffer)
339  mDevice.DMABufferLock(frameData.fAudioBuffer, /*alsoPreLockSGL*/true);
340  #endif
341  mFrameDataRing.Add (&frameData);
342  } // for each NTV2FrameData
343 
344  return AJA_STATUS_SUCCESS;
345 
346 } // SetUpHostBuffers
347 
348 
350 {
351  vector<NTV2TestPatternSelect> testPatIDs;
352  testPatIDs.push_back(NTV2_TestPatt_ColorBars100);
353  testPatIDs.push_back(NTV2_TestPatt_ColorBars75);
354  testPatIDs.push_back(NTV2_TestPatt_Ramp);
355  testPatIDs.push_back(NTV2_TestPatt_MultiBurst);
356  testPatIDs.push_back(NTV2_TestPatt_LineSweep);
357  testPatIDs.push_back(NTV2_TestPatt_CheckField);
358  testPatIDs.push_back(NTV2_TestPatt_FlatField);
359  testPatIDs.push_back(NTV2_TestPatt_MultiPattern);
360 
361  mTestPatRasters.clear();
362  for (size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
363  mTestPatRasters.push_back(NTV2Buffer());
364 
365  if (!mFormatDesc.IsValid())
366  {PLFAIL("Bad format descriptor"); return AJA_STATUS_FAIL;}
367  if (mFormatDesc.IsVANC())
368  {PLFAIL("VANC should have been disabled: " << mFormatDesc); return AJA_STATUS_FAIL;}
369 
370  // Set up one video buffer for each test pattern...
371  for (size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
372  {
373  // Allocate the buffer memory...
374  if (!mTestPatRasters.at(tpNdx).Allocate (mFormatDesc.GetTotalBytes(), BUFFER_PAGE_ALIGNED))
375  { PLFAIL("Test pattern buffer " << DEC(tpNdx+1) << " of " << DEC(testPatIDs.size()) << ": "
376  << xHEX0N(mFormatDesc.GetTotalBytes(),8) << "-byte page-aligned alloc failed");
377  return AJA_STATUS_MEMORY;
378  }
379 
380  // Fill the buffer with test pattern...
381  NTV2TestPatternGen testPatternGen;
382  if (!testPatternGen.DrawTestPattern (testPatIDs.at(tpNdx), mFormatDesc, mTestPatRasters.at(tpNdx)))
383  {
384  cerr << "## ERROR: DrawTestPattern " << DEC(tpNdx) << " failed: " << mFormatDesc << endl;
385  return AJA_STATUS_FAIL;
386  }
387 
388  #ifdef NTV2_BUFFER_LOCKING
389  // Try to prelock the memory, including its scatter-gather list...
390  if (!mDevice.DMABufferLock(mTestPatRasters.at(tpNdx), /*alsoLockSegmentMap=*/true))
391  PLWARN("Test pattern buffer " << DEC(tpNdx+1) << " of " << DEC(testPatIDs.size()) << ": failed to pre-lock");
392  #endif
393  } // loop for each predefined pattern
394 
395  return AJA_STATUS_SUCCESS;
396 
397 } // SetUpTestPatternBuffers
398 
399 
401 {
402  const NTV2Standard outputStandard (::GetNTV2StandardFromVideoFormat(mConfig.fVideoFormat));
403  const UWord numSDIOutputs (mDevice.features().GetNumVideoOutputs());
404  const bool isRGB (::IsRGBFormat(mConfig.fPixelFormat));
405  const bool canVerify (mDevice.features().HasCrosspointConnectROM());
406  UWord connectFailures (0);
407 
408  // Since this function figures out which SDI spigots will be set up for output,
409  // it also sets the "mTCIndexes" member, which determines which timecodes will
410  // be transmitted (and on which SDI spigots)...
411  mTCIndexes.clear();
412 
413  const NTV2OutputXptID cscVidOutXpt(::GetCSCOutputXptFromChannel(mConfig.fOutputChannel, false/*isKey*/, !isRGB/*isRGB*/));
414  const NTV2OutputXptID fsVidOutXpt (::GetFrameBufferOutputXptFromChannel(mConfig.fOutputChannel, isRGB/*isRGB*/, false/*is425*/));
415  const NTV2InputXptID cscInputXpt (isRGB ? ::GetCSCInputXptFromChannel(mConfig.fOutputChannel, false/*isKeyInput*/) : NTV2_INPUT_CROSSPOINT_INVALID);
416  if (isRGB)
417  if (!mDevice.Connect (cscInputXpt, fsVidOutXpt, canVerify))
418  connectFailures++;
419 
420  if (mConfig.fDoMultiFormat)
421  {
422  // Multiformat --- We may be sharing the device with other processes, so route only one SDI output...
423  if (mDevice.features().HasBiDirectionalSDI())
424  mDevice.SetSDITransmitEnable(mConfig.fOutputChannel, true);
425 
426  if (!mDevice.Connect (::GetSDIOutputInputXpt (mConfig.fOutputChannel, false/*isDS2*/), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
427  connectFailures++;
428  mTCIndexes.insert (::NTV2ChannelToTimecodeIndex(mConfig.fOutputChannel, /*inEmbeddedLTC=*/mConfig.fTransmitLTC));
429  // NOTE: No need to send VITC2 with VITC1 (for "i" formats) -- firmware does this automatically
430  mDevice.SetSDIOutputStandard (mConfig.fOutputChannel, outputStandard);
431  }
432  else
433  {
434  // Not multiformat: We own the whole device, so connect all possible SDI outputs...
435  const UWord numFrameStores(mDevice.features().GetNumFrameStores());
436  mDevice.ClearRouting(); // Start with clean slate
437 
438  if (isRGB)
439  if (!mDevice.Connect (cscInputXpt, fsVidOutXpt, canVerify))
440  connectFailures++;
441 
442  for (NTV2Channel chan(NTV2_CHANNEL1); ULWord(chan) < numSDIOutputs; chan = NTV2Channel(chan+1))
443  {
444  if (chan != mConfig.fOutputChannel && chan < numFrameStores)
445  mDevice.DisableChannel(chan); // Disable unused FrameStore
446  if (mDevice.features().HasBiDirectionalSDI())
447  mDevice.SetSDITransmitEnable (chan, true); // Make it an output
448 
449  const NTV2OutputDestination sdiOutput(::NTV2ChannelToOutputDestination(chan));
450  if (NTV2_OUTPUT_DEST_IS_SDI(sdiOutput))
451  if (OutputDestHasRP188BypassEnabled(sdiOutput))
452  DisableRP188Bypass(sdiOutput);
453  if (!mDevice.Connect (::GetSDIOutputInputXpt (chan, false/*isDS2*/), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
454  connectFailures++;
455  mDevice.SetSDIOutputStandard (chan, outputStandard);
456  mTCIndexes.insert (::NTV2ChannelToTimecodeIndex (chan, /*inEmbeddedLTC=*/mConfig.fTransmitLTC)); // Add SDI spigot's TC index
457  // NOTE: No need to send VITC2 with VITC1 (for "i" formats) -- firmware does this automatically
458 
459  if (mConfig.WithAudio())
460  mDevice.SetSDIOutputAudioSystem (chan, mAudioSystem); // Ensure SDIOut embedder gets audio from mAudioSystem
461  } // for each SDI output spigot
462 
463  // And connect analog video output, if the device has one...
464  if (mDevice.features().GetNumAnalogVideoOutputs())
465  if (!mDevice.Connect (::GetOutputDestInputXpt(NTV2_OUTPUTDESTINATION_ANALOG), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
466  connectFailures++;
467 
468  // And connect HDMI video output, if the device has one...
469  if (mDevice.features().GetNumHDMIVideoOutputs())
470  if (!mDevice.Connect (::GetOutputDestInputXpt(NTV2_OUTPUTDESTINATION_HDMI), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
471  connectFailures++;
472  }
473  TCNOTE(mTCIndexes);
474  if (connectFailures)
475  PLWARN(DEC(connectFailures) << " 'Connect' call(s) failed");
476  return connectFailures == 0;
477 
478 } // RouteOutputSignal
479 
480 
482 {
483  // Start my consumer and producer threads...
486  return AJA_STATUS_SUCCESS;
487 
488 } // Run
489 
490 
491 
493 // This is where the play thread starts
494 
496 {
497  // Create and start the playout thread...
498  mConsumerThread.Attach (ConsumerThreadStatic, this);
499  mConsumerThread.SetPriority(AJA_ThreadPriority_High);
500  mConsumerThread.Start();
501 
502 } // StartConsumerThread
503 
504 
505 // The playout thread function
506 void NTV2Player::ConsumerThreadStatic (AJAThread * pThread, void * pContext) // static
507 { (void) pThread;
508  // Grab the NTV2Player instance pointer from the pContext parameter,
509  // then call its ConsumeFrames method...
510  NTV2Player * pApp (reinterpret_cast<NTV2Player*>(pContext));
511  if (pApp)
512  pApp->ConsumeFrames();
513 
514 } // ConsumerThreadStatic
515 
516 
517 static uint64_t sTotalAncFileBytes(0), sCurrentAncFileBytes(0);
518 
519 
521 {
522  ULWord acOptions (AUTOCIRCULATE_WITH_RP188);
523  AUTOCIRCULATE_TRANSFER outputXfer;
524  AUTOCIRCULATE_STATUS outputStatus;
525  AJAAncillaryData * pPkt (AJA_NULL);
526  ULWord goodXfers(0), badXfers(0), starves(0), noRoomWaits(0);
527  ifstream * pAncStrm (AJA_NULL);
528 
529  // Stop AutoCirculate, just in case someone else left it running...
530  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
531  mDevice.WaitForOutputVerticalInterrupt(mConfig.fOutputChannel, 4); // Let it stop
532  PLNOTE("Thread started");
533 
535  { // HDR anc doesn't change per-frame, so fill outputXfer.acANCBuffer with the packet data...
536  static AJAAncillaryData_HDR_SDR sdrPkt;
537  static AJAAncillaryData_HDR_HDR10 hdr10Pkt;
538  static AJAAncillaryData_HDR_HLG hlgPkt;
539 
540  switch (mConfig.fTransmitHDRType)
541  {
542  case AJAAncDataType_HDR_SDR: pPkt = &sdrPkt; break;
543  case AJAAncDataType_HDR_HDR10: pPkt = &hdr10Pkt; break;
544  case AJAAncDataType_HDR_HLG: pPkt = &hlgPkt; break;
545  default: break;
546  }
547  }
548  if (pPkt)
549  { // Allocate page-aligned host Anc buffer...
550  uint32_t hdrPktSize (0);
551  if (!outputXfer.acANCBuffer.Allocate(gAncMaxSizeBytes, BUFFER_PAGE_ALIGNED) || !outputXfer.acANCBuffer.Fill(0LL))
552  PLWARN("Anc buffer " << xHEX0N(gAncMaxSizeBytes,8) << "(" << DEC(gAncMaxSizeBytes) << ")-byte allocate failed -- HDR anc insertion disabled");
553  else if (AJA_FAILURE(pPkt->GenerateTransmitData (outputXfer.acANCBuffer, outputXfer.acANCBuffer, hdrPktSize)))
554  {
555  PLWARN("HDR anc insertion disabled -- GenerateTransmitData failed");
556  outputXfer.acANCBuffer.Deallocate();
557  }
558  else
559  acOptions |= AUTOCIRCULATE_WITH_ANC;
560  }
561  else if (!mConfig.fAncDataFilePath.empty())
562  { // Open raw anc file for reading...
563  pAncStrm = new ifstream(mConfig.fAncDataFilePath.c_str(), ios::binary);
564  do
565  {
566  if (!pAncStrm->good())
567  { PLFAIL("Cannot open anc file '" << mConfig.fAncDataFilePath << "' -- anc insertion disabled");
568  delete pAncStrm; pAncStrm = AJA_NULL;
569  break;
570  }
571  pAncStrm->seekg(0, std::ios_base::end);
572  if (pAncStrm->tellg() == -1)
573  { PLFAIL("Cannot determine anc file size -- anc insertion disabled");
574  delete pAncStrm; pAncStrm = AJA_NULL;
575  break;
576  }
577  sTotalAncFileBytes = uint64_t(pAncStrm->tellg());
578  pAncStrm->seekg(0); // Rewind to start
580  { PLFAIL("anc buffer size " << DEC(gAncMaxSizeBytes*2) << " exceeds anc file size " << DEC(sTotalAncFileBytes)
581  << " -- anc insertion disabled");
582  delete pAncStrm; pAncStrm = AJA_NULL;
583  break;
584  }
585  // Allocate anc buffers...
586  bool ancOK = outputXfer.acANCBuffer.Allocate(gAncMaxSizeBytes, BUFFER_PAGE_ALIGNED);
589  if (!ancOK)
590  {
591  PLFAIL("Anc buffer " << xHEX0N(gAncMaxSizeBytes,8) << "(" << DEC(gAncMaxSizeBytes) << ")-byte"
592  " allocation failed -- anc insertion disabled");
593  outputXfer.acANCBuffer.Deallocate();
594  outputXfer.acANCField2Buffer.Deallocate();
595  delete pAncStrm;
596  pAncStrm = AJA_NULL;
597  break;
598  }
599  acOptions |= AUTOCIRCULATE_WITH_ANC;
600  break; // Good to go!
601  } while (false); // Once thru
602  }
603 #ifdef NTV2_BUFFER_LOCKING
604  if (outputXferInfo.acANCBuffer)
605  mDevice.DMABufferLock(outputXfer.acANCBuffer, /*alsoLockSGL*/true);
606  if (outputXferInfo.acANCField2Buffer)
607  mDevice.DMABufferLock(outputXfer.acANCField2Buffer, /*alsoLockSGL*/true);
608 #endif
609 
610  // Initialize & start AutoCirculate...
611  bool initOK = mDevice.AutoCirculateInitForOutput (mConfig.fOutputChannel, mConfig.fFrames.count(), mAudioSystem, acOptions,
612  1 /*numChannels*/, mConfig.fFrames.firstFrame(), mConfig.fFrames.lastFrame());
613  if (!initOK)
614  {PLFAIL("AutoCirculateInitForOutput failed"); mGlobalQuit = true;}
615  else if (!mConfig.WithVideo())
616  { // Video suppressed --
617  // Clear device frame buffers being AutoCirculated (prevent garbage output frames)
618  NTV2Buffer tmpFrame (mFormatDesc.GetVideoWriteSize());
619  NTV2TestPatternGen blackPatternGen;
620  blackPatternGen.DrawTestPattern (NTV2_TestPatt_Black, mFormatDesc, tmpFrame);
621  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
622  for (uint16_t frmNum(outputStatus.GetStartFrame()); frmNum <= outputStatus.GetEndFrame(); frmNum++)
623  mDevice.DMAWriteFrame(ULWord(frmNum), tmpFrame, mFormatDesc.GetTotalBytes());
624  } // else if --novideo
625 
626  while (!mGlobalQuit)
627  {
628  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
629 
630  // Check if there's room for another frame on the card...
631  if (outputStatus.CanAcceptMoreOutputFrames())
632  {
633  // Device has at least one free frame buffer that can be filled.
634  // Wait for the next frame in our ring to become ready to "consume"...
635  NTV2FrameData * pFrameData (mFrameDataRing.StartConsumeNextBuffer());
636  if (!pFrameData)
637  {starves++; continue;}
638 
639  outputXfer.SetOutputTimeCodes(pFrameData->fTimecodes);
640 
641  if (pFrameData->VideoBuffer()) // Transfer the timecode-burned frame to the device for playout...
642  outputXfer.SetVideoBuffer (pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
643  if (pFrameData->AudioBuffer()) // If also playing audio...
644  outputXfer.SetAudioBuffer (pFrameData->AudioBuffer(), pFrameData->fNumAudioBytes);
645 
646  if (pAncStrm && pAncStrm->good() && outputXfer.acANCBuffer)
647  { // Read pre-recorded anc from binary data file, and inject it into this frame...
648  pAncStrm->read(outputXfer.acANCBuffer, streamsize(outputXfer.acANCBuffer.GetByteCount()));
649  sCurrentAncFileBytes += pAncStrm->good() ? outputXfer.acANCBuffer.GetByteCount() : 0;
650  if (pAncStrm->good() && outputXfer.acANCField2Buffer)
651  {
652  pAncStrm->read(outputXfer.acANCField2Buffer, streamsize(outputXfer.acANCField2Buffer.GetByteCount()));
653  sCurrentAncFileBytes += pAncStrm->good() ? outputXfer.acANCField2Buffer.GetByteCount() : 0;
654  }
655  if (pAncStrm->eof())
656  { pAncStrm->clear();
657  pAncStrm->seekg(0); // Rewind upon EOF
659  PLDBG("Anc file rewound: " << DEC(goodXfers) << " goodXfers, " << DEC(badXfers) << " badXfers");
660  }
661  } // if playing anc from binary data file
662 
663  // Perform the DMA transfer to the device...
664  if (mDevice.AutoCirculateTransfer (mConfig.fOutputChannel, outputXfer))
665  goodXfers++;
666  else
667  badXfers++;
668 
669  if (goodXfers == 3)
670  mDevice.AutoCirculateStart(mConfig.fOutputChannel);
671 
672  // Signal that the frame has been "consumed"...
673  mFrameDataRing.EndConsumeNextBuffer();
674  continue; // Back to top of while loop
675  } // if CanAcceptMoreOutputFrames
676 
677  // Wait for one or more buffers to become available on the device, which should occur at next VBI...
678  noRoomWaits++;
680  } // loop til quit signaled
681 
682  // Stop AutoCirculate...
683  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
684  PLNOTE("Thread completed: " << DEC(goodXfers) << " xfers, " << DEC(badXfers) << " failed, "
685  << DEC(starves) << " starves, " << DEC(noRoomWaits) << " VBI waits");
686  if (pAncStrm)
687  delete pAncStrm;
688 
689 } // ConsumeFrames
690 
691 
692 
694 // This is where the producer thread starts
695 
697 {
698  // Create and start the producer thread...
699  mProducerThread.Attach(ProducerThreadStatic, this);
700  mProducerThread.SetPriority(AJA_ThreadPriority_High);
701  mProducerThread.Start();
702 
703 } // StartProducerThread
704 
705 
706 void NTV2Player::ProducerThreadStatic (AJAThread * pThread, void * pContext) // static
707 { (void) pThread;
708  NTV2Player * pApp (reinterpret_cast<NTV2Player*>(pContext));
709  if (pApp)
710  pApp->ProduceFrames();
711 
712 } // ProducerThreadStatic
713 
714 
716 {
717  ULWord freqNdx(0), testPatNdx(0), badTally(0);
718  double timeOfLastSwitch (0.0);
719 
722  const bool isInterlace (!NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(mConfig.fVideoFormat));
723  const bool isPAL (NTV2_IS_PAL_VIDEO_FORMAT(mConfig.fVideoFormat));
724  const NTV2FrameRate ntv2FrameRate (::GetNTV2FrameRateFromVideoFormat(mConfig.fVideoFormat));
725  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
726 
727  PLNOTE("Thread started");
728  while (!mGlobalQuit)
729  {
730  NTV2FrameData * pFrameData (mFrameDataRing.StartProduceNextBuffer());
731  if (!pFrameData)
732  { badTally++; // No frame available!
733  AJATime::Sleep(10); // Wait a bit for the consumer thread to free one up for me...
734  continue; // ...then try again
735  }
736 
737  if (pFrameData->VideoBuffer()) // Copy fresh, unmodified, pre-rendered test pattern into this frame's video buffer...
738  pFrameData->fVideoBuffer.CopyFrom (mTestPatRasters.at(testPatNdx),
739  /*srcOffset*/ 0,
740  /*dstOffset*/ 0,
741  /*byteCount*/ pFrameData->fVideoBuffer.GetByteCount());
742 
743  const CRP188 rp188Info (mCurrentFrame++, 0, 0, 10, tcFormat);
744  NTV2_RP188 tcF1, tcF2;
745  string tcString;
746 
747  rp188Info.GetRP188Reg(tcF1);
748  rp188Info.GetRP188Str(tcString);
749 
750  // Include timecode in output signal...
751  tcF2 = tcF1;
752  if (isInterlace)
753  { // Set bit 27 of Hi word (PAL) or Lo word (NTSC)
754  if (isPAL) tcF2.fHi |= BIT(27); else tcF2.fLo |= BIT(27);
755  }
756 
757  // Add timecodes for each SDI output...
758  for (NTV2TCIndexesConstIter it(mTCIndexes.begin()); it != mTCIndexes.end(); ++it)
759  pFrameData->fTimecodes[*it] = NTV2_IS_ATC_VITC2_TIMECODE_INDEX(*it) ? tcF2 : tcF1;
760 
761  if (pFrameData->VideoBuffer()) // Burn current timecode into the video buffer...
762  mTCBurner.BurnTimeCode (pFrameData->VideoBuffer(), tcString.c_str(), 80);
763  TCDBG("F" << DEC0N(mCurrentFrame-1,6) << ": " << tcF1 << ": " << tcString);
764 
765  // If also playing audio...
766  if (pFrameData->AudioBuffer()) // ...then generate audio tone data for this frame...
767  pFrameData->fNumAudioBytes = AddTone(*pFrameData); // ...and remember number of audio bytes to xfer
768 
769  // Every few seconds, change the test pattern and tone frequency...
770  const double currentTime (timeBase.FramesToSeconds(mCurrentFrame));
771  if (currentTime > timeOfLastSwitch + 4.0)
772  {
773  freqNdx = (freqNdx + 1) % gNumFrequencies;
774  testPatNdx = (testPatNdx + 1) % ULWord(mTestPatRasters.size());
775  mToneFrequency = gFrequencies[freqNdx];
776  timeOfLastSwitch = currentTime;
777  if (sTotalAncFileBytes)
778  PLINFO("F" << DEC0N(mCurrentFrame,6) << ": " << tcString << ": tone=" << mToneFrequency << "Hz, pattern='"
779  << tpNames.at(testPatNdx) << "', anc file " << DEC(sCurrentAncFileBytes * 100ULL / sTotalAncFileBytes) << "%");
780  else
781  PLINFO("F" << DEC0N(mCurrentFrame,6) << ": " << tcString << ": tone=" << mToneFrequency << "Hz, pattern='"
782  << tpNames.at(testPatNdx) << "'");
783  } // if time to switch test pattern & tone frequency
784 
785  // Signal that I'm done producing this FrameData, making it immediately available for transfer/playout...
786  mFrameDataRing.EndProduceNextBuffer();
787 
788  } // loop til mGlobalQuit goes true
789  PLNOTE("Thread completed: " << DEC(mCurrentFrame) << " frame(s) produced, " << DEC(badTally) << " failed");
790 
791 } // ProduceFrames
792 
793 
794 uint32_t NTV2Player::AddTone (NTV2FrameData & inFrameData)
795 {
798  ULWord numChannels (0);
799 
800  mDevice.GetFrameRate (frameRate, mConfig.fOutputChannel);
801  mDevice.GetAudioRate (audioRate, mAudioSystem);
802  mDevice.GetNumberAudioChannels (numChannels, mAudioSystem);
803 
804  // Set per-channel tone frequencies...
805  double pFrequencies [kNumAudioChannelsMax];
806  pFrequencies[0] = (mToneFrequency / 2.0);
807  for (ULWord chan(1); chan < numChannels; chan++)
808  // The 1.154782 value is the 16th root of 10, to ensure that if mToneFrequency is 2000,
809  // that the calculated frequency of audio channel 16 will be 20kHz...
810  pFrequencies[chan] = pFrequencies[chan-1] * 1.154782;
811 
812  // Since audio on AJA devices use fixed sample rates (typically 48KHz), certain video frame rates will
813  // necessarily result in some frames having more audio samples than others. GetAudioSamplesPerFrame is
814  // called to calculate the correct sample count for the current frame...
815  const ULWord numSamples (::GetAudioSamplesPerFrame (frameRate, audioRate, mCurrentFrame));
816  const double sampleRateHertz (::GetAudioSamplesPerSecond(audioRate));
817 
818  return ::AddAudioTone ( inFrameData.AudioBuffer(), // audio buffer to fill
819  mCurrentSample, // which sample for continuing the waveform
820  numSamples, // number of samples to generate
821  sampleRateHertz, // sample rate [Hz]
822  gAmplitudes, // per-channel amplitudes
823  pFrequencies, // per-channel tone frequencies [Hz]
824  31, // bits per sample
825  false, // don't byte-swap
826  numChannels); // number of audio channels to generate
827 } // AddTone
828 
829 
831 {
832  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outStatus);
833 }
834 
835 
837 {
838  switch (inOutputDest)
839  {
840  case NTV2_OUTPUTDESTINATION_SDI1: return kRegRP188InOut1DBB; // reg 29
841  case NTV2_OUTPUTDESTINATION_SDI2: return kRegRP188InOut2DBB; // reg 64
842  case NTV2_OUTPUTDESTINATION_SDI3: return kRegRP188InOut3DBB; // reg 268
843  case NTV2_OUTPUTDESTINATION_SDI4: return kRegRP188InOut4DBB; // reg 273
844  case NTV2_OUTPUTDESTINATION_SDI5: return kRegRP188InOut5DBB; // reg 29
845  case NTV2_OUTPUTDESTINATION_SDI6: return kRegRP188InOut6DBB; // reg 64
846  case NTV2_OUTPUTDESTINATION_SDI7: return kRegRP188InOut7DBB; // reg 268
847  case NTV2_OUTPUTDESTINATION_SDI8: return kRegRP188InOut8DBB; // reg 273
848  default: return 0;
849  } // switch on output destination
850 
851 } // GetRP188RegisterForOutput
852 
853 
855 {
856  bool result (false);
857  const ULWord regNum (GetRP188RegisterForOutput(inOutputDest));
858  ULWord regValue(0);
859 
860  // Bit 23 of the RP188 DBB register will be set if output timecode is pulled
861  // directly from an SDI input (bypass source)...
862  if (regNum && mDevice.ReadRegister(regNum, regValue) && regValue & BIT(23))
863  result = true;
864 
865  return result;
866 
867 } // OutputDestHasRP188BypassEnabled
868 
869 
871 {
872  // Clear bit 23 of SDI output's RP188 DBB register...
873  const ULWord regNum (GetRP188RegisterForOutput(inOutputDest));
874  if (regNum)
875  mDevice.WriteRegister (regNum, 0, BIT(23), 23);
876 
877 } // DisableRP188Bypass
NTV2TestPatternGen::DrawTestPattern
virtual bool DrawTestPattern(const std::string &inTPName, const NTV2FormatDescriptor &inFormatDesc, NTV2Buffer &inBuffer)
Renders the given test pattern or color into a host raster buffer.
CNTV2Card::SubscribeOutputVerticalEvent
virtual bool SubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Causes me to be notified when an output vertical blanking interrupt is generated for the given output...
Definition: ntv2subscriptions.cpp:25
CNTV2Card::SetVANCMode
virtual bool SetVANCMode(const NTV2VANCMode inVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the VANC mode for the given FrameStore.
Definition: ntv2register.cpp:2640
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail2::end
end_tag end(T &&...)
CNTV2Card::SetMultiFormatMode
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
Definition: ntv2register.cpp:4379
GetSDIOutputInputXpt
NTV2InputXptID GetSDIOutputInputXpt(const NTV2Channel inSDIOutput, const bool inIsDS2=false)
Definition: ntv2signalrouter.cpp:942
DeviceCapabilities::CanDoVideoFormat
bool CanDoVideoFormat(const NTV2VideoFormat inVF)
Definition: ntv2devicecapabilities.h:251
NTV2_AUDIO_LOOPBACK_OFF
@ NTV2_AUDIO_LOOPBACK_OFF
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:1975
NTV2FormatDescriptor::GetVideoWriteSize
ULWord GetVideoWriteSize(ULWord inPageSize=4096UL) const
Definition: ntv2formatdescriptor.cpp:862
NTV2Player::RouteOutputSignal
virtual bool RouteOutputSignal(void)
Performs all widget/signal routing for playout.
Definition: ntv2player.cpp:400
CNTV2Card::GetAncRegionOffsetFromBottom
virtual bool GetAncRegionOffsetFromBottom(ULWord &outByteOffsetFromBottom, const NTV2AncillaryDataRegion inAncRegion=NTV2_AncRgn_All)
Answers with the byte offset to the start of an ancillary data region within a device frame buffer,...
Definition: ntv2dma.cpp:601
NTV2_TestPatt_CheckField
@ NTV2_TestPatt_CheckField
Definition: ntv2testpatterngen.h:34
kRegRP188InOut3DBB
@ kRegRP188InOut3DBB
Definition: ntv2publicinterface.h:391
ancillarydata_hdr_hlg.h
Declares the AJAAncillaryData_HDR_HLG class.
NTV2_REFERENCE_SFP1_PTP
@ NTV2_REFERENCE_SFP1_PTP
Specifies the PTP source on SFP 1.
Definition: ntv2enums.h:1413
NTV2_IS_VALID_TASK_MODE
#define NTV2_IS_VALID_TASK_MODE(__m__)
Definition: ntv2publicinterface.h:4296
NTV2OutputDestination
NTV2OutputDestination
Identifies a specific video output destination.
Definition: ntv2enums.h:1276
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or Frame Store 2 (or the 2nd item).
Definition: ntv2enums.h:1308
NTV2_VANCDATA_NORMAL
@ NTV2_VANCDATA_NORMAL
Definition: ntv2enums.h:3734
AJA_ThreadPriority_High
@ AJA_ThreadPriority_High
Definition: thread.h:44
NTV2ACFrameRange::firstFrame
UWord firstFrame(void) const
Definition: ntv2utils.h:975
CNTV2Card::SetVideoFormat
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.
Definition: ntv2register.cpp:204
AJATimeCodeBurn::RenderTimeCodeFont
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
Definition: timecodeburn.cpp:447
NTV2Player::StartConsumerThread
virtual void StartConsumerThread(void)
Starts my consumer thread.
Definition: ntv2player.cpp:495
NTV2_TestPatt_MultiBurst
@ NTV2_TestPatt_MultiBurst
Definition: ntv2testpatterngen.h:32
NTV2_AUDIO_BUFFER_BIG
@ NTV2_AUDIO_BUFFER_BIG
Definition: ntv2enums.h:1864
CNTV2MacDriverInterface::ReadRegister
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....
Definition: ntv2macdriverinterface.cpp:389
AJAAncDataType_Unknown
@ AJAAncDataType_Unknown
Includes data that is valid, but we don't recognize.
Definition: ancillarydata.h:46
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
IS_KNOWN_AJAAncDataType
#define IS_KNOWN_AJAAncDataType(_x_)
Definition: ancillarydata.h:65
NTV2FrameData
I encapsulate the video, audio and anc host buffers used in the AutoCirculate demos....
Definition: ntv2democommon.h:79
AUTOCIRCULATE_TRANSFER::SetAudioBuffer
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2716
CRP188::GetRP188Reg
bool GetRP188Reg(RP188_STRUCT &outRP188) const
Definition: ntv2rp188.cpp:1241
NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE
#define NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(__f__)
Definition: ntv2enums.h:1008
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1305
NTV2Buffer
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
Definition: ntv2publicinterface.h:5993
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:381
ntv2audiodefines.h
Declares common audio macros and structs used in the SDK.
AJA_STATUS_NOT_FOUND
@ AJA_STATUS_NOT_FOUND
Definition: types.h:402
NTV2Buffer::GetByteCount
ULWord GetByteCount(void) const
Definition: ntv2publicinterface.h:6066
NTV2Player::ProducerThreadStatic
static void ProducerThreadStatic(AJAThread *pThread, void *pContext)
This is the producer thread's static callback function that gets called when the producer thread star...
Definition: ntv2player.cpp:706
GetNTV2FrameRateFromVideoFormat
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3530
AJAThread::Attach
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
Definition: thread.cpp:169
gAudMaxSizeBytes
static const uint32_t gAudMaxSizeBytes(256 *1024)
The maximum number of bytes of 48KHz audio that can be transferred for a single frame....
NTV2_AUDIO_48K
@ NTV2_AUDIO_48K
Definition: ntv2enums.h:1875
NTV2Player
I play out SD or HD test pattern (with timecode) to an output of an AJA device with or without audio ...
Definition: ntv2player.h:24
AJATimeCodeBurn::BurnTimeCode
AJA_EXPORT bool BurnTimeCode(void *pBaseVideoAddress, const std::string &inTimeCodeStr, const uint32_t inYPercent)
Definition: timecodeburn.cpp:45
NTV2Buffer::Deallocate
bool Deallocate(void)
Deallocates my user-space storage (if I own it – i.e. from a prior call to Allocate).
Definition: ntv2publicinterface.cpp:1664
NTV2_OUTPUTDESTINATION_SDI2
@ NTV2_OUTPUTDESTINATION_SDI2
Definition: ntv2enums.h:1281
AJA_STATUS_BUSY
@ AJA_STATUS_BUSY
Definition: types.h:391
CNTV2DeviceScanner::GetFirstDeviceFromArgument
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...
Definition: ntv2devicescanner.cpp:366
gFrequencies
static const double gFrequencies[]
Definition: ntv2player.cpp:52
NTV2_OUTPUTDESTINATION_SDI3
@ NTV2_OUTPUTDESTINATION_SDI3
Definition: ntv2enums.h:1282
NTV2_FRAMERATE_INVALID
@ NTV2_FRAMERATE_INVALID
Definition: ntv2enums.h:425
NTV2_AUDIOSYSTEM_1
@ NTV2_AUDIOSYSTEM_1
This identifies the first Audio System.
Definition: ntv2enums.h:3816
AJACircularBuffer::StartConsumeNextBuffer
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function to ...
Definition: circularbuffer.h:153
NTV2ACFrameRange::count
UWord count(void) const
Definition: ntv2utils.h:974
ntv2testpatterngen.h
Declares the NTV2TestPatternGen class.
CNTV2Card::DisableChannel
virtual bool DisableChannel(const NTV2Channel inChannel)
Disables the given FrameStore.
Definition: ntv2register.cpp:2077
NTV2_TestPatt_ColorBars100
@ NTV2_TestPatt_ColorBars100
Definition: ntv2testpatterngen.h:28
CNTV2Card::ClearRouting
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device.
Definition: ntv2regroute.cpp:278
DEC0N
#define DEC0N(__x__, __n__)
Definition: ntv2publicinterface.h:5607
CNTV2MacDriverInterface::ReleaseStreamForApplication
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
Definition: ntv2macdriverinterface.cpp:516
NTV2_AncRgn_Field2
@ NTV2_AncRgn_Field2
Identifies the "normal" Field 2 ancillary data region.
Definition: ntv2enums.h:4146
kRegRP188InOut5DBB
@ kRegRP188InOut5DBB
Definition: ntv2publicinterface.h:479
AJA_STATUS_MEMORY
@ AJA_STATUS_MEMORY
Definition: types.h:397
AJACircularBuffer::EndProduceNextBuffer
void EndProduceNextBuffer(void)
The producer thread calls this function to signal that it has finished populating the frame it obtain...
Definition: circularbuffer.h:259
NTV2_IS_ATC_VITC2_TIMECODE_INDEX
#define NTV2_IS_ATC_VITC2_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3910
NTV2Buffer::Allocate
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...
Definition: ntv2publicinterface.cpp:1630
NTV2_IS_2K_1080_VIDEO_FORMAT
#define NTV2_IS_2K_1080_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:726
PlayerConfig::fDoMultiFormat
bool fDoMultiFormat
If true, enable device-sharing; otherwise take exclusive control of device.
Definition: ntv2democommon.h:323
NTV2InputXptID
enum NTV2InputCrosspointID NTV2InputXptID
NTV2Player::Init
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2player.cpp:111
TimecodeFormat
TimecodeFormat
Definition: ntv2rp188.h:27
NTV2_AUDIO_FORMAT_LPCM
@ NTV2_AUDIO_FORMAT_LPCM
Definition: ntv2enums.h:1898
CNTV2Card::SetAudioLoopBack
virtual bool SetAudioLoopBack(const NTV2AudioLoopBack inMode, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Enables or disables NTV2AudioLoopBack mode for the given NTV2AudioSystem.
Definition: ntv2audio.cpp:300
NTV2_CHANNEL1
@ NTV2_CHANNEL1
Specifies channel or Frame Store 1 (or the first item).
Definition: ntv2enums.h:1307
ntv2debug.h
CNTV2Card::SetFrameBufferFormat
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.
Definition: ntv2register.cpp:1812
NTV2FrameBufferFormatString
const char * NTV2FrameBufferFormatString(NTV2FrameBufferFormat fmt)
Definition: ntv2debug.cpp:201
CNTV2Card::SetSDITransmitEnable
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
Definition: ntv2register.cpp:3796
CNTV2Card::SetVANCShiftMode
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
Definition: ntv2register.cpp:2800
AUTOCIRCULATE_STATUS::CanAcceptMoreOutputFrames
bool CanAcceptMoreOutputFrames(void) const
Definition: ntv2publicinterface.h:7231
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail::void
j template void())
Definition: json.hpp:4893
NTV2FrameRate
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:396
AJAAncillaryData_HDR_HDR10
This class handles "5251" Frame Status Information packets.
Definition: ancillarydata_hdr_hdr10.h:21
NTV2FrameData::VideoBuffer
NTV2Buffer & VideoBuffer(void)
Definition: ntv2democommon.h:106
CNTV2Card::DMABufferLock
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.
Definition: ntv2dma.cpp:429
PlayerConfig::fTransmitHDRType
AJAAncDataType fTransmitHDRType
Specifies the HDR anc data packet to transmit, if any.
Definition: ntv2democommon.h:321
GetOutputDestInputXpt
NTV2InputXptID GetOutputDestInputXpt(const NTV2OutputDestination inOutputDest, const bool inIsSDI_DS2=false, const UWord inHDMI_Quadrant=99)
Definition: ntv2signalrouter.cpp:928
CNTV2Card::features
virtual class DeviceCapabilities & features(void)
Definition: ntv2card.h:141
AJAThread
Definition: thread.h:69
AUTOCIRCULATE_WITH_ANC
#define AUTOCIRCULATE_WITH_ANC
Use this to AutoCirculate with ancillary data.
Definition: ntv2publicinterface.h:5527
AJAThread::Active
virtual bool Active()
Definition: thread.cpp:116
CNTV2Card::DMABufferUnlockAll
virtual bool DMABufferUnlockAll()
Unlocks all previously-locked buffers used for DMA transfers.
Definition: ntv2dma.cpp:457
CNTV2Card::GetDisplayName
virtual std::string GetDisplayName(void)
Answers with this device's display name.
Definition: ntv2card.cpp:86
NTV2Player::StartProducerThread
virtual void StartProducerThread(void)
Starts my producer thread.
Definition: ntv2player.cpp:696
AJAStatus
AJAStatus
Definition: types.h:378
NTV2ChannelToOutputDestination
NTV2OutputDestination NTV2ChannelToOutputDestination(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its ordinary equivalent NTV2OutputDestination.
Definition: ntv2utils.cpp:5225
NTV2_RP188::fLo
ULWord fLo
| BG 4 | Secs10 | BG 3 | Secs 1 | BG 2 | Frms10 | BG 1 | Frms 1 |
Definition: ntv2publicinterface.h:6762
NTV2_OUTPUTDESTINATION_SDI1
@ NTV2_OUTPUTDESTINATION_SDI1
Definition: ntv2enums.h:1280
NTV2FormatDescriptor::numPixels
ULWord numPixels
Width – total number of pixels per line.
Definition: ntv2formatdescriptor.h:349
process.h
Declares the AJAProcess class.
PlayerConfig::fFrames
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
Definition: ntv2democommon.h:317
NTV2_RP188::fHi
ULWord fHi
| BG 8 | Hrs 10 | BG 7 | Hrs 1 | BG 6 | Mins10 | BG 5 | Mins 1 |
Definition: ntv2publicinterface.h:6763
AJATime::Sleep
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
Definition: systemtime.cpp:284
AJACircularBuffer::Add
AJAStatus Add(FrameDataPtr pInFrameData)
Appends a new frame buffer to me, increasing my frame storage capacity by one frame.
Definition: circularbuffer.h:92
TCNOTE
#define TCNOTE(_expr_)
Definition: ntv2player.cpp:28
NTV2Standard
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:153
NTV2_TestPatt_Ramp
@ NTV2_TestPatt_Ramp
Definition: ntv2testpatterngen.h:31
NTV2_VANCMODE_OFF
@ NTV2_VANCMODE_OFF
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3718
CNTV2Card::SetSDIOutputAudioSystem
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....
Definition: ntv2register.cpp:3949
CNTV2Card::GetNumberAudioChannels
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 ...
Definition: ntv2audio.cpp:180
AJATimeBase
Definition: timebase.h:18
kNumAudioChannelsMax
@ kNumAudioChannelsMax
Definition: ntv2audiodefines.h:44
AJA_STATUS_FEATURE
@ AJA_STATUS_FEATURE
Definition: types.h:393
AJA_STATUS_FAIL
@ AJA_STATUS_FAIL
Definition: types.h:382
ULWord
uint32_t ULWord
Definition: ajatypes.h:253
NTV2_TestPatt_FlatField
@ NTV2_TestPatt_FlatField
Definition: ntv2testpatterngen.h:35
kRegRP188InOut2DBB
@ kRegRP188InOut2DBB
Definition: ntv2publicinterface.h:167
CNTV2Card::GetDescription
virtual std::string GetDescription(void) const
Definition: ntv2card.cpp:124
NTV2FrameData::fVideoBuffer
NTV2Buffer fVideoBuffer
Host video buffer.
Definition: ntv2democommon.h:82
AUTOCIRCULATE_STATUS
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
Definition: ntv2publicinterface.h:7160
ntv2devicescanner.h
Declares the CNTV2DeviceScanner class.
AJAAncillaryData
I am the principal class that stores a single SMPTE-291 SDI ancillary data packet OR the digitized co...
Definition: ancillarydata.h:552
NTV2FrameData::VideoBufferSize
ULWord VideoBufferSize(void) const
Definition: ntv2democommon.h:107
NTV2FormatDescriptor::numLines
ULWord numLines
Height – total number of lines.
Definition: ntv2formatdescriptor.h:348
NTV2FormatDescriptor::GetTotalBytes
ULWord GetTotalBytes(void) const
Definition: ntv2formatdescriptor.cpp:851
AUTOCIRCULATE_TRANSFER::SetOutputTimeCodes
bool SetOutputTimeCodes(const NTV2TimeCodes &inValues)
Intended for playout, replaces the contents of my acOutputTimeCodes member.
Definition: ntv2publicinterface.cpp:2735
CNTV2DemoCommon::SetDefaultPageSize
static size_t SetDefaultPageSize(void)
Definition: ntv2democommon.cpp:1484
NTV2ChannelToTimecodeIndex
NTV2TCIndex NTV2ChannelToTimecodeIndex(const NTV2Channel inChannel, const bool inEmbeddedLTC=false, const bool inIsF2=false)
Converts the given NTV2Channel value into the equivalent NTV2TCIndex value.
Definition: ntv2utils.cpp:5020
NTV2Player::SetUpAudio
virtual AJAStatus SetUpAudio(void)
Performs all audio setup.
Definition: ntv2player.cpp:260
GetCSCOutputXptFromChannel
NTV2OutputXptID GetCSCOutputXptFromChannel(const NTV2Channel inCSC, const bool inIsKey=false, const bool inIsRGB=false)
Definition: ntv2signalrouter.cpp:819
NTV2Player::~NTV2Player
virtual ~NTV2Player(void)
Definition: ntv2player.cpp:79
AJAProcess::GetPid
static uint64_t GetPid()
Definition: process.cpp:35
NTV2_OUTPUTDESTINATION_SDI6
@ NTV2_OUTPUTDESTINATION_SDI6
Definition: ntv2enums.h:1285
sTotalAncFileBytes
static uint64_t sTotalAncFileBytes(0)
CNTV2Card::UnsubscribeOutputVerticalEvent
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.
Definition: ntv2subscriptions.cpp:61
NTV2Buffer::CopyFrom
bool CopyFrom(const void *pInSrcBuffer, const ULWord inByteCount)
Replaces my contents from the given memory buffer, resizing me to the new byte count.
Definition: ntv2publicinterface.cpp:1718
UWord
uint16_t UWord
Definition: ajatypes.h:251
PlayerConfig::fVideoFormat
NTV2VideoFormat fVideoFormat
The video format to use.
Definition: ntv2democommon.h:319
AJACircularBuffer::StartProduceNextBuffer
FrameDataPtr StartProduceNextBuffer(void)
The thread that's responsible for providing frames – the producer – calls this function to populate t...
Definition: circularbuffer.h:109
CNTV2Card::AutoCirculateGetStatus
virtual bool AutoCirculateGetStatus(const NTV2Channel inChannel, AUTOCIRCULATE_STATUS &outStatus)
Returns the current AutoCirculate status for the given channel.
Definition: ntv2autocirculate.cpp:646
NTV2_IS_PAL_VIDEO_FORMAT
#define NTV2_IS_PAL_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:696
NTV2FrameData::fNumAudioBytes
ULWord fNumAudioBytes
Actual number of captured audio bytes.
Definition: ntv2democommon.h:88
NTV2_REFERENCE_FREERUN
@ NTV2_REFERENCE_FREERUN
Specifies the device's internal clock.
Definition: ntv2enums.h:1404
AUTOCIRCULATE_TRANSFER
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
Definition: ntv2publicinterface.h:7969
PlayerConfig::fOutputChannel
NTV2Channel fOutputChannel
The device channel to use.
Definition: ntv2democommon.h:315
NTV2_OUTPUTDESTINATION_SDI8
@ NTV2_OUTPUTDESTINATION_SDI8
Definition: ntv2enums.h:1287
PlayerConfig::fAncDataFilePath
std::string fAncDataFilePath
Optional path to Anc binary data file to playout.
Definition: ntv2democommon.h:314
NTV2VideoFormatToString
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Definition: ntv2utils.cpp:6750
AJAAncillaryData_HDR_HLG
This class handles "5251" Frame Status Information packets.
Definition: ancillarydata_hdr_hlg.h:21
NTV2FrameData::AudioBuffer
NTV2Buffer & AudioBuffer(void)
Definition: ntv2democommon.h:109
NTV2_TestPatt_Black
@ NTV2_TestPatt_Black
Definition: ntv2testpatterngen.h:37
AUTOCIRCULATE_TRANSFER::SetVideoBuffer
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2708
GetCSCInputXptFromChannel
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
Definition: ntv2signalrouter.cpp:775
IsVideoFormatA
bool IsVideoFormatA(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5490
NTV2_TestPatt_ColorBars75
@ NTV2_TestPatt_ColorBars75
Definition: ntv2testpatterngen.h:30
NTV2Player::ConsumerThreadStatic
static void ConsumerThreadStatic(AJAThread *pThread, void *pContext)
This is the consumer thread's static callback function that gets called when the consumer thread star...
Definition: ntv2player.cpp:506
NTV2_TASK_MODE_INVALID
@ NTV2_TASK_MODE_INVALID
Definition: ntv2publicinterface.h:4293
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1284
BUFFER_PAGE_ALIGNED
static const bool BUFFER_PAGE_ALIGNED((!(0)))
kDemoAppSignature
static const ULWord kDemoAppSignature((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0))
AJACircularBuffer::EndConsumeNextBuffer
void EndConsumeNextBuffer(void)
The consumer thread calls this function to signal that it has finished processing the frame it obtain...
Definition: circularbuffer.h:266
AUTOCIRCULATE_TRANSFER::acANCField2Buffer
NTV2Buffer acANCField2Buffer
The host "Field 2" ancillary data buffer. This field is owned by the client application,...
Definition: ntv2publicinterface.h:8006
CRP188
Definition: ntv2rp188.h:55
AUTOCIRCULATE_STATUS::GetEndFrame
uint16_t GetEndFrame(void) const
Definition: ntv2publicinterface.h:7251
kRegRP188InOut1DBB
@ kRegRP188InOut1DBB
Definition: ntv2publicinterface.h:132
CNTV2Card::SetEveryFrameServices
virtual bool SetEveryFrameServices(const NTV2EveryFrameTaskMode inMode)
Sets the device's task mode.
Definition: ntv2register.cpp:179
NTV2StringList
std::vector< std::string > NTV2StringList
Definition: ntv2utils.h:1134
NTV2Player::ProduceFrames
virtual void ProduceFrames(void)
My producer thread that repeatedly produces video frames.
Definition: ntv2player.cpp:715
AJA_STATUS_UNSUPPORTED
@ AJA_STATUS_UNSUPPORTED
Definition: types.h:394
gAmplitudes
static const double gAmplitudes[]
Definition: ntv2player.cpp:54
PLDBG
#define PLDBG(_xpr_)
Definition: ntv2democommon.h:38
NTV2_INPUT_CROSSPOINT_INVALID
@ NTV2_INPUT_CROSSPOINT_INVALID
Definition: ntv2enums.h:2827
CNTV2Card::SetHDMIOutAudioRate
virtual bool SetHDMIOutAudioRate(const NTV2AudioRate inNewValue)
Sets the HDMI output's audio rate.
Definition: ntv2audio.cpp:972
AJAAncillaryData_HDR_SDR
This class handles "5251" Frame Status Information packets.
Definition: ancillarydata_hdr_sdr.h:21
NTV2_OUTPUT_DEST_IS_SDI
#define NTV2_OUTPUT_DEST_IS_SDI(_dest_)
Definition: ntv2enums.h:1294
AJA_NULL
#define AJA_NULL
Definition: ajatypes.h:197
AddAudioTone
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.
Definition: ntv2utils.cpp:4478
CNTV2DemoCommon::GetAJAFrameRate
static AJA_FrameRate GetAJAFrameRate(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:1011
NTV2TestPatternGen
The NTV2 test pattern generator.
Definition: ntv2testpatterngen.h:69
AJAAncDataType_HDR_SDR
@ AJAAncDataType_HDR_SDR
Definition: ancillarydata.h:57
NTV2_FORMAT_UNKNOWN
@ NTV2_FORMAT_UNKNOWN
Definition: ntv2enums.h:498
NTV2FrameData::fAudioBuffer
NTV2Buffer fAudioBuffer
Host audio buffer.
Definition: ntv2democommon.h:84
NTV2Player::DisableRP188Bypass
virtual void DisableRP188Bypass(const NTV2OutputDestination inOutputDest)
Disables the given SDI output's RP188 bypass.
Definition: ntv2player.cpp:870
file_io.h
Declares the AJAFileIO class.
CNTV2Card::Connect
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).
Definition: ntv2regroute.cpp:87
PlayerConfig::fTransmitLTC
bool fTransmitLTC
If true, embed LTC; otherwise embed VITC.
Definition: ntv2democommon.h:326
NTV2AudioRate
NTV2AudioRate
Definition: ntv2enums.h:1873
AJA_STATUS_INITIALIZE
@ AJA_STATUS_INITIALIZE
Definition: types.h:386
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5605
CNTV2Card::SetSDIOutputStandard
virtual bool SetSDIOutputStandard(const UWord inOutputSpigot, const NTV2Standard inValue)
Sets the SDI output spigot's video standard.
Definition: ntv2register.cpp:3200
NTV2_OUTPUTDESTINATION_HDMI
@ NTV2_OUTPUTDESTINATION_HDMI
Definition: ntv2enums.h:1279
false
#define false
Definition: ntv2devicefeatures.h:25
AUTOCIRCULATE_WITH_RP188
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
Definition: ntv2publicinterface.h:5521
AJAFileIO::FileExists
static bool FileExists(const std::wstring &fileName)
Definition: file_io.cpp:97
NTV2TCIndexesConstIter
NTV2TCIndexes::const_iterator NTV2TCIndexesConstIter
Definition: ntv2publicinterface.h:6850
NTV2ACFrameRange::lastFrame
UWord lastFrame(void) const
Definition: ntv2utils.h:976
ancillarydata_hdr_hdr10.h
Declares the AJAAncillaryData_HDR_HDR10 class.
GetFrameBufferOutputXptFromChannel
NTV2OutputXptID GetFrameBufferOutputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsRGB=false, const bool inIs425=false)
Definition: ntv2signalrouter.cpp:845
NTV2Player::OutputDestHasRP188BypassEnabled
virtual bool OutputDestHasRP188BypassEnabled(const NTV2OutputDestination inOutputDest)
Definition: ntv2player.cpp:854
PlayerConfig::fDeviceSpec
std::string fDeviceSpec
The AJA device to use.
Definition: ntv2democommon.h:313
kRegRP188InOut4DBB
@ kRegRP188InOut4DBB
Definition: ntv2publicinterface.h:396
NTV2Player::SetUpTestPatternBuffers
virtual AJAStatus SetUpTestPatternBuffers(void)
Creates my test pattern buffers.
Definition: ntv2player.cpp:349
TCDBG
#define TCDBG(_expr_)
Definition: ntv2player.cpp:30
AJA_STATUS_BAD_PARAM
@ AJA_STATUS_BAD_PARAM
Definition: types.h:392
CNTV2Card::WaitForOutputVerticalInterrupt
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 ...
Definition: ntv2subscriptions.cpp:134
std
Definition: json.hpp:5362
NTV2Player::AddTone
virtual uint32_t AddTone(NTV2FrameData &inFrameData)
Inserts audio tone (based on my current tone frequency) into the given NTV2FrameData's audio buffer.
Definition: ntv2player.cpp:794
NTV2_RP188
This struct replaces the old RP188_STRUCT.
Definition: ntv2publicinterface.h:6760
gNumFrequencies
static const ULWord gNumFrequencies(sizeof(gFrequencies)/sizeof(double))
GetRP188RegisterForOutput
ULWord GetRP188RegisterForOutput(const NTV2OutputDestination inOutputDest)
Definition: ntv2player.cpp:836
IsRGBFormat
bool IsRGBFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5442
CNTV2Card::AutoCirculateTransfer
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 ...
Definition: ntv2autocirculate.cpp:695
gAncMaxSizeBytes
static ULWord gAncMaxSizeBytes(NTV2_ANCSIZE_MAX)
The maximum number of bytes of ancillary data that can be transferred for a single field....
GetAudioSamplesPerFrame
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,...
Definition: ntv2utils.cpp:2789
AUTOCIRCULATE_STATUS::GetStartFrame
uint16_t GetStartFrame(void) const
Definition: ntv2publicinterface.h:7246
CNTV2Card::AutoCirculateInitForOutput
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...
Definition: ntv2autocirculate.cpp:353
ntv2player.h
CIRCULAR_BUFFER_SIZE
static const size_t CIRCULAR_BUFFER_SIZE(10)
Number of NTV2FrameData's in our ring.
CNTV2MacDriverInterface::AcquireStreamForApplication
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 ...
Definition: ntv2macdriverinterface.cpp:481
AJAAncillaryData::GenerateTransmitData
virtual AJAStatus GenerateTransmitData(uint8_t *pBuffer, const size_t inMaxBytes, uint32_t &outPacketSize)
Generates "raw" ancillary data from my internal ancillary data (playback) – see SDI Anc Buffer Data F...
Definition: ancillarydata.cpp:767
CNTV2Card::SetSDIOutputDS2AudioSystem
virtual bool SetSDIOutputDS2AudioSystem(const NTV2Channel inSDIOutputConnector, const NTV2AudioSystem inAudioSystem)
Sets the Audio System that will supply audio for the given SDI output's audio embedder for Data Strea...
Definition: ntv2register.cpp:4006
NTV2Player::NTV2Player
NTV2Player(const PlayerConfig &inConfig)
Constructs me using the given configuration settings.
Definition: ntv2player.cpp:58
NTV2_AudioChannel1_8
@ NTV2_AudioChannel1_8
This selects audio channels 1 thru 8.
Definition: ntv2enums.h:3247
NTV2Player::ConsumeFrames
virtual void ConsumeFrames(void)
My consumer thread that repeatedly plays frames using AutoCirculate (until quit).
Definition: ntv2player.cpp:520
NTV2_OUTPUTDESTINATION_SDI7
@ NTV2_OUTPUTDESTINATION_SDI7
Definition: ntv2enums.h:1286
NTV2Player::Quit
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2player.cpp:88
CNTV2Card::GetEveryFrameServices
virtual bool GetEveryFrameServices(NTV2EveryFrameTaskMode &outMode)
Retrieves the device's current "retail service" task mode.
Definition: ntv2register.cpp:184
CNTV2Card::GetAudioRate
virtual bool GetAudioRate(NTV2AudioRate &outRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Returns the current NTV2AudioRate for the given Audio System.
Definition: ntv2audio.cpp:226
CNTV2Card::GetFrameRate
virtual bool GetFrameRate(NTV2FrameRate &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the AJA device's currently configured frame rate via its "value" parameter.
Definition: ntv2register.cpp:1022
NTV2_OUTPUTDESTINATION_SDI4
@ NTV2_OUTPUTDESTINATION_SDI4
Definition: ntv2enums.h:1283
AJAAncDataType_HDR_HLG
@ AJAAncDataType_HDR_HLG
Definition: ancillarydata.h:59
CNTV2Card::DMAWriteFrame
virtual bool DMAWriteFrame(const ULWord inFrameNumber, const ULWord *pInFrameBuffer, const ULWord inByteCount)
Transfers a single frame from the host to the AJA device.
Definition: ntv2dma.cpp:65
GetAudioSamplesPerSecond
double GetAudioSamplesPerSecond(const NTV2AudioRate inAudioRate)
Returns the audio sample rate as a number of audio samples per second.
Definition: ntv2utils.cpp:3203
NTV2Player::SetUpHostBuffers
virtual AJAStatus SetUpHostBuffers(void)
Sets up my host video & audio buffers.
Definition: ntv2player.cpp:304
AJACircularBuffer::SetAbortFlag
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...
Definition: circularbuffer.h:51
NTV2_TestPatt_MultiPattern
@ NTV2_TestPatt_MultiPattern
Definition: ntv2testpatterngen.h:36
PlayerConfig
Configures an NTV2Player instance.
Definition: ntv2democommon.h:310
PlayerConfig::fDoABConversion
bool fDoABConversion
If true, do level-A/B conversion; otherwise don't.
Definition: ntv2democommon.h:327
CNTV2Card::SetHDMIOutAudioSource8Channel
virtual bool SetHDMIOutAudioSource8Channel(const NTV2Audio8ChannelSelect inNewValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Changes the HDMI output's 8-channel audio source.
Definition: ntv2audio.cpp:914
GetNTV2StandardFromVideoFormat
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2277
PlayerConfig::fPixelFormat
NTV2PixelFormat fPixelFormat
The pixel format to use.
Definition: ntv2democommon.h:318
NTV2OutputXptID
enum NTV2OutputCrosspointID NTV2OutputXptID
NTV2Buffer::Fill
bool Fill(const T &inValue)
Fills me with the given scalar value.
Definition: ntv2publicinterface.h:6218
AJAThread::SetPriority
virtual AJAStatus SetPriority(AJAThreadPriority priority)
Definition: thread.cpp:133
CNTV2Card::AutoCirculateStart
virtual bool AutoCirculateStart(const NTV2Channel inChannel, const ULWord64 inStartTime=0)
Starts AutoCirculating the specified channel that was previously initialized by CNTV2Card::AutoCircul...
Definition: ntv2autocirculate.cpp:503
NTV2TestPatternGen::getTestPatternNames
static NTV2TestPatternNames getTestPatternNames(void)
Definition: ntv2testpatterngen.cpp:2542
CNTV2Card::SetReference
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...
Definition: ntv2register.cpp:1484
sCurrentAncFileBytes
static uint64_t sCurrentAncFileBytes(0)
PLNOTE
#define PLNOTE(_xpr_)
Definition: ntv2democommon.h:36
NTV2Player::Run
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2player.cpp:481
AJA_STATUS_OPEN
@ AJA_STATUS_OPEN
Definition: types.h:388
AJATimeBase::FramesToSeconds
double FramesToSeconds(int64_t frames) const
Definition: timebase.cpp:197
CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:989
kRegRP188InOut7DBB
@ kRegRP188InOut7DBB
Definition: ntv2publicinterface.h:585
CNTV2Card::SetNumberAudioChannels
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...
Definition: ntv2audio.cpp:146
NTV2_TestPatt_LineSweep
@ NTV2_TestPatt_LineSweep
Definition: ntv2testpatterngen.h:33
CNTV2Card::SetAudioBufferSize
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.
Definition: ntv2audio.cpp:249
ancillarydata_hdr_sdr.h
Declares the AJAAncillaryData_HDR_SDR class.
AJAThread::Start
virtual AJAStatus Start()
Definition: thread.cpp:91
NTV2Player::SetUpVideo
virtual AJAStatus SetUpVideo(void)
Performs all video setup.
Definition: ntv2player.cpp:192
PLFAIL
#define PLFAIL(_xpr_)
Definition: ntv2democommon.h:34
CNTV2DemoCommon::GetAJAPixelFormat
static AJA_PixelFormat GetAJAPixelFormat(const NTV2FrameBufferFormat inFormat)
Definition: ntv2democommon.cpp:1043
BIT
#define BIT(_x_)
Definition: ajatypes.h:561
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5604
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition: types.h:371
NTV2_AUDIO_RATE_INVALID
@ NTV2_AUDIO_RATE_INVALID
Definition: ntv2enums.h:1879
CNTV2Card::EnableChannel
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.
Definition: ntv2register.cpp:2097
DeviceCapabilities::CanDoFrameBufferFormat
bool CanDoFrameBufferFormat(const NTV2PixelFormat inPF)
Definition: ntv2devicecapabilities.h:223
CNTV2Card::SetHDMIOutAudioFormat
virtual bool SetHDMIOutAudioFormat(const NTV2AudioFormat inNewValue)
Sets the HDMI output's audio format.
Definition: ntv2audio.cpp:984
NTV2ChannelToAudioSystem
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
Definition: ntv2utils.cpp:4927
AUTOCIRCULATE_TRANSFER::acANCBuffer
NTV2Buffer acANCBuffer
The host ancillary data buffer. This field is owned by the client application, and thus is responsibl...
Definition: ntv2publicinterface.h:7995
NTV2_OUTPUTDESTINATION_ANALOG
@ NTV2_OUTPUTDESTINATION_ANALOG
Definition: ntv2enums.h:1278
CNTV2MacDriverInterface::WriteRegister
virtual bool WriteRegister(const ULWord inRegNum, const ULWord inValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Updates or replaces all or part of the 32-bit contents of a specific register (real or virtual) on th...
Definition: ntv2macdriverinterface.cpp:430
NTV2FormatDescriptor::IsValid
bool IsValid(void) const
Definition: ntv2formatdescriptor.h:94
PLINFO
#define PLINFO(_xpr_)
Definition: ntv2democommon.h:37
CNTV2Card::AutoCirculateStop
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...
Definition: ntv2autocirculate.cpp:519
NTV2_ANCSIZE_MAX
#define NTV2_ANCSIZE_MAX
Definition: ntv2democommon.h:47
PLWARN
#define PLWARN(_xpr_)
Definition: ntv2democommon.h:35
NTV2Player::GetACStatus
virtual void GetACStatus(AUTOCIRCULATE_STATUS &outStatus)
Provides status information about my output (playout) process.
Definition: ntv2player.cpp:830
CNTV2Card::SetSDIOutLevelAtoLevelBConversion
virtual bool SetSDIOutLevelAtoLevelBConversion(const UWord inOutputSpigot, const bool inEnable)
Enables or disables 3G level A to 3G level B conversion at the SDI output widget (assuming the AJA de...
Definition: ntv2register.cpp:4315
NTV2_OUTPUTDESTINATION_SDI5
@ NTV2_OUTPUTDESTINATION_SDI5
Definition: ntv2enums.h:1284
CRP188::GetRP188Str
bool GetRP188Str(std::string &sRP188) const
Definition: ntv2rp188.cpp:918
NTV2_OEM_TASKS
@ NTV2_OEM_TASKS
2: OEM: Device is configured by controlling application(s), with minimal driver involvement.
Definition: ntv2publicinterface.h:4292
kRegRP188InOut6DBB
@ kRegRP188InOut6DBB
Definition: ntv2publicinterface.h:575
AJAAncDataType_HDR_HDR10
@ AJAAncDataType_HDR_HDR10
Definition: ancillarydata.h:58
NTV2FrameData::fTimecodes
NTV2TimeCodes fTimecodes
Map of TC indexes to NTV2_RP188 values.
Definition: ntv2democommon.h:87
CNTV2Card::SetAudioRate
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
Definition: ntv2audio.cpp:205
kRegRP188InOut8DBB
@ kRegRP188InOut8DBB
Definition: ntv2publicinterface.h:595
NTV2_AUDIOSYSTEM_INVALID
@ NTV2_AUDIOSYSTEM_INVALID
Definition: ntv2enums.h:3826
timebase.h
Declares the AJATimeBase class.