SDL_mixer: mpg123 loader: handle api (but not abi) change as of mpg123-1.26.0 (3d6c9)

From 3d6c958eff57c37ac352ee076930ec66c366dcf9 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 26 Jan 2022 12:40:50 +0300
Subject: [PATCH] mpg123 loader: handle api (but not abi) change as of
 mpg123-1.26.0

thanks to Vitaly Novichkov for the notification
---
 dynamic_mp3.c | 4 ++++
 dynamic_mp3.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/dynamic_mp3.c b/dynamic_mp3.c
index 00f6918c..7c3209f0 100644
--- a/dynamic_mp3.c
+++ b/dynamic_mp3.c
@@ -58,7 +58,11 @@ int Mix_InitMP3(void)
 		FUNCTION_LOADER(mpg123_open_handle, int (*)(mpg123_handle *mh, void *iohandle))
 		FUNCTION_LOADER(mpg123_plain_strerror, const char* (*)(int errcode))
 		FUNCTION_LOADER(mpg123_rates, void (*)(const long **list, size_t *number))
+#if (MPG123_API_VERSION >= 45) /* api (but not abi) change as of mpg123-1.26.0 */
+		FUNCTION_LOADER(mpg123_read, int (*)(mpg123_handle *mh, void *outmemory, size_t outmemsize, size_t *done ))
+#else
 		FUNCTION_LOADER(mpg123_read, int (*)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done ))
+#endif
 		FUNCTION_LOADER(mpg123_replace_reader_handle, int (*)( mpg123_handle *mh, ssize_t (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) ))
 		FUNCTION_LOADER(mpg123_seek, off_t (*)( mpg123_handle *mh, off_t sampleoff, int whence ))
 		FUNCTION_LOADER(mpg123_strerror, const char* (*)(mpg123_handle *mh))
diff --git a/dynamic_mp3.h b/dynamic_mp3.h
index f1711f98..2e4c48af 100644
--- a/dynamic_mp3.h
+++ b/dynamic_mp3.h
@@ -38,7 +38,11 @@ typedef struct {
 	int (*mpg123_open_handle)(mpg123_handle *mh, void *iohandle);
 	const char* (*mpg123_plain_strerror)(int errcode);
 	void (*mpg123_rates)(const long **list, size_t *number);
+#if (MPG123_API_VERSION >= 45) /* api (but not abi) change as of mpg123-1.26.0 */
+	int (*mpg123_read)(mpg123_handle *mh, void *outmemory, size_t outmemsize, size_t *done );
+#else
 	int (*mpg123_read)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done );
+#endif
 	int (*mpg123_replace_reader_handle)( mpg123_handle *mh, ssize_t (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) );
 	off_t (*mpg123_seek)( mpg123_handle *mh, off_t sampleoff, int whence );
 	const char* (*mpg123_strerror)(mpg123_handle *mh);