2 * This file is part of FFMpeg.
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.
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.
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
19 #ifndef AVFILTER_FORMATS_H
20 #define AVFILTER_FORMATS_H
24 typedef struct AVFilterChannelLayouts {
25 uint64_t *channel_layouts; ///< list of channel layouts
26 int nb_channel_layouts; ///< number of channel layouts
28 unsigned refcount; ///< number of references to this list
29 struct AVFilterChannelLayouts ***refs; ///< references to this list
30 } AVFilterChannelLayouts;
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.
37 * If a and b do not share any common elements, neither is modified, and NULL
40 AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
41 AVFilterChannelLayouts *b);
42 AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
46 * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct --
47 * representing any channel layout/sample rate.
49 AVFilterChannelLayouts *ff_all_channel_layouts(void);
50 AVFilterFormats *ff_all_samplerates(void);
52 AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
56 * A helper for query_formats() which sets all links to the same list of channel
57 * layouts/sample rates. If there are no links hooked to this filter, the list
60 void ff_set_common_channel_layouts(AVFilterContext *ctx,
61 AVFilterChannelLayouts *layouts);
62 void ff_set_common_samplerates(AVFilterContext *ctx,
63 AVFilterFormats *samplerates);
65 int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
68 * Add *ref as a new reference to f.
70 void ff_channel_layouts_ref(AVFilterChannelLayouts *f,
71 AVFilterChannelLayouts **ref);
74 * Remove a reference to a channel layouts list.
76 void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
78 void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
79 AVFilterChannelLayouts **newref);
81 #endif // AVFILTER_FORMATS_H