FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavutil/tests/iamf.c
Date: 2026-10-29 07:45:57
Exec Total Coverage
Lines: 29 30 96.7%
Functions: 3 3 100.0%
Branches: 4 6 66.7%

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 "libavutil/iamf.h"
22 #include "libavutil/log.h"
23 #include "libavutil/opt.h"
24
25 18 static void print_class_tree(const AVClass *class, int depth)
26 {
27 const AVClass *child;
28 18 void *iter = NULL;
29
30 18 printf("%*s%s\n", depth * 2, "", class->class_name);
31
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 if (depth >= 8)
32 ✗ return;
33
2/2
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 18 times.
33 while ((child = av_opt_child_class_iterate(class, &iter)))
34 15 print_class_tree(child, depth + 1);
35 }
36
37 9 static void find_option(const AVClass *class, const char *name)
38 {
39 9 const AVOption *o = av_opt_find2(&class, name, NULL, 0,
40 AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ,
41 NULL);
42
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 printf("%s: %s %s\n", class->class_name, name, o ? "found" : "not found");
43 9 }
44
45 1 int main(void)
46 {
47 1 const AVClass *audio_element = av_iamf_audio_element_get_class();
48 1 const AVClass *mix_presentation = av_iamf_mix_presentation_get_class();
49 1 const AVClass *param_definition = av_iamf_param_definition_get_class();
50
51 1 printf("Testing av_opt_child_class_iterate()\n");
52 1 print_class_tree(audio_element, 0);
53 1 print_class_tree(mix_presentation, 0);
54 1 print_class_tree(param_definition, 0);
55
56 1 printf("\nTesting av_opt_find2() with AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ\n");
57 1 find_option(audio_element, "default_w");
58 1 find_option(audio_element, "ch_layout");
59 1 find_option(mix_presentation, "annotations");
60 1 find_option(mix_presentation, "default_mix_gain");
61 1 find_option(mix_presentation, "headphones_rendering_mode");
62 1 find_option(mix_presentation, "sound_system");
63 1 find_option(mix_presentation, "parameter_rate");
64 1 find_option(param_definition, "parameter_rate");
65 1 find_option(param_definition, "subblock_duration");
66
67 1 return 0;
68 }
69