AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
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
NTV2EncodeHEVCVif::GetCodecPreset
virtual M31VideoPreset GetCodecPreset(void)
Get the codec preset.
Definition: ntv2encodehevcvif.cpp:354
NTV2EncodeHEVCVif::CodecHevcThreadStatic
static void CodecHevcThreadStatic(AJAThread *pThread, void *pContext)
This is the codec hevc thread's static callback function that gets called when the thread starts....
Definition: ntv2encodehevcvif.cpp:768
NTV2_FBF_10BIT_YCBCR_420PL2
@ NTV2_FBF_10BIT_YCBCR_420PL2
10-Bit 4:2:0 2-Plane YCbCr
Definition: ntv2enums.h:239
NTV2EncodeHEVCVif::SetupVideo
virtual AJAStatus SetupVideo(void)
Sets up everything I need for capturing video.
Definition: ntv2encodehevcvif.cpp:451
ntv2devicefeatures.h
Declares device capability functions.
NTV2EncodeHEVCVif::StartAVFileThread
virtual void StartAVFileThread(void)
Start the audio/video file writer thread.
Definition: ntv2encodehevcvif.cpp:846
NTV2EncodeHEVCVif::RouteInputSignal
virtual void RouteInputSignal(void)
Sets up device routing for capture.
Definition: ntv2encodehevcvif.cpp:528
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
ntv2demohevccommon.h
This file contains some structures, constants, classes and functions that are used in some of the hev...
CNTV2DemoHevcCommon
Definition: ntv2demohevccommon.h:56
NTV2DeviceID
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
NTV2FrameBufferFormat
NTV2FrameBufferFormat
Identifies a particular video frame buffer format. See Device Frame Buffer Formats for details.
Definition: ntv2enums.h:207
timecode.h
Declares the AJATimeCode class.
NTV2FrameRate
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:396
AJAThread
Definition: thread.h:69
timecodeburn.h
Declares the AJATimeCodeBurn class.
AJAStatus
AJAStatus
Definition: types.h:365
AJATimeBase
Definition: timebase.h:18
NTV2EncodeHEVCVif::~NTV2EncodeHEVCVif
virtual ~NTV2EncodeHEVCVif()
Definition: ntv2encodehevcvif.cpp:97
ntv2devicescanner.h
Declares the CNTV2DeviceScanner class.
NTV2EncodeHEVCVif::StartVideoInputThread
virtual void StartVideoInputThread(void)
Start the video input thread.
Definition: ntv2encodehevcvif.cpp:640
ntv2enums.h
Enumerations for controlling NTV2 devices.
CNTV2Card
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:262
M31_FILE_1280X720_420_8_5994p
@ M31_FILE_1280X720_420_8_5994p
Definition: ntv2m31enums.h:35
M31VideoPreset
M31VideoPreset
Definition: ntv2m31enums.h:12
NTV2EncodeHEVCVif::Run
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2encodehevcvif.cpp:614
VIDEO_RING_SIZE
#define VIDEO_RING_SIZE
Definition: ntv2encodehevcvif.h:29
NTV2EncodeHEVCVif::AVFileWorker
virtual void AVFileWorker(void)
Repeatedly removes hevc frame from the hevc ring and writes them to the hevc output file.
Definition: ntv2encodehevcvif.cpp:866
NTV2EncodeHEVCVif
Instances of me capture frames in real time from a video signal provided to an input of an AJA device...
Definition: ntv2encodehevcvif.h:38
NTV2InputSource
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1221
NTV2EncodeHEVCVif::Init
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2encodehevcvif.cpp:224
NTV2EncodeHEVCVif::Quit
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2encodehevcvif.cpp:160
NTV2AudioRate
NTV2AudioRate
Definition: ntv2enums.h:1873
NTV2EncodeHEVCVif::SetupHostBuffers
virtual void SetupHostBuffers(void)
Sets up my circular buffers.
Definition: ntv2encodehevcvif.cpp:379
videotypes.h
Declares the enumeration constants used in the ajabase library.
NTV2EncodeHEVCVif::CodecHevcWorker
virtual void CodecHevcWorker(void)
Repeatedly transfers hevc frames from the codec and adds them to the hevc ring.
Definition: ntv2encodehevcvif.cpp:778
NTV2EncodeHEVCVif::SetupAutoCirculate
virtual void SetupAutoCirculate(void)
Initializes AutoCirculate.
Definition: ntv2encodehevcvif.cpp:605
ntv2m31enums.h
Enumerations for controlling NTV2 devices with m31 HEVC encoders.
NTV2EncodeHEVCVif::AVFileThreadStatic
static void AVFileThreadStatic(AJAThread *pThread, void *pContext)
This is the video file writer thread's static callback function that gets called when the thread star...
Definition: ntv2encodehevcvif.cpp:856
NTV2VideoFormat
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
AVHevcStatus
Definition: ntv2demohevccommon.h:48
M31Channel
M31Channel
Definition: ntv2m31enums.h:225
NTV2EveryFrameTaskMode
NTV2EveryFrameTaskMode
Describes the task mode state. See also: Sharing AJA Devices With Other Applications.
Definition: ntv2publicinterface.h:4257
NTV2EncodeHEVCVif::StartCodecHevcThread
virtual void StartCodecHevcThread(void)
Start the codec hevc thread.
Definition: ntv2encodehevcvif.cpp:758
NTV2EncodeHEVCVif::GetStatus
virtual void GetStatus(AVHevcStatus *outInputStatus)
Provides status information about my input (capture) process.
Definition: ntv2encodehevcvif.cpp:1003
NTV2EncodeHEVCVif::NTV2EncodeHEVCVif
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.
Definition: ntv2encodehevcvif.cpp:44
NTV2EncodeHEVCVif::SetupAudio
virtual AJAStatus SetupAudio(void)
Sets up everything I need for capturing audio.
Definition: ntv2encodehevcvif.cpp:360
NTV2EncodeHEVCVif::VideoInputWorker
virtual void VideoInputWorker(void)
Repeatedly captures video frames using AutoCirculate and add them to the video input ring.
Definition: ntv2encodehevcvif.cpp:660
NTV2EncodeHEVCVif::TransferPictureInfo
virtual void TransferPictureInfo(CNTV2m31 *pM31)
Transfer picture information to the codec.
Definition: ntv2encodehevcvif.cpp:976
circularbuffer.h
Declaration of AJACircularBuffer template class.
NTV2AudioSystem
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information.
Definition: ntv2enums.h:3809
AVHevcDataBuffer
This structure encapsulates the video and audio buffers used by the HEVC demo applications....
Definition: ntv2demohevccommon.h:27
thread.h
Declares the AJAThread class.
NTV2EncodeHEVCVif::VideoInputThreadStatic
static void VideoInputThreadStatic(AJAThread *pThread, void *pContext)
This is the video input thread's static callback function that gets called when the thread starts....
Definition: ntv2encodehevcvif.cpp:650
AJACircularBuffer< AVHevcDataBuffer * >
timebase.h
Declares the AJATimeBase class.