From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 4F22D4DFFD for ; Thu, 6 Mar 2025 20:59:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5A4FB68F046; Thu, 6 Mar 2025 22:59:26 +0200 (EET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D90368EECD for ; Thu, 6 Mar 2025 22:59:19 +0200 (EET) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-223fb0f619dso23126055ad.1 for ; Thu, 06 Mar 2025 12:59:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741294757; x=1741899557; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=WVIQ7gbeFYf2/l+qx8EwJFeLURcAcZTOVupo28cVb2U=; b=i3ODOGEI3EWUCoid4WIucaThdgdJRIcUghWpcXFXudrJXGyLOq2j2p7XHIPuLM8JOL CAxorLiAAgXKmge+CDScyuRN/zqIQi16fqgFz9FaXjkiAcsEj9TvYe0u7Vaf4bVH+fbf bbmfDwsAQtUZ18fiwmHDWvWAhd41AaLHH4rQlMdqYy3plIazNEbX3ywB4OH5PvppkTty PpRHsmtfyq5aYQdu7lK4Q5Q1EW1BCQYTZCdROLTXMvwCOleQ/8gYSvu+ASSwQW+3EgYq gJ5TAaJRQyoICqoUhaB46FmLHBShwYhn2m8D7H5q3IvsLkD8c//YsstNU3kWjWJ1A0fX 3GjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741294757; x=1741899557; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WVIQ7gbeFYf2/l+qx8EwJFeLURcAcZTOVupo28cVb2U=; b=ehvDgNvPTR0o4JE/iLlCxgY4ODgAHfVUSAMvfybEH5i3380olNC1gyKgIp7TLyOvpn MsqVMoUTUuJkRTv6Vq+eiUYZLa4rQr8t9DJm/9Rh3JSjShGIzhbkvlZ5ob6wHXAadZPs rY5aSxp+iXnFxP9GJ1CNW8Yw60XOtlMZsyaEKfv1OKTQg7h0654ReVRxGuqQ+9+9ktWi f1uo+KNS9jDThc335MCMUK+dORu4PcHcQn5xhdTDOXoNbU71AVNbsMpkUMEYGJ+yYjKz Mwcj/cu95g2n89rNd4r7YH54wRUV8qSanmHS5KRKtbYMgGOOwTwQnxNLdDDUEju81pMr mviA== X-Gm-Message-State: AOJu0YxIDNkLY1P/hJaD/aiEdQP9Gsx0erQY6TH15hFmKPA840p2YSUf StyT7RvL2/akmHauS8vnscAW9gdAWNuXNh89Xthv/cEVpNXiEPlJ52Yh3A== X-Gm-Gg: ASbGncuKH2mvsag0D45nE2KM7rD7Adsf/8PsPiOd5vHJ2vadC7eFMxZPzrYA7Jw/nng F3OQSM2OJHaGyn1mYXgNSaQXW5cs4ew0BnFc33a7YXm3Zq5e8VieqcEbiU0txq+SHBN49m6G67M 7i7by1eV8oDCbS3SC3HXrq0FKgmEL20q7EkoTmBLtC+Hx6Tp+/FeQLpHeHHPW1YCivmqorVCjRG NvBXSRcAV3jk93x4PwBxQvnhQqsz8NPiEYvFXt3V0vgeVAqJBhSIceJ9yw4H6epWd6PrVSIv3BT shoSRy3oBKTDGjlaQBQqD8clAdhmGTzUf49HnE38iJg9WMDR31AER7YsBHpoyX8= X-Google-Smtp-Source: AGHT+IHwoRZFH5zxLgYXhhUCg2kLqnUTOWPLek7FNoNC1IGrZ3sO3VgIoGnG9ws8TmgLpxtL9mcu+g== X-Received: by 2002:a05:6a21:388a:b0:1ee:d418:f758 with SMTP id adf61e73a8af0-1f544aef735mr1601784637.17.1741294757421; Thu, 06 Mar 2025 12:59:17 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af28126dfffsm1458216a12.60.2025.03.06.12.59.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Mar 2025 12:59:17 -0800 (PST) Message-Id: In-Reply-To: References: From: ffmpegagent Date: Thu, 06 Mar 2025 20:59:07 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v3 0/4] avutil/log: Replace addresses in log output with simple ids X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: softworkz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ..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 ## 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 - - ## 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".