mirror of https://github.com/mpv-player/mpv
vaapi: fix compilation with Libav
The code using FFSWAP was moved from vo_vaapi.c to vaapi.c, which didn't include libavutil/common.h anymore, just libavutil/avutil.h. The header avutil.h doesn't include common.h recursively in Libav, so it broke there. Add FFSWAP as MPSWAP in mp_common.h (copy pasted from ffmpeg) to make sure this doesn't happen again. (This kind of stuff happens all too often, so screw libavutil.)
This commit is contained in:
parent
72fbd846db
commit
200fb7eceb
|
@ -36,6 +36,8 @@
|
|||
|
||||
#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
|
||||
#define MPSWAP(type, a, b) \
|
||||
do { type SWAP_tmp = b; b = a; a = SWAP_tmp; } while (0)
|
||||
#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
|
||||
|
||||
#define CONTROL_OK 1
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
#include <X11/Xutil.h>
|
||||
#include <va/va_x11.h>
|
||||
|
||||
#include <libavutil/common.h>
|
||||
#include <libavcodec/vaapi.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mpvcore/mp_msg.h"
|
||||
#include "video/out/vo.h"
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <libavutil/avutil.h>
|
||||
|
||||
#include "vaapi.h"
|
||||
#include "mpvcore/mp_common.h"
|
||||
#include "mpvcore/mp_msg.h"
|
||||
#include "mp_image.h"
|
||||
#include "img_format.h"
|
||||
|
@ -439,8 +439,8 @@ bool va_image_map(VADisplay display, VAImage *image, struct mp_image *mpi)
|
|||
}
|
||||
|
||||
if (image->format.fourcc == VA_FOURCC_YV12) {
|
||||
FFSWAP(unsigned int, mpi->stride[1], mpi->stride[2]);
|
||||
FFSWAP(uint8_t *, mpi->planes[1], mpi->planes[2]);
|
||||
MPSWAP(unsigned int, mpi->stride[1], mpi->stride[2]);
|
||||
MPSWAP(uint8_t *, mpi->planes[1], mpi->planes[2]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue