AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2fieldburn.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2fieldburn.h"
9 #include "ntv2devicescanner.h"
10 #include "ajabase/common/types.h"
11 #include "ajabase/system/process.h"
13 #include <iostream>
14 
15 using namespace std;
16 
17 #define ToCharPtr(_p_) reinterpret_cast<char*>(_p_)
18 
19 static const uint32_t kAppSignature (NTV2_FOURCC('F','l','d','B'));
20 
21 
23 
24 
26  : mConfig (inConfig),
27  mPlayThread (AJAThread()),
28  mCaptureThread (AJAThread()),
29  mDeviceID (DEVICE_ID_NOTFOUND),
30  mVideoFormat (NTV2_FORMAT_UNKNOWN),
31  mSavedTaskMode (NTV2_DISABLE_TASKS),
32  mOutputDest (NTV2_OUTPUTDESTINATION_INVALID),
33  mAudioSystem (inConfig.WithAudio() ? NTV2_AUDIOSYSTEM_1 : NTV2_AUDIOSYSTEM_INVALID),
34  mGlobalQuit (false)
35 {
36 } // constructor
37 
38 
40 {
41  Quit(); // Stop my capture and playout threads, then destroy them
42  mDevice.UnsubscribeInputVerticalEvent(mConfig.fInputChannel); // Unsubscribe from input VBI event
43 } // destructor
44 
45 
47 {
48  // Set the global 'quit' flag, and wait for the threads to go inactive...
49  mGlobalQuit = true;
50 
51  while (mPlayThread.Active())
52  AJATime::Sleep(10);
53 
54  while (mCaptureThread.Active())
55  AJATime::Sleep(10);
56 
57  if (!mConfig.fDoMultiFormat)
58  { // Release the device...
60  if (NTV2_IS_VALID_TASK_MODE(mSavedTaskMode))
61  mDevice.SetEveryFrameServices(mSavedTaskMode); // Restore prior task mode
62  }
63 } // Quit
64 
65 
67 {
69 
70  // Open the device...
72  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl; return AJA_STATUS_OPEN;}
73 
74  if (!mDevice.IsDeviceReady (false))
75  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
76 
77  mDeviceID = mDevice.GetDeviceID(); // Keep the device ID handy since it will be used frequently
78  if (!::NTV2DeviceCanDoCapture(mDeviceID))
79  {cerr << "## ERROR: Device '" << mDeviceID << "' cannot capture" << endl; return AJA_STATUS_FEATURE;}
80  if (!::NTV2DeviceCanDoPlayback(mDeviceID))
81  {cerr << "## ERROR: Device '" << mDeviceID << "' cannot playout" << endl; return AJA_STATUS_FEATURE;}
82 
83  ULWord appSignature (0);
84  int32_t appPID (0);
85  mDevice.GetStreamingApplication (appSignature, appPID); // Who currently "owns" the device?
86  mDevice.GetEveryFrameServices(mSavedTaskMode); // Save the current device state
87  if (!mConfig.fDoMultiFormat)
88  {
90  {
91  cerr << "## ERROR: Unable to acquire device because another app (pid " << appPID << ") owns it" << endl;
92  return AJA_STATUS_BUSY; // Some other app is using the device
93  }
94  mDevice.ClearRouting(); // Clear the current device routing (since I "own" the device)
95  }
96  mDevice.SetEveryFrameServices(NTV2_OEM_TASKS); // Force OEM tasks
97 
98  // Set up the video and audio...
99  status = SetupVideo();
100  if (AJA_FAILURE(status))
101  return status;
102 
103  if (NTV2_IS_VALID_AUDIO_SYSTEM(mAudioSystem))
104  status = SetupAudio();
105  if (AJA_FAILURE(status))
106  return status;
107 
108  // Set up the circular buffers...
109  status = SetupHostBuffers();
110  if (AJA_FAILURE(status))
111  return status;
112 
113  // Set up the signal routing...
116 
117  // Lastly, prepare my AJATimeCodeBurn instance...
119  mFormatDesc.numPixels,
120  mFormatDesc.numLines);
121  // Ready to go...
122  #if defined(_DEBUG)
123  cerr << mConfig << endl;
124  #endif // not _DEBUG
125  BURNINFO("Configuration: " << mConfig);
126  return AJA_STATUS_SUCCESS;
127 
128 } // Init
129 
130 
132 {
133  const UWord numFrameStores (::NTV2DeviceGetNumFrameStores(mDeviceID));
134 
135  // Does this device have the requested input source?
136  if (!::NTV2DeviceCanDoInputSource (mDeviceID, mConfig.fInputSource))
137  {cerr << "## ERROR: Device does not have the specified input source" << endl; return AJA_STATUS_BAD_PARAM;}
138 
139  // Pick an input NTV2Channel from the input source, and enable its frame buffer...
141  mDevice.EnableChannel(mConfig.fInputChannel); // Enable the input frame buffer
142 
143  // Pick an appropriate output NTV2Channel, and enable its frame buffer...
144  switch (mConfig.fInputSource)
145  {
146  case NTV2_INPUTSOURCE_SDI1: mConfig.fOutputChannel = (numFrameStores == 2 || numFrameStores > 4) ? NTV2_CHANNEL2 : NTV2_CHANNEL3;
147  break;
148 
149  case NTV2_INPUTSOURCE_SDI2: mConfig.fOutputChannel = (numFrameStores > 4) ? NTV2_CHANNEL3 : NTV2_CHANNEL4;
150  break;
151 
153  break;
154 
155  case NTV2_INPUTSOURCE_SDI4: mConfig.fOutputChannel = (numFrameStores > 4) ? NTV2_CHANNEL5 : NTV2_CHANNEL3;
156  break;
157 
158  case NTV2_INPUTSOURCE_SDI5: mConfig.fOutputChannel = NTV2_CHANNEL6; break;
159  case NTV2_INPUTSOURCE_SDI6: mConfig.fOutputChannel = NTV2_CHANNEL7; break;
160  case NTV2_INPUTSOURCE_SDI7: mConfig.fOutputChannel = NTV2_CHANNEL8; break;
161  case NTV2_INPUTSOURCE_SDI8: mConfig.fOutputChannel = NTV2_CHANNEL7; break;
162 
164  case NTV2_INPUTSOURCE_HDMI1: mConfig.fOutputChannel = numFrameStores < 3 ? NTV2_CHANNEL2 : NTV2_CHANNEL3;
165  break;
166  default:
167  case NTV2_INPUTSOURCE_INVALID: cerr << "## ERROR: Bad input source" << endl; return AJA_STATUS_BAD_PARAM;
168  }
169  mDevice.EnableChannel(mConfig.fOutputChannel); // Enable the output frame buffer
170 
171  // Enable/subscribe interrupts...
172  mDevice.EnableInputInterrupt(mConfig.fInputChannel);
174  mDevice.EnableOutputInterrupt(mConfig.fOutputChannel);
176 
177  // Pick an appropriate output spigot based on the output channel...
178  mOutputDest = ::NTV2ChannelToOutputDestination(mConfig.fOutputChannel);
179  if (!::NTV2DeviceCanDoWidget (mDeviceID, NTV2_Wgt12GSDIOut2)
180  && !::NTV2DeviceCanDoWidget (mDeviceID, NTV2_Wgt3GSDIOut2)
181  && !::NTV2DeviceCanDoWidget (mDeviceID, NTV2_WgtSDIOut2))
182  mOutputDest = NTV2_OUTPUTDESTINATION_SDI1; // If device has only one SDI output
183  if (::NTV2DeviceHasBiDirectionalSDI(mDeviceID) // If device has bidirectional SDI connectors...
184  && NTV2_OUTPUT_DEST_IS_SDI(mOutputDest)) // ...and output destination is SDI...
185  mDevice.SetSDITransmitEnable (mConfig.fOutputChannel, true); // ...then enable transmit mode
186 
187  // Flip the input spigot to "receive" if necessary...
188  bool isXmit (false);
189  if (::NTV2DeviceHasBiDirectionalSDI (mDevice.GetDeviceID ()) // If device has bidirectional SDI connectors...
190  && NTV2_INPUT_SOURCE_IS_SDI(mConfig.fInputSource) // ...and desired input source is SDI...
191  && mDevice.GetSDITransmitEnable (mConfig.fInputChannel, isXmit) // ...and GetSDITransmitEnable succeeds...
192  && isXmit) // ...and input is set to "transmit"...
193  {
194  mDevice.SetSDITransmitEnable (mConfig.fInputChannel, false); // ...then disable transmit mode...
195  mDevice.WaitForOutputVerticalInterrupt (mConfig.fOutputChannel, 10); // ...and allow device to lock to input signal
196  } // if input SDI connector needs to switch from transmit mode
197 
198  // Is there an input signal? What format is it?
199  mVideoFormat = mDevice.GetInputVideoFormat(mConfig.fInputSource);
200  if (mVideoFormat == NTV2_FORMAT_UNKNOWN)
201  {cerr << "## ERROR: No input signal, or can't handle its format" << endl; return AJA_STATUS_NOINPUT;}
202 
203  // This demo requires an interlaced signal...
204  if (IsProgressiveTransport(mVideoFormat))
205  {cerr << "## ERROR: Input signal is progressive -- no fields" << endl; return AJA_STATUS_UNSUPPORTED;}
206 
207  // Free-run the device clock, since E-to-E mode isn't used, nor is a mixer tied to the input...
209 
210  // Check the timecode source...
211  if (!InputSignalHasTimecode())
212  cerr << "## WARNING: Timecode source '" << ::NTV2TCIndexToString(mConfig.fTimecodeSource, true) << "' has no embedded timecode" << endl;
213 
214  // If the device supports different per-channel video formats, configure it as requested...
215  if (::NTV2DeviceCanDoMultiFormat (mDeviceID))
216  mDevice.SetMultiFormatMode (mConfig.fDoMultiFormat);
217 
218  // Set the input/output channel video formats to the video format that was detected earlier...
219  mDevice.SetVideoFormat (mVideoFormat, false, false, ::NTV2DeviceCanDoMultiFormat(mDeviceID) ? mConfig.fInputChannel : NTV2_CHANNEL1);
220  if (::NTV2DeviceCanDoMultiFormat(mDeviceID)) // If device supports multiple formats per-channel...
221  mDevice.SetVideoFormat (mVideoFormat, false, false, mConfig.fOutputChannel); // ...then also set the output channel format to the detected input format
222 
223  // Can the device handle the requested frame buffer pixel format?
224  if (!::NTV2DeviceCanDoFrameBufferFormat (mDeviceID, mConfig.fPixelFormat))
225  {cerr << "## ERROR: " << ::NTV2FrameBufferFormatToString(mConfig.fPixelFormat) << " unsupported" << endl; return AJA_STATUS_UNSUPPORTED;}
226 
227  // Set both input and output frame buffers' pixel formats...
228  mDevice.SetFrameBufferFormat (mConfig.fInputChannel, mConfig.fPixelFormat);
229  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mConfig.fPixelFormat);
230 
231  // Normally, timecode embedded in the output signal comes from whatever is written into the RP188
232  // registers (30/31 for SDI out 1, 65/66 for SDIout2, etc.).
233  // AutoCirculate automatically writes the timecode in the AUTOCIRCULATE_TRANSFER's acRP188 field
234  // into these registers (if AutoCirculateInitForOutput was called with AUTOCIRCULATE_WITH_RP188 set).
235  // Newer AJA devices can also bypass these RP188 registers, and simply copy whatever timecode appears
236  // at any SDI input (called the "bypass source"). To ensure that AutoCirculate's playout timecode
237  // will actually be seen in the output signal, "bypass mode" must be disabled...
238  bool bypassIsEnabled (false);
239  mDevice.IsRP188BypassEnabled (::NTV2InputSourceToChannel(mConfig.fInputSource), bypassIsEnabled);
240  if (bypassIsEnabled)
242 
243  // Now that newer AJA devices can capture/play anc data from separate buffers,
244  // there's no need to enable VANC frame geometries...
245  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fInputChannel);
246  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
247  if (::Is8BitFrameBufferFormat (mConfig.fPixelFormat))
248  { // 8-bit FBFs: since not using VANC geometries, disable bit shift...
251  }
252 
253  // Now that the video is set up, get information about the current frame geometry...
254  mFormatDesc = NTV2FormatDescriptor (mVideoFormat, mConfig.fPixelFormat);
255  if (mFormatDesc.IsPlanar())
256  {cerr << "## ERROR: This demo doesn't work with planar pixel formats" << endl; return AJA_STATUS_UNSUPPORTED;}
257  return AJA_STATUS_SUCCESS;
258 
259 } // SetupVideo
260 
261 
263 {
264  if (!NTV2_IS_VALID_AUDIO_SYSTEM (mAudioSystem))
265  return AJA_STATUS_SUCCESS;
266 
267  if (mConfig.fDoMultiFormat)
268  if (::NTV2DeviceGetNumAudioSystems(mDeviceID) > 1)
269  if (UWord(mConfig.fInputChannel) < ::NTV2DeviceGetNumAudioSystems(mDeviceID))
270  mAudioSystem = ::NTV2ChannelToAudioSystem(mConfig.fInputChannel);
271 
272  // Have the audio subsystem capture audio from the designated input source...
273  mDevice.SetAudioSystemInputSource (mAudioSystem, ::NTV2InputSourceToAudioSource(mConfig.fInputSource),
275 
276  // It's best to use all available audio channels...
277  mDevice.SetNumberAudioChannels (::NTV2DeviceGetMaxAudioChannels(mDeviceID), mAudioSystem);
278 
279  // Assume 48kHz PCM...
280  mDevice.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
281 
282  // 4MB device audio buffers work best...
283  mDevice.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
284 
285  // Set up the output audio embedders...
286  if (::NTV2DeviceGetNumAudioSystems(mDeviceID) > 1)
287  {
288  // Some devices, like the Kona1, have 2 FrameStores but only 1 SDI output,
289  // which makes mConfig.fOutputChannel == NTV2_CHANNEL2, but need SDIoutput to be NTV2_CHANNEL1...
290  UWord SDIoutput(mConfig.fOutputChannel);
291  if (SDIoutput >= ::NTV2DeviceGetNumVideoOutputs(mDeviceID))
292  SDIoutput = ::NTV2DeviceGetNumVideoOutputs(mDeviceID) - 1;
293  mDevice.SetSDIOutputAudioSystem (NTV2Channel(SDIoutput), mAudioSystem);
294  }
295 
296  //
297  // Loopback mode plays whatever audio appears in the input signal when it's
298  // connected directly to an output (i.e., "end-to-end" mode). If loopback is
299  // left enabled, the video will lag the audio as video frames get briefly delayed
300  // in our ring buffer. Audio, therefore, needs to come out of the (buffered) frame
301  // data being played, so loopback must be turned off...
302  //
303  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, mAudioSystem);
304  return AJA_STATUS_SUCCESS;
305 
306 } // SetupAudio
307 
308 
310 {
311  ULWordSequence failures;
312  CNTV2DemoCommon::SetDefaultPageSize(); // Set host-specific page size
313 
314  // Let my circular buffer know when it's time to quit...
315  mFrameDataRing.SetAbortFlag(&mGlobalQuit);
316 
317  // Make the video buffers half the size of a full frame (i.e. field-size)...
318  const ULWord vidBuffSizeBytes (mFormatDesc.GetTotalBytes() / 2);
319  NTV2_ASSERT(mFormatDesc.GetBytesPerRow() == mFormatDesc.linePitch * 4);
320 
321  // Allocate and add each in-host NTV2FrameData to my circular buffer member variable...
322  mHostBuffers.reserve(CIRCULAR_BUFFER_SIZE);
323  while (mHostBuffers.size() < CIRCULAR_BUFFER_SIZE)
324  {
325  mHostBuffers.push_back(NTV2FrameData()); // Make a new NTV2FrameData...
326  NTV2FrameData & frameData (mHostBuffers.back()); // ...and get a reference to it
327 
328  // In Field Mode, one buffer is used to hold each field's video data.
329  frameData.fVideoBuffer.Allocate (vidBuffSizeBytes, /*pageAligned*/true);
330  if (!mConfig.FieldMode())
331  { // In Frame Mode, use two buffers, one for each field. The DMA transfer
332  // of each field will be done as a group of lines, with each line considered a "segment".
333  frameData.fVideoBuffer2.Allocate (vidBuffSizeBytes, /*pageAligned*/true);
334  }
335 
336  // Allocate a page-aligned audio buffer (if handling audio)...
337  if (NTV2_IS_VALID_AUDIO_SYSTEM(mAudioSystem))
338  frameData.fAudioBuffer.Allocate (NTV2_AUDIOSIZE_MAX, /*pageAligned*/true);
339  if (frameData.AudioBuffer())
340  frameData.fAudioBuffer.Fill(ULWord(0));
341 
342  // Check for memory allocation failures...
343  if (!frameData.VideoBuffer()
344  || (NTV2_IS_VALID_AUDIO_SYSTEM(mAudioSystem) && !frameData.AudioBuffer())
345  || (!frameData.VideoBuffer2() && !mConfig.FieldMode()))
346  failures.push_back(ULWord(mHostBuffers.size()+1));
347 
348  // Add this NTV2FrameData to the ring...
349  mFrameDataRing.Add (&frameData);
350  } // for each NTV2FrameData
351 
352  if (!failures.empty())
353  {
354  cerr << "## ERROR: " << DEC(failures.size()) << " allocation failures in buffer(s): " << failures << endl;
355  return AJA_STATUS_MEMORY;
356  }
357  return AJA_STATUS_SUCCESS;
358 
359 } // SetupHostBuffers
360 
361 
363 {
364  const NTV2OutputCrosspointID inputOutputXpt (::GetInputSourceOutputXpt (mConfig.fInputSource));
366  const bool isRGB (::IsRGBFormat(mConfig.fPixelFormat));
367 
368  if (isRGB)
369  {
370  // If the frame buffer is configured for RGB pixel format, incoming YUV must be converted.
371  // This routes the video signal from the input through a color space converter before
372  // connecting to the RGB frame buffer...
373  const NTV2InputCrosspointID cscVideoInputXpt (::GetCSCInputXptFromChannel (mConfig.fInputChannel));
374  const NTV2OutputCrosspointID cscOutputXpt (::GetCSCOutputXptFromChannel (mConfig.fInputChannel, false/*isKey*/, true/*isRGB*/));
375 
376  mDevice.Connect (cscVideoInputXpt, inputOutputXpt); // Connect the CSC's video input to the input spigot's output
377  mDevice.Connect (fbInputXpt, cscOutputXpt); // Connect the frame store's input to the CSC's output
378  }
379  else
380  mDevice.Connect (fbInputXpt, inputOutputXpt); // Route the YCbCr signal directly from the input to the frame buffer's input
381 
382 } // RouteInputSignal
383 
384 
386 {
387  const NTV2InputCrosspointID outputInputXpt (::GetOutputDestInputXpt (mOutputDest));
389  const bool isRGB (::IsRGBFormat(mConfig.fPixelFormat));
390  NTV2OutputCrosspointID outputXpt (fbOutputXpt);
391 
392  if (isRGB)
393  {
394  const NTV2OutputCrosspointID cscVidOutputXpt (::GetCSCOutputXptFromChannel (mConfig.fOutputChannel, false, true));
395  const NTV2InputCrosspointID cscVidInputXpt (::GetCSCInputXptFromChannel (mConfig.fOutputChannel));
396 
397  mDevice.Connect (cscVidInputXpt, fbOutputXpt); // Connect the CSC's video input to the frame store's output
398  mDevice.Connect (outputInputXpt, cscVidOutputXpt); // Connect the SDI output's input to the CSC's video output
399  outputXpt = cscVidOutputXpt;
400  }
401  else
402  mDevice.Connect (outputInputXpt, outputXpt);
403 
404  mTCOutputs.clear();
405  mTCOutputs.push_back(mConfig.fOutputChannel);
406 
407  if (!mConfig.fDoMultiFormat)
408  {
409  // Route all SDI outputs to the outputXpt...
410  const NTV2Channel startNum (NTV2_CHANNEL1);
411  const NTV2Channel endNum (NTV2Channel(::NTV2DeviceGetNumVideoChannels(mDeviceID)));
412  NTV2WidgetID outputWidgetID (NTV2_WIDGET_INVALID);
413 
414  for (NTV2Channel chan(startNum); chan < endNum; chan = NTV2Channel(chan+1))
415  {
416  if (chan == mConfig.fInputChannel || chan == mConfig.fOutputChannel)
417  continue; // Skip the input & output channel, already routed
418  if (::NTV2DeviceHasBiDirectionalSDI(mDeviceID))
419  mDevice.SetSDITransmitEnable (chan, true);
420  if (CNTV2SignalRouter::GetWidgetForInput (::GetSDIOutputInputXpt (chan, ::NTV2DeviceCanDoDualLink(mDeviceID)), outputWidgetID))
421  if (::NTV2DeviceCanDoWidget (mDeviceID, outputWidgetID))
422  {
423  mDevice.Connect (::GetSDIOutputInputXpt(chan), outputXpt);
424  mTCOutputs.push_back(chan);
425  }
426  } // for each output spigot
427 
428  // If HDMI and/or analog video outputs are available, route them, too...
429  if (::NTV2DeviceCanDoWidget (mDeviceID, NTV2_WgtHDMIOut1))
430  mDevice.Connect (NTV2_XptHDMIOutInput, outputXpt); // Route output signal to HDMI output
431  if (::NTV2DeviceCanDoWidget (mDeviceID, NTV2_WgtHDMIOut1v2))
432  mDevice.Connect (NTV2_XptHDMIOutQ1Input, outputXpt); // Route output signal to HDMI output
433  if (::NTV2DeviceCanDoWidget (mDeviceID, NTV2_WgtAnalogOut1))
434  mDevice.Connect (NTV2_XptAnalogOutInput, outputXpt); // Route output signal to Analog output
435  if (::NTV2DeviceCanDoWidget (mDeviceID, NTV2_WgtSDIMonOut1))
436  { // SDI Monitor output is spigot 4 (NTV2_CHANNEL5):
437  mDevice.Connect (::GetSDIOutputInputXpt(NTV2_CHANNEL5), outputXpt); // Route output signal to SDI monitor output
438  mTCOutputs.push_back(NTV2_CHANNEL5);
439  }
440  } // if not multiChannel
441  PLDBG(mTCOutputs.size() << " timecode destination(s): " << ::NTV2ChannelListToStr(mTCOutputs));
442 
443 } // RouteOutputSignal
444 
445 
447 {
448  // Start the playout and capture threads...
449  StartPlayThread();
451  return AJA_STATUS_SUCCESS;
452 
453 } // Run
454 
455 
456 
458 
459 // This is where we will start the play thread
461 {
462  // Create and start the playout thread...
463  mPlayThread.Attach(PlayThreadStatic, this);
465  mPlayThread.Start();
466 
467 } // StartPlayThread
468 
469 
470 // The playout thread function
471 void NTV2FieldBurn::PlayThreadStatic (AJAThread * pThread, void * pContext) // static
472 { (void) pThread;
473  // Grab the NTV2FieldBurn instance pointer from the pContext parameter,
474  // then call its PlayFrames method...
475  NTV2FieldBurn * pApp (reinterpret_cast<NTV2FieldBurn*>(pContext));
476  pApp->PlayFrames();
477 
478 } // PlayThreadStatic
479 
480 
482 {
483  const ULWord acOptions (AUTOCIRCULATE_WITH_RP188 | (mConfig.FieldMode() ? AUTOCIRCULATE_WITH_FIELDS : 0));
484  ULWord goodXfers(0), badXfers(0), starves(0), noRoomWaits(0);
485  AUTOCIRCULATE_TRANSFER outputXferInfo; // F1 transfer info
486  AUTOCIRCULATE_TRANSFER outputXferInfo2; // F2 transfer info (unused in Field Mode)
487  AUTOCIRCULATE_STATUS outputStatus;
488 
489  // Stop AutoCirculate on this channel, just in case some other app left it running...
490  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
491  mDevice.WaitForOutputVerticalInterrupt(mConfig.fOutputChannel, 4); // Let it stop
492  BURNNOTE("Thread started");
493 
494  if (!mConfig.FieldMode())
495  {
496  // In Frame Mode, tell AutoCirculate to DMA F1's data as a group of "segments".
497  // Each segment is one line long, and the segments are contiguous in host
498  // memory, but are stored on every other line in the device frame buffer...
499  outputXferInfo.EnableSegmentedDMAs (mFormatDesc.numLines / 2, // number of segments: number of lines per field, i.e. half the line count
500  mFormatDesc.linePitch * 4, // number of active bytes per line
501  mFormatDesc.linePitch * 4, // host bytes per line: normal line pitch when reading from our half-height buffer
502  mFormatDesc.linePitch * 8); // device bytes per line: skip every other line when writing into device memory
503 
504  // F2 is identical to F1, except that F2 starts on 2nd line in device frame buffer...
505  outputXferInfo2.EnableSegmentedDMAs (mFormatDesc.numLines / 2, // number of segments: number of lines per field, i.e. half the line count
506  mFormatDesc.linePitch * 4, // number of active bytes per line
507  mFormatDesc.linePitch * 4, // host bytes per line: normal line pitch when reading from our half-height buffer
508  mFormatDesc.linePitch * 8); // device bytes per line: skip every other line when writing into device memory
509  outputXferInfo2.acInVideoDMAOffset = mFormatDesc.linePitch * 4; // F2 starts on 2nd line in device buffer
510  }
511 
512  // Initialize AutoCirculate...
513  if (!mDevice.AutoCirculateInitForOutput (mConfig.fOutputChannel, mConfig.fOutputFrames.count(), mAudioSystem, acOptions,
514  1 /*numChannels*/, mConfig.fOutputFrames.firstFrame(), mConfig.fOutputFrames.lastFrame()))
515  {PLFAIL("AutoCirculateInitForOutput failed"); mGlobalQuit = true;}
516 
517  while (!mGlobalQuit)
518  {
519  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
520 
521  // Check if there's room for another frame on the card...
522  if (outputStatus.CanAcceptMoreOutputFrames())
523  {
524  // Device has at least one free frame buffer that can be filled.
525  // Wait for the next frame in our ring to become ready to "consume"...
526  NTV2FrameData * pFrameData (mFrameDataRing.StartConsumeNextBuffer());
527  if (!pFrameData)
528  {starves++; continue;} // Producer thread isn't producing frames fast enough
529 
530  // Prepare to transfer the timecode-burned field (F1) to the device for playout.
531  // Set the outputXfer struct's video and audio buffers from playData's buffers...
532  // IMPORTANT: In Frame Mode, for segmented DMAs, AutoCirculateTransfer expects the video
533  // buffer size to be set to the segment size, in bytes, which is one raster line length.
534  outputXferInfo.SetVideoBuffer (pFrameData->VideoBuffer(),
535  mConfig.FieldMode() ? pFrameData->VideoBufferSize() // Field Mode
536  : mFormatDesc.GetBytesPerRow()); // Frame Mode
537  if (pFrameData->AudioBuffer())
538  outputXferInfo.SetAudioBuffer (pFrameData->AudioBuffer(), pFrameData->AudioBufferSize());
539  if (mConfig.FieldMode())
540  outputXferInfo.acPeerToPeerFlags = pFrameData->fFrameFlags; // Which field was this?
541 
542  // Tell AutoCirculate to embed this frame's timecode into the SDI output(s)...
543  outputXferInfo.SetOutputTimeCodes(pFrameData->fTimecodes);
544  PLDBG(pFrameData->fTimecodes);
545 
546  // Transfer field to the device...
547  if (mDevice.AutoCirculateTransfer (mConfig.fOutputChannel, outputXferInfo))
548  goodXfers++;
549  else
550  badXfers++;
551 
552  if (!mConfig.FieldMode())
553  { // Frame Mode: Additionally transfer F2 to the same device frame buffer used for F1.
554  // Again, for segmented DMAs, AutoCirculateTransfer expects the video buffer size to be
555  // set to the segment size, in bytes, which is one raster line length.
556  outputXferInfo2.acDesiredFrame = outputXferInfo.acTransferStatus.acTransferFrame;
557  outputXferInfo2.SetVideoBuffer (pFrameData->VideoBuffer2(), mFormatDesc.GetBytesPerRow());
558  if (mDevice.AutoCirculateTransfer (mConfig.fOutputChannel, outputXferInfo2))
559  goodXfers++;
560  else
561  badXfers++;
562  }
563 
564  if (goodXfers == 6) // Start AutoCirculate playout once 6 fields are buffered on the device...
565  mDevice.AutoCirculateStart(mConfig.fOutputChannel);
566 
567  // Signal that the frame has been "consumed"...
568  mFrameDataRing.EndConsumeNextBuffer();
569  continue; // Back to top of while loop
570  } // if CanAcceptMoreOutputFrames
571 
572  // Wait for one or more buffers to become available on the device, which should occur at next VBI...
573  noRoomWaits++;
575  } // loop til quit signaled
576 
577  // Stop AutoCirculate...
578  mDevice.AutoCirculateStop (mConfig.fOutputChannel);
579  BURNNOTE("Thread completed: " << DEC(goodXfers) << " xfers, " << DEC(badXfers) << " failed, "
580  << DEC(starves) << " ring starves, " << DEC(noRoomWaits) << " device starves");
581 } // PlayFrames
582 
583 
585 
586 
587 
589 //
590 // This is where the capture thread gets started
591 //
593 {
594  // Create and start the capture thread...
595  mCaptureThread.Attach(CaptureThreadStatic, this);
596  mCaptureThread.SetPriority(AJA_ThreadPriority_High);
597  mCaptureThread.Start();
598 
599 } // StartCaptureThread
600 
601 
602 //
603 // The static capture thread function
604 //
605 void NTV2FieldBurn::CaptureThreadStatic (AJAThread * pThread, void * pContext) // static
606 { (void) pThread;
607  // Grab the NTV2FieldBurn instance pointer from the pContext parameter,
608  // then call its CaptureFrames method...
609  NTV2FieldBurn * pApp(reinterpret_cast<NTV2FieldBurn*>(pContext));
610  pApp->CaptureFrames();
611 } // CaptureThreadStatic
612 
613 
614 //
615 // Repeatedly captures frames until told to stop
616 //
618 {
619  AUTOCIRCULATE_TRANSFER inputXferInfo; // F1 transfer info
620  AUTOCIRCULATE_TRANSFER inputXferInfo2; // F2 transfer info (unused in Field Mode)
621  NTV2TCIndexes F1TCIndexes, F2TCIndexes;
622  const ULWord acOptions ((mConfig.WithTimecode() ? AUTOCIRCULATE_WITH_RP188 : 0) | (mConfig.FieldMode() ? AUTOCIRCULATE_WITH_FIELDS : 0));
623  ULWord goodXfers(0), badXfers(0), ringFulls(0), devWaits(0);
624  BURNNOTE("Thread started");
625 
626  // Prepare the Timecode Indexes we'll be setting for playout...
627  for (size_t ndx(0); ndx < mTCOutputs.size(); ndx++)
628  { const NTV2Channel sdiSpigot(mTCOutputs.at(ndx));
629  F1TCIndexes.insert(::NTV2ChannelToTimecodeIndex(sdiSpigot, /*LTC?*/true)); // F1 LTC
630  F1TCIndexes.insert(::NTV2ChannelToTimecodeIndex(sdiSpigot, /*LTC?*/false)); // F1 VITC
631  F2TCIndexes.insert(::NTV2ChannelToTimecodeIndex(sdiSpigot, /*LTC?*/false, true)); // F2 VITC
632  }
633 
634  if (!mConfig.FieldMode())
635  {
636  // In Frame Mode, use AutoCirculate's "segmented DMA" feature to transfer each field
637  // out of the device's full-frame video buffer as a group of "segments".
638  // Each segment is one line long, and the segments are contiguous in host memory,
639  // but originate on alternating lines in the device's frame buffer...
640  inputXferInfo.EnableSegmentedDMAs (mFormatDesc.numLines / 2, // Number of segments: number of lines per field, i.e. half the line count
641  mFormatDesc.linePitch * 4, // Segment size, in bytes: transfer this many bytes per segment (normal line pitch)
642  mFormatDesc.linePitch * 4, // Host bytes per line: normal line pitch when writing into our half-height buffer
643  mFormatDesc.linePitch * 8); // Device bytes per line: skip every other line when reading from device memory
644 
645  // IMPORTANT: For segmented DMAs, the video buffer size must contain the number of bytes to
646  // transfer per segment. This will be done just prior to calling AutoCirculateTransfer.
647  inputXferInfo2.EnableSegmentedDMAs (mFormatDesc.numLines / 2, // Number of segments: number of lines per field, i.e. half the line count
648  mFormatDesc.linePitch * 4, // Segment size, in bytes: transfer this many bytes per segment (normal line pitch)
649  mFormatDesc.linePitch * 4, // Host bytes per line: normal line pitch when writing into our half-height buffer
650  mFormatDesc.linePitch * 8); // Device bytes per line: skip every other line when reading from device memory
651  inputXferInfo2.acInVideoDMAOffset = mFormatDesc.linePitch * 4; // Field 2 starts on second line in device buffer
652  }
653 
654  // Stop AutoCirculate on this channel, just in case some other app left it running...
655  mDevice.AutoCirculateStop (mConfig.fInputChannel);
656 
657  // Initialize AutoCirculate...
658  if (!mDevice.AutoCirculateInitForInput (mConfig.fInputChannel, // channel
659  mConfig.fInputFrames.count(), // numFrames (zero if specifying range)
660  mAudioSystem, // audio system
661  acOptions, // flags
662  1, // frameStores to gang
663  mConfig.fInputFrames.firstFrame(), mConfig.fInputFrames.lastFrame()))
664  {BURNFAIL("AutoCirculateInitForInput failed"); mGlobalQuit = true;}
665  else
666  // Start AutoCirculate running...
667  mDevice.AutoCirculateStart (mConfig.fInputChannel);
668 
669  while (!mGlobalQuit)
670  {
671  AUTOCIRCULATE_STATUS acStatus;
672  mDevice.AutoCirculateGetStatus (mConfig.fInputChannel, acStatus);
673 
674  if (acStatus.IsRunning() && acStatus.HasAvailableInputFrame())
675  {
676  // At this point, there's at least one fully-formed frame available in the device's frame buffer
677  // memory waiting to be transferred to the host. Reserve an NTV2FrameData to fill ("produce"),
678  // and use it in the next frame transferred from the device...
679  NTV2FrameData * pFrameData (mFrameDataRing.StartProduceNextBuffer ());
680  if (!pFrameData)
681  {ringFulls++; continue;} // Ring full -- consumer thread isn't consuming frames fast enough
682 
683  inputXferInfo.SetVideoBuffer (pFrameData->VideoBuffer(),
684  mConfig.FieldMode() ? pFrameData->VideoBufferSize()
685  : mFormatDesc.GetBytesPerRow());
686  if (NTV2_IS_VALID_AUDIO_SYSTEM(mAudioSystem))
687  inputXferInfo.SetAudioBuffer (pFrameData->AudioBuffer(), NTV2_AUDIOSIZE_MAX);
688 
689  // Transfer this Field (Field Mode) or F1 (Frame Mode) from the device into our host buffers...
690  if (mDevice.AutoCirculateTransfer (mConfig.fInputChannel, inputXferInfo)) goodXfers++;
691  else badXfers++;
692 
693  // Remember the amount, in bytes, of captured audio data...
694  pFrameData->fNumAudioBytes = pFrameData->AudioBuffer() ? inputXferInfo.GetCapturedAudioByteCount() : 0;
695  if (mConfig.FieldMode())
696  pFrameData->fFrameFlags = inputXferInfo.acPeerToPeerFlags; // Remember which field this was
697 
698  // Get a timecode to use for burn-in...
699  NTV2_RP188 thisFrameTC;
700  inputXferInfo.GetInputTimeCodes (pFrameData->fTimecodes, mConfig.fInputChannel);
701  if (!pFrameData->fTimecodes.empty())
702  {
703  thisFrameTC = pFrameData->fTimecodes.begin()->second; // Use 1st "good" timecode for burn-in
704  CAPDBG("Captured TC: " << ::NTV2TCIndexToString(pFrameData->fTimecodes.begin()->first,true) << " " << thisFrameTC);
705  }
706  else
707  { // Invent a timecode (based on frame count)...
708  const NTV2FrameRate ntv2FrameRate (::GetNTV2FrameRateFromVideoFormat (mVideoFormat));
709  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
710  const CRP188 inventedTC (inputXferInfo.GetTransferStatus().GetProcessedFrameCount(), 0, 0, 10, tcFormat);
711  inventedTC.GetRP188Reg(thisFrameTC);
712  }
713  CRP188 tc(thisFrameTC);
714  string tcStr;
715  tc.GetRP188Str(tcStr);
716 
717  if (!mConfig.FieldMode())
718  { // Frame Mode: Transfer F2 segments from same device frame buffer used for F1...
719  inputXferInfo2.acDesiredFrame = inputXferInfo.acTransferStatus.acTransferFrame;
720  inputXferInfo2.SetVideoBuffer (pFrameData->VideoBuffer2(), mFormatDesc.GetBytesPerRow());
721  if (mDevice.AutoCirculateTransfer (mConfig.fInputChannel, inputXferInfo2)) goodXfers++;
722  else badXfers++;
723  }
724 
725  // While this NTV2FrameData's buffers are locked, "burn" identical timecode into each field...
726  // F1 goes into top half, F2 into bottom half...
727  mTCBurner.BurnTimeCode (ToCharPtr(inputXferInfo.acVideoBuffer.GetHostPointer()), tcStr.c_str(),
728  !mConfig.FieldMode() || (pFrameData->fFrameFlags & AUTOCIRCULATE_FRAME_FIELD0) ? 10 : 30);
729  if (!mConfig.FieldMode()) // Frame Mode: "burn" F2 timecode
730  mTCBurner.BurnTimeCode (ToCharPtr(inputXferInfo2.acVideoBuffer.GetHostPointer()), tcStr.c_str(), 30);
731 
732  // Set NTV2FrameData::fTimecodes map for playout...
733  for (NTV2TCIndexesConstIter it(F1TCIndexes.begin()); it != F1TCIndexes.end(); ++it)
734  pFrameData->fTimecodes[*it] = thisFrameTC;
735  for (NTV2TCIndexesConstIter it(F2TCIndexes.begin()); it != F2TCIndexes.end(); ++it)
736  pFrameData->fTimecodes[*it] = thisFrameTC;
737 
738  // Signal that we're done "producing" the frame, making it available for future "consumption"...
739  mFrameDataRing.EndProduceNextBuffer();
740  } // if A/C running and frame(s) are available for transfer
741  else
742  {
743  // Either AutoCirculate is not running, or there were no frames available on the device to transfer.
744  // Rather than waste CPU cycles spinning, waiting until a field/frame becomes available, it's far more
745  // efficient to wait for the next input vertical interrupt event to get signaled...
746  devWaits++;
747  if (mConfig.FieldMode())
749  else
750  mDevice.WaitForInputFieldID (NTV2_FIELD0, mConfig.fInputChannel);
751  }
752  } // loop til quit signaled
753 
754  // Stop AutoCirculate...
755  mDevice.AutoCirculateStop(mConfig.fInputChannel);
756  BURNNOTE("Thread completed: " << DEC(goodXfers) << " xfers, " << DEC(badXfers) << " failed, "
757  << DEC(ringFulls) << " ring full(s), " << DEC(devWaits) << " device waits");
758 
759 } // CaptureFrames
760 
761 
763 
764 
765 void NTV2FieldBurn::GetStatus (ULWord & outFramesProcessed, ULWord & outCaptureFramesDropped, ULWord & outPlayoutFramesDropped,
766  ULWord & outCaptureBufferLevel, ULWord & outPlayoutBufferLevel)
767 {
768  AUTOCIRCULATE_STATUS inputStatus, outputStatus;
769 
770  mDevice.AutoCirculateGetStatus (mConfig.fInputChannel, inputStatus);
771  mDevice.AutoCirculateGetStatus (mConfig.fOutputChannel, outputStatus);
772 
773  outFramesProcessed = inputStatus.acFramesProcessed;
774  outCaptureFramesDropped = inputStatus.acFramesDropped;
775  outPlayoutFramesDropped = outputStatus.acFramesDropped;
776  outCaptureBufferLevel = inputStatus.acBufferLevel;
777  outPlayoutBufferLevel = outputStatus.acBufferLevel;
778 
779 } // GetStatus
780 
781 
782 static ULWord GetRP188RegisterForInput (const NTV2InputSource inInputSource)
783 {
784  switch (inInputSource)
785  {
786  case NTV2_INPUTSOURCE_SDI1: return kRegRP188InOut1DBB; // reg 29
787  case NTV2_INPUTSOURCE_SDI2: return kRegRP188InOut2DBB; // reg 64
788  case NTV2_INPUTSOURCE_SDI3: return kRegRP188InOut3DBB; // reg 268
789  case NTV2_INPUTSOURCE_SDI4: return kRegRP188InOut4DBB; // reg 273
790  case NTV2_INPUTSOURCE_SDI5: return kRegRP188InOut5DBB; // reg 342
791  case NTV2_INPUTSOURCE_SDI6: return kRegRP188InOut6DBB; // reg 418
792  case NTV2_INPUTSOURCE_SDI7: return kRegRP188InOut7DBB; // reg 427
793  case NTV2_INPUTSOURCE_SDI8: return kRegRP188InOut8DBB; // reg 436
794  default: return 0;
795  } // switch on input source
796 
797 } // GetRP188RegisterForInput
798 
799 
801 {
802  const ULWord regNum (::GetRP188RegisterForInput (mConfig.fInputSource));
803  ULWord regValue (0);
804 
805  // Bit 16 of the RP188 DBB register will be set if there is timecode embedded in the input signal...
806  if (regNum && mDevice.ReadRegister(regNum, regValue) && regValue & BIT(16))
807  return true;
808  return false;
809 
810 } // InputSignalHasTimecode
CNTV2Card::SubscribeOutputVerticalEvent
virtual bool SubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Causes me to be notified when an output vertical blanking interrupt is generated for the given output...
Definition: ntv2subscriptions.cpp:25
CNTV2Card::SetVANCMode
virtual bool SetVANCMode(const NTV2VANCMode inVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the VANC mode for the given FrameStore.
Definition: ntv2register.cpp:2656
NTV2FrameData::fFrameFlags
uint32_t fFrameFlags
Frame data flags.
Definition: ntv2democommon.h:91
NTV2DeviceCanDoCapture
bool NTV2DeviceCanDoCapture(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:1907
AUTOCIRCULATE_FRAME_FIELD0
#define AUTOCIRCULATE_FRAME_FIELD0
Frame contains field 0 of an interlaced image (first field in time)
Definition: ntv2publicinterface.h:5505
CNTV2Card::SetMultiFormatMode
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
Definition: ntv2register.cpp:4281
NTV2_INPUTSOURCE_SDI4
@ NTV2_INPUTSOURCE_SDI4
Identifies the 4th SDI video input.
Definition: ntv2enums.h:1231
NTV2_XptHDMIOutInput
@ NTV2_XptHDMIOutInput
Definition: ntv2enums.h:2788
GetSDIOutputInputXpt
NTV2InputXptID GetSDIOutputInputXpt(const NTV2Channel inSDIOutput, const bool inIsDS2=false)
Definition: ntv2signalrouter.cpp:942
NTV2FormatDescriptor::GetBytesPerRow
ULWord GetBytesPerRow(const UWord inPlaneIndex0=0) const
Definition: ntv2formatdescriptor.h:140
NTV2InputSourceToChannel
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5105
AUTOCIRCULATE_STATUS::acFramesProcessed
ULWord acFramesProcessed
Total number of frames successfully processed since CNTV2Card::AutoCirculateStart called.
Definition: ntv2publicinterface.h:7116
NTV2FieldBurn::StartCaptureThread
virtual void StartCaptureThread(void)
Starts my capture thread.
Definition: ntv2fieldburn.cpp:592
AUTOCIRCULATE_TRANSFER::GetTransferStatus
const AUTOCIRCULATE_TRANSFER_STATUS & GetTransferStatus(void) const
Returns a constant reference to my AUTOCIRCULATE_TRANSFER_STATUS.
Definition: ntv2publicinterface.h:8258
NTV2_AUDIO_LOOPBACK_OFF
@ NTV2_AUDIO_LOOPBACK_OFF
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:1971
NTV2ChannelListToStr
std::string NTV2ChannelListToStr(const NTV2ChannelList &inObj, const bool inCompact=true)
Definition: ntv2publicinterface.cpp:3267
NTV2_CHANNEL8
@ NTV2_CHANNEL8
Specifies channel or Frame Store 8 (or the 8th item).
Definition: ntv2enums.h:1314
NTV2FieldBurn::InputSignalHasTimecode
virtual bool InputSignalHasTimecode(void)
Returns true if the current input signal has timecode embedded in it; otherwise returns false.
Definition: ntv2fieldburn.cpp:800
AUTOCIRCULATE_TRANSFER::GetCapturedAudioByteCount
ULWord GetCapturedAudioByteCount(void) const
Definition: ntv2publicinterface.h:8270
kRegRP188InOut3DBB
@ kRegRP188InOut3DBB
Definition: ntv2publicinterface.h:362
NTV2_INPUTSOURCE_SDI6
@ NTV2_INPUTSOURCE_SDI6
Identifies the 6th SDI video input.
Definition: ntv2enums.h:1233
NTV2_WgtSDIOut2
@ NTV2_WgtSDIOut2
Definition: ntv2enums.h:2861
NTV2FieldBurn::SetupAudio
virtual AJAStatus SetupAudio(void)
Sets up everything I need for capturing and playing audio.
Definition: ntv2fieldburn.cpp:262
NTV2_IS_VALID_TASK_MODE
#define NTV2_IS_VALID_TASK_MODE(__m__)
Definition: ntv2publicinterface.h:4265
CAPDBG
#define CAPDBG(_expr_)
Definition: ntv2democommon.h:30
NTV2_FOURCC
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
Definition: ntv2publicinterface.h:5413
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or Frame Store 2 (or the 2nd item).
Definition: ntv2enums.h:1308
NTV2_VANCDATA_NORMAL
@ NTV2_VANCDATA_NORMAL
Definition: ntv2enums.h:3729
AJA_ThreadPriority_High
@ AJA_ThreadPriority_High
Definition: thread.h:44
NTV2ACFrameRange::firstFrame
UWord firstFrame(void) const
Definition: ntv2utils.h:975
AUTOCIRCULATE_WITH_FIELDS
#define AUTOCIRCULATE_WITH_FIELDS
Use this to AutoCirculate with fields as frames for interlaced formats.
Definition: ntv2publicinterface.h:5498
NTV2_WgtSDIMonOut1
@ NTV2_WgtSDIMonOut1
Definition: ntv2enums.h:2904
AUTOCIRCULATE_TRANSFER_STATUS::GetProcessedFrameCount
ULWord GetProcessedFrameCount(void) const
Definition: ntv2publicinterface.h:7868
AJATimeCodeBurn::RenderTimeCodeFont
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
Definition: timecodeburn.cpp:447
NTV2_AUDIO_BUFFER_BIG
@ NTV2_AUDIO_BUFFER_BIG
Definition: ntv2enums.h:1864
CNTV2MacDriverInterface::ReadRegister
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device....
Definition: ntv2macdriverinterface.cpp:709
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.
NTV2TCIndexes
std::set< NTV2TCIndex > NTV2TCIndexes
A set of distinct NTV2TCIndex values.
Definition: ntv2publicinterface.h:6794
NTV2FrameData
I encapsulate the video, audio and anc host buffers used in the AutoCirculate demos....
Definition: ntv2democommon.h:79
AUTOCIRCULATE_TRANSFER::SetAudioBuffer
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2614
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
NTV2FieldBurn::StartPlayThread
virtual void StartPlayThread(void)
Starts my playout thread.
Definition: ntv2fieldburn.cpp:460
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific Frame Store. They're also commonly used to i...
Definition: ntv2enums.h:1305
kAppSignature
static const uint32_t kAppSignature(((((uint32_t)( 'F'))<< 24)|(((uint32_t)( 'l'))<< 16)|(((uint32_t)( 'd'))<< 8)|(((uint32_t)( 'B'))<< 0)))
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:368
NTV2FieldBurn::GetStatus
virtual void GetStatus(ULWord &outNumProcessed, ULWord &outCaptureDrops, ULWord &outPlayoutDrops, ULWord &outCaptureLevel, ULWord &outPlayoutLevel)
Provides status information about my input (capture) and output (playout) processes.
Definition: ntv2fieldburn.cpp:765
NTV2_ASSERT
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:601
GetNTV2FrameRateFromVideoFormat
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3530
AUTOCIRCULATE_TRANSFER_STATUS::acTransferFrame
LWord acTransferFrame
Frame buffer number the frame was transferred to/from. (-1 if failed)
Definition: ntv2publicinterface.h:7828
AJAThread::Attach
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
Definition: thread.cpp:169
CNTV2Card::WaitForInputVerticalInterrupt
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 ...
Definition: ntv2subscriptions.cpp:149
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
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
AUTOCIRCULATE_TRANSFER::EnableSegmentedDMAs
bool EnableSegmentedDMAs(const ULWord inNumSegments, const ULWord inNumActiveBytesPerLine, const ULWord inHostBytesPerLine, const ULWord inDeviceBytesPerLine)
Enables segmented DMAs given a segment count, a host pitch, and device pitch value.
Definition: ntv2publicinterface.cpp:2705
NTV2FormatDescriptor::linePitch
ULWord linePitch
Number of 32-bit words per line. Shadows mLinePitch[0] * sizeof(ULWord).
Definition: ntv2formatdescriptor.h:350
AJA_STATUS_BUSY
@ AJA_STATUS_BUSY
Definition: types.h:378
CNTV2DeviceScanner::GetFirstDeviceFromArgument
static bool GetFirstDeviceFromArgument(const std::string &inArgument, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command li...
Definition: ntv2devicescanner.cpp:327
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
NTV2_AUDIOSYSTEM_1
@ NTV2_AUDIOSYSTEM_1
This identifies the first Audio System.
Definition: ntv2enums.h:3811
AJACircularBuffer::StartConsumeNextBuffer
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function to ...
Definition: circularbuffer.h:153
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
NTV2DeviceCanDoMultiFormat
bool NTV2DeviceCanDoMultiFormat(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:4065
GetFrameBufferInputXptFromChannel
NTV2InputXptID GetFrameBufferInputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsBInput=false)
Definition: ntv2signalrouter.cpp:762
NTV2DeviceCanDoDualLink
bool NTV2DeviceCanDoDualLink(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:2357
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:832
NTV2_WIDGET_INVALID
@ NTV2_WIDGET_INVALID
Definition: ntv2enums.h:2963
kRegRP188InOut5DBB
@ kRegRP188InOut5DBB
Definition: ntv2publicinterface.h:450
AJA_STATUS_MEMORY
@ AJA_STATUS_MEMORY
Definition: types.h:384
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
IsProgressiveTransport
bool IsProgressiveTransport(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5429
NTV2Buffer::Allocate
bool Allocate(const size_t inByteCount, const bool inPageAligned=false)
Allocates (or re-allocates) my user-space storage using the given byte count. I assume full responsib...
Definition: ntv2publicinterface.cpp:1554
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:303
NTV2DeviceCanDoFrameBufferFormat
bool NTV2DeviceCanDoFrameBufferFormat(const NTV2DeviceID inDeviceID, const NTV2FrameBufferFormat inFBFormat)
Definition: ntv2devicefeatures.hpp:15330
NTV2_CHANNEL1
@ NTV2_CHANNEL1
Specifies channel or Frame Store 1 (or the first item).
Definition: ntv2enums.h:1307
NTV2FieldBurn::NTV2FieldBurn
NTV2FieldBurn(const BurnConfig &inConfig)
Constructs me using the given configuration settings.
Definition: ntv2fieldburn.cpp:25
CNTV2Card::SetSDITransmitEnable
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
Definition: ntv2register.cpp:3805
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:3826
CNTV2Card::SetVANCShiftMode
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
Definition: ntv2register.cpp:2816
AUTOCIRCULATE_STATUS::CanAcceptMoreOutputFrames
bool CanAcceptMoreOutputFrames(void) const
Definition: ntv2publicinterface.h:7176
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
CNTV2Card::SetVideoFormat
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=true, const bool inKeepVancSettings=false, const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
Definition: ntv2register.cpp:204
NTV2FrameRate
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:396
NTV2_CHANNEL6
@ NTV2_CHANNEL6
Specifies channel or Frame Store 6 (or the 6th item).
Definition: ntv2enums.h:1312
NTV2FieldBurn::RouteInputSignal
virtual void RouteInputSignal(void)
Sets up board routing for capture.
Definition: ntv2fieldburn.cpp:362
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:488
NTV2FrameData::VideoBuffer
NTV2Buffer & VideoBuffer(void)
Definition: ntv2democommon.h:106
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
NTV2FieldBurn::RouteOutputSignal
virtual void RouteOutputSignal(void)
Sets up board routing for playout.
Definition: ntv2fieldburn.cpp:385
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
NTV2_CHANNEL5
@ NTV2_CHANNEL5
Specifies channel or Frame Store 5 (or the 5th item).
Definition: ntv2enums.h:1311
GetRP188RegisterForInput
static ULWord GetRP188RegisterForInput(const NTV2InputSource inInputSource)
Definition: ntv2fieldburn.cpp:782
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
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
AJA_STATUS_NOINPUT
@ AJA_STATUS_NOINPUT
Definition: types.h:387
AJAStatus
AJAStatus
Definition: types.h:365
NTV2ChannelToOutputDestination
NTV2OutputDestination NTV2ChannelToOutputDestination(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its ordinary equivalent NTV2OutputDestination.
Definition: ntv2utils.cpp:5225
NTV2_OUTPUTDESTINATION_SDI1
@ NTV2_OUTPUTDESTINATION_SDI1
Definition: ntv2enums.h:1280
NTV2FormatDescriptor::numPixels
ULWord numPixels
Width – total number of pixels per line.
Definition: ntv2formatdescriptor.h:349
process.h
Declares the AJAProcess class.
NTV2_Wgt3GSDIOut2
@ NTV2_Wgt3GSDIOut2
Definition: ntv2enums.h:2865
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_VANCMODE_OFF
@ NTV2_VANCMODE_OFF
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3713
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: ntv2audio.cpp:573
AJA_STATUS_FEATURE
@ AJA_STATUS_FEATURE
Definition: types.h:380
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
NTV2DeviceCanDoWidget
bool NTV2DeviceCanDoWidget(const NTV2DeviceID inDeviceID, const NTV2WidgetID inWidgetID)
Definition: ntv2devicefeatures.hpp:30519
NTV2FieldBurn::Init
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2fieldburn.cpp:66
kRegRP188InOut2DBB
@ kRegRP188InOut2DBB
Definition: ntv2publicinterface.h:138
NTV2FrameData::fVideoBuffer
NTV2Buffer fVideoBuffer
Host video buffer.
Definition: ntv2democommon.h:82
AUTOCIRCULATE_STATUS
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
Definition: ntv2publicinterface.h:7105
ntv2devicescanner.h
Declares the CNTV2DeviceScanner class.
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
NTV2DeviceHasBiDirectionalSDI
bool NTV2DeviceHasBiDirectionalSDI(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:6454
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:944
AUTOCIRCULATE_TRANSFER::SetOutputTimeCodes
bool SetOutputTimeCodes(const NTV2TimeCodes &inValues)
Intended for playout, replaces the contents of my acOutputTimeCodes member.
Definition: ntv2publicinterface.cpp:2633
CNTV2DemoCommon::SetDefaultPageSize
static size_t SetDefaultPageSize(void)
Definition: ntv2democommon.cpp:1505
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::SetReference
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=false)
Sets the device's clock reference source. See Device Clocking and Synchronization for more informatio...
Definition: ntv2register.cpp:1486
NTV2FieldBurn::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: ntv2fieldburn.cpp:605
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
NTV2FieldBurn::PlayFrames
virtual void PlayFrames(void)
Repeatedly plays out frames using AutoCirculate (until global quit flag set).
Definition: ntv2fieldburn.cpp:481
AUTOCIRCULATE_TRANSFER::acDesiredFrame
LWord acDesiredFrame
Used to specify a different frame in the circulate ring to transfer to/from.
Definition: ntv2publicinterface.h:7988
CNTV2Card::Connect
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=false)
Connects the given widget signal input (sink) to the given widget signal output (source).
Definition: ntv2regroute.cpp:87
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:244
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::fNumAudioBytes
ULWord fNumAudioBytes
Actual number of captured audio bytes.
Definition: ntv2democommon.h:88
NTV2_REFERENCE_FREERUN
@ NTV2_REFERENCE_FREERUN
Specifies the device's internal clock.
Definition: ntv2enums.h:1404
AUTOCIRCULATE_TRANSFER
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
Definition: ntv2publicinterface.h:7904
NTV2InputCrosspointID
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget's output (...
Definition: ntv2enums.h:2685
NTV2FrameData::AudioBuffer
NTV2Buffer & AudioBuffer(void)
Definition: ntv2democommon.h:109
AUTOCIRCULATE_TRANSFER::SetVideoBuffer
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2606
GetCSCInputXptFromChannel
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
Definition: ntv2signalrouter.cpp:775
NTV2DeviceGetNumFrameStores
UWord NTV2DeviceGetNumFrameStores(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:10487
NTV2FieldBurn::CaptureFrames
virtual void CaptureFrames(void)
Repeatedly captures frames using AutoCirculate (until global quit flag set).
Definition: ntv2fieldburn.cpp:617
NTV2FieldBurn
I capture individual fields from an interlaced video signal provided to an SDI input....
Definition: ntv2fieldburn.h:32
CNTV2Card::AutoCirculateStop
virtual bool AutoCirculateStop(const NTV2Channel inChannel, const bool inAbort=false)
Stops AutoCirculate for the given channel, and releases the on-device frame buffers that were allocat...
Definition: ntv2autocirculate.cpp:519
NTV2WidgetID
NTV2WidgetID
Definition: ntv2enums.h:2842
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1228
NTV2DeviceCanDoPlayback
bool NTV2DeviceCanDoPlayback(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:4438
NTV2FrameData::fVideoBuffer2
NTV2Buffer fVideoBuffer2
Additional host video buffer, usually F2.
Definition: ntv2democommon.h:83
NTV2_XptHDMIOutQ1Input
@ NTV2_XptHDMIOutQ1Input
Definition: ntv2enums.h:2789
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
NTV2_INPUTSOURCE_HDMI1
@ NTV2_INPUTSOURCE_HDMI1
Identifies the 1st HDMI video input.
Definition: ntv2enums.h:1224
CRP188
Definition: ntv2rp188.h:55
kRegRP188InOut1DBB
@ kRegRP188InOut1DBB
Definition: ntv2publicinterface.h:103
AUTOCIRCULATE_STATUS::acBufferLevel
ULWord acBufferLevel
Number of buffered frames in driver ready to capture or play.
Definition: ntv2publicinterface.h:7118
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:381
PLDBG
#define PLDBG(_xpr_)
Definition: ntv2democommon.h:38
NTV2_OUTPUT_DEST_IS_SDI
#define NTV2_OUTPUT_DEST_IS_SDI(_dest_)
Definition: ntv2enums.h:1294
AUTOCIRCULATE_TRANSFER::acTransferStatus
AUTOCIRCULATE_TRANSFER_STATUS acTransferStatus
Contains status information that's valid after CNTV2Card::AutoCirculateTransfer returns,...
Definition: ntv2publicinterface.h:7956
NTV2_DISABLE_TASKS
@ NTV2_DISABLE_TASKS
0: Disabled: Device is completely configured by controlling application(s) – no driver involvement.
Definition: ntv2publicinterface.h:4259
NTV2DeviceGetNumAudioSystems
UWord NTV2DeviceGetNumAudioSystems(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:9864
BurnConfig::fInputChannel
NTV2Channel fInputChannel
The input channel to use.
Definition: ntv2democommon.h:381
NTV2OutputCrosspointID
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget's input (ident...
Definition: ntv2enums.h:2467
BurnConfig::fDeviceSpec
std::string fDeviceSpec
The AJA device to use.
Definition: ntv2democommon.h:379
NTV2Buffer::GetHostPointer
void * GetHostPointer(void) const
Definition: ntv2publicinterface.h:6023
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
NTV2_WgtHDMIOut1
@ NTV2_WgtHDMIOut1
Definition: ntv2enums.h:2879
NTV2FrameData::VideoBuffer2
NTV2Buffer & VideoBuffer2(void)
Definition: ntv2democommon.h:121
AJA_STATUS_INITIALIZE
@ AJA_STATUS_INITIALIZE
Definition: types.h:373
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5579
NTV2FieldBurn::SetupHostBuffers
virtual AJAStatus SetupHostBuffers(void)
Sets up my circular buffers.
Definition: ntv2fieldburn.cpp:309
false
#define false
Definition: ntv2devicefeatures.h:25
AUTOCIRCULATE_WITH_RP188
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
Definition: ntv2publicinterface.h:5490
NTV2TCIndexesConstIter
NTV2TCIndexes::const_iterator NTV2TCIndexesConstIter
A handy const interator for iterating over an NTV2TCIndexes set.
Definition: ntv2publicinterface.h:6795
NTV2FieldBurn::SetupVideo
virtual AJAStatus SetupVideo(void)
Sets up everything I need for capturing and playing video.
Definition: ntv2fieldburn.cpp:131
NTV2ACFrameRange::lastFrame
UWord lastFrame(void) const
Definition: ntv2utils.h:976
AUTOCIRCULATE_STATUS::IsRunning
bool IsRunning(void) const
Definition: ntv2publicinterface.h:7211
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
NTV2FieldBurn::Quit
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2fieldburn.cpp:46
kRegRP188InOut4DBB
@ kRegRP188InOut4DBB
Definition: ntv2publicinterface.h:367
NTV2_INPUTSOURCE_SDI8
@ NTV2_INPUTSOURCE_SDI8
Identifies the 8th SDI video input.
Definition: ntv2enums.h:1235
NTV2DeviceCanDoInputSource
bool NTV2DeviceCanDoInputSource(const NTV2DeviceID inDeviceID, const NTV2InputSource inInputSource)
Definition: ntv2devicefeatures.hpp:17462
AJA_STATUS_BAD_PARAM
@ AJA_STATUS_BAD_PARAM
Definition: types.h:379
CNTV2Card::WaitForOutputVerticalInterrupt
virtual bool WaitForOutputVerticalInterrupt(const NTV2Channel inChannel=NTV2_CHANNEL1, UWord inRepeatCount=1)
Efficiently sleeps the calling thread/process until the next one or more field (interlaced video) or ...
Definition: ntv2subscriptions.cpp:134
NTV2_INPUTSOURCE_SDI2
@ NTV2_INPUTSOURCE_SDI2
Identifies the 2nd SDI video input.
Definition: ntv2enums.h:1229
NTV2_RP188
This struct replaces the old RP188_STRUCT.
Definition: ntv2publicinterface.h:6705
AUTOCIRCULATE_TRANSFER::acVideoBuffer
NTV2Buffer acVideoBuffer
The host video buffer. This field is owned by the client application, and thus is responsible for all...
Definition: ntv2publicinterface.h:7912
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
ULWordSequence
std::vector< uint32_t > ULWordSequence
An ordered sequence of ULWord (uint32_t) values.
Definition: ntv2publicinterface.h:45
AUTOCIRCULATE_TRANSFER::acInVideoDMAOffset
ULWord acInVideoDMAOffset
Optional byte offset into the device frame buffer. Defaults to zero. If non-zero, should be a multipl...
Definition: ntv2publicinterface.h:7971
NTV2_WgtHDMIOut1v2
@ NTV2_WgtHDMIOut1v2
Definition: ntv2enums.h:2903
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
ntv2fieldburn.h
Header file for the NTV2FieldBurn demonstration class.
NTV2DeviceGetNumVideoChannels
ULWord NTV2DeviceGetNumVideoChannels(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:11834
NTV2_WgtAnalogOut1
@ NTV2_WgtAnalogOut1
Definition: ntv2enums.h:2876
CIRCULAR_BUFFER_SIZE
static const size_t CIRCULAR_BUFFER_SIZE(10)
Number of NTV2FrameData's in our ring.
CNTV2MacDriverInterface::AcquireStreamForApplication
virtual bool AcquireStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
Definition: ntv2macdriverinterface.cpp:808
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:371
AUTOCIRCULATE_STATUS::HasAvailableInputFrame
bool HasAvailableInputFrame(void) const
Definition: ntv2publicinterface.h:7181
NTV2_Wgt12GSDIOut2
@ NTV2_Wgt12GSDIOut2
Definition: ntv2enums.h:2947
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
NTV2FieldBurn::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: ntv2fieldburn.cpp:471
CNTV2Card::GetInputVideoFormat
virtual NTV2VideoFormat GetInputVideoFormat(const NTV2InputSource inVideoSource=NTV2_INPUTSOURCE_SDI1, const bool inIsProgressive=false)
Returns the video format of the signal that is present on the given input source.
Definition: ntv2register.cpp:3381
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:2565
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:2578
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:6192
AJAThread::SetPriority
virtual AJAStatus SetPriority(AJAThreadPriority priority)
Definition: thread.cpp:133
CNTV2Card::AutoCirculateStart
virtual bool AutoCirculateStart(const NTV2Channel inChannel, const ULWord64 inStartTime=0)
Starts AutoCirculating the specified channel that was previously initialized by CNTV2Card::AutoCircul...
Definition: ntv2autocirculate.cpp:503
NTV2DeviceGetNumVideoOutputs
UWord NTV2DeviceGetNumVideoOutputs(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:12012
AJA_STATUS_OPEN
@ AJA_STATUS_OPEN
Definition: types.h:375
CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:1000
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
CNTV2Card::SetFrameBufferFormat
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=true, NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
Definition: ntv2register.cpp:1828
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:2732
kRegRP188InOut7DBB
@ kRegRP188InOut7DBB
Definition: ntv2publicinterface.h:556
CNTV2Card::SetNumberAudioChannels
virtual bool SetNumberAudioChannels(const ULWord inNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the number of audio channels to be concurrently captured or played for a given Audio System on t...
Definition: ntv2audio.cpp:149
CNTV2Card::SetAudioBufferSize
virtual bool SetAudioBufferSize(const NTV2AudioBufferSize inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Changes the size of the audio buffer that is used for a given Audio System in the AJA device.
Definition: ntv2audio.cpp:252
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
AUTOCIRCULATE_STATUS::acFramesDropped
ULWord acFramesDropped
Total number of frames dropped since CNTV2Card::AutoCirculateStart called.
Definition: ntv2publicinterface.h:7117
NTV2InputSourceToAudioSource
NTV2AudioSource NTV2InputSourceToAudioSource(const NTV2InputSource inInputSource)
Definition: ntv2utils.cpp:4959
PLFAIL
#define PLFAIL(_xpr_)
Definition: ntv2democommon.h:34
BURNINFO
#define BURNINFO(_expr_)
Definition: ntv2democommon.h:44
CNTV2DemoCommon::GetAJAPixelFormat
static AJA_PixelFormat GetAJAPixelFormat(const NTV2FrameBufferFormat inFormat)
Definition: ntv2democommon.cpp:1054
BIT
#define BIT(_x_)
Definition: ajatypes.h:654
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
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition: types.h:358
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:3828
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:2113
NTV2ChannelToAudioSystem
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
Definition: ntv2utils.cpp:4927
ToCharPtr
#define ToCharPtr(_p_)
Definition: ntv2fieldburn.cpp:17
NTV2_XptAnalogOutInput
@ NTV2_XptAnalogOutInput
Definition: ntv2enums.h:2805
NTV2FieldBurn::~NTV2FieldBurn
virtual ~NTV2FieldBurn()
Definition: ntv2fieldburn.cpp:39
AUTOCIRCULATE_TRANSFER::acPeerToPeerFlags
ULWord acPeerToPeerFlags
Definition: ntv2publicinterface.h:7986
DEVICE_ID_NOTFOUND
@ DEVICE_ID_NOTFOUND
Invalid or "not found".
Definition: ntv2enums.h:90
NTV2DeviceGetMaxAudioChannels
UWord NTV2DeviceGetMaxAudioChannels(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:8796
NTV2FieldBurn::Run
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2fieldburn.cpp:446
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:4261
kRegRP188InOut6DBB
@ kRegRP188InOut6DBB
Definition: ntv2publicinterface.h:546
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:208
kRegRP188InOut8DBB
@ kRegRP188InOut8DBB
Definition: ntv2publicinterface.h:566
NTV2_AUDIOSYSTEM_INVALID
@ NTV2_AUDIOSYSTEM_INVALID
Definition: ntv2enums.h:3821