From 37388ebb0ef9085c841d7f94e665a5a77cfe0e92 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 16 Jul 2013 13:28:28 +0200 Subject: configure: uniform the defines to #define HAVE_xxx (0|1) The configure followed 5 different convetions of defines because the next guy always wanted to introduce a new better way to uniform it[1]. For an hypothetic feature 'hurr' you could have had: * #define HAVE_HURR 1 / #undef HAVE_DURR * #define HAVE_HURR / #undef HAVE_DURR * #define CONFIG_HURR 1 / #undef CONFIG_DURR * #define HAVE_HURR 1 / #define HAVE_DURR 0 * #define CONFIG_HURR 1 / #define CONFIG_DURR 0 All is now uniform and uses: * #define HAVE_HURR 1 * #define HAVE_DURR 0 We like definining to 0 as opposed to `undef` bcause it can help spot typos and is very helpful when doing big reorganizations in the code. [1]: http://xkcd.com/927/ related --- video/decode/vd_lavc.c | 11 +++++------ video/filter/vf.c | 8 ++++---- video/fmt-conversion.c | 2 +- video/image_writer.c | 6 +++--- video/out/gl_common.c | 12 ++++++------ video/out/gl_common.h | 2 +- video/out/gl_header_fixes.h | 4 ++-- video/out/gl_lcms.c | 4 ++-- video/out/gl_video.c | 2 +- video/out/vo.c | 26 +++++++++++++------------- video/out/vo_corevideo.c | 8 ++++---- video/out/vo_vaapi.c | 2 +- video/out/vo_vdpau.c | 2 +- video/out/vo_wayland.c | 2 +- video/out/vo_x11.c | 14 +++++++------- video/out/vo_xv.c | 12 ++++++------ video/out/x11_common.c | 26 +++++++++++++------------- 17 files changed, 71 insertions(+), 72 deletions(-) (limited to 'video') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index ebfd986a95..64542be69d 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -103,18 +103,17 @@ static const struct vd_lavc_hwdec mp_vd_lavc_crystalhd = { }; static const struct vd_lavc_hwdec *hwdec_list[] = { -#if CONFIG_VDPAU -#if HAVE_AV_CODEC_NEW_VDPAU_API +#if HAVE_VDPAU_HWACCEL &mp_vd_lavc_vdpau, -#else +#endif +#if HAVE_VDPAU_DECODER &mp_vd_lavc_vdpau_old, #endif -#endif // CONFIG_VDPAU -#if CONFIG_VDA +#if HAVE_VDA_HWACCEL &mp_vd_lavc_vda, #endif &mp_vd_lavc_crystalhd, -#if CONFIG_VAAPI +#if HAVE_VAAPI_HWACCEL &mp_vd_lavc_vaapi, &mp_vd_lavc_vaapi_copy, #endif diff --git a/video/filter/vf.c b/video/filter/vf.c index c2e15090b8..9a8c1bba04 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -84,10 +84,10 @@ static const vf_info_t *const filter_list[] = { &vf_info_rotate, &vf_info_mirror, -#ifdef CONFIG_LIBPOSTPROC +#if HAVE_LIBPOSTPROC &vf_info_pp, #endif -#ifdef CONFIG_VF_LAVFI +#if HAVE_VF_LAVFI &vf_info_lavfi, #endif @@ -110,10 +110,10 @@ static const vf_info_t *const filter_list[] = { &vf_info_sub, &vf_info_yadif, &vf_info_stereo3d, -#ifdef CONFIG_DLOPEN +#if HAVE_DLOPEN &vf_info_dlopen, #endif -#if CONFIG_VAAPI_VPP +#if HAVE_VAAPI_VPP &vf_info_vaapi, #endif NULL diff --git a/video/fmt-conversion.c b/video/fmt-conversion.c index 8bb119553f..7d37e8ca87 100644 --- a/video/fmt-conversion.c +++ b/video/fmt-conversion.c @@ -171,7 +171,7 @@ static const struct { {IMGFMT_BGRA64_LE, PIX_FMT_BGRA64LE}, #endif -#if HAVE_AV_CODEC_NEW_VDPAU_API +#if HAVE_AVCODEC_NEW_VDPAU_API {IMGFMT_VDPAU, AV_PIX_FMT_VDPAU}, #else {IMGFMT_VDPAU_MPEG1, PIX_FMT_VDPAU_MPEG1}, diff --git a/video/image_writer.c b/video/image_writer.c index 22192ade45..d2ef348d87 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -27,7 +27,7 @@ #include "config.h" -#ifdef CONFIG_JPEG +#if HAVE_JPEG #include #endif @@ -142,7 +142,7 @@ error_exit: return success; } -#ifdef CONFIG_JPEG +#if HAVE_JPEG static void write_jpeg_error_exit(j_common_ptr cinfo) { @@ -226,7 +226,7 @@ static const struct img_writer img_writers[] = { .pixfmts = (int[]) { IMGFMT_BGR24, IMGFMT_BGRA, IMGFMT_BGR15_LE, IMGFMT_Y8, 0}, }, -#ifdef CONFIG_JPEG +#if HAVE_JPEG { "jpg", write_jpeg }, { "jpeg", write_jpeg }, #endif diff --git a/video/out/gl_common.c b/video/out/gl_common.c index 10e806dc8d..d39a09df16 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -142,14 +142,14 @@ static bool is_software_gl(GL *gl) strcmp(renderer, "Mesa X11") == 0; } -#ifdef HAVE_LIBDL +#if HAVE_LIBDL #include #endif void *mp_getdladdr(const char *s) { void *ret = NULL; -#ifdef HAVE_LIBDL +#if HAVE_LIBDL void *handle = dlopen(NULL, RTLD_LAZY); if (!handle) return NULL; @@ -852,18 +852,18 @@ struct backend { }; static struct backend backends[] = { -#ifdef CONFIG_GL_COCOA +#if HAVE_GL_COCOA {"cocoa", mpgl_set_backend_cocoa}, #endif -#ifdef CONFIG_GL_WIN32 +#if HAVE_GL_WIN32 {"win", mpgl_set_backend_w32}, #endif //Add the wayland backend before x11, in order to probe for a wayland-server before a x11-server and avoid using xwayland -#ifdef CONFIG_GL_WAYLAND +#if HAVE_GL_WAYLAND {"wayland", mpgl_set_backend_wayland}, #endif -#ifdef CONFIG_GL_X11 +#if HAVE_GL_X11 {"x11", mpgl_set_backend_x11}, #endif {0} diff --git a/video/out/gl_common.h b/video/out/gl_common.h index ecff698ac8..41d30bb001 100644 --- a/video/out/gl_common.h +++ b/video/out/gl_common.h @@ -37,7 +37,7 @@ #include "video/mp_image.h" -#if defined(CONFIG_GL_COCOA) +#if HAVE_GL_COCOA #ifdef GL_VERSION_3_0 #include #else diff --git a/video/out/gl_header_fixes.h b/video/out/gl_header_fixes.h index da40e7a485..9fe1e88036 100644 --- a/video/out/gl_header_fixes.h +++ b/video/out/gl_header_fixes.h @@ -27,7 +27,7 @@ #ifndef GLAPIENTRY #ifdef APIENTRY #define GLAPIENTRY APIENTRY -#elif defined(CONFIG_GL_WIN32) +#elif HAVE_GL_WIN32 #define GLAPIENTRY __stdcall #else #define GLAPIENTRY @@ -222,7 +222,7 @@ /** \} */ // end of glextdefines group -#if defined(CONFIG_GL_WIN32) && !defined(WGL_CONTEXT_MAJOR_VERSION_ARB) +#if HAVE_GL_WIN32 && !defined(WGL_CONTEXT_MAJOR_VERSION_ARB) /* these are supposed to be defined in wingdi.h but mingw's is too old */ /* only the bits actually used by mplayer are defined */ /* reference: http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt */ diff --git a/video/out/gl_lcms.c b/video/out/gl_lcms.c index d903ec4055..9999eca233 100644 --- a/video/out/gl_lcms.c +++ b/video/out/gl_lcms.c @@ -35,7 +35,7 @@ #include "gl_video.h" #include "gl_lcms.h" -#ifdef CONFIG_LCMS2 +#if HAVE_LCMS2 #include @@ -212,7 +212,7 @@ error_exit: return NULL; } -#else /* CONFIG_LCMS2 */ +#else /* HAVE_LCMS2 */ const struct m_sub_options mp_icc_conf = { .opts = (m_option_t[]) { {0} }, diff --git a/video/out/gl_video.c b/video/out/gl_video.c index d4b4b507c3..3151927be6 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -41,7 +41,7 @@ static const char vo_opengl_shaders[] = // Generated from gl_video_shaders.glsl -#include "gl_video_shaders.h" +#include "video/out/gl_video_shaders.h" ; // Pixel width of 1D lookup textures. diff --git a/video/out/vo.c b/video/out/vo.c index 061fc9caf3..737c9c34f9 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -66,47 +66,47 @@ extern struct vo_driver video_out_wayland; const struct vo_driver *video_out_drivers[] = { -#if CONFIG_VDPAU +#if HAVE_VDPAU &video_out_vdpau, #endif -#ifdef CONFIG_GL +#if HAVE_GL &video_out_opengl, #endif -#ifdef CONFIG_DIRECT3D +#if HAVE_DIRECT3D &video_out_direct3d_shaders, &video_out_direct3d, #endif -#ifdef CONFIG_COREVIDEO +#if HAVE_COREVIDEO &video_out_corevideo, #endif -#ifdef CONFIG_XV +#if HAVE_XV &video_out_xv, #endif -#ifdef CONFIG_SDL2 +#if HAVE_SDL2 &video_out_sdl, #endif -#ifdef CONFIG_GL +#if HAVE_GL &video_out_opengl_old, #endif -#if CONFIG_VAAPI +#if HAVE_VAAPI &video_out_vaapi, #endif -#ifdef CONFIG_X11 +#if HAVE_X11 &video_out_x11, #endif &video_out_null, // should not be auto-selected &video_out_image, -#ifdef CONFIG_CACA +#if HAVE_CACA &video_out_caca, #endif -#ifdef CONFIG_ENCODING +#if HAVE_ENCODING &video_out_lavc, #endif -#ifdef CONFIG_GL +#if HAVE_GL &video_out_opengl_hq, #endif -#ifdef CONFIG_WAYLAND +#if HAVE_WAYLAND &video_out_wayland, #endif NULL diff --git a/video/out/vo_corevideo.c b/video/out/vo_corevideo.c index 58eb711cec..7b34a91924 100644 --- a/video/out/vo_corevideo.c +++ b/video/out/vo_corevideo.c @@ -23,7 +23,7 @@ #include "config.h" #include -#if CONFIG_VDA +#if HAVE_VDA_HWACCEL #include #endif @@ -446,7 +446,7 @@ static struct cv_functions cv_functions = { .set_yuv_colorspace = cv_set_yuv_colorspace, }; -#if CONFIG_VDA +#if HAVE_VDA_HWACCEL static void iosurface_init(struct vo *vo) { struct priv *p = vo->priv; @@ -546,7 +546,7 @@ static struct cv_functions iosurface_functions = { .get_yuv_colorspace = get_yuv_colorspace, .set_yuv_colorspace = iosurface_set_yuv_csp, }; -#endif /* CONFIG_VDA */ +#endif /* HAVE_VDA_HWACCEL */ static int query_format(struct vo *vo, uint32_t format) { @@ -554,7 +554,7 @@ static int query_format(struct vo *vo, uint32_t format) const int flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; switch (format) { -#if CONFIG_VDA +#if HAVE_VDA_HWACCEL case IMGFMT_VDA: p->fns = iosurface_functions; return flags; diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index a810b1bc60..637c4442fa 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -658,7 +658,7 @@ const struct vo_driver video_out_vaapi = { .priv_defaults = &(const struct priv) { .scaling = VA_FILTER_SCALING_DEFAULT, .deint = 0, -#if !CONFIG_VAAPI_VPP +#if !HAVE_VAAPI_VPP .deint_type = 2, #endif }, diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index fd6f87edb9..033f06cb19 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -570,7 +570,7 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo) MP_INFO(vo, "Assuming user-specified display refresh rate of %.3f Hz.\n", vc->user_fps); } else if (vc->user_fps == 0) { -#ifdef CONFIG_XF86VM +#if HAVE_XF86VM double fps = vo_x11_vm_get_fps(vo); if (!fps) MP_WARN(vo, "Failed to get display FPS\n"); diff --git a/video/out/vo_wayland.c b/video/out/vo_wayland.c index b1f99bd26f..ff6d677e15 100644 --- a/video/out/vo_wayland.c +++ b/video/out/vo_wayland.c @@ -177,7 +177,7 @@ static int create_tmpfile_cloexec(char *tmpname) { int fd; -#ifdef HAVE_MKOSTEMP +#if HAVE_MKOSTEMP fd = mkostemp(tmpname, O_CLOEXEC); if (fd >= 0) unlink(tmpname); diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index a2c8ecb2e8..be385ac621 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -40,7 +40,7 @@ #include "x11_common.h" -#ifdef HAVE_SHM +#if HAVE_SHM #include #include #include @@ -94,7 +94,7 @@ struct priv { int num_buffers; int Shmem_Flag; -#ifdef HAVE_SHM +#if HAVE_SHM int Shm_Warned_Slow; XShmSegmentInfo Shminfo[2]; @@ -157,7 +157,7 @@ static int find_depth_from_visuals(struct vo *vo, Visual ** visual_return) static void getMyXImage(struct priv *p, int foo) { struct vo *vo = p->vo; -#ifdef HAVE_SHM +#if HAVE_SHM if (vo->x11->display_is_local && XShmQueryExtension(vo->x11->display)) { p->Shmem_Flag = 1; vo->x11->ShmCompletionEvent = XShmGetEventBase(vo->x11->display) @@ -221,7 +221,7 @@ shmemerror: memset(p->myximage[foo]->data, 0, p->myximage[foo]->bytes_per_line * p->image_height); p->ImageData[foo] = p->myximage[foo]->data; -#ifdef HAVE_SHM +#if HAVE_SHM } #endif } @@ -229,7 +229,7 @@ shmemerror: static void freeMyXImage(struct priv *p, int foo) { struct vo *vo = p->vo; -#ifdef HAVE_SHM +#if HAVE_SHM if (p->Shmem_Flag) { XShmDetach(vo->x11->display, &p->Shminfo[foo]); XDestroyImage(p->myximage[foo]); @@ -397,7 +397,7 @@ static void Display_Image(struct priv *p, XImage *myximage) XImage *x_image = p->myximage[p->current_buf]; -#ifdef HAVE_SHM +#if HAVE_SHM if (p->Shmem_Flag) { XShmPutImage(vo->x11->display, vo->x11->window, vo->x11->vo_gc, x_image, 0, 0, p->dst.x0, p->dst.y0, p->dst_w, p->dst_h, @@ -443,7 +443,7 @@ static mp_image_t *get_screenshot(struct vo *vo) static void wait_for_completion(struct vo *vo, int max_outstanding) { -#ifdef HAVE_SHM +#if HAVE_SHM struct priv *ctx = vo->priv; struct vo_x11_state *x11 = vo->x11; if (ctx->Shmem_Flag) { diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index 28e3fdfcbe..02daaf86f8 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -33,7 +33,7 @@ #include "config.h" -#ifdef HAVE_SHM +#if HAVE_SHM #include #include #include @@ -91,7 +91,7 @@ struct xvctx { struct mp_rect dst_rect; uint32_t max_width, max_height; // zero means: not set int Shmem_Flag; -#ifdef HAVE_SHM +#if HAVE_SHM XShmSegmentInfo Shminfo[2]; int Shm_Warned_Slow; #endif @@ -490,7 +490,7 @@ static bool allocate_xvimage(struct vo *vo, int foo) struct vo_x11_state *x11 = vo->x11; // align it for faster OSD rendering (draw_bmp.c swscale usage) int aligned_w = FFALIGN(ctx->image_width, 32); -#ifdef HAVE_SHM +#if HAVE_SHM if (x11->display_is_local && XShmQueryExtension(x11->display)) { ctx->Shmem_Flag = 1; x11->ShmCompletionEvent = XShmGetEventBase(x11->display) @@ -544,7 +544,7 @@ static bool allocate_xvimage(struct vo *vo, int foo) static void deallocate_xvimage(struct vo *vo, int foo) { struct xvctx *ctx = vo->priv; -#ifdef HAVE_SHM +#if HAVE_SHM if (ctx->Shmem_Flag) { XShmDetach(vo->x11->display, &ctx->Shminfo[foo]); shmdt(ctx->Shminfo[foo].shmaddr); @@ -573,7 +573,7 @@ static inline void put_xvimage(struct vo *vo, XvImage *xvi) struct mp_rect *dst = &ctx->dst_rect; int dw = dst->x1 - dst->x0, dh = dst->y1 - dst->y0; int sw = src->x1 - src->x0, sh = src->y1 - src->y0; -#ifdef HAVE_SHM +#if HAVE_SHM if (ctx->Shmem_Flag) { XvShmPutImage(x11->display, ctx->xv_port, x11->window, x11->vo_gc, xvi, src->x0, src->y0, sw, sh, @@ -628,7 +628,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd) static void wait_for_completion(struct vo *vo, int max_outstanding) { -#ifdef HAVE_SHM +#if HAVE_SHM struct xvctx *ctx = vo->priv; struct vo_x11_state *x11 = vo->x11; if (ctx->Shmem_Flag) { diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 538235a439..54cd063505 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -46,27 +46,27 @@ #include #include -#ifdef CONFIG_XSS +#if HAVE_XSS #include #endif -#ifdef CONFIG_XDPMS +#if HAVE_XEXT #include #endif -#ifdef CONFIG_XINERAMA +#if HAVE_XINERAMA #include #endif -#ifdef CONFIG_XF86VM +#if HAVE_XF86VM #include #endif -#ifdef CONFIG_XF86XK +#if HAVE_XF86XK #include #endif -#if CONFIG_ZLIB +#if HAVE_ZLIB #include #endif @@ -424,7 +424,7 @@ static void vo_x11_update_screeninfo(struct vo *vo) opts->screenwidth = x11->ws_width; opts->screenheight = x11->ws_height; } -#ifdef CONFIG_XINERAMA +#if HAVE_XINERAMA if (opts->screen_id >= -1 && XineramaIsActive(x11->display) && !all_screens) { int screen = opts->fullscreen ? opts->fsscreen_id : opts->screen_id; @@ -974,7 +974,7 @@ static void vo_x11_update_window_title(struct vo *vo) vo_x11_set_property_utf8(vo, x11->XA_NET_WM_ICON_NAME, title); } -#if CONFIG_ZLIB +#if HAVE_ZLIB static bstr decompress_gz(bstr in) { bstr res = {0}; @@ -1530,7 +1530,7 @@ static void xscreensaver_heartbeat(struct vo_x11_state *x11) static int xss_suspend(Display *mDisplay, Bool suspend) { -#ifndef CONFIG_XSS +#if !HAVE_XSS return 0; #else int event, error, major, minor; @@ -1552,7 +1552,7 @@ static void saver_on(struct vo_x11_state *x11) x11->screensaver_off = 0; if (xss_suspend(mDisplay, False)) return; -#ifdef CONFIG_XDPMS +#if HAVE_XEXT if (x11->dpms_disabled) { int nothing; if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) { @@ -1587,7 +1587,7 @@ static void saver_off(struct vo_x11_state *x11) x11->screensaver_off = 1; if (xss_suspend(mDisplay, True)) return; -#ifdef CONFIG_XDPMS +#if HAVE_XEXT if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) { BOOL onoff; CARD16 state; @@ -1636,7 +1636,7 @@ static void vo_x11_selectinput_witherr(struct vo *vo, } } -#ifdef CONFIG_XF86VM +#if HAVE_XF86VM double vo_x11_vm_get_fps(struct vo *vo) { struct vo_x11_state *x11 = vo->x11; @@ -1648,7 +1648,7 @@ double vo_x11_vm_get_fps(struct vo *vo) XFree(modeline.private); return 1e3 * clock / modeline.htotal / modeline.vtotal; } -#else /* CONFIG_XF86VM */ +#else /* HAVE_XF86VM */ double vo_x11_vm_get_fps(struct vo *vo) { return 0; -- cgit v1.2.3 From 3813b137962d083410c31c896b62b3c21e066df9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 4 Nov 2013 00:43:27 +0100 Subject: fix weird DPMS->EXT replacement --- video/out/x11_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'video') diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 54cd063505..09492a2294 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -50,7 +50,7 @@ #include #endif -#if HAVE_XEXT +#if HAVE_XDPMS #include #endif @@ -1552,7 +1552,7 @@ static void saver_on(struct vo_x11_state *x11) x11->screensaver_off = 0; if (xss_suspend(mDisplay, False)) return; -#if HAVE_XEXT +#if HAVE_XDPMS if (x11->dpms_disabled) { int nothing; if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) { @@ -1587,7 +1587,7 @@ static void saver_off(struct vo_x11_state *x11) x11->screensaver_off = 1; if (xss_suspend(mDisplay, True)) return; -#if HAVE_XEXT +#if HAVE_XDPMS if (DPMSQueryExtension(mDisplay, ¬hing, ¬hing)) { BOOL onoff; CARD16 state; -- cgit v1.2.3