summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/dec_video.h5
-rw-r--r--video/decode/lavc.h2
-rw-r--r--video/decode/vd_lavc.c7
3 files changed, 14 insertions, 0 deletions
diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h
index 549d208f81..03b72907ef 100644
--- a/video/decode/dec_video.h
+++ b/video/decode/dec_video.h
@@ -47,6 +47,11 @@ int vd_control(struct sh_video *sh_video, int cmd, void *arg);
struct mp_hwdec_info {
struct mp_vdpau_ctx *vdpau_ctx;
struct mp_vaapi_ctx *vaapi_ctx;
+ // Can be used to lazily load a requested API.
+ // api_name is e.g. "vdpau" (like the fields above, without "_ctx")
+ // Can be NULL, is idempotent, caller checks _ctx fields for success/access.
+ void (*load_api)(struct mp_hwdec_info *info, const char *api_name);
+ void *load_api_ctx;
};
#endif /* MPLAYER_DEC_VIDEO_H */
diff --git a/video/decode/lavc.h b/video/decode/lavc.h
index 9e2533cbd5..af206bc82a 100644
--- a/video/decode/lavc.h
+++ b/video/decode/lavc.h
@@ -86,6 +86,8 @@ bool hwdec_check_codec_support(const char *decoder,
const struct hwdec_profile_entry *table);
int hwdec_get_max_refs(struct lavc_ctx *ctx);
+void hwdec_request_api(struct mp_hwdec_info *info, const char *api_name);
+
// lavc_dr1.c
int mp_codec_get_buffer(AVCodecContext *s, AVFrame *frame);
void mp_codec_release_buffer(AVCodecContext *s, AVFrame *frame);
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index ebfd986a95..47bfd96e84 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -46,6 +46,7 @@
#include "video/img_format.h"
#include "video/mp_image_pool.h"
#include "video/filter/vf.h"
+#include "video/decode/dec_video.h"
#include "demux/stheader.h"
#include "demux/demux_packet.h"
#include "osdep/numcores.h"
@@ -196,6 +197,12 @@ int hwdec_get_max_refs(struct lavc_ctx *ctx)
return ctx->avctx->codec_id == AV_CODEC_ID_H264 ? 16 : 2;
}
+void hwdec_request_api(struct mp_hwdec_info *info, const char *api_name)
+{
+ if (info && info->load_api)
+ info->load_api(info, api_name);
+}
+
static int hwdec_probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
const char *decoder, const char **hw_decoder)
{