Added a bunch of new stuff including better fullscreen handling and some new playlist stuff that's not hooked up yet.

Original commit message from CVS:
Added a bunch of new stuff including better fullscreen handling and some new playlist stuff that's not hooked up yet.
This commit is contained in:
Arik Devens 2001-08-15 22:32:30 +00:00
parent 07ec634c07
commit 4361a3c166
6 changed files with 205 additions and 16 deletions

View file

@ -1,4 +1,39 @@
2001-06-12 Arik Devens <adevens@antioch-college.edu>
2001-08-15 Arik Devens <arik@gnome.org>
* main.c (main): Disabled the showing of the playlist till it
works. ;-)
* gstmediaplay.c (gst_media_play_play_item): New function to play
an item when selected in the playlist.
(gst_media_play_show_playlist): New function to show the
playlist. This is temporary till i do an interface overhaul on the
player.
(gst_media_play_addto_playlist): New function to add files to the
playlist.
* main.c (main): Added stuff for playlist and for handling
multiple files from the console.
* gstmediaplay.h: Added new items to the GstMediaPlay struct for
playlist stuff and for the fullscreen keypress connection.
* gstmediaplay.c (fullscreen_key_press_event): New function to
handle keypress stuff so that we leave fullscreen when the user
hits the escape key.
(gst_media_play_set_fullscreen): Added a signal connect/disconnect
for keypress handling.
(gst_media_play_set_original_size): Added checking to see if we
are still in fullscreen mode and if we are leaving it before
sizing to original size.
(gst_media_play_set_double_size): Ditto except for double size.
2001-08-12 Arik Devens <arik@gnome.org>
* gstmediaplay.c (gst_media_play_set_fullscreen): Added the hiding
and reshowing of the status area when entering and leaving
fullscreen.
2001-06-12 Arik Devens <arik@gnome.org>
* gstmediaplay.glade: Added a basic preferences dialog, not hooked
up yet.

View file

@ -208,7 +208,58 @@ gst_media_play_new ()
}
static void
gst_media_play_update_status_area (GstMediaPlay *play,
gst_media_play_play_item (GtkCList *clist,
gint row,
gint column,
GdkEventButton *event,
GstMediaPlay *mplay)
{
gchar *text;
gtk_clist_get_text (clist, row, column, &text);
gdk_threads_leave ();
gst_media_play_start_uri (mplay, text);
gdk_threads_enter ();
}
void
gst_media_play_show_playlist (GstMediaPlay *mplay)
{
struct stat statbuf;
/* load the interface */
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) {
mplay->playlist_xml = glade_xml_new (DATADIR"gstmediaplay.glade", "playlist_window");
}
else {
mplay->playlist_xml = glade_xml_new ("gstmediaplay.glade", "playlist_window");
}
g_assert (mplay->playlist_xml != NULL);
mplay->playlist_window = glade_xml_get_widget (mplay->playlist_xml, "playlist_window");
mplay->playlist_clist = glade_xml_get_widget (mplay->playlist_xml, "playlist_clist");
gtk_signal_connect (GTK_OBJECT (mplay->playlist_clist), "select_row",
GTK_SIGNAL_FUNC (gst_media_play_play_item), mplay);
gtk_window_set_default_size (GTK_WINDOW (mplay->playlist_window), 215, 280);
gtk_widget_show (mplay->playlist_window);
}
void
gst_media_play_addto_playlist (GstMediaPlay *mplay, char *uri)
{
gchar *text[2];
text[0] = uri;
gtk_clist_append (GTK_CLIST (mplay->playlist_clist), text);
}
static void
gst_media_play_update_status_area (GstMediaPlay *mplay,
gulong current_time,
gulong total_time)
{
@ -218,32 +269,32 @@ gst_media_play_update_status_area (GstMediaPlay *play,
current_time / 60, current_time % 60,
total_time / 60, total_time % 60);
gst_status_area_set_playtime (play->status, time);
gst_status_area_set_playtime (mplay->status, time);
}
void
gst_media_play_start_uri (GstMediaPlay *play,
gst_media_play_start_uri (GstMediaPlay *mplay,
const guchar *uri)
{
GstPlayReturn ret;
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_MEDIA_PLAY (play));
g_return_if_fail (mplay != NULL);
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
if (uri != NULL) {
ret = gst_play_set_uri (play->play, uri);
ret = gst_play_set_uri (mplay->play, uri);
if (ret == GST_PLAY_CANNOT_PLAY) {
printf ("*** Cannot load file: %s ***\n", uri);
} else {
if (!gst_play_media_can_seek (play->play)) {
gtk_widget_set_sensitive (play->slider, FALSE);
if (!gst_play_media_can_seek (mplay->play)) {
gtk_widget_set_sensitive (mplay->slider, FALSE);
}
gtk_window_set_title (GTK_WINDOW (play->window),
gtk_window_set_title (GTK_WINDOW (mplay->window),
g_strconcat ( "Gstplay - ", uri, NULL));
gst_play_play (play->play);
gst_play_play (mplay->play);
}
}
}
@ -265,6 +316,8 @@ on_load_file_selected (GtkWidget *button,
gst_media_play_start_uri (play, file_name);
gdk_threads_enter();
gst_media_play_addto_playlist (play, file_name);
g_free (data);
}
@ -402,6 +455,9 @@ gst_media_play_set_original_size (GstMediaPlay *mplay)
play = mplay->play;
if (fullscreen_active)
gst_media_play_set_fullscreen (mplay);
video_widget = gst_play_get_video_widget (play);
width = gst_play_get_source_width (play);
height = gst_play_get_source_height (play);
@ -418,6 +474,9 @@ gst_media_play_set_double_size (GstMediaPlay *mplay)
play = mplay->play;
if (fullscreen_active)
gst_media_play_set_fullscreen (mplay);
video_widget = gst_play_get_video_widget (play);
width = gst_play_get_source_width (play);
height = gst_play_get_source_height (play);
@ -425,6 +484,20 @@ gst_media_play_set_double_size (GstMediaPlay *mplay)
gtk_widget_set_usize (video_widget, width * 1.5, height * 1.5);
}
static int
fullscreen_key_press_event (GtkWidget *widget,
GdkEventKey *event,
GstMediaPlay *mplay)
{
switch (event->keyval) {
case GDK_Escape:
gst_media_play_set_fullscreen (mplay);
break;
}
return TRUE;
}
void
gst_media_play_set_fullscreen (GstMediaPlay *mplay)
{
@ -446,6 +519,7 @@ gst_media_play_set_fullscreen (GstMediaPlay *mplay)
gtk_widget_hide (glade_xml_get_widget (mplay->xml, "dockitem2"));
gtk_widget_hide (glade_xml_get_widget (mplay->xml, "dockitem3"));
gtk_widget_hide (glade_xml_get_widget (mplay->xml, "dockitem4"));
gtk_widget_hide (GTK_WIDGET (mplay->status));
gdk_window_get_origin (gdk_window, &root_x, &root_y);
gdk_window_get_geometry (gdk_window, &client_x, &client_y,
@ -458,19 +532,25 @@ gst_media_play_set_fullscreen (GstMediaPlay *mplay)
mplay->y = root_y - client_y;
mplay->width = width;
mplay->height = height;
fullscreen_active = TRUE;
mplay->fullscreen_connection_id = gtk_signal_connect (GTK_OBJECT (mplay->window), "key_press_event",
(GtkSignalFunc) fullscreen_key_press_event, mplay);
} else {
gtk_widget_show (glade_xml_get_widget (mplay->xml, "dockitem1"));
gtk_widget_show (glade_xml_get_widget (mplay->xml, "dockitem2"));
gtk_widget_show (glade_xml_get_widget (mplay->xml, "dockitem3"));
gtk_widget_show (glade_xml_get_widget (mplay->xml, "dockitem4"));
gtk_widget_show (GTK_WIDGET (mplay->status));
gtk_widget_queue_resize (glade_xml_get_widget (mplay->xml, "dock1"));
gdk_window_move (gdk_window, mplay->x, mplay->y);
gtk_widget_set_usize (video_widget, source_width,
source_height);
gtk_signal_disconnect (GTK_OBJECT (mplay->window), mplay->fullscreen_connection_id);
fullscreen_active = FALSE;
}
}

View file

@ -626,4 +626,62 @@ Arik Devens &lt;arik@gnome.org&gt;
</widget>
</widget>
<widget>
<class>GtkWindow</class>
<name>playlist_window</name>
<title>playlist</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow1</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget>
<class>GtkCList</class>
<name>playlist_clist</name>
<can_focus>True</can_focus>
<columns>2</columns>
<column_widths>273,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>track_name</name>
<label>track name</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>track_lengthe</name>
<label>track length</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View file

@ -18,6 +18,7 @@ struct _GstMediaPlay {
GtkObject parent;
GladeXML *xml;
GladeXML *playlist_xml;
GstPlay *play;
GtkWidget *play_button;
@ -30,6 +31,12 @@ struct _GstMediaPlay {
// the slider
GtkAdjustment *adjustment;
GtkWidget *slider;
// the playlist
GtkWidget *playlist_window;
GtkWidget *playlist_clist;
guint fullscreen_connection_id;
gulong last_time;
@ -48,6 +55,9 @@ GstMediaPlay* gst_media_play_new (void);
void gst_media_play_start_uri (GstMediaPlay *play, const guchar *uri);
void gst_media_play_show_playlist (GstMediaPlay *mplay);
void gst_media_play_addto_playlist (GstMediaPlay *mplay, char *uri);
void gst_media_play_set_original_size (GstMediaPlay *mplay);
void gst_media_play_set_double_size (GstMediaPlay *mplay);
void gst_media_play_set_fullscreen (GstMediaPlay *mplay);

View file

@ -251,7 +251,7 @@ gst_play_object_introspect (GstObject *object, const gchar *property, GstElement
}
else {
*target = element;
GST_DEBUG(0, "gstplay: using element \"%s\" for %s property\n",
GST_DEBUG(0, "gstplay: using element \"%s\" for %s property\n",
gst_element_get_name(element), property);
}
}
@ -382,7 +382,7 @@ gst_play_set_uri (GstPlay *play, const guchar *uri)
g_return_val_if_fail (play != NULL, GST_PLAY_ERROR);
g_return_val_if_fail (GST_IS_PLAY (play), GST_PLAY_ERROR);
g_return_val_if_fail (uri != NULL, GST_PLAY_ERROR);
priv = (GstPlayPrivate *)play->priv;
if (priv->uri)
@ -413,7 +413,6 @@ gst_play_set_uri (GstPlay *play, const guchar *uri)
gtk_object_set (G_OBJECT (priv->src), "location", priv->uri, NULL);
priv->cache = gst_elementfactory_make ("autoplugcache", "cache");
g_return_val_if_fail (priv->cache != NULL, GST_PLAY_CANNOT_PLAY);

View file

@ -15,7 +15,14 @@ main (int argc, char *argv[])
play = gst_media_play_new ();
if (argc > 1) {
int i;
//gst_media_play_show_playlist (play);
gst_media_play_start_uri (play, argv[1]);
for (i=1;i<argc;i++) {
gst_media_play_addto_playlist (play, argv[i]);
}
}
xmlSaveFile ("gstmediaplay.gst", gst_xml_write (gst_play_get_pipeline (play->play)));