Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > a5d747ed995899f017759677dc1ca1c7 > files > 1

mythplugins-0.24-20110303.2plf.src.rpm

From fae3a90d5df1ef1606f1506b21bb536c3873db32 Mon Sep 17 00:00:00 2001
From: Colin Guthrie <cguthrie@mandriva.org>
Date: Thu, 3 Mar 2011 17:47:47 +0000
Subject: [PATCH] lame: Allow building without lame libraries.

---
 configure                              |   26 ++++++++++++++++++++------
 mythmusic/mythmusic/cdrip.cpp          |    7 +++++++
 mythmusic/mythmusic/globalsettings.cpp |    7 +++++++
 mythmusic/mythmusic/mythmusic.pro      |    6 +++---
 settings.pro                           |    2 +-
 5 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 47973ea..c4bd69c 100755
--- a/configure
+++ b/configure
@@ -115,6 +115,7 @@ opengl
 libvisual
 fftw
 sdl
+mp3lame
 exif
 newexif
 dcraw
@@ -174,6 +175,7 @@ MythMusic related options:
   --enable-libvisual       enable libvisual visualizers [$libvisual]
   --enable-fftw            enable fftw visualizers [$fftw]
   --enable-sdl             use SDL for the synaesthesia output [$sdl]
+  --enable-libmp3lame      enable MP3 encoding support using LAME [$mp3lame]
 
 MythNews related options:
   --enable-mythnews        build the mythnews plugin [$news]
@@ -522,11 +524,11 @@ if test "$music" != "no" ; then
         echo "MythMusic requires CDDA Paranoia."
     fi
 
-    mp3lame="no"
-    if has_header lame/lame.h && has_library libmp3lame ; then
-        mp3lame="yes"
-    else
-        echo "MythMusic requires the LAME mp3 encoder."
+    if test "$mp3lame" != "no" ; then
+        mp3lame="no"
+        if has_header lame/lame.h && has_library libmp3lame ; then
+            mp3lame="yes"
+        fi
     fi
 
     taglib="no"
@@ -550,7 +552,7 @@ if test "$music" != "no" ; then
         fi
     fi
 
-    if test "$vorbis" = "no" -o "$flac" = "no" -o "$mp3lame" = "no" -o "$taglib" = "no" -o "$cdlibs" = "no" ; then
+    if test "$vorbis" = "no" -o "$flac" = "no" -o "$taglib" = "no" -o "$cdlibs" = "no" ; then
         echo "Disabling MythMusic due to missing dependencies."
         music="no"
     fi
@@ -849,6 +851,18 @@ if test "$music" = "yes" ; then
     if test "$taglib" = "yes" ; then
         echo "INCLUDEPATH += `taglib-config --prefix`/include/taglib" >> ./mythmusic/mythmusic/config.pro
     fi
+
+    if test "$mp3lame" = "yes" ; then
+        echo "        MP3 encoding   support will be included in MythMusic"
+        echo "#define LAME 1" >> ./mythmusic/mythmusic/config.h
+        echo "LIBS += -lmp3lame" >> ./mythmusic/mythmusic/config.pro
+        echo "HEADERS += lameencoder.h" >> ./mythmusic/mythmusic/config.pro
+        echo "SOURCES += lameencoder.cpp" >> ./mythmusic/mythmusic/config.pro
+    fi
+
+    if test "$mp3lame" = "no" ; then
+        echo "        MP3 encoding   support will not be included in MythMusic"
+    fi
 fi
 
 ###########################################################
diff --git a/mythmusic/mythmusic/cdrip.cpp b/mythmusic/mythmusic/cdrip.cpp
index d6f522c..66fca65 100644
--- a/mythmusic/mythmusic/cdrip.cpp
+++ b/mythmusic/mythmusic/cdrip.cpp
@@ -45,11 +45,14 @@ using namespace std;
 #include <mythuibuttonlist.h>
 
 // MythMusic includes
+#include "config.h"
 #include "cdrip.h"
 #include "cddecoder.h"
 #include "encoder.h"
 #include "vorbisencoder.h"
+#ifdef LAME
 #include "lameencoder.h"
+#endif
 #include "flacencoder.h"
 #include "genres.h"
 #include "editmetadata.h"
@@ -193,7 +196,9 @@ void CDRipperThread::run(void)
 
     QString textstatus;
     QString encodertype = gCoreContext->GetSetting("EncoderType");
+#ifdef LAME
     bool mp3usevbr = gCoreContext->GetNumSetting("Mp3UseVBR", 0);
+#endif
 
     m_totalSectors = 0;
     m_totalSectorsDone = 0;
@@ -260,6 +265,7 @@ void CDRipperThread::run(void)
 
                 if (m_quality < 3)
                 {
+#ifdef LAME
                     if (encodertype == "mp3")
                     {
                         outfile += ".mp3";
@@ -267,6 +273,7 @@ void CDRipperThread::run(void)
                                                       titleTrack, mp3usevbr));
                     }
                     else // ogg
+#endif
                     {
                         outfile += ".ogg";
                         encoder.reset(new VorbisEncoder(outfile, m_quality,
diff --git a/mythmusic/mythmusic/globalsettings.cpp b/mythmusic/mythmusic/globalsettings.cpp
index 565981b..c19b581 100644
--- a/mythmusic/mythmusic/globalsettings.cpp
+++ b/mythmusic/mythmusic/globalsettings.cpp
@@ -28,6 +28,7 @@
 
 // mythmusic
 #include "globalsettings.h"
+#include "config.h"
 #include "mainvisual.h"
 #include "mythlistview-qt3.h"
 
@@ -185,7 +186,9 @@ static HostComboBox *EncoderType()
     HostComboBox *gc = new HostComboBox("EncoderType");
     gc->setLabel(QObject::tr("Encoding"));
     gc->addSelection(QObject::tr("Ogg Vorbis"), "ogg");
+#ifdef LAME
     gc->addSelection(QObject::tr("Lame (MP3)"), "mp3");
+#endif
     gc->setHelpText(QObject::tr("Audio encoder to use for CD ripping. "
                     "Note that the quality level 'Perfect' will use the "
 		                "FLAC encoder."));
@@ -204,6 +207,7 @@ static HostComboBox *DefaultRipQuality()
     return gc;
 };
 
+#ifdef LAME
 static HostCheckBox *Mp3UseVBR()
 {
     HostCheckBox *gc = new HostCheckBox("Mp3UseVBR");
@@ -214,6 +218,7 @@ static HostCheckBox *Mp3UseVBR()
                     "The Ogg encoder will always use variable bitrates."));
     return gc;
 };
+#endif
 
 static HostLineEdit *FilenameTemplate()
 {
@@ -649,7 +654,9 @@ MusicRipperSettings::MusicRipperSettings(void)
     encodersettings->setLabel(QObject::tr("CD Ripper Settings (part 2)"));
     encodersettings->addChild(EncoderType());
     encodersettings->addChild(DefaultRipQuality());
+#ifdef LAME
     encodersettings->addChild(Mp3UseVBR());
+#endif
     addChild(encodersettings);
 }
 
diff --git a/mythmusic/mythmusic/mythmusic.pro b/mythmusic/mythmusic/mythmusic.pro
index 3ba7a5f..7fdd865 100644
--- a/mythmusic/mythmusic/mythmusic.pro
+++ b/mythmusic/mythmusic/mythmusic.pro
@@ -20,7 +20,7 @@ LIBS += -lmythavformat
 LIBS += -lmythavcodec
 LIBS += -lmythavcore
 LIBS += -lmythavutil
-LIBS += -ltag -logg -lvorbisfile -lvorbis -lvorbisenc -lFLAC -lmp3lame
+LIBS += -ltag -logg -lvorbisfile -lvorbis -lvorbisenc -lFLAC
 
 cdaudio: LIBS += -lcdaudio
 paranoia:LIBS += -lcdda_paranoia -lcdda_interface
@@ -31,7 +31,7 @@ HEADERS += decoder.h flacencoder.h mainvisual.h
 HEADERS += metadata.h playbackbox.h playlist.h polygon.h
 HEADERS += streaminput.h synaesthesia.h encoder.h visualize.h avfdecoder.h
 HEADERS += treecheckitem.h vorbisencoder.h polygon.h
-HEADERS += bumpscope.h globalsettings.h lameencoder.h dbcheck.h
+HEADERS += bumpscope.h globalsettings.h dbcheck.h
 HEADERS += metaio.h metaiotaglib.h
 HEADERS += metaioflacvorbis.h metaioavfcomment.h metaiomp4.h
 HEADERS += metaiowavpack.h metaioid3.h metaiooggvorbis.h
@@ -49,7 +49,7 @@ SOURCES += cddecoder.cpp cdrip.cpp decoder.cpp
 SOURCES += flacencoder.cpp main.cpp
 SOURCES += mainvisual.cpp metadata.cpp playbackbox.cpp playlist.cpp
 SOURCES += streaminput.cpp encoder.cpp dbcheck.cpp
-SOURCES += synaesthesia.cpp treecheckitem.cpp lameencoder.cpp
+SOURCES += synaesthesia.cpp treecheckitem.cpp
 SOURCES += vorbisencoder.cpp visualize.cpp bumpscope.cpp globalsettings.cpp
 SOURCES += databasebox.cpp genres.cpp
 SOURCES += metaio.cpp metaiotaglib.cpp
diff --git a/settings.pro b/settings.pro
index 4ddc739..9bba69a 100644
--- a/settings.pro
+++ b/settings.pro
@@ -60,7 +60,7 @@ LOCAL_LIBDIR_X11 =
 }
 QMAKE_LIBDIR_X11 = 
 
-EXTRA_LIBS += -lfreetype -lmp3lame
+EXTRA_LIBS += -lfreetype
 EXTRA_LIBS += $$CONFIG_AUDIO_ALSA_LIBS
 EXTRA_LIBS += $$CONFIG_AUDIO_JACK_LIBS
 EXTRA_LIBS += $$CONFIG_FIREWIRE_LIBS
-- 
1.7.4.1