summaryrefslogtreecommitdiff
path: root/libavfilter/vf_drawtext.c
diff options
context:
space:
mode:
authorCalvin Walton <calvin.walton@kepstin.ca>2019-06-21 09:08:03 -0400
committerGyan Doshi <ffmpeg@gyani.pro>2019-07-07 11:12:07 +0530
commit2bd21b96096320bc12532119a6b0f7a974db6c19 (patch)
tree0be4a61a2f1f75dad1c4c33f348d5596db5208cc /libavfilter/vf_drawtext.c
parentb7b6ddd59693008c35b3247496ecc946331d0856 (diff)
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.
Diffstat (limited to 'libavfilter/vf_drawtext.c')
-rw-r--r--libavfilter/vf_drawtext.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 01cd7fa122..8f4badbdb5 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -88,6 +88,9 @@ static const char *const var_names[] = {
"x",
"y",
"pict_type",
+ "pkt_pos",
+ "pkt_duration",
+ "pkt_size",
NULL
};
@@ -125,6 +128,9 @@ enum var_name {
VAR_X,
VAR_Y,
VAR_PICT_TYPE,
+ VAR_PKT_POS,
+ VAR_PKT_DURATION,
+ VAR_PKT_SIZE,
VAR_VARS_NB
};
@@ -1516,6 +1522,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
NAN : frame->pts * av_q2d(inlink->time_base);
s->var_values[VAR_PICT_TYPE] = frame->pict_type;
+ s->var_values[VAR_PKT_POS] = frame->pkt_pos;
+ s->var_values[VAR_PKT_DURATION] = frame->pkt_duration * av_q2d(inlink->time_base);
+ s->var_values[VAR_PKT_SIZE] = frame->pkt_size;
s->metadata = frame->metadata;
draw_text(ctx, frame, frame->width, frame->height);