Register gstafcsrc properly, and use it when playing songs from an afcdevice

This commit is contained in:
David Sansome 2010-08-01 18:09:38 +00:00
parent 3535e5b954
commit 2a7c6de273
9 changed files with 45 additions and 42 deletions

View File

@ -12,7 +12,6 @@ include_directories(${IMOBILEDEVICE_INCLUDE_DIRS})
set(SOURCES
gstafcsrc.cpp
main.c
)
add_library(gstafcsrc STATIC

View File

@ -311,3 +311,24 @@ static gboolean gst_afc_src_get_size(GstBaseSrc* src, guint64* size) {
return true;
}
#define PACKAGE "Clementine"
static gboolean afcsrc_init(GstPlugin* afcsrc) {
return gst_element_register(afcsrc, "afcsrc", GST_RANK_PRIMARY, GST_TYPE_AFCSRC);
}
void afcsrc_register_static() {
gst_plugin_register_static(
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"afcsrc",
"iPod/iPhone Source",
afcsrc_init,
"0.1",
"GPL",
"Clementine",
"Clementine",
"http://www.clementine-player.org/");
}

View File

@ -24,6 +24,8 @@
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
void afcsrc_register_static();
G_BEGIN_DECLS
#define GST_TYPE_AFCSRC \

View File

@ -1,38 +0,0 @@
/* This file is part of Clementine.
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 <http://www.gnu.org/licenses/>.
*/
#include "gstafcsrc.h"
#include <gst/gst.h>
#define PACKAGE "Clementine"
static gboolean afcsrc_init(GstPlugin* afcsrc) {
return gst_element_register(afcsrc, "afcsrc", GST_RANK_PRIMARY, GST_TYPE_AFCSRC);
}
GST_PLUGIN_DEFINE_STATIC(
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"afcsrc",
"iPod/iPhone Source",
afcsrc_init,
"0.1",
"GPL",
"Clementine",
"http://www.clementine-player.org/"
)

View File

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.6)
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS "-Woverloaded-virtual -Wall")
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${SPARKLE})
include_directories(../3rdparty/gmock/gtest/include)
include_directories(../3rdparty/qtwin)
@ -601,7 +601,6 @@ if(HAVE_IMOBILEDEVICE)
target_link_libraries(clementine_lib
${IMOBILEDEVICE_LIBRARIES}
${PLIST_LIBRARIES}
gstafcsrc
)
endif(HAVE_IMOBILEDEVICE)
@ -657,6 +656,12 @@ target_link_libraries(clementine
clementine_lib
)
if(HAVE_IMOBILEDEVICE)
target_link_libraries(clementine
gstafcsrc
)
endif(HAVE_IMOBILEDEVICE)
set_target_properties(clementine PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "../dist/Info.plist"
)

View File

@ -56,6 +56,7 @@ void AfcDevice::CopyFinished() {
// Now load the songs from the local database
loader_ = new GPodLoader(local_path_, manager_->task_manager(), backend_);
loader_->set_music_path_prefix("afc://" + url_.host());
loader_->moveToThread(loader_thread_);
connect(loader_, SIGNAL(Error(QString)), SIGNAL(Error(QString)));

View File

@ -58,7 +58,8 @@ void GPodLoader::LoadDatabase() {
Song song;
song.InitFromItdb(track);
song.set_directory_id(1);
song.set_filename(mount_point_ + song.filename());
song.set_filename((path_prefix_.isEmpty() ? mount_point_ : path_prefix_) +
song.filename());
songs << song;
}

View File

@ -33,6 +33,8 @@ public:
GPodLoader(const QString& mount_point, TaskManager* task_manager,
LibraryBackend* backend, QObject* parent = 0);
void set_music_path_prefix(const QString& prefix) { path_prefix_ = prefix; }
public slots:
void LoadDatabase();
@ -45,6 +47,7 @@ private:
QThread* original_thread_;
QString mount_point_;
QString path_prefix_;
TaskManager* task_manager_;
LibraryBackend* backend_;
};

View File

@ -21,9 +21,14 @@
#define DEBUG_PREFIX "Gst-Engine"
#include "config.h"
#include "gstengine.h"
#include "gstenginepipeline.h"
#ifdef HAVE_IMOBILEDEVICE
# include "gstafcsrc/gstafcsrc.h"
#endif
#include <math.h>
#include <unistd.h>
#include <vector>
@ -134,6 +139,10 @@ bool GstEngine::Init() {
return false;
}
#ifdef HAVE_IMOBILEDEVICE
afcsrc_register_static();
#endif
return true;
}