Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
edb0f284
Commit
edb0f284
authored
Apr 03, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codec: tx3g: handle utf8 (fix #11138)
parent
a5d9020b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
7 deletions
+37
-7
modules/codec/substx3g.c
modules/codec/substx3g.c
+37
-7
No files found.
modules/codec/substx3g.c
View file @
edb0f284
...
@@ -86,6 +86,36 @@ static int ConvertFlags( int i_atomflags )
...
@@ -86,6 +86,36 @@ static int ConvertFlags( int i_atomflags )
return
i_vlcstyles_flags
;
return
i_vlcstyles_flags
;
}
}
static
size_t
str8len
(
const
char
*
psz_string
)
{
const
char
*
psz_tmp
=
psz_string
;
size_t
i
=
0
;
while
(
*
psz_tmp
)
{
if
(
(
*
psz_tmp
&
0xC0
)
!=
0x80
)
i
++
;
psz_tmp
++
;
}
return
i
;
}
static
char
*
str8indup
(
const
char
*
psz_string
,
size_t
i_skip
,
size_t
n
)
{
while
(
i_skip
&&
*
psz_string
)
{
if
(
(
*
psz_string
&
0xC0
)
!=
0x80
)
i_skip
--
;
psz_string
++
;
}
if
(
!
*
psz_string
||
i_skip
)
return
NULL
;
const
char
*
psz_tmp
=
psz_string
;
while
(
n
&&
*
psz_tmp
)
{
if
(
(
*
psz_tmp
&
0xC0
)
!=
0x80
)
n
--
;
psz_tmp
++
;
}
return
strndup
(
psz_string
,
psz_tmp
-
psz_string
);
}
static
void
SegmentDoSplit
(
segment_t
*
p_segment
,
uint16_t
i_start
,
uint16_t
i_end
,
static
void
SegmentDoSplit
(
segment_t
*
p_segment
,
uint16_t
i_start
,
uint16_t
i_end
,
segment_t
**
pp_segment_left
,
segment_t
**
pp_segment_left
,
segment_t
**
pp_segment_middle
,
segment_t
**
pp_segment_middle
,
...
@@ -104,23 +134,23 @@ static void SegmentDoSplit( segment_t *p_segment, uint16_t i_start, uint16_t i_e
...
@@ -104,23 +134,23 @@ static void SegmentDoSplit( segment_t *p_segment, uint16_t i_start, uint16_t i_e
p_segment_left
=
calloc
(
1
,
sizeof
(
segment_t
)
);
p_segment_left
=
calloc
(
1
,
sizeof
(
segment_t
)
);
if
(
!
p_segment_left
)
goto
error
;
if
(
!
p_segment_left
)
goto
error
;
memcpy
(
&
p_segment_left
->
styles
,
&
p_segment
->
styles
,
sizeof
(
segment_style_t
)
);
memcpy
(
&
p_segment_left
->
styles
,
&
p_segment
->
styles
,
sizeof
(
segment_style_t
)
);
p_segment_left
->
psz_string
=
str
ndup
(
p_segment
->
psz_string
,
i_start
);
p_segment_left
->
psz_string
=
str
8indup
(
p_segment
->
psz_string
,
0
,
i_start
);
p_segment_left
->
i_size
=
strlen
(
p_segment_left
->
psz_string
);
p_segment_left
->
i_size
=
str
8
len
(
p_segment_left
->
psz_string
);
}
}
p_segment_middle
=
calloc
(
1
,
sizeof
(
segment_t
)
);
p_segment_middle
=
calloc
(
1
,
sizeof
(
segment_t
)
);
if
(
!
p_segment_middle
)
goto
error
;
if
(
!
p_segment_middle
)
goto
error
;
memcpy
(
&
p_segment_middle
->
styles
,
&
p_segment
->
styles
,
sizeof
(
segment_style_t
)
);
memcpy
(
&
p_segment_middle
->
styles
,
&
p_segment
->
styles
,
sizeof
(
segment_style_t
)
);
p_segment_middle
->
psz_string
=
str
ndup
(
p_segment
->
psz_string
+
i_start
,
i_end
-
i_start
+
1
);
p_segment_middle
->
psz_string
=
str
8indup
(
p_segment
->
psz_string
,
i_start
,
i_end
-
i_start
+
1
);
p_segment_middle
->
i_size
=
strlen
(
p_segment_middle
->
psz_string
);
p_segment_middle
->
i_size
=
str
8
len
(
p_segment_middle
->
psz_string
);
if
(
i_end
<
(
p_segment
->
i_size
-
1
)
)
if
(
i_end
<
(
p_segment
->
i_size
-
1
)
)
{
{
p_segment_right
=
calloc
(
1
,
sizeof
(
segment_t
)
);
p_segment_right
=
calloc
(
1
,
sizeof
(
segment_t
)
);
if
(
!
p_segment_right
)
goto
error
;
if
(
!
p_segment_right
)
goto
error
;
memcpy
(
&
p_segment_right
->
styles
,
&
p_segment
->
styles
,
sizeof
(
segment_style_t
)
);
memcpy
(
&
p_segment_right
->
styles
,
&
p_segment
->
styles
,
sizeof
(
segment_style_t
)
);
p_segment_right
->
psz_string
=
str
ndup
(
p_segment
->
psz_string
+
i_end
+
1
,
p_segment
->
i_size
-
i_end
-
1
);
p_segment_right
->
psz_string
=
str
8indup
(
p_segment
->
psz_string
,
i_end
+
1
,
p_segment
->
i_size
-
i_end
-
1
);
p_segment_right
->
i_size
=
strlen
(
p_segment_right
->
psz_string
);
p_segment_right
->
i_size
=
str
8
len
(
p_segment_right
->
psz_string
);
}
}
if
(
p_segment_left
)
p_segment_left
->
p_next
=
p_segment_middle
;
if
(
p_segment_left
)
p_segment_left
->
p_next
=
p_segment_middle
;
...
@@ -242,7 +272,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -242,7 +272,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
return
NULL
;
return
NULL
;
}
}
p_segment
->
psz_string
=
strdup
(
psz_subtitle
);
p_segment
->
psz_string
=
strdup
(
psz_subtitle
);
p_segment
->
i_size
=
strlen
(
psz_subtitle
);
p_segment
->
i_size
=
str
8
len
(
psz_subtitle
);
if
(
p_dec
->
fmt_in
.
subs
.
p_style
)
if
(
p_dec
->
fmt_in
.
subs
.
p_style
)
{
{
p_segment
->
styles
.
i_color
=
p_dec
->
fmt_in
.
subs
.
p_style
->
i_font_color
;
p_segment
->
styles
.
i_color
=
p_dec
->
fmt_in
.
subs
.
p_style
->
i_font_color
;
...
...
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