summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhentan Feng <spyfeng@gmail.com>2010-03-24 18:40:43 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-03-24 18:40:43 +0000
commit852e0ca555514eb103a662df4f104cd596ed7cdf (patch)
tree1f35583559f9c31869acf86d58e813f598a82805
parent508f092a783f7d305d1e9938c953e375139e2cba (diff)
downloadffmpeg-852e0ca555514eb103a662df4f104cd596ed7cdf.tar.gz
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>. Originally committed as revision 22656 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/asf.c17
-rw-r--r--libavformat/asf.h1
-rw-r--r--libavformat/asfenc.c23
3 files changed, 21 insertions, 20 deletions
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 20bfd8de1e..ea577cbbd7 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -152,3 +152,20 @@ const AVMetadataConv ff_asf_metadata_conv[] = {
// { "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;
+}
diff --git a/libavformat/asf.h b/libavformat/asf.h
index 0ad5e11303..85e54ccfe9 100644
--- a/libavformat/asf.h
+++ b/libavformat/asf.h
@@ -229,5 +229,6 @@ extern const AVMetadataConv ff_asf_metadata_conv[];
#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 */
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 3d6e6c8bfe..03b7256397 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -203,23 +203,6 @@ static void put_guid(ByteIOContext *s, const ff_asf_guid *g)
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, const char *tag)
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(AVFormatContext *s, int64_t file_size, int64_t data
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(AVFormatContext *s, int64_t file_size, int64_t data
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