调整各数据位置
This commit is contained in:
@@ -25,7 +25,7 @@ public:
|
||||
}
|
||||
virtual ~FrameRecviver()=default;
|
||||
|
||||
virtual void SetFrameRate(const AVRational &fr){frame_rate=fr;}
|
||||
virtual void OnFrameRate(const AVRational &fr){frame_rate=fr;}
|
||||
|
||||
virtual bool OnFrame(const AVFrame *frame)=0;
|
||||
|
||||
@@ -47,7 +47,7 @@ class RGBAFrameRecviver:public FrameRecviver
|
||||
private:
|
||||
|
||||
FrameConvert *convert=nullptr;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
bool OnFrame(const AVFrame *frame);
|
||||
|
@@ -169,7 +169,7 @@ public:
|
||||
|
||||
frame=av_frame_alloc();
|
||||
|
||||
frame_recviver->SetFrameRate(video_stream->avg_frame_rate);
|
||||
frame_recviver->OnFrameRate(video_stream->avg_frame_rate);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
@@ -71,9 +71,13 @@ namespace
|
||||
|
||||
class FFMPEGVideoEncoder:public VideoEncoder
|
||||
{
|
||||
AVFormatContext* fmt_ctx;
|
||||
AVCodecContext* codec_ctx;
|
||||
|
||||
const AVCodec *codec;
|
||||
|
||||
AVFrame *frame;
|
||||
uint bit_rate;
|
||||
|
||||
AVStream *video_stream=nullptr;
|
||||
uint pts;
|
||||
@@ -89,10 +93,12 @@ class FFMPEGVideoEncoder:public VideoEncoder
|
||||
|
||||
public:
|
||||
|
||||
FFMPEGVideoEncoder(const char *fn,const AVCodec *eco,const uint br):VideoEncoder(fn,br)
|
||||
FFMPEGVideoEncoder(const char *fn,const AVCodec *eco,const uint br):VideoEncoder(fn)
|
||||
{
|
||||
codec=eco;
|
||||
|
||||
bit_rate=br;
|
||||
|
||||
frame=av_frame_alloc();
|
||||
codec_ctx=avcodec_alloc_context3(codec);
|
||||
|
||||
|
@@ -19,33 +19,24 @@ class VideoEncoder
|
||||
{
|
||||
protected:
|
||||
|
||||
AVFormatContext* fmt_ctx;
|
||||
AVCodecContext* codec_ctx;
|
||||
|
||||
Size2u frame_size;
|
||||
AVRational frame_rate;
|
||||
uint bit_rate;
|
||||
Size2u frame_size;
|
||||
|
||||
char filename[_MAX_PATH];
|
||||
|
||||
public:
|
||||
|
||||
VideoEncoder(const char *fn,const uint br)
|
||||
VideoEncoder(const char *fn)
|
||||
{
|
||||
strcpy_s(filename,_MAX_PATH,fn);
|
||||
|
||||
bit_rate=br;
|
||||
}
|
||||
|
||||
AVFormatContext *GetFrmCtx(){return fmt_ctx;}
|
||||
AVCodecContext *GetCodecCtx(){return codec_ctx;}
|
||||
|
||||
virtual ~VideoEncoder()=default;
|
||||
|
||||
virtual void SetFrameRateSize(const AVRational &fr,const Size2u &size)
|
||||
{
|
||||
frame_size=size;
|
||||
frame_rate=fr;
|
||||
frame_size=size;
|
||||
}
|
||||
|
||||
virtual bool Init(int pass)=0;
|
||||
|
Reference in New Issue
Block a user