[Goodies-commits] r7858 - in parole/trunk: . data/interfaces parole

Ali Abdallah aliov at xfce.org
Wed Jul 29 09:41:58 CEST 2009


Author: aliov
Date: 2009-07-29 07:41:58 +0000 (Wed, 29 Jul 2009)
New Revision: 7858

Added:
   parole/trunk/parole/parole-disc-menu.c
   parole/trunk/parole/parole-disc-menu.h
Modified:
   parole/trunk/ChangeLog
   parole/trunk/TODO
   parole/trunk/data/interfaces/parole.ui
   parole/trunk/parole/Makefile.am
   parole/trunk/parole/parole-disc.c
   parole/trunk/parole/parole-file.c
   parole/trunk/parole/parole-gst.c
   parole/trunk/parole/parole-gst.h
   parole/trunk/parole/parole-player.c
   parole/trunk/parole/parole-statusbar.c
Log:
	* Added ParoleDiscMenu to show a DVD menu when playing DVD.
	* Query media capabilities on paused state.
	* parole-file.c get rid of a useless warning.
	* parole-statusbar.c properly set text info of live streams.
	* parole-gst.c optimize a bit the way we query stream info+
	added support for seeking to DVD chapters.
	

Modified: parole/trunk/ChangeLog
===================================================================
--- parole/trunk/ChangeLog	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/ChangeLog	2009-07-29 07:41:58 UTC (rev 7858)
@@ -1,3 +1,11 @@
+2009-07-29: 09:30 Ali aliov at xfce.org
+	* Added ParoleDiscMenu to show a DVD menu when playing DVD.
+	* Query media capabilities on paused state.
+	* parole-file.c get rid of a useless warning.
+	* parole-statusbar.c properly set text info of live streams.
+	* parole-gst.c optimize a bit the way we query stream info+
+	added support for seeking to DVD chapters.
+	
 2009-07-28: 13:00 Ali aliov at xfce.org
 	* Implement shuffle and repeat mode.
 	* Only hide cursor when we are playing a video.

Modified: parole/trunk/TODO
===================================================================
--- parole/trunk/TODO	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/TODO	2009-07-29 07:41:58 UTC (rev 7858)
@@ -3,7 +3,6 @@
 * Complete the shortcut keys.
 * Seek media on button release event on the range.
 * Better support for cdda.
-* Move to next chapter in movie.
 * Support some aspect ratio view.
 * Handle missing gstreamer plugins.
 * Support some playlist title entity.

Modified: parole/trunk/data/interfaces/parole.ui
===================================================================
--- parole/trunk/data/interfaces/parole.ui	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/data/interfaces/parole.ui	2009-07-29 07:41:58 UTC (rev 7858)
@@ -168,6 +168,7 @@
               <object class="GtkNotebook" id="main-notebook">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="show_tabs">False</property>
                 <property name="scrollable">True</property>
                 <property name="group_id">0</property>
                 <child>
@@ -204,6 +205,76 @@
                                     <property name="orientation">vertical</property>
                                     <property name="spacing">5</property>
                                     <child>
+                                      <object class="GtkHBox" id="dvd-box">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <object class="GtkButton" id="prev-chapter">
+                                            <property name="label" translatable="yes">Previous Chapter</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <property name="no_show_all">True</property>
+                                            <property name="image">image1</property>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="dvd-menu">
+                                            <property name="label" translatable="yes">DVD Menu</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <property name="no_show_all">True</property>
+                                            <property name="image">image2</property>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="chapter-menu">
+                                            <property name="label" translatable="yes">Chapter Menu</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <property name="no_show_all">True</property>
+                                            <property name="image">image3</property>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">2</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="next-chapter">
+                                            <property name="label" translatable="yes">Next Chapter</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <property name="no_show_all">True</property>
+                                            <property name="image">image4</property>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">3</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <placeholder/>
+                                        </child>
+                                        <child>
+                                          <placeholder/>
+                                        </child>
+                                        <child>
+                                          <placeholder/>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
                                       <object class="GtkHScale" id="scale">
                                         <property name="visible">True</property>
                                         <property name="sensitive">False</property>
@@ -215,7 +286,7 @@
                                       </object>
                                       <packing>
                                         <property name="expand">False</property>
-                                        <property name="position">0</property>
+                                        <property name="position">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -373,7 +444,7 @@
                                       </object>
                                       <packing>
                                         <property name="expand">False</property>
-                                        <property name="position">1</property>
+                                        <property name="position">2</property>
                                       </packing>
                                     </child>
                                   </object>
@@ -471,10 +542,27 @@
     <property name="visible">True</property>
     <property name="stock">gtk-network</property>
   </object>
-  <object class="GtkImage" id="image6">
+  <object class="GtkImage" id="image1">
     <property name="visible">True</property>
     <property name="stock">gtk-media-previous</property>
   </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="stock">gtk-index</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="no_show_all">True</property>
+    <property name="stock">gtk-index</property>
+  </object>
+  <object class="GtkImage" id="image4">
+    <property name="visible">True</property>
+    <property name="stock">gtk-media-next</property>
+  </object>
+  <object class="GtkImage" id="image6">
+    <property name="visible">True</property>
+    <property name="stock">gtk-media-rewind</property>
+  </object>
   <object class="GtkImage" id="image7">
     <property name="visible">True</property>
     <property name="stock">gtk-media-stop</property>
@@ -485,7 +573,7 @@
   </object>
   <object class="GtkImage" id="image9">
     <property name="visible">True</property>
-    <property name="stock">gtk-media-next</property>
+    <property name="stock">gtk-media-forward</property>
   </object>
   <object class="GtkImage" id="image18">
     <property name="visible">True</property>

Modified: parole/trunk/parole/Makefile.am
===================================================================
--- parole/trunk/parole/Makefile.am	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/parole/Makefile.am	2009-07-29 07:41:58 UTC (rev 7858)
@@ -77,7 +77,8 @@
 	parole-about.h				\
 	parole-builder.h			\
 	parole-subtitle-encoding.h		\
-	parole-open-location.h
+	parole-open-location.h			\
+	parole-disc-menu.h
 
 libparole_headers =				\
 	$(INST_HFILES)
@@ -116,7 +117,8 @@
 	parole-about.c				\
 	parole-builder.c			\
 	parole-subtitle-encoding.c		\
-	parole-open-location.c
+	parole-open-location.c			\
+	parole-disc-menu.c
 
 libparole_la_LDFLAGS =				\
 	$(PAROLE_LDFLAGS)

Added: parole/trunk/parole/parole-disc-menu.c
===================================================================
--- parole/trunk/parole/parole-disc-menu.c	                        (rev 0)
+++ parole/trunk/parole/parole-disc-menu.c	2009-07-29 07:41:58 UTC (rev 7858)
@@ -0,0 +1,176 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "parole-disc-menu.h"
+#include "parole-builder.h"
+#include "parole-statusbar.h"
+#include "parole-gst.h"
+
+static void parole_disc_menu_finalize   (GObject *object);
+
+#define PAROLE_DISC_MENU_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_DISC_MENU, ParoleDiscMenuPrivate))
+
+struct ParoleDiscMenuPrivate
+{
+    ParoleGst   *gst;
+    
+    GtkWidget	*next_chapter;
+    GtkWidget	*prev_chapter;
+    GtkWidget	*dvd_menu;
+    GtkWidget	*chapter_menu;
+};
+
+G_DEFINE_TYPE (ParoleDiscMenu, parole_disc_menu, G_TYPE_OBJECT)
+
+static void
+parole_disc_menu_hide (ParoleDiscMenu *menu)
+{
+    gtk_widget_hide (menu->priv->next_chapter);
+    gtk_widget_hide (menu->priv->prev_chapter);
+    //gtk_widget_hide (menu->priv->dvd_menu);
+    //gtk_widget_hide (menu->priv->chapter_menu);
+}
+
+static void
+parole_disc_menu_show (ParoleDiscMenu *menu)
+{
+    gtk_widget_show (menu->priv->next_chapter);
+    gtk_widget_show (menu->priv->prev_chapter);
+   //gtk_widget_show (menu->priv->dvd_menu);
+   //gtk_widget_show (menu->priv->chapter_menu);
+    
+}
+
+static void
+parole_disc_menu_media_state_cb (ParoleGst *gst, const ParoleStream *stream, 	
+				 ParoleMediaState state, ParoleDiscMenu *menu)
+{
+    ParoleMediaType media_type;
+    
+    if ( state < PAROLE_MEDIA_STATE_PAUSED )
+    {
+	parole_disc_menu_hide (menu);
+    }
+    else
+    {
+	g_object_get (G_OBJECT (stream),
+		      "media-type", &media_type,
+		      NULL);
+	if ( media_type == PAROLE_MEDIA_TYPE_DVD )
+	{
+	    parole_disc_menu_show (menu);
+	}
+    }
+}
+
+static void
+parole_disc_next_chapter_cb (ParoleDiscMenu *menu)
+{
+    parole_gst_next_dvd_chapter (menu->priv->gst);
+}
+
+static void
+parole_disc_prev_chapter_cb (ParoleDiscMenu *menu)
+{
+    parole_gst_prev_dvd_chapter (menu->priv->gst);
+}
+
+static void
+parole_disc_dvd_menu_cb (ParoleDiscMenu *menu)
+{
+    
+}
+
+static void
+parole_disc_chapter_menu_cb (ParoleDiscMenu *menu)
+{
+    
+}
+
+static void
+parole_disc_menu_class_init (ParoleDiscMenuClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    object_class->finalize = parole_disc_menu_finalize;
+
+    g_type_class_add_private (klass, sizeof (ParoleDiscMenuPrivate));
+}
+
+static void
+parole_disc_menu_init (ParoleDiscMenu *menu)
+{
+    GtkBuilder *builder;
+    menu->priv = PAROLE_DISC_MENU_GET_PRIVATE (menu);
+    
+    builder = parole_builder_get_main_interface ();
+    
+    menu->priv->next_chapter = GTK_WIDGET (gtk_builder_get_object (builder, "next-chapter"));
+    menu->priv->prev_chapter = GTK_WIDGET (gtk_builder_get_object (builder, "prev-chapter"));
+    menu->priv->chapter_menu = GTK_WIDGET (gtk_builder_get_object (builder, "chapter-menu"));
+    menu->priv->dvd_menu = GTK_WIDGET (gtk_builder_get_object (builder, "dvd-menu"));
+    
+    
+    g_signal_connect_swapped (menu->priv->next_chapter, "clicked",
+			      G_CALLBACK (parole_disc_next_chapter_cb), menu);
+    
+    g_signal_connect_swapped (menu->priv->prev_chapter, "clicked",
+			      G_CALLBACK (parole_disc_prev_chapter_cb), menu);
+			      
+    g_signal_connect_swapped (menu->priv->dvd_menu, "clicked",
+			      G_CALLBACK (parole_disc_dvd_menu_cb), menu);
+    
+    g_signal_connect_swapped (menu->priv->chapter_menu, "clicked",
+			      G_CALLBACK (parole_disc_chapter_menu_cb), menu);
+			      
+    menu->priv->gst = PAROLE_GST (parole_gst_new ());
+    
+    g_signal_connect (G_OBJECT (menu->priv->gst), "media_state",
+		      G_CALLBACK (parole_disc_menu_media_state_cb), menu);
+    
+    g_object_unref (builder);
+}
+
+static void
+parole_disc_menu_finalize (GObject *object)
+{
+    ParoleDiscMenu *menu;
+
+    menu = PAROLE_DISC_MENU (object);
+
+    G_OBJECT_CLASS (parole_disc_menu_parent_class)->finalize (object);
+}
+
+ParoleDiscMenu *
+parole_disc_menu_new (void)
+{
+    ParoleDiscMenu *menu = NULL;
+    menu = g_object_new (PAROLE_TYPE_DISC_MENU, NULL);
+    return menu;
+}

Added: parole/trunk/parole/parole-disc-menu.h
===================================================================
--- parole/trunk/parole/parole-disc-menu.h	                        (rev 0)
+++ parole/trunk/parole/parole-disc-menu.h	2009-07-29 07:41:58 UTC (rev 7858)
@@ -0,0 +1,51 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __PAROLE_DISC_MENU_H
+#define __PAROLE_DISC_MENU_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_DISC_MENU        (parole_disc_menu_get_type () )
+#define PAROLE_DISC_MENU(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_DISC_MENU, ParoleDiscMenu))
+#define PAROLE_IS_DISC_MENU(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_DISC_MENU))
+
+typedef struct ParoleDiscMenuPrivate ParoleDiscMenuPrivate;
+
+typedef struct
+{
+    GObject         		parent;
+    ParoleDiscMenuPrivate      *priv;
+} ParoleDiscMenu;
+
+typedef struct
+{
+    GObjectClass 		parent_class;
+} ParoleDiscMenuClass;
+
+GType        			parole_disc_menu_get_type        (void) G_GNUC_CONST;
+
+ParoleDiscMenu                 *parole_disc_menu_new             (void);
+
+G_END_DECLS
+
+#endif /* __PAROLE_DISC_MENU_H */

Modified: parole/trunk/parole/parole-disc.c
===================================================================
--- parole/trunk/parole/parole-disc.c	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/parole/parole-disc.c	2009-07-29 07:41:58 UTC (rev 7858)
@@ -142,7 +142,7 @@
 				"uri", data->uri,
 				(GDestroyNotify) g_free);
 	
-	gtk_menu_shell_insert (GTK_MENU_SHELL (disc->priv->media_menu), data->mi, 3);
+	gtk_menu_shell_insert (GTK_MENU_SHELL (disc->priv->media_menu), data->mi, 2);
 	g_signal_connect (data->mi, "activate",
 			  G_CALLBACK (parole_disc_media_activate_cb), disc);
 	g_free (label);

Modified: parole/trunk/parole/parole-file.c
===================================================================
--- parole/trunk/parole/parole-file.c	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/parole/parole-file.c	2009-07-29 07:41:58 UTC (rev 7858)
@@ -162,8 +162,8 @@
 	else
 	{
 	    priv->display_name = g_strdup (priv->filename);
+	    g_warning ("Unable to read file info %s", error->message);
 	}
-	g_warning ("Unable to read file info %s", error->message);
 	goto out;
     }
 
@@ -173,6 +173,7 @@
     priv->content_type = g_strdup (g_file_info_get_content_type (info));
     
     g_object_unref (info);
+    
 out:
     priv->uri = g_file_get_uri (gfile);
     g_object_unref (gfile);

Modified: parole/trunk/parole/parole-gst.c
===================================================================
--- parole/trunk/parole/parole-gst.c	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/parole/parole-gst.c	2009-07-29 07:41:58 UTC (rev 7858)
@@ -40,6 +40,7 @@
 #include "parole-utils.h"
 #include "parole-conf.h"
 #include "parole-utils.h"
+#include "parole-debug.h"
 #include "enum-gtypes.h"
 #include "gmarshal.h"
 
@@ -384,12 +385,11 @@
 				 &seekable,
 				 NULL,
 				 NULL);
+	g_object_set (G_OBJECT (gst->priv->stream),
+	          "seekable", seekable,
+		  NULL);
     }
     gst_query_unref (query);
-    
-    g_object_set (G_OBJECT (gst->priv->stream),
-	          "seekable", seekable,
-		  NULL);
 }
 
 static void
@@ -397,6 +397,7 @@
 {
     gint64 absolute_duration = 0;
     gdouble duration = 0;
+    gboolean live;
     
     GstFormat gst_time = GST_FORMAT_TIME;
     
@@ -407,9 +408,12 @@
     if (gst_time == GST_FORMAT_TIME)
     {
 	duration =  absolute_duration / ((gdouble) 60 * 1000 * 1000 * 1000);
+	live = ( absolute_duration == 0 );
+	TRACE ("Duration %e is_live=%d", duration, live);
 	g_object_set (G_OBJECT (gst->priv->stream),
 		      "absolute-duration", absolute_duration,
 		      "duration", duration,
+		      "live", live,
 		      NULL);
     }
 }
@@ -455,12 +459,16 @@
     gchar *sub;
     gchar *sub_uri;
     gboolean sub_enabled;
+    gboolean has_video;
     
     g_object_get (G_OBJECT (gst->priv->stream),
 		  "media-type", &type,
+		  "has-video",  &has_video,
 		  NULL);
     
-    if ( type != PAROLE_MEDIA_TYPE_LOCAL_FILE )
+    PAROLE_DEBUG_ENUM_FULL (type, ENUM_GTYPE_MEDIA_TYPE, " has_video=%d", has_video);
+    
+    if ( type != PAROLE_MEDIA_TYPE_LOCAL_FILE || !has_video)
 	return;
     
     g_object_get (G_OBJECT (gst->priv->conf),
@@ -539,6 +547,13 @@
 }
 
 static void
+parole_gst_update_stream_info (ParoleGst *gst)
+{
+    TRACE ("Updating stream info");
+    parole_gst_query_info (gst);
+}
+
+static void
 parole_gst_update_vis (ParoleGst *gst)
 {
     gchar *vis_name;
@@ -586,14 +601,18 @@
     switch (gst->priv->state)
     {
 	case GST_STATE_PLAYING:
-	    parole_gst_query_duration (gst);
-	    parole_gst_query_capabilities (gst);
-	    parole_gst_query_info (gst);
 	    gst->priv->media_state = PAROLE_MEDIA_STATE_PLAYING;
 	    g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0, 
 			   gst->priv->stream, PAROLE_MEDIA_STATE_PLAYING);
 	    break;
 	case GST_STATE_PAUSED:
+	    if ( old == GST_STATE_READY )
+	    {
+		parole_gst_query_duration (gst);
+		parole_gst_query_capabilities (gst);
+		parole_gst_query_info (gst);
+	    }
+
 	    gst->priv->media_state = PAROLE_MEDIA_STATE_PAUSED;
 	    g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0, 
 			   gst->priv->stream, PAROLE_MEDIA_STATE_PAUSED);
@@ -606,7 +625,7 @@
 	    g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0, 
 			   gst->priv->stream, PAROLE_MEDIA_STATE_STOPPED);
 
-	    if ( gst->priv->target == GST_STATE_PLAYING)
+	    if ( gst->priv->target == GST_STATE_PLAYING && pending != GST_STATE_PLAYING)
 	    {
 		parole_gst_play_file_internal (gst);
 	    }
@@ -698,6 +717,28 @@
     g_signal_emit (G_OBJECT (gst), signals [MEDIA_TAG], 0, gst->priv->stream);
 }
 
+static void
+parole_gst_application_message (ParoleGst *gst, GstMessage *msg)
+{
+    const gchar *name;
+
+    name = gst_structure_get_name (msg->structure);
+    
+    if ( !name )
+	return;
+	
+    TRACE ("Application message : %s", name);
+    
+    if ( !g_strcmp0 (name, "notify-streaminfo") )
+    {
+	parole_gst_update_stream_info (gst);
+    }
+    else 
+    {
+	//FIXME: Handle video size message.
+    }
+}
+
 static gboolean
 parole_gst_bus_event (GstBus *bus, GstMessage *msg, gpointer data)
 {
@@ -749,11 +790,7 @@
 		parole_gst_evaluate_state (gst, old, new, pending);
 	    break;
 	}
-	case GST_MESSAGE_WARNING:
-	    break;
-	case GST_MESSAGE_INFO:
-	    TRACE ("Info message:");
-	    break;
+	
 	case GST_MESSAGE_TAG:
 	{
 	    GstTagList *tag_list;
@@ -764,6 +801,20 @@
 	    gst_tag_list_free (tag_list);
 	    break;
 	}
+	case GST_MESSAGE_APPLICATION:
+	    parole_gst_application_message (gst, msg);
+	    break;
+	case GST_MESSAGE_DURATION:
+	    TRACE ("Duration message");
+	    parole_gst_query_duration (gst);
+	    break;
+	case GST_MESSAGE_ELEMENT:
+	    break;
+	case GST_MESSAGE_WARNING:
+	    break;
+	case GST_MESSAGE_INFO:
+	    TRACE ("Info message:");
+	    break;
 	case GST_MESSAGE_STATE_DIRTY:
 	    TRACE ("Stream is dirty");
 	    break;
@@ -780,13 +831,8 @@
 	case GST_MESSAGE_STREAM_STATUS:
 	    TRACE ("Stream status");
 	    break;
-	case GST_MESSAGE_APPLICATION:
-	    TRACE ("Application message");
-	    break;
 	case GST_MESSAGE_SEGMENT_START:
 	    break;
-	case GST_MESSAGE_DURATION:
-	    break;
 	case GST_MESSAGE_LATENCY:
 	    break;
 	case GST_MESSAGE_ASYNC_START:
@@ -833,7 +879,7 @@
 parole_gst_stream_info_notify_cb (GObject * obj, GParamSpec * pspec, ParoleGst *gst)
 {
     GstMessage *msg;
-    TRACE ("Stream info changed?");
+    TRACE ("Stream info changed");
     msg = gst_message_new_application (GST_OBJECT (gst->priv->playbin),
 				       gst_structure_new ("notify-streaminfo", NULL));
     gst_element_post_message (gst->priv->playbin, msg);
@@ -1002,6 +1048,29 @@
 }
 
 static void
+parole_gst_change_dvd_chapter (ParoleGst *gst, gint level)
+{
+    GstFormat format;
+    gint64 val;
+    
+    format = gst_format_get_by_nick ("chapter");
+    
+    if ( format != GST_FORMAT_UNDEFINED )
+    {
+	if ( gst_element_query_position (gst->priv->playbin, &format, &val) )
+	{
+	    val += level;
+	    gst_element_seek (gst->priv->playbin, 1.0, format, 
+			      GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 
+			      val,
+			      GST_SEEK_TYPE_NONE,
+			      0);
+	}
+    }
+    
+}
+
+static void
 parole_gst_conf_notify_cb (GObject *object, GParamSpec *spec, ParoleGst *gst)
 {
     TRACE ("spec->name=%s\n", spec->name);
@@ -1280,3 +1349,13 @@
 {
     return gst->priv->target;
 }
+
+void parole_gst_next_dvd_chapter (ParoleGst *gst)
+{
+    parole_gst_change_dvd_chapter (gst, 1);
+}
+
+void parole_gst_prev_dvd_chapter (ParoleGst *gst)
+{
+    parole_gst_change_dvd_chapter (gst, -1);
+}

Modified: parole/trunk/parole/parole-gst.h
===================================================================
--- parole/trunk/parole/parole-gst.h	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/parole/parole-gst.h	2009-07-29 07:41:58 UTC (rev 7858)
@@ -59,55 +59,59 @@
 {
     GtkWidgetClass 	parent_class;
     
-    void		(*media_state)		 (ParoleGst *gst,
-						  const ParoleStream *stream,
-						  ParoleMediaState state);
+    void		(*media_state)		 	(ParoleGst *gst,
+							 const ParoleStream *stream,
+							 ParoleMediaState state);
 						  
-    void		(*media_progressed)	 (ParoleGst *gst,
-					          const ParoleStream *stream,
-						  gdouble value);
+    void		(*media_progressed)	 	(ParoleGst *gst,
+						         const ParoleStream *stream,
+							 gdouble value);
     
-    void		(*buffering)		 (ParoleGst *gst,
-					          const ParoleStream *stream,
-						  gint percentage);
+    void		(*buffering)		 	(ParoleGst *gst,
+							 const ParoleStream *stream,
+							 gint percentage);
     
-    void		(*media_tag)		 (ParoleGst *gst,
-						  const ParoleStream *stream);
+    void		(*media_tag)		 	(ParoleGst *gst,
+							 const ParoleStream *stream);
     
-    void		(*error)		 (ParoleGst *gst,
-						  const gchar *error);
+    void		(*error)		 	(ParoleGst *gst,
+							 const gchar *error);
     
 } ParoleGstClass;
 
-GType        		parole_gst_get_type        (void) G_GNUC_CONST;
+GType        		parole_gst_get_type        	(void) G_GNUC_CONST;
 
-GtkWidget      	       *parole_gst_new             (void);
+GtkWidget      	       *parole_gst_new             	(void);
 
-void		        parole_gst_play_uri        (ParoleGst *gst,
-					            const gchar *uri);
+void		        parole_gst_play_uri        	(ParoleGst *gst,
+							 const gchar *uri);
 
-void			parole_gst_pause           (ParoleGst *gst);
+void			parole_gst_pause           	(ParoleGst *gst);
 
-void			parole_gst_resume          (ParoleGst *gst);
+void			parole_gst_resume          	(ParoleGst *gst);
 
-void			parole_gst_stop            (ParoleGst *gst);
+void			parole_gst_stop            	(ParoleGst *gst);
 
-void			parole_gst_null_state	   (ParoleGst *gst);
+void			parole_gst_null_state	   	(ParoleGst *gst);
 
-void			parole_gst_seek		   (ParoleGst *gst,
-						    gdouble pos);
+void			parole_gst_seek		   	(ParoleGst *gst,
+							 gdouble pos);
 
-void			parole_gst_set_volume      (ParoleGst *gst,
-						    gdouble value);
+void			parole_gst_set_volume      	(ParoleGst *gst,
+							 gdouble value);
 						    
-gdouble			parole_gst_get_volume	   (ParoleGst *gst);
+gdouble			parole_gst_get_volume	   	(ParoleGst *gst);
 
-ParoleMediaState        parole_gst_get_state	   (ParoleGst *gst);
+ParoleMediaState        parole_gst_get_state	   	(ParoleGst *gst);
 
-GstState	        parole_gst_get_gst_state   (ParoleGst *gst);
+GstState	        parole_gst_get_gst_state   	(ParoleGst *gst);
 
 GstState	        parole_gst_get_gst_target_state (ParoleGst *gst);
 
+void			parole_gst_next_dvd_chapter 	(ParoleGst *gst);
+
+void			parole_gst_prev_dvd_chapter 	(ParoleGst *gst);
+
 G_END_DECLS
 
 #endif /* __PAROLE_GST_H */

Modified: parole/trunk/parole/parole-player.c
===================================================================
--- parole/trunk/parole/parole-player.c	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/parole/parole-player.c	2009-07-29 07:41:58 UTC (rev 7858)
@@ -40,6 +40,7 @@
 #include "parole-mediachooser.h"
 #include "parole-file.h"
 #include "parole-disc.h"
+#include "parole-disc-menu.h"
 #include "parole-statusbar.h"
 #include "parole-screensaver.h"
 #include "parole-conf-dialog.h"
@@ -125,6 +126,7 @@
     ParoleDisc          *disc;
     ParoleScreenSaver   *screen_saver;
     ParoleConf          *conf;
+    ParoleDiscMenu      *disc_menu;
 
     GtkWidget 		*gst;
 
@@ -710,10 +712,12 @@
 static void
 parole_player_full_screen_menu_item_activate (ParolePlayer *player)
 {
+    gint npages;
     static gint current_page = 0;
     
     if ( player->priv->full_screen )
     {
+	npages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (player->priv->main_nt));
 	gtk_widget_reparent (player->priv->play_box, player->priv->control);
 	gtk_widget_hide (player->priv->fs_window);
 	parole_statusbar_set_visible (player->priv->status, TRUE);
@@ -723,7 +727,8 @@
 	gtk_widget_show (player->priv->show_hide_playlist);
 	gtk_widget_hide (player->priv->leave_fs);
 	
-	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (player->priv->main_nt), TRUE);
+	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (player->priv->main_nt), npages > 1);
+	
 	gtk_window_unfullscreen (GTK_WINDOW (player->priv->window));
 	gtk_notebook_set_current_page (GTK_NOTEBOOK (player->priv->playlist_nt), current_page);
 	player->priv->full_screen = FALSE;
@@ -1001,6 +1006,7 @@
     g_object_unref (player->priv->gst);
     g_object_unref (player->priv->status);
     g_object_unref (player->priv->disc);
+    g_object_unref (player->priv->disc_menu);
     g_object_unref (player->priv->conf);
     g_object_unref (player->priv->screen_saver);
     
@@ -1057,6 +1063,8 @@
     g_signal_connect (player->priv->disc, "disc-selected",
 		      G_CALLBACK (parole_player_disc_selected_cb), player);
 		      
+    player->priv->disc_menu = parole_disc_menu_new ();
+    
     player->priv->screen_saver = parole_screen_saver_new ();
     player->priv->list = PAROLE_MEDIA_LIST (parole_media_list_new ());
     

Modified: parole/trunk/parole/parole-statusbar.c
===================================================================
--- parole/trunk/parole/parole-statusbar.c	2009-07-28 22:33:53 UTC (rev 7857)
+++ parole/trunk/parole/parole-statusbar.c	2009-07-29 07:41:58 UTC (rev 7858)
@@ -100,6 +100,7 @@
 {
     gchar *text = NULL;
     gchar *title = NULL;
+    gchar *uri = NULL;
     gboolean live;
     
     if ( state >= PAROLE_STATE_PAUSED )
@@ -107,21 +108,27 @@
 	g_object_get (G_OBJECT (stream),
 		      "title", &title,
 		      "live", &live,
+		      "uri", &uri,
 		      NULL);
 		      
+	if ( live )
+	{
+	    text = g_strdup_printf ("%s '%s'", _("Live stream:"), uri);
+	    gtk_label_set_text (GTK_LABEL (bar->priv->label_text), text);
+	    g_free (text);
+	    g_free (uri);
+	    if ( title )
+		g_free (title);
+	    return;
+	}
+	
 	if ( !title )
 	{
-	    gchar *uri;
 	    gchar *filename;
-	    g_object_get (G_OBJECT (stream),
-			  "uri", &uri,
-			  NULL);
-			  
-	    if ( !uri )
+	    if ( G_UNLIKELY (uri == NULL) )
 		goto out;
-		
+	    
 	    filename = g_filename_from_uri (uri, NULL, NULL);
-	    g_free (uri);
 	    
 	    if ( filename )
 	    {
@@ -129,12 +136,16 @@
 		g_free (filename);
 	    }
 	    else
+	    {
+		TRACE ("Unable to set statusbar title");
 		goto out;
+	    }
 	}
 	
-	text = g_strdup_printf ("%s %s", live ? _("Live stream") : " ", title);
+	text = g_strdup_printf ("%s", title);
 	gtk_label_set_text (GTK_LABEL (bar->priv->label_text), text);
 	g_free (text);
+	g_free (uri);
 	return;
     }
 	
@@ -158,6 +169,9 @@
 	statusbar->priv->pos = 0;
     }
 	
+    if ( state < PAROLE_STATE_PAUSED ) 
+	gtk_widget_hide (statusbar->priv->progress);
+	
     parole_statusbar_set_text (statusbar, stream, state);
     parole_statusbar_set_duration (statusbar, state, statusbar->priv->pos);
 }




More information about the Goodies-commits mailing list