playing at double size, general code cleanup and what not.

Original commit message from CVS:
added the begninnings of full-screen support (crashes atm), playing at double size, general code cleanup and what not.
This commit is contained in:
Arik Devens 2001-05-21 01:19:06 +00:00
parent 4212a8dfdc
commit 861256b0db
14 changed files with 1453 additions and 1126 deletions

View file

@ -20,7 +20,8 @@ libgstmediaplay_la_SOURCES = \
gstplay.c \ gstplay.c \
gstmediaplay.c \ gstmediaplay.c \
gststatusarea.c \ gststatusarea.c \
callbacks.c callbacks.c \
full-screen.c
gstmediaplay_SOURCES = \ gstmediaplay_SOURCES = \
main.c main.c
@ -33,8 +34,8 @@ noinst_HEADERS = \
gstmediaplay.h \ gstmediaplay.h \
gststatusarea.h \ gststatusarea.h \
callbacks.h \ callbacks.h \
gstplayprivate.h gstplayprivate.h \
full-screen.h
libgstmediaplay_la_LDFLAGS = -rdynamic libgstmediaplay_la_LDFLAGS = -rdynamic

View file

@ -5,44 +5,72 @@
#include <gnome.h> #include <gnome.h>
#include <glade/glade.h> #include <glade/glade.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include "gstmediaplay.h"
#include "gstplay.h" #include "gstplay.h"
#include "callbacks.h" #include "callbacks.h"
GtkFileSelection *open_file_selection; GtkFileSelection *open_file_selection;
void void
on_save1_activate (GtkMenuItem *menuitem, on_save1_activate (GtkMenuItem *menuitem, gpointer user_data)
gpointer user_data)
{ {
printf ("file1 activate\n"); printf ("file1 activate\n");
} }
void void
on_save_as1_activate (GtkMenuItem *menuitem, on_save_as1_activate (GtkMenuItem *menuitem, gpointer user_data)
gpointer user_data)
{ {
printf ("file1 activate\n"); printf ("file1 activate\n");
} }
void void
on_media2_activate (GtkMenuItem *menuitem, on_media2_activate (GtkMenuItem *menuitem, gpointer user_data)
gpointer user_data)
{ {
printf ("file1 activate\n"); printf ("file1 activate\n");
} }
void void
on_preferences1_activate (GtkMenuItem *menuitem, on_original_size_activate (GtkMenuItem *menuitem, gpointer user_data)
gpointer user_data) {
GstMediaPlay *mplay;
GstPlay *play;
mplay = GST_MEDIA_PLAY (user_data);
play = mplay->play;
gst_play_set_display_size (play, 0);
}
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);
}
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);
}
void
on_preferences1_activate (GtkMenuItem *menuitem, gpointer user_data)
{ {
printf ("file1 activate\n"); printf ("file1 activate\n");
} }
void on_about_activate (GtkWidget *widget, gpointer data) void on_about_activate (GtkWidget *widget, gpointer data)
@ -53,9 +81,8 @@ void on_about_activate(GtkWidget *widget, gpointer data)
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) { if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) {
xml = glade_xml_new (DATADIR"gstmediaplay.glade", "about"); xml = glade_xml_new (DATADIR"gstmediaplay.glade", "about");
} }
else { else
xml = glade_xml_new ("gstmediaplay.glade", "about"); xml = glade_xml_new ("gstmediaplay.glade", "about");
}
/* connect the signals in the interface */ /* connect the signals in the interface */
glade_xml_signal_autoconnect (xml); glade_xml_signal_autoconnect (xml);

View file

@ -1,30 +1,23 @@
#include <gnome.h> #include <gnome.h>
void void
on_file1_activate (GtkMenuItem *menuitem, on_file1_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_open1_activate (GtkMenuItem *menuitem, on_open1_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_close1_activate (GtkMenuItem *menuitem, on_close1_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_media1_activate (GtkMenuItem *menuitem, on_media1_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_play2_activate (GtkMenuItem *menuitem, on_play2_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_pause1_activate (GtkMenuItem *menuitem, on_pause1_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void void
on_stop1_activate (GtkMenuItem *menuitem, on_stop1_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
@ -35,8 +28,8 @@ on_about1_activate (GtkMenuItem *menuitem,
void void
on_hscale1_value_changed (GtkAdjustment *adj, on_hscale1_value_changed (GtkAdjustment *adj,
gpointer user_data); gpointer user_data);
void void
on_drawingarea1_configure_event (GtkWidget *widget, GdkEventConfigure *event, on_drawingarea1_configure_event (GtkWidget *widget,
GdkEventConfigure *event,
gpointer user_data); gpointer user_data);

247
gstplay/full-screen.c Normal file
View file

@ -0,0 +1,247 @@
#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;
}

44
gstplay/full-screen.h Normal file
View file

@ -0,0 +1,44 @@
#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

View file

@ -1,8 +1,3 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#include <config.h> #include <config.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -360,15 +355,13 @@ gst_media_play_state_changed (GstPlay *play,
} }
void void
on_gst_media_play_destroy (GtkWidget *widget, on_gst_media_play_destroy (GtkWidget *widget, GstMediaPlay *mplay)
GstMediaPlay *mplay)
{ {
gst_main_quit (); gst_main_quit ();
} }
void void
on_exit_menu_activate (GtkWidget *widget, on_exit_menu_activate (GtkWidget *widget, GstMediaPlay *mplay)
GstMediaPlay *mplay)
{ {
gdk_threads_leave (); gdk_threads_leave ();
gst_play_stop (mplay->play); gst_play_stop (mplay->play);
@ -388,8 +381,7 @@ on_gst_media_play_delete_event (GtkWidget *widget,
} }
void void
on_extended1_activate (GtkCheckMenuItem *item, on_extended1_activate (GtkCheckMenuItem *item, GstMediaPlay *mplay)
GstMediaPlay *mplay)
{ {
gdk_threads_leave (); gdk_threads_leave ();
gst_status_area_show_extended (mplay->status, item->active); gst_status_area_show_extended (mplay->status, item->active);
@ -397,8 +389,7 @@ on_extended1_activate (GtkCheckMenuItem *item,
} }
static void static void
gst_media_play_frame_displayed (GstPlay *play, gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay)
GstMediaPlay *mplay)
{ {
gulong current_time; gulong current_time;
gulong total_time; gulong total_time;
@ -424,8 +415,7 @@ gst_media_play_frame_displayed (GstPlay *play,
} }
static void static void
gst_media_play_slider_changed (GtkAdjustment *adj, gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay *mplay)
GstMediaPlay *mplay)
{ {
gulong size; gulong size;
@ -437,8 +427,7 @@ gst_media_play_slider_changed (GtkAdjustment *adj,
} }
void void
on_toggle_play_toggled (GtkToggleButton *togglebutton, on_toggle_play_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play)
GstMediaPlay *play)
{ {
gdk_threads_leave (); gdk_threads_leave ();
gst_play_play (play->play); gst_play_play (play->play);
@ -447,8 +436,7 @@ on_toggle_play_toggled (GtkToggleButton *togglebutton,
} }
void void
on_toggle_pause_toggled (GtkToggleButton *togglebutton, on_toggle_pause_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play)
GstMediaPlay *play)
{ {
gdk_threads_leave (); gdk_threads_leave ();
gst_play_pause (play->play); gst_play_pause (play->play);
@ -457,8 +445,7 @@ on_toggle_pause_toggled (GtkToggleButton *togglebutton,
} }
void void
on_toggle_stop_toggled (GtkToggleButton *togglebutton, on_toggle_stop_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play)
GstMediaPlay *play)
{ {
gdk_threads_leave (); gdk_threads_leave ();
gst_play_stop (play->play); gst_play_stop (play->play);
@ -467,8 +454,7 @@ on_toggle_stop_toggled (GtkToggleButton *togglebutton,
} }
static void static void
update_buttons (GstMediaPlay *mplay, update_buttons (GstMediaPlay *mplay, GstPlayState state)
GstPlayState state)
{ {
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->play_button), gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->play_button),
GTK_SIGNAL_FUNC (on_toggle_play_toggled), GTK_SIGNAL_FUNC (on_toggle_play_toggled),
@ -518,4 +504,3 @@ update_slider (GstMediaPlay *mplay,
GTK_SIGNAL_FUNC (gst_media_play_slider_changed), GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
mplay); mplay);
} }

View file

@ -138,6 +138,70 @@
<class>GtkMenu</class> <class>GtkMenu</class>
<name>view1_menu</name> <name>view1_menu</name>
<widget>
<class>GtkMenuItem</class>
<name>present_movie</name>
<label>P_resent Movie</label>
<right_justify>False</right_justify>
<widget>
<class>GtkMenu</class>
<name>present_movie_menu</name>
<widget>
<class>GtkMenuItem</class>
<name>original_size</name>
<accelerator>
<modifiers>GDK_MOD1_MASK</modifiers>
<key>GDK_1</key>
<signal>activate</signal>
</accelerator>
<signal>
<name>activate</name>
<handler>on_original_size_activate</handler>
<data>mplay</data>
<last_modification_time>Sun, 06 May 2001 01:58:18 GMT</last_modification_time>
</signal>
<label>Original Size</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>double_size</name>
<accelerator>
<modifiers>GDK_MOD1_MASK</modifiers>
<key>GDK_2</key>
<signal>activate</signal>
</accelerator>
<signal>
<name>activate</name>
<handler>on_double_size_activate</handler>
<last_modification_time>Sun, 06 May 2001 01:34:06 GMT</last_modification_time>
</signal>
<label>Double Size</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>full_screen</name>
<accelerator>
<modifiers>GDK_MOD1_MASK</modifiers>
<key>GDK_3</key>
<signal>activate</signal>
</accelerator>
<signal>
<name>activate</name>
<handler>on_full_screen_activate</handler>
<last_modification_time>Sun, 06 May 2001 01:34:06 GMT</last_modification_time>
</signal>
<label>Full Screen</label>
<right_justify>False</right_justify>
</widget>
</widget>
</widget>
<widget> <widget>
<class>GtkCheckMenuItem</class> <class>GtkCheckMenuItem</class>
<name>extended1</name> <name>extended1</name>
@ -443,7 +507,6 @@ Ronald Bultje &lt;rbultje@ronald.bitfreak.net&gt;
<last_modification_time>Sun, 06 Aug 2000 15:55:52 GMT</last_modification_time> <last_modification_time>Sun, 06 Aug 2000 15:55:52 GMT</last_modification_time>
</signal> </signal>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button> <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
</widget> </widget>
<widget> <widget>
@ -459,7 +522,6 @@ Ronald Bultje &lt;rbultje@ronald.bitfreak.net&gt;
<last_modification_time>Sun, 06 Aug 2000 15:53:48 GMT</last_modification_time> <last_modification_time>Sun, 06 Aug 2000 15:53:48 GMT</last_modification_time>
</signal> </signal>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
<relief>GTK_RELIEF_NORMAL</relief>
</widget> </widget>
</widget> </widget>

View file

@ -1,31 +1,19 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#ifndef __GST_MEDIA_PLAY_H__ #ifndef __GST_MEDIA_PLAY_H__
#define __GST_MEDIA_PLAY_H__ #define __GST_MEDIA_PLAY_H__
#include <glade/glade.h> #include <glade/glade.h>
#include "gstplay.h" #include "gstplay.h"
#include "gststatusarea.h" #include "gststatusarea.h"
#define GST_TYPE_MEDIA_PLAY (gst_media_play_get_type())
#define GST_MEDIA_PLAY(obj) (GTK_CHECK_CAST ((obj), GST_TYPE_MEDIA_PLAY, GstMediaPlay))
#define GST_MEDIA_PLAY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GST_TYPE_MEDIA_PLAY, GstMediaPlayClass))
#define GST_IS_MEDIA_PLAY(obj) (GTK_CHECK_TYPE ((obj), GST_TYPE_MEDIA_PLAY))
#define GST_IS_MEDIA_PLAY_CLASS(obj) (GTK_CHECK_CLASS_TYPE ((klass), GST_TYPE_MEDIA_PLAY))
typedef struct _GstMediaPlay GstMediaPlay; typedef struct _GstMediaPlay GstMediaPlay;
typedef struct _GstMediaPlayClass GstMediaPlayClass; typedef struct _GstMediaPlayClass GstMediaPlayClass;
#define GST_TYPE_MEDIA_PLAY \
(gst_media_play_get_type())
#define GST_MEDIA_PLAY(obj) \
(GTK_CHECK_CAST((obj),GST_TYPE_MEDIA_PLAY,GstMediaPlay))
#define GST_MEDIA_PLAY_CLASS(klass) \
(GTK_CHECK_CLASS_CAST((klass),GST_TYPE_MEDIA_PLAY,GstMediaPlayClass))
#define GST_IS_MEDIA_PLAY(obj) \
(GTK_CHECK_TYPE((obj),GST_TYPE_MEDIA_PLAY))
#define GST_IS_MEDIA_PLAY_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_MEDIA_PLAY))
struct _GstMediaPlay { struct _GstMediaPlay {
GtkObject parent; GtkObject parent;
@ -48,7 +36,6 @@ struct _GstMediaPlay {
struct _GstMediaPlayClass { struct _GstMediaPlayClass {
GtkObjectClass parent_class; GtkObjectClass parent_class;
}; };

View file

@ -1,12 +1,8 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#include <config.h> #include <config.h>
#include "gstplay.h" #include "gstplay.h"
#include "gstplayprivate.h" #include "gstplayprivate.h"
#include "full-screen.h"
static void gst_play_class_init (GstPlayClass *klass); static void gst_play_class_init (GstPlayClass *klass);
static void gst_play_init (GstPlay *play); static void gst_play_init (GstPlay *play);
@ -185,12 +181,14 @@ gst_play_have_size (GstElement *element, guint width, guint height,
priv = (GstPlayPrivate *) play->priv; priv = (GstPlayPrivate *) play->priv;
priv->source_width = width;
priv->source_height = height;
gtk_widget_set_usize (priv->video_widget, width, height); gtk_widget_set_usize (priv->video_widget, width, height);
} }
static void static void
gst_play_frame_displayed (GstElement *element, gst_play_frame_displayed (GstElement *element, GstPlay *play)
GstPlay *play)
{ {
GstPlayPrivate *priv; GstPlayPrivate *priv;
static int stolen = FALSE; static int stolen = FALSE;
@ -212,17 +210,14 @@ gst_play_frame_displayed (GstElement *element,
} }
static void static void
gst_play_audio_handoff (GstElement *element, gst_play_audio_handoff (GstElement *element, GstPlay *play)
GstPlay *play)
{ {
gtk_signal_emit (GTK_OBJECT (play), gst_play_signals[SIGNAL_AUDIO_PLAYED], gtk_signal_emit (GTK_OBJECT (play), gst_play_signals[SIGNAL_AUDIO_PLAYED],
NULL); NULL);
} }
static void static void
gst_play_object_introspect (GstObject *object, gst_play_object_introspect (GstObject *object, const gchar *property, GstElement **target)
const gchar *property,
GstElement **target)
{ {
gchar *info; gchar *info;
GtkArgInfo *arg; GtkArgInfo *arg;
@ -249,9 +244,7 @@ gst_play_object_introspect (GstObject *object,
* this will change with glib 1.4 * this will change with glib 1.4
* */ * */
static void static void
gst_play_object_added (GstAutoplug* autoplug, gst_play_object_added (GstAutoplug* autoplug, GstObject *object, GstPlay *play)
GstObject *object,
GstPlay *play)
{ {
GstPlayPrivate *priv; GstPlayPrivate *priv;
@ -353,8 +346,7 @@ connect_pads (GstElement *new_element, GstElement *target, gboolean add)
} }
GstPlayReturn GstPlayReturn
gst_play_set_uri (GstPlay *play, gst_play_set_uri (GstPlay *play, const guchar *uri)
const guchar *uri)
{ {
GstPlayPrivate *priv; GstPlayPrivate *priv;
GstCaps *src_caps; GstCaps *src_caps;
@ -509,6 +501,39 @@ gst_play_stop (GstPlay *play)
play->state); play->state);
} }
void
gst_play_set_display_size (GstPlay *play, gint display_preference)
{
GstPlayPrivate *priv;
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
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));
if (priv->uri != NULL) {
//gst_play_stop (play);
full_screen_set_uri (FULL_SCREEN (fs), fs_play, priv->uri);
gtk_widget_show (fs);
}
}
}
gulong gulong
gst_play_get_media_size (GstPlay *play) gst_play_get_media_size (GstPlay *play)
{ {
@ -606,8 +631,7 @@ gst_play_media_can_seek (GstPlay *play)
} }
void void
gst_play_media_seek (GstPlay *play, gst_play_media_seek (GstPlay *play, gulong offset)
gulong offset)
{ {
GstPlayPrivate *priv; GstPlayPrivate *priv;
@ -633,9 +657,7 @@ gst_play_get_pipeline(GstPlay *play)
} }
static void static void
gst_play_set_arg (GtkObject *object, gst_play_set_arg (GtkObject *object, GtkArg *arg, guint id)
GtkArg *arg,
guint id)
{ {
GstPlay *play; GstPlay *play;
@ -654,9 +676,7 @@ gst_play_set_arg (GtkObject *object,
} }
static void static void
gst_play_get_arg (GtkObject *object, gst_play_get_arg (GtkObject *object, GtkArg *arg, guint id)
GtkArg *arg,
guint id)
{ {
GstPlay *play; GstPlay *play;
GstPlayPrivate *priv; GstPlayPrivate *priv;
@ -692,4 +712,3 @@ gst_play_get_arg (GtkObject *object,
break; break;
} }
} }

View file

@ -1,27 +1,17 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#ifndef __GSTPLAY_H__ #ifndef __GSTPLAY_H__
#define __GSTPLAY_H__ #define __GSTPLAY_H__
#include <gst/gst.h> #include <gst/gst.h>
#define GST_TYPE_PLAY (gst_play_get_type ())
#define GST_PLAY(obj) (GTK_CHECK_CAST ((obj), GST_TYPE_PLAY, GstPlay))
#define GST_PLAY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY, GstPlayClass))
#define GST_IS_PLAY(obj) (GTK_CHECK_TYPE ((obj), GST_TYPE_PLAY))
#define GST_IS_PLAY_CLASS(obj) (GTK_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY))
typedef struct _GstPlay GstPlay; typedef struct _GstPlay GstPlay;
typedef struct _GstPlayClass GstPlayClass; typedef struct _GstPlayClass GstPlayClass;
#define GST_TYPE_PLAY \
(gst_play_get_type())
#define GST_PLAY(obj) \
(GTK_CHECK_CAST((obj),GST_TYPE_PLAY,GstPlay))
#define GST_PLAY_CLASS(klass) \
(GTK_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY,GstPlayClass))
#define GST_IS_PLAY(obj) \
(GTK_CHECK_TYPE((obj),GST_TYPE_PLAY))
#define GST_IS_PLAY_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY))
typedef enum { typedef enum {
GST_PLAY_STOPPED, GST_PLAY_STOPPED,
GST_PLAY_PLAYING, GST_PLAY_PLAYING,
@ -85,6 +75,9 @@ void gst_play_media_seek (GstPlay *play, gulong offset);
gulong gst_play_get_media_total_time (GstPlay *play); gulong gst_play_get_media_total_time (GstPlay *play);
gulong gst_play_get_media_current_time (GstPlay *play); gulong gst_play_get_media_current_time (GstPlay *play);
/* set display stuff */
void gst_play_set_display_size ();
/* the autoplugged pipeline */ /* the autoplugged pipeline */
GstElement* gst_play_get_pipeline (GstPlay *play); GstElement* gst_play_get_pipeline (GstPlay *play);

View file

@ -1,8 +1,3 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#ifndef __GSTPLAY_PRIVATE_H__ #ifndef __GSTPLAY_PRIVATE_H__
#define __GSTPLAY_PRIVATE_H__ #define __GSTPLAY_PRIVATE_H__
@ -26,6 +21,9 @@ struct _GstPlayPrivate {
GstElement *bit_rate_element; GstElement *bit_rate_element;
GstElement *media_time_element; GstElement *media_time_element;
GstElement *current_time_element; GstElement *current_time_element;
guint source_width;
guint source_height;
}; };
#endif /* __GSTPLAY_PRIVATE_H__ */ #endif /* __GSTPLAY_PRIVATE_H__ */

View file

@ -1,10 +1,4 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#include <config.h> #include <config.h>
#include "gststatusarea.h" #include "gststatusarea.h"
static void gst_status_area_class_init (GstStatusAreaClass *klass); static void gst_status_area_class_init (GstStatusAreaClass *klass);
@ -118,8 +112,7 @@ gst_status_area_realize (GtkWidget *widget)
} }
static gint static gint
gst_status_area_expose(GtkWidget *widget, gst_status_area_expose(GtkWidget *widget, GdkEventExpose *event)
GdkEventExpose *event)
{ {
GstStatusArea *status_area; GstStatusArea *status_area;
guchar *statustext; guchar *statustext;
@ -227,8 +220,7 @@ gst_status_area_expose(GtkWidget *widget,
} }
void void
gst_status_area_set_state (GstStatusArea *area, gst_status_area_set_state (GstStatusArea *area, GstStatusAreaState state)
GstStatusAreaState state)
{ {
g_return_if_fail(area != NULL); g_return_if_fail(area != NULL);
g_return_if_fail(GST_IS_STATUS_AREA(area)); g_return_if_fail(GST_IS_STATUS_AREA(area));
@ -240,8 +232,7 @@ gst_status_area_set_state (GstStatusArea *area,
} }
void void
gst_status_area_set_playtime (GstStatusArea *area, gst_status_area_set_playtime (GstStatusArea *area, const guchar *time)
const guchar *time)
{ {
g_return_if_fail(area != NULL); g_return_if_fail(area != NULL);
g_return_if_fail(GST_IS_STATUS_AREA(area)); g_return_if_fail(GST_IS_STATUS_AREA(area));
@ -256,14 +247,12 @@ gst_status_area_set_playtime (GstStatusArea *area,
} }
void void
gst_status_area_set_streamtype (GstStatusArea *area, gst_status_area_set_streamtype (GstStatusArea *area, const guchar *type)
const guchar *type)
{ {
} }
void void
gst_status_area_show_extended (GstStatusArea *area, gst_status_area_show_extended (GstStatusArea *area, gboolean show)
gboolean show)
{ {
area->expanded = show; area->expanded = show;
@ -277,9 +266,7 @@ gst_status_area_show_extended (GstStatusArea *area,
} }
static void static void
gst_status_area_set_arg(GtkObject *object, gst_status_area_set_arg(GtkObject *object, GtkArg *arg, guint id)
GtkArg *arg,
guint id)
{ {
GstStatusArea *status_area; GstStatusArea *status_area;
@ -293,9 +280,7 @@ gst_status_area_set_arg(GtkObject *object,
} }
static void static void
gst_status_area_get_arg(GtkObject *object, gst_status_area_get_arg(GtkObject *object, GtkArg *arg, guint id)
GtkArg *arg,
guint id)
{ {
GstStatusArea *status_area; GstStatusArea *status_area;
@ -307,4 +292,3 @@ gst_status_area_get_arg(GtkObject *object,
break; break;
} }
} }

View file

@ -4,20 +4,15 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#define GST_TYPE_STATUS_AREA (gst_status_area_get_type ())
#define GST_STATUS_AREA(obj) (GTK_CHECK_CAST ((obj), GST_TYPE_STATUS_AREA, GstStatusArea))
#define GST_STATUS_AREA_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GST_TYPE_STATUS_AREA, GstStatusAreaClass))
#define GST_IS_STATUS_AREA(obj) (GTK_CHECK_TYPE ((obj), GST_TYPE_STATUS_AREA))
#define GST_IS_STATUS_AREA_CLASS(obj) (GTK_CHECK_CLASS_TYPE ((klass), GST_TYPE_STATUS_AREA))
typedef struct _GstStatusArea GstStatusArea; typedef struct _GstStatusArea GstStatusArea;
typedef struct _GstStatusAreaClass GstStatusAreaClass; typedef struct _GstStatusAreaClass GstStatusAreaClass;
#define GST_TYPE_STATUS_AREA \
(gst_status_area_get_type())
#define GST_STATUS_AREA(obj) \
(GTK_CHECK_CAST((obj),GST_TYPE_STATUS_AREA,GstStatusArea))
#define GST_STATUS_AREA_CLASS(klass) \
(GTK_CHECK_CLASS_CAST((klass),GST_TYPE_STATUS_AREA,GstStatusAreaClass))
#define GST_IS_STATUS_AREA(obj) \
(GTK_CHECK_TYPE((obj),GST_TYPE_STATUS_AREA))
#define GST_IS_STATUS_AREA_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_STATUS_AREA))
typedef enum { typedef enum {
GST_STATUS_AREA_STATE_INIT, GST_STATUS_AREA_STATE_INIT,
GST_STATUS_AREA_STATE_PLAYING, GST_STATUS_AREA_STATE_PLAYING,
@ -35,7 +30,6 @@ struct _GstStatusArea {
struct _GstStatusAreaClass { struct _GstStatusAreaClass {
GtkWidgetClass parent_class; GtkWidgetClass parent_class;
}; };

View file

@ -1,11 +1,5 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#include <config.h> #include <config.h>
#include <gnome.h> #include <gnome.h>
#include "gstmediaplay.h" #include "gstmediaplay.h"
int int
@ -32,4 +26,3 @@ main (int argc, char *argv[])
return 0; return 0;
} }