mirror of
https://github.com/mpv-player/mpv
synced 2025-01-13 10:26:09 +00:00
vd_lavc: allow explicitly selecting vdpau hw decoders
This allows using the vdpau decoders with -vd without having to use the -hwdec switch (basically like in mplayer). Note that this way of selecting the hardware decoder is still deprecated. libavcodec went away from adding special decoder entries for hardware decoding, and instead makes use of the "hwaccel" architecture, where hardware decoders use the same decoder names as the software decoders. The old vdpau special decoders will probably be deprecated and removed in the future.
This commit is contained in:
parent
2cb147a2f4
commit
844249317b
@ -101,7 +101,7 @@ enum hwdec_type {
|
||||
|
||||
struct hwdec {
|
||||
enum hwdec_type api;
|
||||
char *codec, *hw_codec;
|
||||
const char *codec, *hw_codec;
|
||||
};
|
||||
|
||||
static const struct hwdec hwdec[] = {
|
||||
@ -272,6 +272,16 @@ static void init_avctx(sh_video_t *sh, const char *decoder, struct hwdec *hwdec)
|
||||
|
||||
avctx->thread_count = lavc_param->threads;
|
||||
|
||||
// Hack to allow explicitly selecting vdpau hw decoders
|
||||
if (!hwdec && (lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) {
|
||||
ctx->hwdec = talloc(ctx, struct hwdec);
|
||||
*ctx->hwdec = (struct hwdec) {
|
||||
.api = HWDEC_VDPAU,
|
||||
.codec = sh->gsh->codec,
|
||||
.hw_codec = decoder,
|
||||
};
|
||||
}
|
||||
|
||||
if (ctx->hwdec && ctx->hwdec->api == HWDEC_VDPAU) {
|
||||
assert(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU);
|
||||
ctx->do_hw_dr1 = true;
|
||||
|
Loading…
Reference in New Issue
Block a user