[PATCH] Include lavu mathematics.h everywhere M_PI is used
M_PI is not mandated by the C standard. Fix part of ticket 2423 --- Depening on the platform the switch to C11 has the effect of losing the M_PI define. This patch tries to not rely on M_PI being defined while also making the source a bit more standards compliant. The problem was repored in https://trac.mplayerhq.hu/ticket/2423 Best regards, Alexander gui/app/app.c | 1 + gui/skin/skin.c | 1 + gui/ui/main.c | 1 + gui/ui/playbar.c | 1 + gui/win32/gui.c | 1 + gui/win32/skinload.c | 1 + libaf/af_equalizer.c | 1 + libaf/af_hrtf.c | 1 + libaf/af_sinesuppress.c | 1 + libaf/af_tools.c | 1 + libaf/filter.c | 1 + libaf/window.c | 1 + libass/ass_parse.c | 2 ++ libass/ass_render.c | 2 ++ libmpcodecs/dec_teletext.c | 1 + libmpcodecs/vf_geq.c | 1 + libmpcodecs/vf_hue.c | 2 ++ libmpcodecs/vf_qp.c | 1 + libvo/x11_common.c | 1 + xvid_vbr.c | 1 + 20 files changed, 23 insertions(+) diff --git a/gui/app/app.c b/gui/app/app.c index f26058d2d..53399c3e6 100644 --- a/gui/app/app.c +++ b/gui/app/app.c @@ -29,6 +29,7 @@ #include "gui/util/misc.h" #include "libavutil/common.h" +#include "libavutil/mathematics.h" /** * @brief Initialize item counters. diff --git a/gui/skin/skin.c b/gui/skin/skin.c index 621e13f01..1380fec0f 100644 --- a/gui/skin/skin.c +++ b/gui/skin/skin.c @@ -40,6 +40,7 @@ #include "libavutil/attributes.h" #include "libavutil/avstring.h" #include "libavutil/common.h" +#include "libavutil/mathematics.h" typedef struct { const char *name; diff --git a/gui/ui/main.c b/gui/ui/main.c index 43f18be4d..dccbe6a82 100644 --- a/gui/ui/main.c +++ b/gui/ui/main.c @@ -54,6 +54,7 @@ #include "mp_core.h" #include "libavutil/avstring.h" #include "libavutil/common.h" +#include "libavutil/mathematics.h" #include "actions.h" diff --git a/gui/ui/playbar.c b/gui/ui/playbar.c index 58931f1d6..647ca05ca 100644 --- a/gui/ui/playbar.c +++ b/gui/ui/playbar.c @@ -48,6 +48,7 @@ #include "libmpdemux/stheader.h" #include "codec-cfg.h" #include "libavutil/avstring.h" +#include "libavutil/mathematics.h" #include "ui.h" #include "actions.h" diff --git a/gui/win32/gui.c b/gui/win32/gui.c index c10862e0b..e062816be 100644 --- a/gui/win32/gui.c +++ b/gui/win32/gui.c @@ -42,6 +42,7 @@ #include "stream/stream.h" #include "libvo/video_out.h" #include "libmpcodecs/vd.h" +#include "libavutil/mathematics.h" #include "gui/interface.h" #include "gui/ui/actions.h" #include "gui/ui/ui.h" diff --git a/gui/win32/skinload.c b/gui/win32/skinload.c index 40fed386a..398b121ac 100644 --- a/gui/win32/skinload.c +++ b/gui/win32/skinload.c @@ -35,6 +35,7 @@ #include "libavutil/attributes.h" #include "libavutil/common.h" #include "libavutil/imgutils.h" +#include "libavutil/mathematics.h" #include "gui.h" #include "gui/util/mem.h" #include "gui/util/bitmap.h" diff --git a/libaf/af_equalizer.c b/libaf/af_equalizer.c index 8a8f272e0..b2f687abc 100644 --- a/libaf/af_equalizer.c +++ b/libaf/af_equalizer.c @@ -30,6 +30,7 @@ #include <math.h> #include "libavutil/common.h" +#include "libavutil/mathematics.h" #include "mp_msg.h" #include "af.h" diff --git a/libaf/af_hrtf.c b/libaf/af_hrtf.c index e47758342..90fcf50f6 100644 --- a/libaf/af_hrtf.c +++ b/libaf/af_hrtf.c @@ -27,6 +27,7 @@ #include <math.h> #include <libavutil/common.h> +#include <libavutil/mathematics.h> #include "mp_msg.h" #include "af.h" diff --git a/libaf/af_sinesuppress.c b/libaf/af_sinesuppress.c index 6c5b2fccc..dedf6049a 100644 --- a/libaf/af_sinesuppress.c +++ b/libaf/af_sinesuppress.c @@ -28,6 +28,7 @@ #include <math.h> #include <limits.h> +#include "libavutil/mathematics.h" #include "mp_msg.h" #include "af.h" diff --git a/libaf/af_tools.c b/libaf/af_tools.c index 8306a5003..9e1028d53 100644 --- a/libaf/af_tools.c +++ b/libaf/af_tools.c @@ -19,6 +19,7 @@ #include <math.h> #include <string.h> #include "libavutil/common.h" +#include "libavutil/mathematics.h" #include "af.h" /* Convert to gain value from dB. Returns AF_OK if of and AF_ERROR if diff --git a/libaf/filter.c b/libaf/filter.c index c5ab03913..463e4c2f9 100644 --- a/libaf/filter.c +++ b/libaf/filter.c @@ -22,6 +22,7 @@ #include <string.h> #include <math.h> +#include "libavutil/mathematics.h" #include "dsp.h" /****************************************************************************** diff --git a/libaf/window.c b/libaf/window.c index a970bdcbe..9cb374b09 100644 --- a/libaf/window.c +++ b/libaf/window.c @@ -26,6 +26,7 @@ */ #include <math.h> +#include "libavutil/mathematics.h" #include "dsp.h" /* diff --git a/libass/ass_parse.c b/libass/ass_parse.c index bb649715e..3ab3c2aa4 100644 --- a/libass/ass_parse.c +++ b/libass/ass_parse.c @@ -23,6 +23,8 @@ #include <string.h> #include <math.h> +#include "libavutil/mathematics.h" + #include "ass_render.h" #include "ass_parse.h" diff --git a/libass/ass_render.c b/libass/ass_render.c index e0fec919b..fb0cd7ad9 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -21,6 +21,8 @@ #include <assert.h> #include <math.h> +#include "libavutil/mathematics.h" + #include "ass_render.h" #include "ass_parse.h" #include "ass_shaper.h" diff --git a/libmpcodecs/dec_teletext.c b/libmpcodecs/dec_teletext.c index e3b8286a2..e46775dd1 100644 --- a/libmpcodecs/dec_teletext.c +++ b/libmpcodecs/dec_teletext.c @@ -105,6 +105,7 @@ #include "help_mp.h" #include "libmpcodecs/img_format.h" #include "libavutil/common.h" +#include "libavutil/mathematics.h" #include "input/input.h" #include "osdep/timer.h" diff --git a/libmpcodecs/vf_geq.c b/libmpcodecs/vf_geq.c index 6414ec3b2..477a113dc 100644 --- a/libmpcodecs/vf_geq.c +++ b/libmpcodecs/vf_geq.c @@ -35,6 +35,7 @@ #include "libavcodec/avcodec.h" #include "libavutil/common.h" #include "libavutil/eval.h" +#include "libavutil/mathematics.h" struct vf_priv_s { AVExpr * e[3]; diff --git a/libmpcodecs/vf_hue.c b/libmpcodecs/vf_hue.c index 80a3bc0c3..811773f7d 100644 --- a/libmpcodecs/vf_hue.c +++ b/libmpcodecs/vf_hue.c @@ -35,6 +35,8 @@ #include "m_option.h" #include "m_struct.h" +#include "libavutil/mathematics.h" + static struct vf_priv_s { uint8_t *buf[2]; float hue; diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c index 31c9b5060..2a434bab0 100644 --- a/libmpcodecs/vf_qp.c +++ b/libmpcodecs/vf_qp.c @@ -33,6 +33,7 @@ #include "libavcodec/avcodec.h" #include "libavutil/eval.h" +#include "libavutil/mathematics.h" #include "libavutil/mem.h" diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 8595f5459..f2f370d02 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -27,6 +27,7 @@ #include "mp_msg.h" #include "mp_fifo.h" #include "libavutil/common.h" +#include "libavutil/mathematics.h" #include "libavutil/avstring.h" #include "x11_common.h" diff --git a/xvid_vbr.c b/xvid_vbr.c index 5af11f3bd..02a8e6cbb 100644 --- a/xvid_vbr.c +++ b/xvid_vbr.c @@ -31,6 +31,7 @@ #include <math.h> /* Local headers */ +#include "libavutil/mathematics.h" #include "xvid_vbr.h" /****************************************************************************** -- 2.46.2 Alexander
On Sun, 8 Dec 2024 01:25:26 +0100, Alexander Strasser wrote:
M_PI is not mandated by the C standard.
Fix part of ticket 2423 ---
Depening on the platform the switch to C11 has the effect of losing the M_PI define.
i agree we should define m_pi then.
This patch tries to not rely on M_PI being defined while also making the source a bit more standards compliant.
i did not test patch. -compn
On 2024-12-08 01:25 +0100, Alexander Strasser wrote:
M_PI is not mandated by the C standard.
Fix part of ticket 2423 ---
Depening on the platform the switch to C11 has the effect of losing the M_PI define.
This patch tries to not rely on M_PI being defined while also making the source a bit more standards compliant.
The problem was repored in https://trac.mplayerhq.hu/ticket/2423
Committed as SVN r38667 Reporter of ticket 2423 also confirmed it solves part of his problem. Now only the C++ (static) linking problem of that ticket remains to be solved. Alexander
participants (2)
-
Alexander Strasser -
compn