AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2dolbyplayer.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2dolbyplayer.h"
9 #include "ntv2utils.h"
10 #include "ntv2formatdescriptor.h"
11 #include "ntv2debug.h"
12 #include "ntv2testpatterngen.h"
13 #include "ntv2devicescanner.h"
14 #include "ajabase/system/debug.h"
16 #include "ajabase/system/process.h"
18 
19 using namespace std;
20 
21 // Convenience macros for EZ logging:
22 #define TCFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
23 #define TCWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
24 #define TCNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
25 #define TCINFO(_expr_) AJA_sINFO (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
26 #define TCDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_TimecodeGeneric, AJAFUNC << ": " << _expr_)
27 
35 static const uint32_t AUDIOBYTES_MAX_48K (201 * 1024);
36 
44 static const uint32_t AUDIOBYTES_MAX_192K (824 * 1024);
45 
49 static const ULWord kAppSignature (NTV2_FOURCC('D','E','M','O'));
50 
51 
52 
53 NTV2DolbyPlayer::NTV2DolbyPlayer (const string & inDeviceSpecifier,
54  const bool inWithAudio,
55  const NTV2Channel inChannel,
56  const NTV2FrameBufferFormat inPixelFormat,
57  const NTV2VideoFormat inVideoFormat,
58  const bool inDoMultiChannel,
59  const bool inDoRamp,
60  AJAFileIO * inDolbyFile)
61 
62  : mConsumerThread (AJA_NULL),
63  mProducerThread (AJA_NULL),
64  mCurrentFrame (0),
65  mCurrentSample (0),
66  mToneFrequency (440.0),
67  mRampSample (0),
68  mDeviceSpecifier (inDeviceSpecifier),
69  mDeviceID (DEVICE_ID_NOTFOUND),
70  mOutputChannel (inChannel),
71  mVideoFormat (inVideoFormat),
72  mPixelFormat (inPixelFormat),
73  mSavedTaskMode (NTV2_DISABLE_TASKS),
74  mAudioSystem (NTV2_AUDIOSYSTEM_1),
75  mAudioRate (NTV2_AUDIO_192K),
76  mWithAudio (inWithAudio),
77  mGlobalQuit (false),
78  mDoMultiChannel (inDoMultiChannel),
79  mDoRamp (inDoRamp),
80  mVideoBufferSize (0),
81  mAudioBufferSize (0),
82  mTestPatternVideoBuffers (AJA_NULL),
83  mNumTestPatterns (0),
84  mBurstIndex (0),
85  mBurstSamples (0),
86  mBurstBuffer (NULL),
87  mBurstSize (0),
88  mBurstOffset (0),
89  mBurstMax (0),
90  mDolbyFile (inDolbyFile),
91  mDolbyBuffer (NULL),
92  mDolbySize (0),
93  mDolbyBlocks (0)
94 {
95  ::memset (mAVHostBuffer, 0, sizeof (mAVHostBuffer));
96 }
97 
98 
100 {
101  // Stop my playout and producer threads, then destroy them...
102  Quit ();
103 
104  mDevice.UnsubscribeOutputVerticalEvent (mOutputChannel);
105 
106  // Free my threads and buffers...
107  delete mConsumerThread;
108  mConsumerThread = AJA_NULL;
109  delete mProducerThread;
110  mProducerThread = AJA_NULL;
111 
112  if (mTestPatternVideoBuffers)
113  {
114  for (uint32_t ndx(0); ndx < mNumTestPatterns; ndx++)
115  delete [] mTestPatternVideoBuffers [ndx];
116  delete [] mTestPatternVideoBuffers;
117  mTestPatternVideoBuffers = AJA_NULL;
118  mNumTestPatterns = 0;
119  }
120 
121  for (unsigned int ndx = 0; ndx < CIRCULAR_BUFFER_SIZE; ndx++)
122  {
123  if (mAVHostBuffer [ndx].fVideoBuffer)
124  {
125  delete [] mAVHostBuffer [ndx].fVideoBuffer;
126  mAVHostBuffer [ndx].fVideoBuffer = AJA_NULL;
127  }
128  if (mAVHostBuffer [ndx].fAudioBuffer)
129  {
130  delete [] mAVHostBuffer [ndx].fAudioBuffer;
131  mAVHostBuffer [ndx].fAudioBuffer = AJA_NULL;
132  }
133  } // for each buffer in the ring
134 
135  if (mDolbyBuffer)
136  {
137  delete [] mDolbyBuffer;
138  mDolbyBuffer = NULL;
139  }
140 
141  if (mBurstBuffer)
142  {
143  delete [] mBurstBuffer;
144  mBurstBuffer = NULL;
145  }
146 
147  if (!mDoMultiChannel && mDevice.IsOpen())
148  {
149  mDevice.SetEveryFrameServices (mSavedTaskMode); // Restore the previously saved service level
150  mDevice.ReleaseStreamForApplication (kAppSignature, static_cast<int32_t>(AJAProcess::GetPid())); // Release the device
151  }
152 } // destructor
153 
154 
156 {
157  // Set the global 'quit' flag, and wait for the threads to go inactive...
158  mGlobalQuit = true;
159 
160  if (mProducerThread)
161  while (mProducerThread->Active ())
162  AJATime::Sleep (10);
163 
164  if (mConsumerThread)
165  while (mConsumerThread->Active ())
166  AJATime::Sleep (10);
167 
168  mDevice.SetAudioRate (NTV2_AUDIO_48K, mAudioSystem);
171 } // Quit
172 
173 
175 {
176  AJAStatus status (AJA_STATUS_SUCCESS);
177 
178  // Open the device...
179  if (!CNTV2DeviceScanner::GetFirstDeviceFromArgument (mDeviceSpecifier, mDevice))
180  {cerr << "## ERROR: Device '" << mDeviceSpecifier << "' not found" << endl; return AJA_STATUS_OPEN;}
181 
182  if (!mDevice.IsDeviceReady (false))
183  {cerr << "## ERROR: Device '" << mDeviceSpecifier << "' not ready" << endl; return AJA_STATUS_INITIALIZE;}
184 
185  if (!mDoMultiChannel)
186  {
187  if (!mDevice.AcquireStreamForApplication (kAppSignature, static_cast<int32_t>(AJAProcess::GetPid())))
188  return AJA_STATUS_BUSY; // Device is in use by another app -- fail
189 
190  mDevice.GetEveryFrameServices (mSavedTaskMode); // Save the current service level
191  }
192 
193  mDevice.SetEveryFrameServices (NTV2_OEM_TASKS); // Set OEM service level
194 
195  mDeviceID = mDevice.GetDeviceID (); // Keep this ID handy -- it's used frequently
196 
197  if (::NTV2DeviceCanDoMultiFormat (mDeviceID) && mDoMultiChannel)
198  mDevice.SetMultiFormatMode (true);
199  else if (::NTV2DeviceCanDoMultiFormat (mDeviceID))
200  mDevice.SetMultiFormatMode (false);
201 
202  // Beware -- some devices (e.g. Corvid1) can only output from FrameStore 2...
203  if ((mOutputChannel == NTV2_CHANNEL1) && (!::NTV2DeviceCanDoFrameStore1Display (mDeviceID)))
204  mOutputChannel = NTV2_CHANNEL2;
205  if (UWord (mOutputChannel) >= ::NTV2DeviceGetNumFrameStores (mDeviceID))
206  {
207  cerr << "## ERROR: Cannot use channel '" << mOutputChannel+1 << "' -- device only supports channel 1"
208  << (::NTV2DeviceGetNumFrameStores(mDeviceID) > 1 ? string(" thru ") + string(1, char(::NTV2DeviceGetNumFrameStores(mDeviceID)+'0')) : "") << endl;
209  return AJA_STATUS_UNSUPPORTED;
210  }
211 
212  // Set up the video and audio...
213  status = SetUpVideo ();
214  if (AJA_FAILURE (status))
215  return status;
216 
217  status = SetUpAudio ();
218  if (AJA_FAILURE (status))
219  return status;
220 
221  // Set up the circular buffers, and the test pattern buffers...
222  SetUpHostBuffers ();
223  status = SetUpTestPatternVideoBuffers ();
224  if (AJA_FAILURE (status))
225  return status;
226 
227  // Set up the device signal routing, and playout AutoCirculate...
229 
230  // Lastly, prepare my AJATimeCodeBurn instance...
231  const NTV2FormatDescriptor fd (mVideoFormat, mPixelFormat, NTV2_VANCMODE_OFF);
232  mTCBurner.RenderTimeCodeFont (CNTV2DemoCommon::GetAJAPixelFormat (mPixelFormat), fd.numPixels, fd.numLines);
233 
234  return AJA_STATUS_SUCCESS;
235 
236 } // Init
237 
238 
240 {
241  if (mVideoFormat == NTV2_FORMAT_UNKNOWN)
242  mDevice.GetVideoFormat (mVideoFormat, NTV2_CHANNEL1);
243 
244  if (!::NTV2DeviceCanDoVideoFormat (mDeviceID, mVideoFormat))
245  {cerr << "## ERROR: This device cannot handle '" << ::NTV2VideoFormatToString (mVideoFormat) << "'" << endl; return AJA_STATUS_UNSUPPORTED;}
246 
247  // Configure the device to handle the requested video format...
248  mDevice.SetVideoFormat (mVideoFormat, false, false, mOutputChannel);
249 
250  // Set the frame buffer pixel format for all the channels on the device.
251  // If the device doesn't support it, fall back to 8-bit YCbCr...
252  if (!::NTV2DeviceCanDoFrameBufferFormat (mDeviceID, mPixelFormat))
253  {
254  cerr << "## NOTE: Device cannot handle '" << ::NTV2FrameBufferFormatString (mPixelFormat) << "' -- using '"
255  << ::NTV2FrameBufferFormatString (NTV2_FBF_8BIT_YCBCR) << "' instead" << endl;
256  mPixelFormat = NTV2_FBF_8BIT_YCBCR;
257  }
258 
259  mDevice.SetFrameBufferFormat (mOutputChannel, mPixelFormat);
260  if (NTV2DeviceCanDo2110(mDeviceID))
261  {
263  }
264  else
265  {
267  }
268  mDevice.EnableChannel (mOutputChannel);
269 
270  mDevice.SetEnableVANCData (false);
271 
272  // Subscribe the output interrupt -- it's enabled by default...
273  mDevice.SubscribeOutputVerticalEvent (mOutputChannel);
274 
275  return AJA_STATUS_SUCCESS;
276 
277 } // SetUpVideo
278 
279 
281 {
282  const uint16_t numberOfAudioChannels (8);
283 
284  // Use NTV2_AUDIOSYSTEM_1, unless the device has more than one audio system...
285  if (::NTV2DeviceGetNumAudioSystems (mDeviceID) > 1)
286  mAudioSystem = ::NTV2ChannelToAudioSystem (mOutputChannel); // ...and base it on the channel
287 
288  mDevice.SetNumberAudioChannels (numberOfAudioChannels, mAudioSystem);
289  mDevice.SetAudioRate (mAudioRate, mAudioSystem);
290 
291  // How big should the on-device audio buffer be? 1MB? 2MB? 4MB? 8MB?
292  // For this demo, 4MB will work best across all platforms (Windows, Mac & Linux)...
293  mDevice.SetAudioBufferSize (NTV2_AUDIO_BUFFER_BIG, mAudioSystem);
294 
295  // Set the SDI output audio embedders to embed audio samples from the output of mAudioSystem...
296  mDevice.SetHDMIOutAudioSource2Channel (NTV2_AudioChannel1_2, mAudioSystem);
297 
298  mDevice.SetHDMIOutAudioRate(mAudioRate);
299 
301 
302  // If the last app using the device left it in end-to-end mode (input passthru),
303  // then loopback must be disabled, or else the output will contain whatever audio
304  // is present in whatever signal is feeding the device's SDI input...
305  mDevice.SetAudioLoopBack (NTV2_AUDIO_LOOPBACK_OFF, mAudioSystem);
306 
307  return AJA_STATUS_SUCCESS;
308 
309 } // SetUpAudio
310 
311 
313 {
314  // Let my circular buffer know when it's time to quit...
315  mAVCircularBuffer.SetAbortFlag (&mGlobalQuit);
316 
317  // Calculate the size of the video buffer, which depends on video format, pixel format, and whether VANC is included or not...
318  mVideoBufferSize = GetVideoWriteSize (mVideoFormat, mPixelFormat);
319 
320  // Calculate the size of the audio buffer, which mostly depends on the sample rate...
321  mAudioBufferSize = (mAudioRate == NTV2_AUDIO_192K) ? AUDIOBYTES_MAX_192K : AUDIOBYTES_MAX_48K;
322 
323  // Allocate my buffers...
324  for (size_t ndx(0); ndx < CIRCULAR_BUFFER_SIZE; ndx++)
325  {
326  mAVHostBuffer [ndx].fVideoBuffer = reinterpret_cast <uint32_t *> (new uint8_t [mVideoBufferSize]);
327  mAVHostBuffer [ndx].fVideoBufferSize = mVideoBufferSize;
328  mAVHostBuffer [ndx].fAudioBuffer = mWithAudio ? reinterpret_cast<uint32_t*>(new uint8_t[mAudioBufferSize]) : AJA_NULL;
329  mAVHostBuffer [ndx].fAudioBufferSize = mWithAudio ? mAudioBufferSize : 0;
330 
331  ::memset (mAVHostBuffer [ndx].fVideoBuffer, 0x00, mVideoBufferSize);
332  ::memset (mAVHostBuffer [ndx].fAudioBuffer, 0x00, mWithAudio ? mAudioBufferSize : 0);
333 
334  mAVCircularBuffer.Add (&mAVHostBuffer [ndx]);
335  } // for each AV buffer in my circular buffer
336 
337  if (mDolbyFile != NULL)
338  {
339  // Initialize IEC61937 burst size (32 milliseconds) for HDMI 192 kHz sample rate
340  mBurstSamples = 6144; // 192000 * 0.032 samples
341  mBurstMax = mBurstSamples * 2;
342  mBurstBuffer = new uint16_t [mBurstMax];
343  mDolbyBuffer = new uint16_t [mBurstMax];
344  }
345 
346 } // SetUpHostBuffers
347 
348 
350 {
351  bool isRGB (::IsRGBFormat (mPixelFormat));
352 
353  const NTV2OutputCrosspointID fsVidOutXpt (::GetFrameBufferOutputXptFromChannel (mOutputChannel, isRGB/*isRGB*/, false/*is425*/));
354 
355  mDevice.ClearRouting(); // Start with clean slate
356 
357  // And connect HDMI video output
358  mDevice.Connect (::GetOutputDestInputXpt (NTV2_OUTPUTDESTINATION_HDMI), fsVidOutXpt);
359 
360 } // RouteOutputSignal
361 
362 
364 {
365  // Start my consumer and producer threads...
368 
369  return AJA_STATUS_SUCCESS;
370 
371 } // Run
372 
373 
374 
376 // This is where the play thread starts
377 
379 {
380  // Create and start the playout thread...
381  mConsumerThread = new AJAThread ();
382  mConsumerThread->Attach (ConsumerThreadStatic, this);
383  mConsumerThread->SetPriority (AJA_ThreadPriority_High);
384  mConsumerThread->Start ();
385 
386 } // StartConsumerThread
387 
388 
389 // The playout thread function
390 void NTV2DolbyPlayer::ConsumerThreadStatic (AJAThread * pThread, void * pContext) // static
391 {
392  (void) pThread;
393 
394  // Grab the NTV2DolbyPlayer instance pointer from the pContext parameter,
395  // then call its PlayFrames method...
396  NTV2DolbyPlayer * pApp (reinterpret_cast <NTV2DolbyPlayer *> (pContext));
397  if (pApp)
398  pApp->PlayFrames ();
399 
400 } // ConsumerThreadStatic
401 
402 
404 {
405  ULWord acOpts (AUTOCIRCULATE_WITH_RP188); // Add timecode
406  const bool isInterlace (!NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(mVideoFormat));
407  const bool isPAL (NTV2_IS_PAL_VIDEO_FORMAT(mVideoFormat));
408  AUTOCIRCULATE_TRANSFER xferInfo;
409 
410  PLNOTE("Thread started");
411  mDevice.AutoCirculateStop (mOutputChannel);
412  mDevice.AutoCirculateInitForOutput (mOutputChannel, 7, // 7 frame cushion sufficient for all devices & FBFs
413  mWithAudio ? mAudioSystem : NTV2_AUDIOSYSTEM_INVALID, // Which audio system?
414  acOpts);
415 
416  mDevice.AutoCirculateStart(mOutputChannel); // Start it running
417 
418  while (!mGlobalQuit)
419  {
420  AUTOCIRCULATE_STATUS outputStatus;
421  mDevice.AutoCirculateGetStatus (mOutputChannel, outputStatus);
422 
423  // Check if there's room for another frame on the card...
424  if (outputStatus.GetNumAvailableOutputFrames() > 1)
425  {
426  // Wait for the next frame to become ready to "consume"...
427  AVDataBuffer * playData (mAVCircularBuffer.StartConsumeNextBuffer ());
428  if (playData)
429  {
430  // Include timecode in output signal...
431  NTV2TimeCodes tcMap;
432  const NTV2_RP188 tcF1 (playData->fRP188Data);
433  NTV2_RP188 tcF2 (tcF1);
434  if (isInterlace)
435  { // Set bit 27 of Hi word (PAL) or Lo word (NTSC)
436  if (isPAL) tcF2.fHi |= BIT(27); else tcF2.fLo |= BIT(27);
437  }
438  TCDBG("Playing " << tcF1);
439 
440  // Transfer the timecode-burned frame to the device for playout...
441  xferInfo.SetVideoBuffer (playData->fVideoBuffer, playData->fVideoBufferSize);
442  xferInfo.SetAudioBuffer (mWithAudio ? playData->fAudioBuffer : AJA_NULL, mWithAudio ? playData->fAudioBufferSize : 0);
443  mDevice.AutoCirculateTransfer (mOutputChannel, xferInfo);
444  mAVCircularBuffer.EndConsumeNextBuffer(); // Signal that the frame has been "consumed"
445  }
446  }
447  else
448  mDevice.WaitForOutputVerticalInterrupt(mOutputChannel);
449  } // loop til quit signaled
450 
451  // Stop AutoCirculate...
452  mDevice.AutoCirculateStop(mOutputChannel);
453  //delete [] fAncBuffer;
454  PLNOTE("Thread completed, will exit");
455 
456 } // PlayFrames
457 
458 
459 
461 // This is where the producer thread starts
462 
464 {
465  // Create and start the producer thread...
466  mProducerThread = new AJAThread ();
467  mProducerThread->Attach (ProducerThreadStatic, this);
468  mProducerThread->SetPriority (AJA_ThreadPriority_High);
469  mProducerThread->Start ();
470 
471 } // StartProducerThread
472 
473 
474 void NTV2DolbyPlayer::ProducerThreadStatic (AJAThread * pThread, void * pContext) // static
475 {
476  (void) pThread;
477 
478  NTV2DolbyPlayer * pApp (reinterpret_cast <NTV2DolbyPlayer *> (pContext));
479  if (pApp)
480  pApp->ProduceFrames ();
481 
482 } // ProducerThreadStatic
483 
484 
486 {
487  NTV2TestPatternSelect testPatternTypes [] = {NTV2_TestPatt_ColorBars100,
495 
496  mNumTestPatterns = sizeof (testPatternTypes) / sizeof (NTV2TestPatternSelect);
497  mTestPatternVideoBuffers = new uint8_t * [mNumTestPatterns];
498  ::memset (mTestPatternVideoBuffers, 0, mNumTestPatterns * sizeof(uint8_t *));
499 
500  // Set up one video buffer for each of the several predefined patterns...
501  for (uint32_t testPatternIndex(0); testPatternIndex < mNumTestPatterns; testPatternIndex++)
502  {
503  // Allocate the buffer memory...
504  mTestPatternVideoBuffers [testPatternIndex] = new uint8_t[mVideoBufferSize];
505 
506  // Use the test pattern generator to fill an NTV2TestPatternBuffer...
507  NTV2TestPatternGen testPatternGen;
508  NTV2FormatDescriptor formatDesc (mVideoFormat, mPixelFormat);
509  NTV2Buffer vidBuffer (mTestPatternVideoBuffers [testPatternIndex], mVideoBufferSize);
510 
511  if (!testPatternGen.DrawTestPattern (testPatternTypes[testPatternIndex], formatDesc, vidBuffer))
512  {
513  cerr << "## ERROR: DrawTestPattern failed, formatDesc: " << formatDesc << endl;
514  return AJA_STATUS_FAIL;
515  }
516 
517  } // for each test pattern
518 
519  return AJA_STATUS_SUCCESS;
520 
521 } // SetUpTestPatternVideoBuffers
522 
523 
524 static const double gFrequencies [] = {250.0, 500.0, 1000.0, 2000.0};
525 static const ULWord gNumFrequencies (sizeof (gFrequencies) / sizeof (double));
526 static const double gAmplitudes [] = { 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85,
527  0.85, 0.80, 0.75, 0.70, 0.65, 0.60, 0.55, 0.50, 0.45, 0.40, 0.35, 0.30, 0.25, 0.20, 0.15, 0.10};
528 
529 
531 {
532  ULWord frequencyIndex (0);
533  double timeOfLastSwitch (0.0);
534  ULWord testPatternIndex (0);
535 
538 
539  PLNOTE("Thread started");
540  while (!mGlobalQuit)
541  {
542  AVDataBuffer * frameData (mAVCircularBuffer.StartProduceNextBuffer ());
543 
544  // If no frame is available, wait and try again
545  if (!frameData)
546  {
547  AJATime::Sleep (10);
548  continue;
549  }
550 
551  // Copy my pre-made test pattern into my video buffer...
552  ::memcpy (frameData->fVideoBuffer, mTestPatternVideoBuffers [testPatternIndex], mVideoBufferSize);
553 
554  const NTV2FrameRate ntv2FrameRate (::GetNTV2FrameRateFromVideoFormat (mVideoFormat));
555  const TimecodeFormat tcFormat (CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat (ntv2FrameRate));
556  const CRP188 rp188Info (mCurrentFrame++, 0, 0, 10, tcFormat);
557  string timeCodeString;
558 
559  rp188Info.GetRP188Reg (frameData->fRP188Data);
560  rp188Info.GetRP188Str (timeCodeString);
561 
562  // Burn the current timecode into the test pattern image that's now in my video buffer...
563  mTCBurner.BurnTimeCode (reinterpret_cast <char *> (frameData->fVideoBuffer), timeCodeString.c_str (), 80);
564  TCDBG("F" << DEC0N(mCurrentFrame-1,6) << ": " << NTV2_RP188(frameData->fRP188Data) << ": " << timeCodeString);
565 
566  // Generate audio tone data...
567  if (mDolbyFile != NULL)
568  {
569  frameData->fAudioBufferSize = mWithAudio ? AddDolby(frameData->fAudioBuffer) : 0;
570  }
571  else
572  {
573  if (mDoRamp)
574  frameData->fAudioBufferSize = mWithAudio ? AddRamp(frameData->fAudioBuffer) : 0;
575  else
576  frameData->fAudioBufferSize = mWithAudio ? AddTone(frameData->fAudioBuffer) : 0;
577  }
578 
579  // Every few seconds, change the test pattern and tone frequency...
580  const double currentTime (timeBase.FramesToSeconds(mCurrentFrame));
581  if (currentTime > timeOfLastSwitch + 4.0)
582  {
583  frequencyIndex = (frequencyIndex + 1) % gNumFrequencies;
584  testPatternIndex = (testPatternIndex + 1) % mNumTestPatterns;
585  mToneFrequency = gFrequencies[frequencyIndex];
586  timeOfLastSwitch = currentTime;
587  PLINFO("F" << DEC0N(mCurrentFrame,6) << ": " << timeCodeString << ": tone=" << mToneFrequency
588  << "Hz, pattern='" << tpNames.at(testPatternIndex) << "'");
589  } // if time to switch test pattern & tone frequency
590 
591  // Signal that I'm done producing the buffer -- it's now available for playout...
592  mAVCircularBuffer.EndProduceNextBuffer ();
593 
594  } // loop til mGlobalQuit goes true
595  PLNOTE("Thread completed, will exit");
596 
597 } // ProduceFrames
598 
599 
600 void NTV2DolbyPlayer::GetACStatus (ULWord & outGoodFrames, ULWord & outDroppedFrames, ULWord & outBufferLevel)
601 {
602  AUTOCIRCULATE_STATUS status;
603  mDevice.AutoCirculateGetStatus (mOutputChannel, status);
604  outGoodFrames = status.acFramesProcessed;
605  outDroppedFrames = status.acFramesDropped;
606  outBufferLevel = status.acBufferLevel;
607 }
608 
609 
610 uint32_t NTV2DolbyPlayer::AddTone (ULWord * pInAudioBuffer)
611 {
614  ULWord numChannels (0);
615 
616  mDevice.GetFrameRate (frameRate, mOutputChannel);
617  mDevice.GetAudioRate (audioRate, mAudioSystem);
618  mDevice.GetNumberAudioChannels (numChannels, mAudioSystem);
619 
620  // Set per-channel tone frequencies...
621  double pFrequencies [kNumAudioChannelsMax];
622  pFrequencies [0] = (mToneFrequency / 2.0);
623  for (ULWord chan (1); chan < numChannels; chan++)
624  // The 1.154782 value is the 16th root of 10, to ensure that if mToneFrequency is 2000,
625  // that the calculated frequency of audio channel 16 will be 20kHz...
626  pFrequencies [chan] = pFrequencies [chan - 1] * 1.154782;
627 
628  // Because audio on AJA devices use fixed sample rates (typically 48KHz), certain video frame rates will necessarily
629  // result in some frames having more audio samples than others. The GetAudioSamplesPerFrame function
630  // is used to calculate the correct sample count...
631  const ULWord numSamples (::GetAudioSamplesPerFrame (frameRate, audioRate, mCurrentFrame));
632  const double sampleRateHertz (audioRate == NTV2_AUDIO_192K ? 192000.0 : 48000.0);
633 
634  return ::AddAudioTone ( pInAudioBuffer, // audio buffer to fill
635  mCurrentSample, // which sample for continuing the waveform
636  numSamples, // number of samples to generate
637  sampleRateHertz, // sample rate [Hz]
638  gAmplitudes, // per-channel amplitudes
639  pFrequencies, // per-channel tone frequencies [Hz]
640  31, // bits per sample
641  false, // don't byte swap
642  numChannels); // number of audio channels to generate
643 } // AddTone
644 
645 uint32_t NTV2DolbyPlayer::AddRamp (ULWord * pInAudioBuffer)
646 {
647  ULWord* audioBuffer (pInAudioBuffer);
650  ULWord numChannels (0);
651 
652  mDevice.GetFrameRate (frameRate, mOutputChannel);
653  mDevice.GetAudioRate (audioRate, mAudioSystem);
654  mDevice.GetNumberAudioChannels (numChannels, mAudioSystem);
655 
656  // Because audio on AJA devices use fixed sample rates (typically 48KHz), certain video frame rates will necessarily
657  // result in some frames having more audio samples than others. The GetAudioSamplesPerFrame function
658  // is used to calculate the correct sample count...
659  const ULWord numSamples (::GetAudioSamplesPerFrame (frameRate, audioRate, mCurrentFrame));
660 
661  for (uint32_t i = 0; i < numSamples; i++)
662  {
663  for (uint32_t j = 0; j < numChannels; j++)
664  {
665  *audioBuffer = ((uint32_t)mRampSample) << 16;
666  audioBuffer++;
667  mRampSample++;
668  }
669  }
670 
671  return numSamples * numChannels * 4;
672 } // AddRamp
673 
674 #ifdef DOLBY_FULL_PARSER
675 
676 uint32_t NTV2DolbyPlayer::AddDolby (ULWord * pInAudioBuffer)
677 {
680  ULWord numChannels (0);
681  ULWord sampleOffset(0);
682  ULWord sampleCount (0);
683  NTV2DolbyBSI bsi;
684 
685  mDevice.GetFrameRate (frameRate, mOutputChannel);
686  mDevice.GetAudioRate (audioRate, mAudioSystem);
687  mDevice.GetNumberAudioChannels (numChannels, mAudioSystem);
688  const ULWord numSamples (::GetAudioSamplesPerFrame (frameRate, audioRate, mCurrentFrame));
689 
690  if ((mDolbyFile == NULL) || (mDolbyBuffer == NULL))
691  goto silence;
692 
693  // Generate the samples for this frame
694  while (sampleOffset < numSamples)
695  {
696  if ((mBurstSize != 0) && (mBurstIndex < mBurstSamples))
697  {
698  if(mBurstOffset < mBurstSize)
699  {
700  uint32_t data0 = 0;
701  uint32_t data1 = 0;
702  if (mBurstIndex == 0)
703  {
704  // Add IEC61937 burst preamble
705  data0 = 0xf872; // Sync stuff
706  data1 = 0x4e1f;
707  }
708  else if (mBurstIndex == 1)
709  {
710  // Add more IEC61937 burst preamble
711  data0 = ((bsi.bsmod & 0x7) << 8) | 0x0015; // This is Dolby
712  data1 = mBurstSize * 2; // Data size in bytes
713  }
714  else
715  {
716  // Add sync frame data
717  data0 = (uint32_t)(mBurstBuffer[mBurstOffset]);
718  data0 = ((data0 & 0x00ff) << 8) | ((data0 & 0xff00) >> 8);
719  mBurstOffset++;
720  data1 = (uint32_t)(mBurstBuffer[mBurstOffset]);
721  data1 = ((data1 & 0x00ff) << 8) | ((data1 & 0xff00) >> 8);
722  mBurstOffset++;
723  }
724 
725  // Write data into 16 msbs of all audio channel pairs
726  data0 <<= 16;
727  data1 <<= 16;
728  for (ULWord i = 0; i < numChannels; i += 2)
729  {
730  pInAudioBuffer[sampleOffset * numChannels + i] = data0;
731  pInAudioBuffer[sampleOffset * numChannels + i + 1] = data1;
732  }
733  }
734  else
735  {
736  // Pad samples out to burst size
737  for (ULWord i = 0; i < numChannels; i++)
738  {
739  pInAudioBuffer[sampleOffset * numChannels + i] = 0;
740  }
741  }
742  sampleOffset++;
743  mBurstIndex++;
744  }
745  else
746  {
747  ULWord dolbyOffset = 0;
748  ULWord burstOffset = 0;
749  ULWord numBlocks = 0;
750 
751  mBurstIndex = 0;
752  mBurstOffset = 0;
753 
754  if (mDolbySize == 0)
755  {
756  // Find first Dolby Digital Plus burst frame
757  while (true)
758  {
759  if (!GetDolbyFrame(&mDolbyBuffer[0], sampleCount))
760  {
761  cerr << "## ERROR: Dolby frame not found" << endl;
762  mDolbyFile = NULL;
763  goto silence;
764  }
765 
766  if (!ParseBSI(&mDolbyBuffer[1], sampleCount - 1, &bsi))
767  continue;
768 
769  if ((bsi.strmtyp == 0) &&
770  (bsi.substreamid == 0) &&
771  (bsi.bsid == 16) &&
772  ((bsi.numblkscod == 3) || (bsi.convsync == 1)))
773  break;
774  }
775 
776  mDolbySize = sampleCount;
777  switch (bsi.numblkscod)
778  {
779  case 0: mDolbyBlocks = 1; break;
780  case 1: mDolbyBlocks = 2; break;
781  case 2: mDolbyBlocks = 3; break;
782  case 3: mDolbyBlocks = 6; break;
783  default: goto silence;
784  }
785  }
786 
787  while (numBlocks <= 6)
788  {
789  // Copy the Dolby frame into the burst buffer
790  while (dolbyOffset < mDolbySize)
791  {
792  // Check for burst size overrun
793  if (burstOffset >= mBurstMax)
794  {
795  cerr << "## ERROR: Dolby burst too large" << endl;
796  mDolbyFile = NULL;
797  goto silence;
798  }
799 
800  // Copy sample
801  mBurstBuffer[burstOffset] = mDolbyBuffer[dolbyOffset];
802  burstOffset++;
803  dolbyOffset++;
804  }
805 
806  // Get the next Dolby frame
807  if (!GetDolbyFrame(&mDolbyBuffer[0], sampleCount))
808  {
809  // try to loop
810  if (!GetDolbyFrame(&mDolbyBuffer[0], sampleCount))
811  {
812  cerr << "## ERROR: Dolby frame not found" << endl;
813  mDolbyFile = NULL;
814  goto silence;
815  }
816  }
817 
818  // Parse the Dolby bitstream header
819  if (!ParseBSI(&mDolbyBuffer[1], sampleCount - 1, &bsi))
820  continue;
821 
822  // Only Dolby Digital Plus
823  if (bsi.bsid != 16)
824  {
825  cerr << "## ERROR: Dolby frame bad bsid = " << bsi.bsid << endl;
826  continue;
827  }
828 
829  mDolbySize = sampleCount;
830  dolbyOffset = 0;
831 
832  // Increment block count on first substream
833  if ((bsi.strmtyp == 0) && (bsi.substreamid == 0))
834  {
835  // increment block count
836  numBlocks += mDolbyBlocks;
837 
838  switch (bsi.numblkscod)
839  {
840  case 0: mDolbyBlocks = 1; break;
841  case 1: mDolbyBlocks = 2; break;
842  case 2: mDolbyBlocks = 3; break;
843  case 3: mDolbyBlocks = 6; break;
844  default:
845  cerr << "## ERROR: Dolby frame bad numblkscod = " << bsi.numblkscod << endl;
846  goto silence;
847  }
848  }
849 
850  // Are we done?
851  if (numBlocks >= 6)
852  {
853  // First frame of new burst must have convsync == 1
854  if ((bsi.numblkscod != 3) &&
855  (bsi.convsync != 1))
856  {
857  cerr << "## ERROR: Dolby frame unexpected convsync = " << bsi.convsync << endl;
858  mDolbySize = 0;
859  mDolbyBlocks = 0;
860  }
861 
862  // Keep the burst size
863  mBurstSize = burstOffset;
864  break;
865  }
866  }
867  }
868  }
869 
870  return numSamples * numChannels * 4;
871 
872 silence:
873  // Output silence when done with file
874  memset(&pInAudioBuffer[sampleOffset * numChannels], 0, (numSamples - sampleOffset) * numChannels * 4);
875  return numSamples * numChannels * 4;
876 }
877 
878 
879 bool NTV2DolbyPlayer::GetDolbyFrame (uint16_t * pInDolbyBuffer, uint32_t & numSamples)
880 {
881  uint32_t bytes;
882  bool done = false;
883 
884  while (!done)
885  {
886  bytes = mDolbyFile->Read((uint8_t*)(&pInDolbyBuffer[0]), 2);
887  if (bytes != 2)
888  {
889  // Reset file
890  mDolbyFile->Seek(0, eAJASeekSet);
891  return false;
892  }
893 
894  // Check sync word
895  if ((mDolbyBuffer[0] == 0x7705) ||
896  (mDolbyBuffer[0] == 0x770b))
897  done = true;
898  }
899 
900  // Read more of the sync frame header
901  bytes = mDolbyFile->Read((uint8_t*)(&pInDolbyBuffer[1]), 4);
902  if (bytes != 4)
903  return false;
904 
905  // Get frame size - 16 bit words plus sync word
906  uint32_t size = (uint32_t)mDolbyBuffer[1];
907  size = (((size & 0x00ff) << 8) | ((size & 0xff00) >> 8));
908  size = (size & 0x7ff) + 1;
909 
910  // Read the rest of the sync frame
911  uint32_t len = (size - 3) * 2;
912  bytes = mDolbyFile->Read((uint8_t*)(&pInDolbyBuffer[3]), len);
913  if (bytes != len)
914  return false;
915 
916  numSamples = size;
917 
918  return true;
919 }
920 
921 
922 bool NTV2DolbyPlayer::ParseBSI(uint16_t * pInDolbyBuffer, uint32_t numSamples, NTV2DolbyBSI * pBsi)
923 {
924  if ((pInDolbyBuffer == NULL) || (pBsi == NULL))
925  return false;
926 
927  memset(pBsi, 0, sizeof(NTV2DolbyBSI));
928 
929  SetBitBuffer((uint8_t*)pInDolbyBuffer, numSamples * 2);
930 
931  if (!GetBits(pBsi->strmtyp, 2)) return false;
932  if (!GetBits(pBsi->substreamid, 3)) return false;
933  if (!GetBits(pBsi->frmsiz, 11)) return false;
934  if (!GetBits(pBsi->fscod, 2)) return false;
935  if (!GetBits(pBsi->numblkscod, 2)) return false;
936  if (!GetBits(pBsi->acmod, 3)) return false;
937  if (!GetBits(pBsi->lfeon, 1)) return false;
938  if (!GetBits(pBsi->bsid, 5)) return false;
939  if (!GetBits(pBsi->dialnorm, 5)) return false;
940  if (!GetBits(pBsi->compre, 1)) return false;
941  if (pBsi->compre)
942  {
943  if (!GetBits(pBsi->compr, 8)) return false;
944  }
945  if (pBsi->acmod == 0x0) /* if 1+1 mode (dual mono, so some items need a second value) */
946  {
947  if (!GetBits(pBsi->dialnorm2, 5)) return false;
948  if (!GetBits(pBsi->compr2e, 1)) return false;
949  if (pBsi->compr2e)
950  {
951  if (!GetBits(pBsi->compr2, 8)) return false;
952  }
953  }
954  if (pBsi->strmtyp == 0x1) /* if dependent stream */
955  {
956  if (!GetBits(pBsi->chanmape, 1)) return false;
957  if (pBsi->chanmape)
958  {
959  if (!GetBits(pBsi->chanmap, 16)) return false;
960  }
961  }
962  if (!GetBits(pBsi->mixmdate, 1)) return false;
963  if (pBsi->mixmdate) /* mixing metadata */
964  {
965  if (pBsi->acmod > 0x2) /* if more than 2 channels */
966  {
967  if (!GetBits(pBsi->dmixmod, 2)) return false;
968  }
969  if ((pBsi->acmod & 0x1) && (pBsi->acmod > 0x2)) /* if three front channels exist */
970  {
971  if (!GetBits(pBsi->ltrtcmixlev, 3)) return false;
972  if (!GetBits(pBsi->lorocmixlev, 3)) return false;
973  }
974  if (pBsi->acmod & 0x4) /* if a surround channel exists */
975  {
976  if (!GetBits(pBsi->ltrtsurmixlev, 3)) return false;
977  if (!GetBits(pBsi->lorosurmixlev, 3)) return false;
978  }
979  if (pBsi->lfeon) /* if the LFE channel exists */
980  {
981  if (!GetBits(pBsi->lfemixlevcode, 1)) return false;
982  if (pBsi->lfemixlevcode)
983  {
984  if (!GetBits(pBsi->lfemixlevcod, 5)) return false;
985  }
986  }
987  if (pBsi->strmtyp == 0x0) /* if independent stream */
988  {
989  if (!GetBits(pBsi->pgmscle, 1)) return false;
990  if (pBsi->pgmscle)
991  {
992  if (!GetBits(pBsi->pgmscl, 6)) return false;
993  }
994  if (pBsi->acmod == 0x0) /* if 1+1 mode (dual mono, so some items need a second value) */
995  {
996  if (!GetBits(pBsi->pgmscl2e, 1)) return false;
997  if (pBsi->pgmscl2e)
998  {
999  if (!GetBits(pBsi->pgmscl2, 6)) return false;
1000  }
1001  }
1002  if (!GetBits(pBsi->extpgmscle, 1)) return false;
1003  if (pBsi->extpgmscle)
1004  {
1005  if (!GetBits(pBsi->extpgmscl, 6)) return false;
1006  }
1007  if (!GetBits(pBsi->mixdef, 2)) return false;
1008  if (pBsi->mixdef == 0x1) /* mixing option 2 */
1009  {
1010  if (!GetBits(pBsi->premixcmpsel, 1)) return false;
1011  if (!GetBits(pBsi->drcsrc, 1)) return false;
1012  if (!GetBits(pBsi->premixcmpscl, 3)) return false;
1013  }
1014  else if (pBsi->mixdef == 0x2) /* mixing option 3 */
1015  {
1016  if (!GetBits(pBsi->mixdata, 12)) return false;
1017  }
1018  else if (pBsi->mixdef == 0x3) /* mixing option 4 */
1019  {
1020  if (!GetBits(pBsi->mixdeflen, 5)) return false;
1021  if (!GetBits(pBsi->mixdata2e, 1)) return false;
1022  if (pBsi->mixdata2e)
1023  {
1024  if (!GetBits(pBsi->premixcmpsel, 1)) return false;
1025  if (!GetBits(pBsi->drcsrc, 1)) return false;
1026  if (!GetBits(pBsi->premixcmpscl, 3)) return false;
1027  if (!GetBits(pBsi->extpgmlscle, 1)) return false;
1028  if (pBsi->extpgmlscle)
1029  {
1030  if (!GetBits(pBsi->extpgmlscl, 4)) return false;
1031  }
1032  if (!GetBits(pBsi->extpgmcscle, 1)) return false;
1033  if (pBsi->extpgmcscle)
1034  {
1035  if (!GetBits(pBsi->extpgmcscl, 4)) return false;
1036  }
1037  if (!GetBits(pBsi->extpgmrscle, 1)) return false;
1038  if (pBsi->extpgmrscle)
1039  {
1040  if (!GetBits(pBsi->extpgmrscl, 4)) return false;
1041  }
1042  if (!GetBits(pBsi->extpgmlsscle, 1)) return false;
1043  if (pBsi->extpgmlsscle)
1044  {
1045  if (!GetBits(pBsi->extpgmlsscl, 4)) return false;
1046  }
1047  if (!GetBits(pBsi->extpgmrsscle, 1)) return false;
1048  if (pBsi->extpgmrsscle)
1049  {
1050  if (!GetBits(pBsi->extpgmrsscl, 4)) return false;
1051  }
1052  if (!GetBits(pBsi->extpgmlfescle, 1)) return false;
1053  if (pBsi->extpgmlfescle)
1054  {
1055  if (!GetBits(pBsi->extpgmlfescl, 4)) return false;
1056  }
1057  if (!GetBits(pBsi->dmixscle, 1)) return false;
1058  if (pBsi->dmixscle)
1059  {
1060  if (!GetBits(pBsi->dmixscl, 4)) return false;
1061  }
1062  if (!GetBits(pBsi->addche, 1)) return false;
1063  if (pBsi->addche)
1064  {
1065  if (!GetBits(pBsi->extpgmaux1scle, 1)) return false;
1066  if (pBsi->extpgmaux1scle)
1067  {
1068  if (!GetBits(pBsi->extpgmaux1scl, 4)) return false;
1069  }
1070  if (!GetBits(pBsi->extpgmaux2scle, 1)) return false;
1071  if (pBsi->extpgmaux2scle)
1072  {
1073  if (!GetBits(pBsi->extpgmaux2scl, 4)) return false;
1074  }
1075  }
1076  }
1077  if (!GetBits(pBsi->mixdata3e, 1)) return false;
1078  if (pBsi->mixdata3e)
1079  {
1080  if (!GetBits(pBsi->spchdat, 5)) return false;
1081  if (!GetBits(pBsi->addspchdate, 1)) return false;
1082  if (pBsi->addspchdate)
1083  {
1084  if (!GetBits(pBsi->spchdat1, 5)) return false;
1085  if (!GetBits(pBsi->spchan1att, 2)) return false;
1086  if (!GetBits(pBsi->addspchdat1e, 1)) return false;
1087  if (pBsi->addspdat1e)
1088  {
1089  if (!GetBits(pBsi->spchdat2, 5)) return false;
1090  if (!GetBits(pBsi->spchan2att, 3)) return false;
1091  }
1092  }
1093  }
1094  {
1095  uint32_t data;
1096  uint32_t size = 8 * (pBsi->mixdeflen + 2);
1097  size = (size + 7) / 8 * 8;
1098  uint32_t index = 0;
1099  while (size > 0)
1100  {
1101  if (!GetBits(data, (size > 8)? 8 : size)) return false;
1102  pBsi->mixdatabuffer[index++] = (uint8_t)data;
1103  size = size - 8;
1104  }
1105  }
1106  }
1107  if (pBsi->acmod < 0x2) /* if mono or dual mono source */
1108  {
1109  if (!GetBits(pBsi->paninfoe, 1)) return false;
1110  if (pBsi->paninfoe)
1111  {
1112  if (!GetBits(pBsi->panmean, 8)) return false;
1113  if (!GetBits(pBsi->paninfo, 6)) return false;
1114  }
1115  if (pBsi->acmod == 0x0) /* if 1+1 mode (dual mono - some items need a second value) */
1116  {
1117  if (!GetBits(pBsi->paninfo2e, 1)) return false;
1118  if (pBsi->paninfo2e)
1119  {
1120  if (!GetBits(pBsi->panmean2, 8)) return false;
1121  if (!GetBits(pBsi->paninfo2, 6)) return false;
1122  }
1123  }
1124  }
1125  if (!GetBits(pBsi->frmmixcfginfoe, 1)) return false;
1126  if (pBsi->frmmixcfginfoe) /* mixing configuration information */
1127  {
1128  if (pBsi->numblkscod == 0x0)
1129  {
1130  if (!GetBits(pBsi->blkmixcfginfo[0], 5)) return false;
1131  }
1132  else
1133  {
1134  uint32_t blk;
1135  uint32_t numblk;
1136  if (pBsi->numblkscod == 0x1)
1137  numblk = 2;
1138  else if (pBsi->numblkscod == 0x2)
1139  numblk = 3;
1140  else if (pBsi->numblkscod == 0x3)
1141  numblk = 6;
1142  else
1143  return false;
1144  for(blk = 0; blk < numblk; blk++)
1145  {
1146  if (!GetBits(pBsi->blkmixcfginfoe, 1)) return false;
1147  if (pBsi->blkmixcfginfoe)
1148  {
1149  if (!GetBits(pBsi->blkmixcfginfo[blk], 5)) return false;
1150  }
1151  }
1152  }
1153  }
1154  }
1155  }
1156  if (!GetBits(pBsi->infomdate, 1)) return false;
1157  if (pBsi->infomdate) /* informational metadata */
1158  {
1159  if (!GetBits(pBsi->bsmod, 3)) return false;
1160  if (!GetBits(pBsi->copyrightb, 1)) return false;
1161  if (!GetBits(pBsi->origbs, 1)) return false;
1162  if (pBsi->acmod == 0x2) /* if in 2/0 mode */
1163  {
1164  if (!GetBits(pBsi->dsurmod, 2)) return false;
1165  if (!GetBits(pBsi->dheadphonmod, 2)) return false;
1166  }
1167  if (pBsi->acmod >= 0x6) /* if both surround channels exist */
1168  {
1169  if (!GetBits(pBsi->dsurexmod, 2)) return false;
1170  }
1171  if (!GetBits(pBsi->audprodie, 1)) return false;
1172  if (pBsi->audprodie)
1173  {
1174  if (!GetBits(pBsi->mixlevel, 5)) return false;
1175  if (!GetBits(pBsi->roomtyp, 2)) return false;
1176  if (!GetBits(pBsi->adconvtyp, 1)) return false;
1177  }
1178  if (pBsi->acmod == 0x0) /* if 1+1 mode (dual mono, so some items need a second value) */
1179  {
1180  if (!GetBits(pBsi->audprodi2e, 1)) return false;
1181  if (pBsi->audprodi2e)
1182  {
1183  if (!GetBits(pBsi->mixlevel2, 5)) return false;
1184  if (!GetBits(pBsi->roomtyp2, 2)) return false;
1185  if (!GetBits(pBsi->adconvtyp2, 1)) return false;
1186  }
1187  }
1188  if (pBsi->fscod < 0x3) /* if not half sample rate */
1189  {
1190  if (!GetBits(pBsi->sourcefscod, 1)) return false;
1191  }
1192  }
1193  if ((pBsi->strmtyp == 0x0) && (pBsi->numblkscod != 0x3))
1194  {
1195  if (!GetBits(pBsi->convsync, 1)) return false;
1196  }
1197  if (pBsi->strmtyp == 0x2) /* if bit stream converted from AC-3 */
1198  {
1199  if (pBsi->numblkscod == 0x3) /* 6 blocks per syncframe */
1200  {
1201  pBsi->blkid = 1;
1202  }
1203  else
1204  {
1205  if (!GetBits(pBsi->blkid, 1)) return false;
1206  }
1207  if (pBsi->blkid)
1208  {
1209  if (!GetBits(pBsi->frmsizecod, 6)) return false;
1210  }
1211  }
1212  if (!GetBits(pBsi->addbsie, 1)) return false;
1213  if (pBsi->addbsie)
1214  {
1215  if (!GetBits(pBsi->addbsil, 6)) return false;
1216  {
1217  uint32_t data;
1218  uint32_t size = 8 * (pBsi->addbsil + 1);
1219  uint32_t index = 0;
1220  while (size > 0)
1221  {
1222  if (!GetBits(data, 8)) return false;
1223  pBsi->addbsibuffer[index++] = (uint8_t)data;
1224  size = size - 8;
1225  }
1226  }
1227  }
1228 
1229  return true;
1230 }
1231 
1232 void NTV2DolbyPlayer::SetBitBuffer(uint8_t * pBuffer, uint32_t size)
1233 {
1234  mBitBuffer = pBuffer;
1235  mBitSize = size;
1236  mBitIndex = 8;
1237 }
1238 
1239 bool NTV2DolbyPlayer::GetBits(uint32_t & data, uint32_t bits)
1240 {
1241  uint32_t cb;
1242  static uint8_t bitMask[] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
1243 
1244  data = 0;
1245  while (bits > 0)
1246  {
1247  if (mBitSize == 0)
1248  return false;
1249 
1250  if (mBitIndex == 0)
1251  {
1252  mBitBuffer++;
1253  mBitSize--;
1254  mBitIndex = 8;
1255  }
1256 
1257  cb = bits;
1258  if (cb > mBitIndex)
1259  cb = mBitIndex;
1260  bits -= cb;
1261  mBitIndex -= cb;
1262  data |= ((*mBitBuffer >> mBitIndex) & bitMask[cb]) << bits;
1263  }
1264 
1265  return true;
1266 }
1267 
1268 #else
1269 
1270 uint32_t NTV2DolbyPlayer::AddDolby (ULWord * pInAudioBuffer)
1271 {
1274  ULWord numChannels (0);
1275  ULWord sampleOffset(0);
1276 
1277  mDevice.GetFrameRate (frameRate, mOutputChannel);
1278  mDevice.GetAudioRate (audioRate, mAudioSystem);
1279  mDevice.GetNumberAudioChannels (numChannels, mAudioSystem);
1280  const ULWord numSamples (::GetAudioSamplesPerFrame (frameRate, audioRate, mCurrentFrame));
1281 
1282  if ((mDolbyFile == NULL) || (mDolbyBuffer == NULL))
1283  goto silence;
1284 
1285  // Generate the samples for this frame
1286  while (sampleOffset < numSamples)
1287  {
1288  // Time for a new IEC61937 burst
1289  if (mBurstIndex >= mBurstSamples)
1290  mBurstIndex = 0;
1291 
1292  // Get a new Dolby Digital Plus sync frame
1293  if (mBurstIndex == 0)
1294  {
1295  // Read the sync word (all big endian)
1296  uint32_t bytes = mDolbyFile->Read((uint8_t*)(&mDolbyBuffer[0]), 2);
1297  if (bytes != 2)
1298  {
1299  // Try to loop
1300  mDolbyFile->Seek(0, eAJASeekSet);
1301  bytes = mDolbyFile->Read((uint8_t*)(&mDolbyBuffer[0]), 2);
1302  if (bytes != 2)
1303  goto silence;
1304  }
1305 
1306  // Check sync word
1307  if ((mDolbyBuffer[0] != 0x7705) &&
1308  (mDolbyBuffer[0] != 0x770b))
1309  goto silence;
1310 
1311  // Read more of the sync frame header
1312  bytes = mDolbyFile->Read((uint8_t*)(&mDolbyBuffer[1]), 4);
1313  if (bytes != 4)
1314  goto silence;
1315 
1316  // Get frame size - 16 bit words plus sync word
1317  uint32_t size = (uint32_t)mDolbyBuffer[1];
1318  size = (((size & 0x00ff) << 8) | ((size & 0xff00) >> 8)) + 1;
1319 
1320  // Read the rest of the sync frame
1321  uint32_t len = (size - 3) * 2;
1322  bytes = mDolbyFile->Read((uint8_t*)(&mDolbyBuffer[3]), len);
1323  if (bytes != len)
1324  goto silence;
1325 
1326  // Good frame
1327  mBurstOffset = 0;
1328  mBurstSize = size;
1329  }
1330 
1331  // Add the Dolby data to the audio stream
1332  if (mBurstOffset < mBurstSize)
1333  {
1334  uint32_t data0 = 0;
1335  uint32_t data1 = 0;
1336  if (mBurstIndex == 0)
1337  {
1338  // Add IEC61937 burst preamble
1339  data0 = 0xf872; // Sync stuff
1340  data1 = 0x4e1f;
1341  }
1342  else if (mBurstIndex == 1)
1343  {
1344  // Add more IEC61937 burst preamble
1345  data0 = 0x0015; // This is Dolby
1346  data1 = mBurstSize * 2; // Data size in bytes
1347  }
1348  else
1349  {
1350  // Add sync frame data
1351  data0 = (uint32_t)(mDolbyBuffer[mBurstOffset]);
1352  data0 = ((data0 & 0x00ff) << 8) | ((data0 & 0xff00) >> 8);
1353  mBurstOffset++;
1354  data1 = (uint32_t)(mDolbyBuffer[mBurstOffset]);
1355  data1 = ((data1 & 0x00ff) << 8) | ((data1 & 0xff00) >> 8);
1356  mBurstOffset++;
1357  }
1358 
1359  // Write data into 16 msbs of all audio channel pairs
1360  data0 <<= 16;
1361  data1 <<= 16;
1362  for (ULWord i = 0; i < numChannels; i += 2)
1363  {
1364  pInAudioBuffer[sampleOffset * numChannels + i] = data0;
1365  pInAudioBuffer[sampleOffset * numChannels + i + 1] = data1;
1366  }
1367  }
1368  else
1369  {
1370  // Pad samples out to burst size
1371  for (ULWord i = 0; i < numChannels; i++)
1372  {
1373  pInAudioBuffer[sampleOffset * numChannels + i] = 0;
1374  }
1375  }
1376 
1377  sampleOffset++;
1378  mBurstIndex++;
1379  }
1380 
1381  return numSamples * numChannels * 4;
1382 
1383 silence:
1384  // Output silence when done with file
1385  memset(&pInAudioBuffer[sampleOffset * numChannels], 0, (numSamples - sampleOffset) * numChannels * 4);
1386  return numSamples * numChannels * 4;
1387 }
1388 
1389 #endif
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::SubscribeOutputVerticalEvent
virtual bool SubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Causes me to be notified when an output vertical blanking interrupt is generated for the given output...
Definition: ntv2subscriptions.cpp:25
NTV2DolbyPlayer::NTV2DolbyBSI::audprodie
uint32_t audprodie
Definition: ntv2dolbyplayer.h:173
NTV2DolbyPlayer::NTV2DolbyBSI::premixcmpscl
uint32_t premixcmpscl
Definition: ntv2dolbyplayer.h:124
NTV2DolbyPlayer::NTV2DolbyBSI::spchdat1
uint32_t spchdat1
Definition: ntv2dolbyplayer.h:150
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
NTV2DolbyPlayer::AddTone
virtual uint32_t AddTone(ULWord *audioBuffer)
Inserts audio tone (based on my current tone frequency) into the given audio buffer.
Definition: ntv2dolbyplayer.cpp:610
NTV2DolbyPlayer::NTV2DolbyBSI::bsid
uint32_t bsid
Definition: ntv2dolbyplayer.h:98
NTV2DolbyPlayer::~NTV2DolbyPlayer
virtual ~NTV2DolbyPlayer(void)
Definition: ntv2dolbyplayer.cpp:99
AUTOCIRCULATE_STATUS::acFramesProcessed
ULWord acFramesProcessed
Total number of frames successfully processed since CNTV2Card::AutoCirculateStart called.
Definition: ntv2publicinterface.h:7116
NTV2DolbyPlayer::SetUpTestPatternVideoBuffers
virtual AJAStatus SetUpTestPatternVideoBuffers(void)
Creates my test pattern buffers.
Definition: ntv2dolbyplayer.cpp:485
NTV2DolbyPlayer::NTV2DolbyBSI::audprodi2e
uint32_t audprodi2e
Definition: ntv2dolbyplayer.h:177
NTV2DolbyPlayer::NTV2DolbyBSI::chanmape
uint32_t chanmape
Definition: ntv2dolbyplayer.h:105
NTV2DolbyPlayer::NTV2DolbyBSI::mixdata3e
uint32_t mixdata3e
Definition: ntv2dolbyplayer.h:147
NTV2_AUDIO_LOOPBACK_OFF
@ NTV2_AUDIO_LOOPBACK_OFF
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:1971
NTV2DolbyPlayer::NTV2DolbyBSI::mixdata2e
uint32_t mixdata2e
Definition: ntv2dolbyplayer.h:127
NTV2_AUDIO_192K
@ NTV2_AUDIO_192K
Definition: ntv2enums.h:1877
NTV2_TestPatt_CheckField
@ NTV2_TestPatt_CheckField
Definition: ntv2testpatterngen.h:32
TCDBG
#define TCDBG(_expr_)
Definition: ntv2dolbyplayer.cpp:26
NTV2_REFERENCE_SFP1_PTP
@ NTV2_REFERENCE_SFP1_PTP
Specifies the PTP source on SFP 1.
Definition: ntv2enums.h:1413
NTV2_FOURCC
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
Definition: ntv2publicinterface.h:5413
NTV2DolbyPlayer::NTV2DolbyBSI::frmsiz
uint32_t frmsiz
Definition: ntv2dolbyplayer.h:93
NTV2DolbyPlayer::RouteOutputSignal
virtual void RouteOutputSignal(void)
Sets up device routing for playout.
Definition: ntv2dolbyplayer.cpp:349
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or Frame Store 2 (or the 2nd item).
Definition: ntv2enums.h:1308
AJA_ThreadPriority_High
@ AJA_ThreadPriority_High
Definition: thread.h:44
AJATimeCodeBurn::RenderTimeCodeFont
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
Definition: timecodeburn.cpp:447
AVDataBuffer::fRP188Data
RP188_STRUCT fRP188Data
For future use.
Definition: ntv2democommon.h:68
NTV2DolbyPlayer::NTV2DolbyBSI::addspdat1e
uint32_t addspdat1e
Definition: ntv2dolbyplayer.h:153
NTV2_TestPatt_MultiBurst
@ NTV2_TestPatt_MultiBurst
Definition: ntv2testpatterngen.h:30
NTV2_AUDIO_BUFFER_BIG
@ NTV2_AUDIO_BUFFER_BIG
Definition: ntv2enums.h:1864
NTV2DolbyPlayer::NTV2DolbyBSI::frmmixcfginfoe
uint32_t frmmixcfginfoe
Definition: ntv2dolbyplayer.h:163
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
NTV2TestPatternSelect
NTV2TestPatternSelect
Identifies a predefined NTV2 test pattern.
Definition: ntv2testpatterngen.h:24
NTV2DolbyPlayer::NTV2DolbyBSI::lorosurmixlev
uint32_t lorosurmixlev
Definition: ntv2dolbyplayer.h:112
AUTOCIRCULATE_TRANSFER::SetAudioBuffer
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Definition: ntv2publicinterface.cpp:2614
NULL
#define NULL
Definition: ntv2caption608types.h:19
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:1008
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
NTV2Buffer
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
Definition: ntv2publicinterface.h:5967
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:368
NTV2DolbyPlayer::NTV2DolbyBSI::lfeon
uint32_t lfeon
Definition: ntv2dolbyplayer.h:97
NTV2DolbyPlayer::NTV2DolbyBSI::addche
uint32_t addche
Definition: ntv2dolbyplayer.h:142
AVDataBuffer
This structure encapsulates the video, audio and anc buffers used in the AutoCirculate demos....
Definition: ntv2democommon.h:55
GetNTV2FrameRateFromVideoFormat
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3530
NTV2DolbyPlayer::NTV2DolbyBSI::roomtyp
uint32_t roomtyp
Definition: ntv2dolbyplayer.h:175
NTV2DolbyPlayer::NTV2DolbyBSI::compr2
uint32_t compr2
Definition: ntv2dolbyplayer.h:104
NTV2DolbyPlayer::NTV2DolbyBSI::addspchdat1e
uint32_t addspchdat1e
Definition: ntv2dolbyplayer.h:152
NTV2DolbyPlayer::NTV2DolbyBSI::infomdate
uint32_t infomdate
Definition: ntv2dolbyplayer.h:166
AJAThread::Attach
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
Definition: thread.cpp:169
NTV2DolbyPlayer::NTV2DolbyBSI::adconvtyp
uint32_t adconvtyp
Definition: ntv2dolbyplayer.h:176
NTV2_AUDIO_48K
@ NTV2_AUDIO_48K
Definition: ntv2enums.h:1875
systemtime.h
Declares the AJATime class.
NTV2_AUDIO_FORMAT_DOLBY
@ NTV2_AUDIO_FORMAT_DOLBY
Definition: ntv2enums.h:1895
NTV2DolbyPlayer::NTV2DolbyBSI::lorocmixlev
uint32_t lorocmixlev
Definition: ntv2dolbyplayer.h:110
AJATimeCodeBurn::BurnTimeCode
AJA_EXPORT bool BurnTimeCode(void *pBaseVideoAddress, const std::string &inTimeCodeStr, const uint32_t inYPercent)
Definition: timecodeburn.cpp:45
AUDIOBYTES_MAX_48K
static const uint32_t AUDIOBYTES_MAX_48K(201 *1024)
The maximum number of bytes of 48KHz audio that can be transferred for a single frame....
AJA_STATUS_BUSY
@ AJA_STATUS_BUSY
Definition: types.h:378
CNTV2DeviceScanner::GetFirstDeviceFromArgument
static bool GetFirstDeviceFromArgument(const std::string &inArgument, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command li...
Definition: ntv2devicescanner.cpp:327
NTV2_FRAMERATE_INVALID
@ NTV2_FRAMERATE_INVALID
Definition: ntv2enums.h:425
NTV2_AUDIOSYSTEM_1
@ NTV2_AUDIOSYSTEM_1
This identifies the first Audio System.
Definition: ntv2enums.h:3811
AJACircularBuffer::StartConsumeNextBuffer
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function to ...
Definition: circularbuffer.h:153
NTV2DeviceCanDoMultiFormat
bool NTV2DeviceCanDoMultiFormat(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:4065
ntv2testpatterngen.h
Declares the NTV2TestPatternGen class.
NTV2_TestPatt_ColorBars100
@ NTV2_TestPatt_ColorBars100
Definition: ntv2testpatterngen.h:26
NTV2DolbyPlayer::NTV2DolbyBSI::pgmscle
uint32_t pgmscle
Definition: ntv2dolbyplayer.h:115
NTV2DolbyPlayer::PlayFrames
virtual void PlayFrames(void)
Repeatedly plays out frames using AutoCirculate (until quit).
Definition: ntv2dolbyplayer.cpp:403
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
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmscle
uint32_t extpgmscle
Definition: ntv2dolbyplayer.h:119
DEC0N
#define DEC0N(__x__, __n__)
Definition: ntv2publicinterface.h:5581
CNTV2MacDriverInterface::ReleaseStreamForApplication
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
Definition: ntv2macdriverinterface.cpp:832
NTV2FrameBufferFormat
NTV2FrameBufferFormat
Identifies a particular video frame buffer format. See Device Frame Buffer Formats for details.
Definition: ntv2enums.h:207
NTV2DolbyPlayer::NTV2DolbyBSI::drcsrc
uint32_t drcsrc
Definition: ntv2dolbyplayer.h:123
AJACircularBuffer::EndProduceNextBuffer
void EndProduceNextBuffer(void)
The producer thread calls this function to signal that it has finished populating the frame it obtain...
Definition: circularbuffer.h:259
NTV2DolbyPlayer::NTV2DolbyBSI::mixdatabuffer
uint8_t mixdatabuffer[64]
Definition: ntv2dolbyplayer.h:156
NTV2DolbyPlayer::NTV2DolbyBSI::paninfo2e
uint32_t paninfo2e
Definition: ntv2dolbyplayer.h:160
NTV2DolbyPlayer::NTV2DolbyPlayer
NTV2DolbyPlayer(const std::string &inDeviceSpecifier="0", const bool inWithAudio=true, const NTV2Channel inChannel=NTV2_CHANNEL1, const NTV2FrameBufferFormat inPixelFormat=NTV2_FBF_8BIT_YCBCR, const NTV2VideoFormat inVideoFormat=NTV2_FORMAT_1080i_5994, const bool inDoMultiFormat=false, const bool inDoRamp=false, AJAFileIO *inDolbyFile=NULL)
Constructs me using the given configuration settings.
Definition: ntv2dolbyplayer.cpp:53
NTV2DolbyPlayer::Run
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2dolbyplayer.cpp:363
NTV2DeviceCanDoFrameStore1Display
bool NTV2DeviceCanDoFrameStore1Display(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:2716
NTV2DolbyPlayer::NTV2DolbyBSI::numblkscod
uint32_t numblkscod
Definition: ntv2dolbyplayer.h:95
ntv2dolbyplayer.h
Header file for NTV2DolbyPlayer demonstration class.
TimecodeFormat
TimecodeFormat
Definition: ntv2rp188.h:27
NTV2DolbyPlayer::NTV2DolbyBSI::copyrightb
uint32_t copyrightb
Definition: ntv2dolbyplayer.h:168
NTV2_AUDIO_FORMAT_LPCM
@ NTV2_AUDIO_FORMAT_LPCM
Definition: ntv2enums.h:1894
CNTV2Card::SetAudioLoopBack
virtual bool SetAudioLoopBack(const NTV2AudioLoopBack inMode, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Enables or disables NTV2AudioLoopBack mode for the given NTV2AudioSystem.
Definition: ntv2audio.cpp:303
NTV2DeviceCanDoFrameBufferFormat
bool NTV2DeviceCanDoFrameBufferFormat(const NTV2DeviceID inDeviceID, const NTV2FrameBufferFormat inFBFormat)
Definition: ntv2devicefeatures.hpp:15330
NTV2_CHANNEL1
@ NTV2_CHANNEL1
Specifies channel or Frame Store 1 (or the first item).
Definition: ntv2enums.h:1307
NTV2DolbyPlayer::SetBitBuffer
virtual void SetBitBuffer(uint8_t *pBuffer, uint32_t size)
Set the bitstream buffer for bit retrieval.
Definition: ntv2dolbyplayer.cpp:1232
AUTOCIRCULATE_STATUS::GetNumAvailableOutputFrames
ULWord GetNumAvailableOutputFrames(void) const
Definition: ntv2publicinterface.h:7171
ntv2debug.h
NTV2FrameBufferFormatString
const char * NTV2FrameBufferFormatString(NTV2FrameBufferFormat fmt)
Definition: ntv2debug.cpp:201
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmscl
uint32_t extpgmscl
Definition: ntv2dolbyplayer.h:120
NTV2DolbyPlayer::NTV2DolbyBSI::compre
uint32_t compre
Definition: ntv2dolbyplayer.h:100
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
NTV2DolbyPlayer::NTV2DolbyBSI::addbsibuffer
uint8_t addbsibuffer[64]
Definition: ntv2dolbyplayer.h:187
NTV2FrameRate
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:396
NTV2DeviceCanDoVideoFormat
bool NTV2DeviceCanDoVideoFormat(const NTV2DeviceID inDeviceID, const NTV2VideoFormat inVideoFormat)
Definition: ntv2devicefeatures.hpp:18535
NTV2DolbyPlayer::NTV2DolbyBSI::dmixscle
uint32_t dmixscle
Definition: ntv2dolbyplayer.h:140
NTV2DolbyPlayer::NTV2DolbyBSI::spchdat
uint32_t spchdat
Definition: ntv2dolbyplayer.h:148
NTV2DolbyPlayer::NTV2DolbyBSI::lfemixlevcode
uint32_t lfemixlevcode
Definition: ntv2dolbyplayer.h:113
NTV2DolbyPlayer::AddDolby
virtual uint32_t AddDolby(ULWord *audioBuffer)
Inserts dolby audio into the given audio buffer.
Definition: ntv2dolbyplayer.cpp:676
GetOutputDestInputXpt
NTV2InputXptID GetOutputDestInputXpt(const NTV2OutputDestination inOutputDest, const bool inIsSDI_DS2=false, const UWord inHDMI_Quadrant=99)
Definition: ntv2signalrouter.cpp:928
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmlsscl
uint32_t extpgmlsscl
Definition: ntv2dolbyplayer.h:135
AJAThread
Definition: thread.h:69
NTV2DolbyPlayer::NTV2DolbyBSI::blkid
uint32_t blkid
Definition: ntv2dolbyplayer.h:183
NTV2DolbyPlayer::SetUpAudio
virtual AJAStatus SetUpAudio(void)
Sets up everything I need to play audio.
Definition: ntv2dolbyplayer.cpp:280
AJAThread::Active
virtual bool Active()
Definition: thread.cpp:116
gNumFrequencies
static const ULWord gNumFrequencies(sizeof(gFrequencies)/sizeof(double))
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmcscle
uint32_t extpgmcscle
Definition: ntv2dolbyplayer.h:130
AJAStatus
AJAStatus
Definition: types.h:365
NTV2_RP188::fLo
ULWord fLo
| BG 4 | Secs10 | BG 3 | Secs 1 | BG 2 | Frms10 | BG 1 | Frms 1 |
Definition: ntv2publicinterface.h:6707
NTV2DolbyPlayer
I am an object that can play out a test pattern (with timecode) to an output of an AJA device with or...
Definition: ntv2dolbyplayer.h:30
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmaux2scle
uint32_t extpgmaux2scle
Definition: ntv2dolbyplayer.h:145
NTV2DolbyPlayer::NTV2DolbyBSI::mixlevel
uint32_t mixlevel
Definition: ntv2dolbyplayer.h:174
NTV2FormatDescriptor::numPixels
ULWord numPixels
Width – total number of pixels per line.
Definition: ntv2formatdescriptor.h:349
process.h
Declares the AJAProcess class.
NTV2DolbyPlayer::NTV2DolbyBSI::ltrtcmixlev
uint32_t ltrtcmixlev
Definition: ntv2dolbyplayer.h:109
NTV2DolbyPlayer::SetUpVideo
virtual AJAStatus SetUpVideo(void)
Sets up everything I need to play video.
Definition: ntv2dolbyplayer.cpp:239
NTV2_RP188::fHi
ULWord fHi
| BG 8 | Hrs 10 | BG 7 | Hrs 1 | BG 6 | Mins10 | BG 5 | Mins 1 |
Definition: ntv2publicinterface.h:6708
AJATime::Sleep
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
Definition: systemtime.cpp:284
AJACircularBuffer::Add
AJAStatus Add(FrameDataPtr pInFrameData)
Appends a new frame buffer to me, increasing my frame storage capacity by one frame.
Definition: circularbuffer.h:92
NTV2_TestPatt_Ramp
@ NTV2_TestPatt_Ramp
Definition: ntv2testpatterngen.h:29
NTV2_VANCMODE_OFF
@ NTV2_VANCMODE_OFF
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3713
CNTV2Card::GetNumberAudioChannels
virtual bool GetNumberAudioChannels(ULWord &outNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Returns the current number of audio channels being captured or played by a given Audio System on the ...
Definition: ntv2audio.cpp:183
AJATimeBase
Definition: timebase.h:18
kNumAudioChannelsMax
@ kNumAudioChannelsMax
Definition: ntv2audiodefines.h:44
CNTV2Card::GetVideoFormat
virtual bool GetVideoFormat(NTV2VideoFormat &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Definition: ntv2register.cpp:332
AJA_STATUS_FAIL
@ AJA_STATUS_FAIL
Definition: types.h:369
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmlfescle
uint32_t extpgmlfescle
Definition: ntv2dolbyplayer.h:138
NTV2_TestPatt_FlatField
@ NTV2_TestPatt_FlatField
Definition: ntv2testpatterngen.h:33
AJAFileIO::Seek
AJAStatus Seek(const int64_t distance, const AJAFileSetFlag flag) const
Definition: file_io.cpp:545
AUTOCIRCULATE_STATUS
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
Definition: ntv2publicinterface.h:7105
NTV2DolbyPlayer::NTV2DolbyBSI::dialnorm2
uint32_t dialnorm2
Definition: ntv2dolbyplayer.h:102
ntv2devicescanner.h
Declares the CNTV2DeviceScanner class.
NTV2DolbyPlayer::NTV2DolbyBSI::frmsizecod
uint32_t frmsizecod
Definition: ntv2dolbyplayer.h:184
NTV2FormatDescriptor::numLines
ULWord numLines
Height – total number of lines.
Definition: ntv2formatdescriptor.h:348
NTV2DolbyPlayer::NTV2DolbyBSI::paninfo
uint32_t paninfo
Definition: ntv2dolbyplayer.h:159
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
AVDataBuffer::fAudioBufferSize
uint32_t fAudioBufferSize
Size of host audio buffer, in bytes.
Definition: ntv2democommon.h:61
NTV2DolbyPlayer::SetUpHostBuffers
virtual void SetUpHostBuffers(void)
Sets up my circular buffers.
Definition: ntv2dolbyplayer.cpp:312
NTV2DolbyPlayer::NTV2DolbyBSI::mixdata
uint32_t mixdata
Definition: ntv2dolbyplayer.h:125
AJAProcess::GetPid
static uint64_t GetPid()
Definition: process.cpp:35
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmrscle
uint32_t extpgmrscle
Definition: ntv2dolbyplayer.h:132
NTV2DolbyPlayer::NTV2DolbyBSI::ltrtsurmixlev
uint32_t ltrtsurmixlev
Definition: ntv2dolbyplayer.h:111
NTV2DolbyPlayer::NTV2DolbyBSI::pgmscl2
uint32_t pgmscl2
Definition: ntv2dolbyplayer.h:118
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
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmlfescl
uint32_t extpgmlfescl
Definition: ntv2dolbyplayer.h:139
CNTV2Card::UnsubscribeOutputVerticalEvent
virtual bool UnsubscribeOutputVerticalEvent(const NTV2Channel inChannel)
Unregisters me so I'm no longer notified when an output VBI is signaled on the given output channel.
Definition: ntv2subscriptions.cpp:61
UWord
uint16_t UWord
Definition: ajatypes.h:244
AJACircularBuffer::StartProduceNextBuffer
FrameDataPtr StartProduceNextBuffer(void)
The thread that's responsible for providing frames – the producer – calls this function to populate t...
Definition: circularbuffer.h:109
CNTV2Card::AutoCirculateGetStatus
virtual bool AutoCirculateGetStatus(const NTV2Channel inChannel, AUTOCIRCULATE_STATUS &outStatus)
Returns the current AutoCirculate status for the given channel.
Definition: ntv2autocirculate.cpp:646
NTV2DolbyPlayer::NTV2DolbyBSI::fscod
uint32_t fscod
Definition: ntv2dolbyplayer.h:94
NTV2DolbyPlayer::NTV2DolbyBSI::dsurmod
uint32_t dsurmod
Definition: ntv2dolbyplayer.h:170
NTV2_IS_PAL_VIDEO_FORMAT
#define NTV2_IS_PAL_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:696
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmaux2scl
uint32_t extpgmaux2scl
Definition: ntv2dolbyplayer.h:146
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
AUTOCIRCULATE_TRANSFER
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
Definition: ntv2publicinterface.h:7904
ntv2utils.h
Declares numerous NTV2 utility functions.
NTV2DolbyPlayer::NTV2DolbyBSI::blkmixcfginfo
uint32_t blkmixcfginfo[6]
Definition: ntv2dolbyplayer.h:164
NTV2VideoFormatToString
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Definition: ntv2utils.cpp:6750
NTV2DolbyPlayer::NTV2DolbyBSI::spchdat2
uint32_t spchdat2
Definition: ntv2dolbyplayer.h:154
NTV2DolbyPlayer::NTV2DolbyBSI::compr2e
uint32_t compr2e
Definition: ntv2dolbyplayer.h:103
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
NTV2DolbyPlayer::NTV2DolbyBSI::chanmap
uint32_t chanmap
Definition: ntv2dolbyplayer.h:106
NTV2DeviceGetNumFrameStores
UWord NTV2DeviceGetNumFrameStores(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:10487
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_TestPatt_ColorBars75
@ NTV2_TestPatt_ColorBars75
Definition: ntv2testpatterngen.h:28
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmlscl
uint32_t extpgmlscl
Definition: ntv2dolbyplayer.h:129
CNTV2DriverInterface::IsDeviceReady
virtual bool IsDeviceReady(const bool inCheckValid=(0))
Definition: ntv2driverinterface.cpp:1228
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmaux1scle
uint32_t extpgmaux1scle
Definition: ntv2dolbyplayer.h:143
NTV2DolbyPlayer::NTV2DolbyBSI::dmixmod
uint32_t dmixmod
Definition: ntv2dolbyplayer.h:108
GetVideoWriteSize
ULWord GetVideoWriteSize(const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, const NTV2VANCMode inVancMode=NTV2_VANCMODE_OFF)
Identical to the GetVideoActiveSize function, except rounds the result up to the nearest 4K page size...
Definition: ntv2utils.cpp:2775
AJACircularBuffer::EndConsumeNextBuffer
void EndConsumeNextBuffer(void)
The consumer thread calls this function to signal that it has finished processing the frame it obtain...
Definition: circularbuffer.h:266
NTV2DolbyPlayer::NTV2DolbyBSI::panmean2
uint32_t panmean2
Definition: ntv2dolbyplayer.h:161
NTV2DolbyPlayer::NTV2DolbyBSI::spchan1att
uint32_t spchan1att
Definition: ntv2dolbyplayer.h:151
CRP188
Definition: ntv2rp188.h:55
NTV2DolbyPlayer::NTV2DolbyBSI::dheadphonmod
uint32_t dheadphonmod
Definition: ntv2dolbyplayer.h:171
AUTOCIRCULATE_STATUS::acBufferLevel
ULWord acBufferLevel
Number of buffered frames in driver ready to capture or play.
Definition: ntv2publicinterface.h:7118
CNTV2Card::SetEveryFrameServices
virtual bool SetEveryFrameServices(const NTV2EveryFrameTaskMode inMode)
Sets the device's task mode.
Definition: ntv2register.cpp:179
NTV2DolbyPlayer::NTV2DolbyBSI::mixdef
uint32_t mixdef
Definition: ntv2dolbyplayer.h:121
NTV2DolbyPlayer::NTV2DolbyBSI::pgmscl
uint32_t pgmscl
Definition: ntv2dolbyplayer.h:116
NTV2DolbyPlayer::ProduceFrames
virtual void ProduceFrames(void)
Repeatedly produces test pattern frames (until global quit flag set).
Definition: ntv2dolbyplayer.cpp:530
AJA_STATUS_UNSUPPORTED
@ AJA_STATUS_UNSUPPORTED
Definition: types.h:381
CNTV2Card::SetHDMIOutAudioRate
virtual bool SetHDMIOutAudioRate(const NTV2AudioRate inNewValue)
Sets the HDMI output's audio rate.
Definition: ntv2audio.cpp:1082
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmlsscle
uint32_t extpgmlsscle
Definition: ntv2dolbyplayer.h:134
AJA_NULL
#define AJA_NULL
Definition: ajatypes.h:190
AddAudioTone
bool AddAudioTone(ULWord &outNumBytesWritten, NTV2Buffer &inAudioBuffer, ULWord &inOutCurrentSample, const ULWord inNumSamples, const double inSampleRate, const double inAmplitude, const double inFrequency, const ULWord inNumBits, const bool inByteSwap, const ULWord inNumChannels)
Fills the given buffer with 32-bit (ULWord) audio tone samples.
Definition: ntv2utils.cpp:4478
NTV2_DISABLE_TASKS
@ NTV2_DISABLE_TASKS
0: Disabled: Device is completely configured by controlling application(s) – no driver involvement.
Definition: ntv2publicinterface.h:4259
CNTV2DemoCommon::GetAJAFrameRate
static AJA_FrameRate GetAJAFrameRate(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:1022
AVDataBuffer::fAudioBuffer
uint32_t * fAudioBuffer
Pointer to host audio buffer.
Definition: ntv2democommon.h:60
NTV2DolbyPlayer::NTV2DolbyBSI::mixlevel2
uint32_t mixlevel2
Definition: ntv2dolbyplayer.h:178
NTV2DeviceGetNumAudioSystems
UWord NTV2DeviceGetNumAudioSystems(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:9864
AVDataBuffer::fVideoBuffer
uint32_t * fVideoBuffer
Pointer to host video buffer.
Definition: ntv2democommon.h:57
NTV2TestPatternGen
The NTV2 test pattern generator.
Definition: ntv2testpatterngen.h:67
NTV2OutputCrosspointID
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget's input (ident...
Definition: ntv2enums.h:2467
ntv2formatdescriptor.h
Declares the NTV2FormatDescriptor class.
NTV2_FORMAT_UNKNOWN
@ NTV2_FORMAT_UNKNOWN
Definition: ntv2enums.h:498
NTV2DolbyPlayer::NTV2DolbyBSI
Definition: ntv2dolbyplayer.h:89
NTV2DolbyPlayer::NTV2DolbyBSI::pgmscl2e
uint32_t pgmscl2e
Definition: ntv2dolbyplayer.h:117
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmrsscl
uint32_t extpgmrsscl
Definition: ntv2dolbyplayer.h:137
AJAFileIO::Read
uint32_t Read(uint8_t *pBuffer, const uint32_t length)
Definition: file_io.cpp:328
NTV2AudioRate
NTV2AudioRate
Definition: ntv2enums.h:1873
NTV2DolbyPlayer::NTV2DolbyBSI::spchan2att
uint32_t spchan2att
Definition: ntv2dolbyplayer.h:155
AJA_STATUS_INITIALIZE
@ AJA_STATUS_INITIALIZE
Definition: types.h:373
NTV2DolbyPlayer::NTV2DolbyBSI::addspchdate
uint32_t addspchdate
Definition: ntv2dolbyplayer.h:149
CNTV2Card::SetHDMIOutAudioSource2Channel
virtual bool SetHDMIOutAudioSource2Channel(const NTV2AudioChannelPair inNewValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the HDMI output's 2-channel audio source.
Definition: ntv2audio.cpp:973
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmaux1scl
uint32_t extpgmaux1scl
Definition: ntv2dolbyplayer.h:144
NTV2DolbyPlayer::NTV2DolbyBSI::panmean
uint32_t panmean
Definition: ntv2dolbyplayer.h:158
NTV2DolbyPlayer::Quit
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2dolbyplayer.cpp:155
NTV2_OUTPUTDESTINATION_HDMI
@ NTV2_OUTPUTDESTINATION_HDMI
Definition: ntv2enums.h:1279
false
#define false
Definition: ntv2devicefeatures.h:25
NTV2DolbyPlayer::NTV2DolbyBSI::adconvtyp2
uint32_t adconvtyp2
Definition: ntv2dolbyplayer.h:180
AUTOCIRCULATE_WITH_RP188
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
Definition: ntv2publicinterface.h:5490
NTV2DolbyPlayer::GetDolbyFrame
virtual bool GetDolbyFrame(uint16_t *pInDolbyBuffer, uint32_t &numSamples)
Get a dolby audio audio frame from the input file.
Definition: ntv2dolbyplayer.cpp:879
GetFrameBufferOutputXptFromChannel
NTV2OutputXptID GetFrameBufferOutputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsRGB=false, const bool inIs425=false)
Definition: ntv2signalrouter.cpp:845
NTV2DolbyPlayer::NTV2DolbyBSI::lfemixlevcod
uint32_t lfemixlevcod
Definition: ntv2dolbyplayer.h:114
NTV2DolbyPlayer::NTV2DolbyBSI::bsmod
uint32_t bsmod
Definition: ntv2dolbyplayer.h:167
NTV2TimeCodes
std::map< NTV2TCIndex, NTV2_RP188 > NTV2TimeCodes
A mapping of NTV2TCIndex enum values to NTV2_RP188 structures.
Definition: ntv2publicinterface.h:6791
CNTV2Card::WaitForOutputVerticalInterrupt
virtual bool WaitForOutputVerticalInterrupt(const NTV2Channel inChannel=NTV2_CHANNEL1, UWord inRepeatCount=1)
Efficiently sleeps the calling thread/process until the next one or more field (interlaced video) or ...
Definition: ntv2subscriptions.cpp:134
NTV2DolbyPlayer::NTV2DolbyBSI::paninfoe
uint32_t paninfoe
Definition: ntv2dolbyplayer.h:157
NTV2DolbyPlayer::GetBits
virtual bool GetBits(uint32_t &data, uint32_t inBitCount)
Retreive the specified number of bits from the bitstream buffer.
Definition: ntv2dolbyplayer.cpp:1239
NTV2_RP188
This struct replaces the old RP188_STRUCT.
Definition: ntv2publicinterface.h:6705
NTV2DolbyPlayer::NTV2DolbyBSI::dmixscl
uint32_t dmixscl
Definition: ntv2dolbyplayer.h:141
IsRGBFormat
bool IsRGBFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5442
NTV2DolbyPlayer::NTV2DolbyBSI::addbsil
uint32_t addbsil
Definition: ntv2dolbyplayer.h:186
CNTV2Card::AutoCirculateTransfer
virtual bool AutoCirculateTransfer(const NTV2Channel inChannel, AUTOCIRCULATE_TRANSFER &transferInfo)
Transfers all or part of a frame as specified in the given AUTOCIRCULATE_TRANSFER object to/from the ...
Definition: ntv2autocirculate.cpp:695
NTV2DolbyPlayer::AddRamp
virtual uint32_t AddRamp(ULWord *audioBuffer)
Inserts audio test ramp into the given audio buffer.
Definition: ntv2dolbyplayer.cpp:645
AVDataBuffer::fVideoBufferSize
uint32_t fVideoBufferSize
Size of host video buffer, in bytes.
Definition: ntv2democommon.h:59
GetAudioSamplesPerFrame
ULWord GetAudioSamplesPerFrame(const NTV2FrameRate inFrameRate, const NTV2AudioRate inAudioRate, ULWord inCadenceFrame=0, bool inIsSMPTE372Enabled=false)
Returns the number of audio samples for a given video frame rate, audio sample rate,...
Definition: ntv2utils.cpp:2789
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmrscl
uint32_t extpgmrscl
Definition: ntv2dolbyplayer.h:133
NTV2DolbyPlayer::ParseBSI
virtual bool ParseBSI(uint16_t *pInDolbyBuffer, uint32_t numSamples, NTV2DolbyBSI *pBsi)
Parse the dolby audio bit stream information block.
Definition: ntv2dolbyplayer.cpp:922
CNTV2Card::AutoCirculateInitForOutput
virtual bool AutoCirculateInitForOutput(const NTV2Channel inChannel, const UWord inFrameCount=7, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_INVALID, const ULWord inOptionFlags=0, const UByte inNumChannels=1, const UWord inStartFrameNumber=0, const UWord inEndFrameNumber=0)
Prepares for subsequent AutoCirculate playout, designating a contiguous block of frame buffers on the...
Definition: ntv2autocirculate.cpp:353
NTV2VideoFormat
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
NTV2DolbyPlayer::NTV2DolbyBSI::blkmixcfginfoe
uint32_t blkmixcfginfoe
Definition: ntv2dolbyplayer.h:165
CIRCULAR_BUFFER_SIZE
static const size_t CIRCULAR_BUFFER_SIZE(10)
Number of NTV2FrameData's in our ring.
CNTV2MacDriverInterface::AcquireStreamForApplication
virtual bool AcquireStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
Definition: ntv2macdriverinterface.cpp:808
NTV2DolbyPlayer::NTV2DolbyBSI::paninfo2
uint32_t paninfo2
Definition: ntv2dolbyplayer.h:162
NTV2DolbyPlayer::NTV2DolbyBSI::compr
uint32_t compr
Definition: ntv2dolbyplayer.h:101
NTV2DolbyPlayer::NTV2DolbyBSI::acmod
uint32_t acmod
Definition: ntv2dolbyplayer.h:96
AJAFileIO
Definition: file_io.h:64
CNTV2DriverInterface::GetDeviceID
virtual NTV2DeviceID GetDeviceID(void)
Definition: ntv2driverinterface.cpp:371
NTV2DolbyPlayer::NTV2DolbyBSI::convsync
uint32_t convsync
Definition: ntv2dolbyplayer.h:182
NTV2DolbyPlayer::NTV2DolbyBSI::roomtyp2
uint32_t roomtyp2
Definition: ntv2dolbyplayer.h:179
NTV2DolbyPlayer::NTV2DolbyBSI::premixcmpsel
uint32_t premixcmpsel
Definition: ntv2dolbyplayer.h:122
CNTV2Card::GetEveryFrameServices
virtual bool GetEveryFrameServices(NTV2EveryFrameTaskMode &outMode)
Retrieves the device's current "retail service" task mode.
Definition: ntv2register.cpp:184
CNTV2Card::GetAudioRate
virtual bool GetAudioRate(NTV2AudioRate &outRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Returns the current NTV2AudioRate for the given Audio System.
Definition: ntv2audio.cpp:229
NTV2DolbyPlayer::NTV2DolbyBSI::substreamid
uint32_t substreamid
Definition: ntv2dolbyplayer.h:92
NTV2DolbyPlayer::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: ntv2dolbyplayer.cpp:474
NTV2DolbyPlayer::NTV2DolbyBSI::dialnorm
uint32_t dialnorm
Definition: ntv2dolbyplayer.h:99
gFrequencies
static const double gFrequencies[]
Definition: ntv2dolbyplayer.cpp:524
CNTV2Card::GetFrameRate
virtual bool GetFrameRate(NTV2FrameRate &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the AJA device's currently configured frame rate via its "value" parameter.
Definition: ntv2register.cpp:1024
CNTV2Card::SetEnableVANCData
virtual bool SetEnableVANCData(const bool inVANCenabled, const bool inTallerVANC, const NTV2Standard inStandard, const NTV2FrameGeometry inGeometry, const NTV2Channel inChannel=NTV2_CHANNEL1)
Definition: ntv2register.cpp:2736
AJACircularBuffer::SetAbortFlag
void SetAbortFlag(const bool *pAbortFlag)
Tells me the boolean variable I should monitor such that when it gets set to "true" will cause any th...
Definition: circularbuffer.h:51
NTV2DolbyPlayer::NTV2DolbyBSI::strmtyp
uint32_t strmtyp
Definition: ntv2dolbyplayer.h:91
NTV2DolbyPlayer::Init
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2dolbyplayer.cpp:174
NTV2_TestPatt_MultiPattern
@ NTV2_TestPatt_MultiPattern
Definition: ntv2testpatterngen.h:34
NTV2DolbyPlayer::NTV2DolbyBSI::addbsie
uint32_t addbsie
Definition: ntv2dolbyplayer.h:185
NTV2DolbyPlayer::StartProducerThread
virtual void StartProducerThread(void)
Starts my test pattern producer thread.
Definition: ntv2dolbyplayer.cpp:463
NTV2DolbyPlayer::NTV2DolbyBSI::mixmdate
uint32_t mixmdate
Definition: ntv2dolbyplayer.h:107
AJAThread::SetPriority
virtual AJAStatus SetPriority(AJAThreadPriority priority)
Definition: thread.cpp:133
CNTV2Card::AutoCirculateStart
virtual bool AutoCirculateStart(const NTV2Channel inChannel, const ULWord64 inStartTime=0)
Starts AutoCirculating the specified channel that was previously initialized by CNTV2Card::AutoCircul...
Definition: ntv2autocirculate.cpp:503
NTV2TestPatternGen::getTestPatternNames
static NTV2TestPatternNames getTestPatternNames(void)
Definition: ntv2testpatterngen.cpp:2542
NTV2DolbyPlayer::GetACStatus
virtual void GetACStatus(ULWord &outGoodFrames, ULWord &outDroppedFrames, ULWord &outBufferLevel)
Provides status information about my output (playout) process.
Definition: ntv2dolbyplayer.cpp:600
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmlscle
uint32_t extpgmlscle
Definition: ntv2dolbyplayer.h:128
NTV2DolbyPlayer::NTV2DolbyBSI::sourcefscod
uint32_t sourcefscod
Definition: ntv2dolbyplayer.h:181
PLNOTE
#define PLNOTE(_xpr_)
Definition: ntv2democommon.h:36
eAJASeekSet
@ eAJASeekSet
Definition: file_io.h:47
AJA_STATUS_OPEN
@ AJA_STATUS_OPEN
Definition: types.h:375
AJATimeBase::FramesToSeconds
double FramesToSeconds(int64_t frames) const
Definition: timebase.cpp:197
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmcscl
uint32_t extpgmcscl
Definition: ntv2dolbyplayer.h:131
NTV2DolbyPlayer::StartConsumerThread
virtual void StartConsumerThread(void)
Starts my playout thread.
Definition: ntv2dolbyplayer.cpp:378
CNTV2DemoCommon::NTV2FrameRate2TimecodeFormat
static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate)
Definition: ntv2democommon.cpp:1000
NTV2DolbyPlayer::NTV2DolbyBSI::origbs
uint32_t origbs
Definition: ntv2dolbyplayer.h:169
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
NTV2_TestPatt_LineSweep
@ NTV2_TestPatt_LineSweep
Definition: ntv2testpatterngen.h:31
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
AJAThread::Start
virtual AJAStatus Start()
Definition: thread.cpp:91
NTV2DolbyPlayer::NTV2DolbyBSI::mixdeflen
uint32_t mixdeflen
Definition: ntv2dolbyplayer.h:126
AUTOCIRCULATE_STATUS::acFramesDropped
ULWord acFramesDropped
Total number of frames dropped since CNTV2Card::AutoCirculateStart called.
Definition: ntv2publicinterface.h:7117
CNTV2DemoCommon::GetAJAPixelFormat
static AJA_PixelFormat GetAJAPixelFormat(const NTV2FrameBufferFormat inFormat)
Definition: ntv2democommon.cpp:1054
BIT
#define BIT(_x_)
Definition: ajatypes.h:654
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition: types.h:358
NTV2_AUDIO_RATE_INVALID
@ NTV2_AUDIO_RATE_INVALID
Definition: ntv2enums.h:1879
NTV2DolbyPlayer::NTV2DolbyBSI::extpgmrsscle
uint32_t extpgmrsscle
Definition: ntv2dolbyplayer.h:136
NTV2_AudioChannel1_2
@ NTV2_AudioChannel1_2
This selects audio channels 1 and 2 (Group 1 channels 1 and 2)
Definition: ntv2enums.h:3053
CNTV2Card::EnableChannel
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.
Definition: ntv2register.cpp:2113
kAppSignature
static const ULWord kAppSignature(((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0)))
Used when reserving the AJA device, this specifies the application signature.
NTV2DeviceCanDo2110
bool NTV2DeviceCanDo2110(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:467
NTV2ChannelToAudioSystem
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
Definition: ntv2utils.cpp:4927
CNTV2Card::SetHDMIOutAudioFormat
virtual bool SetHDMIOutAudioFormat(const NTV2AudioFormat inNewValue)
Sets the HDMI output's audio format.
Definition: ntv2audio.cpp:1094
NTV2DolbyPlayer::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: ntv2dolbyplayer.cpp:390
PLINFO
#define PLINFO(_xpr_)
Definition: ntv2democommon.h:37
DEVICE_ID_NOTFOUND
@ DEVICE_ID_NOTFOUND
Invalid or "not found".
Definition: ntv2enums.h:90
NTV2DolbyPlayer::NTV2DolbyBSI::dsurexmod
uint32_t dsurexmod
Definition: ntv2dolbyplayer.h:172
gAmplitudes
static const double gAmplitudes[]
Definition: ntv2dolbyplayer.cpp:526
CRP188::GetRP188Str
bool GetRP188Str(std::string &sRP188) const
Definition: ntv2rp188.cpp:918
debug.h
Declares the AJADebug class.
NTV2_OEM_TASKS
@ NTV2_OEM_TASKS
2: OEM: Device is configured by controlling application(s), with minimal driver involvement.
Definition: ntv2publicinterface.h:4261
NTV2TestPatternNames
NTV2StringList NTV2TestPatternNames
A list (std::vector) of pattern names.
Definition: ntv2testpatterngen.h:19
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
AUDIOBYTES_MAX_192K
static const uint32_t AUDIOBYTES_MAX_192K(824 *1024)
The maximum number of bytes of 192KHz audio that can be transferred for a single frame....
NTV2_AUDIOSYSTEM_INVALID
@ NTV2_AUDIOSYSTEM_INVALID
Definition: ntv2enums.h:3821
timebase.h
Declares the AJATimeBase class.