Commit 300f24f3 authored by Aurelien Jacobs's avatar Aurelien Jacobs

use new metadata API in asf muxer

Originally committed as revision 16983 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 4f0f9bdd
......@@ -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);
}
......
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