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
29bffc40
Commit
29bffc40
authored
Apr 13, 2004
by
Sigmund Augdal Helberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modules/codec/subsdec.c:
* strip html-like tags from subtitles
parent
d3d496a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
modules/codec/subsdec.c
modules/codec/subsdec.c
+46
-1
No files found.
modules/codec/subsdec.c
View file @
29bffc40
...
...
@@ -58,6 +58,7 @@ static void CloseDecoder ( vlc_object_t * );
static
void
DecodeBlock
(
decoder_t
*
,
block_t
**
);
static
void
ParseText
(
decoder_t
*
,
block_t
*
,
vout_thread_t
*
);
static
void
StripTags
(
char
*
);
#define DEFAULT_NAME "System Default"
...
...
@@ -369,7 +370,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block,
break
;
}
}
StripTags
(
psz_subtitle
);
vout_ShowTextAbsolute
(
p_vout
,
psz_subtitle
,
NULL
,
OSD_ALIGN_BOTTOM
|
p_sys
->
i_align
,
i_align_h
,
i_align_v
,
p_block
->
i_pts
,
...
...
@@ -377,3 +378,47 @@ static void ParseText( decoder_t *p_dec, block_t *p_block,
free
(
psz_subtitle
);
}
static
void
StripTags
(
char
*
psz_text
)
{
int
i_left_moves
=
0
;
vlc_bool_t
b_inside_tag
=
VLC_FALSE
;
int
i
=
0
;
int
i_tag_start
=
-
1
;
while
(
psz_text
[
i
]
)
{
if
(
!
b_inside_tag
)
{
if
(
psz_text
[
i
]
==
'<'
)
{
b_inside_tag
=
VLC_TRUE
;
i_tag_start
=
i
;
}
psz_text
[
i
-
i_left_moves
]
=
psz_text
[
i
];
}
else
{
if
(
(
psz_text
[
i
]
==
' '
)
||
(
psz_text
[
i
]
==
'\t'
)
||
(
psz_text
[
i
]
==
'\n'
)
||
(
psz_text
[
i
]
==
'\r'
)
)
{
b_inside_tag
=
VLC_FALSE
;
i_tag_start
=
-
1
;
}
else
if
(
psz_text
[
i
]
==
'>'
)
{
i_left_moves
+=
i
-
i_tag_start
+
1
;
i_tag_start
=
-
1
;
b_inside_tag
=
VLC_FALSE
;
}
else
{
psz_text
[
i
-
i_left_moves
]
=
psz_text
[
i
];
}
}
i
++
;
}
psz_text
[
i
-
i_left_moves
]
=
'\0'
;
}
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