mirror of https://github.com/mpv-player/mpv
parent
1c46bd5e50
commit
a7f4ecb012
12
README.md
12
README.md
|
@ -100,10 +100,7 @@ Essential dependencies (incomplete list):
|
|||
libGL, GLX, EGL, xv, ...)
|
||||
- Audio output development headers (libasound/ALSA, pulseaudio)
|
||||
- FFmpeg libraries (libavutil libavcodec libavformat libswscale libavfilter
|
||||
and either libswresample or libavresample)
|
||||
At least FFmpeg 3.2.2 or Libav 12 is required.
|
||||
For hardware decoding with vaapi and vdpau, FFmpeg 3.3 or Libav git is
|
||||
required.
|
||||
and either libswresample or libavresample) from ffmpeg-mpv or Libav
|
||||
- zlib
|
||||
- iconv (normally provided by the system libc)
|
||||
- libass (OSD, OSC, text subtitles)
|
||||
|
@ -111,7 +108,6 @@ Essential dependencies (incomplete list):
|
|||
- libjpeg (optional, used for screenshots only)
|
||||
- uchardet (optional, for subtitle charset detection)
|
||||
- vdpau and vaapi libraries for hardware decoding on Linux (optional)
|
||||
(FFmpeg 3.3 or Libav git is also required.)
|
||||
|
||||
Libass dependencies:
|
||||
|
||||
|
@ -128,11 +124,10 @@ FFmpeg dependencies:
|
|||
- libx264/libmp3lame/libfdk-aac if you want to use encoding (have to be
|
||||
explicitly enabled when compiling FFmpeg)
|
||||
- Libav also works, but some features will not work. (See section below.)
|
||||
- FFmpeg/Libav git for Windows/D3D11 and Cuda decoding.
|
||||
|
||||
Most of the above libraries are available in suitable versions on normal
|
||||
Linux distributions. However, FFmpeg is an exception (distro versions may be
|
||||
too old to work well or at all). For that reason you may want to use
|
||||
Linux distributions. However, FFmpeg is an exception - [ffmpeg-mpv][ffmpeg-mpv]
|
||||
or Libav git master is required. For that reason you may want to use
|
||||
the separately available build wrapper ([mpv-build][mpv-build]) that first
|
||||
compiles FFmpeg libraries and libass, and then compiles the player statically
|
||||
linked against those.
|
||||
|
@ -254,3 +249,4 @@ only if discretion is required.
|
|||
[api-changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/client-api-changes.rst
|
||||
[restore-old-bindings]: https://github.com/mpv-player/mpv/blob/master/etc/restore-old-bindings.conf
|
||||
[contribute.md]: https://github.com/mpv-player/mpv/blob/master/DOCS/contribute.md
|
||||
[ffmpeg-mpv]: https://github.com/mpv-player/ffmpeg-mpv
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
#include "fmt-conversion.h"
|
||||
#include "format.h"
|
||||
|
||||
#define HAVE_LIBSWRESAMPLE HAVE_IS_FFMPEG
|
||||
#define HAVE_LIBAVRESAMPLE HAVE_IS_LIBAV
|
||||
#define HAVE_LIBSWRESAMPLE HAVE_FFMPEG_MPV
|
||||
#define HAVE_LIBAVRESAMPLE HAVE_LIBAV
|
||||
|
||||
#if HAVE_LIBAVRESAMPLE
|
||||
#include <libavresample/avresample.h>
|
||||
|
|
|
@ -42,10 +42,10 @@
|
|||
#include <libavdevice/avdevice.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_IS_LIBAV
|
||||
#if HAVE_LIBAV
|
||||
#include <libavresample/avresample.h>
|
||||
#endif
|
||||
#if HAVE_IS_FFMPEG
|
||||
#if HAVE_FFMPEG_MPV
|
||||
#include <libswresample/swresample.h>
|
||||
#endif
|
||||
|
||||
|
@ -197,10 +197,10 @@ bool print_libav_versions(struct mp_log *log, int v)
|
|||
{"libavformat", LIBAVFORMAT_VERSION_INT, avformat_version()},
|
||||
{"libswscale", LIBSWSCALE_VERSION_INT, swscale_version()},
|
||||
{"libavfilter", LIBAVFILTER_VERSION_INT, avfilter_version()},
|
||||
#if HAVE_IS_LIBAV
|
||||
#if HAVE_LIBAV
|
||||
{"libavresample", LIBAVRESAMPLE_VERSION_INT, avresample_version()},
|
||||
#endif
|
||||
#if HAVE_IS_FFMPEG
|
||||
#if HAVE_FFMPEG_MPV
|
||||
{"libswresample", LIBSWRESAMPLE_VERSION_INT, swresample_version()},
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -33,13 +33,10 @@
|
|||
#include <libavutil/avstring.h>
|
||||
#include <libavutil/mathematics.h>
|
||||
#include <libavutil/replaygain.h>
|
||||
#include <libavutil/spherical.h>
|
||||
#include <libavutil/display.h>
|
||||
#include <libavutil/opt.h>
|
||||
|
||||
#if HAVE_AVUTIL_SPHERICAL
|
||||
#include <libavutil/spherical.h>
|
||||
#endif
|
||||
|
||||
#include "common/msg.h"
|
||||
#include "common/tags.h"
|
||||
#include "common/av_common.h"
|
||||
|
@ -643,7 +640,6 @@ static void handle_new_stream(demuxer_t *demuxer, int i)
|
|||
sh->codec->rotate = (((int)(-r) % 360) + 360) % 360;
|
||||
}
|
||||
|
||||
#if HAVE_AVUTIL_SPHERICAL
|
||||
sd = av_stream_get_side_data(st, AV_PKT_DATA_SPHERICAL, NULL);
|
||||
if (sd) {
|
||||
AVSphericalMapping *sp = (void *)sd;
|
||||
|
@ -654,7 +650,6 @@ static void handle_new_stream(demuxer_t *demuxer, int i)
|
|||
mpsp->ref_angles[1] = sp->pitch / (float)(1 << 16);
|
||||
mpsp->ref_angles[2] = sp->roll / (float)(1 << 16);
|
||||
}
|
||||
#endif
|
||||
|
||||
// This also applies to vfw-muxed mkv, but we can't detect these easily.
|
||||
sh->codec->avi_dts = matches_avinputformat_name(priv, "avi");
|
||||
|
@ -810,13 +805,6 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
|
|||
if (index_mode != 1)
|
||||
avfc->flags |= AVFMT_FLAG_IGNIDX;
|
||||
|
||||
#if LIBAVFORMAT_VERSION_MICRO >= 100
|
||||
/* Keep side data as side data instead of mashing it into the packet
|
||||
* stream.
|
||||
* Note: Libav doesn't have this horrible insanity. */
|
||||
av_opt_set(avfc, "fflags", "+keepside", 0);
|
||||
#endif
|
||||
|
||||
if (lavfdopts->probesize) {
|
||||
if (av_opt_set_int(avfc, "probesize", lavfdopts->probesize, 0) < 0)
|
||||
MP_ERR(demuxer, "couldn't set option probesize to %u\n",
|
||||
|
|
|
@ -192,7 +192,7 @@ static const struct vd_lavc_hwdec mp_vd_lavc_crystalhd = {
|
|||
.copying = true,
|
||||
};
|
||||
|
||||
#if HAVE_VAAPI_HWACCEL
|
||||
#if HAVE_VAAPI
|
||||
static const struct vd_lavc_hwdec mp_vd_lavc_vaapi = {
|
||||
.type = HWDEC_VAAPI,
|
||||
.image_format = IMGFMT_VAAPI,
|
||||
|
@ -226,7 +226,7 @@ static const struct vd_lavc_hwdec mp_vd_lavc_vaapi_copy = {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if HAVE_VDPAU_HWACCEL
|
||||
#if HAVE_VDPAU
|
||||
static const struct vd_lavc_hwdec mp_vd_lavc_vdpau = {
|
||||
.type = HWDEC_VDPAU,
|
||||
.image_format = IMGFMT_VDPAU,
|
||||
|
@ -261,7 +261,7 @@ static const struct vd_lavc_hwdec *const hwdec_list[] = {
|
|||
&mp_vd_lavc_rpi,
|
||||
&mp_vd_lavc_rpi_copy,
|
||||
#endif
|
||||
#if HAVE_VDPAU_HWACCEL
|
||||
#if HAVE_VDPAU
|
||||
&mp_vd_lavc_vdpau,
|
||||
&mp_vd_lavc_vdpau_copy,
|
||||
#endif
|
||||
|
@ -269,7 +269,7 @@ static const struct vd_lavc_hwdec *const hwdec_list[] = {
|
|||
&mp_vd_lavc_videotoolbox,
|
||||
&mp_vd_lavc_videotoolbox_copy,
|
||||
#endif
|
||||
#if HAVE_VAAPI_HWACCEL
|
||||
#if HAVE_VAAPI
|
||||
&mp_vd_lavc_vaapi,
|
||||
&mp_vd_lavc_vaapi_copy,
|
||||
#endif
|
||||
|
@ -610,13 +610,9 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
|
|||
if (ctx->hwdec) {
|
||||
avctx->opaque = vd;
|
||||
avctx->thread_count = 1;
|
||||
#if HAVE_VDPAU_HWACCEL
|
||||
avctx->hwaccel_flags |= AV_HWACCEL_FLAG_IGNORE_LEVEL;
|
||||
#endif
|
||||
#ifdef AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH
|
||||
if (!lavc_param->check_hw_profile)
|
||||
avctx->hwaccel_flags |= AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH;
|
||||
#endif
|
||||
if (ctx->hwdec->image_format)
|
||||
avctx->get_format = get_format_hwdec;
|
||||
if (ctx->hwdec->allocate_image)
|
||||
|
@ -631,13 +627,8 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
|
|||
ctx->hwdec->create_standalone_dev;
|
||||
if (ctx->hwdec_dev->restore_device)
|
||||
ctx->hwdec_dev->restore_device(ctx->hwdec_dev);
|
||||
if (!ctx->hwdec->set_hwframes) {
|
||||
#if HAVE_VDPAU_HWACCEL || HAVE_CUDA_HWACCEL
|
||||
if (!ctx->hwdec->set_hwframes)
|
||||
avctx->hw_device_ctx = av_buffer_ref(ctx->hwdec_dev->av_device_ref);
|
||||
#else
|
||||
goto error;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
ctx->max_delay_queue = ctx->hwdec->delay_queue;
|
||||
ctx->hw_probing = true;
|
||||
|
@ -743,16 +734,14 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame,
|
|||
vd_ffmpeg_ctx *ctx = vd->priv;
|
||||
AVFrameSideData *sd;
|
||||
|
||||
#if HAVE_AVUTIL_CONTENT_LIGHT_LEVEL
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
// Get the content light metadata if available
|
||||
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
|
||||
if (sd) {
|
||||
AVContentLightMetadata *clm = (AVContentLightMetadata *)sd->data;
|
||||
params->color.sig_peak = clm->MaxCLL / MP_REF_WHITE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
// Otherwise, try getting the mastering metadata if available
|
||||
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
|
||||
if (!params->color.sig_peak && sd) {
|
||||
|
@ -772,8 +761,6 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame,
|
|||
params->stereo_in = vd->codec->stereo_mode;
|
||||
}
|
||||
|
||||
#if HAVE_AVCODEC_HW_FRAMES_PARAMS
|
||||
|
||||
static int init_generic_hwaccel(struct dec_video *vd, enum AVPixelFormat hw_fmt)
|
||||
{
|
||||
struct lavc_ctx *ctx = vd->priv;
|
||||
|
@ -865,141 +852,6 @@ error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// Allocate and set AVCodecContext.hw_frames_ctx. Also caches them on redundant
|
||||
// calls (useful because seeks issue get_format, which clears hw_frames_ctx).
|
||||
// device_ctx: reference to an AVHWDeviceContext
|
||||
// av_sw_format: AV_PIX_FMT_ for the underlying hardware frame format
|
||||
// initial_pool_size: number of frames in the memory pool on creation
|
||||
// Return >=0 on success, <0 on error.
|
||||
int hwdec_setup_hw_frames_ctx(struct lavc_ctx *ctx, AVBufferRef *device_ctx,
|
||||
int av_sw_format, int initial_pool_size)
|
||||
{
|
||||
int w = ctx->avctx->coded_width;
|
||||
int h = ctx->avctx->coded_height;
|
||||
int av_hw_format = imgfmt2pixfmt(ctx->hwdec_fmt);
|
||||
|
||||
if (!device_ctx) {
|
||||
MP_ERR(ctx, "Missing device context.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ctx->cached_hw_frames_ctx) {
|
||||
AVHWFramesContext *fctx = (void *)ctx->cached_hw_frames_ctx->data;
|
||||
if (fctx->width != w || fctx->height != h ||
|
||||
fctx->sw_format != av_sw_format ||
|
||||
fctx->format != av_hw_format)
|
||||
{
|
||||
av_buffer_unref(&ctx->cached_hw_frames_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ctx->cached_hw_frames_ctx) {
|
||||
ctx->cached_hw_frames_ctx = av_hwframe_ctx_alloc(device_ctx);
|
||||
if (!ctx->cached_hw_frames_ctx)
|
||||
return -1;
|
||||
|
||||
AVHWFramesContext *fctx = (void *)ctx->cached_hw_frames_ctx->data;
|
||||
|
||||
fctx->format = av_hw_format;
|
||||
fctx->sw_format = av_sw_format;
|
||||
fctx->width = w;
|
||||
fctx->height = h;
|
||||
|
||||
fctx->initial_pool_size = initial_pool_size;
|
||||
|
||||
if (ctx->hwdec->hwframes_refine)
|
||||
ctx->hwdec->hwframes_refine(ctx, ctx->cached_hw_frames_ctx);
|
||||
|
||||
int res = av_hwframe_ctx_init(ctx->cached_hw_frames_ctx);
|
||||
if (res < 0) {
|
||||
MP_ERR(ctx, "Failed to allocate hw frames.\n");
|
||||
av_buffer_unref(&ctx->cached_hw_frames_ctx);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
assert(!ctx->avctx->hw_frames_ctx);
|
||||
ctx->avctx->hw_frames_ctx = av_buffer_ref(ctx->cached_hw_frames_ctx);
|
||||
return ctx->avctx->hw_frames_ctx ? 0 : -1;
|
||||
}
|
||||
|
||||
static int init_generic_hwaccel(struct dec_video *vd, enum AVPixelFormat hw_fmt)
|
||||
{
|
||||
struct lavc_ctx *ctx = vd->priv;
|
||||
struct vd_lavc_hwdec *hwdec = ctx->hwdec;
|
||||
|
||||
if (!ctx->hwdec_dev)
|
||||
return -1;
|
||||
|
||||
if (!hwdec->set_hwframes)
|
||||
return 0;
|
||||
|
||||
// libavcodec has no way yet to communicate the exact surface format needed
|
||||
// for the frame pool, or the required minimum size of the frame pool.
|
||||
// Hopefully, this weakness in the libavcodec API will be fixed in the
|
||||
// future.
|
||||
// For the pixel format, we try to second-guess from what the libavcodec
|
||||
// software decoder would require (sw_pix_fmt). It could break and require
|
||||
// adjustment if new hwaccel surface formats are added.
|
||||
enum AVPixelFormat av_sw_format = AV_PIX_FMT_NONE;
|
||||
assert(hwdec->pixfmt_map);
|
||||
for (int n = 0; hwdec->pixfmt_map[n][0] != AV_PIX_FMT_NONE; n++) {
|
||||
if (ctx->avctx->sw_pix_fmt == hwdec->pixfmt_map[n][0]) {
|
||||
av_sw_format = hwdec->pixfmt_map[n][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hwdec->image_format == IMGFMT_VIDEOTOOLBOX)
|
||||
av_sw_format = imgfmt2pixfmt(vd->opts->videotoolbox_format);
|
||||
if (vd->opts->hwdec_image_format)
|
||||
av_sw_format = imgfmt2pixfmt(vd->opts->hwdec_image_format);
|
||||
|
||||
if (av_sw_format == AV_PIX_FMT_NONE) {
|
||||
MP_VERBOSE(ctx, "Unsupported hw decoding format: %s\n",
|
||||
mp_imgfmt_to_name(pixfmt2imgfmt(ctx->avctx->sw_pix_fmt)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// The video output might not support all formats.
|
||||
// Note that supported_formats==NULL means any are accepted.
|
||||
int *render_formats = ctx->hwdec_dev->supported_formats;
|
||||
if (render_formats) {
|
||||
int mp_format = pixfmt2imgfmt(av_sw_format);
|
||||
bool found = false;
|
||||
for (int n = 0; render_formats[n]; n++) {
|
||||
if (render_formats[n] == mp_format) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
MP_WARN(ctx, "Surface format %s not supported for direct rendering.\n",
|
||||
mp_imgfmt_to_name(mp_format));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int pool_size = 0;
|
||||
if (hwdec->static_pool)
|
||||
pool_size = hwdec_get_max_refs(ctx) + HWDEC_EXTRA_SURFACES;
|
||||
|
||||
ctx->hwdec_fmt = hwdec->image_format;
|
||||
|
||||
if (hwdec->image_format == IMGFMT_VDPAU &&
|
||||
ctx->avctx->codec_id == AV_CODEC_ID_HEVC)
|
||||
{
|
||||
MP_WARN(ctx, "HEVC video output may be broken due to nVidia bugs.\n");
|
||||
}
|
||||
|
||||
return hwdec_setup_hw_frames_ctx(ctx, ctx->hwdec_dev->av_device_ref,
|
||||
av_sw_format, pool_size);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
|
||||
const enum AVPixelFormat *fmt)
|
||||
{
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
|
||||
#include "video/filter/vf.h"
|
||||
|
||||
#define HAVE_OPAQUE_REF (LIBAVUTIL_VERSION_MICRO >= 100 && \
|
||||
LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 47, 100))
|
||||
|
||||
const struct m_opt_choice_alternatives mp_spherical_names[] = {
|
||||
{"auto", MP_SPHERICAL_AUTO},
|
||||
{"none", MP_SPHERICAL_NONE},
|
||||
|
@ -864,16 +861,14 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
|
|||
|
||||
dst->params.chroma_location = avchroma_location_to_mp(src->chroma_location);
|
||||
|
||||
#if HAVE_OPAQUE_REF
|
||||
if (src->opaque_ref) {
|
||||
struct mp_image_params *p = (void *)src->opaque_ref->data;
|
||||
dst->params.rotate = p->rotate;
|
||||
dst->params.stereo_in = p->stereo_in;
|
||||
dst->params.stereo_out = p->stereo_out;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_AVUTIL_ICC_PROFILE
|
||||
#if LIBAVUTIL_VERSION_MICRO >= 100
|
||||
sd = av_frame_get_side_data(src, AV_FRAME_DATA_ICC_PROFILE);
|
||||
if (sd)
|
||||
dst->icc_profile = av_buffer_ref(sd->buf);
|
||||
|
@ -940,14 +935,12 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src)
|
|||
|
||||
dst->chroma_location = mp_chroma_location_to_av(src->params.chroma_location);
|
||||
|
||||
#if HAVE_OPAQUE_REF
|
||||
dst->opaque_ref = av_buffer_alloc(sizeof(struct mp_image_params));
|
||||
if (!dst->opaque_ref)
|
||||
abort();
|
||||
*(struct mp_image_params *)dst->opaque_ref->data = src->params;
|
||||
#endif
|
||||
|
||||
#if HAVE_AVUTIL_ICC_PROFILE
|
||||
#if LIBAVUTIL_VERSION_MICRO >= 100
|
||||
if (src->icc_profile) {
|
||||
AVFrameSideData *sd =
|
||||
ffmpeg_garbage(dst, AV_FRAME_DATA_ICC_PROFILE, new_ref->icc_profile);
|
||||
|
|
121
wscript
121
wscript
|
@ -425,31 +425,27 @@ iconv support use --disable-iconv.",
|
|||
}
|
||||
]
|
||||
|
||||
ffmpeg_version = "3.2.2"
|
||||
ffmpeg_pkg_config_checks = [
|
||||
'libavutil', '>= 55.34.100',
|
||||
'libavcodec', '>= 57.64.100',
|
||||
'libavformat', '>= 57.56.100',
|
||||
'libswscale', '>= 4.2.100',
|
||||
'libavfilter', '>= 6.65.100',
|
||||
'libswresample', '>= 2.3.100',
|
||||
'libavutil', '>= 56.0.100',
|
||||
'libavcodec', '>= 58.2.100',
|
||||
'libavformat', '>= 58.0.102',
|
||||
'libswscale', '>= 5.0.101',
|
||||
'libavfilter', '>= 7.0.101',
|
||||
'libswresample', '>= 3.0.100',
|
||||
]
|
||||
libav_version = "12"
|
||||
libav_pkg_config_checks = [
|
||||
'libavutil', '>= 55.20.0',
|
||||
'libavcodec', '>= 57.25.0',
|
||||
'libavformat', '>= 57.7.0',
|
||||
'libswscale', '>= 4.0.0',
|
||||
'libavfilter', '>= 6.7.0',
|
||||
'libavresample', '>= 3.0.0',
|
||||
'libavutil', '>= 56.6.0',
|
||||
'libavcodec', '>= 58.5.0',
|
||||
'libavformat', '>= 58.1.0',
|
||||
'libswscale', '>= 5.0.0',
|
||||
'libavfilter', '>= 7.0.0',
|
||||
'libavresample', '>= 4.0.0',
|
||||
]
|
||||
|
||||
libav_versions_string = "FFmpeg %s or Libav %s" % (ffmpeg_version, libav_version)
|
||||
|
||||
def check_ffmpeg_or_libav_versions():
|
||||
def fn(ctx, dependency_identifier, **kw):
|
||||
versions = ffmpeg_pkg_config_checks
|
||||
if ctx.dependency_satisfied('is_libav'):
|
||||
if ctx.dependency_satisfied('libav'):
|
||||
versions = libav_pkg_config_checks
|
||||
return check_pkg_config(*versions)(ctx, dependency_identifier, **kw)
|
||||
return fn
|
||||
|
@ -462,67 +458,44 @@ libav_dependencies = [
|
|||
'req': True,
|
||||
'fmsg': "FFmpeg/Libav development files not found.",
|
||||
}, {
|
||||
'name': 'is_ffmpeg_garbage',
|
||||
'name': 'ffmpeg_mpv',
|
||||
'desc': 'libav* is FFmpeg mpv modified version',
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[LIBAVCODEC_MPV ? 1 : -1]',
|
||||
use='libavcodec')
|
||||
}, {
|
||||
'name': 'ffmpeg_garbage',
|
||||
'deps': '!ffmpeg_mpv',
|
||||
'desc': 'libav* is upstream FFmpeg (unsupported)',
|
||||
# FFmpeg <=> LIBAVUTIL_VERSION_MICRO>=100
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[LIBAVCODEC_VERSION_MICRO >= 100 ? 1 : -1]',
|
||||
use='libavcodec')
|
||||
}, {
|
||||
'name': 'is_ffmpeg',
|
||||
'desc': 'libav* is FFmpeg mpv modified version',
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[LIBAVCODEC_MPV ? 1 : -1]',
|
||||
use='libavcodec')
|
||||
}, {
|
||||
# This check should always result in the opposite of is_ffmpeg.
|
||||
# Run it to make sure is_ffmpeg didn't fail for some other reason than
|
||||
# the actual version check.
|
||||
'name': 'is_libav',
|
||||
'name': 'libav',
|
||||
'desc': 'libav* is Libav',
|
||||
# FFmpeg <=> LIBAVUTIL_VERSION_MICRO>=100
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[LIBAVCODEC_VERSION_MICRO >= 100 ? -1 : 1]',
|
||||
use='libavcodec')
|
||||
}, {
|
||||
'name': 'libav',
|
||||
'name': 'libav-any',
|
||||
'desc': 'Libav/FFmpeg library versions',
|
||||
'deps': 'is_ffmpeg || is_libav',
|
||||
'deps': 'ffmpeg_mpv || libav',
|
||||
'func': check_ffmpeg_or_libav_versions(),
|
||||
'req': True,
|
||||
'fmsg': "Unable to find development files for some of the required \
|
||||
FFmpeg/Libav libraries. You need at least {0}. For FFmpeg, the mpv fork, that \
|
||||
FFmpeg/Libav libraries. You need git master. For FFmpeg, the mpv fork, that \
|
||||
might contain additional fixes and features is required. It is available on \
|
||||
https://github.com/mpv-player/ffmpeg-mpv Aborting.".format(libav_versions_string)
|
||||
https://github.com/mpv-player/ffmpeg-mpv Aborting."
|
||||
}, {
|
||||
'name': '--libavdevice',
|
||||
'desc': 'libavdevice',
|
||||
'func': check_pkg_config('libavdevice', '>= 57.0.0'),
|
||||
}, {
|
||||
'name': 'avutil-content-light-level',
|
||||
'desc': 'libavutil content light level struct',
|
||||
'func': check_statement('libavutil/frame.h',
|
||||
'AV_FRAME_DATA_CONTENT_LIGHT_LEVEL',
|
||||
use='libav'),
|
||||
}, {
|
||||
'name': 'avutil-icc-profile',
|
||||
'desc': 'libavutil ICC profile side data',
|
||||
'func': check_statement('libavutil/frame.h',
|
||||
'AV_FRAME_DATA_ICC_PROFILE',
|
||||
use='libav'),
|
||||
}, {
|
||||
'name': 'avutil-spherical',
|
||||
'desc': 'libavutil spherical side data',
|
||||
'func': check_statement('libavutil/spherical.h',
|
||||
'AV_SPHERICAL_EQUIRECTANGULAR',
|
||||
use='libav'),
|
||||
}, {
|
||||
'name': 'avcodec-hw-frames-params',
|
||||
'desc': 'libavcodec avcodec_get_hw_frames_parameters()',
|
||||
'func': check_statement('libavcodec/avcodec.h',
|
||||
'avcodec_get_hw_frames_parameters(0,0,0,0)',
|
||||
use='libav'),
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
audio_output_features = [
|
||||
|
@ -847,53 +820,21 @@ video_output_features = [
|
|||
|
||||
hwaccel_features = [
|
||||
{
|
||||
'name': '--vaapi-hwaccel',
|
||||
'desc': 'libavcodec VAAPI hwaccel (FFmpeg 3.3 API)',
|
||||
'deps': 'vaapi',
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 26, 0) && '
|
||||
' LIBAVCODEC_VERSION_MICRO < 100) ||'
|
||||
' (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 74, 100) && '
|
||||
' LIBAVCODEC_VERSION_MICRO >= 100)'
|
||||
' ? 1 : -1]',
|
||||
use='libav'),
|
||||
}, {
|
||||
'name': 'videotoolbox-hwaccel',
|
||||
'desc': 'libavcodec videotoolbox hwaccel (new API)',
|
||||
'desc': 'libavcodec videotoolbox hwaccel',
|
||||
'deps': 'gl-cocoa || ios-gl',
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 96, 100) && '
|
||||
' LIBAVCODEC_VERSION_MICRO >= 100)'
|
||||
' ? 1 : -1]',
|
||||
use='libav'),
|
||||
'func': check_true,
|
||||
}, {
|
||||
'name': '--videotoolbox-gl',
|
||||
'desc': 'Videotoolbox with OpenGL',
|
||||
'deps': 'gl-cocoa && videotoolbox-hwaccel',
|
||||
'func': check_true
|
||||
}, {
|
||||
'name': '--vdpau-hwaccel',
|
||||
'desc': 'libavcodec VDPAU hwaccel (FFmpeg 3.3 API)',
|
||||
'deps': 'vdpau',
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 37, 1) && '
|
||||
' LIBAVCODEC_VERSION_MICRO < 100) ||'
|
||||
' (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 85, 101) && '
|
||||
' LIBAVCODEC_VERSION_MICRO >= 100)'
|
||||
' ? 1 : -1]',
|
||||
use='libav'),
|
||||
}, {
|
||||
# (conflated with ANGLE for easier deps)
|
||||
'name': '--d3d-hwaccel',
|
||||
'desc': 'D3D11VA hwaccel (new API, plus ANGLE)',
|
||||
'desc': 'D3D11VA hwaccel (plus ANGLE)',
|
||||
'deps': 'os-win32 && egl-angle',
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 4, 0) && '
|
||||
' LIBAVCODEC_VERSION_MICRO < 100) ||'
|
||||
' (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 100, 100) && '
|
||||
' LIBAVCODEC_VERSION_MICRO >= 100)'
|
||||
' ? 1 : -1]',
|
||||
use='libav'),
|
||||
'func': check_true,
|
||||
}, {
|
||||
'name': '--d3d9-hwaccel',
|
||||
'desc': 'DXVA2 hwaccel (plus ANGLE)',
|
||||
|
|
Loading…
Reference in New Issue