Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
luzpaz
gstreamer
Commits
7baa6c18
Commit
7baa6c18
authored
Mar 15, 2004
by
Thomas Vander Stichele
Browse files
don't mix tabs and spaces
Original commit message from CVS: don't mix tabs and spaces
parent
84f49e60
Changes
189
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
7baa6c18
2004-03-15 Thomas Vander Stichele <thomas at apestaart dot org>
* *.c,*.h: don't mix tabs and spaces
2004-03-15 Johan Dahlin <johan@gnome.org>
* gst/schedulers/gstoptimalscheduler.c
...
...
components/bonobo-gstmediaplay/bonobo-gstmediaplay.c
View file @
7baa6c18
...
...
@@ -44,7 +44,8 @@ typedef struct
BonoboUIComponent
*
uic
;
GstPlay
*
play
;
}
control_data_t
;
}
control_data_t
;
/*
* This callback is invoked when the BonoboControl object
...
...
@@ -94,7 +95,8 @@ typedef struct
{
control_data_t
*
control_data
;
GtkFileSelection
*
selector
;
}
file_select_struct
;
}
file_select_struct
;
static
void
filename_selected
(
GtkButton
*
ok
,
gpointer
user_data
)
...
...
@@ -127,14 +129,14 @@ verb_Open_cb (BonoboUIComponent * uic, gpointer user_data, const char *cname)
data
->
control_data
=
control_data
;
gtk_signal_connect
(
GTK_OBJECT
(
GTK_FILE_SELECTION
(
file_selector
)
->
ok_button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
filename_selected
),
data
);
ok_button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
filename_selected
),
data
);
gtk_signal_connect_object
(
GTK_OBJECT
(
GTK_FILE_SELECTION
(
file_selector
)
->
ok_button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
gtk_widget_destroy
),
ok_button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
gtk_widget_destroy
),
(
gpointer
)
file_selector
);
gtk_signal_connect_object
(
GTK_OBJECT
(
GTK_FILE_SELECTION
(
file_selector
)
->
cancel_button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
gtk_widget_destroy
),
cancel_button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
gtk_widget_destroy
),
(
gpointer
)
file_selector
);
gtk_widget_show
(
file_selector
);
...
...
@@ -208,7 +210,7 @@ control_create_menus (control_data_t * control_data)
node
=
bonobo_ui_node_from_string
(
ui
);
bonobo_ui_util_translate_ui
(
node
);
bonobo_ui_util_fixup_help
(
control_data
->
uic
,
node
,
DATADIR
,
"gstmediaplay"
);
DATADIR
,
"gstmediaplay"
);
bonobo_ui_component_set_tree
(
control_data
->
uic
,
"/"
,
node
,
NULL
);
...
...
examples/cutter/cutter.c
View file @
7baa6c18
...
...
@@ -20,7 +20,7 @@ gboolean playing = TRUE;
gboolean
cut_start_signalled
=
FALSE
;
gboolean
cut_stop_signalled
=
FALSE
;
int
id
=
0
;
/* increment this for each new cut */
int
id
=
0
;
/* increment this for each new cut */
GstElement
*
main_bin
;
GstElement
*
audiosrc
;
GstElement
*
queue
;
...
...
@@ -51,9 +51,9 @@ cut_start (GstElement * element)
ct
=
localtime
(
&
seconds
);
/* sprintf (buffer, "/news/incoming/audio/cutter.%06d.wav", id); */
sprintf
(
buffer
,
"/news/incoming/audio/cutter.%04d%02d%02d.%02d%02d%02d.wav"
,
ct
->
tm_year
+
1900
,
ct
->
tm_mon
,
ct
->
tm_mday
,
ct
->
tm_hour
,
ct
->
tm_min
,
ct
->
tm_sec
);
"/news/incoming/audio/cutter.%04d%02d%02d.%02d%02d%02d.wav"
,
ct
->
tm_year
+
1900
,
ct
->
tm_mon
,
ct
->
tm_mday
,
ct
->
tm_hour
,
ct
->
tm_min
,
ct
->
tm_sec
);
}
g_print
(
"DEBUG: cut_start: setting new location to %s
\n
"
,
buffer
);
g_object_set
(
G_OBJECT
(
disksink
),
"location"
,
buffer
,
NULL
);
...
...
examples/launch/mp3parselaunch.c
View file @
7baa6c18
...
...
@@ -15,8 +15,7 @@ main (int argc, char *argv[])
return
-
1
;
}
pipeline
=
(
GstElement
*
)
pipeline
=
(
GstElement
*
)
gst_parse_launch
(
"filesrc name=my_filesrc ! mad ! osssink"
,
&
error
);
if
(
!
pipeline
)
{
fprintf
(
stderr
,
"Parse error: %s"
,
error
->
message
);
...
...
examples/mixer/mixer.c
View file @
7baa6c18
...
...
@@ -88,7 +88,7 @@ main (int argc, char *argv[])
char
buffer
[
20
];
GList
*
input_channels
;
/* structure holding all the input channels */
GList
*
input_channels
;
/* structure holding all the input channels */
input_channel_t
*
channel_in
;
...
...
@@ -96,7 +96,7 @@ main (int argc, char *argv[])
GstElement
*
adder
;
GstElement
*
audiosink
;
GstPad
*
pad
;
/* to request pads for the adder */
GstPad
*
pad
;
/* to request pads for the adder */
gst_init
(
&
argc
,
&
argv
);
...
...
@@ -167,17 +167,17 @@ main (int argc, char *argv[])
/* first song gets special treatment for end style */
env_register_cp
(
channel_in
->
volenv
,
0
.
0
,
1
.
0
);
}
else
{
env_register_cp
(
channel_in
->
volenv
,
0
.
0
,
0
.
0000001
);
/* start muted */
env_register_cp
(
channel_in
->
volenv
,
i
*
10
.
0
-
15
.
0
,
0
.
0000001
);
/* start fade in */
env_register_cp
(
channel_in
->
volenv
,
0
.
0
,
0
.
0000001
);
/* start muted */
env_register_cp
(
channel_in
->
volenv
,
i
*
10
.
0
-
15
.
0
,
0
.
0000001
);
/* start fade in */
env_register_cp
(
channel_in
->
volenv
,
i
*
10
.
0
-
10
.
0
,
1
.
0
);
}
env_register_cp
(
channel_in
->
volenv
,
i
*
10
.
0
-
5
.
0
,
1
.
0
);
/* end of full level */
env_register_cp
(
channel_in
->
volenv
,
i
*
10
.
0
-
5
.
0
,
1
.
0
);
/* end of full level */
if
(
i
!=
num_channels
)
{
env_register_cp
(
channel_in
->
volenv
,
i
*
10
.
0
,
0
.
0000001
);
/* fade to black */
env_register_cp
(
channel_in
->
volenv
,
num_channels
*
10
.
0
-
5
.
0
,
0
.
0000001
);
/* start fade in */
env_register_cp
(
channel_in
->
volenv
,
i
*
10
.
0
,
0
.
0000001
);
/* fade to black */
env_register_cp
(
channel_in
->
volenv
,
num_channels
*
10
.
0
-
5
.
0
,
0
.
0000001
);
/* start fade in */
}
env_register_cp
(
channel_in
->
volenv
,
num_channels
*
10
.
0
,
1
.
0
/
num_channels
);
/* to end level */
env_register_cp
(
channel_in
->
volenv
,
num_channels
*
10
.
0
,
1
.
0
/
num_channels
);
/* to end level */
#ifndef GST_DISABLE_LOADSAVE
gst_xml_write_file
(
GST_ELEMENT
(
main_bin
),
fopen
(
"mixer.xml"
,
"w"
));
...
...
@@ -230,7 +230,7 @@ create_input_channel (int id, char *location)
input_channel_t
*
channel
;
char
buffer
[
20
];
/* hold the names */
char
buffer
[
20
];
/* hold the names */
/* GstAutoplug *autoplug;
GstCaps *srccaps; */
...
...
examples/plugins/example.c
View file @
7baa6c18
...
...
@@ -58,13 +58,13 @@ enum
* can have. They can be quite complex, but for this example plugin
* they are rather simple.
*/
GstStaticPadTemplate
sink_template
=
GST_STATIC_PAD_TEMPLATE
(
"sink"
,
/* The name of the pad */
GST_PAD_SINK
,
/* Direction of the pad */
GST_PAD_ALWAYS
,
/* The pad exists for every instance */
GST_STATIC_CAPS
(
"unknown/unknown, "
/* The MIME media type */
"foo:int=1, "
/* an integer property */
"bar:boolean=true, "
/* a boolean property */
"baz:int={ 1, 3 }"
/* a list of values */
GstStaticPadTemplate
sink_template
=
GST_STATIC_PAD_TEMPLATE
(
"sink"
,
/* The name of the pad */
GST_PAD_SINK
,
/* Direction of the pad */
GST_PAD_ALWAYS
,
/* The pad exists for every instance */
GST_STATIC_CAPS
(
"unknown/unknown, "
/* The MIME media type */
"foo:int=1, "
/* an integer property */
"bar:boolean=true, "
/* a boolean property */
"baz:int={ 1, 3 }"
/* a list of values */
)
);
...
...
@@ -120,9 +120,10 @@ gst_example_get_type (void)
0
,
(
GInstanceInitFunc
)
gst_example_init
,
};
example_type
=
g_type_register_static
(
GST_TYPE_ELEMENT
,
"GstExample"
,
&
example_info
,
0
);
g_type_register_static
(
GST_TYPE_ELEMENT
,
"GstExample"
,
&
example_info
,
0
);
}
return
example_type
;
}
...
...
@@ -152,7 +153,7 @@ gst_example_class_init (GstExampleClass * klass)
/* Here we add an argument to the object. This argument is an integer,
* and can be both read and written.
*/
g_object_class_install_property
(
G_OBJECT_CLASS
(
klass
),
ARG_ACTIVE
,
g_param_spec_int
(
"active"
,
"active"
,
"active"
,
G_MININT
,
G_MAXINT
,
0
,
G_PARAM_READWRITE
));
/* CHECKME */
g_object_class_install_property
(
G_OBJECT_CLASS
(
klass
),
ARG_ACTIVE
,
g_param_spec_int
(
"active"
,
"active"
,
"active"
,
G_MININT
,
G_MAXINT
,
0
,
G_PARAM_READWRITE
));
/* CHECKME */
/* Here we add a signal to the object. This is avery useless signal
* called asdf. The signal will also pass a pointer to the listeners
...
...
@@ -261,7 +262,7 @@ gst_example_chain (GstPad * pad, GstData * _data)
/* Then copy the data in the incoming buffer into the new buffer. */
memcpy
(
GST_BUFFER_DATA
(
outbuf
),
GST_BUFFER_DATA
(
buf
),
GST_BUFFER_SIZE
(
outbuf
));
GST_BUFFER_SIZE
(
outbuf
));
/* we don't need the incomming buffer anymore so we unref it. When we are
* the last plugin with a handle to the buffer, its memory will be freed */
...
...
@@ -392,7 +393,7 @@ plugin_init (GstPlugin * plugin)
* when compared to similar plugins and the GType identifier.
*/
if
(
!
gst_element_register
(
plugin
,
"example"
,
GST_RANK_MARGINAL
,
GST_TYPE_EXAMPLE
))
GST_TYPE_EXAMPLE
))
return
FALSE
;
/* Now we can return successfully. */
...
...
@@ -410,16 +411,16 @@ plugin_init (GstPlugin * plugin)
* The symbol pointing to this structure is the only symbol looked up when
* loading the plugin.
*/
GST_PLUGIN_DEFINE
(
GST_VERSION_MAJOR
,
/* The major version of the core that this was built with */
GST_VERSION_MINOR
,
/* The minor version of the core that this was built with */
"example"
,
/* The name of the plugin. This must be unique: plugins with
* the same name will be assumed to be identical, and only
* one will be loaded. */
"an example plugin"
,
/* a short description of the plugin in English */
plugin_init
,
/* Pointer to the initialisation function for the plugin. */
"0.1"
,
/* The version number of the plugin */
"LGPL"
,
/* ieffective license the plugin can be shipped with. Must be
* valid for all libraries it links to, too. */
GST_PLUGIN_DEFINE
(
GST_VERSION_MAJOR
,
/* The major version of the core that this was built with */
GST_VERSION_MINOR
,
/* The minor version of the core that this was built with */
"example"
,
/* The name of the plugin. This must be unique: plugins with
* the same name will be assumed to be identical, and only
* one will be loaded. */
"an example plugin"
,
/* a short description of the plugin in English */
plugin_init
,
/* Pointer to the initialisation function for the plugin. */
"0.1"
,
/* The version number of the plugin */
"LGPL"
,
/* ieffective license the plugin can be shipped with. Must be
* valid for all libraries it links to, too. */
"my nifty plugin package"
,
/* package this plugin belongs to. */
"http://www.mydomain.com"
...
...
examples/retag/retag.c
View file @
7baa6c18
...
...
@@ -67,7 +67,7 @@ main (int argc, char *argv[])
g_assert
(
filesink
);
/* set the filenames */
filename
=
g_strdup_printf
(
"%s.temp"
,
argv
[
1
]);
/* easy solution */
filename
=
g_strdup_printf
(
"%s.temp"
,
argv
[
1
]);
/* easy solution */
g_object_set
(
G_OBJECT
(
filesrc
),
"location"
,
argv
[
1
],
NULL
);
g_object_set
(
G_OBJECT
(
filesink
),
"location"
,
filename
,
NULL
);
...
...
examples/retag/transcode.c
View file @
7baa6c18
...
...
@@ -75,7 +75,7 @@ main (int argc, char *argv[])
g_assert
(
filesink
);
/* set the filenames */
filename
=
g_strdup_printf
(
"%s.ogg"
,
argv
[
1
]);
/* easy solution */
filename
=
g_strdup_printf
(
"%s.ogg"
,
argv
[
1
]);
/* easy solution */
g_object_set
(
G_OBJECT
(
filesrc
),
"location"
,
argv
[
1
],
NULL
);
g_object_set
(
G_OBJECT
(
filesink
),
"location"
,
filename
,
NULL
);
g_free
(
filename
);
...
...
examples/xml/runxml.c
View file @
7baa6c18
...
...
@@ -14,13 +14,13 @@ xml_loaded (GstXML * xml, GstObject * object, xmlNodePtr self, gpointer data)
xmlNodePtr
nodes
=
children
->
xmlChildrenNode
;
while
(
nodes
)
{
if
(
!
strcmp
(
nodes
->
name
,
"text"
))
{
gchar
*
name
=
g_strdup
(
xmlNodeGetContent
(
nodes
));
if
(
!
strcmp
(
nodes
->
name
,
"text"
))
{
gchar
*
name
=
g_strdup
(
xmlNodeGetContent
(
nodes
));
g_print
(
"object %s loaded with comment '%s'
\n
"
,
gst_object_get_name
(
object
),
name
);
}
nodes
=
nodes
->
next
;
g_print
(
"object %s loaded with comment '%s'
\n
"
,
gst_object_get_name
(
object
),
name
);
}
nodes
=
nodes
->
next
;
}
}
children
=
children
->
next
;
...
...
gst/autoplug/gstsearchfuncs.c
View file @
7baa6c18
...
...
@@ -92,8 +92,8 @@ gst_autoplug_can_connect_src (GstElementFactory * fac, const GstCaps * src)
while
(
templs
)
{
if
((
GST_PAD_TEMPLATE_DIRECTION
(
templs
->
data
)
==
GST_PAD_SINK
)
&&
gst_autoplug_caps_intersect
(
src
,
GST_PAD_TEMPLATE_CAPS
(
templs
->
data
)))
{
gst_autoplug_caps_intersect
(
src
,
GST_PAD_TEMPLATE_CAPS
(
templs
->
data
)))
{
return
GST_PAD_TEMPLATE
(
templs
->
data
);
}
templs
=
g_list_next
(
templs
);
...
...
@@ -122,7 +122,7 @@ gst_autoplug_can_connect_sink (GstElementFactory * fac, const GstCaps * sink)
GstCaps
*
caps
=
GST_PAD_TEMPLATE_CAPS
(
templs
->
data
);
if
((
GST_PAD_TEMPLATE_DIRECTION
(
templs
->
data
)
==
GST_PAD_SRC
)
&&
gst_autoplug_caps_intersect
(
caps
,
sink
))
{
gst_autoplug_caps_intersect
(
caps
,
sink
))
{
return
GST_PAD_TEMPLATE
(
templs
->
data
);
}
templs
=
g_list_next
(
templs
);
...
...
@@ -147,13 +147,13 @@ gst_autoplug_can_match (GstElementFactory * src, GstElementFactory * dest)
GstPadTemplate
*
desttemp
=
(
GstPadTemplate
*
)
desttemps
->
data
;
if
(
srctemp
->
direction
==
GST_PAD_SRC
&&
desttemp
->
direction
==
GST_PAD_SINK
)
{
if
(
gst_autoplug_caps_intersect
(
gst_pad_template_get_caps
(
srctemp
),
gst_pad_template_get_caps
(
desttemp
)))
{
GST_DEBUG
(
"factory
\"
%s
\"
can connect with factory
\"
%s
\"
"
,
GST_OBJECT_NAME
(
src
),
GST_OBJECT_NAME
(
dest
));
return
desttemp
;
}
desttemp
->
direction
==
GST_PAD_SINK
)
{
if
(
gst_autoplug_caps_intersect
(
gst_pad_template_get_caps
(
srctemp
),
gst_pad_template_get_caps
(
desttemp
)))
{
GST_DEBUG
(
"factory
\"
%s
\"
can connect with factory
\"
%s
\"
"
,
GST_OBJECT_NAME
(
src
),
GST_OBJECT_NAME
(
dest
));
return
desttemp
;
}
}
desttemps
=
g_list_next
(
desttemps
);
...
...
@@ -219,7 +219,7 @@ gst_autoplug_factories_filters (GList * factories)
while
(
factories
)
{
/* if you want it faster do src/sink check at once, don't call two functions */
if
(
gst_autoplug_factory_has_src
(
factories
->
data
)
&&
gst_autoplug_factory_has_sink
(
factories
->
data
))
&&
gst_autoplug_factory_has_sink
(
factories
->
data
))
ret
=
g_list_prepend
(
ret
,
factories
->
data
);
factories
=
g_list_next
(
factories
);
}
...
...
@@ -256,18 +256,18 @@ gst_autoplug_factories_filters_with_sink_caps (GList * factories)
gboolean
have_sink
=
FALSE
;
while
(
templs
)
{
if
(
GST_PAD_TEMPLATE_DIRECTION
(
templs
->
data
)
==
GST_PAD_SRC
)
{
have_src
=
TRUE
;
}
if
((
GST_PAD_TEMPLATE_DIRECTION
(
templs
->
data
)
==
GST_PAD_SINK
)
&&
(
GST_PAD_TEMPLATE_CAPS
(
templs
->
data
)
!=
NULL
))
{
have_sink
=
TRUE
;
}
if
(
have_src
&&
have_sink
)
{
ret
=
g_list_prepend
(
ret
,
factory
);
break
;
}
templs
=
g_list_next
(
templs
);
if
(
GST_PAD_TEMPLATE_DIRECTION
(
templs
->
data
)
==
GST_PAD_SRC
)
{
have_src
=
TRUE
;
}
if
((
GST_PAD_TEMPLATE_DIRECTION
(
templs
->
data
)
==
GST_PAD_SINK
)
&&
(
GST_PAD_TEMPLATE_CAPS
(
templs
->
data
)
!=
NULL
))
{
have_sink
=
TRUE
;
}
if
(
have_src
&&
have_sink
)
{
ret
=
g_list_prepend
(
ret
,
factory
);
break
;
}
templs
=
g_list_next
(
templs
);
}
}
factories
=
g_list_next
(
factories
);
...
...
@@ -291,10 +291,10 @@ gst_autoplug_factories_at_most_templates (GList * factories,
while
(
templs
)
{
if
(
GST_PAD_TEMPLATE_DIRECTION
(
templs
->
data
)
==
dir
)
{
count
++
;
count
++
;
}
if
(
count
>
maxtemplates
)
break
;
break
;
templs
=
g_list_next
(
templs
);
}
if
(
count
<=
maxtemplates
)
...
...
@@ -326,8 +326,8 @@ gst_autoplug_sp (const GstCaps * srccaps, const GstCaps * sinkcaps,
GList
*
factories
)
{
GList
*
factory_nodes
=
NULL
;
guint
curcost
=
GST_AUTOPLUG_MAX_COST
;
/* below this cost, there is no path */
GstAutoplugNode
*
bestnode
=
NULL
;
/* best (unconnected) endpoint currently */
guint
curcost
=
GST_AUTOPLUG_MAX_COST
;
/* below this cost, there is no path */
GstAutoplugNode
*
bestnode
=
NULL
;
/* best (unconnected) endpoint currently */
g_return_val_if_fail
(
srccaps
!=
NULL
,
NULL
);
g_return_val_if_fail
(
sinkcaps
!=
NULL
,
NULL
);
...
...
@@ -345,15 +345,15 @@ gst_autoplug_sp (const GstCaps * srccaps, const GstCaps * sinkcaps,
GST_DEBUG
(
"trying with %s"
,
node
->
fac
->
details
.
longname
);
node
->
templ
=
gst_autoplug_can_connect_src
(
node
->
fac
,
srccaps
);
node
->
cost
=
(
node
->
templ
?
gst_autoplug_get_cost
(
node
->
fac
)
:
GST_AUTOPLUG_MAX_COST
);
:
GST_AUTOPLUG_MAX_COST
);
node
->
endpoint
=
gst_autoplug_can_connect_sink
(
node
->
fac
,
sinkcaps
);
if
(
node
->
templ
&&
node
->
endpoint
)
GST_DEBUG
(
"%s makes connection possible"
,
node
->
fac
->
details
.
longname
);
else
GST_DEBUG
(
"direct connection with %s not possible"
,
node
->
fac
->
details
.
longname
);
node
->
fac
->
details
.
longname
);
if
((
node
->
endpoint
!=
NULL
)
&&
((
bestnode
==
NULL
)
||
(
node
->
cost
<
bestnode
->
cost
)))
{
((
bestnode
==
NULL
)
||
(
node
->
cost
<
bestnode
->
cost
)))
{
bestnode
=
node
;
}
factory_nodes
=
g_list_prepend
(
factory_nodes
,
node
);
...
...
@@ -372,22 +372,22 @@ gst_autoplug_sp (const GstCaps * srccaps, const GstCaps * sinkcaps,
/* iterate until we found the best path */
while
(
curcost
<
GST_AUTOPLUG_MAX_COST
)
{
GList
*
nodes
=
factory_nodes
;
guint
nextcost
=
GST_AUTOPLUG_MAX_COST
;
/* next cost to check */
guint
nextcost
=
GST_AUTOPLUG_MAX_COST
;
/* next cost to check */
GST_DEBUG
(
"iterating at current cost %d, bestnode %s at %d"
,
curcost
,
GST_OBJECT_NAME
(
bestnode
->
fac
),
bestnode
->
cost
);
GST_OBJECT_NAME
(
bestnode
->
fac
),
bestnode
->
cost
);
/* check if we already have a valid best connection to the sink */
if
(
bestnode
->
cost
<=
curcost
)
{
GList
*
ret
;
GST_DEBUG
(
"found a way to connect via %s"
,
GST_OBJECT_NAME
((
GstObject
*
)
bestnode
->
fac
));
GST_OBJECT_NAME
((
GstObject
*
)
bestnode
->
fac
));
/* enter all factories into the return list */
ret
=
g_list_prepend
(
NULL
,
bestnode
->
fac
);
bestnode
=
bestnode
->
prev
;
while
(
bestnode
!=
NULL
)
{
ret
=
g_list_prepend
(
ret
,
bestnode
->
fac
);
bestnode
=
bestnode
->
prev
;
ret
=
g_list_prepend
(
ret
,
bestnode
->
fac
);
bestnode
=
bestnode
->
prev
;
}
g_list_free_list_and_elements
(
factory_nodes
);
return
ret
;
...
...
@@ -399,36 +399,35 @@ gst_autoplug_sp (const GstCaps * srccaps, const GstCaps * sinkcaps,
*/
while
(
nodes
)
{
if
(((
GstAutoplugNode
*
)
nodes
->
data
)
->
cost
==
curcost
)
{
/* now check all elements if we got a shorter path */
GList
*
sinknodes
=
factory_nodes
;
GstAutoplugNode
*
srcnode
=
(
GstAutoplugNode
*
)
nodes
->
data
;
while
(
sinknodes
)
{
GstAutoplugNode
*
sinknode
=
(
GstAutoplugNode
*
)
sinknodes
->
data
;
GstPadTemplate
*
templ
;
if
((
sinknode
->
cost
>
srcnode
->
cost
+
gst_autoplug_get_cost
(
sinknode
->
fac
))
&&
(
templ
=
gst_autoplug_can_match
(
srcnode
->
fac
,
sinknode
->
fac
)))
{
/* we got a shorter path
* now enter that path to that node */
sinknode
->
prev
=
srcnode
;
sinknode
->
templ
=
templ
;
sinknode
->
cost
=
srcnode
->
cost
+
gst_autoplug_get_cost
(
sinknode
->
fac
);
/* make sure to set which cost to view next */
nextcost
=
(
nextcost
>
sinknode
->
cost
)
?
sinknode
->
cost
:
nextcost
;
/* did we get a new best node? */
if
(
sinknode
->
endpoint
&&
(
sinknode
->
cost
<
bestnode
->
cost
))
{
bestnode
=
sinknode
;
}
}
sinknodes
=
g_list_next
(
sinknodes
);
}
/* FIXME: for speed remove the item we just iterated with from the factory_nodes
* but don't free it yet and don't forget to free it.
*/
/* now check all elements if we got a shorter path */
GList
*
sinknodes
=
factory_nodes
;
GstAutoplugNode
*
srcnode
=
(
GstAutoplugNode
*
)
nodes
->
data
;
while
(
sinknodes
)
{
GstAutoplugNode
*
sinknode
=
(
GstAutoplugNode
*
)
sinknodes
->
data
;
GstPadTemplate
*
templ
;
if
((
sinknode
->
cost
>
srcnode
->
cost
+
gst_autoplug_get_cost
(
sinknode
->
fac
))
&&
(
templ
=
gst_autoplug_can_match
(
srcnode
->
fac
,
sinknode
->
fac
)))
{
/* we got a shorter path
* now enter that path to that node */
sinknode
->
prev
=
srcnode
;
sinknode
->
templ
=
templ
;
sinknode
->
cost
=
srcnode
->
cost
+
gst_autoplug_get_cost
(
sinknode
->
fac
);
/* make sure to set which cost to view next */
nextcost
=
(
nextcost
>
sinknode
->
cost
)
?
sinknode
->
cost
:
nextcost
;
/* did we get a new best node? */
if
(
sinknode
->
endpoint
&&
(
sinknode
->
cost
<
bestnode
->
cost
))
{
bestnode
=
sinknode
;
}
}
sinknodes
=
g_list_next
(
sinknodes
);
}
/* FIXME: for speed remove the item we just iterated with from the factory_nodes
* but don't free it yet and don't forget to free it.
*/
}
nodes
=
g_list_next
(
nodes
);
}
...
...
gst/autoplug/gstspider.c
View file @
7baa6c18
...
...
@@ -138,8 +138,9 @@ gst_spider_get_type (void)
0
,
(
GInstanceInitFunc
)
gst_spider_init
,
};
spider_type
=
g_type_register_static
(
GST_TYPE_BIN
,
"GstSpider"
,
&
spider_info
,
0
);
g_type_register_static
(
GST_TYPE_BIN
,
"GstSpider"
,
&
spider_info
,
0
);
}
return
spider_type
;
}
...
...
@@ -158,7 +159,7 @@ gst_spider_class_init (GstSpiderClass * klass)
/* properties */
g_object_class_install_property
(
G_OBJECT_CLASS
(
klass
),
ARG_FACTORIES
,
g_param_spec_pointer
(
"factories"
,
"allowed factories"
,
"allowed factories for autoplugging"
,
G_PARAM_READWRITE
));
"allowed factories for autoplugging"
,
G_PARAM_READWRITE
));
gobject_class
->
set_property
=
gst_spider_set_property
;
gobject_class
->
get_property
=
gst_spider_get_property
;
...
...
@@ -251,9 +252,9 @@ gst_spider_set_property (GObject * object, guint prop_id, const GValue * value,
case
ARG_FACTORIES
:
list
=
(
GList
*
)
g_value_get_pointer
(
value
);
while
(
list
)
{
g_return_if_fail
(
list
->
data
!=
NULL
);
g_return_if_fail
(
GST_IS_ELEMENT_FACTORY
(
list
->
data
));
list
=
g_list_next
(
list
);
g_return_if_fail
(
list
->
data
!=
NULL
);
g_return_if_fail
(
GST_IS_ELEMENT_FACTORY
(
list
->
data
));
list
=
g_list_next
(
list
);
}
g_list_free
(
spider
->
factories
);
spider
->
factories
=
(
GList
*
)
g_value_get_pointer
(
value
);
...
...
@@ -304,7 +305,7 @@ gst_spider_link_sometimes (GstElement * src, GstPad * pad,
/* try to autoplug the elements */
if
(
gst_spider_plug_from_srcpad
(
conn
,
pad
)
!=
GST_PAD_LINK_REFUSED
)
{
GST_DEBUG
(
"%s:%s was autoplugged to %s:%s, removing callback"
,
GST_DEBUG_PAD_NAME
(
pad
),
GST_DEBUG_PAD_NAME
(
conn
->
src
->
sink
));
GST_DEBUG_PAD_NAME
(
pad
),
GST_DEBUG_PAD_NAME
(
conn
->
src
->
sink
));
g_signal_handler_disconnect
(
src
,
signal_id
);
signal_id
=
0
;
}
...
...
@@ -425,24 +426,24 @@ gst_spider_identity_plug (GstSpiderIdentity * ident)
factories
=
spider
->
factories
;
while
(
factories
)
{
if
((
padtemp
=
gst_autoplug_can_connect_src
(
factories
->
data
,
src_caps
)))
{
const
GstCaps
*
caps
=
gst_pad_template_get_caps
(
padtemp
);
GST_DEBUG
(
"can connect src to pad template: %"
GST_PTR_FORMAT
,
caps
);
found
=
TRUE
;
}
factories
=
factories
->
next
;
if
((
padtemp
=
gst_autoplug_can_connect_src
(
factories
->
data
,
src_caps
)))
{
const
GstCaps
*
caps
=
gst_pad_template_get_caps
(
padtemp
);
GST_DEBUG
(
"can connect src to pad template: %"
GST_PTR_FORMAT
,
caps
);
found
=
TRUE
;
}
factories
=
factories
->
next
;
}
if
(
!
found
)
{
const
char
*
mime
;
const
char
*
mime
;
mime
=
gst_structure_get_name
(
gst_caps_get_structure
(
src_caps
,
0
));
mime
=
gst_structure_get_name
(
gst_caps_get_structure
(
src_caps
,
0
));
GST_ELEMENT_ERROR
(
spider
,
STREAM
,
CODEC_NOT_FOUND
,
(
_
(
"There is no element present to handle the stream's mime type %s."
),
mime
),
(
NULL
));
gst_caps_free
(
src_caps
);
return
;
GST_ELEMENT_ERROR
(
spider
,
STREAM
,
CODEC_NOT_FOUND
,
(
_
(
"There is no element present to handle the stream's mime type %s."
),
mime
),
(
NULL
));
gst_caps_free
(
src_caps
);
return
;
}
}
gst_caps_free
(
src_caps
);
...
...
@@ -482,15 +483,15 @@ gst_spider_identity_plug (GstSpiderIdentity * ident)
if
(
dir
!=
GST_PAD_DIRECTION
(
otherpad
))
{
/* we only link to plugged in elements */
if
(
peer
->
plugged
==
TRUE
)
{
/* plug in the right direction */
if
(
dir
==
GST_PAD_SINK
)
{
conn
=
gst_spider_link_get
(
peer
);
}
else
{
conn
=
gst_spider_link_get
(
ident
);
}
if
((
GstElement
*
)
spider
->
sink_ident
==
conn
->
current
)
{
gst_spider_plug
(
conn
);
}
/* plug in the right direction */
if
(
dir
==
GST_PAD_SINK
)
{
conn
=
gst_spider_link_get
(
peer
);
}
else
{
conn
=
gst_spider_link_get
(
ident
);
}
if
((
GstElement
*
)
spider
->
sink_ident
==
conn
->
current
)
{
gst_spider_plug
(
conn
);
}
}
}
padlist
=
g_list_next
(
padlist
);
...
...
@@ -536,9 +537,9 @@ gst_spider_create_and_plug (GstSpiderConnection * conn, GList * plugpath)
templist
=
g_list_last
(
plugpath
);
element
=
(
GstElement
*
)
conn
->
src
;
while
((
plugpath
!=
NULL
)
&&
(
element
=
gst_spider_find_element_to_plug
(
element
,
(
GstElementFactory
*
)
plugpath
->
data
,
GST_PAD_SINK
)))
{
&&
(
element
=
gst_spider_find_element_to_plug
(
element
,
(
GstElementFactory
*
)
plugpath
->
data
,
GST_PAD_SINK
)))
{
GList
*
cur
=
templist
;
endelements
=
g_list_prepend
(
endelements
,
element
);
...
...
@@ -549,18 +550,18 @@ gst_spider_create_and_plug (GstSpiderConnection * conn, GList * plugpath)
/* do the linking */
while
(
conn
->
current
!=
(
GstElement
*
)
(
endelements
==
NULL
?
conn
->
src
:
endelements
->
data
))
{
NULL
?
conn
->
src
:
endelements
->
data
))
{
/* get sink element to plug, src is conn->current */
if
(
plugpath
==
NULL
)
{