video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2019-09-28 a4cfd08f442fbf6febf06c98bbbed1723aaf5fd4
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
#ifndef _CV_FFMPEG_DATA_BRIDGE_H_
#define _CV_FFMPEG_DATA_BRIDGE_H_
 
#include <stdlib.h>
#include <stdint.h>
 
struct AVFrame;
 
namespace ffwrapper{
 
    class swscale_wrapper;
    class PicData;
 
    class cvbridge
    {
    public:
        cvbridge(int srcW, int srcH, int srcFmt, 
                     int dstW, int dstH, int dstFmt, int flags=4,
                     void *srcFilter=NULL,
                     void *dstFilter=NULL,
                     double *param=NULL);
        ~cvbridge();
    
    public:
        bool copyPicture(uint8_t *out, AVFrame *in);
 
        bool getAVFrame(uint8_t *in, const int w, const int h, AVFrame * &output);
        AVFrame *getAVFrame(uint8_t *in, const int w, const int h);
 
        AVFrame *getAVFrame(AVFrame *in);
        bool getAVFrame(AVFrame *in, AVFrame * &output);
 
    private:
        ffwrapper::swscale_wrapper         *scale_;
        ffwrapper::PicData                 *pic_;
        uint8_t                         *buff_fill_;
 
    };
    
}
#endif