From: ffmpegagent <ffmpegagent@gmail.com> To: ffmpeg-devel@ffmpeg.org Cc: softworkz <softworkz@hotmail.com> Subject: [FFmpeg-devel] [PATCH v3 0/4] avutil/log: Replace addresses in log output with simple ids Date: Thu, 06 Mar 2025 20:59:07 +0000 Message-ID: <pull.59.v3.ffstaging.FFmpeg.1741294751.ffmpegagent@gmail.com> (raw) In-Reply-To: <pull.59.v2.ffstaging.FFmpeg.1741198783.ffmpegagent@gmail.com> ..and individual numbering. The benefits are: * Smaller log file sizes * The disambiguation is much easier to recognize and to follow * It eventually allows comparing and viewing log file diffs without almost every line being different due to those addresses Before ====== [hevc @ 0000018e72a89cc0] nal_unit_type: [hevc @ 0000018e72a89cc0] Decoding PPS [hevc @ 0000018e72a89cc0] nal_unit_type: 39(SEI_P.. [hevc @ 0000018e72a89cc0] Decoding SEI [mp4 @ 0000018e72a8e240] All [mp4 @ 0000018e72a8e240] Afte [hevc @ 0000018e742f6b40] Decoded frame with POC .. detected 16 logical cores [Parsed_scale_0 @ 0000018e74382f40] Setting 'w' t.. [Parsed_scale_0 @ 0000018e74382f40] Setting 'h' t.. [Parsed_scale_1 @ 0000018e74382440] Setting 'w' t.. [mjpeg @ 0000018e743210c0] Forcing thread count t.. [mjpeg @ 0000018e743210c0] intra_quant_bias = 96 After ===== [hevc #0] nal_unit_type: [hevc #0] Decoding PPS [hevc #0] nal_unit_type: 39(SEI_P.. [hevc #0] Decoding SEI [mp4 #0] All info found [mp4 #0] After avformat_find_ [hevc #1] Decoded frame with POC 2. [Parsed_scale_0 #0] Setting 'w' t.. [Parsed_scale_0 #0] Setting 'h' t.. [Parsed_scale_1 #1] Setting 'w' t.. [mjpeg #2] Forcing thread count t.. [mjpeg #2] intra_quant_bias = 96 Versions ======== V2 == * Added log flag for optionally restoring the previous behavior (as requested by Gyan) softworkz (4): avutil/log: Add callback for context prefix formatting fftools/opt_common: add memaddresses log flag fftools: Provide a log formatting callback for context prefixes doc/fftools-common-opts: document memaddresses log flag doc/APIchanges | 4 +++ doc/fftools-common-opts.texi | 2 ++ fftools/cmdutils.c | 69 ++++++++++++++++++++++++++++++++++++ fftools/cmdutils.h | 5 +++ fftools/ffmpeg.c | 1 + fftools/ffplay.c | 1 + fftools/ffprobe.c | 1 + fftools/opt_common.c | 6 ++++ libavutil/log.c | 24 +++++++++---- libavutil/log.h | 29 +++++++++++++++ libavutil/version.h | 2 +- 11 files changed, 137 insertions(+), 7 deletions(-) base-commit: 5c5be37daff4f4ecbe0c20d6a9f0fdad6eadc9c8 Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-59%2Fsoftworkz%2Fsubmit_logaddresses-v3 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-59/softworkz/submit_logaddresses-v3 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/59 Range-diff vs v2: -: ---------- > 1: b8702de13b avutil/log: Add callback for context prefix formatting 2: 858e2cca9c = 2: 84c0848afc fftools/opt_common: add memaddresses log flag 1: 3a289533a7 ! 3: 105adac4ba avutil/log: Replace addresses in log output with simple ids @@ Metadata Author: softworkz <softworkz@hotmail.com> ## Commit message ## - avutil/log: Replace addresses in log output with simple ids + fftools: Provide a log formatting callback for context prefixes - ..and individual numbering. The benefits are: + This allows to print logical ids instead of memory addresses. + The benefits are: - Smaller log file sizes - The disambiguation is much easier to recognize and to follow - It eventually allows comparing and viewing log file diffs without almost every line being different due to those addresses - Signed-off-by: softworkz <softworkz@hotmail.com> - - ## doc/APIchanges ## -@@ - The last version increases of all libraries were on 2024-03-07 - -+2025-03-xx - xxxxxxxxxx - lavu 59.59.100 - log.h -+ Add flag AV_LOG_PRINT_MEMADDRESSES. -+ - API changes, most recent first: + ## fftools/cmdutils.c ## +@@ fftools/cmdutils.c: AVDictionary *format_opts, *codec_opts; - 2025-03-01 - xxxxxxxxxx - lavu 59.58.100 - pixfmt.h - - ## libavutil/log.c ## -@@ libavutil/log.c: static AVMutex mutex = AV_MUTEX_INITIALIZER; + int hide_banner = 0; - static int av_log_level = AV_LOG_INFO; - static int flags; +static int nb_class_ids; + +#define NB_CLASS_IDS 1000 @@ libavutil/log.c: static AVMutex mutex = AV_MUTEX_INITIALIZER; + // exceeded NB_CLASS_IDS entries in class_ids[] + return 0; +} ++ + void uninit_opts(void) + { + av_dict_free(&swr_opts); +@@ fftools/cmdutils.c: static void check_options(const OptionDef *po) + } + } - #define NB_LEVELS 8 - #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE -@@ libavutil/log.c: static void format_line(void *avcl, int level, const char *fmt, va_list vl, - - if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16; - if (*print_prefix && avc) { -+ const int print_mem = flags & AV_LOG_PRINT_MEMADDRESSES; ++static const char *item_name(void *obj, const AVClass *cls) ++{ ++ return (cls->item_name ? cls->item_name : av_default_item_name)(obj); ++} + - if (avc->parent_log_context_offset) { -- AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) + -- avc->parent_log_context_offset); -+ AVClass** parent = *(AVClass ***) ((uint8_t *)avcl + avc->parent_log_context_offset); - if (parent && *parent) { -- av_bprintf(part+0, "[%s @ %p] ", -- item_name(parent, *parent), parent); -+ if (print_mem) -+ av_bprintf(part+0, "[%s @ %p] ", item_name(parent, *parent), parent); -+ else -+ av_bprintf(part+0, "[%s #%u] ", item_name(parent, *parent), get_class_id(parent)); ++static void log_formatprefix_callback(AVBPrint* buffer, AVClass** avcl, int log_flags) ++{ ++ const int print_mem = log_flags & AV_LOG_PRINT_MEMADDRESSES; ++ if (print_mem) ++ av_bprintf(buffer+0, "[%s @ %p] ", item_name(avcl, *avcl), avcl); ++ else ++ av_bprintf(buffer+0, "[%s #%u] ", item_name(avcl, *avcl), get_class_id(avcl)); ++} + - if(type) type[0] = get_category(parent); - } - } -- av_bprintf(part+1, "[%s @ %p] ", -- item_name(avcl, avc), avcl); -+ if (print_mem) -+ av_bprintf(part+1, "[%s @ %p] ", item_name(avcl, avc), avcl); -+ else -+ av_bprintf(part+1, "[%s #%u] ", item_name(avcl, avc), get_class_id(avcl)); ++void init_logformatting(void) ++{ ++ av_log_set_formatprefix_callback(&log_formatprefix_callback); ++} + - if(type) type[1] = get_category(avcl); - } - + void parse_loglevel(int argc, char **argv, const OptionDef *options) + { + int idx; - ## libavutil/log.h ## -@@ libavutil/log.h: int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl, + ## fftools/cmdutils.h ## +@@ fftools/cmdutils.h: int split_commandline(OptionParseContext *octx, int argc, char *argv[], */ - #define AV_LOG_PRINT_DATETIME 8 + void uninit_parse_context(OptionParseContext *octx); +/** -+ * Print memory addresses instead of logical ids in the AVClass prefix. ++ * Sets up formatting callbacks for logging + */ -+#define AV_LOG_PRINT_MEMADDRESSES 16 ++void init_logformatting(void); + - void av_log_set_flags(int arg); - int av_log_get_flags(void); + /** + * Find the '-loglevel' option in the command line args and apply it. + */ + + ## fftools/ffmpeg.c ## +@@ fftools/ffmpeg.c: int main(int argc, char **argv) + setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */ + av_log_set_flags(AV_LOG_SKIP_REPEATED); ++ init_logformatting(); + parse_loglevel(argc, argv, options); + + #if CONFIG_AVDEVICE - ## libavutil/version.h ## -@@ - */ + ## fftools/ffplay.c ## +@@ fftools/ffplay.c: int main(int argc, char **argv) + init_dynload(); + + av_log_set_flags(AV_LOG_SKIP_REPEATED); ++ init_logformatting(); + parse_loglevel(argc, argv, options); + + /* register all codecs, demux and protocols */ + + ## fftools/ffprobe.c ## +@@ fftools/ffprobe.c: int main(int argc, char **argv) + init_dynload(); - #define LIBAVUTIL_VERSION_MAJOR 59 --#define LIBAVUTIL_VERSION_MINOR 58 -+#define LIBAVUTIL_VERSION_MINOR 59 - #define LIBAVUTIL_VERSION_MICRO 100 + av_log_set_flags(AV_LOG_SKIP_REPEATED); ++ init_logformatting(); - #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ + options = real_options; + parse_loglevel(argc, argv, options); 3: 411c77bdeb = 4: 9dc2cbe5ca doc/fftools-common-opts: document memaddresses log flag -- ffmpeg-codebot _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2025-03-06 20:59 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-03-05 15:38 [FFmpeg-devel] [PATCH] " softworkz 2025-03-05 15:40 ` Nicolas George 2025-03-05 15:45 ` Soft Works 2025-03-05 15:48 ` Soft Works 2025-03-06 10:08 ` Nicolas George 2025-03-06 17:02 ` Soft Works 2025-03-06 17:38 ` Marvin Scholz 2025-03-06 17:44 ` Soft Works 2025-03-06 17:49 ` Marvin Scholz 2025-03-06 18:16 ` Soft Works 2025-03-06 18:58 ` Marvin Scholz 2025-03-06 19:27 ` Soft Works 2025-03-06 20:01 ` Marvin Scholz 2025-03-06 20:48 ` Soft Works 2025-03-06 20:56 ` Soft Works 2025-03-05 15:42 ` Soft Works 2025-03-05 16:23 ` Gyan Doshi 2025-03-05 16:30 ` Soft Works 2025-03-05 17:14 ` Gyan Doshi 2025-03-05 18:19 ` [FFmpeg-devel] [PATCH v2 0/3] " ffmpegagent 2025-03-05 18:19 ` [FFmpeg-devel] [PATCH v2 1/3] " softworkz 2025-03-05 18:19 ` [FFmpeg-devel] [PATCH v2 2/3] fftools/opt_common: add memaddresses log flag softworkz 2025-03-05 18:19 ` [FFmpeg-devel] [PATCH v2 3/3] doc/fftools-common-opts: document " softworkz 2025-03-06 10:04 ` [FFmpeg-devel] [PATCH v2 0/3] avutil/log: Replace addresses in log output with simple ids Nicolas George 2025-03-06 16:38 ` Soft Works 2025-03-06 16:43 ` Nicolas George 2025-03-06 17:05 ` Soft Works 2025-03-06 17:38 ` Soft Works 2025-03-06 20:59 ` ffmpegagent [this message] 2025-03-06 20:59 ` [FFmpeg-devel] [PATCH v3 1/4] avutil/log: Add callback for context prefix formatting softworkz 2025-03-06 20:59 ` [FFmpeg-devel] [PATCH v3 2/4] fftools/opt_common: add memaddresses log flag softworkz 2025-03-06 20:59 ` [FFmpeg-devel] [PATCH v3 3/4] fftools: Provide a log formatting callback for context prefixes softworkz 2025-03-06 20:59 ` [FFmpeg-devel] [PATCH v3 4/4] doc/fftools-common-opts: document memaddresses log flag softworkz
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=pull.59.v3.ffstaging.FFmpeg.1741294751.ffmpegagent@gmail.com \ --to=ffmpegagent@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=softworkz@hotmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git