Logo
ApraPipes 1.0
Loading...
Searching...
No Matches
H264EncoderNVCodec.h
1#pragma once
2
3#include "Module.h"
4#include "CudaCommon.h"
5
10{
11public:
22
33 H264EncoderNVCodecProps(const uint32_t &_bitRateKbps, const apracucontext_sp& _cuContext, const uint32_t &_gopLength,const uint32_t &_frameRate,H264CodecProfile _vProfile,bool _enableBFrames)
34 : cuContext(_cuContext), gopLength(_gopLength), frameRate(_frameRate), bitRateKbps(_bitRateKbps), vProfile(_vProfile), enableBFrames(_enableBFrames)
35 {
36 }
37
43 H264EncoderNVCodecProps(apracucontext_sp& _cuContext) : bitRateKbps(0), cuContext(_cuContext)
44 {
45 }
46
58 H264EncoderNVCodecProps(const uint32_t &_bitRateKbps, const apracucontext_sp& _cuContext, const uint32_t &_gopLength,const uint32_t &_frameRate,H264CodecProfile _vProfile,bool _enableBFrames, uint32_t &_bufferThres)
59 : cuContext(_cuContext), gopLength(_gopLength), frameRate(_frameRate), bitRateKbps(_bitRateKbps), vProfile(_vProfile), enableBFrames(_enableBFrames), bufferThres(_bufferThres)
60 {
61 }
62
64 bool enableBFrames = false;
65 uint32_t gopLength = 30;
66 uint32_t bitRateKbps = 1000;
67 uint32_t frameRate = 30;
68 apracucontext_sp cuContext;
69 uint32_t bufferThres = 30;
70};
71
73{
74
75public:
77 virtual ~H264EncoderNVCodec();
78 bool init();
79 bool term();
80 bool getSPSPPS(void*& buffer, size_t& size, int& width, int& height);
81
82protected:
83 bool process(frame_container& frames);
84 bool processSOS(frame_sp& frame);
85 bool validateInputPins();
86 bool validateOutputPins();
87 bool shouldTriggerSOS();
88 bool processEOS(string& pinId);
89private:
90 class Detail;
91 boost::shared_ptr<Detail> mDetail;
92
94 framemetadata_sp mOutputMetadata;
95 std::string mInputPinId;
96 std::string mOutputPinId;
97
99};
Properties for the H264 encoder using NVCodec.
Definition H264EncoderNVCodec.h:10
uint32_t gopLength
Definition H264EncoderNVCodec.h:65
bool enableBFrames
Definition H264EncoderNVCodec.h:64
uint32_t bufferThres
Definition H264EncoderNVCodec.h:69
uint32_t frameRate
Definition H264EncoderNVCodec.h:67
apracucontext_sp cuContext
Definition H264EncoderNVCodec.h:68
H264EncoderNVCodecProps(const uint32_t &_bitRateKbps, const apracucontext_sp &_cuContext, const uint32_t &_gopLength, const uint32_t &_frameRate, H264CodecProfile _vProfile, bool _enableBFrames)
Constructor for H264EncoderNVCodecProps with all parameters.
Definition H264EncoderNVCodec.h:33
H264EncoderNVCodecProps(apracucontext_sp &_cuContext)
Constructor for H264EncoderNVCodecProps with default bit rate.
Definition H264EncoderNVCodec.h:43
H264CodecProfile vProfile
Definition H264EncoderNVCodec.h:63
H264EncoderNVCodecProps(const uint32_t &_bitRateKbps, const apracucontext_sp &_cuContext, const uint32_t &_gopLength, const uint32_t &_frameRate, H264CodecProfile _vProfile, bool _enableBFrames, uint32_t &_bufferThres)
Constructor for H264EncoderNVCodecProps with buffer threshold.
Definition H264EncoderNVCodec.h:58
uint32_t bitRateKbps
Definition H264EncoderNVCodec.h:66
H264CodecProfile
Enum representing different H.264 codec profiles.
Definition H264EncoderNVCodec.h:17
@ MAIN
Definition H264EncoderNVCodec.h:19
@ BASELINE
Definition H264EncoderNVCodec.h:18
@ HIGH
Definition H264EncoderNVCodec.h:20
Definition H264EncoderNVCodec.cpp:19
Definition H264EncoderNVCodec.h:73
std::string mOutputPinId
Definition H264EncoderNVCodec.h:96
bool process(frame_container &frames)
Definition H264EncoderNVCodec.cpp:169
bool mShouldTriggerSOS
Definition H264EncoderNVCodec.h:93
H264EncoderNVCodecProps props
Definition H264EncoderNVCodec.h:98
bool validateOutputPins()
Definition H264EncoderNVCodec.cpp:132
bool shouldTriggerSOS()
Definition H264EncoderNVCodec.cpp:230
virtual ~H264EncoderNVCodec()
Definition H264EncoderNVCodec.cpp:102
framemetadata_sp mOutputMetadata
Definition H264EncoderNVCodec.h:94
bool init()
Definition H264EncoderNVCodec.cpp:151
boost::shared_ptr< Detail > mDetail
Definition H264EncoderNVCodec.h:91
H264EncoderNVCodec(H264EncoderNVCodecProps _props)
Definition H264EncoderNVCodec.cpp:95
bool processEOS(string &pinId)
Definition H264EncoderNVCodec.cpp:235
bool term()
Definition H264EncoderNVCodec.cpp:161
bool validateInputPins()
Definition H264EncoderNVCodec.cpp:104
bool getSPSPPS(void *&buffer, size_t &size, int &width, int &height)
Definition H264EncoderNVCodec.cpp:178
bool processSOS(frame_sp &frame)
Definition H264EncoderNVCodec.cpp:183
std::string mInputPinId
Definition H264EncoderNVCodec.h:95
Definition Module.h:33
Definition Module.h:151