History

avfilter/vf_thumbnail: allow to change stats log level

Paul B Mahol committed 3 years ago

Commit 520111c1 parent 46642ce2 files · +13 −3Browse files

Unified · Split

2 files
  1. doc/filters.texi +4 −0
  2. libavfilter/vf_thumbnail.c +9 −3
doc/filters.texi+4−0
@@ -22193,6 +22193,10 @@ The filter accepts the following options: · 22192 unmodified lines
22193Set the frames batch size to analyze; in a set of @var{n} frames, the filter22193Set the frames batch size to analyze; in a set of @var{n} frames, the filter
22194will pick one of them, and then handle the next batch of @var{n} frames until22194will pick one of them, and then handle the next batch of @var{n} frames until
22195the end. Default is @code{100}.22195the end. Default is @code{100}.
22196
22197@item log
22198Set the log level to display picked frame stats.
22199Default is @code{info}.
22196@end table22200@end table
22197 22201
22198Since the filter keeps track of the whole frames sequence, a bigger @var{n}22202Since the filter keeps track of the whole frames sequence, a bigger @var{n}
libavfilter/vf_thumbnail.c+9−3
@@ -42,6 +42,7 @@ struct thumb_frame { · 41 unmodified lines
42typedef struct ThumbContext {42typedef struct ThumbContext {
43 const AVClass *class;43 const AVClass *class;
44 int n; ///< current frame44 int n; ///< current frame
45 int loglevel;
45 int n_frames; ///< number of frames for analysis46 int n_frames; ///< number of frames for analysis
46 struct thumb_frame *frames; ///< the n_frames frames47 struct thumb_frame *frames; ///< the n_frames frames
47 AVRational tb; ///< copy of the input timebase to ease access48 AVRational tb; ///< copy of the input timebase to ease access
@@ -58,6 +59,10 @@ typedef struct ThumbContext { · 10 unmodified lines
58 59
59static const AVOption thumbnail_options[] = {60static const AVOption thumbnail_options[] = {
60 { "n", "set the frames batch size", OFFSET(n_frames), AV_OPT_TYPE_INT, {.i64=100}, 2, INT_MAX, FLAGS },61 { "n", "set the frames batch size", OFFSET(n_frames), AV_OPT_TYPE_INT, {.i64=100}, 2, INT_MAX, FLAGS },
62 { "log", "force stats logging level", OFFSET(loglevel), AV_OPT_TYPE_INT, {.i64 = AV_LOG_INFO}, INT_MIN, INT_MAX, FLAGS, "level" },
63 { "quiet", "logging disabled", 0, AV_OPT_TYPE_CONST, {.i64 = AV_LOG_QUIET}, 0, 0, FLAGS, "level" },
64 { "info", "information logging level", 0, AV_OPT_TYPE_CONST, {.i64 = AV_LOG_INFO}, 0, 0, FLAGS, "level" },
65 { "verbose", "verbose logging level", 0, AV_OPT_TYPE_CONST, {.i64 = AV_LOG_VERBOSE}, 0, 0, FLAGS, "level" },
61 { NULL }66 { NULL }
62};67};
63 68
@@ -127,9 +132,10 @@ static AVFrame *get_best_frame(AVFilterContext *ctx) · 63 unmodified lines
127 132
128 // raise the chosen one133 // raise the chosen one
129 picref = s->frames[best_frame_idx].buf;134 picref = s->frames[best_frame_idx].buf;
130 av_log(ctx, AV_LOG_INFO, "frame id #%d (pts_time=%f) selected "135 if (s->loglevel != AV_LOG_QUIET)
131 "from a set of %d images\n", best_frame_idx,136 av_log(ctx, s->loglevel, "frame id #%d (pts_time=%f) selected "
132 picref->pts * av_q2d(s->tb), nb_frames);137 "from a set of %d images\n", best_frame_idx,
138 picref->pts * av_q2d(s->tb), nb_frames);
133 s->frames[best_frame_idx].buf = NULL;139 s->frames[best_frame_idx].buf = NULL;
134 140
135 return picref;141 return picref;

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