On 18/02/16 06:30, Anton Khirnov wrote:
> Quoting Mark Thompson (2016-02-17 23:49:13)
>>
>> How opposed are you to a bit of VAAPI-specific API here?  Having got a
>> bit further, the one specific which would be useful to avoid annoying
>> duplication is the enumeration of formats available in a given
>> configuration (which can then be passed as sw_format when making a
>> hw_frames_ctx).  It's currently done in the device setup to get
>> transfer formats, then identically in the vaapi_scale filter, then
>> again in encoder setup.
>>
> 
> I general, I'm not completely opposed to vendor-specific API if it's
> useful and necessary (the hwctx itself already counts as such).
> But enumerating valid values for sw_format does not strike me as
> especially VAAPI-specific.
> 

Ok, so the operation we want is "get the constraints on the configurable parts
of an AVHWFrameContext given some hardware-specific information about the way
those frames will be used".

How about (deliberately verbose):

typedef struct {
    enum AVPixelFormat *valid_sw_formats;

    int min_frame_width;
    int min_frame_height;

    // Or INT_MAX if not known.
    int max_frame_width;
    int max_frame_height;

    // If there is something with hard constraints here - presumably things
    // which wanted to limit the set of render targets will constrain this
    // somehow, though I don't have an example.  INT_MAX if no constraint.
    int max_frame_pool_size;
} AVHWFrameConstraints;

typedef struct {
    VAConfigID config_id;
} AVVAAPISomethingConfig;

int av_hwdevice_get_hwframe_constraints_given_hw_specific_config(
    AVBufferRef *device_context,
    void *hw_specific_config,
    AVHWFrameConstraints *frame_constraints);

?

Thanks,

- Mark

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to