diff mbox series

[FFmpeg-devel,1/2] avcodec/bsf/showinfo: print packet side data and flags

Message ID 20240712003307.64005-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/bsf/showinfo: print packet side data and flags | expand

Checks

Context Check Description
andriy/make_x86 fail Make failed

Commit Message

James Almer July 12, 2024, 12:33 a.m. UTC
Same as the framecrc muxer. This will allow callers to analize changes in these
values between filters within a list.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/bsf/showinfo.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Anton Khirnov July 13, 2024, 1:46 p.m. UTC | #1
Quoting James Almer (2024-07-12 02:33:06)
> Same as the framecrc muxer.

IOW obfuscated and user-hostile.

Please don't.
James Almer July 13, 2024, 1:49 p.m. UTC | #2
On 7/13/2024 10:46 AM, Anton Khirnov wrote:
> Quoting James Almer (2024-07-12 02:33:06)
>> Same as the framecrc muxer.
> 
> IOW obfuscated and user-hostile.
> 
> Please don't.

You mean to not implement this in any form, or try to make it more user 
friendly? I could remove the flags (which is admittedly obfuscated), and 
only leave the crc which is useful to see in the middle of a bitstream 
filter list.
Anton Khirnov July 13, 2024, 2:04 p.m. UTC | #3
Quoting James Almer (2024-07-13 15:49:48)
> On 7/13/2024 10:46 AM, Anton Khirnov wrote:
> > Quoting James Almer (2024-07-12 02:33:06)
> >> Same as the framecrc muxer.
> > 
> > IOW obfuscated and user-hostile.
> > 
> > Please don't.
> 
> You mean to not implement this in any form, or try to make it more user 
> friendly?

The latter, if you want to spend effort on it. It is potentially useful
information, but in this form it's incomprehensible without reading the
code.
diff mbox series

Patch

diff --git a/libavcodec/bsf/showinfo.c b/libavcodec/bsf/showinfo.c
index 4e31e0b5cb..0899263545 100644
--- a/libavcodec/bsf/showinfo.c
+++ b/libavcodec/bsf/showinfo.c
@@ -23,6 +23,7 @@ 
 #include "bsf.h"
 #include "bsf_internal.h"
 
+#include "libavutil/internal.h"
 #include "libavutil/log.h"
 #include "libavutil/timestamp.h"
 
@@ -45,11 +46,18 @@  static int showinfo_filter(AVBSFContext *ctx, AVPacket *pkt)
            "pts:%s pt:%s "
            "dts:%s dt:%s "
            "ds:%"PRId64" d:%s "
-           "\n",
            priv->nb_packets, pkt->size,
            av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ctx->time_base_in),
            av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ctx->time_base_in),
            pkt->duration, av_ts2timestr(pkt->duration, &ctx->time_base_in));
+    if (pkt->flags != AV_PKT_FLAG_KEY)
+        av_log(ctx, AV_LOG_INFO, ", F=0x%0X", pkt->flags);
+    if (pkt->side_data_elems) {
+        av_log(ctx, AV_LOG_INFO, ", S=%d", pkt->side_data_elems);
+        for (int i = 0; i < pkt->side_data_elems; i++)
+            av_log(ctx, AV_LOG_INFO, ", %8"SIZE_SPECIFIER, pkt->side_data[i].size);
+    }
+    av_log(ctx, AV_LOG_INFO, "\n");
 
     priv->nb_packets++;