2
2
* Matroska file demuxer
3
* Copyright (c) 2003-2008 The FFmpeg Project
5
* This file is part of FFmpeg.
7
* FFmpeg is free software; you can redistribute it and/or
3
* Copyright (c) 2003-2008 The Libav Project
5
* This file is part of Libav.
7
* Libav is free software; you can redistribute it and/or
8
8
* modify it under the terms of the GNU Lesser General Public
9
9
* License as published by the Free Software Foundation; either
10
10
* version 2.1 of the License, or (at your option) any later version.
12
* FFmpeg is distributed in the hope that it will be useful,
12
* Libav is distributed in the hope that it will be useful,
13
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
15
* Lesser General Public License for more details.
17
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with FFmpeg; if not, write to the Free Software
18
* License along with Libav; if not, write to the Free Software
19
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
336
339
{ MATROSKA_ID_TRACKDEFAULTDURATION, EBML_UINT, 0, offsetof(MatroskaTrack,default_duration) },
337
340
{ MATROSKA_ID_TRACKTIMECODESCALE, EBML_FLOAT,0, offsetof(MatroskaTrack,time_scale), {.f=1.0} },
338
341
{ MATROSKA_ID_TRACKFLAGDEFAULT, EBML_UINT, 0, offsetof(MatroskaTrack,flag_default), {.u=1} },
342
{ MATROSKA_ID_TRACKFLAGFORCED, EBML_UINT, 0, offsetof(MatroskaTrack,flag_forced), {.u=0} },
339
343
{ MATROSKA_ID_TRACKVIDEO, EBML_NEST, 0, offsetof(MatroskaTrack,video), {.n=matroska_track_video} },
340
344
{ MATROSKA_ID_TRACKAUDIO, EBML_NEST, 0, offsetof(MatroskaTrack,audio), {.n=matroska_track_audio} },
341
345
{ MATROSKA_ID_TRACKCONTENTENCODINGS,EBML_NEST, 0, 0, {.n=matroska_track_encodings} },
342
346
{ MATROSKA_ID_TRACKFLAGENABLED, EBML_NONE },
343
{ MATROSKA_ID_TRACKFLAGFORCED, EBML_NONE },
344
347
{ MATROSKA_ID_TRACKFLAGLACING, EBML_NONE },
345
348
{ MATROSKA_ID_CODECNAME, EBML_NONE },
346
349
{ MATROSKA_ID_CODECDECODEALL, EBML_NONE },
426
429
{ MATROSKA_ID_TAGSTRING, EBML_UTF8, 0, offsetof(MatroskaTag,string) },
427
430
{ MATROSKA_ID_TAGLANG, EBML_STR, 0, offsetof(MatroskaTag,lang), {.s="und"} },
428
431
{ MATROSKA_ID_TAGDEFAULT, EBML_UINT, 0, offsetof(MatroskaTag,def) },
432
{ MATROSKA_ID_TAGDEFAULT_BUG, EBML_UINT, 0, offsetof(MatroskaTag,def) },
429
433
{ MATROSKA_ID_SIMPLETAG, EBML_NEST, sizeof(MatroskaTag), offsetof(MatroskaTag,sub), {.n=matroska_simpletag} },
469
473
{ MATROSKA_ID_CUES, EBML_NEST, 0, 0, {.n=matroska_index } },
470
474
{ MATROSKA_ID_TAGS, EBML_NEST, 0, 0, {.n=matroska_tags } },
471
475
{ MATROSKA_ID_SEEKHEAD, EBML_NEST, 0, 0, {.n=matroska_seekhead } },
472
{ MATROSKA_ID_CLUSTER, EBML_STOP, 0, offsetof(MatroskaDemuxContext,has_cluster_id) },
476
{ MATROSKA_ID_CLUSTER, EBML_STOP },
513
517
static int ebml_level_end(MatroskaDemuxContext *matroska)
515
ByteIOContext *pb = matroska->ctx->pb;
516
int64_t pos = url_ftell(pb);
519
AVIOContext *pb = matroska->ctx->pb;
520
int64_t pos = avio_tell(pb);
518
522
if (matroska->num_levels > 0) {
519
523
MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
520
if (pos - level->start >= level->length) {
524
if (pos - level->start >= level->length || matroska->current_id) {
521
525
matroska->num_levels--;
534
538
* Returns: number of bytes read, < 0 on error
536
static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
540
static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
537
541
int max_size, uint64_t *number)
539
int len_mask = 0x80, read = 1, n = 1;
542
/* The first byte tells us the length in bytes - get_byte() can normally
546
/* The first byte tells us the length in bytes - avio_r8() can normally
543
547
* return 0, but since that's not a valid first ebmlID byte, we can
544
548
* use it safely here to catch EOS. */
545
if (!(total = get_byte(pb))) {
549
if (!(total = avio_r8(pb))) {
546
550
/* we might encounter EOS here */
548
int64_t pos = url_ftell(pb);
551
if (!pb->eof_reached) {
552
int64_t pos = avio_tell(pb);
549
553
av_log(matroska->ctx, AV_LOG_ERROR,
550
554
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
556
560
/* get the length of the EBML number */
557
while (read <= max_size && !(total & len_mask)) {
561
read = 8 - ff_log2_tab[total];
561
562
if (read > max_size) {
562
int64_t pos = url_ftell(pb) - 1;
563
int64_t pos = avio_tell(pb) - 1;
563
564
av_log(matroska->ctx, AV_LOG_ERROR,
564
565
"Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n",
565
566
(uint8_t) total, pos, pos);
569
570
/* read out length */
571
total ^= 1 << ff_log2_tab[total];
571
572
while (n++ < read)
572
total = (total << 8) | get_byte(pb);
573
total = (total << 8) | avio_r8(pb);
581
* Read a EBML length value.
582
* This needs special handling for the "unknown length" case which has multiple
585
static int ebml_read_length(MatroskaDemuxContext *matroska, AVIOContext *pb,
588
int res = ebml_read_num(matroska, pb, 8, number);
589
if (res > 0 && *number + 1 == 1ULL << (7 * res))
590
*number = 0xffffffffffffffULL;
580
595
* Read the next element as an unsigned int.
581
596
* 0 is success, < 0 is failure.
583
static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
598
static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num)
587
if (size < 1 || size > 8)
588
603
return AVERROR_INVALIDDATA;
590
605
/* big-endian ordering; build up number */
592
607
while (n++ < size)
593
*num = (*num << 8) | get_byte(pb);
608
*num = (*num << 8) | avio_r8(pb);
599
614
* Read the next element as a float.
600
615
* 0 is success, < 0 is failure.
602
static int ebml_read_float(ByteIOContext *pb, int size, double *num)
617
static int ebml_read_float(AVIOContext *pb, int size, double *num)
605
*num= av_int2flt(get_be32(pb));
621
} else if (size == 4) {
622
*num= av_int2flt(avio_rb32(pb));
606
623
} else if(size==8){
607
*num= av_int2dbl(get_be64(pb));
624
*num= av_int2dbl(avio_rb64(pb));
609
626
return AVERROR_INVALIDDATA;
615
632
* Read the next element as an ASCII string.
616
633
* 0 is success, < 0 is failure.
618
static int ebml_read_ascii(ByteIOContext *pb, int size, char **str)
635
static int ebml_read_ascii(AVIOContext *pb, int size, char **str)
621
638
/* EBML strings are usually not 0-terminated, so we allocate one
622
639
* byte more, read the string and NULL-terminate it ourselves. */
623
640
if (!(*str = av_malloc(size + 1)))
624
641
return AVERROR(ENOMEM);
625
if (get_buffer(pb, (uint8_t *) *str, size) != size) {
642
if (avio_read(pb, (uint8_t *) *str, size) != size) {
627
644
return AVERROR(EIO);
629
646
(*str)[size] = '\0';
635
652
* Read the next element as binary data.
636
653
* 0 is success, < 0 is failure.
638
static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
655
static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin)
640
657
av_free(bin->data);
641
658
if (!(bin->data = av_malloc(length)))
642
659
return AVERROR(ENOMEM);
644
661
bin->size = length;
645
bin->pos = url_ftell(pb);
646
if (get_buffer(pb, bin->data, length) != length)
662
bin->pos = avio_tell(pb);
663
if (avio_read(pb, bin->data, length) != length) {
664
av_freep(&bin->data);
647
665
return AVERROR(EIO);
654
673
* are supposed to be sub-elements which can be read separately.
655
674
* 0 is success, < 0 is failure.
657
static int ebml_read_master(MatroskaDemuxContext *matroska, int length)
676
static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length)
659
ByteIOContext *pb = matroska->ctx->pb;
678
AVIOContext *pb = matroska->ctx->pb;
660
679
MatroskaLevel *level;
662
681
if (matroska->num_levels >= EBML_MAX_DEPTH) {
679
698
static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska,
680
699
uint8_t *data, uint32_t size, uint64_t *num)
683
init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL);
684
return ebml_read_num(matroska, &pb, 8, num);
702
ffio_init_context(&pb, data, size, 0, NULL, NULL, NULL, NULL);
703
return ebml_read_num(matroska, &pb, FFMIN(size, 8), num);
713
732
for (i=0; syntax[i].id; i++)
714
733
if (id == syntax[i].id)
735
if (!syntax[i].id && id == MATROSKA_ID_CLUSTER &&
736
matroska->num_levels > 0 &&
737
matroska->levels[matroska->num_levels-1].length == 0xffffffffffffff)
738
return 0; // we reached the end of an unknown size cluster
716
739
if (!syntax[i].id && id != EBML_ID_VOID && id != EBML_ID_CRC32)
717
740
av_log(matroska->ctx, AV_LOG_INFO, "Unknown entry 0x%X\n", id);
718
741
return ebml_parse_elem(matroska, &syntax[i], data);
721
744
static int ebml_parse(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
725
int res = ebml_read_num(matroska, matroska->ctx->pb, 4, &id);
727
return res < 0 ? res : ebml_parse_id(matroska, syntax, id, data);
747
if (!matroska->current_id) {
749
int res = ebml_read_num(matroska, matroska->ctx->pb, 4, &id);
752
matroska->current_id = id | 1 << 7*res;
754
return ebml_parse_id(matroska, syntax, matroska->current_id, data);
730
757
static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
755
782
static int ebml_parse_elem(MatroskaDemuxContext *matroska,
756
783
EbmlSyntax *syntax, void *data)
758
ByteIOContext *pb = matroska->ctx->pb;
785
static const uint64_t max_lengths[EBML_TYPE_COUNT] = {
788
// max. 16 MB for strings
789
[EBML_STR] = 0x1000000,
790
[EBML_UTF8] = 0x1000000,
791
// max. 256 MB for binary data
792
[EBML_BIN] = 0x10000000,
793
// no limits for anything else
795
AVIOContext *pb = matroska->ctx->pb;
759
796
uint32_t id = syntax->id;
772
if (syntax->type != EBML_PASS && syntax->type != EBML_STOP)
773
if ((res = ebml_read_num(matroska, pb, 8, &length)) < 0)
809
if (syntax->type != EBML_PASS && syntax->type != EBML_STOP) {
810
matroska->current_id = 0;
811
if ((res = ebml_read_length(matroska, pb, &length)) < 0)
813
if (max_lengths[syntax->type] && length > max_lengths[syntax->type]) {
814
av_log(matroska->ctx, AV_LOG_ERROR,
815
"Invalid length 0x%"PRIx64" > 0x%"PRIx64" for syntax element %i\n",
816
length, max_lengths[syntax->type], syntax->type);
817
return AVERROR_INVALIDDATA;
776
821
switch (syntax->type) {
777
822
case EBML_UINT: res = ebml_read_uint (pb, length, data); break;
782
827
case EBML_NEST: if ((res=ebml_read_master(matroska, length)) < 0)
784
829
if (id == MATROSKA_ID_SEGMENT)
785
matroska->segment_start = url_ftell(matroska->ctx->pb);
830
matroska->segment_start = avio_tell(matroska->ctx->pb);
786
831
return ebml_parse_nest(matroska, syntax->def.n, data);
787
832
case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data);
788
case EBML_STOP: *(int *)data = 1; return 1;
789
default: return url_fseek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0;
833
case EBML_STOP: return 1;
834
default: return avio_skip(pb,length)<0 ? AVERROR(EIO) : 0;
791
836
if (res == AVERROR_INVALIDDATA)
792
837
av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n");
1004
1052
for (i=0; i < list->nb_elem; i++) {
1005
1053
const char *lang = strcmp(tags[i].lang, "und") ? tags[i].lang : NULL;
1055
if (!tags[i].name) {
1056
av_log(s, AV_LOG_WARNING, "Skipping invalid tag with no TagName.\n");
1006
1059
if (prefix) snprintf(key, sizeof(key), "%s/%s", prefix, tags[i].name);
1007
1060
else av_strlcpy(key, tags[i].name, sizeof(key));
1008
1061
if (tags[i].def || !lang) {
1018
1071
matroska_convert_tag(s, &tags[i].sub, metadata, key);
1074
ff_metadata_conv(metadata, NULL, ff_mkv_metadata_conv);
1023
1077
static void matroska_convert_tags(AVFormatContext *s)
1057
1111
EbmlList *seekhead_list = &matroska->seekhead;
1058
1112
MatroskaSeekhead *seekhead = seekhead_list->elem;
1059
1113
uint32_t level_up = matroska->level_up;
1060
int64_t before_pos = url_ftell(matroska->ctx->pb);
1114
int64_t before_pos = avio_tell(matroska->ctx->pb);
1115
uint32_t saved_id = matroska->current_id;
1061
1116
MatroskaLevel level;
1119
// we should not do any seeking in the streaming case
1120
if (!matroska->ctx->pb->seekable ||
1121
(matroska->ctx->flags & AVFMT_FLAG_IGNIDX))
1064
1124
for (i=0; i<seekhead_list->nb_elem; i++) {
1065
1125
int64_t offset = seekhead[i].pos + matroska->segment_start;
1073
if (url_fseek(matroska->ctx->pb, offset, SEEK_SET) != offset)
1133
if (avio_seek(matroska->ctx->pb, offset, SEEK_SET) != offset)
1076
1136
/* We don't want to lose our seekhead level, so we add
1086
1146
level.length = (uint64_t)-1;
1087
1147
matroska->levels[matroska->num_levels] = level;
1088
1148
matroska->num_levels++;
1149
matroska->current_id = 0;
1090
1151
ebml_parse(matroska, matroska_segment, matroska);
1100
1161
/* seek back */
1101
url_fseek(matroska->ctx->pb, before_pos, SEEK_SET);
1162
avio_seek(matroska->ctx->pb, before_pos, SEEK_SET);
1102
1163
matroska->level_up = level_up;
1164
matroska->current_id = saved_id;
1105
1167
static int matroska_aac_profile(char *codec_id)
1158
1220
if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) {
1159
1221
av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype);
1161
av_metadata_set2(&s->metadata, "doctype", ebml.doctype, 0);
1162
1223
ebml_free(ebml_syntax, &ebml);
1164
1225
/* The next thing is a segment. */
1165
if (ebml_parse(matroska, matroska_segments, matroska) < 0)
1226
if ((res = ebml_parse(matroska, matroska_segments, matroska)) < 0)
1167
1228
matroska_execute_seekhead(matroska);
1230
if (!matroska->time_scale)
1231
matroska->time_scale = 1000000;
1169
1232
if (matroska->duration)
1170
1233
matroska->ctx->duration = matroska->duration * matroska->time_scale
1171
1234
* 1000 / AV_TIME_BASE;
1266
1329
} else if (!strcmp(track->codec_id, "A_MS/ACM")
1267
1330
&& track->codec_priv.size >= 14
1268
1331
&& track->codec_priv.data != NULL) {
1269
init_put_byte(&b, track->codec_priv.data, track->codec_priv.size,
1270
URL_RDONLY, NULL, NULL, NULL, NULL);
1271
ff_get_wav_header(&b, st->codec, track->codec_priv.size);
1333
ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size,
1334
AVIO_RDONLY, NULL, NULL, NULL, NULL);
1335
ret = ff_get_wav_header(&b, st->codec, track->codec_priv.size);
1272
1338
codec_id = st->codec->codec_id;
1273
1339
extradata_offset = FFMIN(track->codec_priv.size, 18);
1274
1340
} else if (!strcmp(track->codec_id, "V_QUICKTIME")
1311
1377
extradata = av_mallocz(extradata_size);
1312
1378
if (extradata == NULL)
1313
1379
return AVERROR(ENOMEM);
1314
init_put_byte(&b, extradata, extradata_size, 1,
1380
ffio_init_context(&b, extradata, extradata_size, 1,
1315
1381
NULL, NULL, NULL, NULL);
1316
put_buffer(&b, "TTA1", 4);
1318
put_le16(&b, track->audio.channels);
1319
put_le16(&b, track->audio.bitdepth);
1320
put_le32(&b, track->audio.out_samplerate);
1321
put_le32(&b, matroska->ctx->duration * track->audio.out_samplerate);
1382
avio_write(&b, "TTA1", 4);
1384
avio_wl16(&b, track->audio.channels);
1385
avio_wl16(&b, track->audio.bitdepth);
1386
avio_wl32(&b, track->audio.out_samplerate);
1387
avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate);
1322
1388
} else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 ||
1323
1389
codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) {
1324
1390
extradata_offset = 26;
1328
1394
} else if (codec_id == CODEC_ID_RA_288 || codec_id == CODEC_ID_COOK ||
1329
1395
codec_id == CODEC_ID_ATRAC3 || codec_id == CODEC_ID_SIPR) {
1331
init_put_byte(&b, track->codec_priv.data,track->codec_priv.size,
1397
ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size,
1332
1398
0, NULL, NULL, NULL, NULL);
1334
flavor = get_be16(&b);
1335
track->audio.coded_framesize = get_be32(&b);
1337
track->audio.sub_packet_h = get_be16(&b);
1338
track->audio.frame_size = get_be16(&b);
1339
track->audio.sub_packet_size = get_be16(&b);
1400
flavor = avio_rb16(&b);
1401
track->audio.coded_framesize = avio_rb32(&b);
1403
track->audio.sub_packet_h = avio_rb16(&b);
1404
track->audio.frame_size = avio_rb16(&b);
1405
track->audio.sub_packet_size = avio_rb16(&b);
1340
1406
track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h);
1341
1407
if (codec_id == CODEC_ID_RA_288) {
1342
1408
st->codec->block_align = track->audio.coded_framesize;
1370
1436
if (track->flag_default)
1371
1437
st->disposition |= AV_DISPOSITION_DEFAULT;
1438
if (track->flag_forced)
1439
st->disposition |= AV_DISPOSITION_FORCED;
1373
1441
if (track->default_duration)
1374
1442
av_reduce(&st->codec->time_base.num, &st->codec->time_base.den,
1706
1774
int offset = 0, pkt_size = lace_size[n];
1707
1775
uint8_t *pkt_data = data;
1709
if (lace_size[n] > size) {
1777
if (pkt_size > size) {
1710
1778
av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n");
1751
1819
if (matroska->prev_pkt &&
1752
1820
timecode != AV_NOPTS_VALUE &&
1753
1821
matroska->prev_pkt->pts == timecode &&
1754
matroska->prev_pkt->stream_index == st->index)
1822
matroska->prev_pkt->stream_index == st->index &&
1823
st->codec->codec_id == CODEC_ID_SSA)
1755
1824
matroska_merge_packets(matroska->prev_pkt, pkt);
1757
1826
dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
1776
1845
EbmlList *blocks_list;
1777
1846
MatroskaBlock *blocks;
1779
int64_t pos = url_ftell(matroska->ctx->pb);
1848
int64_t pos = avio_tell(matroska->ctx->pb);
1780
1849
matroska->prev_pkt = NULL;
1781
if (matroska->has_cluster_id){
1782
/* For the first cluster we parse, its ID was already read as
1783
part of matroska_read_header(), so don't read it again */
1784
res = ebml_parse_id(matroska, matroska_clusters,
1785
MATROSKA_ID_CLUSTER, &cluster);
1850
if (matroska->current_id)
1786
1851
pos -= 4; /* sizeof the ID which was already read */
1787
matroska->has_cluster_id = 0;
1789
res = ebml_parse(matroska, matroska_clusters, &cluster);
1852
res = ebml_parse(matroska, matroska_clusters, &cluster);
1790
1853
blocks_list = &cluster.blocks;
1791
1854
blocks = blocks_list->elem;
1792
1855
for (i=0; i<blocks_list->nb_elem; i++)
1793
if (blocks[i].bin.size > 0) {
1856
if (blocks[i].bin.size > 0 && blocks[i].bin.data) {
1794
1857
int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
1858
if (!blocks[i].non_simple)
1859
blocks[i].duration = AV_NOPTS_VALUE;
1795
1860
res=matroska_parse_block(matroska,
1796
1861
blocks[i].bin.data, blocks[i].bin.size,
1797
1862
blocks[i].bin.pos, cluster.timecode,
1829
1894
timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
1831
1896
if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
1832
url_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
1897
avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
1833
1898
while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
1834
1899
matroska_clear_queue(matroska);
1835
1900
if (matroska_parse_cluster(matroska) < 0)
1857
url_fseek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
1922
avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
1858
1923
matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
1859
1924
matroska->skip_to_timecode = st->index_entries[index].timestamp;
1860
1925
matroska->done = 0;
1881
AVInputFormat matroska_demuxer = {
1883
NULL_IF_CONFIG_SMALL("Matroska file format"),
1946
AVInputFormat ff_matroska_demuxer = {
1948
NULL_IF_CONFIG_SMALL("Matroska/WebM file format"),
1884
1949
sizeof(MatroskaDemuxContext),
1885
1950
matroska_probe,
1886
1951
matroska_read_header,
1887
1952
matroska_read_packet,
1888
1953
matroska_read_close,
1889
1954
matroska_read_seek,
1890
.metadata_conv = ff_mkv_metadata_conv,