AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
ntv2streamplayer.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2streamplayer.h"
9 #include "ntv2debug.h"
10 #include "ntv2devicescanner.h"
11 #include "ntv2testpatterngen.h"
13 #include "ajabase/system/process.h"
14 #include <fstream> // For ifstream
15 
16 using namespace std;
17 
18 // Convenience macros for EZ logging:
19 #define TCFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
20 #define TCWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
21 #define TCNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
22 #define TCINFO(_expr_) AJA_sINFO (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
23 #define TCDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
24 
25 static const bool BUFFER_PAGE_ALIGNED (true);
26 
27 
29  : mConfig (inConfig),
30  mConsumerThread (),
31  mProducerThread (),
32  mDevice (),
33  mDeviceID (DEVICE_ID_INVALID),
34  mSavedTaskMode (NTV2_TASK_MODE_INVALID),
35  mCurrentFrame (0),
36  mFormatDesc (),
37  mGlobalQuit (false),
38  mTCBurner (),
39  mHostBuffers (),
40  mTestPatRasters ()
41 {
42 }
43 
44 
46 {
47  // Stop my playout and producer threads, then destroy them...
48  Quit();
49 } // destructor
50 
51 
53 {
54  // Set the global 'quit' flag, and wait for the threads to go inactive...
55  mGlobalQuit = true;
56 
57  while (mProducerThread.Active())
58  AJATime::Sleep(10);
59 
60  while (mConsumerThread.Active())
61  AJATime::Sleep(10);
62 
63  if (!mConfig.fDoMultiFormat && mDevice.IsOpen())
64  {
66  if (NTV2_IS_VALID_TASK_MODE(mSavedTaskMode))
67  mDevice.SetEveryFrameServices(mSavedTaskMode); // Restore prior task mode
68  }
69 } // Quit
70 
71 
73 {
75 
76  // Open the device...
78  {cerr << "## ERROR: Device '" << mConfig.fDeviceSpec << "' not found" << endl; return AJA_STATUS_OPEN;}
79  mDeviceID = mDevice.GetDeviceID(); // Keep this ID handy -- it's used frequently
80 
81  if (!mDevice.IsDeviceReady(false))
82  {cerr << "## ERROR: Device '" << mDevice.GetDisplayName() << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
83  if (!mDevice.features().CanDoPlayback())
84  {cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' is capture-only" << endl; return AJA_STATUS_FEATURE;}
85  if (!mDevice.features().CanDoStreamingDMA())
86  {cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' does not support streaming DMA" << endl; return AJA_STATUS_FEATURE;}
87 
88  const UWord maxNumChannels (mDevice.features().GetNumFrameStores());
89 
90  // Beware -- some older devices (e.g. Corvid1) can only output from FrameStore 2...
91  if ((mConfig.fOutputChannel == NTV2_CHANNEL1) && (!mDevice.features().CanDoFrameStore1Display()))
92  mConfig.fOutputChannel = NTV2_CHANNEL2;
93  if (UWord(mConfig.fOutputChannel) >= maxNumChannels)
94  {
95  cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' can't use Ch" << DEC(mConfig.fOutputChannel+1)
96  << " -- only supports Ch1" << (maxNumChannels > 1 ? string("-Ch") + string(1, char(maxNumChannels+'0')) : "") << endl;
98  }
99 
100  if (!mConfig.fDoMultiFormat)
101  {
102  mDevice.GetEveryFrameServices(mSavedTaskMode); // Save the current task mode
104  return AJA_STATUS_BUSY; // Device is in use by another app -- fail
105  }
106  mDevice.SetEveryFrameServices(NTV2_OEM_TASKS); // Set OEM service level
107 
108  if (mDevice.features().CanDoMultiFormat())
109  mDevice.SetMultiFormatMode(mConfig.fDoMultiFormat);
110  else
111  mConfig.fDoMultiFormat = false;
112 
113  // Set up the video and audio...
114  status = SetUpVideo();
115  if (AJA_FAILURE(status))
116  return status;
117 
118  // Set up the circular buffers, and the test pattern buffers...
119  status = SetUpHostBuffers();
120  if (AJA_FAILURE(status))
121  return status;
122  status = SetUpTestPatternBuffers();
123  if (AJA_FAILURE(status))
124  return status;
125 
126  // Set up the device signal routing...
127  if (!RouteOutputSignal())
128  return AJA_STATUS_FAIL;
129 
130  // Lastly, prepare my AJATimeCodeBurn instance...
131  if (!mTCBurner.RenderTimeCodeFont (CNTV2DemoCommon::GetAJAPixelFormat(mConfig.fPixelFormat), mFormatDesc.numPixels, mFormatDesc.numLines))
132  {cerr << "## ERROR: RenderTimeCodeFont failed for: " << mFormatDesc << endl; return AJA_STATUS_UNSUPPORTED;}
133 
134  // Ready to go...
135  #if defined(_DEBUG)
136  cerr << mConfig << endl;
137  #endif // defined(_DEBUG)
138  return AJA_STATUS_SUCCESS;
139 
140 } // Init
141 
142 
144 {
145  // Configure the device to output the requested video format...
146  if (mConfig.fVideoFormat == NTV2_FORMAT_UNKNOWN)
147  return AJA_STATUS_BAD_PARAM;
148  if (!mDevice.features().CanDoVideoFormat(mConfig.fVideoFormat))
149  { cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' doesn't support "
150  << ::NTV2VideoFormatToString(mConfig.fVideoFormat) << endl;
151  return AJA_STATUS_UNSUPPORTED;
152  }
153  if (!mDevice.features().CanDoFrameBufferFormat(mConfig.fPixelFormat))
154  { cerr << "## ERROR: '" << mDevice.GetDisplayName() << "' doesn't support "
155  << ::NTV2FrameBufferFormatString(mConfig.fPixelFormat) << endl;
156  return AJA_STATUS_UNSUPPORTED;
157  }
158 
159  // This demo doesn't playout dual-link RGB over SDI -- only YCbCr.
160  // Check that this device has a CSC to convert RGB to YUV...
161  if (::IsRGBFormat(mConfig.fPixelFormat)) // If RGB FBF...
162  if (UWord(mConfig.fOutputChannel) > mDevice.features().GetNumCSCs()) // No CSC for this channel?
163  {cerr << "## ERROR: No CSC for channel " << DEC(mConfig.fOutputChannel+1) << " to convert RGB pixel format" << endl;
164  return AJA_STATUS_UNSUPPORTED;}
165 
166  if (!mDevice.features().CanDo3GLevelConversion() && mConfig.fDoABConversion && ::IsVideoFormatA(mConfig.fVideoFormat))
167  mConfig.fDoABConversion = false;
168  if (mConfig.fDoABConversion)
170 
171  // Keep the raster description handy...
172  mFormatDesc = NTV2FormatDescriptor(mConfig.fVideoFormat, mConfig.fPixelFormat);
173  if (!mFormatDesc.IsValid())
174  return AJA_STATUS_FAIL;
175 
176  // Turn on the FrameStore (to read frame buffer memory and transmit video)...
177  mDevice.EnableChannel(mConfig.fOutputChannel);
178  mDevice.SetMode(mConfig.fOutputChannel, NTV2_MODE_DISPLAY);
179 
180  // This demo assumes VANC is disabled...
181  mDevice.SetVANCMode(NTV2_VANCMODE_OFF, mConfig.fOutputChannel);
183 
184  // Set the FrameStore video format...
185  mDevice.SetVideoFormat (mConfig.fVideoFormat, false, false, mConfig.fOutputChannel);
186 // mDevice.SetTsiFrameEnable(true, mConfig.fOutputChannel);
187 
188  // Set the frame buffer pixel format for the device FrameStore...
189  mDevice.SetFrameBufferFormat (mConfig.fOutputChannel, mConfig.fPixelFormat);
190 
191  // Check if HDR anc is permissible...
192  if (IS_KNOWN_AJAAncDataType(mConfig.fTransmitHDRType) && !mDevice.features().CanDoCustomAnc())
193  {cerr << "## WARNING: HDR Anc requested, but device can't do custom anc" << endl;
195 
196  // Set output clock reference...
197  mDevice.SetReference(mDevice.features().CanDo2110() ? NTV2_REFERENCE_SFP1_PTP : NTV2_REFERENCE_FREERUN);
198 
199  // At this point, video setup is complete (except for widget signal routing).
200  return AJA_STATUS_SUCCESS;
201 
202 } // SetUpVideo
203 
204 
206 {
207  CNTV2DemoCommon::SetDefaultPageSize(); // Set host-specific page size
208 
209  // Allocate and add each in-host NTV2FrameData to my circular buffer member variable...
210  mHostBuffers.reserve(CIRCULAR_BUFFER_SIZE);
211  while (mHostBuffers.size() < CIRCULAR_BUFFER_SIZE)
212  {
213  mHostBuffers.push_back(FrameData()); // Make a new NTV2FrameData...
214  FrameData & frameData(mHostBuffers.back()); // ...and get a reference to it
215 
216  // Allocate a page-aligned video buffer
217  if (mConfig.WithVideo())
218  {
219  if (!frameData.fVideoBuffer.Allocate (mFormatDesc.GetTotalBytes(), BUFFER_PAGE_ALIGNED))
220  {
221  PLFAIL("Failed to allocate " << xHEX0N(mFormatDesc.GetTotalBytes(),8) << "-byte video buffer");
222  return AJA_STATUS_MEMORY;
223  }
224  }
225  frameData.fDataReady = false;
226  } // for each NTV2FrameData
227 
228  mProducerIndex = 0;
229  mConsumerIndex = 0;
230 
231  return AJA_STATUS_SUCCESS;
232 
233 } // SetUpHostBuffers
234 
235 
237 {
238  vector<NTV2TestPatternSelect> testPatIDs;
239  testPatIDs.push_back(NTV2_TestPatt_ColorBars100);
240  testPatIDs.push_back(NTV2_TestPatt_ColorBars75);
241  testPatIDs.push_back(NTV2_TestPatt_Ramp);
242  testPatIDs.push_back(NTV2_TestPatt_MultiBurst);
243  testPatIDs.push_back(NTV2_TestPatt_LineSweep);
244  testPatIDs.push_back(NTV2_TestPatt_CheckField);
245  testPatIDs.push_back(NTV2_TestPatt_FlatField);
246  testPatIDs.push_back(NTV2_TestPatt_MultiPattern);
247  testPatIDs.push_back(NTV2_TestPatt_Border);
248 
249  mTestPatRasters.clear();
250  for (size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
251  mTestPatRasters.push_back(NTV2Buffer());
252 
253  if (!mFormatDesc.IsValid())
254  {PLFAIL("Bad format descriptor"); return AJA_STATUS_FAIL;}
255  if (mFormatDesc.IsVANC())
256  {PLFAIL("VANC should have been disabled: " << mFormatDesc); return AJA_STATUS_FAIL;}
257 
258  // Set up one video buffer for each test pattern...
259  for (size_t tpNdx(0); tpNdx < testPatIDs.size(); tpNdx++)
260  {
261  // Allocate the buffer memory...
262  if (!mTestPatRasters.at(tpNdx).Allocate (mFormatDesc.GetTotalBytes(), BUFFER_PAGE_ALIGNED))
263  { PLFAIL("Test pattern buffer " << DEC(tpNdx+1) << " of " << DEC(testPatIDs.size()) << ": "
264  << xHEX0N(mFormatDesc.GetTotalBytes(),8) << "-byte page-aligned alloc failed");
265  return AJA_STATUS_MEMORY;
266  }
267 
268  // Fill the buffer with test pattern...
269  NTV2TestPatternGen testPatternGen;
270  if (!testPatternGen.DrawTestPattern (testPatIDs.at(tpNdx), mFormatDesc, mTestPatRasters.at(tpNdx)))
271  {
272  cerr << "## ERROR: DrawTestPattern " << DEC(tpNdx) << " failed: " << mFormatDesc << endl;
273  return AJA_STATUS_FAIL;
274  }
275  } // loop for each predefined pattern
276 
277  return AJA_STATUS_SUCCESS;
278 
279 } // SetUpTestPatternBuffers
280 
281 
283 {
284  const NTV2Standard outputStandard (::GetNTV2StandardFromVideoFormat(mConfig.fVideoFormat));
285  const UWord numSDIOutputs (mDevice.features().GetNumVideoOutputs());
286  const bool isRGB (::IsRGBFormat(mConfig.fPixelFormat));
287  const bool canVerify (mDevice.features().HasCrosspointConnectROM());
288  UWord connectFailures (0);
289 
290  const NTV2OutputXptID cscVidOutXpt(::GetCSCOutputXptFromChannel(mConfig.fOutputChannel, false/*isKey*/, !isRGB/*isRGB*/));
291  const NTV2OutputXptID fsVidOutXpt (::GetFrameBufferOutputXptFromChannel(mConfig.fOutputChannel, isRGB/*isRGB*/, false/*is425*/));
292  const NTV2InputXptID cscInputXpt (isRGB ? ::GetCSCInputXptFromChannel(mConfig.fOutputChannel, false/*isKeyInput*/) : NTV2_INPUT_CROSSPOINT_INVALID);
293  if (isRGB)
294  if (!mDevice.Connect (cscInputXpt, fsVidOutXpt, canVerify))
295  connectFailures++;
296 
297  if (mConfig.fDoMultiFormat)
298  {
299  // Multiformat --- We may be sharing the device with other processes, so route only one SDI output...
300  if (mDevice.features().HasBiDirectionalSDI())
301  mDevice.SetSDITransmitEnable(mConfig.fOutputChannel, true);
302 
303  if (!mDevice.Connect (::GetSDIOutputInputXpt (mConfig.fOutputChannel, false/*isDS2*/), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
304  connectFailures++;
305  // NOTE: No need to send VITC2 with VITC1 (for "i" formats) -- firmware does this automatically
306  mDevice.SetSDIOutputStandard (mConfig.fOutputChannel, outputStandard);
307  }
308  else
309  {
310  // Not multiformat: We own the whole device, so connect all possible SDI outputs...
311  const UWord numFrameStores(mDevice.features().GetNumFrameStores());
312  mDevice.ClearRouting(); // Start with clean slate
313 
314  if (isRGB)
315  if (!mDevice.Connect (cscInputXpt, fsVidOutXpt, canVerify))
316  connectFailures++;
317 
318  for (NTV2Channel chan(NTV2_CHANNEL1); ULWord(chan) < numSDIOutputs; chan = NTV2Channel(chan+1))
319  {
320  if (chan != mConfig.fOutputChannel && chan < numFrameStores)
321  mDevice.DisableChannel(chan); // Disable unused FrameStore
322  if (mDevice.features().HasBiDirectionalSDI())
323  mDevice.SetSDITransmitEnable (chan, true); // Make it an output
324 
325  if (!mDevice.Connect (::GetSDIOutputInputXpt (chan, false/*isDS2*/), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
326  connectFailures++;
327  mDevice.SetSDIOutputStandard (chan, outputStandard);
328  // NOTE: No need to send VITC2 with VITC1 (for "i" formats) -- firmware does this automatically
329  } // for each SDI output spigot
330 
331  // And connect analog video output, if the device has one...
332  if (mDevice.features().GetNumAnalogVideoOutputs())
333  if (!mDevice.Connect (::GetOutputDestInputXpt(NTV2_OUTPUTDESTINATION_ANALOG1), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
334  connectFailures++;
335 
336  // And connect HDMI video output, if the device has one...
337  if (mDevice.features().GetNumHDMIVideoOutputs())
338  if (!mDevice.Connect (::GetOutputDestInputXpt(NTV2_OUTPUTDESTINATION_HDMI1), isRGB ? cscVidOutXpt : fsVidOutXpt, canVerify))
339  connectFailures++;
340  }
341  if (connectFailures)
342  PLWARN(DEC(connectFailures) << " 'Connect' call(s) failed");
343  return connectFailures == 0;
344 
345 } // RouteOutputSignal
346 
347 
349 {
350  // Start my consumer and producer threads...
353  return AJA_STATUS_SUCCESS;
354 
355 } // Run
356 
357 
358 
360 // This is where the play thread starts
361 
363 {
364  // Create and start the playout thread...
365  mConsumerThread.Attach (ConsumerThreadStatic, this);
366  mConsumerThread.SetPriority(AJA_ThreadPriority_High);
367  mConsumerThread.Start();
368 
369 } // StartConsumerThread
370 
371 
372 // The playout thread function
373 void NTV2StreamPlayer::ConsumerThreadStatic (AJAThread * pThread, void * pContext) // static
374 { (void) pThread;
375  // Grab the NTV2StreamPlayer instance pointer from the pContext parameter,
376  // then call its ConsumeFrames method...
377  NTV2StreamPlayer * pApp (reinterpret_cast<NTV2StreamPlayer*>(pContext));
378  if (pApp)
379  pApp->ConsumeFrames();
380 
381 } // ConsumerThreadStatic
382 
383 
385 {
386  NTV2StreamChannel strStatus;
387  NTV2StreamBuffer bfrStatus;
388  ULWord goodQueue(0), badQueue(0), goodRelease(0), badRelease(0), starves(0), noRoomWaits(0), status(0);
389  PLNOTE("Thread started");
390 
391  // Lock and map the buffers...
392  for (FrameDataArrayIter iterHost (mHostBuffers.begin()); iterHost != mHostBuffers.end(); ++iterHost)
393  if (iterHost->fVideoBuffer)
394  mDevice.DMABufferLock(iterHost->fVideoBuffer, true);
395 
396  // Initialize and claim ownership of the stream
397  status = mDevice.StreamChannelInitialize(mConfig.fOutputChannel);
398  if (status != NTV2_STREAM_STATUS_SUCCESS)
399  {
400  cerr << "## ERROR: Stream initialize failed: " << status << endl;
401  mGlobalQuit = true;
402  }
403 
404  while (!mGlobalQuit)
405  {
406  // Get stream status
407  status = mDevice.StreamChannelStatus(mConfig.fOutputChannel, strStatus);
408  if (status != NTV2_STREAM_STATUS_SUCCESS)
409  {cerr << "## ERROR: Stream status failed: " << status << endl; return;}
410 
411  if (strStatus.GetQueueDepth() < 6)
412  {
413  FrameData * pFrameData (&mHostBuffers[mConsumerIndex]);
414  if (pFrameData->fDataReady)
415  {
416  // Queue frame to stream
417  status = mDevice.StreamBufferQueue (mConfig.fOutputChannel, pFrameData->fVideoBuffer, mConsumerIndex, bfrStatus);
418  if (status == NTV2_STREAM_STATUS_SUCCESS)
419  {
420  goodQueue++;
421  mConsumerIndex = (mConsumerIndex + 1) % CIRCULAR_BUFFER_SIZE;
422  }
423  else
424  {
425  badQueue++;
426  cerr << "## ERROR: Stream buffer add failed: " << status << endl;
427  }
428 
429  if (goodQueue == 3)
430  {
431  // Stop the stream (this will start streaming the first buffer to the output)
432  status = mDevice.StreamChannelStop (mConfig.fOutputChannel, strStatus);
433  if (status != NTV2_STREAM_STATUS_SUCCESS)
434  {cerr << "## ERROR: Stream stop failed: " << status << endl; return;}
435 
436  // Wait for stream to start...
437  mDevice.StreamChannelWait (mConfig.fOutputChannel, strStatus);
438  while (!strStatus.IsIdle())
439  mDevice.StreamChannelWait (mConfig.fOutputChannel, strStatus);
440 
441  // Wait a few more frames for output to stabilize...
442  for (int i = 0; i < 30; i++)
443  mDevice.StreamChannelWait (mConfig.fOutputChannel, strStatus);
444 
445  // Now start the stream...
446  status = mDevice.StreamChannelStart (mConfig.fOutputChannel, strStatus);
447  if (status != NTV2_STREAM_STATUS_SUCCESS)
448  {cerr << "## ERROR: Stream start failed: " << status << endl; return;}
449  }
450  }
451  else
452  starves++;
453  continue; // Back to top of while loop
454  }
455  else
456  noRoomWaits++;
457 
458  // Look for buffers to release
459  status = mDevice.StreamBufferRelease(mConfig.fOutputChannel, bfrStatus);
460  while (status == NTV2_STREAM_STATUS_SUCCESS)
461  {
462  if (bfrStatus.mBufferCookie < CIRCULAR_BUFFER_SIZE)
463  {
464  mHostBuffers[bfrStatus.mBufferCookie].fDataReady = false;
465  goodRelease++;
466  }
467  else
468  {
469  badRelease++;
470  }
471  status = mDevice.StreamBufferRelease(mConfig.fOutputChannel, bfrStatus);
472  }
473 
474  // Wait for one or more buffers to become available on the device, which should occur at next VBI...
475  if (mDevice.StreamChannelWait(mConfig.fOutputChannel, strStatus) != NTV2_STREAM_STATUS_SUCCESS)
476  break;
477  } // loop til quit signaled
478 
479  // Stop streaming...
480  status = mDevice.StreamChannelInitialize (mConfig.fOutputChannel);
481  if (status != NTV2_STREAM_STATUS_SUCCESS)
482  {cerr << "## ERROR: Stream initialize failed: " << status << endl; return;}
483 
484  // Release all buffers
485  while (mDevice.StreamBufferRelease (mConfig.fOutputChannel, bfrStatus) == NTV2_STREAM_STATUS_SUCCESS)
486  {
487  if (bfrStatus.mBufferCookie < CIRCULAR_BUFFER_SIZE)
488  { // Signal that I'm done consuming this FrameData, making it immediately available for more data...
489  mHostBuffers[bfrStatus.mBufferCookie].fDataReady = false;
490  goodRelease++;
491  }
492  else
493  badRelease++;
494  }
495 
496  // Release stream ownership
497  status = mDevice.StreamChannelRelease (mConfig.fOutputChannel);
498  if (status != NTV2_STREAM_STATUS_SUCCESS)
499  {
500  cerr << "## ERROR: Stream release failed: " << status << endl;
501  return;
502  }
503 
504  PLNOTE("Thread completed: " << DEC(goodQueue) << " queued, " << DEC(badQueue) << " failed, "
505  << DEC(starves) << " starves, " << DEC(noRoomWaits) << " waits, "
506  << DEC(goodRelease) << " releases (" << DEC(badRelease) << " failed)");
507 
508 } // ConsumeFrames
509 
510 
511 
513 // This is where the producer thread starts
514 
516 {
517  // Create and start the producer thread...
518  mProducerThread.Attach(ProducerThreadStatic, this);
519  mProducerThread.SetPriority(AJA_ThreadPriority_High);
520  mProducerThread.Start();
521 
522 } // StartProducerThread
523 
524 
525 void NTV2StreamPlayer::ProducerThreadStatic (AJAThread * pThread, void * pContext) // static
526 { (void) pThread;
527  NTV2StreamPlayer * pApp (reinterpret_cast<NTV2StreamPlayer*>(pContext));
528  if (pApp)
529  pApp->ProduceFrames();
530 
531 } // ProducerThreadStatic
532 
533 
535 {
536  ULWord testPatNdx(0), badTally(0);
537  double timeOfLastSwitch (0.0);
538 
541  const bool isInterlace (!NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(mConfig.fVideoFormat));
542  const bool isPAL (NTV2_IS_PAL_VIDEO_FORMAT(mConfig.fVideoFormat));
543  const NTV2FrameRate ntv2FrameRate (::GetNTV2FrameRateFromVideoFormat(mConfig.fVideoFormat));
544  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat(ntv2FrameRate));
545 
546  PLNOTE("Thread started");
547 
548  while (!mGlobalQuit)
549  {
550  FrameData * pFrameData (&mHostBuffers[mProducerIndex]);
551  if (pFrameData->fDataReady)
552  {
553  badTally++; // No frame available!
554  AJATime::Sleep(10); // Wait a bit for the consumer thread to free one up for me...
555  continue; // ...then try again
556  }
557 
558  // Copy fresh, unmodified, pre-rendered test pattern into this frame's video buffer...
559  pFrameData->fVideoBuffer.CopyFrom (mTestPatRasters.at(testPatNdx),
560  /*srcOffset*/ 0,
561  /*dstOffset*/ 0,
562  /*byteCount*/ pFrameData->fVideoBuffer.GetByteCount());
563 
564  const CRP188 rp188Info (mCurrentFrame++, 0, 0, 10, tcFormat);
565  NTV2_RP188 tcF1, tcF2;
566  string tcString;
567 
568  rp188Info.GetRP188Reg(tcF1);
569  rp188Info.GetRP188Str(tcString);
570 
571  // Include timecode in output signal...
572  tcF2 = tcF1;
573  if (isInterlace)
574  { // Set bit 27 of Hi word (PAL) or Lo word (NTSC)
575  if (isPAL) tcF2.fHi |= BIT(27); else tcF2.fLo |= BIT(27);
576  }
577 
578  if (pFrameData->fVideoBuffer.GetHostAddress(0))
579  { // Burn current timecode into the video buffer...
580  mTCBurner.BurnTimeCode (pFrameData->fVideoBuffer.GetHostAddress(0), tcString.c_str(), 80);
581  }
582  TCDBG("F" << DEC0N(mCurrentFrame-1,6) << ": " << tcF1 << ": " << tcString);
583 
584  // Every few seconds, change the test pattern and tone frequency...
585  const double currentTime (timeBase.FramesToSeconds(mCurrentFrame));
586  if (currentTime > timeOfLastSwitch + 4.0)
587  {
588  testPatNdx = (testPatNdx + 1) % ULWord(mTestPatRasters.size());
589  timeOfLastSwitch = currentTime;
590  PLINFO("F" << DEC0N(mCurrentFrame,6) << ": " << tcString << "pattern='" << tpNames.at(testPatNdx) << "'");
591  } // if time to switch test pattern
592 
593  // Signal that I'm done producing this FrameData, making it immediately available for transfer/playout...
594  pFrameData->fDataReady = true;
595  mProducerIndex = (mProducerIndex + 1) % CIRCULAR_BUFFER_SIZE;
596  } // loop til mGlobalQuit goes true
597 
598  PLNOTE("Thread completed: " << DEC(mCurrentFrame) << " frame(s) produced, " << DEC(badTally) << " failed");
599 } // ProduceFrames
600 
601 
603 {
604  mDevice.StreamChannelStatus(mConfig.fOutputChannel, outStatus);
605 }
606 
NTV2TestPatternGen::DrawTestPattern
virtual bool DrawTestPattern(const std::string &inTPName, const NTV2FormatDescriptor &inFormatDesc, NTV2Buffer &inBuffer)
Renders the given test pattern or color into a host raster buffer.
CNTV2Card::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::StreamBufferQueue
virtual ULWord StreamBufferQueue(const NTV2Channel inChannel, NTV2Buffer &inBuffer, ULWord64 bufferCookie, NTV2StreamBuffer &status)
Queue a buffer to the stream. The bufferCookie is a user defined identifier of the buffer used by the...
Definition: ntv2stream.cpp:67
CNTV2Card::SetMultiFormatMode
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
Definition: ntv2register.cpp:4379
GetSDIOutputInputXpt
NTV2InputXptID GetSDIOutputInputXpt(const NTV2Channel inSDIOutput, const bool inIsDS2=false)
Definition: ntv2signalrouter.cpp:942
DeviceCapabilities::CanDoVideoFormat
bool CanDoVideoFormat(const NTV2VideoFormat inVF)
Definition: ntv2devicecapabilities.h:251
NTV2_OUTPUTDESTINATION_HDMI1
@ NTV2_OUTPUTDESTINATION_HDMI1
Definition: ntv2enums.h:1304
NTV2_TestPatt_CheckField
@ NTV2_TestPatt_CheckField
Definition: ntv2testpatterngen.h:34
NTV2StreamBuffer::mBufferCookie
ULWord64 mBufferCookie
Buffer User cookie.
Definition: ntv2publicinterface.h:8771
NTV2_REFERENCE_SFP1_PTP
@ NTV2_REFERENCE_SFP1_PTP
Specifies the PTP source on SFP 1.
Definition: ntv2enums.h:1443
NTV2_IS_VALID_TASK_MODE
#define NTV2_IS_VALID_TASK_MODE(__m__)
Definition: ntv2publicinterface.h:4296
NTV2StreamChannel
Definition: ntv2publicinterface.h:8702
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or Frame Store 2 (or the 2nd item).
Definition: ntv2enums.h:1337
NTV2_VANCDATA_NORMAL
@ NTV2_VANCDATA_NORMAL
Definition: ntv2enums.h:3768
AJA_ThreadPriority_High
@ AJA_ThreadPriority_High
Definition: thread.h:44
BUFFER_PAGE_ALIGNED
static const bool BUFFER_PAGE_ALIGNED((!(0)))
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
AJATimeCodeBurn::RenderTimeCodeFont
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
Definition: timecodeburn.cpp:447
NTV2_TestPatt_MultiBurst
@ NTV2_TestPatt_MultiBurst
Definition: ntv2testpatterngen.h:32
AJAAncDataType_Unknown
@ AJAAncDataType_Unknown
Includes data that is valid, but we don't recognize.
Definition: ancillarydata.h:46
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
IS_KNOWN_AJAAncDataType
#define IS_KNOWN_AJAAncDataType(_x_)
Definition: ancillarydata.h:65
CRP188::GetRP188Reg
bool GetRP188Reg(RP188_STRUCT &outRP188) const
Definition: ntv2rp188.cpp:1241
NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE
#define NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(__f__)
Definition: ntv2enums.h:1031
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1334
NTV2Buffer
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
Definition: ntv2publicinterface.h:6022
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:381
NTV2StreamPlayer::SetUpHostBuffers
virtual AJAStatus SetUpHostBuffers(void)
Sets up my host video & audio buffers.
Definition: ntv2streamplayer.cpp:205
GetNTV2FrameRateFromVideoFormat
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3530
AJAThread::Attach
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
Definition: thread.cpp:169
NTV2StreamChannel::GetQueueDepth
ULWord GetQueueDepth(void)
Gets the queue depth.
Definition: ntv2publicinterface.h:8734
AJATimeCodeBurn::BurnTimeCode
AJA_EXPORT bool BurnTimeCode(void *pBaseVideoAddress, const std::string &inTimeCodeStr, const uint32_t inYPercent)
Definition: timecodeburn.cpp:45
AJA_STATUS_BUSY
@ AJA_STATUS_BUSY
Definition: types.h:391
CNTV2DeviceScanner::GetFirstDeviceFromArgument
static bool GetFirstDeviceFromArgument(const std::string &inArgument, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command li...
Definition: ntv2devicescanner.cpp:374
ntv2testpatterngen.h
Declares the NTV2TestPatternGen class.
CNTV2Card::DisableChannel
virtual bool DisableChannel(const NTV2Channel inChannel)
Disables the given FrameStore.
Definition: ntv2register.cpp:2077
NTV2_TestPatt_ColorBars100
@ NTV2_TestPatt_ColorBars100
Definition: ntv2testpatterngen.h:28
NTV2StreamPlayer::Init
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2streamplayer.cpp:72
CNTV2Card::ClearRouting
virtual bool ClearRouting(void)
Removes all existing signal path connections between any and all widgets on the AJA device.
Definition: ntv2regroute.cpp:278
DEC0N
#define DEC0N(__x__, __n__)
Definition: ntv2publicinterface.h:5608
CNTV2MacDriverInterface::ReleaseStreamForApplication
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
Definition: ntv2macdriverinterface.cpp:516
AJA_STATUS_MEMORY
@ AJA_STATUS_MEMORY
Definition: types.h:397
CNTV2Card::StreamChannelRelease
virtual ULWord StreamChannelRelease(const NTV2Channel inChannel)
Release a stream. Releases all buffers remaining in the queue.
Definition: ntv2stream.cpp:19
PlayerConfig::fDoMultiFormat
bool fDoMultiFormat
If true, enable device-sharing; otherwise take exclusive control of device.
Definition: ntv2democommon.h:332
NTV2StreamPlayer
I play out SD or HD test pattern (with timecode) to an output of an AJA device with or without audio ...
Definition: ntv2streamplayer.h:24
NTV2InputXptID
enum NTV2InputCrosspointID NTV2InputXptID
TimecodeFormat
TimecodeFormat
Definition: ntv2rp188.h:27
NTV2_CHANNEL1
@ NTV2_CHANNEL1
Specifies channel or Frame Store 1 (or the first item).
Definition: ntv2enums.h:1336
ntv2debug.h
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
NTV2FrameBufferFormatString
const char * NTV2FrameBufferFormatString(NTV2FrameBufferFormat fmt)
Definition: ntv2debug.cpp:205
CNTV2Card::SetSDITransmitEnable
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
Definition: ntv2register.cpp:3796
CNTV2Card::SetVANCShiftMode
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
Definition: ntv2register.cpp:2800
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
NTV2StreamChannel::IsIdle
bool IsIdle(void)
Is the stream idle.
Definition: ntv2publicinterface.h:8740
NTV2StreamPlayer::ConsumeFrames
virtual void ConsumeFrames(void)
My consumer thread that repeatedly plays frames using AutoCirculate (until quit).
Definition: ntv2streamplayer.cpp:384
NTV2StreamPlayer::Quit
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2streamplayer.cpp:52
NTV2FrameRate
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:399
CNTV2Card::DMABufferLock
virtual bool DMABufferLock(const NTV2Buffer &inBuffer, bool inMap=(0), bool inRDMA=(0))
Page-locks the given host buffer to reduce transfer time and CPU usage of DMA transfers.
Definition: ntv2dma.cpp:429
PlayerConfig::fTransmitHDRType
AJAAncDataType fTransmitHDRType
Specifies the HDR anc data packet to transmit, if any.
Definition: ntv2democommon.h:330
GetOutputDestInputXpt
NTV2InputXptID GetOutputDestInputXpt(const NTV2OutputDestination inOutputDest, const bool inIsSDI_DS2=false, const UWord inHDMI_Quadrant=99)
Definition: ntv2signalrouter.cpp:928
CNTV2Card::features
virtual class DeviceCapabilities & features(void)
Definition: ntv2card.h:141
AJAThread
Definition: thread.h:69
NTV2StreamPlayer::~NTV2StreamPlayer
virtual ~NTV2StreamPlayer(void)
Definition: ntv2streamplayer.cpp:45
AJAThread::Active
virtual bool Active()
Definition: thread.cpp:116
CNTV2Card::GetDisplayName
virtual std::string GetDisplayName(void)
Answers with this device's display name.
Definition: ntv2card.cpp:86
AJAStatus
AJAStatus
Definition: types.h:378
NTV2_RP188::fLo
ULWord fLo
| BG 4 | Secs10 | BG 3 | Secs 1 | BG 2 | Frms10 | BG 1 | Frms 1 |
Definition: ntv2publicinterface.h:6792
NTV2StreamPlayer::StartConsumerThread
virtual void StartConsumerThread(void)
Starts my consumer thread.
Definition: ntv2streamplayer.cpp:362
NTV2FormatDescriptor::numPixels
ULWord numPixels
Width – total number of pixels per line.
Definition: ntv2formatdescriptor.h:355
process.h
Declares the AJAProcess class.
NTV2StreamPlayer::SetUpVideo
virtual AJAStatus SetUpVideo(void)
Performs all video setup.
Definition: ntv2streamplayer.cpp:143
NTV2_RP188::fHi
ULWord fHi
| BG 8 | Hrs 10 | BG 7 | Hrs 1 | BG 6 | Mins10 | BG 5 | Mins 1 |
Definition: ntv2publicinterface.h:6793
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
NTV2Standard
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:156
NTV2_TestPatt_Ramp
@ NTV2_TestPatt_Ramp
Definition: ntv2testpatterngen.h:31
NTV2_VANCMODE_OFF
@ NTV2_VANCMODE_OFF
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3752
AJATimeBase
Definition: timebase.h:18
AJA_STATUS_FEATURE
@ AJA_STATUS_FEATURE
Definition: types.h:393
AJA_STATUS_FAIL
@ AJA_STATUS_FAIL
Definition: types.h:382
NTV2StreamPlayer::SetUpTestPatternBuffers
virtual AJAStatus SetUpTestPatternBuffers(void)
Creates my test pattern buffers.
Definition: ntv2streamplayer.cpp:236
ULWord
uint32_t ULWord
Definition: ajatypes.h:255
NTV2_TestPatt_FlatField
@ NTV2_TestPatt_FlatField
Definition: ntv2testpatterngen.h:35
ntv2devicescanner.h
Declares the CNTV2DeviceScanner class.
NTV2FormatDescriptor::numLines
ULWord numLines
Height – total number of lines.
Definition: ntv2formatdescriptor.h:354
CNTV2Card::StreamChannelStart
virtual ULWord StreamChannelStart(const NTV2Channel inChannel, NTV2StreamChannel &status)
Start a stream. Put the stream is the active state to start processing queued buffers....
Definition: ntv2stream.cpp:27
NTV2FormatDescriptor::GetTotalBytes
ULWord GetTotalBytes(void) const
Definition: ntv2formatdescriptor.cpp:855
CNTV2Card::StreamChannelStatus
virtual ULWord StreamChannelStatus(const NTV2Channel inChannel, NTV2StreamChannel &status)
Get the current stream status.
Definition: ntv2stream.cpp:51
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
CNTV2DemoCommon::SetDefaultPageSize
static size_t SetDefaultPageSize(void)
Definition: ntv2democommon.cpp:1591
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
NTV2StreamPlayer::ConsumerThreadStatic
static void ConsumerThreadStatic(AJAThread *pThread, void *pContext)
This is the consumer thread's static callback function that gets called when the consumer thread star...
Definition: ntv2streamplayer.cpp:373
UWord
uint16_t UWord
Definition: ajatypes.h:253
PlayerConfig::fVideoFormat
NTV2VideoFormat fVideoFormat
The video format to use.
Definition: ntv2democommon.h:328
NTV2_IS_PAL_VIDEO_FORMAT
#define NTV2_IS_PAL_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:719
NTV2_REFERENCE_FREERUN
@ NTV2_REFERENCE_FREERUN
Specifies the device's internal clock.
Definition: ntv2enums.h:1434
PlayerConfig::fOutputChannel
NTV2Channel fOutputChannel
The device channel to use.
Definition: ntv2democommon.h:324
NTV2VideoFormatToString
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Definition: ntv2utils.cpp:6793
GetCSCInputXptFromChannel
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
Definition: ntv2signalrouter.cpp:775
CNTV2Card::StreamBufferRelease
virtual ULWord StreamBufferRelease(const NTV2Channel inChannel, NTV2StreamBuffer &status)
Remove the oldest buffer released by the streaming engine from the buffer queue.
Definition: ntv2stream.cpp:77
IsVideoFormatA
bool IsVideoFormatA(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5518
NTV2_TestPatt_ColorBars75
@ NTV2_TestPatt_ColorBars75
Definition: ntv2testpatterngen.h:30
NTV2_TASK_MODE_INVALID
@ NTV2_TASK_MODE_INVALID
Definition: ntv2publicinterface.h:4293
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1312
DEVICE_ID_INVALID
@ DEVICE_ID_INVALID
Definition: ntv2enums.h:93
kDemoAppSignature
static const ULWord kDemoAppSignature((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0))
CRP188
Definition: ntv2rp188.h:55
CNTV2Card::SetEveryFrameServices
virtual bool SetEveryFrameServices(const NTV2EveryFrameTaskMode inMode)
Sets the device's task mode.
Definition: ntv2register.cpp:179
NTV2StringList
std::vector< std::string > NTV2StringList
Definition: ntv2utils.h:1143
AJA_STATUS_UNSUPPORTED
@ AJA_STATUS_UNSUPPORTED
Definition: types.h:394
NTV2_INPUT_CROSSPOINT_INVALID
@ NTV2_INPUT_CROSSPOINT_INVALID
Definition: ntv2enums.h:2858
CNTV2DemoCommon::GetAJAFrameRate
static AJA_FrameRate GetAJAFrameRate(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:1118
NTV2TestPatternGen
The NTV2 test pattern generator.
Definition: ntv2testpatterngen.h:69
NTV2StreamPlayer::Run
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2streamplayer.cpp:348
TCDBG
#define TCDBG(_expr_)
Definition: ntv2streamplayer.cpp:23
NTV2_FORMAT_UNKNOWN
@ NTV2_FORMAT_UNKNOWN
Definition: ntv2enums.h:521
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_TestPatt_Border
@ NTV2_TestPatt_Border
Definition: ntv2testpatterngen.h:39
AJA_STATUS_INITIALIZE
@ AJA_STATUS_INITIALIZE
Definition: types.h:386
CNTV2Card::StreamChannelStop
virtual ULWord StreamChannelStop(const NTV2Channel inChannel, NTV2StreamChannel &status)
Stop a stream. Put the stream is the idle state. For frame based video, the stream will idle on the b...
Definition: ntv2stream.cpp:35
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5606
CNTV2Card::SetSDIOutputStandard
virtual bool SetSDIOutputStandard(const UWord inOutputSpigot, const NTV2Standard inValue)
Sets the SDI output spigot's video standard.
Definition: ntv2register.cpp:3200
CNTV2Card::StreamChannelWait
virtual ULWord StreamChannelWait(const NTV2Channel inChannel, NTV2StreamChannel &status)
Wait for any stream event. Returns for any state or buffer change.
Definition: ntv2stream.cpp:59
false
#define false
Definition: ntv2devicefeatures.h:25
GetFrameBufferOutputXptFromChannel
NTV2OutputXptID GetFrameBufferOutputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsRGB=false, const bool inIs425=false)
Definition: ntv2signalrouter.cpp:845
PlayerConfig::fDeviceSpec
std::string fDeviceSpec
The AJA device to use.
Definition: ntv2democommon.h:322
AJA_STATUS_BAD_PARAM
@ AJA_STATUS_BAD_PARAM
Definition: types.h:392
ntv2streamplayer.h
NTV2StreamPlayer::ProducerThreadStatic
static void ProducerThreadStatic(AJAThread *pThread, void *pContext)
This is the producer thread's static callback function that gets called when the producer thread star...
Definition: ntv2streamplayer.cpp:525
std
Definition: json.hpp:5362
NTV2_RP188
This struct replaces the old RP188_STRUCT.
Definition: ntv2publicinterface.h:6790
IsRGBFormat
bool IsRGBFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5470
CNTV2DemoCommon::GetAJAPixelFormat
static AJA_PixelFormat GetAJAPixelFormat(const NTV2PixelFormat inFormat)
Definition: ntv2democommon.cpp:1150
CIRCULAR_BUFFER_SIZE
static const size_t CIRCULAR_BUFFER_SIZE(10)
Number of NTV2FrameData's in our ring.
CNTV2MacDriverInterface::AcquireStreamForApplication
virtual bool AcquireStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
Definition: ntv2macdriverinterface.cpp:481
NTV2_STREAM_STATUS_SUCCESS
#define NTV2_STREAM_STATUS_SUCCESS
Used in NTV2Stream success.
Definition: ntv2publicinterface.h:8693
CNTV2DriverInterface::GetDeviceID
virtual NTV2DeviceID GetDeviceID(void)
Definition: ntv2driverinterface.cpp:407
CNTV2Card::StreamChannelInitialize
virtual ULWord StreamChannelInitialize(const NTV2Channel inChannel)
Initialize a stream. Put the stream queue and hardware in a known good state ready for use....
Definition: ntv2stream.cpp:11
CNTV2Card::GetEveryFrameServices
virtual bool GetEveryFrameServices(NTV2EveryFrameTaskMode &outMode)
Retrieves the device's current "retail service" task mode.
Definition: ntv2register.cpp:184
NTV2_TestPatt_MultiPattern
@ NTV2_TestPatt_MultiPattern
Definition: ntv2testpatterngen.h:36
PlayerConfig
Configures an NTV2Player instance.
Definition: ntv2democommon.h:319
PlayerConfig::fDoABConversion
bool fDoABConversion
If true, do level-A/B conversion; otherwise don't.
Definition: ntv2democommon.h:336
GetNTV2StandardFromVideoFormat
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2277
PlayerConfig::fPixelFormat
NTV2PixelFormat fPixelFormat
The pixel format to use.
Definition: ntv2democommon.h:327
NTV2OutputXptID
enum NTV2OutputCrosspointID NTV2OutputXptID
AJAThread::SetPriority
virtual AJAStatus SetPriority(AJAThreadPriority priority)
Definition: thread.cpp:133
NTV2TestPatternGen::getTestPatternNames
static NTV2TestPatternNames getTestPatternNames(void)
Definition: ntv2testpatterngen.cpp:2542
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
AJATimeBase::FramesToSeconds
double FramesToSeconds(int64_t frames) const
Definition: timebase.cpp:197
CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:1096
NTV2_TestPatt_LineSweep
@ NTV2_TestPatt_LineSweep
Definition: ntv2testpatterngen.h:33
AJAThread::Start
virtual AJAStatus Start()
Definition: thread.cpp:91
PLFAIL
#define PLFAIL(_xpr_)
Definition: ntv2democommon.h:34
BIT
#define BIT(_x_)
Definition: ajatypes.h:563
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5605
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition: types.h:371
NTV2StreamBuffer
Definition: ntv2publicinterface.h:8762
NTV2StreamPlayer::RouteOutputSignal
virtual bool RouteOutputSignal(void)
Performs all widget/signal routing for playout.
Definition: ntv2streamplayer.cpp:282
NTV2StreamPlayer::NTV2StreamPlayer
NTV2StreamPlayer(const PlayerConfig &inConfig)
Constructs me using the given configuration settings.
Definition: ntv2streamplayer.cpp:28
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:1223
DeviceCapabilities::CanDoFrameBufferFormat
bool CanDoFrameBufferFormat(const NTV2PixelFormat inPF)
Definition: ntv2devicecapabilities.h:223
NTV2FormatDescriptor::IsValid
bool IsValid(void) const
Definition: ntv2formatdescriptor.h:100
PLINFO
#define PLINFO(_xpr_)
Definition: ntv2democommon.h:37
PLWARN
#define PLWARN(_xpr_)
Definition: ntv2democommon.h:35
NTV2StreamPlayer::StartProducerThread
virtual void StartProducerThread(void)
Starts my producer thread.
Definition: ntv2streamplayer.cpp:515
NTV2StreamPlayer::GetStreamStatus
virtual void GetStreamStatus(NTV2StreamChannel &outStatus)
Provides status information about my output (playout) process.
Definition: ntv2streamplayer.cpp:602
CNTV2Card::SetSDIOutLevelAtoLevelBConversion
virtual bool SetSDIOutLevelAtoLevelBConversion(const UWord inOutputSpigot, const bool inEnable)
Enables or disables 3G level A to 3G level B conversion at the SDI output widget (assuming the AJA de...
Definition: ntv2register.cpp:4315
CRP188::GetRP188Str
bool GetRP188Str(std::string &sRP188) const
Definition: ntv2rp188.cpp:918
NTV2_OEM_TASKS
@ NTV2_OEM_TASKS
2: OEM: Device is configured by controlling application(s), with minimal driver involvement.
Definition: ntv2publicinterface.h:4292
NTV2_OUTPUTDESTINATION_ANALOG1
@ NTV2_OUTPUTDESTINATION_ANALOG1
Definition: ntv2enums.h:1303
timebase.h
Declares the AJATimeBase class.
NTV2StreamPlayer::ProduceFrames
virtual void ProduceFrames(void)
My producer thread that repeatedly produces video frames.
Definition: ntv2streamplayer.cpp:534