AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
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()),
34  mDeviceID (DEVICE_ID_NOTFOUND),
36  mSavedTaskMode (NTV2_DISABLE_TASKS),
37  mOutputDest (NTV2_OUTPUTDESTINATION_INVALID),
38  mAudioSystem (NTV2_AUDIOSYSTEM_1),
39  mGlobalQuit (false),
40  mAudioInLastAddress (0),
41  mAudioOutLastAddress (0),
42  mFramesProcessed (0),
43  mFramesDropped (0)
44 {
45 } // constructor
46 
47 
49 {
50  // Stop my capture and playout threads, then destroy them...
51  Quit();
52 
53  // Unsubscribe from input vertical event...
55 
56  if (!mConfig.fDoMultiFormat)
57  {
58  mDevice.SetTaskMode (mSavedTaskMode); // Restore prior service level
59  mDevice.ReleaseStreamForApplication (kAppSignature, static_cast<int32_t>(AJAProcess::GetPid())); // Release the device
60  }
61 
62  // Don't leave the audio system active after we exit
63  mDevice.StopAudioInput (mAudioSystem);
64  mDevice.StopAudioOutput (mAudioSystem);
65 
66 } // destructor
67 
68 
69 void NTV2LLBurn::Quit (void)
70 {
71  // Set the global 'quit' flag, and wait for the thread to go inactive...
72  mGlobalQuit = true;
73 
74  while (mRunThread.Active())
75  AJATime::Sleep(10);
76 
77 } // Quit
78 
79 
81 {
83 
84  // Open the device...
86  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl; return AJA_STATUS_OPEN;}
87 
88  if (!mDevice.IsDeviceReady (false))
89  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
90 
91  mDeviceID = mDevice.GetDeviceID (); // Keep the device ID handy since it will be used frequently
92 
93  // Burn requires device capable of capturing and playing video...
94  if (!(mDevice.features().CanDoCapture() && mDevice.features().CanDoPlayback()))
95  {cerr << "## ERROR: Device cannot both capture & play video" << endl; return AJA_STATUS_BAD_PARAM; }
96 
97  ULWord appSignature (0);
98  int32_t appPID (0);
99  mDevice.GetTaskMode (mSavedTaskMode); // Save the current device state
100  mDevice.GetStreamingApplication (appSignature, appPID); // Who currently "owns" the device?
101  if (!mConfig.fDoMultiFormat)
102  {
103  if (!mDevice.AcquireStreamForApplication (kAppSignature, static_cast<int32_t>(AJAProcess::GetPid())))
104  {
105  cerr << "## ERROR: Unable to acquire device because another app (pid " << appPID << ") owns it" << endl;
106  return AJA_STATUS_BUSY; // Some other app is using the device
107  }
108  mDevice.ClearRouting (); // Clear the current device routing (since I "own" the device)
109  }
110  mDevice.SetTaskMode (NTV2_OEM_TASKS); // Set the OEM service level
111 
112  // Configure the SDI relays if present
113  if (mDevice.features().HasSDIRelays())
114  {
115  // Note that if the board's jumpers are not set in the position
116  // to enable the watchdog timer, these calls will have no effect.
117  mDevice.SetSDIWatchdogEnable(true, 0); // SDI 1/2
118  mDevice.SetSDIWatchdogEnable(true, 1); // SDI 3/4
119 
120  // Set timeout delay to 2 seconds expressed in multiples of 8 ns
121  // and take the relays out of bypass
122  mDevice.SetSDIWatchdogTimeout (2 * 125000000);
123  mDevice.KickSDIWatchdog ();
124 
125  // Give the mechanical relays some time to switch
126  AJATime::Sleep (500);
127  }
128 
129  if (mConfig.WithHanc())
130  {
131  // Transfer audio using HANC extractor/inserter
132  mConfig.fWithAnc = true;
133  mConfig.fSuppressAudio = true;
134  }
135 
136  if (mConfig.WithAnc() && !mDevice.features().CanDoCustomAnc())
137  {cerr << "## WARNING: Device doesn't support custom Anc, '-a -h' option ignored" << endl; mConfig.fWithAnc = false; mConfig.fWithHanc = false;}
138 
139  // Set up the video and audio...
140  status = SetupVideo();
141  if (AJA_FAILURE (status))
142  return status;
143 
144  status = SetupAudio();
145  if (AJA_FAILURE (status))
146  return status;
147 
148  // Set up the circular buffers...
149  status = SetupHostBuffers();
150  if (AJA_FAILURE (status))
151  return status;
152 
154  mDevice.SetLTCInputEnable(true); // Enable analog LTC input (some LTC inputs are shared with reference input)
155 
156  // Lastly, prepare my AJATimeCodeBurn instance...
157  mTCBurner.RenderTimeCodeFont (CNTV2DemoCommon::GetAJAPixelFormat (mConfig.fPixelFormat), mFormatDesc.numPixels, mFormatDesc.numLines);
158 
159  return AJA_STATUS_SUCCESS;
160 
161 } // Init
162 
163 
165 {
166  const uint16_t numFrameStores (mDevice.features().GetNumFrameStores());
167  const uint16_t numSDIOutputs (mDevice.features().GetNumVideoOutputs());
168 
169  // Can the device support the desired input source?
170  if (!mDevice.features().CanDoInputSource(mConfig.fInputSource))
171  {cerr << "## ERROR: This device cannot receive input from the specified source" << endl; return AJA_STATUS_BAD_PARAM;}
172 
173  // Pick an input NTV2Channel from the input source, and enable its frame buffer...
175  mDevice.EnableChannel (mConfig.fInputChannel); // Enable the input frame buffer
176 
177  // Pick an appropriate output NTV2Channel, and enable its frame buffer...
178  switch (mConfig.fInputSource)
179  {
180  case NTV2_INPUTSOURCE_SDI1: mConfig.fOutputChannel = numSDIOutputs < 3 || numFrameStores == 2 || numFrameStores > 4 ? NTV2_CHANNEL2 : NTV2_CHANNEL3; break;
181 
183  case NTV2_INPUTSOURCE_SDI2: mConfig.fOutputChannel = numFrameStores > 4 ? NTV2_CHANNEL3 : NTV2_CHANNEL4; break;
184 
186  case NTV2_INPUTSOURCE_SDI3: mConfig.fOutputChannel = NTV2_CHANNEL4; break;
187 
189  case NTV2_INPUTSOURCE_SDI4: mConfig.fOutputChannel = numFrameStores > 4 ? NTV2_CHANNEL5 : NTV2_CHANNEL3; break;
190 
191  case NTV2_INPUTSOURCE_SDI5: mConfig.fOutputChannel = NTV2_CHANNEL6; break;
192  case NTV2_INPUTSOURCE_SDI6: mConfig.fOutputChannel = NTV2_CHANNEL7; break;
193  case NTV2_INPUTSOURCE_SDI7: mConfig.fOutputChannel = NTV2_CHANNEL8; break;
194  case NTV2_INPUTSOURCE_SDI8: mConfig.fOutputChannel = NTV2_CHANNEL7; break;
195 
197  case NTV2_INPUTSOURCE_HDMI1: mConfig.fOutputChannel = numFrameStores < 3 ? NTV2_CHANNEL2 : NTV2_CHANNEL3;
198  mAudioSystem = NTV2_AUDIOSYSTEM_2;
199  break;
200 // default:
201  case NTV2_INPUTSOURCE_INVALID: cerr << "## ERROR: Bad input source" << endl; return AJA_STATUS_BAD_PARAM;
202  }
203 
204  // Check to see if desired input/output channels are in use by Auto-Circulate, i.e. another Auto-Circulate-based ntv2 demo is running.
205  AUTOCIRCULATE_STATUS acStatus;
206  if (!mDevice.AutoCirculateInitForInput( mConfig.fInputChannel,
210  | (mDevice.features().CanDoCustomAnc() ? AUTOCIRCULATE_WITH_ANC : 0)))
211  {
212  cerr << "Failed to init " << NTV2ChannelToString(mConfig.fInputChannel) << " for input. Is channel in-use by Auto-Circulate?" << endl;
213  return AJA_STATUS_FAIL;
214  }
215  if (!mDevice.AutoCirculateGetStatus(mConfig.fInputChannel, acStatus))
216  {
217  cerr << "Error getting Auto-Circulate status for input channel " << NTV2ChannelToString(mConfig.fInputChannel) << endl;
218  return AJA_STATUS_FAIL;
219  }
220  mInputStartFrame = acStatus.acStartFrame;
221  mInputEndFrame = acStatus.acEndFrame;
222 
223  if (!mDevice.AutoCirculateInitForOutput( mConfig.fOutputChannel,
227  {
228  cerr << "Failed to init " << NTV2ChannelToString(mConfig.fOutputChannel) << " for output. Is channel in-use by Auto-Circulate?" << endl;
229  return AJA_STATUS_FAIL;
230  }
231  if (!mDevice.AutoCirculateGetStatus(mConfig.fOutputChannel, acStatus))
232  {
233  cerr << "Error getting Auto-Circulate status for output channel " << NTV2ChannelToString(mConfig.fOutputChannel) << endl;
234  return AJA_STATUS_FAIL;
235  }
236  mOutputStartFrame = acStatus.acStartFrame;
237  mOutputEndFrame = acStatus.acEndFrame;
238 
239  mDevice.AutoCirculateStop(mConfig.fInputChannel);
240  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
241 
242  bool isTransmit (false);
243  if (mDevice.features().HasBiDirectionalSDI() // If device has bidirectional SDI connectors...
244  && NTV2_INPUT_SOURCE_IS_SDI(mConfig.fInputSource) // ...and desired input source is SDI...
245  && mDevice.GetSDITransmitEnable (mConfig.fInputChannel, isTransmit) // ...and GetSDITransmitEnable succeeds...
246  && isTransmit) // ...and input is set to "transmit"...
247  {
248  mDevice.SetSDITransmitEnable (mConfig.fInputChannel, false); // ...then disable transmit mode...
249  mDevice.WaitForInputVerticalInterrupt(mConfig.fInputChannel, 20); // ...and give the device a dozen frames or so to lock to the input signal
250  } // if input SDI connector needs to switch from transmit mode
251 
252  if (mConfig.WithAnc() && !NTV2_INPUT_SOURCE_IS_SDI(mConfig.fInputSource))
253  cerr << "## WARNING: Non-SDI input source, no Anc capture possible" << endl;
254 
255  // Determine the input video signal format, and set the device's reference source to that input...
256  mVideoFormat = mDevice.GetInputVideoFormat (mConfig.fInputSource);
257  if (mVideoFormat == NTV2_FORMAT_UNKNOWN)
258  {
259  cerr << "## ERROR: The specified input has no signal, or the device cannot handle the signal format" << endl;
260  return AJA_STATUS_NOINPUT; // Sorry, can't handle this format
261  }
262 
264  mAudioSystem = ::NTV2InputSourceToAudioSystem (mConfig.fInputSource);
265  mOutputDest = ::NTV2ChannelToOutputDestination (mConfig.fOutputChannel);
266 
267  if (mDevice.features().HasBiDirectionalSDI() // If device has bidirectional SDI connectors...
268  && NTV2_OUTPUT_DEST_IS_SDI(mOutputDest)) // ...and output destination is SDI...
269  mDevice.SetSDITransmitEnable (mConfig.fOutputChannel, true); // ...then enable transmit mode
270 
271  if (mConfig.WithAnc() && !NTV2_OUTPUT_DEST_IS_SDI(mOutputDest))
272  cerr << "## WARNING: Non-SDI output destination, no Anc playout possible" << endl;
273 
274  mDevice.EnableChannel (mConfig.fInputChannel); // Enable the input frame buffer
275  mDevice.EnableChannel (mConfig.fOutputChannel); // Enable the output frame buffer
276 
277  if (mDevice.features().CanDoMultiFormat() && mConfig.fDoMultiFormat)
278  mDevice.SetMultiFormatMode (true);
279  else if (mDevice.features().CanDoMultiFormat())
280  mDevice.SetMultiFormatMode (false);
281 
282  // Set the input channel format to the detected input format...
283  mDevice.SetVideoFormat (mVideoFormat, false, false, mDevice.features().CanDoMultiFormat() ? mConfig.fInputChannel : NTV2_CHANNEL1);
284  if (mDevice.features().CanDoMultiFormat()) // If device supports multiple formats per-channel...
285  mDevice.SetVideoFormat (mVideoFormat, false, false, mConfig.fOutputChannel); // ...then also set the output channel format to the detected input format
286 
287  // Set the frame buffer pixel format for both channels on the device, assuming it
288  // supports that pixel format . . . otherwise default to 8-bit YCbCr...
289  if (!mDevice.features().CanDoFrameBufferFormat(mConfig.fPixelFormat))
291 
292  // Set the pixel format for both device frame buffers...
293  mDevice.SetFrameBufferFormat (mConfig.fInputChannel, mConfig.fPixelFormat);
294  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mConfig.fPixelFormat);
295 
296  // Enable and subscribe to the interrupts for the channel to be used...
297  mDevice.EnableInputInterrupt (mConfig.fInputChannel);
298  mDevice.SubscribeInputVerticalEvent (mConfig.fInputChannel);
299 
300  // Enable and subscribe to the output interrupts (though it's enabled by default)...
301  mDevice.EnableOutputInterrupt (mConfig.fOutputChannel);
303 
304  // Set the Frame Store modes
305  mDevice.SetMode (mConfig.fInputChannel, NTV2_MODE_CAPTURE);
306  mDevice.SetMode (mConfig.fOutputChannel, NTV2_MODE_DISPLAY);
307 
308  // Set up the device signal routing, and both playout and capture AutoCirculate...
311 
312  // Now that newer AJA devices can capture/play anc data from separate buffers,
313  // there's no need to enable VANC frame geometries...
314  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fInputChannel);
315  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
316  if (::Is8BitFrameBufferFormat(mConfig.fPixelFormat))
317  { // 8-bit FBFs: since not using VANC geometries, disable bit shift...
320  }
321 
322  // Be sure the RP188 mode for the SDI input (expressed as an NTV2Channel),
323  // is set to NTV2_RP188_INPUT...
324  bool isBypassEnabled (false);
325  mDevice.IsRP188BypassEnabled (mConfig.fInputChannel, isBypassEnabled);
326  if (isBypassEnabled)
327  mDevice.DisableRP188Bypass (mConfig.fInputChannel);
328  mDevice.SetRP188Mode (mConfig.fInputChannel, NTV2_RP188_INPUT);
329  mDevice.SetRP188SourceFilter (mConfig.fInputChannel, 0); // 0=LTC 1=VITC1 2=VITC2
330 
331  // Make sure the RP188 mode for all SDI outputs is NTV2_RP188_OUTPUT, and that their RP188
332  // registers are not bypassed (i.e. timecode isn't sourced from an SDI input, as for E-E mode)...
333  NTV2_ASSERT(!mRP188Outputs.empty());
334  for (NTV2ChannelSetConstIter iter(mRP188Outputs.begin()); iter != mRP188Outputs.end(); ++iter)
335  {
336  mDevice.SetRP188Mode (*iter, NTV2_RP188_OUTPUT);
337  mDevice.DisableRP188Bypass (*iter);
338  }
339 
340  // Tell the hardware which buffers to use until the main worker thread runs
341  mDevice.SetInputFrame (mConfig.fInputChannel, 0);
342  mDevice.SetOutputFrame(mConfig.fOutputChannel, 2);
343 
344  // Now that the video is set up, get information about the current frame geometry...
345  mFormatDesc = NTV2FormatDescriptor (mVideoFormat, mConfig.fPixelFormat);
346  return AJA_STATUS_SUCCESS;
347 
348 } // SetupVideo
349 
350 
352 {
353  // Have the audio subsystem capture audio from the designated input source...
355 
356  // It's best to use all available audio channels...
357  mDevice.SetNumberAudioChannels (mDevice.features().GetMaxAudioChannels(), mAudioSystem);
358 
359  // Assume 48kHz PCM...
360  mDevice.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
361 
362  // 4MB device audio buffers work best...
363  mDevice.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
364 
365  // Set up the output audio embedders...
366  if (mDevice.features().GetNumAudioSystems() > 1)
367  {
368  // Some devices, like the Kona1, have 2 FrameStores but only 1 SDI output,
369  // which makes mConfig.fOutputChannel == NTV2_CHANNEL2, but need SDIoutput to be NTV2_CHANNEL1...
370  UWord SDIoutput(mConfig.fOutputChannel);
371  if (SDIoutput >= mDevice.features().GetNumVideoOutputs())
372  SDIoutput = mDevice.features().GetNumVideoOutputs() - 1;
373  mDevice.SetSDIOutputAudioSystem (NTV2Channel(SDIoutput), mAudioSystem);
374  }
375 
376  //
377  // Loopback mode plays whatever audio appears in the input signal when it's
378  // connected directly to an output (i.e., "end-to-end" mode). If loopback is
379  // left enabled, the video will lag the audio as video frames get briefly delayed
380  // in our ring buffer. Audio, therefore, needs to come out of the (buffered) frame
381  // data being played, so loopback must be turned off...
382  //
383  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, mAudioSystem);
384 
385  // Reset both the input and output sides of the audio system so that the buffer
386  // pointers are reset to zero and inhibited from advancing.
387  mDevice.StopAudioOutput (mAudioSystem);
388  mDevice.StopAudioInput (mAudioSystem);
389 
390  // Ensure that the audio system will capture samples when the reset is removed
391  mDevice.SetAudioCaptureEnable (mAudioSystem, true);
392 
393  return AJA_STATUS_SUCCESS;
394 
395 } // SetupAudio
396 
397 // Fixes internal issue #921
398 // NTV2 device audio systems wrap after reading/writing 65,280 samples of 16-channel audio (or 130,560 samples of 8-channel audio)...
399 // i.e. after reading/writing 4,177,920 bytes max.
400 // A 4MB buffer (4,194,304 bytes) wastes 16K (16,384 bytes), but is page-sized, and readily page-aligned on most host OSes.
401 #define HOST_AUDIO_BUFFER_SIZE 4194304
402 
404 {
405  CNTV2DemoCommon::SetDefaultPageSize(); // Set host-specific page size
406 
407  // Allocate and add each in-host buffer to my member variables.
408  // DMA performance can be accelerated slightly by using page-aligned video buffers...
409  mpHostVideoBuffer.Allocate(mFormatDesc.GetVideoWriteSize(ULWord(NTV2Buffer::DefaultPageSize())), true);
410  mpHostAudioBuffer.Allocate(HOST_AUDIO_BUFFER_SIZE, /*page-aligned*/true);
411  mpHostF1AncBuffer.Allocate(mConfig.WithAnc() ? NTV2_ANCSIZE_MAX : 0, /*pageAligned*/true);
412  mpHostF2AncBuffer = NTV2Buffer(mConfig.WithAnc() ? NTV2_ANCSIZE_MAX : 0);
413 
414  if (!mpHostVideoBuffer || !mpHostAudioBuffer || (mConfig.WithAnc() && !mpHostF1AncBuffer) || (mConfig.WithAnc() && !mpHostF2AncBuffer))
415  {
416  cerr << "## ERROR: Unable to allocate host buffer(s)" << endl;
417  return AJA_STATUS_MEMORY;
418  }
419 
420  return AJA_STATUS_SUCCESS;
421 
422 } // SetupHostBuffers
423 
424 
426 {
427  const NTV2OutputCrosspointID inputOutputXpt (::GetInputSourceOutputXpt (mConfig.fInputSource));
429 
430  if (::IsRGBFormat (mConfig.fPixelFormat))
431  {
432  // If the frame buffer is configured for RGB pixel format, incoming YUV must be converted.
433  // This routes the video signal from the input through a color space converter before
434  // connecting to the RGB frame buffer...
435  const NTV2InputCrosspointID cscVideoInputXpt (::GetCSCInputXptFromChannel (mConfig.fInputChannel));
436  const NTV2OutputCrosspointID cscOutputXpt (::GetCSCOutputXptFromChannel (mConfig.fInputChannel, false, true)); // false=video, true=RGB
437 
438  mDevice.Connect (cscVideoInputXpt, inputOutputXpt); // Connect the CSC's video input to the input spigot's output
439  mDevice.Connect (fbInputXpt, cscOutputXpt); // Connect the frame store's input to the CSC's output
440  }
441  else
442  mDevice.Connect (fbInputXpt, inputOutputXpt); // Route the YCbCr signal directly from the input to the frame buffer's input
443 
444 } // RouteInputSignal
445 
446 
448 {
449  const NTV2InputCrosspointID outputInputXpt (::GetOutputDestInputXpt (mOutputDest));
451  NTV2OutputCrosspointID outputXpt (fbOutputXpt);
452 
453  mRP188Outputs.clear();
454  mRP188Outputs.insert(mConfig.fOutputChannel);
455  if (::IsRGBFormat (mConfig.fPixelFormat))
456  {
457  const NTV2OutputCrosspointID cscVidOutputXpt (::GetCSCOutputXptFromChannel (mConfig.fOutputChannel)); // Use CSC's YUV video output
458  const NTV2InputCrosspointID cscVidInputXpt (::GetCSCInputXptFromChannel (mConfig.fOutputChannel));
459 
460  mDevice.Connect (cscVidInputXpt, fbOutputXpt); // Connect the CSC's video input to the frame store's output
461  mDevice.Connect (outputInputXpt, cscVidOutputXpt); // Connect the SDI output's input to the CSC's video output
462  outputXpt = cscVidOutputXpt;
463  }
464  else
465  mDevice.Connect (outputInputXpt, outputXpt);
466 
467  if (!mConfig.fDoMultiFormat)
468  {
469  // Route all SDI outputs to the outputXpt...
470  const NTV2Channel startNum (NTV2_CHANNEL1);
471  const NTV2Channel endNum (NTV2Channel(mDevice.features().GetNumVideoChannels()));
472  NTV2WidgetID outputWidgetID (NTV2_WIDGET_INVALID);
473 
474  for (NTV2Channel chan(startNum); chan < endNum; chan = NTV2Channel(chan+1))
475  {
476  mDevice.SetRP188SourceFilter (chan, 0); // Set all SDI spigots to capture embedded LTC (0==LTC 1==VITC1 2==VITC2)
477  if (chan == mConfig.fInputChannel || chan == mConfig.fOutputChannel)
478  continue; // Skip the input & output channel, already routed
479  mRP188Outputs.insert(chan); // Add this SDI spigot to those we'll push timecode into
480  if (mDevice.features().HasBiDirectionalSDI())
481  mDevice.SetSDITransmitEnable (chan, true);
482  if (CNTV2SignalRouter::GetWidgetForInput (::GetSDIOutputInputXpt (chan, mDevice.features().CanDoDualLink()), outputWidgetID))
483  if (mDevice.features().CanDoWidget(outputWidgetID))
484  mDevice.Connect (::GetSDIOutputInputXpt(chan), outputXpt);
485  } // for each output spigot
486 
487  // If HDMI and/or analog video outputs are available, route them, too...
488  if (mDevice.features().CanDoWidget(NTV2_WgtHDMIOut1))
489  mDevice.Connect (NTV2_XptHDMIOutInput, outputXpt); // Route the output signal to the HDMI output
490  if (mDevice.features().CanDoWidget(NTV2_WgtHDMIOut1v2))
491  mDevice.Connect (NTV2_XptHDMIOutQ1Input, outputXpt); // Route the output signal to the HDMI output
492  if (mDevice.features().CanDoWidget(NTV2_WgtAnalogOut1))
493  mDevice.Connect (NTV2_XptAnalogOutInput, outputXpt); // Route the output signal to the Analog output
494  if (mDevice.features().CanDoWidget(NTV2_WgtSDIMonOut1))
495  mDevice.Connect (::GetSDIOutputInputXpt (NTV2_CHANNEL5), outputXpt); // Route the output signal to the SDI monitor output
496  }
497 
498 } // RouteOutputSignal
499 
500 
502 {
503  // Start the main worker thread...
504  StartRunThread ();
505 
506  return AJA_STATUS_SUCCESS;
507 
508 } // Run
509 
510 
512 
513 // This is where we will start the worker thread
515 {
516  // Create and start the worker thread...
517  mRunThread.Attach(RunThreadStatic, this);
519  mRunThread.Start();
520 
521 } // StartRunThread
522 
523 
524 // The worker thread function
525 void NTV2LLBurn::RunThreadStatic (AJAThread * pThread, void * pContext) // static
526 {
527  (void) pThread;
528  // Grab the NTV2LLBurn instance pointer from the pContext parameter,
529  // then call its ProcessFrames method...
530  NTV2LLBurn * pApp (reinterpret_cast <NTV2LLBurn *> (pContext));
531  pApp->ProcessFrames ();
532 
533 } // RunThreadStatic
534 
535 
536 static const bool CLEAR_HOST_ANC_BUFFER_BEFORE_READ (false);
537 static const bool PRINT_ANC_PACKETS_AFTER_READ (false);
538 static const bool CLEAR_DEVICE_ANC_BUFFER_AFTER_READ (false);
539 static const bool REPLACE_OUTGOING_ANC_WITH_CUSTOM_PACKETS (false);
540 
541 
543 {
544  const bool doAncInput (mConfig.WithAnc() && NTV2_INPUT_SOURCE_IS_SDI(mConfig.fInputSource));
545  const bool doAncOutput (mConfig.WithAnc() && NTV2_OUTPUT_DEST_IS_SDI(mOutputDest));
546  const UWord sdiInput (UWord(::GetIndexForNTV2InputSource(mConfig.fInputSource)));
547  const UWord sdiOutput (UWord(::NTV2OutputDestinationToChannel(mOutputDest)));
548  const bool isInterlace (!NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(mVideoFormat));
549  uint32_t currentInFrame (mInputStartFrame);
550  uint32_t currentOutFrame (mOutputStartFrame);
551  uint32_t currentAudioInAddress (0);
552  uint32_t audioReadOffset (0);
553  uint32_t audioInWrapAddress (0);
554  uint32_t audioOutWrapAddress (0);
555  uint32_t audioBytesCaptured (0);
556  uint32_t ancBytesCapturedF1 (0);
557  uint32_t ancBytesCapturedF2 (0);
558  bool audioIsReset (true);
559  NTV2DIDSet savedDIDs;
560  string timeCodeString;
561 
562  const NTV2Standard videoStandard (::GetNTV2StandardFromVideoFormat(mVideoFormat));
563  const NTV2SmpteLineNumber smpteLineNumInfo (::GetSmpteLineNumber(videoStandard));
564  Bouncer<UWord> yPercent (85/*upperLimit*/, 1/*lowerLimit*/, 1/*startValue*/); // Vertically "bounces" timecode in raster
566  NTV2Buffer zeroesBuffer(mpHostF1AncBuffer.GetByteCount());
567  zeroesBuffer.Fill(ULWord64(0));
568  BURNNOTE("Thread started");
569 
570  // Save current Anc buffer capacity (to restore it later), then max it out...
571  ULWord savedF1ByteCapacity(0), savedF2ByteCapacity(0), offset(0);
572  mDevice.GetAncRegionOffsetAndSize (offset, savedF1ByteCapacity, NTV2_AncRgn_Field1);
573  mDevice.GetAncRegionOffsetAndSize (offset, savedF2ByteCapacity, NTV2_AncRgn_Field2);
575 
576  if (doAncInput)
577  {
578  // Configure extractor
579  mDevice.AncExtractInit(sdiInput, mConfig.fInputChannel);
580 
581  if (mConfig.WithHanc())
582  {
583  mDevice.AncExtractGetFilterDIDs(sdiInput, savedDIDs); // Save current ANC filter (so it can be restored later)
584 
585  // Configure ANC extractor not to filter audio
586  NTV2DIDSet dids;
587 // dids.insert(0xe0); // HD audio group 4 control
588 // dids.insert(0xe1); // HD audio group 3 control
589 // dids.insert(0xe2); // HD audio group 2 control
590 // dids.insert(0xe3); // HD audio group 1 control
591 // dids.insert(0xe4); // HD audio group 4 data
592 // dids.insert(0xe5); // HD audio group 3 data
593 // dids.insert(0xe6); // HD audio group 2 data
594 // dids.insert(0xe7); // HD audio group 1 data
595  dids.insert(0xa0); // 3G audio group 8 control
596  dids.insert(0xa1); // 3G audio group 7 control
597  dids.insert(0xa2); // 3G audio group 6 control
598  dids.insert(0xa3); // 3G audio group 5 control
599  dids.insert(0xa4); // 3G audio group 8 data
600  dids.insert(0xa5); // 3G audio group 7 data
601  dids.insert(0xa6); // 3G audio group 6 data
602  dids.insert(0xa7); // 3G audio group 5 data
603  dids.insert(0x41); // Filter vpid (inserted by sdi output)
604  dids.insert(0x60); // Filter timecode (inserted by sdi output)
605  mDevice.AncExtractSetFilterDIDs (sdiInput, dids);
606 
607  // Enable HANC extraction
608  mDevice.AncExtractSetComponents (sdiInput, true, true, true, true);
609  }
610  else
611  {
612  // Disable HANC extraction
613  mDevice.AncExtractSetComponents (sdiInput, true, true, false, false);
614  }
615 
616  // Start extractor
617  mDevice.AncExtractSetEnable (sdiInput, true);
618  }
619 
620  if (doAncOutput)
621  {
622  // Configure inserter
623  mDevice.AncInsertInit (sdiOutput, mConfig.fInputChannel);
624  mDevice.AncInsertSetComponents (sdiOutput, true, true, mConfig.WithHanc(), mConfig.WithHanc());
625  mDevice.AncInsertSetReadParams (sdiOutput, 0, 0, mConfig.fOutputChannel);
626  mDevice.AncInsertSetField2ReadParams (sdiOutput, 0, 0, mConfig.fOutputChannel);
627  }
628 
629  mDevice.SetSDIOutputAudioEnabled (::NTV2OutputDestinationToChannel(mOutputDest), mConfig.WithAudio());
630 
631  mFramesProcessed = mFramesDropped = 0; // Start with a fresh frame count
632 
633  mDevice.GetAudioReadOffset (audioReadOffset, mAudioSystem);
634  mDevice.GetAudioWrapAddress (audioOutWrapAddress, mAudioSystem);
635 
636  // Wait to make sure the next two SDK calls will be made during the same frame...
637  mDevice.WaitForInputFieldID (NTV2_FIELD0, mConfig.fInputChannel);
638  mDevice.DMAWriteAnc (0, zeroesBuffer, zeroesBuffer);
639  mDevice.DMAWriteAnc (1, zeroesBuffer, zeroesBuffer);
640  mDevice.DMAWriteAnc (2, zeroesBuffer, zeroesBuffer);
641  mDevice.DMAWriteAnc (3, zeroesBuffer, zeroesBuffer);
642 
643  // Before the main loop starts, ping-pong the buffers so the hardware will use
644  // different buffers than the ones it was using while idling...
645  currentInFrame ^= 1;
646  currentOutFrame ^= 1;
647 
648  mDevice.SetInputFrame (mConfig.fInputChannel, currentInFrame);
649  if (doAncInput)
650  mDevice.AncExtractSetWriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
651  if (doAncInput && isInterlace)
652  mDevice.AncExtractSetField2WriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
653 
654  mDevice.SetOutputFrame (mConfig.fOutputChannel, currentOutFrame);
655 
656  // Wait until the hardware starts filling the new buffers, and then start audio
657  // capture as soon as possible to match the video...
658  mDevice.WaitForInputFieldID (NTV2_FIELD0, mConfig.fInputChannel);
659  mDevice.StartAudioInput (mAudioSystem);
660 
661  mAudioInLastAddress = audioReadOffset;
662  audioInWrapAddress = audioOutWrapAddress + audioReadOffset;
663  mAudioOutLastAddress = 0;
664 
665  currentInFrame ^= 1;
666  currentOutFrame ^= 1;
667 
668  mDevice.SetInputFrame (mConfig.fInputChannel, currentInFrame);
669  if (doAncInput)
670  mDevice.AncExtractSetWriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
671  if (doAncInput && isInterlace)
672  mDevice.AncExtractSetField2WriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
673 
674  mDevice.SetOutputFrame (mConfig.fOutputChannel, currentOutFrame);
675 
676  while (!mGlobalQuit)
677  {
678  // Wait until the input has completed capturing a frame...
679  mDevice.WaitForInputFieldID (NTV2_FIELD0, mConfig.fInputChannel);
680 
681  // Flip sense of the buffers again to refer to the buffers that the hardware isn't using (i.e. the off-screen buffers)...
682  currentInFrame ^= 1;
683  currentOutFrame ^= 1;
684 
685  if (mConfig.WithAudio())
686  {
687  // Read the audio position registers as close to the interrupt as possible...
688  mDevice.ReadAudioLastIn (currentAudioInAddress, NTV2AudioSystem(mConfig.fInputChannel));
689  currentAudioInAddress &= ~0x3UL; // Force DWORD alignment
690  currentAudioInAddress += audioReadOffset;
691 
692  if (audioIsReset && mAudioOutLastAddress)
693  {
694  // Now that the audio system has some samples to play, playback can be started...
695  mDevice.StartAudioOutput (mAudioSystem);
696  audioIsReset = false;
697  }
698 
699  if (currentAudioInAddress < mAudioInLastAddress)
700  {
701  // Audio address has wrapped around the end of the buffer.
702  // Do the calculations and transfer from the last address to the end of the buffer...
703  audioBytesCaptured = audioInWrapAddress - mAudioInLastAddress;
704 
705  mDevice.DMAReadAudio (mAudioSystem, mpHostAudioBuffer, mAudioInLastAddress, audioBytesCaptured);
706 
707  // Transfer the new samples from the start of the buffer to the current address...
708  mDevice.DMAReadAudio (mAudioSystem, AsULWordPtr(mpHostAudioBuffer.GetHostAddress(audioBytesCaptured)),
709  audioReadOffset, currentAudioInAddress - audioReadOffset);
710 
711  audioBytesCaptured += currentAudioInAddress - audioReadOffset;
712  }
713  else
714  {
715  audioBytesCaptured = currentAudioInAddress - mAudioInLastAddress;
716 
717  // No wrap, so just perform a linear DMA from the buffer...
718  mDevice.DMAReadAudio (mAudioSystem, mpHostAudioBuffer, mAudioInLastAddress, audioBytesCaptured);
719  }
720 
721  mAudioInLastAddress = currentAudioInAddress;
722  } // if mConfig.WithAudio()
723 
724  // Transfer the new frame to system memory...
725  mDevice.DMAReadFrame (currentInFrame, mpHostVideoBuffer, mpHostVideoBuffer.GetByteCount());
726 
727  if (doAncInput)
728  { // Transfer received Anc data into my F1 & F2 buffers...
729  AJAAncillaryList capturedPackets;
730  // Read ANC bytes captured
731  mDevice.AncExtractGetField1Size (sdiInput, ancBytesCapturedF1);
732  if (isInterlace)
733  mDevice.AncExtractGetField2Size (sdiInput, ancBytesCapturedF2);
735  {
736  mpHostF1AncBuffer.Fill(0);
737  if (isInterlace)
738  mpHostF2AncBuffer.Fill(0);
739  }
740  // Read ANC data
741  mDevice.DMAReadAnc (currentInFrame, mpHostF1AncBuffer, mpHostF2AncBuffer);
742 
744  {
745  AJAAncillaryList::SetFromDeviceAncBuffers (mpHostF1AncBuffer, mpHostF2AncBuffer, capturedPackets);
746  if (capturedPackets.CountAncillaryData()) capturedPackets.Print(cerr, false); // Dump packets
747  }
749  mDevice.DMAWriteAnc (currentInFrame, zeroesBuffer, zeroesBuffer);
750  }
751 
752  // Determine which timecode value should be burned in to the video frame
753  NTV2_RP188 timecodeValue;
755  {
756  // Use the embedded input time code...
757  mDevice.GetRP188Data (mConfig.fInputChannel, timecodeValue);
758  CRP188 inputRP188Info (timecodeValue);
759  inputRP188Info.GetRP188Str(timeCodeString);
760  //cerr << "SDI" << DEC(mConfig.fTimecodeSource) << ":" << timeCodeString << ":" << timecodeValue << endl;
761  }
763  {
764  // Use the analog input time code...
765  mDevice.ReadAnalogLTCInput (mConfig.fTimecodeSource == NTV2_TCINDEX_LTC1 ? 0 : 1, timecodeValue);
766  CRP188 analogRP188Info (timecodeValue);
767  analogRP188Info.GetRP188Str(timeCodeString);
768  //cerr << "Ana" << DEC(mConfig.fTimecodeSource) << ":" << timeCodeString << ":" << timecodeValue << endl;
769  }
770  else
771  {
772  // Invent a timecode (based on the number of frames procesed)...
773  const NTV2FrameRate ntv2FrameRate (GetNTV2FrameRateFromVideoFormat (mVideoFormat));
774  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
775  const CRP188 frameRP188Info (mFramesProcessed, tcFormat);
776 
777  frameRP188Info.GetRP188Reg(timecodeValue);
778  frameRP188Info.GetRP188Str(timeCodeString);
779  //cerr << "Inv:" << timeCodeString << ":" << timecodeValue << endl;
780  }
781 
782  // "Burn" the timecode into the host buffer while we have full access to it...
783  mTCBurner.BurnTimeCode (reinterpret_cast <char *> (mpHostVideoBuffer.GetHostPointer()), timeCodeString.c_str(), yPercent.Next());
784 
785  if (mConfig.WithAudio())
786  {
787  // Calculate where the next audio samples should go in the buffer, taking wraparound into account...
788  if ((mAudioOutLastAddress + audioBytesCaptured) > audioOutWrapAddress)
789  {
790  // The audio will wrap. Transfer enough bytes to fill the buffer to the end...
791  mDevice.DMAWriteAudio (mAudioSystem, mpHostAudioBuffer, mAudioOutLastAddress, audioOutWrapAddress - mAudioOutLastAddress);
792 
793  // Now transfer the remaining bytes to the front of the buffer...
794  mDevice.DMAWriteAudio (mAudioSystem, AsULWordPtr(mpHostAudioBuffer.GetHostAddress(audioOutWrapAddress - mAudioOutLastAddress)),
795  0, audioBytesCaptured - (audioOutWrapAddress - mAudioOutLastAddress));
796 
797  mAudioOutLastAddress = audioBytesCaptured - (audioOutWrapAddress - mAudioOutLastAddress);
798  }
799  else
800  {
801  // No wrap, so just do a linear DMA from the buffer...
802  mDevice.DMAWriteAudio (mAudioSystem, mpHostAudioBuffer, mAudioOutLastAddress, audioBytesCaptured);
803 
804  mAudioOutLastAddress += audioBytesCaptured;
805  }
806  } // if mConfig.WithAudio()
807 
808  // Send the updated frame back to the board for display...
809  mDevice.DMAWriteFrame (currentOutFrame, mpHostVideoBuffer, mpHostVideoBuffer.GetByteCount());
810 
811  if (doAncOutput)
812  {
814  {
816  AJAAncDataLoc F2Loc(F1AncDataLoc);
817  ULWord pktData(NTV2EndianSwap32(mFramesProcessed));
818  pkt.SetDID(0xC0); pkt.SetSID(0x00); pkt.SetDataLocation(F1AncDataLoc); pkt.SetDataCoding(AJAAncDataCoding_Digital);
819  pkt.SetPayloadData(AsCU8Ptr(&pktData), 4);
820  pkts.AddAncillaryData(pkt);
821  if (isInterlace)
822  {
823  F2Loc.SetLineNumber(uint16_t(smpteLineNumInfo.GetFirstActiveLine(NTV2_FIELD1)
824  + ULWord(F1AncDataLoc.GetLineNumber())
825  - smpteLineNumInfo.GetFirstActiveLine(NTV2_FIELD0)));
826  pkt.SetDID(0xC1); pkt.SetSID(0x01); pkt.SetDataLocation(F2Loc);
827  pktData = ULWord(pktData << 16) | ULWord(pktData >> 16);
828  pkt.SetPayloadData(AsCU8Ptr(&pktData), 4);
829  pkts.AddAncillaryData(pkt);
830  }
831  //pkts.Print(cerr, true); cerr << endl;
832  pkts.GetTransmitData (mpHostF1AncBuffer, mpHostF2AncBuffer, !isInterlace, isInterlace ? smpteLineNumInfo.GetLastLine(NTV2_FIELD0)+1 : 0);
833  }
834  // Write ANC data
835  mDevice.DMAWriteAnc (currentOutFrame, mpHostF1AncBuffer, mpHostF2AncBuffer);
836  }
837 
838  // Write the output timecode (for all SDI output spigots)...
839  for (NTV2ChannelSetConstIter iter(mRP188Outputs.begin()); iter != mRP188Outputs.end(); ++iter)
840  mDevice.SetRP188Data (*iter, timecodeValue);
841 
842  // Check for dropped frames by ensuring the hardware has not started to process
843  // the buffers that were just filled....
844  uint32_t readBackIn;
845  uint32_t readBackOut;
846  mDevice.GetInputFrame (mConfig.fInputChannel, readBackIn);
847  mDevice.GetOutputFrame (mConfig.fOutputChannel, readBackOut);
848 
849  if ((readBackIn == currentInFrame) || (readBackOut == currentOutFrame))
850  {
851  cerr << "## WARNING: Drop detected: current in " << currentInFrame << ", readback in " << readBackIn
852  << ", current out " << currentOutFrame << ", readback out " << readBackOut << endl;
853  mFramesDropped++;
854  }
855  else
856  mFramesProcessed++;
857 
858  // Tell the hardware which buffers to start using at the beginning of the next frame...
859  mDevice.SetInputFrame (mConfig.fInputChannel, currentInFrame);
860  if (doAncInput)
861  mDevice.AncExtractSetWriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
862  if (doAncInput && isInterlace)
863  mDevice.AncExtractSetField2WriteParams (sdiInput, currentInFrame, mConfig.fInputChannel);
864 
865  mDevice.SetOutputFrame (mConfig.fOutputChannel, currentOutFrame);
866  if (doAncOutput)
867  mDevice.AncInsertSetReadParams (sdiOutput, currentOutFrame, ancBytesCapturedF1, mConfig.fOutputChannel);
868  if (doAncOutput && isInterlace)
869  mDevice.AncInsertSetField2ReadParams (sdiOutput, currentOutFrame, ancBytesCapturedF2, mConfig.fOutputChannel);
870 
871  // Enable ANC insertion on first output frame
872  if (mFramesProcessed == 1)
873  mDevice.AncInsertSetEnable (sdiOutput, true);
874 
875  } // loop til quit signaled
876 
877  if (doAncInput)
878  mDevice.AncExtractSetEnable (sdiInput, false); // Stop ANC extractor
879  if (doAncOutput)
880  mDevice.AncInsertSetEnable (sdiOutput, false); // Stop ANC inserter
881 
882  if (doAncInput && mConfig.WithHanc())
883  mDevice.AncExtractSetFilterDIDs (sdiInput, savedDIDs); // Restore prior ANC filtering
884 
885  // Restore previous Anc buffer capacity...
886  mDevice.AncSetFrameBufferSize (savedF1ByteCapacity, savedF2ByteCapacity);
887  BURNNOTE("Thread completed, will exit");
888 
889 } // ProcessFrames
890 
891 
893 
894 
895 void NTV2LLBurn::GetStatus (ULWord & outFramesProcessed, ULWord & outFramesDropped)
896 {
897  outFramesProcessed = mFramesProcessed;
898  outFramesDropped = mFramesDropped;
899 
900 } // GetACStatus
901 
902 
904 {
905  switch (inInputSource)
906  {
907  case NTV2_INPUTSOURCE_SDI1: return kRegRP188InOut1DBB; // reg 29
908  case NTV2_INPUTSOURCE_SDI2: return kRegRP188InOut2DBB; // reg 64
909  case NTV2_INPUTSOURCE_SDI3: return kRegRP188InOut3DBB; // reg 268
910  case NTV2_INPUTSOURCE_SDI4: return kRegRP188InOut4DBB; // reg 273
911  case NTV2_INPUTSOURCE_SDI5: return kRegRP188InOut5DBB; // reg 342
912  case NTV2_INPUTSOURCE_SDI6: return kRegRP188InOut6DBB; // reg 418
913  case NTV2_INPUTSOURCE_SDI7: return kRegRP188InOut7DBB; // reg 427
914  case NTV2_INPUTSOURCE_SDI8: return kRegRP188InOut8DBB; // reg 436
915  default: return 0;
916  } // switch on input source
917 
918 } // GetRP188DBBRegNumForInput
919 
920 
922 {
923  bool result (false);
924  const ULWord regNum (GetRP188DBBRegNumForInput(mConfig.fInputSource));
925  ULWord regValue (0);
926 
927  // Bit 16 of the RP188 DBB register will be set if there is timecode embedded in the input signal...
928  if (regNum && mDevice.ReadRegister(regNum, regValue) && regValue & BIT(16))
929  result = true;
930  return result;
931 
932 } // InputSignalHasTimecode
933 
934 
936 {
937  ULWord regMask (kRegMaskLTC1InPresent);
938  ULWord regValue (0);
939  switch (mConfig.fTimecodeSource)
940  {
941  case NTV2_TCINDEX_LTC1: break;
942  case NTV2_TCINDEX_LTC2: regMask = kRegMaskLTC2InPresent; break;
943  default: return false;
944  }
945  mDevice.ReadRegister (kRegLTCStatusControl, regValue, regMask);
946  return regValue ? true : false;
947 
948 } // AnalogLTCInputHasTimecode
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5047
ULWord GetVideoWriteSize(ULWord inPageSize=4096UL) const
The invalid video input.
Definition: ntv2enums.h:1277
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:1268
Identifies the 5th SDI video input.
Definition: ntv2enums.h:1273
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:433
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3895
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:300
Header file for the low latency NTV2Burn demonstration class.
static ULWord GetRP188DBBRegNumForInput(const NTV2InputSource inInputSource)
Definition: ntv2llburn.cpp:903
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:403
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:5452
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:351
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:1266
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:578
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:1226
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:879
Identifies the 1st HDMI video input.
Definition: ntv2enums.h:1265
NTV2OutputDestination NTV2ChannelToOutputDestination(const NTV2Channel inChannel, const NTV2IOKinds inKinds=NTV2_IOKINDS_SDI)
Converts the given NTV2Channel value into its ordinary equivalent NTV2OutputDestination.
Definition: ntv2utils.cpp:5167
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
#define NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(__f__)
Definition: ntv2enums.h:1049
NTV2EmbeddedAudioInput NTV2InputSourceToEmbeddedAudioInput(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2EmbeddedAudioInput value.
Definition: ntv2utils.cpp:4877
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:1243
NTV2AudioSystem NTV2InputSourceToAudioSystem(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2AudioSystem value.
Definition: ntv2utils.cpp:5071
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:542
virtual AJAStatus SetPriority(AJAThreadPriority priority)
Definition: thread.cpp:133
Analog LTC 2.
Definition: ntv2enums.h:3961
#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:205
virtual AJAStatus Start()
Definition: thread.cpp:91
virtual bool EnableInputInterrupt(const NTV2Channel channel=NTV2_CHANNEL1)
Allows the CNTV2Card instance to wait for and respond to input vertical blanking interrupts originati...
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...
#define false
uint32_t ULWord
Definition: ajatypes.h:223
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:1357
ULWord GetLastLine(const NTV2FieldID inRasterFieldID=NTV2_FIELD0) const
mVideoFormat
Definition: ntv2vcam.cpp:801
Identifies the 8th SDI video input.
Definition: ntv2enums.h:1276
virtual class DeviceCapabilities & features(void)
Definition: ntv2card.h:148
bool CanDoInputSource(const NTV2InputSource inSrc)
virtual bool EnableOutputInterrupt(const NTV2Channel channel=NTV2_CHANNEL1)
Allows the CNTV2Card instance to wait for and respond to output vertical blanking interrupts originat...
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:164
Identifies the 2nd SDI video input.
Definition: ntv2enums.h:1270
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:1076
#define AsULWordPtr(_p_)
Definition: ntv2llburn.cpp:27
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:476
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:425
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:3986
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:501
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:485
AutoCirculate Frame Range.
Definition: ntv2utils.h:971
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:5155
NTV2Channel fOutputChannel
The output channel to use.
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:412
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:3960
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:165
0: Disabled (never recommended): device configured exclusively by client application(s).
Playout (output) mode, which reads from device SDRAM.
Definition: ntv2enums.h:1241
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:401
Invalid or "not found".
Definition: ntv2enums.h:98
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:1843
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:1271
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:1165
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
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:69
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:465
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:5274
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:2030
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:1366
virtual bool InputSignalHasTimecode(void)
Returns true if the current input signal has timecode embedded in it; otherwise returns false...
Definition: ntv2llburn.cpp:921
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:1360
virtual NTV2DeviceID GetDeviceID(void)
uint64_t ULWord64
Definition: ajatypes.h:226
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:525
Identifies the 4th SDI video input.
Definition: ntv2enums.h:1272
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:1346
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:449
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...
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1262
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:935
bool IsRGBFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5410
Identifies the 6th SDI video input.
Definition: ntv2enums.h:1274
virtual void RouteOutputSignal(void)
Sets up board routing for playout.
Definition: ntv2llburn.cpp:447
virtual bool SetAudioBufferSize(const NTV2AudioBufferSize inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Changes the size of the audio buffer that is used for a given Audio System in the AJA device...
Definition: ntv2audio.cpp:249
#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:895
This identifies the first Audio System.
Definition: ntv2enums.h:3897
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:965
Identifies the 7th SDI video input.
Definition: ntv2enums.h:1275
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:2527
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget&#39;s output (...
Definition: ntv2enums.h:2752
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:4230
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:2909
uint16_t UWord
Definition: ajatypes.h:221
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:1359
virtual ~NTV2LLBurn()
Definition: ntv2llburn.cpp:48
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 SubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Causes me to be notified when an output vertical blanking interrupt is generated for the given output...
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...
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:1267
Declares the NTV2FormatDescriptor class.
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2llburn.cpp:80
#define NTV2_INPUT_SOURCE_IS_ANALOG(_inpSrc_)
Definition: ntv2enums.h:1282
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:1640
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:1362
NTV2Channel fInputChannel
The input channel to use.
Specifies channel or FrameStore 5 (or the 5th item).
Definition: ntv2enums.h:1363
Identifies the first analog video input.
Definition: ntv2enums.h:1264
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:514
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:4901
Identifies the first field in time for an interlaced video frame, or the first and only field in a pr...
Definition: ntv2enums.h:1842
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:3898
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:1364
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, designating a contiguous block of frame buffers on the ...
bool fWithHanc
If true, capture & play HANC data, including audio (LLBurn). Defaults to false.
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
std::string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:5727
Specifies channel or FrameStore 7 (or the 7th item).
Definition: ntv2enums.h:1365
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Definition: ntv2enums.h:1283
bool GetRP188Str(std::string &sRP188) const
Definition: ntv2rp188.cpp:918
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:4229
Identifies the 1st SDI video input.
Definition: ntv2enums.h:1269
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:1117
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:146
virtual bool StopAudioInput(const NTV2AudioSystem inAudioSystem)
Stops the capture side of the given NTV2AudioSystem, and resets the capture position (i...
Definition: ntv2audio.cpp:1207
#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:3799
std::set< UByte > NTV2DIDSet
A set of distinct NTV2DID values.
Specifies channel or FrameStore 3 (or the 3rd item).
Definition: ntv2enums.h:1361
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:5023
See 8-Bit YCbCr Format.
Definition: ntv2enums.h:223
NTV2InputSource fInputSource
The device input connector to use.
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.