Docs updates.

Original commit message from CVS:
Docs updates.
Added LICENSE info to headers/code where missing in gst directory
Added a bonobo wrapper for the media player (it shows up in gshell but
locks up when activating the component, anyone?)
Fixed some XML save/load problems with arguments.
This commit is contained in:
Wim Taymans 2000-11-11 15:13:50 +00:00
parent a9a7f77e07
commit ef31aa64e8
39 changed files with 1741 additions and 646 deletions

View file

@ -0,0 +1,8 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
bonobo-gstmediaplay

View file

@ -0,0 +1,32 @@
Gamesdir = $(datadir)/gnome/apps/Games
INCLUDES = -I$(top_srcdir)/gst \
-I$(top_srcdir)/gstplay \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DDATADIR=\""$(datadir)"\" \
-I$(includedir) \
$(BONOBOX_TEST_CFLAGS)
bin_PROGRAMS = bonobo-gstmediaplay
bonobo_gstmediaplay_SOURCES = \
bonobo-gstmediaplay.c
bonobo_gstmediaplay_CFLAGS = \
$(shell gnome-config --cflags gnomeui bonobo bonobox) $(shell libglade-config --cflags gnome) \
$(shell gstreamer-config --clfags )
bonobo_gstmediaplay_LDADD = \
$(top_srcdir)/gstplay/libgstmediaplay.la
bonobo_gstmediaplay_LDFLAGS = \
$(shell gnome-config --libs gnomeui bonobo bonobox) $(shell libglade-config --libs gnome) \
$(shell gstreamer-config --libs )
oafdir = $(datadir)/oaf
OAF_FILES = gstmediaplay.oafinfo
oaf_DATA = $(OAF_FILES)
EXTRA_DIST = gstmediaplay.desktop $(OAF_FILES) \
bonobo-gstmediaplay-ui.xml

View file

@ -0,0 +1,19 @@
<Root>
<commands>
<cmd name="NewGame" _label="New game" _tip="Start a new game"/>
<cmd name="OpenGame" _label="Open game" _tip="Load a saved game"/>
</commands>
<menu>
<submenu name="Game" _label="_Game">
<menuitem name="NewGame" verb=""/>
<menuitem name="OpenGame" verb=""/>
</submenu>
</menu>
<dockitem name="Game">
<toolitem name="NewGame" verb=""/>
</dockitem>
</Root>;

View file

@ -0,0 +1,445 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <gnome.h>
#include <liboaf/liboaf.h>
#include <bonobo.h>
#include "gstplay.h"
/*
* Number of running objects
*/
static int running_objects = 0;
static BonoboGenericFactory *factory = NULL;
/*
* BonoboControl data
*/
typedef struct {
BonoboControl *bonobo_object;
BonoboUIComponent *uic;
GstPlay *play;
} control_data_t;
/*
* This callback is invoked when the BonoboControl object
* encounters a fatal CORBA exception.
*/
static void
control_system_exception_cb (BonoboControl *control, CORBA_Object corba_object,
CORBA_Environment *ev, gpointer data)
{
bonobo_object_unref (BONOBO_OBJECT (control));
}
static void
control_update (control_data_t *control_data)
{
g_print("control_update\n", running_objects);
gtk_widget_queue_draw (GTK_WIDGET (control_data->play));
g_print("control_update done\n", running_objects);
}
static void
load_media (BonoboPersistStream *ps,
const Bonobo_Stream stream,
Bonobo_Persist_ContentType type,
void *closure,
CORBA_Environment *ev)
{
control_data_t *control_data = closure;
GstPlay *pl;
Bonobo_Stream_iobuf *buffer;
char *str;
int bx, by, j;
g_return_if_fail (control_data != NULL);
g_return_if_fail (control_data->play != NULL);
if (*type && g_strcasecmp (type, "application/x-gstmediaplay") != 0) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
pl = control_data->play;
bonobo_stream_client_read_string (stream, &str, ev);
if (ev->_major != CORBA_NO_EXCEPTION || str == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
sscanf (str, "%2u%2u\n", &bx, &by);
g_free (str);
if (bx > 128 || by > 128) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
for (j = 0; j < by; j++) {
int i;
Bonobo_Stream_read (stream, bx * 2 + 1, &buffer, ev);
if (ev->_major != CORBA_NO_EXCEPTION)
return;
else if (buffer->_length != bx * 2 + 1) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType,
NULL);
return;
}
CORBA_free (buffer);
}
control_update (control_data);
}
static void
save_media (BonoboPersistStream *ps,
const Bonobo_Stream stream,
Bonobo_Persist_ContentType type,
void *closure,
CORBA_Environment *ev)
{
control_data_t *control_data = closure;
GstPlay *pl;
char *data;
int j;
g_return_if_fail (control_data != NULL);
g_return_if_fail (control_data->play != NULL);
if (*type && g_strcasecmp (type, "application/x-gstmediaplay") != 0) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_WrongDataType, NULL);
return;
}
pl = control_data->play;
if (ev->_major != CORBA_NO_EXCEPTION)
return;
}
static Bonobo_Persist_ContentTypeList *
content_types (BonoboPersistStream *ps, void *closure, CORBA_Environment *ev)
{
return bonobo_persist_generate_content_types (1, "application/x-gstmediaplay");
}
/*
* When one of our controls is activated, we merge our menus
* in with our container's menus.
*/
static void
control_create_menus (control_data_t *control_data)
{
BonoboControl *control = control_data->bonobo_object;
Bonobo_UIContainer remote_uic;
GdkPixbuf *pixbuf;
static char ui [] =
"<Root>"
" <commands>"
" <cmd name=\"NewGame\" _label=\"New game\" _tip=\"Start a new game\"/>"
" <cmd name=\"OpenGame\" _label=\"Open game\" _tip=\"Load a saved game\"/>"
" </commands>"
" <menu>"
" <submenu name=\"Game\" _label=\"_Game\">"
" <menuitem name=\"NewGame\" verb=\"\"/>"
" <menuitem name=\"OpenGame\" verb=\"\"/>"
" </submenu>"
" </menu>"
" <dockitem name=\"Game\">"
" <toolitem name=\"NewGame\" verb=\"\"/>"
" </dockitem>"
"</Root>";
/*
* Get our container's UIContainer server.
*/
remote_uic = bonobo_control_get_remote_ui_container (control);
/*
* We have to deal gracefully with containers
* which don't have a UIContainer running.
*/
if (remote_uic == CORBA_OBJECT_NIL) {
g_warning ("No UI container!");
return;
}
/*
* Give our BonoboUIComponent object a reference to the
* container's UIContainer server.
*/
bonobo_ui_component_set_container (control_data->uic, remote_uic);
/*
* Unref the UI container we have been passed.
*/
bonobo_object_release_unref (remote_uic, NULL);
/* Set up the UI from the XML string. */
{
BonoboUINode *node;
node = bonobo_ui_node_from_string (ui);
bonobo_ui_util_translate_ui (node);
bonobo_ui_util_fixup_help (control_data->uic, node,
DATADIR, "gstmediaplay");
bonobo_ui_component_set_tree (control_data->uic, "/", node, NULL);
bonobo_ui_node_free (node);
}
}
static void
control_remove_menus (control_data_t *control_data)
{
bonobo_ui_component_unset_container (control_data->uic);
}
/*
* Clean up our supplementary BonoboControl data sturctures.
*/
static void
control_destroy_cb (BonoboControl *control, gpointer data)
{
control_data_t *control_data = (control_data_t *) data;
g_message ("control_destroy_cb");
control_data->play = NULL;
g_free (control_data);
running_objects--;
if (running_objects > 0)
return;
/*
* When the last object has gone, unref the factory & quit.
*/
bonobo_object_unref (BONOBO_OBJECT (factory));
gtk_main_quit ();
}
static void
control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
{
control_data_t *control_data = (control_data_t *) data;
g_message ("control_activate");
/*
* The ControlFrame has just asked the Control (that's us) to be
* activated or deactivated. We must reply to the ControlFrame
* and say whether or not we want our activation state to
* change. We are an acquiescent BonoboControl, so we just agree
* with whatever the ControlFrame told us. Most components
* should behave this way.
*/
bonobo_control_activate_notify (control, activate);
/*
* If we were just activated, we merge in our menu entries.
* If we were just deactivated, we remove them.
*/
if (activate)
control_create_menus (control_data);
else
control_remove_menus (control_data);
}
static void
control_set_frame_cb (BonoboControl *control, gpointer data)
{
g_message ("control_set frame cb");
control_create_menus ((control_data_t *) data);
g_message ("control_set frame cb done");
}
static void
update_control (GtkWidget *widget, control_data_t *control_data)
{
g_message ("update_control");
control_update (control_data);
}
static BonoboObject *
bonobo_gstmediaplay_factory (BonoboGenericFactory *this, void *data)
{
BonoboControl *bonobo_object;
control_data_t *control_data;
BonoboPersistStream *stream;
GtkWidget *vbox;
/*
* Create a data structure in which we can store
* Control-object-specific data about this document.
*/
control_data = g_new0 (control_data_t, 1);
if (control_data == NULL)
return NULL;
g_print("creating\n");
control_data->play = gst_play_new ();
g_print("created\n");
vbox = gtk_vbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (control_data->play),
TRUE, TRUE, 0);
gtk_widget_show_all (vbox);
/*
* Create the BonoboControl object.
*/
bonobo_object = bonobo_control_new (vbox);
if (bonobo_object == NULL) {
gtk_widget_destroy (vbox);
g_free (control_data);
return NULL;
}
control_data->bonobo_object = bonobo_object;
control_data->uic = bonobo_control_get_ui_component (bonobo_object);
/*
* When our container wants to activate this component, we will get
* the "activate" signal.
*/
gtk_signal_connect (GTK_OBJECT (bonobo_object), "activate",
GTK_SIGNAL_FUNC (control_activate_cb), control_data);
gtk_signal_connect (GTK_OBJECT (bonobo_object), "set_frame",
GTK_SIGNAL_FUNC (control_set_frame_cb), control_data);
/*
* The "system_exception" signal is raised when the BonoboControl
* encounters a fatal CORBA exception.
*/
gtk_signal_connect (GTK_OBJECT (bonobo_object), "system_exception",
GTK_SIGNAL_FUNC (control_system_exception_cb), control_data);
/*
* We'll need to be able to cleanup when this control gets
* destroyed.
*/
gtk_signal_connect (GTK_OBJECT (bonobo_object), "destroy",
GTK_SIGNAL_FUNC (control_destroy_cb), control_data);
/*
* Create the PersistStream object.
*/
stream = bonobo_persist_stream_new (load_media, save_media,
NULL, content_types,
control_data);
if (stream == NULL) {
bonobo_object_unref (BONOBO_OBJECT (bonobo_object));
gtk_widget_destroy (vbox);
g_free (control_data);
return NULL;
}
bonobo_object_add_interface (BONOBO_OBJECT (bonobo_object),
BONOBO_OBJECT (stream));
/*
* Add some verbs to the control.
*
* The container application will then have the programmatic
* ability to execute the verbs on the component. It will
* also provide a simple mechanism whereby the user can
* right-click on the component to create a popup menu
* listing the available verbs.
*
* We provide one simple verb whose job it is to clear the
* window.
*/
control_data->uic = bonobo_control_get_ui_component (bonobo_object);
/*
* Count the new running object
*/
running_objects++;
g_print("running objects: %d\n", running_objects);
return BONOBO_OBJECT (bonobo_object);
}
static void
init_gstmediaplay_factory (void)
{
printf("init factory\n");
factory = bonobo_generic_factory_new (
"OAFIID:bonobo_gstmediaplay_factory:420f20ca-55d7-4a33-b327-0b246136db18",
bonobo_gstmediaplay_factory, NULL);
}
static void
init_server_factory (int argc, char **argv)
{
CORBA_Environment ev;
CORBA_ORB orb;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
CORBA_exception_init (&ev);
gnome_init_with_popt_table("gstmediaplay", VERSION,
argc, argv,
oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
CORBA_exception_free (&ev);
if (bonobo_init (orb, NULL, NULL) == FALSE)
g_error (_("Could not initialize Bonobo!"));
}
int
main (int argc, char **argv)
{
gst_init (&argc, &argv);
/*
* Setup the factory.
*/
init_server_factory (argc, argv);
init_gstmediaplay_factory ();
/*
* Start processing.
*/
bonobo_main ();
return 0;
}

View file

@ -0,0 +1,20 @@
<oaf_info>
<oaf_server iid="OAFIID:bonobo_gstmediaplay_factory:420f20ca-55d7-4a33-b327-0b246136db18" type="exe" location="bonobo-gstmediaplay">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="GstMediaPlay control factory"/>
<oaf_attribute name="description" type="string" value="bonobo GstMediaPlay object factory"/>
</oaf_server>
<oaf_server iid="OAFIID:bonobo_gstmediaplay:b6735078-0a67-4db0-aba6-ce37ecb63ff2" type="factory" location="OAFIID:bonobo_gstmediaplay_factory:420f20ca-55d7-4a33-b327-0b246136db18">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="GstMediaPlay control"/>
<oaf_attribute name="description" type="string" value="bonobo GstMediaPlay object"/>
</oaf_server>
</oaf_info>

View file

@ -467,6 +467,7 @@ plugins/vorbis/Makefile
plugins/capture/Makefile plugins/capture/Makefile
plugins/capture/v4l/Makefile plugins/capture/v4l/Makefile
gstplay/Makefile gstplay/Makefile
components/bonobo-gstmediaplay/Makefile
test/Makefile test/Makefile
test/xml/Makefile test/xml/Makefile
test/bindings/Makefile test/bindings/Makefile

View file

@ -77,12 +77,14 @@ The maximum number of cothreads we are going to support.
<!-- ##### USER_FUNCTION cothread_func ##### --> <!-- ##### USER_FUNCTION cothread_func ##### -->
<para> <para>
the function that will be called when the cothread starts. the function that will be called when the cothread starts. The function
prototype is like a main() function, so you can do whatever you want with
it.
</para> </para>
@argc: @argc: a main-like argument count
@argv: @argv: a main-like array of arguments
@Returns: @Returns: a return code
<!-- ##### MACRO COTHREAD_STARTED ##### --> <!-- ##### MACRO COTHREAD_STARTED ##### -->

View file

@ -109,57 +109,55 @@ it, is there?
<!-- ##### MACRO GST_META_FLAGS ##### --> <!-- ##### MACRO GST_META_FLAGS ##### -->
<para> <para>
Retrieve the flags of the given meta information
</para> </para>
@meta: @meta: the meta information
<!-- # Unused Parameters # -->
@buf:
<!-- ##### MACRO GST_META_FLAG_IS_SET ##### --> <!-- ##### MACRO GST_META_FLAG_IS_SET ##### -->
<para> <para>
Check if a given flag is set
</para> </para>
@meta: @meta: the meta data to test
@flag: @flag: the flag to test
<!-- ##### MACRO GST_META_FLAG_SET ##### --> <!-- ##### MACRO GST_META_FLAG_SET ##### -->
<para> <para>
Set a flag in the meta data
</para> </para>
@meta: @meta: the meta data
@flag: @flag: the flag to set
<!-- ##### MACRO GST_META_FLAG_UNSET ##### --> <!-- ##### MACRO GST_META_FLAG_UNSET ##### -->
<para> <para>
Clear a flag in the meta data
</para> </para>
@meta: @meta: the meta data
@flag: @flag: the flag to clear
<!-- ##### ENUM GstMetaFlags ##### --> <!-- ##### ENUM GstMetaFlags ##### -->
<para> <para>
Flags indicating properties about the meta data
</para> </para>
@GST_META_FREEABLE: @GST_META_FREEABLE: the meta data can be freed
<!-- ##### STRUCT GstMeta ##### --> <!-- ##### STRUCT GstMeta ##### -->
<para> <para>
</para> </para>
@lock: @lock: for locking purposes
@flags: @flags: the flags of the meta data
@data: @data: the meta data
@size: @size: the size of the meta data
<!-- ##### FUNCTION gst_meta_new_size ##### --> <!-- ##### FUNCTION gst_meta_new_size ##### -->
<para> <para>
@ -172,10 +170,10 @@ it, is there?
<!-- ##### MACRO gst_meta_new ##### --> <!-- ##### MACRO gst_meta_new ##### -->
<para> <para>
Create new meta data
</para> </para>
@type: @type: the type of the meta data to create
<!-- ##### FUNCTION gst_meta_ref ##### --> <!-- ##### FUNCTION gst_meta_ref ##### -->

View file

@ -171,13 +171,6 @@
@Returns: @Returns:
<!-- ##### MACRO GST_SINESRC ##### -->
<para>
</para>
@obj:
<!-- ##### FUNCTION gst_object_get_type ##### --> <!-- ##### FUNCTION gst_object_get_type ##### -->
<para> <para>
@ -185,19 +178,19 @@
@Returns: @Returns:
<!-- ##### MACRO GST_SINESRC ##### -->
<para>
</para>
@obj:
<!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### --> <!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### -->
<para> <para>
</para> </para>
<!-- ##### MACRO GST_QUEUE_CLASS ##### -->
<para>
</para>
@klass:
<!-- ##### FUNCTION gst_audiosrc_get_type ##### --> <!-- ##### FUNCTION gst_audiosrc_get_type ##### -->
<para> <para>
@ -205,6 +198,13 @@
@Returns: @Returns:
<!-- ##### MACRO GST_QUEUE_CLASS ##### -->
<para>
</para>
@klass:
<!-- ##### MACRO GST_IS_QUEUE ##### --> <!-- ##### MACRO GST_IS_QUEUE ##### -->
<para> <para>
@ -356,6 +356,12 @@
</para> </para>
<!-- ##### STRUCT GstFakeSink ##### -->
<para>
</para>
<!-- ##### MACRO GST_THREAD_CLASS ##### --> <!-- ##### MACRO GST_THREAD_CLASS ##### -->
<para> <para>
@ -363,12 +369,6 @@
@klass: @klass:
<!-- ##### STRUCT GstFakeSink ##### -->
<para>
</para>
<!-- ##### MACRO GST_BIN_CLASS ##### --> <!-- ##### MACRO GST_BIN_CLASS ##### -->
<para> <para>
@ -403,16 +403,16 @@
@obj: @obj:
<!-- ##### SECTION ./tmpl/gstcolorspace.sgml:Title ##### -->
GstColorSpace
<!-- ##### STRUCT GstEsdSink ##### --> <!-- ##### STRUCT GstEsdSink ##### -->
<para> <para>
</para> </para>
<!-- ##### SECTION ./tmpl/gstcolorspace.sgml:Title ##### -->
GstColorSpace
<!-- ##### MACRO GST_PAD ##### --> <!-- ##### MACRO GST_PAD ##### -->
<para> <para>
@ -703,14 +703,14 @@ This macro unsets the given state on the element.
<!-- ##### MACRO GST_ESDSINK_CLASS ##### --> <!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
<para> <para>
</para> </para>
@klass: @klass:
<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### --> <!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
<para> <para>
</para> </para>
@ -1366,13 +1366,6 @@ Get the size of the current file.
</para> </para>
<!-- ##### FUNCTION gst_audiosink_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO GST_META ##### --> <!-- ##### MACRO GST_META ##### -->
<para> <para>
@ -1380,6 +1373,13 @@ Get the size of the current file.
@meta: @meta:
<!-- ##### FUNCTION gst_audiosink_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gst_httpsrc_get_type ##### --> <!-- ##### FUNCTION gst_httpsrc_get_type ##### -->
<para> <para>
@ -1421,12 +1421,6 @@ Get the size of the current file.
</para> </para>
<!-- ##### MACRO GST_TYPE_FILTER ##### -->
<para>
</para>
<!-- ##### MACRO GST_IS_SINESRC_CLASS ##### --> <!-- ##### MACRO GST_IS_SINESRC_CLASS ##### -->
<para> <para>
@ -1434,6 +1428,12 @@ Get the size of the current file.
@obj: @obj:
<!-- ##### MACRO GST_TYPE_FILTER ##### -->
<para>
</para>
<!-- ##### MACRO GST_IS_AUDIOSRC_CLASS ##### --> <!-- ##### MACRO GST_IS_AUDIOSRC_CLASS ##### -->
<para> <para>
@ -1511,10 +1511,6 @@ GstElement
@obj: @obj:
<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
<!-- ##### FUNCTION gst_audiosrc_push ##### --> <!-- ##### FUNCTION gst_audiosrc_push ##### -->
<para> <para>
@ -1522,6 +1518,10 @@ GstElement
@src: @src:
<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
<!-- ##### MACRO GST_HTTPSRC_CLASS ##### --> <!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
<para> <para>
@ -1637,15 +1637,15 @@ GstElement
@name: @name:
@Returns: @Returns:
<!-- ##### MACRO GST_TYPE_ESDSINK ##### -->
<para>
</para>
<!-- ##### MACRO GST_CPU_FLAG_MMX ##### --> <!-- ##### MACRO GST_CPU_FLAG_MMX ##### -->
<para> <para>
A flag indicating that MMX instructions are supported. A flag indicating that MMX instructions are supported.
</para> </para>
<!-- ##### MACRO GST_TYPE_ESDSINK ##### -->
<para>
</para>

View file

@ -54,19 +54,18 @@ valid mp3 decoder, and thus the whole point of the type system.
<!-- ##### USER_FUNCTION GstTypeFindFunc ##### --> <!-- ##### USER_FUNCTION GstTypeFindFunc ##### -->
<para> <para>
This is the function that will be called when a typefind has to be
performed by a plugin.
</para> </para>
@buf: @buf: the buffer with media on which to perform the typefind
@priv: @priv: private; don't touch
@Returns: @Returns: a boolean indicating if the typedetection was successfull
<!-- # Unused Parameters # -->
@private:
<!-- ##### STRUCT GstType ##### --> <!-- ##### STRUCT GstType ##### -->
<para> <para>
A type
</para> </para>
@id: @id:
@ -79,7 +78,7 @@ valid mp3 decoder, and thus the whole point of the type system.
<!-- ##### STRUCT GstTypeFactory ##### --> <!-- ##### STRUCT GstTypeFactory ##### -->
<para> <para>
The struct with the typefactory information
</para> </para>
@mime: @mime:

View file

@ -6,7 +6,7 @@ Utility functions
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
Some convenience functions
</para> </para>
<!-- ##### SECTION See_Also ##### --> <!-- ##### SECTION See_Also ##### -->

View file

@ -26,7 +26,7 @@ The different IDCT methods available
@GST_IDCT_FLOAT: accurate float version @GST_IDCT_FLOAT: accurate float version
@GST_IDCT_MMX: fast MMX (not IEEE compliant) @GST_IDCT_MMX: fast MMX (not IEEE compliant)
@GST_IDCT_MMX32: accurate MMX @GST_IDCT_MMX32: accurate MMX
@GST_IDCT_SSE: @GST_IDCT_SSE: fast SSE optimised IDCT
<!-- ##### STRUCT GstIDCT ##### --> <!-- ##### STRUCT GstIDCT ##### -->
<para> <para>

View file

@ -10,6 +10,13 @@
</sect1> </sect1>
<sect1>
<title>GstMediaPlay</title>
<para>
</para>
</sect1>
<sect1> <sect1>
<title>GstEditor</title> <title>GstEditor</title>
<para> <para>

View file

@ -1,6 +1,97 @@
<chapter id="cha-cothreads"> <chapter id="cha-cothreads">
<title>Cothreads</title> <title>Cothreads</title>
<para> <para>
Cothreads are user-space threads that greatly reduce context
switching overhead introduced by regular kernel threads.
Cothreads are also used to handle the more complex elements.
</para>
<para>
A cothread is created by a <classname>GstBin</classname> whenever an element is found
inside the bin that has one or more of the following properties:
<itemizedlist>
<listitem>
<para>
The element is loop-based instead of chain-based
</para>
</listitem>
<listitem>
<para>
The element has multiple input pads
</para>
</listitem>
<listitem>
<para>
The element has the MULTI_IN flag set
</para>
</listitem>
</itemizedlist>
The <classname>GstBin</classname> will create a cothread context for all the elements
in the bin so that the elements will interact in cooperative
multithreading.
</para>
<para>
Before proceding to the concept of loop-based elements we will first
explain the chain-based elements
</para> </para>
<sect1 id="sec-chain-based">
<title>Chain-based elements</title>
<para>
Chain based elements receive a buffer of data and are supposed
to handle the data and perform a gst_pad_push.
</para>
<para>
The basic main function of a chain-based element is like:
</para>
<programlisting>
static void chain_function (GstPad *pad, GstBuffer *buffer)
{
GstBuffer *outbuffer;
....
// process the buffer, create a new outbuffer
...
gst_pad_push (srcpad, outbuffer);
}
</programlisting>
</sect1>
<sect1 id="sec-loop-based">
<title>Loop-based elements</title>
<para>
As opposed to chain-based elements, Loop-based elements enter an
infinite loop that looks like this:
<programlisting>
GstBuffer *buffer, *outbuffer;
while (1) {
buffer = gst_pad_pull (sinkpad);
...
// process buffer, create outbuffer
...
gst_pad_push (srcpad, outbuffer);
}
</programlisting>
The loop-based elements request a buffer whenever they need one.
</para>
<para>
When the request for a buffer cannot immedialty satisfied, the control
will be given to the source element of the loop-based element until it
performs a push on its source pad. At that time the control is handed back
to the loop-based element, etc... The the execution trace can get fairly
complex using cothreads when there are multiple input/output pads for the
loop-based element.
</para>
<para>
There is no problem in putting cothreaded elements into a
<classname>GstThread</classname> to create even more complex pipelines with
both user and kernel space threads.
</para>
</sect1>
</chapter> </chapter>

View file

@ -66,9 +66,6 @@ int main(int argc,char *argv[])
exit(-1); exit(-1);
} }
/* find out how to handle this bin */
gst_bin_create_plan(GST_BIN(pipeline));
/* make it ready */ /* make it ready */
gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_READY); gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_READY);
/* start playing */ /* start playing */

View file

@ -103,4 +103,11 @@ gstreamer-launch disksrc redpill.vob ! css-descramble ! private_stream_1.0 ! \
</para> </para>
</sect1> </sect1>
<sect1>
<title><command>gstmediaplay</command></title>
<para>
A sample media player.
</para>
</sect1>
</chapter> </chapter>

View file

@ -1,3 +1,22 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <pthread.h> #include <pthread.h>
#include <sys/time.h> #include <sys/time.h>
#include <linux/linkage.h> #include <linux/linkage.h>
@ -15,6 +34,14 @@
pthread_key_t _cothread_key = -1; pthread_key_t _cothread_key = -1;
/**
* cothread_create:
* @ctx: the cothread context
*
* create a new cotread state in the given context
*
* Returns: the new cothread state
*/
cothread_state* cothread_state*
cothread_create (cothread_context *ctx) cothread_create (cothread_context *ctx)
{ {
@ -52,6 +79,15 @@ cothread_create (cothread_context *ctx)
return s; return s;
} }
/**
* cothread_setfunc:
* @thread: the cothread state
* @func: the function to call
* @argc: the argument count for the cothread function
* @argv: the arguments for the cothread function
*
* Set the cothread function
*/
void void
cothread_setfunc (cothread_state *thread, cothread_setfunc (cothread_state *thread,
cothread_func func, cothread_func func,
@ -64,6 +100,13 @@ cothread_setfunc (cothread_state *thread,
thread->pc = (int *)func; thread->pc = (int *)func;
} }
/**
* cothread_init:
*
* create and initialize a new cotread context
*
* Returns: the new cothread context
*/
cothread_context* cothread_context*
cothread_init (void) cothread_init (void)
{ {
@ -99,6 +142,12 @@ cothread_init (void)
return ctx; return ctx;
} }
/**
* cothread_main:
* @ctx: the cothread context
*
* Returns: the new cothread state
*/
cothread_state* cothread_state*
cothread_main(cothread_context *ctx) cothread_main(cothread_context *ctx)
{ {
@ -123,6 +172,14 @@ cothread_stub (void)
//printf("uh, yeah, we shouldn't be here, but we should deal anyway\n"); //printf("uh, yeah, we shouldn't be here, but we should deal anyway\n");
} }
/**
* cothread_set_data:
* @thread: the cothread state
* @key: a key for the data
* @data: the data
*
* adds data to a cothread
*/
void void
cothread_set_data (cothread_state *thread, cothread_set_data (cothread_state *thread,
gchar *key, gchar *key,
@ -133,6 +190,15 @@ cothread_set_data (cothread_state *thread,
g_hash_table_insert(ctx->data, key, data); g_hash_table_insert(ctx->data, key, data);
} }
/**
* cothread_get_data:
* @thread: the cothread state
* @key: a key for the data
*
* get data from the cothread
*
* Returns: the data assiciated with the key
*/
gpointer gpointer
cothread_get_data (cothread_state *thread, cothread_get_data (cothread_state *thread,
gchar *key) gchar *key)
@ -142,6 +208,12 @@ cothread_get_data (cothread_state *thread,
return g_hash_table_lookup(ctx->data, key); return g_hash_table_lookup(ctx->data, key);
} }
/**
* cothread_switch:
* @thread: the cothread state
*
* switches to the given cothread state
*/
void void
cothread_switch (cothread_state *thread) cothread_switch (cothread_state *thread)
{ {

View file

@ -1,6 +1,26 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __COTHREADS_H__ #ifndef __COTHREADS_H__
#define __COTHREADS_H__ #define __COTHREADS_H__
#include <glib.h>
#include <setjmp.h> #include <setjmp.h>
#include <pthread.h> #include <pthread.h>

View file

@ -139,14 +139,15 @@ GstElement *gst_queue_new(gchar *name) {
return queue; return queue;
} }
static void gst_queue_cleanup_buffers(gpointer data, gpointer user_data) static void gst_queue_cleanup_buffers(gpointer data, const gpointer user_data)
{ {
DEBUG("queue: %s cleaning buffer %p\n", (gchar *)user_data, data); DEBUG("queue: %s cleaning buffer %p\n", (gchar *)user_data, data);
gst_buffer_unref(GST_BUFFER(data));
gst_buffer_unref (GST_BUFFER (data));
} }
static void gst_queue_flush(GstQueue *queue) { static void gst_queue_flush(GstQueue *queue) {
g_slist_foreach(queue->queue, gst_queue_cleanup_buffers, gst_element_get_name(GST_ELEMENT(queue))); g_slist_foreach(queue->queue, gst_queue_cleanup_buffers, (char *)gst_element_get_name(GST_ELEMENT(queue)));
g_slist_free(queue->queue); g_slist_free(queue->queue);
queue->queue = NULL; queue->queue = NULL;
queue->level_buffers = 0; queue->level_buffers = 0;
@ -155,7 +156,7 @@ static void gst_queue_flush(GstQueue *queue) {
static void gst_queue_chain(GstPad *pad,GstBuffer *buf) { static void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
GstQueue *queue; GstQueue *queue;
gboolean tosignal = FALSE; gboolean tosignal = FALSE;
guchar *name; const guchar *name;
g_return_if_fail(pad != NULL); g_return_if_fail(pad != NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_if_fail(GST_IS_PAD(pad));
@ -215,7 +216,7 @@ static void gst_queue_push(GstConnection *connection) {
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
GSList *front; GSList *front;
gboolean tosignal = FALSE; gboolean tosignal = FALSE;
guchar *name; const guchar *name;
name = gst_element_get_name(GST_ELEMENT(queue)); name = gst_element_get_name(GST_ELEMENT(queue));

View file

@ -1,3 +1,22 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GST_HGUARD_GSTARCH_H #ifndef GST_HGUARD_GSTARCH_H
#define GST_HGUARD_GSTARCH_H #define GST_HGUARD_GSTARCH_H

View file

@ -516,7 +516,7 @@ gst_bin_loopfunc_wrapper (int argc,char *argv[])
GList *pads; GList *pads;
GstPad *pad; GstPad *pad;
GstBuffer *buf; GstBuffer *buf;
G_GNUC_UNUSED gchar *name = gst_element_get_name (element); G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
DEBUG("** gst_bin_loopfunc_wrapper(%d,\"%s\")\n", DEBUG("** gst_bin_loopfunc_wrapper(%d,\"%s\")\n",
argc,gst_element_get_name (element)); argc,gst_element_get_name (element));

View file

@ -18,22 +18,20 @@
*/ */
//#define DEBUG_ENABLED
#include <gst/gst.h>
#include <gst/gstbuffer.h> #include <gst/gstbuffer.h>
//#define DEBUG(format,args...) g_print("DEBUG: " format, ##args)
#define DEBUG(format,args...)
GMemChunk *_gst_buffer_chunk; GMemChunk *_gst_buffer_chunk;
void
void _gst_buffer_initialize() { _gst_buffer_initialize (void)
_gst_buffer_chunk = g_mem_chunk_new("GstBuffer",sizeof(GstBuffer), {
sizeof(GstBuffer)*16,G_ALLOC_AND_FREE); _gst_buffer_chunk = g_mem_chunk_new ("GstBuffer", sizeof(GstBuffer),
sizeof(GstBuffer) * 16, G_ALLOC_AND_FREE);
} }
/** /**
* gst_buffer_new: * gst_buffer_new:
* *
@ -41,16 +39,18 @@ void _gst_buffer_initialize() {
* *
* Returns: new buffer * Returns: new buffer
*/ */
GstBuffer *gst_buffer_new() { GstBuffer*
gst_buffer_new(void)
{
GstBuffer *buffer; GstBuffer *buffer;
buffer = g_mem_chunk_alloc(_gst_buffer_chunk); buffer = g_mem_chunk_alloc (_gst_buffer_chunk);
DEBUG("BUF: allocating new buffer %p\n",buffer); DEBUG("BUF: allocating new buffer %p\n",buffer);
// g_print("allocating new mutex\n"); // g_print("allocating new mutex\n");
buffer->lock = g_mutex_new(); buffer->lock = g_mutex_new ();
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
atomic_set(&buffer->refcount,1); atomic_set (&buffer->refcount, 1);
#else #else
buffer->refcount = 1; buffer->refcount = 1;
#endif #endif
@ -64,6 +64,7 @@ GstBuffer *gst_buffer_new() {
buffer->metas = NULL; buffer->metas = NULL;
buffer->parent = NULL; buffer->parent = NULL;
buffer->pool = NULL; buffer->pool = NULL;
return buffer; return buffer;
} }
@ -75,9 +76,10 @@ GstBuffer *gst_buffer_new() {
* *
* Returns: new buffer * Returns: new buffer
*/ */
GstBuffer *gst_buffer_new_from_pool(GstBufferPool *pool) GstBuffer*
gst_buffer_new_from_pool (GstBufferPool *pool)
{ {
return gst_buffer_pool_new_buffer(pool); return gst_buffer_pool_new_buffer (pool);
} }
/** /**
@ -90,19 +92,23 @@ GstBuffer *gst_buffer_new_from_pool(GstBufferPool *pool)
* *
* Returns: new buffer * Returns: new buffer
*/ */
GstBuffer *gst_buffer_create_sub(GstBuffer *parent,guint32 offset,guint32 size) { GstBuffer*
gst_buffer_create_sub (GstBuffer *parent,
guint32 offset,
guint32 size)
{
GstBuffer *buffer; GstBuffer *buffer;
g_return_val_if_fail(parent != NULL, NULL); g_return_val_if_fail (parent != NULL, NULL);
g_return_val_if_fail(size > 0, NULL); g_return_val_if_fail (size > 0, NULL);
g_return_val_if_fail((offset+size) <= parent->size, NULL); g_return_val_if_fail ((offset+size) <= parent->size, NULL);
buffer = g_mem_chunk_alloc(_gst_buffer_chunk); buffer = g_mem_chunk_alloc (_gst_buffer_chunk);
DEBUG("BUF: allocating new subbuffer %p, parent %p\n",buffer,parent); DEBUG("BUF: allocating new subbuffer %p, parent %p\n", buffer, parent);
buffer->lock = g_mutex_new(); buffer->lock = g_mutex_new ();
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
atomic_set(&buffer->refcount,1); atomic_set (&buffer->refcount, 1);
#else #else
buffer->refcount = 1; buffer->refcount = 1;
#endif #endif
@ -125,7 +131,7 @@ GstBuffer *gst_buffer_create_sub(GstBuffer *parent,guint32 offset,guint32 size)
// set parentage and reference the parent // set parentage and reference the parent
buffer->parent = parent; buffer->parent = parent;
gst_buffer_ref(parent); gst_buffer_ref (parent);
buffer->pool = NULL; buffer->pool = NULL;
// return the new subbuffer // return the new subbuffer
@ -142,33 +148,36 @@ GstBuffer *gst_buffer_create_sub(GstBuffer *parent,guint32 offset,guint32 size)
* *
* Returns: new buffer * Returns: new buffer
*/ */
GstBuffer *gst_buffer_append(GstBuffer *buffer, GstBuffer *append) { GstBuffer*
gst_buffer_append (GstBuffer *buffer,
GstBuffer *append)
{
guint size; guint size;
GstBuffer *newbuf; GstBuffer *newbuf;
g_return_val_if_fail(buffer != NULL, NULL); g_return_val_if_fail (buffer != NULL, NULL);
g_return_val_if_fail(append != NULL, NULL); g_return_val_if_fail (append != NULL, NULL);
g_return_val_if_fail(buffer->pool == NULL, NULL); g_return_val_if_fail (buffer->pool == NULL, NULL);
GST_BUFFER_LOCK(buffer); GST_BUFFER_LOCK (buffer);
// the buffer is not used by anyone else // the buffer is not used by anyone else
if (GST_BUFFER_REFCOUNT(buffer) == 1 && buffer->parent == NULL) { if (GST_BUFFER_REFCOUNT (buffer) == 1 && buffer->parent == NULL) {
// save the old size // save the old size
size = buffer->size; size = buffer->size;
buffer->size += append->size; buffer->size += append->size;
buffer->data = g_realloc(buffer->data, buffer->size); buffer->data = g_realloc (buffer->data, buffer->size);
memcpy(buffer->data + size, append->data, append->size); memcpy(buffer->data + size, append->data, append->size);
GST_BUFFER_UNLOCK(buffer); GST_BUFFER_UNLOCK (buffer);
} }
// the buffer is used, create a new one // the buffer is used, create a new one
else { else {
newbuf = gst_buffer_new(); newbuf = gst_buffer_new ();
newbuf->size = buffer->size+append->size; newbuf->size = buffer->size+append->size;
newbuf->data = g_malloc(newbuf->size); newbuf->data = g_malloc (newbuf->size);
memcpy(newbuf->data, buffer->data, buffer->size); memcpy (newbuf->data, buffer->data, buffer->size);
memcpy(newbuf->data+buffer->size, append->data, append->size); memcpy (newbuf->data+buffer->size, append->data, append->size);
GST_BUFFER_UNLOCK(buffer); GST_BUFFER_UNLOCK (buffer);
gst_buffer_unref(buffer); gst_buffer_unref (buffer);
buffer = newbuf; buffer = newbuf;
} }
return buffer; return buffer;
@ -180,43 +189,44 @@ GstBuffer *gst_buffer_append(GstBuffer *buffer, GstBuffer *append) {
* *
* destroy the buffer * destroy the buffer
*/ */
void gst_buffer_destroy(GstBuffer *buffer) { void gst_buffer_destroy (GstBuffer *buffer)
{
GSList *metas; GSList *metas;
g_return_if_fail(buffer != NULL); g_return_if_fail (buffer != NULL);
if (buffer->parent != NULL) { if (buffer->parent != NULL) {
DEBUG("BUF: freeing subbuffer %p\n",buffer); DEBUG("BUF: freeing subbuffer %p\n", buffer);
} }
else { else {
DEBUG("BUF: freeing buffer %p\n",buffer); DEBUG("BUF: freeing buffer %p\n", buffer);
} }
// free the data only if there is some, DONTFREE isn't set, and not sub // free the data only if there is some, DONTFREE isn't set, and not sub
if (GST_BUFFER_DATA(buffer) && if (GST_BUFFER_DATA (buffer) &&
!GST_BUFFER_FLAG_IS_SET(buffer,GST_BUFFER_DONTFREE) && !GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DONTFREE) &&
(buffer->parent == NULL)) { (buffer->parent == NULL)) {
g_free(GST_BUFFER_DATA(buffer)); g_free (GST_BUFFER_DATA (buffer));
// g_print("freed data in buffer\n"); // g_print("freed data in buffer\n");
} }
// unreference any metadata attached to this buffer // unreference any metadata attached to this buffer
metas = buffer->metas; metas = buffer->metas;
while (metas) { while (metas) {
gst_meta_unref((GstMeta *)(metas->data)); gst_meta_unref ((GstMeta *)(metas->data));
metas = g_slist_next(metas); metas = g_slist_next (metas);
} }
g_slist_free(buffer->metas); g_slist_free (buffer->metas);
// unreference the parent if there is one // unreference the parent if there is one
if (buffer->parent != NULL) if (buffer->parent != NULL)
gst_buffer_unref(buffer->parent); gst_buffer_unref (buffer->parent);
g_mutex_free(buffer->lock); g_mutex_free (buffer->lock);
//g_print("freed mutex\n"); //g_print("freed mutex\n");
// remove it entirely from memory // remove it entirely from memory
g_mem_chunk_free(_gst_buffer_chunk,buffer); g_mem_chunk_free (_gst_buffer_chunk,buffer);
} }
/** /**
@ -225,19 +235,21 @@ void gst_buffer_destroy(GstBuffer *buffer) {
* *
* increment the refcount of this buffer * increment the refcount of this buffer
*/ */
void gst_buffer_ref(GstBuffer *buffer) { void
g_return_if_fail(buffer != NULL); gst_buffer_ref (GstBuffer *buffer)
{
g_return_if_fail (buffer != NULL);
DEBUG("BUF: referencing buffer %p\n",buffer); DEBUG("BUF: referencing buffer %p\n", buffer);
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
//g_return_if_fail(atomic_read(&(buffer->refcount)) > 0); //g_return_if_fail(atomic_read(&(buffer->refcount)) > 0);
atomic_inc(&(buffer->refcount)) atomic_inc (&(buffer->refcount))
#else #else
g_return_if_fail(buffer->refcount > 0); g_return_if_fail (buffer->refcount > 0);
GST_BUFFER_LOCK(buffer); GST_BUFFER_LOCK (buffer);
buffer->refcount++; buffer->refcount++;
GST_BUFFER_UNLOCK(buffer); GST_BUFFER_UNLOCK (buffer);
#endif #endif
} }
@ -248,18 +260,20 @@ void gst_buffer_ref(GstBuffer *buffer) {
* *
* increment the refcount of this buffer with count * increment the refcount of this buffer with count
*/ */
void gst_buffer_ref_by_count(GstBuffer *buffer,int count) { void
g_return_if_fail(buffer != NULL); gst_buffer_ref_by_count (GstBuffer *buffer, int count)
g_return_if_fail(count > 0); {
g_return_if_fail (buffer != NULL);
g_return_if_fail (count > 0);
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
g_return_if_fail(atomic_read(&(buffer->refcount)) > 0); g_return_if_fail (atomic_read (&(buffer->refcount)) > 0);
atomic_add(count,&(buffer->refcount)) atomic_add (count, &(buffer->refcount))
#else #else
g_return_if_fail(buffer->refcount > 0); g_return_if_fail (buffer->refcount > 0);
GST_BUFFER_LOCK(buffer); GST_BUFFER_LOCK (buffer);
buffer->refcount += count; buffer->refcount += count;
GST_BUFFER_UNLOCK(buffer); GST_BUFFER_UNLOCK (buffer);
#endif #endif
} }
@ -270,33 +284,35 @@ void gst_buffer_ref_by_count(GstBuffer *buffer,int count) {
* decrement the refcount of this buffer. If the refcount is * decrement the refcount of this buffer. If the refcount is
* zero, the buffer will be destroyed. * zero, the buffer will be destroyed.
*/ */
void gst_buffer_unref(GstBuffer *buffer) { void
int zero; gst_buffer_unref (GstBuffer *buffer)
{
gint zero;
g_return_if_fail(buffer != NULL); g_return_if_fail (buffer != NULL);
DEBUG("BUF: unreferencing buffer %p\n",buffer); DEBUG("BUF: unreferencing buffer %p\n", buffer);
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
g_return_if_fail(atomic_read(&(buffer->refcount)) > 0); g_return_if_fail (atomic_read (&(buffer->refcount)) > 0);
zero = atomic_dec_and_test(&(buffer->refcount)) zero = atomic_dec_and_test (&(buffer->refcount))
#else #else
g_return_if_fail(buffer->refcount > 0); g_return_if_fail (buffer->refcount > 0);
GST_BUFFER_LOCK(buffer); GST_BUFFER_LOCK (buffer);
buffer->refcount--; buffer->refcount--;
zero = (buffer->refcount == 0); zero = (buffer->refcount == 0);
GST_BUFFER_UNLOCK(buffer); GST_BUFFER_UNLOCK (buffer);
#endif #endif
/* if we ended up with the refcount at zero, destroy the buffer */ /* if we ended up with the refcount at zero, destroy the buffer */
if (zero) { if (zero) {
// if it came from a pool, give it back // if it came from a pool, give it back
if (buffer->pool != NULL) { if (buffer->pool != NULL) {
gst_buffer_pool_destroy_buffer(buffer->pool, buffer); gst_buffer_pool_destroy_buffer (buffer->pool, buffer);
return; return;
} }
else { else {
gst_buffer_destroy(buffer); gst_buffer_destroy (buffer);
} }
} }
} }
@ -308,12 +324,14 @@ void gst_buffer_unref(GstBuffer *buffer) {
* *
* add the meta data to the buffer * add the meta data to the buffer
*/ */
void gst_buffer_add_meta(GstBuffer *buffer,GstMeta *meta) { void
g_return_if_fail(buffer != NULL); gst_buffer_add_meta (GstBuffer *buffer, GstMeta *meta)
g_return_if_fail(meta != NULL); {
g_return_if_fail (buffer != NULL);
g_return_if_fail (meta != NULL);
gst_meta_ref(meta); gst_meta_ref (meta);
buffer->metas = g_slist_append(buffer->metas,meta); buffer->metas = g_slist_append (buffer->metas,meta);
} }
/** /**
@ -324,8 +342,10 @@ void gst_buffer_add_meta(GstBuffer *buffer,GstMeta *meta) {
* *
* Returns: a GSList of metadata * Returns: a GSList of metadata
*/ */
GSList *gst_buffer_get_metas(GstBuffer *buffer) { GSList*
g_return_val_if_fail(buffer != NULL, NULL); gst_buffer_get_metas (GstBuffer *buffer)
{
g_return_val_if_fail (buffer != NULL, NULL);
return buffer->metas; return buffer->metas;
} }
@ -338,12 +358,14 @@ GSList *gst_buffer_get_metas(GstBuffer *buffer) {
* *
* Returns: the first metadata from the buffer * Returns: the first metadata from the buffer
*/ */
GstMeta *gst_buffer_get_first_meta(GstBuffer *buffer) { GstMeta*
g_return_val_if_fail(buffer != NULL, NULL); gst_buffer_get_first_meta (GstBuffer *buffer)
{
g_return_val_if_fail (buffer != NULL, NULL);
if (buffer->metas == NULL) if (buffer->metas == NULL)
return NULL; return NULL;
return GST_META(buffer->metas->data); return GST_META (buffer->metas->data);
} }
/** /**
@ -353,10 +375,12 @@ GstMeta *gst_buffer_get_first_meta(GstBuffer *buffer) {
* *
* remove the given metadata from the buffer * remove the given metadata from the buffer
*/ */
void gst_buffer_remove_meta(GstBuffer *buffer,GstMeta *meta) { void
g_return_if_fail(buffer != NULL); gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta)
g_return_if_fail(meta != NULL); {
g_return_if_fail (buffer != NULL);
g_return_if_fail (meta != NULL);
buffer->metas = g_slist_remove(buffer->metas,meta); buffer->metas = g_slist_remove (buffer->metas, meta);
gst_meta_unref(meta); gst_meta_unref (meta);
} }

View file

@ -30,15 +30,17 @@
* *
* Returns: new buffer pool * Returns: new buffer pool
*/ */
GstBufferPool *gst_buffer_pool_new() GstBufferPool*
gst_buffer_pool_new (void)
{ {
GstBufferPool *pool; GstBufferPool *pool;
pool = g_malloc(sizeof(GstBufferPool)); pool = g_malloc (sizeof(GstBufferPool));
DEBUG("BUF: allocating new buffer pool %p\n", pool); DEBUG("BUF: allocating new buffer pool %p\n", pool);
pool->new_buffer = NULL; pool->new_buffer = NULL;
pool->destroy_buffer = NULL; pool->destroy_buffer = NULL;
return pool; return pool;
} }
@ -51,9 +53,12 @@ GstBufferPool *gst_buffer_pool_new()
* Sets the function that will be called when a buffer is created * Sets the function that will be called when a buffer is created
* from this pool. * from this pool.
*/ */
void gst_buffer_pool_set_create_function(GstBufferPool *pool, GstBufferPoolCreateFunction create, gpointer user_data) void
gst_buffer_pool_set_create_function (GstBufferPool *pool,
GstBufferPoolCreateFunction create,
gpointer user_data)
{ {
g_return_if_fail(pool != NULL); g_return_if_fail (pool != NULL);
pool->new_buffer = create; pool->new_buffer = create;
pool->new_user_data = user_data; pool->new_user_data = user_data;
@ -68,9 +73,12 @@ void gst_buffer_pool_set_create_function(GstBufferPool *pool, GstBufferPoolCreat
* Sets the function that will be called when a buffer is destroyed * Sets the function that will be called when a buffer is destroyed
* from this pool. * from this pool.
*/ */
void gst_buffer_pool_set_destroy_function(GstBufferPool *pool, GstBufferPoolDestroyFunction destroy, gpointer user_data) void
gst_buffer_pool_set_destroy_function (GstBufferPool *pool,
GstBufferPoolDestroyFunction destroy,
gpointer user_data)
{ {
g_return_if_fail(pool != NULL); g_return_if_fail (pool != NULL);
pool->destroy_buffer = destroy; pool->destroy_buffer = destroy;
pool->destroy_user_data = user_data; pool->destroy_user_data = user_data;
@ -82,9 +90,10 @@ void gst_buffer_pool_set_destroy_function(GstBufferPool *pool, GstBufferPoolDest
* *
* frees the memory for this bufferpool * frees the memory for this bufferpool
*/ */
void gst_buffer_pool_destroy(GstBufferPool *pool) void
gst_buffer_pool_destroy (GstBufferPool *pool)
{ {
g_return_if_fail(pool != NULL); g_return_if_fail (pool != NULL);
g_free(pool); g_free(pool);
} }
@ -97,13 +106,14 @@ void gst_buffer_pool_destroy(GstBufferPool *pool)
* *
* Returns: The new buffer * Returns: The new buffer
*/ */
GstBuffer *gst_buffer_pool_new_buffer(GstBufferPool *pool) GstBuffer*
gst_buffer_pool_new_buffer (GstBufferPool *pool)
{ {
GstBuffer *buffer; GstBuffer *buffer;
g_return_val_if_fail(pool != NULL, NULL); g_return_val_if_fail (pool != NULL, NULL);
buffer = pool->new_buffer(pool, pool->new_user_data); buffer = pool->new_buffer (pool, pool->new_user_data);
buffer->pool = pool; buffer->pool = pool;
return buffer; return buffer;
@ -116,10 +126,12 @@ GstBuffer *gst_buffer_pool_new_buffer(GstBufferPool *pool)
* *
* Gives a buffer back to the given pool. * Gives a buffer back to the given pool.
*/ */
void gst_buffer_pool_destroy_buffer(GstBufferPool *pool, GstBuffer *buffer) void
gst_buffer_pool_destroy_buffer (GstBufferPool *pool,
GstBuffer *buffer)
{ {
g_return_if_fail(pool != NULL); g_return_if_fail (pool != NULL);
g_return_if_fail(buffer != NULL); g_return_if_fail (buffer != NULL);
pool->destroy_buffer(pool, buffer, pool->new_user_data); pool->destroy_buffer (pool, buffer, pool->new_user_data);
} }

View file

@ -31,93 +31,103 @@ static GstClock *the_system_clock = NULL;
* *
* Returns: the new clock element * Returns: the new clock element
*/ */
GstClock *gst_clock_new(gchar *name) { GstClock*
gst_clock_new (gchar *name)
{
GstClock *clock = (GstClock *) g_malloc(sizeof(GstClock)); GstClock *clock = (GstClock *) g_malloc(sizeof(GstClock));
clock->name = g_strdup(name);
clock->name = g_strdup (name);
clock->sinkobjects = NULL; clock->sinkobjects = NULL;
clock->sinkmutex = g_mutex_new(); clock->sinkmutex = g_mutex_new ();
clock->lock = g_mutex_new(); clock->lock = g_mutex_new ();
g_mutex_lock(clock->sinkmutex); g_mutex_lock (clock->sinkmutex);
clock->num = 0; clock->num = 0;
clock->num_locked = 0; clock->num_locked = 0;
clock->locking = FALSE; clock->locking = FALSE;
return clock; return clock;
} }
GstClock *gst_clock_get_system() { GstClock*
gst_clock_get_system(void)
{
if (the_system_clock == NULL) { if (the_system_clock == NULL) {
the_system_clock = gst_clock_new("system_clock"); the_system_clock = gst_clock_new ("system_clock");
gst_clock_reset(the_system_clock); gst_clock_reset (the_system_clock);
} }
return the_system_clock; return the_system_clock;
} }
void gst_clock_register(GstClock *clock, GstObject *obj) { void
if (GST_IS_SINK(obj)) { gst_clock_register (GstClock *clock, GstObject *obj)
{
if (GST_IS_SINK (obj)) {
DEBUG("gst_clock: setting registered sink object 0x%p\n", obj); DEBUG("gst_clock: setting registered sink object 0x%p\n", obj);
clock->sinkobjects = g_list_append(clock->sinkobjects, obj); clock->sinkobjects = g_list_append (clock->sinkobjects, obj);
clock->num++; clock->num++;
} }
} }
void gst_clock_set(GstClock *clock, GstClockTime time) { void
struct timeval tfnow; gst_clock_set (GstClock *clock, GstClockTime time)
GstClockTime now;
gettimeofday(&tfnow, (struct timezone *)NULL);
now = tfnow.tv_sec*1000000LL+tfnow.tv_usec;
g_mutex_lock(clock->lock);
clock->start_time = now - time;
g_mutex_unlock(clock->lock);
DEBUG("gst_clock: setting clock to %llu %llu %llu\n", time, now, clock->start_time);
}
GstClockTimeDiff gst_clock_current_diff(GstClock *clock, GstClockTime time)
{ {
struct timeval tfnow; struct timeval tfnow;
GstClockTime now; GstClockTime now;
gettimeofday(&tfnow, (struct timezone *)NULL); gettimeofday (&tfnow, (struct timezone *)NULL);
g_mutex_lock(clock->lock); now = tfnow.tv_sec*1000000LL+tfnow.tv_usec;
now = ((guint64)tfnow.tv_sec*1000000LL+tfnow.tv_usec) - (guint64)clock->start_time; g_mutex_lock (clock->lock);
//if (clock->locking) now = 0; clock->start_time = now - time;
g_mutex_unlock(clock->lock); g_mutex_unlock (clock->lock);
DEBUG("gst_clock: setting clock to %llu %llu %llu\n", time, now, clock->start_time);
//DEBUG("gst_clock: diff with for time %08llu %08lld %08lld %08llu\n", time, now, GST_CLOCK_DIFF(time, now), clock->start_time);
return GST_CLOCK_DIFF(time, now);
} }
void gst_clock_reset(GstClock *clock) { GstClockTimeDiff
gst_clock_current_diff (GstClock *clock, GstClockTime time)
{
struct timeval tfnow;
GstClockTime now;
gettimeofday (&tfnow, (struct timezone *)NULL);
g_mutex_lock (clock->lock);
now = ((guint64)tfnow.tv_sec*1000000LL+tfnow.tv_usec) - (guint64)clock->start_time;
g_mutex_unlock (clock->lock);
return GST_CLOCK_DIFF (time, now);
}
void
gst_clock_reset (GstClock *clock)
{
struct timeval tfnow; struct timeval tfnow;
gettimeofday(&tfnow, (struct timezone *)NULL); gettimeofday (&tfnow, (struct timezone *)NULL);
g_mutex_lock(clock->lock); g_mutex_lock (clock->lock);
clock->start_time = ((guint64)tfnow.tv_sec)*1000000LL+tfnow.tv_usec; clock->start_time = ((guint64)tfnow.tv_sec)*1000000LL+tfnow.tv_usec;
clock->current_time = clock->start_time; clock->current_time = clock->start_time;
clock->adjust = 0LL; clock->adjust = 0LL;
DEBUG("gst_clock: setting start clock %llu\n", clock->start_time); DEBUG("gst_clock: setting start clock %llu\n", clock->start_time);
//clock->locking = TRUE; g_mutex_unlock (clock->lock);
g_mutex_unlock(clock->lock);
} }
void gst_clock_wait(GstClock *clock, GstClockTime time, GstObject *obj) { void
gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
{
struct timeval tfnow; struct timeval tfnow;
GstClockTime now; GstClockTime now;
GstClockTimeDiff diff; GstClockTimeDiff diff;
//DEBUG("gst_clock: requesting clock object 0x%p %08llu %08llu\n", obj, time, clock->current_time);
gettimeofday(&tfnow, (struct timezone *)NULL); gettimeofday (&tfnow, (struct timezone *)NULL);
g_mutex_lock(clock->lock); g_mutex_lock (clock->lock);
now = tfnow.tv_sec*1000000LL+tfnow.tv_usec - clock->start_time; now = tfnow.tv_sec*1000000LL+tfnow.tv_usec - clock->start_time;
//now = clock->current_time + clock->adjust;
diff = GST_CLOCK_DIFF(time, now); diff = GST_CLOCK_DIFF (time, now);
// if we are not behind wait a bit // if we are not behind wait a bit
DEBUG("gst_clock: %s waiting for time %08llu %08llu %08lld\n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff); DEBUG("gst_clock: %s waiting for time %08llu %08llu %08lld\n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff);
g_mutex_unlock(clock->lock); g_mutex_unlock (clock->lock);
if (diff > 10000 ) { if (diff > 10000 ) {
tfnow.tv_usec = (diff % 1000000); tfnow.tv_usec = (diff % 1000000);
tfnow.tv_sec = diff / 1000000; tfnow.tv_sec = diff / 1000000;
@ -125,14 +135,8 @@ void gst_clock_wait(GstClock *clock, GstClockTime time, GstObject *obj) {
if (!tfnow.tv_sec) { if (!tfnow.tv_sec) {
select(0, NULL, NULL, NULL, &tfnow); select(0, NULL, NULL, NULL, &tfnow);
} }
else printf("gst_clock: %s waiting %u %llu %llu %llu seconds\n", gst_element_get_name(GST_ELEMENT(obj)), else DEBUG("gst_clock: %s waiting %u %llu %llu %llu seconds\n", gst_element_get_name(GST_ELEMENT(obj)),
(int)tfnow.tv_sec, now, diff, time); (int)tfnow.tv_sec, now, diff, time);
//DEBUG("gst_clock: 0x%p waiting for time %llu %llu %lld %llu\n", obj, time, target, diff, now);
//DEBUG("waiting %d.%08d\n",tfnow.tv_sec, tfnow.tv_usec);
//DEBUG("gst_clock: 0x%p waiting done time %llu \n", obj, time);
} }
DEBUG("gst_clock: %s waiting for time %08llu %08llu %08lld done \n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff); DEBUG("gst_clock: %s waiting for time %08llu %08llu %08lld done \n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff);
// clock->current_time = clock->start_time + time;
//gst_clock_set(clock, time);
} }

View file

@ -32,8 +32,8 @@ enum {
}; };
static void gst_connection_class_init(GstConnectionClass *klass); static void gst_connection_class_init (GstConnectionClass *klass);
static void gst_connection_init(GstConnection *connection); static void gst_connection_init (GstConnection *connection);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -54,21 +54,24 @@ gst_connection_get_type(void) {
(GtkArgGetFunc)NULL, (GtkArgGetFunc)NULL,
(GtkClassInitFunc)NULL, (GtkClassInitFunc)NULL,
}; };
connection_type = gtk_type_unique(GST_TYPE_ELEMENT,&connection_info); connection_type = gtk_type_unique (GST_TYPE_ELEMENT, &connection_info);
} }
return connection_type; return connection_type;
} }
static void static void
gst_connection_class_init(GstConnectionClass *klass) { gst_connection_class_init (GstConnectionClass *klass)
{
GtkObjectClass *gtkobject_class; GtkObjectClass *gtkobject_class;
gtkobject_class = (GtkObjectClass*)klass; gtkobject_class = (GtkObjectClass*)klass;
parent_class = gtk_type_class(GST_TYPE_ELEMENT); parent_class = gtk_type_class (GST_TYPE_ELEMENT);
} }
static void gst_connection_init(GstConnection *connection) { static void
gst_connection_init (GstConnection *connection)
{
} }
/** /**
@ -79,9 +82,13 @@ static void gst_connection_init(GstConnection *connection) {
* *
* Returns: new connection * Returns: new connection
*/ */
GstElement *gst_connection_new(gchar *name) { GstElement*
GstElement *connection = GST_ELEMENT(gtk_type_new(gst_connection_get_type())); gst_connection_new (gchar *name)
gst_element_set_name(GST_ELEMENT(connection),name); {
GstElement *connection = GST_ELEMENT (gtk_type_new (gst_connection_get_type ()));
gst_element_set_name (GST_ELEMENT (connection), name);
return connection; return connection;
} }
@ -91,15 +98,17 @@ GstElement *gst_connection_new(gchar *name) {
* *
* Push a buffer along a connection * Push a buffer along a connection
*/ */
void gst_connection_push(GstConnection *connection) { void
gst_connection_push (GstConnection *connection)
{
GstConnectionClass *oclass; GstConnectionClass *oclass;
g_return_if_fail(connection != NULL); g_return_if_fail (connection != NULL);
g_return_if_fail(GST_IS_CONNECTION(connection)); g_return_if_fail (GST_IS_CONNECTION (connection));
oclass = (GstConnectionClass *)(GTK_OBJECT(connection)->klass); oclass = (GstConnectionClass *)(GTK_OBJECT (connection)->klass);
g_return_if_fail(oclass->push != NULL); g_return_if_fail (oclass->push != NULL);
(oclass->push)(connection); (oclass->push)(connection);
} }

View file

@ -31,7 +31,8 @@ void gst_cpuid_i386(int,long *,long *,long *,long *);
#define gst_cpuid(o,a,b,c,d) (void)(a);(void)(b);(void)(c); #define gst_cpuid(o,a,b,c,d) (void)(a);(void)(b);(void)(c);
#endif #endif
void _gst_cpu_initialize(void) void
_gst_cpu_initialize (void)
{ {
long eax=0, ebx=0, ecx=0, edx=0; long eax=0, ebx=0, ecx=0, edx=0;
@ -55,7 +56,8 @@ void _gst_cpu_initialize(void)
} }
GstCPUFlags gst_cpu_get_flags(void) GstCPUFlags
gst_cpu_get_flags (void)
{ {
return _gst_cpu_flags; return _gst_cpu_flags;
} }

View file

@ -18,6 +18,7 @@
*/ */
#include <gst/gstelement.h> #include <gst/gstelement.h>
#include <gst/gstextratypes.h>
#include <gst/gstxml.h> #include <gst/gstxml.h>
/* Element signals and args */ /* Element signals and args */
@ -35,12 +36,12 @@ enum {
}; };
static void gst_element_class_init(GstElementClass *klass); static void gst_element_class_init (GstElementClass *klass);
static void gst_element_init(GstElement *element); static void gst_element_init (GstElement *element);
static void gst_element_real_destroy(GtkObject *object);
GstElementStateReturn gst_element_change_state(GstElement *element); static void gst_element_real_destroy (GtkObject *object);
static GstElementStateReturn gst_element_change_state(GstElement *element);
static GstObjectClass *parent_class = NULL; static GstObjectClass *parent_class = NULL;
static guint gst_element_signals[LAST_SIGNAL] = { 0 }; static guint gst_element_signals[LAST_SIGNAL] = { 0 };
@ -64,7 +65,9 @@ GtkType gst_element_get_type(void) {
return element_type; return element_type;
} }
static void gst_element_class_init(GstElementClass *klass) { static void
gst_element_class_init (GstElementClass *klass)
{
GtkObjectClass *gtkobject_class; GtkObjectClass *gtkobject_class;
gtkobject_class = (GtkObjectClass*)klass; gtkobject_class = (GtkObjectClass*)klass;
@ -72,35 +75,37 @@ static void gst_element_class_init(GstElementClass *klass) {
parent_class = gtk_type_class(GST_TYPE_OBJECT); parent_class = gtk_type_class(GST_TYPE_OBJECT);
gst_element_signals[STATE_CHANGE] = gst_element_signals[STATE_CHANGE] =
gtk_signal_new("state_change",GTK_RUN_LAST,gtkobject_class->type, gtk_signal_new ("state_change", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET(GstElementClass,state_change), GTK_SIGNAL_OFFSET (GstElementClass, state_change),
gtk_marshal_NONE__INT,GTK_TYPE_NONE,1, gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1,
GTK_TYPE_INT); GTK_TYPE_INT);
gst_element_signals[NEW_PAD] = gst_element_signals[NEW_PAD] =
gtk_signal_new("new_pad",GTK_RUN_LAST,gtkobject_class->type, gtk_signal_new ("new_pad", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET(GstElementClass,new_pad), GTK_SIGNAL_OFFSET (GstElementClass, new_pad),
gtk_marshal_NONE__POINTER,GTK_TYPE_NONE,1, gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GST_TYPE_PAD); GST_TYPE_PAD);
gst_element_signals[NEW_GHOST_PAD] = gst_element_signals[NEW_GHOST_PAD] =
gtk_signal_new("new_ghost_pad",GTK_RUN_LAST,gtkobject_class->type, gtk_signal_new ("new_ghost_pad", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET(GstElementClass,new_ghost_pad), GTK_SIGNAL_OFFSET (GstElementClass, new_ghost_pad),
gtk_marshal_NONE__POINTER,GTK_TYPE_NONE,1, gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GST_TYPE_PAD); GST_TYPE_PAD);
gst_element_signals[ERROR] = gst_element_signals[ERROR] =
gtk_signal_new("error",GTK_RUN_LAST,gtkobject_class->type, gtk_signal_new ("error", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET(GstElementClass,error), GTK_SIGNAL_OFFSET (GstElementClass, error),
gtk_marshal_NONE__STRING,GTK_TYPE_NONE,1, gtk_marshal_NONE__STRING, GTK_TYPE_NONE,1,
GTK_TYPE_STRING); GTK_TYPE_STRING);
gtk_object_class_add_signals(gtkobject_class,gst_element_signals,LAST_SIGNAL); gtk_object_class_add_signals (gtkobject_class, gst_element_signals, LAST_SIGNAL);
klass->change_state = gst_element_change_state; klass->change_state = gst_element_change_state;
gtkobject_class->destroy = gst_element_real_destroy; gtkobject_class->destroy = gst_element_real_destroy;
} }
static void gst_element_init(GstElement *element) { static void
gst_element_init (GstElement *element)
{
element->current_state = GST_STATE_NULL; element->current_state = GST_STATE_NULL;
element->pending_state = -1; element->pending_state = -1;
element->numpads = 0; element->numpads = 0;
@ -115,8 +120,10 @@ static void gst_element_init(GstElement *element) {
* *
* Returns: new element * Returns: new element
*/ */
GstElement *gst_element_new() { GstElement*
return GST_ELEMENT(gtk_type_new(GST_TYPE_ELEMENT)); gst_element_new(void)
{
return GST_ELEMENT (gtk_type_new (GST_TYPE_ELEMENT));
} }
/** /**
@ -127,22 +134,24 @@ GstElement *gst_element_new() {
* Add a pad (connection point) to the element, setting the parent of the * Add a pad (connection point) to the element, setting the parent of the
* pad to the element (and thus adding a reference). * pad to the element (and thus adding a reference).
*/ */
void gst_element_add_pad(GstElement *element,GstPad *pad) { void
g_return_if_fail(element != NULL); gst_element_add_pad (GstElement *element, GstPad *pad)
g_return_if_fail(GST_IS_ELEMENT(element)); {
g_return_if_fail(pad != NULL); g_return_if_fail (element != NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
/* set the pad's parent */ /* set the pad's parent */
gst_pad_set_parent(pad,GST_OBJECT(element)); gst_pad_set_parent (pad,GST_OBJECT (element));
/* add it to the list */ /* add it to the list */
element->pads = g_list_append(element->pads,pad); element->pads = g_list_append (element->pads, pad);
element->numpads++; element->numpads++;
/* emit the NEW_PAD signal */ /* emit the NEW_PAD signal */
// g_print("emitting NEW_PAD signal, \"%s\"!\n",gst_pad_get_name(pad)); // g_print("emitting NEW_PAD signal, \"%s\"!\n",gst_pad_get_name(pad));
gtk_signal_emit(GTK_OBJECT(element),gst_element_signals[NEW_PAD],pad); gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[NEW_PAD], pad);
} }
/** /**
@ -153,21 +162,23 @@ void gst_element_add_pad(GstElement *element,GstPad *pad) {
* Add a ghost pad to the element, setting the ghost parent of the pad to * Add a ghost pad to the element, setting the ghost parent of the pad to
* the element (and thus adding a reference). * the element (and thus adding a reference).
*/ */
void gst_element_add_ghost_pad(GstElement *element,GstPad *pad) { void
g_return_if_fail(element != NULL); gst_element_add_ghost_pad (GstElement *element, GstPad *pad)
g_return_if_fail(GST_IS_ELEMENT(element)); {
g_return_if_fail(pad != NULL); g_return_if_fail (element != NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
/* set the pad's parent */ /* set the pad's parent */
gst_pad_add_ghost_parent(pad,GST_OBJECT(element)); gst_pad_add_ghost_parent (pad,GST_OBJECT (element));
/* add it to the list */ /* add it to the list */
element->pads = g_list_append(element->pads,pad); element->pads = g_list_append (element->pads, pad);
element->numpads++; element->numpads++;
/* emit the NEW_PAD signal */ /* emit the NEW_PAD signal */
gtk_signal_emit(GTK_OBJECT(element),gst_element_signals[NEW_GHOST_PAD],pad); gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[NEW_GHOST_PAD], pad);
} }
/** /**
@ -179,11 +190,14 @@ void gst_element_add_ghost_pad(GstElement *element,GstPad *pad) {
* *
* Returns: requested pad if found, otherwise NULL. * Returns: requested pad if found, otherwise NULL.
*/ */
GstPad *gst_element_get_pad(GstElement *element,gchar *name) { GstPad*
gst_element_get_pad (GstElement *element, gchar *name)
{
GList *walk; GList *walk;
g_return_val_if_fail(element != NULL, NULL); g_return_val_if_fail (element != NULL, NULL);
g_return_val_if_fail(GST_IS_ELEMENT(element), NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
if (name == NULL) if (name == NULL)
return NULL; return NULL;
if (!element->numpads) if (!element->numpads)
@ -191,9 +205,9 @@ GstPad *gst_element_get_pad(GstElement *element,gchar *name) {
walk = element->pads; walk = element->pads;
while (walk) { while (walk) {
if (!strcmp(((GstPad *)(walk->data))->name,name)) if (!strcmp (((GstPad *)(walk->data))->name, name))
return (GstPad *)(walk->data); return (GstPad *)(walk->data);
walk = g_list_next(walk); walk = g_list_next (walk);
} }
return NULL; return NULL;
@ -207,9 +221,11 @@ GstPad *gst_element_get_pad(GstElement *element,gchar *name) {
* *
* Returns: GList of pads * Returns: GList of pads
*/ */
GList *gst_element_get_pad_list(GstElement *element) { GList*
g_return_val_if_fail(element != NULL, NULL); gst_element_get_pad_list (GstElement *element)
g_return_val_if_fail(GST_IS_ELEMENT(element), NULL); {
g_return_val_if_fail (element != NULL, NULL);
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
return element->pads; return element->pads;
} }
@ -226,26 +242,29 @@ GList *gst_element_get_pad_list(GstElement *element) {
* child of the parent of the other element. If they have different * child of the parent of the other element. If they have different
* parents, the connection fails. * parents, the connection fails.
*/ */
void gst_element_connect(GstElement *src,gchar *srcpadname, void
GstElement *dest,gchar *destpadname) { gst_element_connect (GstElement *src, gchar *srcpadname,
GstElement *dest, gchar *destpadname)
{
GstPad *srcpad,*destpad; GstPad *srcpad,*destpad;
GstObject *srcparent,*destparent; GstObject *srcparent,*destparent;
g_return_if_fail(src != NULL); g_return_if_fail (src != NULL);
g_return_if_fail(GST_IS_ELEMENT(src)); g_return_if_fail (GST_IS_ELEMENT(src));
g_return_if_fail(srcpadname != NULL); g_return_if_fail (srcpadname != NULL);
g_return_if_fail(dest != NULL); g_return_if_fail (dest != NULL);
g_return_if_fail(GST_IS_ELEMENT(dest)); g_return_if_fail (GST_IS_ELEMENT(dest));
g_return_if_fail(destpadname != NULL); g_return_if_fail (destpadname != NULL);
srcpad = gst_element_get_pad(src,srcpadname); srcpad = gst_element_get_pad (src, srcpadname);
destpad = gst_element_get_pad(dest,destpadname); destpad = gst_element_get_pad (dest, destpadname);
g_return_if_fail(srcpad != NULL); g_return_if_fail (srcpad != NULL);
g_return_if_fail(destpad != NULL); g_return_if_fail (destpad != NULL);
srcparent = gst_object_get_parent(GST_OBJECT(src)); srcparent = gst_object_get_parent (GST_OBJECT (src));
destparent = gst_object_get_parent(GST_OBJECT(dest)); destparent = gst_object_get_parent (GST_OBJECT (dest));
/* we can't do anything if neither have parents */ /* we can't do anything if neither have parents */
if ((srcparent == NULL) && (destparent == NULL)) if ((srcparent == NULL) && (destparent == NULL))
return; return;
@ -265,10 +284,12 @@ void gst_element_connect(GstElement *src,gchar *srcpadname,
* This function is used internally by elements to signal an error * This function is used internally by elements to signal an error
* condition. It results in the "error" signal. * condition. It results in the "error" signal.
*/ */
void gst_element_error(GstElement *element,gchar *error) { void
g_error("GstElement: error in element '%s': %s\n",element->name,error); gst_element_error (GstElement *element, gchar *error)
{
g_error("GstElement: error in element '%s': %s\n", element->name, error);
gtk_signal_emit(GTK_OBJECT(element),gst_element_signals[ERROR],error); gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[ERROR], error);
} }
@ -282,22 +303,24 @@ void gst_element_error(GstElement *element,gchar *error) {
* *
* Returns: whether or not the state was successfully set. * Returns: whether or not the state was successfully set.
*/ */
gint gst_element_set_state(GstElement *element,GstElementState state) { gint
gst_element_set_state (GstElement *element, GstElementState state)
{
GstElementClass *oclass; GstElementClass *oclass;
GstElementStateReturn return_val = GST_STATE_SUCCESS; GstElementStateReturn return_val = GST_STATE_SUCCESS;
// g_print("gst_element_set_state(\"%s\",%08lx)\n", // g_print("gst_element_set_state(\"%s\",%08lx)\n",
// element->name,state); // element->name,state);
g_return_val_if_fail(element != NULL, GST_STATE_FAILURE); g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
g_return_val_if_fail(GST_IS_ELEMENT(element), GST_STATE_FAILURE); g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
// first we set the pending state variable // first we set the pending state variable
// FIXME should probably check to see that we don't already have one // FIXME should probably check to see that we don't already have one
GST_STATE_PENDING(element) = state; GST_STATE_PENDING (element) = state;
// now we call the state change function so it can set the state // now we call the state change function so it can set the state
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass); oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
if (oclass->change_state) if (oclass->change_state)
return_val = (oclass->change_state)(element); return_val = (oclass->change_state)(element);
@ -312,13 +335,15 @@ gint gst_element_set_state(GstElement *element,GstElementState state) {
* *
* Returns: the factory used for creating this element * Returns: the factory used for creating this element
*/ */
GstElementFactory *gst_element_get_factory(GstElement *element) { GstElementFactory*
gst_element_get_factory (GstElement *element)
{
GstElementClass *oclass; GstElementClass *oclass;
g_return_val_if_fail(element != NULL, NULL); g_return_val_if_fail (element != NULL, NULL);
g_return_val_if_fail(GST_IS_ELEMENT(element), NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass); oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
return oclass->elementfactory; return oclass->elementfactory;
} }
@ -333,18 +358,20 @@ GstElementFactory *gst_element_get_factory(GstElement *element) {
* *
* Returns: whether or not the state change was successfully set. * Returns: whether or not the state change was successfully set.
*/ */
GstElementStateReturn gst_element_change_state(GstElement *element) { GstElementStateReturn
g_return_val_if_fail(element != NULL, GST_STATE_FAILURE); gst_element_change_state (GstElement *element)
g_return_val_if_fail(GST_IS_ELEMENT(element), GST_STATE_FAILURE); {
g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
// g_print("gst_element_change_state(\"%s\",%d)\n", // g_print("gst_element_change_state(\"%s\",%d)\n",
// element->name,state); // element->name,state);
GST_STATE(element) = GST_STATE_PENDING(element); GST_STATE (element) = GST_STATE_PENDING (element);
GST_STATE_PENDING(element) = GST_STATE_NONE_PENDING; GST_STATE_PENDING (element) = GST_STATE_NONE_PENDING;
gtk_signal_emit(GTK_OBJECT(element),gst_element_signals[STATE_CHANGE], gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[STATE_CHANGE],
GST_STATE(element)); GST_STATE (element));
return TRUE; return TRUE;
} }
@ -356,15 +383,17 @@ GstElementStateReturn gst_element_change_state(GstElement *element) {
* Set the name of the element, getting rid of the old name if there was * Set the name of the element, getting rid of the old name if there was
* one. * one.
*/ */
void gst_element_set_name(GstElement *element,gchar *name) { void
g_return_if_fail(element != NULL); gst_element_set_name (GstElement *element, gchar *name)
g_return_if_fail(GST_IS_ELEMENT(element)); {
g_return_if_fail(name != NULL); g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (name != NULL);
if (element->name != NULL) if (element->name != NULL)
g_free(element->name); g_free(element->name);
element->name = g_strdup(name); element->name = g_strdup (name);
} }
/** /**
@ -375,31 +404,35 @@ void gst_element_set_name(GstElement *element,gchar *name) {
* *
* Returns: name of the element * Returns: name of the element
*/ */
gchar *gst_element_get_name(GstElement *element) { const gchar*
g_return_val_if_fail(element != NULL, NULL); gst_element_get_name (GstElement *element)
g_return_val_if_fail(GST_IS_ELEMENT(element), NULL); {
g_return_val_if_fail (element != NULL, NULL);
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
return element->name; return element->name;
} }
static void gst_element_real_destroy(GtkObject *object) { static void
GstElement *element = GST_ELEMENT(object); gst_element_real_destroy (GtkObject *object)
{
GstElement *element = GST_ELEMENT (object);
GList *pads; GList *pads;
GstPad *pad; GstPad *pad;
// g_print("in gst_element_real_destroy()\n"); // g_print("in gst_element_real_destroy()\n");
if (element->name) if (element->name)
g_free(element->name); g_free (element->name);
pads = element->pads; pads = element->pads;
while (pads) { while (pads) {
pad = GST_PAD(pads->data); pad = GST_PAD (pads->data);
gst_pad_destroy(pad); gst_pad_destroy (pad);
pads = g_list_next(pads); pads = g_list_next (pads);
} }
g_list_free(element->pads); g_list_free (element->pads);
} }
/* /*
@ -428,7 +461,10 @@ static gchar *_gst_element_type_names[] = {
* *
* Returns: the new xml node * Returns: the new xml node
*/ */
xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) { xmlNodePtr
gst_element_save_thyself (GstElement *element,
xmlNodePtr parent)
{
xmlNodePtr self; xmlNodePtr self;
GList *pads; GList *pads;
GstPad *pad; GstPad *pad;
@ -436,86 +472,92 @@ xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) {
GstElementFactory *factory; GstElementFactory *factory;
GtkType type; GtkType type;
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass); oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
self = xmlNewChild(parent,NULL,"element",NULL); self = xmlNewChild (parent, NULL, "element", NULL);
xmlNewChild(self,NULL,"name",element->name); xmlNewChild(self, NULL, "name", element->name);
if (oclass->elementfactory != NULL) { if (oclass->elementfactory != NULL) {
factory = (GstElementFactory *)oclass->elementfactory; factory = (GstElementFactory *)oclass->elementfactory;
xmlNewChild(self,NULL,"type",factory->name); xmlNewChild (self, NULL, "type", factory->name);
xmlNewChild(self,NULL,"version",factory->details->version); xmlNewChild (self, NULL, "version", factory->details->version);
} }
pads = element->pads; pads = element->pads;
while (pads) { while (pads) {
xmlNodePtr padtag = xmlNewChild(self,NULL,"pad",NULL); xmlNodePtr padtag = xmlNewChild (self, NULL, "pad", NULL);
pad = GST_PAD(pads->data); pad = GST_PAD (pads->data);
// figure out if it's a direct pad or a ghostpad // figure out if it's a direct pad or a ghostpad
if (GST_ELEMENT(pad->parent) == element) if (GST_ELEMENT (pad->parent) == element)
gst_pad_save_thyself(pad,padtag); gst_pad_save_thyself (pad, padtag);
pads = g_list_next(pads); pads = g_list_next (pads);
} }
// output all args to the element // output all args to the element
type = GTK_OBJECT_TYPE(element); type = GTK_OBJECT_TYPE (element);
while (type != GTK_TYPE_INVALID) { while (type != GTK_TYPE_INVALID) {
GtkArg *args; GtkArg *args;
guint32 *flags; guint32 *flags;
guint num_args,i; guint num_args,i;
args = gtk_object_query_args(type,&flags,&num_args); args = gtk_object_query_args (type, &flags, &num_args);
for (i=0;i<num_args;i++) {
for (i=0; i<num_args; i++) {
if ((args[i].type > GTK_TYPE_NONE) && if ((args[i].type > GTK_TYPE_NONE) &&
(args[i].type <= GTK_TYPE_STRING) && //(args[i].type <= GTK_TYPE_STRING) &&
(flags && GTK_ARG_READABLE)) { (flags[i] & GTK_ARG_READABLE)) {
xmlNodePtr arg; xmlNodePtr arg;
gtk_object_getv(GTK_OBJECT(element),1,&args[i]); gtk_object_getv (GTK_OBJECT (element), 1, &args[i]);
arg = xmlNewChild(self,NULL,"arg",NULL); arg = xmlNewChild (self, NULL, "arg", NULL);
xmlNewChild(arg,NULL,"name",args[i].name); xmlNewChild (arg, NULL, "name", args[i].name);
switch (args[i].type) { switch (args[i].type) {
case GTK_TYPE_CHAR: case GTK_TYPE_CHAR:
xmlNewChild(arg,NULL,"value", xmlNewChild (arg, NULL, "value",
g_strdup_printf("%c",GTK_VALUE_CHAR(args[i]))); g_strdup_printf ("%c", GTK_VALUE_CHAR (args[i])));
break; break;
case GTK_TYPE_UCHAR: case GTK_TYPE_UCHAR:
xmlNewChild(arg,NULL,"value", xmlNewChild (arg, NULL, "value",
g_strdup_printf("%d",GTK_VALUE_UCHAR(args[i]))); g_strdup_printf ("%d", GTK_VALUE_UCHAR (args[i])));
break; break;
case GTK_TYPE_BOOL: case GTK_TYPE_BOOL:
xmlNewChild(arg,NULL,"value", xmlNewChild (arg, NULL, "value",
GTK_VALUE_BOOL(args[1])?"true":"false"); GTK_VALUE_BOOL (args[i]) ? "true" : "false");
break; break;
case GTK_TYPE_INT: case GTK_TYPE_INT:
xmlNewChild(arg,NULL,"value", xmlNewChild (arg, NULL, "value",
g_strdup_printf("%d",GTK_VALUE_INT(args[i]))); g_strdup_printf ("%d", GTK_VALUE_INT (args[i])));
break; break;
case GTK_TYPE_LONG: case GTK_TYPE_LONG:
xmlNewChild(arg,NULL,"value", xmlNewChild (arg, NULL, "value",
g_strdup_printf("%ld",GTK_VALUE_LONG(args[i]))); g_strdup_printf ("%ld", GTK_VALUE_LONG (args[i])));
break; break;
case GTK_TYPE_ULONG: case GTK_TYPE_ULONG:
xmlNewChild(arg,NULL,"value", xmlNewChild (arg, NULL, "value",
g_strdup_printf("%lu",GTK_VALUE_ULONG(args[i]))); g_strdup_printf ("%lu", GTK_VALUE_ULONG (args[i])));
break; break;
case GTK_TYPE_FLOAT: case GTK_TYPE_FLOAT:
xmlNewChild(arg,NULL,"value", xmlNewChild (arg, NULL, "value",
g_strdup_printf("%f",GTK_VALUE_FLOAT(args[i]))); g_strdup_printf ("%f", GTK_VALUE_FLOAT (args[i])));
break; break;
case GTK_TYPE_DOUBLE: case GTK_TYPE_DOUBLE:
xmlNewChild(arg,NULL,"value", xmlNewChild (arg, NULL, "value",
g_strdup_printf("%g",GTK_VALUE_DOUBLE(args[i]))); g_strdup_printf ("%g", GTK_VALUE_DOUBLE (args[i])));
break; break;
case GTK_TYPE_STRING: case GTK_TYPE_STRING:
xmlNewChild(arg,NULL,"value",GTK_VALUE_STRING(args[i])); xmlNewChild (arg, NULL, "value", GTK_VALUE_STRING (args[i]));
break; break;
default:
if (args[i].type == GST_TYPE_FILENAME) {
xmlNewChild (arg, NULL, "value", GTK_VALUE_STRING (args[i]));
}
break;
} }
} }
} }
type = gtk_type_parent(type); type = gtk_type_parent (type);
} }
if (oclass->save_thyself) if (oclass->save_thyself)
(oclass->save_thyself)(element,self); (oclass->save_thyself)(element, self);
return self; return self;
} }
@ -530,7 +572,10 @@ xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) {
* *
* Returns: the new element * Returns: the new element
*/ */
GstElement *gst_element_load_thyself(xmlNodePtr parent, GHashTable *elements) { GstElement*
gst_element_load_thyself (xmlNodePtr parent,
GHashTable *elements)
{
xmlNodePtr children = parent->childs; xmlNodePtr children = parent->childs;
GstElement *element; GstElement *element;
GstElementClass *oclass; GstElementClass *oclass;
@ -540,50 +585,50 @@ GstElement *gst_element_load_thyself(xmlNodePtr parent, GHashTable *elements) {
// first get the needed tags to cunstruct the element // first get the needed tags to cunstruct the element
while (children) { while (children) {
if (!strcmp(children->name, "name")) { if (!strcmp (children->name, "name")) {
name = g_strdup(xmlNodeGetContent(children)); name = g_strdup (xmlNodeGetContent (children));
} }
else if (!strcmp(children->name, "type")) { else if (!strcmp (children->name, "type")) {
type = g_strdup(xmlNodeGetContent(children)); type = g_strdup (xmlNodeGetContent (children));
} }
children = children->next; children = children->next;
} }
g_assert(name != NULL); g_assert (name != NULL);
g_assert(type != NULL); g_assert (type != NULL);
g_print("gstelement: loading \"%s\" of type \"%s\"\n", name, type); g_print ("gstelement: loading \"%s\" of type \"%s\"\n", name, type);
element = gst_elementfactory_make(type, name); element = gst_elementfactory_make (type, name);
g_assert(element != NULL); g_assert (element != NULL);
g_hash_table_insert(elements, gst_element_get_name(element), element); g_hash_table_insert (elements, g_strdup (gst_element_get_name (element)), element);
// we have the element now, set the arguments and pads // we have the element now, set the arguments and pads
children = parent->childs; children = parent->childs;
while (children) { while (children) {
if (!strcmp(children->name, "pad")) { if (!strcmp (children->name, "pad")) {
gst_pad_load_and_connect(children, GST_OBJECT(element), elements); gst_pad_load_and_connect (children, GST_OBJECT(element), elements);
} }
else if (!strcmp(children->name, "arg")) { else if (!strcmp (children->name, "arg")) {
xmlNodePtr child = children->childs; xmlNodePtr child = children->childs;
while (child) { while (child) {
if (!strcmp(child->name, "name")) { if (!strcmp (child->name, "name")) {
name = g_strdup(xmlNodeGetContent(child)); name = g_strdup (xmlNodeGetContent (child));
} }
else if (!strcmp(child->name, "value")) { else if (!strcmp (child->name, "value")) {
value = g_strdup(xmlNodeGetContent(child)); value = g_strdup (xmlNodeGetContent (child));
} }
child = child->next; child = child->next;
} }
if (name && value) { if (name && value) {
GtkType type = GTK_OBJECT_TYPE(element); GtkType type = GTK_OBJECT_TYPE (element);
GtkArgInfo *info; GtkArgInfo *info;
gchar *result; gchar *result;
result = gtk_object_arg_get_info(type, name, &info); result = gtk_object_arg_get_info (type, name, &info);
if (result) { if (result) {
g_print("gstelement: %s\n", result); g_print("gstelement: %s\n", result);
@ -591,57 +636,60 @@ GstElement *gst_element_load_thyself(xmlNodePtr parent, GHashTable *elements) {
else if (info->arg_flags & GTK_ARG_WRITABLE) { else if (info->arg_flags & GTK_ARG_WRITABLE) {
switch (info->type) { switch (info->type) {
case GTK_TYPE_STRING: case GTK_TYPE_STRING:
gtk_object_set(GTK_OBJECT(element), name, value, NULL); gtk_object_set (GTK_OBJECT (element), name, value, NULL);
break; break;
case GTK_TYPE_INT: { case GTK_TYPE_INT: {
gint i; gint i;
sscanf(value, "%d", &i); sscanf (value, "%d", &i);
gtk_object_set(GTK_OBJECT(element), name, i, NULL); gtk_object_set (GTK_OBJECT (element), name, i, NULL);
break; break;
} }
case GTK_TYPE_LONG: { case GTK_TYPE_LONG: {
glong i; glong i;
sscanf(value, "%ld", &i); sscanf (value, "%ld", &i);
gtk_object_set(GTK_OBJECT(element), name, i, NULL); gtk_object_set (GTK_OBJECT (element), name, i, NULL);
break; break;
} }
case GTK_TYPE_ULONG: { case GTK_TYPE_ULONG: {
gulong i; gulong i;
sscanf(value, "%lu", &i); sscanf (value, "%lu", &i);
gtk_object_set(GTK_OBJECT(element), name, i, NULL); gtk_object_set (GTK_OBJECT (element), name, i, NULL);
break; break;
} }
case GTK_TYPE_BOOL: { case GTK_TYPE_BOOL: {
gboolean i = FALSE; gboolean i = FALSE;
if (!strcmp("true", value)) i = TRUE; if (!strcmp ("true", value)) i = TRUE;
gtk_object_set(GTK_OBJECT(element), name, i, NULL); gtk_object_set (GTK_OBJECT (element), name, i, NULL);
break; break;
} }
case GTK_TYPE_CHAR: { case GTK_TYPE_CHAR: {
gchar i; gchar i;
sscanf(value, "%c", &i); sscanf (value, "%c", &i);
gtk_object_set(GTK_OBJECT(element), name, i, NULL); gtk_object_set (GTK_OBJECT (element), name, i, NULL);
break; break;
} }
case GTK_TYPE_UCHAR: { case GTK_TYPE_UCHAR: {
guchar i; guchar i;
sscanf(value, "%c", &i); sscanf (value, "%c", &i);
gtk_object_set(GTK_OBJECT(element), name, i, NULL); gtk_object_set (GTK_OBJECT (element), name, i, NULL);
break; break;
} }
case GTK_TYPE_FLOAT: { case GTK_TYPE_FLOAT: {
gfloat i; gfloat i;
sscanf(value, "%f", &i); sscanf (value, "%f", &i);
gtk_object_set(GTK_OBJECT(element), name, i, NULL); gtk_object_set (GTK_OBJECT (element), name, i, NULL);
break; break;
} }
case GTK_TYPE_DOUBLE: { case GTK_TYPE_DOUBLE: {
gdouble i; gdouble i;
sscanf(value, "%g", (float *)&i); sscanf (value, "%g", (float *)&i);
gtk_object_set(GTK_OBJECT(element), name, i, NULL); gtk_object_set (GTK_OBJECT (element), name, i, NULL);
break; break;
} }
default: default:
if (info->type == GST_TYPE_FILENAME) {
gtk_object_set (GTK_OBJECT (element), name, value, NULL);
}
break; break;
} }
@ -651,10 +699,10 @@ GstElement *gst_element_load_thyself(xmlNodePtr parent, GHashTable *elements) {
children = children->next; children = children->next;
} }
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass); oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
if (oclass->restore_thyself) if (oclass->restore_thyself)
(oclass->restore_thyself)(element, parent, elements); (oclass->restore_thyself) (element, parent, elements);
return element; return element;
} }
@ -667,7 +715,10 @@ GstElement *gst_element_load_thyself(xmlNodePtr parent, GHashTable *elements) {
* Sets the manager of the element. For internal use only, unless you're * Sets the manager of the element. For internal use only, unless you're
* writing a new bin subclass. * writing a new bin subclass.
*/ */
void gst_element_set_manager(GstElement *element,GstElement *manager) { void
gst_element_set_manager (GstElement *element,
GstElement *manager)
{
element->manager = manager; element->manager = manager;
} }
@ -679,14 +730,18 @@ void gst_element_set_manager(GstElement *element,GstElement *manager) {
* *
* Returns: Element's manager * Returns: Element's manager
*/ */
GstElement *gst_element_get_manager(GstElement *element) { GstElement*
gst_element_get_manager (GstElement *element)
{
return element->manager; return element->manager;
} }
// note that this casts a char ** to a GstElement *. Ick. // note that this casts a char ** to a GstElement *. Ick.
int gst_element_loopfunc_wrapper(int argc,char **argv) { int
GstElement *element = GST_ELEMENT(argv); gst_element_loopfunc_wrapper (int argc, char **argv)
element->loopfunc(element); {
GstElement *element = GST_ELEMENT (argv);
element->loopfunc (element);
return 0; return 0;
} }
@ -699,11 +754,14 @@ int gst_element_loopfunc_wrapper(int argc,char **argv) {
* can deviate from the GstElementLoopFunction definition in type of * can deviate from the GstElementLoopFunction definition in type of
* pointer only. * pointer only.
*/ */
void gst_element_set_loop_function(GstElement *element, void
GstElementLoopFunction loop) { gst_element_set_loop_function(GstElement *element,
GstElementLoopFunction loop)
{
element->loopfunc = loop; element->loopfunc = loop;
if (element->threadstate != NULL) if (element->threadstate != NULL)
// note that this casts a GstElement * to a char **. Ick. // note that this casts a GstElement * to a char **. Ick.
cothread_setfunc(element->threadstate,gst_element_loopfunc_wrapper, cothread_setfunc (element->threadstate, gst_element_loopfunc_wrapper,
0,(char **)element); 0, (char **)element);
} }

View file

@ -160,7 +160,7 @@ void gst_element_set_loop_function (GstElement *element,
GstElementLoopFunction loop); GstElementLoopFunction loop);
void gst_element_set_name (GstElement *element, gchar *name); void gst_element_set_name (GstElement *element, gchar *name);
gchar* gst_element_get_name (GstElement *element); const gchar* gst_element_get_name (GstElement *element);
void gst_element_set_manager (GstElement *element, GstElement *manager); void gst_element_set_manager (GstElement *element, GstElement *manager);
GstElement* gst_element_get_manager (GstElement *element); GstElement* gst_element_get_manager (GstElement *element);

View file

@ -19,7 +19,9 @@
#include <gst/gstextratypes.h> #include <gst/gstextratypes.h>
GtkType gst_extra_get_filename_type(void) { GtkType
gst_extra_get_filename_type (void)
{
static GtkType filename_type = 0; static GtkType filename_type = 0;
if (!filename_type) { if (!filename_type) {
@ -33,7 +35,7 @@ GtkType gst_extra_get_filename_type(void) {
(GtkArgGetFunc)NULL, (GtkArgGetFunc)NULL,
(GtkClassInitFunc)NULL, (GtkClassInitFunc)NULL,
}; };
filename_type = gtk_type_unique(GTK_TYPE_STRING,&filename_info); filename_type = gtk_type_unique (GTK_TYPE_STRING, &filename_info);
} }
return filename_type; return filename_type;
} }

View file

@ -32,9 +32,8 @@ enum {
}; };
static void gst_filter_class_init(GstFilterClass *klass); static void gst_filter_class_init (GstFilterClass *klass);
static void gst_filter_init(GstFilter *filter); static void gst_filter_init (GstFilter *filter);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
//static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; //static guint gst_filter_signals[LAST_SIGNAL] = { 0 };
@ -60,15 +59,18 @@ gst_filter_get_type(void) {
} }
static void static void
gst_filter_class_init(GstFilterClass *klass) { gst_filter_class_init (GstFilterClass *klass)
{
GtkObjectClass *gtkobject_class; GtkObjectClass *gtkobject_class;
gtkobject_class = (GtkObjectClass*)klass; gtkobject_class = (GtkObjectClass*)klass;
parent_class = gtk_type_class(GST_TYPE_ELEMENT); parent_class = gtk_type_class (GST_TYPE_ELEMENT);
} }
static void gst_filter_init(GstFilter *filter) { static void
gst_filter_init (GstFilter *filter)
{
} }
/** /**
@ -79,8 +81,12 @@ static void gst_filter_init(GstFilter *filter) {
* *
* Returns: new filter * Returns: new filter
*/ */
GstElement *gst_filter_new(gchar *name) { GstElement*
GstElement *filter = GST_ELEMENT(gtk_type_new(gst_filter_get_type())); gst_filter_new (gchar *name)
gst_element_set_name(GST_ELEMENT(filter),name); {
GstElement *filter = GST_ELEMENT (gtk_type_new (gst_filter_get_type()));
gst_element_set_name (GST_ELEMENT (filter), name);
return filter; return filter;
} }

View file

@ -1,3 +1,22 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GST_HGUARD_GSTI386_H #ifndef GST_HGUARD_GSTI386_H
#define GST_HGUARD_GSTI386_H #define GST_HGUARD_GSTI386_H

View file

@ -30,11 +30,13 @@
* *
* Returns: new meta object * Returns: new meta object
*/ */
GstMeta *gst_meta_new_size(gint size) { GstMeta*
gst_meta_new_size (gint size)
{
GstMeta *meta; GstMeta *meta;
meta = g_malloc0(size); meta = g_malloc0 (size);
gst_meta_ref(meta); gst_meta_ref (meta);
return meta; return meta;
} }
@ -45,10 +47,13 @@ GstMeta *gst_meta_new_size(gint size) {
* *
* increases the refcount of a meta object * increases the refcount of a meta object
*/ */
void gst_meta_ref(GstMeta *meta) { void
g_return_if_fail(meta != NULL); gst_meta_ref (GstMeta *meta)
{
g_return_if_fail (meta != NULL);
gst_trace_add_entry(NULL,0,meta,"ref meta"); gst_trace_add_entry (NULL, 0, meta, "ref meta");
meta->refcount++; meta->refcount++;
} }
@ -59,15 +64,17 @@ void gst_meta_ref(GstMeta *meta) {
* decreases the refcount of a meta object. if the refcount is zero, the * decreases the refcount of a meta object. if the refcount is zero, the
* meta object is freed. * meta object is freed.
*/ */
void gst_meta_unref(GstMeta *meta) { void
g_return_if_fail(meta != NULL); gst_meta_unref (GstMeta *meta)
{
g_return_if_fail (meta != NULL);
gst_trace_add_entry(NULL,0,meta,"unref meta"); gst_trace_add_entry (NULL, 0, meta, "unref meta");
meta->refcount--; meta->refcount--;
if (meta->refcount == 0) { if (meta->refcount == 0) {
// gst_trace_add_entry(NULL,0,meta,"destroy meta"); // gst_trace_add_entry(NULL,0,meta,"destroy meta");
g_free(meta); g_free (meta);
// g_print("freeing metadata\n"); // g_print("freeing metadata\n");
} }
} }
@ -82,7 +89,10 @@ void gst_meta_unref(GstMeta *meta) {
* *
* Returns: the meta object or a copy. * Returns: the meta object or a copy.
*/ */
GstMeta *gst_meta_cow(GstMeta *meta) { GstMeta*
g_return_val_if_fail(meta != NULL, NULL); gst_meta_cow (GstMeta *meta)
return NULL; {
g_return_val_if_fail (meta != NULL, NULL);
return NULL;
} }

View file

@ -1,3 +1,22 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GST_HGUARD_GSTPPC_H #ifndef GST_HGUARD_GSTPPC_H
#define GST_HGUARD_GSTPPC_H #define GST_HGUARD_GSTPPC_H

View file

@ -33,15 +33,15 @@ enum {
}; };
static void gst_sink_class_init(GstSinkClass *klass); static void gst_sink_class_init (GstSinkClass *klass);
static void gst_sink_init(GstSink *sink); static void gst_sink_init (GstSink *sink);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
//static guint gst_sink_signals[LAST_SIGNAL] = { 0 }; //static guint gst_sink_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_sink_get_type(void) { gst_sink_get_type (void)
{
static GtkType sink_type = 0; static GtkType sink_type = 0;
if (!sink_type) { if (!sink_type) {
@ -55,21 +55,24 @@ gst_sink_get_type(void) {
(GtkArgGetFunc)NULL, (GtkArgGetFunc)NULL,
(GtkClassInitFunc)NULL, (GtkClassInitFunc)NULL,
}; };
sink_type = gtk_type_unique(GST_TYPE_ELEMENT,&sink_info); sink_type = gtk_type_unique (GST_TYPE_ELEMENT, &sink_info);
} }
return sink_type; return sink_type;
} }
static void static void
gst_sink_class_init(GstSinkClass *klass) { gst_sink_class_init (GstSinkClass *klass)
{
GtkObjectClass *gtkobject_class; GtkObjectClass *gtkobject_class;
gtkobject_class = (GtkObjectClass*)klass; gtkobject_class = (GtkObjectClass*)klass;
parent_class = gtk_type_class(GST_TYPE_ELEMENT); parent_class = gtk_type_class (GST_TYPE_ELEMENT);
} }
static void gst_sink_init(GstSink *sink) { static void
gst_sink_init (GstSink *sink)
{
} }
/** /**
@ -81,8 +84,11 @@ static void gst_sink_init(GstSink *sink) {
* Returns: new sink * Returns: new sink
*/ */
GstObject *gst_sink_new(gchar *name) { GstObject*
GstObject *sink = GST_OBJECT(gtk_type_new(GST_TYPE_SINK)); gst_sink_new (gchar *name)
gst_element_set_name(GST_ELEMENT(sink),name); {
GstObject *sink = GST_OBJECT (gtk_type_new (GST_TYPE_SINK));
gst_element_set_name (GST_ELEMENT (sink), name);
return sink; return sink;
} }

View file

@ -35,12 +35,12 @@ enum {
static void gst_src_class_init(GstSrcClass *klass); static void gst_src_class_init(GstSrcClass *klass);
static void gst_src_init(GstSrc *src); static void gst_src_init(GstSrc *src);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
static guint gst_src_signals[LAST_SIGNAL] = { 0 }; static guint gst_src_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_src_get_type(void) { gst_src_get_type(void)
{
static GtkType src_type = 0; static GtkType src_type = 0;
if (!src_type) { if (!src_type) {
@ -54,28 +54,31 @@ gst_src_get_type(void) {
(GtkArgGetFunc)NULL, (GtkArgGetFunc)NULL,
(GtkClassInitFunc)NULL, (GtkClassInitFunc)NULL,
}; };
src_type = gtk_type_unique(GST_TYPE_ELEMENT,&src_info); src_type = gtk_type_unique (GST_TYPE_ELEMENT, &src_info);
} }
return src_type; return src_type;
} }
static void static void
gst_src_class_init(GstSrcClass *klass) { gst_src_class_init (GstSrcClass *klass)
{
GtkObjectClass *gtkobject_class; GtkObjectClass *gtkobject_class;
gtkobject_class = (GtkObjectClass*)klass; gtkobject_class = (GtkObjectClass*)klass;
parent_class = gtk_type_class(GST_TYPE_ELEMENT); parent_class = gtk_type_class (GST_TYPE_ELEMENT);
gst_src_signals[EOS] = gst_src_signals[EOS] =
gtk_signal_new("eos",GTK_RUN_LAST,gtkobject_class->type, gtk_signal_new ("eos", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET(GstSrcClass,eos), GTK_SIGNAL_OFFSET (GstSrcClass,eos),
gtk_marshal_NONE__NONE,GTK_TYPE_NONE,0, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
GST_TYPE_SRC);
gtk_object_class_add_signals(gtkobject_class,gst_src_signals,LAST_SIGNAL); gtk_object_class_add_signals (gtkobject_class, gst_src_signals, LAST_SIGNAL);
} }
static void gst_src_init(GstSrc *src) { static void
gst_src_init (GstSrc *src)
{
src->flags = 0; src->flags = 0;
} }
@ -86,11 +89,13 @@ static void gst_src_init(GstSrc *src) {
* singals the eos signal to indicate that the end of the stream * singals the eos signal to indicate that the end of the stream
* is reached. * is reached.
*/ */
void gst_src_signal_eos(GstSrc *src) { void
g_return_if_fail(src != NULL); gst_src_signal_eos (GstSrc *src)
g_return_if_fail(GST_IS_SRC(src)); {
g_return_if_fail (src != NULL);
g_return_if_fail (GST_IS_SRC (src));
gtk_signal_emit(GTK_OBJECT(src),gst_src_signals[EOS]); gtk_signal_emit (GTK_OBJECT (src), gst_src_signals[EOS]);
} }
/** /**
@ -99,15 +104,17 @@ void gst_src_signal_eos(GstSrc *src) {
* *
* Push a buffer from the source. * Push a buffer from the source.
*/ */
void gst_src_push(GstSrc *src) { void
gst_src_push (GstSrc *src)
{
GstSrcClass *oclass; GstSrcClass *oclass;
g_return_if_fail(src != NULL); g_return_if_fail (src != NULL);
g_return_if_fail(GST_IS_SRC(src)); g_return_if_fail (GST_IS_SRC (src));
oclass = (GstSrcClass *)(GTK_OBJECT(src)->klass); oclass = (GstSrcClass *)(GTK_OBJECT (src)->klass);
g_return_if_fail(oclass->push != NULL); g_return_if_fail (oclass->push != NULL);
(oclass->push)(src); (oclass->push)(src);
} }
@ -120,16 +127,18 @@ void gst_src_push(GstSrc *src) {
* *
* Push a buffer of a given size from the source. * Push a buffer of a given size from the source.
*/ */
void gst_src_push_region(GstSrc *src,gulong offset,gulong size) { void
gst_src_push_region (GstSrc *src, gulong offset, gulong size)
{
GstSrcClass *oclass; GstSrcClass *oclass;
g_return_if_fail(src != NULL); g_return_if_fail (src != NULL);
g_return_if_fail(GST_IS_SRC(src)); g_return_if_fail (GST_IS_SRC (src));
oclass = (GstSrcClass *)(GTK_OBJECT(src)->klass); oclass = (GstSrcClass *)(GTK_OBJECT (src)->klass);
g_return_if_fail(oclass->push_region != NULL); g_return_if_fail (oclass->push_region != NULL);
(oclass->push_region)(src,offset,size); (oclass->push_region)(src, offset, size);
} }

View file

@ -165,8 +165,9 @@ gst_thread_get_arg (GtkObject *object,
/* it's not null if we got it, but it might not be ours */ /* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_THREAD (object)); g_return_if_fail (GST_IS_THREAD (object));
switch(id) { switch (id) {
case ARG_CREATE_THREAD: case ARG_CREATE_THREAD:
g_print("gstthread: query thread %d\n", GST_FLAG_IS_SET (object, GST_THREAD_CREATE));
GTK_VALUE_BOOL (*arg) = GST_FLAG_IS_SET (object, GST_THREAD_CREATE); GTK_VALUE_BOOL (*arg) = GST_FLAG_IS_SET (object, GST_THREAD_CREATE);
break; break;
default: default:
@ -327,7 +328,7 @@ gst_thread_restore_thyself (GstElement *element,
xmlNodePtr parent, xmlNodePtr parent,
GHashTable *elements) GHashTable *elements)
{ {
g_print("gstthread: restore\n"); g_print("gstthread: restore\n");
if (GST_ELEMENT_CLASS (parent_class)->restore_thyself) if (GST_ELEMENT_CLASS (parent_class)->restore_thyself)
GST_ELEMENT_CLASS (parent_class)->restore_thyself (element,parent, elements); GST_ELEMENT_CLASS (parent_class)->restore_thyself (element,parent, elements);

View file

@ -24,7 +24,6 @@
* I'm not overly worried yet... * I'm not overly worried yet...
*/ */
#include <gst/gst.h> #include <gst/gst.h>
#include <string.h> #include <string.h>
@ -41,9 +40,10 @@ struct _gst_type_node
int iDist; int iDist;
int iPrev; int iPrev;
}; };
typedef struct _gst_type_node gst_type_node; typedef struct _gst_type_node gst_type_node;
static gboolean gst_type_typefind_dummy(GstBuffer *buffer, gpointer priv); static gboolean gst_type_typefind_dummy (GstBuffer *buffer, gpointer priv);
/* we keep a (spase) matrix in the hashtable like: /* we keep a (spase) matrix in the hashtable like:
* *
@ -59,38 +59,48 @@ static gboolean gst_type_typefind_dummy(GstBuffer *buffer, gpointer priv);
* *
**/ **/
void _gst_type_initialize() { void
_gst_type_initialize (void)
{
_gst_types = NULL; _gst_types = NULL;
_gst_maxtype = 1; /* type 0 is undefined */ _gst_maxtype = 1; /* type 0 is undefined */
// gst_type_audio_register();
} }
guint16 gst_type_register(GstTypeFactory *factory) { /**
* gst_type_register:
* @factory: the type factory to register
*
* register a new type factory to the system
*
* Returns: the new type id
*/
guint16
gst_type_register (GstTypeFactory *factory)
{
guint16 id; guint16 id;
GstType *type; GstType *type;
g_return_val_if_fail(factory != NULL, 0); g_return_val_if_fail (factory != NULL, 0);
//g_print("gsttype: type register %s\n", factory->mime); //g_print("gsttype: type register %s\n", factory->mime);
id = gst_type_find_by_mime(factory->mime); id = gst_type_find_by_mime (factory->mime);
if (!id) { if (!id) {
type = g_new0(GstType, 1); type = g_new0 (GstType, 1);
type->id = _gst_maxtype++; type->id = _gst_maxtype++;
type->mime = factory->mime; type->mime = factory->mime;
type->exts = factory->exts; type->exts = factory->exts;
type->typefindfunc = factory->typefindfunc; type->typefindfunc = factory->typefindfunc;
type->srcs = NULL; type->srcs = NULL;
type->sinks = NULL; type->sinks = NULL;
type->converters = g_hash_table_new(NULL, NULL); type->converters = g_hash_table_new (NULL, NULL);
_gst_types = g_list_prepend(_gst_types,type); _gst_types = g_list_prepend (_gst_types, type);
id = type->id; id = type->id;
} else { } else {
type = gst_type_find_by_id(id); type = gst_type_find_by_id (id);
/* now we want to try to merge the types and return the original */ /* now we want to try to merge the types and return the original */
/* FIXME: do extension merging here, not that easy */ /* FIXME: do extension merging here, not that easy */
@ -104,23 +114,24 @@ guint16 gst_type_register(GstTypeFactory *factory) {
return id; return id;
} }
static guint16 gst_type_find_by_mime_func(gchar *mime) { static
guint16 gst_type_find_by_mime_func (gchar *mime)
{
GList *walk; GList *walk;
GstType *type; GstType *type;
gint typelen,mimelen; gint typelen,mimelen;
gchar *search, *found; gchar *search, *found;
walk = _gst_types; walk = _gst_types;
// DEBUG("searching for '%s'\n",mime); // DEBUG("searching for '%s'\n",mime);
mimelen = strlen(mime); mimelen = strlen (mime);
while (walk) { while (walk) {
type = (GstType *)walk->data; type = (GstType *)walk->data;
search = type->mime; search = type->mime;
// DEBUG("checking against '%s'\n",search); // DEBUG("checking against '%s'\n",search);
typelen = strlen(search); typelen = strlen (search);
while ((search - type->mime) < typelen) { while ((search - type->mime) < typelen) {
found = strstr(search,mime); found = strstr (search, mime);
/* if the requested mime is in the list */ /* if the requested mime is in the list */
if (found) { if (found) {
if ((*(found + mimelen) == ' ') || if ((*(found + mimelen) == ' ') ||
@ -133,25 +144,61 @@ static guint16 gst_type_find_by_mime_func(gchar *mime) {
} else } else
search += mimelen; search += mimelen;
} }
walk = g_list_next(walk); walk = g_list_next (walk);
} }
return 0; return 0;
} }
guint16 gst_type_find_by_mime(gchar *mime) { /**
* gst_type_find_by_mime:
* @mime: the mime type to find
*
* find the type id of a given mime type
*
* Returns: the type id
*/
guint16
gst_type_find_by_mime (gchar *mime)
{
guint16 typeid; guint16 typeid;
typeid = gst_type_find_by_mime_func(mime); typeid = gst_type_find_by_mime_func (mime);
if (!typeid) { if (!typeid) {
gst_plugin_load_typefactory(mime); gst_plugin_load_typefactory (mime);
} }
return gst_type_find_by_mime_func(mime); return gst_type_find_by_mime_func (mime);
} }
GstType *gst_type_find_by_id(guint16 id) { /**
* gst_type_find_by_ext:
* @ext: the extension to find
*
* find the type id of a given extention
*
* Returns: the type id
*/
guint16
gst_type_find_by_ext (gchar *ext)
{
//FIXME
g_warning ("gsttype: find_by_ext not implemented");
return 0;
}
/**
* gst_type_find_by_id:
* @id: the type id to lookup
*
* find the type of a given type id
*
* Returns: the type
*/
GstType*
gst_type_find_by_id (guint16 id)
{
GList *walk = _gst_types; GList *walk = _gst_types;
GstType *type; GstType *type;
@ -159,122 +206,175 @@ GstType *gst_type_find_by_id(guint16 id) {
type = (GstType *)walk->data; type = (GstType *)walk->data;
if (type->id == id) if (type->id == id)
return type; return type;
walk = g_list_next(walk); walk = g_list_next (walk);
} }
return NULL; return NULL;
} }
static void gst_type_dump_converter(gpointer key, gpointer value, gpointer data) { static void
gst_type_dump_converter (gpointer key,
gpointer value,
gpointer data)
{
GList *walk = (GList *)value; GList *walk = (GList *)value;
GstElementFactory *factory; GstElementFactory *factory;
g_print("gsttype: %u, (", GPOINTER_TO_UINT(key)); g_print ("gsttype: %u, (", GPOINTER_TO_UINT (key));
while (walk) { while (walk) {
factory = (GstElementFactory *) walk->data; factory = (GstElementFactory *) walk->data;
g_print("%s, ", factory->name); g_print("%s, ", factory->name);
walk = g_list_next(walk); walk = g_list_next (walk);
} }
g_print("NULL)), "); g_print ("NULL)), ");
} }
void gst_type_dump() { /**
* gst_type_dump:
*
* dumps the current type system
*/
void
gst_type_dump(void)
{
GList *walk = _gst_types; GList *walk = _gst_types;
GstType *type; GstType *type;
g_print("gst_type_dump() : \n"); g_print ("gst_type_dump() : \n");
while (walk) { while (walk) {
type = (GstType *)walk->data; type = (GstType *)walk->data;
g_print("gst_type: %d (%s) -> (", type->id, type->mime); g_print ("gst_type: %d (%s) -> (", type->id, type->mime);
g_hash_table_foreach(type->converters, gst_type_dump_converter, NULL); g_hash_table_foreach (type->converters, gst_type_dump_converter, NULL);
g_print("NULL)\n"); g_print ("NULL)\n");
walk = g_list_next(walk); walk = g_list_next (walk);
} }
} }
void gst_type_add_src(guint16 id,GstElementFactory *src) { /**
* gst_type_add_src:
* @id: the type id to add the source factory to
* @src: the source factory for the type
*
* register the src factory as being a source for the
* given type id
*/
void
gst_type_add_src (guint16 id, GstElementFactory *src)
{
GList *walk; GList *walk;
GstType *type = gst_type_find_by_id(id); GstType *type = gst_type_find_by_id (id);
g_return_if_fail(type != NULL); g_return_if_fail (type != NULL);
g_return_if_fail(src != NULL); g_return_if_fail (src != NULL);
type->srcs = g_list_prepend(type->srcs,src); type->srcs = g_list_prepend (type->srcs, src);
gst_elementfactory_add_src(src, id); gst_elementfactory_add_src (src, id);
// find out if the element has to be indexed in the matrix // find out if the element has to be indexed in the matrix
walk = src->sink_types; walk = src->sink_types;
while (walk) { while (walk) {
GstType *type2 = gst_type_find_by_id(GPOINTER_TO_UINT(walk->data)); GstType *type2 = gst_type_find_by_id (GPOINTER_TO_UINT (walk->data));
GList *converters = (GList *)g_hash_table_lookup(type2->converters, GUINT_TO_POINTER((guint)id)); GList *converters = (GList *)g_hash_table_lookup (type2->converters, GUINT_TO_POINTER ((guint)id));
GList *orig = converters; GList *orig = converters;
while (converters) { while (converters) {
if (converters->data == src) { if (converters->data == src) {
break; break;
} }
converters = g_list_next(converters); converters = g_list_next (converters);
} }
if (!converters) { if (!converters) {
orig = g_list_prepend(orig, src); orig = g_list_prepend (orig, src);
g_hash_table_insert(type2->converters, GUINT_TO_POINTER((guint)id), orig); g_hash_table_insert (type2->converters, GUINT_TO_POINTER ((guint)id), orig);
} }
walk = g_list_next(walk); walk = g_list_next (walk);
} }
} }
void gst_type_add_sink(guint16 id,GstElementFactory *sink) { /**
* gst_type_add_sink:
* @id: the type id to add the sink factory to
* @sink: the sink factory for the type
*
* register the sink factory as being a sink for the
* given type id
*/
void
gst_type_add_sink (guint16 id, GstElementFactory *sink)
{
GList *walk; GList *walk;
GstType *type = gst_type_find_by_id(id); GstType *type = gst_type_find_by_id (id);
g_return_if_fail(type != NULL); g_return_if_fail (type != NULL);
g_return_if_fail(sink != NULL); g_return_if_fail (sink != NULL);
type->sinks = g_list_prepend(type->sinks,sink); type->sinks = g_list_prepend (type->sinks, sink);
gst_elementfactory_add_sink(sink, id); gst_elementfactory_add_sink (sink, id);
// find out if the element has to be indexed in the matrix // find out if the element has to be indexed in the matrix
walk = sink->src_types; walk = sink->src_types;
while (walk) { while (walk) {
GList *converters = (GList *)g_hash_table_lookup(type->converters, walk->data); GList *converters = (GList *)g_hash_table_lookup (type->converters, walk->data);
GList *orig = converters; GList *orig = converters;
while (converters) { while (converters) {
if (converters->data == sink) { if (converters->data == sink) {
break; break;
} }
converters = g_list_next(converters); converters = g_list_next (converters);
} }
if (!converters) { if (!converters) {
orig = g_list_prepend(orig, sink); orig = g_list_prepend (orig, sink);
g_hash_table_insert(type->converters, walk->data, orig); g_hash_table_insert (type->converters, walk->data, orig);
} }
walk = g_list_next(walk); walk = g_list_next (walk);
} }
} }
GList *gst_type_get_srcs(guint16 id) { /**
GstType *type = gst_type_find_by_id(id); * gst_type_get_srcs:
* @id: the id to fetch the source factories for
*
* return a list of elementfactories that source
* the given type id
*
* Returns: a list of elementfactories
*/
GList*
gst_type_get_srcs (guint16 id)
{
GstType *type = gst_type_find_by_id (id);
g_return_val_if_fail(type != NULL, NULL); g_return_val_if_fail (type != NULL, NULL);
return type->srcs; return type->srcs;
} }
GList *gst_type_get_sinks(guint16 id) { /**
GstType *type = gst_type_find_by_id(id); * gst_type_get_sinks:
* @id: the id to fetch the sink factories for
*
* return a list of elementfactories that sink
* the given type id
*
* Returns: a list of elementfactories
*/
GList*
gst_type_get_sinks (guint16 id)
{
GstType *type = gst_type_find_by_id (id);
g_return_val_if_fail(type != 0, NULL); g_return_val_if_fail (type != 0, NULL);
return type->sinks; return type->sinks;
} }
@ -285,37 +385,41 @@ GList *gst_type_get_sinks(guint16 id) {
* to connnect two GstTypes * to connnect two GstTypes
* *
**/ **/
static GList*
static GList *gst_type_enqueue(GList *queue, gint iNode, gint iDist, gint iPrev) { gst_type_enqueue (GList *queue, gint iNode, gint iDist, gint iPrev)
gst_type_node *node = g_malloc(sizeof(gst_type_node)); {
gst_type_node *node = g_malloc (sizeof (gst_type_node));
node->iNode = iNode; node->iNode = iNode;
node->iDist = iDist; node->iDist = iDist;
node->iPrev = iPrev; node->iPrev = iPrev;
queue = g_list_append(queue, node); queue = g_list_append (queue, node);
return queue; return queue;
} }
static GList *gst_type_dequeue(GList *queue, gint *iNode, gint *iDist, gint *iPrev) { static GList*
gst_type_dequeue (GList *queue, gint *iNode, gint *iDist, gint *iPrev)
{
GList *head; GList *head;
gst_type_node *node; gst_type_node *node;
head = g_list_first(queue); head = g_list_first (queue);
if (head) { if (head) {
node = (gst_type_node *)head->data; node = (gst_type_node *)head->data;
*iNode = node->iNode; *iNode = node->iNode;
*iPrev = node->iPrev; *iPrev = node->iPrev;
*iDist = node->iDist; *iDist = node->iDist;
head = g_list_remove(queue, node); head = g_list_remove (queue, node);
} }
return head; return head;
} }
static GList *construct_path (gst_type_node *rgnNodes, gint chNode) static GList*
construct_path (gst_type_node *rgnNodes, gint chNode)
{ {
guint src = chNode; guint src = chNode;
guint current = rgnNodes[chNode].iPrev; guint current = rgnNodes[chNode].iPrev;
@ -323,14 +427,14 @@ static GList *construct_path (gst_type_node *rgnNodes, gint chNode)
GstType *type; GstType *type;
GList *converters; GList *converters;
g_print("gsttype: constructed mime path "); g_print ("gsttype: constructed mime path ");
while (current != MAX_COST) while (current != MAX_COST)
{ {
type = gst_type_find_by_id(current); type = gst_type_find_by_id (current);
converters = (GList *)g_hash_table_lookup(type->converters, GUINT_TO_POINTER(src)); converters = (GList *)g_hash_table_lookup (type->converters, GUINT_TO_POINTER (src));
g_print("(%d %d)", src, current); g_print ("(%d %d)", src, current);
factories = g_list_prepend(factories, converters->data); factories = g_list_prepend (factories, converters->data);
src = current; src = current;
current = rgnNodes[current].iPrev; current = rgnNodes[current].iPrev;
} }
@ -338,17 +442,31 @@ static GList *construct_path (gst_type_node *rgnNodes, gint chNode)
return factories; return factories;
} }
static guint gst_type_find_cost(gint src, gint dest) { static guint
GstType *type = gst_type_find_by_id(src); gst_type_find_cost (gint src, gint dest)
{
GstType *type = gst_type_find_by_id (src);
GList *converters = (GList *)g_hash_table_lookup(type->converters, GUINT_TO_POINTER(dest)); GList *converters = (GList *)g_hash_table_lookup (type->converters, GUINT_TO_POINTER (dest));
// FIXME do something very clever here... // FIXME do something very clever here...
if (converters) return 1; if (converters) return 1;
return MAX_COST; return MAX_COST;
} }
GList *gst_type_get_sink_to_src(guint16 sinkid, guint16 srcid) { /**
* gst_type_get_sink_to_src:
* @sinkid: the id of the sink
* @srcid: the id of the source
*
* return a list of elementfactories that convert the source
* type id to the sink type id
*
* Returns: a list of elementfactories
*/
GList*
gst_type_get_sink_to_src (guint16 sinkid, guint16 srcid)
{
gst_type_node *rgnNodes; gst_type_node *rgnNodes;
GList *queue = NULL; GList *queue = NULL;
gint iNode, iDist, iPrev, i, iCost; gint iNode, iDist, iPrev, i, iCost;
@ -358,7 +476,7 @@ GList *gst_type_get_sink_to_src(guint16 sinkid, guint16 srcid) {
return NULL; return NULL;
} }
else { else {
rgnNodes = g_malloc(sizeof(gst_type_node) * _gst_maxtype); rgnNodes = g_malloc (sizeof (gst_type_node) * _gst_maxtype);
for (i=0; i< _gst_maxtype; i++) { for (i=0; i< _gst_maxtype; i++) {
rgnNodes[i].iNode = i; rgnNodes[i].iNode = i;
@ -368,53 +486,82 @@ GList *gst_type_get_sink_to_src(guint16 sinkid, guint16 srcid) {
rgnNodes[sinkid].iDist = 0; rgnNodes[sinkid].iDist = 0;
rgnNodes[sinkid].iPrev = MAX_COST; rgnNodes[sinkid].iPrev = MAX_COST;
queue = gst_type_enqueue(queue, sinkid, 0, MAX_COST); queue = gst_type_enqueue (queue, sinkid, 0, MAX_COST);
while (g_list_length(queue) > 0) { while (g_list_length (queue) > 0) {
queue = gst_type_dequeue(queue, &iNode, &iDist, &iPrev); queue = gst_type_dequeue (queue, &iNode, &iDist, &iPrev);
for (i=0; i< _gst_maxtype; i++) { for (i=0; i< _gst_maxtype; i++) {
iCost = gst_type_find_cost(iNode, i); iCost = gst_type_find_cost (iNode, i);
if (iCost != MAX_COST) { if (iCost != MAX_COST) {
if((MAX_COST == rgnNodes[i].iDist) || if((MAX_COST == rgnNodes[i].iDist) ||
(rgnNodes[i].iDist > (iCost + iDist))) { (rgnNodes[i].iDist > (iCost + iDist))) {
rgnNodes[i].iDist = iDist + iCost; rgnNodes[i].iDist = iDist + iCost;
rgnNodes[i].iPrev = iNode; rgnNodes[i].iPrev = iNode;
queue = gst_type_enqueue(queue, i, iDist + iCost, iNode); queue = gst_type_enqueue (queue, i, iDist + iCost, iNode);
} }
} }
} }
} }
} }
return construct_path(rgnNodes, srcid); return construct_path (rgnNodes, srcid);
} }
GList *gst_type_get_list() { /**
* gst_type_get_list:
*
* return a list of all registered types
*
* Returns: a list of GstTypes
*/
GList*
gst_type_get_list (void)
{
return _gst_types; return _gst_types;
} }
xmlNodePtr gst_type_save_thyself(GstType *type, xmlNodePtr parent) { /**
* gst_type_save_thyself:
xmlNewChild(parent, NULL, "mime", type->mime); * @type: the type to save
* @parent: the parent node to save into
*
* save a type into an XML representation
*
* Returns: the new xmlNodePtr
*/
xmlNodePtr
gst_type_save_thyself (GstType *type, xmlNodePtr parent)
{
xmlNewChild (parent, NULL, "mime", type->mime);
return parent; return parent;
} }
guint16 gst_type_load_thyself(xmlNodePtr parent) { /**
* gst_type_load_thyself:
* @parent: the parent node with the xml information
*
* load a type from an XML representation
*
* Returns: the loaded type id
*/
guint16
gst_type_load_thyself (xmlNodePtr parent)
{
xmlNodePtr field = parent->childs; xmlNodePtr field = parent->childs;
guint16 typeid = 0; guint16 typeid = 0;
while (field) { while (field) {
if (!strcmp(field->name, "mime")) { if (!strcmp (field->name, "mime")) {
typeid = gst_type_find_by_mime(xmlNodeGetContent(field)); typeid = gst_type_find_by_mime (xmlNodeGetContent (field));
if (!typeid) { if (!typeid) {
GstTypeFactory *factory = g_new0(GstTypeFactory, 1); GstTypeFactory *factory = g_new0 (GstTypeFactory, 1);
factory->mime = g_strdup(xmlNodeGetContent(field)); factory->mime = g_strdup (xmlNodeGetContent (field));
typeid = gst_type_register(factory); typeid = gst_type_register (factory);
} }
return typeid; return typeid;
} }
@ -424,52 +571,72 @@ guint16 gst_type_load_thyself(xmlNodePtr parent) {
return typeid; return typeid;
} }
/**
xmlNodePtr gst_typefactory_save_thyself(GstTypeFactory *factory, xmlNodePtr parent) { * gst_typefactory_save_thyself:
* @factory: the type factory to save
xmlNewChild(parent, NULL, "mime", factory->mime); * @parent: the parent node to save into
*
* save a typefactory into an XML representation
*
* Returns: the new xmlNodePtr
*/
xmlNodePtr
gst_typefactory_save_thyself (GstTypeFactory *factory, xmlNodePtr parent)
{
xmlNewChild (parent, NULL, "mime", factory->mime);
if (factory->exts) { if (factory->exts) {
xmlNewChild(parent, NULL, "extensions", factory->exts); xmlNewChild (parent, NULL, "extensions", factory->exts);
} }
if (factory->typefindfunc) { if (factory->typefindfunc) {
xmlNewChild(parent, NULL, "typefind", NULL); xmlNewChild (parent, NULL, "typefind", NULL);
} }
return parent; return parent;
} }
static gboolean gst_type_typefind_dummy(GstBuffer *buffer, gpointer priv) static gboolean
gst_type_typefind_dummy (GstBuffer *buffer, gpointer priv)
{ {
GstType *type = (GstType *)priv; GstType *type = (GstType *)priv;
guint16 typeid; guint16 typeid;
g_print("gsttype: need to load typefind function\n"); g_print ("gsttype: need to load typefind function\n");
type->typefindfunc = NULL; type->typefindfunc = NULL;
gst_plugin_load_typefactory(type->mime); gst_plugin_load_typefactory (type->mime);
typeid = gst_type_find_by_mime(type->mime); typeid = gst_type_find_by_mime (type->mime);
type = gst_type_find_by_id(typeid); type = gst_type_find_by_id (typeid);
if (type->typefindfunc) { if (type->typefindfunc) {
return type->typefindfunc(buffer, type); return type->typefindfunc (buffer, type);
} }
return FALSE; return FALSE;
} }
GstTypeFactory *gst_typefactory_load_thyself(xmlNodePtr parent) { /**
* gst_typefactory_load_thyself:
* @parent: the parent node to load from
*
* load a typefactory from an XML representation
*
* Returns: the new typefactory
*/
GstTypeFactory*
gst_typefactory_load_thyself (xmlNodePtr parent)
{
GstTypeFactory *factory = g_new0(GstTypeFactory, 1); GstTypeFactory *factory = g_new0 (GstTypeFactory, 1);
xmlNodePtr field = parent->childs; xmlNodePtr field = parent->childs;
factory->typefindfunc = NULL; factory->typefindfunc = NULL;
while (field) { while (field) {
if (!strcmp(field->name, "mime")) { if (!strcmp (field->name, "mime")) {
factory->mime = g_strdup(xmlNodeGetContent(field)); factory->mime = g_strdup (xmlNodeGetContent (field));
} }
else if (!strcmp(field->name, "extensions")) { else if (!strcmp (field->name, "extensions")) {
factory->exts = g_strdup(xmlNodeGetContent(field)); factory->exts = g_strdup (xmlNodeGetContent (field));
} }
else if (!strcmp(field->name, "typefind")) { else if (!strcmp (field->name, "typefind")) {
factory->typefindfunc = gst_type_typefind_dummy; factory->typefindfunc = gst_type_typefind_dummy;
} }
field = field->next; field = field->next;

View file

@ -4,23 +4,31 @@ INCLUDES = $(GLIB_CFLAGS) $(GTK_CFLAGS) -I$(top_srcdir) \
$(shell gnome-config --cflags gnomeui) $(shell gstreamer-config --cflags) $(shell gnome-config --cflags gnomeui) $(shell gstreamer-config --cflags)
bin_PROGRAMS = gstmediaplay bin_PROGRAMS = gstmediaplay
lib_LTLIBRARIES = libgstmediaplay.la
gladedir = $(datadir)/gstmediaplay gladedir = $(datadir)/gstmediaplay
glade_DATA = gstmediaplay.glade play.xpm stop.xpm pause.xpm glade_DATA = gstmediaplay.glade play.xpm stop.xpm pause.xpm
gstmediaplay_SOURCES = \ libgstmediaplay_la_SOURCES = \
gstplay.c main.c \ gstplay.c \
gstmediaplay.c gstmediaplay.h \ gstmediaplay.c gstmediaplay.h \
gststatusarea.c gststatusarea.h \ gststatusarea.c gststatusarea.h \
callbacks.c callbacks.h callbacks.c callbacks.h
gstmediaplay_SOURCES = \
main.c
CFLAGS += -O2 -Wall -DDATADIR=\""$(gladedir)/"\" CFLAGS += -O2 -Wall -DDATADIR=\""$(gladedir)/"\"
gstmediaplay_CFLAGS = $(shell gnome-config --cflags gnomeui) $(shell libglade-config --cflags gnome) \ gstmediaplay_CFLAGS = $(shell gnome-config --cflags gnomeui) $(shell libglade-config --cflags gnome) \
$(shell gstreamer-config --cflags ) $(shell gstreamer-config --cflags )
gstmediaplay_LDFLAGS = $(shell gnome-config --libs gnomeui) $(shell libglade-config --libs gnome) \ gstmediaplay_LDFLAGS = $(shell gnome-config --libs gnomeui) $(shell libglade-config --libs gnome) \
$(shell gstreamer-config --libs ) $(shell gstreamer-config --libs ) ./libgstmediaplay.la
if HAVE_LIBXV if HAVE_LIBXV
xvlibs=-lXv xvlibs=-lXv

View file

@ -139,14 +139,15 @@ GstElement *gst_queue_new(gchar *name) {
return queue; return queue;
} }
static void gst_queue_cleanup_buffers(gpointer data, gpointer user_data) static void gst_queue_cleanup_buffers(gpointer data, const gpointer user_data)
{ {
DEBUG("queue: %s cleaning buffer %p\n", (gchar *)user_data, data); DEBUG("queue: %s cleaning buffer %p\n", (gchar *)user_data, data);
gst_buffer_unref(GST_BUFFER(data));
gst_buffer_unref (GST_BUFFER (data));
} }
static void gst_queue_flush(GstQueue *queue) { static void gst_queue_flush(GstQueue *queue) {
g_slist_foreach(queue->queue, gst_queue_cleanup_buffers, gst_element_get_name(GST_ELEMENT(queue))); g_slist_foreach(queue->queue, gst_queue_cleanup_buffers, (char *)gst_element_get_name(GST_ELEMENT(queue)));
g_slist_free(queue->queue); g_slist_free(queue->queue);
queue->queue = NULL; queue->queue = NULL;
queue->level_buffers = 0; queue->level_buffers = 0;
@ -155,7 +156,7 @@ static void gst_queue_flush(GstQueue *queue) {
static void gst_queue_chain(GstPad *pad,GstBuffer *buf) { static void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
GstQueue *queue; GstQueue *queue;
gboolean tosignal = FALSE; gboolean tosignal = FALSE;
guchar *name; const guchar *name;
g_return_if_fail(pad != NULL); g_return_if_fail(pad != NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_if_fail(GST_IS_PAD(pad));
@ -215,7 +216,7 @@ static void gst_queue_push(GstConnection *connection) {
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
GSList *front; GSList *front;
gboolean tosignal = FALSE; gboolean tosignal = FALSE;
guchar *name; const guchar *name;
name = gst_element_get_name(GST_ELEMENT(queue)); name = gst_element_get_name(GST_ELEMENT(queue));