mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
write strings as utf16be
Originally committed as revision 15056 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d3b4b74c32
commit
5f94b92077
@ -324,6 +324,16 @@ static void mxf_write_preface(AVFormatContext *s)
|
|||||||
put_be64(pb, 0);
|
put_be64(pb, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write an ascii string as utf-16
|
||||||
|
*/
|
||||||
|
static void mxf_write_utf16(ByteIOContext *pb, const char *value)
|
||||||
|
{
|
||||||
|
int i, size = strlen(value)+1;
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
put_be16(pb, value[i]);
|
||||||
|
}
|
||||||
|
|
||||||
static void mxf_write_identification(AVFormatContext *s)
|
static void mxf_write_identification(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
ByteIOContext *pb = s->pb;
|
ByteIOContext *pb = s->pb;
|
||||||
@ -331,12 +341,12 @@ static void mxf_write_identification(AVFormatContext *s)
|
|||||||
|
|
||||||
mxf_write_metadata_key(pb, 0x013000);
|
mxf_write_metadata_key(pb, 0x013000);
|
||||||
PRINT_KEY(s, "identification key", pb->buf_ptr - 16);
|
PRINT_KEY(s, "identification key", pb->buf_ptr - 16);
|
||||||
company_name_len = sizeof("FFmpeg");
|
company_name_len = sizeof("FFmpeg") * 2;
|
||||||
product_name_len = sizeof("OP1a Muxer");
|
product_name_len = sizeof("OP1a Muxer") * 2;
|
||||||
|
|
||||||
length = 80 + company_name_len + product_name_len;
|
length = 80 + company_name_len + product_name_len;
|
||||||
if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
|
if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
|
||||||
version_string_len = sizeof(LIBAVFORMAT_IDENT);
|
version_string_len = sizeof(LIBAVFORMAT_IDENT) * 2;
|
||||||
length += 4 + version_string_len;
|
length += 4 + version_string_len;
|
||||||
}
|
}
|
||||||
klv_encode_ber_length(pb, length);
|
klv_encode_ber_length(pb, length);
|
||||||
@ -350,14 +360,14 @@ static void mxf_write_identification(AVFormatContext *s)
|
|||||||
mxf_write_uuid(pb, Identification, 1);
|
mxf_write_uuid(pb, Identification, 1);
|
||||||
|
|
||||||
mxf_write_local_tag(pb, company_name_len, 0x3C01);
|
mxf_write_local_tag(pb, company_name_len, 0x3C01);
|
||||||
put_buffer(pb, "FFmpeg", company_name_len);
|
mxf_write_utf16(pb, "FFmpeg");
|
||||||
|
|
||||||
mxf_write_local_tag(pb, product_name_len, 0x3C02);
|
mxf_write_local_tag(pb, product_name_len, 0x3C02);
|
||||||
put_buffer(pb, "OP1a Muxer", product_name_len);
|
mxf_write_utf16(pb, "OP1a Muxer");
|
||||||
|
|
||||||
if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
|
if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
|
||||||
mxf_write_local_tag(pb, version_string_len, 0x3C04);
|
mxf_write_local_tag(pb, version_string_len, 0x3C04);
|
||||||
put_buffer(pb, LIBAVFORMAT_IDENT, version_string_len);
|
mxf_write_utf16(pb, LIBAVFORMAT_IDENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write product uid
|
// write product uid
|
||||||
|
Loading…
Reference in New Issue
Block a user