From edba9b79174610b078840fc87942db85e8216d79 Mon Sep 17 00:00:00 2001 From: simon987 Date: Sun, 20 Feb 2022 10:43:34 -0500 Subject: [PATCH] Fix multiple content metadata bug --- third-party/libscan/libscan/media/media.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/third-party/libscan/libscan/media/media.c b/third-party/libscan/libscan/media/media.c index 9327e10..58a9eea 100644 --- a/third-party/libscan/libscan/media/media.c +++ b/third-party/libscan/libscan/media/media.c @@ -251,7 +251,7 @@ void append_tag_meta_if_not_exists(scan_media_ctx_t *ctx, document_t *doc, AVDic for (; *ptr; ++ptr) *ptr = (char) tolower(*ptr); __always_inline -static void append_audio_meta(AVFormatContext *pFormatCtx, document_t *doc) { +static void append_audio_meta(scan_media_ctx_t *ctx, AVFormatContext *pFormatCtx, document_t *doc) { AVDictionaryEntry *tag = NULL; while ((tag = av_dict_get(pFormatCtx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { @@ -269,7 +269,7 @@ static void append_audio_meta(AVFormatContext *pFormatCtx, document_t *doc) { } else if (strcmp(key, "album") == 0) { APPEND_TAG_META(MetaAlbum) } else if (strcmp(key, "comment") == 0) { - APPEND_TAG_META(MetaContent) + append_tag_meta_if_not_exists(ctx, doc, tag, MetaContent); } } } @@ -437,7 +437,7 @@ int decode_frame_and_save_thumbnail(scan_media_ctx_t *ctx, AVFormatContext *pFor return SAVE_THUMBNAIL_FAILED; } - if (ctx->tesseract_lang != NULL && IS_VIDEO(pFormatCtx)) { + if (ctx->tesseract_lang != NULL && IS_VIDEO(pFormatCtx) && thumbnail_index == 0) { ocr_image(ctx, doc, decoder, frame_and_packet->frame); }