//
// Created by 阳坤 on 2022/3/1.
//

#include "../ffmpeg/av_decode.h"
#include "../opencv/image_fingerprint.h"
#include "list"
#include "string.h"

#ifndef BYTESFLOW_OPENCV_MEDIA_VIDEO_SIMILARITY_H
#define BYTESFLOW_OPENCV_MEDIA_VIDEO_SIMILARITY_H

/**
 * 定义一个视频相似上下文结构体
 */
typedef struct VideoSimilarityContext {
    /*视频路径*/
    const char *video_path;
    /*强制使用关键帧检查*/
    int force_keyframe;
    /*检查帧数量*/
    int frame_count;
    /*解码器 id*/
    long decode_obj_id;

    FILE *log;
} VideoSimilarityContext;






VideoSimilarity *json2VideoSimilarity(const char *json);

const char *videoSimilarity2json(VideoSimilarity *videoSimilarity);

/**
 * 视频相似检测初始化
 * @param url 视频路径
 * @return 对象 id
 */
long video_similarity_detection_init(const char *url, VideoSimilarity **pSimilarity);

/**
 * 开始分析
 * @param force_keyframe 强制关键帧
 * @param start_time 开始时间
 * @param frame_count 解码帧的数量
 * */
int video_similarity_detection_start(long id, int force_keyframe,
                                     DisableMediaType disableMediaType, std::vector<VideoSimilarityModel *> *lists);

/**
 * 关闭
 * @return
 */
int video_similarity_detection_close(long id);



const char * get_video_similarity_list(const char * inputfile);

#endif //BYTESFLOW_OPENCV_MEDIA_VIDEO_SIMILARITY_H
