AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
ntv2burn.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2burn.h"
9 #include "ntv2devicescanner.h"
10 #include "ntv2testpatterngen.h" // Needed for --novideo
11 #include "ajabase/common/types.h"
12 #include "ajabase/system/process.h"
14 #include <iostream>
15 
16 using namespace std;
17 
18 //#define NTV2_BUFFER_LOCKING // Define this to pre-lock video/audio buffers in kernel
19 
20 static const uint32_t kAppSignature (NTV2_FOURCC('B','u','r','n'));
21 
22 
24 
25 
26 NTV2Burn::NTV2Burn (const BurnConfig & inConfig)
27  : mConfig (inConfig),
28  mPlayThread (AJAThread()),
29  mCaptureThread (AJAThread()),
30  mDeviceID (DEVICE_ID_NOTFOUND),
31  mVideoFormat (NTV2_FORMAT_UNKNOWN),
32  mSavedTaskMode (NTV2_DISABLE_TASKS),
33  mOutputDest (NTV2_OUTPUTDESTINATION_INVALID),
34  mAudioSystem (inConfig.WithAudio() ? ::NTV2InputSourceToAudioSystem(inConfig.fInputSource) : NTV2_AUDIOSYSTEM_INVALID),
35  mGlobalQuit (false)
36 {
37 } // constructor
38 
39 
41 {
42  Quit(); // Stop my capture and playout threads, then destroy them
43  mDevice.UnsubscribeInputVerticalEvent(mConfig.fInputChannel); // Unsubscribe from input VBI event
44 } // destructor
45 
46 
47 void NTV2Burn::Quit (void)
48 {
49  // Set the global 'quit' flag, and wait for the threads to go inactive...
50  mGlobalQuit = true;
51 
52  while (mPlayThread.Active())
53  AJATime::Sleep(10);
54 
55  while (mCaptureThread.Active())
56  AJATime::Sleep(10);
57 
58  if (!mConfig.fDoMultiFormat)
59  { // Release the device...
61  if (NTV2_IS_VALID_TASK_MODE(mSavedTaskMode))
62  mDevice.SetEveryFrameServices(mSavedTaskMode); // Restore prior task mode
63  }
64 } // Quit
65 
66 
68 {
70 
71  // Open the device...
73  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl; return AJA_STATUS_OPEN;}
74 
75  if (!mDevice.IsDeviceReady(false))
76  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
77 
78  mDeviceID = mDevice.GetDeviceID(); // Keep the device ID handy since it will be used frequently
79  if (!mDevice.features().CanDoCapture())
80  {cerr << "## ERROR: Device '" << mDeviceID << "' cannot capture" << endl; return AJA_STATUS_FEATURE;}
81  if (!mDevice.features().CanDoPlayback())
82  {cerr << "## ERROR: Device '" << mDeviceID << "' cannot playout" << endl; return AJA_STATUS_FEATURE;}
83 
84  ULWord appSignature (0);
85  int32_t appPID (0);
86  mDevice.GetStreamingApplication (appSignature, appPID); // Who currently "owns" the device?
87  mDevice.GetEveryFrameServices(mSavedTaskMode); // Save the current device state
88  if (!mConfig.fDoMultiFormat)
89  {
91  {
92  cerr << "## ERROR: Unable to acquire device because another app (pid " << appPID << ") owns it" << endl;
93  return AJA_STATUS_BUSY; // Some other app is using the device
94  }
95  mDevice.ClearRouting(); // Clear the current device routing (since I "own" the device)
96  }
97  mDevice.SetEveryFrameServices(NTV2_OEM_TASKS); // Force OEM tasks
98 
99  // Configure the SDI relays if present
100  if (mDevice.features().HasSDIRelays())
101  {
102  // Note that if the board's jumpers are not set in the position
103  // to enable the watchdog timer, these calls will have no effect.
104  mDevice.SetSDIWatchdogEnable(true, 0); // SDI 1/2
105  mDevice.SetSDIWatchdogEnable(true, 1); // SDI 3/4
106 
107  // Set timeout delay to 2 seconds expressed in multiples of 8 ns
108  // and take the relays out of bypass...
109  mDevice.SetSDIWatchdogTimeout(2 * 125000000);
110  mDevice.KickSDIWatchdog();
111 
112  // Give the mechanical relays some time to switch...
113  AJATime::Sleep(500);
114  }
115 
116  // Make sure the device actually supports custom anc before using it...
117  if (mConfig.WithAnc())
118  mConfig.fWithAnc = mDevice.features().CanDoCustomAnc();
119 
120  // Set up the video and audio...
121  status = SetupVideo();
122  if (AJA_FAILURE(status))
123  return status;
124  status = mConfig.WithAudio() ? SetupAudio() : AJA_STATUS_SUCCESS;
125  if (AJA_FAILURE(status))
126  return status;
127 
128  // Set up the circular buffers...
129  status = SetupHostBuffers();
130  if (AJA_FAILURE(status))
131  return status;
132 
133  // Set up the signal routing...
136 
137  // Lastly, prepare my AJATimeCodeBurn instance...
139  mFormatDesc.numPixels,
140  mFormatDesc.numLines);
141  // Ready to go...
142  #if defined(_DEBUG)
143  cerr << mConfig;
144  if (mDevice.IsRemote())
145  cerr << "Device Description: " << mDevice.GetDescription() << endl;
146  cerr << endl;
147  #endif // not _DEBUG
148  BURNINFO("Configuration: " << mConfig);
149  return AJA_STATUS_SUCCESS;
150 
151 } // Init
152 
153 
155 {
156  const UWord numFrameStores (mDevice.features().GetNumFrameStores());
157 
158  // Does this device have the requested input source?
159  if (!mDevice.features().CanDoInputSource(mConfig.fInputSource))
160  {cerr << "## ERROR: Device does not have the specified input source" << endl; return AJA_STATUS_BAD_PARAM;}
161 
162  // Pick an input NTV2Channel from the input source, and enable its frame buffer...
164  mDevice.EnableChannel (mConfig.fInputChannel); // Enable the input frame buffer
165 
166  // Pick an appropriate output NTV2Channel, and enable its frame buffer...
167  switch (mConfig.fInputSource)
168  {
169  case NTV2_INPUTSOURCE_SDI1: mConfig.fOutputChannel = numFrameStores == 2 || numFrameStores > 4 ? NTV2_CHANNEL2 : NTV2_CHANNEL3;
170  break;
171 
173  case NTV2_INPUTSOURCE_SDI2: mConfig.fOutputChannel = numFrameStores > 4 ? NTV2_CHANNEL3 : NTV2_CHANNEL4;
174  break;
175 
178  break;
179 
181  case NTV2_INPUTSOURCE_SDI4: mConfig.fOutputChannel = numFrameStores > 4 ? NTV2_CHANNEL5 : NTV2_CHANNEL3;
182  break;
183 
184  case NTV2_INPUTSOURCE_SDI5: mConfig.fOutputChannel = NTV2_CHANNEL6; break;
185  case NTV2_INPUTSOURCE_SDI6: mConfig.fOutputChannel = NTV2_CHANNEL7; break;
186  case NTV2_INPUTSOURCE_SDI7: mConfig.fOutputChannel = NTV2_CHANNEL8; break;
187  case NTV2_INPUTSOURCE_SDI8: mConfig.fOutputChannel = NTV2_CHANNEL7; break;
188 
190  case NTV2_INPUTSOURCE_HDMI1: mConfig.fOutputChannel = numFrameStores < 3 ? NTV2_CHANNEL2 : NTV2_CHANNEL3;
191  mAudioSystem = NTV2_AUDIOSYSTEM_2;
192  break;
193  default:
194  case NTV2_INPUTSOURCE_INVALID: cerr << "## ERROR: Bad input source" << endl; return AJA_STATUS_BAD_PARAM;
195  }
196  mDevice.EnableChannel(mConfig.fOutputChannel); // Enable the output frame buffer
197 
198  // Enable/subscribe interrupts...
199  mDevice.EnableInputInterrupt(mConfig.fInputChannel);
201  mDevice.EnableOutputInterrupt(mConfig.fOutputChannel);
203 
204  // Pick an appropriate output spigot based on the output channel...
205  mOutputDest = ::NTV2ChannelToOutputDestination(mConfig.fOutputChannel);
206  if (!mDevice.features().CanDoWidget(NTV2_Wgt12GSDIOut2)
207  && !mDevice.features().CanDoWidget(NTV2_Wgt3GSDIOut2)
208  && !mDevice.features().CanDoWidget(NTV2_WgtSDIOut2))
209  mOutputDest = NTV2_OUTPUTDESTINATION_SDI1; // If device has only one SDI output
210  if (mDevice.features().HasBiDirectionalSDI() // If device has bidirectional SDI connectors...
211  && NTV2_OUTPUT_DEST_IS_SDI(mOutputDest)) // ...and output destination is SDI...
212  mDevice.SetSDITransmitEnable (mConfig.fOutputChannel, true); // ...then enable transmit mode
213 
214  // Flip the input spigot to "receive" if necessary...
215  bool isXmit (false);
216  if (mDevice.features().HasBiDirectionalSDI() // If device has bidirectional SDI connectors...
217  && NTV2_INPUT_SOURCE_IS_SDI(mConfig.fInputSource) // ...and desired input source is SDI...
218  && mDevice.GetSDITransmitEnable (mConfig.fInputChannel, isXmit) // ...and GetSDITransmitEnable succeeds...
219  && isXmit) // ...and input is set to "transmit"...
220  {
221  mDevice.SetSDITransmitEnable (mConfig.fInputChannel, false); // ...then disable transmit mode...
222  mDevice.WaitForOutputVerticalInterrupt (mConfig.fOutputChannel, 10); // ...and allow device to lock to input signal
223  } // if input SDI connector needs to switch from transmit mode
224 
225  // Is there an input signal? What format is it?
226  mVideoFormat = mDevice.GetInputVideoFormat(mConfig.fInputSource);
227  if (mVideoFormat == NTV2_FORMAT_UNKNOWN)
228  {cerr << "## ERROR: No input signal, or can't handle its format" << endl; return AJA_STATUS_NOINPUT;}
229 
230  // Free-run the device clock, since E-to-E mode isn't used, nor is a mixer tied to the input...
232 
233  // Check the timecode source...
235  {
236  const NTV2Channel tcChannel (::NTV2TimecodeIndexToChannel(mConfig.fTimecodeSource));
237  const NTV2Channel endNum (NTV2Channel (mDevice.features().GetNumVideoChannels()));
238  if (tcChannel >= endNum)
239  {cerr << "## ERROR: Timecode source '" << ::NTV2TCIndexToString(mConfig.fTimecodeSource, true) << "' illegal on this device" << endl; return AJA_STATUS_BAD_PARAM;}
240  if (tcChannel == mConfig.fOutputChannel)
241  {cerr << "## ERROR: Timecode source '" << ::NTV2TCIndexToString(mConfig.fTimecodeSource, true) << "' conflicts with output channel" << endl; return AJA_STATUS_BAD_PARAM;}
242  if (mDevice.features().HasBiDirectionalSDI() // If device has bidirectional SDI connectors...
243  && mDevice.GetSDITransmitEnable (tcChannel, isXmit) // ...and GetSDITransmitEnable succeeds...
244  && isXmit) // ...and the SDI timecode source is set to "transmit"...
245  {
246  mDevice.SetSDITransmitEnable (tcChannel, false); // ...then disable transmit mode...
247  AJATime::Sleep (500); // ...and give the device a dozen frames or so to lock to the input signal
248  } // if input SDI connector needs to switch from transmit mode
249 
250  // configure for vitc capture (should the driver do this?)
251  mDevice.SetRP188SourceFilter(tcChannel, 0x01);
252 
253  const NTV2VideoFormat tcInputVideoFormat (mDevice.GetInputVideoFormat (::NTV2TimecodeIndexToInputSource(mConfig.fTimecodeSource)));
254  if (tcInputVideoFormat == NTV2_FORMAT_UNKNOWN)
255  cerr << "## WARNING: Timecode source '" << ::NTV2TCIndexToString(mConfig.fTimecodeSource, true) << "' has no input signal" << endl;
256  if (!InputSignalHasTimecode ())
257  cerr << "## WARNING: Timecode source '" << ::NTV2TCIndexToString(mConfig.fTimecodeSource, true) << "' has no embedded timecode" << endl;
258  }
260  cerr << "## WARNING: Timecode source '" << ::NTV2TCIndexToString(mConfig.fTimecodeSource, true) << "' has no embedded timecode" << endl;
261 
262  // If the device supports different per-channel video formats, configure it as requested...
263  if (mDevice.features().CanDoMultiFormat())
264  mDevice.SetMultiFormatMode(mConfig.fDoMultiFormat);
265 
266  // Set the input/output channel video formats to the video format that was detected earlier...
267  mDevice.SetVideoFormat (mVideoFormat, false, false, mDevice.features().CanDoMultiFormat() ? mConfig.fInputChannel : NTV2_CHANNEL1);
268  if (mDevice.features().CanDoMultiFormat()) // If device supports multiple formats per-channel...
269  mDevice.SetVideoFormat (mVideoFormat, false, false, mConfig.fOutputChannel); // ...then also set the output channel format to the detected input format
270 
271  // Can the device handle the requested frame buffer pixel format?
272  if (!mDevice.features().CanDoFrameBufferFormat(mConfig.fPixelFormat))
273  {cerr << "## ERROR: " << ::NTV2FrameBufferFormatToString(mConfig.fPixelFormat) << " unsupported" << endl; return AJA_STATUS_UNSUPPORTED;}
274 
275  // Set both input and output frame buffers' pixel formats...
276  mDevice.SetFrameBufferFormat (mConfig.fInputChannel, mConfig.fPixelFormat);
277  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mConfig.fPixelFormat);
278 
279  // Normally, timecode embedded in the output signal comes from whatever is written into the RP188
280  // registers (30/31 for SDI out 1, 65/66 for SDIout2, etc.).
281  // AutoCirculate automatically writes the timecode in the AUTOCIRCULATE_TRANSFER's acRP188 field
282  // into these registers (if AutoCirculateInitForOutput was called with AUTOCIRCULATE_WITH_RP188 set).
283  // Newer AJA devices can also bypass these RP188 registers, and simply copy whatever timecode appears
284  // at any SDI input (called the "bypass source"). To ensure that AutoCirculate's playout timecode
285  // will actually be seen in the output signal, "bypass mode" must be disabled...
286  bool bypassIsEnabled (false);
287  mDevice.IsRP188BypassEnabled (::NTV2InputSourceToChannel(mConfig.fInputSource), bypassIsEnabled);
288  if (bypassIsEnabled)
290 
291  // Now that newer AJA devices can capture/play anc data from separate buffers,
292  // there's no need to enable VANC frame geometries...
293  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fInputChannel);
294  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
295  if (::Is8BitFrameBufferFormat(mConfig.fPixelFormat))
296  { // 8-bit FBFs: since not using VANC geometries, disable bit shift...
299  }
300 
302  mDevice.SetLTCInputEnable (true); // Enable analog LTC input (some LTC inputs are shared with reference input)
303 
304  // Now that the video is set up, get information about the current frame geometry...
305  mFormatDesc = NTV2FormatDescriptor (mVideoFormat, mConfig.fPixelFormat);
306  if (mFormatDesc.IsPlanar())
307  {cerr << "## ERROR: This demo doesn't work with planar pixel formats" << endl; return AJA_STATUS_UNSUPPORTED;}
308  return AJA_STATUS_SUCCESS;
309 
310 } // SetupVideo
311 
312 
314 {
315  if (!NTV2_IS_VALID_AUDIO_SYSTEM(mAudioSystem))
316  return AJA_STATUS_SUCCESS;
317 
318  // Have the audio subsystem capture audio from the designated input source...
319  mDevice.SetAudioSystemInputSource (mAudioSystem, ::NTV2InputSourceToAudioSource(mConfig.fInputSource),
321 
322  // It's best to use all available audio channels...
323  mDevice.SetNumberAudioChannels (mDevice.features().GetMaxAudioChannels(), mAudioSystem);
324 
325  // Assume 48kHz PCM...
326  mDevice.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
327 
328  // 4MB device audio buffers work best...
329  mDevice.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
330 
331  // Set up the output audio embedders...
332  if (mDevice.features().GetNumAudioSystems() > 1)
333  {
334  // Some devices, like the Kona1, have 2 FrameStores but only 1 SDI output,
335  // which makes mConfig.fOutputChannel == NTV2_CHANNEL2, but need SDIoutput to be NTV2_CHANNEL1...
336  UWord SDIoutput(mConfig.fOutputChannel);
337  if (SDIoutput >= mDevice.features().GetNumVideoOutputs())
338  SDIoutput = mDevice.features().GetNumVideoOutputs() - 1;
339  mDevice.SetSDIOutputAudioSystem (NTV2Channel(SDIoutput), mAudioSystem);
340 
341  if (mDevice.features().GetNumHDMIVideoOutputs() > 0)
343  }
344 
345  //
346  // Loopback mode plays whatever audio appears in the input signal when it's
347  // connected directly to an output (i.e., "end-to-end" mode). If loopback is
348  // left enabled, the video will lag the audio as video frames get briefly delayed
349  // in our ring buffer. Audio, therefore, needs to come out of the (buffered) frame
350  // data being played, so loopback must be turned off...
351  //
352  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, mAudioSystem);
353  return AJA_STATUS_SUCCESS;
354 
355 } // SetupAudio
356 
357 
359 {
360  CNTV2DemoCommon::SetDefaultPageSize(); // Set host-specific page size
361 
362  // Let my circular buffer know when it's time to quit...
363  mFrameDataRing.SetAbortFlag (&mGlobalQuit);
364 
365  // Determine video buffer size...
366  const ULWord vidBuffSizeBytes (mFormatDesc.GetVideoWriteSize(ULWord(NTV2Buffer::DefaultPageSize())));
367 
368  // Determine per-field max Anc buffer size...
369  ULWord ancBuffSizeBytes (0);
370  if (!mDevice.GetAncRegionOffsetFromBottom (ancBuffSizeBytes, NTV2_AncRgn_Field2))
371  ancBuffSizeBytes = NTV2_ANCSIZE_MAX;
372 
373  // Allocate and add each in-host NTV2FrameData to my mFrameDataRing...
374  mHostBuffers.reserve(CIRCULAR_BUFFER_SIZE);
375  while (mHostBuffers.size() < CIRCULAR_BUFFER_SIZE)
376  {
377  mHostBuffers.push_back(NTV2FrameData()); // Make a new NTV2FrameData...
378  NTV2FrameData & frameData (mHostBuffers.back()); // ...and get a reference to it
379 
380  // Allocate a page-aligned video buffer (if handling video)...
381  if (!mConfig.fSuppressVideo)
382  if (!frameData.fVideoBuffer.Allocate (vidBuffSizeBytes, /*pageAligned*/true))
383  {
384  BURNFAIL("Failed to allocate " << xHEX0N(vidBuffSizeBytes,8) << "-byte video buffer");
385  return AJA_STATUS_MEMORY;
386  }
387  #ifdef NTV2_BUFFER_LOCKING
388  if (frameData.fVideoBuffer)
389  mDevice.DMABufferLock(frameData.fVideoBuffer, true);
390  #endif
391 
392  // Allocate a page-aligned audio buffer (if handling audio)...
393  if (NTV2_IS_VALID_AUDIO_SYSTEM(mAudioSystem) && mConfig.WithAudio())
394  if (!frameData.fAudioBuffer.Allocate (NTV2_AUDIOSIZE_MAX, /*pageAligned*/true))
395  {
396  BURNFAIL("Failed to allocate " << xHEX0N(NTV2_AUDIOSIZE_MAX,8) << "-byte audio buffer");
397  return AJA_STATUS_MEMORY;
398  }
399  if (frameData.AudioBuffer())
400  frameData.fAudioBuffer.Fill(ULWord(0));
401 
402  if (mConfig.WithAnc())
403  { // Allocate page-aligned anc buffers...
404  if (!frameData.fAncBuffer.Allocate (ancBuffSizeBytes, /*pageAligned*/true))
405  {
406  BURNFAIL("Failed to allocate " << xHEX0N(ancBuffSizeBytes,8) << "-byte anc buffer");
407  return AJA_STATUS_MEMORY;
408  }
409  if (!::IsProgressivePicture(mVideoFormat))
410  if (!frameData.fAncBuffer2.Allocate(ancBuffSizeBytes, /*pageAligned*/true))
411  {
412  BURNFAIL("Failed to allocate " << xHEX0N(ancBuffSizeBytes,8) << "-byte F2 anc buffer");
413  return AJA_STATUS_MEMORY;
414  }
415  }
416  if (frameData.AncBuffer())
417  frameData.AncBuffer().Fill(ULWord(0));
418  if (frameData.AncBuffer2())
419  frameData.AncBuffer2().Fill(ULWord(0));
420 
421  // Add this NTV2FrameData to the ring...
422  mFrameDataRing.Add(&frameData);
423  } // for each NTV2FrameData
424 
425  return AJA_STATUS_SUCCESS;
426 
427 } // SetupHostBuffers
428 
429 
431 {
432  const NTV2OutputCrosspointID inputOutputXpt (::GetInputSourceOutputXpt(mConfig.fInputSource));
434  const bool isRGB (::IsRGBFormat(mConfig.fPixelFormat));
435 
436  if (isRGB)
437  {
438  // If the frame buffer is configured for RGB pixel format, incoming YUV must be converted.
439  // This routes the video signal from the input through a color space converter before
440  // connecting to the RGB frame buffer...
441  const NTV2InputCrosspointID cscVideoInputXpt (::GetCSCInputXptFromChannel (mConfig.fInputChannel));
442  const NTV2OutputCrosspointID cscOutputXpt (::GetCSCOutputXptFromChannel (mConfig.fInputChannel, false/*isKey*/, true/*isRGB*/));
443 
444  mDevice.Connect (cscVideoInputXpt, inputOutputXpt); // Connect the CSC's video input to the input spigot's output
445  mDevice.Connect (fbInputXpt, cscOutputXpt); // Connect the frame store's input to the CSC's output
446  }
447  else
448  mDevice.Connect (fbInputXpt, inputOutputXpt); // Route the YCbCr signal directly from the input to the frame buffer's input
449 
450 } // RouteInputSignal
451 
452 
454 {
455  const NTV2InputCrosspointID outputInputXpt (::GetOutputDestInputXpt(mOutputDest));
457  const bool isRGB (::IsRGBFormat(mConfig.fPixelFormat));
458  NTV2OutputCrosspointID outputXpt (fbOutputXpt);
459 
460  if (isRGB)
461  {
462  const NTV2OutputCrosspointID cscVidOutputXpt (::GetCSCOutputXptFromChannel(mConfig.fOutputChannel)); // Use CSC's YUV video output
463  const NTV2InputCrosspointID cscVidInputXpt (::GetCSCInputXptFromChannel(mConfig.fOutputChannel));
464 
465  mDevice.Connect (cscVidInputXpt, fbOutputXpt); // Connect the CSC's video input to the frame store's output
466  mDevice.Connect (outputInputXpt, cscVidOutputXpt); // Connect the SDI output's input to the CSC's video output
467  outputXpt = cscVidOutputXpt;
468  }
469  else
470  mDevice.Connect (outputInputXpt, outputXpt);
471 
472  mTCOutputs.clear ();
473  mTCOutputs.insert (::NTV2ChannelToTimecodeIndex(mConfig.fOutputChannel));
474 
475  if (!mConfig.fDoMultiFormat)
476  {
477  // Route all SDI outputs to the outputXpt...
478  const NTV2Channel startNum (NTV2_CHANNEL1);
479  const NTV2Channel endNum (NTV2Channel(mDevice.features().GetNumVideoChannels()));
481  NTV2WidgetID outputWidgetID (NTV2_WIDGET_INVALID);
482 
483  for (NTV2Channel chan (startNum); chan < endNum; chan = NTV2Channel (chan + 1))
484  {
485  // this kills vitc capture
486 // mDevice.SetRP188SourceFilter (chan, 0); // Set all SDI spigots to capture embedded LTC (VITC could be an option)
487 
488  if (chan == mConfig.fInputChannel || chan == mConfig.fOutputChannel)
489  continue; // Skip the input & output channel, already routed
490  if (NTV2_IS_VALID_CHANNEL (tcInputChannel) && chan == tcInputChannel)
491  continue; // Skip the timecode input channel
492  if (mDevice.features().HasBiDirectionalSDI())
493  mDevice.SetSDITransmitEnable (chan, true);
494  if (CNTV2SignalRouter::GetWidgetForInput (::GetSDIOutputInputXpt (chan, mDevice.features().CanDoDualLink()), outputWidgetID, mDeviceID))
495  if (mDevice.features().CanDoWidget(outputWidgetID))
496  {
497  mDevice.Connect (::GetSDIOutputInputXpt (chan), outputXpt);
498  mTCOutputs.insert (::NTV2ChannelToTimecodeIndex (chan));
499  mTCOutputs.insert (::NTV2ChannelToTimecodeIndex (chan, true));
500  }
501  } // for each output spigot
502 
503  // If HDMI and/or analog video outputs are available, route them, too...
504  if (mDevice.features().GetNumHDMIVideoOutputs() > 0)
505  mDevice.Connect (NTV2_XptHDMIOutQ1Input, outputXpt); // Route the output signal to the HDMI output
506  if (mDevice.features().CanDoWidget(NTV2_WgtAnalogOut1))
507  mDevice.Connect (NTV2_XptAnalogOutInput, outputXpt); // Route the output signal to the Analog output
508  if (mDevice.features().CanDoWidget(NTV2_WgtSDIMonOut1))
509  mDevice.Connect (::GetSDIOutputInputXpt (NTV2_CHANNEL5), outputXpt); // Route the output signal to the SDI monitor output
510  } // if not multiChannel
511  PLDBG(mTCOutputs.size() << " timecode destination(s): " << mTCOutputs);
512 
513 } // RouteOutputSignal
514 
515 
517 {
518  // Start the playout and capture threads...
519  StartPlayThread();
521  return AJA_STATUS_SUCCESS;
522 
523 } // Run
524 
525 
526 
528 
529 // This is where we will start the play thread
531 {
532  // Create and start the playout thread...
533  mPlayThread.Attach(PlayThreadStatic, this);
535  mPlayThread.Start();
536 
537 } // StartPlayThread
538 
539 
540 // The playout thread function
541 void NTV2Burn::PlayThreadStatic (AJAThread * pThread, void * pContext) // static
542 { (void) pThread;
543  // Grab the NTV2Burn instance pointer from the pContext parameter,
544  // then call its PlayFrames method...
545  NTV2Burn * pApp (reinterpret_cast<NTV2Burn*>(pContext));
546  pApp->PlayFrames();
547 
548 } // PlayThreadStatic
549 
550 
552 {
553  const ULWord acOptions (AUTOCIRCULATE_WITH_RP188 | (mConfig.WithAnc() ? AUTOCIRCULATE_WITH_ANC : 0));
554  ULWord goodXfers(0), badXfers(0), starves(0), noRoomWaits(0);
555  AUTOCIRCULATE_TRANSFER outputXferInfo;
556  AUTOCIRCULATE_STATUS outputStatus;
557 
558  // Stop AutoCirculate on this channel, just in case some other app left it running...
559  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
560  mDevice.WaitForOutputVerticalInterrupt(mConfig.fOutputChannel, 4); // Let it stop
561  BURNNOTE("Thread started");
562 
563  // Initialize AutoCirculate...
564  if (!mDevice.AutoCirculateInitForOutput (mConfig.fOutputChannel, mConfig.fOutputFrames.count(), mAudioSystem, acOptions,
565  1 /*numChannels*/, mConfig.fOutputFrames.firstFrame(), mConfig.fOutputFrames.lastFrame()))
566  {BURNFAIL("AutoCirculateInitForOutput failed"); mGlobalQuit = true;}
567  else if (!mConfig.WithVideo())
568  { // Video suppressed --
569  // Clear device frame buffers being AutoCirculated (prevent garbage output frames)
570  NTV2Buffer tmpFrame (mFormatDesc.GetVideoWriteSize());
571  NTV2TestPatternGen blackPatternGen;
572  blackPatternGen.DrawTestPattern (NTV2_TestPatt_Black, mFormatDesc, tmpFrame);
573  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
574  for (uint16_t frmNum(outputStatus.GetStartFrame()); frmNum <= outputStatus.GetEndFrame(); frmNum++)
575  mDevice.DMAWriteFrame(ULWord(frmNum), tmpFrame, mFormatDesc.GetTotalBytes(), mConfig.fOutputChannel);
576  } // else if --novideo
577 
578  while (!mGlobalQuit)
579  {
580  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
581 
582  // Check if there's room for another frame on the card...
583  if (outputStatus.CanAcceptMoreOutputFrames())
584  {
585  // Device has at least one free frame buffer that can be filled.
586  // Wait for the next frame in our ring to become ready to "consume"...
587  NTV2FrameData * pFrameData (mFrameDataRing.StartConsumeNextBuffer());
588  if (!pFrameData)
589  {starves++; continue;} // Producer thread isn't producing frames fast enough
590 
591  // Prepare to transfer this timecode-burned frame to the device for playout.
592  // Set the XferInfo struct's video, audio and anc buffers from playData's buffers...
593  if (pFrameData->VideoBuffer())
594  outputXferInfo.SetVideoBuffer (pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
595  if (pFrameData->AudioBuffer())
596  outputXferInfo.SetAudioBuffer (pFrameData->AudioBuffer(), pFrameData->NumCapturedAudioBytes());
597  if (pFrameData->AncBuffer() || pFrameData->AncBuffer2())
598  outputXferInfo.SetAncBuffers (pFrameData->AncBuffer(), pFrameData->NumCapturedAncBytes(), pFrameData->AncBuffer2(), pFrameData->NumCapturedAnc2Bytes());
599 
600  // Tell AutoCirculate to embed this frame's timecode(s) into the SDI output(s)...
601  outputXferInfo.SetOutputTimeCodes(pFrameData->fTimecodes);
602  PLDBG(pFrameData->fTimecodes);
603 
604  // Transfer the frame to the device for eventual playout...
605  if (mDevice.AutoCirculateTransfer (mConfig.fOutputChannel, outputXferInfo))
606  goodXfers++;
607  else
608  badXfers++;
609 
610  if (goodXfers == 3) // Start AutoCirculate playout once 3 frames are buffered on the device...
611  mDevice.AutoCirculateStart(mConfig.fOutputChannel);
612 
613  // Signal that the frame has been "consumed"...
614  mFrameDataRing.EndConsumeNextBuffer ();
615  continue; // Back to top of while loop
616  } // if CanAcceptMoreOutputFrames
617 
618  // Wait for one or more buffers to become available on the device, which should occur at next VBI...
619  noRoomWaits++;
621  } // loop til quit signaled
622 
623  // Stop AutoCirculate...
624  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
625  BURNNOTE("Thread completed: " << DEC(goodXfers) << " xfers, " << DEC(badXfers) << " failed, "
626  << DEC(starves) << " ring starves, " << DEC(noRoomWaits) << " device starves");
627 } // PlayFrames
628 
629 
631 
632 
633 
635 //
636 // This is where the capture thread gets started
637 //
639 {
640  // Create and start the capture thread...
641  mCaptureThread.Attach(CaptureThreadStatic, this);
642  mCaptureThread.SetPriority(AJA_ThreadPriority_High);
643  mCaptureThread.Start();
644 
645 } // StartCaptureThread
646 
647 
648 //
649 // The static capture thread function
650 //
651 void NTV2Burn::CaptureThreadStatic (AJAThread * pThread, void * pContext) // static
652 { (void) pThread;
653  // Grab the NTV2Burn instance pointer from the pContext parameter,
654  // then call its CaptureFrames method...
655  NTV2Burn * pApp (reinterpret_cast<NTV2Burn*>(pContext));
656  pApp->CaptureFrames();
657 } // CaptureThreadStatic
658 
659 
660 //
661 // Repeatedly captures frames until told to stop
662 //
664 {
665  AUTOCIRCULATE_TRANSFER inputXferInfo;
666  const ULWord acOptions ((mConfig.WithTimecode() ? AUTOCIRCULATE_WITH_RP188 : 0) | (mConfig.WithAnc() ? AUTOCIRCULATE_WITH_ANC : 0));
667  ULWord goodXfers(0), badXfers(0), ringFulls(0), devWaits(0);
668  Bouncer<UWord> yPercent (85/*upperLimit*/, 1/*lowerLimit*/, 1/*startValue*/); // "Bounces" timecode up & down in raster
669  BURNNOTE("Thread started");
670 
671  // Stop AutoCirculate on this channel, just in case some other app left it running...
672  mDevice.AutoCirculateStop(mConfig.fInputChannel);
673 
674  // Initialize AutoCirculate...
675  if (!mDevice.AutoCirculateInitForInput (mConfig.fInputChannel, // channel
676  mConfig.fInputFrames.count(), // numFrames (zero if specifying range)
677  mAudioSystem, // audio system
678  acOptions, // flags
679  1, // frameStores to gang
680  mConfig.fInputFrames.firstFrame(), mConfig.fInputFrames.lastFrame()))
681  {BURNFAIL("AutoCirculateInitForInput failed"); mGlobalQuit = true;}
682  else
683  // Start AutoCirculate running...
684  mDevice.AutoCirculateStart (mConfig.fInputChannel);
685 
686  while (!mGlobalQuit)
687  {
688  AUTOCIRCULATE_STATUS acStatus;
689  mDevice.AutoCirculateGetStatus (mConfig.fInputChannel, acStatus);
690 
691  if (mDevice.features().HasSDIRelays())
692  mDevice.KickSDIWatchdog(); // Prevent watchdog from timing out and putting the relays into bypass mode
693 
694  if (acStatus.IsRunning() && acStatus.HasAvailableInputFrame())
695  {
696  // At this point, there's at least one fully-formed frame available in the device's frame buffer
697  // memory waiting to be transferred to the host. Reserve an NTV2FrameData to fill ("produce"),
698  // and use it in the next frame transferred from the device...
699  NTV2FrameData * pFrameData (mFrameDataRing.StartProduceNextBuffer ());
700  if (!pFrameData)
701  {ringFulls++; continue;} // Ring full -- consumer thread isn't consuming frames fast enough
702 
703  if (pFrameData->VideoBuffer())
704  inputXferInfo.SetVideoBuffer (pFrameData->VideoBuffer(), pFrameData->VideoBufferSize());
705  if (pFrameData->AudioBuffer())
706  inputXferInfo.SetAudioBuffer (pFrameData->AudioBuffer(), pFrameData->AudioBufferSize());
707  if (pFrameData->AncBuffer() || pFrameData->AncBuffer2())
708  inputXferInfo.SetAncBuffers (pFrameData->AncBuffer(), pFrameData->AncBufferSize(), pFrameData->AncBuffer2(), pFrameData->AncBuffer2Size());
709 
710  // Transfer the frame from the device into our host buffers...
711  if (mDevice.AutoCirculateTransfer (mConfig.fInputChannel, inputXferInfo)) goodXfers++;
712  else badXfers++;
713 
714  // Remember the amount, in bytes, of captured audio & anc data...
715  pFrameData->fNumAudioBytes = pFrameData->AudioBuffer() ? inputXferInfo.GetCapturedAudioByteCount() : 0;
716  pFrameData->fNumAncBytes = pFrameData->AncBuffer() ? inputXferInfo.GetCapturedAncByteCount(false/*F1*/): 0;
717  pFrameData->fNumAnc2Bytes = pFrameData->AncBuffer2() ? inputXferInfo.GetCapturedAncByteCount(true/*F2*/) : 0;
718 
719  // Determine which timecode value should be burned in to the video frame
720  string timeCodeString;
721  NTV2_RP188 timecodeValue;
723  {
724  // Use the embedded input time code...
725  mDevice.GetRP188Data (mConfig.fInputChannel, timecodeValue);
726  CRP188 inputRP188Info (timecodeValue);
727  inputRP188Info.GetRP188Str(timeCodeString);
728  }
730  {
731  // Use the analog input time code...
732  mDevice.ReadAnalogLTCInput (mConfig.fTimecodeSource == NTV2_TCINDEX_LTC1 ? 0 : 1, timecodeValue);
733  CRP188 analogRP188Info (timecodeValue);
734  analogRP188Info.GetRP188Str(timeCodeString);
735  }
736  else
737  {
738  // Invent a timecode (based on the number of frames procesed)...
739  const NTV2FrameRate ntv2FrameRate (GetNTV2FrameRateFromVideoFormat (mVideoFormat));
740  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
741  const CRP188 frameRP188Info (inputXferInfo.GetTransferStatus().GetProcessedFrameCount(), 0, 0, 10, tcFormat);
742 
743  frameRP188Info.GetRP188Reg(timecodeValue);
744  frameRP188Info.GetRP188Str(timeCodeString);
745  }
746 
747  // Get a timecode to use for burn-in...
748  NTV2_RP188 thisFrameTC;
749  inputXferInfo.GetInputTimeCodes (pFrameData->fTimecodes, mConfig.fInputChannel);
750  if (pFrameData->HasValidTimecode(mConfig.fTimecodeSource))
751  {
752  thisFrameTC = pFrameData->fTimecodes[mConfig.fTimecodeSource];
753  }
754  else
755  { // Invent a timecode (based on frame count)...
756  const NTV2FrameRate ntv2FrameRate (::GetNTV2FrameRateFromVideoFormat (mVideoFormat));
757  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
758  const CRP188 inventedTC (inputXferInfo.GetTransferStatus().GetProcessedFrameCount(), 0, 0, 10, tcFormat);
759  inventedTC.GetRP188Reg(thisFrameTC);
760  }
761 
762  // While this NTV2FrameData's buffers are locked, "burn" timecode into the raster...
763  mTCBurner.BurnTimeCode (pFrameData->VideoBuffer(), timeCodeString.c_str(), yPercent.Next());
764 
765  // Signal that we're done "producing" this frame, making it available for future "consumption"...
766  mFrameDataRing.EndProduceNextBuffer();
767  } // if A/C running and frame(s) are available for transfer
768  else
769  {
770  // Either AutoCirculate is not running, or there were no frames available on the device to transfer.
771  // Rather than waste CPU cycles spinning, waiting until a frame becomes available, it's far more
772  // efficient to wait for the next input vertical interrupt event to get signaled...
773  devWaits++;
774  mDevice.WaitForInputFieldID (NTV2_FIELD0, mConfig.fInputChannel);
775  }
776  } // loop til quit signaled
777 
778  // Stop AutoCirculate...
779  mDevice.AutoCirculateStop (mConfig.fInputChannel);
780  BURNNOTE("Thread completed: " << DEC(goodXfers) << " xfers, " << DEC(badXfers) << " failed, "
781  << DEC(ringFulls) << " ring full(s), " << DEC(devWaits) << " device waits");
782 
783 } // CaptureFrames
784 
785 
787 
788 
789 void NTV2Burn::GetStatus (AUTOCIRCULATE_STATUS & outInputStatus, AUTOCIRCULATE_STATUS & outOutputStatus)
790 {
791  mDevice.AutoCirculateGetStatus (mConfig.fInputChannel, outInputStatus);
792  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outOutputStatus);
793 
794 } // GetStatus
795 
796 
797 static ULWord GetRP188RegisterForInput (const NTV2InputSource inInputSource)
798 {
799  switch (inInputSource)
800  {
801  case NTV2_INPUTSOURCE_SDI1: return kRegRP188InOut1DBB; // reg 29
802  case NTV2_INPUTSOURCE_SDI2: return kRegRP188InOut2DBB; // reg 64
803  case NTV2_INPUTSOURCE_SDI3: return kRegRP188InOut3DBB; // reg 268
804  case NTV2_INPUTSOURCE_SDI4: return kRegRP188InOut4DBB; // reg 273
805  case NTV2_INPUTSOURCE_SDI5: return kRegRP188InOut5DBB; // reg 342
806  case NTV2_INPUTSOURCE_SDI6: return kRegRP188InOut6DBB; // reg 418
807  case NTV2_INPUTSOURCE_SDI7: return kRegRP188InOut7DBB; // reg 427
808  case NTV2_INPUTSOURCE_SDI8: return kRegRP188InOut8DBB; // reg 436
809  default: return 0;
810  } // switch on input source
811 
812 } // GetRP188RegisterForInput
813 
814 
816 {
817  const ULWord regNum (::GetRP188RegisterForInput(mConfig.fInputSource));
818  ULWord regValue(0);
819 
820  // Bit 16 of the RP188 DBB register will be set if there is timecode embedded in the input signal...
821  return regNum && mDevice.ReadRegister(regNum, regValue) && regValue & BIT(16);
822 
823 } // InputSignalHasTimecode
824 
825 
827 {
829  return false;
831  bool result(false);
832  mDevice.driverInterface().ReadRegister(kRegLTCStatusControl, result, regMask);
833  return result;
834 
835 } // AnalogLTCInputHasTimecode
NTV2TestPatternGen::DrawTestPattern
virtual bool DrawTestPattern(const std::string &inTPName, const NTV2FormatDescriptor &inFormatDesc, NTV2Buffer &inBuffer)
Renders the given test pattern or color into a host raster buffer.
CNTV2Card::SubscribeOutputVerticalEvent
virtual bool SubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Causes me to be notified when an output vertical blanking interrupt is generated for the given output...
Definition: ntv2subscriptions.cpp:25
CNTV2Card::SetVANCMode
virtual bool SetVANCMode(const NTV2VANCMode inVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the VANC mode for the given FrameStore.
Definition: ntv2register.cpp:2640
NTV2FrameData::NumCapturedAnc2Bytes
ULWord NumCapturedAnc2Bytes(void) const
Definition: ntv2democommon.h:119
GetRP188RegisterForInput
static ULWord GetRP188RegisterForInput(const NTV2InputSource inInputSource)
Definition: ntv2burn.cpp:797
NTV2TimecodeIndexToChannel
NTV2Channel NTV2TimecodeIndexToChannel(const NTV2TCIndex inTCIndex)
Converts the given NTV2TCIndex value into the appropriate NTV2Channel value.
Definition: ntv2utils.cpp:5037
CNTV2Card::SetMultiFormatMode
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
Definition: ntv2register.cpp:4379
NTV2_INPUTSOURCE_SDI4
@ NTV2_INPUTSOURCE_SDI4
Identifies the 4th SDI video input.
Definition: ntv2enums.h:1231
GetSDIOutputInputXpt
NTV2InputXptID GetSDIOutputInputXpt(const NTV2Channel inSDIOutput, const bool inIsDS2=false)
Definition: ntv2signalrouter.cpp:942
NTV2InputSourceToChannel
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5105
AUTOCIRCULATE_TRANSFER::GetTransferStatus
const AUTOCIRCULATE_TRANSFER_STATUS & GetTransferStatus(void) const
Returns a constant reference to my AUTOCIRCULATE_TRANSFER_STATUS.
Definition: ntv2publicinterface.h:8324
NTV2_IS_SDI_TIMECODE_INDEX
#define NTV2_IS_SDI_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3916
NTV2_AUDIO_LOOPBACK_OFF
@ NTV2_AUDIO_LOOPBACK_OFF
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:1975
NTV2FormatDescriptor::GetVideoWriteSize
ULWord GetVideoWriteSize(ULWord inPageSize=4096UL) const
Definition: ntv2formatdescriptor.cpp:862
CNTV2Card::GetAncRegionOffsetFromBottom
virtual bool GetAncRegionOffsetFromBottom(ULWord &outByteOffsetFromBottom, const NTV2AncillaryDataRegion inAncRegion=NTV2_AncRgn_All)
Answers with the byte offset to the start of an ancillary data region within a device frame buffer,...
Definition: ntv2dma.cpp:601
NTV2_CHANNEL8
@ NTV2_CHANNEL8
Specifies channel or Frame Store 8 (or the 8th item).
Definition: ntv2enums.h:1314
AUTOCIRCULATE_TRANSFER::GetCapturedAudioByteCount
ULWord GetCapturedAudioByteCount(void) const
Definition: ntv2publicinterface.h:8336
kRegRP188InOut3DBB
@ kRegRP188InOut3DBB
Definition: ntv2publicinterface.h:391
NTV2_INPUTSOURCE_SDI6
@ NTV2_INPUTSOURCE_SDI6
Identifies the 6th SDI video input.
Definition: ntv2enums.h:1233
NTV2_WgtSDIOut2
@ NTV2_WgtSDIOut2
Definition: ntv2enums.h:2866
NTV2_IS_VALID_TASK_MODE
#define NTV2_IS_VALID_TASK_MODE(__m__)
Definition: ntv2publicinterface.h:4296
NTV2Burn::Init
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2burn.cpp:67
NTV2_FOURCC
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
Definition: ntv2publicinterface.h:5444
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or Frame Store 2 (or the 2nd item).
Definition: ntv2enums.h:1308
NTV2_VANCDATA_NORMAL
@ NTV2_VANCDATA_NORMAL
Definition: ntv2enums.h:3734
AJA_ThreadPriority_High
@ AJA_ThreadPriority_High
Definition: thread.h:44
NTV2ACFrameRange::firstFrame
UWord firstFrame(void) const
Definition: ntv2utils.h:975
CNTV2Card::KickSDIWatchdog
virtual bool KickSDIWatchdog(void)
Restarts the countdown timer to prevent the watchdog timer from timing out.
Definition: ntv2register.cpp:4045
NTV2_WgtSDIMonOut1
@ NTV2_WgtSDIMonOut1
Definition: ntv2enums.h:2909
CNTV2Card::SetVideoFormat
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=(!(0)), const bool inKeepVancSettings=(0), const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
Definition: ntv2register.cpp:204
AUTOCIRCULATE_TRANSFER_STATUS::GetProcessedFrameCount
ULWord GetProcessedFrameCount(void) const
Definition: ntv2publicinterface.h:7923
AJATimeCodeBurn::RenderTimeCodeFont
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
Definition: timecodeburn.cpp:447
CNTV2Card::SetSDIWatchdogEnable
virtual bool SetSDIWatchdogEnable(const bool inEnable, const UWord inIndex0)
Sets the connector pair relays to be under watchdog timer control or manual control.
Definition: ntv2register.cpp:4127
NTV2_AUDIO_BUFFER_BIG
@ NTV2_AUDIO_BUFFER_BIG
Definition: ntv2enums.h:1864
CNTV2MacDriverInterface::ReadRegister
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device....
Definition: ntv2macdriverinterface.cpp:389
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
types.h
Declares common types used in the ajabase library.
NTV2FrameData
I encapsulate the video, audio and anc host buffers used in the AutoCirculate demos....
Definition: ntv2democommon.h:79
AUTOCIRCULATE_TRANSFER::SetAudioBuffer
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2716
Is8BitFrameBufferFormat
bool Is8BitFrameBufferFormat(const NTV2FrameBufferFormat fbFormat)
Definition: ntv2utils.cpp:5484
CRP188::GetRP188Reg
bool GetRP188Reg(RP188_STRUCT &outRP188) const
Definition: ntv2rp188.cpp:1241
NTV2_INPUTSOURCE_SDI7
@ NTV2_INPUTSOURCE_SDI7
Identifies the 7th SDI video input.
Definition: ntv2enums.h:1234
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1305
NTV2FrameData::fNumAncBytes
ULWord fNumAncBytes
Actual number of captured F1 anc bytes.
Definition: ntv2democommon.h:89
NTV2Buffer
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
Definition: ntv2publicinterface.h:5993
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:381
NTV2Burn::RouteOutputSignal
virtual void RouteOutputSignal(void)
Sets up board routing for playout.
Definition: ntv2burn.cpp:453
GetNTV2FrameRateFromVideoFormat
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3530
AJAThread::Attach
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
Definition: thread.cpp:169
CNTV2Card::EnableInputInterrupt
virtual bool EnableInputInterrupt(const NTV2Channel channel=NTV2_CHANNEL1)
Allows the CNTV2Card instance to wait for and respond to input vertical blanking interrupts originati...
Definition: ntv2interrupts.cpp:23
NTV2_AUDIO_48K
@ NTV2_AUDIO_48K
Definition: ntv2enums.h:1875
NTV2FrameData::AncBuffer2
NTV2Buffer & AncBuffer2(void)
Definition: ntv2democommon.h:117
CNTV2Card::ReadAnalogLTCInput
virtual bool ReadAnalogLTCInput(const UWord inLTCInput, RP188_STRUCT &outRP188Data)
Reads the current contents of the device's analog LTC input registers.
Definition: ntv2register.cpp:3695
systemtime.h
Declares the AJATime class.
AJATimeCodeBurn::BurnTimeCode
AJA_EXPORT bool BurnTimeCode(void *pBaseVideoAddress, const std::string &inTimeCodeStr, const uint32_t inYPercent)
Definition: timecodeburn.cpp:45
AJA_STATUS_BUSY
@ AJA_STATUS_BUSY
Definition: types.h:391
CNTV2DeviceScanner::GetFirstDeviceFromArgument
static bool GetFirstDeviceFromArgument(const std::string &inArgument, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command li...
Definition: ntv2devicescanner.cpp:366
BurnConfig::fDoMultiFormat
bool fDoMultiFormat
If true, enables device-sharing; otherwise takes exclusive control of the device.
Definition: ntv2democommon.h:388
BurnConfig::fTimecodeSource
NTV2TCIndex fTimecodeSource
Timecode source to use.
Definition: ntv2democommon.h:387
AJACircularBuffer::StartConsumeNextBuffer
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function to ...
Definition: circularbuffer.h:153
NTV2Burn::CaptureThreadStatic
static void CaptureThreadStatic(AJAThread *pThread, void *pContext)
This is the capture thread's static callback function that gets called when the capture thread runs....
Definition: ntv2burn.cpp:651
NTV2InputSourceToEmbeddedAudioInput
NTV2EmbeddedAudioInput NTV2InputSourceToEmbeddedAudioInput(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2EmbeddedAudioInput value.
Definition: ntv2utils.cpp:4935
NTV2ACFrameRange::count
UWord count(void) const
Definition: ntv2utils.h:974
ntv2testpatterngen.h
Declares the NTV2TestPatternGen class.
GetFrameBufferInputXptFromChannel
NTV2InputXptID GetFrameBufferInputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsBInput=false)
Definition: ntv2signalrouter.cpp:762
NTV2Burn::StartCaptureThread
virtual void StartCaptureThread(void)
Starts my capture thread.
Definition: ntv2burn.cpp:638
CNTV2Card::ClearRouting
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device.
Definition: ntv2regroute.cpp:278
CNTV2Card::AutoCirculateInitForInput
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 ...
Definition: ntv2autocirculate.cpp:221
CNTV2MacDriverInterface::ReleaseStreamForApplication
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
Definition: ntv2macdriverinterface.cpp:516
NTV2_WIDGET_INVALID
@ NTV2_WIDGET_INVALID
Definition: ntv2enums.h:2968
NTV2_AncRgn_Field2
@ NTV2_AncRgn_Field2
Identifies the "normal" Field 2 ancillary data region.
Definition: ntv2enums.h:4146
kRegRP188InOut5DBB
@ kRegRP188InOut5DBB
Definition: ntv2publicinterface.h:479
NTV2FrameData::fAncBuffer2
NTV2Buffer fAncBuffer2
Additional "F2" host anc buffer.
Definition: ntv2democommon.h:86
AJA_STATUS_MEMORY
@ AJA_STATUS_MEMORY
Definition: types.h:397
AJACircularBuffer::EndProduceNextBuffer
void EndProduceNextBuffer(void)
The producer thread calls this function to signal that it has finished populating the frame it obtain...
Definition: circularbuffer.h:259
kRegMaskLTC2InPresent
@ kRegMaskLTC2InPresent
Definition: ntv2publicinterface.h:1884
NTV2Buffer::Allocate
bool Allocate(const size_t inByteCount, const bool inPageAligned=false)
Allocates (or re-allocates) my user-space storage using the given byte count. I assume full responsib...
Definition: ntv2publicinterface.cpp:1630
BurnConfig::fSuppressVideo
bool fSuppressVideo
If true, suppress video; otherwise include video.
Definition: ntv2democommon.h:390
AUTOCIRCULATE_TRANSFER::SetAncBuffers
bool SetAncBuffers(ULWord *pInANCBuffer, const ULWord inANCByteCount, ULWord *pInANCF2Buffer=NULL, const ULWord inANCF2ByteCount=0)
Sets my ancillary data buffers for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2724
NTV2FrameData::fAncBuffer
NTV2Buffer fAncBuffer
Host ancillary data buffer.
Definition: ntv2democommon.h:85
TimecodeFormat
TimecodeFormat
Definition: ntv2rp188.h:27
CNTV2Card::SetAudioLoopBack
virtual bool SetAudioLoopBack(const NTV2AudioLoopBack inMode, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Enables or disables NTV2AudioLoopBack mode for the given NTV2AudioSystem.
Definition: ntv2audio.cpp:300
NTV2_CHANNEL1
@ NTV2_CHANNEL1
Specifies channel or Frame Store 1 (or the first item).
Definition: ntv2enums.h:1307
CNTV2Card::SetFrameBufferFormat
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=(!(0)), NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
Definition: ntv2register.cpp:1812
CNTV2Card::SetSDITransmitEnable
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
Definition: ntv2register.cpp:3796
CNTV2Card::GetSDITransmitEnable
virtual bool GetSDITransmitEnable(const NTV2Channel inChannel, bool &outEnabled)
Answers whether or not the specified SDI connector is currently acting as a transmitter (i....
Definition: ntv2register.cpp:3817
CNTV2Card::SetVANCShiftMode
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
Definition: ntv2register.cpp:2800
AUTOCIRCULATE_STATUS::CanAcceptMoreOutputFrames
bool CanAcceptMoreOutputFrames(void) const
Definition: ntv2publicinterface.h:7231
NTV2_FIELD0
@ NTV2_FIELD0
Identifies the first field in time for an interlaced video frame, or the first and only field in a pr...
Definition: ntv2enums.h:1787
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail::void
j template void())
Definition: json.hpp:4893
NTV2FrameRate
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:396
NTV2_INPUTSOURCE_HDMI3
@ NTV2_INPUTSOURCE_HDMI3
Identifies the 3rd HDMI video input.
Definition: ntv2enums.h:1226
NTV2Burn::StartPlayThread
virtual void StartPlayThread(void)
Starts my playout thread.
Definition: ntv2burn.cpp:530
NTV2_CHANNEL_INVALID
@ NTV2_CHANNEL_INVALID
Definition: ntv2enums.h:1316
NTV2_CHANNEL6
@ NTV2_CHANNEL6
Specifies channel or Frame Store 6 (or the 6th item).
Definition: ntv2enums.h:1312
kRegMaskLTC1InPresent
@ kRegMaskLTC1InPresent
Definition: ntv2publicinterface.h:1882
NTV2InputSourceToAudioSystem
NTV2AudioSystem NTV2InputSourceToAudioSystem(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2AudioSystem value.
Definition: ntv2utils.cpp:5129
CNTV2Card::SetAudioSystemInputSource
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
NTV2FrameData::VideoBuffer
NTV2Buffer & VideoBuffer(void)
Definition: ntv2democommon.h:106
IsProgressivePicture
bool IsProgressivePicture(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5423
CNTV2Card::DMABufferLock
virtual bool DMABufferLock(const NTV2Buffer &inBuffer, bool inMap=(0), bool inRDMA=(0))
Page-locks the given host buffer to reduce transfer time and CPU usage of DMA transfers.
Definition: ntv2dma.cpp:429
NTV2_CHANNEL4
@ NTV2_CHANNEL4
Specifies channel or Frame Store 4 (or the 4th item).
Definition: ntv2enums.h:1310
CNTV2Card::EnableOutputInterrupt
virtual bool EnableOutputInterrupt(const NTV2Channel channel=NTV2_CHANNEL1)
Allows the CNTV2Card instance to wait for and respond to output vertical blanking interrupts originat...
Definition: ntv2interrupts.cpp:22
GetOutputDestInputXpt
NTV2InputXptID GetOutputDestInputXpt(const NTV2OutputDestination inOutputDest, const bool inIsSDI_DS2=false, const UWord inHDMI_Quadrant=99)
Definition: ntv2signalrouter.cpp:928
BurnConfig::fPixelFormat
NTV2PixelFormat fPixelFormat
The pixel format to use.
Definition: ntv2democommon.h:386
NTV2Burn::CaptureFrames
virtual void CaptureFrames(void)
Repeatedly captures frames using AutoCirculate (until global quit flag set).
Definition: ntv2burn.cpp:663
NTV2_CHANNEL5
@ NTV2_CHANNEL5
Specifies channel or Frame Store 5 (or the 5th item).
Definition: ntv2enums.h:1311
CNTV2DriverInterface::ReadRegister
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device....
Definition: ntv2driverinterface.cpp:403
NTV2Burn::GetStatus
virtual void GetStatus(AUTOCIRCULATE_STATUS &outInputStatus, AUTOCIRCULATE_STATUS &outOutputStatus)
Provides status information about my input (capture) and output (playout) processes.
Definition: ntv2burn.cpp:789
CNTV2Card::features
virtual class DeviceCapabilities & features(void)
Definition: ntv2card.h:141
BurnConfig::fOutputFrames
NTV2ACFrameRange fOutputFrames
Playout frame count or range.
Definition: ntv2democommon.h:385
NTV2_INPUTSOURCE_ANALOG1
@ NTV2_INPUTSOURCE_ANALOG1
Identifies the first analog video input.
Definition: ntv2enums.h:1223
AJAThread
Definition: thread.h:69
AUTOCIRCULATE_WITH_ANC
#define AUTOCIRCULATE_WITH_ANC
Use this to AutoCirculate with ancillary data.
Definition: ntv2publicinterface.h:5527
NTV2FrameData::NumCapturedAncBytes
ULWord NumCapturedAncBytes(void) const
Definition: ntv2democommon.h:115
AJAThread::Active
virtual bool Active()
Definition: thread.cpp:116
NTV2_INPUTSOURCE_SDI1
@ NTV2_INPUTSOURCE_SDI1
Identifies the 1st SDI video input.
Definition: ntv2enums.h:1228
NTV2_IS_ANALOG_TIMECODE_INDEX
#define NTV2_IS_ANALOG_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3905
AJA_STATUS_NOINPUT
@ AJA_STATUS_NOINPUT
Definition: types.h:400
AJAStatus
AJAStatus
Definition: types.h:378
NTV2ChannelToOutputDestination
NTV2OutputDestination NTV2ChannelToOutputDestination(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its ordinary equivalent NTV2OutputDestination.
Definition: ntv2utils.cpp:5225
NTV2Buffer::DefaultPageSize
static size_t DefaultPageSize(void)
Definition: ntv2publicinterface.cpp:2007
NTV2Burn::NTV2Burn
NTV2Burn(const BurnConfig &inConfig)
Constructs me using the given configuration settings.
Definition: ntv2burn.cpp:26
NTV2_OUTPUTDESTINATION_SDI1
@ NTV2_OUTPUTDESTINATION_SDI1
Definition: ntv2enums.h:1280
NTV2FormatDescriptor::numPixels
ULWord numPixels
Width – total number of pixels per line.
Definition: ntv2formatdescriptor.h:349
CNTV2Card::GetRP188Data
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...
Definition: ntv2register.cpp:2510
process.h
Declares the AJAProcess class.
CNTV2Card::SetRP188SourceFilter
virtual bool SetRP188SourceFilter(const NTV2Channel inSDIInput, const UWord inFilterValue)
Sets the RP188 DBB filter for the given SDI input.
Definition: ntv2register.cpp:2533
NTV2_Wgt3GSDIOut2
@ NTV2_Wgt3GSDIOut2
Definition: ntv2enums.h:2870
NTV2TCIndexToString
std::string NTV2TCIndexToString(const NTV2TCIndex inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6413
AJATime::Sleep
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
Definition: systemtime.cpp:284
AJACircularBuffer::Add
AJAStatus Add(FrameDataPtr pInFrameData)
Appends a new frame buffer to me, increasing my frame storage capacity by one frame.
Definition: circularbuffer.h:92
NTV2_AUDIOSYSTEM_2
@ NTV2_AUDIOSYSTEM_2
This identifies the 2nd Audio System.
Definition: ntv2enums.h:3817
NTV2_VANCMODE_OFF
@ NTV2_VANCMODE_OFF
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3718
BURNFAIL
#define BURNFAIL(_expr_)
Definition: ntv2democommon.h:40
CNTV2Card::SetSDIOutputAudioSystem
virtual bool SetSDIOutputAudioSystem(const NTV2Channel inSDIOutputConnector, const NTV2AudioSystem inAudioSystem)
Sets the device's NTV2AudioSystem that will provide audio for the given SDI output's audio embedder....
Definition: ntv2register.cpp:3949
AJA_STATUS_FEATURE
@ AJA_STATUS_FEATURE
Definition: types.h:393
NTV2FrameData::HasValidTimecode
bool HasValidTimecode(const NTV2TCIndex inTCNdx) const
Definition: ntv2democommon.h:129
ULWord
uint32_t ULWord
Definition: ajatypes.h:253
NTV2FrameData::NumCapturedAudioBytes
ULWord NumCapturedAudioBytes(void) const
Definition: ntv2democommon.h:111
kRegRP188InOut2DBB
@ kRegRP188InOut2DBB
Definition: ntv2publicinterface.h:167
CNTV2Card::GetDescription
virtual std::string GetDescription(void) const
Definition: ntv2card.cpp:124
NTV2FrameData::fVideoBuffer
NTV2Buffer fVideoBuffer
Host video buffer.
Definition: ntv2democommon.h:82
AUTOCIRCULATE_STATUS
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
Definition: ntv2publicinterface.h:7160
ntv2devicescanner.h
Declares the CNTV2DeviceScanner class.
NTV2_CHANNEL7
@ NTV2_CHANNEL7
Specifies channel or Frame Store 7 (or the 7th item).
Definition: ntv2enums.h:1313
NTV2FrameData::VideoBufferSize
ULWord VideoBufferSize(void) const
Definition: ntv2democommon.h:107
NTV2FormatDescriptor::numLines
ULWord numLines
Height – total number of lines.
Definition: ntv2formatdescriptor.h:348
NTV2FormatDescriptor::GetTotalBytes
ULWord GetTotalBytes(void) const
Definition: ntv2formatdescriptor.cpp:851
CNTV2MacDriverInterface::GetStreamingApplication
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 ...
Definition: ntv2macdriverinterface.cpp:651
AUTOCIRCULATE_TRANSFER::SetOutputTimeCodes
bool SetOutputTimeCodes(const NTV2TimeCodes &inValues)
Intended for playout, replaces the contents of my acOutputTimeCodes member.
Definition: ntv2publicinterface.cpp:2735
CNTV2DemoCommon::SetDefaultPageSize
static size_t SetDefaultPageSize(void)
Definition: ntv2democommon.cpp:1484
NTV2_INPUTSOURCE_INVALID
@ NTV2_INPUTSOURCE_INVALID
The invalid video input.
Definition: ntv2enums.h:1236
NTV2ChannelToTimecodeIndex
NTV2TCIndex NTV2ChannelToTimecodeIndex(const NTV2Channel inChannel, const bool inEmbeddedLTC=false, const bool inIsF2=false)
Converts the given NTV2Channel value into the equivalent NTV2TCIndex value.
Definition: ntv2utils.cpp:5020
CNTV2Card::UnsubscribeInputVerticalEvent
virtual bool UnsubscribeInputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Unregisters me so I'm no longer notified when an input VBI is signaled on the given input channel.
Definition: ntv2subscriptions.cpp:75
GetCSCOutputXptFromChannel
NTV2OutputXptID GetCSCOutputXptFromChannel(const NTV2Channel inCSC, const bool inIsKey=false, const bool inIsRGB=false)
Definition: ntv2signalrouter.cpp:819
AJAProcess::GetPid
static uint64_t GetPid()
Definition: process.cpp:35
NTV2_INPUTSOURCE_SDI5
@ NTV2_INPUTSOURCE_SDI5
Identifies the 5th SDI video input.
Definition: ntv2enums.h:1232
NTV2FrameData::AncBufferSize
ULWord AncBufferSize(void) const
Definition: ntv2democommon.h:114
NTV2Burn::PlayThreadStatic
static void PlayThreadStatic(AJAThread *pThread, void *pContext)
This is the playout thread's static callback function that gets called when the playout thread runs....
Definition: ntv2burn.cpp:541
CNTV2Card::SetLTCInputEnable
virtual bool SetLTCInputEnable(const bool inEnable)
Enables or disables the ability for the device to read analog LTC on the reference input connector.
Definition: ntv2register.cpp:3651
CNTV2Card::driverInterface
virtual CNTV2DriverInterface & driverInterface(void)
Definition: ntv2card.h:6121
AUTOCIRCULATE_TRANSFER::GetCapturedAncByteCount
ULWord GetCapturedAncByteCount(const bool inField2=false) const
Definition: ntv2publicinterface.h:8346
NTV2_CHANNEL3
@ NTV2_CHANNEL3
Specifies channel or Frame Store 3 (or the 3rd item).
Definition: ntv2enums.h:1309
UWord
uint16_t UWord
Definition: ajatypes.h:251
AJACircularBuffer::StartProduceNextBuffer
FrameDataPtr StartProduceNextBuffer(void)
The thread that's responsible for providing frames – the producer – calls this function to populate t...
Definition: circularbuffer.h:109
CNTV2Card::AutoCirculateGetStatus
virtual bool AutoCirculateGetStatus(const NTV2Channel inChannel, AUTOCIRCULATE_STATUS &outStatus)
Returns the current AutoCirculate status for the given channel.
Definition: ntv2autocirculate.cpp:646
NTV2FrameData::AudioBufferSize
ULWord AudioBufferSize(void) const
Definition: ntv2democommon.h:110
NTV2FrameData::AncBuffer2Size
ULWord AncBuffer2Size(void) const
Definition: ntv2democommon.h:118
NTV2FrameData::fNumAudioBytes
ULWord fNumAudioBytes
Actual number of captured audio bytes.
Definition: ntv2democommon.h:88
NTV2_REFERENCE_FREERUN
@ NTV2_REFERENCE_FREERUN
Specifies the device's internal clock.
Definition: ntv2enums.h:1404
AUTOCIRCULATE_TRANSFER
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
Definition: ntv2publicinterface.h:7969
NTV2InputCrosspointID
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget's output (...
Definition: ntv2enums.h:2690
NTV2FrameData::AudioBuffer
NTV2Buffer & AudioBuffer(void)
Definition: ntv2democommon.h:109
NTV2_TestPatt_Black
@ NTV2_TestPatt_Black
Definition: ntv2testpatterngen.h:37
AUTOCIRCULATE_TRANSFER::SetVideoBuffer
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2708
GetCSCInputXptFromChannel
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
Definition: ntv2signalrouter.cpp:775
NTV2WidgetID
NTV2WidgetID
Definition: ntv2enums.h:2847
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1284
NTV2_INPUTSOURCE_HDMI4
@ NTV2_INPUTSOURCE_HDMI4
Identifies the 4th HDMI video input.
Definition: ntv2enums.h:1227
NTV2Burn::InputSignalHasTimecode
virtual bool InputSignalHasTimecode(void)
Returns true if the current input signal has timecode embedded in it; otherwise returns false.
Definition: ntv2burn.cpp:815
NTV2Burn::Quit
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2burn.cpp:47
NTV2_XptHDMIOutQ1Input
@ NTV2_XptHDMIOutQ1Input
Definition: ntv2enums.h:2794
DeviceCapabilities::CanDoInputSource
bool CanDoInputSource(const NTV2InputSource inSrc)
Definition: ntv2devicecapabilities.h:233
AJACircularBuffer::EndConsumeNextBuffer
void EndConsumeNextBuffer(void)
The consumer thread calls this function to signal that it has finished processing the frame it obtain...
Definition: circularbuffer.h:266
BurnConfig::fWithAnc
bool fWithAnc
If true, capture & play anc data (LLBurn). Defaults to false.
Definition: ntv2democommon.h:392
NTV2_INPUTSOURCE_HDMI1
@ NTV2_INPUTSOURCE_HDMI1
Identifies the 1st HDMI video input.
Definition: ntv2enums.h:1224
CNTV2Card::GetInputVideoFormat
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.
Definition: ntv2register.cpp:3365
CRP188
Definition: ntv2rp188.h:55
AUTOCIRCULATE_STATUS::GetEndFrame
uint16_t GetEndFrame(void) const
Definition: ntv2publicinterface.h:7251
kRegRP188InOut1DBB
@ kRegRP188InOut1DBB
Definition: ntv2publicinterface.h:132
NTV2_AUDIOSIZE_MAX
#define NTV2_AUDIOSIZE_MAX
Definition: ntv2democommon.h:46
CNTV2Card::SetEveryFrameServices
virtual bool SetEveryFrameServices(const NTV2EveryFrameTaskMode inMode)
Sets the device's task mode.
Definition: ntv2register.cpp:179
AJA_STATUS_UNSUPPORTED
@ AJA_STATUS_UNSUPPORTED
Definition: types.h:394
CNTV2Card::SetSDIWatchdogTimeout
virtual bool SetSDIWatchdogTimeout(const ULWord inValue)
Specifies the amount of time that must elapse before the watchdog timer times out.
Definition: ntv2register.cpp:4147
PLDBG
#define PLDBG(_xpr_)
Definition: ntv2democommon.h:38
NTV2_OUTPUT_DEST_IS_SDI
#define NTV2_OUTPUT_DEST_IS_SDI(_dest_)
Definition: ntv2enums.h:1294
NTV2_IS_VALID_CHANNEL
#define NTV2_IS_VALID_CHANNEL(__x__)
Definition: ntv2enums.h:1319
NTV2_DISABLE_TASKS
@ NTV2_DISABLE_TASKS
0: Disabled: Device is completely configured by controlling application(s) – no driver involvement.
Definition: ntv2publicinterface.h:4290
BurnConfig::fInputChannel
NTV2Channel fInputChannel
The input channel to use.
Definition: ntv2democommon.h:381
NTV2Burn::SetupVideo
virtual AJAStatus SetupVideo(void)
Sets up everything I need for capturing and playing video.
Definition: ntv2burn.cpp:154
NTV2TestPatternGen
The NTV2 test pattern generator.
Definition: ntv2testpatterngen.h:69
NTV2_INPUTSOURCE_HDMI2
@ NTV2_INPUTSOURCE_HDMI2
Identifies the 2nd HDMI video input.
Definition: ntv2enums.h:1225
NTV2OutputCrosspointID
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget's input (ident...
Definition: ntv2enums.h:2471
BurnConfig::fDeviceSpec
std::string fDeviceSpec
The AJA device to use.
Definition: ntv2democommon.h:379
NTV2InputSource
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1221
BurnConfig::fInputSource
NTV2InputSource fInputSource
The device input connector to use.
Definition: ntv2democommon.h:383
NTV2_FORMAT_UNKNOWN
@ NTV2_FORMAT_UNKNOWN
Definition: ntv2enums.h:498
NTV2FrameData::fAudioBuffer
NTV2Buffer fAudioBuffer
Host audio buffer.
Definition: ntv2democommon.h:84
NTV2Burn
I capture frames from a video signal provided to an AJA device's video input. I burn timecode into th...
Definition: ntv2burn.h:30
CNTV2Card::Connect
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=(0))
Connects the given widget signal input (sink) to the given widget signal output (source).
Definition: ntv2regroute.cpp:87
AJA_STATUS_INITIALIZE
@ AJA_STATUS_INITIALIZE
Definition: types.h:386
CNTV2Card::SetHDMIOutAudioSource2Channel
virtual bool SetHDMIOutAudioSource2Channel(const NTV2AudioChannelPair inNewValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the HDMI output's 2-channel audio source.
Definition: ntv2audio.cpp:863
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5605
false
#define false
Definition: ntv2devicefeatures.h:25
NTV2Burn::PlayFrames
virtual void PlayFrames(void)
Repeatedly plays out frames using AutoCirculate (until global quit flag set).
Definition: ntv2burn.cpp:551
AUTOCIRCULATE_WITH_RP188
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
Definition: ntv2publicinterface.h:5521
ntv2burn.h
Header file for the NTV2Burn demonstration class.
NTV2ACFrameRange::lastFrame
UWord lastFrame(void) const
Definition: ntv2utils.h:976
AUTOCIRCULATE_STATUS::IsRunning
bool IsRunning(void) const
Definition: ntv2publicinterface.h:7266
GetFrameBufferOutputXptFromChannel
NTV2OutputXptID GetFrameBufferOutputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsRGB=false, const bool inIs425=false)
Definition: ntv2signalrouter.cpp:845
NTV2_OUTPUTDESTINATION_INVALID
@ NTV2_OUTPUTDESTINATION_INVALID
Definition: ntv2enums.h:1288
NTV2FrameBufferFormatToString
std::string NTV2FrameBufferFormatToString(const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:6940
kRegRP188InOut4DBB
@ kRegRP188InOut4DBB
Definition: ntv2publicinterface.h:396
NTV2_INPUTSOURCE_SDI8
@ NTV2_INPUTSOURCE_SDI8
Identifies the 8th SDI video input.
Definition: ntv2enums.h:1235
AJA_STATUS_BAD_PARAM
@ AJA_STATUS_BAD_PARAM
Definition: types.h:392
CNTV2Card::WaitForOutputVerticalInterrupt
virtual bool WaitForOutputVerticalInterrupt(const NTV2Channel inChannel=NTV2_CHANNEL1, UWord inRepeatCount=1)
Efficiently sleeps the calling thread/process until the next one or more field (interlaced video) or ...
Definition: ntv2subscriptions.cpp:134
NTV2_INPUTSOURCE_SDI2
@ NTV2_INPUTSOURCE_SDI2
Identifies the 2nd SDI video input.
Definition: ntv2enums.h:1229
std
Definition: json.hpp:5362
NTV2_RP188
This struct replaces the old RP188_STRUCT.
Definition: ntv2publicinterface.h:6760
NTV2_TCINDEX_LTC2
@ NTV2_TCINDEX_LTC2
Analog LTC 2.
Definition: ntv2enums.h:3880
NTV2Burn::AnalogLTCInputHasTimecode
virtual bool AnalogLTCInputHasTimecode(void)
Returns true if there is a valid LTC signal on my device's primary analog LTC input port; otherwise r...
Definition: ntv2burn.cpp:826
IsRGBFormat
bool IsRGBFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5442
CNTV2Card::AutoCirculateTransfer
virtual bool AutoCirculateTransfer(const NTV2Channel inChannel, AUTOCIRCULATE_TRANSFER &transferInfo)
Transfers all or part of a frame as specified in the given AUTOCIRCULATE_TRANSFER object to/from the ...
Definition: ntv2autocirculate.cpp:695
AUTOCIRCULATE_STATUS::GetStartFrame
uint16_t GetStartFrame(void) const
Definition: ntv2publicinterface.h:7246
CNTV2Card::AutoCirculateInitForOutput
virtual bool AutoCirculateInitForOutput(const NTV2Channel inChannel, const UWord inFrameCount=7, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_INVALID, const ULWord inOptionFlags=0, const UByte inNumChannels=1, const UWord inStartFrameNumber=0, const UWord inEndFrameNumber=0)
Prepares for subsequent AutoCirculate playout, designating a contiguous block of frame buffers on the...
Definition: ntv2autocirculate.cpp:353
NTV2VideoFormat
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
NTV2FrameData::fNumAnc2Bytes
ULWord fNumAnc2Bytes
Actual number of captured F2 anc bytes.
Definition: ntv2democommon.h:90
Bouncer
A handy class that makes it easy to "bounce" an unsigned integer value between a minimum and maximum ...
Definition: ntv2democommon.h:167
NTV2Burn::SetupHostBuffers
virtual AJAStatus SetupHostBuffers(void)
Sets up my circular buffers.
Definition: ntv2burn.cpp:358
NTV2_WgtAnalogOut1
@ NTV2_WgtAnalogOut1
Definition: ntv2enums.h:2881
CIRCULAR_BUFFER_SIZE
static const size_t CIRCULAR_BUFFER_SIZE(10)
Number of NTV2FrameData's in our ring.
CNTV2MacDriverInterface::AcquireStreamForApplication
virtual bool AcquireStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
Definition: ntv2macdriverinterface.cpp:481
DeviceCapabilities::CanDoWidget
bool CanDoWidget(const NTV2WidgetID inWgtID)
Definition: ntv2devicecapabilities.h:260
NTV2Burn::RouteInputSignal
virtual void RouteInputSignal(void)
Sets up board routing for capture.
Definition: ntv2burn.cpp:430
CNTV2SignalRouter::GetWidgetForInput
static bool GetWidgetForInput(const NTV2InputXptID inInputXpt, NTV2WidgetID &outWidgetID, const NTV2DeviceID inDeviceID=DEVICE_ID_NOTFOUND)
Returns the widget that "owns" the specified input crosspoint.
Definition: ntv2signalrouter.cpp:398
CNTV2DriverInterface::GetDeviceID
virtual NTV2DeviceID GetDeviceID(void)
Definition: ntv2driverinterface.cpp:381
AUTOCIRCULATE_STATUS::HasAvailableInputFrame
bool HasAvailableInputFrame(void) const
Definition: ntv2publicinterface.h:7236
NTV2_Wgt12GSDIOut2
@ NTV2_Wgt12GSDIOut2
Definition: ntv2enums.h:2952
CNTV2Card::GetEveryFrameServices
virtual bool GetEveryFrameServices(NTV2EveryFrameTaskMode &outMode)
Retrieves the device's current "retail service" task mode.
Definition: ntv2register.cpp:184
GetInputSourceOutputXpt
NTV2OutputXptID GetInputSourceOutputXpt(const NTV2InputSource inInputSource, const bool inIsSDI_DS2=false, const bool inIsHDMI_RGB=false, const UWord inHDMI_Quadrant=0)
Definition: ntv2signalrouter.cpp:865
CNTV2Card::DMAWriteFrame
virtual bool DMAWriteFrame(const ULWord inFrameNumber, const ULWord *pInFrameBuffer, const ULWord inByteCount)
Transfers a single frame from the host to the AJA device.
Definition: ntv2dma.cpp:65
NTV2Burn::SetupAudio
virtual AJAStatus SetupAudio(void)
Sets up everything I need for capturing and playing audio.
Definition: ntv2burn.cpp:313
NTV2TimecodeIndexToInputSource
NTV2InputSource NTV2TimecodeIndexToInputSource(const NTV2TCIndex inTCIndex)
Converts the given NTV2TCIndex value into the appropriate NTV2InputSource value.
Definition: ntv2utils.cpp:5046
CNTV2Card::IsRP188BypassEnabled
virtual bool IsRP188BypassEnabled(const NTV2Channel inSDIOutput, bool &outIsBypassEnabled)
Answers if the SDI output's RP-188 bypass mode is enabled or not.
Definition: ntv2register.cpp:2549
CNTV2Card::DisableRP188Bypass
virtual bool DisableRP188Bypass(const NTV2Channel inSDIOutput)
Configures the SDI output's embedder to embed SMPTE 12M timecode specified in calls to CNTV2Card::Set...
Definition: ntv2register.cpp:2562
AJACircularBuffer::SetAbortFlag
void SetAbortFlag(const bool *pAbortFlag)
Tells me the boolean variable I should monitor such that when it gets set to "true" will cause any th...
Definition: circularbuffer.h:51
NTV2_INPUT_SOURCE_IS_SDI
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Definition: ntv2enums.h:1242
NTV2Buffer::Fill
bool Fill(const T &inValue)
Fills me with the given scalar value.
Definition: ntv2publicinterface.h:6218
AJAThread::SetPriority
virtual AJAStatus SetPriority(AJAThreadPriority priority)
Definition: thread.cpp:133
CNTV2Card::AutoCirculateStart
virtual bool AutoCirculateStart(const NTV2Channel inChannel, const ULWord64 inStartTime=0)
Starts AutoCirculating the specified channel that was previously initialized by CNTV2Card::AutoCircul...
Definition: ntv2autocirculate.cpp:503
CNTV2Card::SetReference
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=(0))
Sets the device's clock reference source. See Video Output Clocking & Synchronization for more inform...
Definition: ntv2register.cpp:1484
AJA_STATUS_OPEN
@ AJA_STATUS_OPEN
Definition: types.h:388
NTV2Burn::Run
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2burn.cpp:516
CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:989
CNTV2Card::WaitForInputFieldID
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 ...
Definition: ntv2subscriptions.cpp:214
AUTOCIRCULATE_TRANSFER::GetInputTimeCodes
bool GetInputTimeCodes(NTV2TimeCodeList &outValues) const
Intended for capture, answers with the timecodes captured in my acTransferStatus member's acFrameStam...
Definition: ntv2publicinterface.cpp:2834
kRegRP188InOut7DBB
@ kRegRP188InOut7DBB
Definition: ntv2publicinterface.h:585
CNTV2Card::SetNumberAudioChannels
virtual bool SetNumberAudioChannels(const ULWord inNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the number of audio channels to be concurrently captured or played for a given Audio System on t...
Definition: ntv2audio.cpp:146
CNTV2Card::SetAudioBufferSize
virtual bool SetAudioBufferSize(const NTV2AudioBufferSize inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Changes the size of the audio buffer that is used for a given Audio System in the AJA device.
Definition: ntv2audio.cpp:249
Bouncer::Next
T Next(void)
Definition: ntv2democommon.h:193
NTV2_INPUTSOURCE_SDI3
@ NTV2_INPUTSOURCE_SDI3
Identifies the 3rd SDI video input.
Definition: ntv2enums.h:1230
AJAThread::Start
virtual AJAStatus Start()
Definition: thread.cpp:91
NTV2InputSourceToAudioSource
NTV2AudioSource NTV2InputSourceToAudioSource(const NTV2InputSource inInputSource)
Definition: ntv2utils.cpp:4959
BURNINFO
#define BURNINFO(_expr_)
Definition: ntv2democommon.h:44
CNTV2DemoCommon::GetAJAPixelFormat
static AJA_PixelFormat GetAJAPixelFormat(const NTV2FrameBufferFormat inFormat)
Definition: ntv2democommon.cpp:1043
BIT
#define BIT(_x_)
Definition: ajatypes.h:561
CNTV2Card::SubscribeInputVerticalEvent
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: ntv2subscriptions.cpp:39
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5604
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition: types.h:371
BurnConfig::fInputFrames
NTV2ACFrameRange fInputFrames
Ingest frame count or range.
Definition: ntv2democommon.h:384
NTV2_IS_VALID_AUDIO_SYSTEM
#define NTV2_IS_VALID_AUDIO_SYSTEM(__x__)
Definition: ntv2enums.h:3833
NTV2_AudioChannel1_2
@ NTV2_AudioChannel1_2
This selects audio channels 1 and 2 (Group 1 channels 1 and 2)
Definition: ntv2enums.h:3058
NTV2_TCINDEX_LTC1
@ NTV2_TCINDEX_LTC1
Analog LTC 1.
Definition: ntv2enums.h:3879
NTV2_INPUT_SOURCE_IS_ANALOG
#define NTV2_INPUT_SOURCE_IS_ANALOG(_inpSrc_)
Definition: ntv2enums.h:1241
kRegLTCStatusControl
@ kRegLTCStatusControl
Definition: ntv2publicinterface.h:356
BurnConfig
Configures an NTV2Burn or NTV2FieldBurn instance.
Definition: ntv2democommon.h:376
CNTV2Card::EnableChannel
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.
Definition: ntv2register.cpp:2097
DeviceCapabilities::CanDoFrameBufferFormat
bool CanDoFrameBufferFormat(const NTV2PixelFormat inPF)
Definition: ntv2devicecapabilities.h:223
NTV2Burn::~NTV2Burn
virtual ~NTV2Burn()
Definition: ntv2burn.cpp:40
NTV2FrameData::AncBuffer
NTV2Buffer & AncBuffer(void)
Definition: ntv2democommon.h:113
kAppSignature
static const uint32_t kAppSignature(((((uint32_t)( 'B'))<< 24)|(((uint32_t)( 'u'))<< 16)|(((uint32_t)( 'r'))<< 8)|(((uint32_t)( 'n'))<< 0)))
NTV2_XptAnalogOutInput
@ NTV2_XptAnalogOutInput
Definition: ntv2enums.h:2810
CNTV2Card::AutoCirculateStop
virtual bool AutoCirculateStop(const NTV2Channel inChannel, const bool inAbort=(0))
Stops AutoCirculate for the given channel, and releases the on-device frame buffers that were allocat...
Definition: ntv2autocirculate.cpp:519
DEVICE_ID_NOTFOUND
@ DEVICE_ID_NOTFOUND
Invalid or "not found".
Definition: ntv2enums.h:90
NTV2_ANCSIZE_MAX
#define NTV2_ANCSIZE_MAX
Definition: ntv2democommon.h:47
CRP188::GetRP188Str
bool GetRP188Str(std::string &sRP188) const
Definition: ntv2rp188.cpp:918
BurnConfig::fOutputChannel
NTV2Channel fOutputChannel
The output channel to use.
Definition: ntv2democommon.h:382
NTV2_OEM_TASKS
@ NTV2_OEM_TASKS
2: OEM: Device is configured by controlling application(s), with minimal driver involvement.
Definition: ntv2publicinterface.h:4292
kRegRP188InOut6DBB
@ kRegRP188InOut6DBB
Definition: ntv2publicinterface.h:575
BURNNOTE
#define BURNNOTE(_expr_)
Definition: ntv2democommon.h:43
NTV2FrameData::fTimecodes
NTV2TimeCodes fTimecodes
Map of TC indexes to NTV2_RP188 values.
Definition: ntv2democommon.h:87
CNTV2Card::SetAudioRate
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
Definition: ntv2audio.cpp:205
kRegRP188InOut8DBB
@ kRegRP188InOut8DBB
Definition: ntv2publicinterface.h:595
NTV2_AUDIOSYSTEM_INVALID
@ NTV2_AUDIOSYSTEM_INVALID
Definition: ntv2enums.h:3826