It will be useful in the mp3 muxer.
Signed-off-by: Mans Rullgard <mans@mansr.com>
// { "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;
-}
#define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000
extern AVInputFormat asf_demuxer;
-int ff_put_str16_nolen(ByteIOContext *s, const char *tag);
int ff_guidcmp(const void *g1, const void *g2);
void ff_get_guid(ByteIOContext *s, ff_asf_guid *g);
if (url_open_dyn_buf(&dyn_buf) < 0)
return;
- ff_put_str16_nolen(dyn_buf, tag);
+ avio_put_str16le(dyn_buf, tag);
len = url_close_dyn_buf(dyn_buf, &pb);
put_le16(s, len);
put_buffer(s, pb, len);
hpos = put_header(pb, &ff_asf_comment_header);
for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) {
- len = tags[n] ? ff_put_str16_nolen(dyn_buf, tags[n]->value) : 0;
+ len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0;
put_le16(pb, len);
}
len = url_close_dyn_buf(dyn_buf, &buf);
if ( url_open_dyn_buf(&dyn_buf) < 0)
return AVERROR(ENOMEM);
- ff_put_str16_nolen(dyn_buf, desc);
+ avio_put_str16le(dyn_buf, desc);
len = url_close_dyn_buf(dyn_buf, &buf);
put_le16(pb, len / 2); // "number of characters" = length in bytes / 2
int avio_put_str(ByteIOContext *s, const char *str);
/**
+ * Convert an UTF-8 string to UTF-16LE and write it.
+ * @return number of bytes written.
+ */
+int avio_put_str16le(ByteIOContext *s, const char *str);
+
+/**
* fseek() equivalent for ByteIOContext.
* @return new position or AVERROR.
*/
return len;
}
+int avio_put_str16le(ByteIOContext *s, const char *str)
+{
+ const uint8_t *q = str;
+ 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;
+}
+
int ff_get_v_length(uint64_t val){
int i=1;
#include "libavutil/intreadwrite.h"
#include "libavcodec/bytestream.h"
#include "network.h"
-#include "asf.h"
#define LOCAL_ADDRESS 0xc0a80081 // FIXME get and use correct local ip address.
#define LOCAL_PORT 1037 // as above.
init_put_byte(&bic, mms->write_out_ptr,
sizeof(mms->out_buffer) - size, 1, NULL, NULL, NULL, NULL);
- len = ff_put_str16_nolen(&bic, src);
+ len = avio_put_str16le(&bic, src);
mms->write_out_ptr += len;
}