diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2009-02-04 01:37:16 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2009-02-04 01:37:16 +0000 |
commit | 300f24f3177e335ba8bebc5066cd78ee9fec6945 (patch) | |
tree | 3a0439f84f3e754c5fa40539f71bea208005a8cb /libavformat/asf-enc.c | |
parent | 4f0f9bddacfd1abf0cb353091c3b4be410961690 (diff) | |
download | ffmpeg-300f24f3177e335ba8bebc5066cd78ee9fec6945.tar.gz |
use new metadata API in asf muxer
Originally committed as revision 16983 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/asf-enc.c')
-rw-r--r-- | libavformat/asf-enc.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libavformat/asf-enc.c b/libavformat/asf-enc.c index 64c5200826..0edfc69d07 100644 --- a/libavformat/asf-enc.c +++ b/libavformat/asf-enc.c @@ -271,6 +271,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data { ASFContext *asf = s->priv_data; ByteIOContext *pb = s->pb; + AVMetadataTag *title, *author, *copyright, *comment; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int has_title; AVCodecContext *enc; @@ -278,8 +279,13 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data int bit_rate; int64_t duration; + title = av_metadata_get(s->metadata, "title" , NULL, 0); + author = av_metadata_get(s->metadata, "author" , NULL, 0); + copyright = av_metadata_get(s->metadata, "copyright", NULL, 0); + comment = av_metadata_get(s->metadata, "comment" , NULL, 0); + duration = asf->duration + PREROLL_TIME * 10000; - has_title = (s->title[0] || s->author[0] || s->copyright[0] || s->comment[0]); + has_title = title || author || copyright || comment; bit_rate = 0; for(n=0;n<s->nb_streams;n++) { @@ -327,15 +333,15 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data /* title and other infos */ if (has_title) { hpos = put_header(pb, &comment_header); - if ( s->title[0] ) { put_le16(pb, 2 * (strlen(s->title ) + 1)); } else { put_le16(pb, 0); } - if ( s->author[0] ) { put_le16(pb, 2 * (strlen(s->author ) + 1)); } else { put_le16(pb, 0); } - if ( s->copyright[0] ) { put_le16(pb, 2 * (strlen(s->copyright) + 1)); } else { put_le16(pb, 0); } - if ( s->comment[0] ) { put_le16(pb, 2 * (strlen(s->comment ) + 1)); } else { put_le16(pb, 0); } + put_le16(pb, title ? 2 * (strlen(title->value ) + 1) : 0); + put_le16(pb, author ? 2 * (strlen(author->value ) + 1) : 0); + put_le16(pb, copyright ? 2 * (strlen(copyright->value) + 1) : 0); + put_le16(pb, comment ? 2 * (strlen(comment->value ) + 1) : 0); put_le16(pb, 0); - if ( s->title[0] ) put_str16_nolen(pb, s->title); - if ( s->author[0] ) put_str16_nolen(pb, s->author); - if ( s->copyright[0] ) put_str16_nolen(pb, s->copyright); - if ( s->comment[0] ) put_str16_nolen(pb, s->comment); + if (title ) put_str16_nolen(pb, title->value ); + if (author ) put_str16_nolen(pb, author->value ); + if (copyright) put_str16_nolen(pb, copyright->value); + if (comment ) put_str16_nolen(pb, comment->value ); end_header(pb, hpos); } |