On Wed, Mar 21, 2018 at 03:20:30PM +0100, Tobias Rapp wrote: > Allows to manage the AV_LOG_PRINT_LEVEL flag as a prefix to the loglevel > option value, similar to the existing AV_LOG_SKIP_REPEATED flag. > > Signed-off-by: Tobias Rapp <t.r...@noa-archive.com> > --- > doc/fftools-common-opts.texi | 11 +++++++---- > fftools/cmdutils.c | 26 +++++++++++++++++++------- > 2 files changed, 26 insertions(+), 11 deletions(-) > > diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi > index 185ec21..9b6bc44 100644 > --- a/doc/fftools-common-opts.texi > +++ b/doc/fftools-common-opts.texi > @@ -168,14 +168,17 @@ The returned list cannot be assumed to be always > complete. > ffmpeg -sinks pulse,server=192.168.0.4 > @end example > > -@item -loglevel [repeat+]@var{loglevel} | -v [repeat+]@var{loglevel} > +@item -loglevel [repeat+][level+]@var{loglevel} | -v > [repeat+][level+]@var{loglevel} > Set the logging level used by the library. > Adding "repeat+" indicates that repeated log output should not be compressed > to the first line and the "Last message repeated n times" line will be > omitted. "repeat" can also be used alone. > -If "repeat" is used alone, and with no prior loglevel set, the default > -loglevel will be used. If multiple loglevel parameters are given, using > -'repeat' will not change the loglevel. > +Adding "level+" indicates that log output should add a @code{[level]} prefix > to > +each message line. This can be used as an alternative to log coloring, e.g. > when > +dumping the log to file. > +If "repeat" and/or "level" is used alone, and with no prior loglevel set, the > +default loglevel will be used. If multiple loglevel parameters are given, > using > +'repeat'/'level' will not change the loglevel. > @var{loglevel} is a string or a number containing one of the following > values: > @table @samp > @item quiet, -8 > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index 708a849..51fa88c 100644 > --- a/fftools/cmdutils.c > +++ b/fftools/cmdutils.c > @@ -888,16 +888,28 @@ int opt_loglevel(void *optctx, const char *opt, const > char *arg) > > flags = av_log_get_flags(); > tail = strstr(arg, "repeat"); > - if (tail) > + if (tail == arg) { > flags &= ~AV_LOG_SKIP_REPEATED; > - else > + arg += 6 + (arg[6] == '+'); > + if (!*arg) { > + av_log_set_flags(flags); > + return 0; > + } > + } else { > flags |= AV_LOG_SKIP_REPEATED; > - > + } > + tail = strstr(arg, "level"); > + if (tail == arg) { > + flags |= AV_LOG_PRINT_LEVEL; > + arg += 5 + (arg[5] == '+'); > + if (!*arg) { > + av_log_set_flags(flags); > + return 0; > + } > + } else { > + flags &= ~AV_LOG_PRINT_LEVEL; > + } > av_log_set_flags(flags); > - if (tail == arg) > - arg += 6 + (arg[6]=='+'); > - if(tail && !*arg) > - return 0;
might be simpler to use av_strtok() also this code should idealy be moved into libavutil so other applications do not need to duplicate it thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Never trust a computer, one day, it may think you are the virus. -- Compn
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel