|
|
@ -265,7 +265,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; |
|
|
|
AVMetadataTag *tags[5]; |
|
|
|
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; |
|
|
|
int metadata_count; |
|
|
|
int metadata_count; |
|
|
@ -274,13 +274,14 @@ 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); |
|
|
|
tags[0] = av_metadata_get(s->metadata, "title" , NULL, 0); |
|
|
|
author = av_metadata_get(s->metadata, "author" , NULL, 0); |
|
|
|
tags[1] = av_metadata_get(s->metadata, "author" , NULL, 0); |
|
|
|
copyright = av_metadata_get(s->metadata, "copyright", NULL, 0); |
|
|
|
tags[2] = av_metadata_get(s->metadata, "copyright", NULL, 0); |
|
|
|
comment = av_metadata_get(s->metadata, "comment" , NULL, 0); |
|
|
|
tags[3] = av_metadata_get(s->metadata, "comment" , NULL, 0); |
|
|
|
|
|
|
|
tags[4] = av_metadata_get(s->metadata, "rating" , NULL, 0); |
|
|
|
|
|
|
|
|
|
|
|
duration = asf->duration + PREROLL_TIME * 10000; |
|
|
|
duration = asf->duration + PREROLL_TIME * 10000; |
|
|
|
has_title = title || author || copyright || comment; |
|
|
|
has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; |
|
|
|
metadata_count = s->metadata ? s->metadata->count : 0; |
|
|
|
metadata_count = s->metadata ? s->metadata->count : 0; |
|
|
|
|
|
|
|
|
|
|
|
bit_rate = 0; |
|
|
|
bit_rate = 0; |
|
|
@ -329,15 +330,11 @@ 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, &ff_asf_comment_header); |
|
|
|
hpos = put_header(pb, &ff_asf_comment_header); |
|
|
|
put_le16(pb, title ? 2 * (strlen(title->value ) + 1) : 0); |
|
|
|
for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) |
|
|
|
put_le16(pb, author ? 2 * (strlen(author->value ) + 1) : 0); |
|
|
|
put_le16(pb, tags[n] ? 2*(strlen(tags[n]->value) + 1) : 0); |
|
|
|
put_le16(pb, copyright ? 2 * (strlen(copyright->value) + 1) : 0); |
|
|
|
for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) |
|
|
|
put_le16(pb, comment ? 2 * (strlen(comment->value ) + 1) : 0); |
|
|
|
if (tags[n]) |
|
|
|
put_le16(pb, 0); |
|
|
|
put_str16_nolen(pb, tags[n]->value); |
|
|
|
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); |
|
|
|
end_header(pb, hpos); |
|
|
|
} |
|
|
|
} |
|
|
|
if (metadata_count) { |
|
|
|
if (metadata_count) { |
|
|
|