mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 17:42:17 +00:00
872b068cb7
Although we can support vulkan multiplane images, cuda lacks any such support, and so cannot natively import such images for interop. It's possible that we can do separate exports for each plane in the image and have it work, but for now, we can selectively disable multiplane when we know that we'll be consuming cuda frames. As a reminder, even though cuda is the frame source, interop is one way so the vulkan images have to be imported to cuda before we copy the frame contents over. This logic here is slightly more complex than I'd like but you can't just set the flag blindly, as it will cause hwframes ctx creation to fail if the format is packed or if it's planar rgb. Oh well.
48 lines
1.9 KiB
C
48 lines
1.9 KiB
C
#ifndef MPV_MP_IMAGE_POOL_H
|
|
#define MPV_MP_IMAGE_POOL_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
struct mp_image_pool;
|
|
|
|
struct mp_image_pool *mp_image_pool_new(void *tparent);
|
|
struct mp_image *mp_image_pool_get(struct mp_image_pool *pool, int fmt,
|
|
int w, int h);
|
|
// the reference to "new" is transferred to the pool
|
|
void mp_image_pool_add(struct mp_image_pool *pool, struct mp_image *new);
|
|
void mp_image_pool_clear(struct mp_image_pool *pool);
|
|
|
|
void mp_image_pool_set_lru(struct mp_image_pool *pool);
|
|
|
|
struct mp_image *mp_image_pool_get_no_alloc(struct mp_image_pool *pool, int fmt,
|
|
int w, int h);
|
|
|
|
typedef struct mp_image *(*mp_image_allocator)(void *data, int fmt, int w, int h);
|
|
void mp_image_pool_set_allocator(struct mp_image_pool *pool,
|
|
mp_image_allocator cb, void *cb_data);
|
|
|
|
struct mp_image *mp_image_pool_new_copy(struct mp_image_pool *pool,
|
|
struct mp_image *img);
|
|
bool mp_image_pool_make_writeable(struct mp_image_pool *pool,
|
|
struct mp_image *img);
|
|
|
|
struct mp_image *mp_image_hw_download(struct mp_image *img,
|
|
struct mp_image_pool *swpool);
|
|
|
|
int mp_image_hw_download_get_sw_format(struct mp_image *img);
|
|
|
|
bool mp_image_hw_upload(struct mp_image *hw_img, struct mp_image *src);
|
|
|
|
struct AVBufferRef;
|
|
bool mp_update_av_hw_frames_pool(struct AVBufferRef **hw_frames_ctx,
|
|
struct AVBufferRef *hw_device_ctx,
|
|
int imgfmt, int sw_imgfmt, int w, int h,
|
|
bool disable_multiplane);
|
|
|
|
struct mp_image *mp_av_pool_image_hw_upload(struct AVBufferRef *hw_frames_ctx,
|
|
struct mp_image *src);
|
|
|
|
struct mp_image *mp_av_pool_image_hw_map(struct AVBufferRef *hw_frames_ctx,
|
|
struct mp_image *src);
|
|
#endif
|