Blame view

src/decoder/muxer.h 659 Bytes
4061a3c3   Hu Chunming   更换decoder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  #pragma once
  #include <memory>
  
  class AVFrame;
  class AVStream;
  class AVCodecContext;
  class AVFormatContext;
  
  class muxer
  {
  public:
  	muxer();
  	~muxer();
  
  	bool init(int w, int h, int fps, int bit_rate, char* outfile_name);
  	void uninit();
  	bool write_image(const uint8_t* bgr);
  	bool write_yuv(const uint8_t* yuv_data);
  	bool write_frame(const AVFrame* frame);
  	bool flush();
  	bool close();
  
  private:
  	bool bgr_to_yuv420p(const uint8_t* const buf_bgr, uint8_t* const buf_420p);
  
  private:
  	int width_;
  	int height_;
  	int y_size_;
  	int uv_size_;
  	int pts_;
  	AVCodecContext* codec_ctx_;
  	AVFormatContext* fmt_ctx_;
  	AVStream* out_stream_;
  	AVFrame* yuv_frame_;
  };