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
90029002
90039003 @item pict_type
90049004 A one character description of the current frame's picture type.
9005+
9006+@item pkt_pos
9007+The current packet's position in the input file or stream
9008+(in bytes, from the start of the input). A value of -1 indicates
9009+this info is not available.
9010+
9011+@item pkt_duration
9012+The current packet's duration, in seconds.
9013+
9014+@item pkt_size
9015+The current packet's size (in bytes).
90059016 @end table
90069017
90079018 @anchor{drawtext_expansion}
libavfilter/version.h+2−1
@@ -31,7 +31,8 @@ · 30 unmodified lines
3131
3232 #define LIBAVFILTER_VERSION_MAJOR 7
3333 #define LIBAVFILTER_VERSION_MINOR 56
34−#define LIBAVFILTER_VERSION_MICRO 100
34+#define LIBAVFILTER_VERSION_MICRO 101
35+
3536
3637 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
3738 LIBAVFILTER_VERSION_MINOR, \
libavfilter/vf_drawtext.c+9−0
@@ -88,6 +88,9 @@ static const char *const var_names[] = { · 87 unmodified lines
8888 "x",
8989 "y",
9090 "pict_type",
91+ "pkt_pos",
92+ "pkt_duration",
93+ "pkt_size",
9194 NULL
9295 };
9396
@@ -125,6 +128,9 @@ enum var_name { · 31 unmodified lines
125128 VAR_X,
126129 VAR_Y,
127130 VAR_PICT_TYPE,
131+ VAR_PKT_POS,
132+ VAR_PKT_DURATION,
133+ VAR_PKT_SIZE,
128134 VAR_VARS_NB
129135 };
130136
@@ -1516,6 +1522,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 1385 unmodified lines
15161522 NAN : frame->pts * av_q2d(inlink->time_base);
15171523
15181524 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;
15191528 s->metadata = frame->metadata;
15201529
15211530 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