AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
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 "ntv2testpatterngen.h"
13 #include "ajabase/system/process.h"
17 #include <fstream> // For ifstream
18 
19 using namespace std;
20 
21 //#define NTV2_BUFFER_LOCKING // Define this to pre-lock video/audio buffers in kernel
22 
23 // Convenience macros for EZ logging:
24 #define TCFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
25 #define TCWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
26 #define TCNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
27 #define TCINFO(_expr_) AJA_sINFO (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
28 #define TCDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
29 
35 static ULWord gAncMaxSizeBytes (NTV2_ANCSIZE_MAX); // Max per-frame anc buffer size, in bytes
36 
45 static const uint32_t gAudMaxSizeBytes (256 * 1024); // Max per-frame audio buffer size, in bytes
46 
47 static const bool BUFFER_PAGE_ALIGNED (true);
48 
49 // Audio tone generator data
50 static const double gFrequencies [] = {250.0, 500.0, 1000.0, 2000.0};
51 static const ULWord gNumFrequencies (sizeof(gFrequencies) / sizeof(double));
52 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,
53  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};
54 
55 
57  : mConfig (inConfig),
58  mConsumerThread (),
59  mProducerThread (),
60  mDevice (),
61  mSavedTaskMode (NTV2_TASK_MODE_INVALID),
62  mCurrentFrame (0),
63  mCurrentSample (0),
64  mToneFrequency (440.0),
65  mAudioSystem (NTV2_AUDIOSYSTEM_INVALID),
66  mFormatDesc (),
67  mTCIndexes (),
68  mGlobalQuit (false),
69  mTCBurner (),
70  mHostBuffers (),
71  mFrameDataRing (),
72  mTestPatRasters ()
73 {
74 }
75 
76 
78 {
79  // Stop my playout and producer threads, then destroy them...
80  Quit();
81 
82  mDevice.UnsubscribeOutputVerticalEvent(mConfig.fOutputChannel); // Unsubscribe from output VBI event
83 } // destructor
84 
85 
86 void NTV2Player::Quit (void)
87 {
88  // Set the global 'quit' flag, and wait for the threads to go inactive...
89  mGlobalQuit = true;
90 
91  while (mProducerThread.Active())
92  AJATime::Sleep(10);
93 
94  while (mConsumerThread.Active())
95  AJATime::Sleep(10);
96 
97 #if defined(NTV2_BUFFER_LOCKING)
98  mDevice.DMABufferUnlockAll();
99 #endif // NTV2_BUFFER_LOCKING
100  if (!mConfig.fDoMultiFormat && mDevice.IsOpen())
101  {
103  if (NTV2_IS_VALID_TASK_MODE(mSavedTaskMode))
104  mDevice.SetEveryFrameServices(mSavedTaskMode); // Restore prior task mode
105  }
106 } // Quit
107 
108 
110 {
111  AJAStatus status (AJA_STATUS_SUCCESS);
112 
113  // Open the device...
115  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl; return AJA_STATUS_OPEN;}
116 
117  if (!mDevice.IsDeviceReady(false))
118  {cerr << "## ERROR: Device '" << mDevice.GetDisplayName() << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
119  if (!mDevice.features().CanDoPlayback())
120  {cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' is capture-only" << endl; return AJA_STATUS_FEATURE;}
121 
122  const UWord maxNumChannels (mDevice.features().GetNumFrameStores());
123 
124  // Beware -- some older devices (e.g. Corvid1) can only output from FrameStore 2...
125  if ((mConfig.fOutputChannel == NTV2_CHANNEL1) && (!mDevice.features().CanDoFrameStore1Display()))
126  mConfig.fOutputChannel = NTV2_CHANNEL2;
127  if (UWord(mConfig.fOutputChannel) >= maxNumChannels)
128  {
129  cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' can't use Ch" << DEC(mConfig.fOutputChannel+1)
130  << " -- only supports Ch1" << (maxNumChannels > 1 ? string("-Ch") + string(1, char(maxNumChannels+'0')) : "") << endl;
131  return AJA_STATUS_UNSUPPORTED;
132  }
133 
134  if (!mConfig.fDoMultiFormat)
135  {
136  mDevice.GetEveryFrameServices(mSavedTaskMode); // Save the current task mode
138  return AJA_STATUS_BUSY; // Device is in use by another app -- fail
139  }
140  mDevice.SetEveryFrameServices(NTV2_OEM_TASKS); // Set OEM service level
141 
142  if (mDevice.features().CanDoMultiFormat())
143  mDevice.SetMultiFormatMode(mConfig.fDoMultiFormat);
144  else
145  mConfig.fDoMultiFormat = false;
146 
147  // Set up the video and audio...
148  status = SetUpVideo();
149  if (AJA_FAILURE(status))
150  return status;
151  status = mConfig.WithAudio() ? SetUpAudio() : AJA_STATUS_SUCCESS;
152  if (AJA_FAILURE(status))
153  return status;
154 
155  // Set up the circular buffers, and the test pattern buffers...
156  status = SetUpHostBuffers();
157  if (AJA_FAILURE(status))
158  return status;
159  status = SetUpTestPatternBuffers();
160  if (AJA_FAILURE(status))
161  return status;
162 
163  // Set up the device signal routing...
164  if (!RouteOutputSignal())
165  return AJA_STATUS_FAIL;
166 
167  // Lastly, prepare my AJATimeCodeBurn instance...
168  if (!mTCBurner.RenderTimeCodeFont (CNTV2DemoCommon::GetAJAPixelFormat(mConfig.fPixelFormat), mFormatDesc.numPixels, mFormatDesc.numLines))
169  {cerr << "## ERROR: RenderTimeCodeFont failed for: " << mFormatDesc << endl; return AJA_STATUS_UNSUPPORTED;}
170 
171  // Ready to go...
172  #if defined(_DEBUG)
173  cerr << mConfig;
174  if (mDevice.IsRemote())
175  cerr << "Device Description: " << mDevice.GetDescription() << endl;
176  cerr << endl;
177  #endif // defined(_DEBUG)
178  return AJA_STATUS_SUCCESS;
179 
180 } // Init
181 
182 
184 {
185  // Configure the device to output the requested video format...
186  if (mConfig.fVideoFormat == NTV2_FORMAT_UNKNOWN)
187  return AJA_STATUS_BAD_PARAM;
188  if (!mDevice.features().CanDoVideoFormat(mConfig.fVideoFormat))
189  { cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' doesn't support "
190  << ::NTV2VideoFormatToString(mConfig.fVideoFormat) << endl;
191  return AJA_STATUS_UNSUPPORTED;
192  }
193  if (!mDevice.features().CanDoFrameBufferFormat(mConfig.fPixelFormat))
194  { cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' doesn't support "
195  << ::NTV2FrameBufferFormatString(mConfig.fPixelFormat) << endl;
196  return AJA_STATUS_UNSUPPORTED;
197  }
198 
199  // This demo doesn't playout dual-link RGB over SDI -- only YCbCr.
200  // Check that this device has a CSC to convert RGB to YUV...
201  if (::IsRGBFormat(mConfig.fPixelFormat)) // If RGB FBF...
202  if (UWord(mConfig.fOutputChannel) > mDevice.features().GetNumCSCs()) // No CSC for this channel?
203  {cerr << "## ERROR: No CSC for channel " << DEC(mConfig.fOutputChannel+1) << " to convert RGB pixel format" << endl;
204  return AJA_STATUS_UNSUPPORTED;}
205 
206  if (!mDevice.features().CanDo3GLevelConversion() && mConfig.fDoABConversion && ::IsVideoFormatA(mConfig.fVideoFormat))
207  mConfig.fDoABConversion = false;
208  if (mConfig.fDoABConversion)
210 
211  // Keep the raster description handy...
212  mFormatDesc = NTV2FormatDescriptor(mConfig.fVideoFormat, mConfig.fPixelFormat);
213  if (!mFormatDesc.IsValid())
214  return AJA_STATUS_FAIL;
215 
216  // Turn on the FrameStore (to read frame buffer memory and transmit video)...
217  mDevice.EnableChannel(mConfig.fOutputChannel);
218 
219  // This demo assumes VANC is disabled...
220  mDevice.SetVANCMode(NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
222 
223  // Set the FrameStore video format...
224  mDevice.SetVideoFormat (mConfig.fVideoFormat, false, false, mConfig.fOutputChannel);
225 
226  // Set the frame buffer pixel format for the device FrameStore...
227  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mConfig.fPixelFormat);
228 
229  // The output interrupt is Enabled by default, but on some platforms, you must subscribe to it
230  // in order to be able to wait on its event/semaphore...
232 
233  // Check if HDR anc is permissible...
235  {cerr << "## WARNING: HDR Anc requested, but device can't do custom anc" << endl;
237 
238  // Get current per-field maximum Anc buffer size...
241 
242  // Set output clock reference...
244 
245  // At this point, video setup is complete (except for widget signal routing).
246  return AJA_STATUS_SUCCESS;
247 
248 } // SetUpVideo
249 
250 
252 {
253  uint16_t numAudioChannels (mDevice.features().GetMaxAudioChannels());
254 
255  // If there are 2048 pixels on a line instead of 1920, reduce the number of audio channels
256  // This is because HANC is narrower, and has space for only 8 channels
257  if (NTV2_IS_2K_1080_VIDEO_FORMAT(mConfig.fVideoFormat) && numAudioChannels > 8)
258  numAudioChannels = 8;
259 
260  mAudioSystem = NTV2_AUDIOSYSTEM_1; // Use NTV2_AUDIOSYSTEM_1...
261  if (mDevice.features().GetNumAudioSystems() > 1) // ...but if the device has more than one audio system...
262  mAudioSystem = ::NTV2ChannelToAudioSystem(mConfig.fOutputChannel); // ...base it on the channel
263  // However, there are a few older devices that have only 1 audio system,
264  // yet 2 frame stores (or must use channel 2 for playout)...
265  if (!mDevice.features().CanDoFrameStore1Display())
266  mAudioSystem = NTV2_AUDIOSYSTEM_1;
267 
268  mDevice.SetNumberAudioChannels (numAudioChannels, mAudioSystem);
269  mDevice.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
270 
271  // How big should the on-device audio buffer be? 1MB? 2MB? 4MB? 8MB?
272  // For this demo, 4MB will work best across all platforms (Windows, Mac & Linux)...
273  mDevice.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
274 
275  // Set the SDI output audio embedders to embed audio samples from the output of mAudioSystem...
276  mDevice.SetSDIOutputAudioSystem (mConfig.fOutputChannel, mAudioSystem);
277  mDevice.SetSDIOutputDS2AudioSystem (mConfig.fOutputChannel, mAudioSystem);
278 
279  // If the last app using the device left it in E-E mode (input passthru), then loopback
280  // must be disabled --- otherwise the output audio will be pass-thru SDI input audio...
281  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, mAudioSystem);
282 
283  if (!mConfig.fDoMultiFormat && mDevice.features().GetNumHDMIVideoOutputs())
284  {
288  }
289 
290  return AJA_STATUS_SUCCESS;
291 
292 } // SetUpAudio
293 
294 
296 {
297  CNTV2DemoCommon::SetDefaultPageSize(); // Set host-specific page size
298 
299  // Let my circular buffer know when it's time to quit...
300  mFrameDataRing.SetAbortFlag (&mGlobalQuit);
301 
302  // Allocate and add each in-host NTV2FrameData to my circular buffer member variable...
303  mHostBuffers.reserve(CIRCULAR_BUFFER_SIZE);
304  while (mHostBuffers.size() < CIRCULAR_BUFFER_SIZE)
305  {
306  mHostBuffers.push_back(NTV2FrameData()); // Make a new NTV2FrameData...
307  NTV2FrameData & frameData(mHostBuffers.back()); // ...and get a reference to it
308 
309  // Allocate a page-aligned video buffer
310  if (mConfig.WithVideo())
311  if (!frameData.fVideoBuffer.Allocate (mFormatDesc.GetTotalBytes(), BUFFER_PAGE_ALIGNED))
312  {
313  PLFAIL("Failed to allocate " << xHEX0N(mFormatDesc.GetTotalBytes(),8) << "-byte video buffer");
314  return AJA_STATUS_MEMORY;
315  }
316  #ifdef NTV2_BUFFER_LOCKING
317  if (frameData.fVideoBuffer)
318  mDevice.DMABufferLock(frameData.fVideoBuffer, true);
319  #endif
320 
321  // Allocate a page-aligned audio buffer (if transmitting audio)
322  if (mConfig.WithAudio())
324  {
325  PLFAIL("Failed to allocate " << xHEX0N(gAudMaxSizeBytes,8) << "-byte audio buffer");
326  return AJA_STATUS_MEMORY;
327  }
328  #ifdef NTV2_BUFFER_LOCKING
329  if (frameData.fAudioBuffer)
330  mDevice.DMABufferLock(frameData.fAudioBuffer, /*alsoPreLockSGL*/true);
331  #endif
332  mFrameDataRing.Add (&frameData);
333  } // for each NTV2FrameData
334 
335  return AJA_STATUS_SUCCESS;
336 
337 } // SetUpHostBuffers
338 
339 
341 {
342  vector<NTV2TestPatternSelect> testPatIDs;
343  testPatIDs.push_back(NTV2_TestPatt_ColorBars100);
344  testPatIDs.push_back(NTV2_TestPatt_ColorBars75);
345  testPatIDs.push_back(NTV2_TestPatt_Ramp);
346  testPatIDs.push_back(NTV2_TestPatt_MultiBurst);
347  testPatIDs.push_back(NTV2_TestPatt_LineSweep);
348  testPatIDs.push_back(NTV2_TestPatt_CheckField);
349  testPatIDs.push_back(NTV2_TestPatt_FlatField);
350  testPatIDs.push_back(NTV2_TestPatt_MultiPattern);
351 
352  mTestPatRasters.clear();
353  for (size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
354  mTestPatRasters.push_back(NTV2Buffer());
355 
356  if (!mFormatDesc.IsValid())
357  {PLFAIL("Bad format descriptor"); return AJA_STATUS_FAIL;}
358  if (mFormatDesc.IsVANC())
359  {PLFAIL("VANC should have been disabled: " << mFormatDesc); return AJA_STATUS_FAIL;}
360 
361  // Set up one video buffer for each test pattern...
362  for (size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
363  {
364  // Allocate the buffer memory...
365  if (!mTestPatRasters.at(tpNdx).Allocate (mFormatDesc.GetTotalBytes(), BUFFER_PAGE_ALIGNED))
366  { PLFAIL("Test pattern buffer " << DEC(tpNdx+1) << " of " << DEC(testPatIDs.size()) << ": "
367  << xHEX0N(mFormatDesc.GetTotalBytes(),8) << "-byte page-aligned alloc failed");
368  return AJA_STATUS_MEMORY;
369  }
370 
371  // Fill the buffer with test pattern...
372  NTV2TestPatternGen testPatternGen;
373  if (!testPatternGen.DrawTestPattern (testPatIDs.at(tpNdx), mFormatDesc, mTestPatRasters.at(tpNdx)))
374  {
375  cerr << "## ERROR: DrawTestPattern " << DEC(tpNdx) << " failed: " << mFormatDesc << endl;
376  return AJA_STATUS_FAIL;
377  }
378 
379  #ifdef NTV2_BUFFER_LOCKING
380  // Try to prelock the memory, including its scatter-gather list...
381  if (!mDevice.DMABufferLock(mTestPatRasters.at(tpNdx), /*alsoLockSegmentMap=*/true))
382  PLWARN("Test pattern buffer " << DEC(tpNdx+1) << " of " << DEC(testPatIDs.size()) << ": failed to pre-lock");
383  #endif
384  } // loop for each predefined pattern
385 
386  return AJA_STATUS_SUCCESS;
387 
388 } // SetUpTestPatternBuffers
389 
390 
392 {
393  const NTV2Standard outputStandard (::GetNTV2StandardFromVideoFormat(mConfig.fVideoFormat));
394  const UWord numSDIOutputs (mDevice.features().GetNumVideoOutputs());
395  const bool isRGB (::IsRGBFormat(mConfig.fPixelFormat));
396  const bool canVerify (mDevice.HasCanConnectROM());
397  UWord connectFailures (0);
398 
399  // Since this function figures out which SDI spigots will be set up for output,
400  // it also sets the "mTCIndexes" member, which determines which timecodes will
401  // be transmitted (and on which SDI spigots)...
402  mTCIndexes.clear();
403 
404  const NTV2OutputXptID cscVidOutXpt(::GetCSCOutputXptFromChannel(mConfig.fOutputChannel, false/*isKey*/, !isRGB/*isRGB*/));
405  const NTV2OutputXptID fsVidOutXpt (::GetFrameBufferOutputXptFromChannel(mConfig.fOutputChannel, isRGB/*isRGB*/, false/*is425*/));
406  const NTV2InputXptID cscInputXpt (isRGB ? ::GetCSCInputXptFromChannel(mConfig.fOutputChannel, false/*isKeyInput*/) : NTV2_INPUT_CROSSPOINT_INVALID);
407  if (isRGB)
408  if (!mDevice.Connect (cscInputXpt, fsVidOutXpt, canVerify))
409  connectFailures++;
410 
411  if (mConfig.fDoMultiFormat)
412  {
413  // Multiformat --- We may be sharing the device with other processes, so route only one SDI output...
414  if (mDevice.features().HasBiDirectionalSDI())
415  mDevice.SetSDITransmitEnable(mConfig.fOutputChannel, true);
416 
417  if (!mDevice.Connect (::GetSDIOutputInputXpt (mConfig.fOutputChannel, false/*isDS2*/), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
418  connectFailures++;
419  mTCIndexes.insert (::NTV2ChannelToTimecodeIndex(mConfig.fOutputChannel, /*inEmbeddedLTC=*/mConfig.fTransmitLTC));
420  // NOTE: No need to send VITC2 with VITC1 (for "i" formats) -- firmware does this automatically
421  mDevice.SetSDIOutputStandard (mConfig.fOutputChannel, outputStandard);
422  }
423  else
424  {
425  // Not multiformat: We own the whole device, so connect all possible SDI outputs...
426  const UWord numFrameStores(mDevice.features().GetNumFrameStores());
427  mDevice.ClearRouting(); // Start with clean slate
428 
429  if (isRGB)
430  if (!mDevice.Connect (cscInputXpt, fsVidOutXpt, canVerify))
431  connectFailures++;
432 
433  for (NTV2Channel chan(NTV2_CHANNEL1); ULWord(chan) < numSDIOutputs; chan = NTV2Channel(chan+1))
434  {
435  if (chan != mConfig.fOutputChannel && chan < numFrameStores)
436  mDevice.DisableChannel(chan); // Disable unused FrameStore
437  if (mDevice.features().HasBiDirectionalSDI())
438  mDevice.SetSDITransmitEnable (chan, true); // Make it an output
439 
440  const NTV2OutputDestination sdiOutput(::NTV2ChannelToOutputDestination(chan));
441  if (NTV2_OUTPUT_DEST_IS_SDI(sdiOutput))
442  if (OutputDestHasRP188BypassEnabled(sdiOutput))
443  DisableRP188Bypass(sdiOutput);
444  if (!mDevice.Connect (::GetSDIOutputInputXpt (chan, false/*isDS2*/), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
445  connectFailures++;
446  mDevice.SetSDIOutputStandard (chan, outputStandard);
447  mTCIndexes.insert (::NTV2ChannelToTimecodeIndex (chan, /*inEmbeddedLTC=*/mConfig.fTransmitLTC)); // Add SDI spigot's TC index
448  // NOTE: No need to send VITC2 with VITC1 (for "i" formats) -- firmware does this automatically
449 
450  if (mConfig.WithAudio())
451  mDevice.SetSDIOutputAudioSystem (chan, mAudioSystem); // Ensure SDIOut embedder gets audio from mAudioSystem
452  } // for each SDI output spigot
453 
454  // And connect analog video output, if the device has one...
455  if (mDevice.features().GetNumAnalogVideoOutputs())
456  if (!mDevice.Connect (::GetOutputDestInputXpt(NTV2_OUTPUTDESTINATION_ANALOG), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
457  connectFailures++;
458 
459  // And connect HDMI video output, if the device has one...
460  if (mDevice.features().GetNumHDMIVideoOutputs())
461  if (!mDevice.Connect (::GetOutputDestInputXpt(NTV2_OUTPUTDESTINATION_HDMI), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
462  connectFailures++;
463  }
464  TCNOTE(mTCIndexes);
465  if (connectFailures)
466  PLWARN(DEC(connectFailures) << " 'Connect' call(s) failed");
467  return connectFailures == 0;
468 
469 } // RouteOutputSignal
470 
471 
473 {
474  // Start my consumer and producer threads...
477  return AJA_STATUS_SUCCESS;
478 
479 } // Run
480 
481 
482 
484 // This is where the play thread starts
485 
487 {
488  // Create and start the playout thread...
489  mConsumerThread.Attach (ConsumerThreadStatic, this);
490  mConsumerThread.SetPriority(AJA_ThreadPriority_High);
491  mConsumerThread.Start();
492 
493 } // StartConsumerThread
494 
495 
496 // The playout thread function
497 void NTV2Player::ConsumerThreadStatic (AJAThread * pThread, void * pContext) // static
498 { (void) pThread;
499  // Grab the NTV2Player instance pointer from the pContext parameter,
500  // then call its ConsumeFrames method...
501  NTV2Player * pApp (reinterpret_cast<NTV2Player*>(pContext));
502  if (pApp)
503  pApp->ConsumeFrames();
504 
505 } // ConsumerThreadStatic
506 
507 
509 {
510  ULWord acOptions (AUTOCIRCULATE_WITH_RP188);
511  AUTOCIRCULATE_TRANSFER outputXfer;
512  AUTOCIRCULATE_STATUS outputStatus;
513  AJAAncillaryData * pPkt (AJA_NULL);
514  ULWord goodXfers(0), badXfers(0), starves(0), noRoomWaits(0);
515  ifstream * pAncStrm (AJA_NULL);
516 
517  // Stop AutoCirculate, just in case someone else left it running...
518  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
519  mDevice.WaitForOutputVerticalInterrupt(mConfig.fOutputChannel, 4); // Let it stop
520  PLNOTE("Thread started");
521 
523  { // HDR anc doesn't change per-frame, so fill outputXfer.acANCBuffer with the packet data...
524  static AJAAncillaryData_HDR_SDR sdrPkt;
525  static AJAAncillaryData_HDR_HDR10 hdr10Pkt;
526  static AJAAncillaryData_HDR_HLG hlgPkt;
527 
528  switch (mConfig.fTransmitHDRType)
529  {
530  case AJAAncDataType_HDR_SDR: pPkt = &sdrPkt; break;
531  case AJAAncDataType_HDR_HDR10: pPkt = &hdr10Pkt; break;
532  case AJAAncDataType_HDR_HLG: pPkt = &hlgPkt; break;
533  default: break;
534  }
535  }
536  if (pPkt)
537  { // Allocate page-aligned host Anc buffer...
538  uint32_t hdrPktSize (0);
539  if (!outputXfer.acANCBuffer.Allocate(gAncMaxSizeBytes, BUFFER_PAGE_ALIGNED) || !outputXfer.acANCBuffer.Fill(0LL))
540  PLWARN("Anc buffer " << xHEX0N(gAncMaxSizeBytes,8) << "(" << DEC(gAncMaxSizeBytes) << ")-byte allocate failed -- HDR anc insertion disabled");
541  else if (AJA_FAILURE(pPkt->GenerateTransmitData (outputXfer.acANCBuffer, outputXfer.acANCBuffer, hdrPktSize)))
542  {
543  PLWARN("HDR anc insertion disabled -- GenerateTransmitData failed");
544  outputXfer.acANCBuffer.Deallocate();
545  }
546  else
547  acOptions |= AUTOCIRCULATE_WITH_ANC;
548  }
549  else if (!mConfig.fAncDataFilePath.empty())
550  { // Open raw anc file for reading...
551  pAncStrm = new ifstream(mConfig.fAncDataFilePath.c_str(), ios::binary);
552  if (pAncStrm->good())
553  {
554  bool ancOK = outputXfer.acANCBuffer.Allocate(gAncMaxSizeBytes, BUFFER_PAGE_ALIGNED);
557  if (ancOK)
558  acOptions |= AUTOCIRCULATE_WITH_ANC;
559  else
560  {
561  PLWARN("Anc buffer " << xHEX0N(gAncMaxSizeBytes,8) << "(" << DEC(gAncMaxSizeBytes) << ")-byte allocate failed -- anc insertion from file disabled");
562  outputXfer.acANCBuffer.Deallocate();
563  outputXfer.acANCField2Buffer.Deallocate();
564  }
565  }
566  else
567  PLWARN("Unable to open anc data file '" << mConfig.fAncDataFilePath << "' -- anc insertion disabled");
568  }
569 #ifdef NTV2_BUFFER_LOCKING
570  if (outputXferInfo.acANCBuffer)
571  mDevice.DMABufferLock(outputXfer.acANCBuffer, /*alsoLockSGL*/true);
572  if (outputXferInfo.acANCField2Buffer)
573  mDevice.DMABufferLock(outputXfer.acANCField2Buffer, /*alsoLockSGL*/true);
574 #endif
575 
576  // Initialize & start AutoCirculate...
577  bool initOK = mDevice.AutoCirculateInitForOutput (mConfig.fOutputChannel, mConfig.fFrames.count(), mAudioSystem, acOptions,
578  1 /*numChannels*/, mConfig.fFrames.firstFrame(), mConfig.fFrames.lastFrame());
579  if (!initOK)
580  {PLFAIL("AutoCirculateInitForOutput failed"); mGlobalQuit = true;}
581  else if (!mConfig.WithVideo())
582  { // Video suppressed --
583  // Clear device frame buffers being AutoCirculated (prevent garbage output frames)
584  NTV2Buffer tmpFrame (mFormatDesc.GetVideoWriteSize());
585  NTV2TestPatternGen blackPatternGen;
586  blackPatternGen.DrawTestPattern (NTV2_TestPatt_Black, mFormatDesc, tmpFrame);
587  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
588  for (uint16_t frmNum(outputStatus.GetStartFrame()); frmNum <= outputStatus.GetEndFrame(); frmNum++)
589  mDevice.DMAWriteFrame(ULWord(frmNum), tmpFrame, mFormatDesc.GetTotalBytes());
590  } // else if --novideo
591 
592  while (!mGlobalQuit)
593  {
594  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
595 
596  // Check if there's room for another frame on the card...
597  if (outputStatus.CanAcceptMoreOutputFrames())
598  {
599  // Device has at least one free frame buffer that can be filled.
600  // Wait for the next frame in our ring to become ready to "consume"...
601  NTV2FrameData * pFrameData (mFrameDataRing.StartConsumeNextBuffer());
602  if (!pFrameData)
603  {starves++; continue;}
604 
605  outputXfer.SetOutputTimeCodes(pFrameData->fTimecodes);
606 
607  if (pFrameData->VideoBuffer()) // Transfer the timecode-burned frame to the device for playout...
608  outputXfer.SetVideoBuffer (pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
609  if (pFrameData->AudioBuffer()) // If also playing audio...
610  outputXfer.SetAudioBuffer (pFrameData->AudioBuffer(), pFrameData->fNumAudioBytes);
611 
612  if (pAncStrm && pAncStrm->good() && outputXfer.acANCBuffer)
613  { // Read pre-recorded anc from binary data file, and inject it into this frame...
614  pAncStrm->read(outputXfer.acANCBuffer, streamsize(outputXfer.acANCBuffer.GetByteCount()));
615  if (pAncStrm->good() && outputXfer.acANCField2Buffer)
616  pAncStrm->read(outputXfer.acANCField2Buffer, streamsize(outputXfer.acANCField2Buffer.GetByteCount()));
617  }
618 
619  // Perform the DMA transfer to the device...
620  if (mDevice.AutoCirculateTransfer (mConfig.fOutputChannel, outputXfer))
621  goodXfers++;
622  else
623  badXfers++;
624 
625  if (goodXfers == 3)
626  mDevice.AutoCirculateStart(mConfig.fOutputChannel);
627 
628  // Signal that the frame has been "consumed"...
629  mFrameDataRing.EndConsumeNextBuffer();
630  continue; // Back to top of while loop
631  } // if CanAcceptMoreOutputFrames
632 
633  // Wait for one or more buffers to become available on the device, which should occur at next VBI...
634  noRoomWaits++;
636  } // loop til quit signaled
637 
638  // Stop AutoCirculate...
639  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
640  PLNOTE("Thread completed: " << DEC(goodXfers) << " xfers, " << DEC(badXfers) << " failed, "
641  << DEC(starves) << " starves, " << DEC(noRoomWaits) << " VBI waits");
642  if (pAncStrm)
643  delete pAncStrm;
644 
645 } // ConsumeFrames
646 
647 
648 
650 // This is where the producer thread starts
651 
653 {
654  // Create and start the producer thread...
655  mProducerThread.Attach(ProducerThreadStatic, this);
656  mProducerThread.SetPriority(AJA_ThreadPriority_High);
657  mProducerThread.Start();
658 
659 } // StartProducerThread
660 
661 
662 void NTV2Player::ProducerThreadStatic (AJAThread * pThread, void * pContext) // static
663 { (void) pThread;
664  NTV2Player * pApp (reinterpret_cast<NTV2Player*>(pContext));
665  if (pApp)
666  pApp->ProduceFrames();
667 
668 } // ProducerThreadStatic
669 
670 
672 {
673  ULWord freqNdx(0), testPatNdx(0), badTally(0);
674  double timeOfLastSwitch (0.0);
675 
678  const bool isInterlace (!NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(mConfig.fVideoFormat));
679  const bool isPAL (NTV2_IS_PAL_VIDEO_FORMAT(mConfig.fVideoFormat));
680  const NTV2FrameRate ntv2FrameRate (::GetNTV2FrameRateFromVideoFormat(mConfig.fVideoFormat));
681  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
682 
683  PLNOTE("Thread started");
684  while (!mGlobalQuit)
685  {
686  NTV2FrameData * pFrameData (mFrameDataRing.StartProduceNextBuffer());
687  if (!pFrameData)
688  { badTally++; // No frame available!
689  AJATime::Sleep(10); // Wait a bit for the consumer thread to free one up for me...
690  continue; // ...then try again
691  }
692 
693  if (pFrameData->VideoBuffer()) // Copy fresh, unmodified, pre-rendered test pattern into this frame's video buffer...
694  pFrameData->fVideoBuffer.CopyFrom (mTestPatRasters.at(testPatNdx),
695  /*srcOffset*/ 0,
696  /*dstOffset*/ 0,
697  /*byteCount*/ pFrameData->fVideoBuffer.GetByteCount());
698 
699  const CRP188 rp188Info (mCurrentFrame++, 0, 0, 10, tcFormat);
700  NTV2_RP188 tcF1, tcF2;
701  string tcString;
702 
703  rp188Info.GetRP188Reg(tcF1);
704  rp188Info.GetRP188Str(tcString);
705 
706  // Include timecode in output signal...
707  tcF2 = tcF1;
708  if (isInterlace)
709  { // Set bit 27 of Hi word (PAL) or Lo word (NTSC)
710  if (isPAL) tcF2.fHi |= BIT(27); else tcF2.fLo |= BIT(27);
711  }
712 
713  // Add timecodes for each SDI output...
714  for (NTV2TCIndexesConstIter it(mTCIndexes.begin()); it != mTCIndexes.end(); ++it)
715  pFrameData->fTimecodes[*it] = NTV2_IS_ATC_VITC2_TIMECODE_INDEX(*it) ? tcF2 : tcF1;
716 
717  if (pFrameData->VideoBuffer()) // Burn current timecode into the video buffer...
718  mTCBurner.BurnTimeCode (pFrameData->VideoBuffer(), tcString.c_str(), 80);
719  TCDBG("F" << DEC0N(mCurrentFrame-1,6) << ": " << tcF1 << ": " << tcString);
720 
721  // If also playing audio...
722  if (pFrameData->AudioBuffer()) // ...then generate audio tone data for this frame...
723  pFrameData->fNumAudioBytes = AddTone(*pFrameData); // ...and remember number of audio bytes to xfer
724 
725  // Every few seconds, change the test pattern and tone frequency...
726  const double currentTime (timeBase.FramesToSeconds(mCurrentFrame));
727  if (currentTime > timeOfLastSwitch + 4.0)
728  {
729  freqNdx = (freqNdx + 1) % gNumFrequencies;
730  testPatNdx = (testPatNdx + 1) % ULWord(mTestPatRasters.size());
731  mToneFrequency = gFrequencies[freqNdx];
732  timeOfLastSwitch = currentTime;
733  PLINFO("F" << DEC0N(mCurrentFrame,6) << ": " << tcString << ": tone=" << mToneFrequency << "Hz, pattern='" << tpNames.at(testPatNdx) << "'");
734  } // if time to switch test pattern & tone frequency
735 
736  // Signal that I'm done producing this FrameData, making it immediately available for transfer/playout...
737  mFrameDataRing.EndProduceNextBuffer();
738 
739  } // loop til mGlobalQuit goes true
740  PLNOTE("Thread completed: " << DEC(mCurrentFrame) << " frame(s) produced, " << DEC(badTally) << " failed");
741 
742 } // ProduceFrames
743 
744 
745 uint32_t NTV2Player::AddTone (NTV2FrameData & inFrameData)
746 {
749  ULWord numChannels (0);
750 
751  mDevice.GetFrameRate (frameRate, mConfig.fOutputChannel);
752  mDevice.GetAudioRate (audioRate, mAudioSystem);
753  mDevice.GetNumberAudioChannels (numChannels, mAudioSystem);
754 
755  // Set per-channel tone frequencies...
756  double pFrequencies [kNumAudioChannelsMax];
757  pFrequencies[0] = (mToneFrequency / 2.0);
758  for (ULWord chan(1); chan < numChannels; chan++)
759  // The 1.154782 value is the 16th root of 10, to ensure that if mToneFrequency is 2000,
760  // that the calculated frequency of audio channel 16 will be 20kHz...
761  pFrequencies[chan] = pFrequencies[chan-1] * 1.154782;
762 
763  // Since audio on AJA devices use fixed sample rates (typically 48KHz), certain video frame rates will
764  // necessarily result in some frames having more audio samples than others. GetAudioSamplesPerFrame is
765  // called to calculate the correct sample count for the current frame...
766  const ULWord numSamples (::GetAudioSamplesPerFrame (frameRate, audioRate, mCurrentFrame));
767  const double sampleRateHertz (::GetAudioSamplesPerSecond(audioRate));
768 
769  return ::AddAudioTone ( inFrameData.AudioBuffer(), // audio buffer to fill
770  mCurrentSample, // which sample for continuing the waveform
771  numSamples, // number of samples to generate
772  sampleRateHertz, // sample rate [Hz]
773  gAmplitudes, // per-channel amplitudes
774  pFrequencies, // per-channel tone frequencies [Hz]
775  31, // bits per sample
776  false, // don't byte-swap
777  numChannels); // number of audio channels to generate
778 } // AddTone
779 
780 
782 {
783  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outStatus);
784 }
785 
786 
788 {
789  switch (inOutputDest)
790  {
791  case NTV2_OUTPUTDESTINATION_SDI1: return kRegRP188InOut1DBB; // reg 29
792  case NTV2_OUTPUTDESTINATION_SDI2: return kRegRP188InOut2DBB; // reg 64
793  case NTV2_OUTPUTDESTINATION_SDI3: return kRegRP188InOut3DBB; // reg 268
794  case NTV2_OUTPUTDESTINATION_SDI4: return kRegRP188InOut4DBB; // reg 273
795  case NTV2_OUTPUTDESTINATION_SDI5: return kRegRP188InOut5DBB; // reg 29
796  case NTV2_OUTPUTDESTINATION_SDI6: return kRegRP188InOut6DBB; // reg 64
797  case NTV2_OUTPUTDESTINATION_SDI7: return kRegRP188InOut7DBB; // reg 268
798  case NTV2_OUTPUTDESTINATION_SDI8: return kRegRP188InOut8DBB; // reg 273
799  default: return 0;
800  } // switch on output destination
801 
802 } // GetRP188RegisterForOutput
803 
804 
806 {
807  bool result (false);
808  const ULWord regNum (GetRP188RegisterForOutput(inOutputDest));
809  ULWord regValue(0);
810 
811  // Bit 23 of the RP188 DBB register will be set if output timecode is pulled
812  // directly from an SDI input (bypass source)...
813  if (regNum && mDevice.ReadRegister(regNum, regValue) && regValue & BIT(23))
814  result = true;
815 
816  return result;
817 
818 } // OutputDestHasRP188BypassEnabled
819 
820 
822 {
823  // Clear bit 23 of SDI output's RP188 DBB register...
824  const ULWord regNum (GetRP188RegisterForOutput(inOutputDest));
825  if (regNum)
826  mDevice.WriteRegister (regNum, 0, BIT(23), 23);
827 
828 } // 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:2656
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:4281
GetSDIOutputInputXpt
NTV2InputXptID GetSDIOutputInputXpt(const NTV2Channel inSDIOutput, const bool inIsDS2=false)
Definition: ntv2signalrouter.cpp:942
DeviceCapabilities::CanDoVideoFormat
bool CanDoVideoFormat(const NTV2VideoFormat inVF)
Definition: ntv2card.h:243
NTV2_AUDIO_LOOPBACK_OFF
@ NTV2_AUDIO_LOOPBACK_OFF
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:1971
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:391
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:659
NTV2_TestPatt_CheckField
@ NTV2_TestPatt_CheckField
Definition: ntv2testpatterngen.h:32
kRegRP188InOut3DBB
@ kRegRP188InOut3DBB
Definition: ntv2publicinterface.h:362
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:4265
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:3729
AJA_ThreadPriority_High
@ AJA_ThreadPriority_High
Definition: thread.h:44
NTV2ACFrameRange::firstFrame
UWord firstFrame(void) const
Definition: ntv2utils.h:975
DeviceCapabilities::HasBiDirectionalSDI
bool HasBiDirectionalSDI(void)
Definition: ntv2card.h:143
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:486
NTV2_TestPatt_MultiBurst
@ NTV2_TestPatt_MultiBurst
Definition: ntv2testpatterngen.h:30
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:709
AJAAncDataType_Unknown
@ AJAAncDataType_Unknown
Includes data that is valid, but we don't recognize.
Definition: ancillarydata.h:46
DeviceCapabilities::GetNumAudioSystems
UWord GetNumAudioSystems(void)
Definition: ntv2card.h:188
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:64
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:2614
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 Frame Store. They're also commonly used to i...
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:5967
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:368
NTV2Buffer::GetByteCount
ULWord GetByteCount(void) const
Definition: ntv2publicinterface.h:6040
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:662
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:1588
NTV2_OUTPUTDESTINATION_SDI2
@ NTV2_OUTPUTDESTINATION_SDI2
Definition: ntv2enums.h:1281
AJA_STATUS_BUSY
@ AJA_STATUS_BUSY
Definition: types.h:378
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:327
gFrequencies
static const double gFrequencies[]
Definition: ntv2player.cpp:50
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:3811
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:2093
NTV2_TestPatt_ColorBars100
@ NTV2_TestPatt_ColorBars100
Definition: ntv2testpatterngen.h:26
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:5581
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:832
NTV2_AncRgn_Field2
@ NTV2_AncRgn_Field2
Identifies the "normal" Field 2 ancillary data region.
Definition: ntv2enums.h:4141
kRegRP188InOut5DBB
@ kRegRP188InOut5DBB
Definition: ntv2publicinterface.h:450
AJA_STATUS_MEMORY
@ AJA_STATUS_MEMORY
Definition: types.h:384
DeviceCapabilities::GetNumAnalogVideoOutputs
UWord GetNumAnalogVideoOutputs(void)
Definition: ntv2card.h:187
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:3905
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:1554
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:109
TimecodeFormat
TimecodeFormat
Definition: ntv2rp188.h:27
NTV2_AUDIO_FORMAT_LPCM
@ NTV2_AUDIO_FORMAT_LPCM
Definition: ntv2enums.h:1894
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:303
NTV2_CHANNEL1
@ NTV2_CHANNEL1
Specifies channel or Frame Store 1 (or the first item).
Definition: ntv2enums.h:1307
ntv2debug.h
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:3805
DeviceCapabilities::CanDoCustomAnc
bool CanDoCustomAnc(void)
Definition: ntv2card.h:93
CNTV2Card::SetVANCShiftMode
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
Definition: ntv2register.cpp:2816
AUTOCIRCULATE_STATUS::CanAcceptMoreOutputFrames
bool CanAcceptMoreOutputFrames(void) const
Definition: ntv2publicinterface.h:7176
CNTV2Card::SetVideoFormat
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=true, const bool inKeepVancSettings=false, const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
Definition: ntv2register.cpp:204
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
DeviceCapabilities::CanDo3GLevelConversion
bool CanDo3GLevelConversion(void)
Definition: ntv2card.h:76
NTV2FrameData::VideoBuffer
NTV2Buffer & VideoBuffer(void)
Definition: ntv2democommon.h:106
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
DeviceCapabilities::GetNumFrameStores
UWord GetNumFrameStores(void)
Definition: ntv2card.h:195
CNTV2Card::features
virtual class DeviceCapabilities & features(void)
Definition: ntv2card.h:377
AJAThread
Definition: thread.h:69
AUTOCIRCULATE_WITH_ANC
#define AUTOCIRCULATE_WITH_ANC
Use this to AutoCirculate with ancillary data.
Definition: ntv2publicinterface.h:5496
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:515
CNTV2Card::GetDisplayName
virtual std::string GetDisplayName(void)
Answers with this device's display name.
Definition: ntv2card.cpp:84
NTV2Player::StartProducerThread
virtual void StartProducerThread(void)
Starts my producer thread.
Definition: ntv2player.cpp:652
AJAStatus
AJAStatus
Definition: types.h:365
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:6707
DeviceCapabilities::CanDoPlayback
bool CanDoPlayback(void)
Definition: ntv2card.h:118
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:6708
DeviceCapabilities::GetMaxAudioChannels
UWord GetMaxAudioChannels(void)
Definition: ntv2card.h:176
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:26
NTV2Standard
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:153
NTV2_TestPatt_Ramp
@ NTV2_TestPatt_Ramp
Definition: ntv2testpatterngen.h:29
NTV2_VANCMODE_OFF
@ NTV2_VANCMODE_OFF
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3713
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: ntv2audio.cpp:573
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:183
AJATimeBase
Definition: timebase.h:18
kNumAudioChannelsMax
@ kNumAudioChannelsMax
Definition: ntv2audiodefines.h:44
AJA_STATUS_FEATURE
@ AJA_STATUS_FEATURE
Definition: types.h:380
AJA_STATUS_FAIL
@ AJA_STATUS_FAIL
Definition: types.h:369
DeviceCapabilities::GetNumVideoOutputs
UWord GetNumVideoOutputs(void)
Definition: ntv2card.h:214
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
NTV2_TestPatt_FlatField
@ NTV2_TestPatt_FlatField
Definition: ntv2testpatterngen.h:33
kRegRP188InOut2DBB
@ kRegRP188InOut2DBB
Definition: ntv2publicinterface.h:138
NTV2FrameData::fVideoBuffer
NTV2Buffer fVideoBuffer
Host video buffer.
Definition: ntv2democommon.h:82
AUTOCIRCULATE_STATUS
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
Definition: ntv2publicinterface.h:7105
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:550
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
DeviceCapabilities::CanDo2110
bool CanDo2110(void)
Definition: ntv2card.h:74
AUTOCIRCULATE_TRANSFER::SetOutputTimeCodes
bool SetOutputTimeCodes(const NTV2TimeCodes &inValues)
Intended for playout, replaces the contents of my acOutputTimeCodes member.
Definition: ntv2publicinterface.cpp:2633
CNTV2DemoCommon::SetDefaultPageSize
static size_t SetDefaultPageSize(void)
Definition: ntv2democommon.cpp:1505
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
CNTV2Card::SetReference
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=false)
Sets the device's clock reference source. See Device Clocking and Synchronization for more informatio...
Definition: ntv2register.cpp:1486
NTV2Player::SetUpAudio
virtual AJAStatus SetUpAudio(void)
Performs all audio setup.
Definition: ntv2player.cpp:251
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:77
AJAProcess::GetPid
static uint64_t GetPid()
Definition: process.cpp:35
NTV2_OUTPUTDESTINATION_SDI6
@ NTV2_OUTPUTDESTINATION_SDI6
Definition: ntv2enums.h:1285
CNTV2Card::Connect
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=false)
Connects the given widget signal input (sink) to the given widget signal output (source).
Definition: ntv2regroute.cpp:87
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:1642
UWord
uint16_t UWord
Definition: ajatypes.h:244
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:7904
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:35
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:2606
GetCSCInputXptFromChannel
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
Definition: ntv2signalrouter.cpp:775
CNTV2Card::DMABufferLock
virtual bool DMABufferLock(const NTV2Buffer &inBuffer, bool inMap=false, bool inRDMA=false)
Page-locks the given host buffer to reduce transfer time and CPU usage of DMA transfers.
Definition: ntv2dma.cpp:487
IsVideoFormatA
bool IsVideoFormatA(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5490
CNTV2Card::AutoCirculateStop
virtual bool AutoCirculateStop(const NTV2Channel inChannel, const bool inAbort=false)
Stops AutoCirculate for the given channel, and releases the on-device frame buffers that were allocat...
Definition: ntv2autocirculate.cpp:519
NTV2_TestPatt_ColorBars75
@ NTV2_TestPatt_ColorBars75
Definition: ntv2testpatterngen.h:28
DeviceCapabilities::GetNumHDMIVideoOutputs
UWord GetNumHDMIVideoOutputs(void)
Definition: ntv2card.h:200
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:497
NTV2_TASK_MODE_INVALID
@ NTV2_TASK_MODE_INVALID
Definition: ntv2publicinterface.h:4262
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1228
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:7941
CRP188
Definition: ntv2rp188.h:55
AUTOCIRCULATE_STATUS::GetEndFrame
uint16_t GetEndFrame(void) const
Definition: ntv2publicinterface.h:7196
kRegRP188InOut1DBB
@ kRegRP188InOut1DBB
Definition: ntv2publicinterface.h:103
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:671
AJA_STATUS_UNSUPPORTED
@ AJA_STATUS_UNSUPPORTED
Definition: types.h:381
gAmplitudes
static const double gAmplitudes[]
Definition: ntv2player.cpp:52
NTV2_INPUT_CROSSPOINT_INVALID
@ NTV2_INPUT_CROSSPOINT_INVALID
Definition: ntv2enums.h:2822
CNTV2Card::SetHDMIOutAudioRate
virtual bool SetHDMIOutAudioRate(const NTV2AudioRate inNewValue)
Sets the HDMI output's audio rate.
Definition: ntv2audio.cpp:1082
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:190
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:1022
NTV2TestPatternGen
The NTV2 test pattern generator.
Definition: ntv2testpatterngen.h:67
AJAAncDataType_HDR_SDR
@ AJAAncDataType_HDR_SDR
Definition: ancillarydata.h:57
CNTV2DriverInterface::GetDescription
virtual std::string GetDescription(void) const
Definition: ntv2driverinterface.h:574
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:821
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:373
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5579
CNTV2Card::SetSDIOutputStandard
virtual bool SetSDIOutputStandard(const UWord inOutputSpigot, const NTV2Standard inValue)
Sets the SDI output spigot's video standard.
Definition: ntv2register.cpp:3216
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:5490
NTV2TCIndexesConstIter
NTV2TCIndexes::const_iterator NTV2TCIndexesConstIter
A handy const interator for iterating over an NTV2TCIndexes set.
Definition: ntv2publicinterface.h:6795
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:805
PlayerConfig::fDeviceSpec
std::string fDeviceSpec
The AJA device to use.
Definition: ntv2democommon.h:313
kRegRP188InOut4DBB
@ kRegRP188InOut4DBB
Definition: ntv2publicinterface.h:367
NTV2Player::SetUpTestPatternBuffers
virtual AJAStatus SetUpTestPatternBuffers(void)
Creates my test pattern buffers.
Definition: ntv2player.cpp:340
TCDBG
#define TCDBG(_expr_)
Definition: ntv2player.cpp:28
AJA_STATUS_BAD_PARAM
@ AJA_STATUS_BAD_PARAM
Definition: types.h:379
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
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:745
NTV2_RP188
This struct replaces the old RP188_STRUCT.
Definition: ntv2publicinterface.h:6705
gNumFrequencies
static const ULWord gNumFrequencies(sizeof(gFrequencies)/sizeof(double))
GetRP188RegisterForOutput
ULWord GetRP188RegisterForOutput(const NTV2OutputDestination inOutputDest)
Definition: ntv2player.cpp:787
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:7191
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:808
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:665
DeviceCapabilities::GetNumCSCs
UWord GetNumCSCs(void)
Definition: ntv2card.h:190
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: ntv2audio.cpp:630
NTV2Player::NTV2Player
NTV2Player(const PlayerConfig &inConfig)
Constructs me using the given configuration settings.
Definition: ntv2player.cpp:56
NTV2_AudioChannel1_8
@ NTV2_AudioChannel1_8
This selects audio channels 1 thru 8.
Definition: ntv2enums.h:3242
NTV2Player::ConsumeFrames
virtual void ConsumeFrames(void)
My consumer thread that repeatedly plays frames using AutoCirculate (until quit).
Definition: ntv2player.cpp:508
NTV2_OUTPUTDESTINATION_SDI7
@ NTV2_OUTPUTDESTINATION_SDI7
Definition: ntv2enums.h:1286
NTV2Player::Quit
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2player.cpp:86
DeviceCapabilities::CanDoFrameStore1Display
bool CanDoFrameStore1Display(void)
Definition: ntv2card.h:100
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:229
DeviceCapabilities::CanDoMultiFormat
bool CanDoMultiFormat(void)
Definition: ntv2card.h:113
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:1024
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:295
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:34
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:1024
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:6192
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
PLNOTE
#define PLNOTE(_xpr_)
Definition: ntv2democommon.h:36
NTV2Player::Run
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2player.cpp:472
AJA_STATUS_OPEN
@ AJA_STATUS_OPEN
Definition: types.h:375
AJATimeBase::FramesToSeconds
double FramesToSeconds(int64_t frames) const
Definition: timebase.cpp:197
CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:1000
CNTV2Card::SetFrameBufferFormat
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=true, 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:1828
kRegRP188InOut7DBB
@ kRegRP188InOut7DBB
Definition: ntv2publicinterface.h:556
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:149
NTV2_TestPatt_LineSweep
@ NTV2_TestPatt_LineSweep
Definition: ntv2testpatterngen.h:31
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:252
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:183
PLFAIL
#define PLFAIL(_xpr_)
Definition: ntv2democommon.h:34
CNTV2DemoCommon::GetAJAPixelFormat
static AJA_PixelFormat GetAJAPixelFormat(const NTV2FrameBufferFormat inFormat)
Definition: ntv2democommon.cpp:1054
BIT
#define BIT(_x_)
Definition: ajatypes.h:654
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5578
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition: types.h:358
NTV2_AUDIO_RATE_INVALID
@ NTV2_AUDIO_RATE_INVALID
Definition: ntv2enums.h:1879
BUFFER_PAGE_ALIGNED
static const bool BUFFER_PAGE_ALIGNED(true)
CNTV2Card::EnableChannel
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.
Definition: ntv2register.cpp:2113
DeviceCapabilities::CanDoFrameBufferFormat
bool CanDoFrameBufferFormat(const NTV2PixelFormat inPF)
Definition: ntv2card.h:231
CNTV2Card::SetHDMIOutAudioFormat
virtual bool SetHDMIOutAudioFormat(const NTV2AudioFormat inNewValue)
Sets the HDMI output's audio format.
Definition: ntv2audio.cpp:1094
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:7930
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:754
NTV2FormatDescriptor::IsValid
bool IsValid(void) const
Definition: ntv2formatdescriptor.h:94
PLINFO
#define PLINFO(_xpr_)
Definition: ntv2democommon.h:37
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:781
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:4217
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:4261
kRegRP188InOut6DBB
@ kRegRP188InOut6DBB
Definition: ntv2publicinterface.h:546
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:208
kRegRP188InOut8DBB
@ kRegRP188InOut8DBB
Definition: ntv2publicinterface.h:566
NTV2_AUDIOSYSTEM_INVALID
@ NTV2_AUDIOSYSTEM_INVALID
Definition: ntv2enums.h:3821
timebase.h
Declares the AJATimeBase class.