History

vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables

Changes to vf_drawtext.c written by Calvin Walton <calvin.walton@kepstin.ca> Changes to filters.texi written by greg Luce <electron.rotoscope@gmail.com> with lots of help from Moritz Barsnick and Gyan Fixes #7947.

Calvin Walton committed 7 years ago

Commit 2bd21b91 parent b7b6ddd3 files · +22 −1Browse files

Unified · Split

3 files
  1. doc/filters.texi +11 −0
  2. libavfilter/version.h +2 −1
  3. libavfilter/vf_drawtext.c +9 −0
doc/filters.texi+11−0
@@ -9002,6 +9002,17 @@ to each other, so you can for example specify @code{y=x/dar}. · 9001 unmodified lines
9002 9002
9003@item pict_type9003@item pict_type
9004A one character description of the current frame's picture type.9004A one character description of the current frame's picture type.
9005
9006@item pkt_pos
9007The current packet's position in the input file or stream
9008(in bytes, from the start of the input). A value of -1 indicates
9009this info is not available.
9010
9011@item pkt_duration
9012The current packet's duration, in seconds.
9013
9014@item pkt_size
9015The current packet's size (in bytes).
9005@end table9016@end table
9006 9017
9007@anchor{drawtext_expansion}9018@anchor{drawtext_expansion}
libavfilter/version.h+2−1
@@ -31,7 +31,8 @@ · 30 unmodified lines
31 31
32#define LIBAVFILTER_VERSION_MAJOR 732#define LIBAVFILTER_VERSION_MAJOR 7
33#define LIBAVFILTER_VERSION_MINOR 5633#define LIBAVFILTER_VERSION_MINOR 56
34#define LIBAVFILTER_VERSION_MICRO 10034#define LIBAVFILTER_VERSION_MICRO 101
35
35 36
36#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \37#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
37 LIBAVFILTER_VERSION_MINOR, \38 LIBAVFILTER_VERSION_MINOR, \
libavfilter/vf_drawtext.c+9−0
@@ -88,6 +88,9 @@ static const char *const var_names[] = { · 87 unmodified lines
88 "x",88 "x",
89 "y",89 "y",
90 "pict_type",90 "pict_type",
91 "pkt_pos",
92 "pkt_duration",
93 "pkt_size",
91 NULL94 NULL
92};95};
93 96
@@ -125,6 +128,9 @@ enum var_name { · 31 unmodified lines
125 VAR_X,128 VAR_X,
126 VAR_Y,129 VAR_Y,
127 VAR_PICT_TYPE,130 VAR_PICT_TYPE,
131 VAR_PKT_POS,
132 VAR_PKT_DURATION,
133 VAR_PKT_SIZE,
128 VAR_VARS_NB134 VAR_VARS_NB
129};135};
130 136
@@ -1516,6 +1522,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 1385 unmodified lines
1516 NAN : frame->pts * av_q2d(inlink->time_base);1522 NAN : frame->pts * av_q2d(inlink->time_base);
1517 1523
1518 s->var_values[VAR_PICT_TYPE] = frame->pict_type;1524 s->var_values[VAR_PICT_TYPE] = frame->pict_type;
1525 s->var_values[VAR_PKT_POS] = frame->pkt_pos;
1526 s->var_values[VAR_PKT_DURATION] = frame->pkt_duration * av_q2d(inlink->time_base);
1527 s->var_values[VAR_PKT_SIZE] = frame->pkt_size;
1519 s->metadata = frame->metadata;1528 s->metadata = frame->metadata;
1520 1529
1521 draw_text(ctx, frame, frame->width, frame->height);1530 draw_text(ctx, frame, frame->width, frame->height);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t