From 508e5f278b9541f987dd2a67580bc96481177fee Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mon, 4 May 2009 16:18:58 +0000 Subject: [PATCH] - fix Source0 Url - xine backend will not play files with non-ascii names (kdebug#172242) --- phonon-4.3.2-kdebug#172242.patch | 101 +++++++++++++++++++++++++++++++ phonon.spec | 12 +++- 2 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 phonon-4.3.2-kdebug#172242.patch diff --git a/phonon-4.3.2-kdebug#172242.patch b/phonon-4.3.2-kdebug#172242.patch new file mode 100644 index 0000000..4aec362 --- /dev/null +++ b/phonon-4.3.2-kdebug#172242.patch @@ -0,0 +1,101 @@ +Index: phonon/xine/xinestream.h +=================================================================== +--- phonon/xine/xinestream.h (revision 924144) ++++ phonon/xine/xinestream.h (revision 924145) +@@ -86,7 +86,6 @@ + //void needRewire(AudioPostList *postList); + void useGaplessPlayback(bool); + void useGapOf(int gap); +- void gaplessSwitchTo(const QUrl &url); + void gaplessSwitchTo(const QByteArray &mrl); + void closeBlocking(); + void aboutToDeleteVideoWidget(); +@@ -141,7 +140,6 @@ + + void unload(); + public slots: +- void setUrl(const QUrl &url); + void setMrl(const QByteArray &mrl, StateForNewMrl = StoppedState); + void play(); + void pause(); +Index: phonon/xine/mediaobject.cpp +=================================================================== +--- phonon/xine/mediaobject.cpp (revision 924144) ++++ phonon/xine/mediaobject.cpp (revision 924145) +@@ -317,6 +317,20 @@ + setSourceInternal(source, HardSwitch); + } + ++static QByteArray mrlEncode(QByteArray mrl) ++{ ++ for (int i = 0; i < mrl.size(); ++i) { ++ const unsigned char c = static_cast(mrl.at(i)); ++ if (c & 0x80 || c == '\\' || c < 32 || c == '%') { ++ char enc[4]; ++ qsnprintf(enc, 4, "%%%02X", c); ++ mrl = mrl.left(i) + QByteArray(enc, 3) + mrl.mid(i + 1); ++ i += 2; ++ } ++ } ++ return mrl; ++} ++ + void MediaObject::setSourceInternal(const MediaSource &source, HowToSetTheUrl how) + { + //debug() << Q_FUNC_INFO; +@@ -340,13 +354,18 @@ + m_stream->setError(Phonon::NormalError, tr("Cannot open media data at '%1'").arg(source.url().toString(QUrl::RemovePassword))); + return; + } +- switch (how) { +- case GaplessSwitch: +- m_stream->gaplessSwitchTo(source.url()); +- break; +- case HardSwitch: +- m_stream->setUrl(source.url()); +- break; ++ { ++ const QByteArray &mrl = (source.url().scheme() == QLatin1String("file") ? ++ "file:/" + mrlEncode(QFile::encodeName(source.url().toLocalFile())) : ++ source.url().toEncoded()); ++ switch (how) { ++ case GaplessSwitch: ++ m_stream->gaplessSwitchTo(mrl); ++ break; ++ case HardSwitch: ++ m_stream->setMrl(mrl); ++ break; ++ } + } + break; + case MediaSource::Disc: +Index: phonon/xine/xinestream.cpp +=================================================================== +--- phonon/xine/xinestream.cpp (revision 924144) ++++ phonon/xine/xinestream.cpp (revision 924145) +@@ -619,12 +619,6 @@ + } + + // called from main thread +-void XineStream::gaplessSwitchTo(const QUrl &url) +-{ +- gaplessSwitchTo(url.toEncoded()); +-} +- +-// called from main thread + void XineStream::gaplessSwitchTo(const QByteArray &mrl) + { + QCoreApplication::postEvent(this, new GaplessSwitchEvent(mrl)); +@@ -1707,12 +1701,6 @@ + } + + // called from main thread +-void XineStream::setUrl(const QUrl &url) +-{ +- setMrl(url.toEncoded()); +-} +- +-// called from main thread + void XineStream::setMrl(const QByteArray &mrl, StateForNewMrl sfnm) + { + debug() << Q_FUNC_INFO << mrl << ", " << sfnm; diff --git a/phonon.spec b/phonon.spec index dedcf0b..a04d90b 100644 --- a/phonon.spec +++ b/phonon.spec @@ -1,11 +1,12 @@ Summary: Multimedia framework api Name: phonon Version: 4.3.1 -Release: 3%{?dist} +Release: 4%{?dist} Group: System Environment/Libraries License: LGPLv2+ URL: http://phonon.kde.org/ -Source0: ftp://ftp.kde.org/pub/kde/stable/phonon/%{version}/%{name}-%{version}.tar.bz2 +#Source0: ftp://ftp.kde.org/pub/kde/stable/phonon/%{version}/%{name}-%{version}.tar.bz2 +Source0: ftp://ftp.kde.org/pub/kde/stable/4.2.1/phonon-%{version}.tar.bz2 Source1: http://gstreamer.freedesktop.org/data/images/artwork/gstreamer-logo.svg BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -21,6 +22,8 @@ Patch1: phonon-4.2.96-xine-pulseaudio.patch ## Upstream patches Patch100: phonon-4.3.2-gstreamer-utf8-url.patch Patch101: phonon-4.3.2-gstreamer-volumefader.patch +# fix for non-ascii filenames in xine backend +Patch102: phonon-4.3.2-kdebug#172242.patch BuildRequires: automoc4 >= 0.9.86 BuildRequires: cmake >= 2.6.0 @@ -76,6 +79,7 @@ Requires: pkgconfig %patch1 -p1 -b .xine-pulseaudio %patch100 -p0 -b .gstreamer-utf8-url %patch101 -p0 -b .gstreamer-volumefader +%patch102 -p1 -b .xine_nonascii %build @@ -168,6 +172,10 @@ fi %changelog +* Mon May 04 2009 Rex Dieter - 4.3.1-4 +- fix Source0 Url +- xine backend will not play files with non-ascii names (kdebug#172242) + * Sat Apr 11 2009 Rex Dieter - 4.3.1-3 - optimize scriptlets - Provides/Requires: phonon-backend%%{_isa} ...