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 ...@@ -271,6 +271,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
AVMetadataTag *title, *author, *copyright, *comment;
int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
int has_title; int has_title;
AVCodecContext *enc; AVCodecContext *enc;
...@@ -278,8 +279,13 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data ...@@ -278,8 +279,13 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
int bit_rate; int bit_rate;
int64_t duration; 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; 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; bit_rate = 0;
for(n=0;n<s->nb_streams;n++) { 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 ...@@ -327,15 +333,15 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
/* title and other infos */ /* title and other infos */
if (has_title) { if (has_title) {
hpos = put_header(pb, &comment_header); hpos = put_header(pb, &comment_header);
if ( s->title[0] ) { put_le16(pb, 2 * (strlen(s->title ) + 1)); } else { put_le16(pb, 0); } put_le16(pb, title ? 2 * (strlen(title->value ) + 1) : 0);
if ( s->author[0] ) { put_le16(pb, 2 * (strlen(s->author ) + 1)); } else { put_le16(pb, 0); } put_le16(pb, author ? 2 * (strlen(author->value ) + 1) : 0);
if ( s->copyright[0] ) { put_le16(pb, 2 * (strlen(s->copyright) + 1)); } else { put_le16(pb, 0); } put_le16(pb, copyright ? 2 * (strlen(copyright->value) + 1) : 0);
if ( s->comment[0] ) { put_le16(pb, 2 * (strlen(s->comment ) + 1)); } else { put_le16(pb, 0); } put_le16(pb, comment ? 2 * (strlen(comment->value ) + 1) : 0);
put_le16(pb, 0); put_le16(pb, 0);
if ( s->title[0] ) put_str16_nolen(pb, s->title); if (title ) put_str16_nolen(pb, title->value );
if ( s->author[0] ) put_str16_nolen(pb, s->author); if (author ) put_str16_nolen(pb, author->value );
if ( s->copyright[0] ) put_str16_nolen(pb, s->copyright); if (copyright) put_str16_nolen(pb, copyright->value);
if ( s->comment[0] ) put_str16_nolen(pb, s->comment); if (comment ) put_str16_nolen(pb, comment->value );
end_header(pb, hpos); 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