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:
parent
a9a7f77e07
commit
ef31aa64e8
8
components/bonobo-gstmediaplay/.gitignore
vendored
Normal file
8
components/bonobo-gstmediaplay/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
.deps
|
||||
.libs
|
||||
bonobo-gstmediaplay
|
32
components/bonobo-gstmediaplay/Makefile.am
Normal file
32
components/bonobo-gstmediaplay/Makefile.am
Normal 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
|
||||
|
19
components/bonobo-gstmediaplay/bonobo-gstmediaplay-ui.xml
Normal file
19
components/bonobo-gstmediaplay/bonobo-gstmediaplay-ui.xml
Normal 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>;
|
445
components/bonobo-gstmediaplay/bonobo-gstmediaplay.c
Normal file
445
components/bonobo-gstmediaplay/bonobo-gstmediaplay.c
Normal 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;
|
||||
}
|
20
components/bonobo-gstmediaplay/gstmediaplay.oafinfo
Normal file
20
components/bonobo-gstmediaplay/gstmediaplay.oafinfo
Normal 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>
|
@ -467,6 +467,7 @@ plugins/vorbis/Makefile
|
||||
plugins/capture/Makefile
|
||||
plugins/capture/v4l/Makefile
|
||||
gstplay/Makefile
|
||||
components/bonobo-gstmediaplay/Makefile
|
||||
test/Makefile
|
||||
test/xml/Makefile
|
||||
test/bindings/Makefile
|
||||
|
@ -77,12 +77,14 @@ The maximum number of cothreads we are going to support.
|
||||
|
||||
<!-- ##### USER_FUNCTION cothread_func ##### -->
|
||||
<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>
|
||||
|
||||
@argc:
|
||||
@argv:
|
||||
@Returns:
|
||||
@argc: a main-like argument count
|
||||
@argv: a main-like array of arguments
|
||||
@Returns: a return code
|
||||
|
||||
|
||||
<!-- ##### MACRO COTHREAD_STARTED ##### -->
|
||||
|
@ -109,57 +109,55 @@ it, is there?
|
||||
|
||||
<!-- ##### MACRO GST_META_FLAGS ##### -->
|
||||
<para>
|
||||
|
||||
Retrieve the flags of the given meta information
|
||||
</para>
|
||||
|
||||
@meta:
|
||||
<!-- # Unused Parameters # -->
|
||||
@buf:
|
||||
@meta: the meta information
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_META_FLAG_IS_SET ##### -->
|
||||
<para>
|
||||
|
||||
Check if a given flag is set
|
||||
</para>
|
||||
|
||||
@meta:
|
||||
@flag:
|
||||
@meta: the meta data to test
|
||||
@flag: the flag to test
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_META_FLAG_SET ##### -->
|
||||
<para>
|
||||
|
||||
Set a flag in the meta data
|
||||
</para>
|
||||
|
||||
@meta:
|
||||
@flag:
|
||||
@meta: the meta data
|
||||
@flag: the flag to set
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_META_FLAG_UNSET ##### -->
|
||||
<para>
|
||||
|
||||
Clear a flag in the meta data
|
||||
</para>
|
||||
|
||||
@meta:
|
||||
@flag:
|
||||
@meta: the meta data
|
||||
@flag: the flag to clear
|
||||
|
||||
|
||||
<!-- ##### ENUM GstMetaFlags ##### -->
|
||||
<para>
|
||||
|
||||
Flags indicating properties about the meta data
|
||||
</para>
|
||||
|
||||
@GST_META_FREEABLE:
|
||||
@GST_META_FREEABLE: the meta data can be freed
|
||||
|
||||
<!-- ##### STRUCT GstMeta ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@lock:
|
||||
@flags:
|
||||
@data:
|
||||
@size:
|
||||
@lock: for locking purposes
|
||||
@flags: the flags of the meta data
|
||||
@data: the meta data
|
||||
@size: the size of the meta data
|
||||
|
||||
<!-- ##### FUNCTION gst_meta_new_size ##### -->
|
||||
<para>
|
||||
@ -172,10 +170,10 @@ it, is there?
|
||||
|
||||
<!-- ##### MACRO gst_meta_new ##### -->
|
||||
<para>
|
||||
|
||||
Create new meta data
|
||||
</para>
|
||||
|
||||
@type:
|
||||
@type: the type of the meta data to create
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_meta_ref ##### -->
|
||||
|
@ -171,13 +171,6 @@
|
||||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_SINESRC ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
|
||||
<!-- ##### FUNCTION gst_object_get_type ##### -->
|
||||
<para>
|
||||
|
||||
@ -185,19 +178,19 @@
|
||||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_SINESRC ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
|
||||
<!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_QUEUE_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@klass:
|
||||
|
||||
<!-- ##### FUNCTION gst_audiosrc_get_type ##### -->
|
||||
<para>
|
||||
|
||||
@ -205,6 +198,13 @@
|
||||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_QUEUE_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@klass:
|
||||
|
||||
<!-- ##### MACRO GST_IS_QUEUE ##### -->
|
||||
<para>
|
||||
|
||||
@ -356,6 +356,12 @@
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### STRUCT GstFakeSink ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_THREAD_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
@ -363,12 +369,6 @@
|
||||
|
||||
@klass:
|
||||
|
||||
<!-- ##### STRUCT GstFakeSink ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_BIN_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
@ -403,16 +403,16 @@
|
||||
|
||||
@obj:
|
||||
|
||||
<!-- ##### SECTION ./tmpl/gstcolorspace.sgml:Title ##### -->
|
||||
GstColorSpace
|
||||
|
||||
|
||||
<!-- ##### STRUCT GstEsdSink ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SECTION ./tmpl/gstcolorspace.sgml:Title ##### -->
|
||||
GstColorSpace
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD ##### -->
|
||||
<para>
|
||||
|
||||
@ -703,14 +703,14 @@ This macro unsets the given state on the element.
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
|
||||
<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@klass:
|
||||
|
||||
<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
|
||||
<!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
@ -1366,13 +1366,6 @@ Get the size of the current file.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_audiosink_get_type ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_META ##### -->
|
||||
<para>
|
||||
|
||||
@ -1380,6 +1373,13 @@ Get the size of the current file.
|
||||
|
||||
@meta:
|
||||
|
||||
<!-- ##### FUNCTION gst_audiosink_get_type ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### FUNCTION gst_httpsrc_get_type ##### -->
|
||||
<para>
|
||||
|
||||
@ -1421,12 +1421,6 @@ Get the size of the current file.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_TYPE_FILTER ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_IS_SINESRC_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
@ -1434,6 +1428,12 @@ Get the size of the current file.
|
||||
|
||||
@obj:
|
||||
|
||||
<!-- ##### MACRO GST_TYPE_FILTER ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_IS_AUDIOSRC_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
@ -1511,10 +1511,6 @@ GstElement
|
||||
|
||||
@obj:
|
||||
|
||||
<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
|
||||
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_audiosrc_push ##### -->
|
||||
<para>
|
||||
|
||||
@ -1522,6 +1518,10 @@ GstElement
|
||||
|
||||
@src:
|
||||
|
||||
<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
@ -1637,15 +1637,15 @@ GstElement
|
||||
@name:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_TYPE_ESDSINK ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_CPU_FLAG_MMX ##### -->
|
||||
<para>
|
||||
A flag indicating that MMX instructions are supported.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_TYPE_ESDSINK ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
@ -54,19 +54,18 @@ valid mp3 decoder, and thus the whole point of the type system.
|
||||
|
||||
<!-- ##### USER_FUNCTION GstTypeFindFunc ##### -->
|
||||
<para>
|
||||
|
||||
This is the function that will be called when a typefind has to be
|
||||
performed by a plugin.
|
||||
</para>
|
||||
|
||||
@buf:
|
||||
@priv:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@private:
|
||||
@buf: the buffer with media on which to perform the typefind
|
||||
@priv: private; don't touch
|
||||
@Returns: a boolean indicating if the typedetection was successfull
|
||||
|
||||
|
||||
<!-- ##### STRUCT GstType ##### -->
|
||||
<para>
|
||||
|
||||
A type
|
||||
</para>
|
||||
|
||||
@id:
|
||||
@ -79,7 +78,7 @@ valid mp3 decoder, and thus the whole point of the type system.
|
||||
|
||||
<!-- ##### STRUCT GstTypeFactory ##### -->
|
||||
<para>
|
||||
|
||||
The struct with the typefactory information
|
||||
</para>
|
||||
|
||||
@mime:
|
||||
|
@ -6,7 +6,7 @@ Utility functions
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
Some convenience functions
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
|
@ -26,7 +26,7 @@ The different IDCT methods available
|
||||
@GST_IDCT_FLOAT: accurate float version
|
||||
@GST_IDCT_MMX: fast MMX (not IEEE compliant)
|
||||
@GST_IDCT_MMX32: accurate MMX
|
||||
@GST_IDCT_SSE:
|
||||
@GST_IDCT_SSE: fast SSE optimised IDCT
|
||||
|
||||
<!-- ##### STRUCT GstIDCT ##### -->
|
||||
<para>
|
||||
|
@ -10,6 +10,13 @@
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<title>GstMediaPlay</title>
|
||||
<para>
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<title>GstEditor</title>
|
||||
<para>
|
||||
|
@ -1,6 +1,97 @@
|
||||
<chapter id="cha-cothreads">
|
||||
<title>Cothreads</title>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
@ -66,9 +66,6 @@ int main(int argc,char *argv[])
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* find out how to handle this bin */
|
||||
gst_bin_create_plan(GST_BIN(pipeline));
|
||||
|
||||
/* make it ready */
|
||||
gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_READY);
|
||||
/* start playing */
|
||||
|
@ -103,4 +103,11 @@ gstreamer-launch disksrc redpill.vob ! css-descramble ! private_stream_1.0 ! \
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<title><command>gstmediaplay</command></title>
|
||||
<para>
|
||||
A sample media player.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
|
@ -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 <sys/time.h>
|
||||
#include <linux/linkage.h>
|
||||
@ -15,6 +34,14 @@
|
||||
|
||||
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_create (cothread_context *ctx)
|
||||
{
|
||||
@ -52,6 +79,15 @@ cothread_create (cothread_context *ctx)
|
||||
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
|
||||
cothread_setfunc (cothread_state *thread,
|
||||
cothread_func func,
|
||||
@ -64,6 +100,13 @@ cothread_setfunc (cothread_state *thread,
|
||||
thread->pc = (int *)func;
|
||||
}
|
||||
|
||||
/**
|
||||
* cothread_init:
|
||||
*
|
||||
* create and initialize a new cotread context
|
||||
*
|
||||
* Returns: the new cothread context
|
||||
*/
|
||||
cothread_context*
|
||||
cothread_init (void)
|
||||
{
|
||||
@ -99,6 +142,12 @@ cothread_init (void)
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/**
|
||||
* cothread_main:
|
||||
* @ctx: the cothread context
|
||||
*
|
||||
* Returns: the new cothread state
|
||||
*/
|
||||
cothread_state*
|
||||
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");
|
||||
}
|
||||
|
||||
/**
|
||||
* cothread_set_data:
|
||||
* @thread: the cothread state
|
||||
* @key: a key for the data
|
||||
* @data: the data
|
||||
*
|
||||
* adds data to a cothread
|
||||
*/
|
||||
void
|
||||
cothread_set_data (cothread_state *thread,
|
||||
gchar *key,
|
||||
@ -133,6 +190,15 @@ cothread_set_data (cothread_state *thread,
|
||||
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
|
||||
cothread_get_data (cothread_state *thread,
|
||||
gchar *key)
|
||||
@ -142,6 +208,12 @@ cothread_get_data (cothread_state *thread,
|
||||
return g_hash_table_lookup(ctx->data, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* cothread_switch:
|
||||
* @thread: the cothread state
|
||||
*
|
||||
* switches to the given cothread state
|
||||
*/
|
||||
void
|
||||
cothread_switch (cothread_state *thread)
|
||||
{
|
||||
|
@ -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__
|
||||
#define __COTHREADS_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <setjmp.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
@ -139,14 +139,15 @@ GstElement *gst_queue_new(gchar *name) {
|
||||
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);
|
||||
|
||||
gst_buffer_unref (GST_BUFFER (data));
|
||||
}
|
||||
|
||||
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);
|
||||
queue->queue = NULL;
|
||||
queue->level_buffers = 0;
|
||||
@ -155,7 +156,7 @@ static void gst_queue_flush(GstQueue *queue) {
|
||||
static void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
||||
GstQueue *queue;
|
||||
gboolean tosignal = FALSE;
|
||||
guchar *name;
|
||||
const guchar *name;
|
||||
|
||||
g_return_if_fail(pad != NULL);
|
||||
g_return_if_fail(GST_IS_PAD(pad));
|
||||
@ -215,7 +216,7 @@ static void gst_queue_push(GstConnection *connection) {
|
||||
GstBuffer *buf = NULL;
|
||||
GSList *front;
|
||||
gboolean tosignal = FALSE;
|
||||
guchar *name;
|
||||
const guchar *name;
|
||||
|
||||
name = gst_element_get_name(GST_ELEMENT(queue));
|
||||
|
||||
|
@ -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
|
||||
#define GST_HGUARD_GSTARCH_H
|
||||
|
||||
|
@ -516,7 +516,7 @@ gst_bin_loopfunc_wrapper (int argc,char *argv[])
|
||||
GList *pads;
|
||||
GstPad *pad;
|
||||
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",
|
||||
argc,gst_element_get_name (element));
|
||||
|
@ -18,22 +18,20 @@
|
||||
*/
|
||||
|
||||
|
||||
//#define DEBUG_ENABLED
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbuffer.h>
|
||||
|
||||
//#define DEBUG(format,args...) g_print("DEBUG: " format, ##args)
|
||||
#define DEBUG(format,args...)
|
||||
|
||||
|
||||
|
||||
GMemChunk *_gst_buffer_chunk;
|
||||
|
||||
|
||||
void _gst_buffer_initialize() {
|
||||
void
|
||||
_gst_buffer_initialize (void)
|
||||
{
|
||||
_gst_buffer_chunk = g_mem_chunk_new ("GstBuffer", sizeof(GstBuffer),
|
||||
sizeof(GstBuffer) * 16, G_ALLOC_AND_FREE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gst_buffer_new:
|
||||
*
|
||||
@ -41,7 +39,9 @@ void _gst_buffer_initialize() {
|
||||
*
|
||||
* Returns: new buffer
|
||||
*/
|
||||
GstBuffer *gst_buffer_new() {
|
||||
GstBuffer*
|
||||
gst_buffer_new(void)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
|
||||
buffer = g_mem_chunk_alloc (_gst_buffer_chunk);
|
||||
@ -64,6 +64,7 @@ GstBuffer *gst_buffer_new() {
|
||||
buffer->metas = NULL;
|
||||
buffer->parent = NULL;
|
||||
buffer->pool = NULL;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@ -75,7 +76,8 @@ GstBuffer *gst_buffer_new() {
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
@ -90,7 +92,11 @@ GstBuffer *gst_buffer_new_from_pool(GstBufferPool *pool)
|
||||
*
|
||||
* 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;
|
||||
|
||||
g_return_val_if_fail (parent != NULL, NULL);
|
||||
@ -142,7 +148,10 @@ GstBuffer *gst_buffer_create_sub(GstBuffer *parent,guint32 offset,guint32 size)
|
||||
*
|
||||
* Returns: new buffer
|
||||
*/
|
||||
GstBuffer *gst_buffer_append(GstBuffer *buffer, GstBuffer *append) {
|
||||
GstBuffer*
|
||||
gst_buffer_append (GstBuffer *buffer,
|
||||
GstBuffer *append)
|
||||
{
|
||||
guint size;
|
||||
GstBuffer *newbuf;
|
||||
|
||||
@ -180,7 +189,8 @@ GstBuffer *gst_buffer_append(GstBuffer *buffer, GstBuffer *append) {
|
||||
*
|
||||
* destroy the buffer
|
||||
*/
|
||||
void gst_buffer_destroy(GstBuffer *buffer) {
|
||||
void gst_buffer_destroy (GstBuffer *buffer)
|
||||
{
|
||||
GSList *metas;
|
||||
|
||||
g_return_if_fail (buffer != NULL);
|
||||
@ -225,7 +235,9 @@ void gst_buffer_destroy(GstBuffer *buffer) {
|
||||
*
|
||||
* increment the refcount of this buffer
|
||||
*/
|
||||
void gst_buffer_ref(GstBuffer *buffer) {
|
||||
void
|
||||
gst_buffer_ref (GstBuffer *buffer)
|
||||
{
|
||||
g_return_if_fail (buffer != NULL);
|
||||
|
||||
DEBUG("BUF: referencing buffer %p\n", buffer);
|
||||
@ -248,7 +260,9 @@ void gst_buffer_ref(GstBuffer *buffer) {
|
||||
*
|
||||
* increment the refcount of this buffer with count
|
||||
*/
|
||||
void gst_buffer_ref_by_count(GstBuffer *buffer,int count) {
|
||||
void
|
||||
gst_buffer_ref_by_count (GstBuffer *buffer, int count)
|
||||
{
|
||||
g_return_if_fail (buffer != NULL);
|
||||
g_return_if_fail (count > 0);
|
||||
|
||||
@ -270,8 +284,10 @@ void gst_buffer_ref_by_count(GstBuffer *buffer,int count) {
|
||||
* decrement the refcount of this buffer. If the refcount is
|
||||
* zero, the buffer will be destroyed.
|
||||
*/
|
||||
void gst_buffer_unref(GstBuffer *buffer) {
|
||||
int zero;
|
||||
void
|
||||
gst_buffer_unref (GstBuffer *buffer)
|
||||
{
|
||||
gint zero;
|
||||
|
||||
g_return_if_fail (buffer != NULL);
|
||||
|
||||
@ -308,7 +324,9 @@ void gst_buffer_unref(GstBuffer *buffer) {
|
||||
*
|
||||
* add the meta data to the buffer
|
||||
*/
|
||||
void gst_buffer_add_meta(GstBuffer *buffer,GstMeta *meta) {
|
||||
void
|
||||
gst_buffer_add_meta (GstBuffer *buffer, GstMeta *meta)
|
||||
{
|
||||
g_return_if_fail (buffer != NULL);
|
||||
g_return_if_fail (meta != NULL);
|
||||
|
||||
@ -324,7 +342,9 @@ void gst_buffer_add_meta(GstBuffer *buffer,GstMeta *meta) {
|
||||
*
|
||||
* Returns: a GSList of metadata
|
||||
*/
|
||||
GSList *gst_buffer_get_metas(GstBuffer *buffer) {
|
||||
GSList*
|
||||
gst_buffer_get_metas (GstBuffer *buffer)
|
||||
{
|
||||
g_return_val_if_fail (buffer != NULL, NULL);
|
||||
|
||||
return buffer->metas;
|
||||
@ -338,7 +358,9 @@ GSList *gst_buffer_get_metas(GstBuffer *buffer) {
|
||||
*
|
||||
* Returns: the first metadata from the buffer
|
||||
*/
|
||||
GstMeta *gst_buffer_get_first_meta(GstBuffer *buffer) {
|
||||
GstMeta*
|
||||
gst_buffer_get_first_meta (GstBuffer *buffer)
|
||||
{
|
||||
g_return_val_if_fail (buffer != NULL, NULL);
|
||||
|
||||
if (buffer->metas == NULL)
|
||||
@ -353,7 +375,9 @@ GstMeta *gst_buffer_get_first_meta(GstBuffer *buffer) {
|
||||
*
|
||||
* remove the given metadata from the buffer
|
||||
*/
|
||||
void gst_buffer_remove_meta(GstBuffer *buffer,GstMeta *meta) {
|
||||
void
|
||||
gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta)
|
||||
{
|
||||
g_return_if_fail (buffer != NULL);
|
||||
g_return_if_fail (meta != NULL);
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
*
|
||||
* Returns: new buffer pool
|
||||
*/
|
||||
GstBufferPool *gst_buffer_pool_new()
|
||||
GstBufferPool*
|
||||
gst_buffer_pool_new (void)
|
||||
{
|
||||
GstBufferPool *pool;
|
||||
|
||||
@ -39,6 +40,7 @@ GstBufferPool *gst_buffer_pool_new()
|
||||
|
||||
pool->new_buffer = NULL;
|
||||
pool->destroy_buffer = NULL;
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
@ -51,7 +53,10 @@ GstBufferPool *gst_buffer_pool_new()
|
||||
* Sets the function that will be called when a buffer is created
|
||||
* 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);
|
||||
|
||||
@ -68,7 +73,10 @@ void gst_buffer_pool_set_create_function(GstBufferPool *pool, GstBufferPoolCreat
|
||||
* Sets the function that will be called when a buffer is destroyed
|
||||
* 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);
|
||||
|
||||
@ -82,7 +90,8 @@ void gst_buffer_pool_set_destroy_function(GstBufferPool *pool, GstBufferPoolDest
|
||||
*
|
||||
* 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);
|
||||
|
||||
@ -97,7 +106,8 @@ void gst_buffer_pool_destroy(GstBufferPool *pool)
|
||||
*
|
||||
* Returns: The new buffer
|
||||
*/
|
||||
GstBuffer *gst_buffer_pool_new_buffer(GstBufferPool *pool)
|
||||
GstBuffer*
|
||||
gst_buffer_pool_new_buffer (GstBufferPool *pool)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
|
||||
@ -116,7 +126,9 @@ GstBuffer *gst_buffer_pool_new_buffer(GstBufferPool *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 (buffer != NULL);
|
||||
|
@ -31,20 +31,27 @@ static GstClock *the_system_clock = NULL;
|
||||
*
|
||||
* Returns: the new clock element
|
||||
*/
|
||||
GstClock *gst_clock_new(gchar *name) {
|
||||
GstClock*
|
||||
gst_clock_new (gchar *name)
|
||||
{
|
||||
GstClock *clock = (GstClock *) g_malloc(sizeof(GstClock));
|
||||
|
||||
clock->name = g_strdup (name);
|
||||
clock->sinkobjects = NULL;
|
||||
clock->sinkmutex = g_mutex_new ();
|
||||
clock->lock = g_mutex_new ();
|
||||
g_mutex_lock (clock->sinkmutex);
|
||||
|
||||
clock->num = 0;
|
||||
clock->num_locked = 0;
|
||||
clock->locking = FALSE;
|
||||
|
||||
return clock;
|
||||
}
|
||||
|
||||
GstClock *gst_clock_get_system() {
|
||||
GstClock*
|
||||
gst_clock_get_system(void)
|
||||
{
|
||||
if (the_system_clock == NULL) {
|
||||
the_system_clock = gst_clock_new ("system_clock");
|
||||
gst_clock_reset (the_system_clock);
|
||||
@ -52,7 +59,9 @@ GstClock *gst_clock_get_system() {
|
||||
return the_system_clock;
|
||||
}
|
||||
|
||||
void gst_clock_register(GstClock *clock, GstObject *obj) {
|
||||
void
|
||||
gst_clock_register (GstClock *clock, GstObject *obj)
|
||||
{
|
||||
if (GST_IS_SINK (obj)) {
|
||||
DEBUG("gst_clock: setting registered sink object 0x%p\n", obj);
|
||||
clock->sinkobjects = g_list_append (clock->sinkobjects, obj);
|
||||
@ -60,7 +69,9 @@ void gst_clock_register(GstClock *clock, GstObject *obj) {
|
||||
}
|
||||
}
|
||||
|
||||
void gst_clock_set(GstClock *clock, GstClockTime time) {
|
||||
void
|
||||
gst_clock_set (GstClock *clock, GstClockTime time)
|
||||
{
|
||||
struct timeval tfnow;
|
||||
GstClockTime now;
|
||||
|
||||
@ -72,7 +83,8 @@ void gst_clock_set(GstClock *clock, GstClockTime time) {
|
||||
DEBUG("gst_clock: setting clock to %llu %llu %llu\n", time, now, clock->start_time);
|
||||
}
|
||||
|
||||
GstClockTimeDiff gst_clock_current_diff(GstClock *clock, GstClockTime time)
|
||||
GstClockTimeDiff
|
||||
gst_clock_current_diff (GstClock *clock, GstClockTime time)
|
||||
{
|
||||
struct timeval tfnow;
|
||||
GstClockTime now;
|
||||
@ -80,15 +92,14 @@ GstClockTimeDiff gst_clock_current_diff(GstClock *clock, GstClockTime time)
|
||||
gettimeofday (&tfnow, (struct timezone *)NULL);
|
||||
g_mutex_lock (clock->lock);
|
||||
now = ((guint64)tfnow.tv_sec*1000000LL+tfnow.tv_usec) - (guint64)clock->start_time;
|
||||
//if (clock->locking) now = 0;
|
||||
g_mutex_unlock (clock->lock);
|
||||
|
||||
//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) {
|
||||
void
|
||||
gst_clock_reset (GstClock *clock)
|
||||
{
|
||||
struct timeval tfnow;
|
||||
|
||||
gettimeofday (&tfnow, (struct timezone *)NULL);
|
||||
@ -97,21 +108,20 @@ void gst_clock_reset(GstClock *clock) {
|
||||
clock->current_time = clock->start_time;
|
||||
clock->adjust = 0LL;
|
||||
DEBUG("gst_clock: setting start clock %llu\n", clock->start_time);
|
||||
//clock->locking = TRUE;
|
||||
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;
|
||||
GstClockTime now;
|
||||
GstClockTimeDiff diff;
|
||||
|
||||
//DEBUG("gst_clock: requesting clock object 0x%p %08llu %08llu\n", obj, time, clock->current_time);
|
||||
|
||||
gettimeofday (&tfnow, (struct timezone *)NULL);
|
||||
g_mutex_lock (clock->lock);
|
||||
now = tfnow.tv_sec*1000000LL+tfnow.tv_usec - clock->start_time;
|
||||
//now = clock->current_time + clock->adjust;
|
||||
|
||||
diff = GST_CLOCK_DIFF (time, now);
|
||||
// if we are not behind wait a bit
|
||||
@ -125,14 +135,8 @@ void gst_clock_wait(GstClock *clock, GstClockTime time, GstObject *obj) {
|
||||
if (!tfnow.tv_sec) {
|
||||
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);
|
||||
//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);
|
||||
// clock->current_time = clock->start_time + time;
|
||||
//gst_clock_set(clock, time);
|
||||
|
||||
}
|
||||
|
@ -60,7 +60,8 @@ gst_connection_get_type(void) {
|
||||
}
|
||||
|
||||
static void
|
||||
gst_connection_class_init(GstConnectionClass *klass) {
|
||||
gst_connection_class_init (GstConnectionClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
|
||||
gtkobject_class = (GtkObjectClass*)klass;
|
||||
@ -68,7 +69,9 @@ gst_connection_class_init(GstConnectionClass *klass) {
|
||||
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
|
||||
*/
|
||||
GstElement *gst_connection_new(gchar *name) {
|
||||
GstElement*
|
||||
gst_connection_new (gchar *name)
|
||||
{
|
||||
GstElement *connection = GST_ELEMENT (gtk_type_new (gst_connection_get_type ()));
|
||||
|
||||
gst_element_set_name (GST_ELEMENT (connection), name);
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
@ -91,7 +98,9 @@ GstElement *gst_connection_new(gchar *name) {
|
||||
*
|
||||
* Push a buffer along a connection
|
||||
*/
|
||||
void gst_connection_push(GstConnection *connection) {
|
||||
void
|
||||
gst_connection_push (GstConnection *connection)
|
||||
{
|
||||
GstConnectionClass *oclass;
|
||||
|
||||
g_return_if_fail (connection != NULL);
|
||||
|
@ -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);
|
||||
#endif
|
||||
|
||||
void _gst_cpu_initialize(void)
|
||||
void
|
||||
_gst_cpu_initialize (void)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
116
gst/gstelement.c
116
gst/gstelement.c
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <gst/gstelement.h>
|
||||
#include <gst/gstextratypes.h>
|
||||
#include <gst/gstxml.h>
|
||||
|
||||
/* Element signals and args */
|
||||
@ -37,10 +38,10 @@ enum {
|
||||
|
||||
static void gst_element_class_init (GstElementClass *klass);
|
||||
static void gst_element_init (GstElement *element);
|
||||
|
||||
static void gst_element_real_destroy (GtkObject *object);
|
||||
|
||||
GstElementStateReturn gst_element_change_state(GstElement *element);
|
||||
|
||||
static GstElementStateReturn gst_element_change_state(GstElement *element);
|
||||
|
||||
static GstObjectClass *parent_class = NULL;
|
||||
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
|
||||
@ -64,7 +65,9 @@ GtkType gst_element_get_type(void) {
|
||||
return element_type;
|
||||
}
|
||||
|
||||
static void gst_element_class_init(GstElementClass *klass) {
|
||||
static void
|
||||
gst_element_class_init (GstElementClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
|
||||
gtkobject_class = (GtkObjectClass*)klass;
|
||||
@ -100,7 +103,9 @@ static void gst_element_class_init(GstElementClass *klass) {
|
||||
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->pending_state = -1;
|
||||
element->numpads = 0;
|
||||
@ -115,7 +120,9 @@ static void gst_element_init(GstElement *element) {
|
||||
*
|
||||
* Returns: new element
|
||||
*/
|
||||
GstElement *gst_element_new() {
|
||||
GstElement*
|
||||
gst_element_new(void)
|
||||
{
|
||||
return GST_ELEMENT (gtk_type_new (GST_TYPE_ELEMENT));
|
||||
}
|
||||
|
||||
@ -127,7 +134,9 @@ GstElement *gst_element_new() {
|
||||
* Add a pad (connection point) to the element, setting the parent of the
|
||||
* pad to the element (and thus adding a reference).
|
||||
*/
|
||||
void gst_element_add_pad(GstElement *element,GstPad *pad) {
|
||||
void
|
||||
gst_element_add_pad (GstElement *element, GstPad *pad)
|
||||
{
|
||||
g_return_if_fail (element != NULL);
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_if_fail (pad != NULL);
|
||||
@ -153,7 +162,9 @@ void gst_element_add_pad(GstElement *element,GstPad *pad) {
|
||||
* Add a ghost pad to the element, setting the ghost parent of the pad to
|
||||
* the element (and thus adding a reference).
|
||||
*/
|
||||
void gst_element_add_ghost_pad(GstElement *element,GstPad *pad) {
|
||||
void
|
||||
gst_element_add_ghost_pad (GstElement *element, GstPad *pad)
|
||||
{
|
||||
g_return_if_fail (element != NULL);
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_if_fail (pad != NULL);
|
||||
@ -179,11 +190,14 @@ void gst_element_add_ghost_pad(GstElement *element,GstPad *pad) {
|
||||
*
|
||||
* 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;
|
||||
|
||||
g_return_val_if_fail (element != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
if (!element->numpads)
|
||||
@ -207,7 +221,9 @@ GstPad *gst_element_get_pad(GstElement *element,gchar *name) {
|
||||
*
|
||||
* Returns: GList of pads
|
||||
*/
|
||||
GList *gst_element_get_pad_list(GstElement *element) {
|
||||
GList*
|
||||
gst_element_get_pad_list (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (element != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||
|
||||
@ -226,8 +242,10 @@ GList *gst_element_get_pad_list(GstElement *element) {
|
||||
* child of the parent of the other element. If they have different
|
||||
* parents, the connection fails.
|
||||
*/
|
||||
void gst_element_connect(GstElement *src,gchar *srcpadname,
|
||||
GstElement *dest,gchar *destpadname) {
|
||||
void
|
||||
gst_element_connect (GstElement *src, gchar *srcpadname,
|
||||
GstElement *dest, gchar *destpadname)
|
||||
{
|
||||
GstPad *srcpad,*destpad;
|
||||
GstObject *srcparent,*destparent;
|
||||
|
||||
@ -246,6 +264,7 @@ void gst_element_connect(GstElement *src,gchar *srcpadname,
|
||||
|
||||
srcparent = gst_object_get_parent (GST_OBJECT (src));
|
||||
destparent = gst_object_get_parent (GST_OBJECT (dest));
|
||||
|
||||
/* we can't do anything if neither have parents */
|
||||
if ((srcparent == NULL) && (destparent == NULL))
|
||||
return;
|
||||
@ -265,7 +284,9 @@ void gst_element_connect(GstElement *src,gchar *srcpadname,
|
||||
* This function is used internally by elements to signal an error
|
||||
* condition. It results in the "error" signal.
|
||||
*/
|
||||
void gst_element_error(GstElement *element,gchar *error) {
|
||||
void
|
||||
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);
|
||||
@ -282,7 +303,9 @@ void gst_element_error(GstElement *element,gchar *error) {
|
||||
*
|
||||
* 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;
|
||||
GstElementStateReturn return_val = GST_STATE_SUCCESS;
|
||||
|
||||
@ -312,7 +335,9 @@ gint gst_element_set_state(GstElement *element,GstElementState state) {
|
||||
*
|
||||
* Returns: the factory used for creating this element
|
||||
*/
|
||||
GstElementFactory *gst_element_get_factory(GstElement *element) {
|
||||
GstElementFactory*
|
||||
gst_element_get_factory (GstElement *element)
|
||||
{
|
||||
GstElementClass *oclass;
|
||||
|
||||
g_return_val_if_fail (element != NULL, NULL);
|
||||
@ -333,7 +358,9 @@ GstElementFactory *gst_element_get_factory(GstElement *element) {
|
||||
*
|
||||
* Returns: whether or not the state change was successfully set.
|
||||
*/
|
||||
GstElementStateReturn gst_element_change_state(GstElement *element) {
|
||||
GstElementStateReturn
|
||||
gst_element_change_state (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
|
||||
|
||||
@ -356,7 +383,9 @@ GstElementStateReturn gst_element_change_state(GstElement *element) {
|
||||
* Set the name of the element, getting rid of the old name if there was
|
||||
* one.
|
||||
*/
|
||||
void gst_element_set_name(GstElement *element,gchar *name) {
|
||||
void
|
||||
gst_element_set_name (GstElement *element, gchar *name)
|
||||
{
|
||||
g_return_if_fail (element != NULL);
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_if_fail (name != NULL);
|
||||
@ -375,14 +404,18 @@ void gst_element_set_name(GstElement *element,gchar *name) {
|
||||
*
|
||||
* Returns: name of the element
|
||||
*/
|
||||
gchar *gst_element_get_name(GstElement *element) {
|
||||
const gchar*
|
||||
gst_element_get_name (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (element != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||
|
||||
return element->name;
|
||||
}
|
||||
|
||||
static void gst_element_real_destroy(GtkObject *object) {
|
||||
static void
|
||||
gst_element_real_destroy (GtkObject *object)
|
||||
{
|
||||
GstElement *element = GST_ELEMENT (object);
|
||||
GList *pads;
|
||||
GstPad *pad;
|
||||
@ -428,7 +461,10 @@ static gchar *_gst_element_type_names[] = {
|
||||
*
|
||||
* 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;
|
||||
GList *pads;
|
||||
GstPad *pad;
|
||||
@ -464,10 +500,11 @@ xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) {
|
||||
guint num_args,i;
|
||||
|
||||
args = gtk_object_query_args (type, &flags, &num_args);
|
||||
|
||||
for (i=0; i<num_args; i++) {
|
||||
if ((args[i].type > GTK_TYPE_NONE) &&
|
||||
(args[i].type <= GTK_TYPE_STRING) &&
|
||||
(flags && GTK_ARG_READABLE)) {
|
||||
//(args[i].type <= GTK_TYPE_STRING) &&
|
||||
(flags[i] & GTK_ARG_READABLE)) {
|
||||
xmlNodePtr arg;
|
||||
gtk_object_getv (GTK_OBJECT (element), 1, &args[i]);
|
||||
arg = xmlNewChild (self, NULL, "arg", NULL);
|
||||
@ -483,7 +520,7 @@ xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) {
|
||||
break;
|
||||
case GTK_TYPE_BOOL:
|
||||
xmlNewChild (arg, NULL, "value",
|
||||
GTK_VALUE_BOOL(args[1])?"true":"false");
|
||||
GTK_VALUE_BOOL (args[i]) ? "true" : "false");
|
||||
break;
|
||||
case GTK_TYPE_INT:
|
||||
xmlNewChild (arg, NULL, "value",
|
||||
@ -508,6 +545,11 @@ xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) {
|
||||
case GTK_TYPE_STRING:
|
||||
xmlNewChild (arg, NULL, "value", GTK_VALUE_STRING (args[i]));
|
||||
break;
|
||||
default:
|
||||
if (args[i].type == GST_TYPE_FILENAME) {
|
||||
xmlNewChild (arg, NULL, "value", GTK_VALUE_STRING (args[i]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,7 +572,10 @@ xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) {
|
||||
*
|
||||
* 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;
|
||||
GstElement *element;
|
||||
GstElementClass *oclass;
|
||||
@ -557,7 +602,7 @@ GstElement *gst_element_load_thyself(xmlNodePtr parent, GHashTable *elements) {
|
||||
|
||||
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
|
||||
children = parent->childs;
|
||||
@ -642,6 +687,9 @@ GstElement *gst_element_load_thyself(xmlNodePtr parent, GHashTable *elements) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (info->type == GST_TYPE_FILENAME) {
|
||||
gtk_object_set (GTK_OBJECT (element), name, value, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -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
|
||||
* 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;
|
||||
}
|
||||
|
||||
@ -679,12 +730,16 @@ void gst_element_set_manager(GstElement *element,GstElement *manager) {
|
||||
*
|
||||
* Returns: Element's manager
|
||||
*/
|
||||
GstElement *gst_element_get_manager(GstElement *element) {
|
||||
GstElement*
|
||||
gst_element_get_manager (GstElement *element)
|
||||
{
|
||||
return element->manager;
|
||||
}
|
||||
|
||||
// note that this casts a char ** to a GstElement *. Ick.
|
||||
int gst_element_loopfunc_wrapper(int argc,char **argv) {
|
||||
int
|
||||
gst_element_loopfunc_wrapper (int argc, char **argv)
|
||||
{
|
||||
GstElement *element = GST_ELEMENT (argv);
|
||||
element->loopfunc (element);
|
||||
return 0;
|
||||
@ -699,9 +754,12 @@ int gst_element_loopfunc_wrapper(int argc,char **argv) {
|
||||
* can deviate from the GstElementLoopFunction definition in type of
|
||||
* pointer only.
|
||||
*/
|
||||
void gst_element_set_loop_function(GstElement *element,
|
||||
GstElementLoopFunction loop) {
|
||||
void
|
||||
gst_element_set_loop_function(GstElement *element,
|
||||
GstElementLoopFunction loop)
|
||||
{
|
||||
element->loopfunc = loop;
|
||||
|
||||
if (element->threadstate != NULL)
|
||||
// note that this casts a GstElement * to a char **. Ick.
|
||||
cothread_setfunc (element->threadstate, gst_element_loopfunc_wrapper,
|
||||
|
@ -160,7 +160,7 @@ void gst_element_set_loop_function (GstElement *element,
|
||||
GstElementLoopFunction loop);
|
||||
|
||||
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);
|
||||
GstElement* gst_element_get_manager (GstElement *element);
|
||||
|
@ -19,7 +19,9 @@
|
||||
|
||||
#include <gst/gstextratypes.h>
|
||||
|
||||
GtkType gst_extra_get_filename_type(void) {
|
||||
GtkType
|
||||
gst_extra_get_filename_type (void)
|
||||
{
|
||||
static GtkType filename_type = 0;
|
||||
|
||||
if (!filename_type) {
|
||||
|
@ -35,7 +35,6 @@ enum {
|
||||
static void gst_filter_class_init (GstFilterClass *klass);
|
||||
static void gst_filter_init (GstFilter *filter);
|
||||
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_filter_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
@ -60,7 +59,8 @@ gst_filter_get_type(void) {
|
||||
}
|
||||
|
||||
static void
|
||||
gst_filter_class_init(GstFilterClass *klass) {
|
||||
gst_filter_class_init (GstFilterClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
|
||||
gtkobject_class = (GtkObjectClass*)klass;
|
||||
@ -68,7 +68,9 @@ gst_filter_class_init(GstFilterClass *klass) {
|
||||
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
|
||||
*/
|
||||
GstElement *gst_filter_new(gchar *name) {
|
||||
GstElement*
|
||||
gst_filter_new (gchar *name)
|
||||
{
|
||||
GstElement *filter = GST_ELEMENT (gtk_type_new (gst_filter_get_type()));
|
||||
|
||||
gst_element_set_name (GST_ELEMENT (filter), name);
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
@ -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
|
||||
#define GST_HGUARD_GSTI386_H
|
||||
|
||||
|
@ -30,7 +30,9 @@
|
||||
*
|
||||
* Returns: new meta object
|
||||
*/
|
||||
GstMeta *gst_meta_new_size(gint size) {
|
||||
GstMeta*
|
||||
gst_meta_new_size (gint size)
|
||||
{
|
||||
GstMeta *meta;
|
||||
|
||||
meta = g_malloc0 (size);
|
||||
@ -45,10 +47,13 @@ GstMeta *gst_meta_new_size(gint size) {
|
||||
*
|
||||
* increases the refcount of a meta object
|
||||
*/
|
||||
void gst_meta_ref(GstMeta *meta) {
|
||||
void
|
||||
gst_meta_ref (GstMeta *meta)
|
||||
{
|
||||
g_return_if_fail (meta != NULL);
|
||||
|
||||
gst_trace_add_entry (NULL, 0, meta, "ref meta");
|
||||
|
||||
meta->refcount++;
|
||||
}
|
||||
|
||||
@ -59,7 +64,9 @@ void gst_meta_ref(GstMeta *meta) {
|
||||
* decreases the refcount of a meta object. if the refcount is zero, the
|
||||
* meta object is freed.
|
||||
*/
|
||||
void gst_meta_unref(GstMeta *meta) {
|
||||
void
|
||||
gst_meta_unref (GstMeta *meta)
|
||||
{
|
||||
g_return_if_fail (meta != NULL);
|
||||
|
||||
gst_trace_add_entry (NULL, 0, meta, "unref meta");
|
||||
@ -82,7 +89,10 @@ void gst_meta_unref(GstMeta *meta) {
|
||||
*
|
||||
* Returns: the meta object or a copy.
|
||||
*/
|
||||
GstMeta *gst_meta_cow(GstMeta *meta) {
|
||||
GstMeta*
|
||||
gst_meta_cow (GstMeta *meta)
|
||||
{
|
||||
g_return_val_if_fail (meta != NULL, NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
19
gst/gstppc.h
19
gst/gstppc.h
@ -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
|
||||
#define GST_HGUARD_GSTPPC_H
|
||||
|
||||
|
@ -36,12 +36,12 @@ enum {
|
||||
static void gst_sink_class_init (GstSinkClass *klass);
|
||||
static void gst_sink_init (GstSink *sink);
|
||||
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_sink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_sink_get_type(void) {
|
||||
gst_sink_get_type (void)
|
||||
{
|
||||
static GtkType sink_type = 0;
|
||||
|
||||
if (!sink_type) {
|
||||
@ -61,7 +61,8 @@ gst_sink_get_type(void) {
|
||||
}
|
||||
|
||||
static void
|
||||
gst_sink_class_init(GstSinkClass *klass) {
|
||||
gst_sink_class_init (GstSinkClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
|
||||
gtkobject_class = (GtkObjectClass*)klass;
|
||||
@ -69,7 +70,9 @@ gst_sink_class_init(GstSinkClass *klass) {
|
||||
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
|
||||
*/
|
||||
|
||||
GstObject *gst_sink_new(gchar *name) {
|
||||
GstObject*
|
||||
gst_sink_new (gchar *name)
|
||||
{
|
||||
GstObject *sink = GST_OBJECT (gtk_type_new (GST_TYPE_SINK));
|
||||
gst_element_set_name (GST_ELEMENT (sink), name);
|
||||
|
||||
return sink;
|
||||
}
|
||||
|
27
gst/gstsrc.c
27
gst/gstsrc.c
@ -35,12 +35,12 @@ enum {
|
||||
static void gst_src_class_init(GstSrcClass *klass);
|
||||
static void gst_src_init(GstSrc *src);
|
||||
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static guint gst_src_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_src_get_type(void) {
|
||||
gst_src_get_type(void)
|
||||
{
|
||||
static GtkType src_type = 0;
|
||||
|
||||
if (!src_type) {
|
||||
@ -60,7 +60,8 @@ gst_src_get_type(void) {
|
||||
}
|
||||
|
||||
static void
|
||||
gst_src_class_init(GstSrcClass *klass) {
|
||||
gst_src_class_init (GstSrcClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
|
||||
gtkobject_class = (GtkObjectClass*)klass;
|
||||
@ -70,12 +71,14 @@ gst_src_class_init(GstSrcClass *klass) {
|
||||
gst_src_signals[EOS] =
|
||||
gtk_signal_new ("eos", GTK_RUN_LAST, gtkobject_class->type,
|
||||
GTK_SIGNAL_OFFSET (GstSrcClass,eos),
|
||||
gtk_marshal_NONE__NONE,GTK_TYPE_NONE,0,
|
||||
GST_TYPE_SRC);
|
||||
gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -86,7 +89,9 @@ static void gst_src_init(GstSrc *src) {
|
||||
* singals the eos signal to indicate that the end of the stream
|
||||
* is reached.
|
||||
*/
|
||||
void gst_src_signal_eos(GstSrc *src) {
|
||||
void
|
||||
gst_src_signal_eos (GstSrc *src)
|
||||
{
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (GST_IS_SRC (src));
|
||||
|
||||
@ -99,7 +104,9 @@ void gst_src_signal_eos(GstSrc *src) {
|
||||
*
|
||||
* Push a buffer from the source.
|
||||
*/
|
||||
void gst_src_push(GstSrc *src) {
|
||||
void
|
||||
gst_src_push (GstSrc *src)
|
||||
{
|
||||
GstSrcClass *oclass;
|
||||
|
||||
g_return_if_fail (src != NULL);
|
||||
@ -120,7 +127,9 @@ void gst_src_push(GstSrc *src) {
|
||||
*
|
||||
* 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;
|
||||
|
||||
g_return_if_fail (src != NULL);
|
||||
|
@ -167,6 +167,7 @@ gst_thread_get_arg (GtkObject *object,
|
||||
|
||||
switch (id) {
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
|
229
gst/gsttype.c
229
gst/gsttype.c
@ -24,7 +24,6 @@
|
||||
* I'm not overly worried yet...
|
||||
*/
|
||||
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -41,6 +40,7 @@ struct _gst_type_node
|
||||
int iDist;
|
||||
int iPrev;
|
||||
};
|
||||
|
||||
typedef struct _gst_type_node gst_type_node;
|
||||
|
||||
static gboolean gst_type_typefind_dummy (GstBuffer *buffer, gpointer priv);
|
||||
@ -59,15 +59,24 @@ static gboolean gst_type_typefind_dummy(GstBuffer *buffer, gpointer priv);
|
||||
*
|
||||
**/
|
||||
|
||||
void _gst_type_initialize() {
|
||||
|
||||
void
|
||||
_gst_type_initialize (void)
|
||||
{
|
||||
_gst_types = NULL;
|
||||
_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;
|
||||
GstType *type;
|
||||
|
||||
@ -75,6 +84,7 @@ guint16 gst_type_register(GstTypeFactory *factory) {
|
||||
|
||||
//g_print("gsttype: type register %s\n", factory->mime);
|
||||
id = gst_type_find_by_mime (factory->mime);
|
||||
|
||||
if (!id) {
|
||||
type = g_new0 (GstType, 1);
|
||||
|
||||
@ -104,13 +114,14 @@ guint16 gst_type_register(GstTypeFactory *factory) {
|
||||
return id;
|
||||
}
|
||||
|
||||
static guint16 gst_type_find_by_mime_func(gchar *mime) {
|
||||
static
|
||||
guint16 gst_type_find_by_mime_func (gchar *mime)
|
||||
{
|
||||
GList *walk;
|
||||
GstType *type;
|
||||
gint typelen,mimelen;
|
||||
gchar *search, *found;
|
||||
|
||||
|
||||
walk = _gst_types;
|
||||
// DEBUG("searching for '%s'\n",mime);
|
||||
mimelen = strlen (mime);
|
||||
@ -139,7 +150,17 @@ static guint16 gst_type_find_by_mime_func(gchar *mime) {
|
||||
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;
|
||||
|
||||
typeid = gst_type_find_by_mime_func (mime);
|
||||
@ -151,7 +172,33 @@ guint16 gst_type_find_by_mime(gchar *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;
|
||||
GstType *type;
|
||||
|
||||
@ -165,7 +212,11 @@ GstType *gst_type_find_by_id(guint16 id) {
|
||||
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;
|
||||
GstElementFactory *factory;
|
||||
|
||||
@ -179,7 +230,14 @@ static void gst_type_dump_converter(gpointer key, gpointer value, gpointer data)
|
||||
g_print ("NULL)), ");
|
||||
}
|
||||
|
||||
void gst_type_dump() {
|
||||
/**
|
||||
* gst_type_dump:
|
||||
*
|
||||
* dumps the current type system
|
||||
*/
|
||||
void
|
||||
gst_type_dump(void)
|
||||
{
|
||||
GList *walk = _gst_types;
|
||||
GstType *type;
|
||||
|
||||
@ -196,7 +254,17 @@ void gst_type_dump() {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
GstType *type = gst_type_find_by_id (id);
|
||||
|
||||
@ -230,7 +298,17 @@ void gst_type_add_src(guint16 id,GstElementFactory *src) {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
GstType *type = gst_type_find_by_id (id);
|
||||
|
||||
@ -263,7 +341,18 @@ void gst_type_add_sink(guint16 id,GstElementFactory *sink) {
|
||||
}
|
||||
}
|
||||
|
||||
GList *gst_type_get_srcs(guint16 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);
|
||||
@ -271,7 +360,18 @@ GList *gst_type_get_srcs(guint16 id) {
|
||||
return type->srcs;
|
||||
}
|
||||
|
||||
GList *gst_type_get_sinks(guint16 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);
|
||||
@ -285,8 +385,9 @@ GList *gst_type_get_sinks(guint16 id) {
|
||||
* to connnect two GstTypes
|
||||
*
|
||||
**/
|
||||
|
||||
static GList *gst_type_enqueue(GList *queue, gint iNode, gint iDist, gint iPrev) {
|
||||
static GList*
|
||||
gst_type_enqueue (GList *queue, gint iNode, gint iDist, gint iPrev)
|
||||
{
|
||||
gst_type_node *node = g_malloc (sizeof (gst_type_node));
|
||||
|
||||
node->iNode = iNode;
|
||||
@ -298,7 +399,9 @@ static GList *gst_type_enqueue(GList *queue, gint iNode, gint iDist, gint iPrev)
|
||||
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;
|
||||
gst_type_node *node;
|
||||
|
||||
@ -315,7 +418,8 @@ static GList *gst_type_dequeue(GList *queue, gint *iNode, gint *iDist, gint *iPr
|
||||
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 current = rgnNodes[chNode].iPrev;
|
||||
@ -338,7 +442,9 @@ static GList *construct_path (gst_type_node *rgnNodes, gint chNode)
|
||||
return factories;
|
||||
}
|
||||
|
||||
static guint gst_type_find_cost(gint src, gint dest) {
|
||||
static guint
|
||||
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));
|
||||
@ -348,7 +454,19 @@ static guint gst_type_find_cost(gint src, gint dest) {
|
||||
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;
|
||||
GList *queue = NULL;
|
||||
gint iNode, iDist, iPrev, i, iCost;
|
||||
@ -392,18 +510,47 @@ GList *gst_type_get_sink_to_src(guint16 sinkid, guint16 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;
|
||||
}
|
||||
|
||||
xmlNodePtr gst_type_save_thyself(GstType *type, xmlNodePtr parent) {
|
||||
|
||||
/**
|
||||
* gst_type_save_thyself:
|
||||
* @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;
|
||||
}
|
||||
|
||||
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;
|
||||
guint16 typeid = 0;
|
||||
|
||||
@ -424,9 +571,18 @@ guint16 gst_type_load_thyself(xmlNodePtr parent) {
|
||||
return typeid;
|
||||
}
|
||||
|
||||
|
||||
xmlNodePtr gst_typefactory_save_thyself(GstTypeFactory *factory, xmlNodePtr parent) {
|
||||
|
||||
/**
|
||||
* gst_typefactory_save_thyself:
|
||||
* @factory: the type factory to save
|
||||
* @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) {
|
||||
xmlNewChild (parent, NULL, "extensions", factory->exts);
|
||||
@ -438,7 +594,8 @@ xmlNodePtr gst_typefactory_save_thyself(GstTypeFactory *factory, xmlNodePtr pare
|
||||
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;
|
||||
guint16 typeid;
|
||||
@ -456,7 +613,17 @@ static gboolean gst_type_typefind_dummy(GstBuffer *buffer, gpointer priv)
|
||||
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);
|
||||
xmlNodePtr field = parent->childs;
|
||||
|
@ -6,21 +6,29 @@ INCLUDES = $(GLIB_CFLAGS) $(GTK_CFLAGS) -I$(top_srcdir) \
|
||||
|
||||
bin_PROGRAMS = gstmediaplay
|
||||
|
||||
lib_LTLIBRARIES = libgstmediaplay.la
|
||||
|
||||
gladedir = $(datadir)/gstmediaplay
|
||||
glade_DATA = gstmediaplay.glade play.xpm stop.xpm pause.xpm
|
||||
|
||||
gstmediaplay_SOURCES = \
|
||||
gstplay.c main.c \
|
||||
libgstmediaplay_la_SOURCES = \
|
||||
gstplay.c \
|
||||
gstmediaplay.c gstmediaplay.h \
|
||||
gststatusarea.c gststatusarea.h \
|
||||
callbacks.c callbacks.h
|
||||
|
||||
gstmediaplay_SOURCES = \
|
||||
main.c
|
||||
|
||||
|
||||
CFLAGS += -O2 -Wall -DDATADIR=\""$(gladedir)/"\"
|
||||
|
||||
gstmediaplay_CFLAGS = $(shell gnome-config --cflags gnomeui) $(shell libglade-config --cflags gnome) \
|
||||
$(shell gstreamer-config --cflags )
|
||||
|
||||
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
|
||||
xvlibs=-lXv
|
||||
|
@ -139,14 +139,15 @@ GstElement *gst_queue_new(gchar *name) {
|
||||
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);
|
||||
|
||||
gst_buffer_unref (GST_BUFFER (data));
|
||||
}
|
||||
|
||||
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);
|
||||
queue->queue = NULL;
|
||||
queue->level_buffers = 0;
|
||||
@ -155,7 +156,7 @@ static void gst_queue_flush(GstQueue *queue) {
|
||||
static void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
||||
GstQueue *queue;
|
||||
gboolean tosignal = FALSE;
|
||||
guchar *name;
|
||||
const guchar *name;
|
||||
|
||||
g_return_if_fail(pad != NULL);
|
||||
g_return_if_fail(GST_IS_PAD(pad));
|
||||
@ -215,7 +216,7 @@ static void gst_queue_push(GstConnection *connection) {
|
||||
GstBuffer *buf = NULL;
|
||||
GSList *front;
|
||||
gboolean tosignal = FALSE;
|
||||
guchar *name;
|
||||
const guchar *name;
|
||||
|
||||
name = gst_element_get_name(GST_ELEMENT(queue));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user