123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- #ifndef AVUTIL_HWCONTEXT_H
- #define AVUTIL_HWCONTEXT_H
- #include "buffer.h"
- #include "frame.h"
- #include "log.h"
- #include "pixfmt.h"
- enum AVHWDeviceType {
- AV_HWDEVICE_TYPE_NONE,
- AV_HWDEVICE_TYPE_VDPAU,
- AV_HWDEVICE_TYPE_CUDA,
- AV_HWDEVICE_TYPE_VAAPI,
- AV_HWDEVICE_TYPE_DXVA2,
- AV_HWDEVICE_TYPE_QSV,
- AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
- AV_HWDEVICE_TYPE_D3D11VA,
- AV_HWDEVICE_TYPE_DRM,
- AV_HWDEVICE_TYPE_OPENCL,
- AV_HWDEVICE_TYPE_MEDIACODEC,
- AV_HWDEVICE_TYPE_VULKAN,
- };
- typedef struct AVHWDeviceInternal AVHWDeviceInternal;
- typedef struct AVHWDeviceContext {
-
- const AVClass *av_class;
-
- AVHWDeviceInternal *internal;
-
- enum AVHWDeviceType type;
-
- void *hwctx;
-
- void (*free)(struct AVHWDeviceContext *ctx);
-
- void *user_opaque;
- } AVHWDeviceContext;
- typedef struct AVHWFramesInternal AVHWFramesInternal;
- typedef struct AVHWFramesContext {
-
- const AVClass *av_class;
-
- AVHWFramesInternal *internal;
-
- AVBufferRef *device_ref;
-
- AVHWDeviceContext *device_ctx;
-
- void *hwctx;
-
- void (*free)(struct AVHWFramesContext *ctx);
-
- void *user_opaque;
-
- AVBufferPool *pool;
-
- int initial_pool_size;
-
- enum AVPixelFormat format;
-
- enum AVPixelFormat sw_format;
-
- int width, height;
- } AVHWFramesContext;
- enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name);
- const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
- enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
- AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
- int av_hwdevice_ctx_init(AVBufferRef *ref);
- int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
- const char *device, AVDictionary *opts, int flags);
- int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
- enum AVHWDeviceType type,
- AVBufferRef *src_ctx, int flags);
- int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ctx,
- enum AVHWDeviceType type,
- AVBufferRef *src_ctx,
- AVDictionary *options, int flags);
- AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx);
- int av_hwframe_ctx_init(AVBufferRef *ref);
- int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
- int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags);
- enum AVHWFrameTransferDirection {
-
- AV_HWFRAME_TRANSFER_DIRECTION_FROM,
-
- AV_HWFRAME_TRANSFER_DIRECTION_TO,
- };
- int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
- enum AVHWFrameTransferDirection dir,
- enum AVPixelFormat **formats, int flags);
- typedef struct AVHWFramesConstraints {
-
- enum AVPixelFormat *valid_hw_formats;
-
- enum AVPixelFormat *valid_sw_formats;
-
- int min_width;
- int min_height;
-
- int max_width;
- int max_height;
- } AVHWFramesConstraints;
- void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
- AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
- const void *hwconfig);
- void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
- enum {
-
- AV_HWFRAME_MAP_READ = 1 << 0,
-
- AV_HWFRAME_MAP_WRITE = 1 << 1,
-
- AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
-
- AV_HWFRAME_MAP_DIRECT = 1 << 3,
- };
- int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags);
- int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx,
- enum AVPixelFormat format,
- AVBufferRef *derived_device_ctx,
- AVBufferRef *source_frame_ctx,
- int flags);
- #endif
|