LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 3338|回复: 16

分享:xmms2完美支持ape及cue标签

[复制链接]
发表于 2007-10-8 18:10:44 | 显示全部楼层 |阅读模式
在irc上询问后,得到一个对cue支持的patch
startms.diff
但是这个patch对0.2DrJekyll补丁会出错。而新的git中,mac插件总是无法正常工作。
查看这个patch,发现是xmms_xform_metadata_get_str的声明不一样了。改了下这个patch,放在下面,
commit cee22c84e6be8ae4c89c333695fa5b50c63ea036
Author: Florian Ragwitz <rafl@debian.org>
Date:   Sun Sep 30 00:15:57 2007 +0200

    BUG(1637): honor startms.

diff --git a/src/xmms/output.c b/src/xmms/output.c
index 6f5933c..4f5e0b1 100644
--- a/src/xmms/output.c
+++ b/src/xmms/output.c
@@ -251,6 +251,7 @@ typedef struct {
        xmms_output_t *output;
        xmms_xform_t *chain;
        gboolean flush;
+       guint startms;
} xmms_output_song_changed_arg_t;

static void
@@ -285,6 +286,21 @@ song_changed (void *data)
        if (arg->flush)
                xmms_output_flush (arg->output);

+       if (arg->startms > 0) {
+               xmms_error_t err;
+               xmms_error_reset (&err);
+
+               XMMS_DBG ("Got startms. Trying to seek to %u.", arg->startms);
+
+               arg->output->filler_state = FILLER_SEEK;
+               arg->output->filler_seek = xmms_sample_ms_to_samples (arg->output->format, arg->startms);
+               g_cond_signal (arg->output->filler_state_cond);
+
+               if (xmms_error_iserror (&err)) {
+                       XMMS_DBG ("Failed to seek to startms");
+               }
+       }
+
        xmms_object_emit_f (XMMS_OBJECT (arg->output),
                            XMMS_IPC_SIGNAL_OUTPUT_CURRENTID,
                            XMMS_OBJECT_CMD_ARG_UINT32,
@@ -404,6 +420,8 @@ xmms_output_filler (void *arg)
                        xmms_medialib_entry_t entry;
                        xmms_output_song_changed_arg_t *arg;
                        xmms_medialib_session_t *session;
+                       gchar *tmp;
+                       gint startms = 0;

                        g_mutex_unlock (output->filler_mutex);

@@ -435,10 +453,21 @@ xmms_output_filler (void *arg)
                                continue;
                        }

+                       if (tmp=xmms_xform_metadata_get_str (chain, "startms")) {
+                               gchar *endptr;
+
+                               startms = g_ascii_strtoull (tmp, &endptr, 10);
+
+                               if (*endptr != '\0') {
+                                       startms = 0;
+                               }
+                       }
+
                        arg = g_new0 (xmms_output_song_changed_arg_t, 1);
                        arg->output = output;
                        arg->chain = chain;
                        arg->flush = last_was_kill;
+                       arg->startms = startms;
                        xmms_object_ref (chain);

                        last_was_kill = FALSE;

gentoo bug report上的xmms2 ebuild,修改过一点:
# copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils

MY_PV="0.2DrJekyll"

DESCRIPTION="X-platform Music Multiplexing System 2"
HOMEPAGE="http://wiki.xmms2.xmms.se/index.php/Main_Page"
SRC_URI="mirror://sourceforge/xmms2/xmms2-${MY_PV}.tar.bz2"

LICENSE="GPL-2 LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64"
IUSE="aac alsa ao avahi cli coreaudio curl cxx fam flac gnome jack mad mms
modplug mac mp4 musepack ofa perl python resid ruby samba shout sid speech vorbis wma xml"

DEPEND=">=dev-lang/python-2.3
        >=dev-libs/glib-2.8
        >=dev-db/sqlite-3.2.4
        aac? ( media-libs/faad2 )
        alsa? ( media-libs/alsa-lib )
        ao? ( media-libs/libao )
        avahi? ( net-dns/avahi )
        curl? ( >=net-misc/curl-7.11.2 )
        cxx? ( dev-libs/boost dev-cpp/glibmm )
        fam? ( app-admin/gamin )
        flac? ( media-libs/flac )
        gnome? ( gnome-base/gnome-vfs )
        jack? ( media-sound/jack )
        mac? ( media-sound/mac-port )
        mad? ( media-libs/libmad )
        mms? ( media-libs/libmms )
        modplug? ( media-libs/libmodplug )
        mp4? ( media-video/ffmpeg )
        musepack? ( media-libs/libmpcdec )
        ofa? ( media-libs/libofa )
        perl? ( dev-lang/perl )
        resid? ( media-libs/resid )
        ruby? ( >=dev-lang/ruby-1.8 )
        samba? ( net-fs/samba )
        shout? ( media-libs/libshout )
        sid? ( >=media-libs/libsidplay-2.0 )
        speech? ( >=sci-libs/fftw-3.0 media-libs/libsamplerate )
        vorbis? ( media-libs/libvorbis )
        wma? ( media-video/ffmpeg )
        xml? ( dev-libs/libxml2 )"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${PN}-${MY_PV}"

disable_plugins() {
        local disable_plugins x

        # that one should never work (and we need a non-empty $disable_plugins)
        disable_plugins="waveout"

        for x in alsa ao coreaudio curl flac jack mac mad mms modplug musepack ofa samba sid vorbis ; do
                if ! use ${x} ; then
                        disable_plugins="${disable_plugins},${x}";
                fi
        done

        for x in aac:faad avahi:daap gnome:gnomevfs mp4:avformat shout:ices speech:vocoder xml:xspf,rss ; do
                if ! use ${x/:*} ; then
                        disable_plugins="${disable_plugins},${x/*:}";
                fi
        done

        echo ${disable_plugins}
}

enable_optionals() {
        local enable_optionals x

        # that one should always work (and we need a non-empty $enable_optionals)
        enable_optionals="launcher"

        for x in avahi cli perl python ruby ; do
                if use ${x} ; then
                        enable_optionals="${enable_optionals},${x}";
                fi
        done

        for x in gnome:dns_sd cxx:xmmsclient++,xmmsclient++-glib fam:medialib-updater ; do
                if use ${x/:*} ; then
                        enable_optionals="${enable_optionals},${x/*:}";
                fi
        done

        echo ${enable_optionals}
}

src_unpack() {
        unpack ${A}
        cd "${S}"
        epatch "${FILESDIR}/startms.patch"
}

src_compile() {
        ./waf configure --without-plugins "$(disable_plugins)" \
                                        --with-optionals "$(enable_optionals)" \
                                        --prefix /usr \
                                        || die "configure failed"
        ./waf build -p $(echo "${MAKEOPTS}" | sed -e "s/.*\(-j[0-9]\+\).*/\1/") || die "build failed"
}

src_install() {
        ./waf --destdir ${D} install
        dodoc AUTHORS COPYING COPYING.GPL COPYING.LGPL README TODO
}

digest之后,直接emerge,现在xmms2可以直接播放ape,也可以播放cue,注意,播放cue才能识别出artist,album等信息,并且可以按照标记的时间,自动的把同一个ape文件中的歌当作不同的曲目,并且正确寻址。
  1. xmms2 addpls aaa.cue
复制代码
发表于 2007-10-9 09:11:52 | 显示全部楼层
收藏先~~~
回复 支持 反对

使用道具 举报

发表于 2007-10-14 10:57:02 | 显示全部楼层
出错啦!!!



PATCH COMMAND:   patch -p4 -g0 -E --no-backup-if-mismatch < /usr/portage/local/my-overlay/media-sound/xmms2/files/startms.patch

=========================
missing header for unified diff at line 11 of patch
can't find file to patch at input line 11
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|commit cee22c84e6be8ae4c89c333695fa5b50c63ea036
|Author: Florian Ragwitz <rafl@debian.org>
|Date: Sun Sep 30 00:15:57 2007 +0200
|
|BUG(1637): honor startms.
|
|diff --git a/src/xmms/output.c b/src/xmms/output.c
|index 6f5933c..4f5e0b1 100644
|--- a/src/xmms/output.c
|+++ b/src/xmms/output.c
--------------------------
No file to patch.  Skipping patch.
patch: **** malformed patch at line 12: xmms_output_t *output;
回复 支持 反对

使用道具 举报

发表于 2008-2-15 14:25:15 | 显示全部楼层
那个声明是哪里不一样呢,和0.4相比。想看下原来的patch.另外,mac的问题已经有patch了。在http://bugs.xmms2.xmms.se/print_bug_page.php?bug_id=1887
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-18 21:54:09 | 显示全部楼层
http://rafb.net/p/Xw2f5072.html

btw,那个mac的patch是偶提交的……
回复 支持 反对

使用道具 举报

发表于 2008-2-19 23:05:35 | 显示全部楼层
404 not found....

我刚去IRC了,没人给我patch,呵呵。那个rafl也在,说是他在做吧。
而且这里你贴的应该是不完整的,缺少stopms的那一部分。

btw:拜下牛人。
回复 支持 反对

使用道具 举报

发表于 2008-2-19 23:41:30 | 显示全部楼层
ubuntu论坛上看到过,不过貌似有点bug,就是必须从第一首播放起?

一直用mpd,不想换,听歌全部转换成mp3或者ogg格式。呵呵
回复 支持 反对

使用道具 举报

发表于 2008-2-19 23:47:53 | 显示全部楼层
Post by jarryson;1817930
ubuntu论坛上看到过,不过貌似有点bug,就是必须从第一首播放起?

一直用mpd,不想换,听歌全部转换成mp3或者ogg格式。呵呵
嗯,目前仍未修复。bug有好几个相关的了。mp3是必竟是有损的,花大把时间从驴子上拖的flac和ape总不甘心转成mp3听。上面的补丁可以不用从第一首播放起,不过还是得听完。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-20 02:33:26 | 显示全部楼层
http://ftp.ubuntu.org.cn/home/panchoat/xmms2
下面吧~wgetpaste的实效性挺弱~
偶把偶的ebuild的目录mirror上去了。mirror到overlay里应该就可以emerge了。补丁是修改过的,以便适应0.4的api变化。

btw:偶不是牛人……
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-20 02:35:18 | 显示全部楼层
Post by jarryson;1817930
ubuntu论坛上看到过,不过貌似有点bug,就是必须从第一首播放起?

一直用mpd,不想换,听歌全部转换成mp3或者ogg格式。呵呵


似乎不用吧~偶的ape的歌都是shuffle后和一堆其他格式的歌一起播~没见到一定要从哪首开始阿~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表