From bfded635a544a1ab5d252739f4be4f7f30b39b7f Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期五, 26 七月 2019 14:46:48 +0800
Subject: [PATCH] update ffmpeg

---
 csrc/cffmpeg.cpp |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/csrc/cffmpeg.cpp b/csrc/cffmpeg.cpp
index cbb0b1f..f804054 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,18 +63,28 @@
     int i;
     std::string p;
     s->GetInfoRecorder(i, p);
-    if(p.empty()){
-        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){
     Wrapper *s = (Wrapper*)h;
     s->BuildDecoder();

--
Gitblit v1.8.0