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
98c9ade9
Commit
98c9ade9
authored
Aug 01, 2015
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drawtext: Move the strftime expansion in a separate function
Signed-off-by:
Luca Barbato
<
lu_zero@gentoo.org
>
parent
fe026ba9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
vf_drawtext.c
libavfilter/vf_drawtext.c
+29
-17
No files found.
libavfilter/vf_drawtext.c
View file @
98c9ade9
...
...
@@ -521,28 +521,15 @@ static inline int is_newline(uint32_t c)
return
c
==
'\n'
||
c
==
'\r'
||
c
==
'\f'
||
c
==
'\v'
;
}
static
int
dtext_prepare_text
(
AVFilterContext
*
ctx
)
static
int
expand_strftime
(
DrawTextContext
*
s
)
{
DrawTextContext
*
s
=
ctx
->
priv
;
uint32_t
code
=
0
,
prev_code
=
0
;
int
x
=
0
,
y
=
0
,
i
=
0
,
ret
;
int
text_height
,
baseline
;
char
*
text
=
s
->
text
;
uint8_t
*
p
;
int
str_w
=
0
,
len
;
int
y_min
=
32000
,
y_max
=
-
32000
;
FT_Vector
delta
;
Glyph
*
glyph
=
NULL
,
*
prev_glyph
=
NULL
;
Glyph
dummy
=
{
0
};
int
width
=
ctx
->
inputs
[
0
]
->
w
;
int
height
=
ctx
->
inputs
[
0
]
->
h
;
time_t
now
=
time
(
0
);
struct
tm
ltime
;
time_t
now
=
time
(
0
);
uint8_t
*
buf
=
s
->
expanded_text
;
int
buf_size
=
s
->
expanded_text_size
;
if
(
!
buf
)
buf_size
=
2
*
strlen
(
s
->
text
)
+
1
;
buf_size
=
2
*
strlen
(
s
->
text
)
+
1
;
localtime_r
(
&
now
,
&
ltime
);
...
...
@@ -555,9 +542,34 @@ static int dtext_prepare_text(AVFilterContext *ctx)
if
(
!
buf
)
return
AVERROR
(
ENOMEM
);
text
=
s
->
expanded_text
=
buf
;
s
->
expanded_text
=
buf
;
s
->
expanded_text_size
=
buf_size
;
return
0
;
}
static
int
dtext_prepare_text
(
AVFilterContext
*
ctx
)
{
DrawTextContext
*
s
=
ctx
->
priv
;
uint32_t
code
=
0
,
prev_code
=
0
;
int
x
=
0
,
y
=
0
,
i
=
0
,
ret
;
int
text_height
,
baseline
;
char
*
text
;
uint8_t
*
p
;
int
str_w
=
0
,
len
;
int
y_min
=
32000
,
y_max
=
-
32000
;
FT_Vector
delta
;
Glyph
*
glyph
=
NULL
,
*
prev_glyph
=
NULL
;
Glyph
dummy
=
{
0
};
int
width
=
ctx
->
inputs
[
0
]
->
w
;
int
height
=
ctx
->
inputs
[
0
]
->
h
;
ret
=
expand_strftime
(
s
);
if
(
ret
<
0
)
return
ret
;
text
=
s
->
expanded_text
?
s
->
expanded_text
:
s
->
text
;
if
((
len
=
strlen
(
text
))
>
s
->
nb_positions
)
{
FT_Vector
*
p
=
av_realloc
(
s
->
positions
,
len
*
sizeof
(
*
s
->
positions
));
...
...
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