]> git.sesse.net Git - ffmpeg/blob - libavfilter/formats.h
lavfi: remove avfilter_null_* from public API on next bump.
[ffmpeg] / libavfilter / formats.h
1 /*
2  * This file is part of Libav.
3  *
4  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18
19 #ifndef AVFILTER_FORMATS_H
20 #define AVFILTER_FORMATS_H
21
22 #include "avfilter.h"
23
24 typedef struct AVFilterChannelLayouts {
25     uint64_t *channel_layouts;  ///< list of channel layouts
26     int    nb_channel_layouts;  ///< number of channel layouts
27
28     unsigned refcount;          ///< number of references to this list
29     struct AVFilterChannelLayouts ***refs; ///< references to this list
30 } AVFilterChannelLayouts;
31
32 /**
33  * Return a channel layouts/samplerates list which contains the intersection of
34  * the layouts/samplerates of a and b. Also, all the references of a, all the
35  * references of b, and a and b themselves will be deallocated.
36  *
37  * If a and b do not share any common elements, neither is modified, and NULL
38  * is returned.
39  */
40 AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
41                                                  AVFilterChannelLayouts *b);
42 AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
43                                       AVFilterFormats *b);
44
45 /**
46  * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct --
47  * representing any channel layout/sample rate.
48  */
49 AVFilterChannelLayouts *ff_all_channel_layouts(void);
50 AVFilterFormats *ff_all_samplerates(void);
51
52 /**
53  * A helper for query_formats() which sets all links to the same list of channel
54  * layouts/sample rates. If there are no links hooked to this filter, the list
55  * is freed.
56  */
57 void ff_set_common_channel_layouts(AVFilterContext *ctx,
58                                    AVFilterChannelLayouts *layouts);
59 void ff_set_common_samplerates(AVFilterContext *ctx,
60                                AVFilterFormats *samplerates);
61
62 int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
63
64 /**
65  * Add *ref as a new reference to f.
66  */
67 void ff_channel_layouts_ref(AVFilterChannelLayouts *f,
68                             AVFilterChannelLayouts **ref);
69
70 /**
71  * Remove a reference to a channel layouts list.
72  */
73 void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
74
75 void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
76                                   AVFilterChannelLayouts **newref);
77
78 int ff_default_query_formats(AVFilterContext *ctx);
79
80 #endif // AVFILTER_FORMATS_H