[FFmpeg-devel] [PATCH] lavc/bsf: add a showinfo filter
Alexander Strasser
eclipse7 at gmx.net
Tue Feb 13 00:35:15 EET 2024
On 2024-01-29 19:42 +0100, Anton Khirnov wrote:
[...]
> --- a/doc/bitstream_filters.texi
> +++ b/doc/bitstream_filters.texi
> @@ -887,6 +887,10 @@ For example, to set PTS equal to DTS (not recommended if B-frames are involved):
> ffmpeg -i INPUT -c:a copy -bsf:a setts=pts=DTS out.mkv
> @end example
>
> + at section showinfo
> +Log basic packet information. Mainly useful for testing, debugging,
> +and development.
> +
Maybe it's a good idea to state something about the stability of
the output format. I assume it's to be treated like other logging
and is not expected to stay stable. Not sure how much it helps to
state it clearly, but it can't hurt IMHO.
[...]
> --- /dev/null
> +++ b/libavcodec/bsf/showinfo.c
[...]
> +static int showinfo_filter(AVBSFContext *ctx, AVPacket *pkt)
> +{
> + ShowinfoContext *priv = ctx->priv_data;
> +
> + while (1) {
> + int ret;
> +
> + ret = ff_bsf_get_packet_ref(ctx, pkt);
> + if (ret < 0)
> + return ret;
> +
> + av_log(ctx, AV_LOG_INFO,
> + "n:%7"PRIu64" "
> + "size:%7d "
> + "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));
> +
> + priv->nb_packets++;
> +
> + return 0;
> + }
> +}
It's late here and I surely must be missing something. Anyway,
why do we use a while loop here?
Best regards,
Alexander
[...]
More information about the ffmpeg-devel
mailing list