91 lines
2.7 KiB
C++
91 lines
2.7 KiB
C++
#ifndef F3099295_0B78_4FE9_A07D_1748943D2805
|
|
#define F3099295_0B78_4FE9_A07D_1748943D2805
|
|
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
#include "MPPChannel.h"
|
|
#include "../core/VideoEncoder.h"
|
|
#include "../core/CodecCapabilityManager.h"
|
|
#include "../../core/Notifications.h"
|
|
#include "util/HandlesManager.h"
|
|
#include <hi_mpi_venc.h>
|
|
#include <hi_mpi_vpss.h>
|
|
|
|
namespace Video
|
|
{
|
|
namespace MPP5
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DECLARE
|
|
*******************************************************************************
|
|
*/
|
|
class VideoEncoder: public MPPChannel, public Core::VideoEncoder
|
|
{
|
|
private:
|
|
class Preprocessor: public MPPChannel
|
|
{
|
|
public:
|
|
using Ptr = Poco::SharedPtr<Preprocessor>;
|
|
|
|
public:
|
|
Preprocessor(const std::string& name, uint32_t id);
|
|
~Preprocessor();
|
|
|
|
public:
|
|
void start(uint32_t iwidth, uint32_t iheight, uint32_t owidth, uint32_t oheight);
|
|
void stop();
|
|
|
|
uint32_t groupID() const;
|
|
const std::string& name() const;
|
|
|
|
private:
|
|
const std::string _name;
|
|
};
|
|
|
|
public:
|
|
VideoEncoder(Core::CodecID codecID);
|
|
~VideoEncoder();
|
|
|
|
protected:
|
|
void start() override;
|
|
void stop() override;
|
|
void initialize() override;
|
|
void deinitialize() override;
|
|
|
|
void onConfigChanged(ParameterNames& names) override;
|
|
void onLink(Core::Component::Ptr pPrevious) override;
|
|
void onUnlink(Core::Component::Ptr pPrevious) override;
|
|
|
|
void handlePreviousParameterChanged(const Poco::AutoPtr<Core::ParameterChangedNotification>& pNotication);
|
|
|
|
Core::VideoComponent::Ptr getPrevious();
|
|
int getSuitableGOP();
|
|
int getSuitableSFR();
|
|
int getSuitableDFR();
|
|
uint32_t getSuitableBitrate();
|
|
void getEncodeResolution(Core::VideoComponent::Ptr pPrevious, uint32_t& width, uint32_t& height);
|
|
|
|
void setChnAttrGOPMode(hi_venc_chn_attr& attr, Core::GOPMode mode, int gop);
|
|
void setChnAttrRateControl(hi_venc_chn_attr& attr, Core::CodecID codec, Core::BitrateControl bc, int gop, int sfr,
|
|
int dfr, uint32_t bitrate);
|
|
Core::Packet::Ptr readPacket(uint32_t timeout);
|
|
|
|
void releaseCapabilityHandle();
|
|
|
|
private:
|
|
Core::CodecCapabilityManager::Handle _handle;
|
|
Preprocessor _preprocessor;
|
|
|
|
public:
|
|
static void initModule();
|
|
static void deinitModule();
|
|
|
|
private:
|
|
static Core::CodecCapabilityManager _capabilityManager;
|
|
};
|
|
}
|
|
}
|
|
#endif
|