mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
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:
parent
4212a8dfdc
commit
861256b0db
14 changed files with 1453 additions and 1126 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -1,68 +1,95 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#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)
|
|
||||||
{
|
{
|
||||||
printf("file1 activate\n");
|
GstMediaPlay *mplay;
|
||||||
|
GstPlay *play;
|
||||||
|
|
||||||
|
mplay = GST_MEDIA_PLAY (user_data);
|
||||||
|
play = mplay->play;
|
||||||
|
|
||||||
|
gst_play_set_display_size (play, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_about_activate(GtkWidget *widget, gpointer data)
|
void
|
||||||
|
on_double_size_activate (GtkMenuItem *menuitem, gpointer user_data)
|
||||||
{
|
{
|
||||||
GladeXML *xml;
|
GstMediaPlay *mplay;
|
||||||
struct stat statbuf;
|
GstPlay *play;
|
||||||
|
|
||||||
|
mplay = GST_MEDIA_PLAY (user_data);
|
||||||
|
play = mplay->play;
|
||||||
|
|
||||||
if (stat(DATADIR"gstmediaplay.glade", &statbuf) == 0) {
|
gst_play_set_display_size (play, 1);
|
||||||
xml = glade_xml_new (DATADIR"gstmediaplay.glade", "about");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
xml = glade_xml_new ("gstmediaplay.glade", "about");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* connect the signals in the interface */
|
|
||||||
glade_xml_signal_autoconnect(xml);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_gstplay_destroy(GtkWidget *widget, gpointer data)
|
void
|
||||||
|
on_full_screen_activate (GtkMenuItem *menuitem, gpointer user_data)
|
||||||
{
|
{
|
||||||
gst_main_quit();
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_about_activate (GtkWidget *widget, gpointer data)
|
||||||
|
{
|
||||||
|
GladeXML *xml;
|
||||||
|
struct stat statbuf;
|
||||||
|
|
||||||
|
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) {
|
||||||
|
xml = glade_xml_new (DATADIR"gstmediaplay.glade", "about");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
xml = glade_xml_new ("gstmediaplay.glade", "about");
|
||||||
|
|
||||||
|
/* connect the signals in the interface */
|
||||||
|
glade_xml_signal_autoconnect (xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_gstplay_destroy (GtkWidget *widget, gpointer data)
|
||||||
|
{
|
||||||
|
gst_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,35 @@
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
on_file1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data);
|
||||||
|
void
|
||||||
|
on_open1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data);
|
||||||
|
void
|
||||||
|
on_close1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data);
|
||||||
|
void
|
||||||
|
on_media1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data);
|
||||||
|
void
|
||||||
|
on_play2_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data);
|
||||||
|
void
|
||||||
|
on_pause1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data);
|
||||||
|
void
|
||||||
|
on_stop1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
void
|
void
|
||||||
on_file1_activate (GtkMenuItem *menuitem,
|
on_about1_activate (GtkMenuItem *menuitem,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
void
|
void
|
||||||
on_open1_activate (GtkMenuItem *menuitem,
|
on_hscale1_value_changed (GtkAdjustment *adj,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
void
|
void
|
||||||
on_close1_activate (GtkMenuItem *menuitem,
|
on_drawingarea1_configure_event (GtkWidget *widget,
|
||||||
gpointer user_data);
|
GdkEventConfigure *event,
|
||||||
|
gpointer user_data);
|
||||||
void
|
|
||||||
on_media1_activate (GtkMenuItem *menuitem,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void
|
|
||||||
on_play2_activate (GtkMenuItem *menuitem,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void
|
|
||||||
on_pause1_activate (GtkMenuItem *menuitem,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void
|
|
||||||
on_stop1_activate (GtkMenuItem *menuitem,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void
|
|
||||||
on_about1_activate (GtkMenuItem *menuitem,
|
|
||||||
gpointer user_data);
|
|
||||||
void
|
|
||||||
on_hscale1_value_changed (GtkAdjustment *adj,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void
|
|
||||||
on_drawingarea1_configure_event (GtkWidget *widget, GdkEventConfigure *event,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
|
|
247
gstplay/full-screen.c
Normal file
247
gstplay/full-screen.c
Normal 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
44
gstplay/full-screen.h
Normal 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
|
|
@ -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>
|
||||||
|
@ -12,26 +7,26 @@
|
||||||
#include "gstmediaplay.h"
|
#include "gstmediaplay.h"
|
||||||
#include "callbacks.h"
|
#include "callbacks.h"
|
||||||
|
|
||||||
static void gst_media_play_class_init (GstMediaPlayClass *klass);
|
static void gst_media_play_class_init (GstMediaPlayClass *klass);
|
||||||
static void gst_media_play_init (GstMediaPlay *play);
|
static void gst_media_play_init (GstMediaPlay *play);
|
||||||
|
|
||||||
static void gst_media_play_set_arg (GtkObject *object,GtkArg *arg,guint id);
|
static void gst_media_play_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||||
static void gst_media_play_get_arg (GtkObject *object,GtkArg *arg,guint id);
|
static void gst_media_play_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||||
|
|
||||||
static void gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay);
|
static void gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay);
|
||||||
static void gst_media_play_state_changed (GstPlay *play, GstPlayState state, GstMediaPlay *mplay);
|
static void gst_media_play_state_changed (GstPlay *play, GstPlayState state, GstMediaPlay *mplay);
|
||||||
static void gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay *mplay);
|
static void gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay *mplay);
|
||||||
|
|
||||||
static void update_buttons (GstMediaPlay *mplay, GstPlayState state);
|
static void update_buttons (GstMediaPlay *mplay, GstPlayState state);
|
||||||
static void update_slider (GstMediaPlay *mplay, GtkAdjustment *adjustment, gfloat value);
|
static void update_slider (GstMediaPlay *mplay, GtkAdjustment *adjustment, gfloat value);
|
||||||
|
|
||||||
/* signals and args */
|
/* signals and args */
|
||||||
enum {
|
enum {
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ARG_0,
|
ARG_0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -44,58 +39,58 @@ target_drag_data_received (GtkWidget *widget,
|
||||||
guint time,
|
guint time,
|
||||||
GstMediaPlay *play)
|
GstMediaPlay *play)
|
||||||
{
|
{
|
||||||
if (strstr (data->data, "file:")) {
|
if (strstr (data->data, "file:")) {
|
||||||
g_print ("Got: %s\n",&data->data[5]);
|
g_print ("Got: %s\n", &data->data[5]);
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave ();
|
||||||
gst_media_play_start_uri (play, g_strchomp(&data->data[5]));
|
gst_media_play_start_uri (play, g_strchomp (&data->data[5]));
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkTargetEntry target_table[] = {
|
static GtkTargetEntry target_table[] = {
|
||||||
{ "text/plain", 0, 0 }
|
{ "text/plain", 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static GtkObject *parent_class = NULL;
|
static GtkObject *parent_class = NULL;
|
||||||
//static guint gst_media_play_signals[LAST_SIGNAL] = { 0 };
|
//static guint gst_media_play_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GtkType
|
GtkType
|
||||||
gst_media_play_get_type(void)
|
gst_media_play_get_type (void)
|
||||||
{
|
{
|
||||||
static GtkType play_type = 0;
|
static GtkType play_type = 0;
|
||||||
|
|
||||||
if (!play_type) {
|
if (!play_type) {
|
||||||
static const GtkTypeInfo play_info = {
|
static const GtkTypeInfo play_info = {
|
||||||
"GstMediaPlay",
|
"GstMediaPlay",
|
||||||
sizeof(GstMediaPlay),
|
sizeof (GstMediaPlay),
|
||||||
sizeof(GstMediaPlayClass),
|
sizeof (GstMediaPlayClass),
|
||||||
(GtkClassInitFunc)gst_media_play_class_init,
|
(GtkClassInitFunc) gst_media_play_class_init,
|
||||||
(GtkObjectInitFunc)gst_media_play_init,
|
(GtkObjectInitFunc) gst_media_play_init,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(GtkClassInitFunc)NULL,
|
(GtkClassInitFunc) NULL,
|
||||||
};
|
};
|
||||||
play_type = gtk_type_unique(gtk_object_get_type(),&play_info);
|
play_type = gtk_type_unique (gtk_object_get_type(), &play_info);
|
||||||
}
|
}
|
||||||
return play_type;
|
return play_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_media_play_class_init (GstMediaPlayClass *klass)
|
gst_media_play_class_init (GstMediaPlayClass *klass)
|
||||||
{
|
{
|
||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
|
|
||||||
parent_class = gtk_type_class (gtk_object_get_type ());
|
parent_class = gtk_type_class (gtk_object_get_type ());
|
||||||
|
|
||||||
object_class = (GtkObjectClass*)klass;
|
object_class = (GtkObjectClass*) klass;
|
||||||
|
|
||||||
object_class->set_arg = gst_media_play_set_arg;
|
object_class->set_arg = gst_media_play_set_arg;
|
||||||
object_class->get_arg = gst_media_play_get_arg;
|
object_class->get_arg = gst_media_play_get_arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GstMediaPlay *play;
|
GstMediaPlay *play;
|
||||||
GModule *symbols;
|
GModule *symbols;
|
||||||
} connect_struct;
|
} connect_struct;
|
||||||
|
|
||||||
/* we need more control here so... */
|
/* we need more control here so... */
|
||||||
|
@ -108,107 +103,107 @@ gst_media_play_connect_func (const gchar *handler_name,
|
||||||
gboolean after,
|
gboolean after,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkSignalFunc func;
|
GtkSignalFunc func;
|
||||||
connect_struct *data = (connect_struct *)user_data;
|
connect_struct *data = (connect_struct *) user_data;
|
||||||
|
|
||||||
if (!g_module_symbol (data->symbols, handler_name, (gpointer *)&func))
|
if (!g_module_symbol (data->symbols, handler_name, (gpointer *)&func))
|
||||||
g_warning("gsteditorproperty: could not find signal handler '%s'.", handler_name);
|
g_warning ("gsteditorproperty: could not find signal handler '%s'.", handler_name);
|
||||||
else {
|
else {
|
||||||
if (after)
|
if (after)
|
||||||
gtk_signal_connect_after (object, signal_name, func, (gpointer) data->play);
|
gtk_signal_connect_after (object, signal_name, func, (gpointer) data->play);
|
||||||
else
|
else
|
||||||
gtk_signal_connect (object, signal_name, func, (gpointer) data->play);
|
gtk_signal_connect (object, signal_name, func, (gpointer) data->play);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_media_play_init(GstMediaPlay *mplay)
|
gst_media_play_init (GstMediaPlay *mplay)
|
||||||
{
|
{
|
||||||
GModule *symbols;
|
GModule *symbols;
|
||||||
connect_struct data;
|
connect_struct data;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
|
|
||||||
/* load the interface */
|
/* load the interface */
|
||||||
if (stat(DATADIR"gstmediaplay.glade", &statbuf) == 0) {
|
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) {
|
||||||
mplay->xml = glade_xml_new (DATADIR"gstmediaplay.glade", "gstplay");
|
mplay->xml = glade_xml_new (DATADIR"gstmediaplay.glade", "gstplay");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mplay->xml = glade_xml_new ("gstmediaplay.glade", "gstplay");
|
mplay->xml = glade_xml_new ("gstmediaplay.glade", "gstplay");
|
||||||
}
|
}
|
||||||
g_assert (mplay->xml != NULL);
|
g_assert (mplay->xml != NULL);
|
||||||
|
|
||||||
mplay->slider = glade_xml_get_widget(mplay->xml, "slider");
|
mplay->slider = glade_xml_get_widget (mplay->xml, "slider");
|
||||||
g_assert (mplay->slider != NULL);
|
g_assert (mplay->slider != NULL);
|
||||||
{
|
{
|
||||||
GtkArg arg;
|
GtkArg arg;
|
||||||
GtkRange *range;
|
GtkRange *range;
|
||||||
|
|
||||||
arg.name = "adjustment";
|
arg.name = "adjustment";
|
||||||
gtk_object_getv (GTK_OBJECT (mplay->slider), 1, &arg);
|
gtk_object_getv (GTK_OBJECT (mplay->slider), 1, &arg);
|
||||||
range = GTK_RANGE (GTK_VALUE_POINTER (arg));
|
range = GTK_RANGE (GTK_VALUE_POINTER (arg));
|
||||||
mplay->adjustment = gtk_range_get_adjustment (range);
|
mplay->adjustment = gtk_range_get_adjustment (range);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (mplay->adjustment), "value_changed",
|
gtk_signal_connect (GTK_OBJECT (mplay->adjustment), "value_changed",
|
||||||
GTK_SIGNAL_FUNC (gst_media_play_slider_changed), mplay);
|
GTK_SIGNAL_FUNC (gst_media_play_slider_changed), mplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
mplay->play_button = glade_xml_get_widget (mplay->xml, "toggle_play");
|
mplay->play_button = glade_xml_get_widget (mplay->xml, "toggle_play");
|
||||||
g_assert (mplay->play_button != NULL);
|
g_assert (mplay->play_button != NULL);
|
||||||
mplay->pause_button = glade_xml_get_widget (mplay->xml, "toggle_pause");
|
mplay->pause_button = glade_xml_get_widget (mplay->xml, "toggle_pause");
|
||||||
g_assert (mplay->pause_button != NULL);
|
g_assert (mplay->pause_button != NULL);
|
||||||
mplay->stop_button = glade_xml_get_widget (mplay->xml, "toggle_stop");
|
mplay->stop_button = glade_xml_get_widget (mplay->xml, "toggle_stop");
|
||||||
g_assert (mplay->stop_button != NULL);
|
g_assert (mplay->stop_button != NULL);
|
||||||
|
|
||||||
mplay->window = glade_xml_get_widget (mplay->xml, "gstplay");
|
mplay->window = glade_xml_get_widget (mplay->xml, "gstplay");
|
||||||
g_assert (mplay->window != NULL);
|
g_assert (mplay->window != NULL);
|
||||||
|
|
||||||
gtk_drag_dest_set (mplay->window,
|
gtk_drag_dest_set (mplay->window,
|
||||||
GTK_DEST_DEFAULT_ALL,
|
GTK_DEST_DEFAULT_ALL,
|
||||||
target_table, 1,
|
target_table, 1,
|
||||||
GDK_ACTION_COPY);
|
GDK_ACTION_COPY);
|
||||||
gtk_signal_connect (GTK_OBJECT (mplay->window), "drag_data_received",
|
gtk_signal_connect (GTK_OBJECT (mplay->window), "drag_data_received",
|
||||||
GTK_SIGNAL_FUNC (target_drag_data_received),
|
GTK_SIGNAL_FUNC (target_drag_data_received),
|
||||||
mplay);
|
mplay);
|
||||||
|
|
||||||
mplay->play = gst_play_new();
|
mplay->play = gst_play_new();
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (mplay->play), "frame_displayed",
|
gtk_signal_connect (GTK_OBJECT (mplay->play), "frame_displayed",
|
||||||
GTK_SIGNAL_FUNC (gst_media_play_frame_displayed),
|
GTK_SIGNAL_FUNC (gst_media_play_frame_displayed),
|
||||||
mplay);
|
mplay);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (mplay->play), "audio_played",
|
gtk_signal_connect (GTK_OBJECT (mplay->play), "audio_played",
|
||||||
GTK_SIGNAL_FUNC (gst_media_play_frame_displayed),
|
GTK_SIGNAL_FUNC (gst_media_play_frame_displayed),
|
||||||
mplay);
|
mplay);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (mplay->play), "playing_state_changed",
|
gtk_signal_connect (GTK_OBJECT (mplay->play), "playing_state_changed",
|
||||||
GTK_SIGNAL_FUNC (gst_media_play_state_changed),
|
GTK_SIGNAL_FUNC (gst_media_play_state_changed),
|
||||||
mplay);
|
mplay);
|
||||||
|
|
||||||
gnome_dock_set_client_area (GNOME_DOCK (glade_xml_get_widget(mplay->xml, "dock1")),
|
gnome_dock_set_client_area (GNOME_DOCK (glade_xml_get_widget(mplay->xml, "dock1")),
|
||||||
GTK_WIDGET (mplay->play));
|
GTK_WIDGET (mplay->play));
|
||||||
|
|
||||||
gtk_widget_show (GTK_WIDGET (mplay->play));
|
gtk_widget_show (GTK_WIDGET (mplay->play));
|
||||||
|
|
||||||
mplay->status = (GstStatusArea *)glade_xml_get_widget (mplay->xml, "status_area");
|
mplay->status = (GstStatusArea *) glade_xml_get_widget (mplay->xml, "status_area");
|
||||||
gst_status_area_set_state (mplay->status, GST_STATUS_AREA_STATE_INIT);
|
gst_status_area_set_state (mplay->status, GST_STATUS_AREA_STATE_INIT);
|
||||||
gst_status_area_set_playtime (mplay->status, "00:00 / 00:00");
|
gst_status_area_set_playtime (mplay->status, "00:00 / 00:00");
|
||||||
|
|
||||||
symbols = g_module_open (NULL, 0);
|
symbols = g_module_open (NULL, 0);
|
||||||
|
|
||||||
data.play = mplay;
|
data.play = mplay;
|
||||||
data.symbols = symbols;
|
data.symbols = symbols;
|
||||||
|
|
||||||
glade_xml_signal_autoconnect_full (mplay->xml, gst_media_play_connect_func, &data);
|
glade_xml_signal_autoconnect_full (mplay->xml, gst_media_play_connect_func, &data);
|
||||||
|
|
||||||
mplay->last_time = 0;
|
mplay->last_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstMediaPlay *
|
GstMediaPlay *
|
||||||
gst_media_play_new ()
|
gst_media_play_new ()
|
||||||
{
|
{
|
||||||
return GST_MEDIA_PLAY (gtk_type_new (GST_TYPE_MEDIA_PLAY));
|
return GST_MEDIA_PLAY (gtk_type_new (GST_TYPE_MEDIA_PLAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -216,84 +211,84 @@ gst_media_play_update_status_area (GstMediaPlay *play,
|
||||||
gulong current_time,
|
gulong current_time,
|
||||||
gulong total_time)
|
gulong total_time)
|
||||||
{
|
{
|
||||||
gchar time[14];
|
gchar time[14];
|
||||||
|
|
||||||
sprintf(time, "%02lu:%02lu / %02lu:%02lu",
|
sprintf (time, "%02lu:%02lu / %02lu:%02lu",
|
||||||
current_time/60, current_time%60,
|
current_time / 60, current_time % 60,
|
||||||
total_time/60, total_time%60);
|
total_time / 60, total_time % 60);
|
||||||
|
|
||||||
gst_status_area_set_playtime (play->status, time);
|
gst_status_area_set_playtime (play->status, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_media_play_start_uri (GstMediaPlay *play,
|
gst_media_play_start_uri (GstMediaPlay *play,
|
||||||
const guchar *uri)
|
const guchar *uri)
|
||||||
{
|
{
|
||||||
GstPlayReturn ret;
|
GstPlayReturn ret;
|
||||||
|
|
||||||
g_return_if_fail (play != NULL);
|
g_return_if_fail (play != NULL);
|
||||||
g_return_if_fail (GST_IS_MEDIA_PLAY (play));
|
g_return_if_fail (GST_IS_MEDIA_PLAY (play));
|
||||||
|
|
||||||
if (uri != NULL) {
|
if (uri != NULL) {
|
||||||
ret = gst_play_set_uri (play->play, uri);
|
ret = gst_play_set_uri (play->play, uri);
|
||||||
|
|
||||||
if (!gst_play_media_can_seek (play->play)) {
|
if (!gst_play_media_can_seek (play->play)) {
|
||||||
gtk_widget_set_sensitive (play->slider, FALSE);
|
gtk_widget_set_sensitive (play->slider, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_window_set_title (GTK_WINDOW (play->window),
|
gtk_window_set_title (GTK_WINDOW (play->window),
|
||||||
g_strconcat ( "Gstplay - ", uri, NULL));
|
g_strconcat ( "Gstplay - ", uri, NULL));
|
||||||
|
|
||||||
gst_play_play (play->play);
|
gst_play_play (play->play);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWidget *selection;
|
GtkWidget *selection;
|
||||||
GstMediaPlay *play;
|
GstMediaPlay *play;
|
||||||
} file_select;
|
} file_select;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_load_file_selected (GtkWidget *button,
|
on_load_file_selected (GtkWidget *button,
|
||||||
file_select *data)
|
file_select *data)
|
||||||
{
|
{
|
||||||
GtkWidget *selector = data->selection;
|
GtkWidget *selector = data->selection;
|
||||||
GstMediaPlay *play = data->play;
|
GstMediaPlay *play = data->play;
|
||||||
|
|
||||||
gchar *file_name = gtk_file_selection_get_filename (GTK_FILE_SELECTION(selector));
|
gchar *file_name = gtk_file_selection_get_filename (GTK_FILE_SELECTION (selector));
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
gst_media_play_start_uri (play, file_name);
|
gst_media_play_start_uri (play, file_name);
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
|
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_open2_activate (GtkWidget *widget,
|
on_open2_activate (GtkWidget *widget,
|
||||||
GstMediaPlay *play)
|
GstMediaPlay *play)
|
||||||
{
|
{
|
||||||
GtkWidget *file_selector;
|
GtkWidget *file_selector;
|
||||||
file_select *file_data = g_new0 (file_select, 1);
|
file_select *file_data = g_new0 (file_select, 1);
|
||||||
|
|
||||||
file_selector = gtk_file_selection_new("Please select a file to load.");
|
file_selector = gtk_file_selection_new ("Please select a file to load.");
|
||||||
|
|
||||||
file_data->selection = file_selector;
|
file_data->selection = file_selector;
|
||||||
file_data->play = play;
|
file_data->play = play;
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
|
||||||
"clicked", GTK_SIGNAL_FUNC (on_load_file_selected),
|
"clicked", GTK_SIGNAL_FUNC (on_load_file_selected),
|
||||||
file_data);
|
file_data);
|
||||||
|
|
||||||
/* Ensure that the dialog box is destroyed when the user clicks a button. */
|
/* Ensure that the dialog box is destroyed when the user clicks a button. */
|
||||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
|
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
|
||||||
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||||
(gpointer) file_selector);
|
(gpointer) file_selector);
|
||||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->cancel_button),
|
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->cancel_button),
|
||||||
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||||
(gpointer) file_selector);
|
(gpointer) file_selector);
|
||||||
|
|
||||||
/* Display that dialog */
|
/* Display that dialog */
|
||||||
gtk_widget_show (file_selector);
|
gtk_widget_show (file_selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -302,14 +297,14 @@ gst_media_play_set_arg (GtkObject *object,
|
||||||
GtkArg *arg,
|
GtkArg *arg,
|
||||||
guint id)
|
guint id)
|
||||||
{
|
{
|
||||||
GstMediaPlay *play;
|
GstMediaPlay *play;
|
||||||
play = GST_MEDIA_PLAY (object);
|
play = GST_MEDIA_PLAY (object);
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
default:
|
default:
|
||||||
g_warning("GstMediaPlay: unknown arg!");
|
g_warning ("GstMediaPlay: unknown arg!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -317,63 +312,61 @@ gst_media_play_get_arg (GtkObject *object,
|
||||||
GtkArg *arg,
|
GtkArg *arg,
|
||||||
guint id)
|
guint id)
|
||||||
{
|
{
|
||||||
GstMediaPlay *play;
|
GstMediaPlay *play;
|
||||||
|
|
||||||
play = GST_MEDIA_PLAY (object);
|
play = GST_MEDIA_PLAY (object);
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
default:
|
default:
|
||||||
arg->type = GTK_TYPE_INVALID;
|
arg->type = GTK_TYPE_INVALID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_media_play_state_changed (GstPlay *play,
|
gst_media_play_state_changed (GstPlay *play,
|
||||||
GstPlayState state,
|
GstPlayState state,
|
||||||
GstMediaPlay *mplay)
|
GstMediaPlay *mplay)
|
||||||
{
|
{
|
||||||
GstStatusAreaState area_state;
|
GstStatusAreaState area_state;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_PLAY (play));
|
g_return_if_fail (GST_IS_PLAY (play));
|
||||||
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
|
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
|
||||||
|
|
||||||
|
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
update_buttons (mplay, state);
|
update_buttons (mplay, state);
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case GST_PLAY_STOPPED:
|
case GST_PLAY_STOPPED:
|
||||||
area_state = GST_STATUS_AREA_STATE_STOPPED;
|
area_state = GST_STATUS_AREA_STATE_STOPPED;
|
||||||
break;
|
break;
|
||||||
case GST_PLAY_PLAYING:
|
case GST_PLAY_PLAYING:
|
||||||
area_state = GST_STATUS_AREA_STATE_PLAYING;
|
area_state = GST_STATUS_AREA_STATE_PLAYING;
|
||||||
break;
|
break;
|
||||||
case GST_PLAY_PAUSED:
|
case GST_PLAY_PAUSED:
|
||||||
area_state = GST_STATUS_AREA_STATE_PAUSED;
|
area_state = GST_STATUS_AREA_STATE_PAUSED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
area_state = GST_STATUS_AREA_STATE_INIT;
|
area_state = GST_STATUS_AREA_STATE_INIT;
|
||||||
}
|
}
|
||||||
gst_status_area_set_state (mplay->status, area_state);
|
gst_status_area_set_state (mplay->status, area_state);
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave ();
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
gst_main_quit ();
|
gst_main_quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
|
@ -381,128 +374,121 @@ on_gst_media_play_delete_event (GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
GstMediaPlay *mplay)
|
GstMediaPlay *mplay)
|
||||||
{
|
{
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave ();
|
||||||
gst_play_stop (mplay->play);
|
gst_play_stop (mplay->play);
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
gulong size, current_offset;
|
gulong size, current_offset;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_PLAY (play));
|
g_return_if_fail (GST_IS_PLAY (play));
|
||||||
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
|
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
|
||||||
|
|
||||||
current_time = gst_play_get_media_current_time (play);
|
current_time = gst_play_get_media_current_time (play);
|
||||||
total_time = gst_play_get_media_total_time (play);
|
total_time = gst_play_get_media_total_time (play);
|
||||||
size = gst_play_get_media_size (play);
|
size = gst_play_get_media_size (play);
|
||||||
current_offset = gst_play_get_media_offset (play);
|
current_offset = gst_play_get_media_offset (play);
|
||||||
|
|
||||||
//g_print ("%lu %lu %lu %lu\n", current_time, total_time, size, current_offset);
|
//g_print ("%lu %lu %lu %lu\n", current_time, total_time, size, current_offset);
|
||||||
|
|
||||||
if (current_time != mplay->last_time) {
|
if (current_time != mplay->last_time) {
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
gst_media_play_update_status_area (mplay, current_time, total_time);
|
gst_media_play_update_status_area (mplay, current_time, total_time);
|
||||||
update_slider (mplay, mplay->adjustment, current_offset*100.0/size);
|
update_slider (mplay, mplay->adjustment, current_offset*100.0/size);
|
||||||
mplay->last_time = current_time;
|
mplay->last_time = current_time;
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
|
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
|
||||||
|
|
||||||
size = gst_play_get_media_size (mplay->play);
|
size = gst_play_get_media_size (mplay->play);
|
||||||
|
|
||||||
gst_play_media_seek(mplay->play, (int)(adj->value*size/100.0));
|
gst_play_media_seek (mplay->play, (int)(adj->value*size/100.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
update_buttons (play, GST_PLAY_STATE(play->play));
|
update_buttons (play, GST_PLAY_STATE(play->play));
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
update_buttons (play, GST_PLAY_STATE(play->play));
|
update_buttons (play, GST_PLAY_STATE(play->play));
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
update_buttons (play, GST_PLAY_STATE(play->play));
|
update_buttons (play, GST_PLAY_STATE(play->play));
|
||||||
}
|
}
|
||||||
|
|
||||||
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),
|
||||||
mplay);
|
mplay);
|
||||||
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->pause_button),
|
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->pause_button),
|
||||||
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
|
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
|
||||||
mplay);
|
mplay);
|
||||||
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->stop_button),
|
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->stop_button),
|
||||||
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
|
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
|
||||||
mplay);
|
mplay);
|
||||||
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->play_button), FALSE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->play_button), FALSE);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->pause_button), FALSE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->pause_button), FALSE);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->stop_button), FALSE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->stop_button), FALSE);
|
||||||
|
|
||||||
if (state == GST_PLAY_PLAYING) {
|
if (state == GST_PLAY_PLAYING) {
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->play_button), TRUE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->play_button), TRUE);
|
||||||
}
|
}
|
||||||
else if (state == GST_PLAY_PAUSED) {
|
else if (state == GST_PLAY_PAUSED) {
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->pause_button), TRUE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->pause_button), TRUE);
|
||||||
}
|
}
|
||||||
else if (state == GST_PLAY_STOPPED) {
|
else if (state == GST_PLAY_STOPPED) {
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->stop_button), TRUE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->stop_button), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->play_button),
|
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->play_button),
|
||||||
GTK_SIGNAL_FUNC (on_toggle_play_toggled),
|
GTK_SIGNAL_FUNC (on_toggle_play_toggled),
|
||||||
mplay);
|
mplay);
|
||||||
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->pause_button),
|
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->pause_button),
|
||||||
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
|
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
|
||||||
mplay);
|
mplay);
|
||||||
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->stop_button),
|
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->stop_button),
|
||||||
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
|
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
|
||||||
mplay);
|
mplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -510,12 +496,11 @@ update_slider (GstMediaPlay *mplay,
|
||||||
GtkAdjustment *adjustment,
|
GtkAdjustment *adjustment,
|
||||||
gfloat value)
|
gfloat value)
|
||||||
{
|
{
|
||||||
gtk_signal_handler_block_by_func (GTK_OBJECT (adjustment),
|
gtk_signal_handler_block_by_func (GTK_OBJECT (adjustment),
|
||||||
GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
|
GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
|
||||||
mplay);
|
mplay);
|
||||||
gtk_adjustment_set_value (adjustment, value);
|
gtk_adjustment_set_value (adjustment, value);
|
||||||
gtk_signal_handler_unblock_by_func (GTK_OBJECT (adjustment),
|
gtk_signal_handler_unblock_by_func (GTK_OBJECT (adjustment),
|
||||||
GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
|
GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
|
||||||
mplay);
|
mplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 <rbultje@ronald.bitfreak.net>
|
||||||
<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 <rbultje@ronald.bitfreak.net>
|
||||||
<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>
|
||||||
|
|
||||||
|
|
|
@ -1,54 +1,41 @@
|
||||||
/*
|
|
||||||
* 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;
|
||||||
|
|
||||||
GladeXML *xml;
|
GladeXML *xml;
|
||||||
GstPlay *play;
|
GstPlay *play;
|
||||||
|
|
||||||
GtkWidget *play_button;
|
GtkWidget *play_button;
|
||||||
GtkWidget *pause_button;
|
GtkWidget *pause_button;
|
||||||
GtkWidget *stop_button;
|
GtkWidget *stop_button;
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
|
|
||||||
GstStatusArea *status;
|
GstStatusArea *status;
|
||||||
|
|
||||||
// the slider
|
// the slider
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
GtkWidget *slider;
|
GtkWidget *slider;
|
||||||
|
|
||||||
gulong last_time;
|
gulong last_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstMediaPlayClass {
|
struct _GstMediaPlayClass {
|
||||||
GtkObjectClass parent_class;
|
GtkObjectClass parent_class;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,65 +1,55 @@
|
||||||
/*
|
|
||||||
* 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,
|
||||||
GST_PLAY_PAUSED,
|
GST_PLAY_PAUSED,
|
||||||
} GstPlayState;
|
} GstPlayState;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_PLAY_OK,
|
GST_PLAY_OK,
|
||||||
GST_PLAY_UNKNOWN_MEDIA,
|
GST_PLAY_UNKNOWN_MEDIA,
|
||||||
GST_PLAY_CANNOT_PLAY,
|
GST_PLAY_CANNOT_PLAY,
|
||||||
GST_PLAY_ERROR,
|
GST_PLAY_ERROR,
|
||||||
} GstPlayReturn;
|
} GstPlayReturn;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_PLAY_TYPE_AUDIO = (1 << 0),
|
GST_PLAY_TYPE_AUDIO = (1 << 0),
|
||||||
GST_PLAY_TYPE_VIDEO = (1 << 1),
|
GST_PLAY_TYPE_VIDEO = (1 << 1),
|
||||||
} GstPlayMediaTypeFlags;
|
} GstPlayMediaTypeFlags;
|
||||||
|
|
||||||
struct _GstPlay {
|
struct _GstPlay {
|
||||||
GtkHBox parent;
|
GtkHBox parent;
|
||||||
|
|
||||||
GstPlayState state;
|
GstPlayState state;
|
||||||
GstPlayMediaTypeFlags flags;
|
GstPlayMediaTypeFlags flags;
|
||||||
|
|
||||||
gpointer priv;
|
gpointer priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GST_PLAY_STATE(play) ((play)->state)
|
#define GST_PLAY_STATE(play) ((play)->state)
|
||||||
#define GST_PLAY_MEDIA_TYPE(play) ((play)->flags)
|
#define GST_PLAY_MEDIA_TYPE(play) ((play)->flags)
|
||||||
#define GST_PLAY_IS_AUDIO_TYPE(play) ((play)->flags & GST_PLAY_TYPE_AUDIO)
|
#define GST_PLAY_IS_AUDIO_TYPE(play) ((play)->flags & GST_PLAY_TYPE_AUDIO)
|
||||||
#define GST_PLAY_IS_VIDEO_TYPE(play) ((play)->flags & GST_PLAY_TYPE_VIDEO)
|
#define GST_PLAY_IS_VIDEO_TYPE(play) ((play)->flags & GST_PLAY_TYPE_VIDEO)
|
||||||
|
|
||||||
struct _GstPlayClass {
|
struct _GstPlayClass {
|
||||||
GtkHBoxClass parent_class;
|
GtkHBoxClass parent_class;
|
||||||
|
|
||||||
void (*state_changed) (GstPlay *play, GstPlayState state);
|
void (*state_changed) (GstPlay *play, GstPlayState state);
|
||||||
void (*frame_displayed) (GstPlay *play);
|
void (*frame_displayed) (GstPlay *play);
|
||||||
void (*audio_played) (GstPlay *play);
|
void (*audio_played) (GstPlay *play);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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__
|
||||||
|
|
||||||
|
@ -11,21 +6,24 @@
|
||||||
typedef struct _GstPlayPrivate GstPlayPrivate;
|
typedef struct _GstPlayPrivate GstPlayPrivate;
|
||||||
|
|
||||||
struct _GstPlayPrivate {
|
struct _GstPlayPrivate {
|
||||||
GstElement *thread;
|
GstElement *thread;
|
||||||
GstElement *bin;
|
GstElement *bin;
|
||||||
GstElement *video_element, *audio_element;
|
GstElement *video_element, *audio_element;
|
||||||
GstElement *video_show;
|
GstElement *video_show;
|
||||||
GtkWidget *video_widget;
|
GtkWidget *video_widget;
|
||||||
GstElement *src;
|
GstElement *src;
|
||||||
|
|
||||||
|
guchar *uri;
|
||||||
|
gboolean muted;
|
||||||
|
gboolean can_seek;
|
||||||
|
|
||||||
|
GstElement *offset_element;
|
||||||
|
GstElement *bit_rate_element;
|
||||||
|
GstElement *media_time_element;
|
||||||
|
GstElement *current_time_element;
|
||||||
|
|
||||||
guchar *uri;
|
guint source_width;
|
||||||
gboolean muted;
|
guint source_height;
|
||||||
gboolean can_seek;
|
|
||||||
|
|
||||||
GstElement *offset_element;
|
|
||||||
GstElement *bit_rate_element;
|
|
||||||
GstElement *media_time_element;
|
|
||||||
GstElement *current_time_element;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GSTPLAY_PRIVATE_H__ */
|
#endif /* __GSTPLAY_PRIVATE_H__ */
|
||||||
|
|
|
@ -1,31 +1,25 @@
|
||||||
/*
|
|
||||||
* 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);
|
||||||
static void gst_status_area_init(GstStatusArea *status_area);
|
static void gst_status_area_init (GstStatusArea *status_area);
|
||||||
|
|
||||||
static void gst_status_area_set_arg(GtkObject *object,GtkArg *arg,guint id);
|
static void gst_status_area_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||||
static void gst_status_area_get_arg(GtkObject *object,GtkArg *arg,guint id);
|
static void gst_status_area_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||||
|
|
||||||
static void gst_status_area_realize(GtkWidget *status_area);
|
static void gst_status_area_realize (GtkWidget *status_area);
|
||||||
static gint gst_status_area_expose(GtkWidget *widget, GdkEventExpose *event);
|
static gint gst_status_area_expose (GtkWidget *widget, GdkEventExpose *event);
|
||||||
|
|
||||||
#define DEFAULT_HEIGHT 20
|
#define DEFAULT_HEIGHT 20
|
||||||
#define DEFAULT_EXPANDED_HEIGHT 100
|
#define DEFAULT_EXPANDED_HEIGHT 100
|
||||||
|
|
||||||
/* signals and args */
|
/* signals and args */
|
||||||
enum {
|
enum {
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ARG_0,
|
ARG_0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static GtkDrawingArea *parent_class = NULL;
|
static GtkDrawingArea *parent_class = NULL;
|
||||||
|
@ -34,277 +28,267 @@ static GtkDrawingArea *parent_class = NULL;
|
||||||
GtkType
|
GtkType
|
||||||
gst_status_area_get_type (void)
|
gst_status_area_get_type (void)
|
||||||
{
|
{
|
||||||
static GtkType status_area_type = 0;
|
static GtkType status_area_type = 0;
|
||||||
|
|
||||||
if (!status_area_type) {
|
if (!status_area_type) {
|
||||||
static const GtkTypeInfo status_area_info = {
|
static const GtkTypeInfo status_area_info = {
|
||||||
"GstStatusArea",
|
"GstStatusArea",
|
||||||
sizeof(GstStatusArea),
|
sizeof(GstStatusArea),
|
||||||
sizeof(GstStatusAreaClass),
|
sizeof(GstStatusAreaClass),
|
||||||
(GtkClassInitFunc)gst_status_area_class_init,
|
(GtkClassInitFunc)gst_status_area_class_init,
|
||||||
(GtkObjectInitFunc)gst_status_area_init,
|
(GtkObjectInitFunc)gst_status_area_init,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(GtkClassInitFunc)NULL,
|
(GtkClassInitFunc)NULL,
|
||||||
};
|
};
|
||||||
status_area_type = gtk_type_unique (gtk_widget_get_type (),&status_area_info);
|
status_area_type = gtk_type_unique (gtk_widget_get_type (),&status_area_info);
|
||||||
}
|
}
|
||||||
return status_area_type;
|
return status_area_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_status_area_class_init (GstStatusAreaClass *klass)
|
gst_status_area_class_init (GstStatusAreaClass *klass)
|
||||||
{
|
{
|
||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
GtkWidgetClass *widget_class;
|
GtkWidgetClass *widget_class;
|
||||||
|
|
||||||
parent_class = gtk_type_class (gtk_widget_get_type ());
|
parent_class = gtk_type_class (gtk_widget_get_type ());
|
||||||
|
|
||||||
object_class = (GtkObjectClass*)klass;
|
object_class = (GtkObjectClass*)klass;
|
||||||
widget_class = (GtkWidgetClass*)klass;
|
widget_class = (GtkWidgetClass*)klass;
|
||||||
|
|
||||||
object_class->set_arg = gst_status_area_set_arg;
|
object_class->set_arg = gst_status_area_set_arg;
|
||||||
object_class->get_arg = gst_status_area_get_arg;
|
object_class->get_arg = gst_status_area_get_arg;
|
||||||
|
|
||||||
widget_class->realize = gst_status_area_realize;
|
widget_class->realize = gst_status_area_realize;
|
||||||
widget_class->expose_event = gst_status_area_expose;
|
widget_class->expose_event = gst_status_area_expose;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_status_area_init (GstStatusArea *status_area)
|
gst_status_area_init (GstStatusArea *status_area)
|
||||||
{
|
{
|
||||||
GTK_WIDGET(status_area)->requisition.height = DEFAULT_HEIGHT;
|
GTK_WIDGET(status_area)->requisition.height = DEFAULT_HEIGHT;
|
||||||
|
|
||||||
status_area->state = GST_STATUS_AREA_STATE_INIT;
|
status_area->state = GST_STATUS_AREA_STATE_INIT;
|
||||||
status_area->expanded = FALSE;
|
status_area->expanded = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstStatusArea *
|
GstStatusArea *
|
||||||
gst_status_area_new (void)
|
gst_status_area_new (void)
|
||||||
{
|
{
|
||||||
return GST_STATUS_AREA (gtk_type_new (GST_TYPE_STATUS_AREA));
|
return GST_STATUS_AREA (gtk_type_new (GST_TYPE_STATUS_AREA));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_status_area_realize (GtkWidget *widget)
|
gst_status_area_realize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
GstStatusArea *status_area;
|
GstStatusArea *status_area;
|
||||||
|
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
g_return_if_fail(GST_IS_STATUS_AREA(widget));
|
g_return_if_fail(GST_IS_STATUS_AREA(widget));
|
||||||
|
|
||||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||||
status_area = GST_STATUS_AREA(widget);
|
status_area = GST_STATUS_AREA(widget);
|
||||||
|
|
||||||
attributes.x = widget->allocation.x;
|
attributes.x = widget->allocation.x;
|
||||||
attributes.y = widget->allocation.y;
|
attributes.y = widget->allocation.y;
|
||||||
attributes.width = widget->allocation.width;
|
attributes.width = widget->allocation.width;
|
||||||
attributes.height = widget->allocation.height;
|
attributes.height = widget->allocation.height;
|
||||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||||
attributes.window_type = GDK_WINDOW_CHILD;
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
attributes.event_mask = gtk_widget_get_events (widget)
|
attributes.event_mask = gtk_widget_get_events (widget)
|
||||||
| GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
|
| GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
|
||||||
| GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
|
| GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
|
||||||
|
|
||||||
attributes.visual = gtk_widget_get_visual (widget);
|
attributes.visual = gtk_widget_get_visual (widget);
|
||||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||||
|
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||||
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
|
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
|
||||||
|
|
||||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_STATUS_AREA (widget), FALSE);
|
g_return_val_if_fail (GST_IS_STATUS_AREA (widget), FALSE);
|
||||||
g_return_val_if_fail (event != NULL, FALSE);
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
|
||||||
status_area = GST_STATUS_AREA (widget);
|
status_area = GST_STATUS_AREA (widget);
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) {
|
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) {
|
||||||
gdk_draw_rectangle (widget->window,
|
gdk_draw_rectangle (widget->window,
|
||||||
widget->style->black_gc,
|
widget->style->black_gc,
|
||||||
TRUE,
|
TRUE,
|
||||||
0, 0,
|
0, 0,
|
||||||
widget->allocation.width,
|
widget->allocation.width,
|
||||||
widget->allocation.height);
|
widget->allocation.height);
|
||||||
|
|
||||||
if (status_area->expanded) {
|
if (status_area->expanded) {
|
||||||
gint width;
|
gint width;
|
||||||
|
|
||||||
gdk_draw_line (widget->window,
|
gdk_draw_line (widget->window,
|
||||||
widget->style->dark_gc[0],
|
widget->style->dark_gc[0],
|
||||||
0, widget->allocation.height - 20,
|
0, widget->allocation.height - 20,
|
||||||
widget->allocation.width, widget->allocation.height - 20);
|
widget->allocation.width, widget->allocation.height - 20);
|
||||||
|
|
||||||
width = gdk_string_width (widget->style->font, "Show:");
|
width = gdk_string_width (widget->style->font, "Show:");
|
||||||
|
|
||||||
gdk_draw_string (widget->window,
|
gdk_draw_string (widget->window,
|
||||||
widget->style->font,
|
widget->style->font,
|
||||||
widget->style->white_gc,
|
widget->style->white_gc,
|
||||||
80-width, 15,
|
80-width, 15,
|
||||||
"Show:");
|
"Show:");
|
||||||
|
|
||||||
width = gdk_string_width (widget->style->font, "Clip:");
|
width = gdk_string_width (widget->style->font, "Clip:");
|
||||||
|
|
||||||
gdk_draw_string (widget->window,
|
gdk_draw_string (widget->window,
|
||||||
widget->style->font,
|
widget->style->font,
|
||||||
widget->style->white_gc,
|
widget->style->white_gc,
|
||||||
80-width, 40,
|
80-width, 40,
|
||||||
"Clip:");
|
"Clip:");
|
||||||
|
|
||||||
width = gdk_string_width (widget->style->font, "Author:");
|
width = gdk_string_width (widget->style->font, "Author:");
|
||||||
|
|
||||||
gdk_draw_string (widget->window,
|
gdk_draw_string (widget->window,
|
||||||
widget->style->font,
|
widget->style->font,
|
||||||
widget->style->white_gc,
|
widget->style->white_gc,
|
||||||
80-width, 55,
|
80-width, 55,
|
||||||
"Author:");
|
"Author:");
|
||||||
|
|
||||||
width = gdk_string_width (widget->style->font, "Copyright:");
|
width = gdk_string_width (widget->style->font, "Copyright:");
|
||||||
|
|
||||||
gdk_draw_string (widget->window,
|
gdk_draw_string (widget->window,
|
||||||
widget->style->font,
|
widget->style->font,
|
||||||
widget->style->white_gc,
|
widget->style->white_gc,
|
||||||
80-width, 70,
|
80-width, 70,
|
||||||
"Copyright:");
|
"Copyright:");
|
||||||
|
|
||||||
gdk_draw_line (widget->window,
|
gdk_draw_line (widget->window,
|
||||||
widget->style->dark_gc[0],
|
widget->style->dark_gc[0],
|
||||||
0, widget->allocation.height - 80,
|
0, widget->allocation.height - 80,
|
||||||
widget->allocation.width, widget->allocation.height - 80);
|
widget->allocation.width, widget->allocation.height - 80);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (status_area->state) {
|
switch (status_area->state) {
|
||||||
case GST_STATUS_AREA_STATE_INIT:
|
case GST_STATUS_AREA_STATE_INIT:
|
||||||
statustext = "Initializing";
|
statustext = "Initializing";
|
||||||
break;
|
break;
|
||||||
case GST_STATUS_AREA_STATE_PLAYING:
|
case GST_STATUS_AREA_STATE_PLAYING:
|
||||||
statustext = "Playing";
|
statustext = "Playing";
|
||||||
break;
|
break;
|
||||||
case GST_STATUS_AREA_STATE_PAUSED:
|
case GST_STATUS_AREA_STATE_PAUSED:
|
||||||
statustext = "Paused";
|
statustext = "Paused";
|
||||||
break;
|
break;
|
||||||
case GST_STATUS_AREA_STATE_STOPPED:
|
case GST_STATUS_AREA_STATE_STOPPED:
|
||||||
statustext = "Stopped";
|
statustext = "Stopped";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
statustext = "";
|
statustext = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_draw_string (widget->window,
|
gdk_draw_string (widget->window,
|
||||||
widget->style->font,
|
widget->style->font,
|
||||||
widget->style->white_gc,
|
widget->style->white_gc,
|
||||||
8, widget->allocation.height-5,
|
8, widget->allocation.height-5,
|
||||||
statustext);
|
statustext);
|
||||||
|
|
||||||
if (status_area->playtime) {
|
if (status_area->playtime) {
|
||||||
gint width = gdk_string_width (widget->style->font, status_area->playtime);
|
gint width = gdk_string_width (widget->style->font, status_area->playtime);
|
||||||
|
|
||||||
gdk_draw_string (widget->window,
|
gdk_draw_string (widget->window,
|
||||||
widget->style->font,
|
widget->style->font,
|
||||||
widget->style->white_gc,
|
widget->style->white_gc,
|
||||||
widget->allocation.width-width-20,
|
widget->allocation.width-width-20,
|
||||||
widget->allocation.height-5,
|
widget->allocation.height-5,
|
||||||
status_area->playtime);
|
status_area->playtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
area->state = state;
|
area->state = state;
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE(area))
|
if (GTK_WIDGET_VISIBLE(area))
|
||||||
gtk_widget_queue_draw(GTK_WIDGET(area));
|
gtk_widget_queue_draw(GTK_WIDGET(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));
|
||||||
g_return_if_fail(time != NULL);
|
g_return_if_fail(time != NULL);
|
||||||
|
|
||||||
if (area->playtime) g_free (area->playtime);
|
if (area->playtime) g_free (area->playtime);
|
||||||
|
|
||||||
area->playtime = g_strdup (time);
|
area->playtime = g_strdup (time);
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE(area))
|
if (GTK_WIDGET_VISIBLE(area))
|
||||||
gtk_widget_queue_draw(GTK_WIDGET(area));
|
gtk_widget_queue_draw(GTK_WIDGET(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;
|
||||||
|
|
||||||
if (show) {
|
if (show) {
|
||||||
GTK_WIDGET(area)->requisition.height = DEFAULT_EXPANDED_HEIGHT;
|
GTK_WIDGET(area)->requisition.height = DEFAULT_EXPANDED_HEIGHT;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GTK_WIDGET(area)->requisition.height = DEFAULT_HEIGHT;
|
GTK_WIDGET(area)->requisition.height = DEFAULT_HEIGHT;
|
||||||
}
|
}
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (area));
|
gtk_widget_queue_resize (GTK_WIDGET (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;
|
||||||
|
|
||||||
status_area = GST_STATUS_AREA(object);
|
status_area = GST_STATUS_AREA(object);
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
default:
|
default:
|
||||||
g_warning("GstStatusArea: unknown arg!");
|
g_warning("GstStatusArea: unknown arg!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
status_area = GST_STATUS_AREA(object);
|
status_area = GST_STATUS_AREA(object);
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
default:
|
default:
|
||||||
arg->type = GTK_TYPE_INVALID;
|
arg->type = GTK_TYPE_INVALID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,38 +4,32 @@
|
||||||
#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,
|
||||||
GST_STATUS_AREA_STATE_PAUSED,
|
GST_STATUS_AREA_STATE_PAUSED,
|
||||||
GST_STATUS_AREA_STATE_STOPPED,
|
GST_STATUS_AREA_STATE_STOPPED,
|
||||||
} GstStatusAreaState;
|
} GstStatusAreaState;
|
||||||
|
|
||||||
struct _GstStatusArea {
|
struct _GstStatusArea {
|
||||||
GtkWidget parent;
|
GtkWidget parent;
|
||||||
|
|
||||||
GstStatusAreaState state;
|
GstStatusAreaState state;
|
||||||
guchar *playtime;
|
guchar *playtime;
|
||||||
gboolean expanded;
|
gboolean expanded;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstStatusAreaClass {
|
struct _GstStatusAreaClass {
|
||||||
GtkWidgetClass parent_class;
|
GtkWidgetClass parent_class;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,28 @@
|
||||||
/*
|
|
||||||
* 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
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GstMediaPlay *play;
|
GstMediaPlay *play;
|
||||||
|
|
||||||
gst_init (&argc,&argv);
|
gst_init (&argc,&argv);
|
||||||
gnome_init ("gstreamer", VERSION, argc, argv);
|
gnome_init ("gstreamer", VERSION, argc, argv);
|
||||||
glade_init();
|
glade_init();
|
||||||
glade_gnome_init();
|
glade_gnome_init();
|
||||||
|
|
||||||
play = gst_media_play_new ();
|
play = gst_media_play_new ();
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
gst_media_play_start_uri (play, argv[1]);
|
gst_media_play_start_uri (play, argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlSaveFile("gstmediaplay.gst", gst_xml_write(gst_play_get_pipeline(play->play)));
|
xmlSaveFile ("gstmediaplay.gst", gst_xml_write (gst_play_get_pipeline (play->play)));
|
||||||
|
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter();
|
||||||
gst_main ();
|
gst_main();
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue