From 93f44a10e2e8942e57e62bb210a2ca7d206a51b7 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期二, 24 九月 2019 11:26:44 +0800
Subject: [PATCH] add rec audio;

---
 csrc/ffmpeg/format/FormatOut.hpp |   25 ++++++++++---------------
 1 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/csrc/ffmpeg/format/FormatOut.hpp b/csrc/ffmpeg/format/FormatOut.hpp
index 2fbe47b..fc6fa1b 100644
--- a/csrc/ffmpeg/format/FormatOut.hpp
+++ b/csrc/ffmpeg/format/FormatOut.hpp
@@ -15,8 +15,6 @@
 
 namespace ffwrapper{
 	class VideoProp;
-	class CodedData;
-	class FrameData;
 
 	class FormatOut
 	{
@@ -34,28 +32,24 @@
 		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(std::vector<AVStream*> in);
+		bool copyCodecFromIn(AVFormatContext* in);
 		bool openResource(const char *filename, const int flags);
 		bool closeResource();
 
-		bool JustWriter(std::vector<AVStream*> in, const char *filename);
+		bool JustWriter(AVFormatContext* in, 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);
-		void adjustVideoPTS(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_;}
@@ -67,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_;
@@ -78,7 +73,7 @@
 		std::string 			format_name_;
 
 		// rec
-		std::vector<AVStream*>	streams_;
+		AVFormatContext 		*in_ctx_;
 	};
 }
 #endif
\ No newline at end of file

--
Gitblit v1.8.0