Kaynağa Gözat

add debug log w 2

DevYK 3 yıl önce
ebeveyn
işleme
2e74161914
1 değiştirilmiş dosya ile 5 ekleme ve 4 silme
  1. 5 4
      src/utils/video_similarity.cpp

+ 5 - 4
src/utils/video_similarity.cpp

@@ -72,12 +72,13 @@ int video_similarity_detection_start(long id, int force_keyframe,
         model->pts = video_frame->pts;
 //        LOGE("push pts >>>>= %lld \n", model->pts);
         (*lists)[index]->hashs.push_back(model);
-        fprintf(ctx->log, "image_hash ");
+        if (ctx->log)fprintf(ctx->log, "image_hash  \n");
         if (image_hash)
             free((void *) image_hash);
-        fprintf(ctx->log, "image_hash 2");
+        if (ctx->log) fprintf(ctx->log, "image_hash 2 \n");
         av_frame_free(&video_frame);
     }
+    if (ctx->log) fprintf(ctx->log, "loop exit \n");
     return 0;
 }
 
@@ -201,8 +202,8 @@ const char *get_video_similarity_list(const char *inputjson) {
             const char *name = GetFileName(((VideoSimilarityContext *) id)->video_path, n); //把字符串及其长度传给函数
             printf("%s\n", name); //name就是那个名称,可以输出
             char args[512];
-//            sprintf(args, "/Users/devyk/Data/Project/sample/github_code/OpenCVSample/temp/%s.log","test");
-            sprintf(args, "/datalog/%s.log", "test");
+//            sprintf(args, "/Users/devyk/Data/Project/sample/github_code/OpenCVSample/temp/%s.log",name);
+            sprintf(args, "/datalog/ffmpeg_opencv/%s.log", name);
             ((VideoSimilarityContext *) id)->log = fopen(args, "wb+");
             printf("args===%s \n", args);
             fprintf(((VideoSimilarityContext *) id)->log, inputjson);