banshee r4596 - in trunk/banshee: . build build/m4/banshee src/Libraries/Mtp src/Libraries/Mtp/Mtp
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4596 - in trunk/banshee: . build build/m4/banshee src/Libraries/Mtp src/Libraries/Mtp/Mtp
- Date: Tue, 23 Sep 2008 20:38:42 +0000 (UTC)
Author: gburt
Date: Tue Sep 23 20:38:42 2008
New Revision: 4596
URL: http://svn.gnome.org/viewvc/banshee?rev=4596&view=rev
Log:
2008-09-23 Gabriel Burt <gabriel burt gmail com>
* src/Libraries/Mtp/Mtp/Folder.cs:
* src/Libraries/Mtp/Mtp/Album.cs:
* src/Libraries/Mtp/Mtp/Track.cs: Patch from Salah Coronya adding support
for libmtp >= 0.3.0 (aka libmtp8). Modified by myself to #if/else the
patch out if building against older versions of libmtp - so still
compatible with libmtp >= 0.2.0 (BGO #542117).
* src/Libraries/Mtp/Makefile.am: Set the define appropriately based on the
version of libmtp we're building against.
* build/m4/banshee/dap-mtp.m4: Allow libmtp >= 0.30.
* build/build.rules.mk: Pass the BUILD_DEFINES variable to the actual
build command, so assemblies can define things to #if around.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/build/build.rules.mk
trunk/banshee/build/m4/banshee/dap-mtp.m4
trunk/banshee/src/Libraries/Mtp/Makefile.am
trunk/banshee/src/Libraries/Mtp/Mtp/Album.cs
trunk/banshee/src/Libraries/Mtp/Mtp/Folder.cs
trunk/banshee/src/Libraries/Mtp/Mtp/Track.cs
Modified: trunk/banshee/build/build.rules.mk
==============================================================================
--- trunk/banshee/build/build.rules.mk (original)
+++ trunk/banshee/build/build.rules.mk Tue Sep 23 20:38:42 2008
@@ -53,7 +53,7 @@
test "x$$colors" = "xyes" && \
echo -e "\033[1mCompiling $(notdir $@)...\033[0m" || \
echo "Compiling $(notdir $@)...";
- @test "x$(DEVEL_BUILD)" = "xyes" && warn="-warnaserror"; $(BUILD) -nowarn:0078 -target:$(TARGET) -out:$@ $$warn -define:HAVE_GTK_2_10 -define:NET_2_0 $(ENABLE_TESTS_FLAG) $(FILTERED_LINK) $(RESOURCES_BUILD) $(SOURCES_BUILD)
+ @test "x$(DEVEL_BUILD)" = "xyes" && warn="-warnaserror"; $(BUILD) -nowarn:0078 -target:$(TARGET) -out:$@ $$warn -define:HAVE_GTK_2_10 -define:NET_2_0 $(BUILD_DEFINES) $(ENABLE_TESTS_FLAG) $(FILTERED_LINK) $(RESOURCES_BUILD) $(SOURCES_BUILD)
@if [ -e $(notdir $ config) ]; then \
cp $(notdir $ config) $(top_builddir)/bin; \
fi;
Modified: trunk/banshee/build/m4/banshee/dap-mtp.m4
==============================================================================
--- trunk/banshee/build/m4/banshee/dap-mtp.m4 (original)
+++ trunk/banshee/build/m4/banshee/dap-mtp.m4 Tue Sep 23 20:38:42 2008
@@ -10,12 +10,8 @@
libmtp >= $LIBMTP_REQUIRED,
enable_libmtp="$enable_libmtp", enable_libmtp=no)
- PKG_CHECK_MODULES(LIBMTP,
- libmtp < 0.3.0,
- enable_libmtp="$enable_libmtp", enable_libmtp=no)
-
if test "x$enable_mtp" = "xyes" -a "x$enable_libmtp" = "xno"; then
- AC_MSG_ERROR([libmtp was not found or is not up to date. Please install libmtp of at least version $LIBMTP_REQUIRED and less than 0.3.0, or disable MTP support by passing --disable-mtp])
+ AC_MSG_ERROR([libmtp was not found or is not up to date. Please install libmtp of at least version $LIBMTP_REQUIRED, or disable MTP support by passing --disable-mtp])
fi
if test "x$enable_libmtp" = "xyes"; then
@@ -24,5 +20,6 @@
fi
AM_CONDITIONAL(ENABLE_MTP, test "x$enable_libmtp" = "xyes")
+ AM_CONDITIONAL(LIBMTP_EIGHT, test "x$LIBMTP_SO_MAP" = "xlibmtp.so.8")
])
Modified: trunk/banshee/src/Libraries/Mtp/Makefile.am
==============================================================================
--- trunk/banshee/src/Libraries/Mtp/Makefile.am (original)
+++ trunk/banshee/src/Libraries/Mtp/Makefile.am Tue Sep 23 20:38:42 2008
@@ -2,6 +2,10 @@
TARGET = library
LINK = $(REF_MTP)
+if LIBMTP_EIGHT
+BUILD_DEFINES = "-define:LIBMTP8"
+endif
+
SOURCES = \
Mtp/AbstractTrackList.cs \
Mtp/Album.cs \
Modified: trunk/banshee/src/Libraries/Mtp/Mtp/Album.cs
==============================================================================
--- trunk/banshee/src/Libraries/Mtp/Mtp/Album.cs (original)
+++ trunk/banshee/src/Libraries/Mtp/Mtp/Album.cs Tue Sep 23 20:38:42 2008
@@ -119,7 +119,11 @@
protected override int Create ()
{
+#if LIBMTP8
+ return LIBMTP_Create_New_Album (Device.Handle, ref album);
+#else
return LIBMTP_Create_New_Album (Device.Handle, ref album, 0);
+#endif
}
protected override int Update ()
@@ -159,8 +163,13 @@
[DllImport("libmtp.dll")]
internal static extern IntPtr LIBMTP_Get_Album (MtpDeviceHandle handle, uint albumId); // LIBMTP_album_t*
+#if LIBMTP8
+ [DllImport("libmtp.dll")]
+ internal static extern int LIBMTP_Create_New_Album (MtpDeviceHandle handle, ref AlbumStruct album);
+#else
[DllImport("libmtp.dll")]
internal static extern int LIBMTP_Create_New_Album (MtpDeviceHandle handle, ref AlbumStruct album, uint parentId);
+#endif
[DllImport("libmtp.dll")]
internal static extern int LIBMTP_Update_Album (MtpDeviceHandle handle, ref AlbumStruct album);
@@ -170,6 +179,10 @@
internal struct AlbumStruct
{
public uint album_id;
+#if LIBMTP8
+ public uint parent_id;
+ public uint storage_id;
+#endif
[MarshalAs(UnmanagedType.LPStr)]
public string name;
Modified: trunk/banshee/src/Libraries/Mtp/Mtp/Folder.cs
==============================================================================
--- trunk/banshee/src/Libraries/Mtp/Mtp/Folder.cs (original)
+++ trunk/banshee/src/Libraries/Mtp/Mtp/Folder.cs Tue Sep 23 20:38:42 2008
@@ -215,6 +215,9 @@
{
public uint folder_id;
public uint parent_id;
+#if LIBMTP8
+ public uint storage_id;
+#endif
[MarshalAs(UnmanagedType.LPStr)] public string name;
public IntPtr sibling; // LIBMTP_folder_t*
public IntPtr child; // LIBMTP_folder_t*
Modified: trunk/banshee/src/Libraries/Mtp/Mtp/Track.cs
==============================================================================
--- trunk/banshee/src/Libraries/Mtp/Mtp/Track.cs (original)
+++ trunk/banshee/src/Libraries/Mtp/Mtp/Track.cs Tue Sep 23 20:38:42 2008
@@ -134,6 +134,13 @@
set { trackStruct.usecount = value; }
}
+#if LIBMTP8
+ public string Composer {
+ get { return trackStruct.composer; }
+ set { trackStruct.composer = value; }
+ }
+#endif
+
public Track (string filename, ulong filesize) : this (new TrackStruct (), null)
{
this.trackStruct.filename = filename;
@@ -209,7 +216,11 @@
internal static void SendTrack (MtpDeviceHandle handle, string path, ref TrackStruct metadata, ProgressFunction callback, IntPtr data, uint parent)
{
+#if LIBMTP8
+ if (LIBMTP_Send_Track_From_File (handle, path, ref metadata, callback, data) != 0)
+#else
if (LIBMTP_Send_Track_From_File (handle, path, ref metadata, callback, data, parent) != 0)
+#endif
{
LibMtpException.CheckErrorStack (handle);
throw new LibMtpException (ErrorCode.General, "Could not upload the track");
@@ -240,8 +251,13 @@
[DllImport("libmtp.dll")]
private static extern int LIBMTP_Get_Track_To_File (MtpDeviceHandle handle, uint trackId, string path, ProgressFunction callback, IntPtr data);
+#if LIBMTP8
+ [DllImport("libmtp.dll")]
+ private static extern int LIBMTP_Send_Track_From_File (MtpDeviceHandle handle, string path, ref TrackStruct track, ProgressFunction callback, IntPtr data);
+#else
[DllImport("libmtp.dll")]
private static extern int LIBMTP_Send_Track_From_File (MtpDeviceHandle handle, string path, ref TrackStruct track, ProgressFunction callback, IntPtr data, uint parentHandle);
+#endif
[DllImport("libmtp.dll")]
private static extern int LIBMTP_Update_Track_Metadata (MtpDeviceHandle handle, ref TrackStruct metadata);
@@ -258,9 +274,15 @@
{
public uint item_id;
public uint parent_id;
-
+#if LIBMTP8
+ public uint storage_id;
+#endif
+
[MarshalAs(UnmanagedType.LPStr)] public string title;
[MarshalAs(UnmanagedType.LPStr)] public string artist;
+#if LIBMTP8
+ [MarshalAs(UnmanagedType.LPStr)] public string composer;
+#endif
[MarshalAs(UnmanagedType.LPStr)] public string genre;
[MarshalAs(UnmanagedType.LPStr)] public string album;
[MarshalAs(UnmanagedType.LPStr)] public string date;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]