vd_lavc: allow disabling codec hwdec per-device
This commit is contained in:
1 parent
70894ae039
commit
07c8c16bef
2 files changed
+11
No files matched your search
@@ -589,6 +589,14 @@ static void select_and_set_hwdec(struct mp_filter *vd)
|
||||
|
||||
const struct hwcontext_fns *fns =
|
||||
hwdec_get_hwcontext_fns(hwdec->lavc_device);
|
||||
if (fns && fns->is_codec_allowed &&
|
||||
!fns->is_codec_allowed(ctx->hwdec_dev, hwdec->codec->id))
|
||||
{
|
||||
MP_WARN(vd, "Hardware decoding of '%s' is disabled on this "
|
||||
"device.\n", codec);
|
||||
av_buffer_unref(&ctx->hwdec_dev);
|
||||
continue;
|
||||
}
|
||||
if (fns && fns->is_emulated && fns->is_emulated(ctx->hwdec_dev)) {
|
||||
if (hwdec_auto) {
|
||||
MP_VERBOSE(vd, "Not using emulated API.\n");
|
||||
|
||||
@@ -109,6 +109,9 @@ struct hwcontext_fns {
|
||||
struct hwcontext_create_dev_params *params);
|
||||
// Return whether this is using some sort of sub-optimal emulation layer.
|
||||
bool (*is_emulated)(struct AVBufferRef *hw_device_ctx);
|
||||
// Return whether hardware decoding of the given codec is allowed on this
|
||||
// device. If NULL, all codecs are assumed to be allowed.
|
||||
bool (*is_codec_allowed)(struct AVBufferRef *hw_device_ctx, int av_codec_id);
|
||||
};
|
||||
|
||||
// The parameter is of type enum AVHWDeviceType (as in int to avoid extensive
|
||||
|
||||
Reference in new issue
Block a user