AJA NTV2 SDK  17.6.0.1688
NTV2 SDK 17.6.0.1688
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ntv2overlay.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2overlay.h"
9 #include "ntv2devicescanner.h"
10 #include "ajabase/common/types.h"
11 #include "ajabase/system/process.h"
14 #include <iostream>
15 
16 using namespace std;
17 
18 static const uint32_t kAppSignature (NTV2_FOURCC('O','v','r','l'));
19 
21 
22 
24  : mConfig (inConfig),
25  mPlayThread (AJAThread()),
26  mCaptureThread (AJAThread()),
27  mVideoFormat (NTV2_FORMAT_UNKNOWN),
28  mHDMIColorSpace (NTV2_LHIHDMIColorSpaceYCbCr),
29  mSavedTaskMode (NTV2_DISABLE_TASKS),
30  mInputPixFormat (inConfig.fPixelFormat), // fixed to 10-bit YCbCr
31  mOutputPixFormat(NTV2_FBF_ARGB), // fixed to 8-bit ARGB
32  mGlobalQuit (false)
33 {
34  mAVCircularBuffer.SetAbortFlag(&mGlobalQuit); // Ring buffer abandons waits when mGlobalQuit goes true
35 } // constructor
36 
37 
39 {
40  Quit(); // Stop my capture and playout threads, then destroy them
45 } // destructor
46 
47 
48 void NTV2Overlay::Quit (void)
49 {
50  // Set the global 'quit' flag, and wait for the threads to go inactive...
51  mGlobalQuit = true;
52 
53  while (mPlayThread.Active())
54  AJATime::Sleep(10);
55 
56  while (mCaptureThread.Active())
57  AJATime::Sleep(10);
58 
59  if (!mConfig.fDoMultiFormat)
60  { // Release the device...
62  if (NTV2_IS_VALID_TASK_MODE(mSavedTaskMode))
63  mDevice.SetEveryFrameServices(mSavedTaskMode); // Restore prior task mode
64  }
65 } // Quit
66 
67 
69 {
71 
72  // Open the device...
74  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl; return AJA_STATUS_OPEN;}
75  if (!mDevice.IsDeviceReady(false))
76  {cerr << "## ERROR: Device '" << mDevice.GetDescription() << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
77  if (mDevice.GetDeviceID() != DEVICE_ID_KONAX)
78  cerr << "## WARNING: Device '" << mDevice.GetDescription() << "' is not KONA X" << endl;
79 
80  ULWord appSig(0);
81  int32_t appPID(0);
82  mDevice.GetStreamingApplication (appSig, appPID); // Who currently "owns" the device?
83  mDevice.GetEveryFrameServices(mSavedTaskMode); // Save the current device state
84 
86  {
87  cerr << "## ERROR: Cannot acquire '" << mDevice.GetDescription() << "' because another app (pid " << appPID << ") owns it" << endl;
88  return AJA_STATUS_BUSY; // Some other app is using the device
89  }
90 
91  mDevice.SetEveryFrameServices(NTV2_OEM_TASKS); // Force OEM tasks
92 
95 
96  // Enable/subscribe interrupts...
97  mConfig.fInputChannel = NTV2_CHANNEL1;
98  mConfig.fOutputChannel = NTV2_CHANNEL2;
102 
103  // Set up the overlay image...
104  status = SetupOverlayBug();
105  if (AJA_FAILURE(status))
106  return status;
107 
108  // Set up the video and audio...
109  status = SetupVideo();
110  if (AJA_FAILURE(status))
111  return status;
112  status = SetupAudio();
113  if (AJA_FAILURE(status))
114  return status;
115 
116  // Ready to go...
117  cerr << mConfig;
118  if (mDevice.IsRemote())
119  cerr << "Device Description: " << mDevice.GetDescription() << endl;
120  cerr << endl;
121 
122  CAPINFO("Configuration: " << mConfig); PLINFO("Configuration: " << mConfig);
123  return AJA_STATUS_SUCCESS;
124 } // Init
125 
126 
128 {
129  // Flip the input spigot to "receive" if necessary...
130  mDevice.SetSDITransmitEnable (NTV2_CHANNEL1, false);
131  mDevice.SetSDITransmitEnable (NTV2_CHANNEL2, true);
132 
134 
135  // Since this demo runs in E-to-E mode (thru Mixer/Keyer), reference must be tied to the input...
137 
138  mDevice.SetMultiFormatMode(true);
139 
140  mDevice.ClearRouting();
144 
145  // Set up Mixer...
146  const UWord mixerNum (0);
147  mDevice.SetMixerMode (mixerNum, NTV2MIXERMODE_MIX); // "mix" mode
148  mDevice.SetMixerFGMatteEnabled (mixerNum, false); // no FG matte
149  mDevice.SetMixerBGMatteEnabled (mixerNum, false); // no BG matte
150  mDevice.SetMixerCoefficient (mixerNum, 0x10000); // FG "bug" overlay full strength (initially)
151  mDevice.SetMixerFGInputControl (mixerNum, NTV2MIXERINPUTCONTROL_SHAPED); // respect FG alpha channel
152  mDevice.SetMixerBGInputControl (mixerNum, NTV2MIXERINPUTCONTROL_FULLRASTER); // BG uses full raster
153  mDevice.SetMixerVancOutputFromForeground (mixerNum, false); // false means "use BG VANC, not FG"
154 
155  return AJA_STATUS_SUCCESS;
156 
157 } // SetupVideo
158 
160 {
161  // Connect SDIIn1 to Mixer1 background...
162  mDevice.Connect(NTV2_XptMixer1BGVidInput, NTV2_XptSDIIn1, false); // SDIIn1 => Mix1BGVid
163  mDevice.Connect(NTV2_XptMixer1BGKeyInput, NTV2_XptSDIIn1, false); // SDIIn1 => Mix1BGKey
164 
165  // Connect SDIIn1 to FrameStore1...
166  if (NTV2_IS_FBF_RGB(mInputPixFormat))
167  { // Convert YUV to RGB...
168  mDevice.Connect(NTV2_XptCSC1VidInput, NTV2_XptSDIIn1, false); // SDIIn1 => CSC1
169  mDevice.Connect(NTV2_XptFrameBuffer1Input, NTV2_XptCSC1VidRGB, false); // CSC1RGB => FS1
170  }
171  else
172  mDevice.Connect(NTV2_XptFrameBuffer1Input, NTV2_XptSDIIn1, false); // SDIIn1 => FS1
173 } // RouteInputSignal
174 
176 {
177  // Connect FrameStore2 RGB output through CSC2 to Mixer1 foreground...
178  mDevice.Connect(NTV2_XptCSC2VidInput, NTV2_XptFrameBuffer2RGB, false); // FS2RGB => CSC2
179  mDevice.Connect(NTV2_XptMixer1FGVidInput, NTV2_XptCSC2VidYUV, false); // CSC2Vid => Mix1FGVid
180  mDevice.Connect(NTV2_XptMixer1FGKeyInput, NTV2_XptCSC2KeyYUV, false); // CSC2Key => Mix1FGKey
181 } // RouteOverlaySignal
182 
183 
185 {
186  // Connect Mixer1 output to SDI & HDMI outputs...
189 } // RouteOutputSignal
190 
191 
193 {
194  // Set up the output audio embedders...
195  NTV2AudioSystem audioSystem = NTV2_AUDIOSYSTEM_1;
196  mDevice.SetSDIOutputAudioSystem (NTV2_CHANNEL2, audioSystem);
198 
199  // Enable loopback for E-E mode (i.e. output whatever audio is in input signal)...
200  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, audioSystem); // Don't turn loopback on until input signal is stable
201  return AJA_STATUS_SUCCESS;
202 
203 } // SetupAudio
204 
205 
207 {
208  if (!NTV2_IS_VALID_VIDEO_FORMAT(mVideoFormat))
209  return AJA_STATUS_NOINPUT;
210 
212 
213  // Allocate and add each NTV2FrameData to my circular buffer member variable...
214  const ULWord captureBufferSize (::GetVideoWriteSize (mVideoFormat, mInputPixFormat));
215  mBuffers.reserve(CIRCULAR_BUFFER_SIZE);
216  while (mBuffers.size() < CIRCULAR_BUFFER_SIZE)
217  {
218  mBuffers.push_back(NTV2FrameData()); // Make a new NTV2FrameData...
219  NTV2FrameData & frameData(mBuffers.back()); // ...and get a reference to it
220  // Allocate a page-aligned video buffer
221  if (!frameData.fVideoBuffer.Allocate(captureBufferSize, /*pageAlign?*/true))
222  return AJA_STATUS_MEMORY;
223  mAVCircularBuffer.Add(&frameData); // Add to my circular buffer
224  } // for each NTV2FrameData
225  return AJA_STATUS_SUCCESS;
226 } // SetupCaptureBuffers
227 
228 
230 {
231  mBuffers.clear();
232  mAVCircularBuffer.Clear();
233  return;
234 } // ReleaseCaptureBuffers
235 
236 // 4-byte-per-pixel DrawVLine -- draws a vertical line using the given pixel value and line thickness
237 static bool DrawVLine (NTV2Buffer & buf, const NTV2RasterInfo & info, const ULWord argbPixValue, const ULWord pixThickness,
238  const ULWord xPos, const ULWord yTop, const ULWord height)
239 {
240  for (ULWord y(yTop); y < (yTop + height); y++)
241  for (ULWord w(0); w < pixThickness; w++)
242  buf.U32(y * info.linePitch + xPos + w) = argbPixValue;
243  return true;
244 }
245 
246 // 4-byte-per-pixel DrawHLine -- draws a horizontal line using the given pixel value and line thickness
247 static bool DrawHLine (NTV2Buffer & buf, const NTV2RasterInfo & info, const ULWord argbPixValue, const ULWord vThickness,
248  const ULWord yPos, const ULWord xLeft, const ULWord width)
249 {
250  for (ULWord v(0); v < vThickness; v++)
251  for (ULWord x(xLeft); x < (xLeft + width); x++)
252  buf.U32((yPos + v) * info.linePitch + x) = argbPixValue;
253  return true;
254 }
255 
256 // 4-byte-per-pixel DrawBox -- draws a rectangle using the given pixel value and line thickness
257 static bool DrawBox (NTV2Buffer & buf, const NTV2RasterInfo & info, const ULWord argbPixValue, const UWord pixThickness,
258  const UWord topLeftX, const UWord topLeftY, const ULWord width, const ULWord height)
259 {
260  /*T*/DrawVLine (buf, info, argbPixValue, pixThickness, /*xPos*/topLeftX, /*yTop */topLeftY, /*hght*/height);
261  /*B*/DrawVLine (buf, info, argbPixValue, pixThickness, /*xPos*/topLeftX + width - pixThickness, /*yTop */topLeftY, /*hght*/height);
262  /*L*/DrawHLine (buf, info, argbPixValue, pixThickness, /*yPos*/topLeftY, /*xLeft*/topLeftX, /*wdth*/width);
263  /*R*/DrawHLine (buf, info, argbPixValue, pixThickness, /*yPos*/topLeftY + height - pixThickness, /*xLeft*/topLeftX, /*wdth*/width);
264  return true;
265 }
266 
268 {
269  static const ULWord sOpaqueRed(0xFFFF0000), sOpaqueBlue(0xFF0000FF), sOpaqueGreen(0xFF008000),
270  sOpaqueWhite(0xFFFFFFFF), sOpaqueBlack(0xFF000000);
271 
272  // The overlay "bug" is a 256x256 pixel raster image composed of four opaque rectangles of
273  // varying color and diminishing size, each set inside each other, centered in the raster.
274  // All space between them is transparent to reveal the background video. The line thickness
275  // of each rectangle is the same: 1/16th the width or height of the raster. The pixel format
276  // is NTV2_FBF_ARGB, which all devices handle, and easy to traverse at 4-bytes-per-pixel.
277  static const vector<ULWord> sColors = {sOpaqueWhite, sOpaqueRed, sOpaqueBlue, sOpaqueGreen};
278  const ULWord hght(256), wdth(256), thickness(wdth/16);
279 
280  // The overlay bug's NTV2RasterInfo must be hacked together manually:
281  mBugRasterInfo = NTV2RasterInfo (hght, wdth, /*U32s/line*/wdth, /*1stAct*/0, /*lumaBits*/0, /*chromaBits*/8, /*alphaBits*/8);
282 
283  // Allocate the overlay bug's host buffer:
284  if (!mBug.Allocate(mBugRasterInfo.GetTotalBytes()))
285  return AJA_STATUS_MEMORY;
286 
287  // Draw the rectangles into the mBug buffer...
288  for (size_t n(0); n < sColors.size(); n++)
289  DrawBox (mBug, mBugRasterInfo, sColors.at(n), thickness, /*topLeftX*/n*2*thickness, /*topLeftY*/n*2*thickness, wdth-2*n*2*thickness, hght-2*n*2*thickness);
290 
291  // Draw a hatch mark in the middle of it...
292  /*V*/DrawVLine (mBug, mBugRasterInfo, sOpaqueBlack, /*thickness*/1, /*xPos*/wdth/2, /*yTop */hght/2-thickness, /*hght*/2*thickness);
293  /*H*/DrawHLine (mBug, mBugRasterInfo, sOpaqueBlack, /*thickness*/1, /*yPos*/hght/2, /*xLeft*/wdth/2-thickness, /*wdth*/2*thickness);
294  return AJA_STATUS_SUCCESS;
295 
296 } // SetupOverlayBug
297 
299 {
301  ULWord numConsecutiveFrames(0), MIN_NUM_CONSECUTIVE_FRAMES(6);
302 
303  // Detection loop:
304  while (result == NTV2_FORMAT_UNKNOWN)
305  {
306  // Determine the input video signal format...
307  // Warning: if there's no input signal, this loop won't exit until mGlobalQuit goes true!
308  UWord loopCount(0);
309  while (result == NTV2_FORMAT_UNKNOWN)
310  {
311  mDevice.WaitForOutputVerticalInterrupt(NTV2_CHANNEL1); // Just delay til next output VBI
312  if (mGlobalQuit)
313  return NTV2_FORMAT_UNKNOWN; // Terminate if asked to do so
314 
315  const NTV2VideoFormat currVF (mDevice.GetInputVideoFormat(mConfig.fInputSource));
316  if (currVF == NTV2_FORMAT_UNKNOWN)
317  { // Wait for video signal to appear
318  if (++loopCount % 500 == 0) // Log message every minute or so at ~50ms
319  CAPDBG("Waiting for valid video signal to appear at " << ::NTV2InputSourceToString(mConfig.fInputSource,true));
320  }
321  else if (numConsecutiveFrames == 0)
322  {
323  lastVF = currVF; // First valid video format to appear
324  numConsecutiveFrames++; // Start debounce counter
325  }
326  else if (numConsecutiveFrames == MIN_NUM_CONSECUTIVE_FRAMES)
327  {
328  numConsecutiveFrames = 0; // Reset for next signal outage
329  result = currVF; // Set official video format to use
330  }
331  else
332  numConsecutiveFrames = (lastVF == currVF) ? numConsecutiveFrames + 1 : 0;
333  } // loop while input video format is unstable
334 
335  CAPNOTE(::NTV2InputSourceToString(mConfig.fInputSource,true) << " video format: "
336  << ::NTV2VideoFormatToString(result));
337  cerr << endl << "## NOTE: " << ::NTV2InputSourceToString(mConfig.fInputSource,true)
338  << " video format is " << ::NTV2VideoFormatToString(result) << endl;
339  break; // Done!
340  } // loop
341 
342  NTV2_ASSERT(result != NTV2_FORMAT_UNKNOWN);
343  return result;
344 } // WaitForStableInputSignal
345 
346 
348 {
349  // Start the input thread...
351  return AJA_STATUS_SUCCESS;
352 } // Run
353 
354 
356 
357 // This is where the play thread is started
359 {
360  // Create and start the playout thread...
361  mPlayThread.Attach(OutputThreadStatic, this);
363  mPlayThread.Start();
364 } // StartOutputThread
365 
366 // The static output thread function
367 void NTV2Overlay::OutputThreadStatic (AJAThread * pThread, void * pContext) // static
368 { (void) pThread;
369  // Grab the NTV2Overlay instance pointer from the pContext parameter,
370  // then call its OutputThread method...
371  NTV2Overlay * pApp (reinterpret_cast<NTV2Overlay*>(pContext));
372  pApp->OutputThread();
373 } // OutputThreadStatic
374 
376 
377 //
378 // The output thread:
379 // - at startup:
380 // - configures the overlay FrameStore
381 // - initializes (but doesn't start) AutoCirculate (to allocate 2 device buffers)
382 // - while running:
383 // - blits the overlay image into the host overlay raster buffer
384 // - DMAs the overlay raster buffer to the device for mixing
385 // - terminates when AutoCirculate channel is stopped or when mGlobalQuit goes true
386 // - ensures my AutoCirculate channel is stopped
387 //
389 {
391  ULWord thrdNum(gPlayEnterCount), fbNum(10), loops(0);
392  ULWord goodWaits(0), badWaits(0), goodBlits(0), badBlits(0), goodXfers(0), badXfers(0), pingPong(0);
393  AUTOCIRCULATE_STATUS acStatus;
394  NTV2Buffer hostBuffer;
395 
396  // Configure the output FrameStore...
397  mDevice.SetMode (mConfig.fOutputChannel, NTV2_MODE_DISPLAY);
398  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mOutputPixFormat);
399  mDevice.SetVideoFormat (mVideoFormat, /*retail*/false, /*keepVanc*/false, mConfig.fOutputChannel);
400  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
401  NTV2RasterInfo rasterInfo (mVideoFormat, mOutputPixFormat);
402  if (!hostBuffer.Allocate(rasterInfo.GetTotalRasterBytes(), /*pageAligned*/true))
403  {cerr << "## ERROR: Failed to allocate " << rasterInfo.GetTotalRasterBytes() << "-byte vid buffer" << endl; return;}
404 
405  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
406  if (mDevice.AutoCirculateInitForOutput(mConfig.fOutputChannel, 2) && mDevice.AutoCirculateGetStatus(mConfig.fOutputChannel, acStatus)) // Find out which buffers we got
407  fbNum = ULWord(acStatus.acStartFrame); // Use them
408  else
409  {cerr << "## NOTE: Allocate 2-frame AC" << DEC(mConfig.fOutputChannel+1) << " range failed" << endl; return;}
410 
411  PLNOTE(DEC(thrdNum) << " started, " << ::NTV2VideoFormatToString(mVideoFormat)
412  << " raster:" << rasterInfo << ", bug:" << mBugRasterInfo);
413  Bouncer<ULWord> mixPct (/*max*/400, /*min*/100, /*start*/100),
414  xPos (/*max*/rasterInfo.GetRasterWidth() - mBugRasterInfo.GetRasterWidth()),
415  yPos (/*max*/rasterInfo.GetVisibleRasterHeight() - mBugRasterInfo.GetVisibleRasterHeight() - 1);
416 
417  // Loop til Quit or my AC channel stops...
418  while (!mGlobalQuit)
419  {
420  // Terminate this output thread when video format changes...
421  if (mDevice.GetInputVideoFormat(mConfig.fInputSource) != mVideoFormat)
422  break; // Stopped, exit thread
423 
424  NTV2FrameData * pFrameData (mAVCircularBuffer.StartConsumeNextBuffer());
425  if (pFrameData)
426  {
427  // Consume captured frame ... it's simply dropped on the floor.
428  // (The frame can't be used here anyway, since it's NTV2_FBF_10BIT_YCBCR,
429  // and the output pixel format is NTV2_FBF_ARGB.)
430  mAVCircularBuffer.EndConsumeNextBuffer(); // Signal "done with this frame"
431  }
432 
433  // Wait for the next output vertical interrupt event to get signaled...
434  if (mDevice.WaitForOutputVerticalInterrupt(mConfig.fOutputChannel))
435  {
436  ++goodWaits;
437  // Clear host buffer, blit the "bug" into it, then transfer it to device...
438  hostBuffer.Fill(ULWord(0));
439  if (::CopyRaster (mOutputPixFormat, // src & dst pixel format
440  hostBuffer, // dstBuffer
441  rasterInfo.GetBytesPerRow(), // dstBytesPerLine
442  rasterInfo.GetVisibleRasterHeight(), // dstTotalLines
443  yPos.Next(), // dstVertLineOffset
444  xPos.Next(), // dstHorzPixelOffset
445  mBug, // srcBuffer
446  mBugRasterInfo.GetBytesPerRow(), // srcBytesPerLine
447  mBugRasterInfo.GetVisibleRasterHeight(), // srcTotalLines
448  0, // srcVertLineOffset
449  mBugRasterInfo.GetVisibleRasterHeight(), // srcVertLinesToCopy
450  0, // srcHorzPixelOffset
451  mBugRasterInfo.GetRasterWidth())) // srcHorzPixelsToCopy
452  ++goodBlits;
453  else
454  ++badBlits;
455  if (mDevice.DMAWriteFrame (fbNum + pingPong, hostBuffer, hostBuffer.GetByteCount()))
456  ++goodXfers;
457  else
458  ++badXfers;
459  mDevice.SetOutputFrame (mConfig.fOutputChannel, fbNum + pingPong);
460  pingPong = pingPong ? 0 : 1;
461  mDevice.SetMixerCoefficient (MixerNum(), mixPct.Next() * 0x10000 / 400);
462  }
463  else
464  ++badWaits;
465 
466  if (++loops % 500 == 0) // Log message every minute or so
467  PLDBG(DEC(thrdNum) << ": " << DEC(goodXfers) << " xfers (" << DEC(badXfers) << " failed), " << DEC(goodBlits)
468  << " blits (" << DEC(badBlits) << " failed), " << DEC(goodWaits) << " waits ("
469  << DEC(badWaits) << " failed)");
470  } // loop til quit or A/C stopped
471 
472  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
474  PLNOTE(DEC(thrdNum) << " done: " << DEC(goodXfers) << " xfers (" << DEC(badXfers) << " failed), "
475  << DEC(goodBlits) << " blits (" << DEC(badBlits) << " failed), " << DEC(goodWaits) << " waits (" << DEC(badWaits) << " failed)");
477 
478 } // OutputThread
479 
480 
482 
483 
484 // This is where the input thread gets started
486 {
487  // Create and start the capture thread...
488  mCaptureThread.Attach(InputThreadStatic, this);
489  mCaptureThread.SetPriority(AJA_ThreadPriority_High);
490  mCaptureThread.Start();
491 } // StartInputThread
492 
493 // The static input thread function
494 void NTV2Overlay::InputThreadStatic (AJAThread * pThread, void * pContext) // static
495 { (void) pThread;
496  // Grab the NTV2Overlay instance pointer from the pContext parameter,
497  // then call its InputThread method...
498  NTV2Overlay * pApp (reinterpret_cast<NTV2Overlay*>(pContext));
499  pApp->InputThread();
500 } // InputThreadStatic
501 
502 
503 //
504 // The input thread:
505 // - waits indefinitely for a stable input signal, and if one is found:
506 // - configures an input FrameStore (if needed for capturing frames to host)
507 // - initializes AutoCirculate to reserve a couple of device frame buffers
508 // - starts a new output thread
509 // - waits indefinitely to see if the input signal is lost or changes, and if it does:
510 // - stops input AutoCirculate which signals the output thread to exit
511 // - upon termination:
512 // - ensures my monitor/capture AutoCirculate channel is stopped
513 //
515 {
516  ULWord loops(0), bails(0), vfChgTally(0), badWaits(0), waitTally(0), goodXfers(0), badXfers(0);
517  AUTOCIRCULATE_TRANSFER xferInfo;
518  CAPNOTE("Started");
519 
520  // Loop until time to quit...
521  while (!mGlobalQuit)
522  {
523  mDevice.AutoCirculateStop(mConfig.fInputChannel);
524  mVideoFormat = WaitForStableInputSignal();
525  if (mVideoFormat == NTV2_FORMAT_UNKNOWN)
526  break; // Quit
527 
528  // At this point, the input video format is stable.
529  // Configure the input FrameStore...
530  mDevice.SetMode (mConfig.fInputChannel, NTV2_MODE_CAPTURE);
532  mDevice.SetVideoFormat (mVideoFormat, /*retail*/false, /*keepVanc*/false, mConfig.fInputChannel);
533  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fInputChannel);
535  { cerr << "## NOTE: Failed to [re]allocate host buffers" << endl;
536  mGlobalQuit = true;
537  continue;
538  }
539 
540  AUTOCIRCULATE_STATUS acStatus;
541  if (!mDevice.AutoCirculateInitForInput(mConfig.fInputChannel, 7))
542  { cerr << "## NOTE: Input A/C allocate device frame buffer range failed" << endl;
543  mGlobalQuit = true;
544  continue;
545  }
546 
547  mDevice.AutoCirculateStart(mConfig.fInputChannel); // Start capturing
548  StartOutputThread(); // Start a new playout thread
549 
550  // Capture frames until signal format changes...
551  while (!mGlobalQuit)
552  {
553  AUTOCIRCULATE_STATUS acStatus;
554  mDevice.AutoCirculateGetStatus (mConfig.fInputChannel, acStatus);
555  if (acStatus.IsRunning() && acStatus.HasAvailableInputFrame())
556  {
557  // At least one fully-formed frame is available in device frame buffer
558  // memory that can be transferred to the host. Reserve an NTV2FrameData
559  // to "produce", and use it to store the next frame to be transferred...
560  NTV2FrameData * pCaptureData (mAVCircularBuffer.StartProduceNextBuffer());
561  if (pCaptureData)
562  { // Transfer frame from device...
563  xferInfo.SetVideoBuffer (pCaptureData->VideoBuffer(), pCaptureData->VideoBufferSize());
564  if (mDevice.AutoCirculateTransfer (mConfig.fInputChannel, xferInfo)) ++goodXfers;
565  else ++badXfers;
566  mAVCircularBuffer.EndProduceNextBuffer(); // Signal "done with this frame"
567  } // if pCaptureData != NULL
568  else ++bails;
569  } // if A/C running and frame(s) are available for transfer
570  else
571  { // Wait for next input VBI...
572  if (mDevice.WaitForInputVerticalInterrupt(mConfig.fInputChannel)) ++waitTally;
573  else ++badWaits;
574  }
575  if (++loops % 500 == 0) // Log message every minute or so
576  CAPDBG(DEC(vfChgTally) << " sigChgs, " << DEC(bails) << " bails, " << DEC(waitTally)
577  << " waits (" << DEC(badWaits) << " failed), " << DEC(goodXfers) << " xfers ("
578  << DEC(badXfers) << " failed)");
579 
580  // Check input signal format...
581  if (mDevice.GetInputVideoFormat(mConfig.fInputSource) != mVideoFormat)
582  { // Input signal format changed!
583  ++vfChgTally;
584  mAVCircularBuffer.StartProduceNextBuffer(); // Unblock output thread
585  mAVCircularBuffer.EndProduceNextBuffer();
587  break; // Break to outer loop to wait for stable input signal
588  }
589  } // inner loop -- until signal change
590  } // loop til quit signaled
591 
592  mDevice.AutoCirculateStop(mConfig.fInputChannel); // This will signal OutputThread to exit
593  CAPNOTE("Done: " << DEC(vfChgTally) << " sigChgs, " << DEC(bails) << " bails, " << DEC(waitTally)
594  << " waits (" << DEC(badWaits) << " failed), " << DEC(goodXfers) << " xfers ("
595  << DEC(badXfers) << " failed)");
596 } // InputThread
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
CNTV2Card::SetMixerFGMatteEnabled
virtual bool SetMixerFGMatteEnabled(const UWord inWhichMixer, const bool inIsEnabled)
Answers if the given mixer/keyer's foreground matte is enabled or not.
Definition: ntv2register.cpp:2982
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:4365
NTV2_XptHDMIOutInput
@ NTV2_XptHDMIOutInput
Definition: ntv2enums.h:2841
NTV2FormatDescriptor::GetBytesPerRow
ULWord GetBytesPerRow(const UWord inPlaneIndex0=0) const
Definition: ntv2formatdescriptor.h:158
DrawBox
static bool DrawBox(NTV2Buffer &buf, const NTV2RasterInfo &info, const ULWord argbPixValue, const UWord pixThickness, const UWord topLeftX, const UWord topLeftY, const ULWord width, const ULWord height)
Definition: ntv2overlay.cpp:257
NTV2_FBF_ARGB
@ NTV2_FBF_ARGB
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:215
NTV2_AUDIO_LOOPBACK_OFF
@ NTV2_AUDIO_LOOPBACK_OFF
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:2016
NTV2Overlay::SetupVideo
AJAStatus SetupVideo(void)
Performs all video setup.
Definition: ntv2overlay.cpp:127
NTV2_IS_VALID_TASK_MODE
#define NTV2_IS_VALID_TASK_MODE(__m__)
Definition: ntv2publicinterface.h:4445
CAPDBG
#define CAPDBG(_expr_)
Definition: ntv2democommon.h:30
NTV2_FOURCC
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
Definition: ntv2publicinterface.h:5594
NTV2_REFERENCE_INPUT1
@ NTV2_REFERENCE_INPUT1
Specifies the SDI In 1 connector.
Definition: ntv2enums.h:1443
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or FrameStore 2 (or the 2nd item).
Definition: ntv2enums.h:1346
AJA_ThreadPriority_High
@ AJA_ThreadPriority_High
Definition: thread.h:44
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
NTV2_XptFrameBuffer2RGB
@ NTV2_XptFrameBuffer2RGB
Definition: ntv2enums.h:2535
NTV2Overlay::ReleaseCaptureBuffers
void ReleaseCaptureBuffers(void)
Frees capture buffers & ring.
Definition: ntv2overlay.cpp:229
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
NTV2MIXERMODE_MIX
@ NTV2MIXERMODE_MIX
Overlays foreground video on top of background video.
Definition: ntv2enums.h:1780
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
NTV2_XptCSC2KeyYUV
@ NTV2_XptCSC2KeyYUV
Definition: ntv2enums.h:2538
NTV2Buffer
Describes a user-space buffer on the host computer. I have an address and a length,...
Definition: ntv2publicinterface.h:6185
AUTOCIRCULATE_STATUS::acStartFrame
LWord acStartFrame
First frame to circulate. FIXFIXFIX Why is this signed? CHANGE TO ULWord??
Definition: ntv2publicinterface.h:7369
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:381
kAppSignature
static const uint32_t kAppSignature(((((uint32_t)( 'O'))<< 24)|(((uint32_t)( 'v'))<< 16)|(((uint32_t)( 'r'))<< 8)|(((uint32_t)( 'l'))<< 0)))
NTV2Buffer::GetByteCount
ULWord GetByteCount(void) const
Definition: ntv2publicinterface.h:6259
NTV2_ASSERT
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:508
CNTV2Card::SetMixerCoefficient
virtual bool SetMixerCoefficient(const UWord inWhichMixer, const ULWord inMixCoefficient)
Sets the current mix coefficient of the given mixer/keyer.
Definition: ntv2register.cpp:2944
CNTV2Card::SetMixerBGInputControl
virtual bool SetMixerBGInputControl(const UWord inWhichMixer, const NTV2MixerKeyerInputControl inInputControl)
Sets the background input control value for the given mixer/keyer.
Definition: ntv2register.cpp:2897
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
systemtime.h
Declares the AJATime class.
NTV2Overlay::InputThreadStatic
static void InputThreadStatic(AJAThread *pThread, void *pInstance)
Static output/playout thread function.
Definition: ntv2overlay.cpp:494
NTV2FormatDescriptor::linePitch
ULWord linePitch
Number of 32-bit words per line – shadows mLinePitch[0] / sizeof(ULWord)
Definition: ntv2formatdescriptor.h:368
ancillarylist.h
Declares the AJAAncillaryList class.
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:329
gPlayEnterCount
static ULWord gPlayEnterCount(0)
NTV2Buffer::U32
uint32_t U32(const int inIndex) const
Definition: ntv2publicinterface.h:6724
BurnConfig::fDoMultiFormat
bool fDoMultiFormat
If true, enables device-sharing; otherwise takes exclusive control of the device.
Definition: ntv2democommon.h:396
NTV2_AUDIOSYSTEM_1
@ NTV2_AUDIOSYSTEM_1
This identifies the first Audio System.
Definition: ntv2enums.h:3867
AJACircularBuffer::StartConsumeNextBuffer
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function to ...
Definition: circularbuffer.h:153
CNTV2Card::ClearRouting
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device.
Definition: ntv2regroute.cpp:313
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:524
CNTV2Card::SetOutputFrame
virtual bool SetOutputFrame(const NTV2Channel inChannel, const ULWord inValue)
Sets the output frame index number for the given FrameStore. This identifies which frame in device SD...
Definition: ntv2register.cpp:2191
AJA_STATUS_MEMORY
@ AJA_STATUS_MEMORY
Definition: types.h:397
NTV2Overlay::SetupCaptureBuffers
AJAStatus SetupCaptureBuffers(void)
Allocates capture buffers & ring.
Definition: ntv2overlay.cpp:206
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
ntv2overlay.h
Header file for the NTV2Overlay demonstration class.
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:1769
DrawHLine
static bool DrawHLine(NTV2Buffer &buf, const NTV2RasterInfo &info, const ULWord argbPixValue, const ULWord vThickness, const ULWord yPos, const ULWord xLeft, const ULWord width)
Definition: ntv2overlay.cpp:247
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 FrameStore 1 (or the first item).
Definition: ntv2enums.h:1345
NTV2Overlay::RouteOutputSignal
void RouteOutputSignal(void)
Performs output routing.
Definition: ntv2overlay.cpp:184
NTV2Overlay::NTV2Overlay
NTV2Overlay(const OverlayConfig &inConfig)
Construct from OverlayConfig.
Definition: ntv2overlay.cpp:23
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
NTV2_XptCSC1VidInput
@ NTV2_XptCSC1VidInput
Definition: ntv2enums.h:2757
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
NTV2Overlay::OutputThread
void OutputThread(void)
The output/playout thread function.
Definition: ntv2overlay.cpp:388
NTV2FrameData::VideoBuffer
NTV2Buffer & VideoBuffer(void)
Definition: ntv2democommon.h:106
NTV2Overlay::~NTV2Overlay
virtual ~NTV2Overlay()
My destructor.
Definition: ntv2overlay.cpp:38
AJAThread
Definition: thread.h:69
AJAThread::Active
virtual bool Active()
Definition: thread.cpp:116
NTV2Overlay::Run
AJAStatus Run(void)
Runs me (only after Init called)
Definition: ntv2overlay.cpp:347
AJA_STATUS_NOINPUT
@ AJA_STATUS_NOINPUT
Definition: types.h:400
CopyRaster
bool CopyRaster(const NTV2PixelFormat inPixelFormat, UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Copies all or part of a source raster image into a destination raster at a given position.
Definition: ntv2utils.cpp:1642
CNTV2Card::SetMixerBGMatteEnabled
virtual bool SetMixerBGMatteEnabled(const UWord inWhichMixer, const bool inIsEnabled)
Answers if the given mixer/keyer's background matte is enabled or not.
Definition: ntv2register.cpp:2997
AJAStatus
AJAStatus
Definition: types.h:378
NTV2_IS_FBF_RGB
#define NTV2_IS_FBF_RGB(__fbf__)
Definition: ntv2enums.h:274
NTV2InputSourceToString
std::string NTV2InputSourceToString(const NTV2InputSource inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:7263
process.h
Declares the AJAProcess class.
NTV2_XptFrameBuffer1Input
@ NTV2_XptFrameBuffer1Input
Definition: ntv2enums.h:2741
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:3769
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:3951
ULWord
uint32_t ULWord
Definition: ajatypes.h:255
CNTV2Card::GetDescription
virtual std::string GetDescription(void) const
Definition: ntv2card.cpp:143
NTV2FrameData::fVideoBuffer
NTV2Buffer fVideoBuffer
Host video buffer.
Definition: ntv2democommon.h:82
AUTOCIRCULATE_STATUS
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
Definition: ntv2publicinterface.h:7365
ntv2devicescanner.h
Declares the CNTV2DeviceScanner class.
NTV2_XptMixer1FGKeyInput
@ NTV2_XptMixer1FGKeyInput
Definition: ntv2enums.h:2827
NTV2FrameData::VideoBufferSize
ULWord VideoBufferSize(void) const
Definition: ntv2democommon.h:107
DEVICE_ID_KONAX
@ DEVICE_ID_KONAX
See KONA X™.
Definition: ntv2enums.h:78
NTV2_XptSDIOut2Input
@ NTV2_XptSDIOut2Input
Definition: ntv2enums.h:2787
NTV2FormatDescriptor::GetTotalBytes
ULWord GetTotalBytes(void) const
Definition: ntv2formatdescriptor.cpp:946
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:659
CNTV2Card::SetMode
virtual bool SetMode(const NTV2Channel inChannel, const NTV2Mode inNewValue, const bool inIsRetail=(!(0)))
Determines if a given FrameStore on the AJA device will be used to capture or playout video.
Definition: ntv2register.cpp:1607
NTV2MIXERINPUTCONTROL_SHAPED
@ NTV2MIXERINPUTCONTROL_SHAPED
Definition: ntv2enums.h:1765
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
DrawVLine
static bool DrawVLine(NTV2Buffer &buf, const NTV2RasterInfo &info, const ULWord argbPixValue, const ULWord pixThickness, const ULWord xPos, const ULWord yTop, const ULWord height)
Definition: ntv2overlay.cpp:237
AJAProcess::GetPid
static uint64_t GetPid()
Definition: process.cpp:35
NTV2RasterInfo
NTV2FormatDesc NTV2RasterInfo
Shorthand for NTV2FormatDescriptor.
Definition: ntv2formatdescriptor.h:385
CNTV2Card::UnsubscribeOutputVerticalEvent
virtual bool UnsubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Unregisters me so I'm no longer notified when an output VBI is signaled on the given output channel.
Definition: ntv2subscriptions.cpp:61
UWord
uint16_t UWord
Definition: ajatypes.h:253
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
AUTOCIRCULATE_TRANSFER
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
Definition: ntv2publicinterface.h:8252
NTV2VideoFormatToString
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Definition: ntv2utils.cpp:6798
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:2851
NTV2Overlay::Init
AJAStatus Init(void)
Prepares me to Run()
Definition: ntv2overlay.cpp:68
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1316
NTV2Overlay::RouteInputSignal
void RouteInputSignal(void)
Performs input routing.
Definition: ntv2overlay.cpp:159
GetVideoWriteSize
ULWord GetVideoWriteSize(const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, const NTV2VANCMode inVancMode=NTV2_VANCMODE_OFF)
Identical to the GetVideoActiveSize function, except rounds the result up to the nearest 4K page size...
Definition: ntv2utils.cpp:2779
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
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
CNTV2Card::SetEveryFrameServices
virtual bool SetEveryFrameServices(const NTV2EveryFrameTaskMode inMode)
Sets the device's task mode.
Definition: ntv2register.cpp:179
PLDBG
#define PLDBG(_xpr_)
Definition: ntv2democommon.h:38
NTV2FormatDescriptor::GetTotalRasterBytes
ULWord GetTotalRasterBytes(const UWord inPlaneIndex0=0) const
Definition: ntv2formatdescriptor.h:132
NTV2_DISABLE_TASKS
@ NTV2_DISABLE_TASKS
0: Disabled (never recommended): device configured exclusively by client application(s).
Definition: ntv2publicinterface.h:4439
CNTV2Card::SetMixerFGInputControl
virtual bool SetMixerFGInputControl(const UWord inWhichMixer, const NTV2MixerKeyerInputControl inInputControl)
Sets the foreground input control value for the given mixer/keyer.
Definition: ntv2register.cpp:2874
BurnConfig::fInputChannel
NTV2Channel fInputChannel
The input channel to use.
Definition: ntv2democommon.h:388
NTV2Overlay::RouteOverlaySignal
void RouteOverlaySignal(void)
Performs overlay routing.
Definition: ntv2overlay.cpp:175
NTV2Overlay::SetupOverlayBug
AJAStatus SetupOverlayBug(void)
Sets up overlay "bug".
Definition: ntv2overlay.cpp:267
BurnConfig::fDeviceSpec
std::string fDeviceSpec
The AJA device to use.
Definition: ntv2democommon.h:386
NTV2Overlay::SetupAudio
AJAStatus SetupAudio(void)
Performs all audio setup.
Definition: ntv2overlay.cpp:192
BurnConfig::fInputSource
NTV2InputSource fInputSource
The device input connector to use.
Definition: ntv2democommon.h:390
NTV2_FORMAT_UNKNOWN
@ NTV2_FORMAT_UNKNOWN
Definition: ntv2enums.h:525
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
NTV2_XptMixer1FGVidInput
@ NTV2_XptMixer1FGVidInput
Definition: ntv2enums.h:2828
NTV2_FBF_10BIT_YCBCR
@ NTV2_FBF_10BIT_YCBCR
See 10-Bit YCbCr Format.
Definition: ntv2enums.h:213
AJAAtomic::Increment
static int32_t Increment(int32_t volatile *pTarget)
Definition: atomic.cpp:82
AJA_STATUS_INITIALIZE
@ AJA_STATUS_INITIALIZE
Definition: types.h:386
NTV2_LHIHDMIColorSpaceYCbCr
@ NTV2_LHIHDMIColorSpaceYCbCr
Definition: ntv2enums.h:3650
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:5738
false
#define false
Definition: ntv2devicefeatures.h:25
NTV2_XptMixer1BGVidInput
@ NTV2_XptMixer1BGVidInput
Definition: ntv2enums.h:2826
CNTV2Card::SetMixerVancOutputFromForeground
virtual bool SetMixerVancOutputFromForeground(const UWord inWhichMixer, const bool inFromForegroundSource=(!(0)))
Sets the VANC source for the given mixer/keyer to the foreground video (or not). See the SDI Ancillar...
Definition: ntv2register.cpp:2853
AUTOCIRCULATE_STATUS::IsRunning
bool IsRunning(void) const
Definition: ntv2publicinterface.h:7505
NTV2_MODE_CAPTURE
@ NTV2_MODE_CAPTURE
Capture (input) mode, which writes into device SDRAM.
Definition: ntv2enums.h:1234
CAPINFO
#define CAPINFO(_expr_)
Definition: ntv2democommon.h:32
NTV2MIXERINPUTCONTROL_FULLRASTER
@ NTV2MIXERINPUTCONTROL_FULLRASTER
Definition: ntv2enums.h:1764
AJACircularBuffer::Clear
void Clear(void)
Clears my frame collection, their locks, everything.
Definition: circularbuffer.h:314
NTV2Overlay::InputThread
void InputThread(void)
The input/capture thread function.
Definition: ntv2overlay.cpp:514
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
std
Definition: json.hpp:5362
CNTV2Card::SetMixerMode
virtual bool SetMixerMode(const UWord inWhichMixer, const NTV2MixerKeyerMode inMode)
Sets the mode for the given mixer/keyer.
Definition: ntv2register.cpp:2920
NTV2_XptSDIIn1
@ NTV2_XptSDIIn1
Definition: ntv2enums.h:2517
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
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.
NTV2Overlay::StartInputThread
void StartInputThread(void)
Starts input thread.
Definition: ntv2overlay.cpp:485
Bouncer
A handy class that makes it easy to "bounce" an unsigned integer value between a minimum and maximum ...
Definition: ntv2democommon.h:167
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:489
gPlayExitCount
static ULWord gPlayExitCount(0)
CNTV2DriverInterface::GetDeviceID
virtual NTV2DeviceID GetDeviceID(void)
Definition: ntv2driverinterface.cpp:411
AUTOCIRCULATE_STATUS::HasAvailableInputFrame
bool HasAvailableInputFrame(void) const
Definition: ntv2publicinterface.h:7475
CNTV2Card::GetEveryFrameServices
virtual bool GetEveryFrameServices(NTV2EveryFrameTaskMode &outMode)
Retrieves the device's current "retail service" task mode.
Definition: ntv2register.cpp:184
NTV2Overlay::OutputThreadStatic
static void OutputThreadStatic(AJAThread *pThread, void *pInstance)
Definition: ntv2overlay.cpp:367
NTV2Overlay::StartOutputThread
void StartOutputThread(void)
Starts output thread.
Definition: ntv2overlay.cpp:358
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
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_XptCSC1VidRGB
@ NTV2_XptCSC1VidRGB
Definition: ntv2enums.h:2522
NTV2Buffer::Fill
bool Fill(const T &inValue)
Fills me with the given scalar value.
Definition: ntv2publicinterface.h:6411
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
PLNOTE
#define PLNOTE(_xpr_)
Definition: ntv2democommon.h:36
AJA_STATUS_OPEN
@ AJA_STATUS_OPEN
Definition: types.h:388
NTV2_XptCSC2VidYUV
@ NTV2_XptCSC2VidYUV
Definition: ntv2enums.h:2536
Bouncer::Next
T Next(void)
Definition: ntv2democommon.h:193
AJAThread::Start
virtual AJAStatus Start()
Definition: thread.cpp:91
NTV2Overlay::WaitForStableInputSignal
NTV2VideoFormat WaitForStableInputSignal(void)
Waits for stable input signal.
Definition: ntv2overlay.cpp:298
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
NTV2AudioSystem
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information.
Definition: ntv2enums.h:3865
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition: types.h:371
NTV2_AudioChannel1_2
@ NTV2_AudioChannel1_2
This selects audio channels 1 and 2 (Group 1 channels 1 and 2)
Definition: ntv2enums.h:3106
NTV2_XptMixer1BGKeyInput
@ NTV2_XptMixer1BGKeyInput
Definition: ntv2enums.h:2825
BurnConfig
Configures an NTV2Burn or NTV2FieldBurn instance.
Definition: ntv2democommon.h:383
CNTV2Card::EnableChannel
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.
Definition: ntv2register.cpp:2097
NTV2_MODE_DISPLAY
@ NTV2_MODE_DISPLAY
Playout (output) mode, which reads from device SDRAM.
Definition: ntv2enums.h:1232
NTV2Overlay
Outputs live input video overlaid with image having transparency.
Definition: ntv2overlay.h:22
NTV2_XptMixer1VidYUV
@ NTV2_XptMixer1VidYUV
Definition: ntv2enums.h:2539
NTV2_XptCSC2VidInput
@ NTV2_XptCSC2VidInput
Definition: ntv2enums.h:2759
PLINFO
#define PLINFO(_xpr_)
Definition: ntv2democommon.h:37
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
CAPNOTE
#define CAPNOTE(_expr_)
Definition: ntv2democommon.h:31
NTV2Overlay::Quit
void Quit(void)
Gracefully stops me.
Definition: ntv2overlay.cpp:48
NTV2FormatDescriptor::GetVisibleRasterHeight
ULWord GetVisibleRasterHeight(void) const
Definition: ntv2formatdescriptor.h:203
NTV2_IS_VALID_VIDEO_FORMAT
#define NTV2_IS_VALID_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:716
BurnConfig::fOutputChannel
NTV2Channel fOutputChannel
The output channel to use.
Definition: ntv2democommon.h:389
NTV2_OEM_TASKS
@ NTV2_OEM_TASKS
2: OEM (recommended): device configured by client application(s) with some driver involvement.
Definition: ntv2publicinterface.h:4441