AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ntv2encodehevcvif.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
9 #ifndef _NTV2ENCODEHEVCVIF_H
10 #define _NTV2ENCODEHEVCVIF_H
11 
12 #include "ntv2enums.h"
13 #include "ntv2devicefeatures.h"
14 #include "ntv2devicescanner.h"
15 #include "ntv2demohevccommon.h"
16 //#include "ajacircularbuffer.h"
17 
18 #include "ntv2m31enums.h"
19 
25 #include "ajabase/system/thread.h"
26 
27 #include "ntv2m31.h"
28 
29 #define VIDEO_RING_SIZE 60
30 #define AUDIO_RING_SIZE (3*VIDEO_RING_SIZE)
31 
32 
39 {
40  // Public Instance Methods
41  public:
58  NTV2EncodeHEVCVif ( const std::string inDeviceSpecifier = "0",
61  const uint32_t inAudioChannels = 0,
62  const bool inInfoData = false,
63  const uint32_t inMaxFrames = 0xffffffff);
64 
65  virtual ~NTV2EncodeHEVCVif ();
66 
70  virtual AJAStatus Init (void);
71 
76  virtual AJAStatus Run (void);
77 
81  virtual void Quit (void);
82 
87  virtual void GetStatus (AVHevcStatus * outInputStatus);
88 
92  virtual M31VideoPreset GetCodecPreset (void);
93 
94  // Protected Instance Methods
95  protected:
99  virtual AJAStatus SetupVideo (void);
100 
104  virtual AJAStatus SetupAudio (void);
105 
109  virtual void RouteInputSignal (void);
110 
114  virtual void SetupHostBuffers (void);
115 
119  virtual void SetupAutoCirculate (void);
120 
124  virtual void StartVideoInputThread (void);
125 
129  virtual void StartCodecHevcThread (void);
130 
134  virtual void StartAVFileThread (void);
135 
140  virtual void VideoInputWorker (void);
141 
146  virtual void CodecHevcWorker (void);
147 
152  virtual void AVFileWorker (void);
153 
158  virtual void TransferPictureInfo(CNTV2m31 * pM31);
159 
160  // Protected Class Methods
161  protected:
168  static void VideoInputThreadStatic (AJAThread * pThread, void * pContext);
169 
176  static void CodecHevcThreadStatic (AJAThread * pThread, void * pContext);
177 
184  static void AVFileThreadStatic (AJAThread * pThread, void * pContext);
185 
186  // Private Member Data
187  private:
188  AJAThread mACInputThread;
189  AJAThread mCodecHevcThread;
190  AJAThread mAVFileThread;
191  CNTV2m31 * mM31;
192  CNTV2DemoHevcCommon * mHevcCommon;
193 
194  CNTV2Card mDevice;
195  NTV2DeviceID mDeviceID;
196  const std::string mDeviceSpecifier;
197  bool mWithAudio;
198  NTV2Channel mInputChannel;
199  NTV2Channel mOutputChannel;
200  M31Channel mEncodeChannel;
201  M31VideoPreset mPreset;
202  NTV2InputSource mInputSource;
203  NTV2VideoFormat mInputFormat;
204  NTV2VideoFormat mVideoFormat;
205  NTV2FrameBufferFormat mCapturePixelFormat;
206  NTV2FrameBufferFormat mOverlayPixelFormat;
207  NTV2FrameBufferFormat mCodecPixelFormat;
208  NTV2FrameRate mFrameRate;
209  NTV2AudioRate mAudioRate;
210  bool mWithInfo;
211  NTV2AudioSystem mAudioSystem;
212  NTV2EveryFrameTaskMode mSavedTaskMode;
213  uint32_t mNumAudioChannels;
214  uint32_t mFileAudioChannels;
215  uint32_t mMaxFrames;
216 
217  bool mLastFrame;
218  bool mLastFrameInput;
219  bool mLastFrameHevc;
220  bool mLastFrameVideo;
221  bool mGlobalQuit;
222  uint32_t mQueueSize;
223  uint32_t mVideoBufferSize;
224  uint32_t mPicInfoBufferSize;
225  uint32_t mEncInfoBufferSize;
226  uint32_t mAudioBufferSize;
227  uint32_t mOverlayBufferSize;
228 
229  AVHevcDataBuffer mACInputBuffer [VIDEO_RING_SIZE];
230  AJACircularBuffer <AVHevcDataBuffer *> mACInputCircularBuffer;
231 
232  AVHevcDataBuffer mVideoHevcBuffer [VIDEO_RING_SIZE];
233  AJACircularBuffer <AVHevcDataBuffer *> mVideoHevcCircularBuffer;
234 
235  AVHevcDataBuffer * mFrameData;
236  uint32_t * mSilentBuffer;
237  uint32_t mVideoInputFrameCount;
238  uint32_t mCodecHevcFrameCount;
239  uint32_t mAVFileFrameCount;
240  uint32_t mRawFrameCount;
241  uint32_t mInfoFrameCount;
242 
243  uint32_t * mOverlayBuffer [2];
244  uint32_t mOverlayFrame [2];
245  uint32_t mOverlayIndex;
246 
247  AJATimeBase mTimeBase;
248 
249 }; // NTV2EncodeHEVCVIF
250 
251 #endif // _NTV2ENCODEHEVCVIF_H
Instances of me capture frames in real time from a video signal provided to an input of an AJA device...
virtual void VideoInputWorker(void)
Repeatedly captures video frames using AutoCirculate and add them to the video input ring...
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3895
virtual void SetupHostBuffers(void)
Sets up my circular buffers.
virtual void AVFileWorker(void)
Repeatedly removes hevc frame from the hevc ring and writes them to the hevc output file...
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
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
virtual AJAStatus SetupVideo(void)
Sets up everything I need for capturing video.
NTV2TaskMode
Describes the task mode state. See also: Sharing AJA Devices With Other Applications.
virtual void RouteInputSignal(void)
Sets up device routing for capture.
virtual void StartAVFileThread(void)
Start the audio/video file writer thread.
AJAStatus
Definition: types.h:380
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
virtual void StartCodecHevcThread(void)
Start the codec hevc thread.
Declares the AJATimeCodeBurn class.
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1357
Declares the AJATimeBase class.
virtual M31VideoPreset GetCodecPreset(void)
Get the codec preset.
virtual void Quit(void)
Gracefully stops me from running.
M31VideoPreset
Definition: ntv2m31enums.h:13
virtual void GetStatus(AVHevcStatus *outInputStatus)
Provides status information about my input (capture) process.
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:412
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.
virtual AJAStatus SetupAudio(void)
Sets up everything I need for capturing audio.
#define VIDEO_RING_SIZE
virtual void CodecHevcWorker(void)
Repeatedly transfers hevc frames from the codec and adds them to the hevc ring.
virtual AJAStatus Run(void)
Runs me.
NTV2EncodeHEVCVif(const std::string inDeviceSpecifier="0", const M31VideoPreset inM31Preset=M31_FILE_1280X720_420_8_5994p, const NTV2FrameBufferFormat inPixelFormat=NTV2_FBF_10BIT_YCBCR_420PL2, const uint32_t inAudioChannels=0, const bool inInfoData=(0), const uint32_t inMaxFrames=0xffffffff)
Constructs me using the given settings.
Declares the CNTV2DeviceScanner class.
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.
virtual void SetupAutoCirculate(void)
Initializes AutoCirculate.
Declares the AJATimeCode class.
M31Channel
Definition: ntv2m31enums.h:226
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...
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...
static void AVFileThreadStatic(AJAThread *pThread, void *pContext)
This is the video file writer thread&#39;s static callback function that gets called when the thread star...
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 TransferPictureInfo(CNTV2m31 *pM31)
Transfer picture information to the codec.
NTV2AudioRate
Definition: ntv2enums.h:1928
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...
virtual void StartVideoInputThread(void)
Start the video input thread.
Declares device capability functions.