From 0560a8fce4c9d005655fce5025bc0fda8c58bff8 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期一, 02 十二月 2019 16:15:47 +0800 Subject: [PATCH] update --- csrc/ffmpeg/format/FormatOut.hpp | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/csrc/ffmpeg/format/FormatOut.hpp b/csrc/ffmpeg/format/FormatOut.hpp index 35575d7..9aa9b15 100644 --- a/csrc/ffmpeg/format/FormatOut.hpp +++ b/csrc/ffmpeg/format/FormatOut.hpp @@ -14,8 +14,6 @@ namespace ffwrapper{ class VideoProp; - class CodedData; - class FrameData; class FormatOut { @@ -26,34 +24,32 @@ FormatOut(VideoProp &prop, const char *filename, char *format_name = NULL); - FormatOut(AVStream *in, const char *format_name); + FormatOut(const double fps, const char *format_name); void clear(); public: bool open(const char *filename, const char *format_name); bool openCodec(VideoProp &prop); - int encode(AVPacket &pkt, AVFrame *frame); - int encode(std::shared_ptr<CodedData> &data, - std::shared_ptr<FrameData> &frame_data); - int encode(std::shared_ptr<CodedData> &data,AVFrame *frame); + int encode(AVPacket *pkt, AVFrame *frame); public: - bool copyCodecFromIn(AVStream *in); + bool addStream(AVStream *s); + bool copyCodecFromIn(AVStream *v, AVStream *a); bool openResource(const char *filename, const int flags); bool closeResource(); - bool JustWriter(AVStream *in, const char *filename); + bool JustWriter(AVStream *v, AVStream *a, const char *filename); bool EncodeWriter(const char *filename); - bool writeFrame(AVPacket &pkt, const int64_t &frame_cnt, bool interleaved = true); - void adjustPTS(AVPacket &pkt, const int64_t &frame_cnt); + bool writeFrame(AVPacket *pkt, const int64_t &frame_cnt, bool interleaved = true); + void adjustPTS(AVPacket *pkt, const int64_t &frame_cnt); bool endWriter(); bool writeHeader(AVDictionary **options = NULL); - bool writeFrame2(AVPacket &pkt, bool interleaved); + bool writeFrame2(AVPacket *pkt, bool interleaved); bool writeTrailer(); public: - AVStream *getStream(){return v_s_;} + AVStream *getStream(); const AVCodecContext *getCodecContext() const; const double getFPS()const{return fps_;} @@ -65,7 +61,8 @@ void configEncoder(VideoProp &prop); private: AVFormatContext *ctx_; - AVStream *v_s_; + int v_idx_; + int a_idx_; AVCodecContext *enc_ctx_; int64_t sync_opts_; @@ -75,6 +72,9 @@ double fps_; std::string format_name_; + // rec + AVStream *in_v_stream_; + AVStream *in_a_stream_; }; } #endif \ No newline at end of file -- Gitblit v1.8.0