[Libav-user] VAAPI constraints - Failed to query surface attributes: 4 (invalid VAConfigID)
Mark Thompson
sw at jkqxz.net
Wed Feb 8 00:03:27 EET 2017
On 07/02/17 18:54, Anton Sviridenko wrote:
> {
> AVVAAPIHWConfig *hwconfig = NULL;
> AVHWFramesConstraints *constraints = NULL;
>
> hwconfig = (AVVAAPIHWConfig
> *)av_hwdevice_hwconfig_alloc(m_hw_device_ctx);
> constraints =
> av_hwdevice_get_hwframe_constraints(m_hw_device_ctx, hwconfig);
>
> if (!constraints)
> {
> qDebug() << "Failed to query VAAPI constraints";
> av_freep(&hwconfig);
> return;
> }
>
> qDebug() << "VAAPI frame constraints: \n"
> << "min_width " << constraints->min_width
> << "min_height " << constraints->min_height
> << "max_width " << constraints->max_width
> << "max_height " << constraints->max_height;
>
> av_freep(&hwconfig);
> av_hwframe_constraints_free(&constraints);
> }
You need to fill the config_id field of AVVAAPIHWConfig. The av_hwdevice_get_hwframe_constraints() function returns constraints on hwframes /for the given processing configuration/, which you have to supply. Alternatively, you can pass a null pointer in place of the hwconfig argument to get any global constraints which exist on image sizes or formats (in your case above for VAAPI that wouldn't say much of use because there are no global constraints on image sizes, only local ones to each processing configuration).
For some examples, see <http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavfilter/vf_scale_vaapi.c;h=5e6298a263d21fb5c7cd42047da0979233eaedaf;hb=HEAD#l135> (making a scaler) or <http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/vaapi_decode.c;h=da9e4aeddef86f9f54b3a82582205ebc840b738e;hb=HEAD#l368> (making a decoder).
- Mark
More information about the Libav-user
mailing list