| | |
| | | void c_ffmpeg_destroy(const cffmpeg h); |
| | | void c_ffmpeg_run(const cffmpeg h, const char *input); |
| | | |
| | | int c_ffmpeg_get_fps(const cffmpeg h); |
| | | void c_ffmpeg_run_gb28181(const cffmpeg h); |
| | | void c_ffmepg_use_cpu(const cffmpeg h); |
| | | /////////passive api |
| | |
| | | s->RunStream(input); |
| | | } |
| | | |
| | | int c_ffmpeg_get_fps(const cffmpeg h){ |
| | | Wrapper *s = (Wrapper*)h; |
| | | return s->GetFPS(); |
| | | } |
| | | |
| | | void c_ffmpeg_run_gb28181(const cffmpeg h){ |
| | | Wrapper *s = (Wrapper*)h; |
| | | s->GB28181(); |
| | |
| | | ,decoder_(nullptr) |
| | | ,rec_(new rec) |
| | | ,logit_(false) |
| | | ,fps_(25) |
| | | { |
| | | makeTheWorld(); |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | fps_ = in->getFPS(); |
| | | |
| | | int wTime = 1000000.0 / in->getFPS() ; |
| | | wTime >>= 1; |
| | | logIt("WAIT TIME PER FRAME: %d", wTime); |
| | |
| | | void CPUDec(){cpu_ = 1;} |
| | | void AudioSwitch(const bool a); |
| | | void SetRecMinCacheTime(const int mind); |
| | | |
| | | int GetFPS(){return fps_;} |
| | | public: //decoder |
| | | void BuildDecoder(); |
| | | void GetPicDecoder(unsigned char **data, int *w, int *h, int *format, int *length, int64_t *id); |
| | |
| | | // 录像请求缓存,等待runstream后添加 |
| | | std::function<void()> fn_rec_lazy_; |
| | | bool logit_; |
| | | int fps_; |
| | | }; |
| | | |
| | | uint8_t* Decode(const char *file, const int gb, int *w, int *h); |
| | |
| | | |
| | | C.wrap_fn_run(unsafe.Pointer(libcffmpeg), h.ffmpeg, in) |
| | | } |
| | | |
| | | // FPS fps |
| | | func (h *GoFFMPEG) FPS() int { |
| | | return int(C.wrap_fn_fps(unsafe.Pointer(libcffmpeg), h.ffmpeg)) |
| | | } |
| | |
| | | fn_run(h, input); |
| | | } |
| | | |
| | | int wrap_fn_fps(void *lib, const cffmpeg h){ |
| | | if(!fn_fps){ |
| | | fn_fps = (lib_cffmpeg_fps)dlsym(lib, "c_ffmpeg_get_fps"); |
| | | if (!fn_fps) return 25; |
| | | } |
| | | return fn_fps(h); |
| | | } |
| | | |
| | | void wrap_fn_run_gb28181(void *lib, const cffmpeg h){ |
| | | if (!fn_gb28181){ |
| | | fn_gb28181 = (lib_cffmpeg_gb28181)dlsym(lib, "c_ffmpeg_run_gb28181"); |
| | |
| | | typedef cffmpeg(*lib_cffmpeg_create2)(const char*); |
| | | typedef void (*lib_cffmpeg_destroy)(const cffmpeg); |
| | | typedef void (*lib_cffmpeg_run)(const cffmpeg, const char*); |
| | | typedef int (*lib_cffmpeg_fps)(const cffmpeg); |
| | | typedef void (*lib_cffmpeg_gb28181)(const cffmpeg); |
| | | typedef void (*lib_cffmpeg_cpu)(const cffmpeg); |
| | | typedef void (*lib_cffmpeg_rec_duration)(const cffmpeg, const int, const int); |
| | |
| | | static lib_cffmpeg_create2 fn_create2 = NULL; |
| | | static lib_cffmpeg_destroy fn_destroy = NULL; |
| | | static lib_cffmpeg_run fn_run = NULL; |
| | | static lib_cffmpeg_fps fn_fps = NULL; |
| | | static lib_cffmpeg_gb28181 fn_gb28181 = NULL; |
| | | static lib_cffmpeg_cpu fn_cpu = NULL; |
| | | static lib_cffmpeg_rec_duration fn_rec_duration = NULL; |
| | |
| | | cffmpeg wrap_fn_create2(void *lib, const char *logfile); |
| | | void wrap_fn_destroy(void *lib, const cffmpeg h); |
| | | void wrap_fn_run(void *lib, const cffmpeg h, const char* input); |
| | | int wrap_fn_fps(void *lib, const cffmpeg h); |
| | | void wrap_fn_run_gb28181(void *lib, const cffmpeg h); |
| | | void wrap_fn_use_cpu(void *lib, const cffmpeg h); |
| | | void wrap_fn_rec_duration(void *lib, const cffmpeg h, const int min, const int max); |