Data Fields
AVDeviceCapabilitiesQuery Struct Reference

Following API allows user to probe device capabilities (supported codecs, pixel formats, sample formats, resolutions, channel counts, etc). More...

#include <avdevice.h>

Data Fields

const AVClassav_class
enum AVCodecID codec
enum AVSampleFormat sample_format
enum AVPixelFormat pixel_format
int sample_rate
int channels
int64_t channel_layout
int window_width
int window_height
int frame_width
int frame_height
AVRational fps

Detailed Description

Following API allows user to probe device capabilities (supported codecs, pixel formats, sample formats, resolutions, channel counts, etc).

It is build on top op AVOption API. Queried capabilities make it possible to set up converters of video or audio parameters that fit to the device.

List of capabilities that can be queried:

Value of the capability may be set by user using av_opt_set() function and AVDeviceCapabilitiesQuery object. Following queries will limit results to the values matching already set capabilities. For example, setting a codec may impact number of formats or fps values returned during next query. Setting invalid value may limit results to zero.

Example of the usage basing on opengl output device:

AVOptionRanges *ranges;
int ret;
if ((ret = avformat_alloc_output_context2(&oc, NULL, "opengl", NULL)) < 0)
goto fail;
if (avdevice_capabilities_create(&caps, oc, NULL) < 0)
goto fail;
//query codecs
if (av_opt_query_ranges(&ranges, caps, "codec", AV_OPT_MULTI_COMPONENT_RANGE)) < 0)
goto fail;
//pick codec here and set it
av_opt_set(caps, "codec", AV_CODEC_ID_RAWVIDEO, 0);
//query format
if (av_opt_query_ranges(&ranges, caps, "pixel_format", AV_OPT_MULTI_COMPONENT_RANGE)) < 0)
goto fail;
//pick format here and set it
av_opt_set(caps, "pixel_format", AV_PIX_FMT_YUV420P, 0);
//query and set more capabilities
//clean up code

Structure describes device capabilities.

It is used by devices in conjunction with av_device_capabilities AVOption table to implement capabilities probing API based on AVOption API. Should not be used directly.

Definition at line 407 of file avdevice.h.

Field Documentation

◆ av_class

const AVClass* AVDeviceCapabilitiesQuery::av_class

Definition at line 408 of file avdevice.h.

◆ device_context

AVFormatContext* AVDeviceCapabilitiesQuery::device_context

Definition at line 409 of file avdevice.h.

◆ codec

enum AVCodecID AVDeviceCapabilitiesQuery::codec

Definition at line 410 of file avdevice.h.

◆ sample_format

enum AVSampleFormat AVDeviceCapabilitiesQuery::sample_format

Definition at line 411 of file avdevice.h.

◆ pixel_format

enum AVPixelFormat AVDeviceCapabilitiesQuery::pixel_format

Definition at line 412 of file avdevice.h.

◆ sample_rate

int AVDeviceCapabilitiesQuery::sample_rate

Definition at line 413 of file avdevice.h.

◆ channels

int AVDeviceCapabilitiesQuery::channels

Definition at line 414 of file avdevice.h.

◆ channel_layout

int64_t AVDeviceCapabilitiesQuery::channel_layout

Definition at line 415 of file avdevice.h.

◆ window_width

int AVDeviceCapabilitiesQuery::window_width

Definition at line 416 of file avdevice.h.

◆ window_height

int AVDeviceCapabilitiesQuery::window_height

Definition at line 417 of file avdevice.h.

◆ frame_width

int AVDeviceCapabilitiesQuery::frame_width

Definition at line 418 of file avdevice.h.

◆ frame_height

int AVDeviceCapabilitiesQuery::frame_height

Definition at line 419 of file avdevice.h.

◆ fps

AVRational AVDeviceCapabilitiesQuery::fps

Definition at line 420 of file avdevice.h.

The documentation for this struct was generated from the following file:
Following API allows user to probe device capabilities (supported codecs, pixel formats,...
Definition: avdevice.h:407
Definition: codec_id.h:65
int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, AVDictionary **device_options)
Initialize capabilities probing API based on AVOption API.
Definition: avdevice.c:46
#define fail()
Definition: checkasm.h:134
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition: opt.c:487
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
Format I/O context.
Definition: avformat.h:1216
#define NULL
Definition: coverity.c:32
void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s)
Free resources created by avdevice_capabilities_create()
Definition: avdevice.c:52
Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than one component for cert...
Definition: opt.h:584
List of AVOptionRange structs.
Definition: opt.h:336
Definition: filter_design.txt:187
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
Definition: avformat.c:95
int av_opt_query_ranges(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
Get a list of allowed ranges for the given option.
Definition: opt.c:1946
int avformat_alloc_output_context2(AVFormatContext **ctx, const AVOutputFormat *oformat, const char *format_name, const char *filename)
Allocate an AVFormatContext for an output format.
Definition: mux.c:91