FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
avdevice.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/samplefmt.h"
#include "libavutil/pixfmt.h"
#include "libavcodec/avcodec.h"
#include "avdevice.h"
#include "config.h"

Go to the source code of this file.

Macros

#define E   AV_OPT_FLAG_ENCODING_PARAM
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define A   AV_OPT_FLAG_AUDIO_PARAM
 
#define V   AV_OPT_FLAG_VIDEO_PARAM
 
#define OFFSET(x)   offsetof(AVDeviceCapabilitiesQuery, x)
 
#define LICENSE_PREFIX   "libavdevice license: "
 

Functions

unsigned avdevice_version (void)
 Return the LIBAVDEVICE_VERSION_INT constant.
 
const char * avdevice_configuration (void)
 Return the libavdevice build-time configuration.
 
const char * avdevice_license (void)
 Return the libavdevice license.
 
static voidav_device_next (void *prev, int output, AVClassCategory c1, AVClassCategory c2)
 
AVInputFormatav_input_audio_device_next (AVInputFormat *d)
 Audio input devices iterator.
 
AVInputFormatav_input_video_device_next (AVInputFormat *d)
 Video input devices iterator.
 
AVOutputFormatav_output_audio_device_next (AVOutputFormat *d)
 Audio output devices iterator.
 
AVOutputFormatav_output_video_device_next (AVOutputFormat *d)
 Video output devices iterator.
 
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.
 
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.
 
int avdevice_capabilities_create (AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, AVDictionary **device_options)
 Initialize capabilities probing API based on AVOption API.
 
void avdevice_capabilities_free (AVDeviceCapabilitiesQuery **caps, AVFormatContext *s)
 Free resources created by avdevice_capabilities_create()
 
int avdevice_list_devices (AVFormatContext *s, AVDeviceInfoList **device_list)
 List devices.
 
void avdevice_free_list_devices (AVDeviceInfoList **device_list)
 Convenient function to free result of avdevice_list_devices().
 

Variables

const AVOption av_device_capabilities []
 AVOption table used by devices to implement device capabilities API.
 

Macro Definition Documentation

Definition at line 26 of file avdevice.c.

Definition at line 27 of file avdevice.c.

#define A   AV_OPT_FLAG_AUDIO_PARAM

Definition at line 28 of file avdevice.c.

#define V   AV_OPT_FLAG_VIDEO_PARAM

Definition at line 29 of file avdevice.c.

#define OFFSET (   x)    offsetof(AVDeviceCapabilitiesQuery, x)

Definition at line 30 of file avdevice.c.

#define LICENSE_PREFIX   "libavdevice license: "

Function Documentation

unsigned avdevice_version ( void  )

Return the LIBAVDEVICE_VERSION_INT constant.

Definition at line 60 of file avdevice.c.

const char* avdevice_configuration ( void  )

Return the libavdevice build-time configuration.

Definition at line 66 of file avdevice.c.

const char* avdevice_license ( void  )

Return the libavdevice license.

Definition at line 71 of file avdevice.c.

static void* av_device_next ( void prev,
int  output,
AVClassCategory  c1,
AVClassCategory  c2 
)
static
AVInputFormat* av_input_audio_device_next ( AVInputFormat d)

Audio input devices iterator.

If d is NULL, returns the first registered input audio/video device, if d is non-NULL, returns the next registered input audio/video device after d or NULL if d is the last one.

Definition at line 99 of file avdevice.c.

AVInputFormat* av_input_video_device_next ( AVInputFormat d)

Video input devices iterator.

If d is NULL, returns the first registered input audio/video device, if d is non-NULL, returns the next registered input audio/video device after d or NULL if d is the last one.

Definition at line 105 of file avdevice.c.

AVOutputFormat* av_output_audio_device_next ( AVOutputFormat d)

Audio output devices iterator.

If d is NULL, returns the first registered output audio/video device, if d is non-NULL, returns the next registered output audio/video device after d or NULL if d is the last one.

Definition at line 111 of file avdevice.c.

AVOutputFormat* av_output_video_device_next ( AVOutputFormat d)

Video output devices iterator.

If d is NULL, returns the first registered output audio/video device, if d is non-NULL, returns the next registered output audio/video device after d or NULL if d is the last one.

Definition at line 117 of file avdevice.c.

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.

Parameters
sdevice context.
typemessage type.
datamessage data. Exact type depends on message type.
data_sizesize of message data.
Returns
>= 0 on success, negative on error. AVERROR(ENOSYS) when device doesn't implement handler of the message.

Definition at line 123 of file avdevice.c.

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.

Parameters
sdevice context.
typemessage type.
datamessage data. Can be NULL.
data_sizesize of message data.
Returns
>= 0 on success, negative on error. AVERROR(ENOSYS) when application doesn't implement handler of the message.

Definition at line 131 of file avdevice.c.

Referenced by opengl_create_window(), opengl_draw(), opengl_release_window(), opengl_resize(), opengl_write_header(), opengl_write_trailer(), pulse_audio_sink_input_cb(), pulse_overflow(), pulse_stream_writable(), pulse_underflow(), and pulse_write_packet().

int avdevice_capabilities_create ( AVDeviceCapabilitiesQuery **  caps,
AVFormatContext s,
AVDictionary **  device_options 
)

Initialize capabilities probing API based on AVOption API.

avdevice_capabilities_free() must be called when query capabilities API is not used anymore.

Parameters
[out]capsDevice capabilities data. Pointer to a NULL pointer must be passed.
sContext of the device.
device_optionsAn AVDictionary filled with device-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL. The same options must be passed later to avformat_write_header() for output devices or avformat_open_input() for input devices, or at any other place that affects device-private options.
Returns
>= 0 on success, negative otherwise.

Definition at line 139 of file avdevice.c.

void avdevice_capabilities_free ( AVDeviceCapabilitiesQuery **  caps,
AVFormatContext s 
)

Free resources created by avdevice_capabilities_create()

Parameters
capsDevice capabilities data to be freed.
sContext of the device.

Definition at line 168 of file avdevice.c.

int avdevice_list_devices ( struct AVFormatContext s,
AVDeviceInfoList **  device_list 
)

List devices.

Returns available device names and their parameters.

Note
: Some devices may accept system-dependent device names that cannot be autodetected. The list returned by this function cannot be assumed to be always completed.
Parameters
sdevice context.
[out]device_listlist of autodetected devices.
Returns
count of autodetected devices, negative on error.

Definition at line 183 of file avdevice.c.

void avdevice_free_list_devices ( AVDeviceInfoList **  device_list)

Convenient function to free result of avdevice_list_devices().

Parameters
devicesdevice list to be freed.

Definition at line 208 of file avdevice.c.

Referenced by avdevice_list_devices().

Variable Documentation

const AVOption av_device_capabilities[]
Initial value:
= {
{ "codec", "codec", OFFSET(codec), AV_OPT_TYPE_INT,
{.i64 = AV_CODEC_ID_NONE}, AV_CODEC_ID_NONE, INT_MAX, E|D|A|V },
{ "sample_format", "sample format", OFFSET(sample_format), AV_OPT_TYPE_SAMPLE_FMT,
{.i64 = AV_SAMPLE_FMT_NONE}, AV_SAMPLE_FMT_NONE, INT_MAX, E|D|A },
{ "sample_rate", "sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT,
{.i64 = -1}, -1, INT_MAX, E|D|A },
{ "channels", "channels", OFFSET(channels), AV_OPT_TYPE_INT,
{.i64 = -1}, -1, INT_MAX, E|D|A },
{ "channel_layout", "channel layout", OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT,
{.i64 = -1}, -1, INT_MAX, E|D|A },
{ "pixel_format", "pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT,
{.i64 = AV_PIX_FMT_NONE}, AV_PIX_FMT_NONE, INT_MAX, E|D|V },
{ "window_size", "window size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE,
{.str = NULL}, -1, INT_MAX, E|D|V },
{ "frame_size", "frame size", OFFSET(frame_width), AV_OPT_TYPE_IMAGE_SIZE,
{.str = NULL}, -1, INT_MAX, E|D|V },
{ "fps", "fps", OFFSET(fps), AV_OPT_TYPE_RATIONAL,
{.dbl = -1}, -1, INT_MAX, E|D|V },
{ NULL }
}

AVOption table used by devices to implement device capabilities API.

Should not be used by a user.

Definition at line 32 of file avdevice.c.