Blame view

src/decoder/gb28181/FFDecoder.h0 1017 Bytes
c8285c8d   Hu Chunming   GB28181 UDP 有重大进展...
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  #ifndef __FF_DECODER_H__
  #define __FF_DECODER_H__
  
  #include "../interface/interface_headers.h"
  
  extern "C" {
      #include "libavutil/avstring.h"
      #include "libavformat/avformat.h"
      #include "libswscale/swscale.h"
  }
  
  struct FrameData {
      AVFrame* frame {nullptr};
      unsigned long pts {0};
      bool bKeyframe {false};
  
      FrameData() {
          frame = av_frame_alloc();
      }
  
      ~FrameData() {
          if (frame) {
              av_frame_free(&frame);
              frame = nullptr;
          }
      }
  };
  
  class FFDecoder
  {
  public:
      FFDecoder(/* args */);
      ~FFDecoder();
  
      FrameData* Decode(int videoType, char* data, int len, int isKey, uint64_t pts);
  
  private:
      FrameData* ff_decode(int videoType, AVPacket* pkt);
  
  private:
      string m_dec_name;
  
      AVDictionary *gpu_options {nullptr};
      AVCodecContext* m_pAVCodecCtx {nullptr};
      const AVCodec* m_pAVCodec {nullptr};
  
      int m_devid {-1};
  
      int frameW {-1};
      int frameH {-1};
  	float m_fps {0.0};
  };
  
  
  
  
  #endif      // __FF_DECODER_H__