diff --git a/dist/macdeploy.py b/dist/macdeploy.py index 8036cf1d2..797dabebe 100755 --- a/dist/macdeploy.py +++ b/dist/macdeploy.py @@ -76,9 +76,6 @@ GSTREAMER_PLUGINS=[ # Icecast support 'libgsticydemux.so', - # Fingerprinting support - 'libgstofa.so', - # CD support 'libgstcdio.so', ] diff --git a/dist/windows/clementine.nsi.in b/dist/windows/clementine.nsi.in index 36ed436de..60fbd367d 100644 --- a/dist/windows/clementine.nsi.in +++ b/dist/windows/clementine.nsi.in @@ -87,10 +87,12 @@ Section "Delete old files" oldfiles Delete "$INSTDIR\libgstrtsp-0.10.dll" Delete "$INSTDIR\libgstsdp-0.10.dll" Delete "$INSTDIR\libgsttag-0.10.dll" + Delete "$INSTDIR\libofa.dll" Delete "$INSTDIR\libxml2.dll" Delete "$INSTDIR\z.dll" Delete "$INSTDIR\gstreamer-plugins\libgstasfdemux.dll" Delete "$INSTDIR\gstreamer-plugins\libgstffmpeg-gpl.dll" + Delete "$INSTDIR\gstreamer-plugins\libgstofa.dll" Delete "$INSTDIR\gstreamer-plugins\libgstqueue2.dll" Delete "$INSTDIR\gstreamer-plugins\libgstsoup.dll" @@ -149,7 +151,6 @@ Section "Clementine" Clementine File "libmad.dll" File "libmms-0.dll" File "libmp3lame-0.dll" - File "libofa.dll" File "libogg-0.dll" File "liboil-0.3-0.dll" File "liborc-0.4-0.dll" @@ -267,7 +268,6 @@ Section "Gstreamer plugins" gstreamer-plugins File "/oname=libgstmad.dll" "gstreamer-plugins\libgstmad.dll" File "/oname=libgstmms.dll" "gstreamer-plugins\libgstmms.dll" File "/oname=libgstmpegaudioparse.dll" "gstreamer-plugins\libgstmpegaudioparse.dll" - File "/oname=libgstofa.dll" "gstreamer-plugins\libgstofa.dll" File "/oname=libgstogg.dll" "gstreamer-plugins\libgstogg.dll" File "/oname=libgstqtdemux.dll" "gstreamer-plugins\libgstqtdemux.dll" File "/oname=libgstreplaygain.dll" "gstreamer-plugins\libgstreplaygain.dll" @@ -990,7 +990,6 @@ Section "Uninstall" Delete "$INSTDIR\libmad.dll" Delete "$INSTDIR\libmms-0.dll" Delete "$INSTDIR\libmp3lame-0.dll" - Delete "$INSTDIR\libofa.dll" Delete "$INSTDIR\libogg-0.dll" Delete "$INSTDIR\liboil-0.3-0.dll" Delete "$INSTDIR\liborc-0.4-0.dll" @@ -1048,7 +1047,6 @@ Section "Uninstall" Delete "$INSTDIR\gstreamer-plugins\libgstmad.dll" Delete "$INSTDIR\gstreamer-plugins\libgstmms.dll" Delete "$INSTDIR\gstreamer-plugins\libgstmpegaudioparse.dll" - Delete "$INSTDIR\gstreamer-plugins\libgstofa.dll" Delete "$INSTDIR\gstreamer-plugins\libgstogg.dll" Delete "$INSTDIR\gstreamer-plugins\libgstqtdemux.dll" Delete "$INSTDIR\gstreamer-plugins\libgstreplaygain.dll" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6bc094ce9..36aa4ede7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -182,7 +182,6 @@ set(SOURCES musicbrainz/chromaprinter.cpp musicbrainz/echoprinter.cpp - musicbrainz/fingerprinter.cpp musicbrainz/musicbrainzclient.cpp musicbrainz/musicdnsclient.cpp musicbrainz/tagfetcher.cpp diff --git a/src/musicbrainz/fingerprinter.cpp b/src/musicbrainz/fingerprinter.cpp deleted file mode 100644 index ab353c68e..000000000 --- a/src/musicbrainz/fingerprinter.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* This file is part of Clementine. - Copyright 2010, David Sansome - - Clementine is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Clementine is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Clementine. If not, see . -*/ - -#include "fingerprinter.h" -#include "core/logging.h" - -#include -#include -#include - -Fingerprinter::Fingerprinter(const QString& filename) - : filename_(filename), - event_loop_(NULL), - convert_element_(NULL) -{ -} - -Fingerprinter::~Fingerprinter() { -} - -bool Fingerprinter::GstreamerHasOfa() { - GstElementFactory* factory = gst_element_factory_find("ofa"); - if (!factory) { - return false; - } - - gst_object_unref(factory); - return true; -} - -GstElement* Fingerprinter::CreateElement(const QString &factory_name, - GstElement *bin) { - GstElement* ret = gst_element_factory_make( - factory_name.toAscii().constData(), - factory_name.toAscii().constData()); - - if (ret && bin) - gst_bin_add(GST_BIN(bin), ret); - - if (!ret) { - qLog(Warning) << "Couldn't create the gstreamer element" << factory_name; - } - - return ret; -} - -QString Fingerprinter::CreateFingerprint() { - GMainContext* context = g_main_context_new(); - g_main_context_push_thread_default(context); - event_loop_ = g_main_loop_new(context, FALSE); - - GstElement* pipeline = gst_pipeline_new("pipeline"); - GstElement* src = CreateElement("filesrc", pipeline); - GstElement* decode = CreateElement("decodebin2", pipeline); - GstElement* convert = CreateElement("audioconvert", pipeline); - GstElement* ofa = CreateElement("ofa", pipeline); - GstElement* sink = CreateElement("fakesink", pipeline); - - if (!src || !decode || !convert || !ofa || !sink) { - return QString(); - } - - convert_element_ = convert; - - // Connect the elements - gst_element_link_many(src, decode, NULL); - gst_element_link_many(convert, ofa, sink, NULL); - - // Set the filename - g_object_set(src, "location", filename_.toLocal8Bit().constData(), NULL); - - // Connect signals - g_signal_connect(decode, "new-decoded-pad", G_CALLBACK(NewPadCallback), this); - gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline)), BusCallbackSync, this); - guint bus_callback_id = gst_bus_add_watch(gst_pipeline_get_bus(GST_PIPELINE(pipeline)), BusCallback, this); - - // Start playing - gst_element_set_state(pipeline, GST_STATE_PLAYING); - - g_main_loop_run(event_loop_); - g_main_loop_unref(event_loop_); - g_main_context_unref(context); - - // Cleanup - gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline)), NULL, NULL); - g_source_remove(bus_callback_id); - gst_object_unref(pipeline); - - return fingerprint_; -} - -void Fingerprinter::NewPadCallback(GstElement*, GstPad* pad, gboolean, gpointer data) { - Fingerprinter* instance = reinterpret_cast(data); - GstPad* const audiopad = gst_element_get_pad(instance->convert_element_, "sink"); - - if (GST_PAD_IS_LINKED(audiopad)) { - qLog(Warning) << "audiopad is already linked, unlinking old pad"; - gst_pad_unlink(audiopad, GST_PAD_PEER(audiopad)); - } - - gst_pad_link(pad, audiopad); - gst_object_unref(audiopad); -} - -void Fingerprinter::ReportError(GstMessage* msg) { - GError* error; - gchar* debugs; - - gst_message_parse_error(msg, &error, &debugs); - QString message = QString::fromLocal8Bit(error->message); - - g_error_free(error); - free(debugs); - - qLog(Error) << "Error processing" << filename_ << ":" << message; -} - -gboolean Fingerprinter::BusCallback(GstBus*, GstMessage* msg, gpointer data) { - Fingerprinter* instance = reinterpret_cast(data); - - switch (GST_MESSAGE_TYPE(msg)) { - case GST_MESSAGE_ERROR: - instance->ReportError(msg); - g_main_loop_quit(instance->event_loop_); - break; - - case GST_MESSAGE_TAG: - instance->TagMessageReceived(msg); - break; - - default: - break; - } - return GST_BUS_DROP; -} - -GstBusSyncReply Fingerprinter::BusCallbackSync(GstBus*, GstMessage* msg, gpointer data) { - Fingerprinter* instance = reinterpret_cast(data); - - switch (GST_MESSAGE_TYPE(msg)) { - case GST_MESSAGE_EOS: - g_main_loop_quit(instance->event_loop_); - break; - - case GST_MESSAGE_ERROR: - instance->ReportError(msg); - g_main_loop_quit(instance->event_loop_); - break; - - case GST_MESSAGE_TAG: - instance->TagMessageReceived(msg); - break; - - default: - break; - } - return GST_BUS_PASS; -} - -void Fingerprinter::TagMessageReceived(GstMessage* message) { - GstTagList* taglist = NULL; - gst_message_parse_tag(message, &taglist); - - gchar* data = NULL; - bool success = gst_tag_list_get_string(taglist, "ofa-fingerprint", &data); - - if (success && data) { - fingerprint_ = QString::fromUtf8(data); - g_free(data); - } - - gst_tag_list_free(taglist); -} diff --git a/src/musicbrainz/fingerprinter.h b/src/musicbrainz/fingerprinter.h deleted file mode 100644 index e49da8f2d..000000000 --- a/src/musicbrainz/fingerprinter.h +++ /dev/null @@ -1,67 +0,0 @@ -/* This file is part of Clementine. - Copyright 2010, David Sansome - - Clementine is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Clementine is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Clementine. If not, see . -*/ - -#ifndef FINGERPRINTER_H -#define FINGERPRINTER_H - -#include -#include - -#include - -class QEventLoop; - -class Fingerprinter { - // Creates an OFA fingerprint from a song. - // Uses GStreamer to open and decode the file, also uses gstreamer's ofa - // element to generate the fingerprint. The fingerprint identifies one - // particular encoding of a song. Pass the fingerprint to MusicDNS to - // identify it. - // You should create one Fingerprinter for each file you want to fingerprint. - // This class works well with QtConcurrentMap. - -public: - Fingerprinter(const QString& filename); - ~Fingerprinter(); - - // Checks if this gstreamer installation has the required ofa plugin. - static bool GstreamerHasOfa(); - - // Creates a fingerprint from the song. This method is blocking, so you want - // to call it in another thread. Returns an empty string if no fingerprint - // could be created. - QString CreateFingerprint(); - -private: - GstElement* CreateElement(const QString& factory_name, GstElement* bin = NULL); - - void ReportError(GstMessage* message); - void TagMessageReceived(GstMessage* message); - - static void NewPadCallback(GstElement*, GstPad* pad, gboolean, gpointer data); - static gboolean BusCallback(GstBus*, GstMessage* msg, gpointer data); - static GstBusSyncReply BusCallbackSync(GstBus*, GstMessage* msg, gpointer data); - -private: - QString filename_; - QString fingerprint_; - GMainLoop* event_loop_; - - GstElement* convert_element_; -}; - -#endif // FINGERPRINTER_H diff --git a/src/ui/edittagdialog.cpp b/src/ui/edittagdialog.cpp index 5ada0a35d..fbdea511d 100644 --- a/src/ui/edittagdialog.cpp +++ b/src/ui/edittagdialog.cpp @@ -25,7 +25,6 @@ #include "covers/coverproviders.h" #include "library/library.h" #include "library/librarybackend.h" -#include "musicbrainz/fingerprinter.h" #include "playlist/playlistdelegates.h" #include "ui/albumcoverchoicecontroller.h" #include "ui/coverfromurldialog.h" @@ -728,11 +727,6 @@ void EditTagDialog::ResetPlayCounts() { } void EditTagDialog::FetchTag() { - if (!Fingerprinter::GstreamerHasOfa()) { - QMessageBox::warning(this, tr("Error"), tr("Your gstreamer installation is missing the 'ofa' plugin. This is required for automatic tag fetching. Try installing the 'gstreamer-plugins-bad' package.")); - return; - } - const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes(); SongList songs; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 35845efa6..d159ecc0c 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -54,7 +54,6 @@ #include "library/librarydirectorymodel.h" #include "library/libraryfilterwidget.h" #include "library/libraryviewcontainer.h" -#include "musicbrainz/fingerprinter.h" #include "musicbrainz/tagfetcher.h" #include "playlist/playlistbackend.h" #include "playlist/playlist.h" @@ -2117,11 +2116,6 @@ void MainWindow::Exit() { } void MainWindow::AutoCompleteTags() { - if (!Fingerprinter::GstreamerHasOfa()) { - QMessageBox::warning(this, tr("Error"), tr("Your gstreamer installation is missing the 'ofa' plugin. This is required for automatic tag fetching. Try installing the 'gstreamer-plugins-bad' package.")); - return; - } - // Create the tag fetching stuff if it hasn't been already if (!tag_fetcher_) { tag_fetcher_.reset(new TagFetcher);