All pastes #895543 Raw Edit

Something

public text v1 · immutable
·published 2008-02-07 22:19 UTC
rendered paste body
Index: bacon-video-widget-gst-0.10.c
===================================================================
--- bacon-video-widget-gst-0.10.c       (revision 5073)
+++ bacon-video-widget-gst-0.10.c       (working copy)
@@ -3900,9 +3900,9 @@
 
   switch (type) {
     case MEDIA_TYPE_VCD:
+    case MEDIA_TYPE_DVD:
       res = TRUE;
       break;
-    case MEDIA_TYPE_DVD:
     case MEDIA_TYPE_CDDA:
     default:
       res = FALSE;
@@ -3937,13 +3937,46 @@
       g_free (uri[0]);
       break;
     }
-/*
+
     case MEDIA_TYPE_DVD: {
+      GstFormat fmt;
+      GstElement *element;
+      gint64 num_titles, i;
+
+      fmt = gst_format_get_by_nick ("title");
+      element = gst_element_factory_make ("dvdreadsrc", "test_dvdsrc");
+      g_object_set (element, "device", device, NULL);
+      if (gst_element_set_state (element, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) {
+             g_message ("Couldn't set state");
+//        g_object_unref (element);
+        return NULL;
+      }
+      if (gst_element_query_duration (element, &fmt, &num_titles) == FALSE) {
+             g_message ("Couldn't query duration");
+//        g_object_unref (element);
+       return NULL;
+      }
+
+      fmt = GST_FORMAT_TIME;
+      for (i = 0 ; i < num_titles; i++) {
+       gint64 len;
+        g_object_set (element, "title", i, NULL);
+        if (gst_element_query_duration (element, &fmt, &len) == FALSE) {
+               g_message ("Couldnt' query duration for title %d", i);
+          break;
+       }
+       g_message ("URI: dvd://%d (time: %lld min)", i, len / 1000000000 / 60);
+      }
+//      g_object_unref (element);
+      mrls = NULL;
+#if 0
+      gst_element_query_duration (bvw->priv->play, &fmt, &len)
       gchar *uri[] = { "dvd://", NULL };
       mrls = g_strdupv (uri);
+#endif
       break;
     }
-*/
+
     default:
       mrls = NULL;
       break;