From 4e5b2b0c3aeefffdd9613e33678cade25fac3fe4 Mon Sep 17 00:00:00 2001
From: Rafostar <rafostar.github@gmail.com>
Date: Sun, 10 Jan 2021 19:55:31 +0100
Subject: [PATCH] matroska: treat non-image structure as attachment and set
 mimetype

Otherwise each structure is named as GstTagImageInfo even if it does not contain any images
which is misleading. Also set the structure mimetype to fix assrender fonts detection.
---
 gst/matroska/matroska-read-common.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gst/matroska/matroska-read-common.c b/gst/matroska/matroska-read-common.c
index 90d6e38e1..628e19669 100644
--- a/gst/matroska/matroska-read-common.c
+++ b/gst/matroska/matroska-read-common.c
@@ -851,10 +851,13 @@ gst_matroska_read_common_parse_attached_file (GstMatroskaReadCommon * common,
     }
 
     /* Set filename and description in the info */
-    if (info == NULL)
-      info = gst_structure_new_empty ("GstTagImageInfo");
-
+    if (info == NULL) {
+      const gchar *structure_name = (image_type != GST_TAG_IMAGE_TYPE_NONE) ?
+          "GstTagImageInfo" : "GstTagAttachmentInfo";
+      info = gst_structure_new_empty (structure_name);
+    }
     gst_structure_set (info, "filename", G_TYPE_STRING, filename, NULL);
+    gst_structure_set (info, "mimetype", G_TYPE_STRING, mimetype, NULL);
     if (description)
       gst_structure_set (info, "description", G_TYPE_STRING, description, NULL);
 
-- 
2.28.0

