diff -uNr --exclude='*.orig' --exclude='*.rej' nautilus-2.5.8/configure.in nautilus-2.5.8.patched/configure.in --- nautilus-2.5.8/configure.in 2004-02-24 14:32:49.000000000 +0100 +++ nautilus-2.5.8.patched/configure.in 2004-03-02 18:08:31.100016816 +0100 @@ -21,6 +21,7 @@ XML_REQUIRED=2.4.7 STARTUP_NOTIFICATION_REQUIRED=0.5 EXIF_REQUIRED=0.5.12 +GSTREAMER_REQUIRED=0.6.0 AC_SUBST(ART_REQUIRED) AC_SUBST(BONOBO_ACTIVATION_REQUIRED) @@ -40,6 +41,7 @@ AC_SUBST(RSVG_REQUIRED) AC_SUBST(XML_REQUIRED) AC_SUBST(STARTUP_NOTIFICATION_REQUIRED) +AC_SUBST(GSTREAMER_REQUIRED) dnl =========================================================================== @@ -257,6 +259,53 @@ dnl ========================================================================== +dnl gstreamer checking + +AC_ARG_ENABLE(gstreamer, + AC_HELP_STRING([--enable-gstreamer],[use GStreamer for sound preview]), + [case "${enableval}" in + yes) ENABLE_GST=yes ;; + no) ENABLE_GST=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-gstreamer) ;; + esac], + [ENABLE_GST=no]) dnl Default value + +AC_MSG_CHECKING(for backend libraries) + +if test x$ENABLE_GST = xyes; then + +dnl Now we're ready to ask for gstreamer libs and cflags +dnl And we can also ask for the right version of gstreamer + HAVE_GSTREAMER=no + +dnl start with 0.7 + GST_MAJORMINOR=0.8 + PKG_CHECK_MODULES(GST, \ + gstreamer-gconf-$GST_MAJORMINOR >= $GSTREAMER_REQUIRED, + HAVE_GSTREAMER=yes,HAVE_GSTREAMER=no) + +dnl try 0.6 + if test "x$HAVE_GSTREAMER" = "xno"; then + GST_MAJORMINOR=0.6 + PKG_CHECK_MODULES(GST, \ + gstreamer-gconf-$GST_MAJORMINOR >= $GSTREAMER_REQUIRED, + HAVE_GSTREAMER=yes,HAVE_GSTREAMER=no) + fi + +dnl Give error and exit if we don't have gstreamer + if test "x$HAVE_GSTREAMER" = "xno"; then + AC_MSG_ERROR(you need gstreamer development packages installed !) + fi + + MM="gstreamer-libs-$GST_MAJORMINOR >= $GSTREAMER_REQUIRED gstreamer-gconf-$GST_MAJORMINOR >= $GSTREAMER_REQUIRED" + + AC_MSG_RESULT(GStreamer) + AC_DEFINE(USE_GST_AUDIO_PREVIEW,1,[Define if you want to use the GStreamer media framework]) + +fi + +dnl ========================================================================== + dnl Turn on the additional warnings last, so -Werror doesn't affect other tests. AC_ARG_ENABLE(more-warnings, @@ -333,7 +382,7 @@ AC_SUBST(LIBNAUTILUS_EXTENSION_LIBS) dnl core nautilus (must list bonobo-activation and libbonobo because idldir does not respect "requires") -CORE_MODULES="eel-2.0 librsvg-2.0 bonobo-activation-2.0 libbonobo-2.0 libbonoboui-2.0 esound gnome-desktop-2.0 $EXTRA_CORE_MODULES" +CORE_MODULES="eel-2.0 librsvg-2.0 bonobo-activation-2.0 libbonobo-2.0 libbonoboui-2.0 esound gnome-desktop-2.0 $MM $EXTRA_CORE_MODULES" CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES` $x_cflags" AC_SUBST(CORE_CFLAGS) CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES` $CDDA_LIBS $LIBJPEG $x_libs" diff -uNr --exclude='*.orig' --exclude='*.rej' nautilus-2.5.8/src/file-manager/fm-icon-view.c nautilus-2.5.8.patched/src/file-manager/fm-icon-view.c --- nautilus-2.5.8/src/file-manager/fm-icon-view.c 2004-02-13 11:50:10.000000000 +0100 +++ nautilus-2.5.8.patched/src/file-manager/fm-icon-view.c 2004-03-02 18:12:12.802312944 +0100 @@ -78,8 +78,13 @@ #include #include +#ifdef USE_GST_AUDIO_PREVIEW +#include +#include +#else #define USE_OLD_AUDIO_PREVIEW 1 #define READ_CHUNK_SIZE 16384 +#endif /* USE_GST_AUDIO_PREVIEW */ /* Paths to use when creating & referring to Bonobo menu items */ #define MENU_PATH_STRETCH_ICON "/menu/Edit/Edit Items Placeholder/Stretch" @@ -193,6 +198,10 @@ static int preview_sound_auto_value; static gboolean gnome_esd_enabled_auto_value; +#ifdef USE_GST_AUDIO_PREVIEW +static GstElement *thread; +#endif + static void fm_icon_view_set_directory_sort_by (FMIconView *icon_view, NautilusFile *file, const char *sort_by); @@ -1777,6 +1786,22 @@ fm_directory_view_stop_batching_selection_changes (FM_DIRECTORY_VIEW (icon_view)); } +#ifdef USE_GST_AUDIO_PREVIEW +static void +gst_end_of_stream_callback (GstElement *src, gpointer callback_data) +{ + FMIconView *icon_view; + icon_view = FM_ICON_VIEW (callback_data); + + gst_element_set_state (GST_ELEMENT (thread), GST_STATE_NULL); + + if (icon_view->details->audio_preview_timeout != 0) { + g_source_remove (icon_view->details->audio_preview_timeout); + icon_view->details->audio_preview_timeout = 0; + } +} +#endif + /* handle the preview signal by inspecting the mime type. For now, we only preview local sound files. */ /* here's the timer task that actually plays the file using mpg123, ogg123 or play. */ @@ -1784,6 +1809,34 @@ static gboolean play_file (gpointer callback_data) { +#ifdef USE_GST_AUDIO_PREVIEW + gchar *file_uri; + GstElement *filesrc, *decoder, *audiosink; + FMIconView *icon_view; + + icon_view = FM_ICON_VIEW (callback_data); + file_uri = nautilus_file_get_uri (icon_view->details->audio_preview_file); + + if (file_uri != NULL && gst_init_check (NULL, NULL)) { + thread = gst_thread_new ("thread"); + filesrc = gst_element_factory_make ("gnomevfssrc", "disk_source"); + decoder = gst_element_factory_make ("spider", "spider"); + audiosink = gst_gconf_get_default_audio_sink (); + + g_object_set (G_OBJECT (filesrc), "location", file_uri, NULL); + g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (gst_end_of_stream_callback), icon_view); + + gst_bin_add_many (GST_BIN (thread), filesrc, decoder, audiosink, NULL); + gst_element_link_many (filesrc, decoder, audiosink, NULL); + + gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING); + } + + g_free (file_uri); + + icon_view->details->audio_preview_file = NULL; + icon_view->details->audio_preview_timeout = 0; +#else #if USE_OLD_AUDIO_PREVIEW NautilusFile *file; FMIconView *icon_view; @@ -1908,6 +1961,7 @@ icon_view->details->audio_preview_timeout = 0; icon_view->details->audio_preview_file = NULL; #endif +#endif /* USE_GST_AUDIO_PREVIEW */ return FALSE; } @@ -1921,7 +1975,22 @@ static void preview_audio (FMIconView *icon_view, NautilusFile *file, gboolean start_flag) -{ +{ +#ifdef USE_GST_AUDIO_PREVIEW + if (thread != NULL) { + gst_element_set_state (GST_ELEMENT (thread), GST_STATE_NULL); + } + + if (icon_view->details->audio_preview_timeout != 0) { + g_source_remove (icon_view->details->audio_preview_timeout); + icon_view->details->audio_preview_timeout = 0; + } + + if (start_flag) { + icon_view->details->audio_preview_file = file; + icon_view->details->audio_preview_timeout = g_timeout_add (1000, play_file, icon_view); + } +#else /* Stop current audio playback */ #if USE_OLD_AUDIO_PREVIEW nautilus_sound_kill_sound (); @@ -1946,15 +2015,18 @@ icon_view->details->audio_preview_timeout = g_timeout_add (1000, play_file, icon_view); #endif } +#endif /* USE_GST_AUDIO_PREVIEW */ } static gboolean should_preview_sound (NautilusFile *file) { +#ifndef USE_GST_AUDIO_PREVIEW /* Check gnome config sound preference */ if (!gnome_esd_enabled_auto_value) { return FALSE; } +#endif /* USE_GST_AUDIO_PREVIEW */ /* Check user performance preference */ if (preview_sound_auto_value == NAUTILUS_SPEED_TRADEOFF_NEVER) { @@ -1985,11 +2057,21 @@ mime_type = nautilus_file_get_mime_type (file); if ((eel_istr_has_prefix (mime_type, "audio/") +#ifdef USE_GST_AUDIO_PREVIEW + || eel_istr_has_prefix (mime_type, "application/ogg") + || eel_istr_has_prefix (mime_type, "application/x-ogg") + || eel_istr_has_prefix (mime_type, "application/flac") + || eel_istr_has_prefix (mime_type, "application/x-flac")) + && eel_strcasecmp (mime_type, "audio/x-pn-realaudio") != 0 + && eel_strcasecmp (mime_type, "audio/x-mpegurl") != 0 + ) { +#else || eel_istr_has_prefix (mime_type, "application/ogg") || eel_istr_has_prefix (mime_type, "application/x-ogg")) && eel_strcasecmp (mime_type, "audio/x-pn-realaudio") != 0 && eel_strcasecmp (mime_type, "audio/x-mpegurl") != 0 && nautilus_sound_can_play_sound ()) { +#endif result = 1; preview_audio (icon_view, file, start_flag); }