From d2bec7c45f71a12734b359f10bda6302ecd8a657 Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期一, 29 七月 2019 11:49:22 +0800 Subject: [PATCH] Merge branch 'master' of ssh://192.168.1.14:29418/valib/goffmpeg --- csrc/cffmpeg.cpp | 43 ++++++++++++++++++------------------------- 1 files changed, 18 insertions(+), 25 deletions(-) diff --git a/csrc/cffmpeg.cpp b/csrc/cffmpeg.cpp index 423ef01..cdbd2f0 100644 --- a/csrc/cffmpeg.cpp +++ b/csrc/cffmpeg.cpp @@ -48,14 +48,14 @@ //////passive api -void c_ffmpeg_build_recorder(const cffmpeg h, const char *dir, int mind, int maxd){ +void c_ffmpeg_build_recorder(const cffmpeg h, const char* id, const char *dir, int mind, int maxd){ Wrapper *s = (Wrapper*)h; - s->BuildRecorder(dir, mind, maxd); + s->BuildRecorder(id, dir, mind, maxd); } -void c_ffmpeg_fire_recorder(const cffmpeg h, const int64_t id){ +void c_ffmpeg_fire_recorder(const cffmpeg h, const char* sid, const int64_t id){ Wrapper *s = (Wrapper*)h; - s->FireRecorder(id); + s->FireRecorder(sid, id); } char* c_ffmpeg_get_info_recorder(const cffmpeg h, int *index, int *length){ @@ -63,16 +63,26 @@ int i; std::string p; s->GetInfoRecorder(i, p); - if(i < 0){ - return NULL; - } + + // printf("cffmpeg get info : index : %d, file : %s\n", i, p.c_str()); + *index = i; *length = p.length(); char *path = (char*)malloc(*length + 1); memcpy(path, p.c_str(), *length); path[*length] = '\0'; - + return path; +} + +char* c_ffmpeg_get_rec_id(const cffmpeg h, const char* p, int *length){ + Wrapper *s = (Wrapper*)h; + std::string id = s->GetRecorderID(p); + *length = id.length(); + char *i = (char*)malloc(*length+1); + memcpy(i, id.c_str(), *length); + i[*length] = '\0'; + return i; } void c_ffmpeg_build_decoder(const cffmpeg h){ @@ -93,23 +103,6 @@ s->GetPacket(&data, size, key); return data; } -/////////////////////active api -void c_ffmpeg_active_recorder(const cffmpeg h, const char *dir, int mind, int maxd, - rec_func fn){ - Wrapper *s = (Wrapper*)h; - - s->ActiveRecorder(dir, mind, maxd,[fn](std::string &p, int &i){ - fn((char*)p.c_str(), i); - }); -} - -void c_ffmpeg_active_decoder(const cffmpeg h, dec_func fn){ - Wrapper *s = (Wrapper*)h; - s->ActiveDecoder([fn](void* d, int wid, int hei){ - fn(d, wid, hei); - }); -} - /////////////////////test void* c_ffmpeg_decode_jpeg(const cffmpeg h, const char *file, int *wid, int *hei){ -- Gitblit v1.8.0