Mercurial > libavformat.hg
changeset 4498:d7a7c516f281 libavformat
matroskaenc: use new metadata API
author | aurel |
---|---|
date | Sun, 15 Feb 2009 16:53:05 +0000 |
parents | dc79722bbc25 |
children | dee012239d99 |
files | matroskaenc.c |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/matroskaenc.c Sun Feb 15 16:05:37 2009 +0000 +++ b/matroskaenc.c Sun Feb 15 16:53:05 2009 +0000 @@ -543,6 +543,7 @@ int bit_depth = av_get_bits_per_sample(codec->codec_id); int sample_rate = codec->sample_rate; int output_sample_rate = 0; + AVMetadataTag *tag; if (!bit_depth) bit_depth = av_get_bits_per_sample_format(codec->sample_fmt); @@ -555,10 +556,10 @@ put_ebml_uint (pb, MATROSKA_ID_TRACKUID , i + 1); put_ebml_uint (pb, MATROSKA_ID_TRACKFLAGLACING , 0); // no lacing (yet) - if (st->language[0]) - put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, st->language); - else - put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, "und"); + if ((tag = av_metadata_get(st->metadata, "description", NULL, 0))) + put_ebml_string(pb, MATROSKA_ID_TRACKNAME, tag->value); + tag = av_metadata_get(st->metadata, "language", NULL, 0); + put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, tag ? tag->value:"und"); if (st->disposition) put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGDEFAULT, !!(st->disposition & AV_DISPOSITION_DEFAULT)); @@ -644,6 +645,7 @@ MatroskaMuxContext *mkv = s->priv_data; ByteIOContext *pb = s->pb; ebml_master ebml_header, segment_info; + AVMetadataTag *tag; int ret; mkv->md5_ctx = av_mallocz(av_md5_size); @@ -677,8 +679,8 @@ segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0); put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 1000000); - if (strlen(s->title)) - put_ebml_string(pb, MATROSKA_ID_TITLE, s->title); + if ((tag = av_metadata_get(s->metadata, "title", NULL, 0))) + put_ebml_string(pb, MATROSKA_ID_TITLE, tag->value); if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , LIBAVFORMAT_IDENT); put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);