Discussion:
[PATCH 1/2] modplug: allow compilation with libmodplug < 0.8
Johannes Weißl
2011-05-04 15:49:48 UTC
Permalink
---
configure | 10 ++++++++--
modplug.c | 9 +++++++++
2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 127f64a..7e2773a 100755
--- a/configure
+++ b/configure
@@ -176,8 +176,13 @@ check_mikmod()

check_modplug()
{
- pkg_config MODPLUG "libmodplug" "-I/usr/include/libmodplug" "-lmodplug -lstdc++ -lm"
- return $?
+ pkg_config MODPLUG "libmodplug" "-I/usr/include/libmodplug" "-lmodplug -lstdc++ -lm" || return $?
+ MODPLUG_API_8=0
+ if check_function "ModPlug_GetModuleType" $MODPLUG_CFLAGS $MODPLUG_LIBS
+ then
+ MODPLUG_API_8=1
+ fi
+ return 0
}

check_vorbis()
@@ -428,6 +433,7 @@ config_header config/datadir.h DATADIR
config_header config/libdir.h LIBDIR
config_header config/debug.h DEBUG
config_header config/tremor.h CONFIG_TREMOR
+config_header config/modplug.h MODPLUG_API_8
config_header config/mpc.h MPC_SV8
config_header config/mp4.h USE_MPEG4IP
config_header config/curses.h HAVE_RESIZETERM HAVE_USE_DEFAULT_COLORS
diff --git a/modplug.c b/modplug.c
index bcebdde..95dbe98 100644
--- a/modplug.c
+++ b/modplug.c
@@ -19,6 +19,7 @@
#include "ip.h"
#include "file.h"
#include "xmalloc.h"
+#include "config/modplug.h"

#include <modplug.h>
#include <sys/types.h>
@@ -139,9 +140,11 @@ static int mod_read_comments(struct input_plugin_data *ip_data, struct keyval **
if (val && val[0])
comments_add_const(&c, "title", val);

+#if MODPLUG_API_8
val = ModPlug_GetMessage(priv->file);
if (val && val[0])
comments_add_const(&c, "comment", val);
+#endif

keyvals_terminate(&c);
*comments = c.keyvals;
@@ -160,6 +163,7 @@ static long mod_bitrate(struct input_plugin_data *ip_data)
return -IP_ERROR_FUNCTION_NOT_SUPPORTED;
}

+#if MODPLUG_API_8
static const char *mod_type_to_string(int type)
{
/* from <libmodplug/sndfile.h>, which is C++ */
@@ -190,9 +194,11 @@ static const char *mod_type_to_string(int type)
}
return NULL;
}
+#endif

static char *mod_codec(struct input_plugin_data *ip_data)
{
+#if MODPLUG_API_8
struct mod_private *priv = ip_data->private;
const char *codec;
int type;
@@ -201,6 +207,9 @@ static char *mod_codec(struct input_plugin_data *ip_data)
codec = mod_type_to_string(type);

return codec ? xstrdup(codec) : NULL;
+#else
+ return NULL;
+#endif
}

static char *mod_codec_profile(struct input_plugin_data *ip_data)
--
1.7.5
Johannes Weißl
2011-05-04 15:49:49 UTC
Permalink
---
wavpack.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/wavpack.c b/wavpack.c
index b7b60e1..9d57400 100644
--- a/wavpack.c
+++ b/wavpack.c
@@ -375,8 +375,10 @@ static char *wavpack_codec_profile(struct input_plugin_data *ip_data)

if (m & MODE_FAST)
strcat(buf, "fast");
+#ifdef MODE_VERY_HIGH
else if (m & MODE_VERY_HIGH)
strcat(buf, "very high");
+#endif
else if (m & MODE_HIGH)
strcat(buf, "high");
else
@@ -385,11 +387,13 @@ static char *wavpack_codec_profile(struct input_plugin_data *ip_data)
if (m & MODE_HYBRID)
strcat(buf, " hybrid");

+#ifdef MODE_XMODE
if ((m & MODE_EXTRA) && (m & MODE_XMODE)) {
char xmode[] = " x0";
xmode[2] = ((m & MODE_XMODE) >> 12) + '0';
strcat(buf, xmode);
}
+#endif

return xstrdup(buf);
}
--
1.7.5
Johannes Weißl
2011-05-04 16:48:18 UTC
Permalink
Otherwise the HAVE_FFMPEG_AVCODEC_H check is always wrong!
---
ffmpeg.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 439f187..812600f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -16,8 +16,13 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/

-#include <stdio.h>
+#include "ip.h"
+#include "xmalloc.h"
+#include "debug.h"
+#include "utils.h"
+#include "config/ffmpeg.h"

+#include <stdio.h>
#ifdef HAVE_FFMPEG_AVCODEC_H
#include <ffmpeg/avcodec.h>
#include <ffmpeg/avformat.h>
@@ -28,12 +33,6 @@
#include <libavformat/avio.h>
#endif

-#include "ip.h"
-#include "xmalloc.h"
-#include "debug.h"
-#include "utils.h"
-#include "config/ffmpeg.h"
-
#if (LIBAVFORMAT_VERSION_INT < ((52<<16)+(31<<8)+0))
# define NUM_FFMPEG_KEYS 8
#endif
--
1.7.5
Johannes Weißl
2011-05-04 16:48:19 UTC
Permalink
---
ffmpeg.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 812600f..c789757 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -458,12 +458,14 @@ static char *ffmpeg_codec(struct input_plugin_data *ip_data)
#if (LIBAVCODEC_VERSION_INT < ((52<<16)+(104<<8)+0))
static const char *codec_profile_to_str(int profile)
{
+#if (LIBAVCODEC_VERSION_INT >= ((51<<16)+(41<<8)+0))
switch (profile) {
case FF_PROFILE_AAC_MAIN: return "Main";
case FF_PROFILE_AAC_LOW: return "LC";
case FF_PROFILE_AAC_SSR: return "SSR";
case FF_PROFILE_AAC_LTP: return "LTP";
}
+#endif
return NULL;
}
#endif
--
1.7.5
Gregory Petrosyan
2011-05-05 13:10:12 UTC
Permalink
Merged all 4, thanks a lot!

Gregory

Loading...