Summary: | ktrm.cpp compile failure against libtunepimp-0.4.0 | ||
---|---|---|---|
Product: | [Applications] juk | Reporter: | Rex Dieter <rdieter> |
Component: | general | Assignee: | Scott Wheeler <wheeler> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
quick-n-dirty (untested) build fix
another similar tunepimp patch |
Description
Rex Dieter
2005-11-17 19:26:49 UTC
Created attachment 13514 [details]
quick-n-dirty (untested) build fix
Of course, the patch fixes the build against libtunepimp-0.4 but (probably) breaks building against libtunepimp-0.3. See also bug #94988 (similar problem w/amarok) I've just downloaded the latest library and will try to do some testing with it today and then get a version into JuK and amaroK that has #ifdef's for the 0.3 and 0.4 versions. Hopefully it'll make it into 3.5. Thanks Scott. FYI, with the amarok patch I provided (see bug #94988), it at least compiles, but lookups are very flaky: 1. Initial musicbrainz lookup, ie, the first lookup on any audio file, (always?) fails. 2. ~75% of subsequent lookups on the same fail hang. 3. ~25% of subsequent lookups succeed. ??? So, I'd venture to guess there's some code changes required. (-: Created attachment 13646 [details]
another similar tunepimp patch
I have found this problem also. But, I do not set to 1 the last parameter of
tp_AddFile(). And more convenient to use status parameter of
TRMNotifyCallback() instead of tr_GetStatus() method.
SVN commit 499319 by mueller: musicbrainz 0.4.x support BUG:116575 M +3 -1 configure.in.in M +26 -3 ktrm.cpp --- branches/KDE/3.5/kdemultimedia/juk/configure.in.in #499318:499319 @@ -35,7 +35,9 @@ fi if test "x$have_musicbrainz" = xyes; then - AC_DEFINE(HAVE_MUSICBRAINZ, 1, [have MusicBrainz]) + AC_CHECK_LIB(tunepimp, tp_SetFileNameEncoding, + AC_DEFINE(HAVE_MUSICBRAINZ, 4, [have MusicBrainz 0.4.x]), + AC_DEFINE(HAVE_MUSICBRAINZ, 1, [have MusicBrainz])) else AC_DEFINE(HAVE_MUSICBRAINZ, 0, [have MusicBrainz]) fi --- branches/KDE/3.5/kdemultimedia/juk/ktrm.cpp #499318:499319 @@ -42,7 +42,11 @@ extern "C" { +#if HAVE_MUSICBRAINZ >= 4 + static void TRMNotifyCallback(tunepimp_t pimp, void *data, TPCallbackEnum type, int fileId, TPFileStatus status); +#else static void TRMNotifyCallback(tunepimp_t pimp, void *data, TPCallbackEnum type, int fileId); +#endif } /** @@ -66,7 +70,11 @@ int id; if(!m_fileMap.contains(lookup->file())) { +#if HAVE_MUSICBRAINZ >= 4 + id = tp_AddFile(m_pimp, QFile::encodeName(lookup->file()), 0); +#else id = tp_AddFile(m_pimp, QFile::encodeName(lookup->file())); +#endif m_fileMap.insert(lookup->file(), id); } else { @@ -120,7 +128,11 @@ tp_SetAutoSaveThreshold(m_pimp, -1); tp_SetMoveFiles(m_pimp, false); tp_SetRenameFiles(m_pimp, false); +#if HAVE_MUSICBRAINZ >= 4 + tp_SetFileNameEncoding(m_pimp, "UTF-8"); +#else tp_SetUseUTF8(m_pimp, true); +#endif tp_SetNotifyCallback(m_pimp, TRMNotifyCallback, 0); // Re-read proxy config. @@ -286,14 +298,19 @@ /** * Callback fuction for TunePimp lookup events. */ - -static void TRMNotifyCallback(tunepimp_t pimp, void *, TPCallbackEnum type, int fileId) +#if HAVE_MUSICBRAINZ >= 4 +static void TRMNotifyCallback(tunepimp_t pimp, void *data, TPCallbackEnum type, int fileId, TPFileStatus status) +#else +static void TRMNotifyCallback(tunepimp_t pimp, void *data, TPCallbackEnum type, int fileId) +#endif { if(type != tpFileChanged) return; track_t track = tp_GetTrack(pimp, fileId); +#if HAVE_MUSICBRAINZ < 4 TPFileStatus status = tr_GetStatus(track); +#endif switch(status) { case eRecognized: @@ -503,10 +520,16 @@ KTRMResult result; result.d->title = QString::fromUtf8(tracks[i]->name); +#if HAVE_MUSICBRAINZ >= 4 + result.d->artist = QString::fromUtf8(tracks[i]->artist.name); + result.d->album = QString::fromUtf8(tracks[i]->album.name); + result.d->year = tracks[i]->album.releaseYear; +#else result.d->artist = QString::fromUtf8(tracks[i]->artist->name); result.d->album = QString::fromUtf8(tracks[i]->album->name); + result.d->year = tracks[i]->album->releaseYear; +#endif result.d->track = tracks[i]->trackNum; - result.d->year = tracks[i]->album->releaseYear; result.d->relevance = tracks[i]->relevance; d->results.append(result); |