From 8fb24547e4d068cdcd491e59ddc451b3a252ea4b Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期二, 30 七月 2019 15:42:53 +0800 Subject: [PATCH] update rec frame id --- csrc/cffmpeg.cpp | 40 ++++++++++++++-------------------------- 1 files changed, 14 insertions(+), 26 deletions(-) diff --git a/csrc/cffmpeg.cpp b/csrc/cffmpeg.cpp index 956d33c..3383b31 100644 --- a/csrc/cffmpeg.cpp +++ b/csrc/cffmpeg.cpp @@ -58,12 +58,11 @@ s->FireRecorder(sid, id); } -char* c_ffmpeg_get_info_recorder(const cffmpeg h, char **sid, int *index, int *length){ +char* c_ffmpeg_get_info_recorder(const cffmpeg h, int *index, int *length){ Wrapper *s = (Wrapper*)h; int i; std::string p; - std::string id; - s->GetInfoRecorder(id, i, p); + s->GetInfoRecorder(i, p); // printf("cffmpeg get info : index : %d, file : %s\n", i, p.c_str()); @@ -72,12 +71,18 @@ char *path = (char*)malloc(*length + 1); memcpy(path, p.c_str(), *length); path[*length] = '\0'; - - *sid = (char*)malloc(id.length()+1); - memcpy(*sid, id.c_str(), id.length()); - *sid[id.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){ @@ -85,10 +90,10 @@ s->BuildDecoder(); } -void* c_ffmpeg_get_pic_decoder(const cffmpeg h, int *wid, int *hei){ +void* c_ffmpeg_get_pic_decoder(const cffmpeg h, int *wid, int *hei, int64_t *id){ Wrapper *s = (Wrapper*)h; unsigned char *data = NULL; - s->GetPicDecoder(&data, wid, hei); + s->GetPicDecoder(&data, wid, hei, id); return data; } @@ -98,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