FFmpeg
Loading...
Searching...
No Matches
iamf.c
Go to the documentation of this file.
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
25static void print_class_tree(const AVClass *class, int depth)
26{
27 const AVClass *child;
28 void *iter = NULL;
29
30 printf("%*s%s\n", depth * 2, "", class->class_name);
31 if (depth >= 8)
32 return;
33 while ((child = av_opt_child_class_iterate(class, &iter)))
34 print_class_tree(child, depth + 1);
35}
36
37static void find_option(const AVClass *class, const char *name)
38{
39 const AVOption *o = av_opt_find2(&class, name, NULL, 0,
41 NULL);
42 printf("%s: %s %s\n", class->class_name, name, o ? "found" : "not found");
43}
44
45int main(void)
46{
47 const AVClass *audio_element = av_iamf_audio_element_get_class();
48 const AVClass *mix_presentation = av_iamf_mix_presentation_get_class();
50
51 printf("Testing av_opt_child_class_iterate()\n");
52 print_class_tree(audio_element, 0);
53 print_class_tree(mix_presentation, 0);
55
56 printf("\nTesting av_opt_find2() with AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ\n");
57 find_option(audio_element, "default_w");
58 find_option(audio_element, "ch_layout");
59 find_option(mix_presentation, "annotations");
60 find_option(mix_presentation, "default_mix_gain");
61 find_option(mix_presentation, "headphones_rendering_mode");
62 find_option(mix_presentation, "sound_system");
63 find_option(mix_presentation, "parameter_rate");
64 find_option(param_definition, "parameter_rate");
65 find_option(param_definition, "subblock_duration");
66
67 return 0;
68}
#define class
Definition math.h:25
#define NULL
Definition coverity.c:32
__device__ int printf(const char *,...)
const AVClass * av_iamf_audio_element_get_class(void)
Definition iamf.c:319
const AVClass * av_iamf_mix_presentation_get_class(void)
Definition iamf.c:517
const AVClass * av_iamf_param_definition_get_class(void)
Definition iamf.c:154
const AVClass * av_opt_child_class_iterate(const AVClass *parent, void **iter)
Iterate over potential AVOptions-enabled children of parent.
Definition opt.c:2134
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition opt.h:604
const AVOption * av_opt_find2(void *obj, const char *name, const char *unit, int opt_flags, int search_flags, void **target_obj)
Look for an option in an object.
Definition opt.c:2081
#define AV_OPT_SEARCH_FAKE_OBJ
The obj passed to av_opt_find() or av_opt_set() is fake – only a double pointer to AVClass instead of...
Definition opt.h:612
static int param_definition(const IAMFContext *iamf, const IAMFParamDefinition *param_def, AVIOContext *dyn_bc, void *log_ctx)
Immersive Audio Model and Formats API header.
static void print_class_tree(const AVClass *class, int depth)
Definition iamf.c:25
static void find_option(const AVClass *class, const char *name)
Definition iamf.c:37
int main(void)
Definition iamf.c:45
AVOptions.
const char * name
Definition qsvenc.c:142
Describe the class of an AVClass context structure.
Definition log.h:76
AVOption.
Definition opt.h:428