FFmpeg
Loading...
Searching...
No Matches
libavcodec
bsf
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
"
24
#include "
libavcodec/bsf_internal.h
"
25
26
#include "
libavutil/adler32.h
"
27
#include "
libavutil/log.h
"
28
#include "
libavutil/timestamp.h
"
29
30
typedef
struct
ShowinfoContext
{
31
uint64_t
nb_packets
;
32
}
ShowinfoContext
;
33
34
static
int
showinfo_filter
(
AVBSFContext
*
ctx
,
AVPacket
*
pkt
)
35
{
36
ShowinfoContext
*priv =
ctx
->priv_data;
37
uint32_t crc;
38
int
ret;
39
40
ret =
ff_bsf_get_packet_ref
(
ctx
,
pkt
);
41
if
(ret < 0)
42
return
ret;
43
44
crc =
av_adler32_update
(0,
pkt
->data,
pkt
->size);
45
av_log
(
ctx
,
AV_LOG_INFO
,
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
63
const
FFBitStreamFilter
ff_showinfo_bsf
= {
64
.p.name =
"showinfo"
,
65
.filter =
showinfo_filter
,
66
.priv_data_size =
sizeof
(
ShowinfoContext
),
67
};
adler32.h
Public header for Adler-32 hash function implementation.
ff_showinfo_bsf
const FFBitStreamFilter ff_showinfo_bsf
Definition
showinfo.c:63
ff_bsf_get_packet_ref
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
Definition
bsf.c:254
bsf.h
bsf_internal.h
pkt
static AVPacket * pkt
Definition
demux_decode.c:55
av_adler32_update
AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, size_t len)
Calculate the Adler32 checksum of a buffer.
Definition
adler32.c:44
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition
log.h:221
log.h
showinfo_filter
static int showinfo_filter(AVBSFContext *ctx, AVPacket *pkt)
Definition
showinfo.c:34
AVBSFContext
The bitstream filter state.
Definition
bsf.h:68
AVPacket
This structure stores compressed data.
Definition
packet.h:580
FFBitStreamFilter
Definition
bsf_internal.h:29
ShowinfoContext
Definition
showinfo.c:30
ShowinfoContext::nb_packets
uint64_t nb_packets
Definition
showinfo.c:31
av_log
#define av_log(a,...)
Definition
tableprint_vlc.h:27
ctx
static AVFormatContext * ctx
Definition
movenc.c:49
timestamp.h
timestamp utils, mostly useful for debugging/logging purposes
av_ts2str
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition
timestamp.h:54
av_ts2timestr
#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
Generated on Sun Aug 16 2026 20:20:45 for FFmpeg by
1.13.2