[FFmpeg-cvslog] r22656 - in trunk/libavformat: asf.c asf.h asfenc.c

rbultje subversion
Wed Mar 24 19:40:43 CET 2010


Author: rbultje
Date: Wed Mar 24 19:40:43 2010
New Revision: 22656

Log:
Move put_le16_nolen() to asf.c and give it a ff_ prefix. This way, it is easier
to share it with e.g. MMS.

Patch by Zhentan Feng <spyfeng gmail com>.

Modified:
   trunk/libavformat/asf.c
   trunk/libavformat/asf.h
   trunk/libavformat/asfenc.c

Modified: trunk/libavformat/asf.c
==============================================================================
--- trunk/libavformat/asf.c	Wed Mar 24 18:09:21 2010	(r22655)
+++ trunk/libavformat/asf.c	Wed Mar 24 19:40:43 2010	(r22656)
@@ -152,3 +152,20 @@ const AVMetadataConv ff_asf_metadata_con
 //  { "Year"               , "date"        }, TODO: conversion year<->date
     { 0 }
 };
+
+int ff_put_str16_nolen(ByteIOContext *s, const char *tag)
+{
+    const uint8_t *q = tag;
+    int ret = 0;
+
+    while (*q) {
+        uint32_t ch;
+        uint16_t tmp;
+
+        GET_UTF8(ch, *q++, break;)
+        PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;)
+    }
+    put_le16(s, 0);
+    ret += 2;
+    return ret;
+}

Modified: trunk/libavformat/asf.h
==============================================================================
--- trunk/libavformat/asf.h	Wed Mar 24 18:09:21 2010	(r22655)
+++ trunk/libavformat/asf.h	Wed Mar 24 19:40:43 2010	(r22656)
@@ -229,5 +229,6 @@ extern const AVMetadataConv ff_asf_metad
 #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000
 
 extern AVInputFormat asf_demuxer;
+int ff_put_str16_nolen(ByteIOContext *s, const char *tag);
 
 #endif /* AVFORMAT_ASF_H */

Modified: trunk/libavformat/asfenc.c
==============================================================================
--- trunk/libavformat/asfenc.c	Wed Mar 24 18:09:21 2010	(r22655)
+++ trunk/libavformat/asfenc.c	Wed Mar 24 19:40:43 2010	(r22656)
@@ -203,23 +203,6 @@ static void put_guid(ByteIOContext *s, c
     put_buffer(s, *g, sizeof(*g));
 }
 
-static int put_str16_nolen(ByteIOContext *s, const char *tag)
-{
-    const uint8_t *q = tag;
-    int ret = 0;
-
-    while (*q) {
-        uint32_t ch;
-        uint16_t tmp;
-
-        GET_UTF8(ch, *q++, break;)
-        PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;)
-    }
-    put_le16(s, 0);
-    ret += 2;
-    return ret;
-}
-
 static void put_str16(ByteIOContext *s, const char *tag)
 {
     int len;
@@ -228,7 +211,7 @@ static void put_str16(ByteIOContext *s, 
     if (url_open_dyn_buf(&dyn_buf) < 0)
         return;
 
-    put_str16_nolen(dyn_buf, tag);
+    ff_put_str16_nolen(dyn_buf, tag);
     len = url_close_dyn_buf(dyn_buf, &pb);
     put_le16(s, len);
     put_buffer(s, pb, len);
@@ -361,7 +344,7 @@ static int asf_write_header1(AVFormatCon
         hpos = put_header(pb, &ff_asf_comment_header);
 
         for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) {
-            len = tags[n] ? put_str16_nolen(dyn_buf, tags[n]->value) : 0;
+            len = tags[n] ? ff_put_str16_nolen(dyn_buf, tags[n]->value) : 0;
             put_le16(pb, len);
         }
         len = url_close_dyn_buf(dyn_buf, &buf);
@@ -489,7 +472,7 @@ static int asf_write_header1(AVFormatCon
         if ( url_open_dyn_buf(&dyn_buf) < 0)
             return AVERROR(ENOMEM);
 
-        put_str16_nolen(dyn_buf, desc);
+        ff_put_str16_nolen(dyn_buf, desc);
         len = url_close_dyn_buf(dyn_buf, &buf);
         put_le16(pb, len / 2); // "number of characters" = length in bytes / 2
 



More information about the ffmpeg-cvslog mailing list