AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ntv2dolbycapture.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
9 #ifndef _NTV2DOLBYCAPTURE_H
10 #define _NTV2DOLBYCAPTURE_H
11 
12 #include "ntv2democommon.h"
13 #include "ajabase/system/thread.h"
14 
15 
20 {
21  public:
22  std::string fAudioDataFilePath;
23  std::string fDolbyDataFilePath;
26 
30  inline explicit DolbyCaptureConfig (const std::string & inDeviceSpec = "0")
31  : CaptureConfig(inDeviceSpec),
34  {
35  }
36  AJALabelValuePairs Get (const bool inCompact = false) const;
38 
39 std::ostream & operator << (std::ostream & ioStrm, const DolbyCaptureConfig & inObj);
40 
41 
46 {
47  // Public Instance Methods
48  public:
54  NTV2DolbyCapture (const DolbyCaptureConfig & inConfig);
55 
56  virtual ~NTV2DolbyCapture ();
57 
61  virtual AJAStatus Init (void);
62 
67  virtual AJAStatus Run (void);
68 
72  virtual void Quit (void);
73 
80  virtual void GetACStatus (ULWord & outGoodFrames, ULWord & outDroppedFrames, ULWord & outBufferLevel);
81 
82 
83  // Protected Instance Methods
84  protected:
88  virtual AJAStatus SetupVideo (void);
89 
93  virtual AJAStatus SetupAudio (void);
94 
98  virtual bool RouteInputSignal (void);
99 
103  virtual void SetupHostBuffers (void);
104 
108  virtual void StartProducerThread (void);
109 
113  virtual void CaptureFrames (void);
114 
118  virtual void StartConsumerThread (void);
119 
123  virtual void ConsumeFrames (void);
124 
129  virtual uint32_t RecoverAudio (const NTV2Buffer & inAncBuffer, const uint32_t inAncSize, NTV2Buffer & outAudioBuffer);
130 
138  virtual uint32_t RecoverDolby (const NTV2Buffer & inAudioBuffer, const uint32_t inAudioSize, NTV2Buffer & outDolbyBuffer);
139 
140  // Protected Class Methods
141  protected:
149  static void ConsumerThreadStatic (AJAThread * pThread, void * pContext);
150 
158  static void ProducerThreadStatic (AJAThread * pThread, void * pContext);
159 
160 
161  // Private Member Data
162  private:
163  AJAThread mConsumerThread;
164  AJAThread mProducerThread;
165  CNTV2Card mDevice;
166  NTV2DeviceID mDeviceID;
167  DolbyCaptureConfig mConfig;
168  NTV2VideoFormat mVideoFormat;
169  NTV2FormatDesc mFormatDesc;
170  NTV2TaskMode mSavedTaskMode;
171  NTV2AudioSystem mAudioSystem;
172  NTV2FrameDataArray mHostBuffers;
173  FrameDataRingBuffer mAVCircularBuffer;
174  bool mGlobalQuit;
175  uint32_t mDolbyState;
176  uint32_t mDolbyLength;
177 
178 }; // NTV2DolbyCapture
179 
180 #endif // _NTV2CAPTURE_H
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3895
std::ostream & operator<<(std::ostream &ioStrm, const DolbyCaptureConfig &inObj)
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
NTV2TaskMode
Describes the task mode state. See also: Sharing AJA Devices With Other Applications.
AJAStatus
Definition: types.h:380
virtual void CaptureFrames(void)
Repeatedly captures frames using AutoCirculate (until global quit flag set).
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
std::vector< AJALabelValuePair > AJALabelValuePairs
An ordered sequence of label/value pairs.
Definition: info.h:71
virtual void SetupHostBuffers(void)
Sets up my circular buffers.
virtual void StartConsumerThread(void)
Starts my frame consumer thread.
NTV2DolbyCapture(const DolbyCaptureConfig &inConfig)
Constructs me using the given settings.
#define false
uint32_t ULWord
Definition: ajatypes.h:223
DolbyCaptureConfig(const std::string &inDeviceSpec="0")
Constructs a default DolbyCaptureConfig.
bool fDoFrameStats
if true, output per frame statistics
virtual void StartProducerThread(void)
Starts my capture thread.
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
This class is used to configure an NTV2Capture instance.
Declares the AJAThread class.
virtual AJAStatus SetupVideo(void)
Sets up everything I need for capturing video.
Describes a video frame for a given video standard or format and pixel format, including the total nu...
virtual AJAStatus SetupAudio(void)
Sets up everything I need for capturing audio.
bool fDoAudioFilter
If true, capture only audio anc.
static void ConsumerThreadStatic(AJAThread *pThread, void *pContext)
This is the consumer thread&#39;s static callback function that gets called when the consumer thread runs...
std::string fDolbyDataFilePath
Optional path to Dolby binary data file.
Describes a user-space buffer on the host computer. I have an address and a length, plus some optional attributes (allocated by SDK?, page-aligned? etc.).
std::vector< NTV2FrameData > NTV2FrameDataArray
A vector of NTV2FrameData elements.
virtual AJAStatus Run(void)
Runs me.
virtual uint32_t RecoverDolby(const NTV2Buffer &inAudioBuffer, const uint32_t inAudioSize, NTV2Buffer &outDolbyBuffer)
Recover Dolby data from the given audio data.
virtual bool RouteInputSignal(void)
Sets up device routing for capture.
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
virtual ~NTV2DolbyCapture()
I capture HDMI Dolby audio from an HDMI input of an AJA device.
DolbyCaptureConfig DolbyCaptureConfig
This class is used to configure an NTV2Capture instance.
This file contains some structures, constants, classes and functions that are used in some of the dem...
virtual void GetACStatus(ULWord &outGoodFrames, ULWord &outDroppedFrames, ULWord &outBufferLevel)
Provides status information about my input (capture) process.
virtual void ConsumeFrames(void)
Repeatedly consumes frames from the circular buffer (until global quit flag set). ...
virtual void Quit(void)
Gracefully stops me from running.
I am a circular frame buffer that simplifies implementing a type-safe producer/consumer model for pro...
This class is used to configure an NTV2Capture instance.
std::string fAudioDataFilePath
Optional path to Audio binary data file.
static void ProducerThreadStatic(AJAThread *pThread, void *pContext)
This is the capture thread&#39;s static callback function that gets called when the capture thread runs...
AJALabelValuePairs Get(const bool inCompact=(0)) const
virtual uint32_t RecoverAudio(const NTV2Buffer &inAncBuffer, const uint32_t inAncSize, NTV2Buffer &outAudioBuffer)
Recover audio from ancillary data.