aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2025-08-11 15:47:48 +0200
committerNiklas Haas <ffmpeg@haasn.dev>2025-08-12 09:01:39 +0000
commitd276875c90ec0ce923518d061ae03c48f6cd3af6 (patch)
tree11e3db844016fd0bb65e00c53fb36830e471ad43
parent029f501a95c1bb47a1407dee06992b3a70d2c8fa (diff)
downloadffmpeg-d276875c90ec0ce923518d061ae03c48f6cd3af6.tar.gz
avfilter/vf_drawtext: use AVFilterContext for logging
-rw-r--r--libavfilter/vf_drawtext.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 674e1e53c1..c2f6f52f43 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1269,11 +1269,12 @@ static void update_alpha(DrawTextContext *s)
s->alpha = 256 * alpha;
}
-static int draw_glyphs(DrawTextContext *s, AVFrame *frame,
+static int draw_glyphs(AVFilterContext *ctx, AVFrame *frame,
FFDrawColor *color,
TextMetrics *metrics,
int x, int y, int borderw)
{
+ DrawTextContext *s = ctx->priv;
int g, l, x1, y1, w1, h1, idx;
int dx = 0, dy = 0, pdx = 0;
GlyphInfo *info;
@@ -1297,7 +1298,7 @@ static int draw_glyphs(DrawTextContext *s, AVFrame *frame,
if ((!j_left || j_right) && !s->tab_warning_printed && s->tab_count > 0) {
s->tab_warning_printed = 1;
- av_log(s, AV_LOG_WARNING, "Tab characters are only supported with left horizontal alignment\n");
+ av_log(ctx, AV_LOG_WARNING, "Tab characters are only supported with left horizontal alignment\n");
}
clip_x = FFMIN(metrics->rect_x + s->box_width + s->bb_right, frame->width);
@@ -1510,7 +1511,7 @@ continue_on_failed2:
cur_line->width64 = w64;
- av_log(s, AV_LOG_DEBUG, " Line: %d -- glyphs count: %d - width64: %d - offset_left64: %d - offset_right64: %d)\n",
+ av_log(ctx, AV_LOG_DEBUG, " Line: %d -- glyphs count: %d - width64: %d - offset_left64: %d - offset_right64: %d)\n",
line_count, hb->glyph_count, cur_line->width64, cur_line->offset_left64, cur_line->offset_right64);
if (w64 > width64) {
@@ -1613,7 +1614,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame)
return ret;
if (!av_bprint_is_complete(&s->expanded_fontcolor))
return AVERROR(ENOMEM);
- av_log(s, AV_LOG_DEBUG, "Evaluated fontcolor is '%s'\n", s->expanded_fontcolor.str);
+ av_log(ctx, AV_LOG_DEBUG, "Evaluated fontcolor is '%s'\n", s->expanded_fontcolor.str);
ret = av_parse_color(s->fontcolor.rgba, s->expanded_fontcolor.str, -1, s);
if (ret)
return ret;
@@ -1797,20 +1798,20 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame)
}
if (s->shadowx || s->shadowy) {
- if ((ret = draw_glyphs(s, frame, &shadowcolor, &metrics,
+ if ((ret = draw_glyphs(ctx, frame, &shadowcolor, &metrics,
s->shadowx, s->shadowy, s->borderw)) < 0) {
return ret;
}
}
if (s->borderw) {
- if ((ret = draw_glyphs(s, frame, &bordercolor, &metrics,
+ if ((ret = draw_glyphs(ctx, frame, &bordercolor, &metrics,
0, 0, s->borderw)) < 0) {
return ret;
}
}
- if ((ret = draw_glyphs(s, frame, &fontcolor, &metrics, 0,
+ if ((ret = draw_glyphs(ctx, frame, &fontcolor, &metrics, 0,
0, 0)) < 0) {
return ret;
}
@@ -1846,7 +1847,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
header = (AVDetectionBBoxHeader *)sd->data;
loop = header->nb_bboxes;
} else {
- av_log(s, AV_LOG_WARNING, "No detection bboxes.\n");
+ av_log(ctx, AV_LOG_WARNING, "No detection bboxes.\n");
return ff_filter_frame(outlink, frame);
}
}