Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e8003718
Commit
e8003718
authored
Jul 29, 2017
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/htmlsubtitles: improve line breaks handling
parent
55949e3e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
htmlsubtitles.c
libavcodec/htmlsubtitles.c
+3
-2
htmlsubtitles.c
libavcodec/tests/htmlsubtitles.c
+2
-0
libavcodec-htmlsubtitles
tests/ref/fate/libavcodec-htmlsubtitles
+1
-0
No files found.
libavcodec/htmlsubtitles.c
View file @
e8003718
...
...
@@ -165,7 +165,7 @@ int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
#define LIKELY_A_TAG_CHAR(x) (((x) >= '0' && (x) <= '9') || \
((x) >= 'a' && (x) <= 'z') || \
((x) >= 'A' && (x) <= 'Z') || \
(x) == '_')
(x) == '_'
|| (x) == '/'
)
for
(
i
=
0
;
tagname
[
i
];
i
++
)
{
if
(
!
LIKELY_A_TAG_CHAR
(
tagname
[
i
]))
{
likely_a_tag
=
0
;
...
...
@@ -237,7 +237,8 @@ int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
}
else
if
(
tagname
[
0
]
&&
!
tagname
[
1
]
&&
strchr
(
"bisu"
,
av_tolower
(
tagname
[
0
])))
{
av_bprintf
(
dst
,
"{
\\
%c%d}"
,
(
char
)
av_tolower
(
tagname
[
0
]),
!
tag_close
);
in
+=
skip
;
}
else
if
(
!
av_strcasecmp
(
tagname
,
"br"
))
{
}
else
if
(
!
av_strncasecmp
(
tagname
,
"br"
,
2
)
&&
(
!
tagname
[
2
]
||
(
tagname
[
2
]
==
'/'
&&
!
tagname
[
3
])))
{
av_bprintf
(
dst
,
"
\\
N"
);
in
+=
skip
;
}
else
if
(
likely_a_tag
)
{
...
...
libavcodec/tests/htmlsubtitles.c
View file @
e8003718
...
...
@@ -29,6 +29,8 @@ static const char * const test_cases[] = {
"Foo <foo@bar.com>"
,
// not a tag (not alnum)
"<b> foo <I> bar </B> bla </i>"
,
// broken nesting
"A<br>B<BR/>C<br / >D< Br >E<brk><brk/>"
,
// misc line breaks
};
int
main
(
void
)
...
...
tests/ref/fate/libavcodec-htmlsubtitles
View file @
e8003718
...
...
@@ -5,3 +5,4 @@
< font color=red >red</font> --> {\c&HFF&}red{\c}
Foo <foo@bar.com> --> Foo <foo@bar.com>
<b> foo <I> bar </B> bla </i> --> {\b1} foo {\i1} bar {\b0} bla {\i0}
A<br>B<BR/>C<br / >D< Br >E<brk><brk/> --> A\NB\NC\ND\NE
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