MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / opt_loglevel

Function opt_loglevel

ffmpeg-single-cmd/src/main/cpp/cmdutils.c:871–919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

869}
870
871int opt_loglevel(void *optctx, const char *opt, const char *arg)
872{
873 const struct { const char *name; int level; } log_levels[] = {
874 { "quiet" , AV_LOG_QUIET },
875 { "panic" , AV_LOG_PANIC },
876 { "fatal" , AV_LOG_FATAL },
877 { "error" , AV_LOG_ERROR },
878 { "warning", AV_LOG_WARNING },
879 { "info" , AV_LOG_INFO },
880 { "verbose", AV_LOG_VERBOSE },
881 { "debug" , AV_LOG_DEBUG },
882 { "trace" , AV_LOG_TRACE },
883 };
884 char *tail;
885 int level;
886 int flags;
887 int i;
888
889 flags = av_log_get_flags();
890 tail = strstr(arg, "repeat");
891 if (tail)
892 flags &= ~AV_LOG_SKIP_REPEATED;
893 else
894 flags |= AV_LOG_SKIP_REPEATED;
895
896 av_log_set_flags(flags);
897 if (tail == arg)
898 arg += 6 + (arg[6]=='+');
899 if(tail && !*arg)
900 return 0;
901
902 for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) {
903 if (!strcmp(log_levels[i].name, arg)) {
904 av_log_set_level(log_levels[i].level);
905 return 0;
906 }
907 }
908
909 level = strtol(arg, &tail, 10);
910 if (*tail) {
911 av_log(NULL, AV_LOG_FATAL, "Invalid loglevel \"%s\". "
912 "Possible levels are numbers or:\n", arg);
913 for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
914 av_log(NULL, AV_LOG_FATAL, "\"%s\"\n", log_levels[i].name);
915 exit_program(1);
916 }
917 av_log_set_level(level);
918 return 0;
919}
920
921static void expand_filename_template(AVBPrint *bp, const char *template,
922 struct tm *tm)

Callers 1

parse_loglevelFunction · 0.85

Calls 1

exit_programFunction · 0.85

Tested by

no test coverage detected