AJA NTV2 SDK  17.5.0.1658
NTV2 SDK 17.5.0.1658
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 #define OVRLFAIL BURNFAIL
19 #define OVRLWARN BURNWARN
20 #define OVRLDBG BURNDBG
21 #define OVRLNOTE BURNNOTE
22 #define OVRLINFO BURNINFO
23 
24 static const uint32_t kAppSignature (NTV2_FOURCC('O','v','r','l'));
25 
27 
28 
30  : mConfig (inConfig),
31  mPlayThread (AJAThread()),
32  mCaptureThread (AJAThread()),
33  mVideoFormat (NTV2_FORMAT_UNKNOWN),
34  mHDMIColorSpace (NTV2_LHIHDMIColorSpaceYCbCr),
35  mSavedTaskMode (NTV2_DISABLE_TASKS),
36  mInputPixFormat (inConfig.fPixelFormat), // fixed to 10-bit YCbCr
37  mOutputPixFormat(NTV2_FBF_ARGB), // fixed to 8-bit ARGB
38  mGlobalQuit (false)
39 {
40  mAVCircularBuffer.SetAbortFlag(&mGlobalQuit); // Ring buffer abandons waits when mGlobalQuit goes true
41 } // constructor
42 
43 
45 {
46  Quit(); // Stop my capture and playout threads, then destroy them
51 } // destructor
52 
53 
54 void NTV2Overlay::Quit (void)
55 {
56  // Set the global 'quit' flag, and wait for the threads to go inactive...
57  mGlobalQuit = true;
58 
59  while (mPlayThread.Active())
60  AJATime::Sleep(10);
61 
62  while (mCaptureThread.Active())
63  AJATime::Sleep(10);
64 
65  if (!mConfig.fDoMultiFormat)
66  { // Release the device...
68  if (NTV2_IS_VALID_TASK_MODE(mSavedTaskMode))
69  mDevice.SetEveryFrameServices(mSavedTaskMode); // Restore prior task mode
70  }
71 } // Quit
72 
73 
75 {
77 
78  // Open the device...
80  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl; return AJA_STATUS_OPEN;}
81  if (!mDevice.IsDeviceReady(false))
82  {cerr << "## ERROR: Device '" << mDevice.GetDescription() << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
83  if (mDevice.GetDeviceID() != DEVICE_ID_KONAX)
84  cerr << "## WARNING: Device '" << mDevice.GetDescription() << "' is not KONA X" << endl;
85 
86  ULWord appSig(0);
87  int32_t appPID(0);
88  mDevice.GetStreamingApplication (appSig, appPID); // Who currently "owns" the device?
89  mDevice.GetEveryFrameServices(mSavedTaskMode); // Save the current device state
90 
92  {
93  cerr << "## ERROR: Cannot acquire '" << mDevice.GetDescription() << "' because another app (pid " << appPID << ") owns it" << endl;
94  return AJA_STATUS_BUSY; // Some other app is using the device
95  }
96 
97  mDevice.SetEveryFrameServices(NTV2_OEM_TASKS); // Force OEM tasks
98 
100  mDevice.EnableChannel(NTV2_CHANNEL2);
101 
102  // Enable/subscribe interrupts...
103  mConfig.fInputChannel = NTV2_CHANNEL1;
104  mConfig.fOutputChannel = NTV2_CHANNEL2;
108 
109  // Set up the overlay image...
110  status = SetupOverlayBug();
111  if (AJA_FAILURE(status))
112  return status;
113 
114  // Set up the video and audio...
115  status = SetupVideo();
116  if (AJA_FAILURE(status))
117  return status;
118  status = SetupAudio();
119  if (AJA_FAILURE(status))
120  return status;
121 
122  // Ready to go...
123  cerr << mConfig;
124  if (mDevice.IsRemote())
125  cerr << "Device Description: " << mDevice.GetDescription() << endl;
126  cerr << endl;
127 
128  OVRLINFO("Configuration: " << mConfig);
129  return AJA_STATUS_SUCCESS;
130 } // Init
131 
132 
134 {
135  // Flip the input spigot to "receive" if necessary...
136  mDevice.SetSDITransmitEnable (NTV2_CHANNEL1, false);
137  mDevice.SetSDITransmitEnable (NTV2_CHANNEL2, true);
138 
140 
141  // Since this demo runs in E-to-E mode (thru Mixer/Keyer), reference must be tied to the input...
143 
144  mDevice.SetMultiFormatMode(true);
145 
146  mDevice.ClearRouting();
150 
151  // Set up Mixer...
152  const UWord mixerNum (0);
153  mDevice.SetMixerMode (mixerNum, NTV2MIXERMODE_MIX); // "mix" mode
154  mDevice.SetMixerFGMatteEnabled (mixerNum, false); // no FG matte
155  mDevice.SetMixerBGMatteEnabled (mixerNum, false); // no BG matte
156  mDevice.SetMixerCoefficient (mixerNum, 0x10000); // FG "bug" overlay full strength (initially)
157  mDevice.SetMixerFGInputControl (mixerNum, NTV2MIXERINPUTCONTROL_SHAPED); // respect FG alpha channel
158  mDevice.SetMixerBGInputControl (mixerNum, NTV2MIXERINPUTCONTROL_FULLRASTER); // BG uses full raster
159  mDevice.SetMixerVancOutputFromForeground (mixerNum, false); // false means "use BG VANC, not FG"
160 
161  return AJA_STATUS_SUCCESS;
162 
163 } // SetupVideo
164 
166 {
167  // Connect SDIIn1 to FrameStore1 and Mixer1 background...
171 } // RouteInputSignal
172 
174 {
175  // Connect FrameStore2 RGB output through CSC2 to Mixer1 foreground...
179 } // RouteOverlaySignal
180 
181 
183 {
184  // Connect Mixer1 output to SDI & HDMI outputs...
187 } // RouteOutputSignal
188 
189 
191 {
192  // Set up the output audio embedders...
193  NTV2AudioSystem audioSystem = NTV2_AUDIOSYSTEM_1;
194  mDevice.SetSDIOutputAudioSystem (NTV2_CHANNEL2, audioSystem);
196 
197  // Enable loopback for E-E mode (i.e. output whatever audio is in input signal)...
198  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, audioSystem); // Don't turn loopback on until input signal is stable
199  return AJA_STATUS_SUCCESS;
200 
201 } // SetupAudio
202 
203 
205 {
206  if (!NTV2_IS_VALID_VIDEO_FORMAT(mVideoFormat))
207  return AJA_STATUS_NOINPUT;
208 
210 
211  // Allocate and add each NTV2FrameData to my circular buffer member variable...
212  const ULWord captureBufferSize (::GetVideoWriteSize (mVideoFormat, mInputPixFormat));
213  mBuffers.reserve(CIRCULAR_BUFFER_SIZE);
214  while (mBuffers.size() < CIRCULAR_BUFFER_SIZE)
215  {
216  mBuffers.push_back(NTV2FrameData()); // Make a new NTV2FrameData...
217  NTV2FrameData & frameData(mBuffers.back()); // ...and get a reference to it
218  // Allocate a page-aligned video buffer
219  if (!frameData.fVideoBuffer.Allocate(captureBufferSize, /*pageAlign?*/true))
220  return AJA_STATUS_MEMORY;
221  mAVCircularBuffer.Add(&frameData); // Add to my circular buffer
222  } // for each NTV2FrameData
223  return AJA_STATUS_SUCCESS;
224 } // SetupCaptureBuffers
225 
226 
228 {
229  mBuffers.clear();
230  mAVCircularBuffer.Clear();
231  return;
232 } // ReleaseCaptureBuffers
233 
234 // 4-byte-per-pixel DrawVLine -- draws a vertical line using the given pixel value and line thickness
235 static bool DrawVLine (NTV2Buffer & buf, const NTV2RasterInfo & info, const ULWord argbPixValue, const ULWord pixThickness,
236  const ULWord xPos, const ULWord yTop, const ULWord height)
237 {
238  for (ULWord y(yTop); y < (yTop + height); y++)
239  for (ULWord w(0); w < pixThickness; w++)
240  buf.U32(y * info.linePitch + xPos + w) = argbPixValue;
241  return true;
242 }
243 
244 // 4-byte-per-pixel DrawHLine -- draws a horizontal line using the given pixel value and line thickness
245 static bool DrawHLine (NTV2Buffer & buf, const NTV2RasterInfo & info, const ULWord argbPixValue, const ULWord vThickness,
246  const ULWord yPos, const ULWord xLeft, const ULWord width)
247 {
248  for (ULWord v(0); v < vThickness; v++)
249  for (ULWord x(xLeft); x < (xLeft + width); x++)
250  buf.U32((yPos + v) * info.linePitch + x) = argbPixValue;
251  return true;
252 }
253 
254 // 4-byte-per-pixel DrawBox -- draws a rectangle using the given pixel value and line thickness
255 static bool DrawBox (NTV2Buffer & buf, const NTV2RasterInfo & info, const ULWord argbPixValue, const UWord pixThickness,
256  const UWord topLeftX, const UWord topLeftY, const ULWord width, const ULWord height)
257 {
258  /*T*/DrawVLine (buf, info, argbPixValue, pixThickness, /*xPos*/topLeftX, /*yTop */topLeftY, /*hght*/height);
259  /*B*/DrawVLine (buf, info, argbPixValue, pixThickness, /*xPos*/topLeftX + width - pixThickness, /*yTop */topLeftY, /*hght*/height);
260  /*L*/DrawHLine (buf, info, argbPixValue, pixThickness, /*yPos*/topLeftY, /*xLeft*/topLeftX, /*wdth*/width);
261  /*R*/DrawHLine (buf, info, argbPixValue, pixThickness, /*yPos*/topLeftY + height - pixThickness, /*xLeft*/topLeftX, /*wdth*/width);
262  return true;
263 }
264 
266 {
267  static const ULWord sOpaqueRed(0xFFFF0000), sOpaqueBlue(0xFF0000FF), sOpaqueGreen(0xFF008000),
268  sOpaqueWhite(0xFFFFFFFF), sOpaqueBlack(0xFF000000);
269 
270  // The overlay "bug" is a 256x256 pixel raster image composed of four opaque rectangles of
271  // varying color and diminishing size, each set inside each other, centered in the raster.
272  // All space between them is transparent to reveal the background video. The line thickness
273  // of each rectangle is the same: 1/16th the width or height of the raster. The pixel format
274  // is NTV2_FBF_ARGB, which all devices handle, and easy to traverse at 4-bytes-per-pixel.
275  static const vector<ULWord> sColors = {sOpaqueWhite, sOpaqueRed, sOpaqueBlue, sOpaqueGreen};
276  const ULWord hght(256), wdth(256), thickness(wdth/16);
277 
278  // The overlay bug's NTV2RasterInfo must be hacked together manually:
279  mBugRasterInfo = NTV2RasterInfo (hght, wdth, /*U32s/line*/wdth, /*1stAct*/0, /*lumaBits*/0, /*chromaBits*/8, /*alphaBits*/8);
280 
281  // Allocate the overlay bug's host buffer:
282  if (!mBug.Allocate(mBugRasterInfo.GetTotalBytes()))
283  return AJA_STATUS_MEMORY;
284 
285  // Draw the rectangles into the mBug buffer...
286  for (size_t n(0); n < sColors.size(); n++)
287  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);
288 
289  // Draw a hatch mark in the middle of it...
290  /*V*/DrawVLine (mBug, mBugRasterInfo, sOpaqueBlack, /*thickness*/1, /*xPos*/wdth/2, /*yTop */hght/2-thickness, /*hght*/2*thickness);
291  /*H*/DrawHLine (mBug, mBugRasterInfo, sOpaqueBlack, /*thickness*/1, /*yPos*/hght/2, /*xLeft*/wdth/2-thickness, /*wdth*/2*thickness);
292  return AJA_STATUS_SUCCESS;
293 
294 } // SetupOverlayBug
295 
297 {
299  ULWord numConsecutiveFrames(0), MIN_NUM_CONSECUTIVE_FRAMES(6);
300 
301  // Detection loop:
302  while (result == NTV2_FORMAT_UNKNOWN)
303  {
304  // Determine the input video signal format...
305  // Warning: if there's no input signal, this loop won't exit until mGlobalQuit goes true!
306  UWord loopCount(0);
307  while (result == NTV2_FORMAT_UNKNOWN)
308  {
309  mDevice.WaitForOutputVerticalInterrupt(NTV2_CHANNEL1); // Just delay til next output VBI
310  if (mGlobalQuit)
311  return NTV2_FORMAT_UNKNOWN; // Terminate if asked to do so
312 
313  const NTV2VideoFormat currVF (mDevice.GetInputVideoFormat(mConfig.fInputSource));
314  if (currVF == NTV2_FORMAT_UNKNOWN)
315  { // Wait for video signal to appear
316  if (++loopCount % 500 == 0) // Log message every minute or so at ~50ms
317  CAPDBG("Waiting for valid video signal to appear at " << ::NTV2InputSourceToString(mConfig.fInputSource,true));
318  }
319  else if (numConsecutiveFrames == 0)
320  {
321  lastVF = currVF; // First valid video format to appear
322  numConsecutiveFrames++; // Start debounce counter
323  }
324  else if (numConsecutiveFrames == MIN_NUM_CONSECUTIVE_FRAMES)
325  {
326  numConsecutiveFrames = 0; // Reset for next signal outage
327  result = currVF; // Set official video format to use
328  }
329  else
330  numConsecutiveFrames = (lastVF == currVF) ? numConsecutiveFrames + 1 : 0;
331  } // loop while input video format is unstable
332 
333  CAPNOTE(::NTV2InputSourceToString(mConfig.fInputSource,true) << " video format: "
334  << ::NTV2VideoFormatToString(result));
335  cerr << endl << "## NOTE: " << ::NTV2InputSourceToString(mConfig.fInputSource,true)
336  << " video format is " << ::NTV2VideoFormatToString(result) << endl;
337  break; // Done!
338  } // loop
339 
340  NTV2_ASSERT(result != NTV2_FORMAT_UNKNOWN);
341  return result;
342 } // WaitForStableInputSignal
343 
344 
346 {
347  // Start the input thread...
349  return AJA_STATUS_SUCCESS;
350 } // Run
351 
352 
354 
355 // This is where the play thread is started
357 {
358  // Create and start the playout thread...
359  mPlayThread.Attach(OutputThreadStatic, this);
361  mPlayThread.Start();
362 } // StartOutputThread
363 
364 // The static output thread function
365 void NTV2Overlay::OutputThreadStatic (AJAThread * pThread, void * pContext) // static
366 { (void) pThread;
367  // Grab the NTV2Overlay instance pointer from the pContext parameter,
368  // then call its OutputThread method...
369  NTV2Overlay * pApp (reinterpret_cast<NTV2Overlay*>(pContext));
370  pApp->OutputThread();
371 } // OutputThreadStatic
372 
374 
375 //
376 // The output thread:
377 // - at startup:
378 // - configures the overlay FrameStore
379 // - initializes (but doesn't start) AutoCirculate (to allocate 2 device buffers)
380 // - while running:
381 // - blits the overlay image into the host overlay raster buffer
382 // - DMAs the overlay raster buffer to the device for mixing
383 // - terminates when AutoCirculate channel is stopped or when mGlobalQuit goes true
384 // - ensures my AutoCirculate channel is stopped
385 //
387 {
389  ULWord thrdNum(gPlayEnterCount), fbNum(10), loops(0);
390  ULWord goodWaits(0), badWaits(0), goodBlits(0), badBlits(0), goodXfers(0), badXfers(0), pingPong(0);
391  AUTOCIRCULATE_STATUS acStatus;
392  NTV2Buffer hostBuffer;
393 
394  // Configure the output FrameStore...
395  mDevice.SetMode (mConfig.fOutputChannel, NTV2_MODE_DISPLAY);
396  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mOutputPixFormat);
397  mDevice.SetVideoFormat (mVideoFormat, /*retail*/false, /*keepVanc*/false, mConfig.fOutputChannel);
398  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
399  NTV2RasterInfo rasterInfo (mVideoFormat, mOutputPixFormat);
400  if (!hostBuffer.Allocate(rasterInfo.GetTotalRasterBytes(), /*pageAligned*/true))
401  {cerr << "## ERROR: Failed to allocate " << rasterInfo.GetTotalRasterBytes() << "-byte vid buffer" << endl; return;}
402 
403  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
404  if (mDevice.AutoCirculateInitForOutput(mConfig.fOutputChannel, 2) && mDevice.AutoCirculateGetStatus(mConfig.fOutputChannel, acStatus)) // Find out which buffers we got
405  fbNum = ULWord(acStatus.acStartFrame); // Use them
406  else
407  {cerr << "## NOTE: Allocate 2-frame AC" << DEC(mConfig.fOutputChannel+1) << " range failed" << endl; return;}
408 
409  PLNOTE(DEC(thrdNum) << " started, " << ::NTV2VideoFormatToString(mVideoFormat)
410  << " raster:" << rasterInfo << ", bug:" << mBugRasterInfo);
411  Bouncer<ULWord> mixPct (/*max*/400, /*min*/100, /*start*/100),
412  xPos (/*max*/rasterInfo.GetRasterWidth() - mBugRasterInfo.GetRasterWidth()),
413  yPos (/*max*/rasterInfo.GetVisibleRasterHeight() - mBugRasterInfo.GetVisibleRasterHeight() - 1);
414 
415  // Loop til Quit or my AC channel stops...
416  while (!mGlobalQuit)
417  {
418  // Terminate this output thread when video format changes...
419  if (mDevice.GetInputVideoFormat(mConfig.fInputSource) != mVideoFormat)
420  break; // Stopped, exit thread
421 
422  NTV2FrameData * pFrameData (mAVCircularBuffer.StartConsumeNextBuffer());
423  if (pFrameData)
424  {
425  // Consume captured frame ... it's simply dropped on the floor.
426  // (The frame can't be used here anyway, since it's NTV2_FBF_10BIT_YCBCR,
427  // and the output pixel format is NTV2_FBF_ARGB.)
428  mAVCircularBuffer.EndConsumeNextBuffer(); // Signal "done with this frame"
429  }
430 
431  // Wait for the next output vertical interrupt event to get signaled...
432  if (mDevice.WaitForOutputVerticalInterrupt(mConfig.fOutputChannel))
433  {
434  ++goodWaits;
435  // Clear host buffer, blit the "bug" into it, then transfer it to device...
436  hostBuffer.Fill(ULWord(0));
437  if (::CopyRaster (mOutputPixFormat, // src & dst pixel format
438  hostBuffer, // dstBuffer
439  rasterInfo.GetBytesPerRow(), // dstBytesPerLine
440  rasterInfo.GetVisibleRasterHeight(), // dstTotalLines
441  yPos.Next(), // dstVertLineOffset
442  xPos.Next(), // dstHorzPixelOffset
443  mBug, // srcBuffer
444  mBugRasterInfo.GetBytesPerRow(), // srcBytesPerLine
445  mBugRasterInfo.GetVisibleRasterHeight(), // srcTotalLines
446  0, // srcVertLineOffset
447  mBugRasterInfo.GetVisibleRasterHeight(), // srcVertLinesToCopy
448  0, // srcHorzPixelOffset
449  mBugRasterInfo.GetRasterWidth())) // srcHorzPixelsToCopy
450  ++goodBlits;
451  else
452  ++badBlits;
453  if (mDevice.DMAWriteFrame (fbNum + pingPong, hostBuffer, hostBuffer.GetByteCount()))
454  ++goodXfers;
455  else
456  ++badXfers;
457  mDevice.SetOutputFrame (mConfig.fOutputChannel, fbNum + pingPong);
458  pingPong = pingPong ? 0 : 1;
459  mDevice.SetMixerCoefficient (MixerNum(), mixPct.Next() * 0x10000 / 400);
460  }
461  else
462  ++badWaits;
463 
464  if (++loops % 500 == 0) // Log message every minute or so
465  PLDBG(DEC(thrdNum) << ": " << DEC(goodXfers) << " xfers (" << DEC(badXfers) << " failed), " << DEC(goodBlits)
466  << " blits (" << DEC(badBlits) << " failed), " << DEC(goodWaits) << " waits ("
467  << DEC(badWaits) << " failed)");
468  } // loop til quit or A/C stopped
469 
470  mDevice.AutoCirculateStop(mConfig.fOutputChannel);
472  PLNOTE(DEC(thrdNum) << " done: " << DEC(goodXfers) << " xfers (" << DEC(badXfers) << " failed), "
473  << DEC(goodBlits) << " blits (" << DEC(badBlits) << " failed), " << DEC(goodWaits) << " waits (" << DEC(badWaits) << " failed)");
475 
476 } // OutputThread
477 
478 
480 
481 
482 // This is where the input thread gets started
484 {
485  // Create and start the capture thread...
486  mCaptureThread.Attach(InputThreadStatic, this);
487  mCaptureThread.SetPriority(AJA_ThreadPriority_High);
488  mCaptureThread.Start();
489 } // StartInputThread
490 
491 // The static input thread function
492 void NTV2Overlay::InputThreadStatic (AJAThread * pThread, void * pContext) // static
493 { (void) pThread;
494  // Grab the NTV2Overlay instance pointer from the pContext parameter,
495  // then call its InputThread method...
496  NTV2Overlay * pApp (reinterpret_cast<NTV2Overlay*>(pContext));
497  pApp->InputThread();
498 } // InputThreadStatic
499 
500 
501 //
502 // The input thread:
503 // - waits indefinitely for a stable input signal, and if one is found:
504 // - configures an input FrameStore (if needed for capturing frames to host)
505 // - initializes AutoCirculate to reserve a couple of device frame buffers
506 // - starts a new output thread
507 // - waits indefinitely to see if the input signal is lost or changes, and if it does:
508 // - stops input AutoCirculate which signals the output thread to exit
509 // - upon termination:
510 // - ensures my monitor/capture AutoCirculate channel is stopped
511 //
513 {
514  ULWord loops(0), bails(0), vfChgTally(0), badWaits(0), waitTally(0), goodXfers(0), badXfers(0);
515  AUTOCIRCULATE_TRANSFER xferInfo;
516  CAPNOTE("Started");
517 
518  // Loop until time to quit...
519  while (!mGlobalQuit)
520  {
521  mDevice.AutoCirculateStop(mConfig.fInputChannel);
522  mVideoFormat = WaitForStableInputSignal();
523  if (mVideoFormat == NTV2_FORMAT_UNKNOWN)
524  break; // Quit
525 
526  // At this point, the input video format is stable.
527  // Configure the input FrameStore...
528  mDevice.SetMode (mConfig.fInputChannel, NTV2_MODE_CAPTURE);
530  mDevice.SetVideoFormat (mVideoFormat, /*retail*/false, /*keepVanc*/false, mConfig.fInputChannel);
531  mDevice.SetVANCMode (NTV2_VANCMODE_OFF, mConfig.fInputChannel);
533  { cerr << "## NOTE: Failed to [re]allocate host buffers" << endl;
534  mGlobalQuit = true;
535  continue;
536  }
537 
538  AUTOCIRCULATE_STATUS acStatus;
539  if (!mDevice.AutoCirculateInitForInput(mConfig.fInputChannel, 7))
540  { cerr << "## NOTE: Input A/C allocate device frame buffer range failed" << endl;
541  mGlobalQuit = true;
542  continue;
543  }
544 
545  mDevice.AutoCirculateStart(mConfig.fInputChannel); // Start capturing
546  StartOutputThread(); // Start a new playout thread
547 
548  // Capture frames until signal format changes...
549  while (!mGlobalQuit)
550  {
551  AUTOCIRCULATE_STATUS acStatus;
552  mDevice.AutoCirculateGetStatus (mConfig.fInputChannel, acStatus);
553  if (acStatus.IsRunning() && acStatus.HasAvailableInputFrame())
554  {
555  // At least one fully-formed frame is available in device frame buffer
556  // memory that can be transferred to the host. Reserve an NTV2FrameData
557  // to "produce", and use it to store the next frame to be transferred...
558  NTV2FrameData * pCaptureData (mAVCircularBuffer.StartProduceNextBuffer());
559  if (pCaptureData)
560  { // Transfer frame from device...
561  xferInfo.SetVideoBuffer (pCaptureData->VideoBuffer(), pCaptureData->VideoBufferSize());
562  if (mDevice.AutoCirculateTransfer (mConfig.fInputChannel, xferInfo)) ++goodXfers;
563  else ++badXfers;
564  mAVCircularBuffer.EndProduceNextBuffer(); // Signal "done with this frame"
565  } // if pCaptureData != NULL
566  else ++bails;
567  } // if A/C running and frame(s) are available for transfer
568  else
569  { // Wait for next input VBI...
570  if (mDevice.WaitForInputVerticalInterrupt(mConfig.fInputChannel)) ++waitTally;
571  else ++badWaits;
572  }
573  if (++loops % 500 == 0) // Log message every minute or so
574  CAPDBG(DEC(vfChgTally) << " sigChgs, " << DEC(bails) << " bails, " << DEC(waitTally)
575  << " waits (" << DEC(badWaits) << " failed), " << DEC(goodXfers) << " xfers ("
576  << DEC(badXfers) << " failed)");
577 
578  // Check input signal format...
579  if (mDevice.GetInputVideoFormat(mConfig.fInputSource) != mVideoFormat)
580  { // Input signal format changed!
581  ++vfChgTally;
582  mAVCircularBuffer.StartProduceNextBuffer(); // Unblock output thread
583  mAVCircularBuffer.EndProduceNextBuffer();
585  break; // Break to outer loop to wait for stable input signal
586  }
587  } // inner loop -- until signal change
588  } // loop til quit signaled
589 
590  mDevice.AutoCirculateStop(mConfig.fInputChannel); // This will signal OutputThread to exit
591  CAPNOTE("Done: " << DEC(vfChgTally) << " sigChgs, " << DEC(bails) << " bails, " << DEC(waitTally)
592  << " waits (" << DEC(badWaits) << " failed), " << DEC(goodXfers) << " xfers ("
593  << DEC(badXfers) << " failed)");
594 } // 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:255
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:133
NTV2_IS_VALID_TASK_MODE
#define NTV2_IS_VALID_TASK_MODE(__m__)
Definition: ntv2publicinterface.h:4401
CAPDBG
#define CAPDBG(_expr_)
Definition: ntv2democommon.h:30
NTV2_FOURCC
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
Definition: ntv2publicinterface.h:5550
NTV2_REFERENCE_INPUT1
@ NTV2_REFERENCE_INPUT1
Specifies the SDI In 1 connector.
Definition: ntv2enums.h:1443
OVRLINFO
#define OVRLINFO
Definition: ntv2overlay.cpp:22
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:227
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:6141
AUTOCIRCULATE_STATUS::acStartFrame
LWord acStartFrame
First frame to circulate. FIXFIXFIX Why is this signed? CHANGE TO ULWord??
Definition: ntv2publicinterface.h:7325
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:6215
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:492
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:6680
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:204
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:245
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:182
NTV2Overlay::NTV2Overlay
NTV2Overlay(const OverlayConfig &inConfig)
Construct from OverlayConfig.
Definition: ntv2overlay.cpp:29
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
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:386
NTV2FrameData::VideoBuffer
NTV2Buffer & VideoBuffer(void)
Definition: ntv2democommon.h:106
NTV2Overlay::~NTV2Overlay
virtual ~NTV2Overlay()
My destructor.
Definition: ntv2overlay.cpp:44
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:345
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
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:7321
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:235
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:8208
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:74
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1316
NTV2Overlay::RouteInputSignal
void RouteInputSignal(void)
Performs input routing.
Definition: ntv2overlay.cpp:165
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:4395
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:173
NTV2Overlay::SetupOverlayBug
AJAStatus SetupOverlayBug(void)
Sets up overlay "bug".
Definition: ntv2overlay.cpp:265
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:190
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:5694
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:7461
NTV2_MODE_CAPTURE
@ NTV2_MODE_CAPTURE
Capture (input) mode, which writes into device SDRAM.
Definition: ntv2enums.h:1234
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:512
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:483
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:7431
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:365
NTV2Overlay::StartOutputThread
void StartOutputThread(void)
Starts output thread.
Definition: ntv2overlay.cpp:356
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
NTV2Buffer::Fill
bool Fill(const T &inValue)
Fills me with the given scalar value.
Definition: ntv2publicinterface.h:6367
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:296
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
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:54
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:4397