AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ntv2encodehevcvifac.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
9 #ifndef _NTV2ENCODEHEVCVIFAC_H
10 #define _NTV2ENCODEHEVCVIFAC_H
11 
12 #include "ntv2enums.h"
13 #include "ntv2devicefeatures.h"
14 #include "ntv2devicescanner.h"
15 #include "ntv2demohevccommon.h"
16 
17 #include "ntv2m31enums.h"
18 
24 #include "ajabase/system/thread.h"
25 
26 #include "ntv2m31.h"
27 
28 #define VIDEO_RING_SIZE 60
29 #define AUDIO_RING_SIZE (3*VIDEO_RING_SIZE)
30 
31 
38 {
39  // Public Instance Methods
40  public:
63  NTV2EncodeHEVCVifAc ( const std::string inDeviceSpecifier = "0",
64  const NTV2Channel inChannel = NTV2_CHANNEL1,
67  const bool inQuadMode = false,
68  const uint32_t inAudioChannels = 0,
69  const bool inTimeCodeBurn = false,
70  const bool inInfoData = false,
71  const uint32_t inMaxFrames = 0xffffffff);
72 
73  virtual ~NTV2EncodeHEVCVifAc ();
74 
78  virtual AJAStatus Init (void);
79 
84  virtual AJAStatus Run (void);
85 
89  virtual void Quit (void);
90 
95  virtual void GetStatus (AVHevcStatus * outInputStatus);
96 
100  virtual M31VideoPreset GetCodecPreset (void);
101 
102  // Protected Instance Methods
103  protected:
107  virtual AJAStatus SetupVideo (void);
108 
112  virtual AJAStatus SetupAudio (void);
113 
117  virtual void RouteInputSignal (void);
118 
122  virtual void SetupHostBuffers (void);
123 
127  virtual void SetupAutoCirculate (void);
128 
132  virtual void StartVideoInputThread (void);
133 
137  virtual void StartVideoProcessThread (void);
138 
142  virtual void StartCodecRawThread (void);
143 
147  virtual void StartCodecHevcThread (void);
148 
152  virtual void StartVideoFileThread (void);
153 
157  virtual void StartAudioFileThread (void);
158 
163  virtual void VideoInputWorker (void);
164 
169  virtual void VideoProcessWorker (void);
170 
175  virtual void CodecRawWorker (void);
176 
181  virtual void CodecHevcWorker (void);
182 
187  virtual void VideoFileWorker (void);
188 
193  virtual void AudioFileWorker (void);
194 
198  virtual AJAStatus ProcessVideoFrame (AVHevcDataBuffer * pSrcFrame, AVHevcDataBuffer * pDstFrame, uint32_t frameNumber);
199 
200  // Protected Class Methods
201  protected:
208  static void VideoInputThreadStatic (AJAThread * pThread, void * pContext);
209 
216  static void VideoProcessThreadStatic (AJAThread * pThread, void * pContext);
217 
224  static void CodecRawThreadStatic (AJAThread * pThread, void * pContext);
225 
232  static void CodecHevcThreadStatic (AJAThread * pThread, void * pContext);
233 
240  static void VideoFileThreadStatic (AJAThread * pThread, void * pContext);
241 
248  static void AudioFileThreadStatic (AJAThread * pThread, void * pContext);
249 
250  // Private Member Data
251  private:
252  AJAThread mVideoInputThread;
253  AJAThread mVideoProcessThread;
254  AJAThread mCodecRawThread;
255  AJAThread mCodecHevcThread;
256  AJAThread mVideoFileThread;
257  AJAThread mAudioFileThread;
258  CNTV2m31 * mM31;
259  CNTV2DemoHevcCommon * mHevcCommon;
260 
261  CNTV2Card mDevice;
262  NTV2DeviceID mDeviceID;
263  const std::string mDeviceSpecifier;
264  bool mWithAudio;
265  NTV2Channel mInputChannel;
266  NTV2Channel mOutputChannel;
267  M31Channel mEncodeChannel;
268  M31VideoPreset mPreset;
269  NTV2InputSource mInputSource;
270  NTV2VideoFormat mVideoFormat;
271  NTV2FrameBufferFormat mPixelFormat;
272  bool mQuad;
273  bool mInterlaced;
274  bool mMultiStream;
275  bool mWithInfo;
276  bool mWithAnc;
277  NTV2AudioSystem mAudioSystem;
278  NTV2EveryFrameTaskMode mSavedTaskMode;
279  uint32_t mNumAudioChannels;
280  uint32_t mFileAudioChannels;
281  uint32_t mMaxFrames;
282 
283  bool mLastFrame;
284  bool mLastFrameInput;
285  bool mLastFrameRaw;
286  bool mLastFrameHevc;
287  bool mLastFrameVideo;
288  bool mLastFrameAudio;
289  bool mGlobalQuit;
290  uint32_t mQueueSize;
291  uint32_t mVideoBufferSize;
292  uint32_t mPicInfoBufferSize;
293  uint32_t mEncInfoBufferSize;
294  uint32_t mAudioBufferSize;
295 
296  AVHevcDataBuffer mVideoInputBuffer [VIDEO_RING_SIZE];
297  AJACircularBuffer <AVHevcDataBuffer *> mVideoInputCircularBuffer;
298 
299  AVHevcDataBuffer mVideoRawBuffer [VIDEO_RING_SIZE];
300  AJACircularBuffer <AVHevcDataBuffer *> mVideoRawCircularBuffer;
301 
302  AVHevcDataBuffer mVideoHevcBuffer [VIDEO_RING_SIZE];
303  AJACircularBuffer <AVHevcDataBuffer *> mVideoHevcCircularBuffer;
304 
305  AVHevcDataBuffer mAudioInputBuffer [AUDIO_RING_SIZE];
306  AJACircularBuffer <AVHevcDataBuffer *> mAudioInputCircularBuffer;
307 
308  uint32_t mVideoInputFrameCount;
309  uint32_t mVideoProcessFrameCount;
310  uint32_t mCodecRawFrameCount;
311  uint32_t mCodecHevcFrameCount;
312  uint32_t mVideoFileFrameCount;
313  uint32_t mAudioFileFrameCount;
314 
315  AJATimeBase mTimeBase;
316  AJATimeCode mTimeCode;
317  AJATimeCodeBurn mTimeCodeBurn;
318 
319 }; // NTV2EncodeHEVCVIFAc
320 
321 #endif // _NTV2ENCODEHEVCVIFAC_H
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3895
virtual AJAStatus Run(void)
Runs me.
virtual void StartVideoProcessThread(void)
Start the video process thread.
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:219
NTV2TaskMode
Describes the task mode state. See also: Sharing AJA Devices With Other Applications.
AJAStatus
Definition: types.h:380
virtual void VideoInputWorker(void)
Repeatedly captures video frames using AutoCirculate and add them to the video input ring...
#define VIDEO_RING_SIZE
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
virtual void StartVideoFileThread(void)
Start the video file writer thread.
virtual void AudioFileWorker(void)
Repeatedly removes audio samples from the audio input ring and writes them to the audio output file...
static void CodecRawThreadStatic(AJAThread *pThread, void *pContext)
This is the codec raw thread&#39;s static callback function that gets called when the thread starts...
Declares the AJATimeCodeBurn class.
virtual AJAStatus ProcessVideoFrame(AVHevcDataBuffer *pSrcFrame, AVHevcDataBuffer *pDstFrame, uint32_t frameNumber)
Default do-nothing function for processing the captured frames.
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1357
virtual void SetupAutoCirculate(void)
Initializes AutoCirculate.
virtual void VideoProcessWorker(void)
Repeatedly removes video frames from the video input ring, calls a custom video process method and ad...
virtual void VideoFileWorker(void)
Repeatedly removes hevc frame from the hevc ring and writes them to the hevc output file...
Declares the AJATimeBase class.
M31VideoPreset
Definition: ntv2m31enums.h:13
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
Enumerations for controlling NTV2 devices.
Declares the AJAThread class.
Instances of me capture frames in real time from a video signal provided to an input of an AJA device...
Utility class for timecodes.
Definition: timecode.h:28
static void VideoFileThreadStatic(AJAThread *pThread, void *pContext)
This is the video file writer thread&#39;s static callback function that gets called when the thread star...
virtual void SetupHostBuffers(void)
Sets up my circular buffers.
virtual void CodecRawWorker(void)
Repeatedly removes video frames from the raw video ring and transfers them to the codec...
#define AUDIO_RING_SIZE
virtual void StartCodecHevcThread(void)
Start the codec hevc thread.
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
virtual void CodecHevcWorker(void)
Repeatedly transfers hevc frames from the codec and adds them to the hevc ring.
Declares the CNTV2DeviceScanner class.
virtual void Quit(void)
Gracefully stops me from running.
10-Bit 4:2:0 2-Plane YCbCr
Definition: ntv2enums.h:251
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1262
Declaration of AJACircularBuffer template class.
Declares the AJATimeCode class.
virtual void StartAudioFileThread(void)
Start the audio file writer thread.
M31Channel
Definition: ntv2m31enums.h:226
static void CodecHevcThreadStatic(AJAThread *pThread, void *pContext)
This is the codec hevc thread&#39;s static callback function that gets called when the thread starts...
virtual void GetStatus(AVHevcStatus *outInputStatus)
Provides status information about my input (capture) process.
Specifies channel or FrameStore 1 (or the first item).
Definition: ntv2enums.h:1359
virtual AJAStatus SetupVideo(void)
Sets up everything I need for capturing video.
This structure encapsulates the video and audio buffers used by the HEVC demo applications. The demo programs that employ producer/consumer threads use a fixed number of these buffers.
virtual void RouteInputSignal(void)
Sets up device routing for capture.
NTV2EncodeHEVCVifAc(const std::string inDeviceSpecifier="0", const NTV2Channel inChannel=NTV2_CHANNEL1, const M31VideoPreset inM31Preset=M31_FILE_1280X720_420_8_5994p, const NTV2FrameBufferFormat inPixelFormat=NTV2_FBF_10BIT_YCBCR_420PL2, const bool inQuadMode=(0), const uint32_t inAudioChannels=0, const bool inTimeCodeBurn=(0), const bool inInfoData=(0), const uint32_t inMaxFrames=0xffffffff)
Constructs me using the given settings.
virtual void StartCodecRawThread(void)
Start the codec raw thread.
virtual void StartVideoInputThread(void)
Start the video input thread.
static void VideoProcessThreadStatic(AJAThread *pThread, void *pContext)
This is the video process thread&#39;s static callback function that gets called when the thread starts...
virtual AJAStatus SetupAudio(void)
Sets up everything I need for capturing audio.
This file contains some structures, constants, classes and functions that are used in some of the hev...
Declares the enumeration constants used in the ajabase library.
I am a circular frame buffer that simplifies implementing a type-safe producer/consumer model for pro...
static void AudioFileThreadStatic(AJAThread *pThread, void *pContext)
This is the audio file writer thread&#39;s static callback function that gets called when the thread star...
virtual M31VideoPreset GetCodecPreset(void)
Get the codec preset.
Declares device capability functions.
static void VideoInputThreadStatic(AJAThread *pThread, void *pContext)
This is the video input thread&#39;s static callback function that gets called when the thread starts...