After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 624841 - Audio preview of CD tracks fails if totem is not installed
Audio preview of CD tracks fails if totem is not installed
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: [obsolete] Audio Preview
2.30.x
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-07-20 14:44 UTC by Olivier Tilloy
Modified: 2010-10-13 16:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for play_file in fm-icon-view.c (829 bytes, patch)
2010-07-20 14:49 UTC, Olivier Tilloy
needs-work Details | Review
Updated patch, against git master (1.42 KB, patch)
2010-08-04 11:58 UTC, Olivier Tilloy
needs-work Details | Review
Updated patch, against git master (1.50 KB, patch)
2010-08-17 11:48 UTC, Olivier Tilloy
committed Details | Review

Description Olivier Tilloy 2010-07-20 14:44:20 UTC
Originally reported in Ubuntu (https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/607793):

To perform audio preview, Nautilus uses totem-audio-preview. If not present (i.e. if totem is not installed), it falls back on gst-launch-0.10 with a playbin pipeline. Unfortunately playbin doesn't understand the cdda:// URIs when trying to preview tracks on an audio CD.

Steps to reproduce:
1) Uninstall totem
2) Install gstreamer0.10-tools
3) Make sure audio previews are active:
    gconftool-2 --type string --set /apps/nautilus/preferences/preview_sound "always"
4) Insert an audio CD, when prompted what to do choose "Open Folder"
5) Hover the mouse cursor over one of the tracks in nautilus (typically "Track n.wav")

Expected result: after a delay (about 1 second), the track starts playing.
Current result: nothing happens.

Note that when totem is installed, the preview works.
Comment 1 Olivier Tilloy 2010-07-20 14:49:52 UTC
Created attachment 166218 [details] [review]
patch for play_file in fm-icon-view.c

The issue is with the way nautilus builds the URI to pass to playbin. The attached patch mimics totem's behaviour to build URIs that playbin is happy with.
Comment 2 Cosimo Cecchi 2010-08-01 11:02:50 UTC
Review of attachment 166218 [details] [review]:

::: nautilus-2.30.1.orig/src/file-manager/fm-icon-view.c
@@ +1945,3 @@
 	file = icon_view->details->audio_preview_file;
 	uri = nautilus_file_get_uri (file);
+	gfile = g_file_new_for_uri (uri);

You could just use nautilus_file_get_location () instead of getting the URI and creating a GFile later.

Also, you seem to do URI->GFile->path->URI again. Why is that needed? How are the first and the last URI different?
Comment 3 Olivier Tilloy 2010-08-04 11:58:53 UTC
Created attachment 167105 [details] [review]
Updated patch, against git master

Right, nautilus_file_get_location works too.
The transformation URI->GFile->path->URI, although not straightforward, is needed in order to pass playbin a real gvfs URI. Compare the URIs for a track on an audio CD, before and after the transformation:

before: cdda://sr0/Track%201.wav
after:  file:///home/foobar/.gvfs/cdda%20mount%20on%20sr0/Track%201.wav

Although not documented, this is exactly what totem does, so I suppose it’s reasonable.

I’m attaching an updated patch against git master.
Comment 4 Cosimo Cecchi 2010-08-14 10:25:02 UTC
Review of attachment 167105 [details] [review]:

::: src/file-manager/fm-icon-view.c
@@ +2031,2 @@
 	file = icon_view->details->audio_preview_file;
 	uri = nautilus_file_get_uri (file);

I see the reason why you need this conversion but in this case, the following should be more elegant and readable:

file = icon_view->details->audio_preview_file;
gfile = nautilus_file_get_location (file);
path = g_file_get_path (gfile);

if (path) {
  uri = g_filename_to_uri (path, NULL, NULL);
} else {
  uri = nautilus_file_get_uri (file);
}

g_object_unref (gfile);
g_free (path);

Can you try something similar and see if it works?
Comment 5 Olivier Tilloy 2010-08-17 10:11:08 UTC
@Cosimo: thanks for the review. The changes you suggest are cosmetic, and the code is functionally equivalent, so I don’t see a reason why it wouldn’t work. I’m testing to be really sure, and will attach an updated patch.
Comment 6 Olivier Tilloy 2010-08-17 11:48:48 UTC
Created attachment 168057 [details] [review]
Updated patch, against git master

This updated patch takes into account Cosimo’s style suggestions. It was successfully tested to ensure it is functionally equivalent to its previous iteration.
Comment 7 Olivier Tilloy 2010-09-10 13:11:41 UTC
Can the status of this bug be set accordingly?

@Cosimo: did you have a chance to test my revised patch?
Comment 8 Cosimo Cecchi 2010-10-13 16:15:44 UTC
Olivier, thanks for the updated patch.
I pushed it to nautilus master, with a slightly better comment and commit message.

Closing as FIXED.