FFmpeg
Loading...
Searching...
No Matches
showinfo.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Anton Khirnov <anton@khirnov.net>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <inttypes.h>
22
23#include "libavcodec/bsf.h"
25
26#include "libavutil/adler32.h"
27#include "libavutil/log.h"
28#include "libavutil/timestamp.h"
29
30typedef struct ShowinfoContext {
31 uint64_t nb_packets;
33
35{
36 ShowinfoContext *priv = ctx->priv_data;
37 uint32_t crc;
38 int ret;
39
41 if (ret < 0)
42 return ret;
43
44 crc = av_adler32_update(0, pkt->data, pkt->size);
46 "n:%7"PRIu64" "
47 "size:%7d "
48 "pts:%s pt:%s "
49 "dts:%s dt:%s "
50 "ds:%"PRId64" d:%s "
51 "adler32:0x%08"PRIx32
52 "\n",
53 priv->nb_packets, pkt->size,
54 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ctx->time_base_in),
55 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ctx->time_base_in),
56 pkt->duration, av_ts2timestr(pkt->duration, &ctx->time_base_in), crc);
57
58 priv->nb_packets++;
59
60 return 0;
61}
62
64 .p.name = "showinfo",
65 .filter = showinfo_filter,
66 .priv_data_size = sizeof(ShowinfoContext),
67};
Public header for Adler-32 hash function implementation.
const FFBitStreamFilter ff_showinfo_bsf
Definition showinfo.c:63
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
Definition bsf.c:254
static AVPacket * pkt
AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, size_t len)
Calculate the Adler32 checksum of a buffer.
Definition adler32.c:44
#define AV_LOG_INFO
Standard information.
Definition log.h:221
static int showinfo_filter(AVBSFContext *ctx, AVPacket *pkt)
Definition showinfo.c:34
The bitstream filter state.
Definition bsf.h:68
This structure stores compressed data.
Definition packet.h:580
uint64_t nb_packets
Definition showinfo.c:31
#define av_log(a,...)
static AVFormatContext * ctx
Definition movenc.c:49
timestamp utils, mostly useful for debugging/logging purposes
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition timestamp.h:54
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition timestamp.h:83