Gentoo Archives: gentoo-commits

From: "Tomas Chvatal (scarabeus)" <scarabeus@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-sound/phonon/files: fix_nonascii_chars.patch
Date: Sat, 28 Feb 2009 06:03:43
Message-Id: E1LdIIX-0004rB-7O@stork.gentoo.org
1 scarabeus 09/02/28 06:03:41
2
3 Added: fix_nonascii_chars.patch
4 Log:
5 Fix nonascii character named/taged files with xine playback. Per bug #259825.
6 (Portage version: 2.2_rc23/cvs/Linux i686)
7
8 Revision Changes Path
9 1.1 media-sound/phonon/files/fix_nonascii_chars.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/phonon/files/fix_nonascii_chars.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/phonon/files/fix_nonascii_chars.patch?rev=1.1&content-type=text/plain
13
14 Index: fix_nonascii_chars.patch
15 ===================================================================
16 --- branches/phonon/4.3/xine/mediaobject.cpp 2009/02/10 09:11:04 924143
17 +++ branches/phonon/4.3/xine/mediaobject.cpp 2009/02/10 09:17:28 924144
18 @@ -317,6 +317,20 @@
19 setSourceInternal(source, HardSwitch);
20 }
21
22 +static QByteArray mrlEncode(QByteArray mrl)
23 +{
24 + for (int i = 0; i < mrl.size(); ++i) {
25 + const unsigned char c = static_cast<unsigned char>(mrl.at(i));
26 + if (c & 0x80 || c == '\\' || c < 32 || c == '%') {
27 + char enc[4];
28 + qsnprintf(enc, 4, "%%%02X", c);
29 + mrl = mrl.left(i) + QByteArray(enc, 3) + mrl.mid(i + 1);
30 + i += 2;
31 + }
32 + }
33 + return mrl;
34 +}
35 +
36 void MediaObject::setSourceInternal(const MediaSource &source, HowToSetTheUrl how)
37 {
38 //debug() << Q_FUNC_INFO;
39 @@ -340,13 +354,18 @@
40 m_stream->setError(Phonon::NormalError, tr("Cannot open media data at '<i>%1</i>'").arg(source.url().toString(QUrl::RemovePassword)));
41 return;
42 }
43 - switch (how) {
44 - case GaplessSwitch:
45 - m_stream->gaplessSwitchTo(source.url());
46 - break;
47 - case HardSwitch:
48 - m_stream->setUrl(source.url());
49 - break;
50 + {
51 + const QByteArray &mrl = (source.url().scheme() == QLatin1String("file") ?
52 + "file:/" + mrlEncode(QFile::encodeName(source.url().toLocalFile())) :
53 + source.url().toEncoded());
54 + switch (how) {
55 + case GaplessSwitch:
56 + m_stream->gaplessSwitchTo(mrl);
57 + break;
58 + case HardSwitch:
59 + m_stream->setMrl(mrl);
60 + break;
61 + }
62 }
63 break;
64 case MediaSource::Disc:
65 --- branches/phonon/4.3/xine/xinestream.cpp 2009/02/10 09:11:04 924143
66 +++ branches/phonon/4.3/xine/xinestream.cpp 2009/02/10 09:17:28 924144
67 @@ -619,12 +619,6 @@
68 }
69
70 // called from main thread
71 -void XineStream::gaplessSwitchTo(const QUrl &url)
72 -{
73 - gaplessSwitchTo(url.toEncoded());
74 -}
75 -
76 -// called from main thread
77 void XineStream::gaplessSwitchTo(const QByteArray &mrl)
78 {
79 QCoreApplication::postEvent(this, new GaplessSwitchEvent(mrl));
80 @@ -1707,12 +1701,6 @@
81 }
82
83 // called from main thread
84 -void XineStream::setUrl(const QUrl &url)
85 -{
86 - setMrl(url.toEncoded());
87 -}
88 -
89 -// called from main thread
90 void XineStream::setMrl(const QByteArray &mrl, StateForNewMrl sfnm)
91 {
92 debug() << Q_FUNC_INFO << mrl << ", " << sfnm;
93 --- branches/phonon/4.3/xine/xinestream.h 2009/02/10 09:11:04 924143
94 +++ branches/phonon/4.3/xine/xinestream.h 2009/02/10 09:17:28 924144
95 @@ -86,7 +86,6 @@
96 //void needRewire(AudioPostList *postList);
97 void useGaplessPlayback(bool);
98 void useGapOf(int gap);
99 - void gaplessSwitchTo(const QUrl &url);
100 void gaplessSwitchTo(const QByteArray &mrl);
101 void closeBlocking();
102 void aboutToDeleteVideoWidget();
103 @@ -141,7 +140,6 @@
104
105 void unload();
106 public slots:
107 - void setUrl(const QUrl &url);
108 void setMrl(const QByteArray &mrl, StateForNewMrl = StoppedState);
109 void play();
110 void pause();