AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2streamgrabber.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
7 #include <ostream>
8 #include "ntv2streamgrabber.h"
9 #include "ntv2democommon.h"
10 #include "ntv2devicefeatures.h"
11 #include "ntv2devicescanner.h"
12 #include "ntv2utils.h"
13 #if defined (INCLUDE_AJACC)
16  using namespace std;
17 #endif
18 
19 #define NTV2_NUM_IMAGES (10)
20 
21 // Convenience macros for EZ logging:
22 #define FGFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
23 #define FGWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
24 #define FGDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
25 #define FGNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
26 #define FGINFO(_expr_) AJA_sINFO (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
27 
28 static QMutex gMutex;
29 
30 
32  : QThread (parent),
33  mRestart (true),
34  mAbort (false),
35  mCheckFor4K (false),
36  mDeinterlace (true),
37  mbFixedReference (false),
38  mBoardNumber (0),
39  mDeviceID (DEVICE_ID_NOTFOUND),
40  mChannel (NTV2_MAX_NUM_CHANNELS),
41  mNumChannels (0),
42  mTsi (false),
43  mCurrentVideoFormat (NTV2_FORMAT_UNKNOWN),
44  mCurrentColorSpace (NTV2_LHIHDMIColorSpaceYCbCr),
45  mLastVideoFormat (NTV2_FORMAT_UNKNOWN),
46  mDebounceCounter (0),
47  mFormatIsProgressive (true),
48  mInputSource (NTV2_NUM_INPUTSOURCES),
49  mFrameBufferFormat (NTV2_FBF_ARGB),
50  mDoMultiChannel (false),
51  mbWithAudio (false),
52  mAudioOutput (AJA_NULL),
53  mAudioDevice (AJA_NULL),
54  mNumAudioChannels (0),
55  mAudioSystem (NTV2_AUDIOSYSTEM_1),
56  mTimeCodeSource (NTV2_TCINDEX_INVALID)
57 {
59 
60 } // constructor
61 
62 
64 {
65  mAbort = true;
66  while (isRunning ())
67  ; // Wait for grabber thread to finish
68 
70 
71  if (mAudioOutput)
72  delete mAudioOutput;
73 
74 } // destructor
75 
76 
78 {
79  if (inInputSource != mInputSource)
80  {
81  qDebug() << "## DEBUG: NTV2StreamGrabber::SetInputSource" << ::NTV2InputSourceToString (inInputSource).c_str ();
82  gMutex.lock ();
83  mInputSource = inInputSource;
84  mRestart = true;
85  gMutex.unlock ();
86  }
87 
88 } // SetInputSource
89 
90 
91 void NTV2StreamGrabber::SetDeviceIndex (const UWord inDeviceIndex)
92 {
93  if (inDeviceIndex != mBoardNumber)
94  {
95  gMutex.lock ();
96  mBoardNumber = inDeviceIndex;
97  mRestart = true;
98  gMutex.unlock ();
99  }
100 } // SetDeviceIndex
101 
102 
104 {
105  if (inTCIndex != mTimeCodeSource)
106  {
107  gMutex.lock ();
108  mTimeCodeSource = inTCIndex;
109  mRestart = true;
110  gMutex.unlock ();
111  }
112 } // SetTimeCodeSource
113 
114 
116 {
117  gMutex.lock ();
118  const UWord result (mBoardNumber);
119  gMutex.unlock ();
120  return result;
121 }
122 
123 
124 #if defined (INCLUDE_AJACC)
125  #if 0
126  static const UWord gTest [15][32] =
127  // 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
128  // 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
129  /*01*/ {{0x250C, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014,
130  0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2510},
131  /*02*/ {0x007C, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E,
132  0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x007C},
133  /*03*/ {0x007C, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005D,
134  0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x007C},
135  /*04*/ {0x007C, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0020, 0x00E1, 0x00E9, 0x00ED,
136  0x00F3, 0x00FA, 0x00E7, 0x00F7, 0x00D1, 0x00E1, 0x00F1, 0x2588, 0x00AE, 0x00B0, 0x00BD, 0x00BF, 0x2122, 0x00A2, 0x00A3, 0x007C},
137  /*05*/ {0x007C, 0x266A, 0x00E0, 0x00A0, 0x00E8, 0x00E2, 0x00EA, 0x00EE, 0x00F4, 0x00FB, 0x00C1, 0x00C9, 0x00D3, 0x00DA, 0x00DC, 0x00FC,
138  0x2018, 0x00A1, 0x002A, 0x2019, 0x2014, 0x00A9, 0x2120, 0x2022, 0x201C, 0x201D, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x007C},
139  /*06*/ {0x007C, 0x00C0, 0x00C2, 0x00C7, 0x00C8, 0x00CA, 0x00CB, 0x00EB, 0x00CE, 0x00CF, 0x00EF, 0x00D4, 0x00D9, 0x00F9, 0x00DB, 0x00AB,
140  0x00BB, 0x0020, 0x0020, 0x00C3, 0x00E3, 0x00CD, 0x00CC, 0x00EC, 0x00D2, 0x00F2, 0x00D5, 0x00F5, 0x007B, 0x007D, 0x005C, 0x007C},
141  /*07*/ {0x007C, 0x005E, 0x005F, 0x007C, 0x007E, 0x0020, 0x0020, 0x00C4, 0x00E4, 0x00D6, 0x00F6, 0x00DF, 0x00A5, 0x00A4, 0x007C, 0x00C5,
142  0x00E5, 0x00D8, 0x00F8, 0x00C4, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x007C},
143  /*08*/ {0x007C, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
144  0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x007C},
145  /*09*/ {0x007C, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E,
146  0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x007C},
147  /*10*/ {0x007C, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005D,
148  0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x007C},
149  /*11*/ {0x007C, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0020, 0x00E1, 0x00E9, 0x00ED,
150  0x00F3, 0x00FA, 0x00E7, 0x00F7, 0x00D1, 0x00E1, 0x00F1, 0x2588, 0x00AE, 0x00B0, 0x00BD, 0x00BF, 0x2122, 0x00A2, 0x00A3, 0x007C},
151  /*12*/ {0x007C, 0x266A, 0x00E0, 0x00A0, 0x00E8, 0x00E2, 0x00EA, 0x00EE, 0x00F4, 0x00FB, 0x00C1, 0x00C9, 0x00D3, 0x00DA, 0x00DC, 0x00FC,
152  0x2018, 0x00A1, 0x002A, 0x2019, 0x2014, 0x00A9, 0x2120, 0x2022, 0x201C, 0x201D, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x007C},
153  /*13*/ {0x007C, 0x00C0, 0x00C2, 0x00C7, 0x00C8, 0x00CA, 0x00CB, 0x00EB, 0x00CE, 0x00CF, 0x00EF, 0x00D4, 0x00D9, 0x00F9, 0x00DB, 0x00AB,
154  0x00BB, 0x0020, 0x0020, 0x00C3, 0x00E3, 0x00CD, 0x00CC, 0x00EC, 0x00D2, 0x00F2, 0x00D5, 0x00F5, 0x007B, 0x007D, 0x005C, 0x007C},
155  /*14*/ {0x007C, 0x005E, 0x005F, 0x007C, 0x007E, 0x0020, 0x0020, 0x00C4, 0x00E4, 0x00D6, 0x00F6, 0x00DF, 0x00A5, 0x00A4, 0x007C, 0x00C5,
156  0x00E5, 0x00D8, 0x00F8, 0x00C4, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x007C},
157  /*15*/ {0x2514, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014,
158  0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2014, 0x2518}};
159  #endif // 0
160 #endif // defined (INCLUDE_AJACC)
161 
162 
163 void NTV2StreamGrabber::ClearCaptionBuffer (const bool inNotifyClients)
164 {
165  #if defined (INCLUDE_AJACC)
166  for (UWord row (NTV2_CC608_MinRow); row <= NTV2_CC608_MaxRow; row++)
167  for (UWord col (NTV2_CC608_MinCol); col <= NTV2_CC608_MaxCol; col++)
168  mScreenBuffer [row-1][col-1] = 0x0020; // gTest[row-1][col-1];
169  if (inNotifyClients)
170  emit captionScreenChanged (&mScreenBuffer[0][0]);
171  #else
172  (void) inNotifyClients;
173  #endif
174 }
175 
176 
178 {
179  #if defined (INCLUDE_AJACC)
180  NTV2_ASSERT (mNTV2Card.IsOpen ());
181  NTV2_ASSERT (mDeviceID != DEVICE_ID_NOTFOUND);
182 
183  if (::NTV2DeviceCanDoCustomAnc (mDeviceID))
184  {
185  bool gotCaptionPacket (false);
186  CaptionData captionData; // The two byte pairs (one pair per field) our 608 decoder is looking for
187  ostringstream oss; // DEBUG
188 
189  // See what's in the AUTOCIRCULATE_TRANSFER's F1 & F2 anc buffers...
190  AJAAncillaryList ancPacketsF1, ancPacketsF2;
191  ancPacketsF1.AddReceivedAncillaryData ((uint8_t *) mTransferStruct.acANCBuffer.GetHostPointer (), mTransferStruct.acANCBuffer.GetByteCount ());
192  ancPacketsF2.AddReceivedAncillaryData ((uint8_t *) mTransferStruct.acANCField2Buffer.GetHostPointer (), mTransferStruct.acANCField2Buffer.GetByteCount ());
193  ancPacketsF1.ParseAllAncillaryData ();
194  ancPacketsF2.ParseAllAncillaryData ();
195 
197  {
199  if (ancCEA708DataIn.GetPayloadData () && ancCEA708DataIn.GetPayloadByteCount ())
200  gotCaptionPacket = m708Decoder ? m708Decoder->SetSMPTE334AncData (ancCEA708DataIn.GetPayloadData (), ancCEA708DataIn.GetPayloadByteCount ()) : false;
201  //if (gotCaptionPacket) oss << "Using F1 AJAAnc CEA708 packet(s)";
202  }
204  {
206  if (ancCEA608DataIn.GetPayloadData () && ancCEA608DataIn.GetPayloadByteCount ())
207  gotCaptionPacket = m708Decoder ? m708Decoder->SetSMPTE334AncData (ancCEA608DataIn.GetPayloadData (), ancCEA608DataIn.GetPayloadByteCount ()) : false;
208  //if (gotCaptionPacket) oss << "Using F1 AJAAnc CEA608 packet(s)";
209  }
211  {
213  if (AJA_SUCCESS (ancEIA608DataIn.ParsePayloadData ()))
214  if (AJA_SUCCESS (ancEIA608DataIn.GetCEA608Bytes (captionData.f1_char1, captionData.f1_char2, captionData.bGotField1Data)))
215  gotCaptionPacket = true;
216  //if (gotCaptionPacket) oss << "Using F1 AJAAnc EIA608 packet(s)";
217  }
219  {
221  if (AJA_SUCCESS (ancEIA608DataIn.ParsePayloadData ()))
222  if (AJA_SUCCESS (ancEIA608DataIn.GetCEA608Bytes (captionData.f2_char1, captionData.f2_char2, captionData.bGotField2Data)))
223  gotCaptionPacket = true;
224  //if (gotCaptionPacket) oss << "Using F2 AJAAnc EIA608 packet(s)";
225  }
226 
227  if (NTV2_IS_HD_VIDEO_FORMAT (mCurrentVideoFormat))
228  {
229  if (gotCaptionPacket && m708Decoder && m708Decoder->ParseSMPTE334AncPacket ())
230  captionData = m708Decoder->GetCC608CaptionData (); // Extract the 608 caption byte pairs
231  } // else if HD
232 
233  // Sorry, we only handle 608 captions -- nothing else.
234  // The 608 decoder does the rest. It expects to be called once per frame (to implement flashing characters and roll-up).
235  // Pass the caption byte pairs to it for processing (even if captionData.HasData returns false)...
236  if (m608Decoder)
237  m608Decoder->ProcessNew608FrameData (captionData);
238  //if (!oss.str ().empty ()) cerr << oss.str () << endl; // DEBUG DEBUG DEBUG DEBUG
239  //if (captionData.HasData ()) cerr << captionData << endl;
240  } // if able to use Anc buffers
241  #endif // defined (INCLUDE_AJACC)
242 } // GrabCaptions
243 
244 
245 void NTV2StreamGrabber::changeCaptionChannel (int inNewCaptionChannelId)
246 {
247  #if defined (INCLUDE_AJACC)
248  const NTV2Line21Channel chosenCaptionChannel (static_cast <NTV2Line21Channel> (inNewCaptionChannelId));
249 
250  if (!m608Decoder && IsValidLine21Channel (chosenCaptionChannel))
251  {
252  NTV2_ASSERT (!m708Decoder);
253  if (CNTV2CaptionDecoder608::Create (m608Decoder) && CNTV2CaptionDecoder708::Create (m708Decoder))
254  {
255  m608Decoder->SubscribeChangeNotification (Caption608Changed, this);
256  m608Decoder->SetDisplayChannel (chosenCaptionChannel);
257  ClearCaptionBuffer (true);
258  }
259  else
260  {m608Decoder = AJA_NULL; m708Decoder = AJA_NULL;}
261  }
262  else if (m608Decoder)
263  {
264  NTV2_ASSERT (m708Decoder);
265  if (!IsValidLine21Channel (chosenCaptionChannel))
266  {m608Decoder = AJA_NULL; m708Decoder = AJA_NULL;}
267  else if (m608Decoder->GetDisplayChannel () != chosenCaptionChannel)
268  m608Decoder->SetDisplayChannel (chosenCaptionChannel);
269  ClearCaptionBuffer (true);
270  }
271  #else
272  (void) inNewCaptionChannelId;
273  #endif // defined (INCLUDE_AJACC)
274 } // changeCaptionChannel
275 
276 
278 {
279  // Set up 2 images to ping-pong between capture and display...
280  QImage * images [NTV2_NUM_IMAGES];
281  ULWord framesCaptured (0);
282  FGNOTE("Thread started");
283 
284  // initialize images
285  for (int i = 0; i < NTV2_NUM_IMAGES; i++)
286  {
287  images[i] = new QImage(STREAMPREVIEW_WIDGET_X, STREAMPREVIEW_WIDGET_Y, QImage::Format_RGB32);
288  }
289 
290  // Make sure all Bidirectionals are set to Inputs.
291  if (mNTV2Card.Open(mBoardNumber))
292  {
293  if (!mDoMultiChannel && !mNTV2Card.AcquireStreamForApplicationWithReference (kDemoAppSignature, int32_t(AJAProcess::GetPid())))
294  {
295  // We have not acquired the board continue until something changes...
296  qDebug ("Could not acquire board number %d", GetDeviceIndex());
297  mNTV2Card.Close ();
298  mDeviceID = DEVICE_ID_NOTFOUND;
299  }
300  else
301  {
302  mNTV2Card.GetEveryFrameServices (mSavedTaskMode); // Save the current state before we change it
303  mNTV2Card.SetEveryFrameServices (NTV2_OEM_TASKS); // Since this is an OEM demo we will set the OEM service level
304 
305  if (::NTV2DeviceHasBiDirectionalSDI (mNTV2Card.GetDeviceID())) // If device has bidirectional SDI connectors...
306  {
307  bool waitForInput = false;
308  for (unsigned offset (0); offset < 8; offset++)
309  {
310  mNTV2Card.EnableChannel (NTV2Channel(offset));
311  bool outputEnabled;
312  mNTV2Card.GetSDITransmitEnable (NTV2Channel(offset), outputEnabled);
313  if (outputEnabled)
314  {
315  waitForInput = true;
316  mNTV2Card.SetSDITransmitEnable (NTV2Channel(offset), false);
317  }
318  }
319  // Only if we had to change an output to input do we need to wait.
320  if (waitForInput)
321  mNTV2Card.WaitForInputVerticalInterrupt (mChannel, 10); // ...and give the device some time to lock to a signal
322  }
323  }
324  }
325 
326  while (true)
327  {
328  if (mAbort)
329  break;
330 
331  if (!NTV2_IS_VALID_INPUT_SOURCE (mInputSource))
332  {
333  // No input chosen, so display banner...
334  QImage * currentImage = images [0];
335  currentImage->load (":/resources/splash.png");
336  emit newStatusString ("");
337  emit newFrame (*currentImage, true);
338  mNTV2Card.SetSDITransmitEnable (NTV2_CHANNEL1, false);
339  mNTV2Card.SetSDITransmitEnable (NTV2_CHANNEL2, false);
340  msleep (200);
341  continue;
342  }
343 
344  if (mRestart)
345  {
346  gMutex.lock ();
347  if (mNTV2Card.IsOpen ())
348  {
349  msleep (1000);
350  if (!mDoMultiChannel)
351  {
353  mNTV2Card.SetEveryFrameServices (mSavedTaskMode);
354  }
355  mNTV2Card.Close ();
356  mDeviceID = DEVICE_ID_NOTFOUND;
357  }
358  gMutex.unlock ();
359 
360  if (mNTV2Card.Open(mBoardNumber))
361  {
362  if (!mDoMultiChannel && !mNTV2Card.AcquireStreamForApplicationWithReference (kDemoAppSignature, int32_t(AJAProcess::GetPid())))
363  {
364  //We have not acquired the board continue until something changes
365  qDebug() << "Could not acquire board number " << GetDeviceIndex();
366  msleep (1000);
367  mNTV2Card.Close ();
368  mDeviceID = DEVICE_ID_NOTFOUND;
369  continue;
370  }
371 
372  mNTV2Card.GetEveryFrameServices (mSavedTaskMode); // Save the current state before we change it
373  mNTV2Card.SetEveryFrameServices (NTV2_OEM_TASKS); // Since this is an OEM demo we will set the OEM service level
374 
375  mDeviceID = mNTV2Card.GetDeviceID ();
376 // if (::NTV2DeviceCanDoMultiFormat (mDeviceID))
377  mNTV2Card.SetMultiFormatMode (false);
378 
379  if (!mNTV2Card.IsDeviceReady (false))
380  {
381  qDebug ("Device not ready");
382  msleep (1000); // Keep the UI responsive while waiting for device to become ready
383  }
384  else if (SetupInput ())
385  {
386  mTransferStruct.acVideoBuffer.Allocate(mFrameDimensions.Width()*mFrameDimensions.Height()*4, true);
387  mTransferStruct.acVideoBuffer.Fill(0);
388  mTransferStruct.acANCBuffer.Allocate (::NTV2DeviceCanDoCustomAnc (mNTV2Card.GetDeviceID ()) ? NTV2_ANCSIZE_MAX : 0); // Reserve space for anc data
389  mTransferStruct.acANCField2Buffer.Allocate (::NTV2DeviceCanDoCustomAnc (mNTV2Card.GetDeviceID ()) ? NTV2_ANCSIZE_MAX : 0); // Reserve space for anc data
390  const ULWord acOptions(AUTOCIRCULATE_WITH_RP188 | (mTransferStruct.acANCBuffer.IsNULL() && mTransferStruct.acANCField2Buffer.IsNULL() ? 0 : AUTOCIRCULATE_WITH_ANC));
391  gMutex.lock ();
392  mNTV2Card.DMAStreamStop (mChannel, true);
393  gMutex.unlock ();
394 
395  // Start AutoCirculate...
396  mNTV2Card.SetLTCInputEnable (true);
397  mNTV2Card.SetRP188SourceFilter (mChannel, 0); // 0=LTC 1=VITC1 2=VITC2
398  mNTV2Card.DMABufferUnlockAll();
399  for (int i = 0; i < NTV2_NUM_IMAGES; i++)
400  {
401  delete images[i];
402  images[i] = new QImage ((uchar*)mTransferStruct.acVideoBuffer.GetHostAddress(i), mFrameDimensions.Width (), mFrameDimensions.Height (), QImage::Format_RGB32);
403  }
404 
405  mNTV2Card.SetInputFrame(mChannel, 0);
406  mNTV2Card.WaitForInputVerticalInterrupt (mChannel, 1);
407 
408  QImage * currentImage (images [0]);
409  mNTV2Card.DMABufferLock(reinterpret_cast<PULWord>(currentImage->bits()), ULWord(currentImage->sizeInBytes()), true);
410  mNTV2Card.DMAStreamStart (reinterpret_cast<PULWord>(currentImage->bits()), ULWord(currentImage->sizeInBytes()), mChannel, true);
411  framesCaptured = 0;
412  mRestart = false;
413  } // if board set up ok
414  else
415  msleep (1000); // This keeps the UI responsive if/while this channel has no input
416  } // if board opened ok
417  else
418  {
419  qDebug() << "## WARNING: Open failed for device " << GetDeviceIndex ();
420  msleep (200);
421  continue;
422  }
423 
424  emit newStatusString (::NTV2InputSourceToString (mInputSource, true).c_str());
425  } // if mRestart
426 
427  if (CheckForValidInput () == false && NTV2_IS_VALID_INPUT_SOURCE (mInputSource))
428  {
429  QImage * currentImage (images [0]);
430  currentImage->fill (qRgba (40, 40, 40, 255));
431 
432  QString status (QString("%1: No Detected Input").arg(::NTV2InputSourceToString(mInputSource, true).c_str()));
433  emit newStatusString (status);
434  emit newFrame (*currentImage, true);
435  msleep (200);
436  continue;
437  }
438 
439  if (mNTV2Card.IsOpen())
440  {
441  QImage * currentImage (images [0]);
442  NTV2TimeCodeList tcValues;
443 #if 0
444  #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
445  mTransferStruct.SetVideoBuffer (reinterpret_cast<PULWord>(currentImage->bits()), ULWord(currentImage->sizeInBytes()));
446  #else
447  mTransferStruct.SetVideoBuffer (reinterpret_cast<PULWord>(currentImage->bits()), ULWord(currentImage->byteCount()));
448  #endif
449 #endif
450 
451  QString outString (::NTV2InputSourceToString (mInputSource, true).c_str());
452  outString.append (" ");
453  outString.append (::NTV2VideoFormatToString (mCurrentVideoFormat).c_str ());
454 
455  emit newStatusString (outString);
456 
457  emit newFrame (*currentImage, (framesCaptured == 0) ? true : false);
458 
459  framesCaptured++;
460 
461  mNTV2Card.WaitForInputVerticalInterrupt (mChannel);
462  }
463  } // loop til break
464 
465  if (mNTV2Card.IsOpen ())
466  {
467  gMutex.lock ();
468  msleep (1000);
469  if (!mDoMultiChannel)
470  {
471  mNTV2Card.ReleaseStreamForApplicationWithReference (kDemoAppSignature, int32_t(AJAProcess::GetPid())); // Release the device
472  mNTV2Card.SetEveryFrameServices (mSavedTaskMode); // Restore prior task mode
473  }
474  mNTV2Card.Close ();
475  mDeviceID = DEVICE_ID_NOTFOUND;
476  gMutex.unlock ();
477  }
478 
479  for (int i = 0; i < NTV2_NUM_IMAGES; i++)
480  delete images[i];
481 
482  FGNOTE("Thread completed, will exit for device" << mNTV2Card.GetDisplayName() << " input source " << ::NTV2InputSourceToString(mInputSource));
483 
484 } // run
485 
486 
488 {
489  bool validInput (false);
490 
491  NTV2_ASSERT (mNTV2Card.IsOpen ());
492  NTV2_ASSERT (mDeviceID != DEVICE_ID_NOTFOUND);
493 
494  mChannel = ::NTV2InputSourceToChannel (mInputSource);
495  if(mChannel == NTV2_CHANNEL_INVALID)
496  mChannel = NTV2_CHANNEL1;
497  mTimeCodeSource = ::NTV2InputSourceToTimecodeIndex (mInputSource);
498 
499  bool waitForInput(false);
500  if (::NTV2DeviceHasBiDirectionalSDI (mNTV2Card.GetDeviceID())) // If device has bidirectional SDIs...
501  for (unsigned offset (0); offset < 4; offset++)
502  {
503  mNTV2Card.EnableChannel (NTV2Channel(mChannel+offset));
504  bool outputEnabled;
505  mNTV2Card.GetSDITransmitEnable (NTV2Channel(mChannel+offset), outputEnabled);
506  if (outputEnabled)
507  {
508  waitForInput = true;
509  mNTV2Card.SetSDITransmitEnable (NTV2Channel(mChannel+offset), false);
510  }
511  }
512 
513  // Only if we had to change an output to input do we need to wait.
514  if (waitForInput)
515  mNTV2Card.WaitForInputVerticalInterrupt (mChannel, 10); // Give the device ~10 fields/frames to lock to a signal
516 
517  mCurrentVideoFormat = GetVideoFormatFromInputSource ();
518  mCurrentColorSpace = GetColorSpaceFromInputSource ();
520 
521  if (NTV2_IS_VALID_VIDEO_FORMAT (mCurrentVideoFormat))
522  {
523  validInput = true;
524  switch (mCurrentVideoFormat)
525  {
527  mCurrentVideoFormat = NTV2_FORMAT_1080p_5000_A;
528  break;
530  mCurrentVideoFormat = NTV2_FORMAT_1080p_5994_A;
531  break;
533  mCurrentVideoFormat = NTV2_FORMAT_1080p_6000_A;
534  break;
535  default:
536  break;
537  }
538  mNTV2Card.SetVideoFormat (mCurrentVideoFormat, false, false, mChannel);
540  mNTV2Card.GetVANCMode(vm, mChannel);
541  const NTV2FormatDescriptor fd(mCurrentVideoFormat, mFrameBufferFormat, vm);
542  mFrameDimensions.Set (fd.GetRasterWidth(), fd.GetRasterHeight());
543  const QString vfString (::NTV2VideoFormatToString (mCurrentVideoFormat).c_str ());
544  qDebug() << "## DEBUG: mInputSource=" << mChannel << ", mCurrentVideoFormat=" << vfString << ", width=" << mFrameDimensions.Width() << ", height=" << mFrameDimensions.Height();
545 
546  mFormatIsProgressive = IsProgressivePicture (mCurrentVideoFormat);
547  if (!mbFixedReference)
549 
550  if (NTV2_INPUT_SOURCE_IS_SDI (mInputSource))
551  {
552  mNumChannels = 0;
553  mTsi = false;
554 
555  for (unsigned offset (0); offset < 1; offset++)
556  {
557  mNumChannels++;
558  if (::NTV2DeviceGetNumCSCs (mDeviceID) > (UWord)mChannel)
559  {
560  mNTV2Card.Connect (::GetCSCInputXptFromChannel (NTV2Channel (mChannel + offset)), ::GetSDIInputOutputXptFromChannel (NTV2Channel (mChannel + offset)));
561  mNTV2Card.Connect (::GetFrameBufferInputXptFromChannel (NTV2Channel (mChannel + offset)), ::GetCSCOutputXptFromChannel (NTV2Channel (mChannel + offset), false/*isKey*/, true/*isRGB*/));
562  mNTV2Card.SetFrameBufferFormat (NTV2Channel (mChannel + offset), mFrameBufferFormat);
563  }
564  else
565  {
566  mNTV2Card.Connect (::GetFrameBufferInputXptFromChannel (NTV2Channel (mChannel + offset)), ::GetSDIInputOutputXptFromChannel (NTV2Channel (mChannel + offset)));
567  mNTV2Card.SetFrameBufferFormat (NTV2Channel (mChannel + offset), NTV2_FBF_8BIT_YCBCR);
568  }
569  mNTV2Card.EnableChannel (NTV2Channel (mChannel + offset));
570  mNTV2Card.SetMode (NTV2Channel (mChannel + offset), NTV2_MODE_CAPTURE);
571  mNTV2Card.SetSDIInLevelBtoLevelAConversion (mChannel + offset, IsInput3Gb (mInputSource) ? true : false);
572  if (!NTV2_IS_4K_VIDEO_FORMAT (mCurrentVideoFormat))
573  break;
574 // mNTV2Card.Set4kSquaresEnable(true, NTV2_CHANNEL1);
575  }
576 
577  // configure passthrough
578  if (mInputSource == NTV2_INPUTSOURCE_SDI1)
579  {
581  mNTV2Card.SetSDITransmitEnable (NTV2_CHANNEL2, true);
584  }
585  else if (mInputSource == NTV2_INPUTSOURCE_SDI2)
586  {
588  mNTV2Card.SetSDITransmitEnable (NTV2_CHANNEL1, true);
591  }
592  }
593  else if (mInputSource == NTV2_INPUTSOURCE_ANALOG1)
594  {
595  mNumChannels = 0;
596  mTsi = false;
597  //mNTV2Card.SetTsiFrameEnable(false, NTV2_CHANNEL1);
598 
600  mNTV2Card.Connect (::GetFrameBufferInputXptFromChannel (NTV2_CHANNEL1), ::GetCSCOutputXptFromChannel (NTV2_CHANNEL1, false/*isKey*/, true/*isRGB*/));
601  mNTV2Card.SetFrameBufferFormat (NTV2_CHANNEL1, mFrameBufferFormat);
602  if (!mbFixedReference)
604  mChannel = NTV2_CHANNEL1;
605  mNumChannels = 1;
606  }
607  else if (NTV2_INPUT_SOURCE_IS_HDMI (mInputSource))
608  {
609  mNumChannels = 0;
610  mTsi = false;
611 
612  if (!mbFixedReference)
613  mNTV2Card.SetReference (::NTV2InputSourceToReferenceSource(mInputSource));
614 
615 #if 0
616  // configure hdmi with 2.0 support
617  if (NTV2_IS_4K_VIDEO_FORMAT (mCurrentVideoFormat) && !mNTV2Card.DeviceCanDoHDMIQuadRasterConversion ())
618  {
619  // Set two sample interleave
620  mChannel = NTV2_CHANNEL1;
621  mNTV2Card.SetTsiFrameEnable(true, NTV2_CHANNEL1);
622 
623  for (NTV2Channel channel (NTV2_CHANNEL1); channel < NTV2_CHANNEL3; channel = NTV2Channel(channel+1))
624  {
625  mNTV2Card.EnableChannel (channel);
626  mNTV2Card.SetMode (channel, NTV2_MODE_CAPTURE);
627  mNTV2Card.SetFrameBufferFormat (channel, mFrameBufferFormat);
628  }
629 
630  if (mCurrentColorSpace == NTV2_LHIHDMIColorSpaceYCbCr)
631  {
632  mNTV2Card.Connect (NTV2_XptCSC1VidInput,
633  ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, false/*isHDMI_RGB*/, NTV2_CHANNEL1/*hdmiQuadrant*/));
634  mNTV2Card.Connect (NTV2_XptCSC2VidInput,
635  ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, false/*isHDMI_RGB*/, NTV2_CHANNEL2/*hdmiQuadrant*/));
636  mNTV2Card.Connect (NTV2_XptCSC3VidInput,
637  ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, false/*isHDMI_RGB*/, NTV2_CHANNEL3/*hdmiQuadrant*/));
638  mNTV2Card.Connect (NTV2_XptCSC4VidInput,
639  ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, false/*isHDMI_RGB*/, NTV2_CHANNEL4/*hdmiQuadrant*/));
640 
645  }
646  else
647  {
648  mNTV2Card.Connect (NTV2_Xpt425Mux1AInput, ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, true/*isHDMI_RGB*/, NTV2_CHANNEL1/*hdmiQuadrant*/));
649  mNTV2Card.Connect (NTV2_Xpt425Mux1BInput, ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, true/*isHDMI_RGB*/, NTV2_CHANNEL2/*hdmiQuadrant*/));
650  mNTV2Card.Connect (NTV2_Xpt425Mux2AInput, ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, true/*isHDMI_RGB*/, NTV2_CHANNEL3/*hdmiQuadrant*/));
651  mNTV2Card.Connect (NTV2_Xpt425Mux2BInput, ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, true/*isHDMI_RGB*/, NTV2_CHANNEL4/*hdmiQuadrant*/));
652  }
653 
658 
659  mNumChannels = 2;
660  mTsi = true;
661  }
662  else if (NTV2_IS_4K_VIDEO_FORMAT (mCurrentVideoFormat) && mNTV2Card.DeviceCanDoHDMIQuadRasterConversion ())
663  {
664  mNumChannels = 0;
665  mNTV2Card.SetTsiFrameEnable(false, NTV2_CHANNEL1);
666  for (NTV2Channel channel (NTV2_CHANNEL1); channel < NTV2_CHANNEL5; channel = NTV2Channel(channel+1))
667  {
668  mNumChannels++;
669  mNTV2Card.EnableChannel (channel);
670  mNTV2Card.SetMode (channel, NTV2_MODE_CAPTURE);
671  mNTV2Card.SetFrameBufferFormat (channel, mFrameBufferFormat);
672  if (mCurrentColorSpace == NTV2_LHIHDMIColorSpaceYCbCr)
673  {
674  mNTV2Card.Connect (::GetCSCInputXptFromChannel (channel),
675  ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, false/*isHDMI_RGB*/, channel/*hdmiQuadrant*/));
676  mNTV2Card.Connect (::GetFrameBufferInputXptFromChannel (channel),
677  ::GetCSCOutputXptFromChannel (channel, false/*isKey*/, true/*isRGB*/));
678  }
679  else
680  {
681  mNTV2Card.Connect (::GetFrameBufferInputXptFromChannel (channel),
682  ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, true/*isHDMI_RGB*/, channel/*hdmiQuadrant*/));
683  }
684  } // loop once for each channel (4 times for 4K/UHD)
685  }
686  else
687 #endif
688  {
689  mNumChannels = 1;
690  mNTV2Card.EnableChannel (mChannel);
691  mNTV2Card.SetMode (mChannel, NTV2_MODE_CAPTURE);
692  mNTV2Card.SetFrameBufferFormat (mChannel, mFrameBufferFormat);
693  if (mCurrentColorSpace == NTV2_LHIHDMIColorSpaceYCbCr)
694  {
695  mNTV2Card.Connect (::GetCSCInputXptFromChannel (mChannel),
696  ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, false/*isHDMI_RGB*/, 0/*hdmiQuadrant*/));
697  mNTV2Card.Connect (::GetFrameBufferInputXptFromChannel (mChannel),
698  ::GetCSCOutputXptFromChannel (mChannel, false/*isKey*/, true/*isRGB*/));
699  }
700  else
701  {
702  mNTV2Card.Connect (::GetFrameBufferInputXptFromChannel (mChannel),
703  ::GetInputSourceOutputXpt (mInputSource, false/*isSDI_DS2*/, true/*isHDMI_RGB*/, 0/*hdmiQuadrant*/));
704  }
705  }
706 
707  // configure the qrc if present
708  if (NTV2DeviceGetHDMIVersion(mDeviceID) == 2)
710 
711  // configure passthrough
712  if (mInputSource == NTV2_INPUTSOURCE_HDMI1)
713  {
715  mNTV2Card.SetSDITransmitEnable (NTV2_CHANNEL1, true);
716  mNTV2Card.SetSDITransmitEnable (NTV2_CHANNEL2, true);
720  }
721  }
722  else
723  qDebug () << "## DEBUG: NTV2StreamGrabber::SetupInput: Bad mInputSource switch value " << ::NTV2InputSourceToChannelSpec (mInputSource);
724  } // if video format not unknown
725 
726  return validInput;
727 
728 } // SetupInput
729 
730 
732 {
733  if (mNTV2Card.IsOpen ())
734  {
735  mNTV2Card.AutoCirculateStop (mChannel);
736 
737  bool tsiEnable(false);
738  mNTV2Card.GetTsiFrameEnable (tsiEnable, NTV2_CHANNEL1);
739 // for (ULWord i(0); i < (tsiEnable ? 2 : mNumChannels); i++)
740 // mNTV2Card.SetMode (NTV2Channel(mChannel + i), NTV2_MODE_DISPLAY);
741  }
742  ClearCaptionBuffer (true);
743 
744 } // StopAutoCirculate
745 
746 
748 {
751 
752  switch (videoFormat)
753  {
755  videoFormat = NTV2_FORMAT_1080p_5000_A;
756  break;
758  videoFormat = NTV2_FORMAT_1080p_5994_A;
759  break;
761  videoFormat = NTV2_FORMAT_1080p_6000_A;
762  break;
763  default:
764  break;
765  }
766  if (videoFormat == NTV2_FORMAT_UNKNOWN)
767  {
768  mCurrentVideoFormat = videoFormat;
769  return false;
770  } // if no video or unknown format
771  else if ((mCurrentVideoFormat != videoFormat) ||
772  (mCurrentColorSpace != colorSpace))
773  {
774  if (mDebounceCounter == 0)
775  {
776  // Check to see if the video input has stabilized...
777  mLastVideoFormat = videoFormat;
778  mDebounceCounter++;
779  }
780  else if (mDebounceCounter == 6)
781  {
782  // The new format is stable -- restart autocirculate...
783  mRestart = true;
784  mCurrentVideoFormat = videoFormat;
785  mDebounceCounter = 0;
786  }
787  else
788  {
789  if (mLastVideoFormat == videoFormat)
790  mDebounceCounter++; // New format still stable -- keep counting
791  else
792  mDebounceCounter = 0; // Input changed again -- start over
793  }
794 
795  return true;
796  } // else if video format changed
797  else
798  return true;
799 
800 } // CheckForValidInput
801 
802 
804 {
805  NTV2VideoFormat videoFormat (NTV2_FORMAT_UNKNOWN);
806  NTV2_ASSERT (mNTV2Card.IsOpen ());
807  NTV2_ASSERT (mDeviceID != DEVICE_ID_NOTFOUND);
808 
809  switch (mInputSource)
810  {
811 #if 0
814  {
815  const ULWord ndx (::GetIndexForNTV2InputSource (mInputSource));
816  videoFormat = mNTV2Card.GetInputVideoFormat (::GetNTV2InputSourceForIndex (ndx + 0));
817  NTV2Standard videoStandard (::GetNTV2StandardFromVideoFormat (videoFormat));
818  if (mCheckFor4K && (videoStandard == NTV2_STANDARD_1080p))
819  {
820  NTV2VideoFormat videoFormatNext (mNTV2Card.GetInputVideoFormat (::GetNTV2InputSourceForIndex (ndx + 1)));
821  if (videoFormatNext == videoFormat)
822  {
823  videoFormatNext = mNTV2Card.GetInputVideoFormat (::GetNTV2InputSourceForIndex (ndx + 2));
824  if (videoFormatNext == videoFormat)
825  {
826  videoFormatNext = mNTV2Card.GetInputVideoFormat (::GetNTV2InputSourceForIndex (ndx + 3));
827  if (videoFormatNext == videoFormat)
828  CNTV2DemoCommon::Get4KInputFormat (videoFormat);
829  }
830  }
831  }
832  break;
833  }
834 #endif
836  break; // indicates no source is currently selected
837 
838  default:
839  videoFormat = mNTV2Card.GetInputVideoFormat (mInputSource);
840  break;
841  }
842 
843  return videoFormat;
844 
845 } // GetVideoFormatFromInputSource
846 
847 
849 {
850  if (NTV2_INPUT_SOURCE_IS_HDMI (mInputSource))
851  {
853  mNTV2Card.GetHDMIInputColor (hdmiColor, mChannel);
854  return hdmiColor;
855  }
856 
858 }
859 
860 
862 {
863  bool is3Gb (false);
864 
865  mNTV2Card.GetSDIInput3GbPresent (is3Gb, ::NTV2InputSourceToChannel (inputSource));
866 
867  return is3Gb;
868 } // IsInput3Gb
869 
870 
872 {
873  NTV2_ASSERT (mNTV2Card.IsOpen ());
874  NTV2_ASSERT (mDeviceID != DEVICE_ID_NOTFOUND);
875 
876  mTransferStruct.acAudioBuffer.Allocate (NTV2_AUDIOSIZE_MAX); // Reserve space for largest audio packet/frame
877  if (mAudioOutput)
878  {
879  delete mAudioOutput;
880  mAudioOutput = AJA_NULL;
881  }
882 
883  NTV2AudioSource audioSource (NTV2_AUDIO_EMBEDDED);
884  if (NTV2_INPUT_SOURCE_IS_HDMI (mInputSource))
885  audioSource = NTV2_AUDIO_HDMI;
886  else if (NTV2_INPUT_SOURCE_IS_ANALOG (mInputSource))
887  audioSource = NTV2_AUDIO_ANALOG;
888 
889  // Set up AJA device audio...
890  mNumAudioChannels = ::NTV2DeviceGetMaxAudioChannels (mDeviceID);
891  mAudioSystem = ::NTV2ChannelToAudioSystem (mChannel);
892  mNTV2Card.SetAudioSystemInputSource (mAudioSystem, audioSource, ::NTV2InputSourceToEmbeddedAudioInput (mInputSource));
893  mNTV2Card.SetNumberAudioChannels (mNumAudioChannels, mAudioSystem);
894  mNTV2Card.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
895  mNTV2Card.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
896 
897  // Set up Qt's audio output...
898  mFormat.setSampleRate (48000);
899  mFormat.setChannelCount (2);
900  mFormat.setSampleSize (16);
901  mFormat.setCodec ("audio/pcm");
902  mFormat.setByteOrder (QAudioFormat::LittleEndian);
903  mFormat.setSampleType (QAudioFormat::SignedInt);
904 
905  QAudioDeviceInfo audioDeviceInfo (QAudioDeviceInfo::defaultOutputDevice ());
906  if (audioDeviceInfo.isFormatSupported (mFormat))
907  mAudioOutput = new QAudioOutput (mFormat, AJA_NULL);
908 
909 } // SetupAudio
910 
911 
912 void NTV2StreamGrabber::OutputAudio (ULWord * pInOutBuffer, const ULWord inNumValidBytes)
913 {
914  const ULWord nBytesPerAJASample (4); // AJA devices provide four bytes per channel per sample
915  unsigned channel (0); // Current channel being processed
916  UWord qtSampleNdx (0); // Which Qt audio sample is being processed
917  const ULWord totalSamples (inNumValidBytes / mNumAudioChannels); // Total number of audio samples to process, regardless of channel count
918  const ULWord totalAjaSamples (inNumValidBytes / nBytesPerAJASample); // Total number of AJA-device-provided audio samples, one sample per channel
919  UWord * pQtAudioBuffer (reinterpret_cast <UWord *> (pInOutBuffer)); // Qt-centric pointer to the audio buffer (2-bytes per channel per sample)
920 
921  //
922  // Walk through the audio buffer channel by channel:
923  // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 ...etc...
924  // and copy samples from channels 0 and 1 up to the front of the buffer...
925  // 0 1 0 1 0 1 0 1 0 1 0 1 ...etc..
926  //
927 
928  for (unsigned ajaSampleNdx = 0; ajaSampleNdx < totalAjaSamples; ajaSampleNdx++)
929  {
930  if (channel < 2)
931  {
932  pQtAudioBuffer [qtSampleNdx] = pInOutBuffer [ajaSampleNdx] >> 16; // Also discard the least significant 16 bits of each sample
933  qtSampleNdx++;
934  } // if channel 0 or 1
935 
936  channel++;
937  if (channel == mNumAudioChannels)
938  channel = 0;
939  } // for each channel for each sample
940 
941  if (mAudioDevice)
942  mAudioDevice->write (reinterpret_cast <const char *> (pQtAudioBuffer), totalSamples);
943 
944 } // OutputAudio
945 
946 
947 #if defined (INCLUDE_AJACC)
948  void NTV2StreamGrabber::Caption608Changed (void * pInstance, const NTV2Caption608ChangeInfo & inChangeInfo)
949  {
950  NTV2StreamGrabber * pFG (reinterpret_cast <NTV2StreamGrabber *> (pInstance));
951  if (pFG)
952  pFG->caption608Changed (inChangeInfo);
953  }
954 
955  void NTV2StreamGrabber::caption608Changed (const NTV2Caption608ChangeInfo & inChangeInfo)
956  {
957  NTV2Line21Attributes attrs;
958  bool changed (false);
959  for (UWord row (NTV2_CC608_MinRow); row <= NTV2_CC608_MaxRow; row++)
960  for (UWord col (NTV2_CC608_MinCol); col <= NTV2_CC608_MaxCol; col++)
961  {
962  ushort utf16Char (m608Decoder ? m608Decoder->GetOnAirUTF16CharacterWithAttributes (row, col, attrs) : 0x0020);
963  if (!utf16Char)
964  utf16Char = 0x0020;
965  if (utf16Char != mScreenBuffer [row-1][col-1])
966  {
967  mScreenBuffer [row-1][col-1] = utf16Char;
968  changed = true;
969  }
970  }
971  if (changed)
972  emit captionScreenChanged (&mScreenBuffer[0][0]);
973  }
974 #endif // defined (INCLUDE_AJACC)
NTV2StreamGrabber::newStatusString
void newStatusString(const QString &inStatus)
This is signaled (called) when my status string changes.
CNTV2Card::SetSDIInLevelBtoLevelAConversion
virtual bool SetSDIInLevelBtoLevelAConversion(const NTV2ChannelSet &inSDIInputs, const bool inEnable)
Enables or disables 3G level B to 3G level A conversion at the SDI input(s).
Definition: ntv2register.cpp:4185
NTV2InputSourceToReferenceSource
NTV2ReferenceSource NTV2InputSourceToReferenceSource(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2ReferenceSource value.
Definition: ntv2utils.cpp:5081
ntv2streamgrabber.h
Header file for the NTV2StreamGrabber class.
CNTV2Card::SetMultiFormatMode
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
Definition: ntv2register.cpp:4281
NTV2_Xpt425Mux1AInput
@ NTV2_Xpt425Mux1AInput
Definition: ntv2enums.h:2797
NTV2InputSourceToChannel
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5105
CNTV2Card::DMAStreamStop
virtual bool DMAStreamStop(const NTV2Channel inChannel, const bool inToHost)
Definition: ntv2dma.cpp:149
NTV2_FBF_ARGB
@ NTV2_FBF_ARGB
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:212
GetSDIInputOutputXptFromChannel
NTV2OutputXptID GetSDIInputOutputXptFromChannel(const NTV2Channel inSDIInput, const bool inIsDS2=false)
Definition: ntv2signalrouter.cpp:893
NTV2StreamGrabber::SetupAudio
void SetupAudio(void)
Performs audio configuration.
Definition: ntv2streamgrabber.cpp:871
NTV2_REFERENCE_INPUT1
@ NTV2_REFERENCE_INPUT1
Specifies the SDI In 1 connector.
Definition: ntv2enums.h:1402
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or Frame Store 2 (or the 2nd item).
Definition: ntv2enums.h:1308
CNTV2CaptionDecoder708::Create
static bool Create(CNTV2CaptionDecoder708Ptr &outDecoder)
Creates a new CNTV2CaptionEncoder708 instance.
ancillarydata_cea608_line21.h
Declares the AJAAncillaryData_Cea608_line21 class.
NTV2_CC608_MinCol
const UWord NTV2_CC608_MinCol(1)
The minimum column index number (located at the left edge of the screen).
CaptionData::f2_char1
UByte f2_char1
Caption Byte 1 of Field 2.
Definition: ntv2caption608types.h:662
ntv2devicefeatures.h
Declares device capability functions.
NTV2LHIHDMIColorSpace
NTV2LHIHDMIColorSpace
Definition: ntv2enums.h:3592
NTV2_AUDIO_BUFFER_BIG
@ NTV2_AUDIO_BUFFER_BIG
Definition: ntv2enums.h:1864
AJAAncillaryData_Cea608::GetCEA608Bytes
virtual AJAStatus GetCEA608Bytes(uint8_t &outByte1, uint8_t &outByte2, bool &outIsValid) const
Answers with the CEA608 payload bytes.
Definition: ancillarydata_cea608.cpp:89
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
NTV2InputSourceToTimecodeIndex
NTV2TimecodeIndex NTV2InputSourceToTimecodeIndex(const NTV2InputSource inInputSource, const bool inEmbeddedLTC=false)
Converts a given NTV2InputSource to its equivalent NTV2TimecodeIndex value.
Definition: ntv2utils.cpp:5153
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific Frame Store. They're also commonly used to i...
Definition: ntv2enums.h:1305
CNTV2Card::DeviceCanDoHDMIQuadRasterConversion
virtual bool DeviceCanDoHDMIQuadRasterConversion(void)
Definition: ntv2card.cpp:476
NTV2Buffer::GetByteCount
ULWord GetByteCount(void) const
Definition: ntv2publicinterface.h:6040
NTV2_ASSERT
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:601
NTV2_XptCSC4VidInput
@ NTV2_XptCSC4VidInput
Definition: ntv2enums.h:2710
AJAAncillaryData_Cea608_Line21
This class handles "analog" (Line 21) based CEA-608 caption data packets.
Definition: ancillarydata_cea608_line21.h:27
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
NTV2_AUDIO_48K
@ NTV2_AUDIO_48K
Definition: ntv2enums.h:1875
ancillarylist.h
Declares the AJAAncillaryList class.
NTV2_Xpt425Mux2AYUV
@ NTV2_Xpt425Mux2AYUV
Definition: ntv2enums.h:2593
NTV2_AUDIOSYSTEM_1
@ NTV2_AUDIOSYSTEM_1
This identifies the first Audio System.
Definition: ntv2enums.h:3811
NTV2InputSourceToEmbeddedAudioInput
NTV2EmbeddedAudioInput NTV2InputSourceToEmbeddedAudioInput(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2EmbeddedAudioInput value.
Definition: ntv2utils.cpp:4935
AUTOCIRCULATE_TRANSFER::acAudioBuffer
NTV2Buffer acAudioBuffer
The host audio buffer. This field is owned by the client application, and thus is responsible for all...
Definition: ntv2publicinterface.h:7919
AJAAncillaryList::CountAncillaryDataWithType
virtual uint32_t CountAncillaryDataWithType(const AJAAncDataType inMatchType) const
Answers with the number of AJAAncillaryData objects having the given type.
Definition: ancillarylist.cpp:218
GetFrameBufferInputXptFromChannel
NTV2InputXptID GetFrameBufferInputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsBInput=false)
Definition: ntv2signalrouter.cpp:762
AJAAncillaryList::ParseAllAncillaryData
virtual AJAStatus ParseAllAncillaryData(void)
Sends a "ParsePayloadData" command to all of my AJAAncillaryData objects.
Definition: ancillarylist.cpp:201
NTV2_Xpt425Mux2BYUV
@ NTV2_Xpt425Mux2BYUV
Definition: ntv2enums.h:2595
NTV2FormatDescriptor::GetRasterHeight
ULWord GetRasterHeight(const bool inVisibleOnly=false) const
Definition: ntv2formatdescriptor.h:170
NTV2StreamGrabber::SetupInput
bool SetupInput(void)
Configures my AJA device for capture.
Definition: ntv2streamgrabber.cpp:487
NTV2_REFERENCE_ANALOG_INPUT1
@ NTV2_REFERENCE_ANALOG_INPUT1
Specifies the Analog In 1 connector.
Definition: ntv2enums.h:1405
NTV2Buffer::Allocate
bool Allocate(const size_t inByteCount, const bool inPageAligned=false)
Allocates (or re-allocates) my user-space storage using the given byte count. I assume full responsib...
Definition: ntv2publicinterface.cpp:1554
NTV2DeviceGetNumCSCs
UWord NTV2DeviceGetNumCSCs(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:10042
NTV2_LHIHDMIColorSpaceRGB
@ NTV2_LHIHDMIColorSpaceRGB
Definition: ntv2enums.h:3595
CNTV2Card::GetVANCMode
virtual bool GetVANCMode(NTV2VANCMode &outVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Retrieves the current VANC mode for the given FrameStore.
Definition: ntv2register.cpp:2744
PULWord
uint32_t * PULWord
Definition: ajatypes.h:247
NTV2_CHANNEL1
@ NTV2_CHANNEL1
Specifies channel or Frame Store 1 (or the first item).
Definition: ntv2enums.h:1307
CNTV2Card::SetSDITransmitEnable
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
Definition: ntv2register.cpp:3805
CaptionData::f1_char2
UByte f1_char2
Caption Byte 2 of Field 1.
Definition: ntv2caption608types.h:659
NTV2_XptCSC1VidInput
@ NTV2_XptCSC1VidInput
Definition: ntv2enums.h:2704
CNTV2Card::GetSDITransmitEnable
virtual bool GetSDITransmitEnable(const NTV2Channel inChannel, bool &outEnabled)
Answers whether or not the specified SDI connector is currently acting as a transmitter (i....
Definition: ntv2register.cpp:3826
AJAAncillaryList::GetAncillaryDataWithType
virtual AJAAncillaryData * GetAncillaryDataWithType(const AJAAncDataType inMatchType, const uint32_t inIndex=0) const
Answers with the AJAAncillaryData object having the given type and index.
Definition: ancillarylist.cpp:234
NTV2StreamGrabber::run
virtual void run(void)
My thread function.
Definition: ntv2streamgrabber.cpp:277
NTV2_HDMI_V2_HDSD_BIDIRECTIONAL
@ NTV2_HDMI_V2_HDSD_BIDIRECTIONAL
Definition: ntv2enums.h:3916
CNTV2Card::SetVideoFormat
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=true, const bool inKeepVancSettings=false, const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
Definition: ntv2register.cpp:204
CNTV2DemoCommon::Get4KInputFormat
static bool Get4KInputFormat(NTV2VideoFormat &inOutVideoFormat)
Given a video format, if all 4 inputs are the same and promotable to 4K, this function does the promo...
Definition: ntv2democommon.cpp:1099
AJAAncillaryList
I am an ordered collection of AJAAncillaryData instances which represent one or more SMPTE 291 data p...
Definition: ancillarylist.h:64
NTV2_Xpt425Mux2BInput
@ NTV2_Xpt425Mux2BInput
Definition: ntv2enums.h:2800
NTV2_CHANNEL_INVALID
@ NTV2_CHANNEL_INVALID
Definition: ntv2enums.h:1316
NTV2FrameDimensions::Set
NTV2FrameDimensions & Set(const ULWord inWidth, const ULWord inHeight)
Sets my dimension values.
Definition: ntv2publicinterface.h:5668
CNTV2Card::SetAudioSystemInputSource
virtual bool SetAudioSystemInputSource(const NTV2AudioSystem inAudioSystem, const NTV2AudioSource inAudioSource, const NTV2EmbeddedAudioInput inEmbeddedInput)
Sets the audio source for the given NTV2AudioSystem on the device.
Definition: ntv2audio.cpp:488
NTV2_IS_4K_VIDEO_FORMAT
#define NTV2_IS_4K_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:746
IsProgressivePicture
bool IsProgressivePicture(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5423
NTV2_CHANNEL4
@ NTV2_CHANNEL4
Specifies channel or Frame Store 4 (or the 4th item).
Definition: ntv2enums.h:1310
NTV2_CHANNEL5
@ NTV2_CHANNEL5
Specifies channel or Frame Store 5 (or the 5th item).
Definition: ntv2enums.h:1311
GetIndexForNTV2InputSource
ULWord GetIndexForNTV2InputSource(const NTV2InputSource inValue)
Definition: ntv2utils.cpp:5306
NTV2DeviceGetHDMIVersion
ULWord NTV2DeviceGetHDMIVersion(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:8618
NTV2_INPUTSOURCE_ANALOG1
@ NTV2_INPUTSOURCE_ANALOG1
Identifies the first analog video input.
Definition: ntv2enums.h:1223
AUTOCIRCULATE_WITH_ANC
#define AUTOCIRCULATE_WITH_ANC
Use this to AutoCirculate with ancillary data.
Definition: ntv2publicinterface.h:5496
NTV2Caption608ChangeInfo
This class is used to respond to dynamic events that occur during CEA-608 caption decoding.
Definition: ntv2caption608types.h:779
NTV2_INPUTSOURCE_SDI1
@ NTV2_INPUTSOURCE_SDI1
Identifies the 1st SDI video input.
Definition: ntv2enums.h:1228
CNTV2Card::DMABufferUnlockAll
virtual bool DMABufferUnlockAll()
Unlocks all previously-locked buffers used for DMA transfers.
Definition: ntv2dma.cpp:515
CNTV2Card::GetDisplayName
virtual std::string GetDisplayName(void)
Answers with this device's display name.
Definition: ntv2card.cpp:84
NTV2InputSourceToChannelSpec
NTV2Crosspoint NTV2InputSourceToChannelSpec(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Crosspoint value.
Definition: ntv2utils.cpp:5057
NTV2StreamGrabber::GetColorSpaceFromInputSource
NTV2LHIHDMIColorSpace GetColorSpaceFromInputSource(void)
Definition: ntv2streamgrabber.cpp:848
NTV2_XptCSC3VidRGB
@ NTV2_XptCSC3VidRGB
Definition: ntv2enums.h:2535
NTV2InputSourceToString
std::string NTV2InputSourceToString(const NTV2InputSource inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:7215
CNTV2Card::SetRP188SourceFilter
virtual bool SetRP188SourceFilter(const NTV2Channel inSDIInput, const UWord inFilterValue)
Sets the RP188 DBB filter for the given SDI input.
Definition: ntv2register.cpp:2549
NTV2_FORMAT_1080p_5994_B
@ NTV2_FORMAT_1080p_5994_B
Definition: ntv2enums.h:529
NTV2_XptFrameBuffer1Input
@ NTV2_XptFrameBuffer1Input
Definition: ntv2enums.h:2688
NTV2Standard
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:153
NTV2_XptCSC4VidRGB
@ NTV2_XptCSC4VidRGB
Definition: ntv2enums.h:2538
NTV2_MAX_NUM_CHANNELS
@ NTV2_MAX_NUM_CHANNELS
Definition: ntv2enums.h:1315
NTV2Buffer::IsNULL
bool IsNULL(void) const
Definition: ntv2publicinterface.h:6062
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
ntv2devicescanner.h
Declares the CNTV2DeviceScanner class.
AJAAncillaryList::AddReceivedAncillaryData
virtual AJAStatus AddReceivedAncillaryData(const uint8_t *pInReceivedData, const uint32_t inByteCount, const uint32_t inFrameNum=0)
Parse "raw" ancillary data bytes received from hardware (ingest) – see SDI Anc Buffer Data Format – i...
Definition: ancillarylist.cpp:538
AJAAncillaryData
I am the principal class that stores a single SMPTE-291 SDI ancillary data packet OR the digitized co...
Definition: ancillarydata.h:550
NTV2StreamGrabber::StopAutoCirculate
void StopAutoCirculate(void)
Stops capturing.
Definition: ntv2streamgrabber.cpp:731
NTV2_XptSDIOut2Input
@ NTV2_XptSDIOut2Input
Definition: ntv2enums.h:2734
gMutex
static QMutex gMutex
Definition: ntv2streamgrabber.cpp:28
AJAAncillaryData::GetPayloadData
virtual const uint8_t * GetPayloadData(void) const
Definition: ancillarydata.h:788
NTV2DeviceHasBiDirectionalSDI
bool NTV2DeviceHasBiDirectionalSDI(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:6454
CNTV2Card::SetReference
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=false)
Sets the device's clock reference source. See Device Clocking and Synchronization for more informatio...
Definition: ntv2register.cpp:1486
AJAAncillaryData_Cea608_Line21::ParsePayloadData
virtual AJAStatus ParsePayloadData(void)
Parses out (interprets) the "local" ancillary data from my payload data.
Definition: ancillarydata_cea608_line21.cpp:83
NTV2TCIndex
NTV2TCIndex
These enum values are indexes into the capture/playout AutoCirculate timecode arrays.
Definition: ntv2enums.h:3865
IsValidLine21Channel
#define IsValidLine21Channel(_chan_)
Definition: ntv2caption608types.h:102
GetCSCOutputXptFromChannel
NTV2OutputXptID GetCSCOutputXptFromChannel(const NTV2Channel inCSC, const bool inIsKey=false, const bool inIsRGB=false)
Definition: ntv2signalrouter.cpp:819
AJAProcess::GetPid
static uint64_t GetPid()
Definition: process.cpp:35
NTV2_INPUTSOURCE_SDI5
@ NTV2_INPUTSOURCE_SDI5
Identifies the 5th SDI video input.
Definition: ntv2enums.h:1232
FGNOTE
#define FGNOTE(_expr_)
Definition: ntv2streamgrabber.cpp:25
CNTV2Card::Connect
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=false)
Connects the given widget signal input (sink) to the given widget signal output (source).
Definition: ntv2regroute.cpp:87
CNTV2Card::SetLTCInputEnable
virtual bool SetLTCInputEnable(const bool inEnable)
Enables or disables the ability for the device to read analog LTC on the reference input connector.
Definition: ntv2register.cpp:3660
NTV2_CHANNEL3
@ NTV2_CHANNEL3
Specifies channel or Frame Store 3 (or the 3rd item).
Definition: ntv2enums.h:1309
NTV2_STANDARD_1080p
@ NTV2_STANDARD_1080p
Identifies SMPTE HD 1080p.
Definition: ntv2enums.h:159
UWord
uint16_t UWord
Definition: ajatypes.h:244
NTV2_IS_VALID_INPUT_SOURCE
#define NTV2_IS_VALID_INPUT_SOURCE(_inpSrc_)
Definition: ntv2enums.h:1243
NTV2_FBF_8BIT_YCBCR
@ NTV2_FBF_8BIT_YCBCR
See 8-Bit YCbCr Format.
Definition: ntv2enums.h:211
NTV2_REFERENCE_FREERUN
@ NTV2_REFERENCE_FREERUN
Specifies the device's internal clock.
Definition: ntv2enums.h:1404
GetNTV2InputSourceForIndex
NTV2InputSource GetNTV2InputSourceForIndex(const ULWord inIndex0, const NTV2IOKinds inKinds=NTV2_IOKINDS_SDI)
Definition: ntv2utils.cpp:5268
NTV2_XptCSC3VidInput
@ NTV2_XptCSC3VidInput
Definition: ntv2enums.h:2708
ntv2utils.h
Declares numerous NTV2 utility functions.
NTV2_FORMAT_1080p_5000_B
@ NTV2_FORMAT_1080p_5000_B
Definition: ntv2enums.h:528
NTV2StreamGrabber::newFrame
void newFrame(const QImage &inImage, const bool inClear)
This is signaled (called) when a new frame has been captured and is available for display.
NTV2VideoFormatToString
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Definition: ntv2utils.cpp:6750
NTV2_INPUT_SOURCE_IS_HDMI
#define NTV2_INPUT_SOURCE_IS_HDMI(_inpSrc_)
Definition: ntv2enums.h:1240
AJAAncillaryDataType_Cea608_Vanc
#define AJAAncillaryDataType_Cea608_Vanc
Definition: ancillarydata.h:1568
AUTOCIRCULATE_TRANSFER::SetVideoBuffer
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2606
AJA_SUCCESS
#define AJA_SUCCESS(_status_)
Definition: types.h:357
GetCSCInputXptFromChannel
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
Definition: ntv2signalrouter.cpp:775
CNTV2Card::DMABufferLock
virtual bool DMABufferLock(const NTV2Buffer &inBuffer, bool inMap=false, bool inRDMA=false)
Page-locks the given host buffer to reduce transfer time and CPU usage of DMA transfers.
Definition: ntv2dma.cpp:487
NTV2_IS_HD_VIDEO_FORMAT
#define NTV2_IS_HD_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:700
NTV2_XptAnalogIn
@ NTV2_XptAnalogIn
Definition: ntv2enums.h:2498
CNTV2CaptionDecoder608::Create
static bool Create(CNTV2CaptionDecoder608Ptr &outEncoder)
Creates a new CNTV2CaptionEncoder608 instance.
CNTV2Card::AutoCirculateStop
virtual bool AutoCirculateStop(const NTV2Channel inChannel, const bool inAbort=false)
Stops AutoCirculate for the given channel, and releases the on-device frame buffers that were allocat...
Definition: ntv2autocirculate.cpp:519
NTV2_XptFrameBuffer1DS2Input
@ NTV2_XptFrameBuffer1DS2Input
Definition: ntv2enums.h:2689
NTV2_REFERENCE_HDMI_INPUT1
@ NTV2_REFERENCE_HDMI_INPUT1
Specifies the HDMI In 1 connector.
Definition: ntv2enums.h:1406
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1228
CaptionData::bGotField2Data
bool bGotField2Data
True if Field 2 bytes have been set; otherwise false.
Definition: ntv2caption608types.h:661
NTV2StreamGrabber::GetDeviceIndex
UWord GetDeviceIndex(void) const
Definition: ntv2streamgrabber.cpp:115
NTV2_NUM_INPUTSOURCES
@ NTV2_NUM_INPUTSOURCES
Definition: ntv2enums.h:1237
NTV2StreamGrabber::ClearCaptionBuffer
void ClearCaptionBuffer(const bool inSignalClients=false)
Definition: ntv2streamgrabber.cpp:163
kDemoAppSignature
static const ULWord kDemoAppSignature((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0))
NTV2_Xpt425Mux1AYUV
@ NTV2_Xpt425Mux1AYUV
Definition: ntv2enums.h:2589
NTV2_XptHDMIOutQ1Input
@ NTV2_XptHDMIOutQ1Input
Definition: ntv2enums.h:2789
NTV2_Xpt425Mux1BYUV
@ NTV2_Xpt425Mux1BYUV
Definition: ntv2enums.h:2591
AUTOCIRCULATE_TRANSFER::acANCField2Buffer
NTV2Buffer acANCField2Buffer
The host "Field 2" ancillary data buffer. This field is owned by the client application,...
Definition: ntv2publicinterface.h:7941
CNTV2Card::SetTsiFrameEnable
virtual bool SetTsiFrameEnable(const bool inIsEnabled, const NTV2Channel inChannel)
Enables or disables SMPTE 425 two-sample interleave (Tsi) frame mode on the device.
Definition: ntv2register.cpp:1313
NTV2_FORMAT_1080p_6000_A
@ NTV2_FORMAT_1080p_6000_A
Definition: ntv2enums.h:535
NTV2_INPUTSOURCE_HDMI1
@ NTV2_INPUTSOURCE_HDMI1
Identifies the 1st HDMI video input.
Definition: ntv2enums.h:1224
NTV2_AUDIOSIZE_MAX
#define NTV2_AUDIOSIZE_MAX
Definition: ntv2democommon.h:46
CNTV2Card::SetEveryFrameServices
virtual bool SetEveryFrameServices(const NTV2EveryFrameTaskMode inMode)
Sets the device's task mode.
Definition: ntv2register.cpp:179
NTV2VANCMode
NTV2VANCMode
These enum values identify the available VANC modes.
Definition: ntv2enums.h:3711
AJA_NULL
#define AJA_NULL
Definition: ajatypes.h:190
NTV2_VANCMODE_INVALID
@ NTV2_VANCMODE_INVALID
This identifies the invalid (unspecified, uninitialized) VANC mode.
Definition: ntv2enums.h:3716
NTV2_CC608_MaxCol
const UWord NTV2_CC608_MaxCol(32)
The maximum column index number (located at the right edge of the screen).
NTV2_XptSDIIn2
@ NTV2_XptSDIIn2
Definition: ntv2enums.h:2472
NTV2Buffer::GetHostAddress
void * GetHostAddress(const ULWord inByteOffset, const bool inFromEnd=false) const
Definition: ntv2publicinterface.cpp:1610
NTV2Buffer::GetHostPointer
void * GetHostPointer(void) const
Definition: ntv2publicinterface.h:6023
NTV2InputSource
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1221
NTV2StreamGrabber::SetInputSource
void SetInputSource(const NTV2InputSource inInputSource)
Sets the input to be used for capture on the AJA device being used.
Definition: ntv2streamgrabber.cpp:77
NTV2_FORMAT_UNKNOWN
@ NTV2_FORMAT_UNKNOWN
Definition: ntv2enums.h:498
NTV2StreamGrabber::GrabCaptions
void GrabCaptions(void)
Performs caption data extraction & decoding.
Definition: ntv2streamgrabber.cpp:177
NTV2StreamGrabber
A QThread that captures audio/video from NTV2-compatible AJA devices and uses Qt signals to emit ARGB...
Definition: ntv2streamgrabber.h:42
NTV2_AUDIO_HDMI
@ NTV2_AUDIO_HDMI
Obtain audio samples from the device HDMI input, if available.
Definition: ntv2enums.h:1951
NTV2_LHIHDMIColorSpaceYCbCr
@ NTV2_LHIHDMIColorSpaceYCbCr
Definition: ntv2enums.h:3594
AJAAncillaryDataType_Cea708
#define AJAAncillaryDataType_Cea708
Definition: ancillarydata.h:1567
NTV2_XptFrameBuffer2Input
@ NTV2_XptFrameBuffer2Input
Definition: ntv2enums.h:2690
false
#define false
Definition: ntv2devicefeatures.h:25
ntv2democommon.h
This file contains some structures, constants, classes and functions that are used in some of the dem...
AUTOCIRCULATE_WITH_RP188
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
Definition: ntv2publicinterface.h:5490
NTV2_XptHDMIIn1
@ NTV2_XptHDMIIn1
Definition: ntv2enums.h:2499
NTV2StreamGrabber::~NTV2StreamGrabber
virtual ~NTV2StreamGrabber()
My destructor.
Definition: ntv2streamgrabber.cpp:63
NTV2StreamGrabber::NTV2StreamGrabber
NTV2StreamGrabber(QObject *pInParentObject=NULL)
Constructs me.
Definition: ntv2streamgrabber.cpp:31
NTV2_MODE_CAPTURE
@ NTV2_MODE_CAPTURE
Capture (input) mode, which writes into device SDRAM.
Definition: ntv2enums.h:1202
NTV2Line21Channel
NTV2Line21Channel
The CEA-608 caption channels: CC1 thru CC4, TX1 thru TX4, plus XDS.
Definition: ntv2caption608types.h:82
NTV2_INPUTSOURCE_SDI2
@ NTV2_INPUTSOURCE_SDI2
Identifies the 2nd SDI video input.
Definition: ntv2enums.h:1229
AUTOCIRCULATE_TRANSFER::acVideoBuffer
NTV2Buffer acVideoBuffer
The host video buffer. This field is owned by the client application, and thus is responsible for all...
Definition: ntv2publicinterface.h:7912
NTV2_CC608_MinRow
const UWord NTV2_CC608_MinRow(1)
The minimum row index number (located at the top of the screen).
NTV2StreamGrabber::GetVideoFormatFromInputSource
NTV2VideoFormat GetVideoFormatFromInputSource(void)
Definition: ntv2streamgrabber.cpp:803
NTV2_AUDIO_EMBEDDED
@ NTV2_AUDIO_EMBEDDED
Obtain audio samples from the audio that's embedded in the video HANC.
Definition: ntv2enums.h:1948
NTV2_XptSDIIn1
@ NTV2_XptSDIIn1
Definition: ntv2enums.h:2471
NTV2_FORMAT_1080p_5000_A
@ NTV2_FORMAT_1080p_5000_A
Definition: ntv2enums.h:533
CNTV2MacDriverInterface::AcquireStreamForApplicationWithReference
virtual bool AcquireStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::AcquireStreamForApplication useful for process g...
Definition: ntv2macdriverinterface.cpp:863
NTV2VideoFormat
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
NTV2StreamGrabber::OutputAudio
void OutputAudio(ULWord *pInOutAudioBuffer, const ULWord inNumValidBytes)
Writes audio samples for channels 1 and 2 that are in the given audio buffer to my QAudioOutput devic...
Definition: ntv2streamgrabber.cpp:912
CNTV2Card::GetHDMIInputColor
virtual bool GetHDMIInputColor(NTV2LHIHDMIColorSpace &outValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Answers with the current colorspace for the given HDMI input.
Definition: ntv2hdmi.cpp:52
NTV2TimeCodeList
std::vector< NTV2_RP188 > NTV2TimeCodeList
An ordered sequence of zero or more NTV2_RP188 structures. An NTV2TCIndex enum value can be used as a...
Definition: ntv2publicinterface.h:6786
NTV2_XptCSC2VidRGB
@ NTV2_XptCSC2VidRGB
Definition: ntv2enums.h:2491
NTV2_FORMAT_1080p_6000_B
@ NTV2_FORMAT_1080p_6000_B
Definition: ntv2enums.h:530
STREAMPREVIEW_WIDGET_Y
#define STREAMPREVIEW_WIDGET_Y
Definition: ntv2streamgrabber.h:32
true
#define true
Definition: ntv2devicefeatures.h:26
NTV2_TCINDEX_INVALID
@ NTV2_TCINDEX_INVALID
Definition: ntv2enums.h:3895
CNTV2DriverInterface::GetDeviceID
virtual NTV2DeviceID GetDeviceID(void)
Definition: ntv2driverinterface.cpp:371
NTV2_REFERENCE_INPUT2
@ NTV2_REFERENCE_INPUT2
Specifies the SDI In 2 connector.
Definition: ntv2enums.h:1403
NTV2_FORMAT_1080p_5994_A
@ NTV2_FORMAT_1080p_5994_A
Definition: ntv2enums.h:534
CNTV2Card::GetEveryFrameServices
virtual bool GetEveryFrameServices(NTV2EveryFrameTaskMode &outMode)
Retrieves the device's current "retail service" task mode.
Definition: ntv2register.cpp:184
GetInputSourceOutputXpt
NTV2OutputXptID GetInputSourceOutputXpt(const NTV2InputSource inInputSource, const bool inIsSDI_DS2=false, const bool inIsHDMI_RGB=false, const UWord inHDMI_Quadrant=0)
Definition: ntv2signalrouter.cpp:865
CNTV2Card::SetInputFrame
virtual bool SetInputFrame(const NTV2Channel inChannel, const ULWord inValue)
Sets the input frame index number for the given FrameStore. This identifies which frame in device SDR...
Definition: ntv2register.cpp:2225
CNTV2Card::SetHDMIV2Mode
virtual bool SetHDMIV2Mode(const NTV2HDMIV2Mode inMode)
Sets HDMI V2 mode for the device.
Definition: ntv2hdmi.cpp:592
CNTV2Card::GetInputVideoFormat
virtual NTV2VideoFormat GetInputVideoFormat(const NTV2InputSource inVideoSource=NTV2_INPUTSOURCE_SDI1, const bool inIsProgressive=false)
Returns the video format of the signal that is present on the given input source.
Definition: ntv2register.cpp:3381
NTV2_XptCSC1VidRGB
@ NTV2_XptCSC1VidRGB
Definition: ntv2enums.h:2476
AJAAncillaryDataType_Cea608_Line21
#define AJAAncillaryDataType_Cea608_Line21
Definition: ancillarydata.h:1569
NTV2_INPUT_SOURCE_IS_SDI
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Definition: ntv2enums.h:1242
GetNTV2StandardFromVideoFormat
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2277
CNTV2Card::DMAStreamStart
virtual bool DMAStreamStart(ULWord *inBuffer, const ULWord inByteCount, const NTV2Channel inChannel, const bool inToHost)
Streaming transfers.
Definition: ntv2dma.cpp:136
NTV2Buffer::Fill
bool Fill(const T &inValue)
Fills me with the given scalar value.
Definition: ntv2publicinterface.h:6192
CaptionData::bGotField1Data
bool bGotField1Data
True if Field 1 bytes have been set; otherwise false.
Definition: ntv2caption608types.h:657
NTV2DeviceCanDoCustomAnc
bool NTV2DeviceCanDoCustomAnc(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:2087
NTV2Line21Attributes
CEA-608 Character Attributes.
Definition: ntv2caption608types.h:357
NTV2_AUDIO_ANALOG
@ NTV2_AUDIO_ANALOG
Obtain audio samples from the device analog input(s), if available.
Definition: ntv2enums.h:1950
CaptionData
This structure encapsulates all possible CEA-608 caption data bytes that may be associated with a giv...
Definition: ntv2caption608types.h:655
CNTV2Card::SetFrameBufferFormat
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=true, NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
Definition: ntv2register.cpp:1828
CNTV2Card::SetNumberAudioChannels
virtual bool SetNumberAudioChannels(const ULWord inNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the number of audio channels to be concurrently captured or played for a given Audio System on t...
Definition: ntv2audio.cpp:149
CNTV2Card::SetAudioBufferSize
virtual bool SetAudioBufferSize(const NTV2AudioBufferSize inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Changes the size of the audio buffer that is used for a given Audio System in the AJA device.
Definition: ntv2audio.cpp:252
NTV2StreamGrabber::IsInput3Gb
bool IsInput3Gb(const NTV2InputSource inputSource)
Definition: ntv2streamgrabber.cpp:861
CaptionData::f2_char2
UByte f2_char2
Caption Byte 2 of Field 2.
Definition: ntv2caption608types.h:663
CNTV2Card::SetMode
virtual bool SetMode(const NTV2Channel inChannel, const NTV2Mode inNewValue, const bool inIsRetail=true)
Determines if a given FrameStore on the AJA device will be used to capture or playout video.
Definition: ntv2register.cpp:1613
NTV2_HDMI_V2_4K_CAPTURE
@ NTV2_HDMI_V2_4K_CAPTURE
Definition: ntv2enums.h:3917
NTV2StreamGrabber::captionScreenChanged
void captionScreenChanged(const ushort *pInScreen)
This is signaled (called) when my caption screen buffer changes.
CNTV2MacDriverInterface::ReleaseStreamForApplicationWithReference
virtual bool ReleaseStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::ReleaseStreamForApplication useful for process g...
Definition: ntv2macdriverinterface.cpp:890
NTV2StreamGrabber::CheckForValidInput
bool CheckForValidInput(void)
Definition: ntv2streamgrabber.cpp:747
NTV2_INPUT_SOURCE_IS_ANALOG
#define NTV2_INPUT_SOURCE_IS_ANALOG(_inpSrc_)
Definition: ntv2enums.h:1241
CNTV2Card::EnableChannel
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.
Definition: ntv2register.cpp:2113
NTV2_XptFrameBuffer2DS2Input
@ NTV2_XptFrameBuffer2DS2Input
Definition: ntv2enums.h:2691
NTV2AudioSource
NTV2AudioSource
This enum value determines/states where an audio system will obtain its audio samples.
Definition: ntv2enums.h:1946
CNTV2Card::GetTsiFrameEnable
virtual bool GetTsiFrameEnable(bool &outIsEnabled, const NTV2Channel inChannel)
Returns the current SMPTE 425 two-sample-interleave frame mode on the device, whether it's enabled or...
Definition: ntv2register.cpp:1406
NTV2ChannelToAudioSystem
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
Definition: ntv2utils.cpp:4927
AUTOCIRCULATE_TRANSFER::acANCBuffer
NTV2Buffer acANCBuffer
The host ancillary data buffer. This field is owned by the client application, and thus is responsibl...
Definition: ntv2publicinterface.h:7930
NTV2_XptCSC2VidInput
@ NTV2_XptCSC2VidInput
Definition: ntv2enums.h:2706
CNTV2DriverInterface::Open
virtual bool Open(const UWord inDeviceIndex)
Opens a local/physical AJA device so it can be monitored/controlled.
Definition: ntv2driverinterface.cpp:128
DEVICE_ID_NOTFOUND
@ DEVICE_ID_NOTFOUND
Invalid or "not found".
Definition: ntv2enums.h:90
CNTV2Card::GetSDIInput3GbPresent
virtual bool GetSDIInput3GbPresent(bool &outValue, const NTV2Channel channel)
Definition: ntv2register.cpp:3623
NTV2_ANCSIZE_MAX
#define NTV2_ANCSIZE_MAX
Definition: ntv2democommon.h:47
NTV2_XptSDIOut1Input
@ NTV2_XptSDIOut1Input
Definition: ntv2enums.h:2732
NTV2_Xpt425Mux1BInput
@ NTV2_Xpt425Mux1BInput
Definition: ntv2enums.h:2798
CaptionData::f1_char1
UByte f1_char1
Caption Byte 1 of Field 1.
Definition: ntv2caption608types.h:658
NTV2DeviceGetMaxAudioChannels
UWord NTV2DeviceGetMaxAudioChannels(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:8796
NTV2StreamGrabber::SetTimeCodeSource
void SetTimeCodeSource(const NTV2TCIndex inTCSource)
Definition: ntv2streamgrabber.cpp:103
NTV2_NUM_IMAGES
#define NTV2_NUM_IMAGES
Definition: ntv2streamgrabber.cpp:19
NTV2_IS_VALID_VIDEO_FORMAT
#define NTV2_IS_VALID_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:688
CNTV2DriverInterface::Close
virtual bool Close(void)
Closes me, releasing host resources that may have been allocated in a previous Open call.
Definition: ntv2driverinterface.cpp:196
NTV2_OEM_TASKS
@ NTV2_OEM_TASKS
2: OEM: Device is configured by controlling application(s), with minimal driver involvement.
Definition: ntv2publicinterface.h:4261
NTV2_Xpt425Mux2AInput
@ NTV2_Xpt425Mux2AInput
Definition: ntv2enums.h:2799
NTV2StreamGrabber::SetDeviceIndex
void SetDeviceIndex(const UWord inDeviceIndex)
Sets the AJA device to be used for capture.
Definition: ntv2streamgrabber.cpp:91
NTV2_CC608_MaxRow
const UWord NTV2_CC608_MaxRow(15)
The maximum permissible row index number (located at the bottom of the screen).
CNTV2Card::SetAudioRate
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
Definition: ntv2audio.cpp:208
STREAMPREVIEW_WIDGET_X
#define STREAMPREVIEW_WIDGET_X
Definition: ntv2streamgrabber.h:31