p26001-store-acs-soc-fw-app/video/ffmpeg/AudioEncoder.h
2026-09-28 21:33:04 +08:00

45 lines
1.3 KiB
C++

#ifndef D5F58729_9077_452E_ADC5_2D75E17601EA
#define D5F58729_9077_452E_ADC5_2D75E17601EA
/*
*******************************************************************************
* INCLUDE
*******************************************************************************
*/
#include "../core/AudioEncoder.h"
extern "C"
{
#include <libavcodec/avcodec.h>
}
#include <functional>
namespace Video
{
namespace FFmpeg
{
/*
*******************************************************************************
* CLASS DECLARE
*******************************************************************************
*/
class AudioEncoder: public Core::AudioEncoder
{
public:
AudioEncoder(Core::CodecID codecID);
~AudioEncoder();
protected:
void initialize() override;
void deinitialize() override;
Core::Packet::Ptr encode() override;
void onConfigChanged(ParameterNames& names) override;
uint64_t ts = 0;
private:
AVCodecContext* _pCodecCtx;
AVFrame* _pFrame;
AVPacket* _pPacket;
std::function<void(Core::Frame::Ptr, AVFrame*)> _frameConvertor;
};
}
}
#endif