Blame view

src/gb28181/FFGB28181Decoder.h 1.58 KB
3d2ab595   Hu Chunming   支持gb28181
1
2
3
4
5
6
7
8
  #ifndef _GB28181_DECODER_H_

  #define _GB28181_DECODER_H_

  

  #include "RTPReceiver.h"

  

  #include "../AbstractDecoder.h"

  

  #include <atomic>

92989af0   ming   更新解码器
9
  #include <mutex>

3d2ab595   Hu Chunming   支持gb28181
10
11
12
13
14
15
16
17
  

  struct AVFormatContext;

  struct AVCodecContext;

  struct AVCodec;

  struct AVFrame;

  struct AVPacket;

  struct SwsContext;

  

92989af0   ming   更新解码器
18
  using namespace std;

3d2ab595   Hu Chunming   支持gb28181
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  

  class FFGB28181Decoder: public AbstractDecoder

  {

  public:

  	FFGB28181Decoder();

  	~FFGB28181Decoder();

  

      bool init(FFDecConfig& cfg);

      void close();

      bool start();

      void pause();

      void resume();

  

      void setDecKeyframe(bool bKeyframe);

  

      bool isRunning();

      bool isFinished();

      bool isPausing();

      bool getResolution( int &width, int &height );

  

      bool isSurport(FFDecConfig& cfg);

  

      int getCachedQueueLength();

  

  	float fps();

  

      DECODER_TYPE getDecoderType(){ return DECODER_TYPE_GB28181; }

  

  public:

      void stream_callback(int videoType, char* data, int len, int isKey, uint64_t pts, uint64_t localPts);

  	void stream_end_callback();

92989af0   ming   更新解码器
50
      void post_decode_thread();

3d2ab595   Hu Chunming   支持gb28181
51
52
53
54
  

  private:

      AVCodecContext* m_pAVCodecCtx {};

      const AVCodec* m_pAVCodec {};

3d2ab595   Hu Chunming   支持gb28181
55
56
57
  

      int m_gpuid {-1};

  

372e629f   ming   gb28181支持TCP数据流
58
  	RTPReceiver* m_rtpPtr;

3d2ab595   Hu Chunming   支持gb28181
59
      int m_port;

3d2ab595   Hu Chunming   支持gb28181
60
61
62
63
64
65
66
67
68
69
70
71
72
  

      uint64_t  m_startPts {};

      uint64_t  m_lastPts {};   //上一次pts的值

  	uint64_t  m_curPts {};    //当前的pts	

  	uint64_t  m_diffPts {};

  

      uint32_t frameW {}, frameH {};

  	float m_fps {};

      int m_frameSkip {};

  	

      int log_count {};

      

      std::atomic_int m_status {};

92989af0   ming   更新解码器
73
74
75
76
  

      AVDictionary *gpu_options = nullptr;

  

      pthread_t m_post_decode_thread;

3d2ab595   Hu Chunming   支持gb28181
77
78
79
  };

  

  #endif // _GB28181_DECODER_H_