]> git.sesse.net Git - ffmpeg/blob - libavfilter/formats.h
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavfilter / formats.h
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 #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 AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
53
54
55 /**
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
58  * is freed.
59  */
60 void ff_set_common_channel_layouts(AVFilterContext *ctx,
61                                    AVFilterChannelLayouts *layouts);
62 void ff_set_common_samplerates(AVFilterContext *ctx,
63                                AVFilterFormats *samplerates);
64
65 int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
66
67 /**
68  * Add *ref as a new reference to f.
69  */
70 void ff_channel_layouts_ref(AVFilterChannelLayouts *f,
71                             AVFilterChannelLayouts **ref);
72
73 /**
74  * Remove a reference to a channel layouts list.
75  */
76 void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
77
78 void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
79                                   AVFilterChannelLayouts **newref);
80
81 int ff_default_query_formats(AVFilterContext *ctx);
82
83 #endif // AVFILTER_FORMATS_H