Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
f65600d5
Commit
f65600d5
authored
Jan 16, 2012
by
Clément Bœsch
Committed by
Clément Bœsch
Feb 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drawtext: use new public timecode API.
parent
11e5d3b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
21 deletions
+15
-21
filters.texi
doc/filters.texi
+0
-2
vf_drawtext.c
libavfilter/vf_drawtext.c
+15
-19
No files found.
doc/filters.texi
View file @
f65600d5
...
...
@@ -1302,8 +1302,6 @@ timestamp expressed in seconds, NAN if the input timestamp is unknown
@item timecode
initial timecode representation in "hh:mm:ss[:;.]ff" format. It can be used
with or without text parameter. @var{rate} option must be specified.
Note that timecode options are @emph{not} effective if FFmpeg is build with
@code{--disable-avcodec}.
@item r, rate
frame rate (timecode only)
...
...
libavfilter/vf_drawtext.c
View file @
f65600d5
...
...
@@ -30,7 +30,6 @@
#include <time.h>
#include "config.h"
#include "libavcodec/timecode.h"
#include "libavutil/avstring.h"
#include "libavutil/colorspace.h"
#include "libavutil/file.h"
...
...
@@ -39,6 +38,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/timecode.h"
#include "libavutil/tree.h"
#include "libavutil/lfg.h"
#include "avfilter.h"
...
...
@@ -157,7 +157,9 @@ typedef struct {
AVExpr
*
d_pexpr
;
int
draw
;
///< set to zero to prevent drawing
AVLFG
prng
;
///< random
struct
ff_timecode
tc
;
char
*
tc_opt_string
;
///< specified timecode option string
AVRational
tc_rate
;
///< frame rate for timecode
AVTimecode
tc
;
///< timecode context
int
frame_id
;
}
DrawTextContext
;
...
...
@@ -179,9 +181,9 @@ static const AVOption drawtext_options[]= {
{
"tabsize"
,
"set tab size"
,
OFFSET
(
tabsize
),
AV_OPT_TYPE_INT
,
{.
dbl
=
4
},
0
,
INT_MAX
},
{
"basetime"
,
"set base time"
,
OFFSET
(
basetime
),
AV_OPT_TYPE_INT64
,
{.
dbl
=
AV_NOPTS_VALUE
},
INT64_MIN
,
INT64_MAX
},
{
"draw"
,
"if false do not draw"
,
OFFSET
(
d_expr
),
AV_OPT_TYPE_STRING
,
{.
str
=
"1"
},
CHAR_MIN
,
CHAR_MAX
},
{
"timecode"
,
"set initial timecode"
,
OFFSET
(
tc
.
str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
CHAR_MIN
,
CHAR_MAX
},
{
"r"
,
"set rate (timecode only)"
,
OFFSET
(
tc
.
rate
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
},
{
"rate"
,
"set rate (timecode only)"
,
OFFSET
(
tc
.
rate
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
},
{
"timecode"
,
"set initial timecode"
,
OFFSET
(
tc
_opt_string
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
CHAR_MIN
,
CHAR_MAX
},
{
"r"
,
"set rate (timecode only)"
,
OFFSET
(
tc
_
rate
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
},
{
"rate"
,
"set rate (timecode only)"
,
OFFSET
(
tc
_
rate
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
},
/* FT_LOAD_* flags */
{
"ft_load_flags"
,
"set font loading flags for libfreetype"
,
OFFSET
(
ft_load_flags
),
AV_OPT_TYPE_FLAGS
,
{.
dbl
=
FT_LOAD_DEFAULT
|
FT_LOAD_RENDER
},
0
,
INT_MAX
,
0
,
"ft_load_flags"
},
...
...
@@ -341,17 +343,13 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
av_file_unmap
(
textbuf
,
textbuf_size
);
}
if
(
dtext
->
tc
.
str
)
{
#if CONFIG_AVCODEC
if
(
avpriv_init_smpte_timecode
(
ctx
,
&
dtext
->
tc
)
<
0
)
return
AVERROR
(
EINVAL
);
if
(
dtext
->
tc_opt_string
)
{
int
ret
=
av_timecode_init_from_string
(
&
dtext
->
tc
,
dtext
->
tc_rate
,
dtext
->
tc_opt_string
,
ctx
);
if
(
ret
<
0
)
return
ret
;
if
(
!
dtext
->
text
)
dtext
->
text
=
av_strdup
(
""
);
#else
av_log
(
ctx
,
AV_LOG_ERROR
,
"Timecode options are only available if libavfilter is built with libavcodec enabled.
\n
"
);
return
AVERROR
(
EINVAL
);
#endif
}
if
(
!
dtext
->
text
)
{
...
...
@@ -729,13 +727,11 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
buf_size
*=
2
;
}
while
((
buf
=
av_realloc
(
buf
,
buf_size
)));
#if CONFIG_AVCODEC
if
(
dtext
->
tc
.
str
)
{
char
tcbuf
[
16
];
avpriv_timecode_to_string
(
tcbuf
,
&
dtext
->
tc
,
dtext
->
frame_id
++
);
if
(
dtext
->
tc_opt_string
)
{
char
tcbuf
[
AV_TIMECODE_STR_SIZE
];
av_timecode_make_string
(
&
dtext
->
tc
,
tcbuf
,
dtext
->
frame_id
++
);
buf
=
av_asprintf
(
"%s%s"
,
dtext
->
text
,
tcbuf
);
}
#endif
if
(
!
buf
)
return
AVERROR
(
ENOMEM
);
...
...
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