Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libopusenc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
libopusenc
Commits
bdf3369e
Unverified
Commit
bdf3369e
authored
Dec 29, 2017
by
Jean-Marc Valin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Windows UTF8 support
parent
802597c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
5 deletions
+128
-5
Makefile.am
Makefile.am
+4
-2
src/opusenc.c
src/opusenc.c
+3
-2
src/picture.c
src/picture.c
+2
-1
src/unicode_support.c
src/unicode_support.c
+80
-0
src/unicode_support.h
src/unicode_support.h
+39
-0
No files found.
Makefile.am
View file @
bdf3369e
...
...
@@ -16,14 +16,16 @@ noinst_HEADERS = src/arch.h \
src/picture.h
\
src/resample_sse.h
\
src/speex_resampler.h
\
src/stack_alloc.h
src/stack_alloc.h
\
src/unicode_support.h
libopusenc_la_SOURCES
=
\
src/ogg_packer.c
\
src/opus_header.c
\
src/opusenc.c
\
src/picture.c
\
src/resample.c
src/resample.c
\
src/unicode_support.c
libopusenc_la_LIBADD
=
$(DEPS_LIBS)
$(lrintf_lib)
libopusenc_la_LDFLAGS
=
-no-undefined
\
-version-info
@OP_LT_CURRENT@:@OP_LT_REVISION@:@OP_LT_AGE@
...
...
src/opusenc.c
View file @
bdf3369e
...
...
@@ -42,6 +42,7 @@
#include "speex_resampler.h"
#include "picture.h"
#include "ogg_packer.h"
#include "unicode_support.h"
/* Bump this when we change the ABI. */
#define OPE_ABI_VERSION 0
...
...
@@ -234,7 +235,7 @@ OggOpusEnc *ope_encoder_create_file(const char *path, OggOpusComments *comments,
if
(
enc
==
NULL
||
(
error
&&
*
error
))
{
return
NULL
;
}
obj
->
file
=
fopen
(
path
,
"wb"
);
obj
->
file
=
_ope_
fopen
(
path
,
"wb"
);
if
(
!
obj
->
file
)
{
if
(
error
)
*
error
=
OPE_CANNOT_OPEN
;
ope_encoder_destroy
(
enc
);
...
...
@@ -695,7 +696,7 @@ int ope_encoder_continue_new_file(OggOpusEnc *enc, const char *path, OggOpusComm
int
ret
;
struct
StdioObject
*
obj
;
if
(
!
(
obj
=
malloc
(
sizeof
(
*
obj
))))
return
OPE_ALLOC_FAIL
;
obj
->
file
=
fopen
(
path
,
"wb"
);
obj
->
file
=
_ope_
fopen
(
path
,
"wb"
);
if
(
!
obj
->
file
)
{
free
(
obj
);
/* By trying to open the file first, we can recover if we can't open it. */
...
...
src/picture.c
View file @
bdf3369e
...
...
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include <string.h>
#include "picture.h"
#include "unicode_support.h"
static
const
char
BASE64_TABLE
[
64
]
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
...
...
@@ -262,7 +263,7 @@ char *_ope_parse_picture_specification(const char *filename, int picture_type, c
}
if
(
description
==
NULL
)
description
=
""
;
picture_file
=
fopen
(
filename
,
"rb"
);
picture_file
=
_ope_
fopen
(
filename
,
"rb"
);
/*Buffer size: 8 static 4-byte fields plus 2 dynamic fields, plus the
file/URL data.
We reserve at least 10 bytes for the media type, in case we still need to
...
...
src/unicode_support.c
0 → 100644
View file @
bdf3369e
/* Copyright (c) 2004-2012 LoRd_MuldeR <mulder2@gmx.de>
File: unicode_support.c
This file was originally part of a patch included with LameXP,
released under the same license as the original audio tools.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "unicode_support.h"
#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
#include <windows.h>
#include <io.h>
static
UINT
g_old_output_cp
=
((
UINT
)
-
1
);
static
wchar_t
*
utf8_to_utf16
(
const
char
*
input
)
{
wchar_t
*
Buffer
;
int
BuffSize
=
0
,
Result
=
0
;
BuffSize
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
input
,
-
1
,
NULL
,
0
);
Buffer
=
(
wchar_t
*
)
malloc
(
sizeof
(
wchar_t
)
*
BuffSize
);
if
(
Buffer
)
{
Result
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
input
,
-
1
,
Buffer
,
BuffSize
);
}
return
((
Result
>
0
)
&&
(
Result
<=
BuffSize
))
?
Buffer
:
NULL
;
}
FILE
*
_ope_fopen
(
const
char
*
filename_utf8
,
const
char
*
mode_utf8
)
{
FILE
*
ret
=
NULL
;
wchar_t
*
filename_utf16
=
utf8_to_utf16
(
filename_utf8
);
wchar_t
*
mode_utf16
=
utf8_to_utf16
(
mode_utf8
);
if
(
filename_utf16
&&
mode_utf16
)
{
ret
=
_wfopen
(
filename_utf16
,
mode_utf16
);
}
if
(
filename_utf16
)
free
(
filename_utf16
);
if
(
mode_utf16
)
free
(
mode_utf16
);
return
ret
;
}
#else
#include <stdio.h>
FILE
*
_ope_fopen
(
const
char
*
filename_utf8
,
const
char
*
mode_utf8
)
{
return
fopen
(
filename_utf8
,
mode_utf8
);
}
#endif
src/unicode_support.h
0 → 100644
View file @
bdf3369e
/* Copyright (c) 2004-2012 LoRd_MuldeR <mulder2@gmx.de>
File: unicode_support.h
This file was originally part of a patch included with LameXP,
released under the same license as the original audio tools.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef UNICODE_SUPPORT_H_INCLUDED
#define UNICODE_SUPPORT_H_INCLUDED
#include <stdio.h>
#define WIN_UNICODE 1
FILE
*
_ope_fopen
(
const
char
*
filename_utf8
,
const
char
*
mode_utf8
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment