gst/gst.c (gst_main, gst_main_quit): upd.

Original commit message from CVS:
2001-12-14  Michael Meeks  <michael@ximian.com>

* gst/gst.c (gst_main, gst_main_quit): upd.

* gst/gstutils.c (gst_util_has_arg): impl.
(gst_util_get_int64_arg): impl.

* plugins/mpeg2/video/gstmpeg2play.c
(gst_mpeg2play_class_init): min frames per sec = 0.

* plugins/mikmod/gstmikmod.c (gst_mikmod_class_init):
s/16bit/use16bit/ properties can't begin with a non
alpha.

* tools/gstreamer-guilaunch.c: fresh from the ministy
of nasty hacks.

* tools/Makefile.am: enable gstreamer-guilaunch for
Gnome 2.0

* tools/gstreamer-launch.c (main): upd.
(idle_func): quit the mainloop.
This commit is contained in:
Michael Meeks 2001-12-14 18:11:52 +00:00
parent 672ea30dd8
commit d04099240b
17 changed files with 292 additions and 235 deletions

View file

@ -1,3 +1,26 @@
2001-12-14 Michael Meeks <michael@ximian.com>
* gst/gst.c (gst_main, gst_main_quit): upd.
* gst/gstutils.c (gst_util_has_arg): impl.
(gst_util_get_int64_arg): impl.
* plugins/mpeg2/video/gstmpeg2play.c
(gst_mpeg2play_class_init): min frames per sec = 0.
* plugins/mikmod/gstmikmod.c (gst_mikmod_class_init):
s/16bit/use16bit/ properties can't begin with a non
alpha.
* tools/gstreamer-guilaunch.c: fresh from the ministy
of nasty hacks.
* tools/Makefile.am: enable gstreamer-guilaunch for
Gnome 2.0
* tools/gstreamer-launch.c (main): upd.
(idle_func): quit the mainloop.
2001-12-14 Michael Meeks <michael@ximian.com>
* plugins/audiofile/gstafsrc.c (gst_afsrc_class_init): upd.

View file

@ -73,7 +73,8 @@ gst_init (int *argc, char **argv[])
GstTrace *gst_trace;
#endif
if (!g_thread_supported ()) g_thread_init (NULL);
if (!g_thread_supported ())
g_thread_init (NULL);
#ifdef USE_GLIB2
g_type_init();
@ -343,6 +344,10 @@ gst_init_check (int *argc,
return ret;
}
#ifdef USE_GLIB2
static GSList *mainloops = NULL;
#endif
/**
* gst_main:
*
@ -351,7 +356,14 @@ gst_init_check (int *argc,
void
gst_main (void)
{
#ifndef USE_GLIB2
#ifdef USE_GLIB2
GMainLoop *loop;
loop = g_main_loop_new (NULL, FALSE);
mainloops = g_slist_prepend (mainloops, loop);
g_main_loop_run (loop);
#else
gtk_main ();
#endif
}
@ -364,7 +376,15 @@ gst_main (void)
void
gst_main_quit (void)
{
#ifndef USE_GLIB2
#ifdef USE_GLIB2
if (!mainloops)
g_warning ("Quit more loops than there are");
else {
GMainLoop *loop = mainloops->data;
mainloops = g_slist_delete_link (mainloops, mainloops);
g_main_loop_quit (loop);
}
#else
gtk_main_quit ();
#endif
}

View file

@ -1335,16 +1335,18 @@ gst_element_populate_std_props (GObjectClass * klass,
if (prop_id == fd_id) {
pspec = g_param_spec_int ("fd", "File-descriptor",
"File-descriptor for the file being read", 0, G_MAXINT, 0, flags);
"File-descriptor for the file being read",
0, G_MAXINT, 0, flags);
}
else if (prop_id == blocksize_id) {
pspec = g_param_spec_ulong ("blocksize", "Block Size",
"Block size to read per buffer", 0, G_MAXULONG, 4096, flags);
"Block size to read per buffer",
0, G_MAXULONG, 4096, flags);
}
else if (prop_id == bytesperread_id) {
pspec = g_param_spec_int ("bytesperread", "bytesperread", "bytesperread",
pspec = g_param_spec_int ("bytesperread", "bytesperread",
"bytesperread",
G_MININT, G_MAXINT, 0, flags);
}
@ -1354,7 +1356,8 @@ gst_element_populate_std_props (GObjectClass * klass,
}
else if (prop_id == filesize_id) {
pspec = g_param_spec_int64 ("filesize", "File Size",
"Size of the file being read", 0, G_MAXINT64, 0, flags);
"Size of the file being read",
0, G_MAXINT64, 0, flags);
}
else if (prop_id == mmapsize_id) {
@ -1365,21 +1368,25 @@ gst_element_populate_std_props (GObjectClass * klass,
}
else if (prop_id == location_id) {
pspec = g_param_spec_string ("location", "File Location",
"Location of the file to read", NULL, flags);
"Location of the file to read",
NULL, flags);
}
else if (prop_id == offset_id) {
pspec = g_param_spec_int64 ("offset", "File Offset",
"Byte offset of current read pointer", 0, G_MAXINT64, 0, flags);
"Byte offset of current read pointer",
0, G_MAXINT64, 0, flags);
}
else if (prop_id == silent_id) {
pspec = g_param_spec_boolean ("silent", "silent", "silent", FALSE, flags);
pspec = g_param_spec_boolean ("silent", "silent", "silent",
FALSE, flags);
}
else if (prop_id == touch_id) {
pspec = g_param_spec_boolean ("touch", "Touch read data",
"Touch data to force disk read before push ()", TRUE, flags);
"Touch data to force disk read before "
"push ()", TRUE, flags);
}
else {
g_warning ("Unknown - 'standard' property '%s' id %d from klass %s",
@ -1426,3 +1433,4 @@ gst_element_install_std_props (GstElementClass * klass, const char *first_name,
va_end (args);
}

View file

@ -93,6 +93,27 @@ gst_util_get_long_arg (GObject * object, const gchar * argname)
return g_value_get_long (&value);
}
/**
* gst_util_get_long_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as a long.
*
* Returns: the property of the object
*/
gint64
gst_util_get_int64_arg (GObject *object, const gchar *argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_INT64);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_int64 (&value);
}
/**
* gst_util_get_float_arg:
* @object: the object to query
@ -568,3 +589,31 @@ gst_print_element_args (GString * buf, gint indent, GstElement * element)
}
g_free (property_specs);
}
/**
* gst_util_has_arg:
* @object: an object
* @argname: a property it might have
* @arg_type: the type of the argument it should have
*
* Determines whether this @object has a property of name
* @argname and of type @arg_type
*
* Return value: TRUE if it has the prop, else FALSE
**/
gboolean
gst_util_has_arg (GObject *object, const gchar *argname, GType arg_type)
{
GParamSpec *pspec;
pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (object), argname);
if (!pspec)
return FALSE;
if (pspec->value_type != arg_type)
return FALSE;
return TRUE;
}

View file

@ -31,9 +31,12 @@
extern "C" {
#endif /* __cplusplus */
gboolean gst_util_has_arg (GObject *object, const gchar *argname,
GType arg_type);
gint gst_util_get_int_arg (GObject *object, const gchar *argname);
gboolean gst_util_get_bool_arg (GObject *object, const gchar *argname);
glong gst_util_get_long_arg (GObject *object, const gchar *argname);
gint64 gst_util_get_int64_arg (GObject *object, const gchar *argname);
gfloat gst_util_get_float_arg (GObject *object, const gchar *argname);
gdouble gst_util_get_double_arg (GObject *object, const gchar *argname);
const gchar* gst_util_get_string_arg (GObject *object, const gchar *argname);

View file

@ -1,23 +1,19 @@
2001-12-14 Wim Taymans <wim.taymans@chello.be>
2001-12-14 Michael Meeks <michael@ximian.com>
* (gst_play_set_uri): use filesrc again.
* gstplay.c (gst_play_set_uri): remove bogus
priv->offset_element set.
2001-12-13 Michael Meeks <michael@ximian.com>
* gstplayprivate.h: kill, move into
* gstplay.c (gst_play_object_introspect): copy and
port to GObject.
(gst_play_get_arg): use UINT for compat.
(gst_play_set_uri): use disksrc instead.
* gstplay.c: here & lots of cleanup.
* gststatusarea.c (gst_status_area_expose): needs
pangoizing, conditionaly build.
* gstplay.h: use an opaque typedef for GstPlayPrivate,
lots of ugly casts die.
* gstmediaplay.c (gst_media_play_init): upd.
(gst_media_play_show_playlist):
* main.c (main): use gtk_main; gst_main no longer hits
the GUI mainloop.
* gstplay.h (gst_glade_xml_new): add.
* callbacks.c (on_preferences1_activate): glade hacks.
* gstmediaplay.c (gst_media_play_init): show the toplevel
2001-12-06 Arik Devens <arik@gnome.org>

View file

@ -30,8 +30,7 @@ libgstmediaplayinclude_HEADERS = \
noinst_HEADERS = \
gstmediaplay.h \
gststatusarea.h \
callbacks.h \
gstplayprivate.h
callbacks.h
libgstmediaplay_la_LDFLAGS = -rdynamic
libgstmediaplay_la_CFLAGS = $(GNOME_CFLAGS) $(LIBGLADE_GNOME_CFLAGS) $(GST_CFLAGS) -DDATADIR=\""$(gladedir)/"\"

View file

@ -67,14 +67,18 @@ on_preferences1_activate (GtkMenuItem *menuitem, gpointer user_data)
GladeXML *xml;
struct stat statbuf;
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) {
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0)
xml = gst_glade_xml_new (DATADIR"gstmediaplay.glade", "preferences");
}
else
xml = gst_glade_xml_new ("gstmediaplay.glade", "preferences");
glade_xml_signal_autoconnect (xml);
gtk_widget_show (glade_xml_get_widget (xml, "preferences"));
}
void on_about_activate (GtkWidget *widget, gpointer data)
void
on_about_activate (GtkWidget *widget, gpointer data)
{
GladeXML *xml;
struct stat statbuf;
@ -85,12 +89,14 @@ void on_about_activate (GtkWidget *widget, gpointer data)
else
xml = gst_glade_xml_new ("gstmediaplay.glade", "about");
/* connect the signals in the interface */
glade_xml_signal_autoconnect (xml);
gtk_widget_show (glade_xml_get_widget (xml, "about"));
}
void on_gstplay_destroy (GtkWidget *widget, gpointer data)
void
on_gstplay_destroy (GtkWidget *widget, gpointer data)
{
gst_main_quit();
gtk_main_quit();
}

View file

@ -205,6 +205,8 @@ gst_media_play_init (GstMediaPlay *mplay)
gtk_widget_show (GTK_WIDGET (mplay->play));
gtk_widget_show (GTK_WIDGET (glade_xml_get_widget (mplay->xml, "gstplay")));
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_playtime (mplay->status, "00:00 / 00:00");

View file

@ -14,7 +14,7 @@
<property name="wmclass_name">gstmediaplay</property>
<property name="wmclass_class">GstMediaPlay</property>
<property name="enable_layout_config">yes</property>
<property name="visible">yes</property>
<property name="visible">no</property>
<property name="window-position">GTK_WIN_POS_CENTER</property>
<signal name="delete_event" handler="on_gst_media_play_delete_event" />
@ -430,14 +430,6 @@
<signal name="toggled" handler="on_toggle_stop_toggled" />
</widget>
</child>
<child>
<widget class="button" id="button1">
<property name="label" translatable="yes">button1</property>
<property name="icon">play.xpm</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -658,18 +650,20 @@ Arik Devens &lt;arik@gnome.org&gt;
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="visible">yes</property>
<child>
<widget class="GtkTreeView" id="playlist_clist">
<widget class="GtkCList" id="playlist_clist">
<property name="can_focus">yes</property>
<property name="headers-visible">yes</property>
<property name="column_widths">273,80</property>
<property name="selection_mode">GTK_SELECTION_SINGLE</property>
<property name="show_titles">yes</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="n_columns">2</property>
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="track_name">
<property name="child_name">CList:title</property>
<property name="label" translatable="yes">track name</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">no</property>
@ -683,7 +677,6 @@ Arik Devens &lt;arik@gnome.org&gt;
<child>
<widget class="GtkLabel" id="track_lengthe">
<property name="child_name">CList:title</property>
<property name="label" translatable="yes">track length</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">no</property>

View file

@ -7,7 +7,6 @@
#include <gtk/gtkmain.h>
#include "gstplay.h"
#include "gstplayprivate.h"
static void gst_play_class_init (GstPlayClass *klass);
static void gst_play_init (GstPlay *play);
@ -43,6 +42,28 @@ enum {
static GtkObject *parent_class = NULL;
static guint gst_play_signals[LAST_SIGNAL] = {0};
struct _GstPlayPrivate {
GstElement *pipeline;
GstElement *video_element, *audio_element;
GstElement *video_show;
GtkWidget *video_widget;
GstElement *src;
GstElement *cache;
GstElement *typefind;
guchar *uri;
gboolean muted;
gboolean can_seek;
GstElement *offset_element;
GstElement *bit_rate_element;
GstElement *media_time_element;
GstElement *current_time_element;
guint source_width;
guint source_height;
};
GtkType
gst_play_get_type (void)
{
@ -218,30 +239,24 @@ static void
gst_play_have_size (GstElement *element, guint width, guint height,
GstPlay *play)
{
GstPlayPrivate *priv;
play->priv->source_width = width;
play->priv->source_height = height;
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 (play->priv->video_widget, width, height);
}
static void
gst_play_frame_displayed (GstElement *element, GstPlay *play)
{
GstPlayPrivate *priv;
static int stolen = FALSE;
priv = (GstPlayPrivate *)play->priv;
gdk_threads_enter ();
if (!stolen) {
gtk_widget_realize (priv->video_widget);
gtk_socket_steal (GTK_SOCKET (priv->video_widget),
gst_util_get_int_arg (G_OBJECT (priv->video_show), "xid"));
gtk_widget_show (priv->video_widget);
gtk_widget_realize (play->priv->video_widget);
gtk_socket_steal (GTK_SOCKET (play->priv->video_widget),
gst_util_get_int_arg (
G_OBJECT (play->priv->video_show), "xid"));
gtk_widget_show (play->priv->video_widget);
stolen = TRUE;
}
gdk_threads_leave ();
@ -269,10 +284,9 @@ gst_play_object_introspect (GstObject *object, const gchar *property, GstElement
element = GST_ELEMENT (object);
#warning this looks grim, did I port it right ?
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), property);
if (!pspec) {
if (pspec) {
*target = element;
GST_DEBUG(0, "gstplay: using element \"%s\" for %s property\n",
gst_element_get_name(element), property);
@ -310,36 +324,33 @@ gst_play_object_introspect (GstObject *object, const gchar *property, GstElement
static void
gst_play_object_added (GstAutoplug* autoplug, GstObject *object, GstPlay *play)
{
GstPlayPrivate *priv;
g_return_if_fail (play != NULL);
priv = (GstPlayPrivate *)play->priv;
if (GST_FLAG_IS_SET (object, GST_ELEMENT_NO_SEEK)) {
priv->can_seek = FALSE;
}
if (GST_FLAG_IS_SET (object, GST_ELEMENT_NO_SEEK))
play->priv->can_seek = FALSE;
// first come first serve here...
if (!priv->offset_element)
gst_play_object_introspect (object, "offset", &priv->offset_element);
if (!priv->bit_rate_element)
gst_play_object_introspect (object, "bit_rate", &priv->bit_rate_element);
if (!priv->media_time_element)
gst_play_object_introspect (object, "media_time", &priv->media_time_element);
if (!priv->current_time_element)
gst_play_object_introspect (object, "current_time", &priv->current_time_element);
if (!play->priv->offset_element)
gst_play_object_introspect (object, "offset",
&play->priv->offset_element);
if (!play->priv->bit_rate_element)
gst_play_object_introspect (object, "bit_rate",
&play->priv->bit_rate_element);
if (!play->priv->media_time_element)
gst_play_object_introspect (object, "media_time",
&play->priv->media_time_element);
if (!play->priv->current_time_element)
gst_play_object_introspect (object, "current_time",
&play->priv->current_time_element);
}
static void
gst_play_cache_empty (GstElement *element, GstPlay *play)
{
GstPlayPrivate *priv;
GstPlayPrivate *priv = play->priv;
GstElement *new_element;
priv = (GstPlayPrivate *)play->priv;
gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
new_element = gst_bin_get_by_name (GST_BIN (priv->pipeline), "new_element");
@ -355,14 +366,12 @@ gst_play_cache_empty (GstElement *element, GstPlay *play)
static void
gst_play_have_type (GstElement *sink, GstCaps *caps, GstPlay *play)
{
GstPlayPrivate *priv;
GstElement *new_element;
GstAutoplug *autoplug;
GstPlayPrivate *priv = play->priv;
GST_DEBUG (0,"GstPipeline: play have type\n");
priv = (GstPlayPrivate *)play->priv;
gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
gst_element_disconnect (priv->cache, "src", priv->typefind, "sink");
@ -398,6 +407,7 @@ gst_play_have_type (GstElement *sink, GstCaps *caps, GstPlay *play)
gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
}
#if 0
static gboolean
connect_pads (GstElement *new_element, GstElement *target, gboolean add)
{
@ -420,6 +430,7 @@ connect_pads (GstElement *new_element, GstElement *target, gboolean add)
}
return FALSE;
}
#endif
GstPlayReturn
gst_play_set_uri (GstPlay *play, const guchar *uri)
@ -441,22 +452,20 @@ gst_play_set_uri (GstPlay *play, const guchar *uri)
priv->src = gst_elementfactory_make ("gnomevfssrc", "srcelement");
if (!priv->src) {
if (strstr (uri, "file:/")) {
uri += strlen ("file:/");
}
if (strstr (uri, "file:/"))
uri += strlen ("file:/");
else
return GST_PLAY_CANNOT_PLAY;
}
}
if (priv->src == NULL) {
if (!priv->src)
priv->src = gst_elementfactory_make ("filesrc", "srcelement");
}
priv->uri = g_strdup (uri);
//priv->src = gst_elementfactory_make ("dvdsrc", "disk_src");
priv->offset_element = priv->src;
/* priv->src = gst_elementfactory_make ("dvdsrc", "disk_src"); */
g_return_val_if_fail (priv->src != NULL, GST_PLAY_CANNOT_PLAY);
g_object_set (G_OBJECT (priv->src), "location", priv->uri, NULL);
@ -486,23 +495,18 @@ gst_play_set_uri (GstPlay *play, const guchar *uri)
static void
gst_play_realize (GtkWidget *widget)
{
GstPlay *play;
GstPlayPrivate *priv;
GstPlay *play = GST_PLAY (widget);
g_return_if_fail (GST_IS_PLAY (widget));
g_return_if_fail (play != NULL);
//g_print ("realize\n");
play = GST_PLAY (widget);
priv = (GstPlayPrivate *)play->priv;
play->priv->video_widget = gtk_socket_new ();
priv->video_widget = gtk_socket_new ();
gtk_container_add (GTK_CONTAINER (widget), priv->video_widget);
gtk_container_add (GTK_CONTAINER (widget), play->priv->video_widget);
if (GTK_WIDGET_CLASS (parent_class)->realize) {
if (GTK_WIDGET_CLASS (parent_class)->realize)
GTK_WIDGET_CLASS (parent_class)->realize (widget);
}
//gtk_socket_steal (GTK_SOCKET (priv->video_widget),
// gst_util_get_int_arg (GTK_OBJECT(priv->video_element), "xid"));
@ -515,14 +519,13 @@ gst_play_realize (GtkWidget *widget)
void
gst_play_play (GstPlay *play)
{
GstPlayPrivate *priv;
GstPlayPrivate *priv = play->priv;
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
priv = (GstPlayPrivate *)play->priv;
if (play->state == GST_PLAY_PLAYING) return;
if (play->state == GST_PLAY_PLAYING)
return;
if (play->state == GST_PLAY_STOPPED)
gst_element_set_state (GST_ELEMENT (priv->pipeline),GST_STATE_READY);
@ -538,14 +541,13 @@ gst_play_play (GstPlay *play)
void
gst_play_pause (GstPlay *play)
{
GstPlayPrivate *priv;
GstPlayPrivate *priv = play->priv;
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
priv = (GstPlayPrivate *)play->priv;
if (play->state != GST_PLAY_PLAYING) return;
if (play->state != GST_PLAY_PLAYING)
return;
gst_element_set_state (GST_ELEMENT (priv->pipeline), GST_STATE_PAUSED);
@ -559,19 +561,18 @@ gst_play_pause (GstPlay *play)
void
gst_play_stop (GstPlay *play)
{
GstPlayPrivate *priv;
GstPlayPrivate *priv = play->priv;
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
priv = (GstPlayPrivate *)play->priv;
if (play->state == GST_PLAY_STOPPED)
return;
if (play->state == GST_PLAY_STOPPED) return;
// FIXME until state changes are handled properly
/* FIXME until state changes are handled properly */
gst_element_set_state (GST_ELEMENT (priv->pipeline), GST_STATE_READY);
gtk_object_set (GTK_OBJECT (priv->src), "offset", 0, NULL);
//gst_element_set_state (GST_ELEMENT (priv->pipeline),GST_STATE_NULL);
g_object_set (G_OBJECT (priv->src), "offset", 0, NULL);
/* gst_element_set_state (GST_ELEMENT (priv->pipeline),GST_STATE_NULL); */
play->state = GST_PLAY_STOPPED;
g_idle_remove_by_data (priv->pipeline);
@ -583,67 +584,48 @@ gst_play_stop (GstPlay *play)
GtkWidget *
gst_play_get_video_widget (GstPlay *play)
{
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
priv = (GstPlayPrivate *)play->priv;
return priv->video_widget;
return play->priv->video_widget;
}
gint
gst_play_get_source_width (GstPlay *play)
{
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
priv = (GstPlayPrivate *)play->priv;
return priv->source_width;
return play->priv->source_width;
}
gint
gst_play_get_source_height (GstPlay *play)
{
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
priv = (GstPlayPrivate *)play->priv;
return priv->source_height;
return play->priv->source_height;
}
gulong
gst_play_get_media_size (GstPlay *play)
{
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
priv = (GstPlayPrivate *)play->priv;
return gst_util_get_long_arg (G_OBJECT (priv->src), "filesize");
if (gst_util_has_arg (G_OBJECT (play->priv->src),
"filesize", G_TYPE_INT64))
return gst_util_get_int64_arg (
G_OBJECT (play->priv->src), "filesize");
else
return 0;
}
gulong
gst_play_get_media_offset (GstPlay *play)
{
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
priv = (GstPlayPrivate *)play->priv;
if (priv->offset_element)
return gst_util_get_long_arg (G_OBJECT (priv->offset_element), "offset");
if (play->priv->offset_element)
return gst_util_get_long_arg (
G_OBJECT (play->priv->offset_element), "offset");
else
return 0;
}
@ -652,20 +634,19 @@ gulong
gst_play_get_media_total_time (GstPlay *play)
{
gulong total_time, bit_rate;
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
priv = (GstPlayPrivate *)play->priv;
if (play->priv->media_time_element)
return gst_util_get_long_arg (
G_OBJECT (play->priv->media_time_element), "media_time");
if (priv->media_time_element) {
return gst_util_get_long_arg (G_OBJECT (priv->media_time_element), "media_time");
}
if (!play->priv->bit_rate_element)
return 0;
if (priv->bit_rate_element == NULL) return 0;
bit_rate = gst_util_get_long_arg (G_OBJECT (priv->bit_rate_element), "bit_rate");
bit_rate = gst_util_get_long_arg (
G_OBJECT (play->priv->bit_rate_element), "bit_rate");
if (bit_rate)
total_time = (gst_play_get_media_size (play) * 8) / bit_rate;
@ -679,20 +660,20 @@ gulong
gst_play_get_media_current_time (GstPlay *play)
{
gulong current_time, bit_rate;
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
priv = (GstPlayPrivate *)play->priv;
if (priv->current_time_element) {
return gst_util_get_long_arg (G_OBJECT (priv->current_time_element), "current_time");
if (play->priv->current_time_element) {
return gst_util_get_long_arg (
G_OBJECT (play->priv->current_time_element),
"current_time");
}
if (priv->bit_rate_element == NULL) return 0;
if (!play->priv->bit_rate_element)
return 0;
bit_rate = gst_util_get_long_arg (G_OBJECT (priv->bit_rate_element), "bit_rate");
bit_rate = gst_util_get_long_arg (
G_OBJECT (play->priv->bit_rate_element), "bit_rate");
if (bit_rate)
current_time = (gst_play_get_media_offset (play) * 8) / bit_rate;
@ -705,40 +686,27 @@ gst_play_get_media_current_time (GstPlay *play)
gboolean
gst_play_media_can_seek (GstPlay *play)
{
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
priv = (GstPlayPrivate *)play->priv;
return priv->can_seek;
return play->priv->can_seek;
}
void
gst_play_media_seek (GstPlay *play, gulong offset)
{
GstPlayPrivate *priv;
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
priv = (GstPlayPrivate *)play->priv;
gtk_object_set (GTK_OBJECT (priv->src), "offset", offset, NULL);
if (play->priv->offset_element)
g_object_set (G_OBJECT (play->priv->src),
"offset", offset, NULL);
}
GstElement*
gst_play_get_pipeline (GstPlay *play)
{
GstPlayPrivate *priv;
g_return_val_if_fail (play != NULL, NULL);
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
priv = (GstPlayPrivate *)play->priv;
return GST_ELEMENT (priv->pipeline);
return GST_ELEMENT (play->priv->pipeline);
}
static void
@ -770,7 +738,7 @@ gst_play_get_arg (GtkObject *object, GtkArg *arg, guint id)
g_return_if_fail (arg != NULL);
play = GST_PLAY (object);
priv = (GstPlayPrivate *)play->priv;
priv = play->priv;
switch (id) {
case ARG_URI:

View file

@ -39,13 +39,14 @@ typedef enum {
GST_PLAY_TYPE_VIDEO = (1 << 1),
} GstPlayMediaTypeFlags;
typedef struct _GstPlayPrivate GstPlayPrivate;
struct _GstPlay {
GtkHBox parent;
GstPlayState state;
GstPlayState state;
GstPlayMediaTypeFlags flags;
gpointer priv;
GstPlayPrivate *priv;
};
#define GST_PLAY_STATE(play) ((play)->state)

View file

@ -1,30 +1 @@
#ifndef __GSTPLAY_PRIVATE_H__
#define __GSTPLAY_PRIVATE_H__
#include <gst/gst.h>
typedef struct _GstPlayPrivate GstPlayPrivate;
struct _GstPlayPrivate {
GstElement *pipeline;
GstElement *video_element, *audio_element;
GstElement *video_show;
GtkWidget *video_widget;
GstElement *src;
GstElement *cache;
GstElement *typefind;
guchar *uri;
gboolean muted;
gboolean can_seek;
GstElement *offset_element;
GstElement *bit_rate_element;
GstElement *media_time_element;
GstElement *current_time_element;
guint source_width;
guint source_height;
};
#endif /* __GSTPLAY_PRIVATE_H__ */
#error Bogus header

View file

@ -28,20 +28,24 @@ main (int argc, char *argv[])
if (argc > 1) {
int i;
//gst_media_play_show_playlist (play);
gst_media_play_start_uri (play, argv[1]);
gst_media_play_show_playlist (play);
gst_media_play_start_uri (play, argv [1]);
for (i=1;i<argc;i++) {
//gst_media_play_addto_playlist (play, argv[i]);
}
for (i = 1; i < argc; i++)
gst_media_play_addto_playlist (play, argv [i]);
}
#ifndef GST_DISABLE_LOADSAVE
xmlSaveFile ("gstmediaplay.gst", gst_xml_write (gst_play_get_pipeline (play->play)));
xmlSaveFile ("gstmediaplay.gst", gst_xml_write (
gst_play_get_pipeline (play->play)));
#endif
gdk_threads_enter();
#ifdef USE_GLIB2
gtk_main ();
#else
gst_main();
#endif
gdk_threads_leave();
return 0;

View file

@ -12,7 +12,15 @@ GST_LOADSAVE_SRC = gstreamer-compprep
endif
if USE_GLIB2
if HAVE_LIBGLADE_GNOME
GST_GUI_LAUNCH = gstreamer-guilaunch
gstreamer_guilaunch_CFLAGS = \
$(LIBGLADE_GNOME_CFLAGS) $(CFLAGS)
gstreamer_guilaunch_LDADD = \
$(LIBGLADE_GNOME_LIBS) $(LDADD)
else
GST_GUI_LAUNCH =
endif
else
GST_GUI_LAUNCH = gstreamer-guilaunch
endif

View file

@ -1,3 +1,4 @@
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@ -9,6 +10,12 @@
#include <glib.h>
#include <gtk/gtk.h>
#ifdef USE_GLIB2
#define GTK_ENABLE_BROKEN
#include <gtk/gtktree.h>
#include <gtk/gtktreeitem.h>
#undef GTK_ENABLE_BROKEN
#endif
#include <gst/gst.h>
GtkWidget *start_but, *pause_but, *parse_but, *status;
@ -604,13 +611,18 @@ pause_callback( GtkWidget *widget,
}
}
int main(int argc,char *argv[]) {
int
main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *parse_line, *pipe_combo, *notebook, *pane;
GtkWidget *tree_root, *tree_root_item, *page_scroll;
gst_init(&argc,&argv);
#ifdef USE_GLIB2
gtk_init (&argc, &argv);
#endif
gst_init (&argc, &argv);
/***** set up the GUI *****/
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

View file

@ -4,7 +4,7 @@
#include <string.h>
#include <stdlib.h>
static int launch_argc;
static int launch_argc;
static char **launch_argv;
#ifndef USE_GLIB2
@ -62,9 +62,7 @@ gboolean
idle_func (gpointer data)
{
if (!gst_bin_iterate (GST_BIN (data))) {
#ifndef USE_GLIB2
gtk_main_quit ();
#endif
gst_main_quit ();
g_print ("iteration ended\n");
return FALSE;
}
@ -174,12 +172,8 @@ main(int argc, char *argv[])
exit (-1);
}
g_idle_add(idle_func,pipeline);
#ifdef USE_GLIB2
g_main_loop_run (g_main_loop_new (NULL, FALSE));
#else
gtk_main();
#endif
g_idle_add (idle_func, pipeline);
gst_main ();
gst_element_set_state (pipeline, GST_STATE_NULL);
}