video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2023-12-26 18a05d269516a5e33d8460291c2f93e73d95adce
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
#ifndef _cffmpeg_decoder_hpp_
#define _cffmpeg_decoder_hpp_
 
#include <stdint.h>
#include <memory>
#include <list>
#include <mutex>
#include <thread>
#include <atomic>
#include <condition_variable>
 
struct AVFrame;
struct AVCodecContext;
 
class CPacket;
 
namespace ffwrapper
{
    class FormatIn;
    class CodedData;
} // namespace ffwrapper
 
namespace cffmpeg_wrap
{
    class decoder
    {
    private:
 
        ffwrapper::FormatIn *decRef_;
        
        std::list<CPacket> list_pkt_;
        std::mutex mutex_pkt_;
        
        int64_t next_idx_;
 
    private:
        int initDecoder();
    public: 
        void Start();
        int SetFrame(const CPacket &pkt);
        void GetFrame(unsigned char **data, int *w, int *h, int *format, int *length, int64_t *id);
    
    public:
        explicit decoder(ffwrapper::FormatIn *dec);
        ~decoder();
    };
    
} // namespace cffmpeg_wrap
 
 
#endif