| @@ -36,6 +36,7 @@ · 35 unmodified lines |
| 36 | 36 | #include "libavutil/channel_layout.h" |
| 37 | 37 | #include "libavutil/dict.h" |
| 38 | 38 | #include "libavutil/frame.h" |
| 39 | +#include "libavutil/hwcontext.h" |
| 39 | 40 | #include "libavutil/log.h" |
| 40 | 41 | #include "libavutil/pixfmt.h" |
| 41 | 42 | #include "libavutil/rational.h" |
| @@ -3279,6 +3280,61 @@ typedef struct AVProfile { · 3237 unmodified lines |
| 3279 | 3280 | const char *name; ///< short name for the profile |
| 3280 | 3281 | } AVProfile; |
| 3281 | 3282 | |
| 3283 | +enum { |
| 3284 | + /** |
| 3285 | + * The codec supports this format via the hw_device_ctx interface. |
| 3286 | + * |
| 3287 | + * When selecting this format, AVCodecContext.hw_device_ctx should |
| 3288 | + * have been set to a device of the specified type before calling |
| 3289 | + * avcodec_open2(). |
| 3290 | + */ |
| 3291 | + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01, |
| 3292 | + /** |
| 3293 | + * The codec supports this format via the hw_frames_ctx interface. |
| 3294 | + * |
| 3295 | + * When selecting this format for a decoder, |
| 3296 | + * AVCodecContext.hw_frames_ctx should be set to a suitable frames |
| 3297 | + * context inside the get_format() callback. The frames context |
| 3298 | + * must have been created on a device of the specified type. |
| 3299 | + */ |
| 3300 | + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02, |
| 3301 | + /** |
| 3302 | + * The codec supports this format by some internal method. |
| 3303 | + * |
| 3304 | + * This format can be selected without any additional configuration - |
| 3305 | + * no device or frames context is required. |
| 3306 | + */ |
| 3307 | + AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04, |
| 3308 | + /** |
| 3309 | + * The codec supports this format by some ad-hoc method. |
| 3310 | + * |
| 3311 | + * Additional settings and/or function calls are required. See the |
| 3312 | + * codec-specific documentation for details. (Methods requiring |
| 3313 | + * this sort of configuration are deprecated and others should be |
| 3314 | + * used in preference.) |
| 3315 | + */ |
| 3316 | + AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08, |
| 3317 | +}; |
| 3318 | + |
| 3319 | +typedef struct AVCodecHWConfig { |
| 3320 | + /** |
| 3321 | + * A hardware pixel format which the codec can use. |
| 3322 | + */ |
| 3323 | + enum AVPixelFormat pix_fmt; |
| 3324 | + /** |
| 3325 | + * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible |
| 3326 | + * setup methods which can be used with this configuration. |
| 3327 | + */ |
| 3328 | + int methods; |
| 3329 | + /** |
| 3330 | + * The device type associated with the configuration. |
| 3331 | + * |
| 3332 | + * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and |
| 3333 | + * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused. |
| 3334 | + */ |
| 3335 | + enum AVHWDeviceType device_type; |
| 3336 | +} AVCodecHWConfig; |
| 3337 | + |
| 3282 | 3338 | typedef struct AVCodecDefault AVCodecDefault; |
| 3283 | 3339 | |
| 3284 | 3340 | struct AVSubtitle; |
| @@ -3404,6 +3460,15 @@ typedef struct AVCodec { · 119 unmodified lines |
| 3404 | 3460 | * packets before decoding. |
| 3405 | 3461 | */ |
| 3406 | 3462 | const char *bsfs; |
| 3463 | + |
| 3464 | + /** |
| 3465 | + * Array of pointers to hardware configurations supported by the codec, |
| 3466 | + * or NULL if no hardware supported. The array is terminated by a NULL |
| 3467 | + * pointer. |
| 3468 | + * |
| 3469 | + * The user can only access this field via avcodec_get_hw_config(). |
| 3470 | + */ |
| 3471 | + const struct AVCodecHWConfigInternal **hw_configs; |
| 3407 | 3472 | } AVCodec; |
| 3408 | 3473 | |
| 3409 | 3474 | #if FF_API_CODEC_GET_SET |
| @@ -3413,6 +3478,15 @@ int av_codec_get_max_lowres(const AVCodec *codec); · 3 unmodified lines |
| 3413 | 3478 | |
| 3414 | 3479 | struct MpegEncContext; |
| 3415 | 3480 | |
| 3481 | +/** |
| 3482 | + * Retrieve supported hardware configurations for a codec. |
| 3483 | + * |
| 3484 | + * Values of index from zero to some maximum return the indexed configuration |
| 3485 | + * descriptor; all other values return NULL. If the codec does not support |
| 3486 | + * any hardware configurations then it will always return NULL. |
| 3487 | + */ |
| 3488 | +const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index); |
| 3489 | + |
| 3416 | 3490 | /** |
| 3417 | 3491 | * @defgroup lavc_hwaccel AVHWAccel |
| 3418 | 3492 | * @{ |