Blame view

src/decoder/dvpp/depend_headers.h 1.83 KB
09c2d08c   Hu Chunming   arm交付版
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
  #ifndef __DEPEND_HEADERS_H__
  #define __DEPEND_HEADERS_H__
  
  #include <iostream>
  #include <utility>
  #include <chrono>
  #include <thread>
  #include <functional>
  #include <atomic>
  #include <fstream>
  #include <signal.h>
  #include <time.h>
  #include <unistd.h>
  #include <set>
  #include <mutex>
  #include <vector>
  #include <condition_variable>
  
  /*
  * 依赖模块外部的代码或库
  * 不要在此处添加模块内部的头文件
  */
  
  // ffmpeg c 所以编译的时候要加入从 extern导入的C 来声明否则连接失败
  extern "C" {
      #include "libavutil/imgutils.h"
      #include "libavutil/samplefmt.h"
      #include "libavformat/avformat.h"
      #include "libavcodec/avcodec.h"
c027963f   Hu Chunming   ffmpeg6.1.1版本的接收rtp
30
31
32
33
      #include "libavcodec/bsf.h"
  	#include "libavutil/opt.h"
  	#include "libavutil/timestamp.h"
  	#include "libswscale/swscale.h"
09c2d08c   Hu Chunming   arm交付版
34
35
36
37
38
39
40
41
  }
  
  
  #include "../interface/logger.hpp"
  #include "../interface/DeviceMemory.hpp"
  #include "../interface/interface_headers.h"
  #include "../interface/utiltools.hpp"
  
746db74c   Hu Chunming   实现recode
42
43
  
  struct DataPacket {
01fb8719   Hu Chunming   修复aclrtSetDevice造...
44
45
      uint8_t *pkt_data{nullptr};
      int   pkt_size{0};
746db74c   Hu Chunming   实现recode
46
47
48
      unsigned long long frame_nb{0};
      bool isKeyFrame{false};
  
01fb8719   Hu Chunming   修复aclrtSetDevice造...
49
50
51
52
53
54
55
56
      DataPacket(uint8_t *data, int size, unsigned long long frameNb, bool isKey) {
          pkt_data = (uint8_t*) malloc(size);
          memcpy(pkt_data, data, size);
          pkt_size = size;
          frame_nb = frameNb;
          isKeyFrame = isKey;
      }
  
746db74c   Hu Chunming   实现recode
57
      ~DataPacket(){
01fb8719   Hu Chunming   修复aclrtSetDevice造...
58
          if(pkt_data != nullptr) {
69ee81f3   Hu Chunming   提交websocket clien...
59
              // LOG_INFO("free frame_nb:{}", frame_nb);
01fb8719   Hu Chunming   修复aclrtSetDevice造...
60
61
              free(pkt_data);
              pkt_data = nullptr;
746db74c   Hu Chunming   实现recode
62
          }
01fb8719   Hu Chunming   修复aclrtSetDevice造...
63
64
65
          pkt_size = 0;
          frame_nb = 0;
          isKeyFrame = false;
746db74c   Hu Chunming   实现recode
66
67
68
      }
  };
  
bf661eb0   Hu Chunming   录像文件保存优化
69
70
71
72
73
74
75
76
77
78
79
80
81
  struct DataFrame {
      AVFrame* frame {nullptr};
      unsigned long long frame_nb{0};
      bool isKeyFrame{false};
  
      ~DataFrame(){
          if(frame != nullptr) {
              av_frame_free(&frame);
              frame = nullptr;
          }
      }
  };
  
09c2d08c   Hu Chunming   arm交付版
82
  #endif