AJA NTV2 SDK  17.5.0.1492
NTV2 SDK 17.5.0.1492
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  // If we own the whole device, make sure all FrameStores are disabled (good practice)
226  if (!mConfig.fDoMultiFormat)
227  {
228  NTV2ChannelSet enabledChannels;
229  mDevice.GetEnabledChannels(enabledChannels);
230  mDevice.DisableChannels(enabledChannels);
231  }
232 
233  // Turn on the FrameStore (to read frame buffer memory and transmit video)...
234  mDevice.EnableChannel(mConfig.fOutputChannel);
235 
236  // This demo assumes VANC is disabled...
237  mDevice.SetVANCMode(NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
239 
240  // Set the FrameStore video format...
241  mDevice.SetVideoFormat (mConfig.fVideoFormat, false, false, mConfig.fOutputChannel);
242 
243  // Set the frame buffer pixel format for the device FrameStore...
244  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mConfig.fPixelFormat);
245 
246  // The output interrupt is Enabled by default, but on some platforms, you must subscribe to it
247  // in order to be able to wait on its event/semaphore...
249 
250  // Check if HDR anc is permissible...
251  if (IS_KNOWN_AJAAncDataType(mConfig.fTransmitHDRType) && !mDevice.features().CanDoCustomAnc())
252  {cerr << "## WARNING: HDR Anc requested, but device can't do custom anc" << endl;
254 
255  // Get current per-field maximum Anc buffer size...
258 
259  // Set output clock reference...
260  mDevice.SetReference(mDevice.features().CanDo2110() ? NTV2_REFERENCE_SFP1_PTP : NTV2_REFERENCE_FREERUN);
261 
262  // At this point, video setup is complete (except for widget signal routing).
263  return AJA_STATUS_SUCCESS;
264 
265 } // SetUpVideo
266 
267 
269 {
270  uint16_t numAudioChannels (mDevice.features().GetMaxAudioChannels());
271 
272  // If there are 2048 pixels on a line instead of 1920, reduce the number of audio channels
273  // This is because HANC is narrower, and has space for only 8 channels
274  if (NTV2_IS_2K_1080_VIDEO_FORMAT(mConfig.fVideoFormat) && numAudioChannels > 8)
275  numAudioChannels = 8;
276 
277  mAudioSystem = NTV2_AUDIOSYSTEM_1; // Use NTV2_AUDIOSYSTEM_1...
278  if (mDevice.features().GetNumAudioSystems() > 1) // ...but if the device has more than one audio system...
279  mAudioSystem = ::NTV2ChannelToAudioSystem(mConfig.fOutputChannel); // ...base it on the channel
280  // However, there are a few older devices that have only 1 audio system,
281  // yet 2 frame stores (or must use channel 2 for playout)...
282  if (!mDevice.features().CanDoFrameStore1Display())
283  mAudioSystem = NTV2_AUDIOSYSTEM_1;
284 
285  mDevice.SetNumberAudioChannels (numAudioChannels, mAudioSystem);
286  mDevice.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
287 
288  // How big should the on-device audio buffer be? 1MB? 2MB? 4MB? 8MB?
289  // For this demo, 4MB will work best across all platforms (Windows, Mac & Linux)...
290  mDevice.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
291 
292  // Set the SDI output audio embedders to embed audio samples from the output of mAudioSystem...
293  mDevice.SetSDIOutputAudioSystem (mConfig.fOutputChannel, mAudioSystem);
294  mDevice.SetSDIOutputDS2AudioSystem (mConfig.fOutputChannel, mAudioSystem);
295 
296  // If the last app using the device left it in E-E mode (input passthru), then loopback
297  // must be disabled --- otherwise the output audio will be pass-thru SDI input audio...
298  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, mAudioSystem);
299 
300  if (!mConfig.fDoMultiFormat && mDevice.features().GetNumHDMIVideoOutputs())
301  {
305  }
306 
307  return AJA_STATUS_SUCCESS;
308 
309 } // SetUpAudio
310 
311 
313 {
314  CNTV2DemoCommon::SetDefaultPageSize(); // Set host-specific page size
315 
316  // Let my circular buffer know when it's time to quit...
317  mFrameDataRing.SetAbortFlag (&mGlobalQuit);
318 
319  // Allocate and add each in-host NTV2FrameData to my circular buffer member variable...
320  mHostBuffers.reserve(CIRCULAR_BUFFER_SIZE);
321  while (mHostBuffers.size() < CIRCULAR_BUFFER_SIZE)
322  {
323  mHostBuffers.push_back(NTV2FrameData()); // Make a new NTV2FrameData...
324  NTV2FrameData & frameData(mHostBuffers.back()); // ...and get a reference to it
325 
326  // Allocate a page-aligned video buffer
327  if (mConfig.WithVideo())
328  if (!frameData.fVideoBuffer.Allocate (mFormatDesc.GetTotalBytes(), BUFFER_PAGE_ALIGNED))
329  {
330  PLFAIL("Failed to allocate " << xHEX0N(mFormatDesc.GetTotalBytes(),8) << "-byte video buffer");
331  return AJA_STATUS_MEMORY;
332  }
333  #ifdef NTV2_BUFFER_LOCKING
334  if (frameData.fVideoBuffer)
335  mDevice.DMABufferLock(frameData.fVideoBuffer, true);
336  #endif
337 
338  // Allocate a page-aligned audio buffer (if transmitting audio)
339  if (mConfig.WithAudio())
341  {
342  PLFAIL("Failed to allocate " << xHEX0N(gAudMaxSizeBytes,8) << "-byte audio buffer");
343  return AJA_STATUS_MEMORY;
344  }
345  #ifdef NTV2_BUFFER_LOCKING
346  if (frameData.fAudioBuffer)
347  mDevice.DMABufferLock(frameData.fAudioBuffer, /*alsoPreLockSGL*/true);
348  #endif
349  mFrameDataRing.Add (&frameData);
350  } // for each NTV2FrameData
351 
352  return AJA_STATUS_SUCCESS;
353 
354 } // SetUpHostBuffers
355 
356 
358 {
359  vector<NTV2TestPatternSelect> testPatIDs;
360  testPatIDs.push_back(NTV2_TestPatt_ColorBars100);
361  testPatIDs.push_back(NTV2_TestPatt_ColorBars75);
362  testPatIDs.push_back(NTV2_TestPatt_Ramp);
363  testPatIDs.push_back(NTV2_TestPatt_MultiBurst);
364  testPatIDs.push_back(NTV2_TestPatt_LineSweep);
365  testPatIDs.push_back(NTV2_TestPatt_CheckField);
366  testPatIDs.push_back(NTV2_TestPatt_FlatField);
367  testPatIDs.push_back(NTV2_TestPatt_MultiPattern);
368 
369  mTestPatRasters.clear();
370  for (size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
371  mTestPatRasters.push_back(NTV2Buffer());
372 
373  if (!mFormatDesc.IsValid())
374  {PLFAIL("Bad format descriptor"); return AJA_STATUS_FAIL;}
375  if (mFormatDesc.IsVANC())
376  {PLFAIL("VANC should have been disabled: " << mFormatDesc); return AJA_STATUS_FAIL;}
377 
378  // Set up one video buffer for each test pattern...
379  for (size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
380  {
381  // Allocate the buffer memory...
382  if (!mTestPatRasters.at(tpNdx).Allocate (mFormatDesc.GetTotalBytes(), BUFFER_PAGE_ALIGNED))
383  { PLFAIL("Test pattern buffer " << DEC(tpNdx+1) << " of " << DEC(testPatIDs.size()) << ": "
384  << xHEX0N(mFormatDesc.GetTotalBytes(),8) << "-byte page-aligned alloc failed");
385  return AJA_STATUS_MEMORY;
386  }
387 
388  // Fill the buffer with test pattern...
389  NTV2TestPatternGen testPatternGen;
390  if (!testPatternGen.DrawTestPattern (testPatIDs.at(tpNdx), mFormatDesc, mTestPatRasters.at(tpNdx)))
391  {
392  cerr << "## ERROR: DrawTestPattern " << DEC(tpNdx) << " failed: " << mFormatDesc << endl;
393  return AJA_STATUS_FAIL;
394  }
395 
396  #ifdef NTV2_BUFFER_LOCKING
397  // Try to prelock the memory, including its scatter-gather list...
398  if (!mDevice.DMABufferLock(mTestPatRasters.at(tpNdx), /*alsoLockSegmentMap=*/true))
399  PLWARN("Test pattern buffer " << DEC(tpNdx+1) << " of " << DEC(testPatIDs.size()) << ": failed to pre-lock");
400  #endif
401  } // loop for each predefined pattern
402 
403  return AJA_STATUS_SUCCESS;
404 
405 } // SetUpTestPatternBuffers
406 
407 
409 {
410  const NTV2Standard outputStandard (::GetNTV2StandardFromVideoFormat(mConfig.fVideoFormat));
411  const bool isRGB (::IsRGBFormat(mConfig.fPixelFormat));
412  const bool canVerify (mDevice.features().HasCrosspointConnectROM());
413  UWord connectFailures (0);
414 
415  // Since this function figures out which SDI spigots will be set up for output,
416  // it also sets the "mTCIndexes" member, which determines which timecodes will
417  // be transmitted (and on which SDI spigots)...
418  mTCIndexes.clear();
419 
420  const NTV2OutputXptID cscVidOutXpt(::GetCSCOutputXptFromChannel(mConfig.fOutputChannel, false/*isKey*/, !isRGB/*isRGB*/));
421  const NTV2OutputXptID fsVidOutXpt (::GetFrameBufferOutputXptFromChannel(mConfig.fOutputChannel, isRGB/*isRGB*/, false/*is425*/));
422  const NTV2InputXptID cscInputXpt (isRGB ? ::GetCSCInputXptFromChannel(mConfig.fOutputChannel, false/*isKeyInput*/) : NTV2_INPUT_CROSSPOINT_INVALID);
423 
424  if (!mConfig.fDoMultiFormat) // Not multiformat: We own the whole device...
425  {
426  mDevice.ClearRouting(); // Start with clean slate
427  }
428 
429  if (isRGB)
430  if (!mDevice.Connect (cscInputXpt, fsVidOutXpt, canVerify))
431  connectFailures++;
432 
433  if (mDevice.features().HasBiDirectionalSDI())
434  mDevice.SetSDITransmitEnable(mConfig.fOutputChannel, true);
435 
436  if (!mDevice.Connect (::GetSDIOutputInputXpt (mConfig.fOutputChannel, false/*isDS2*/), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
437  connectFailures++;
438 
439  mDevice.SetSDIOutputStandard (mConfig.fOutputChannel, outputStandard);
440 
441  mTCIndexes.insert (::NTV2ChannelToTimecodeIndex(mConfig.fOutputChannel, /*inEmbeddedLTC=*/mConfig.fTransmitLTC));
442  // NOTE: No need to send VITC2 with VITC1 (for "i" formats) -- firmware does this automatically
443 
444  if (!mConfig.fDoMultiFormat) // Not multiformat: We own the whole device...
445  {
446  // Also connect analog video output, if the device has one...
447  if (mDevice.features().GetNumAnalogVideoOutputs() && mConfig.fOutputChannel == NTV2_CHANNEL1)
448  if (!mDevice.Connect (::GetOutputDestInputXpt(NTV2_OUTPUTDESTINATION_ANALOG1), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
449  connectFailures++;
450 
451  // Also connect HDMI video output, if the device has one...
452  if (mDevice.features().GetNumHDMIVideoOutputs() && mConfig.fOutputChannel == NTV2_CHANNEL1)
453  {
454  if (!mDevice.Connect (::GetOutputDestInputXpt(NTV2_OUTPUTDESTINATION_HDMI1), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
455  connectFailures++;
456  }
457  }
458  TCNOTE(mTCIndexes);
459  if (connectFailures)
460  PLWARN(DEC(connectFailures) << " 'Connect' call(s) failed");
461  return connectFailures == 0;
462 
463 } // RouteOutputSignal
464 
465 
467 {
468  // Start my consumer and producer threads...
471  return AJA_STATUS_SUCCESS;
472 
473 } // Run
474 
475 
476 
478 // This is where the play thread starts
479 
481 {
482  // Create and start the playout thread...
483  mConsumerThread.Attach (ConsumerThreadStatic, this);
484  mConsumerThread.SetPriority(AJA_ThreadPriority_High);
485  mConsumerThread.Start();
486 
487 } // StartConsumerThread
488 
489 
490 // The playout thread function
491 void NTV2Player::ConsumerThreadStatic (AJAThread * pThread, void * pContext) // static
492 { (void) pThread;
493  // Grab the NTV2Player instance pointer from the pContext parameter,
494  // then call its ConsumeFrames method...
495  NTV2Player * pApp (reinterpret_cast<NTV2Player*>(pContext));
496  if (pApp)
497  pApp->ConsumeFrames();
498 
499 } // ConsumerThreadStatic
500 
501 
502 static uint64_t sTotalAncFileBytes(0), sCurrentAncFileBytes(0);
503 
504 
506 {
507  ULWord acOptions (AUTOCIRCULATE_WITH_RP188);
508  AUTOCIRCULATE_TRANSFER outputXfer;
509  AUTOCIRCULATE_STATUS outputStatus;
510  AJAAncillaryData * pPkt (AJA_NULL);
511  ULWord goodXfers(0), badXfers(0), starves(0), noRoomWaits(0);
512  ifstream * pAncStrm (AJA_NULL);
513 
514  // Stop AutoCirculate, just in case someone else left it running...
515  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
516  mDevice.WaitForOutputVerticalInterrupt(mConfig.fOutputChannel, 4); // Let it stop
517  PLNOTE("Thread started");
518 
520  { // HDR anc doesn't change per-frame, so fill outputXfer.acANCBuffer with the packet data...
521  static AJAAncillaryData_HDR_SDR sdrPkt;
522  static AJAAncillaryData_HDR_HDR10 hdr10Pkt;
523  static AJAAncillaryData_HDR_HLG hlgPkt;
524 
525  switch (mConfig.fTransmitHDRType)
526  {
527  case AJAAncDataType_HDR_SDR: pPkt = &sdrPkt; break;
528  case AJAAncDataType_HDR_HDR10: pPkt = &hdr10Pkt; break;
529  case AJAAncDataType_HDR_HLG: pPkt = &hlgPkt; break;
530  default: break;
531  }
532  }
533  if (pPkt)
534  { // Allocate page-aligned host Anc buffer...
535  uint32_t hdrPktSize (0);
536  if (!outputXfer.acANCBuffer.Allocate(gAncMaxSizeBytes, BUFFER_PAGE_ALIGNED) || !outputXfer.acANCBuffer.Fill(0LL))
537  PLWARN("Anc buffer " << xHEX0N(gAncMaxSizeBytes,8) << "(" << DEC(gAncMaxSizeBytes) << ")-byte allocate failed -- HDR anc insertion disabled");
538  else if (AJA_FAILURE(pPkt->GenerateTransmitData (outputXfer.acANCBuffer, outputXfer.acANCBuffer, hdrPktSize)))
539  {
540  PLWARN("HDR anc insertion disabled -- GenerateTransmitData failed");
541  outputXfer.acANCBuffer.Deallocate();
542  }
543  else
544  acOptions |= AUTOCIRCULATE_WITH_ANC;
545  }
546  else if (!mConfig.fAncDataFilePath.empty())
547  { // Open raw anc file for reading...
548  pAncStrm = new ifstream(mConfig.fAncDataFilePath.c_str(), ios::binary);
549  do
550  {
551  if (!pAncStrm->good())
552  { PLFAIL("Cannot open anc file '" << mConfig.fAncDataFilePath << "' -- anc insertion disabled");
553  delete pAncStrm; pAncStrm = AJA_NULL;
554  break;
555  }
556  pAncStrm->seekg(0, std::ios_base::end);
557  if (pAncStrm->tellg() == -1)
558  { PLFAIL("Cannot determine anc file size -- anc insertion disabled");
559  delete pAncStrm; pAncStrm = AJA_NULL;
560  break;
561  }
562  sTotalAncFileBytes = uint64_t(pAncStrm->tellg());
563  pAncStrm->seekg(0); // Rewind to start
565  { PLFAIL("anc buffer size " << DEC(gAncMaxSizeBytes*2) << " exceeds anc file size " << DEC(sTotalAncFileBytes)
566  << " -- anc insertion disabled");
567  delete pAncStrm; pAncStrm = AJA_NULL;
568  break;
569  }
570  // Allocate anc buffers...
571  bool ancOK = outputXfer.acANCBuffer.Allocate(gAncMaxSizeBytes, BUFFER_PAGE_ALIGNED);
574  if (!ancOK)
575  {
576  PLFAIL("Anc buffer " << xHEX0N(gAncMaxSizeBytes,8) << "(" << DEC(gAncMaxSizeBytes) << ")-byte"
577  " allocation failed -- anc insertion disabled");
578  outputXfer.acANCBuffer.Deallocate();
579  outputXfer.acANCField2Buffer.Deallocate();
580  delete pAncStrm;
581  pAncStrm = AJA_NULL;
582  break;
583  }
584  acOptions |= AUTOCIRCULATE_WITH_ANC;
585  break; // Good to go!
586  } while (false); // Once thru
587  }
588 #ifdef NTV2_BUFFER_LOCKING
589  if (outputXferInfo.acANCBuffer)
590  mDevice.DMABufferLock(outputXfer.acANCBuffer, /*alsoLockSGL*/true);
591  if (outputXferInfo.acANCField2Buffer)
592  mDevice.DMABufferLock(outputXfer.acANCField2Buffer, /*alsoLockSGL*/true);
593 #endif
594 
595  // Initialize & start AutoCirculate...
596  bool initOK = mDevice.AutoCirculateInitForOutput (mConfig.fOutputChannel, mConfig.fFrames.count(), mAudioSystem, acOptions,
597  1 /*numChannels*/, mConfig.fFrames.firstFrame(), mConfig.fFrames.lastFrame());
598  if (!initOK)
599  {PLFAIL("AutoCirculateInitForOutput failed"); mGlobalQuit = true;}
600  else if (!mConfig.WithVideo())
601  { // Video suppressed --
602  // Clear device frame buffers being AutoCirculated (prevent garbage output frames)
603  NTV2Buffer tmpFrame (mFormatDesc.GetVideoWriteSize());
604  NTV2TestPatternGen blackPatternGen;
605  blackPatternGen.DrawTestPattern (NTV2_TestPatt_Black, mFormatDesc, tmpFrame);
606  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
607  for (uint16_t frmNum(outputStatus.GetStartFrame()); frmNum <= outputStatus.GetEndFrame(); frmNum++)
608  mDevice.DMAWriteFrame(ULWord(frmNum), tmpFrame, mFormatDesc.GetTotalBytes());
609  } // else if --novideo
610 
611  while (!mGlobalQuit)
612  {
613  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
614 
615  // Check if there's room for another frame on the card...
616  if (outputStatus.CanAcceptMoreOutputFrames())
617  {
618  // Device has at least one free frame buffer that can be filled.
619  // Wait for the next frame in our ring to become ready to "consume"...
620  NTV2FrameData * pFrameData (mFrameDataRing.StartConsumeNextBuffer());
621  if (!pFrameData)
622  {starves++; continue;}
623 
624  outputXfer.SetOutputTimeCodes(pFrameData->fTimecodes);
625 
626  if (pFrameData->VideoBuffer()) // Transfer the timecode-burned frame to the device for playout...
627  outputXfer.SetVideoBuffer (pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
628  if (pFrameData->AudioBuffer()) // If also playing audio...
629  outputXfer.SetAudioBuffer (pFrameData->AudioBuffer(), pFrameData->fNumAudioBytes);
630 
631  if (pAncStrm && pAncStrm->good() && outputXfer.acANCBuffer)
632  { // Read pre-recorded anc from binary data file, and inject it into this frame...
633  pAncStrm->read(outputXfer.acANCBuffer, streamsize(outputXfer.acANCBuffer.GetByteCount()));
634  sCurrentAncFileBytes += pAncStrm->good() ? outputXfer.acANCBuffer.GetByteCount() : 0;
635  if (pAncStrm->good() && outputXfer.acANCField2Buffer)
636  {
637  pAncStrm->read(outputXfer.acANCField2Buffer, streamsize(outputXfer.acANCField2Buffer.GetByteCount()));
638  sCurrentAncFileBytes += pAncStrm->good() ? outputXfer.acANCField2Buffer.GetByteCount() : 0;
639  }
640  if (pAncStrm->eof())
641  { pAncStrm->clear();
642  pAncStrm->seekg(0); // Rewind upon EOF
644  PLDBG("Anc file rewound: " << DEC(goodXfers) << " goodXfers, " << DEC(badXfers) << " badXfers");
645  }
646  } // if playing anc from binary data file
647 
648  // Perform the DMA transfer to the device...
649  if (mDevice.AutoCirculateTransfer (mConfig.fOutputChannel, outputXfer))
650  goodXfers++;
651  else
652  badXfers++;
653 
654  if (goodXfers == 3)
655  mDevice.AutoCirculateStart(mConfig.fOutputChannel);
656 
657  // Signal that the frame has been "consumed"...
658  mFrameDataRing.EndConsumeNextBuffer();
659  continue; // Back to top of while loop
660  } // if CanAcceptMoreOutputFrames
661 
662  // Wait for one or more buffers to become available on the device, which should occur at next VBI...
663  noRoomWaits++;
665  } // loop til quit signaled
666 
667  // Stop AutoCirculate...
668  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
669  PLNOTE("Thread completed: " << DEC(goodXfers) << " xfers, " << DEC(badXfers) << " failed, "
670  << DEC(starves) << " starves, " << DEC(noRoomWaits) << " VBI waits");
671  if (pAncStrm)
672  delete pAncStrm;
673 
674 } // ConsumeFrames
675 
676 
677 
679 // This is where the producer thread starts
680 
682 {
683  // Create and start the producer thread...
684  mProducerThread.Attach(ProducerThreadStatic, this);
685  mProducerThread.SetPriority(AJA_ThreadPriority_High);
686  mProducerThread.Start();
687 
688 } // StartProducerThread
689 
690 
691 void NTV2Player::ProducerThreadStatic (AJAThread * pThread, void * pContext) // static
692 { (void) pThread;
693  NTV2Player * pApp (reinterpret_cast<NTV2Player*>(pContext));
694  if (pApp)
695  pApp->ProduceFrames();
696 
697 } // ProducerThreadStatic
698 
699 
701 {
702  ULWord freqNdx(0), testPatNdx(0), badTally(0);
703  double timeOfLastSwitch (0.0);
704 
707  const bool isInterlace (!NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(mConfig.fVideoFormat));
708  const bool isPAL (NTV2_IS_PAL_VIDEO_FORMAT(mConfig.fVideoFormat));
709  const NTV2FrameRate ntv2FrameRate (::GetNTV2FrameRateFromVideoFormat(mConfig.fVideoFormat));
710  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
711 
712  PLNOTE("Thread started");
713  while (!mGlobalQuit)
714  {
715  NTV2FrameData * pFrameData (mFrameDataRing.StartProduceNextBuffer());
716  if (!pFrameData)
717  { badTally++; // No frame available!
718  AJATime::Sleep(10); // Wait a bit for the consumer thread to free one up for me...
719  continue; // ...then try again
720  }
721 
722  if (pFrameData->VideoBuffer()) // Copy fresh, unmodified, pre-rendered test pattern into this frame's video buffer...
723  pFrameData->fVideoBuffer.CopyFrom (mTestPatRasters.at(testPatNdx),
724  /*srcOffset*/ 0,
725  /*dstOffset*/ 0,
726  /*byteCount*/ pFrameData->fVideoBuffer.GetByteCount());
727 
728  const CRP188 rp188Info (mCurrentFrame++, 0, 0, 10, tcFormat);
729  NTV2_RP188 tcF1, tcF2;
730  string tcString;
731 
732  rp188Info.GetRP188Reg(tcF1);
733  rp188Info.GetRP188Str(tcString);
734 
735  // Include timecode in output signal...
736  tcF2 = tcF1;
737  if (isInterlace)
738  { // Set bit 27 of Hi word (PAL) or Lo word (NTSC)
739  if (isPAL) tcF2.fHi |= BIT(27); else tcF2.fLo |= BIT(27);
740  }
741 
742  // Add timecodes for each SDI output...
743  for (NTV2TCIndexesConstIter it(mTCIndexes.begin()); it != mTCIndexes.end(); ++it)
744  pFrameData->fTimecodes[*it] = NTV2_IS_ATC_VITC2_TIMECODE_INDEX(*it) ? tcF2 : tcF1;
745 
746  if (pFrameData->VideoBuffer()) // Burn current timecode into the video buffer...
747  mTCBurner.BurnTimeCode (pFrameData->VideoBuffer(), tcString.c_str(), 80);
748  TCDBG("F" << DEC0N(mCurrentFrame-1,6) << ": " << tcF1 << ": " << tcString);
749 
750  // If also playing audio...
751  if (pFrameData->AudioBuffer()) // ...then generate audio tone data for this frame...
752  pFrameData->fNumAudioBytes = AddTone(*pFrameData); // ...and remember number of audio bytes to xfer
753 
754  // Every few seconds, change the test pattern and tone frequency...
755  const double currentTime (timeBase.FramesToSeconds(mCurrentFrame));
756  if (currentTime > timeOfLastSwitch + 4.0)
757  {
758  freqNdx = (freqNdx + 1) % gNumFrequencies;
759  testPatNdx = (testPatNdx + 1) % ULWord(mTestPatRasters.size());
760  mToneFrequency = gFrequencies[freqNdx];
761  timeOfLastSwitch = currentTime;
762  if (sTotalAncFileBytes)
763  PLINFO("F" << DEC0N(mCurrentFrame,6) << ": " << tcString << ": tone=" << mToneFrequency << "Hz, pattern='"
764  << tpNames.at(testPatNdx) << "', anc file " << DEC(sCurrentAncFileBytes * 100ULL / sTotalAncFileBytes) << "%");
765  else
766  PLINFO("F" << DEC0N(mCurrentFrame,6) << ": " << tcString << ": tone=" << mToneFrequency << "Hz, pattern='"
767  << tpNames.at(testPatNdx) << "'");
768  } // if time to switch test pattern & tone frequency
769 
770  // Signal that I'm done producing this FrameData, making it immediately available for transfer/playout...
771  mFrameDataRing.EndProduceNextBuffer();
772 
773  } // loop til mGlobalQuit goes true
774  PLNOTE("Thread completed: " << DEC(mCurrentFrame) << " frame(s) produced, " << DEC(badTally) << " failed");
775 
776 } // ProduceFrames
777 
778 
779 uint32_t NTV2Player::AddTone (NTV2FrameData & inFrameData)
780 {
783  ULWord numChannels (0);
784 
785  mDevice.GetFrameRate (frameRate, mConfig.fOutputChannel);
786  mDevice.GetAudioRate (audioRate, mAudioSystem);
787  mDevice.GetNumberAudioChannels (numChannels, mAudioSystem);
788 
789  // Set per-channel tone frequencies...
790  double pFrequencies [kNumAudioChannelsMax];
791  pFrequencies[0] = (mToneFrequency / 2.0);
792  for (ULWord chan(1); chan < numChannels; chan++)
793  // The 1.154782 value is the 16th root of 10, to ensure that if mToneFrequency is 2000,
794  // that the calculated frequency of audio channel 16 will be 20kHz...
795  pFrequencies[chan] = pFrequencies[chan-1] * 1.154782;
796 
797  // Since audio on AJA devices use fixed sample rates (typically 48KHz), certain video frame rates will
798  // necessarily result in some frames having more audio samples than others. GetAudioSamplesPerFrame is
799  // called to calculate the correct sample count for the current frame...
800  const ULWord numSamples (::GetAudioSamplesPerFrame (frameRate, audioRate, mCurrentFrame));
801  const double sampleRateHertz (::GetAudioSamplesPerSecond(audioRate));
802 
803  return ::AddAudioTone ( inFrameData.AudioBuffer(), // audio buffer to fill
804  mCurrentSample, // which sample for continuing the waveform
805  numSamples, // number of samples to generate
806  sampleRateHertz, // sample rate [Hz]
807  gAmplitudes, // per-channel amplitudes
808  pFrequencies, // per-channel tone frequencies [Hz]
809  31, // bits per sample
810  false, // don't byte-swap
811  numChannels); // number of audio channels to generate
812 } // AddTone
813 
814 
816 {
817  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outStatus);
818 }
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:4365
GetSDIOutputInputXpt
NTV2InputXptID GetSDIOutputInputXpt(const NTV2Channel inSDIOutput, const bool inIsDS2=false)
Definition: ntv2signalrouter.cpp:970
DeviceCapabilities::CanDoVideoFormat
bool CanDoVideoFormat(const NTV2VideoFormat inVF)
Definition: ntv2devicecapabilities.h:254
NTV2_AUDIO_LOOPBACK_OFF
@ NTV2_AUDIO_LOOPBACK_OFF
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:2016
NTV2FormatDescriptor::GetVideoWriteSize
ULWord GetVideoWriteSize(ULWord inPageSize=4096UL) const
Definition: ntv2formatdescriptor.cpp:957
NTV2Player::RouteOutputSignal
virtual bool RouteOutputSignal(void)
Performs all widget/signal routing for playout.
Definition: ntv2player.cpp:408
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_OUTPUTDESTINATION_HDMI1
@ NTV2_OUTPUTDESTINATION_HDMI1
Definition: ntv2enums.h:1313
NTV2_TestPatt_CheckField
@ NTV2_TestPatt_CheckField
Definition: ntv2testpatterngen.h:34
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:1454
NTV2_IS_VALID_TASK_MODE
#define NTV2_IS_VALID_TASK_MODE(__m__)
Definition: ntv2publicinterface.h:4354
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or FrameStore 2 (or the 2nd item).
Definition: ntv2enums.h:1346
NTV2_VANCDATA_NORMAL
@ NTV2_VANCDATA_NORMAL
Definition: ntv2enums.h:3785
AJA_ThreadPriority_High
@ AJA_ThreadPriority_High
Definition: thread.h:44
NTV2ACFrameRange::firstFrame
UWord firstFrame(void) const
Definition: ntv2utils.h:983
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:480
NTV2_TestPatt_MultiBurst
@ NTV2_TestPatt_MultiBurst
Definition: ntv2testpatterngen.h:32
NTV2_AUDIO_BUFFER_BIG
@ NTV2_AUDIO_BUFFER_BIG
Definition: ntv2enums.h:1905
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:2859
CRP188::GetRP188Reg
bool GetRP188Reg(RP188_STRUCT &outRP188) const
Definition: ntv2rp188.cpp:1240
NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE
#define NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(__f__)
Definition: ntv2enums.h:1040
NTV2Buffer
Describes a user-space buffer on the host computer. I have an address and a length,...
Definition: ntv2publicinterface.h:6094
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:6168
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:691
GetNTV2FrameRateFromVideoFormat
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3534
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:1916
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:1803
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:329
gFrequencies
static const double gFrequencies[]
Definition: ntv2player.cpp:52
NTV2_FRAMERATE_INVALID
@ NTV2_FRAMERATE_INVALID
Definition: ntv2enums.h:432
NTV2_AUDIOSYSTEM_1
@ NTV2_AUDIOSYSTEM_1
This identifies the first Audio System.
Definition: ntv2enums.h:3867
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:982
ntv2testpatterngen.h
Declares the NTV2TestPatternGen class.
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:313
DEC0N
#define DEC0N(__x__, __n__)
Definition: ntv2publicinterface.h:5649
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:4199
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:3961
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:1769
NTV2_IS_2K_1080_VIDEO_FORMAT
#define NTV2_IS_2K_1080_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:754
PlayerConfig::fDoMultiFormat
bool fDoMultiFormat
If true, enable device-sharing; otherwise take exclusive control of device.
Definition: ntv2democommon.h:332
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:1939
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 FrameStore 1 (or the first item).
Definition: ntv2enums.h:1345
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:205
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:7345
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:403
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:330
GetOutputDestInputXpt
NTV2InputXptID GetOutputDestInputXpt(const NTV2OutputDestination inOutputDest, const bool inIsSDI_DS2=false, const UWord inHDMI_Quadrant=99)
Definition: ntv2signalrouter.cpp:956
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:5587
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:681
AJAStatus
AJAStatus
Definition: types.h:378
NTV2_RP188::fLo
ULWord fLo
| BG 4 | Secs10 | BG 3 | Secs 1 | BG 2 | Frms10 | BG 1 | Frms 1 |
Definition: ntv2publicinterface.h:6873
NTV2FormatDescriptor::numPixels
ULWord numPixels
Width – total number of pixels per line.
Definition: ntv2formatdescriptor.h:367
process.h
Declares the AJAProcess class.
PlayerConfig::fFrames
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
Definition: ntv2democommon.h:326
NTV2_RP188::fHi
ULWord fHi
| BG 8 | Hrs 10 | BG 7 | Hrs 1 | BG 6 | Mins10 | BG 5 | Mins 1 |
Definition: ntv2publicinterface.h:6874
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:156
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:3769
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:3951
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:255
NTV2_TestPatt_FlatField
@ NTV2_TestPatt_FlatField
Definition: ntv2testpatterngen.h:35
CNTV2Card::GetDescription
virtual std::string GetDescription(void) const
Definition: ntv2card.cpp:143
NTV2FrameData::fVideoBuffer
NTV2Buffer fVideoBuffer
Host video buffer.
Definition: ntv2democommon.h:82
AUTOCIRCULATE_STATUS
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
Definition: ntv2publicinterface.h:7274
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:366
NTV2FormatDescriptor::GetTotalBytes
ULWord GetTotalBytes(void) const
Definition: ntv2formatdescriptor.cpp:946
AUTOCIRCULATE_TRANSFER::SetOutputTimeCodes
bool SetOutputTimeCodes(const NTV2TimeCodes &inValues)
Intended for playout, replaces the contents of my acOutputTimeCodes member.
Definition: ntv2publicinterface.cpp:2878
CNTV2DemoCommon::SetDefaultPageSize
static size_t SetDefaultPageSize(void)
Definition: ntv2democommon.cpp:1553
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:5027
NTV2Player::SetUpAudio
virtual AJAStatus SetUpAudio(void)
Performs all audio setup.
Definition: ntv2player.cpp:268
GetCSCOutputXptFromChannel
NTV2OutputXptID GetCSCOutputXptFromChannel(const NTV2Channel inCSC, const bool inIsKey=false, const bool inIsRGB=false)
Definition: ntv2signalrouter.cpp:847
NTV2Player::~NTV2Player
virtual ~NTV2Player(void)
Definition: ntv2player.cpp:79
AJAProcess::GetPid
static uint64_t GetPid()
Definition: process.cpp:35
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:1857
UWord
uint16_t UWord
Definition: ajatypes.h:253
PlayerConfig::fVideoFormat
NTV2VideoFormat fVideoFormat
The video format to use.
Definition: ntv2democommon.h:328
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:724
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:1445
AUTOCIRCULATE_TRANSFER
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
Definition: ntv2publicinterface.h:8161
PlayerConfig::fOutputChannel
NTV2Channel fOutputChannel
The device channel to use.
Definition: ntv2democommon.h:324
PlayerConfig::fAncDataFilePath
std::string fAncDataFilePath
Optional path to Anc binary data file to playout.
Definition: ntv2democommon.h:323
NTV2VideoFormatToString
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Definition: ntv2utils.cpp:6798
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:2851
GetCSCInputXptFromChannel
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
Definition: ntv2signalrouter.cpp:803
IsVideoFormatA
bool IsVideoFormatA(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5523
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:491
NTV2_TASK_MODE_INVALID
@ NTV2_TASK_MODE_INVALID
Definition: ntv2publicinterface.h:4351
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1316
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))
NTV2ChannelSet
std::set< NTV2Channel > NTV2ChannelSet
A set of distinct NTV2Channel values.
Definition: ntv2publicinterface.h:3869
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:8198
CRP188
Definition: ntv2rp188.h:55
AUTOCIRCULATE_STATUS::GetEndFrame
uint16_t GetEndFrame(void) const
Definition: ntv2publicinterface.h:7399
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:1143
NTV2Player::ProduceFrames
virtual void ProduceFrames(void)
My producer thread that repeatedly produces video frames.
Definition: ntv2player.cpp:700
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:2875
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
AJA_NULL
#define AJA_NULL
Definition: ajatypes.h:199
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:4483
CNTV2DemoCommon::GetAJAFrameRate
static AJA_FrameRate GetAJAFrameRate(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:1080
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:525
NTV2FrameData::fAudioBuffer
NTV2Buffer fAudioBuffer
Host audio buffer.
Definition: ntv2democommon.h:84
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:335
NTV2AudioRate
NTV2AudioRate
Definition: ntv2enums.h:1914
AJA_STATUS_INITIALIZE
@ AJA_STATUS_INITIALIZE
Definition: types.h:386
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5647
CNTV2Card::SetSDIOutputStandard
virtual bool SetSDIOutputStandard(const UWord inOutputSpigot, const NTV2Standard inValue)
Sets the SDI output spigot's video standard.
Definition: ntv2register.cpp:3200
CNTV2Card::DisableChannels
virtual bool DisableChannels(const NTV2ChannelSet &inChannels)
Disables the given FrameStore(s).
Definition: ntv2register.cpp:2087
false
#define false
Definition: ntv2devicefeatures.h:25
AUTOCIRCULATE_WITH_RP188
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
Definition: ntv2publicinterface.h:5581
AJAFileIO::FileExists
static bool FileExists(const std::wstring &fileName)
Definition: file_io.cpp:97
NTV2TCIndexesConstIter
NTV2TCIndexes::const_iterator NTV2TCIndexesConstIter
Definition: ntv2publicinterface.h:6961
NTV2ACFrameRange::lastFrame
UWord lastFrame(void) const
Definition: ntv2utils.h:984
ancillarydata_hdr_hdr10.h
Declares the AJAAncillaryData_HDR_HDR10 class.
PlayerConfig::fDeviceSpec
std::string fDeviceSpec
The AJA device to use.
Definition: ntv2democommon.h:322
NTV2Player::SetUpTestPatternBuffers
virtual AJAStatus SetUpTestPatternBuffers(void)
Creates my test pattern buffers.
Definition: ntv2player.cpp:357
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
GetFrameBufferOutputXptFromChannel
#define GetFrameBufferOutputXptFromChannel
Definition: ntv2signalrouter.h:731
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:779
NTV2_RP188
This struct replaces the old RP188_STRUCT.
Definition: ntv2publicinterface.h:6871
gNumFrequencies
static const ULWord gNumFrequencies(sizeof(gFrequencies)/sizeof(double))
IsRGBFormat
bool IsRGBFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5475
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
CNTV2DemoCommon::GetAJAPixelFormat
static AJA_PixelFormat GetAJAPixelFormat(const NTV2PixelFormat inFormat)
Definition: ntv2democommon.cpp:1112
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:2793
AUTOCIRCULATE_STATUS::GetStartFrame
uint16_t GetStartFrame(void) const
Definition: ntv2publicinterface.h:7394
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:4003
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:3295
NTV2Player::ConsumeFrames
virtual void ConsumeFrames(void)
My consumer thread that repeatedly plays frames using AutoCirculate (until quit).
Definition: ntv2player.cpp:505
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
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:3207
NTV2Player::SetUpHostBuffers
virtual AJAStatus SetUpHostBuffers(void)
Sets up my host video & audio buffers.
Definition: ntv2player.cpp:312
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:319
PlayerConfig::fDoABConversion
bool fDoABConversion
If true, do level-A/B conversion; otherwise don't.
Definition: ntv2democommon.h:336
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:2279
PlayerConfig::fPixelFormat
NTV2PixelFormat fPixelFormat
The pixel format to use.
Definition: ntv2democommon.h:327
NTV2OutputXptID
enum NTV2OutputCrosspointID NTV2OutputXptID
NTV2Buffer::Fill
bool Fill(const T &inValue)
Fills me with the given scalar value.
Definition: ntv2publicinterface.h:6320
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:466
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:1058
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
BIT
#define BIT(_x_)
Definition: ajatypes.h:563
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5646
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition: types.h:371
NTV2_AUDIO_RATE_INVALID
@ NTV2_AUDIO_RATE_INVALID
Definition: ntv2enums.h:1920
CNTV2Card::GetEnabledChannels
virtual bool GetEnabledChannels(NTV2ChannelSet &outChannels)
Answers with the set of channels that are currently enabled.
Definition: ntv2register.cpp:2136
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:226
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:4934
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:8187
NTV2FormatDescriptor::IsValid
bool IsValid(void) const
Definition: ntv2formatdescriptor.h:112
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:815
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:4301
CRP188::GetRP188Str
bool GetRP188Str(std::string &sRP188) const
Definition: ntv2rp188.cpp:917
NTV2_OEM_TASKS
@ NTV2_OEM_TASKS
2: OEM (recommended): device configured by client application(s) with some driver involvement.
Definition: ntv2publicinterface.h:4350
AJAAncDataType_HDR_HDR10
@ AJAAncDataType_HDR_HDR10
Definition: ancillarydata.h:58
NTV2_OUTPUTDESTINATION_ANALOG1
@ NTV2_OUTPUTDESTINATION_ANALOG1
Definition: ntv2enums.h:1312
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
NTV2_AUDIOSYSTEM_INVALID
@ NTV2_AUDIOSYSTEM_INVALID
Definition: ntv2enums.h:3877
timebase.h
Declares the AJATimeBase class.