totem r5082 - in trunk: . src src/backend
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r5082 - in trunk: . src src/backend
- Date: Fri, 8 Feb 2008 00:08:07 +0000 (GMT)
Author: hadess
Date: Fri Feb 8 00:08:07 2008
New Revision: 5082
URL: http://svn.gnome.org/viewvc/totem?rev=5082&view=rev
Log:
2008-02-07 Bastien Nocera <hadess hadess net>
* src/backend/bacon-video-widget-gst-0.10.c:
(bacon_video_widget_can_play), (bacon_video_widget_get_mrls):
Enumerate the DVD titles using dvdreadsrc, and create a list
of MRLs to play this back (Closes: #321709), check for the
presence of dvdreadsrc to see whether we support DVD playback
* src/totem-menu.c: (totem_action_add_recent): Don't add directories
to the recent files
* src/totem.c: (totem_action_load_media_device): Don't use the URL
from TotemDisc to get the DVD MRL, use the backend instead
Modified:
trunk/ChangeLog
trunk/src/backend/bacon-video-widget-gst-0.10.c
trunk/src/totem-menu.c
trunk/src/totem.c
Modified: trunk/src/backend/bacon-video-widget-gst-0.10.c
==============================================================================
--- trunk/src/backend/bacon-video-widget-gst-0.10.c (original)
+++ trunk/src/backend/bacon-video-widget-gst-0.10.c Fri Feb 8 00:08:07 2008
@@ -3902,7 +3902,15 @@
case MEDIA_TYPE_VCD:
res = TRUE;
break;
- case MEDIA_TYPE_DVD:
+ case MEDIA_TYPE_DVD: {
+ GstElement *element;
+
+ element = gst_element_factory_make ("dvdreadsrc", "test_dvdsrc");
+ res = (element != NULL);
+ if (element != NULL)
+ g_object_unref (element);
+ break;
+ }
case MEDIA_TYPE_CDDA:
default:
res = FALSE;
@@ -3937,13 +3945,68 @@
g_free (uri[0]);
break;
}
-/*
+
case MEDIA_TYPE_DVD: {
- gchar *uri[] = { "dvd://", NULL };
- mrls = g_strdupv (uri);
+ GstFormat fmt;
+ GstElement *element;
+ gint64 num_titles, i;
+ GPtrArray *array;
+
+ element = gst_element_factory_make ("dvdreadsrc", "test_dvdsrc");
+ if (element == NULL)
+ return NULL;
+ /* We need to get the format after instantiating dvdreadsrc, as
+ * the nick is registered in that class init */
+ fmt = gst_format_get_by_nick ("title");
+ g_object_set (element, "device", device, NULL);
+ if (gst_element_set_state (element, GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) {
+ GST_DEBUG ("Couldn't change the state to PAUSED");
+ g_object_unref (element);
+ return NULL;
+ }
+ if (gst_element_query_duration (element, &fmt, &num_titles) == FALSE) {
+ GST_DEBUG ("Couldn't query the \"duration\" (number of titles)");
+ gst_element_set_state (element, GST_STATE_NULL);
+ g_object_unref (element);
+ return NULL;
+ }
+
+ fmt = GST_FORMAT_TIME;
+ array = g_ptr_array_new ();
+ for (i = 1 ; i <= num_titles; i++) {
+ gint64 len;
+
+ /* Reset to NULL, change the title, and go back to PAUSED */
+ if (gst_element_set_state (element, GST_STATE_NULL) != GST_STATE_CHANGE_SUCCESS) {
+ GST_DEBUG ("Couldn't set state to NULL for title %"G_GINT64_FORMAT, i);
+ break;
+ }
+ g_object_set (element, "title", i, NULL);
+ if (gst_element_set_state (element, GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) {
+ GST_DEBUG ("Couldn't set state for title %"G_GINT64_FORMAT, i);
+ break;
+ }
+
+ if (gst_element_query_duration (element, &fmt, &len) == FALSE) {
+ GST_DEBUG ("Couldnt' query duration for title %"G_GINT64_FORMAT, i);
+ break;
+ }
+ /* If it's less than 30 seconds long, we kick it out */
+ if (GST_TIME_AS_SECONDS (len) > 30) {
+ g_ptr_array_add (array, g_strdup_printf ("dvd://%"G_GINT64_FORMAT, i));
+ GST_DEBUG ("URI: dvd://%"G_GINT64_FORMAT" (time: %"G_GINT64_FORMAT" mins %"G_GINT64_FORMAT" seconds)",
+ i, GST_TIME_AS_SECONDS (len) / 60, GST_TIME_AS_SECONDS (len) % 60);
+ }
+ }
+
+ gst_element_set_state (element, GST_STATE_NULL);
+ g_object_unref (element);
+ if (array->len >= 1)
+ g_ptr_array_add (array, NULL);
+ mrls = (char **) g_ptr_array_free (array, FALSE);
break;
}
-*/
+
default:
mrls = NULL;
break;
Modified: trunk/src/totem-menu.c
==============================================================================
--- trunk/src/totem-menu.c (original)
+++ trunk/src/totem-menu.c Fri Feb 8 00:08:07 2008
@@ -706,6 +706,10 @@
/* Local files with no mime-type probably don't exist */
if (data.mime_type == NULL)
return;
+ if (strcmp (data.mime_type, "x-directory/normal") == 0) {
+ g_free (data.mime_type);
+ return;
+ }
/* It's a local file */
display = g_filename_from_uri (filename, NULL, NULL);
Modified: trunk/src/totem.c
==============================================================================
--- trunk/src/totem.c (original)
+++ trunk/src/totem.c Fri Feb 8 00:08:07 2008
@@ -537,14 +537,7 @@
break;
case MEDIA_TYPE_DVD:
case MEDIA_TYPE_VCD:
- {
- const char *filenames[2];
-
- filenames[0] = url;
- filenames[1] = NULL;
-
- retval = totem_action_open_files (totem, (char **) filenames);
- }
+ retval = totem_action_load_media (totem, type, device_path);
break;
case MEDIA_TYPE_CDDA:
totem_action_error (_("Totem does not support playback of Audio CDs"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]