video analysis2.0拆分,ffmpeg封装go接口库
chenshijun
2019-07-17 803388b511d31b9e25f6829298bb12e06323474c
csrc/wrapper.hpp
@@ -15,6 +15,7 @@
namespace ffwrapper{
    class FormatIn;
    class FormatOut;
    class VideoProp;
    class CodedData;
@@ -26,6 +27,7 @@
enum WORKER{
    WORKER_RECORDER = 0,
    WORKER_DECODER,
    WORKER_ENCODER,
};
namespace cffmpeg_wrap{
@@ -76,6 +78,11 @@
            void GetPicDecoder(unsigned char **data, int *w, int *h);
            //active api
            void ActiveDecoder(FUNC_DEC fn);
        public:
            void BuildEncoder(const char *file, const int w, const int h, const int fps, const int br, const int gi);
            int init_encoder(ffwrapper::FormatIn *in, const char *file, const int w, const int h, const int fps, const int br, const int gi);
        private:
            std::string input_url_;
@@ -105,7 +112,15 @@
        //////////////////test frame to bgr24
        public:
            uint8_t *decodeJPEG(const char *file, int *w, int *h);
        private:
            ffwrapper::FormatOut *encoder_;
    };
    void *CreateEncoder(const int w, const int h, const int fps, const int br, const int scale_flag, const int gi);
    void DestroyEncoder(void *h);
    int Encode(void *hdl, uint8_t *in, const int w, const int h, uint8_t **out, int *size, int *key);
}
#endif