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

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/vf_thumbnail.c+9−3
@@ -42,6 +42,7 @@ struct thumb_frame { · 41 unmodified lines
4242 typedef struct ThumbContext {
4343 const AVClass *class;
4444 int n; ///< current frame
45+ int loglevel;
4546 int n_frames; ///< number of frames for analysis
4647 struct thumb_frame *frames; ///< the n_frames frames
4748 AVRational tb; ///< copy of the input timebase to ease access
@@ -58,6 +59,10 @@ typedef struct ThumbContext { · 10 unmodified lines
5859
5960 static const AVOption thumbnail_options[] = {
6061 { "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" },
6166 { NULL }
6267 };
6368
@@ -127,9 +132,10 @@ static AVFrame *get_best_frame(AVFilterContext *ctx) · 63 unmodified lines
127132
128133 // raise the chosen one
129134 picref = s->frames[best_frame_idx].buf;
130− av_log(ctx, AV_LOG_INFO, "frame id #%d (pts_time=%f) selected "
131− "from a set of %d images\n", best_frame_idx,
132− picref->pts * av_q2d(s->tb), nb_frames);
135+ if (s->loglevel != AV_LOG_QUIET)
136+ av_log(ctx, s->loglevel, "frame id #%d (pts_time=%f) selected "
137+ "from a set of %d images\n", best_frame_idx,
138+ picref->pts * av_q2d(s->tb), nb_frames);
133139 s->frames[best_frame_idx].buf = NULL;
134140
135141 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