../../../ffmpeg/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
17 / 17
100.0%
Branches:
8 / 8
100.0%
Functions:
1 / 1
100.0%

libavcodec/tests/hw_base_encode.c
Line Branch Exec Source
1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include <stdio.h>
20
21 #include "libavcodec/hw_base_encode.c"
22
23 1 int main(void)
24 {
25 1 AVCodecContext avctx = { 0 };
26
27
2/2
✓ Branch 13 → 3 taken 4 times.
✓ Branch 13 → 14 taken 1 time.
5 for (int delay = 0; delay <= 3; delay++) {
28
2/2
✓ Branch 11 → 4 taken 20 times.
✓ Branch 11 → 12 taken 4 times.
24 for (int count = 0; count <= 4; count++) {
29 20 FFHWBaseEncodePicture pic = { 0 };
30 20 FFHWBaseEncodeContext ctx = { 0 };
31 int ret;
32
33 20 ctx.decode_delay = delay;
34 20 ctx.input_order = count;
35 20 ctx.first_pts = 100;
36
2/2
✓ Branch 4 → 5 taken 16 times.
✓ Branch 4 → 6 taken 4 times.
20 if (count) {
37 16 pic.pts = ctx.first_pts + 10 * (count - 1);
38 16 ctx.pic_end = &pic;
39 }
40
2/2
✓ Branch 6 → 7 taken 10 times.
✓ Branch 6 → 8 taken 10 times.
20 if (count > delay)
41 10 ctx.dts_pts_diff = 10 * delay;
42
43 20 ret = hw_base_encode_send_frame(&avctx, &ctx, NULL);
44 20 printf("delay=%d frames=%d return=%d eof=%d pts_diff=%"PRId64"\n",
45 delay, count, ret, ctx.end_of_stream, ctx.dts_pts_diff);
46 }
47 }
48 1 return 0;
49 }
50