1
mirror of https://github.com/mpv-player/mpv synced 2024-11-18 21:16:10 +01:00
mpv/filters/f_hwtransfer.h
wm4 49f9146fe4 f_hwtransfer: add a mp_hwdownload filter
This just wraps the mp_image_hw_download() function as a filter and adds
some minor caching/error logging. (Shame that it needs to much
boilerplate, I guess.)

Will be used by the following commit. Wrapping it as filter seemed more
convenient than other choices.
2019-10-02 21:14:58 +02:00

42 lines
1.3 KiB
C

#pragma once
#include "filter.h"
// A filter which uploads sw frames to hw. Ignores hw frames.
struct mp_hwupload {
struct mp_filter *f;
// Hardware wrapper format, e.g. IMGFMT_VAAPI.
int hw_imgfmt;
// List of supported underlying surface formats.
int *fmts;
int num_fmts;
// List of supported upload image formats. May contain duplicate entries
// (which should be ignored).
int *upload_fmts;
int num_upload_fmts;
// For fmts[n], fmt_upload_index[n] gives the index of the first supported
// upload format in upload_fmts[], and fmt_upload_num[n] gives the number
// of formats at this position.
int *fmt_upload_index;
int *fmt_upload_num;
};
struct mp_hwupload *mp_hwupload_create(struct mp_filter *parent, int hw_imgfmt);
// Return the best format suited for upload that is supported for a given input
// imgfmt. This returns the same as imgfmt if the format is natively supported,
// and otherwise a format that likely results in the least loss.
// Returns 0 if completely unsupported.
int mp_hwupload_find_upload_format(struct mp_hwupload *u, int imgfmt);
// A filter which downloads sw frames from hw. Ignores sw frames.
struct mp_hwdownload {
struct mp_filter *f;
struct mp_image_pool *pool;
};
struct mp_hwdownload *mp_hwdownload_create(struct mp_filter *parent);