diff options
author | wm4 <wm4@nowhere> | 2020-02-16 15:14:55 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-02-16 15:14:55 +0100 |
commit | 7d11eda72e90d7aa9df25127bd810aa7b191029c (patch) | |
tree | 5c474862236dc62d136fe44dfdf3737bc808b829 /video | |
parent | a4eb8f75c0644ce5cf7c0bcea6b3efd2a886027d (diff) | |
download | mpv-7d11eda72e90d7aa9df25127bd810aa7b191029c.tar.bz2 mpv-7d11eda72e90d7aa9df25127bd810aa7b191029c.tar.xz |
Remove remains of Libav compatibility
Libav seems rather dead: no release for 2 years, no new git commits in
master for almost a year (with one exception ~6 months ago). From what I
can tell, some developers resigned themselves to the horrifying idea to
post patches to ffmpeg-devel instead, while the rest of the developers
went on to greener pastures.
Libav was a better project than FFmpeg. Unfortunately, FFmpeg won,
because it managed to keep the name and website. Libav was pushed more
and more into obscurity: while there was initially a big push for Libav,
FFmpeg just remained "in place" and visible for most people. FFmpeg was
slowly draining all manpower and energy from Libav. A big part of this
was that FFmpeg stole code from Libav (regular merges of the entire
Libav git tree), making it some sort of Frankenstein mirror of Libav,
think decaying zombie with additional legs ("features") nailed to it.
"Stealing" surely is the wrong word; I'm just aping the language that
some of the FFmpeg members used to use. All that is in the past now, I'm
probably the only person left who is annoyed by this, and with this
commit I'm putting this decade long problem finally to an end. I just
thought I'd express my annoyance about this fucking shitshow one last
time.
The most intrusive change in this commit is the resample filter, which
originally used libavresample. Since the FFmpeg developer refused to
enable libavresample by default for drama reasons, and the API was
slightly different, so the filter used some big preprocessor mess to
make it compatible to libswresample. All that falls away now. The
simplification to the build system is also significant.
Diffstat (limited to 'video')
-rw-r--r-- | video/decode/vd_lavc.c | 5 | ||||
-rw-r--r-- | video/fmt-conversion.c | 19 | ||||
-rw-r--r-- | video/img_format.c | 8 | ||||
-rw-r--r-- | video/mp_image.c | 7 | ||||
-rw-r--r-- | video/out/gpu/hwdec.c | 2 | ||||
-rw-r--r-- | video/sws_utils.c | 2 |
6 files changed, 1 insertions, 42 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 8f892462a1..b41c4c48c6 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -628,10 +628,7 @@ static void init_avctx(struct mp_filter *vd) goto error; avctx->codec_type = AVMEDIA_TYPE_VIDEO; avctx->codec_id = lavc_codec->id; - -#if LIBAVCODEC_VERSION_MICRO >= 100 avctx->pkt_timebase = ctx->codec_timebase; -#endif ctx->pic = av_frame_alloc(); if (!ctx->pic) @@ -1105,10 +1102,8 @@ static int decode_frame(struct mp_filter *vd) mpi->pts = mp_pts_from_av(ctx->pic->pts, &ctx->codec_timebase); mpi->dts = mp_pts_from_av(ctx->pic->pkt_dts, &ctx->codec_timebase); -#if LIBAVCODEC_VERSION_MICRO >= 100 mpi->pkt_duration = mp_pts_from_av(ctx->pic->pkt_duration, &ctx->codec_timebase); -#endif av_frame_unref(ctx->pic); diff --git a/video/fmt-conversion.c b/video/fmt-conversion.c index 9f3c6380ff..e18b6a1f8f 100644 --- a/video/fmt-conversion.c +++ b/video/fmt-conversion.c @@ -36,9 +36,7 @@ static const struct { {IMGFMT_PAL8, AV_PIX_FMT_PAL8}, {IMGFMT_UYVY, AV_PIX_FMT_UYVY422}, {IMGFMT_NV12, AV_PIX_FMT_NV12}, -#if LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(56, 27, 0) {IMGFMT_NV24, AV_PIX_FMT_NV24}, -#endif {IMGFMT_Y8, AV_PIX_FMT_GRAY8}, {IMGFMT_Y16, AV_PIX_FMT_GRAY16}, {IMGFMT_420P, AV_PIX_FMT_YUV420P}, @@ -49,40 +47,23 @@ static const struct { {IMGFMT_420P, AV_PIX_FMT_YUVJ420P}, {IMGFMT_444P, AV_PIX_FMT_YUVJ444P}, -#if LIBAVUTIL_VERSION_MICRO >= 100 {IMGFMT_BGR0, AV_PIX_FMT_BGR0}, {IMGFMT_0RGB, AV_PIX_FMT_0RGB}, {IMGFMT_RGB0, AV_PIX_FMT_RGB0}, {IMGFMT_0BGR, AV_PIX_FMT_0BGR}, -#else - {IMGFMT_BGR0, AV_PIX_FMT_BGRA}, - {IMGFMT_0RGB, AV_PIX_FMT_ARGB}, - {IMGFMT_RGB0, AV_PIX_FMT_RGBA}, - {IMGFMT_0BGR, AV_PIX_FMT_ABGR}, -#endif {IMGFMT_RGBA64, AV_PIX_FMT_RGBA64}, {IMGFMT_VDPAU, AV_PIX_FMT_VDPAU}, -#if HAVE_VIDEOTOOLBOX_HWACCEL {IMGFMT_VIDEOTOOLBOX, AV_PIX_FMT_VIDEOTOOLBOX}, -#endif -#if HAVE_ANDROID {IMGFMT_MEDIACODEC, AV_PIX_FMT_MEDIACODEC}, -#endif {IMGFMT_VAAPI, AV_PIX_FMT_VAAPI}, {IMGFMT_DXVA2, AV_PIX_FMT_DXVA2_VLD}, -#if HAVE_D3D_HWACCEL {IMGFMT_D3D11, AV_PIX_FMT_D3D11}, -#endif {IMGFMT_MMAL, AV_PIX_FMT_MMAL}, -#if HAVE_CUDA_HWACCEL {IMGFMT_CUDA, AV_PIX_FMT_CUDA}, -#endif {IMGFMT_P010, AV_PIX_FMT_P010}, -#if HAVE_DRMPRIME {IMGFMT_DRMPRIME, AV_PIX_FMT_DRM_PRIME}, -#endif {0, AV_PIX_FMT_NONE} }; diff --git a/video/img_format.c b/video/img_format.c index a21ba6f9cb..63fdb34898 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -377,10 +377,8 @@ enum mp_component_type mp_imgfmt_get_component_type(int imgfmt) if (!pixdesc || (pixdesc->flags & AV_PIX_FMT_FLAG_HWACCEL)) return MP_COMPONENT_TYPE_UNKNOWN; -#if LIBAVUTIL_VERSION_MICRO >= 100 if (pixdesc->flags & AV_PIX_FMT_FLAG_FLOAT) return MP_COMPONENT_TYPE_FLOAT; -#endif return MP_COMPONENT_TYPE_UINT; } @@ -509,10 +507,8 @@ bool mp_get_regular_imgfmt(struct mp_regular_imgfmt *dst, int imgfmt) res.chroma_w = 1 << pixdesc->log2_chroma_w; res.chroma_h = 1 << pixdesc->log2_chroma_h; -#if LIBAVUTIL_VERSION_MICRO >= 100 if (pixdesc->flags & AV_PIX_FMT_FLAG_BAYER) return false; // it's satan himself -#endif res.forced_csp = mp_imgfmt_get_forced_csp(imgfmt); @@ -574,10 +570,6 @@ int mp_imgfmt_find(int xs, int ys, int planes, int component_bits, int flags) return 0; } -#if LIBAVUTIL_VERSION_MICRO < 100 -#define avcodec_find_best_pix_fmt_of_list avcodec_find_best_pix_fmt2 -#endif - // Compare the dst image formats, and return the one which can carry more data // (e.g. higher depth, more color components, lower chroma subsampling, etc.), // with respect to what is required to keep most of the src format. diff --git a/video/mp_image.c b/video/mp_image.c index ef2fa488ad..ea04bab26e 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -25,10 +25,7 @@ #include <libavutil/hwcontext.h> #include <libavutil/rational.h> #include <libavcodec/avcodec.h> - -#if LIBAVUTIL_VERSION_MICRO >= 100 #include <libavutil/mastering_display_metadata.h> -#endif #include "mpv_talloc.h" @@ -867,7 +864,6 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src) dst->params.color.light = p->color.light; } -#if LIBAVUTIL_VERSION_MICRO >= 100 sd = av_frame_get_side_data(src, AV_FRAME_DATA_ICC_PROFILE); if (sd) dst->icc_profile = sd->buf; @@ -899,7 +895,6 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src) }; MP_TARRAY_APPEND(NULL, dst->ff_side_data, dst->num_ff_side_data, mpsd); } -#endif if (dst->hwctx) { AVHWFramesContext *fctx = (void *)dst->hwctx->data; @@ -968,7 +963,6 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src) abort(); *(struct mp_image_params *)dst->opaque_ref->data = src->params; -#if LIBAVUTIL_VERSION_MICRO >= 100 if (src->icc_profile) { AVFrameSideData *sd = av_frame_new_side_data_from_buf(dst, AV_FRAME_DATA_ICC_PROFILE, @@ -998,7 +992,6 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src) mpsd->buf = NULL; } } -#endif talloc_free(new_ref); diff --git a/video/out/gpu/hwdec.c b/video/out/gpu/hwdec.c index c07dbf9fd0..db75c64b05 100644 --- a/video/out/gpu/hwdec.c +++ b/video/out/gpu/hwdec.c @@ -73,7 +73,7 @@ const struct ra_hwdec_driver *const ra_hwdec_drivers[] = { #if HAVE_RPI_MMAL &ra_hwdec_rpi_overlay, #endif -#if HAVE_DRMPRIME && HAVE_DRM +#if HAVE_DRM &ra_hwdec_drmprime_drm, #endif diff --git a/video/sws_utils.c b/video/sws_utils.c index 855c1ba821..55faadb1ee 100644 --- a/video/sws_utils.c +++ b/video/sws_utils.c @@ -285,7 +285,6 @@ int mp_sws_reinit(struct mp_sws_context *ctx) av_opt_set_double(ctx->sws, "param0", ctx->params[0], 0); av_opt_set_double(ctx->sws, "param1", ctx->params[1], 0); -#if LIBAVCODEC_VERSION_MICRO >= 100 int cr_src = mp_chroma_location_to_av(src->chroma_location); int cr_dst = mp_chroma_location_to_av(dst->chroma_location); int cr_xpos, cr_ypos; @@ -297,7 +296,6 @@ int mp_sws_reinit(struct mp_sws_context *ctx) av_opt_set_int(ctx->sws, "dst_h_chr_pos", cr_xpos, 0); av_opt_set_int(ctx->sws, "dst_v_chr_pos", cr_ypos, 0); } -#endif // This can fail even with normal operation, e.g. if a conversion path // simply does not support these settings. |