phonon xine mediaobject and badly encoded filenames

Marcos Dione mdione at grulic.org.ar
Fri Nov 13 00:16:39 CET 2009


On Mon, Nov 09, 2009 at 11:20:58PM +0100, Marcos Dione wrote:
> > > file://path/somethingwitha#.ogg
> > > http://example.com/foo.ogg
> > > 
> > > I think both will break - the first because of the missing MRL escaping, the 
> > > second because you prepend "file:/".
> > 
> >     ok, I will try to fix it so those play. it makes sense to use a QUrl
> > instead of QFile/QString, but then we sould call mrlEncode with
> > source.url().toEncoded() and fix from there.
> 
>     ...which is exactly what this patch does. mrlEncode() only handles the #
> case. also, the 'file:/' is appended only if the QUrl has no scheme(), which is
> the only case in we should add the scheme. anyways, it's a preview; I still
> want to test it with filenames mentioned in those other bug reports. I will do
> that tomorrow night.

    ok, it took me some more time, but I kept testing using data from the
following bugreports:

https://bugs.kde.org/show_bug.cgi?id=197252
https://bugs.kde.org/show_bug.cgi?id=202027 (is a similar case as my original one, utf8 and latin1 mix)
https://bugs.kde.org/show_bug.cgi?id=206085
https://bugs.kde.org/show_bug.cgi?id=173789 ([]'s in the filename)
https://bugs.kde.org/show_bug.cgi?id=172242
https://bugs.kde.org/show_bug.cgi?id=189898 (simply spaces, which I knew it already worked)
https://bugs.kde.org/show_bug.cgi?id=194889 (# in the filename)
https://bugs.kde.org/show_bug.cgi?id=194889 (´ in the filename)

    the example:

$ ls /home/mdione/src/projects/satyr/testmedia/Último\ bondi\ a\ Finisterre\[1986\]/
Les_Misérables José AfonsoJosé Afonso [Disco2]Grâ - ´ La peque?a 林一峰與小娟###.mp3

    most of the filename is in utf8 (even when the first bug report mentioned
above talks about Big5 - I'm not sure which encoding is that) except for the
\x1a (ñ in latin1). I obtained that file simply running this small python script:

--- code ---
# vim: set fileencoding=utf-8 :
import os

path1= '/home/mdione/src/projects/satyr/testmedia/\xc3\x9altimo bondi a Finisterre/07- La peque\xf1a novia del ##carioca.mp3'
path2= '/home/mdione/src/projects/satyr/testmedia/\xc3\x9altimo bondi a Finisterre[1986]/Les_Mis\xc3\xa9rables Jos\xc3\xa9 AfonsoJos\xc3\xa9 Afonso \x5bDisco2\x5dGr\xc3\xa2 - ´ La peque\xf1a \xe6\x9e\x97\xe4\xb8\x80\xe5\xb3\xb0\xe8\x88\x87\xe5\xb0\x8f\xe5\xa8\x9f###.mp3'

os.rename (path1, path2)
--- code ---

    the output:

bool Phonon::Xine::XineStream::xineOpen(Phonon::State) xine_open succeeded for m_mrl = file:/%2Fhome%2Fmdione%2Fsrc%2Fprojects%2Fsatyr%2Fplaylist-listmodel%2F..%2Ftestmedia%2F%2F%C3%9Altimo%20bondi%20a%20Finisterre%5B1986%5D%2FLes_Mis%C3%A9rables%20Jos%C3%A9%20AfonsoJos%C3%A9%20Afonso%20%5BDisco2%5DGr%C3%A2%20-%20%C2%B4%20La%20peque%F1a%20%E6%9E%97%E4%B8%80%E5%B3%B0%E8%88%87%E5%B0%8F%E5%A8%9F%23%23%23.mp3

    ... and the file plays :) quite a line, but quite a success :)

    in other news, the gstreamer backend seems to suffer from a similar
problem. playing a file successuly with this patch and the xine backend, I get:

bool Phonon::Xine::XineStream::xineOpen(Phonon::State) xine_open succeeded for m_mrl = file:/%2Fhome%2Fmdione%2Fmedia%2Fmusic%2F%2FSoda%20Stereo%2FEl%20%C3%BAltimo%20concierto%2F19-Un%20mill%F3n%20de%20a%F1os%20luz.mp3

    but with gstreamer:

(<unknown>:10963): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion `gst_uri_is_valid (uri)' failed

    I will continue investigate that once I finished with this patch, which
besides actually commiting it, I think I just done.

-- 
(Not so) Random fortune:
Unlike "traditional" software development where the supply chain is
tightly managed and usually completely or nearly completely internal,
the open source model seems to me to be a lot more like the free market
dynamics seen in commodity markets and how supply trickles on through
the machinery to eventually create products the consumer purchases.
	    -- Aaron Seigo


More information about the Phonon-backends mailing list