FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/bsf/showinfo.c
Date: 2024-02-29 09:57:37
Exec Total Coverage
Lines: 0 11 0.0%
Functions: 0 1 0.0%
Branches: 0 2 0.0%

Line Branch Exec Source
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 "bsf.h"
24 #include "bsf_internal.h"
25
26 #include "libavutil/log.h"
27 #include "libavutil/timestamp.h"
28
29 typedef struct ShowinfoContext {
30 uint64_t nb_packets;
31 } ShowinfoContext;
32
33 static int showinfo_filter(AVBSFContext *ctx, AVPacket *pkt)
34 {
35 ShowinfoContext *priv = ctx->priv_data;
36 int ret;
37
38 ret = ff_bsf_get_packet_ref(ctx, pkt);
39 if (ret < 0)
40 return ret;
41
42 av_log(ctx, AV_LOG_INFO,
43 "n:%7"PRIu64" "
44 "size:%7d "
45 "pts:%s pt:%s "
46 "dts:%s dt:%s "
47 "ds:%"PRId64" d:%s "
48 "\n",
49 priv->nb_packets, pkt->size,
50 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ctx->time_base_in),
51 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ctx->time_base_in),
52 pkt->duration, av_ts2timestr(pkt->duration, &ctx->time_base_in));
53
54 priv->nb_packets++;
55
56 return 0;
57 }
58
59 const FFBitStreamFilter ff_showinfo_bsf = {
60 .p.name = "showinfo",
61 .filter = showinfo_filter,
62 .priv_data_size = sizeof(ShowinfoContext),
63 };
64