Added hacky check to make sure we have video to fullscreen, will be removed when the new libgstplay lands.

Original commit message from CVS:
Added hacky check to make sure we have video to fullscreen, will be removed when the new libgstplay lands.
This commit is contained in:
Arik Devens 2001-08-15 22:43:09 +00:00
parent 4361a3c166
commit 51af47b13a
3 changed files with 74 additions and 64 deletions

View file

@ -1,3 +1,10 @@
2001-08-15 Arik Devens <arik@gnome.org>
* gstmediaplay.c (gst_media_play_set_fullscreen): Added a hacky
check to determine if we are even playing a video. workaround till
the new libgstplay gets here and makes all of this hackishness
unnecessary and foolish. ;-)
2001-08-15 Arik Devens <arik@gnome.org>
* main.c (main): Disabled the showing of the playlist till it

View file

@ -514,44 +514,47 @@ gst_media_play_set_fullscreen (GstMediaPlay *mplay)
source_width = gst_play_get_source_width (play);
source_height = gst_play_get_source_height (play);
if (!fullscreen_active) {
gtk_widget_hide (glade_xml_get_widget (mplay->xml, "dockitem1"));
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,
&width, &height, NULL);
gdk_window_move (gdk_window, -client_x, -client_y);
gtk_widget_set_usize (video_widget, gdk_screen_width () + 1,
gdk_screen_height () + 1);
mplay->x = root_x - client_x;
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;
if (source_width || source_height)
{
if (!fullscreen_active) {
gtk_widget_hide (glade_xml_get_widget (mplay->xml, "dockitem1"));
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,
&width, &height, NULL);
gdk_window_move (gdk_window, -client_x, -client_y);
gtk_widget_set_usize (video_widget, gdk_screen_width () + 1,
gdk_screen_height () + 1);
mplay->x = root_x - client_x;
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

@ -165,8 +165,8 @@ gst_play_init (GstPlay *play)
priv->bit_rate_element = NULL;
priv->media_time_element = NULL;
priv->source_width = 100;
priv->source_height = 100;
priv->source_width = 0;
priv->source_height = 0;
}
GstPlay *
@ -387,51 +387,51 @@ gst_play_set_uri (GstPlay *play, const guchar *uri)
if (priv->uri)
g_free (priv->uri);
/* see if it looks like an URI */
if ((uriloc = strstr (uri, ":/"))) {
priv->src = gst_elementfactory_make ("gnomevfssrc", "srcelement");
if (!priv->src) {
if (strstr (uri, "file:/")) {
priv->src = gst_elementfactory_make ("gnomevfssrc", "srcelement");
if (!priv->src) {
if (strstr (uri, "file:/")) {
uri += strlen ("file:/");
}
else
return GST_PLAY_CANNOT_PLAY;
}
}
else
return GST_PLAY_CANNOT_PLAY;
}
}
if (priv->src == NULL) {
priv->src = gst_elementfactory_make ("disksrc", "srcelement");
priv->src = gst_elementfactory_make ("disksrc", "srcelement");
}
priv->uri = g_strdup (uri);
//priv->src = gst_elementfactory_make ("dvdsrc", "disk_src");
priv->offset_element = priv->src;
g_return_val_if_fail (priv->src != NULL, GST_PLAY_CANNOT_PLAY);
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);
gtk_signal_connect (GTK_OBJECT (priv->cache), "cache_empty",
GTK_SIGNAL_FUNC (gst_play_cache_empty), play);
GTK_SIGNAL_FUNC (gst_play_cache_empty), play);
priv->typefind = gst_elementfactory_make ("typefind", "typefind");
g_return_val_if_fail (priv->typefind != NULL, GST_PLAY_CANNOT_PLAY);
gtk_signal_connect (GTK_OBJECT (priv->typefind), "have_type",
GTK_SIGNAL_FUNC (gst_play_have_type), play);
GTK_SIGNAL_FUNC (gst_play_have_type), play);
gst_bin_add (GST_BIN (priv->pipeline), priv->src);
gst_bin_add (GST_BIN (priv->pipeline), priv->cache);
gst_bin_add (GST_BIN (priv->pipeline), priv->typefind);
gst_element_connect (priv->src, "src", priv->cache, "sink");
gst_element_connect (priv->cache, "src", priv->typefind, "sink");
return GST_PLAY_OK;
}
@ -451,7 +451,7 @@ gst_play_realize (GtkWidget *widget)
priv->video_widget = gtk_socket_new ();
gtk_container_add (GTK_CONTAINER (widget), priv->video_widget);
if (GTK_WIDGET_CLASS (parent_class)->realize) {
GTK_WIDGET_CLASS (parent_class)->realize (widget);
}