Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc-gpu
Commits
979ee1a3
Commit
979ee1a3
authored
Oct 26, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TS: use FromCharset()
parent
e8b9642e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
47 deletions
+16
-47
modules/demux/ts.c
modules/demux/ts.c
+16
-47
No files found.
modules/demux/ts.c
View file @
979ee1a3
...
...
@@ -2621,10 +2621,8 @@ static char *EITConvertToUTF8( const unsigned char *psz_instring,
bool
b_broken
)
{
const
char
*
psz_encoding
;
char
*
psz_outstring
;
char
psz_encbuf
[
sizeof
(
"ISO_8859-123"
)];
size_t
i_in
,
i_out
,
offset
=
1
;
vlc_iconv_t
iconv_handle
;
size_t
offset
=
1
;
if
(
i_length
<
1
)
return
NULL
;
if
(
psz_instring
[
0
]
>=
0x20
)
...
...
@@ -2710,55 +2708,26 @@ static char *EITConvertToUTF8( const unsigned char *psz_instring,
offset
=
0
;
}
i_in
=
i_length
-
offset
;
i_
out
=
i_in
*
6
+
1
;
psz_instring
+=
offset
;
i_
length
-=
offset
;
psz_outstring
=
malloc
(
i_out
);
if
(
!
psz_outstring
)
{
return
NULL
;
char
*
psz
=
FromCharset
(
psz_encoding
,
psz_instring
,
i_length
);
if
(
psz
==
NULL
)
{
/* Invalid character set (e.g. ISO_8859-12) */
psz
=
strndup
(
(
const
char
*
)
psz_instring
,
i_length
);
if
(
unlikely
(
psz
==
NULL
)
)
return
NULL
;
EnsureUTF8
(
psz
);
}
iconv_handle
=
vlc_iconv_open
(
"UTF-8"
,
psz_encoding
);
if
(
iconv_handle
==
(
vlc_iconv_t
)(
-
1
)
)
{
/* Invalid character set (e.g. ISO_8859-12) */
memcpy
(
psz_outstring
,
&
psz_instring
[
offset
],
i_in
);
psz_outstring
[
i_in
]
=
'\0'
;
EnsureUTF8
(
psz_outstring
);
}
else
/* Convert EIT-coded CR/LFs */
for
(
char
*
p
=
strstr
(
psz
,
"
\xc2\x8a
"
);
p
!=
NULL
;
p
=
strstr
(
p
,
"
\xc2\x8a
"
))
{
const
char
*
psz_in
=
(
const
char
*
)
&
psz_instring
[
offset
];
char
*
psz_out
=
psz_outstring
;
while
(
vlc_iconv
(
iconv_handle
,
&
psz_in
,
&
i_in
,
&
psz_out
,
&
i_out
)
==
(
size_t
)(
-
1
)
)
{
/* skip naughty byte. This may fail terribly for multibyte stuff,
* but what can we do anyway? */
psz_in
++
;
i_in
--
;
vlc_iconv
(
iconv_handle
,
NULL
,
NULL
,
NULL
,
NULL
);
/* reset */
}
vlc_iconv_close
(
iconv_handle
);
*
psz_out
=
'\0'
;
/* Convert EIT-coded CR/LFs */
unsigned
char
*
pbuf
=
(
unsigned
char
*
)
psz_outstring
;
for
(
;
pbuf
<
(
unsigned
char
*
)
psz_out
;
pbuf
++
)
{
if
(
pbuf
[
0
]
==
0xc2
&&
pbuf
[
1
]
==
0x8a
)
{
pbuf
[
0
]
=
' '
;
pbuf
[
1
]
=
'\n'
;
}
}
p
[
0
]
=
' '
;
p
[
1
]
=
'\n'
;
}
return
psz
_outstring
;
return
psz
;
}
static
void
SDTCallBack
(
demux_t
*
p_demux
,
dvbpsi_sdt_t
*
p_sdt
)
...
...
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