[FFmpeg-cvslog] r16983 - trunk/libavformat/asf-enc.c

aurel subversion
Wed Feb 4 02:37:16 CET 2009


Author: aurel
Date: Wed Feb  4 02:37:16 2009
New Revision: 16983

Log:
use new metadata API in asf muxer

Modified:
   trunk/libavformat/asf-enc.c

Modified: trunk/libavformat/asf-enc.c
==============================================================================
--- trunk/libavformat/asf-enc.c	Wed Feb  4 00:18:12 2009	(r16982)
+++ trunk/libavformat/asf-enc.c	Wed Feb  4 02:37:16 2009	(r16983)
@@ -271,6 +271,7 @@ static int asf_write_header1(AVFormatCon
 {
     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(AVFormatCon
     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(AVFormatCon
     /* 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);
     }
 




More information about the ffmpeg-cvslog mailing list