diff --git a/mpvcore/encode_lavc.c b/mpvcore/encode_lavc.c index 84d726cfdc..d2017a7f37 100644 --- a/mpvcore/encode_lavc.c +++ b/mpvcore/encode_lavc.c @@ -754,19 +754,19 @@ int encode_lavc_write_frame(struct encode_lavc_context *ctx, AVPacket *packet) } int encode_lavc_supports_pixfmt(struct encode_lavc_context *ctx, - enum PixelFormat pix_fmt) + enum AVPixelFormat pix_fmt) { CHECK_FAIL(ctx, 0); if (!ctx->vc) return 0; - if (pix_fmt == PIX_FMT_NONE) + if (pix_fmt == AV_PIX_FMT_NONE) return 0; if (!ctx->vc->pix_fmts) return VFCAP_CSP_SUPPORTED; else { - const enum PixelFormat *p; + const enum AVPixelFormat *p; for (p = ctx->vc->pix_fmts; *p >= 0; ++p) { if (pix_fmt == *p) return VFCAP_CSP_SUPPORTED; diff --git a/mpvcore/encode_lavc.h b/mpvcore/encode_lavc.h index f47825e1d7..15e0a5c7f2 100644 --- a/mpvcore/encode_lavc.h +++ b/mpvcore/encode_lavc.h @@ -79,7 +79,7 @@ struct encode_lavc_context { AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx, enum AVMediaType mt); void encode_lavc_write_stats(struct encode_lavc_context *ctx, AVStream *stream); int encode_lavc_write_frame(struct encode_lavc_context *ctx, AVPacket *packet); -int encode_lavc_supports_pixfmt(struct encode_lavc_context *ctx, enum PixelFormat format); +int encode_lavc_supports_pixfmt(struct encode_lavc_context *ctx, enum AVPixelFormat format); AVCodec *encode_lavc_get_codec(struct encode_lavc_context *ctx, AVStream *stream); int encode_lavc_open_codec(struct encode_lavc_context *ctx, AVStream *stream); int encode_lavc_available(struct encode_lavc_context *ctx); diff --git a/old-configure b/old-configure index 564b1c9331..d5592be408 100755 --- a/old-configure +++ b/old-configure @@ -2600,7 +2600,7 @@ fi echores "$_lcms2" -all_libav_libs="libavutil > 51.73.0:libavcodec > 54.34.0:libavformat > 54.19.0:libswscale >= 2.0.0" +all_libav_libs="libavutil >= 52.3.0:libavcodec > 54.34.0:libavformat > 54.19.0:libswscale >= 2.0.0" echocheck "Libav ($all_libav_libs)" if test "$ffmpeg" = auto ; then IFS=":" # shell should not be used for programming diff --git a/video/decode/lavc.h b/video/decode/lavc.h index 2fdfae41f1..5007b80a0f 100644 --- a/video/decode/lavc.h +++ b/video/decode/lavc.h @@ -27,7 +27,7 @@ typedef struct lavc_ctx { AVCodecContext *avctx; AVFrame *pic; struct vd_lavc_hwdec *hwdec; - enum PixelFormat pix_fmt; + enum AVPixelFormat pix_fmt; int do_hw_dr1; int best_csp; struct mp_image_params image_params; diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 32bbca969f..868f148d8b 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -65,8 +65,8 @@ static void init_avctx(struct dec_video *vd, const char *decoder, static void uninit_avctx(struct dec_video *vd); static void setup_refcounting_hw(struct AVCodecContext *s); -static enum PixelFormat get_format_hwdec(struct AVCodecContext *avctx, - const enum PixelFormat *pix_fmt); +static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx, + const enum AVPixelFormat *pix_fmt); static void uninit(struct dec_video *vd); @@ -383,7 +383,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder, ctx->hwdec_info = &vd->hwdec_info; ctx->do_dr1 = ctx->do_hw_dr1 = 0; - ctx->pix_fmt = PIX_FMT_NONE; + ctx->pix_fmt = AV_PIX_FMT_NONE; ctx->image_params = (struct mp_image_params){0}; ctx->vo_image_params = (struct mp_image_params){0}; ctx->hwdec = hwdec; @@ -542,20 +542,20 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame) }; } -static enum PixelFormat get_format_hwdec(struct AVCodecContext *avctx, - const enum PixelFormat *fmt) +static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx, + const enum AVPixelFormat *fmt) { struct dec_video *vd = avctx->opaque; vd_ffmpeg_ctx *ctx = vd->priv; mp_msg(MSGT_DECVIDEO, MSGL_V, "Pixel formats supported by decoder:"); - for (int i = 0; fmt[i] != PIX_FMT_NONE; i++) + for (int i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) mp_msg(MSGT_DECVIDEO, MSGL_V, " %s", av_get_pix_fmt_name(fmt[i])); mp_msg(MSGT_DECVIDEO, MSGL_V, "\n"); assert(ctx->hwdec); - for (int i = 0; fmt[i] != PIX_FMT_NONE; i++) { + for (int i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) { const int *okfmt = ctx->hwdec->image_formats; for (int n = 0; okfmt && okfmt[n]; n++) { if (imgfmt2pixfmt(okfmt[n]) == fmt[i]) @@ -563,7 +563,7 @@ static enum PixelFormat get_format_hwdec(struct AVCodecContext *avctx, } } - return PIX_FMT_NONE; + return AV_PIX_FMT_NONE; } static struct mp_image *get_surface_hwdec(struct dec_video *vd, AVFrame *pic) diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c index 6ac9d43eb9..d195cf230e 100644 --- a/video/filter/vf_scale.c +++ b/video/filter/vf_scale.c @@ -157,7 +157,7 @@ static int preferred_conversions[][2] = { static int check_outfmt(vf_instance_t *vf, int outfmt) { enum AVPixelFormat pixfmt = imgfmt2pixfmt(outfmt); - if (pixfmt == PIX_FMT_NONE || sws_isSupportedOutput(pixfmt) < 1) + if (pixfmt == AV_PIX_FMT_NONE || sws_isSupportedOutput(pixfmt) < 1) return 0; return vf_next_query_format(vf, outfmt); } @@ -375,7 +375,7 @@ static int control(struct vf_instance *vf, int request, void *data) static int query_format(struct vf_instance *vf, unsigned int fmt) { - if (!IMGFMT_IS_HWACCEL(fmt) && imgfmt2pixfmt(fmt) != PIX_FMT_NONE) { + if (!IMGFMT_IS_HWACCEL(fmt) && imgfmt2pixfmt(fmt) != AV_PIX_FMT_NONE) { if (sws_isSupportedInput(imgfmt2pixfmt(fmt)) < 1) return 0; unsigned int best = find_best_out(vf, fmt); diff --git a/video/fmt-conversion.c b/video/fmt-conversion.c index 371e81c399..ab115b0010 100644 --- a/video/fmt-conversion.c +++ b/video/fmt-conversion.c @@ -24,92 +24,92 @@ static const struct { int fmt; - enum PixelFormat pix_fmt; + enum AVPixelFormat pix_fmt; } conversion_map[] = { - {IMGFMT_ARGB, PIX_FMT_ARGB}, - {IMGFMT_BGRA, PIX_FMT_BGRA}, - {IMGFMT_BGR24, PIX_FMT_BGR24}, - {IMGFMT_BGR16_BE, PIX_FMT_RGB565BE}, - {IMGFMT_BGR16_LE, PIX_FMT_RGB565LE}, - {IMGFMT_BGR15_BE, PIX_FMT_RGB555BE}, - {IMGFMT_BGR15_LE, PIX_FMT_RGB555LE}, - {IMGFMT_BGR12_BE, PIX_FMT_RGB444BE}, - {IMGFMT_BGR12_LE, PIX_FMT_RGB444LE}, - {IMGFMT_BGR8, PIX_FMT_RGB8}, - {IMGFMT_BGR4, PIX_FMT_RGB4}, - {IMGFMT_MONO, PIX_FMT_MONOBLACK}, - {IMGFMT_MONO_W, PIX_FMT_MONOWHITE}, - {IMGFMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE}, - {IMGFMT_BGR4_BYTE, PIX_FMT_RGB4_BYTE}, - {IMGFMT_RGB48_LE, PIX_FMT_RGB48LE}, - {IMGFMT_RGB48_BE, PIX_FMT_RGB48BE}, - {IMGFMT_ABGR, PIX_FMT_ABGR}, - {IMGFMT_RGBA, PIX_FMT_RGBA}, - {IMGFMT_RGB24, PIX_FMT_RGB24}, - {IMGFMT_RGB16_BE, PIX_FMT_BGR565BE}, - {IMGFMT_RGB16_LE, PIX_FMT_BGR565LE}, - {IMGFMT_RGB15_BE, PIX_FMT_BGR555BE}, - {IMGFMT_RGB15_LE, PIX_FMT_BGR555LE}, - {IMGFMT_RGB12_BE, PIX_FMT_BGR444BE}, - {IMGFMT_RGB12_LE, PIX_FMT_BGR444LE}, - {IMGFMT_RGB8, PIX_FMT_BGR8}, - {IMGFMT_RGB4, PIX_FMT_BGR4}, - {IMGFMT_PAL8, PIX_FMT_PAL8}, - {IMGFMT_GBRP, PIX_FMT_GBRP}, - {IMGFMT_GBRP9_BE, PIX_FMT_GBRP9BE}, - {IMGFMT_GBRP9_LE, PIX_FMT_GBRP9LE}, - {IMGFMT_GBRP10_BE, PIX_FMT_GBRP10BE}, - {IMGFMT_GBRP10_LE, PIX_FMT_GBRP10LE}, - {IMGFMT_GBRP16_BE, PIX_FMT_GBRP16BE}, - {IMGFMT_GBRP16_LE, PIX_FMT_GBRP16LE}, - {IMGFMT_YUYV, PIX_FMT_YUYV422}, - {IMGFMT_UYVY, PIX_FMT_UYVY422}, - {IMGFMT_NV12, PIX_FMT_NV12}, - {IMGFMT_NV21, PIX_FMT_NV21}, - {IMGFMT_Y8, PIX_FMT_GRAY8}, + {IMGFMT_ARGB, AV_PIX_FMT_ARGB}, + {IMGFMT_BGRA, AV_PIX_FMT_BGRA}, + {IMGFMT_BGR24, AV_PIX_FMT_BGR24}, + {IMGFMT_BGR16_BE, AV_PIX_FMT_RGB565BE}, + {IMGFMT_BGR16_LE, AV_PIX_FMT_RGB565LE}, + {IMGFMT_BGR15_BE, AV_PIX_FMT_RGB555BE}, + {IMGFMT_BGR15_LE, AV_PIX_FMT_RGB555LE}, + {IMGFMT_BGR12_BE, AV_PIX_FMT_RGB444BE}, + {IMGFMT_BGR12_LE, AV_PIX_FMT_RGB444LE}, + {IMGFMT_BGR8, AV_PIX_FMT_RGB8}, + {IMGFMT_BGR4, AV_PIX_FMT_RGB4}, + {IMGFMT_MONO, AV_PIX_FMT_MONOBLACK}, + {IMGFMT_MONO_W, AV_PIX_FMT_MONOWHITE}, + {IMGFMT_RGB4_BYTE, AV_PIX_FMT_BGR4_BYTE}, + {IMGFMT_BGR4_BYTE, AV_PIX_FMT_RGB4_BYTE}, + {IMGFMT_RGB48_LE, AV_PIX_FMT_RGB48LE}, + {IMGFMT_RGB48_BE, AV_PIX_FMT_RGB48BE}, + {IMGFMT_ABGR, AV_PIX_FMT_ABGR}, + {IMGFMT_RGBA, AV_PIX_FMT_RGBA}, + {IMGFMT_RGB24, AV_PIX_FMT_RGB24}, + {IMGFMT_RGB16_BE, AV_PIX_FMT_BGR565BE}, + {IMGFMT_RGB16_LE, AV_PIX_FMT_BGR565LE}, + {IMGFMT_RGB15_BE, AV_PIX_FMT_BGR555BE}, + {IMGFMT_RGB15_LE, AV_PIX_FMT_BGR555LE}, + {IMGFMT_RGB12_BE, AV_PIX_FMT_BGR444BE}, + {IMGFMT_RGB12_LE, AV_PIX_FMT_BGR444LE}, + {IMGFMT_RGB8, AV_PIX_FMT_BGR8}, + {IMGFMT_RGB4, AV_PIX_FMT_BGR4}, + {IMGFMT_PAL8, AV_PIX_FMT_PAL8}, + {IMGFMT_GBRP, AV_PIX_FMT_GBRP}, + {IMGFMT_GBRP9_BE, AV_PIX_FMT_GBRP9BE}, + {IMGFMT_GBRP9_LE, AV_PIX_FMT_GBRP9LE}, + {IMGFMT_GBRP10_BE, AV_PIX_FMT_GBRP10BE}, + {IMGFMT_GBRP10_LE, AV_PIX_FMT_GBRP10LE}, + {IMGFMT_GBRP16_BE, AV_PIX_FMT_GBRP16BE}, + {IMGFMT_GBRP16_LE, AV_PIX_FMT_GBRP16LE}, + {IMGFMT_YUYV, AV_PIX_FMT_YUYV422}, + {IMGFMT_UYVY, AV_PIX_FMT_UYVY422}, + {IMGFMT_NV12, AV_PIX_FMT_NV12}, + {IMGFMT_NV21, AV_PIX_FMT_NV21}, + {IMGFMT_Y8, AV_PIX_FMT_GRAY8}, // Support really ancient ffmpeg versions (before e91946ed23dfbb) - // Newer versions use PIX_FMT_GRAY8A - {IMGFMT_YA8, PIX_FMT_Y400A}, - {IMGFMT_Y16_LE, PIX_FMT_GRAY16LE}, - {IMGFMT_Y16_BE, PIX_FMT_GRAY16BE}, - {IMGFMT_410P, PIX_FMT_YUV410P}, - {IMGFMT_420P, PIX_FMT_YUV420P}, - {IMGFMT_411P, PIX_FMT_YUV411P}, - {IMGFMT_422P, PIX_FMT_YUV422P}, - {IMGFMT_444P, PIX_FMT_YUV444P}, - {IMGFMT_440P, PIX_FMT_YUV440P}, + // Newer versions use AV_PIX_FMT_GRAY8A + {IMGFMT_YA8, AV_PIX_FMT_Y400A}, + {IMGFMT_Y16_LE, AV_PIX_FMT_GRAY16LE}, + {IMGFMT_Y16_BE, AV_PIX_FMT_GRAY16BE}, + {IMGFMT_410P, AV_PIX_FMT_YUV410P}, + {IMGFMT_420P, AV_PIX_FMT_YUV420P}, + {IMGFMT_411P, AV_PIX_FMT_YUV411P}, + {IMGFMT_422P, AV_PIX_FMT_YUV422P}, + {IMGFMT_444P, AV_PIX_FMT_YUV444P}, + {IMGFMT_440P, AV_PIX_FMT_YUV440P}, - {IMGFMT_420P16_LE, PIX_FMT_YUV420P16LE}, - {IMGFMT_420P16_BE, PIX_FMT_YUV420P16BE}, - {IMGFMT_420P9_LE, PIX_FMT_YUV420P9LE}, - {IMGFMT_420P9_BE, PIX_FMT_YUV420P9BE}, - {IMGFMT_420P10_LE, PIX_FMT_YUV420P10LE}, - {IMGFMT_420P10_BE, PIX_FMT_YUV420P10BE}, - {IMGFMT_422P10_LE, PIX_FMT_YUV422P10LE}, - {IMGFMT_422P10_BE, PIX_FMT_YUV422P10BE}, - {IMGFMT_444P9_BE , PIX_FMT_YUV444P9BE}, - {IMGFMT_444P9_LE , PIX_FMT_YUV444P9LE}, - {IMGFMT_444P10_BE, PIX_FMT_YUV444P10BE}, - {IMGFMT_444P10_LE, PIX_FMT_YUV444P10LE}, - {IMGFMT_422P16_LE, PIX_FMT_YUV422P16LE}, - {IMGFMT_422P16_BE, PIX_FMT_YUV422P16BE}, - {IMGFMT_422P9_LE, PIX_FMT_YUV422P9LE}, - {IMGFMT_422P9_BE, PIX_FMT_YUV422P9BE}, - {IMGFMT_444P16_LE, PIX_FMT_YUV444P16LE}, - {IMGFMT_444P16_BE, PIX_FMT_YUV444P16BE}, + {IMGFMT_420P16_LE, AV_PIX_FMT_YUV420P16LE}, + {IMGFMT_420P16_BE, AV_PIX_FMT_YUV420P16BE}, + {IMGFMT_420P9_LE, AV_PIX_FMT_YUV420P9LE}, + {IMGFMT_420P9_BE, AV_PIX_FMT_YUV420P9BE}, + {IMGFMT_420P10_LE, AV_PIX_FMT_YUV420P10LE}, + {IMGFMT_420P10_BE, AV_PIX_FMT_YUV420P10BE}, + {IMGFMT_422P10_LE, AV_PIX_FMT_YUV422P10LE}, + {IMGFMT_422P10_BE, AV_PIX_FMT_YUV422P10BE}, + {IMGFMT_444P9_BE , AV_PIX_FMT_YUV444P9BE}, + {IMGFMT_444P9_LE , AV_PIX_FMT_YUV444P9LE}, + {IMGFMT_444P10_BE, AV_PIX_FMT_YUV444P10BE}, + {IMGFMT_444P10_LE, AV_PIX_FMT_YUV444P10LE}, + {IMGFMT_422P16_LE, AV_PIX_FMT_YUV422P16LE}, + {IMGFMT_422P16_BE, AV_PIX_FMT_YUV422P16BE}, + {IMGFMT_422P9_LE, AV_PIX_FMT_YUV422P9LE}, + {IMGFMT_422P9_BE, AV_PIX_FMT_YUV422P9BE}, + {IMGFMT_444P16_LE, AV_PIX_FMT_YUV444P16LE}, + {IMGFMT_444P16_BE, AV_PIX_FMT_YUV444P16BE}, // YUVJ are YUV formats that use the full Y range. Decoder color range // information is used instead. Deprecated in ffmpeg. - {IMGFMT_420P, PIX_FMT_YUVJ420P}, - {IMGFMT_422P, PIX_FMT_YUVJ422P}, - {IMGFMT_444P, PIX_FMT_YUVJ444P}, - {IMGFMT_440P, PIX_FMT_YUVJ440P}, + {IMGFMT_420P, AV_PIX_FMT_YUVJ420P}, + {IMGFMT_422P, AV_PIX_FMT_YUVJ422P}, + {IMGFMT_444P, AV_PIX_FMT_YUVJ444P}, + {IMGFMT_440P, AV_PIX_FMT_YUVJ440P}, - {IMGFMT_420AP, PIX_FMT_YUVA420P}, + {IMGFMT_420AP, AV_PIX_FMT_YUVA420P}, #if LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 10, 0) - {IMGFMT_422AP, PIX_FMT_YUVA422P}, - {IMGFMT_444AP, PIX_FMT_YUVA444P}, + {IMGFMT_422AP, AV_PIX_FMT_YUVA422P}, + {IMGFMT_444AP, AV_PIX_FMT_YUVA444P}, {IMGFMT_420AP9_BE, AV_PIX_FMT_YUVA420P9BE}, {IMGFMT_420AP9_LE, AV_PIX_FMT_YUVA420P9LE}, @@ -140,85 +140,85 @@ static const struct { #endif // ffmpeg only -#if LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT > AV_VERSION_INT(52, 0, 0) - {IMGFMT_420P12_LE, PIX_FMT_YUV420P12LE}, - {IMGFMT_420P12_BE, PIX_FMT_YUV420P12BE}, - {IMGFMT_420P14_LE, PIX_FMT_YUV420P14LE}, - {IMGFMT_420P14_BE, PIX_FMT_YUV420P14BE}, - {IMGFMT_422P12_LE, PIX_FMT_YUV422P12LE}, - {IMGFMT_422P12_BE, PIX_FMT_YUV422P12BE}, - {IMGFMT_422P14_LE, PIX_FMT_YUV422P14LE}, - {IMGFMT_422P14_BE, PIX_FMT_YUV422P14BE}, - {IMGFMT_444P12_BE, PIX_FMT_YUV444P12BE}, - {IMGFMT_444P12_LE, PIX_FMT_YUV444P12LE}, - {IMGFMT_444P14_BE, PIX_FMT_YUV444P14BE}, - {IMGFMT_444P14_LE, PIX_FMT_YUV444P14LE}, +#if LIBAVUTIL_VERSION_MICRO >= 100 + {IMGFMT_420P12_LE, AV_PIX_FMT_YUV420P12LE}, + {IMGFMT_420P12_BE, AV_PIX_FMT_YUV420P12BE}, + {IMGFMT_420P14_LE, AV_PIX_FMT_YUV420P14LE}, + {IMGFMT_420P14_BE, AV_PIX_FMT_YUV420P14BE}, + {IMGFMT_422P12_LE, AV_PIX_FMT_YUV422P12LE}, + {IMGFMT_422P12_BE, AV_PIX_FMT_YUV422P12BE}, + {IMGFMT_422P14_LE, AV_PIX_FMT_YUV422P14LE}, + {IMGFMT_422P14_BE, AV_PIX_FMT_YUV422P14BE}, + {IMGFMT_444P12_BE, AV_PIX_FMT_YUV444P12BE}, + {IMGFMT_444P12_LE, AV_PIX_FMT_YUV444P12LE}, + {IMGFMT_444P14_BE, AV_PIX_FMT_YUV444P14BE}, + {IMGFMT_444P14_LE, AV_PIX_FMT_YUV444P14LE}, - {IMGFMT_GBRP12_BE, PIX_FMT_GBRP12BE}, - {IMGFMT_GBRP12_LE, PIX_FMT_GBRP12LE}, - {IMGFMT_GBRP14_BE, PIX_FMT_GBRP14BE}, - {IMGFMT_GBRP14_LE, PIX_FMT_GBRP14LE}, + {IMGFMT_GBRP12_BE, AV_PIX_FMT_GBRP12BE}, + {IMGFMT_GBRP12_LE, AV_PIX_FMT_GBRP12LE}, + {IMGFMT_GBRP14_BE, AV_PIX_FMT_GBRP14BE}, + {IMGFMT_GBRP14_LE, AV_PIX_FMT_GBRP14LE}, - {IMGFMT_RGBA64_BE, PIX_FMT_RGBA64BE}, - {IMGFMT_RGBA64_LE, PIX_FMT_RGBA64LE}, - {IMGFMT_BGRA64_BE, PIX_FMT_BGRA64BE}, - {IMGFMT_BGRA64_LE, PIX_FMT_BGRA64LE}, + {IMGFMT_RGBA64_BE, AV_PIX_FMT_RGBA64BE}, + {IMGFMT_RGBA64_LE, AV_PIX_FMT_RGBA64LE}, + {IMGFMT_BGRA64_BE, AV_PIX_FMT_BGRA64BE}, + {IMGFMT_BGRA64_LE, AV_PIX_FMT_BGRA64LE}, - {IMGFMT_BGR0, PIX_FMT_BGR0}, - {IMGFMT_0RGB, PIX_FMT_0RGB}, - {IMGFMT_RGB0, PIX_FMT_RGB0}, - {IMGFMT_0BGR, PIX_FMT_0BGR}, - {IMGFMT_BGR0, PIX_FMT_BGR0}, + {IMGFMT_BGR0, AV_PIX_FMT_BGR0}, + {IMGFMT_0RGB, AV_PIX_FMT_0RGB}, + {IMGFMT_RGB0, AV_PIX_FMT_RGB0}, + {IMGFMT_0BGR, AV_PIX_FMT_0BGR}, + {IMGFMT_BGR0, AV_PIX_FMT_BGR0}, #else - {IMGFMT_BGR0, PIX_FMT_BGRA}, - {IMGFMT_0RGB, PIX_FMT_ARGB}, - {IMGFMT_RGB0, PIX_FMT_RGBA}, - {IMGFMT_0BGR, PIX_FMT_ABGR}, - {IMGFMT_BGR0, PIX_FMT_BGRA}, + {IMGFMT_BGR0, AV_PIX_FMT_BGRA}, + {IMGFMT_0RGB, AV_PIX_FMT_ARGB}, + {IMGFMT_RGB0, AV_PIX_FMT_RGBA}, + {IMGFMT_0BGR, AV_PIX_FMT_ABGR}, + {IMGFMT_BGR0, AV_PIX_FMT_BGRA}, #endif #if HAVE_AVCODEC_NEW_VDPAU_API {IMGFMT_VDPAU, AV_PIX_FMT_VDPAU}, #else - {IMGFMT_VDPAU_MPEG1, PIX_FMT_VDPAU_MPEG1}, - {IMGFMT_VDPAU_MPEG2, PIX_FMT_VDPAU_MPEG2}, - {IMGFMT_VDPAU_H264, PIX_FMT_VDPAU_H264}, - {IMGFMT_VDPAU_WMV3, PIX_FMT_VDPAU_WMV3}, - {IMGFMT_VDPAU_VC1, PIX_FMT_VDPAU_VC1}, - {IMGFMT_VDPAU_MPEG4, PIX_FMT_VDPAU_MPEG4}, + {IMGFMT_VDPAU_MPEG1, AV_PIX_FMT_VDPAU_MPEG1}, + {IMGFMT_VDPAU_MPEG2, AV_PIX_FMT_VDPAU_MPEG2}, + {IMGFMT_VDPAU_H264, AV_PIX_FMT_VDPAU_H264}, + {IMGFMT_VDPAU_WMV3, AV_PIX_FMT_VDPAU_WMV3}, + {IMGFMT_VDPAU_VC1, AV_PIX_FMT_VDPAU_VC1}, + {IMGFMT_VDPAU_MPEG4, AV_PIX_FMT_VDPAU_MPEG4}, // map to an arbitrary but existing vdpau format - {IMGFMT_VDPAU, PIX_FMT_VDPAU_H264}, + {IMGFMT_VDPAU, AV_PIX_FMT_VDPAU_H264}, #endif - {IMGFMT_VDA, PIX_FMT_VDA_VLD}, - {IMGFMT_VAAPI, PIX_FMT_VAAPI_VLD}, + {IMGFMT_VDA, AV_PIX_FMT_VDA_VLD}, + {IMGFMT_VAAPI, AV_PIX_FMT_VAAPI_VLD}, - {0, PIX_FMT_NONE} + {0, AV_PIX_FMT_NONE} }; -enum PixelFormat imgfmt2pixfmt(int fmt) +enum AVPixelFormat imgfmt2pixfmt(int fmt) { if (fmt == IMGFMT_NONE) - return PIX_FMT_NONE; + return AV_PIX_FMT_NONE; int i; - enum PixelFormat pix_fmt; + enum AVPixelFormat pix_fmt; for (i = 0; conversion_map[i].fmt; i++) if (conversion_map[i].fmt == fmt) break; pix_fmt = conversion_map[i].pix_fmt; - if (pix_fmt == PIX_FMT_NONE) + if (pix_fmt == AV_PIX_FMT_NONE) mp_msg(MSGT_GLOBAL, MSGL_V, "Unsupported format %s\n", vo_format_name(fmt)); return pix_fmt; } -int pixfmt2imgfmt(enum PixelFormat pix_fmt) +int pixfmt2imgfmt(enum AVPixelFormat pix_fmt) { - if (pix_fmt == PIX_FMT_NONE) + if (pix_fmt == AV_PIX_FMT_NONE) return IMGFMT_NONE; int i; - for (i = 0; conversion_map[i].pix_fmt != PIX_FMT_NONE; i++) + for (i = 0; conversion_map[i].pix_fmt != AV_PIX_FMT_NONE; i++) if (conversion_map[i].pix_fmt == pix_fmt) break; int fmt = conversion_map[i].fmt; diff --git a/video/fmt-conversion.h b/video/fmt-conversion.h index f7114b0aef..c8f0b883b1 100644 --- a/video/fmt-conversion.h +++ b/video/fmt-conversion.h @@ -21,7 +21,7 @@ #include -enum PixelFormat imgfmt2pixfmt(int fmt); -int pixfmt2imgfmt(enum PixelFormat pix_fmt); +enum AVPixelFormat imgfmt2pixfmt(int fmt); +int pixfmt2imgfmt(enum AVPixelFormat pix_fmt); #endif /* MPLAYER_FMT_CONVERSION_H */ diff --git a/video/img_format.c b/video/img_format.c index 73e50bd803..b3d0c8bd91 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -157,8 +157,9 @@ const char *mp_imgfmt_to_name(unsigned int fmt) struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt) { - enum PixelFormat fmt = imgfmt2pixfmt(mpfmt); - if (fmt == PIX_FMT_NONE) { + enum AVPixelFormat fmt = imgfmt2pixfmt(mpfmt); + const AVPixFmtDescriptor *pd = av_pix_fmt_desc_get(fmt); + if (!pd || fmt == AV_PIX_FMT_NONE) { const char *name = mp_imgfmt_to_name(mpfmt); if (name) { mp_msg(MSGT_DECVIDEO, MSGL_V, @@ -167,9 +168,6 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt) return (struct mp_imgfmt_desc) {0}; } - const AVPixFmtDescriptor *pd = &av_pix_fmt_descriptors[fmt]; - assert(pd); - struct mp_imgfmt_desc desc = { .id = mpfmt, .avformat = fmt, @@ -207,7 +205,7 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt) if (mpfmt == IMGFMT_XYZ12_LE || mpfmt == IMGFMT_XYZ12_BE) { desc.flags |= MP_IMGFLAG_XYZ; - } else if (!(pd->flags & PIX_FMT_RGB) && fmt != PIX_FMT_MONOBLACK && + } else if (!(pd->flags & PIX_FMT_RGB) && fmt != AV_PIX_FMT_MONOBLACK && fmt != PIX_FMT_PAL8) { desc.flags |= MP_IMGFLAG_YUV; diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c index 77c9f9f875..2da3f06a3c 100644 --- a/video/out/vo_lavc.c +++ b/video/out/vo_lavc.c @@ -94,7 +94,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, uint32_t format) { struct priv *vc = vo->priv; - enum PixelFormat pix_fmt = imgfmt2pixfmt(format); + enum AVPixelFormat pix_fmt = imgfmt2pixfmt(format); AVRational display_aspect_ratio, image_aspect_ratio; AVRational aspect; @@ -135,7 +135,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, vc->lastframeipts = MP_NOPTS_VALUE; vc->lastencodedipts = MP_NOPTS_VALUE; - if (pix_fmt == PIX_FMT_NONE) + if (pix_fmt == AV_PIX_FMT_NONE) goto error; /* imgfmt2pixfmt already prints something */ vc->stream = encode_lavc_alloc_stream(vo->encode_lavc_ctx, @@ -174,7 +174,7 @@ error: static int query_format(struct vo *vo, uint32_t format) { - enum PixelFormat pix_fmt = imgfmt2pixfmt(format); + enum AVPixelFormat pix_fmt = imgfmt2pixfmt(format); if (!vo->encode_lavc_ctx) return 0; diff --git a/video/sws_utils.c b/video/sws_utils.c index 27cd0c7330..3bc6bc4910 100644 --- a/video/sws_utils.c +++ b/video/sws_utils.c @@ -79,9 +79,9 @@ void mp_sws_set_from_cmdline(struct mp_sws_context *ctx) bool mp_sws_supported_format(int imgfmt) { - enum PixelFormat av_format = imgfmt2pixfmt(imgfmt); + enum AVPixelFormat av_format = imgfmt2pixfmt(imgfmt); - return av_format != PIX_FMT_NONE && sws_isSupportedInput(av_format) + return av_format != AV_PIX_FMT_NONE && sws_isSupportedInput(av_format) && sws_isSupportedOutput(av_format); } @@ -204,12 +204,12 @@ int mp_sws_reinit(struct mp_sws_context *ctx) if (!src_fmt.id || !dst_fmt.id) return -1; - enum PixelFormat s_fmt = imgfmt2pixfmt(src->imgfmt); - if (s_fmt == PIX_FMT_NONE || sws_isSupportedInput(s_fmt) < 1) + enum AVPixelFormat s_fmt = imgfmt2pixfmt(src->imgfmt); + if (s_fmt == AV_PIX_FMT_NONE || sws_isSupportedInput(s_fmt) < 1) return -1; - enum PixelFormat d_fmt = imgfmt2pixfmt(dst->imgfmt); - if (d_fmt == PIX_FMT_NONE || sws_isSupportedOutput(d_fmt) < 1) + enum AVPixelFormat d_fmt = imgfmt2pixfmt(dst->imgfmt); + if (d_fmt == AV_PIX_FMT_NONE || sws_isSupportedOutput(d_fmt) < 1) return -1; int s_csp = mp_csp_to_sws_colorspace(src->colorspace); @@ -273,7 +273,7 @@ int mp_sws_scale(struct mp_sws_context *ctx, struct mp_image *dst, { // Hack for older swscale versions which don't support this. // We absolutely need this in the OSD rendering path. - if (dst->imgfmt == IMGFMT_GBRP && !sws_isSupportedOutput(PIX_FMT_GBRP)) + if (dst->imgfmt == IMGFMT_GBRP && !sws_isSupportedOutput(AV_PIX_FMT_GBRP)) return to_gbrp(dst, src, ctx->flags); mp_image_params_from_image(&ctx->src, src); diff --git a/wscript b/wscript index 9e42001048..3237d6e04e 100644 --- a/wscript +++ b/wscript @@ -276,7 +276,7 @@ If you really mean to compile without libass support use --disable-libass." ] libav_pkg_config_checks = [ - 'libavutil', '> 51.73.0', + 'libavutil', '>= 52.3.0', 'libavcodec', '> 54.34.0', 'libavformat', '> 54.19.0', 'libswscale', '>= 2.0.0'