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
26
27 #include "libavutil/ffversion.h"
29
30 #define E AV_OPT_FLAG_ENCODING_PARAM
31 #define D AV_OPT_FLAG_DECODING_PARAM
32 #define A AV_OPT_FLAG_AUDIO_PARAM
33 #define V AV_OPT_FLAG_VIDEO_PARAM
34 #define OFFSET(x) offsetof(AVDeviceCapabilitiesQuery, x)
35
42 {.i64 = -1}, -1, INT_MAX,
E|
D|
A },
44 {.i64 = -1}, -1, INT_MAX,
E|
D|
A },
46 {.i64 = -1}, -1, INT_MAX,
E|
D|
A },
50 {.str =
NULL}, -1, INT_MAX,
E|
D|
V },
52 {.str =
NULL}, -1, INT_MAX,
E|
D|
V },
54 {.dbl = -1}, -1, INT_MAX,
E|
D|
V },
56 };
57
58 #undef E
59 #undef D
60 #undef A
61 #undef V
62 #undef OFFSET
63
65 {
68 }
69
71 {
72 return FFMPEG_CONFIGURATION;
73 }
74
76 {
77 #define LICENSE_PREFIX "libavdevice license: "
79 }
80
83 {
86 do {
87 if (output) {
89 break;
91 } else {
93 break;
95 }
96 if (!pc)
97 continue;
99 } while (category != c1 && category != c2);
100 return prev;
101 }
102
104 {
107 }
108
110 {
113 }
114
116 {
119 }
120
122 {
125 }
126
128 void *
data,
size_t data_size)
129 {
133 }
134
136 void *
data,
size_t data_size)
137 {
141 }
142
145 {
146 int ret;
153 if (!(*caps))
155 (*caps)->device_context =
s;
161 } else {
164 }
166 return 0;
169 return ret;
170 }
171
173 {
174 if (!s || !caps || !(*caps))
175 return;
180 } else {
183 }
185 }
186
188 {
189 int ret;
197 }
199 if (!(*device_list))
201 /* no default device by default */
202 (*device_list)->default_device = -1;
205 else
207 if (ret < 0)
209 return ret;
210 }
211
214 {
216 int ret;
217
225 return ret;
226 }
227
230 {
232 int ret;
233
235 return ret;
237 }
238
241 {
243 int ret;
244
246 return ret;
248 }
249
251 {
254 int i;
255
257 list = *device_list;
258 if (!list)
259 return;
260
263 if (dev) {
267 }
268 }
271 }
AVOutputFormat * av_output_audio_device_next(AVOutputFormat *d)
Audio output devices iterator.
Structure describes basic parameters of the device.
int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type, void *data, size_t data_size)
Send control message from device to application.
ptrdiff_t const GLvoid * data
char * device_description
human friendly name
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
char * device_name
device name, format depends on device
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
av_warn_unused_result int ff_alloc_input_device_context(struct AVFormatContext **avctx, struct AVInputFormat *iformat, const char *format)
static void * device_next(void *prev, int output, AVClassCategory c1, AVClassCategory c2)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVDevToAppMessageType
Message types used by avdevice_dev_to_app_control_message().
AVInputFormat * av_input_video_device_next(AVInputFormat *d)
Video input devices iterator.
const char * avdevice_license(void)
Return the libavdevice license.
const OptionDef options[]
struct AVOutputFormat * oformat
The output container format.
Main libavdevice API header.
void avdevice_free_list_devices(AVDeviceInfoList **device_list)
Convenient function to free result of avdevice_list_devices().
const char av_device_ffversion[]
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
simple assert() macros that are a bit more flexible than ISO C assert().
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
int avdevice_list_input_sources(AVInputFormat *device, const char *device_name, AVDictionary *device_options, AVDeviceInfoList **device_list)
List devices.
#define LIBAVDEVICE_VERSION_INT
AVDeviceInfo ** devices
list of autodetected devices
const AVOption av_device_capabilities[]
AVOption table used by devices to implement device capabilities API.
AVAppToDevMessageType
Message types used by avdevice_app_to_dev_control_message().
const char * avdevice_configuration(void)
Return the libavdevice build-time configuration.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
int avdevice_list_output_sinks(AVOutputFormat *device, const char *device_name, AVDictionary *device_options, AVDeviceInfoList **device_list)
int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type, void *data, size_t data_size)
Send control message from application to device.
AVOutputFormat * av_output_video_device_next(AVOutputFormat *d)
Video output devices iterator.
AVOutputFormat * av_oformat_next(const AVOutputFormat *f)
If f is NULL, returns the first registered output format, if f is non-NULL, returns the next register...
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
unsigned avdevice_version(void)
Return the LIBAVDEVICE_VERSION_INT constant.
Libavcodec external API header.
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
Describe the class of an AVClass context structure.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
offset must point to two consecutive integers
#define LIBAVDEVICE_VERSION_MICRO
AVInputFormat * av_input_audio_device_next(AVInputFormat *d)
Audio input devices iterator.
struct AVInputFormat * iformat
The input container format.
int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, AVDictionary **device_options)
Initialize capabilities probing API based on AVOption API.
void * priv_data
Format private data.
void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s)
Free resources created by avdevice_capabilities_create()
static int list_devices_for_context(AVFormatContext *s, AVDictionary *options, AVDeviceInfoList **device_list)
int nb_devices
number of autodetected devices
Following API allows user to probe device capabilities (supported codecs, pixel formats, sample formats, resolutions, channel counts, etc).
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
AVInputFormat * av_iformat_next(const AVInputFormat *f)
If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registere...
int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
List devices.