From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id F12BF4C10F for ; Tue, 2 Sep 2025 16:29:38 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'3yW3hPx+jrPM67/44fXBL7EOi6HMMavLwPlyx3ZZgnY=', expected b's/quE9l54nyfrLMMInT0sHw2B9/FE2aPWioahmtV5Tg=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1756830553; h=mime-version : to : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=3yW3hPx+jrPM67/44fXBL7EOi6HMMavLwPlyx3ZZgnY=; b=f2IACLkW0AT9HKbUa4r4UOB4+pkiOJPoUwztESOTRR3JfBrdqC4MPpm0xxnCOGGGibArU 4a9wS3GIKV5i1N/28KbwE0lPboQQVFq9qC+bqk+8W482S0827ITXHormgu1I9RxKLpBUbES LPEvL+XTJi5WVQbVjo2+SsW1nuud3qktqHMGJskiNh9vv4xvjdDv7c7LUg2z9zhq23uk7E2 Qu4p/q7vCY3xiOHAV4yXSwTuDvRsYLh/GfWKhuwJGRYwmUuJzPE8fYabnZjqCcDZkknQYwy xcScwZ3ZSDtK1TnzXkk19VkRAxx6w/bKTvXqdcz2fs4SKc5HuhF97XolEkQQ== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id EDB2368E7A1; Tue, 2 Sep 2025 19:29:12 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1756830540; b=i5ro4Oxo53nyf0TnT8OjggetmOlRH4zUyNoyVOEoViixzf6ee5bhZdEybcIOy2sz4m7/h iQbmVuCtRniQwGeOvQ9u3Y7bKlwndgQjIxLHP1MD6M2U2pTY9sHVvU19fvhqbDcsVAGNEUW IESAAxESyhoLcjVZ0ogku9ZFORXVZddVh324ZkD38X31Jh0NNa2kJulj7/F9tHq7rhXFk9S bAp6POMQhJtFyLm0r3ytBZK8twnwx5yxpPsfzk6Z4Qd+6borrTUS9Pp+h/9xCPbaQXOXDcz VR18X/+rnA3p5iMzol1J+a2fRskQG/rLV3fvV4yql85g4ETqeT1weSEdenBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1756830540; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=QrezPp12Ghc196icoGG1jcxG+VK3Ejp+KJVfd1XszOs=; b=Pvqv81gwV9EXxF9FAkFA7gU5vjXJdjO25GQwLPuc9rUv4r+esp+Mac0ouM2tI0J2D8s1f SjEUGUpxq0wRlsnt9h6N5FUN1t3Uk2AWSVTjEL7/XOLdHRN7VnnFBzVZ8Foe6CVTPTDBTon mc4Yw3lOi9DXq/C9qIjnAypoCgCbTA7FAri55LXzGdUZXmo6YG3zTRkTJ18Jy3QE+ZCwp2a 05THvbXmkEh8x4vlBkoLhM3Wlyk2O9DUmUDNnrbN1vwV5FzTuKU0szHDUSY3lXE6oGZJkTd gqxHBKTpzBv2doKxQjY0FM/i6iaIPnmq4pgiS48XrUz4g1iEKg0WHNsKyw0w== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1756830531; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : from; bh=s/quE9l54nyfrLMMInT0sHw2B9/FE2aPWioahmtV5Tg=; b=tywiTu5CvlPNgnB2E60cWP25YaNSOvshw0FuD0Q6Qzl8s/t9evCkixYIfm4CsF7Bpp1WW royN78SXrenwTVJL9ZqF431KC1P+WTn5UIGREMJEKWEvKlipfEyHnuwFBwbXOXxX+cWvaxB HaQ4Xua5S+Ls74f6jbTjPfM95p49sA7DTKKh6Jo9U7LXTe6+sM/O+UkuICVMpb9vpHYqxMk jn/tb+eOXpz8+YIPhnNegbLqzN5JqSpmwI2nkbKgmZDm/MkQAlIt5rkv7YjoV/Gu71Kd21M K24oUH4R+mxkVfXGcexUVZv431F19/f0lev0rli2V1AlVUcRxQ0lbJo4loEA== Received: from 5d8f51c41678 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 5AB5568BECB for ; Tue, 2 Sep 2025 19:28:51 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Message-ID: <175683053162.25.4399736552132003106@463a07221176> Message-ID-Hash: QX6BILKKUI2WGLYTDICZVVGCPAWY26XZ X-Message-ID-Hash: QX6BILKKUI2WGLYTDICZVVGCPAWY26XZ X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] ffprobe: add support for printing downmix frame side data (PR #20401) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: ngaullier via ffmpeg-devel Cc: ngaullier Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20401 opened by ngaullier URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20401 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20401.patch Also fix honor -byte_binary_prefix as a required preliminary step. >>From 2fdd5a62d46d3b761b451d37775c808e551b7659 Mon Sep 17 00:00:00 2001 From: Nicolas Gaullier Date: Tue, 2 Sep 2025 17:07:35 +0200 Subject: [PATCH 1/4] fftools/textformat: make unit_second and unit_byte available externally This is required to support specific formatting. Also remove generic units that do no belong to textformat. Signed-off-by: Nicolas Gaullier --- fftools/textformat/avtextformat.c | 14 ++++++-------- fftools/textformat/avtextformat.h | 3 +++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c index 651a84578c..b6a0577193 100644 --- a/fftools/textformat/avtextformat.c +++ b/fftools/textformat/avtextformat.c @@ -242,10 +242,8 @@ fail: } /* Temporary definitions during refactoring */ -static const char unit_second_str[] = "s"; -static const char unit_hertz_str[] = "Hz"; -static const char unit_byte_str[] = "byte"; -static const char unit_bit_per_second_str[] = "bit/s"; +const char avtext_unit_second_str[] = "s"; +const char avtext_unit_byte_str[] = "byte"; void avtext_print_section_header(AVTextFormatContext *tctx, const void *data, int section_id) @@ -383,7 +381,7 @@ static char *value_string(const AVTextFormatContext *tctx, char *buf, int buf_si int64_t vali = 0; int show_float = 0; - if (uv.unit == unit_second_str) { + if (uv.unit == avtext_unit_second_str) { vald = uv.val.d; show_float = 1; } else { @@ -391,7 +389,7 @@ static char *value_string(const AVTextFormatContext *tctx, char *buf, int buf_si vali = uv.val.i; } - if (uv.unit == unit_second_str && tctx->use_value_sexagesimal_format) { + if (uv.unit == avtext_unit_second_str && tctx->use_value_sexagesimal_format) { double secs; int hours, mins; secs = vald; @@ -406,7 +404,7 @@ static char *value_string(const AVTextFormatContext *tctx, char *buf, int buf_si if (tctx->use_value_prefix && vald > 1) { int64_t index; - if (uv.unit == unit_byte_str && tctx->use_byte_value_binary_prefix) { + if (uv.unit == avtext_unit_byte_str && tctx->use_byte_value_binary_prefix) { index = (int64_t)(log2(vald) / 10); index = av_clip64(index, 0, FF_ARRAY_ELEMS(si_prefixes) - 1); vald /= si_prefixes[index].bin_val; @@ -502,7 +500,7 @@ void avtext_print_time(AVTextFormatContext *tctx, const char *key, double d = av_q2d(*time_base) * ts; struct unit_value uv; uv.val.d = d; - uv.unit = unit_second_str; + uv.unit = avtext_unit_second_str; value_string(tctx, buf, sizeof(buf), uv); avtext_print_string(tctx, key, buf, 0); } diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h index d9c14069eb..d6a5caed61 100644 --- a/fftools/textformat/avtextformat.h +++ b/fftools/textformat/avtextformat.h @@ -155,6 +155,9 @@ typedef struct AVTextFormatOptions { #define AV_TEXTFORMAT_PRINT_STRING_OPTIONAL 1 #define AV_TEXTFORMAT_PRINT_STRING_VALIDATE 2 +extern const char avtext_unit_second_str[]; +extern const char avtext_unit_byte_str[]; + int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args, const AVTextFormatSection *sections, int nb_sections, AVTextFormatOptions options, char *show_data_hash); -- 2.49.1 >>From 45caeb682522cbe566c9d26b2e45d0c995ef3557 Mon Sep 17 00:00:00 2001 From: Nicolas Gaullier Date: Tue, 2 Sep 2025 17:12:08 +0200 Subject: [PATCH 2/4] fftools/ffprobe: honor -byte_binary_prefix Also remove a static duplicate of unit_second which is both unused and misleading as avtext_unit_second has to be used instead. See previous commit. Signed-off-by: Nicolas Gaullier --- fftools/ffprobe.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index f4eb87aefa..67ab21c140 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -332,9 +332,7 @@ static const char *print_input_filename; static const AVInputFormat *iformat = NULL; static const char *output_filename = NULL; -static const char unit_second_str[] = "s" ; static const char unit_hertz_str[] = "Hz" ; -static const char unit_byte_str[] = "byte" ; static const char unit_bit_per_second_str[] = "bit/s"; static int nb_streams; @@ -1227,7 +1225,7 @@ static void show_packet(AVTextFormatContext *tfc, InputFile *ifile, AVPacket *pk print_time("dts_time", pkt->dts, &st->time_base); print_duration_ts("duration", pkt->duration); print_duration_time("duration_time", pkt->duration, &st->time_base); - print_val("size", pkt->size, unit_byte_str); + print_val("size", pkt->size, avtext_unit_byte_str); if (pkt->pos != -1) print_fmt ("pos", "%"PRId64, pkt->pos); else print_str_opt("pos", "N/A"); print_fmt("flags", "%c%c%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_', @@ -1379,7 +1377,7 @@ static void show_frame(AVTextFormatContext *tfc, AVFrame *frame, AVStream *strea print_duration_time("duration_time", frame->duration, &stream->time_base); if (fd && fd->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, fd->pkt_pos); else print_str_opt("pkt_pos", "N/A"); - if (fd && fd->pkt_size != -1) print_val ("pkt_size", fd->pkt_size, unit_byte_str); + if (fd && fd->pkt_size != -1) print_val ("pkt_size", fd->pkt_size, avtext_unit_byte_str); else print_str_opt("pkt_size", "N/A"); switch (stream->codecpar->codec_type) { @@ -2273,7 +2271,7 @@ static int show_format(AVTextFormatContext *tfc, InputFile *ifile) } print_time("start_time", fmt_ctx->start_time, &AV_TIME_BASE_Q); print_time("duration", fmt_ctx->duration, &AV_TIME_BASE_Q); - if (size >= 0) print_val ("size", size, unit_byte_str); + if (size >= 0) print_val ("size", size, avtext_unit_byte_str); else print_str_opt("size", "N/A"); if (fmt_ctx->bit_rate > 0) print_val ("bit_rate", fmt_ctx->bit_rate, unit_bit_per_second_str); else print_str_opt("bit_rate", "N/A"); -- 2.49.1 >>From da5e8fc5b9dc642d5d0a3a2e0455b11c7c897a41 Mon Sep 17 00:00:00 2001 From: Nicolas Gaullier Date: Tue, 2 Sep 2025 17:40:42 +0200 Subject: [PATCH 3/4] fftools/textformat: add support for decibel formatting Signed-off-by: Nicolas Gaullier --- fftools/textformat/avtextformat.c | 23 +++++++++++++++++++---- fftools/textformat/avtextformat.h | 3 +++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c index b6a0577193..01413492ed 100644 --- a/fftools/textformat/avtextformat.c +++ b/fftools/textformat/avtextformat.c @@ -244,6 +244,7 @@ fail: /* Temporary definitions during refactoring */ const char avtext_unit_second_str[] = "s"; const char avtext_unit_byte_str[] = "byte"; +const char avtext_unit_decibel_str[] = "dB"; void avtext_print_section_header(AVTextFormatContext *tctx, const void *data, int section_id) @@ -375,15 +376,21 @@ struct unit_value { const char *unit; }; +static const char float_fmt_default[] = "%f"; +static const char float_fmt_full[] = "%f"; +static const char float_fmt_singledigit[] = "%.1f"; static char *value_string(const AVTextFormatContext *tctx, char *buf, int buf_size, struct unit_value uv) { double vald; int64_t vali = 0; - int show_float = 0; + const char *float_fmt = float_fmt_default; if (uv.unit == avtext_unit_second_str) { vald = uv.val.d; - show_float = 1; + float_fmt = float_fmt_full; + } else if (uv.unit == avtext_unit_decibel_str) { + vald = 20 * log10(uv.val.d); + float_fmt = float_fmt_singledigit; } else { vald = (double)uv.val.i; vali = uv.val.i; @@ -418,8 +425,8 @@ static char *value_string(const AVTextFormatContext *tctx, char *buf, int buf_si vali = (int64_t)vald; } - if (show_float || (tctx->use_value_prefix && vald != (int64_t)vald)) - snprintf(buf, buf_size, "%f", vald); + if (float_fmt != float_fmt_default || (tctx->use_value_prefix && vald != (int64_t)vald)) + snprintf(buf, buf_size, float_fmt, vald); else snprintf(buf, buf_size, "%"PRId64, vali); @@ -440,6 +447,14 @@ void avtext_print_unit_integer(AVTextFormatContext *tctx, const char *key, int64 avtext_print_string(tctx, key, value_string(tctx, val_str, sizeof(val_str), uv), 0); } +void avtext_print_unit_double(AVTextFormatContext *tctx, const char *key, double val, const char *unit) +{ + char val_str[128]; + struct unit_value uv; + uv.val.d = val; + uv.unit = unit; + avtext_print_string(tctx, key, value_string(tctx, val_str, sizeof(val_str), uv), 0); +} int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *val, int flags) { diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h index d6a5caed61..375cc1703c 100644 --- a/fftools/textformat/avtextformat.h +++ b/fftools/textformat/avtextformat.h @@ -157,6 +157,7 @@ typedef struct AVTextFormatOptions { extern const char avtext_unit_second_str[]; extern const char avtext_unit_byte_str[]; +extern const char avtext_unit_decibel_str[]; int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args, const AVTextFormatSection *sections, int nb_sections, AVTextFormatOptions options, char *show_data_hash); @@ -174,6 +175,8 @@ int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char * void avtext_print_unit_integer(AVTextFormatContext *tctx, const char *key, int64_t val, const char *unit); +void avtext_print_unit_double(AVTextFormatContext *tctx, const char *key, double val, const char *unit); + void avtext_print_rational(AVTextFormatContext *tctx, const char *key, AVRational q, char sep); void avtext_print_time(AVTextFormatContext *tctx, const char *key, int64_t ts, const AVRational *time_base, int is_duration); -- 2.49.1 >>From 1441e454b14b36645c1699dec830ab1c6dd64800 Mon Sep 17 00:00:00 2001 From: Nicolas Gaullier Date: Tue, 2 Sep 2025 17:27:46 +0200 Subject: [PATCH 4/4] fftools/ffprobe: add support for downmix_info frame side data Signed-off-by: Nicolas Gaullier --- fftools/ffprobe.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 67ab21c140..43996b2d5a 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -39,6 +39,7 @@ #include "libavutil/avutil.h" #include "libavutil/bprint.h" #include "libavutil/channel_layout.h" +#include "libavutil/downmix_info.h" #include "libavutil/display.h" #include "libavutil/film_grain_params.h" #include "libavutil/hdr_dynamic_metadata.h" @@ -434,6 +435,7 @@ static void log_callback(void *ptr, int level, const char *fmt, va_list vl) #define print_duration_time(k, v, tb) avtext_print_time(tfc, k, v, tb, 1) #define print_duration_ts(k, v) avtext_print_ts(tfc, k, v, 1) #define print_val(k, v, u) avtext_print_unit_integer(tfc, k, v, u) +#define print_val_double(k, v, u) avtext_print_unit_double(tfc, k, v, u) #define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \ { \ @@ -461,6 +463,34 @@ static inline int show_tags(AVTextFormatContext *tfc, AVDictionary *tags, int se return ret; } +static void print_downmix_info(AVTextFormatContext *tfc, + const AVDownmixInfo *downmix_info) +{ + AVBPrint pbuf; + + switch (downmix_info->preferred_downmix_type) { + case AV_DOWNMIX_TYPE_LORO: + print_str("preferred_downmix_type", "loro"); + break; + case AV_DOWNMIX_TYPE_LTRT: + print_str("preferred_downmix_type", "ltrt"); + break; + case AV_DOWNMIX_TYPE_DPLII: + print_str("preferred_downmix_type", "dplII"); + break; + default: + print_str("preferred_downmix_type", "unknown"); + break; + } + av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); + print_val_double("center_mix_level", downmix_info->center_mix_level, avtext_unit_decibel_str); + print_val_double("center_mix_level_ltrt", downmix_info->center_mix_level_ltrt, avtext_unit_decibel_str); + print_val_double("surround_mix_level", downmix_info->surround_mix_level, avtext_unit_decibel_str); + print_val_double("surround_mix_level_ltrt", downmix_info->surround_mix_level_ltrt, avtext_unit_decibel_str); + print_val_double("lfe_mix_level", downmix_info->lfe_mix_level, avtext_unit_decibel_str); + av_bprint_finalize(&pbuf, NULL); +} + static void print_displaymatrix(AVTextFormatContext *tfc, const int32_t matrix[9]) { double rotation = av_display_rotation_get(matrix); @@ -1298,7 +1328,9 @@ static void print_frame_side_data(AVTextFormatContext *tfc, avtext_print_section_header(tfc, sd, SECTION_ID_FRAME_SIDE_DATA); name = av_frame_side_data_name(sd->type); print_str("side_data_type", name ? name : "unknown"); - if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) { + if (sd->type == AV_FRAME_DATA_DOWNMIX_INFO && sd->size > 0) { + print_downmix_info(tfc, (AVDownmixInfo *)sd->data); + } else if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) { print_displaymatrix(tfc, (const int32_t*)sd->data); } else if (sd->type == AV_FRAME_DATA_AFD && sd->size > 0) { print_int("active_format", *sd->data); -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org