mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 09:32:40 +00:00
8fff125422
This requires FFmpeg git master for accelerated hardware decoding. Keep in mind that FFmpeg must be compiled with --enable-mmal. Libav will also work. Most things work. Screenshots don't work with accelerated/opaque decoding (except using full window screenshot mode). Subtitles are very slow - even simple but huge overlays can cause frame drops. This always uses fullscreen mode. It uses dispmanx and mmal directly, and there are no window managers or anything on this level. vo_opengl also kind of works, but is pretty useless and slow. It can't use opaque hardware decoding (copy back can be used by forcing the option --vd=lavc:h264_mmal). Keep in mind that the dispmanx backend is preferred over the X11 ones in case you're trying on X11; but X11 is even more useless on RPI. This doesn't correctly reject extended h264 profiles and thus doesn't fallback to software decoding. The hw supports only up to the high profile, and will e.g. return garbage for Hi10P video. This sets a precedent of enabling hw decoding by default, but only if RPI support is compiled (which most hopefully it will be disabled on desktop Linux platforms). While it's more or less required to use hw decoding on the weak RPI, it causes more problems than it solves on real platforms (Linux has the Intel GPU problem, OSX still has some cases with broken decoding.) So I can live with this compromise of having different defaults depending on the platform. Raspberry Pi 2 is required. This wasn't tested on the original RPI, though at least decoding itself seems to work (but full playback was not tested).
58 lines
1.8 KiB
C
58 lines
1.8 KiB
C
#ifndef MP_HWDEC_H_
|
|
#define MP_HWDEC_H_
|
|
|
|
struct mp_image_pool;
|
|
|
|
// keep in sync with --hwdec option
|
|
enum hwdec_type {
|
|
HWDEC_AUTO = -1,
|
|
HWDEC_NONE = 0,
|
|
HWDEC_VDPAU = 1,
|
|
HWDEC_VDA = 2,
|
|
HWDEC_VAAPI = 4,
|
|
HWDEC_VAAPI_COPY = 5,
|
|
HWDEC_DXVA2_COPY = 6,
|
|
HWDEC_RPI = 7,
|
|
};
|
|
|
|
struct mp_hwdec_ctx {
|
|
enum hwdec_type type;
|
|
|
|
void *priv; // for free use by hwdec implementation
|
|
|
|
// API-specific, not needed by all backends.
|
|
struct mp_vdpau_ctx *vdpau_ctx;
|
|
struct mp_vaapi_ctx *vaapi_ctx;
|
|
|
|
// Optional.
|
|
// Allocates a software image from the pool, downloads the hw image from
|
|
// mpi, and returns it.
|
|
// pool can be NULL (then just use straight allocation).
|
|
// Return NULL on error or if mpi has the wrong format.
|
|
struct mp_image *(*download_image)(struct mp_hwdec_ctx *ctx,
|
|
struct mp_image *mpi,
|
|
struct mp_image_pool *swpool);
|
|
};
|
|
|
|
// Used to communicate hardware decoder API handles from VO to video decoder.
|
|
// The VO can set the context pointer for supported APIs.
|
|
struct mp_hwdec_info {
|
|
// (Since currently only 1 hwdec API is loaded at a time, this pointer
|
|
// simply maps to the loaded one.)
|
|
struct mp_hwdec_ctx *hwctx;
|
|
|
|
// 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 hwctx fields for success/access.
|
|
// Due to threading, the callback is the only code that is allowed to
|
|
// change fields in this struct after initialization.
|
|
void (*load_api)(struct mp_hwdec_info *info, const char *api_name);
|
|
void *load_api_ctx;
|
|
};
|
|
|
|
// Trivial helper to call info->load_api().
|
|
// Implemented in vd_lavc.c.
|
|
void hwdec_request_api(struct mp_hwdec_info *info, const char *api_name);
|
|
|
|
#endif
|