mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 18:05:21 +00:00
hw_videotoolbox: allow using native decoder output format
Depends on FFmpeg commit ade7c1a2326e2bb9b. It has yet to show whether it actually does what it should. Probably doesn't.
This commit is contained in:
parent
0aa01ca743
commit
85c8556eef
@ -779,6 +779,8 @@ Video
|
||||
the given hardware. ``nv12``, the default, works better on modern hardware,
|
||||
while ``uyvy422`` appears to be better for old hardware. ``yuv420p`` also
|
||||
works.
|
||||
Since mpv 0.25.0, ``no`` is an accepted value, which lets the decoder pick
|
||||
the format on newer FFmpeg versions (will use ``nv12`` on older versions).
|
||||
|
||||
``--panscan=<0.0-1.0>``
|
||||
Enables pan-and-scan functionality (cropping the sides of e.g. a 16:9
|
||||
|
@ -448,7 +448,7 @@ const m_option_t mp_opts[] = {
|
||||
OPT_CHOICE_C("hwdec", hwdec_api, 0, mp_hwdec_names),
|
||||
OPT_STRING("hwdec-codecs", hwdec_codecs, 0),
|
||||
#if HAVE_VIDEOTOOLBOX_HWACCEL
|
||||
OPT_IMAGEFORMAT("videotoolbox-format", videotoolbox_format, 0),
|
||||
OPT_IMAGEFORMAT("videotoolbox-format", videotoolbox_format, 0, .min = -1),
|
||||
#endif
|
||||
|
||||
// -1 means auto aspect (prefer container size until aspect change)
|
||||
|
@ -105,8 +105,14 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h)
|
||||
if (!vtctx)
|
||||
return -1;
|
||||
|
||||
vtctx->cv_pix_fmt_type =
|
||||
mp_imgfmt_to_cvpixelformat(ctx->opts->videotoolbox_format);
|
||||
int imgfmt = ctx->opts->videotoolbox_format;
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 81, 103)
|
||||
if (!imgfmt)
|
||||
imgfmt = IMGFMT_NV12;
|
||||
#endif
|
||||
vtctx->cv_pix_fmt_type = mp_imgfmt_to_cvpixelformat(imgfmt);
|
||||
MP_VERBOSE(ctx, "Requesting cv_pix_fmt_type=0x%x\n",
|
||||
(unsigned)vtctx->cv_pix_fmt_type);
|
||||
|
||||
int err = av_videotoolbox_default_init2(ctx->avctx, vtctx);
|
||||
if (err < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user