video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2020-09-01 e62936fa4a4b626a359bce8981ebbbaddcd4aada
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
#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:
        uint8_t* convert2Data(AVFrame *in);
        AVFrame* convert2Frame(AVFrame *in);
 
        static AVFrame *fillFrame(uint8_t *in, const int w, const int h, const int f);
        static uint8_t* extractFrame(AVFrame *in, int *length);
 
    private:
        ffwrapper::swscale_wrapper         *scale_;
        ffwrapper::PicData                 *pic_;
 
    };
    
}
#endif