Commit 7f8d8fe8 authored by Erik Walthinsen's avatar Erik Walthinsen

Merged from GOBJECT1 to HEAD at 200106241

Original commit message from CVS:
Merged from GOBJECT1 to HEAD at 200106241
parent 27036196
......@@ -8,6 +8,8 @@
#undef HAVE_LC_MESSAGES
#undef HAVE_STPCPY
#undef USE_GLIB2
#undef PLUGINS_DIR
#undef PLUGINS_BUILDDIR
#undef PLUGINS_USE_BUILDDIR
......
......@@ -169,21 +169,62 @@ dnl Check for essential libraries first:
dnl ====================================
dnl Check for glib
AM_PATH_GLIB(1.2.0,,
AC_MSG_ERROR(Cannot find glib: Is glib-config in path?),
glib gmodule gthread)
dnl Put the glib flags into $LIBS and $CFLAGS since we always use them
CORE_LIBS="$GLIB_LIBS"
CORE_CFLAGS="$GLIB_CFLAGS"
AC_ARG_ENABLE(glib2,
[ --enable-glib2 enable the use of glib-2.0 and GObject if available],
[ case "${enableval}" in
yes) USE_GLIB2=yes ;;
no) USE_GLIB2=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-glib2) ;;
esac],
[:])
HAVE_OBJECT_MODEL=no
if test x$USE_GLIB2 = xyes; then
AC_MSG_CHECKING(glib-2.0)
PKG_CHECK_MODULES(GLIB2, glib-2.0 gobject-2.0 gthread-2.0 gmodule-2.0,
HAVE_GLIB2=yes,HAVE_GLIB2=yes)
if test x$HAVE_GLIB2 = xyes; then
CORE_LIBS="$GLIB2_LIBS"
CORE_CFLAGS="$GLIB2_CFLAGS"
AC_SUBST(GLIB2_LIBS)
AC_SUBST(GLIB2_CFLAGS)
dnl Check for gtk
AM_PATH_GTK(1.2.0,,
AC_MSG_ERROR(Cannot find gtk: Is gtk-config in path?))
dnl Put the gtk flags into $LIBS and $CFLAGS since we always use them
CORE_LIBS="$CORE_LIBS $GTK_LIBS"
CORE_CFLAGS="$CORE_CFLAGS $GTK_CFLAGS"
AC_DEFINE(USE_GLIB2)
HAVE_OBJECT_MODEL=yes
else
USE_GLIB2=no
HAVE_OBJECT_MODEL=no
fi
fi
AM_CONDITIONAL(USE_GLIB2, test "x$USE_GLIB2" = "xyes")
AC_SUBST(USE_GLIB2)
AM_CONDITIONAL(USE_GTK2, test "x$USE_GTK2" = "xyes")
AC_SUBST(USE_GTK2)
AM_CONDITIONAL(USE_GNOME2, test "x$USE_GNOME2" = "xyes")
AC_SUBST(USE_GNOME2)
if test x$HAVE_OBJECT_MODEL = xno; then
dnl Check for glib
AM_PATH_GLIB(1.2.0,,
AC_MSG_ERROR(Cannot find glib: Is glib-config in path?),
glib gmodule gthread)
dnl Put the glib flags into $LIBS and $CFLAGS since we always use them
CORE_LIBS="$GLIB_LIBS"
CORE_CFLAGS="$GLIB_CFLAGS"
dnl Check for gtk
AM_PATH_GTK(1.2.0,,
AC_MSG_ERROR(Cannot find gtk: Is gtk-config in path?))
dnl Put the gtk flags into $LIBS and $CFLAGS since we always use them
CORE_LIBS="$CORE_LIBS $GTK_LIBS"
CORE_CFLAGS="$CORE_CFLAGS $GTK_CFLAGS"
HAVE_OBJECT_MODEL=yes
fi
dnl Check for libxml
......@@ -381,19 +422,27 @@ AC_SUBST(GDK_PIXBUF_LIBS)
AC_SUBST(GDK_PIXBUF_CFLAGS)
dnl Check for libgnome
AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
if test x$GNOME_CONFIG = xno; then
AC_MSG_WARN(Couldn't find gnome-config: can't build editor or gstplay)
if test x$USE_GLIB2 = xyes; then
dnl we don't support gnome/gtk with glib2.0 yet
GNOME_LIBS=
GNOME_CFLAGS=
HAVE_GNOME=no
AC_MSG_WARN(gnome disabled for glib2.0)
else
GNOME_LIBS=`gnome-config --libs gnome gnomeui`
GNOME_CFLAGS=`gnome-config --cflags gnome gnomeui`
GHTTP_LIBS=`gnome-config --libs gnome gnomeui`
GHTTP_CFLAGS=`gnome-config --cflags gnome gnomeui`
HAVE_GNOME=yes
dnl Check for libgnome
AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
if test x$GNOME_CONFIG = xno; then
AC_MSG_WARN(Couldn't find gnome-config: can't build editor or gstplay)
GNOME_LIBS=
GNOME_CFLAGS=
HAVE_GNOME=no
else
GNOME_LIBS=`gnome-config --libs gnome gnomeui`
GNOME_CFLAGS=`gnome-config --cflags gnome gnomeui`
GHTTP_LIBS=`gnome-config --libs gnome gnomeui`
GHTTP_CFLAGS=`gnome-config --cflags gnome gnomeui`
HAVE_GNOME=yes
fi
fi
AC_SUBST(GNOME_LIBS)
AC_SUBST(GNOME_CFLAGS)
......@@ -401,57 +450,77 @@ AC_SUBST(GHTTP_LIBS)
dnl Check for libghttp
dnl FIXME: need to check for header
AC_CHECK_LIB(ghttp, ghttp_request_new,
[GHTTP_LIBS="-lghttp"
GST_HTTPSRC_GET_TYPE="gst_httpsrc_get_type"
HAVE_LIBGHTTP=yes
],
[AC_MSG_WARN(Cannot find libghttp: can't build gsthttpsrc)
GHTTP_LIBS=
GST_HTTPSRC_GET_TYPE=
HAVE_LIBGHTTP=no
],
$LIBS)
if test x$USE_GLIB2 = xyes; then
GHTTP_LIBS=
GST_HTTPSRC_GET_TYPE=
HAVE_LIBGHTTP=no
AC_MSG_WARN(ghttp disabled for glib2.0)
else
AC_CHECK_LIB(ghttp, ghttp_request_new,
[GHTTP_LIBS="-lghttp"
GST_HTTPSRC_GET_TYPE="gst_httpsrc_get_type"
HAVE_LIBGHTTP=yes
],
[AC_MSG_WARN(Cannot find libghttp: can't build gsthttpsrc)
GHTTP_LIBS=
GST_HTTPSRC_GET_TYPE=
HAVE_LIBGHTTP=no
],
$LIBS)
fi
AC_SUBST(GST_HTTPSRC_GET_TYPE)
dnl Check for libglade
HAVE_LIBGLADE_GNOME="no"
AC_PATH_PROG(LIBGLADE_CONFIG_PATH, libglade-config, no)
if test x$LIBGLADE_CONFIG_PATH = xno; then
AC_MSG_WARN(Couldn't find libglade-config - Can't build gstplay)
if test x$USE_GLIB2 = xyes; then
dnl no glade for glib2.0
LIBGLADE_GNOME_LIBS=
LIBGLADE_GNOME_CFLAGS=
AC_MSG_WARN(libglade disabled for glib2.0)
else
LIBGLADE_GNOME_LIBS=`libglade-config --libs gnome`
LIBGLADE_GNOME_CFLAGS=`libglade-config --cflags gnome`
libglade_save_CFLAGS="$CFLAGS"
libglade_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $LIBGLADE_GNOME_CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $LIBGLADE_GNOME_LIBS $GTK_LIBS"
AC_TRY_LINK([#include <glade/glade.h>],[glade_gnome_init();],
HAVE_LIBGLADE_GNOME="yes",
AC_MSG_WARN(
AC_PATH_PROG(LIBGLADE_CONFIG_PATH, libglade-config, no)
if test x$LIBGLADE_CONFIG_PATH = xno; then
AC_MSG_WARN(Couldn't find libglade-config - Can't build gstplay)
LIBGLADE_GNOME_LIBS=
LIBGLADE_GNOME_CFLAGS=
else
LIBGLADE_GNOME_LIBS=`libglade-config --libs gnome`
LIBGLADE_GNOME_CFLAGS=`libglade-config --cflags gnome`
libglade_save_CFLAGS="$CFLAGS"
libglade_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $LIBGLADE_GNOME_CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $LIBGLADE_GNOME_LIBS $GTK_LIBS"
AC_TRY_LINK([#include <glade/glade.h>],[glade_gnome_init();],
HAVE_LIBGLADE_GNOME="yes",
AC_MSG_WARN(
[Couldn't find gnome libraries for libglade - Can't build gstmediaplay and gsteditor])
)
CFLAGS="$libglade_save_CFLAGS"
LIBS="$libglade_save_LIBS"
CFLAGS="$libglade_save_CFLAGS"
LIBS="$libglade_save_LIBS"
fi
fi
AC_SUBST(LIBGLADE_GNOME_LIBS)
AC_SUBST(LIBGLADE_GNOME_CFLAGS)
dnl Check for Gnome VFS
HAVE_GNOME_VFS="no"
AC_MSG_CHECKING(for Gnome VFS)
if gnome-config --libs vfs > /dev/null 2>&1; then
if test x$USE_GLIB2 = xyes; then
VFS_LIBS=
VFS_CFLAGS=
AC_MSG_WARN(Gnome-VFS disabled for glib2.0)
else
AC_MSG_CHECKING(for Gnome VFS)
if gnome-config --libs vfs > /dev/null 2>&1; then
HAVE_GNOME_VFS="yes"
AC_MSG_RESULT(found)
else
VFS_LIBS="`gnome-config --libs vfs`"
VFS_CFLAGS="`gnome-config --cflags vfs`"
else
AC_MSG_WARN(Did not find Gnome-VFS installed)
VFS_LIBS=
VFS_CFLAGS=
fi
fi
VFS_LIBS="`gnome-config --libs vfs`"
VFS_CFLAGS="`gnome-config --cflags vfs`"
AC_SUBST(VFS_LIBS)
AC_SUBST(VFS_CFLAGS)
......@@ -459,15 +528,13 @@ dnl Check for Avifile
HAVE_AVIFILE="no"
AC_MSG_CHECKING(for Avifile)
if avifile-config --libs > /dev/null 2>&1; then
HAVE_AVIFILE="yes"
AC_MSG_RESULT(found)
HAVE_AVIFILE="yes"
AC_MSG_RESULT(found)
else
AC_MSG_WARN(Did not find Avifile installed)
AC_MSG_WARN(Did not find Avifile installed)
fi
AVIFILE_LIBS="`avifile-config --libs`"
AVIFILE_CFLAGS="`avifile-config --cflags`"
AC_SUBST(AVIFILE_LIBS)
AC_SUBST(AVIFILE_CFLAGS)
......@@ -1148,8 +1215,6 @@ gst/elements/Makefile
gst/autoplug/Makefile
libs/Makefile
libs/riff/Makefile
libs/colorspace/Makefile
libs/videoscale/Makefile
libs/getbits/Makefile
libs/putbits/Makefile
libs/idct/Makefile
......@@ -1164,6 +1229,7 @@ plugins/avi/Makefile
plugins/avi/wincodec/Makefile
plugins/avi/winaudio/Makefile
plugins/flx/Makefile
plugins/festival/Makefile
plugins/flac/Makefile
plugins/jpeg/Makefile
plugins/mp3decode/Makefile
......@@ -1219,6 +1285,7 @@ plugins/icecast/icecastsend/Makefile
plugins/effects/Makefile
plugins/effects/stereo/Makefile
plugins/effects/volume/Makefile
plugins/udp/Makefile
plugins/visualization/Makefile
plugins/visualization/spectrum/Makefile
plugins/visualization/vumeter/Makefile
......
some random ramblings about the event system:
Possible candidates for events
------------------------------
- QoS
- EOS
- Seek
- caps nego??
- bufferpool get??
- ...
Assumptions for events
----------------------
- They are tied to a pad.
- get rid of gst_pad_set_*_function (except for the chain/get ones)
- occur async to dataflow. (need locking?)
- fixed set of events only for core features. (elements cannot abuse
events for doing dataflow)
Questions
---------
limit the valid directions an event can travel in? ie. Can EOS only
travel downstream (left to right)?
eg. Seek travels upstream, but it makes sense to also make it travel
downstream (the case of a disksink, where we overwrite the header)
Setting an event function
-------------------------
void gst_pad_set_event_function (GstPad *pad, gint event_mask,
GstEventFunction *function);
event masks:
typedef enum {
GST_EVENT_EOS = (1 << 0),
GST_EVENT_QOS = (1 << 1),
GST_EVENT_SEEK = (1 << 2),
GST_EVENT_CAPS = (1 << 3),
} GstEventType;
Event structure
---------------
typedef struct {
GstEventType type;
GstEventMinorType minor;
guint64 timestamp; /* also sequence number ?? */
union {
/* EOS stuff */
/* QoS stuff */
/* Seek stuff */
GstSeekType type; /* time, bytes, ... */
gint64 offset;
gint64 lenth;
/* Caps stuff */
GstCaps *caps;
} data;
} GstEvent;
typedef enum {
GST_EVENT_MINOR_NONE,
/* EOS stuff */
/* QoS stuff */
/* Seek stuff */
GST_EVENT_MINOR_OFFSET,
GST_EVENT_MINOR_TIME,
/* caps nego stuff */
GST_EVENT_MINOR_CAPS_TRY,
GST_EVENT_MINOR_CAPS_START,
GST_EVENT_MINOR_CAPS_FINAL,
} GstEventMinorType;
Receiving events
----------------
a sample GstEventFunction, the event functions returns TRUE if the event is handled,
FALSE otherwise.
gboolean
gst_anelement_handle_event (GstPad *pad, GstEvent *event)
{
if (event->type == GST_EVENT_EOS) {
/* do something */
return TRUE;
}
else if (event->type == GST_EVENT_CAPS) {
if (event->minor == GST_EVENT_CAPS_TRY) {
/* try using this caps structure */
return TRUE; /* return FALSE to proxy ???*/
}
}
return FALSE;
}
Default event handler for pads
------------------------------
gboolean
gst_pad_handle_event (GstPad *pad, GstEvent *event)
{
GstElement *element;
GList *pads;
GstPad *srcpad;
gboolean result = TRUE;
GstPadDirection dir = GST_PAD_DIRECTION (pad);
g_return_val_if_fail (pad != NULL, FALSE);
g_return_val_if_fail (GST_IS_REAL_PAD(pad), FALSE); // NOTE the restriction
element = GST_ELEMENT (gst_object_get_parent (GST_OBJECT (pad)));
/* send out the events to all pad with opposite direction */
pads = gst_element_get_pad_list(element);
while (pads) {
otherpad = GST_PAD(pads->data);
pads = g_list_next(pads);
if (gst_pad_get_direction(otherpad) != dir) {
result &= gst_pad_send_event (GST_REAL_PAD(otherpad), event);
}
}
/* result is combined result of all handlers? */
return result;
}
......@@ -9,3 +9,9 @@ SUBDIRS = $(GNOME_SUBDS) \
helloworld helloworld2 \
queue queue2 queue3 queue4 \
launch thread xml plugins typefind mixer cutter
DIST_SUBDIRS = autoplug \
helloworld helloworld2 \
queue queue2 queue3 queue4 \
launch thread xml plugins typefind mixer cutter
......@@ -53,8 +53,8 @@ void cut_start (GstElement *element)
ct->tm_hour, ct->tm_min, ct->tm_sec);
}
g_print ("DEBUG: cut_start: setting new location to %s\n", buffer);
gtk_object_set (GTK_OBJECT (disksink), "location", buffer, NULL);
gtk_object_set (GTK_OBJECT (disksink), "type", 4, NULL);
g_object_set (G_OBJECT (disksink), "location", buffer, NULL);
g_object_set (G_OBJECT (disksink), "type", 4, NULL);
gst_element_set_state (main_bin, GST_STATE_PLAYING);
++id;
......@@ -78,7 +78,7 @@ void cut_stop (GstElement *element)
gst_element_set_state (main_bin, GST_STATE_PAUSED);
g_print ("DEBUG: cut_stop: setting new location\n");
gtk_object_set (GTK_OBJECT (disksink), "location", "/dev/null", NULL);
g_object_set (G_OBJECT (disksink), "location", "/dev/null", NULL);
gst_element_set_state (main_bin, GST_STATE_PLAYING);
g_print ("stop_cut_signal done\n");
......@@ -116,7 +116,7 @@ int main (int argc, char *argv[])
/* create cutter */
cutter = gst_elementfactory_make ("cutter", "cutter");
gtk_object_set (GTK_OBJECT (cutter),
g_object_set (G_OBJECT (cutter),
"threshold_dB", -40.0,
"runlength", 0.5,
NULL);
......@@ -126,14 +126,14 @@ int main (int argc, char *argv[])
/* set params */
gtk_object_set (GTK_OBJECT (audiosrc), "frequency", 44100,
g_object_set (G_OBJECT (audiosrc), "frequency", 44100,
"channels", 1,
"format", 16, NULL);
encoder = gst_elementfactory_make ("passthrough", "encoder");
disksink = gst_elementfactory_make ("afsink", "disk_sink");
gtk_object_set (GTK_OBJECT (disksink), "location", "/dev/null", NULL);
g_object_set (G_OBJECT (disksink), "location", "/dev/null", NULL);
thread = gst_thread_new ("thread");
g_assert (thread != NULL);
......@@ -168,10 +168,10 @@ int main (int argc, char *argv[])
/* set signal handlers */
g_print ("setting signal handlers\n");
gtk_signal_connect (GTK_OBJECT(cutter), "cut_start",
GTK_SIGNAL_FUNC(cut_start_signal), NULL);
gtk_signal_connect (GTK_OBJECT(cutter), "cut_stop",
GTK_SIGNAL_FUNC(cut_stop_signal), NULL);
g_signal_connectc (G_OBJECT(cutter), "cut_start",
(GCallback)cut_start_signal, NULL, FALSE);
g_signal_connectc (G_OBJECT(cutter), "cut_stop",
(GCallback)cut_stop_signal, NULL, FALSE);
/* start playing */
g_print ("setting to play\n");
......
......@@ -27,9 +27,9 @@ int main(int argc,char *argv[])
/* create a disk reader */
disksrc = gst_elementfactory_make("disksrc", "disk_source");
gtk_object_set(GTK_OBJECT(disksrc),"location", argv[1],NULL);
gtk_signal_connect(GTK_OBJECT(disksrc),"eos",
GTK_SIGNAL_FUNC(eos),NULL);
g_object_set(G_OBJECT(disksrc),"location", argv[1],NULL);
g_signal_connectc(G_OBJECT(disksrc),"eos",
G_CALLBACK(eos),NULL,FALSE);
/* now it's time to get the parser */
parse = gst_elementfactory_make("mp3parse","parse");
......
......@@ -32,9 +32,9 @@ int main(int argc,char *argv[])
/* create a disk reader */
disksrc = gst_elementfactory_make("disksrc", "disk_source");
g_assert(disksrc != NULL);
gtk_object_set(GTK_OBJECT(disksrc),"location", argv[1],NULL);
gtk_signal_connect(GTK_OBJECT(disksrc),"eos",
GTK_SIGNAL_FUNC(eos),NULL);
g_object_set(G_OBJECT(disksrc),"location", argv[1],NULL);
g_signal_connectc(G_OBJECT(disksrc),"eos",
G_CALLBACK(eos),NULL,FALSE);
/* and an audio sink */
osssink = gst_elementfactory_make("osssink", "play_audio");
......
......@@ -270,14 +270,14 @@ create_input_channel (int id, char* location)
g_assert(channel->disksrc != NULL);
GST_DEBUG(0, "c_i_p : setting location\n");
gtk_object_set(GTK_OBJECT(channel->disksrc),"location", location, NULL);
g_object_set(G_OBJECT(channel->disksrc),"location", location, NULL);
/* add disksrc to the bin before autoplug */
gst_bin_add(GST_BIN(channel->pipe), channel->disksrc);
/* connect signal to eos of disksrc */
gtk_signal_connect(GTK_OBJECT(channel->disksrc),"eos",
GTK_SIGNAL_FUNC(eos),NULL);
g_signal_connectc (G_OBJECT(channel->disksrc),"eos",
G_CALLBACK(eos),NULL,FALSE);
#ifdef DEBUG
......@@ -395,7 +395,7 @@ void env_register_cp (GstElement *volenv, double cp_time, double cp_level)
char buffer[30];
sprintf (buffer, "%f:%f", cp_time, cp_level);
gtk_object_set(GTK_OBJECT(volenv), "controlpoint", buffer, NULL);
g_object_set(G_OBJECT(volenv), "controlpoint", buffer, NULL);
}
......@@ -100,8 +100,8 @@ static void gst_example_init (GstExample *example);
static void gst_example_chain (GstPad *pad, GstBuffer *buf);
static void gst_example_set_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_example_get_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_example_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_example_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
/* These hold the constructed pad templates, which are created during
* plugin load, and used during element instantiation.
......@@ -123,29 +123,29 @@ static guint gst_example_signals[LAST_SIGNAL] = { 0 };
* register the type, providing the name of the class, struct sizes,
* and pointers to the various functions that define the class.
*/
GtkType
GType
gst_example_get_type(void)
{
static GtkType example_type = 0;
static GType example_type = 0;
if (!example_type) {
static const GtkTypeInfo example_info = {
"GstExample",
static const GTypeInfo example_info = {
sizeof(GstExampleClass), NULL,
NULL,
(GClassInitFunc)gst_example_class_init,
NULL,
NULL,
sizeof(GstExample),
sizeof(GstExampleClass),
(GtkClassInitFunc)gst_example_class_init,
(GtkObjectInitFunc)gst_example_init,
(GtkArgSetFunc)NULL, /* These last three are depracated */
(GtkArgGetFunc)NULL,
(GtkClassInitFunc)NULL,
0,
(GInstanceInitFunc)gst_example_init,
};
example_type = gtk_type_unique(GST_TYPE_ELEMENT,&example_info);
example_type = g_type_register_static(GST_TYPE_ELEMENT, "GstExample", &example_info, 0);
}
return example_type;
}
/* In order to create an instance of an object, the class must be
* initialized by this function. GtkObject will take care of running
* initialized by this function. GObject will take care of running
* it, based on the pointer to the function provided above.
*/
static void
......@@ -154,41 +154,40 @@ gst_example_class_init (GstExampleClass *klass)
/* Class pointers are needed to supply pointers to the private