FFmpeg
avdevice.h
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 #ifndef AVDEVICE_AVDEVICE_H
20 #define AVDEVICE_AVDEVICE_H
21 
22 #include "version.h"
23 
48 #include "libavutil/log.h"
49 #include "libavutil/opt.h"
50 #include "libavutil/dict.h"
51 #include "libavformat/avformat.h"
52 
56 unsigned avdevice_version(void);
57 
61 const char *avdevice_configuration(void);
62 
66 const char *avdevice_license(void);
67 
71 void avdevice_register_all(void);
72 
81 
90 
99 
108 
109 typedef struct AVDeviceRect {
110  int x;
111  int y;
112  int width;
113  int height;
114 } AVDeviceRect;
115 
123  AV_APP_TO_DEV_NONE = MKBETAG('N','O','N','E'),
124 
134  AV_APP_TO_DEV_WINDOW_SIZE = MKBETAG('G','E','O','M'),
135 
144  AV_APP_TO_DEV_WINDOW_REPAINT = MKBETAG('R','E','P','A'),
145 
155  AV_APP_TO_DEV_PAUSE = MKBETAG('P', 'A', 'U', ' '),
156  AV_APP_TO_DEV_PLAY = MKBETAG('P', 'L', 'A', 'Y'),
157  AV_APP_TO_DEV_TOGGLE_PAUSE = MKBETAG('P', 'A', 'U', 'T'),
158 
168  AV_APP_TO_DEV_SET_VOLUME = MKBETAG('S', 'V', 'O', 'L'),
169 
179  AV_APP_TO_DEV_MUTE = MKBETAG(' ', 'M', 'U', 'T'),
180  AV_APP_TO_DEV_UNMUTE = MKBETAG('U', 'M', 'U', 'T'),
181  AV_APP_TO_DEV_TOGGLE_MUTE = MKBETAG('T', 'M', 'U', 'T'),
182 
191  AV_APP_TO_DEV_GET_VOLUME = MKBETAG('G', 'V', 'O', 'L'),
192  AV_APP_TO_DEV_GET_MUTE = MKBETAG('G', 'M', 'U', 'T'),
193 };
194 
202  AV_DEV_TO_APP_NONE = MKBETAG('N','O','N','E'),
203 
218  AV_DEV_TO_APP_CREATE_WINDOW_BUFFER = MKBETAG('B','C','R','E'),
219 
229  AV_DEV_TO_APP_PREPARE_WINDOW_BUFFER = MKBETAG('B','P','R','E'),
230 
240  AV_DEV_TO_APP_DISPLAY_WINDOW_BUFFER = MKBETAG('B','D','I','S'),
241 
251  AV_DEV_TO_APP_DESTROY_WINDOW_BUFFER = MKBETAG('B','D','E','S'),
252 
260  AV_DEV_TO_APP_BUFFER_OVERFLOW = MKBETAG('B','O','F','L'),
261  AV_DEV_TO_APP_BUFFER_UNDERFLOW = MKBETAG('B','U','F','L'),
262 
274  AV_DEV_TO_APP_BUFFER_READABLE = MKBETAG('B','R','D',' '),
275  AV_DEV_TO_APP_BUFFER_WRITABLE = MKBETAG('B','W','R',' '),
276 
284  AV_DEV_TO_APP_MUTE_STATE_CHANGED = MKBETAG('C','M','U','T'),
285 
293  AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED = MKBETAG('C','V','O','L'),
294 };
295 
307  enum AVAppToDevMessageType type,
308  void *data, size_t data_size);
309 
321  enum AVDevToAppMessageType type,
322  void *data, size_t data_size);
323 
401  const AVClass *av_class;
402  AVFormatContext *device_context;
403  enum AVCodecID codec;
404  enum AVSampleFormat sample_format;
405  enum AVPixelFormat pixel_format;
406  int sample_rate;
407  int channels;
408  int64_t channel_layout;
409  int window_width;
410  int window_height;
411  int frame_width;
412  int frame_height;
413  AVRational fps;
415 
419 extern const AVOption av_device_capabilities[];
420 
439  AVDictionary **device_options);
440 
448 
452 typedef struct AVDeviceInfo {
453  char *device_name;
455 } AVDeviceInfo;
456 
460 typedef struct AVDeviceInfoList {
465 
479 int avdevice_list_devices(struct AVFormatContext *s, AVDeviceInfoList **device_list);
480 
486 void avdevice_free_list_devices(AVDeviceInfoList **device_list);
487 
505 int avdevice_list_input_sources(struct AVInputFormat *device, const char *device_name,
506  AVDictionary *device_options, AVDeviceInfoList **device_list);
507 int avdevice_list_output_sinks(struct AVOutputFormat *device, const char *device_name,
508  AVDictionary *device_options, AVDeviceInfoList **device_list);
509 
514 #endif /* AVDEVICE_AVDEVICE_H */
Window size change message.
Definition: avdevice.h:134
const char * avdevice_configuration(void)
Return the libavdevice build-time configuration.
Definition: avdevice.c:70
Repaint request message.
Definition: avdevice.h:144
Structure describes basic parameters of the device.
Definition: avdevice.h:452
AVOutputFormat * av_output_audio_device_next(AVOutputFormat *d)
Audio output devices iterator.
Definition: avdevice.c:115
Prepare window buffer message.
Definition: avdevice.h:229
int x
x coordinate of top left corner
Definition: avdevice.h:110
Dummy message.
Definition: avdevice.h:202
AVOption.
Definition: opt.h:246
char * device_description
human friendly name
Definition: avdevice.h:454
void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s)
Free resources created by avdevice_capabilities_create()
Definition: avdevice.c:172
char * device_name
device name, format depends on device
Definition: avdevice.h:453
Volume level change message.
Definition: avdevice.h:293
Definition: avdevice.h:109
int avdevice_list_devices(struct AVFormatContext *s, AVDeviceInfoList **device_list)
List devices.
Definition: avdevice.c:187
Definition: avformat.h:642
Buffer fullness status messages.
Definition: avdevice.h:260
Display window buffer message.
Definition: avdevice.h:240
Format I/O context.
Definition: avformat.h:1342
Create window buffer message.
Definition: avdevice.h:218
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.
Definition: avdevice.c:135
Public dictionary API.
int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, AVDictionary **device_options)
Initialize capabilities probing API based on AVOption API.
Definition: avdevice.c:143
AVDevToAppMessageType
Message types used by avdevice_dev_to_app_control_message().
Definition: avdevice.h:198
void avdevice_free_list_devices(AVDeviceInfoList **device_list)
Convenient function to free result of avdevice_list_devices().
Definition: avdevice.c:250
AVOptions.
AVOutputFormat * av_output_video_device_next(AVOutputFormat *d)
Video output devices iterator.
Definition: avdevice.c:121
Get volume/mute messages.
Definition: avdevice.h:191
Definition: dict.c:30
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: avcodec.h:215
Request pause/play.
Definition: avdevice.h:155
struct AVDeviceInfoList AVDeviceInfoList
List of devices.
AVDeviceInfo ** devices
list of autodetected devices
Definition: avdevice.h:461
Volume control message.
Definition: avdevice.h:168
int avdevice_list_input_sources(struct AVInputFormat *device, const char *device_name, AVDictionary *device_options, AVDeviceInfoList **device_list)
List devices.
Definition: avdevice.c:228
Mute control messages.
Definition: avdevice.h:179
struct AVDeviceCapabilitiesQuery AVDeviceCapabilitiesQuery
Following API allows user to probe device capabilities (supported codecs, pixel formats, sample formats, resolutions, channel counts, etc).
struct AVDeviceInfo AVDeviceInfo
Structure describes basic parameters of the device.
const AVOption av_device_capabilities[]
AVOption table used by devices to implement device capabilities API.
Definition: avdevice.c:36
Dummy message.
Definition: avdevice.h:123
Destroy window buffer message.
Definition: avdevice.h:251
AVInputFormat * av_input_video_device_next(AVInputFormat *d)
Video input devices iterator.
Definition: avdevice.c:109
int height
height
Definition: avdevice.h:113
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
Describe the class of an AVClass context structure.
Definition: log.h:67
AVInputFormat * av_input_audio_device_next(AVInputFormat *d)
Audio input devices iterator.
Definition: avdevice.c:103
Rational number (pair of numerator and denominator).
Definition: rational.h:58
const char * avdevice_license(void)
Return the libavdevice license.
Definition: avdevice.c:75
Mute state change message.
Definition: avdevice.h:284
int default_device
index of default device or -1 if no default
Definition: avdevice.h:463
List of devices.
Definition: avdevice.h:460
Libavdevice version macros.
int width
width
Definition: avdevice.h:112
void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
Definition: alldevices.c:67
Main libavformat public API header.
Definition: avformat.h:506
unsigned avdevice_version(void)
Return the LIBAVDEVICE_VERSION_INT constant.
Definition: avdevice.c:64
Buffer readable/writable.
Definition: avdevice.h:274
AVAppToDevMessageType
Message types used by avdevice_app_to_dev_control_message().
Definition: avdevice.h:119
int y
y coordinate of top left corner
Definition: avdevice.h:111
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.
Definition: avdevice.c:127
int nb_devices
number of autodetected devices
Definition: avdevice.h:462
Following API allows user to probe device capabilities (supported codecs, pixel formats, sample formats, resolutions, channel counts, etc).
Definition: avdevice.h:400
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60