mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
Hmm, added working (if hacked) full-screen play, shuffled things around, added error checking so we don't crash on fi...
Original commit message from CVS: Hmm, added working (if hacked) full-screen play, shuffled things around, added error checking so we don't crash on file not found, added the beginnings of a preferences dialog.
This commit is contained in:
parent
f462526422
commit
80fdb9475e
11 changed files with 300 additions and 349 deletions
|
@ -1,3 +1,44 @@
|
|||
2001-06-12 Arik Devens <adevens@antioch-college.edu>
|
||||
|
||||
* gstmediaplay.glade: Added a basic preferences dialog, not hooked
|
||||
up yet.
|
||||
|
||||
* callbacks.c (on_preferences1_activate): Added loading the new
|
||||
preferences dialog.
|
||||
|
||||
* Makefile.am: Removed full-screen.[c,h] from the build.
|
||||
|
||||
* full-screen.h: Removed this file, no longer needed.
|
||||
|
||||
* full-screen.c: Removed this file, no longer needed.
|
||||
|
||||
* gstplay.c (gst_play_get_video_widget): New function to return
|
||||
the actual video_widget.
|
||||
(gst_play_get_source_width): New function to get the width of the
|
||||
source media.
|
||||
(gst_play_get_source_height): New function to get the height of
|
||||
the source media.
|
||||
(gst_play_set_uri): Added check to make sure the file we are
|
||||
trying to play actually exists. i wonder if this fails with
|
||||
gnomevfs?
|
||||
|
||||
* callbacks.c (on_original_size_activate): Use the new function.
|
||||
(on_double_size_activate): Use the new function.
|
||||
(on_full_screen_activate): Use the new function.
|
||||
|
||||
* gstmediaplay.h (gst_media_play_set_fullscreen): Added function
|
||||
prototypes for the new functions.
|
||||
|
||||
* gstmediaplay.c (gst_media_play_start_uri): Added a check for the
|
||||
return value of set_uri so that we don't crash on not being able
|
||||
to load a file.
|
||||
(gst_media_play_set_original_size): New function to size the
|
||||
video_widget to its default size.
|
||||
(gst_media_play_set_fullscreen): New function to do
|
||||
full-screen. Still a hack but at least this one works.
|
||||
(gst_media_play_set_double_size): New function to size the
|
||||
video_widget to double its default size.
|
||||
|
||||
2001-06-06 Arik Devens <arik@gnome.org>
|
||||
|
||||
* gstmediaplay.glade: Dissabled full-screen for the moment till it
|
||||
|
|
|
@ -20,8 +20,7 @@ libgstmediaplay_la_SOURCES = \
|
|||
gstplay.c \
|
||||
gstmediaplay.c \
|
||||
gststatusarea.c \
|
||||
callbacks.c \
|
||||
full-screen.c
|
||||
callbacks.c
|
||||
|
||||
gstmediaplay_SOURCES = \
|
||||
main.c
|
||||
|
@ -34,9 +33,7 @@ noinst_HEADERS = \
|
|||
gstmediaplay.h \
|
||||
gststatusarea.h \
|
||||
callbacks.h \
|
||||
gstplayprivate.h \
|
||||
full-screen.h
|
||||
|
||||
gstplayprivate.h
|
||||
|
||||
libgstmediaplay_la_LDFLAGS = -rdynamic
|
||||
|
||||
|
|
|
@ -35,42 +35,43 @@ void
|
|||
on_original_size_activate (GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
GstMediaPlay *mplay;
|
||||
GstPlay *play;
|
||||
|
||||
mplay = GST_MEDIA_PLAY (user_data);
|
||||
play = mplay->play;
|
||||
|
||||
gst_play_set_display_size (play, 0);
|
||||
gst_media_play_set_original_size (mplay);
|
||||
}
|
||||
|
||||
void
|
||||
on_double_size_activate (GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
GstMediaPlay *mplay;
|
||||
GstPlay *play;
|
||||
|
||||
mplay = GST_MEDIA_PLAY (user_data);
|
||||
play = mplay->play;
|
||||
|
||||
gst_play_set_display_size (play, 1);
|
||||
gst_media_play_set_double_size (mplay);
|
||||
}
|
||||
|
||||
void
|
||||
on_full_screen_activate (GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
GstMediaPlay *mplay;
|
||||
GstPlay *play;
|
||||
|
||||
mplay = GST_MEDIA_PLAY (user_data);
|
||||
play = mplay->play;
|
||||
|
||||
gst_play_set_display_size (play, 2);
|
||||
|
||||
gst_media_play_set_fullscreen (mplay);
|
||||
}
|
||||
|
||||
void
|
||||
on_preferences1_activate (GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
printf ("file1 activate\n");
|
||||
GladeXML *xml;
|
||||
struct stat statbuf;
|
||||
|
||||
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) {
|
||||
xml = glade_xml_new (DATADIR"gstmediaplay.glade", "preferences");
|
||||
}
|
||||
else
|
||||
xml = glade_xml_new ("gstmediaplay.glade", "preferences");
|
||||
}
|
||||
|
||||
void on_about_activate (GtkWidget *widget, gpointer data)
|
||||
|
|
|
@ -1,247 +0,0 @@
|
|||
#include <config.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include "full-screen.h"
|
||||
#include "gstplay.h"
|
||||
|
||||
/* Private part of the FullScreen structure */
|
||||
struct _FullScreenPrivate {
|
||||
GstPlay *play;
|
||||
|
||||
/* Whether we have a keyboard grab */
|
||||
guint have_grab : 1;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void full_screen_class_init (FullScreenClass *class);
|
||||
static void full_screen_init (FullScreen *fs);
|
||||
static void full_screen_finalize (GtkObject *object);
|
||||
|
||||
static void full_screen_show (GtkWidget *widget);
|
||||
static void full_screen_hide (GtkWidget *widget);
|
||||
|
||||
static gint full_screen_key_press (GtkWidget *widget, GdkEventKey *event);
|
||||
|
||||
static GtkWindowClass *parent_class;
|
||||
|
||||
/**
|
||||
|
||||
* @void:
|
||||
*
|
||||
* Registers the #FullScreen class if necessary, and returns the type ID
|
||||
* associated to it.
|
||||
*
|
||||
* Return value: The type ID of the #FullScreen class.
|
||||
**/
|
||||
GtkType
|
||||
full_screen_get_type (void)
|
||||
{
|
||||
static GtkType full_screen_type = 0;
|
||||
|
||||
if (!full_screen_type) {
|
||||
static GtkTypeInfo full_screen_info = {
|
||||
"FullScreen",
|
||||
sizeof (FullScreen),
|
||||
sizeof (FullScreenClass),
|
||||
(GtkClassInitFunc) full_screen_class_init,
|
||||
(GtkObjectInitFunc) full_screen_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
full_screen_type = gtk_type_unique (GTK_TYPE_WINDOW, &full_screen_info);
|
||||
}
|
||||
|
||||
return full_screen_type;
|
||||
}
|
||||
|
||||
/* Class initialization function for the full screen mode */
|
||||
static void
|
||||
full_screen_class_init (FullScreenClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
widget_class = (GtkWidgetClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (GTK_TYPE_WINDOW);
|
||||
|
||||
object_class->finalize = full_screen_finalize;
|
||||
|
||||
widget_class->show = full_screen_show;
|
||||
widget_class->hide = full_screen_hide;
|
||||
widget_class->key_press_event = full_screen_key_press;
|
||||
}
|
||||
|
||||
/* Object initialization function for the full screen view */
|
||||
static void
|
||||
full_screen_init (FullScreen *fs)
|
||||
{
|
||||
FullScreenPrivate *priv;
|
||||
|
||||
priv = g_new0 (FullScreenPrivate, 1);
|
||||
fs->priv = priv;
|
||||
|
||||
GTK_WINDOW (fs)->type = GTK_WINDOW_POPUP;
|
||||
g_assert (fs != NULL);
|
||||
gtk_widget_set_usize (GTK_WIDGET (fs), gdk_screen_width (), gdk_screen_height ());
|
||||
gtk_widget_set_uposition (GTK_WIDGET (fs), 0, 0);
|
||||
|
||||
priv->play = gst_play_new();
|
||||
gtk_container_add (GTK_CONTAINER (fs), GTK_WIDGET (priv->play));
|
||||
gtk_widget_show (priv->play);
|
||||
}
|
||||
|
||||
/* Finalize handler for the full screen view */
|
||||
static void
|
||||
full_screen_finalize (GtkObject *object)
|
||||
{
|
||||
FullScreen *fs;
|
||||
FullScreenPrivate *priv;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (IS_FULL_SCREEN (object));
|
||||
|
||||
fs = FULL_SCREEN (object);
|
||||
priv = fs->priv;
|
||||
|
||||
g_free (priv);
|
||||
fs->priv = NULL;
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->finalize)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Widget methods */
|
||||
|
||||
/* Show handler for the full screen view */
|
||||
static void
|
||||
full_screen_show (GtkWidget *widget)
|
||||
{
|
||||
FullScreen *fs;
|
||||
FullScreenPrivate *priv;
|
||||
|
||||
fs = FULL_SCREEN (widget);
|
||||
priv = fs->priv;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->show)
|
||||
(* GTK_WIDGET_CLASS (parent_class)->show) (widget);
|
||||
|
||||
priv->have_grab = gdk_keyboard_grab (widget->window, TRUE, GDK_CURRENT_TIME) == 0;
|
||||
gtk_grab_add (widget);
|
||||
|
||||
//gtk_widget_grab_focus (ui_image_get_image_view (UI_IMAGE (priv->ui)));
|
||||
}
|
||||
|
||||
/* Hide handler for the full screen view */
|
||||
static void
|
||||
full_screen_hide (GtkWidget *widget)
|
||||
{
|
||||
FullScreen *fs;
|
||||
FullScreenPrivate *priv;
|
||||
|
||||
fs = FULL_SCREEN (widget);
|
||||
priv = fs->priv;
|
||||
|
||||
if (priv->have_grab) {
|
||||
priv->have_grab = FALSE;
|
||||
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->show)
|
||||
(* GTK_WIDGET_CLASS (parent_class)->show) (widget);
|
||||
|
||||
gtk_widget_destroy (widget);
|
||||
}
|
||||
|
||||
/* Key press handler for the full screen view */
|
||||
static gint
|
||||
full_screen_key_press (GtkWidget *widget, GdkEventKey *event)
|
||||
{
|
||||
gint result;
|
||||
gboolean do_hide;
|
||||
|
||||
result = FALSE;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->key_press_event)
|
||||
result = (* GTK_WIDGET_CLASS (parent_class)->key_press_event) (widget, event);
|
||||
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
do_hide = FALSE;
|
||||
|
||||
switch (event->keyval) {
|
||||
case GDK_Escape:
|
||||
do_hide = TRUE;
|
||||
break;
|
||||
|
||||
case GDK_W:
|
||||
case GDK_w:
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
do_hide = TRUE;
|
||||
break;
|
||||
|
||||
case GDK_Q:
|
||||
case GDK_q:
|
||||
do_hide = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (do_hide)
|
||||
gtk_widget_hide (widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* full_screen_new:
|
||||
* @void:
|
||||
*
|
||||
* Creates a new empty full screen image viewer.
|
||||
*
|
||||
* Return value: A newly-created full screen image viewer.
|
||||
**/
|
||||
GtkWidget *
|
||||
full_screen_new (void)
|
||||
{
|
||||
return GTK_WIDGET (gtk_type_new (TYPE_FULL_SCREEN));
|
||||
}
|
||||
|
||||
void
|
||||
full_screen_set_uri (FullScreen *fs,
|
||||
GstPlay *play,
|
||||
const guchar *uri)
|
||||
{
|
||||
g_return_if_fail (fs != NULL);
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (uri != NULL);
|
||||
|
||||
g_return_if_fail (IS_FULL_SCREEN (fs));
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
|
||||
gst_play_set_uri (play, uri);
|
||||
|
||||
gst_play_play (play);
|
||||
}
|
||||
|
||||
GstPlay *
|
||||
full_screen_get_gst_play (FullScreen *fs)
|
||||
{
|
||||
FullScreenPrivate *priv;
|
||||
g_return_val_if_fail (fs != NULL, 0);
|
||||
|
||||
priv = fs->priv;
|
||||
|
||||
return priv->play;
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#ifndef FULL_SCREEN_H
|
||||
#define FULL_SCREEN_H
|
||||
|
||||
#include <libgnome/gnome-defs.h>
|
||||
#include <gtk/gtkwindow.h>
|
||||
#include "gstplay.h"
|
||||
|
||||
BEGIN_GNOME_DECLS
|
||||
|
||||
|
||||
|
||||
#define TYPE_FULL_SCREEN (full_screen_get_type ())
|
||||
#define FULL_SCREEN(obj) (GTK_CHECK_CAST ((obj), TYPE_FULL_SCREEN, FullScreen))
|
||||
#define FULL_SCREEN_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_FULL_SCREEN, \
|
||||
FullScreenClass))
|
||||
#define IS_FULL_SCREEN(obj) (GTK_CHECK_TYPE ((obj), TYPE_FULL_SCREEN))
|
||||
#define IS_FULL_SCREEN_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_FULL_SCREEN))
|
||||
|
||||
typedef struct _FullScreen FullScreen;
|
||||
typedef struct _FullScreenClass FullScreenClass;
|
||||
|
||||
typedef struct _FullScreenPrivate FullScreenPrivate;
|
||||
|
||||
struct _FullScreen {
|
||||
GtkWindow window;
|
||||
|
||||
/* Private data */
|
||||
FullScreenPrivate *priv;
|
||||
};
|
||||
|
||||
struct _FullScreenClass {
|
||||
GtkWindowClass parent_class;
|
||||
};
|
||||
|
||||
GtkType full_screen_get_type (void);
|
||||
|
||||
GtkWidget *full_screen_new (void);
|
||||
|
||||
void full_screen_set_uri (FullScreen *fs, GstPlay *play, const guchar *uri);
|
||||
GstPlay * full_screen_get_gst_play (FullScreen *fs);
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
|
@ -20,6 +20,8 @@ static void gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay
|
|||
static void update_buttons (GstMediaPlay *mplay, GstPlayState state);
|
||||
static void update_slider (GstMediaPlay *mplay, GtkAdjustment *adjustment, gfloat value);
|
||||
|
||||
gboolean fullscreen_active = FALSE;
|
||||
|
||||
/* signals and args */
|
||||
enum {
|
||||
LAST_SIGNAL
|
||||
|
@ -230,15 +232,19 @@ gst_media_play_start_uri (GstMediaPlay *play,
|
|||
|
||||
if (uri != NULL) {
|
||||
ret = gst_play_set_uri (play->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 (play->play)) {
|
||||
gtk_widget_set_sensitive (play->slider, FALSE);
|
||||
gtk_window_set_title (GTK_WINDOW (play->window),
|
||||
g_strconcat ( "Gstplay - ", uri, NULL));
|
||||
|
||||
gst_play_play (play->play);
|
||||
}
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (play->window),
|
||||
g_strconcat ( "Gstplay - ", uri, NULL));
|
||||
|
||||
gst_play_play (play->play);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,6 +393,88 @@ on_extended1_activate (GtkCheckMenuItem *item, GstMediaPlay *mplay)
|
|||
gdk_threads_enter ();
|
||||
}
|
||||
|
||||
void
|
||||
gst_media_play_set_original_size (GstMediaPlay *mplay)
|
||||
{
|
||||
GstPlay *play;
|
||||
GtkWidget *video_widget;
|
||||
gint width, height;
|
||||
|
||||
play = mplay->play;
|
||||
|
||||
video_widget = gst_play_get_video_widget (play);
|
||||
width = gst_play_get_source_width (play);
|
||||
height = gst_play_get_source_height (play);
|
||||
|
||||
gtk_widget_set_usize (video_widget, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gst_media_play_set_double_size (GstMediaPlay *mplay)
|
||||
{
|
||||
GstPlay *play;
|
||||
GtkWidget *video_widget;
|
||||
gint width, height;
|
||||
|
||||
play = mplay->play;
|
||||
|
||||
video_widget = gst_play_get_video_widget (play);
|
||||
width = gst_play_get_source_width (play);
|
||||
height = gst_play_get_source_height (play);
|
||||
|
||||
gtk_widget_set_usize (video_widget, width * 1.5, height * 1.5);
|
||||
}
|
||||
|
||||
void
|
||||
gst_media_play_set_fullscreen (GstMediaPlay *mplay)
|
||||
{
|
||||
GdkWindow *gdk_window;
|
||||
gint client_x, client_y, root_x, root_y;
|
||||
gint width, height, source_width, source_height;
|
||||
GstPlay *play;
|
||||
GtkWidget *video_widget;
|
||||
|
||||
gdk_window = mplay->window->window;
|
||||
play = mplay->play;
|
||||
|
||||
video_widget = gst_play_get_video_widget (play);
|
||||
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"));
|
||||
|
||||
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;
|
||||
} 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_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);
|
||||
|
||||
fullscreen_active = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay)
|
||||
{
|
||||
|
|
|
@ -187,7 +187,6 @@
|
|||
<widget>
|
||||
<class>GtkMenuItem</class>
|
||||
<name>full_screen</name>
|
||||
<sensitive>False</sensitive>
|
||||
<accelerator>
|
||||
<modifiers>GDK_CONTROL_MASK</modifiers>
|
||||
<key>GDK_3</key>
|
||||
|
@ -469,7 +468,7 @@
|
|||
<modal>True</modal>
|
||||
<wmclass_name>about</wmclass_name>
|
||||
<wmclass_class>GstMediaPlay</wmclass_class>
|
||||
<copyright>(C) 1999-2001 Erik Walthinsen</copyright>
|
||||
<copyright>(C) 1999-2001 Erik Walthinsen, Arik Devens</copyright>
|
||||
<authors>Erik Walthinsen <omega@cse.ogi.edu>
|
||||
Wim Taymans <wim.taymans@tvd.be>
|
||||
Richard Boulton <richard@tartarus.org>
|
||||
|
@ -532,4 +531,99 @@ Arik Devens <arik@gnome.org>
|
|||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkWindow</class>
|
||||
<name>preferences</name>
|
||||
<title>GstMediaPlayer Preferences</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>GtkNotebook</class>
|
||||
<name>notebook1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<show_tabs>True</show_tabs>
|
||||
<show_border>True</show_border>
|
||||
<tab_pos>GTK_POS_TOP</tab_pos>
|
||||
<scrollable>False</scrollable>
|
||||
<tab_hborder>2</tab_hborder>
|
||||
<tab_vborder>2</tab_vborder>
|
||||
<popup_enable>False</popup_enable>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame1</name>
|
||||
<label>Full Screen</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>checkbutton1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Show file menu</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>checkbutton2</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Show player controls</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>checkbutton3</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Show status area</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>Notebook:tab</child_name>
|
||||
<name>label1</name>
|
||||
<label>Viewers</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>
|
||||
|
||||
</GTK-Interface>
|
||||
|
|
|
@ -32,6 +32,8 @@ struct _GstMediaPlay {
|
|||
GtkWidget *slider;
|
||||
|
||||
gulong last_time;
|
||||
|
||||
gint x, y, width, height;
|
||||
};
|
||||
|
||||
struct _GstMediaPlayClass {
|
||||
|
@ -42,8 +44,12 @@ struct _GstMediaPlayClass {
|
|||
GtkType gst_media_play_get_type (void);
|
||||
|
||||
/* setup the player */
|
||||
GstMediaPlay* gst_media_play_new (void);
|
||||
GstMediaPlay* gst_media_play_new (void);
|
||||
|
||||
void gst_media_play_start_uri (GstMediaPlay *play, const guchar *uri);
|
||||
void gst_media_play_start_uri (GstMediaPlay *play, const guchar *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);
|
||||
|
||||
#endif /* __GST_MEDIA_PLAY_H__ */
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "gstplay.h"
|
||||
#include "gstplayprivate.h"
|
||||
#include "full-screen.h"
|
||||
|
||||
static void gst_play_class_init (GstPlayClass *klass);
|
||||
static void gst_play_init (GstPlay *play);
|
||||
|
@ -165,6 +164,9 @@ gst_play_init (GstPlay *play)
|
|||
priv->offset_element = NULL;
|
||||
priv->bit_rate_element = NULL;
|
||||
priv->media_time_element = NULL;
|
||||
|
||||
priv->source_width = 100;
|
||||
priv->source_height = 100;
|
||||
}
|
||||
|
||||
GstPlay *
|
||||
|
@ -374,6 +376,7 @@ GstPlayReturn
|
|||
gst_play_set_uri (GstPlay *play, const guchar *uri)
|
||||
{
|
||||
GstPlayPrivate *priv;
|
||||
FILE *file;
|
||||
gchar* uriloc;
|
||||
|
||||
g_return_val_if_fail (play != NULL, GST_PLAY_ERROR);
|
||||
|
@ -385,6 +388,10 @@ gst_play_set_uri (GstPlay *play, const guchar *uri)
|
|||
if (priv->uri)
|
||||
g_free (priv->uri);
|
||||
|
||||
/* see if the file actually exists */
|
||||
file = fopen (uri, "r");
|
||||
if (!file)
|
||||
return GST_PLAY_CANNOT_PLAY;
|
||||
|
||||
/* see if it looks like an URI */
|
||||
if ((uriloc = strstr (uri, ":/"))) {
|
||||
|
@ -498,7 +505,7 @@ gst_play_pause (GstPlay *play)
|
|||
|
||||
if (play->state != GST_PLAY_PLAYING) return;
|
||||
|
||||
gst_element_set_state (GST_ELEMENT (priv->pipeline),GST_STATE_PAUSED);
|
||||
gst_element_set_state (GST_ELEMENT (priv->pipeline), GST_STATE_PAUSED);
|
||||
|
||||
play->state = GST_PLAY_PAUSED;
|
||||
g_idle_remove_by_data (priv->pipeline);
|
||||
|
@ -515,13 +522,13 @@ gst_play_stop (GstPlay *play)
|
|||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
|
||||
if (play->state == GST_PLAY_STOPPED) return;
|
||||
|
||||
priv = (GstPlayPrivate *)play->priv;
|
||||
|
||||
if (play->state == GST_PLAY_STOPPED) return;
|
||||
|
||||
// FIXME until state changes are handled properly
|
||||
gst_element_set_state (GST_ELEMENT (priv->pipeline),GST_STATE_READY);
|
||||
gtk_object_set (GTK_OBJECT (priv->src),"offset",0,NULL);
|
||||
gst_element_set_state (GST_ELEMENT (priv->pipeline), GST_STATE_READY);
|
||||
gtk_object_set (GTK_OBJECT (priv->src), "offset", 0, NULL);
|
||||
//gst_element_set_state (GST_ELEMENT (priv->pipeline),GST_STATE_NULL);
|
||||
|
||||
play->state = GST_PLAY_STOPPED;
|
||||
|
@ -531,37 +538,43 @@ gst_play_stop (GstPlay *play)
|
|||
play->state);
|
||||
}
|
||||
|
||||
void
|
||||
gst_play_set_display_size (GstPlay *play, gint display_preference)
|
||||
GtkWidget *
|
||||
gst_play_get_video_widget (GstPlay *play)
|
||||
{
|
||||
GstPlayPrivate *priv;
|
||||
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
g_return_val_if_fail (play != NULL, 0);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), 0);
|
||||
|
||||
priv = (GstPlayPrivate *)play->priv;
|
||||
|
||||
if (display_preference == 0) {
|
||||
gtk_widget_set_usize (GTK_WIDGET (priv->video_widget), priv->source_width, priv->source_height);
|
||||
}
|
||||
else if (display_preference == 1) {
|
||||
gtk_widget_set_usize (GTK_WIDGET (priv->video_widget), priv->source_width * 2, priv->source_height * 2);
|
||||
}
|
||||
else if (display_preference == 2) {
|
||||
GtkWidget *fs;
|
||||
GstPlay *fs_play;
|
||||
|
||||
fs = full_screen_new ();
|
||||
|
||||
fs_play = full_screen_get_gst_play (FULL_SCREEN (fs));
|
||||
return priv->video_widget;
|
||||
}
|
||||
|
||||
if (priv->uri != NULL) {
|
||||
//gst_play_stop (play);
|
||||
full_screen_set_uri (FULL_SCREEN (fs), fs_play, priv->uri);
|
||||
gint
|
||||
gst_play_get_source_width (GstPlay *play)
|
||||
{
|
||||
GstPlayPrivate *priv;
|
||||
|
||||
gtk_widget_show (fs);
|
||||
}
|
||||
}
|
||||
g_return_val_if_fail (play != NULL, 0);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), 0);
|
||||
|
||||
priv = (GstPlayPrivate *)play->priv;
|
||||
|
||||
return priv->source_width;
|
||||
}
|
||||
|
||||
gint
|
||||
gst_play_get_source_height (GstPlay *play)
|
||||
{
|
||||
GstPlayPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (play != NULL, 0);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), 0);
|
||||
|
||||
priv = (GstPlayPrivate *)play->priv;
|
||||
|
||||
return priv->source_height;
|
||||
}
|
||||
|
||||
gulong
|
||||
|
|
|
@ -76,7 +76,9 @@ gulong gst_play_get_media_total_time (GstPlay *play);
|
|||
gulong gst_play_get_media_current_time (GstPlay *play);
|
||||
|
||||
/* set display stuff */
|
||||
void gst_play_set_display_size ();
|
||||
GtkWidget * gst_play_get_video_widget (GstPlay *play);
|
||||
gint gst_play_get_source_width (GstPlay *play);
|
||||
gint gst_play_get_source_height (GstPlay *play);
|
||||
|
||||
/* the autoplugged pipeline */
|
||||
GstElement* gst_play_get_pipeline (GstPlay *play);
|
||||
|
|
|
@ -11,7 +11,7 @@ main (int argc, char *argv[])
|
|||
gnome_init ("gstreamer", VERSION, argc, argv);
|
||||
glade_init();
|
||||
glade_gnome_init();
|
||||
|
||||
|
||||
play = gst_media_play_new ();
|
||||
|
||||
if (argc > 1) {
|
||||
|
|
Loading…
Reference in a new issue