AJA NTV2 SDK  18.1.0.2439
NTV2 SDK 18.1.0.2439
ntv2llburn.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2llburn.h"
9 #include "ntv2endian.h"
10 #include "ntv2formatdescriptor.h"
11 #include "ajabase/common/types.h"
13 #include <iostream>
14 
15 using namespace std;
16 
17 // Override NTV2_ANCSIZE_MAX for testing new HANC insertion feature
18 #if defined(NTV2_ANCSIZE_MAX)
19  #undef NTV2_ANCSIZE_MAX
20 #endif
21 #define NTV2_ANCSIZE_MAX (256 * 1024) // Super Size Me! 0x40000
22 
23 
24 const uint32_t kAppSignature (NTV2_FOURCC('L','l','b','u'));
25 const uint32_t kNumFrameBuffers (2); // ping-pong between frames N and N+1 (determined by querying Auto-Circulate for available frame-buffers)
26 
27 #define AsULWordPtr(_p_) reinterpret_cast<ULWord*>(_p_)
28 #define AsCU8Ptr(_p_) reinterpret_cast<const uint8_t*>(_p_)
29 
30 
32  : mConfig (inConfig),
33  mRunThread (AJAThread()),
35  mSavedTaskMode (NTV2_DISABLE_TASKS),
36  mOutputDest (NTV2_OUTPUTDESTINATION_INVALID),
37  mAudioSystem (NTV2_AUDIOSYSTEM_1),
38  mGlobalQuit (false),
39  mAudioInLastAddress (0),
40  mAudioOutLastAddress (0),
41  mFramesProcessed (0),
42  mFramesDropped (0)
43 {
44 } // constructor
45 
46 
48 {
49  // Stop my capture and playout threads, then destroy them...
50  Quit();
51 
52  // Unsubscribe from input vertical event...
54 
55  if (!mConfig.fDoMultiFormat)
56  {
57  mDevice.SetTaskMode (mSavedTaskMode); // Restore prior service level
58  mDevice.ReleaseStreamForApplication (kAppSignature, static_cast<int32_t>(AJAProcess::GetPid())); // Release the device
59  }
60 
61  // Don't leave the audio system active after we exit
62  mDevice.StopAudioInput (mAudioSystem);
63  mDevice.StopAudioOutput (mAudioSystem);
64 
65 } // destructor
66 
67 
68 void NTV2LLBurn::Quit (void)
69 {
70  // Set the global 'quit' flag, and wait for the thread to go inactive...
71  mGlobalQuit = true;
72 
73  while (mRunThread.Active())
74  AJATime::Sleep(10);
75 
76 } // Quit
77 
78 
80 {
82 
83  // Open the device...
85  { if (aja::lower(mConfig.fDeviceSpec) != "list" && mConfig.fDeviceSpec != "?")
86  cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl;
87  return AJA_STATUS_OPEN;
88  }
89  if (!mDevice.IsDeviceReady (false))
90  {cerr << "## ERROR: '" << mDevice.GetDescription() << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
91 
92  // Burn requires device capable of capturing and playing video...
93  if (!(mDevice.features().CanDoCapture() && mDevice.features().CanDoPlayback()))
94  {cerr << "## ERROR: '" << mDevice.GetDescription() << "' cannot both capture & play video" << endl; return AJA_STATUS_BAD_PARAM; }
95 
96  ULWord appSignature (0);
97  int32_t appPID (0);
98  mDevice.GetTaskMode(mSavedTaskMode); // Save the current device state
99  mDevice.GetStreamingApplication (appSignature, appPID); // Who currently "owns" the device?
100  if (!mConfig.fDoMultiFormat)
101  {
102  if (!mDevice.AcquireStreamForApplication (kAppSignature, static_cast<int32_t>(AJAProcess::GetPid())))
103  {
104  cerr << "## ERROR: Unable to acquire '" << mDevice.GetDescription() << "' because another app (pid " << appPID << ") owns it" << endl;
105  return AJA_STATUS_BUSY; // Some other app is using the device
106  }
107  mDevice.ClearRouting(); // Clear the current device routing (since I "own" the device)
108  }
109  mDevice.SetTaskMode(NTV2_OEM_TASKS); // Set the OEM service level
110 
111  // Configure the SDI relays if present
112  if (mDevice.features().HasSDIRelays())
113  {
114  // Note that if the board's jumpers are not set in the position
115  // to enable the watchdog timer, these calls will have no effect.
116  mDevice.SetSDIWatchdogEnable(true, 0); // SDI 1/2
117  mDevice.SetSDIWatchdogEnable(true, 1); // SDI 3/4
118 
119  // Set timeout delay to 2 seconds expressed in multiples of 8 ns
120  // and take the relays out of bypass
121  mDevice.SetSDIWatchdogTimeout (2 * 125000000);
122  mDevice.KickSDIWatchdog ();
123 
124  // Give the mechanical relays some time to switch
125  AJATime::Sleep (500);
126  }
127 
128  if (mConfig.WithHanc())
129  {
130  // Transfer audio using HANC extractor/inserter
131  mConfig.fWithAnc = true;
132  mConfig.fSuppressAudio = true;
133  }
134 
135  if (mConfig.WithAnc() && !mDevice.features().CanDoCustomAnc())
136  {cerr << "## WARNING: Device doesn't support custom Anc, '-a -h' option ignored" << endl; mConfig.fWithAnc = false; mConfig.fWithHanc = false;}
137 
138  // Set up the video and audio...
139  status = SetupVideo();
140  if (AJA_FAILURE(status))
141  return status;
142 
143  status = SetupAudio();
144  if (AJA_FAILURE(status))
145  return status;
146 
147  // Set up the circular buffers...
148  status = SetupHostBuffers();
149  if (AJA_FAILURE(status))
150  return status;
151 
153  mDevice.SetLTCInputEnable(true); // Enable analog LTC input (some LTC inputs are shared with reference input)
154 
155  // Lastly, prepare my AJATimeCodeBurn instance...
156  mTCBurner.RenderTimeCodeFont (CNTV2DemoCommon::GetAJAPixelFormat (mConfig.fPixelFormat), mFormatDesc.numPixels, mFormatDesc.numLines);
157  // Ready to go...
158  if (mConfig.IsVerbose())
159  { cerr << mConfig
160  << "Device Description: " << mDevice.GetDescription() << endl
161  << endl;
162  }
163  BURNINFO("Configuration: " << mConfig);
164  return AJA_STATUS_SUCCESS;
165 
166 } // Init
167 
168 
170 {
171  const uint16_t numFrameStores (mDevice.features().GetNumFrameStores());
172  const uint16_t numSDIOutputs (mDevice.features().GetNumVideoOutputs());
173 
174  // Can the device support the desired input source?
175  if (!mDevice.features().CanDoInputSource(mConfig.fInputSource))
176  {cerr << "## ERROR: This device cannot receive input from the specified source" << endl; return AJA_STATUS_BAD_PARAM;}
177 
178  // Pick an input NTV2Channel from the input source, and enable its frame buffer...
180  mDevice.EnableChannel (mConfig.fInputChannel); // Enable the input frame buffer
181 
182  // Pick an appropriate output NTV2Channel, and enable its frame buffer...
183  switch (mConfig.fInputSource)
184  {
185  case NTV2_INPUTSOURCE_SDI1: mConfig.fOutputChannel = numSDIOutputs < 3 || numFrameStores == 2 || numFrameStores > 4 ? NTV2_CHANNEL2 : NTV2_CHANNEL3; break;
186 
188  case NTV2_INPUTSOURCE_SDI2: mConfig.fOutputChannel = numFrameStores > 4 ? NTV2_CHANNEL3 : NTV2_CHANNEL4; break;
189 
191  case NTV2_INPUTSOURCE_SDI3: mConfig.fOutputChannel = NTV2_CHANNEL4; break;
192 
194  case NTV2_INPUTSOURCE_SDI4: mConfig.fOutputChannel = numFrameStores > 4 ? NTV2_CHANNEL5 : NTV2_CHANNEL3; break;
195 
196  case NTV2_INPUTSOURCE_SDI5: mConfig.fOutputChannel = NTV2_CHANNEL6; break;
197  case NTV2_INPUTSOURCE_SDI6: mConfig.fOutputChannel = NTV2_CHANNEL7; break;
198  case NTV2_INPUTSOURCE_SDI7: mConfig.fOutputChannel = NTV2_CHANNEL8; break;
199  case NTV2_INPUTSOURCE_SDI8: mConfig.fOutputChannel = NTV2_CHANNEL7; break;
200 
202  case NTV2_INPUTSOURCE_HDMI1: mConfig.fOutputChannel = numFrameStores < 3 ? NTV2_CHANNEL2 : NTV2_CHANNEL3;
203  mAudioSystem = NTV2_AUDIOSYSTEM_2;
204  break;
205 // default:
206  case NTV2_INPUTSOURCE_INVALID: cerr << "## ERROR: Bad input source" << endl; return AJA_STATUS_BAD_PARAM;
207  }
208 
209  // Check to see if desired input/output channels are in use by Auto-Circulate, i.e. another Auto-Circulate-based ntv2 demo is running.
210  AUTOCIRCULATE_STATUS acStatus;
211  if (!mDevice.AutoCirculateInitForInput( mConfig.fInputChannel,
215  | (mDevice.features().CanDoCustomAnc() ? AUTOCIRCULATE_WITH_ANC : 0)))
216  {
217  cerr << "Failed to init " << NTV2ChannelToString(mConfig.fInputChannel) << " for input. Is channel in-use by Auto-Circulate?" << endl;
218  return AJA_STATUS_FAIL;
219  }
220  if (!mDevice.AutoCirculateGetStatus(mConfig.fInputChannel, acStatus))
221  {
222  cerr << "Error getting Auto-Circulate status for input channel " << NTV2ChannelToString(mConfig.fInputChannel) << endl;
223  return AJA_STATUS_FAIL;
224  }
225  mInputStartFrame = acStatus.acStartFrame;
226  mInputEndFrame = acStatus.acEndFrame;
227 
228  if (!mDevice.AutoCirculateInitForOutput( mConfig.fOutputChannel,
232  {
233  cerr << "Failed to init " << NTV2ChannelToString(mConfig.fOutputChannel) << " for output. Is channel in-use by Auto-Circulate?" << endl;
234  return AJA_STATUS_FAIL;
235  }
236  if (!mDevice.AutoCirculateGetStatus(mConfig.fOutputChannel, acStatus))
237  {
238  cerr << "Error getting Auto-Circulate status for output channel " << NTV2ChannelToString(mConfig.fOutputChannel) << endl;
239  return AJA_STATUS_FAIL;
240  }
241  mOutputStartFrame = acStatus.acStartFrame;
242  mOutputEndFrame = acStatus.acEndFrame;
243 
244  mDevice.AutoCirculateStop(mConfig.fInputChannel);
245  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
246 
247  bool isTransmit (false);
248  if (mDevice.features().HasBiDirectionalSDI() // If device has bidirectional SDI connectors...
249  && NTV2_INPUT_SOURCE_IS_SDI(mConfig.fInputSource) // ...and desired input source is SDI...
250  && mDevice.GetSDITransmitEnable (mConfig.fInputChannel, isTransmit) // ...and GetSDITransmitEnable succeeds...
251  && isTransmit) // ...and input is set to "transmit"...
252  {
253  mDevice.SetSDITransmitEnable (mConfig.fInputChannel, false); // ...then disable transmit mode...
254  mDevice.WaitForInputVerticalInterrupt(mConfig.fInputChannel, 20); // ...and give the device a dozen frames or so to lock to the input signal
255  } // if input SDI connector needs to switch from transmit mode
256 
257  if (mConfig.WithAnc() && !NTV2_INPUT_SOURCE_IS_SDI(mConfig.fInputSource))
258  cerr << "## WARNING: Non-SDI input source, no Anc capture possible" << endl;
259 
260  // Determine the input video signal format, and set the device's reference source to that input...
261  mVideoFormat = mDevice.GetInputVideoFormat (mConfig.fInputSource);
262  if (mVideoFormat == NTV2_FORMAT_UNKNOWN)
263  {
264  cerr << "## ERROR: The specified input has no signal, or the device cannot handle the signal format" << endl;
265  return AJA_STATUS_NOINPUT; // Sorry, can't handle this format
266  }
267 
269  mAudioSystem = ::NTV2InputSourceToAudioSystem (mConfig.fInputSource);
270  mOutputDest = ::NTV2ChannelToOutputDestination (mConfig.fOutputChannel);
271 
272  if (mDevice.features().HasBiDirectionalSDI() // If device has bidirectional SDI connectors...
273  && NTV2_OUTPUT_DEST_IS_SDI(mOutputDest)) // ...and output destination is SDI...
274  mDevice.SetSDITransmitEnable (mConfig.fOutputChannel, true); // ...then enable transmit mode
275 
276  if (mConfig.WithAnc() && !NTV2_OUTPUT_DEST_IS_SDI(mOutputDest))
277  cerr << "## WARNING: Non-SDI output destination, no Anc playout possible" << endl;
278 
279  mDevice.EnableChannel (mConfig.fInputChannel); // Enable the input frame buffer
280  mDevice.EnableChannel (mConfig.fOutputChannel); // Enable the output frame buffer
281 
282  if (mDevice.features().CanDoMultiFormat() && mConfig.fDoMultiFormat)
283  mDevice.SetMultiFormatMode (true);
284  else if (mDevice.features().CanDoMultiFormat())
285  mDevice.SetMultiFormatMode (false);
286 
287  // Set the input channel format to the detected input format...
288  mDevice.SetVideoFormat (mVideoFormat, false, false, mDevice.features().CanDoMultiFormat() ? mConfig.fInputChannel : NTV2_CHANNEL1);
289  if (mDevice.features().CanDoMultiFormat()) // If device supports multiple formats per-channel...
290  mDevice.SetVideoFormat (mVideoFormat, false, false, mConfig.fOutputChannel); // ...then also set the output channel format to the detected input format
291 
292  // Set the frame buffer pixel format for both channels on the device, assuming it
293  // supports that pixel format . . . otherwise default to 8-bit YCbCr...
294  if (!mDevice.features().CanDoFrameBufferFormat(mConfig.fPixelFormat))
296 
297  // Set the pixel format for both device frame buffers...
298  mDevice.SetFrameBufferFormat (mConfig.fInputChannel, mConfig.fPixelFormat);
299  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mConfig.fPixelFormat);
300 
301  // Subscribe to the interrupt events to be used...
302  mDevice.SubscribeInputVerticalEvent (mConfig.fInputChannel);
304 
305  // Set the Frame Store modes
306  mDevice.SetMode (mConfig.fInputChannel, NTV2_MODE_CAPTURE);
307  mDevice.SetMode (mConfig.fOutputChannel, NTV2_MODE_DISPLAY);
308 
309  // Set up the device signal routing, and both playout and capture AutoCirculate...
312 
313  // Now that newer AJA devices can capture/play anc data from separate buffers,
314  // there's no need to enable VANC frame geometries...
315  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fInputChannel);
316  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
317  if (::Is8BitFrameBufferFormat(mConfig.fPixelFormat))
318  { // 8-bit FBFs: since not using VANC geometries, disable bit shift...
321  }
322 
323  // Be sure the RP188 mode for the SDI input (expressed as an NTV2Channel),
324  // is set to NTV2_RP188_INPUT...
325  bool isBypassEnabled (false);
326  mDevice.IsRP188BypassEnabled (mConfig.fInputChannel, isBypassEnabled);
327  if (isBypassEnabled)
328  mDevice.DisableRP188Bypass (mConfig.fInputChannel);
329  mDevice.SetRP188Mode (mConfig.fInputChannel, NTV2_RP188_INPUT);
330  mDevice.SetRP188SourceFilter (mConfig.fInputChannel, 0); // 0=LTC 1=VITC1 2=VITC2
331 
332  // Make sure the RP188 mode for all SDI outputs is NTV2_RP188_OUTPUT, and that their RP188
333  // registers are not bypassed (i.e. timecode isn't sourced from an SDI input, as for E-E mode)...
334  NTV2_ASSERT(!mRP188Outputs.empty());
335  for (NTV2ChannelSetConstIter iter(mRP188Outputs.begin()); iter != mRP188Outputs.end(); ++iter)
336  {
337  mDevice.SetRP188Mode (*iter, NTV2_RP188_OUTPUT);
338  mDevice.DisableRP188Bypass (*iter);
339  }
340 
341  // Tell the hardware which buffers to use until the main worker thread runs
342  mDevice.SetInputFrame (mConfig.fInputChannel, 0);
343  mDevice.SetOutputFrame(mConfig.fOutputChannel, 2);
344 
345  // Now that the video is set up, get information about the current frame geometry...
346  mFormatDesc = NTV2FormatDescriptor (mVideoFormat, mConfig.fPixelFormat);
347  return AJA_STATUS_SUCCESS;
348 
349 } // SetupVideo
350 
351 
353 {
354  // Have the audio subsystem capture audio from the designated input source...
356 
357  // It's best to use all available audio channels...
358  mDevice.SetNumberAudioChannels (mDevice.features().GetMaxAudioChannels(), mAudioSystem);
359 
360  // Assume 48kHz PCM...
361  mDevice.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
362 
363  // 4MB device audio buffers work best...
364  mDevice.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
365 
366  // Set up the output audio embedders...
367  if (mDevice.features().GetNumAudioSystems() > 1)
368  {
369  // Some devices, like the Kona1, have 2 FrameStores but only 1 SDI output,
370  // which makes mConfig.fOutputChannel == NTV2_CHANNEL2, but need SDIoutput to be NTV2_CHANNEL1...
371  UWord SDIoutput(mConfig.fOutputChannel);
372  if (SDIoutput >= mDevice.features().GetNumVideoOutputs())
373  SDIoutput = mDevice.features().GetNumVideoOutputs() - 1;
374  mDevice.SetSDIOutputAudioSystem (NTV2Channel(SDIoutput), mAudioSystem);
375  }
376 
377  //
378  // Loopback mode plays whatever audio appears in the input signal when it's
379  // connected directly to an output (i.e., "end-to-end" mode). If loopback is
380  // left enabled, the video will lag the audio as video frames get briefly delayed
381  // in our ring buffer. Audio, therefore, needs to come out of the (buffered) frame
382  // data being played, so loopback must be turned off...
383  //
384  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, mAudioSystem);
385 
386  // Reset both the input and output sides of the audio system so that the buffer
387  // pointers are reset to zero and inhibited from advancing.
388  mDevice.StopAudioOutput (mAudioSystem);
389  mDevice.StopAudioInput (mAudioSystem);
390 
391  // Ensure that the audio system will capture samples when the reset is removed
392  mDevice.SetAudioCaptureEnable (mAudioSystem, true);
393 
394  return AJA_STATUS_SUCCESS;
395 
396 } // SetupAudio
397 
398 // Fixes internal issue #921
399 // NTV2 device audio systems wrap after reading/writing 65,280 samples of 16-channel audio (or 130,560 samples of 8-channel audio)...
400 // i.e. after reading/writing 4,177,920 bytes max.
401 // A 4MB buffer (4,194,304 bytes) wastes 16K (16,384 bytes), but is page-sized, and readily page-aligned on most host OSes.
402 #define HOST_AUDIO_BUFFER_SIZE 4194304
403 
405 {
406  CNTV2DemoCommon::SetDefaultPageSize(); // Set host-specific page size
407 
408  // Allocate and add each in-host buffer to my member variables.
409  // DMA performance can be accelerated slightly by using page-aligned video buffers...
410  mpHostVideoBuffer.Allocate(mFormatDesc.GetVideoWriteSize(ULWord(NTV2Buffer::DefaultPageSize())), true);
411  mpHostAudioBuffer.Allocate(HOST_AUDIO_BUFFER_SIZE, /*page-aligned*/true);
412  mpHostF1AncBuffer.Allocate(mConfig.WithAnc() ? NTV2_ANCSIZE_MAX : 0, /*pageAligned*/true);
413  mpHostF2AncBuffer = NTV2Buffer(mConfig.WithAnc() ? NTV2_ANCSIZE_MAX : 0);
414 
415  if (!mpHostVideoBuffer || !mpHostAudioBuffer || (mConfig.WithAnc() && !mpHostF1AncBuffer) || (mConfig.WithAnc() && !mpHostF2AncBuffer))
416  {
417  cerr << "## ERROR: Unable to allocate host buffer(s)" << endl;
418  return AJA_STATUS_MEMORY;
419  }
420 
421  return AJA_STATUS_SUCCESS;
422 
423 } // SetupHostBuffers
424 
425 
427 {
428  const NTV2OutputCrosspointID inputOutputXpt (::GetInputSourceOutputXpt (mConfig.fInputSource));
430 
431  if (::IsRGBFormat (mConfig.fPixelFormat))
432  {
433  // If the frame buffer is configured for RGB pixel format, incoming YUV must be converted.
434  // This routes the video signal from the input through a color space converter before
435  // connecting to the RGB frame buffer...
436  const NTV2InputCrosspointID cscVideoInputXpt (::GetCSCInputXptFromChannel (mConfig.fInputChannel));
437  const NTV2OutputCrosspointID cscOutputXpt (::GetCSCOutputXptFromChannel (mConfig.fInputChannel, false, true)); // false=video, true=RGB
438 
439  mDevice.Connect (cscVideoInputXpt, inputOutputXpt); // Connect the CSC's video input to the input spigot's output
440  mDevice.Connect (fbInputXpt, cscOutputXpt); // Connect the frame store's input to the CSC's output
441  }
442  else
443  mDevice.Connect (fbInputXpt, inputOutputXpt); // Route the YCbCr signal directly from the input to the frame buffer's input
444 
445 } // RouteInputSignal
446 
447 
449 {
450  const NTV2InputCrosspointID outputInputXpt (::GetOutputDestInputXpt (mOutputDest));
452  NTV2OutputCrosspointID outputXpt (fbOutputXpt);
453 
454  mRP188Outputs.clear();
455  mRP188Outputs.insert(mConfig.fOutputChannel);
456  if (::IsRGBFormat (mConfig.fPixelFormat))
457  {
458  const NTV2OutputCrosspointID cscVidOutputXpt (::GetCSCOutputXptFromChannel (mConfig.fOutputChannel)); // Use CSC's YUV video output
459  const NTV2InputCrosspointID cscVidInputXpt (::GetCSCInputXptFromChannel (mConfig.fOutputChannel));
460 
461  mDevice.Connect (cscVidInputXpt, fbOutputXpt); // Connect the CSC's video input to the frame store's output
462  mDevice.Connect (outputInputXpt, cscVidOutputXpt); // Connect the SDI output's input to the CSC's video output
463  outputXpt = cscVidOutputXpt;
464  }
465  else
466  mDevice.Connect (outputInputXpt, outputXpt);
467 
468  if (!mConfig.fDoMultiFormat)
469  {
470  // Route all SDI outputs to the outputXpt...
471  const NTV2Channel startNum (NTV2_CHANNEL1);
472  const NTV2Channel endNum (NTV2Channel(mDevice.features().GetNumVideoChannels()));
473  NTV2WidgetID outputWidgetID (NTV2_WIDGET_INVALID);
474 
475  for (NTV2Channel chan(startNum); chan < endNum; chan = NTV2Channel(chan+1))
476  {
477  mDevice.SetRP188SourceFilter (chan, 0); // Set all SDI spigots to capture embedded LTC (0==LTC 1==VITC1 2==VITC2)
478  if (chan == mConfig.fInputChannel || chan == mConfig.fOutputChannel)
479  continue; // Skip the input & output channel, already routed
480  mRP188Outputs.insert(chan); // Add this SDI spigot to those we'll push timecode into
481  if (mDevice.features().HasBiDirectionalSDI())
482  mDevice.SetSDITransmitEnable (chan, true);
483  if (CNTV2SignalRouter::GetWidgetForInput (::GetSDIOutputInputXpt (chan, mDevice.features().CanDoDualLink()), outputWidgetID))
484  if (mDevice.features().CanDoWidget(outputWidgetID))
485  mDevice.Connect (::GetSDIOutputInputXpt(chan), outputXpt);
486  } // for each output spigot
487 
488  // If HDMI and/or analog video outputs are available, route them, too...
489  if (mDevice.features().CanDoWidget(NTV2_WgtHDMIOut1))
490  mDevice.Connect (NTV2_XptHDMIOutInput, outputXpt); // Route the output signal to the HDMI output
491  if (mDevice.features().CanDoWidget(NTV2_WgtHDMIOut1v2))
492  mDevice.Connect (NTV2_XptHDMIOutQ1Input, outputXpt); // Route the output signal to the HDMI output
493  if (mDevice.features().CanDoWidget(NTV2_WgtAnalogOut1))
494  mDevice.Connect (NTV2_XptAnalogOutInput, outputXpt); // Route the output signal to the Analog output
495  if (mDevice.features().CanDoWidget(NTV2_WgtSDIMonOut1))
496  mDevice.Connect (::GetSDIOutputInputXpt (NTV2_CHANNEL5), outputXpt); // Route the output signal to the SDI monitor output
497  }
498 
499 } // RouteOutputSignal
500 
501 
503 {
504  // Start the main worker thread...
505  StartRunThread ();
506 
507  return AJA_STATUS_SUCCESS;
508 
509 } // Run
510 
511 
513 
514 // This is where we will start the worker thread
516 {
517  // Create and start the worker thread...
518  mRunThread.Attach(RunThreadStatic, this);
520  mRunThread.Start();
521 
522 } // StartRunThread
523 
524 
525 // The worker thread function
526 void NTV2LLBurn::RunThreadStatic (AJAThread * pThread, void * pContext) // static
527 {
528  (void) pThread;
529  // Grab the NTV2LLBurn instance pointer from the pContext parameter,
530  // then call its ProcessFrames method...
531  NTV2LLBurn * pApp (reinterpret_cast <NTV2LLBurn *> (pContext));
532  pApp->ProcessFrames ();
533 
534 } // RunThreadStatic
535 
536 
537 static const bool CLEAR_HOST_ANC_BUFFER_BEFORE_READ (false);
538 static const bool PRINT_ANC_PACKETS_AFTER_READ (false);
539 static const bool CLEAR_DEVICE_ANC_BUFFER_AFTER_READ (false);
540 static const bool REPLACE_OUTGOING_ANC_WITH_CUSTOM_PACKETS (false);
541 
542 
544 {
545  const bool doAncInput (mConfig.WithAnc() && NTV2_INPUT_SOURCE_IS_SDI(mConfig.fInputSource));
546  const bool doAncOutput (mConfig.WithAnc() && NTV2_OUTPUT_DEST_IS_SDI(mOutputDest));
547  const UWord sdiInput (UWord(::GetIndexForNTV2InputSource(mConfig.fInputSource)));
548  const UWord sdiOutput (UWord(::NTV2OutputDestinationToChannel(mOutputDest)));
549  const bool isInterlace (!NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(mVideoFormat));
550  uint32_t currentInFrame (mInputStartFrame);
551  uint32_t currentOutFrame (mOutputStartFrame);
552  uint32_t currentAudioInAddress (0);
553  uint32_t audioReadOffset (0);
554  uint32_t audioInWrapAddress (0);
555  uint32_t audioOutWrapAddress (0);
556  uint32_t audioBytesCaptured (0);
557  uint32_t ancBytesCapturedF1 (0);
558  uint32_t ancBytesCapturedF2 (0);
559  bool audioIsReset (true);
560  NTV2DIDSet savedDIDs;
561  string timeCodeString;
562 
563  const NTV2Standard videoStandard (::GetNTV2StandardFromVideoFormat(mVideoFormat));
564  const NTV2SmpteLineNumber smpteLineNumInfo (::GetSmpteLineNumber(videoStandard));
565  Bouncer<UWord> yPercent (85/*upperLimit*/, 1/*lowerLimit*/, 1/*startValue*/); // Vertically "bounces" timecode in raster
567  NTV2Buffer zeroesBuffer(mpHostF1AncBuffer.GetByteCount());
568  zeroesBuffer.Fill(ULWord64(0));
569  BURNNOTE("Thread started");
570 
571  // Save current Anc buffer capacity (to restore it later), then max it out...
572  ULWord savedF1ByteCapacity(0), savedF2ByteCapacity(0), offset(0);
573  mDevice.GetAncRegionOffsetAndSize (offset, savedF1ByteCapacity, NTV2_AncRgn_Field1);
574  mDevice.GetAncRegionOffsetAndSize (offset, savedF2ByteCapacity, NTV2_AncRgn_Field2);
576 
577  if (doAncInput)
578  {
579  // Configure extractor
580  mDevice.AncExtractInit(sdiInput, mConfig.fInputChannel);
581 
582  if (mConfig.WithHanc())
583  {
584  mDevice.AncExtractGetFilterDIDs(sdiInput, savedDIDs); // Save current ANC filter (so it can be restored later)
585 
586  // Configure ANC extractor not to filter audio
587  NTV2DIDSet dids;
588 // dids.insert(0xe0); // HD audio group 4 control
589 // dids.insert(0xe1); // HD audio group 3 control
590 // dids.insert(0xe2); // HD audio group 2 control
591 // dids.insert(0xe3); // HD audio group 1 control
592 // dids.insert(0xe4); // HD audio group 4 data
593 // dids.insert(0xe5); // HD audio group 3 data
594 // dids.insert(0xe6); // HD audio group 2 data
595 // dids.insert(0xe7); // HD audio group 1 data
596  dids.insert(0xa0); // 3G audio group 8 control
597  dids.insert(0xa1); // 3G audio group 7 control
598  dids.insert(0xa2); // 3G audio group 6 control
599  dids.insert(0xa3); // 3G audio group 5 control
600  dids.insert(0xa4); // 3G audio group 8 data
601  dids.insert(0xa5); // 3G audio group 7 data
602  dids.insert(0xa6); // 3G audio group 6 data
603  dids.insert(0xa7); // 3G audio group 5 data
604  dids.insert(0x41); // Filter vpid (inserted by sdi output)
605  dids.insert(0x60); // Filter timecode (inserted by sdi output)
606  mDevice.AncExtractSetFilterDIDs (sdiInput, dids);
607 
608  // Enable HANC extraction
609  mDevice.AncExtractSetComponents (sdiInput, true, true, true, true);
610  }
611  else
612  {
613  // Disable HANC extraction
614  mDevice.AncExtractSetComponents (sdiInput, true, true, false, false);
615  }
616 
617  // Start extractor
618  mDevice.AncExtractSetEnable (sdiInput, true);
619  }
620 
621  if (doAncOutput)
622  {
623  // Configure inserter
624  mDevice.AncInsertInit (sdiOutput, mConfig.fInputChannel);
625  mDevice.AncInsertSetComponents (sdiOutput, true, true, mConfig.WithHanc(), mConfig.WithHanc());
626  mDevice.AncInsertSetReadParams (sdiOutput, 0, 0, mConfig.fOutputChannel);
627  mDevice.AncInsertSetField2ReadParams (sdiOutput, 0, 0, mConfig.fOutputChannel);
628  }
629 
630  mDevice.SetSDIOutputAudioEnabled (::NTV2OutputDestinationToChannel(mOutputDest), mConfig.WithAudio());
631 
632  mFramesProcessed = mFramesDropped = 0; // Start with a fresh frame count
633 
634  mDevice.GetAudioReadOffset (audioReadOffset, mAudioSystem);
635  mDevice.GetAudioWrapAddress (audioOutWrapAddress, mAudioSystem);
636 
637  // Wait to make sure the next two SDK calls will be made during the same frame...
638  mDevice.WaitForInputFieldID (NTV2_FIELD0, mConfig.fInputChannel);
639  mDevice.DMAWriteAnc (0, zeroesBuffer, zeroesBuffer);
640  mDevice.DMAWriteAnc (1, zeroesBuffer, zeroesBuffer);
641  mDevice.DMAWriteAnc (2, zeroesBuffer, zeroesBuffer);
642  mDevice.DMAWriteAnc (3, zeroesBuffer, zeroesBuffer);
643 
644  // Before the main loop starts, ping-pong the buffers so the hardware will use
645  // different buffers than the ones it was using while idling...
646  currentInFrame ^= 1;
647  currentOutFrame ^= 1;
648 
649  mDevice.SetInputFrame (mConfig.fInputChannel, currentInFrame);
650  if (doAncInput)
651  mDevice.AncExtractSetWriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
652  if (doAncInput && isInterlace)
653  mDevice.AncExtractSetField2WriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
654 
655  mDevice.SetOutputFrame (mConfig.fOutputChannel, currentOutFrame);
656 
657  // Wait until the hardware starts filling the new buffers, and then start audio
658  // capture as soon as possible to match the video...
659  mDevice.WaitForInputFieldID (NTV2_FIELD0, mConfig.fInputChannel);
660  mDevice.StartAudioInput (mAudioSystem);
661 
662  mAudioInLastAddress = audioReadOffset;
663  audioInWrapAddress = audioOutWrapAddress + audioReadOffset;
664  mAudioOutLastAddress = 0;
665 
666  currentInFrame ^= 1;
667  currentOutFrame ^= 1;
668 
669  mDevice.SetInputFrame (mConfig.fInputChannel, currentInFrame);
670  if (doAncInput)
671  mDevice.AncExtractSetWriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
672  if (doAncInput && isInterlace)
673  mDevice.AncExtractSetField2WriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
674 
675  mDevice.SetOutputFrame (mConfig.fOutputChannel, currentOutFrame);
676 
677  while (!mGlobalQuit)
678  {
679  // Wait until the input has completed capturing a frame...
680  mDevice.WaitForInputFieldID (NTV2_FIELD0, mConfig.fInputChannel);
681 
682  // Flip sense of the buffers again to refer to the buffers that the hardware isn't using (i.e. the off-screen buffers)...
683  currentInFrame ^= 1;
684  currentOutFrame ^= 1;
685 
686  if (mConfig.WithAudio())
687  {
688  // Read the audio position registers as close to the interrupt as possible...
689  mDevice.ReadAudioLastIn (currentAudioInAddress, NTV2AudioSystem(mConfig.fInputChannel));
690  currentAudioInAddress &= ~0x3UL; // Force DWORD alignment
691  currentAudioInAddress += audioReadOffset;
692 
693  if (audioIsReset && mAudioOutLastAddress)
694  {
695  // Now that the audio system has some samples to play, playback can be started...
696  mDevice.StartAudioOutput (mAudioSystem);
697  audioIsReset = false;
698  }
699 
700  if (currentAudioInAddress < mAudioInLastAddress)
701  {
702  // Audio address has wrapped around the end of the buffer.
703  // Do the calculations and transfer from the last address to the end of the buffer...
704  audioBytesCaptured = audioInWrapAddress - mAudioInLastAddress;
705 
706  mDevice.DMAReadAudio (mAudioSystem, mpHostAudioBuffer, mAudioInLastAddress, audioBytesCaptured);
707 
708  // Transfer the new samples from the start of the buffer to the current address...
709  mDevice.DMAReadAudio (mAudioSystem, AsULWordPtr(mpHostAudioBuffer.GetHostAddress(audioBytesCaptured)),
710  audioReadOffset, currentAudioInAddress - audioReadOffset);
711 
712  audioBytesCaptured += currentAudioInAddress - audioReadOffset;
713  }
714  else
715  {
716  audioBytesCaptured = currentAudioInAddress - mAudioInLastAddress;
717 
718  // No wrap, so just perform a linear DMA from the buffer...
719  mDevice.DMAReadAudio (mAudioSystem, mpHostAudioBuffer, mAudioInLastAddress, audioBytesCaptured);
720  }
721 
722  mAudioInLastAddress = currentAudioInAddress;
723  } // if mConfig.WithAudio()
724 
725  // Transfer the new frame to system memory...
726  mDevice.DMAReadFrame (currentInFrame, mpHostVideoBuffer, ULWord(mpHostVideoBuffer.GetByteCount()));
727 
728  if (doAncInput)
729  { // Transfer received Anc data into my F1 & F2 buffers...
730  AJAAncillaryList capturedPackets;
731  // Read ANC bytes captured
732  mDevice.AncExtractGetField1Size (sdiInput, ancBytesCapturedF1);
733  if (isInterlace)
734  mDevice.AncExtractGetField2Size (sdiInput, ancBytesCapturedF2);
736  {
737  mpHostF1AncBuffer.Fill(0);
738  if (isInterlace)
739  mpHostF2AncBuffer.Fill(0);
740  }
741  // Read ANC data
742  mDevice.DMAReadAnc (currentInFrame, mpHostF1AncBuffer, mpHostF2AncBuffer);
743 
745  {
746  AJAAncillaryList::SetFromDeviceAncBuffers (mpHostF1AncBuffer, mpHostF2AncBuffer, capturedPackets);
747  if (capturedPackets.CountAncillaryData()) capturedPackets.Print(cerr, false); // Dump packets
748  }
750  mDevice.DMAWriteAnc (currentInFrame, zeroesBuffer, zeroesBuffer);
751  }
752 
753  // Determine which timecode value should be burned in to the video frame
754  NTV2_RP188 timecodeValue;
756  {
757  // Use the embedded input time code...
758  mDevice.GetRP188Data (mConfig.fInputChannel, timecodeValue);
759  CRP188 inputRP188Info (timecodeValue);
760  inputRP188Info.GetRP188Str(timeCodeString);
761  //cerr << "SDI" << DEC(mConfig.fTimecodeSource) << ":" << timeCodeString << ":" << timecodeValue << endl;
762  }
764  {
765  // Use the analog input time code...
766  mDevice.ReadAnalogLTCInput (mConfig.fTimecodeSource == NTV2_TCINDEX_LTC1 ? 0 : 1, timecodeValue);
767  CRP188 analogRP188Info (timecodeValue);
768  analogRP188Info.GetRP188Str(timeCodeString);
769  //cerr << "Ana" << DEC(mConfig.fTimecodeSource) << ":" << timeCodeString << ":" << timecodeValue << endl;
770  }
771  else
772  {
773  // Invent a timecode (based on the number of frames procesed)...
774  const NTV2FrameRate ntv2FrameRate (GetNTV2FrameRateFromVideoFormat (mVideoFormat));
775  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
776  const CRP188 frameRP188Info (mFramesProcessed, tcFormat);
777 
778  frameRP188Info.GetRP188Reg(timecodeValue);
779  frameRP188Info.GetRP188Str(timeCodeString);
780  //cerr << "Inv:" << timeCodeString << ":" << timecodeValue << endl;
781  }
782 
783  // "Burn" the timecode into the host buffer while we have full access to it...
784  mTCBurner.BurnTimeCode (reinterpret_cast <char *> (mpHostVideoBuffer.GetHostPointer()), timeCodeString.c_str(), yPercent.Next());
785 
786  if (mConfig.WithAudio())
787  {
788  // Calculate where the next audio samples should go in the buffer, taking wraparound into account...
789  if ((mAudioOutLastAddress + audioBytesCaptured) > audioOutWrapAddress)
790  {
791  // The audio will wrap. Transfer enough bytes to fill the buffer to the end...
792  mDevice.DMAWriteAudio (mAudioSystem, mpHostAudioBuffer, mAudioOutLastAddress, audioOutWrapAddress - mAudioOutLastAddress);
793 
794  // Now transfer the remaining bytes to the front of the buffer...
795  mDevice.DMAWriteAudio (mAudioSystem, AsULWordPtr(mpHostAudioBuffer.GetHostAddress(audioOutWrapAddress - mAudioOutLastAddress)),
796  0, audioBytesCaptured - (audioOutWrapAddress - mAudioOutLastAddress));
797 
798  mAudioOutLastAddress = audioBytesCaptured - (audioOutWrapAddress - mAudioOutLastAddress);
799  }
800  else
801  {
802  // No wrap, so just do a linear DMA from the buffer...
803  mDevice.DMAWriteAudio (mAudioSystem, mpHostAudioBuffer, mAudioOutLastAddress, audioBytesCaptured);
804 
805  mAudioOutLastAddress += audioBytesCaptured;
806  }
807  } // if mConfig.WithAudio()
808 
809  // Send the updated frame back to the board for display...
810  mDevice.DMAWriteFrame (currentOutFrame, mpHostVideoBuffer, ULWord(mpHostVideoBuffer.GetByteCount()));
811 
812  if (doAncOutput)
813  {
815  {
817  AJAAncDataLoc F2Loc(F1AncDataLoc);
818  ULWord pktData(NTV2EndianSwap32(mFramesProcessed));
819  pkt.SetDID(0xC0); pkt.SetSID(0x00); pkt.SetDataLocation(F1AncDataLoc); pkt.SetDataCoding(AJAAncDataCoding_Digital);
820  pkt.SetPayloadData(AsCU8Ptr(&pktData), 4);
821  pkts.AddAncillaryData(pkt);
822  if (isInterlace)
823  {
824  F2Loc.SetLineNumber(uint16_t(smpteLineNumInfo.GetFirstActiveLine(NTV2_FIELD1)
825  + ULWord(F1AncDataLoc.GetLineNumber())
826  - smpteLineNumInfo.GetFirstActiveLine(NTV2_FIELD0)));
827  pkt.SetDID(0xC1); pkt.SetSID(0x01); pkt.SetDataLocation(F2Loc);
828  pktData = ULWord(pktData << 16) | ULWord(pktData >> 16);
829  pkt.SetPayloadData(AsCU8Ptr(&pktData), 4);
830  pkts.AddAncillaryData(pkt);
831  }
832  //pkts.Print(cerr, true); cerr << endl;
833  pkts.GetTransmitData (mpHostF1AncBuffer, mpHostF2AncBuffer, !isInterlace, isInterlace ? smpteLineNumInfo.GetLastLine(NTV2_FIELD0)+1 : 0);
834  }
835  // Write ANC data
836  mDevice.DMAWriteAnc (currentOutFrame, mpHostF1AncBuffer, mpHostF2AncBuffer);
837  }
838 
839  // Write the output timecode (for all SDI output spigots)...
840  for (NTV2ChannelSetConstIter iter(mRP188Outputs.begin()); iter != mRP188Outputs.end(); ++iter)
841  mDevice.SetRP188Data (*iter, timecodeValue);
842 
843  // Check for dropped frames by ensuring the hardware has not started to process
844  // the buffers that were just filled....
845  uint32_t readBackIn;
846  uint32_t readBackOut;
847  mDevice.GetInputFrame (mConfig.fInputChannel, readBackIn);
848  mDevice.GetOutputFrame (mConfig.fOutputChannel, readBackOut);
849 
850  if ((readBackIn == currentInFrame) || (readBackOut == currentOutFrame))
851  {
852  cerr << "## WARNING: Drop detected: current in " << currentInFrame << ", readback in " << readBackIn
853  << ", current out " << currentOutFrame << ", readback out " << readBackOut << endl;
854  mFramesDropped++;
855  }
856  else
857  mFramesProcessed++;
858 
859  // Tell the hardware which buffers to start using at the beginning of the next frame...
860  mDevice.SetInputFrame (mConfig.fInputChannel, currentInFrame);
861  if (doAncInput)
862  mDevice.AncExtractSetWriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
863  if (doAncInput && isInterlace)
864  mDevice.AncExtractSetField2WriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
865 
866  mDevice.SetOutputFrame (mConfig.fOutputChannel, currentOutFrame);
867  if (doAncOutput)
868  mDevice.AncInsertSetReadParams (sdiOutput, currentOutFrame, ancBytesCapturedF1, mConfig.fOutputChannel);
869  if (doAncOutput && isInterlace)
870  mDevice.AncInsertSetField2ReadParams (sdiOutput, currentOutFrame, ancBytesCapturedF2, mConfig.fOutputChannel);
871 
872  // Enable ANC insertion on first output frame
873  if (mFramesProcessed == 1)
874  mDevice.AncInsertSetEnable (sdiOutput, true);
875 
876  } // loop til quit signaled
877 
878  if (doAncInput)
879  mDevice.AncExtractSetEnable (sdiInput, false); // Stop ANC extractor
880  if (doAncOutput)
881  mDevice.AncInsertSetEnable (sdiOutput, false); // Stop ANC inserter
882 
883  if (doAncInput && mConfig.WithHanc())
884  mDevice.AncExtractSetFilterDIDs (sdiInput, savedDIDs); // Restore prior ANC filtering
885 
886  // Restore previous Anc buffer capacity...
887  mDevice.AncSetFrameBufferSize (savedF1ByteCapacity, savedF2ByteCapacity);
888  BURNNOTE("Thread completed, will exit");
889 
890 } // ProcessFrames
891 
892 
894 
895 
896 void NTV2LLBurn::GetStatus (ULWord & outFramesProcessed, ULWord & outFramesDropped)
897 {
898  outFramesProcessed = mFramesProcessed;
899  outFramesDropped = mFramesDropped;
900 
901 } // GetACStatus
902 
903 
905 {
906  switch (inInputSource)
907  {
908  case NTV2_INPUTSOURCE_SDI1: return kRegRP188InOut1DBB; // reg 29
909  case NTV2_INPUTSOURCE_SDI2: return kRegRP188InOut2DBB; // reg 64
910  case NTV2_INPUTSOURCE_SDI3: return kRegRP188InOut3DBB; // reg 268
911  case NTV2_INPUTSOURCE_SDI4: return kRegRP188InOut4DBB; // reg 273
912  case NTV2_INPUTSOURCE_SDI5: return kRegRP188InOut5DBB; // reg 342
913  case NTV2_INPUTSOURCE_SDI6: return kRegRP188InOut6DBB; // reg 418
914  case NTV2_INPUTSOURCE_SDI7: return kRegRP188InOut7DBB; // reg 427
915  case NTV2_INPUTSOURCE_SDI8: return kRegRP188InOut8DBB; // reg 436
916  default: return 0;
917  } // switch on input source
918 
919 } // GetRP188DBBRegNumForInput
920 
921 
923 {
924  bool result (false);
925  const ULWord regNum (GetRP188DBBRegNumForInput(mConfig.fInputSource));
926  ULWord regValue (0);
927 
928  // Bit 16 of the RP188 DBB register will be set if there is timecode embedded in the input signal...
929  if (regNum && mDevice.ReadRegister(regNum, regValue) && regValue & BIT(16))
930  result = true;
931  return result;
932 
933 } // InputSignalHasTimecode
934 
935 
937 {
938  ULWord regMask (kRegMaskLTC1InPresent);
939  ULWord regValue (0);
940  switch (mConfig.fTimecodeSource)
941  {
942  case NTV2_TCINDEX_LTC1: break;
943  case NTV2_TCINDEX_LTC2: regMask = kRegMaskLTC2InPresent; break;
944  default: return false;
945  }
946  mDevice.ReadRegister (kRegLTCStatusControl, regValue, regMask);
947  return regValue ? true : false;
948 
949 } // AnalogLTCInputHasTimecode
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5051
ULWord GetVideoWriteSize(ULWord inPageSize=4096UL) const
The invalid video input.
Definition: ntv2enums.h:1281
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3630
virtual bool SetTaskMode(const NTV2TaskMode inMode)
Sets the device&#39;s task mode.
bool fWithAnc
If true, capture & play anc data (LLBurn). Defaults to false.
virtual AJAStatus GetTransmitData(NTV2Buffer &F1Buffer, NTV2Buffer &F2Buffer, const bool inIsProgressive=true, const uint32_t inF2StartLine=0)
Encodes my AJAAncillaryData packets into the given buffers in the default SDI Anc Buffer Data Format ...
virtual bool WaitForInputFieldID(const NTV2FieldID inFieldID, const NTV2Channel inChannel=NTV2_CHANNEL1)
Efficiently sleeps the calling thread/process until the next input VBI for the given field and input ...
Identifies the 4th HDMI video input.
Definition: ntv2enums.h:1272
Identifies the 5th SDI video input.
Definition: ntv2enums.h:1277
T Next(void)
virtual bool GetSDITransmitEnable(const NTV2Channel inChannel, bool &outEnabled)
Answers whether or not the specified SDI connector is currently acting as a transmitter (i...
virtual bool GetAudioWrapAddress(ULWord &outWrapAddress, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
For the given Audio System, answers with the wrap address, the threshold at which input/record or out...
Definition: ntv2audio.cpp:434
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3901
virtual bool SetSDIWatchdogEnable(const bool inEnable, const UWord inIndex0)
Sets the connector pair relays to be under watchdog timer control or manual control.
virtual uint32_t CountAncillaryData(void) const
Answers with the number of AJAAncillaryData objects I contain (any/all types).
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...
Declares common types used in the ajabase library.
virtual bool SetAudioLoopBack(const NTV2AudioLoopBack inMode, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Enables or disables NTV2AudioLoopBack mode for the given NTV2AudioSystem.
Definition: ntv2audio.cpp:301
Header file for the low latency NTV2Burn demonstration class.
static ULWord GetRP188DBBRegNumForInput(const NTV2InputSource inInputSource)
Definition: ntv2llburn.cpp:904
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=(0))
Sets the device&#39;s clock reference source. See Video Output Clocking & Synchronization for more inform...
virtual AJAStatus SetupHostBuffers(void)
Sets up my circular buffers.
Definition: ntv2llburn.cpp:404
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
bool Is8BitFrameBufferFormat(const NTV2FrameBufferFormat fbFormat)
Definition: ntv2utils.cpp:5456
virtual AJAStatus SetSID(const uint8_t inSID)
Sets my Secondary Data ID (SID) - (aka the Data Block Number (DBN) for "Type 1" SMPTE-291 packets)...
virtual AJAStatus SetupAudio(void)
Sets up everything I need for capturing and playing audio.
Definition: ntv2llburn.cpp:352
virtual bool AncInsertInit(const UWord inSDIOutput, const NTV2Channel inChannel=NTV2_CHANNEL_INVALID, const NTV2Standard inStandard=NTV2_STANDARD_INVALID)
Initializes the given SDI output&#39;s Anc inserter for custom Anc packet insertion. (Call NTV2DeviceCanD...
Definition: ntv2anc.cpp:303
Identifies the 2nd HDMI video input.
Definition: ntv2enums.h:1270
virtual bool AncSetFrameBufferSize(const ULWord inF1Size, const ULWord inF2Size)
Sets the capacity of the SDI ANC or HDMI AUX buffers in device frame memory. (Call NTV2DeviceCanDoCus...
Definition: ntv2anc.cpp:123
#define BIT(_x_)
Definition: ajatypes.h:496
NTV2ChannelSet::const_iterator NTV2ChannelSetConstIter
A handy const iterator into an NTV2ChannelSet.
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=(!(0)), const bool inKeepVancSettings=(0), const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
virtual AJAStatus SetDID(const uint8_t inDataID)
Sets my Data ID (DID).
AJAStatus
Definition: types.h:380
Ancillary data found between SAV and EAV (.
virtual bool SetRP188Mode(const NTV2Channel inChannel, const NTV2_RP188Mode inMode)
Sets the current RP188 mode – NTV2_RP188_INPUT or NTV2_RP188_OUTPUT – for the given channel...
virtual bool SetAudioCaptureEnable(const NTV2AudioSystem inAudioSystem, const bool inEnable)
Enables or disables the writing of incoming audio into the given Audio System&#39;s capture buffer...
Definition: ntv2audio.cpp:1243
virtual bool IsDeviceReady(const bool inCheckValid=(0))
virtual bool AncExtractGetField1Size(const UWord inSDIInput, ULWord &outF1Size)
Answers with the number of bytes of field 1 ANC extracted. (Call NTV2DeviceCanDoCustomAnc to determin...
Definition: ntv2anc.cpp:974
Used to describe Start of Active Video (SAV) location and field dominance for a given NTV2Standard...
Definition: ntv2utils.h:878
Identifies the 1st HDMI video input.
Definition: ntv2enums.h:1269
NTV2OutputDestination NTV2ChannelToOutputDestination(const NTV2Channel inChannel, const NTV2IOKinds inKinds=NTV2_IOKINDS_SDI)
Converts the given NTV2Channel value into its ordinary equivalent NTV2OutputDestination.
Definition: ntv2utils.cpp:5171
static uint64_t GetPid()
Definition: process.cpp:35
#define AJA_FAILURE(_status_)
Definition: types.h:373
virtual bool AncExtractSetEnable(const UWord inSDIInput, const bool inIsEnabled)
Enables or disables the given SDI input&#39;s Anc extractor. (Call NTV2DeviceCanDoCustomAnc to determine ...
Definition: ntv2anc.cpp:772
virtual bool SubscribeOutputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Causes me to be notified when an output vertical blanking interrupt is generated for the given output...
Definition: ntv2card.h:2763
#define NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(__f__)
Definition: ntv2enums.h:1053
NTV2EmbeddedAudioInput NTV2InputSourceToEmbeddedAudioInput(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2EmbeddedAudioInput value.
Definition: ntv2utils.cpp:4881
ULWord GetByteCount(void) const
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
virtual bool GetOutputFrame(const NTV2Channel inChannel, ULWord &outValue)
Answers with the current output frame number for the given FrameStore (expressed as an NTV2Channel)...
Capture (input) mode, which writes into device SDRAM.
Definition: ntv2enums.h:1247
NTV2AudioSystem NTV2InputSourceToAudioSystem(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2AudioSystem value.
Definition: ntv2utils.cpp:5075
LWord acStartFrame
First frame to circulate. FIXFIXFIX Why is this signed? CHANGE TO ULWord??
bool fSuppressAudio
If true, suppress audio; otherwise include audio.
virtual void ProcessFrames(void)
Repeatedly captures, burns, and plays frames without using AutoCirculate (until global quit flag set)...
Definition: ntv2llburn.cpp:543
virtual AJAStatus SetPriority(AJAThreadPriority priority)
Definition: thread.cpp:133
Analog LTC 2.
Definition: ntv2enums.h:3967
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
Defines a number of handy byte-swapping macros.
NTV2LLBurn(const BurnConfig &inConfig)
Constructs me using the given configuration settings.
Definition: ntv2llburn.cpp:31
virtual std::ostream & Print(std::ostream &oss, const bool inDetailed=true) const
Dumps a human-readable description of every packet in my list to the given output stream...
Definition: json.hpp:5362
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
Definition: ntv2audio.cpp:206
virtual AJAStatus Start()
Definition: thread.cpp:91
#define false
uint32_t ULWord
Definition: ajatypes.h:236
virtual bool AutoCirculateGetStatus(const NTV2Channel inChannel, AUTOCIRCULATE_STATUS &outStatus)
Returns the current AutoCirculate status for the given channel.
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=(!(0)), NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1361
ULWord GetLastLine(const NTV2FieldID inRasterFieldID=NTV2_FIELD0) const
mVideoFormat
Definition: ntv2vcam.cpp:801
Identifies the 8th SDI video input.
Definition: ntv2enums.h:1280
virtual class DeviceCapabilities & features(void)
Definition: ntv2card.h:148
bool CanDoInputSource(const NTV2InputSource inSrc)
virtual bool AncInsertSetField2ReadParams(const UWord inSDIOutput, const ULWord inFrameNumber, const ULWord inF2Size, const NTV2Channel inChannel=NTV2_CHANNEL_INVALID, const NTV2Framesize inFrameSize=NTV2_FRAMESIZE_INVALID)
Configures the Anc inserter for the next frame&#39;s F2 Anc data to embed/transmit. (Call NTV2DeviceCanDo...
Definition: ntv2anc.cpp:456
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
uint16_t GetLineNumber(void) const
virtual bool DMAReadAnc(const ULWord inFrameNumber, NTV2Buffer &outAncF1Buffer, NTV2Buffer &outAncF2Buffer=NULL_POINTER, const NTV2Channel inChannel=NTV2_CHANNEL1)
Transfers the contents of the ancillary data buffer(s) from a given frame on the AJA device to the ho...
Definition: ntv2dma.cpp:172
#define NTV2_ANCSIZE_MAX
Definition: ntv2llburn.cpp:21
virtual AJAStatus SetupVideo(void)
Sets up everything I need for capturing and playing video.
Definition: ntv2llburn.cpp:169
Identifies the 2nd SDI video input.
Definition: ntv2enums.h:1274
virtual bool StartAudioOutput(const NTV2AudioSystem inAudioSystem, const bool inWaitForVBI=(0))
Starts the playout side of the given NTV2AudioSystem, reading outgoing audio samples from the Audio S...
Definition: ntv2audio.cpp:1077
#define AsULWordPtr(_p_)
Definition: ntv2llburn.cpp:27
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:489
Defines where the ancillary data can be found within a video stream.
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device...
virtual void RouteInputSignal(void)
Sets up board routing for capture.
Definition: ntv2llburn.cpp:426
virtual bool GetRP188Data(const NTV2Channel inSDIInput, NTV2_RP188 &outRP188Data)
Reads the raw RP188 data from the DBB/Low/Hi registers for the given SDI input. On newer devices with...
This struct replaces the old RP188_STRUCT.
virtual bool AncExtractGetField2Size(const UWord inSDIInput, ULWord &outF2Size)
Answers with the number of bytes of field 2 ANC extracted. (Call NTV2DeviceCanDoCustomAnc to determin...
Definition: ntv2anc.cpp:995
int32_t appPID(0)
A handy class that makes it easy to "bounce" an unsigned integer value between a minimum and maximum ...
#define NTV2_IS_ANALOG_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3992
ULWord numPixels
Width – total number of pixels per line.
virtual bool Active()
Definition: thread.cpp:116
virtual bool DMAWriteAudio(const NTV2AudioSystem inAudioSystem, const ULWord *pInAudioBuffer, const ULWord inOffsetBytes, const ULWord inByteCount)
Synchronously transfers audio data from the specified host buffer to the given Audio System&#39;s buffer ...
Definition: ntv2dma.cpp:154
bool Fill(const T &inValue)
Fills me with the given scalar value.
virtual bool GetTaskMode(NTV2TaskMode &outMode)
Retrieves the device&#39;s current task mode.
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2llburn.cpp:502
virtual bool SetAudioSystemInputSource(const NTV2AudioSystem inAudioSystem, const NTV2AudioSource inAudioSource, const NTV2EmbeddedAudioInput inEmbeddedInput)
Sets the audio source for the given NTV2AudioSystem on the device.
Definition: ntv2audio.cpp:486
A helper class used in CNTV2Card::AutoCirculateInitForInput and CNTV2Card::AutoCirculateInitForOutput...
Definition: ntv2utils.h:972
virtual bool KickSDIWatchdog(void)
Restarts the countdown timer to prevent the watchdog timer from timing out.
NTV2OutputXptID GetInputSourceOutputXpt(const NTV2InputSource inInputSource, const bool inIsSDI_DS2=false, const bool inIsHDMI_RGB=false, const UWord inHDMI_Quadrant=0)
NTV2PixelFormat fPixelFormat
The pixel format to use.
static AJA_PixelFormat GetAJAPixelFormat(const NTV2PixelFormat inFormat)
NTV2Channel NTV2OutputDestinationToChannel(const NTV2OutputDestination inOutputDest)
Converts a given NTV2OutputDestination to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5159
NTV2Channel fOutputChannel
The output channel to use.
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:416
virtual bool SetLTCInputEnable(const bool inEnable)
Enables or disables the ability for the device to read analog LTC on the reference input connector...
virtual bool SetOutputFrame(const NTV2Channel inChannel, const ULWord inValue)
Sets the output frame index number for the given FrameStore. This identifies which frame in device SD...
#define true
Analog LTC 1.
Definition: ntv2enums.h:3966
virtual bool AncExtractSetFilterDIDs(const UWord inSDIInput, const NTV2DIDSet &inDIDs)
Replaces the DIDs to be excluded (filtered) by the given SDI input&#39;s Anc extractor. (Call NTV2DeviceCanDoCustomAnc to determine if the device supports Anc extractor firmware.)
Definition: ntv2anc.cpp:949
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:169
0: Disabled (never recommended): device configured exclusively by client application(s).
Playout (output) mode, which reads from device SDRAM.
Definition: ntv2enums.h:1245
virtual std::string GetDescription(void) const
Definition: ntv2card.cpp:139
virtual bool AncExtractGetFilterDIDs(const UWord inSDIInput, NTV2DIDSet &outDIDs)
Answers with the DIDs currently being excluded (filtered) by the SDI input&#39;s Anc extractor. (Call NTV2DeviceCanDoCustomAnc to determine if the device supports Anc extractor firmware.)
Definition: ntv2anc.cpp:924
virtual bool SetMode(const NTV2Channel inChannel, const NTV2Mode inNewValue, const bool inIsRetail=(!(0)))
Determines if a given FrameStore on the AJA device will be used to capture or playout video...
virtual bool SetRP188Data(const NTV2Channel inSDIOutput, const NTV2_RP188 &inRP188Data)
Writes the raw RP188 data into the DBB/Low/Hi registers for the given SDI output. These values are la...
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
NTV2InputXptID GetOutputDestInputXpt(const NTV2OutputDestination inOutputDest, const bool inIsSDI_DS2=false, const UWord inHDMI_Quadrant=99)
#define HOST_AUDIO_BUFFER_SIZE
Definition: ntv2llburn.cpp:402
static bool GetFirstDeviceFromArgument(const std::string &inArgument, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command li...
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
virtual bool SetRP188SourceFilter(const NTV2Channel inSDIInput, const UWord inFilterValue)
Sets the RP188 DBB filter for the given SDI input.
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 ...
Identifies the last (second) field in time for an interlaced video frame.
Definition: ntv2enums.h:1848
virtual bool ReadAnalogLTCInput(const UWord inLTCInput, RP188_STRUCT &outRP188Data)
Reads the current contents of the device&#39;s analog LTC input registers.
Identifies the 3rd SDI video input.
Definition: ntv2enums.h:1275
virtual bool StartAudioInput(const NTV2AudioSystem inAudioSystem, const bool inWaitForVBI=(0))
Starts the capture side of the given NTV2AudioSystem, writing incoming audio samples into the Audio S...
Definition: ntv2audio.cpp:1174
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
virtual bool SubscribeInputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Causes me to be notified when an input vertical blanking interrupt occurs on the given input channel...
Definition: ntv2card.h:2787
bool WithHanc(void) const
virtual NTV2VideoFormat GetInputVideoFormat(const NTV2InputSource inVideoSource=NTV2_INPUTSOURCE_SDI1, const bool inIsProgressive=(0))
Returns the video format of the signal that is present on the given input source. ...
Describes a video frame for a given video standard or format and pixel format, including the total nu...
AJAAncDataLoc & SetLineNumber(const uint16_t inLineNum)
Sets my anc data line number value.
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
Definition: systemtime.cpp:284
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2llburn.cpp:68
virtual bool DMAWriteAnc(const ULWord inFrameNumber, NTV2Buffer &inAncF1Buffer, NTV2Buffer &inAncF2Buffer=NULL_POINTER, const NTV2Channel inChannel=NTV2_CHANNEL1)
Transfers the contents of the ancillary data buffer(s) from the host to a given frame on the AJA devi...
Definition: ntv2dma.cpp:228
2: OEM (recommended): device configured by client application(s) with some driver involvement...
The ancillary data is associated with the luminance (Y) channel of the video stream.
static AJAStatus SetFromDeviceAncBuffers(const NTV2Buffer &inF1AncBuffer, const NTV2Buffer &inF2AncBuffer, AJAAncillaryList &outPackets, const uint32_t inFrameNum=0)
Returns all ancillary data packets found in the given F1 and F2 ancillary data buffers.
NTV2InputXptID GetFrameStoreInputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsBInput=false)
virtual bool AncExtractSetField2WriteParams(const UWord inSDIInput, const ULWord inFrameNumber, const NTV2Channel inChannel=NTV2_CHANNEL_INVALID, const NTV2Framesize inFrameSize=NTV2_FRAMESIZE_INVALID)
Configures the given SDI input&#39;s Anc extractor to receive the next frame&#39;s F2 Anc data...
Definition: ntv2anc.cpp:856
const uint32_t kAppSignature(((((uint32_t)( 'L'))<< 24)|(((uint32_t)( 'l'))<< 16)|(((uint32_t)( 'b'))<< 8)|(((uint32_t)( 'u'))<< 0)))
virtual bool ReadAudioLastIn(ULWord &outValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
For the given Audio System, answers with the byte offset to the last byte of the latest chunk of 4-by...
Definition: ntv2audio.cpp:466
virtual AJAStatus AddAncillaryData(const AJAAncillaryList &inPackets)
Appends a copy of the given list&#39;s packets to me.
static size_t DefaultPageSize(void)
virtual bool GetInputFrame(const NTV2Channel inChannel, ULWord &outValue)
Answers with the current input frame index number for the given FrameStore. This identifies which par...
virtual bool SetSDIOutputAudioSystem(const NTV2Channel inSDIOutputConnector, const NTV2AudioSystem inAudioSystem)
Sets the device&#39;s NTV2AudioSystem that will provide audio for the given SDI output&#39;s audio embedder...
ULWord GetIndexForNTV2InputSource(const NTV2InputSource inValue)
Definition: ntv2utils.cpp:5278
virtual AJAStatus SetDataCoding(const AJAAncDataCoding inCodingType)
Sets my ancillary data coding type (e.g. digital or analog/raw waveform).
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:2035
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
virtual bool AncExtractSetWriteParams(const UWord inSDIInput, const ULWord inFrameNumber, const NTV2Channel inChannel=NTV2_CHANNEL_INVALID, const NTV2Framesize inFrameSize=NTV2_FRAMESIZE_INVALID)
Configures the given SDI input&#39;s Anc extractor to receive the next frame&#39;s F1 Anc data...
Definition: ntv2anc.cpp:810
Configures an NTV2Burn or NTV2FieldBurn instance.
Specifies channel or FrameStore 8 (or the 8th item).
Definition: ntv2enums.h:1370
virtual bool InputSignalHasTimecode(void)
Returns true if the current input signal has timecode embedded in it; otherwise returns false...
Definition: ntv2llburn.cpp:922
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
#define AUTOCIRCULATE_WITH_ANC
Use this to AutoCirculate with ancillary data.
Specifies channel or FrameStore 2 (or the 2nd item).
Definition: ntv2enums.h:1364
uint64_t ULWord64
Definition: ajatypes.h:239
LWord acEndFrame
Last frame to circulate. FIXFIXFIX Why is this signed? CHANGE TO ULWord??
virtual bool GetAncRegionOffsetAndSize(ULWord &outByteOffset, ULWord &outByteCount, const NTV2AncillaryDataRegion inAncRegion=NTV2_AncRgn_All)
Answers with the offset and size of an ancillary data region within a device frame buffer...
Definition: ntv2dma.cpp:516
virtual bool AncInsertSetComponents(const UWord inSDIOutput, const bool inVancY, const bool inVancC, const bool inHancY, const bool inHancC)
Enables or disables individual Anc insertion components for the given SDI output. (Call NTV2DeviceCan...
Definition: ntv2anc.cpp:357
static void RunThreadStatic(AJAThread *pThread, void *pContext)
This is the worker thread&#39;s static callback function that gets called when the thread runs...
Definition: ntv2llburn.cpp:526
bool IsVerbose(void) const
Identifies the 4th SDI video input.
Definition: ntv2enums.h:1276
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...
std::string fDeviceSpec
The AJA device to use.
#define NTV2_OUTPUT_DEST_IS_SDI(_dest_)
Definition: ntv2enums.h:1350
virtual AJAStatus SetDataLocation(const AJAAncDataLoc &inLoc)
Sets my ancillary data "location" within the video stream.
#define AsCU8Ptr(_p_)
Definition: ntv2llburn.cpp:28
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...
Describes a user-space buffer on the host computer. I have an address and a length, plus some optional attributes (allocated by SDK?, page-aligned? etc.).
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=(0))
Connects the given widget signal input (sink) to the given widget signal output (source).
virtual bool GetAudioReadOffset(ULWord &outReadOffset, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
For the given Audio System, answers with the byte offset from the start of the audio buffer to the fi...
Definition: ntv2audio.cpp:450
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1266
virtual bool AnalogLTCInputHasTimecode(void)
Returns true if there is a valid LTC signal on my device&#39;s primary analog LTC input port; otherwise r...
Definition: ntv2llburn.cpp:936
bool IsRGBFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5414
Identifies the 6th SDI video input.
Definition: ntv2enums.h:1278
virtual void RouteOutputSignal(void)
Sets up board routing for playout.
Definition: ntv2llburn.cpp:448
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:250
#define BURNNOTE(_expr_)
virtual bool AncInsertSetReadParams(const UWord inSDIOutput, const ULWord inFrameNumber, const ULWord inF1Size, const NTV2Channel inChannel=NTV2_CHANNEL_INVALID, const NTV2Framesize inFrameSize=NTV2_FRAMESIZE_INVALID)
Configures the Anc inserter for the next frame&#39;s F1 Anc data to embed/transmit. (Call NTV2DeviceCanDo...
Definition: ntv2anc.cpp:414
static const bool CLEAR_DEVICE_ANC_BUFFER_AFTER_READ((0))
static bool GetWidgetForInput(const NTV2InputXptID inInputXpt, NTV2WidgetID &outWidgetID, const NTV2DeviceID inDeviceID=DEVICE_ID_NOTFOUND)
Returns the widget that "owns" the specified input crosspoint.
virtual void GetStatus(ULWord &outFramesProcessed, ULWord &outFramesDropped)
Provides status information about my input (capture) and output (playout) processes.
Definition: ntv2llburn.cpp:896
This identifies the first Audio System.
Definition: ntv2enums.h:3903
bool WithAudio(void) const
NTV2SmpteLineNumber GetSmpteLineNumber(const NTV2Standard inStandard)
For the given video standard, returns the SMPTE-designated line numbers for Field 1 and Field 2 that ...
Definition: ntv2utils.h:964
Identifies the 7th SDI video input.
Definition: ntv2enums.h:1279
virtual bool SetSDIWatchdogTimeout(const ULWord inValue)
Specifies the amount of time that must elapse before the watchdog timer times out.
ULWord numLines
Height – total number of lines.
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
Definition: thread.cpp:169
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget&#39;s input (ident...
Definition: ntv2enums.h:2532
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget&#39;s output (...
Definition: ntv2enums.h:2757
The ancillary data is associated with Link A of the video stream.
Definition: ancillarydata.h:81
Identifies the "normal" Field 2 ancillary data region.
Definition: ntv2enums.h:4236
bool fDoMultiFormat
If true, enables device-sharing; otherwise takes exclusive control of the device. ...
ULWord GetFirstActiveLine(const NTV2FieldID inRasterFieldID=NTV2_FIELD0) const
Definition: ntv2utils.cpp:4219
virtual bool DMAReadAudio(const NTV2AudioSystem inAudioSystem, ULWord *pOutAudioBuffer, const ULWord inOffsetBytes, const ULWord inByteCount)
Synchronously transfers audio data from a given Audio System&#39;s buffer memory on the AJA device to the...
Definition: ntv2dma.cpp:136
bool WithAnc(void) const
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
NTV2OutputXptID GetFrameStoreOutputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsRGB=false, const bool inIs425=false)
NTV2WidgetID
Definition: ntv2enums.h:2914
uint16_t UWord
Definition: ajatypes.h:234
virtual AJAStatus SetPayloadData(const uint8_t *pInData, const uint32_t inByteCount)
Copy data from external memory into my local payload memory.
Specifies channel or FrameStore 1 (or the first item).
Definition: ntv2enums.h:1363
virtual bool UnsubscribeInputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Unregisters me so I&#39;m no longer notified when an input VBI is signaled on the given input channel...
Definition: ntv2card.h:2837
virtual ~NTV2LLBurn()
Definition: ntv2llburn.cpp:47
virtual bool SetInputFrame(const NTV2Channel inChannel, const ULWord inValue)
Sets the input frame index number for the given FrameStore. This identifies which frame in device SDR...
bool CanDoFrameBufferFormat(const NTV2PixelFormat inPF)
ULWord appSignature(0)
virtual bool AutoCirculateInitForOutput(const NTV2Channel inChannel, const UWord inFrameCount=7, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_INVALID, const ULWord inOptionFlags=0, const UByte inNumChannels=1, const UWord inStartFrameNumber=0, const UWord inEndFrameNumber=0)
Prepares for subsequent AutoCirculate playback streaming, designating a contiguous block of frame buf...
static const bool PRINT_ANC_PACKETS_AFTER_READ((0))
static const bool REPLACE_OUTGOING_ANC_WITH_CUSTOM_PACKETS((0))
bool CanDoWidget(const NTV2WidgetID inWgtID)
TimecodeFormat
Definition: ntv2rp188.h:22
Identifies the 3rd HDMI video input.
Definition: ntv2enums.h:1271
Declares the NTV2FormatDescriptor class.
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2llburn.cpp:79
#define NTV2_INPUT_SOURCE_IS_ANALOG(_inpSrc_)
Definition: ntv2enums.h:1286
virtual bool SetSDIOutputAudioEnabled(const NTV2Channel inSDIOutput, const bool &inEnable)
Enables or disables the audio output embedder for the given SDI output connector (specified as a chan...
Definition: ntv2audio.cpp:1657
AJA_EXPORT bool BurnTimeCode(void *pBaseVideoAddress, const std::string &inTimeCodeStr, const uint32_t inYPercent)
Specifies channel or FrameStore 4 (or the 4th item).
Definition: ntv2enums.h:1366
NTV2Channel fInputChannel
The input channel to use.
Specifies channel or FrameStore 5 (or the 5th item).
Definition: ntv2enums.h:1367
Identifies the first analog video input.
Definition: ntv2enums.h:1268
NTV2TCIndex fTimecodeSource
Timecode source to use.
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2375
virtual bool DMAReadFrame(const ULWord inFrameNumber, ULWord *pOutFrameBuffer, const ULWord inByteCount)
Transfers a single frame from the AJA device to the host.
Definition: ntv2dma.cpp:41
bool GetRP188Reg(RP188_STRUCT &outRP188) const
Definition: ntv2rp188.cpp:1241
virtual void StartRunThread(void)
Starts my main worker thread.
Definition: ntv2llburn.cpp:515
virtual bool AncExtractSetComponents(const UWord inSDIInput, const bool inVancY, const bool inVancC, const bool inHancY, const bool inHancC)
Enables or disables the Anc extraction components for the given SDI input. (Call NTV2DeviceCanDoCusto...
Definition: ntv2anc.cpp:760
void * GetHostPointer(void) const
NTV2AudioSource NTV2InputSourceToAudioSource(const NTV2InputSource inInputSource)
Definition: ntv2utils.cpp:4905
Identifies the first field in time for an interlaced video frame, or the first and only field in a pr...
Definition: ntv2enums.h:1847
static size_t SetDefaultPageSize(void)
virtual bool DisableRP188Bypass(const NTV2Channel inSDIOutput)
Configures the SDI output&#39;s embedder to embed SMPTE 12M timecode specified in calls to CNTV2Card::Set...
This identifies the 2nd Audio System.
Definition: ntv2enums.h:3904
virtual bool AncInsertSetEnable(const UWord inSDIOutput, const bool inIsEnabled)
Enables or disables the given SDI output&#39;s Anc inserter frame buffer reads. (Call NTV2DeviceCanDoCust...
Definition: ntv2anc.cpp:374
Specifies channel or FrameStore 6 (or the 6th item).
Definition: ntv2enums.h:1368
I am the principal class that stores a single SMPTE-291 SDI ancillary data packet OR the digitized co...
virtual bool AutoCirculateInitForInput(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 ingest streaming, designating a contiguous block of frame buffe...
bool fWithHanc
If true, capture & play HANC data, including audio (LLBurn). Defaults to false.
#define BURNINFO(_expr_)
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
std::string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:5731
Specifies channel or FrameStore 7 (or the 7th item).
Definition: ntv2enums.h:1369
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Definition: ntv2enums.h:1287
bool GetRP188Str(std::string &sRP188) const
Definition: ntv2rp188.cpp:918
std::string & lower(std::string &str)
Definition: common.cpp:436
const uint32_t kNumFrameBuffers(2)
Declares the AJAAncillaryList class.
static const bool CLEAR_HOST_ANC_BUFFER_BEFORE_READ((0))
void * GetHostAddress(const ULWord inByteOffset, const bool inFromEnd=false) const
Identifies the "normal" Field 1 ancillary data region.
Definition: ntv2enums.h:4235
Identifies the 1st SDI video input.
Definition: ntv2enums.h:1273
NTV2InputXptID GetSDIOutputInputXpt(const NTV2Channel inSDIOutput, const bool inIsDS2=false)
virtual bool SetVANCMode(const NTV2VANCMode inVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the VANC mode for the given FrameStore.
virtual bool StopAudioOutput(const NTV2AudioSystem inAudioSystem)
Stops the playout side of the given NTV2AudioSystem, parking the "Read Head" at the start of the play...
Definition: ntv2audio.cpp:1122
virtual bool GetStreamingApplication(ULWord &outAppType, int32_t &outProcessID)
Answers with the four-CC type and process ID of the application that currently "owns" the AJA device ...
virtual bool AncExtractInit(const UWord inSDIInput, const NTV2Channel inChannel=NTV2_CHANNEL_INVALID, const NTV2Standard inStandard=NTV2_STANDARD_INVALID)
Initializes the given SDI input&#39;s Anc extractor for custom Anc packet detection and de-embedding...
Definition: ntv2anc.cpp:706
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:147
virtual bool StopAudioInput(const NTV2AudioSystem inAudioSystem)
Stops the capture side of the given NTV2AudioSystem, and resets the capture position (i...
Definition: ntv2audio.cpp:1220
#define NTV2EndianSwap32(__val__)
Definition: ntv2endian.h:19
NTV2OutputXptID GetCSCOutputXptFromChannel(const NTV2Channel inCSC, const bool inIsKey=false, const bool inIsRGB=false)
virtual bool WaitForInputVerticalInterrupt(const NTV2Channel inChannel=NTV2_CHANNEL1, UWord inRepeatCount=1)
Efficiently sleeps the calling thread/process until the next one or more field (interlaced video) or ...
virtual bool IsRP188BypassEnabled(const NTV2Channel inSDIOutput, bool &outIsBypassEnabled)
Answers if the SDI output&#39;s RP-188 bypass mode is enabled or not.
I am an ordered collection of AJAAncillaryData instances which represent one or more SMPTE 291 data p...
Definition: ancillarylist.h:64
The ancillary data is associated with DS1 of the video stream (Link A).
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3805
std::set< UByte > NTV2DIDSet
A set of distinct NTV2DID values.
Specifies channel or FrameStore 3 (or the 3rd item).
Definition: ntv2enums.h:1365
Captures video and audio from a signal provided to an input of an AJA device, burns timecode into the...
Definition: ntv2llburn.h:32
The ancillary data is in the form of a SMPTE-291 Ancillary Packet.
NTV2ReferenceSource NTV2InputSourceToReferenceSource(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2ReferenceSource value.
Definition: ntv2utils.cpp:5027
See 8-Bit YCbCr Format.
Definition: ntv2enums.h:227
NTV2InputSource fInputSource
The device input connector to use.
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.