]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_find_rect.c
avfilter/vf_psnr: remove unnecessary check
[ffmpeg] / libavfilter / vf_find_rect.c
index f9129cc140f85338837ebf850f9e8588093b4a45..1a94655b6b19609e52f9b4ec76adbe3d9f92ca84 100644 (file)
@@ -187,6 +187,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     float best_score;
     int best_x, best_y;
     int i;
+    char buf[32];
 
     foc->haystack_frame[0] = av_frame_clone(in);
     for (i=1; i<foc->mipmaps; i++) {
@@ -216,18 +217,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         }
     }
 
-    av_log(ctx, AV_LOG_INFO, "Found at n=%lld pts_time=%f x=%d y=%d with score=%f\n",
+    av_log(ctx, AV_LOG_INFO, "Found at n=%"PRId64" pts_time=%f x=%d y=%d with score=%f\n",
            inlink->frame_count_out, TS2D(in->pts) * av_q2d(inlink->time_base),
            best_x, best_y, best_score);
     foc->last_x = best_x;
     foc->last_y = best_y;
 
+    snprintf(buf, sizeof(buf), "%f", best_score);
+
     av_frame_make_writable(in);
 
     av_dict_set_int(&in->metadata, "lavfi.rect.w", foc->obj_frame->width, 0);
     av_dict_set_int(&in->metadata, "lavfi.rect.h", foc->obj_frame->height, 0);
     av_dict_set_int(&in->metadata, "lavfi.rect.x", best_x, 0);
     av_dict_set_int(&in->metadata, "lavfi.rect.y", best_y, 0);
+    av_dict_set(&in->metadata, "lavfi.rect.score", buf, 0);
 
     return ff_filter_frame(ctx->outputs[0], in);
 }
@@ -299,7 +303,7 @@ static const AVFilterPad foc_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_vf_find_rect = {
+const AVFilter ff_vf_find_rect = {
     .name            = "find_rect",
     .description     = NULL_IF_CONFIG_SMALL("Find a user specified object."),
     .priv_size       = sizeof(FOCContext),