Commit 3bd26b28 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/matroskadec: Export FileDescription as title tag

Each AttachedFile in Matroska can have a FileDescription element that
contains a human-friendly name for the attached file; yet this element
has been ignored up until now. This commit changes this and exports it
as title tag instead (the Matroska muxer mapped the title tag to the
AttachedFile element since support for Attachments was added).
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent 4ebfc13c
...@@ -259,6 +259,7 @@ typedef struct MatroskaTrack { ...@@ -259,6 +259,7 @@ typedef struct MatroskaTrack {
typedef struct MatroskaAttachment { typedef struct MatroskaAttachment {
uint64_t uid; uint64_t uid;
char *filename; char *filename;
char *description;
char *mime; char *mime;
EbmlBin bin; EbmlBin bin;
...@@ -587,7 +588,7 @@ static EbmlSyntax matroska_attachment[] = { ...@@ -587,7 +588,7 @@ static EbmlSyntax matroska_attachment[] = {
{ MATROSKA_ID_FILENAME, EBML_UTF8, 0, offsetof(MatroskaAttachment, filename) }, { MATROSKA_ID_FILENAME, EBML_UTF8, 0, offsetof(MatroskaAttachment, filename) },
{ MATROSKA_ID_FILEMIMETYPE, EBML_STR, 0, offsetof(MatroskaAttachment, mime) }, { MATROSKA_ID_FILEMIMETYPE, EBML_STR, 0, offsetof(MatroskaAttachment, mime) },
{ MATROSKA_ID_FILEDATA, EBML_BIN, 0, offsetof(MatroskaAttachment, bin) }, { MATROSKA_ID_FILEDATA, EBML_BIN, 0, offsetof(MatroskaAttachment, bin) },
{ MATROSKA_ID_FILEDESC, EBML_NONE }, { MATROSKA_ID_FILEDESC, EBML_UTF8, 0, offsetof(MatroskaAttachment, description) },
CHILD_OF(matroska_attachments) CHILD_OF(matroska_attachments)
}; };
...@@ -2914,6 +2915,8 @@ static int matroska_read_header(AVFormatContext *s) ...@@ -2914,6 +2915,8 @@ static int matroska_read_header(AVFormatContext *s)
break; break;
av_dict_set(&st->metadata, "filename", attachments[j].filename, 0); av_dict_set(&st->metadata, "filename", attachments[j].filename, 0);
av_dict_set(&st->metadata, "mimetype", attachments[j].mime, 0); av_dict_set(&st->metadata, "mimetype", attachments[j].mime, 0);
if (attachments[j].description)
av_dict_set(&st->metadata, "title", attachments[j].description, 0);
st->codecpar->codec_id = AV_CODEC_ID_NONE; st->codecpar->codec_id = AV_CODEC_ID_NONE;
for (i = 0; mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) { for (i = 0; mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment