World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Структура AVDeviceCapabilitiesQuery

#include <avdevice.h>

+ Граф связей класса AVDeviceCapabilitiesQuery:

Открытые атрибуты

const AVClassav_class
 
AVFormatContextdevice_context
 
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
 

Подробное описание

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:

  • Capabilities valid for both audio and video devices:
    • codec: supported audio/video codecs. type: AV_OPT_TYPE_INT (AVCodecID value)
  • Capabilities valid for audio devices:
    • sample_format: supported sample formats. type: AV_OPT_TYPE_INT (AVSampleFormat value)
    • sample_rate: supported sample rates. type: AV_OPT_TYPE_INT
    • channels: supported number of channels. type: AV_OPT_TYPE_INT
    • channel_layout: supported channel layouts. type: AV_OPT_TYPE_INT64
  • Capabilities valid for video devices:
    • pixel_format: supported pixel formats. type: AV_OPT_TYPE_INT (AVPixelFormat value)
    • window_size: supported window sizes (describes size of the window size presented to the user). type: AV_OPT_TYPE_IMAGE_SIZE
    • frame_size: supported frame sizes (describes size of provided video frames). type: AV_OPT_TYPE_IMAGE_SIZE
    • fps: supported fps values type: AV_OPT_TYPE_RATIONAL

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:

AVFormatContext *oc = NULL;
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
fail:
//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.

См. определение в файле avdevice.h строка 400

Данные класса

◆ av_class

const AVClass* AVDeviceCapabilitiesQuery::av_class

См. определение в файле avdevice.h строка 401

◆ device_context

AVFormatContext* AVDeviceCapabilitiesQuery::device_context

См. определение в файле avdevice.h строка 402

◆ codec

enum AVCodecID AVDeviceCapabilitiesQuery::codec

См. определение в файле avdevice.h строка 403

◆ sample_format

enum AVSampleFormat AVDeviceCapabilitiesQuery::sample_format

См. определение в файле avdevice.h строка 404

◆ pixel_format

enum AVPixelFormat AVDeviceCapabilitiesQuery::pixel_format

См. определение в файле avdevice.h строка 405

◆ sample_rate

int AVDeviceCapabilitiesQuery::sample_rate

См. определение в файле avdevice.h строка 406

◆ channels

int AVDeviceCapabilitiesQuery::channels

См. определение в файле avdevice.h строка 407

◆ channel_layout

int64_t AVDeviceCapabilitiesQuery::channel_layout

См. определение в файле avdevice.h строка 408

◆ window_width

int AVDeviceCapabilitiesQuery::window_width

См. определение в файле avdevice.h строка 409

◆ window_height

int AVDeviceCapabilitiesQuery::window_height

См. определение в файле avdevice.h строка 410

◆ frame_width

int AVDeviceCapabilitiesQuery::frame_width

См. определение в файле avdevice.h строка 411

◆ frame_height

int AVDeviceCapabilitiesQuery::frame_height

См. определение в файле avdevice.h строка 412

◆ fps

AVRational AVDeviceCapabilitiesQuery::fps

См. определение в файле avdevice.h строка 413


Объявления и описания членов структуры находятся в файле:
AV_CODEC_ID_RAWVIDEO
@ AV_CODEC_ID_RAWVIDEO
Definition: avcodec.h:231
av_opt_set
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
avdevice_capabilities_create
int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, AVDictionary **device_options)
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AVDeviceCapabilitiesQuery
Definition: avdevice.h:400
AVOptionRanges
Definition: opt.h:329
query
GLenum query
Definition: SDL_opengl_glext.h:3483
avformat_alloc_output_context2
int avformat_alloc_output_context2(AVFormatContext **ctx, ff_const59 AVOutputFormat *oformat, const char *format_name, const char *filename)
avdevice_capabilities_free
void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s)
AVFormatContext
Definition: avformat.h:1344
avformat_free_context
void avformat_free_context(AVFormatContext *s)
av_opt_query_ranges
int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags)