changeset 5713:0db115a3dbb4 libavformat

Eliminate put_str16(). Patch by Anton Khirnov <wyskas gmail com>.
author rbultje
date Wed, 24 Feb 2010 18:09:49 +0000
parents 20877abd6b08
children 081abaf38c51
files asfenc.c
diffstat 1 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/asfenc.c	Wed Feb 24 18:01:44 2010 +0000
+++ b/asfenc.c	Wed Feb 24 18:09:49 2010 +0000
@@ -203,13 +203,6 @@
     put_buffer(s, *g, sizeof(*g));
 }
 
-static void put_str16_nolen(ByteIOContext *s, const char *tag);
-static void put_str16(ByteIOContext *s, const char *tag)
-{
-    put_le16(s,strlen(tag) + 1);
-    put_str16_nolen(s, tag);
-}
-
 static void put_str16_nolen(ByteIOContext *s, const char *tag)
 {
     int c;
@@ -449,6 +442,7 @@
     put_le32(pb, s->nb_streams);
     for(n=0;n<s->nb_streams;n++) {
         AVCodec *p;
+        const char *desc;
 
         enc = s->streams[n]->codec;
         p = avcodec_find_encoder(enc->codec_id);
@@ -461,9 +455,11 @@
             put_le16(pb, -1);
 
         if(enc->codec_id == CODEC_ID_WMAV2)
-            put_str16(pb, "Windows Media Audio V8");
+            desc = "Windows Media Audio V8";
         else
-            put_str16(pb, p ? p->name : enc->codec_name);
+            desc = p ? p->name : enc->codec_name;
+        put_le16(pb, strlen(desc) + 1); // "number of characters" = length in bytes / 2
+        put_str16_nolen(pb, desc);
         put_le16(pb, 0); /* no parameters */