mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-29 21:14:47 +00:00
don't mix tabs and spaces
Original commit message from CVS: don't mix tabs and spaces
This commit is contained in:
parent
84f49e604d
commit
7baa6c18e7
189 changed files with 5170 additions and 5041 deletions
|
@ -1,3 +1,7 @@
|
|||
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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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; */
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
/* 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;
|
||||
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.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
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;
|
||||
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) {
|
||||
element =
|
||||
(GstElement *) (endelements == NULL ? conn->src : endelements->data);
|
||||
(GstElement *) (endelements == NULL ? conn->src : endelements->data);
|
||||
} else {
|
||||
element =
|
||||
gst_element_factory_create ((GstElementFactory *) plugpath->data,
|
||||
NULL);
|
||||
gst_element_factory_create ((GstElementFactory *) plugpath->data,
|
||||
NULL);
|
||||
GST_DEBUG
|
||||
("Adding element %s of type %s and syncing state with autoplugger",
|
||||
GST_ELEMENT_NAME (element), GST_PLUGIN_FEATURE_NAME (plugpath->data));
|
||||
("Adding element %s of type %s and syncing state with autoplugger",
|
||||
GST_ELEMENT_NAME (element), GST_PLUGIN_FEATURE_NAME (plugpath->data));
|
||||
gst_bin_add (GST_BIN (spider), element);
|
||||
}
|
||||
/* insert and link new element */
|
||||
|
@ -572,30 +573,30 @@ gst_spider_create_and_plug (GstSpiderConnection * conn, GList * plugpath)
|
|||
|
||||
/* remove element that couldn't be linked, if it wasn't the endpoint */
|
||||
if (element != (GstElement *) conn->src)
|
||||
gst_bin_remove (GST_BIN (spider), element);
|
||||
gst_bin_remove (GST_BIN (spider), element);
|
||||
|
||||
while (templs) {
|
||||
GstPadTemplate *templ = (GstPadTemplate *) templs->data;
|
||||
GstPadTemplate *templ = (GstPadTemplate *) templs->data;
|
||||
|
||||
if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC)
|
||||
&& (GST_PAD_TEMPLATE_PRESENCE (templ) == GST_PAD_SOMETIMES)) {
|
||||
GST_DEBUG ("adding callback to link element %s to %s",
|
||||
GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
||||
conn->signal_id =
|
||||
g_signal_connect (G_OBJECT (conn->current), "new_pad",
|
||||
G_CALLBACK (gst_spider_link_sometimes), conn);
|
||||
g_list_free (plugpath);
|
||||
return GST_PAD_LINK_DELAYED;
|
||||
}
|
||||
templs = g_list_next (templs);
|
||||
if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC)
|
||||
&& (GST_PAD_TEMPLATE_PRESENCE (templ) == GST_PAD_SOMETIMES)) {
|
||||
GST_DEBUG ("adding callback to link element %s to %s",
|
||||
GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
||||
conn->signal_id =
|
||||
g_signal_connect (G_OBJECT (conn->current), "new_pad",
|
||||
G_CALLBACK (gst_spider_link_sometimes), conn);
|
||||
g_list_free (plugpath);
|
||||
return GST_PAD_LINK_DELAYED;
|
||||
}
|
||||
templs = g_list_next (templs);
|
||||
}
|
||||
GST_DEBUG ("no chance to link element %s to %s",
|
||||
GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
||||
GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
||||
g_list_free (plugpath);
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
GST_DEBUG ("added element %s and attached it to element %s",
|
||||
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (conn->current));
|
||||
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (conn->current));
|
||||
gst_spider_link_add (conn, element);
|
||||
if (plugpath != NULL)
|
||||
plugpath = g_list_delete_link (plugpath, plugpath);
|
||||
|
@ -622,13 +623,13 @@ gst_spider_find_element_to_plug (GstElement * src, GstElementFactory * fac,
|
|||
|
||||
/* is the pad on the right side and is it linked? */
|
||||
if ((GST_PAD_DIRECTION (pad) == dir)
|
||||
&& (pad = (GstPad *) (GST_RPAD_PEER (pad)))) {
|
||||
&& (pad = (GstPad *) (GST_RPAD_PEER (pad)))) {
|
||||
/* is the element the pad is linked to of the right type? */
|
||||
GstElement *element = GST_PAD_PARENT (pad);
|
||||
|
||||
if (G_TYPE_FROM_INSTANCE (element) ==
|
||||
gst_element_factory_get_element_type (fac)) {
|
||||
return element;
|
||||
gst_element_factory_get_element_type (fac)) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
padlist = g_list_next (padlist);
|
||||
|
@ -671,7 +672,7 @@ gst_spider_plug_from_srcpad (GstSpiderConnection * conn, GstPad * srcpad)
|
|||
/* see if they match already */
|
||||
if (gst_pad_link (srcpad, conn->src->sink)) {
|
||||
GST_DEBUG ("%s:%s and %s:%s can link directly",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (conn->src->sink));
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (conn->src->sink));
|
||||
gst_pad_unlink (srcpad, conn->src->sink);
|
||||
gst_spider_create_and_plug (conn, NULL);
|
||||
return GST_PAD_LINK_OK;
|
||||
|
@ -696,7 +697,7 @@ gst_spider_plug_from_srcpad (GstSpiderConnection * conn, GstPad * srcpad)
|
|||
/* if there is no way to plug: return */
|
||||
if (plugpath == NULL) {
|
||||
GST_DEBUG ("no chance to plug from %s to %s",
|
||||
GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
||||
GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
GST_DEBUG ("found a link that needs %d elements", g_list_length (plugpath));
|
||||
|
@ -708,8 +709,8 @@ gst_spider_plug_from_srcpad (GstSpiderConnection * conn, GstPad * srcpad)
|
|||
element = conn->current;
|
||||
while ((plugpath != NULL)
|
||||
&& (element =
|
||||
gst_spider_find_element_to_plug (element,
|
||||
(GstElementFactory *) plugpath->data, GST_PAD_SRC))) {
|
||||
gst_spider_find_element_to_plug (element,
|
||||
(GstElementFactory *) plugpath->data, GST_PAD_SRC))) {
|
||||
gst_spider_link_add (conn, element);
|
||||
plugpath = g_list_delete_link (plugpath, plugpath);
|
||||
}
|
||||
|
@ -739,10 +740,10 @@ plugin_init (GstPlugin * plugin)
|
|||
"spider autoplugging element");
|
||||
|
||||
if (!gst_element_register (plugin, "spider", GST_RANK_SECONDARY,
|
||||
GST_TYPE_SPIDER))
|
||||
GST_TYPE_SPIDER))
|
||||
return FALSE;
|
||||
if (!gst_element_register (plugin, "spideridentity", GST_RANK_NONE,
|
||||
GST_TYPE_SPIDER_IDENTITY))
|
||||
GST_TYPE_SPIDER_IDENTITY))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -109,11 +109,12 @@ gst_spider_identity_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_spider_identity_init,
|
||||
};
|
||||
|
||||
spider_identity_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSpiderIdentity",
|
||||
&spider_identity_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSpiderIdentity",
|
||||
&spider_identity_info, 0);
|
||||
GST_DEBUG_CATEGORY_INIT (gst_spider_identity_debug, "spideridentity", 0,
|
||||
"spider autoplugging proxy element");
|
||||
"spider autoplugging proxy element");
|
||||
}
|
||||
return spider_identity_type;
|
||||
}
|
||||
|
@ -189,16 +190,16 @@ gst_spider_identity_chain (GstPad * pad, GstBuffer * buf)
|
|||
GList *list = spider->links;
|
||||
|
||||
while (list) {
|
||||
GstSpiderConnection *conn = (GstSpiderConnection *) list->data;
|
||||
GstSpiderConnection *conn = (GstSpiderConnection *) list->data;
|
||||
|
||||
list = g_list_next (list);
|
||||
if (conn->current != (GstElement *) conn->src) {
|
||||
GST_DEBUG ("sending EOS to unconnected element %s from %s",
|
||||
GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (ident));
|
||||
gst_pad_push (conn->src->src,
|
||||
GST_DATA (GST_BUFFER (gst_event_new (GST_EVENT_EOS))));
|
||||
gst_element_set_eos (GST_ELEMENT (conn->src));
|
||||
}
|
||||
list = g_list_next (list);
|
||||
if (conn->current != (GstElement *) conn->src) {
|
||||
GST_DEBUG ("sending EOS to unconnected element %s from %s",
|
||||
GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (ident));
|
||||
gst_pad_push (conn->src->src,
|
||||
GST_DATA (GST_BUFFER (gst_event_new (GST_EVENT_EOS))));
|
||||
gst_element_set_eos (GST_ELEMENT (conn->src));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end hack for current event stuff here */
|
||||
|
@ -221,8 +222,7 @@ gst_spider_identity_new_src (gchar * name)
|
|||
GstSpiderIdentity *ret =
|
||||
(GstSpiderIdentity *) gst_element_factory_make ("spideridentity", name);
|
||||
/* set the right functions */
|
||||
gst_element_set_loop_function (GST_ELEMENT (ret),
|
||||
(GstElementLoopFunction)
|
||||
gst_element_set_loop_function (GST_ELEMENT (ret), (GstElementLoopFunction)
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_src_loop));
|
||||
|
||||
return ret;
|
||||
|
@ -235,8 +235,7 @@ gst_spider_identity_new_sink (gchar * name)
|
|||
(GstSpiderIdentity *) gst_element_factory_make ("spideridentity", name);
|
||||
|
||||
/* set the right functions */
|
||||
gst_element_set_loop_function (GST_ELEMENT (ret),
|
||||
(GstElementLoopFunction)
|
||||
gst_element_set_loop_function (GST_ELEMENT (ret), (GstElementLoopFunction)
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_dumb_loop));
|
||||
|
||||
return ret;
|
||||
|
@ -278,10 +277,10 @@ gst_spider_identity_getcaps (GstPad * pad)
|
|||
GstCaps *ret = gst_pad_get_allowed_caps (otherpad);
|
||||
|
||||
if (ident->caps) {
|
||||
GstCaps *ret2 = gst_caps_intersect (ident->caps, ret);
|
||||
GstCaps *ret2 = gst_caps_intersect (ident->caps, ret);
|
||||
|
||||
gst_caps_free (ret);
|
||||
ret = ret2;
|
||||
gst_caps_free (ret);
|
||||
ret = ret2;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -308,29 +307,29 @@ gst_spider_identity_request_new_pad (GstElement * element,
|
|||
switch (GST_PAD_TEMPLATE_DIRECTION (templ)) {
|
||||
case GST_PAD_SINK:
|
||||
if (ident->sink != NULL)
|
||||
break;
|
||||
break;
|
||||
/* sink */
|
||||
GST_DEBUG ("element %s requests new sink pad", GST_ELEMENT_NAME (ident));
|
||||
ident->sink = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (ident), ident->sink);
|
||||
gst_pad_set_link_function (ident->sink,
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_link));
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_link));
|
||||
gst_pad_set_getcaps_function (ident->sink,
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
|
||||
return ident->sink;
|
||||
case GST_PAD_SRC:
|
||||
/* src */
|
||||
if (ident->src != NULL)
|
||||
break;
|
||||
break;
|
||||
GST_DEBUG ("element %s requests new src pad", GST_ELEMENT_NAME (ident));
|
||||
ident->src = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (ident), ident->src);
|
||||
gst_pad_set_link_function (ident->src,
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_link));
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_link));
|
||||
gst_pad_set_getcaps_function (ident->src,
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
|
||||
gst_pad_set_event_function (ident->src,
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_handle_src_event));
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_handle_src_event));
|
||||
return ident->src;
|
||||
default:
|
||||
break;
|
||||
|
@ -370,22 +369,22 @@ gst_spider_identity_change_state (GstElement * element)
|
|||
|
||||
/* start typefinding or plugging */
|
||||
if ((GST_RPAD_PEER (ident->sink) != NULL)
|
||||
&& (GST_RPAD_PEER (ident->src) == NULL)) {
|
||||
GstCaps *caps =
|
||||
gst_pad_get_caps ((GstPad *) GST_PAD_PEER (ident->sink));
|
||||
if (gst_caps_is_any (caps) || gst_caps_is_empty (caps)) {
|
||||
gst_spider_identity_start_type_finding (ident);
|
||||
gst_caps_free (caps);
|
||||
break;
|
||||
} else {
|
||||
gst_spider_identity_plug (ident);
|
||||
}
|
||||
gst_caps_free (caps);
|
||||
&& (GST_RPAD_PEER (ident->src) == NULL)) {
|
||||
GstCaps *caps =
|
||||
gst_pad_get_caps ((GstPad *) GST_PAD_PEER (ident->sink));
|
||||
if (gst_caps_is_any (caps) || gst_caps_is_empty (caps)) {
|
||||
gst_spider_identity_start_type_finding (ident);
|
||||
gst_caps_free (caps);
|
||||
break;
|
||||
} else {
|
||||
gst_spider_identity_plug (ident);
|
||||
}
|
||||
gst_caps_free (caps);
|
||||
}
|
||||
/* autoplug on src */
|
||||
if ((GST_RPAD_PEER (ident->src) != NULL)
|
||||
&& (GST_RPAD_PEER (ident->sink) == NULL)) {
|
||||
gst_spider_identity_plug (ident);
|
||||
&& (GST_RPAD_PEER (ident->sink) == NULL)) {
|
||||
gst_spider_identity_plug (ident);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
@ -408,17 +407,16 @@ gst_spider_identity_start_type_finding (GstSpiderIdentity * ident)
|
|||
GST_DEBUG ("element %s starts typefinding", GST_ELEMENT_NAME (ident));
|
||||
if (GST_STATE (GST_ELEMENT_PARENT (ident)) == GST_STATE_PLAYING) {
|
||||
gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT (ident)),
|
||||
GST_STATE_PAUSED);
|
||||
GST_STATE_PAUSED);
|
||||
restart = TRUE;
|
||||
}
|
||||
|
||||
gst_element_set_loop_function (GST_ELEMENT (ident),
|
||||
(GstElementLoopFunction)
|
||||
gst_element_set_loop_function (GST_ELEMENT (ident), (GstElementLoopFunction)
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_sink_loop_type_finding));
|
||||
|
||||
if (restart) {
|
||||
gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT (ident)),
|
||||
GST_STATE_PLAYING);
|
||||
GST_STATE_PLAYING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,9 +448,8 @@ gst_spider_identity_src_loop (GstSpiderIdentity * ident)
|
|||
|
||||
/* we don't want a loop function if we're plugged */
|
||||
if (ident->sink && GST_PAD_PEER (ident->sink)) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (ident),
|
||||
(GstElementLoopFunction)
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_dumb_loop));
|
||||
gst_element_set_loop_function (GST_ELEMENT (ident), (GstElementLoopFunction)
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_dumb_loop));
|
||||
gst_spider_identity_dumb_loop (ident);
|
||||
return;
|
||||
}
|
||||
|
@ -466,7 +463,8 @@ typedef struct
|
|||
GstBuffer *buffer;
|
||||
guint best_probability;
|
||||
GstCaps *caps;
|
||||
} SpiderTypeFind;
|
||||
}
|
||||
SpiderTypeFind;
|
||||
guint8 *
|
||||
spider_find_peek (gpointer data, gint64 offset, guint size)
|
||||
{
|
||||
|
@ -532,7 +530,7 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity * ident)
|
|||
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
|
||||
|
||||
GST_DEBUG ("trying typefind function %s",
|
||||
GST_PLUGIN_FEATURE_NAME (factory));
|
||||
GST_PLUGIN_FEATURE_NAME (factory));
|
||||
gst_type_find_factory_call_function (factory, &gst_find);
|
||||
if (find.best_probability >= GST_TYPE_FIND_MAXIMUM)
|
||||
goto plug;
|
||||
|
@ -545,8 +543,7 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity * ident)
|
|||
|
||||
end:
|
||||
/* remove loop function */
|
||||
gst_element_set_loop_function (GST_ELEMENT (ident),
|
||||
(GstElementLoopFunction)
|
||||
gst_element_set_loop_function (GST_ELEMENT (ident), (GstElementLoopFunction)
|
||||
GST_DEBUG_FUNCPTR (gst_spider_identity_dumb_loop));
|
||||
|
||||
/* push the buffer */
|
||||
|
|
|
@ -15,10 +15,10 @@ gst_factories_at_most_templates (GList * factories, GstPadDirection dir,
|
|||
|
||||
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)
|
||||
|
@ -33,7 +33,7 @@ static void
|
|||
property_change_callback (GObject * object, GstObject * orig,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
||||
gchar *str = 0;
|
||||
|
||||
if (pspec->flags & G_PARAM_READABLE) {
|
||||
|
@ -121,8 +121,8 @@ main (int argc, char *argv[])
|
|||
|
||||
/* link objects */
|
||||
if (!(gst_element_link (filesrc, decoder) &&
|
||||
gst_element_link (decoder, osssink) &&
|
||||
gst_element_link (decoder, videosink))) {
|
||||
gst_element_link (decoder, osssink) &&
|
||||
gst_element_link (decoder, videosink))) {
|
||||
g_print ("the pipeline could not be linked\n");
|
||||
exit (-4);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ static void cothread_destroy (cothread_state * cothread);
|
|||
|
||||
struct _cothread_context
|
||||
{
|
||||
cothread_state *cothreads[COTHREAD_MAXTHREADS]; /* array of cothread states */
|
||||
cothread_state *cothreads[COTHREAD_MAXTHREADS]; /* array of cothread states */
|
||||
int ncothreads;
|
||||
int current;
|
||||
unsigned long stack_top;
|
||||
|
@ -112,7 +112,7 @@ cothread_context *
|
|||
cothread_context_init (void)
|
||||
{
|
||||
char __csf;
|
||||
void *current_stack_frame = &__csf; /* Get pointer inside current stack frame */
|
||||
void *current_stack_frame = &__csf; /* Get pointer inside current stack frame */
|
||||
cothread_context *ctx;
|
||||
|
||||
/* if there already is a cotread context for this thread,
|
||||
|
@ -120,7 +120,7 @@ cothread_context_init (void)
|
|||
ctx = g_static_private_get (&_cothread_ctx_key);
|
||||
if (ctx) {
|
||||
GST_CAT_INFO (GST_CAT_COTHREADS,
|
||||
"returning private _cothread_ctx_key %p", ctx);
|
||||
"returning private _cothread_ctx_key %p", ctx);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ cothread_create (cothread_context * ctx)
|
|||
if (ctx->cothreads[slot] == NULL)
|
||||
break;
|
||||
else if (ctx->cothreads[slot]->flags & COTHREAD_DESTROYED &&
|
||||
slot != ctx->current) {
|
||||
slot != ctx->current) {
|
||||
cothread_destroy (ctx->cothreads[slot]);
|
||||
break;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ cothread_create (cothread_context * ctx)
|
|||
unsigned long ptr;
|
||||
|
||||
for (ptr = ctx->stack_top - 4096; ptr > (unsigned long) cothread;
|
||||
ptr -= 4096) {
|
||||
ptr -= 4096) {
|
||||
GST_CAT_DEBUG (GST_CAT_COTHREADS, "touching location 0x%08lx", ptr);
|
||||
*(volatile unsigned int *) ptr = *(volatile unsigned int *) ptr;
|
||||
GST_CAT_DEBUG (GST_CAT_COTHREADS, "ok (0x%08x)", *(unsigned int *) ptr);
|
||||
|
@ -478,11 +478,11 @@ cothread_stub (void)
|
|||
cothread->func (cothread->argc, cothread->argv);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_COTHREADS, "cothread[%d] thread->func exited",
|
||||
ctx->current);
|
||||
ctx->current);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_COTHREADS, "sp=%p", current_stack_frame);
|
||||
GST_CAT_DEBUG (GST_CAT_COTHREADS, "ctx=%p current=%p", ctx,
|
||||
cothread_get_current_context ());
|
||||
cothread_get_current_context ());
|
||||
g_assert (ctx == cothread_get_current_context ());
|
||||
|
||||
g_assert (ctx->current != 0);
|
||||
|
@ -623,8 +623,8 @@ cothread_switch (cothread_state * cothread)
|
|||
enter = setjmp (current->jmp);
|
||||
if (enter != 0) {
|
||||
GST_CAT_DEBUG (GST_CAT_COTHREADS,
|
||||
"enter cothread #%d %d sp=%p jmpbuf=%p",
|
||||
current->cothreadnum, enter, current->sp, current->jmp);
|
||||
"enter cothread #%d %d sp=%p jmpbuf=%p",
|
||||
current->cothreadnum, enter, current->sp, current->jmp);
|
||||
return;
|
||||
}
|
||||
GST_CAT_DEBUG (GST_CAT_COTHREADS, "exit cothread #%d %d sp=%p jmpbuf=%p",
|
||||
|
|
|
@ -69,9 +69,10 @@ gst_aggregator_sched_get_type (void)
|
|||
{AGGREGATOR_CHAIN, "4", "Chain Based"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!aggregator_sched_type) {
|
||||
aggregator_sched_type =
|
||||
g_enum_register_static ("GstAggregatorSched", aggregator_sched);
|
||||
g_enum_register_static ("GstAggregatorSched", aggregator_sched);
|
||||
}
|
||||
return aggregator_sched_type;
|
||||
}
|
||||
|
@ -117,17 +118,17 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
||||
g_param_spec_int ("num_pads", "Num pads", "The number of source pads",
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "Silent", "Don't produce messages",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCHED,
|
||||
g_param_spec_enum ("sched", "Scheduling",
|
||||
"The type of scheduling this element should use",
|
||||
GST_TYPE_AGGREGATOR_SCHED, AGGREGATOR_CHAIN, G_PARAM_READWRITE));
|
||||
"The type of scheduling this element should use",
|
||||
GST_TYPE_AGGREGATOR_SCHED, AGGREGATOR_CHAIN, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last_message", "Last message",
|
||||
"The current state of the element", NULL, G_PARAM_READABLE));
|
||||
"The current state of the element", NULL, G_PARAM_READABLE));
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
|
||||
|
@ -192,7 +193,7 @@ gst_aggregator_update_functions (GstAggregator * aggregator)
|
|||
|
||||
if (AGGREGATOR_IS_LOOP_BASED (aggregator)) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (aggregator),
|
||||
GST_DEBUG_FUNCPTR (gst_aggregator_loop));
|
||||
GST_DEBUG_FUNCPTR (gst_aggregator_loop));
|
||||
} else {
|
||||
gst_element_set_loop_function (GST_ELEMENT (aggregator), NULL);
|
||||
}
|
||||
|
@ -271,9 +272,9 @@ gst_aggregator_push (GstAggregator * aggregator, GstPad * pad, GstBuffer * buf,
|
|||
g_free (aggregator->last_message);
|
||||
|
||||
aggregator->last_message =
|
||||
g_strdup_printf ("%10.10s ******* (%s:%s)a (%d bytes, %"
|
||||
G_GUINT64_FORMAT ")", debug, GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_strdup_printf ("%10.10s ******* (%s:%s)a (%d bytes, %"
|
||||
G_GUINT64_FORMAT ")", debug, GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
g_object_notify (G_OBJECT (aggregator), "last_message");
|
||||
}
|
||||
|
@ -306,11 +307,11 @@ gst_aggregator_loop (GstElement * element)
|
|||
* and that the peer pad is also enabled.
|
||||
*/
|
||||
if (GST_PAD_IS_USABLE (pad)) {
|
||||
buf = GST_BUFFER (gst_pad_pull (pad));
|
||||
debug = "loop";
|
||||
buf = GST_BUFFER (gst_pad_pull (pad));
|
||||
debug = "loop";
|
||||
|
||||
/* then push it forward */
|
||||
gst_aggregator_push (aggregator, pad, buf, debug);
|
||||
/* then push it forward */
|
||||
gst_aggregator_push (aggregator, pad, buf, debug);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -64,7 +64,7 @@ debug_buffers (GstBufferStore * store)
|
|||
g_printerr ("BUFFERS in store:\n");
|
||||
while (walk) {
|
||||
g_print ("%15" G_GUINT64_FORMAT " - %7u\n", GST_BUFFER_OFFSET (walk->data),
|
||||
GST_BUFFER_SIZE (walk->data));
|
||||
GST_BUFFER_SIZE (walk->data));
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
g_printerr ("\n");
|
||||
|
@ -127,14 +127,14 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
|
|||
store->buffers && GST_BUFFER_OFFSET_IS_VALID (store->buffers->data)) {
|
||||
/* we assumed valid offsets, but suddenly they are not anymore */
|
||||
GST_DEBUG_OBJECT (store,
|
||||
"attempting to add buffer %p with invalid offset to store with valid offset, abort",
|
||||
buffer);
|
||||
"attempting to add buffer %p with invalid offset to store with valid offset, abort",
|
||||
buffer);
|
||||
return FALSE;
|
||||
} else if (!store->buffers
|
||||
|| !GST_BUFFER_OFFSET_IS_VALID (store->buffers->data)) {
|
||||
/* the starting buffer had an invalid offset, in that case we assume continuous buffers */
|
||||
GST_LOG_OBJECT (store, "adding buffer %p with invalid offset and size %u",
|
||||
buffer, GST_BUFFER_SIZE (buffer));
|
||||
buffer, GST_BUFFER_SIZE (buffer));
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
store->buffers = g_list_append (store->buffers, buffer);
|
||||
return TRUE;
|
||||
|
@ -145,9 +145,9 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
|
|||
|
||||
g_assert (GST_BUFFER_OFFSET_IS_VALID (buffer));
|
||||
GST_LOG_OBJECT (store,
|
||||
"attempting to add buffer %p with offset %" G_GUINT64_FORMAT
|
||||
" and size %u", buffer, GST_BUFFER_OFFSET (buffer),
|
||||
GST_BUFFER_SIZE (buffer));
|
||||
"attempting to add buffer %p with offset %" G_GUINT64_FORMAT
|
||||
" and size %u", buffer, GST_BUFFER_OFFSET (buffer),
|
||||
GST_BUFFER_SIZE (buffer));
|
||||
/* we keep a sorted list of non-overlapping buffers */
|
||||
walk = store->buffers;
|
||||
while (walk) {
|
||||
|
@ -155,88 +155,88 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
|
|||
current_list = walk;
|
||||
walk = g_list_next (walk);
|
||||
if (GST_BUFFER_OFFSET (current) < GST_BUFFER_OFFSET (buffer)) {
|
||||
continue;
|
||||
continue;
|
||||
} else if (GST_BUFFER_OFFSET (current) == GST_BUFFER_OFFSET (buffer)) {
|
||||
guint needed_size;
|
||||
guint needed_size;
|
||||
|
||||
if (walk) {
|
||||
needed_size = MIN (GST_BUFFER_SIZE (buffer),
|
||||
GST_BUFFER_OFFSET (walk->data) - GST_BUFFER_OFFSET (current));
|
||||
} else {
|
||||
needed_size = GST_BUFFER_SIZE (buffer);
|
||||
}
|
||||
if (needed_size <= GST_BUFFER_SIZE (current)) {
|
||||
buffer = NULL;
|
||||
break;
|
||||
} else {
|
||||
if (needed_size < GST_BUFFER_SIZE (buffer)) {
|
||||
/* need to create subbuffer to not have overlapping data */
|
||||
GstBuffer *sub = gst_buffer_create_sub (buffer, 0, needed_size);
|
||||
if (walk) {
|
||||
needed_size = MIN (GST_BUFFER_SIZE (buffer),
|
||||
GST_BUFFER_OFFSET (walk->data) - GST_BUFFER_OFFSET (current));
|
||||
} else {
|
||||
needed_size = GST_BUFFER_SIZE (buffer);
|
||||
}
|
||||
if (needed_size <= GST_BUFFER_SIZE (current)) {
|
||||
buffer = NULL;
|
||||
break;
|
||||
} else {
|
||||
if (needed_size < GST_BUFFER_SIZE (buffer)) {
|
||||
/* need to create subbuffer to not have overlapping data */
|
||||
GstBuffer *sub = gst_buffer_create_sub (buffer, 0, needed_size);
|
||||
|
||||
g_assert (sub);
|
||||
buffer = sub;
|
||||
} else {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
}
|
||||
/* replace current buffer with new one */
|
||||
GST_INFO_OBJECT (store,
|
||||
"replacing buffer %p with buffer %p with offset %" G_GINT64_FORMAT
|
||||
" and size %u", current_list->data, buffer,
|
||||
GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
gst_data_unref (GST_DATA (current_list->data));
|
||||
current_list->data = buffer;
|
||||
buffer = NULL;
|
||||
break;
|
||||
}
|
||||
g_assert (sub);
|
||||
buffer = sub;
|
||||
} else {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
}
|
||||
/* replace current buffer with new one */
|
||||
GST_INFO_OBJECT (store,
|
||||
"replacing buffer %p with buffer %p with offset %" G_GINT64_FORMAT
|
||||
" and size %u", current_list->data, buffer,
|
||||
GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
gst_data_unref (GST_DATA (current_list->data));
|
||||
current_list->data = buffer;
|
||||
buffer = NULL;
|
||||
break;
|
||||
}
|
||||
} else if (GST_BUFFER_OFFSET (current) > GST_BUFFER_OFFSET (buffer)) {
|
||||
GList *previous = g_list_previous (current_list);
|
||||
guint64 start_offset = previous ?
|
||||
GST_BUFFER_OFFSET (previous->data) +
|
||||
GST_BUFFER_SIZE (previous->data) : 0;
|
||||
GList *previous = g_list_previous (current_list);
|
||||
guint64 start_offset = previous ?
|
||||
GST_BUFFER_OFFSET (previous->data) +
|
||||
GST_BUFFER_SIZE (previous->data) : 0;
|
||||
|
||||
if (start_offset == GST_BUFFER_OFFSET (current)) {
|
||||
buffer = NULL;
|
||||
break;
|
||||
} else {
|
||||
/* we have data to insert */
|
||||
if (start_offset > GST_BUFFER_OFFSET (buffer) ||
|
||||
GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) >
|
||||
GST_BUFFER_OFFSET (current)) {
|
||||
GstBuffer *sub;
|
||||
if (start_offset == GST_BUFFER_OFFSET (current)) {
|
||||
buffer = NULL;
|
||||
break;
|
||||
} else {
|
||||
/* we have data to insert */
|
||||
if (start_offset > GST_BUFFER_OFFSET (buffer) ||
|
||||
GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) >
|
||||
GST_BUFFER_OFFSET (current)) {
|
||||
GstBuffer *sub;
|
||||
|
||||
/* need a subbuffer */
|
||||
start_offset = GST_BUFFER_OFFSET (buffer) > start_offset ? 0 :
|
||||
start_offset - GST_BUFFER_OFFSET (buffer);
|
||||
sub = gst_buffer_create_sub (buffer, start_offset,
|
||||
MIN (GST_BUFFER_SIZE (buffer),
|
||||
GST_BUFFER_OFFSET (current) - start_offset -
|
||||
GST_BUFFER_OFFSET (buffer)));
|
||||
g_assert (sub);
|
||||
GST_BUFFER_OFFSET (sub) = start_offset + GST_BUFFER_OFFSET (buffer);
|
||||
buffer = sub;
|
||||
} else {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
}
|
||||
GST_INFO_OBJECT (store,
|
||||
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
|
||||
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
store->buffers =
|
||||
g_list_insert_before (store->buffers, current_list, buffer);
|
||||
buffer = NULL;
|
||||
break;
|
||||
}
|
||||
/* need a subbuffer */
|
||||
start_offset = GST_BUFFER_OFFSET (buffer) > start_offset ? 0 :
|
||||
start_offset - GST_BUFFER_OFFSET (buffer);
|
||||
sub = gst_buffer_create_sub (buffer, start_offset,
|
||||
MIN (GST_BUFFER_SIZE (buffer),
|
||||
GST_BUFFER_OFFSET (current) - start_offset -
|
||||
GST_BUFFER_OFFSET (buffer)));
|
||||
g_assert (sub);
|
||||
GST_BUFFER_OFFSET (sub) = start_offset + GST_BUFFER_OFFSET (buffer);
|
||||
buffer = sub;
|
||||
} else {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
}
|
||||
GST_INFO_OBJECT (store,
|
||||
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
|
||||
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
store->buffers =
|
||||
g_list_insert_before (store->buffers, current_list, buffer);
|
||||
buffer = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buffer) {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
GST_INFO_OBJECT (store,
|
||||
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
|
||||
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
|
||||
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
if (current_list) {
|
||||
g_list_append (current_list, buffer);
|
||||
g_list_append (current_list, buffer);
|
||||
} else {
|
||||
g_assert (store->buffers == NULL);
|
||||
store->buffers = g_list_prepend (NULL, buffer);
|
||||
g_assert (store->buffers == NULL);
|
||||
store->buffers = g_list_prepend (NULL, buffer);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -352,47 +352,47 @@ gst_buffer_store_get_buffer (GstBufferStore * store, guint64 offset, guint size)
|
|||
do_nothing_loop (); */
|
||||
} else if (cur_offset == offset && GST_BUFFER_SIZE (current) == size) {
|
||||
GST_LOG_OBJECT (store,
|
||||
"found matching buffer %p for offset %" G_GUINT64_FORMAT
|
||||
" and size %u", current, offset, size);
|
||||
"found matching buffer %p for offset %" G_GUINT64_FORMAT
|
||||
" and size %u", current, offset, size);
|
||||
ret = current;
|
||||
gst_data_ref (GST_DATA (ret));
|
||||
GST_LOG_OBJECT (store, "refcount %d", GST_DATA_REFCOUNT_VALUE (ret));
|
||||
break;
|
||||
} else if (cur_offset + GST_BUFFER_SIZE (current) > offset) {
|
||||
if (cur_offset + GST_BUFFER_SIZE (current) >= offset + size) {
|
||||
ret = gst_buffer_create_sub (current, offset - cur_offset, size);
|
||||
GST_LOG_OBJECT (store,
|
||||
"created subbuffer %p from buffer %p for offset %llu and size %u",
|
||||
ret, current, offset, size);
|
||||
break;
|
||||
ret = gst_buffer_create_sub (current, offset - cur_offset, size);
|
||||
GST_LOG_OBJECT (store,
|
||||
"created subbuffer %p from buffer %p for offset %llu and size %u",
|
||||
ret, current, offset, size);
|
||||
break;
|
||||
}
|
||||
/* uh, the requested data spans some buffers */
|
||||
ret = gst_buffer_new_and_alloc (size);
|
||||
GST_LOG_OBJECT (store, "created buffer %p for offset %" G_GUINT64_FORMAT
|
||||
" and size %u, will fill with data now", ret, offset, size);
|
||||
" and size %u, will fill with data now", ret, offset, size);
|
||||
data = GST_BUFFER_DATA (ret);
|
||||
tmp = GST_BUFFER_SIZE (current) - offset + cur_offset;
|
||||
memcpy (data, GST_BUFFER_DATA (current) + offset - cur_offset, tmp);
|
||||
data += tmp;
|
||||
size -= tmp;
|
||||
while (size) {
|
||||
if (walk == NULL ||
|
||||
(have_offset &&
|
||||
GST_BUFFER_OFFSET (current) + GST_BUFFER_SIZE (current) !=
|
||||
GST_BUFFER_OFFSET (walk->data))) {
|
||||
GST_DEBUG_OBJECT (store,
|
||||
"not all data for offset %" G_GUINT64_FORMAT
|
||||
" and remaining size %u available, aborting", offset, size);
|
||||
gst_data_unref (GST_DATA (ret));
|
||||
ret = NULL;
|
||||
goto out;
|
||||
}
|
||||
current = GST_BUFFER (walk->data);
|
||||
walk = g_list_next (walk);
|
||||
tmp = MIN (GST_BUFFER_SIZE (current), size);
|
||||
memcpy (data, GST_BUFFER_DATA (current), tmp);
|
||||
data += tmp;
|
||||
size -= tmp;
|
||||
if (walk == NULL ||
|
||||
(have_offset &&
|
||||
GST_BUFFER_OFFSET (current) + GST_BUFFER_SIZE (current) !=
|
||||
GST_BUFFER_OFFSET (walk->data))) {
|
||||
GST_DEBUG_OBJECT (store,
|
||||
"not all data for offset %" G_GUINT64_FORMAT
|
||||
" and remaining size %u available, aborting", offset, size);
|
||||
gst_data_unref (GST_DATA (ret));
|
||||
ret = NULL;
|
||||
goto out;
|
||||
}
|
||||
current = GST_BUFFER (walk->data);
|
||||
walk = g_list_next (walk);
|
||||
tmp = MIN (GST_BUFFER_SIZE (current), size);
|
||||
memcpy (data, GST_BUFFER_DATA (current), tmp);
|
||||
data += tmp;
|
||||
size -= tmp;
|
||||
}
|
||||
}
|
||||
if (!have_offset) {
|
||||
|
@ -437,8 +437,8 @@ gst_buffer_store_get_size (GstBufferStore * store, guint64 offset)
|
|||
}
|
||||
while (walk) {
|
||||
if (have_offset && counting &&
|
||||
cur_offset + GST_BUFFER_SIZE (current) !=
|
||||
GST_BUFFER_OFFSET (walk->data)) {
|
||||
cur_offset + GST_BUFFER_SIZE (current) !=
|
||||
GST_BUFFER_OFFSET (walk->data)) {
|
||||
break;
|
||||
}
|
||||
current = GST_BUFFER (walk->data);
|
||||
|
@ -450,11 +450,11 @@ gst_buffer_store_get_size (GstBufferStore * store, guint64 offset)
|
|||
ret += GST_BUFFER_SIZE (current);
|
||||
} else {
|
||||
if (cur_offset > offset)
|
||||
return 0;
|
||||
return 0;
|
||||
if (cur_offset + GST_BUFFER_SIZE (current) > offset) {
|
||||
/* we have at least some bytes */
|
||||
ret = cur_offset + GST_BUFFER_SIZE (current) - offset;
|
||||
counting = TRUE;
|
||||
/* we have at least some bytes */
|
||||
ret = cur_offset + GST_BUFFER_SIZE (current) - offset;
|
||||
counting = TRUE;
|
||||
}
|
||||
}
|
||||
if (!have_offset) {
|
||||
|
|
|
@ -81,7 +81,7 @@ plugin_init (GstPlugin * plugin)
|
|||
|
||||
while ((*my_elements).name) {
|
||||
if (!gst_element_register (plugin, (*my_elements).name, (*my_elements).rank,
|
||||
((*my_elements).type) ()))
|
||||
((*my_elements).type) ()))
|
||||
return FALSE;
|
||||
my_elements++;
|
||||
}
|
||||
|
|
|
@ -70,22 +70,23 @@ gst_fakesink_state_error_get_type (void)
|
|||
static GEnumValue fakesink_state_error[] = {
|
||||
{FAKESINK_STATE_ERROR_NONE, "0", "No state change errors"},
|
||||
{FAKESINK_STATE_ERROR_NULL_READY, "1",
|
||||
"Fail state change from NULL to READY"},
|
||||
"Fail state change from NULL to READY"},
|
||||
{FAKESINK_STATE_ERROR_READY_PAUSED, "2",
|
||||
"Fail state change from READY to PAUSED"},
|
||||
"Fail state change from READY to PAUSED"},
|
||||
{FAKESINK_STATE_ERROR_PAUSED_PLAYING, "3",
|
||||
"Fail state change from PAUSED to PLAYING"},
|
||||
"Fail state change from PAUSED to PLAYING"},
|
||||
{FAKESINK_STATE_ERROR_PLAYING_PAUSED, "4",
|
||||
"Fail state change from PLAYING to PAUSED"},
|
||||
"Fail state change from PLAYING to PAUSED"},
|
||||
{FAKESINK_STATE_ERROR_PAUSED_READY, "5",
|
||||
"Fail state change from PAUSED to READY"},
|
||||
"Fail state change from PAUSED to READY"},
|
||||
{FAKESINK_STATE_ERROR_READY_NULL, "6",
|
||||
"Fail state change from READY to NULL"},
|
||||
"Fail state change from READY to NULL"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesink_state_error_type) {
|
||||
fakesink_state_error_type =
|
||||
g_enum_register_static ("GstFakeSinkStateError", fakesink_state_error);
|
||||
g_enum_register_static ("GstFakeSinkStateError", fakesink_state_error);
|
||||
}
|
||||
return fakesink_state_error_type;
|
||||
}
|
||||
|
@ -133,27 +134,27 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SINKS,
|
||||
g_param_spec_int ("num_sinks", "Number of sinks",
|
||||
"The number of sinkpads", 1, G_MAXINT, 1, G_PARAM_READABLE));
|
||||
"The number of sinkpads", 1, G_MAXINT, 1, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STATE_ERROR,
|
||||
g_param_spec_enum ("state_error", "State Error",
|
||||
"Generate a state change error", GST_TYPE_FAKESINK_STATE_ERROR,
|
||||
FAKESINK_STATE_ERROR_NONE, G_PARAM_READWRITE));
|
||||
"Generate a state change error", GST_TYPE_FAKESINK_STATE_ERROR,
|
||||
FAKESINK_STATE_ERROR_NONE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last_message", "Last Message",
|
||||
"The message describing current status", NULL, G_PARAM_READABLE));
|
||||
"The message describing current status", NULL, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
|
||||
g_param_spec_boolean ("sync", "Sync", "Sync on the clock", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_HANDOFFS,
|
||||
g_param_spec_boolean ("signal-handoffs", "Signal handoffs",
|
||||
"Send a signal before unreffing the buffer", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
"Send a signal before unreffing the buffer", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "Silent",
|
||||
"Don't produce last_message events", FALSE, G_PARAM_READWRITE));
|
||||
"Don't produce last_message events", FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
|
||||
g_param_spec_boolean ("dump", "Dump", "Dump received bytes to stdout",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gst_fakesink_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -316,22 +317,22 @@ gst_fakesink_chain (GstPad * pad, GstData * _data)
|
|||
g_free (fakesink->last_message);
|
||||
|
||||
fakesink->last_message =
|
||||
g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
|
||||
g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
|
||||
|
||||
g_object_notify (G_OBJECT (fakesink), "last_message");
|
||||
}
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
if (fakesink->sync && fakesink->clock) {
|
||||
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
|
||||
if (fakesink->sync && fakesink->clock) {
|
||||
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
|
||||
|
||||
gst_element_set_time (GST_ELEMENT (fakesink), value);
|
||||
}
|
||||
gst_element_set_time (GST_ELEMENT (fakesink), value);
|
||||
}
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -344,19 +345,19 @@ gst_fakesink_chain (GstPad * pad, GstData * _data)
|
|||
g_free (fakesink->last_message);
|
||||
|
||||
fakesink->last_message =
|
||||
g_strdup_printf ("chain ******* (%s:%s)< (%d bytes, timestamp: %"
|
||||
G_GINT64_FORMAT ", duration: %" G_GINT64_FORMAT ", offset: %"
|
||||
G_GINT64_FORMAT ", flags: %d) %p", GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf),
|
||||
GST_BUFFER_DURATION (buf), GST_BUFFER_OFFSET (buf),
|
||||
GST_BUFFER_FLAGS (buf), buf);
|
||||
g_strdup_printf ("chain ******* (%s:%s)< (%d bytes, timestamp: %"
|
||||
G_GINT64_FORMAT ", duration: %" G_GINT64_FORMAT ", offset: %"
|
||||
G_GINT64_FORMAT ", flags: %d) %p", GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf),
|
||||
GST_BUFFER_DURATION (buf), GST_BUFFER_OFFSET (buf),
|
||||
GST_BUFFER_FLAGS (buf), buf);
|
||||
|
||||
g_object_notify (G_OBJECT (fakesink), "last_message");
|
||||
}
|
||||
|
||||
if (fakesink->signal_handoffs)
|
||||
g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0,
|
||||
buf, pad);
|
||||
buf, pad);
|
||||
|
||||
if (fakesink->dump) {
|
||||
gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
|
@ -373,27 +374,27 @@ gst_fakesink_change_state (GstElement * element)
|
|||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_NULL_TO_READY:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_NULL_READY)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_READY_PAUSED)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_PAUSED_PLAYING)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_PLAYING_TO_PAUSED:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_PLAYING_PAUSED)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_PAUSED_READY)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_READY_TO_NULL:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_READY_NULL)
|
||||
goto error;
|
||||
goto error;
|
||||
g_free (fakesink->last_message);
|
||||
fakesink->last_message = NULL;
|
||||
break;
|
||||
|
|
|
@ -95,9 +95,10 @@ gst_fakesrc_output_get_type (void)
|
|||
{FAKESRC_GET_ALWAYS_SUCEEDS, "8", "'_get' Always succeeds"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesrc_output_type) {
|
||||
fakesrc_output_type =
|
||||
g_enum_register_static ("GstFakeSrcOutput", fakesrc_output);
|
||||
g_enum_register_static ("GstFakeSrcOutput", fakesrc_output);
|
||||
}
|
||||
return fakesrc_output_type;
|
||||
}
|
||||
|
@ -112,6 +113,7 @@ gst_fakesrc_data_get_type (void)
|
|||
{FAKESRC_DATA_SUBBUFFER, "2", "Subbuffer data"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesrc_data_type) {
|
||||
fakesrc_data_type = g_enum_register_static ("GstFakeSrcData", fakesrc_data);
|
||||
}
|
||||
|
@ -127,12 +129,13 @@ gst_fakesrc_sizetype_get_type (void)
|
|||
{FAKESRC_SIZETYPE_NULL, "1", "Send empty buffers"},
|
||||
{FAKESRC_SIZETYPE_FIXED, "2", "Fixed size buffers (sizemax sized)"},
|
||||
{FAKESRC_SIZETYPE_RANDOM, "3",
|
||||
"Random sized buffers (sizemin <= size <= sizemax)"},
|
||||
"Random sized buffers (sizemin <= size <= sizemax)"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesrc_sizetype_type) {
|
||||
fakesrc_sizetype_type =
|
||||
g_enum_register_static ("GstFakeSrcSizeType", fakesrc_sizetype);
|
||||
g_enum_register_static ("GstFakeSrcSizeType", fakesrc_sizetype);
|
||||
}
|
||||
return fakesrc_sizetype_type;
|
||||
}
|
||||
|
@ -148,12 +151,13 @@ gst_fakesrc_filltype_get_type (void)
|
|||
{FAKESRC_FILLTYPE_RANDOM, "3", "Fill buffers with random crap"},
|
||||
{FAKESRC_FILLTYPE_PATTERN, "4", "Fill buffers with pattern 0x00 -> 0xff"},
|
||||
{FAKESRC_FILLTYPE_PATTERN_CONT, "5",
|
||||
"Fill buffers with pattern 0x00 -> 0xff that spans buffers"},
|
||||
"Fill buffers with pattern 0x00 -> 0xff that spans buffers"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesrc_filltype_type) {
|
||||
fakesrc_filltype_type =
|
||||
g_enum_register_static ("GstFakeSrcFillType", fakesrc_filltype);
|
||||
g_enum_register_static ("GstFakeSrcFillType", fakesrc_filltype);
|
||||
}
|
||||
return fakesrc_filltype_type;
|
||||
}
|
||||
|
@ -201,56 +205,56 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
|
||||
g_param_spec_int ("num-sources", "num-sources", "Number of sources",
|
||||
1, G_MAXINT, 1, G_PARAM_READABLE));
|
||||
1, G_MAXINT, 1, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
|
||||
g_param_spec_boolean ("loop-based", "loop-based",
|
||||
"Enable loop-based operation", FALSE, G_PARAM_READWRITE));
|
||||
"Enable loop-based operation", FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT,
|
||||
g_param_spec_enum ("output", "output", "Output method (currently unused)",
|
||||
GST_TYPE_FAKESRC_OUTPUT, FAKESRC_FIRST_LAST_LOOP, G_PARAM_READWRITE));
|
||||
GST_TYPE_FAKESRC_OUTPUT, FAKESRC_FIRST_LAST_LOOP, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DATA,
|
||||
g_param_spec_enum ("data", "data", "Data allocation method",
|
||||
GST_TYPE_FAKESRC_DATA, FAKESRC_DATA_ALLOCATE, G_PARAM_READWRITE));
|
||||
GST_TYPE_FAKESRC_DATA, FAKESRC_DATA_ALLOCATE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZETYPE,
|
||||
g_param_spec_enum ("sizetype", "sizetype",
|
||||
"How to determine buffer sizes", GST_TYPE_FAKESRC_SIZETYPE,
|
||||
FAKESRC_SIZETYPE_NULL, G_PARAM_READWRITE));
|
||||
"How to determine buffer sizes", GST_TYPE_FAKESRC_SIZETYPE,
|
||||
FAKESRC_SIZETYPE_NULL, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMIN,
|
||||
g_param_spec_int ("sizemin", "sizemin", "Minimum buffer size", 0,
|
||||
G_MAXINT, DEFAULT_SIZEMIN, G_PARAM_READWRITE));
|
||||
G_MAXINT, DEFAULT_SIZEMIN, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX,
|
||||
g_param_spec_int ("sizemax", "sizemax", "Maximum buffer size", 0,
|
||||
G_MAXINT, DEFAULT_SIZEMAX, G_PARAM_READWRITE));
|
||||
G_MAXINT, DEFAULT_SIZEMAX, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PARENTSIZE,
|
||||
g_param_spec_int ("parentsize", "parentsize",
|
||||
"Size of parent buffer for sub-buffered allocation", 0, G_MAXINT,
|
||||
DEFAULT_PARENTSIZE, G_PARAM_READWRITE));
|
||||
"Size of parent buffer for sub-buffered allocation", 0, G_MAXINT,
|
||||
DEFAULT_PARENTSIZE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILLTYPE,
|
||||
g_param_spec_enum ("filltype", "filltype",
|
||||
"How to fill the buffer, if at all", GST_TYPE_FAKESRC_FILLTYPE,
|
||||
FAKESRC_FILLTYPE_NULL, G_PARAM_READWRITE));
|
||||
"How to fill the buffer, if at all", GST_TYPE_FAKESRC_FILLTYPE,
|
||||
FAKESRC_FILLTYPE_NULL, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PATTERN,
|
||||
g_param_spec_string ("pattern", "pattern", "pattern", NULL,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_BUFFERS,
|
||||
g_param_spec_int ("num-buffers", "num-buffers",
|
||||
"Number of buffers to output before sending EOS", G_MININT, G_MAXINT,
|
||||
0, G_PARAM_READWRITE));
|
||||
"Number of buffers to output before sending EOS", G_MININT, G_MAXINT,
|
||||
0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EOS,
|
||||
g_param_spec_boolean ("eos", "eos", "Send out the EOS event?", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last-message", "last-message",
|
||||
"The last status message", NULL, G_PARAM_READABLE));
|
||||
"The last status message", NULL, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "Silent",
|
||||
"Don't produce last_message events", FALSE, G_PARAM_READWRITE));
|
||||
"Don't produce last_message events", FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_HANDOFFS,
|
||||
g_param_spec_boolean ("signal-handoffs", "Signal handoffs",
|
||||
"Send a signal before pushing the buffer", FALSE, G_PARAM_READWRITE));
|
||||
"Send a signal before pushing the buffer", FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
|
||||
g_param_spec_boolean ("dump", "Dump", "Dump produced bytes to stdout",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gst_fakesrc_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -334,6 +338,7 @@ gst_fakesrc_get_formats (GstPad * pad)
|
|||
GST_FORMAT_DEFAULT,
|
||||
0,
|
||||
};
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
@ -347,6 +352,7 @@ gst_fakesrc_get_query_types (GstPad * pad)
|
|||
GST_QUERY_SEGMENT_END,
|
||||
0,
|
||||
};
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
|
@ -384,6 +390,7 @@ gst_fakesrc_get_event_mask (GstPad * pad)
|
|||
{GST_EVENT_FLUSH, 0},
|
||||
{0, 0},
|
||||
};
|
||||
|
||||
return masks;
|
||||
}
|
||||
|
||||
|
@ -399,7 +406,7 @@ gst_fakesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
src->buffer_count = GST_EVENT_SEEK_OFFSET (event);
|
||||
|
||||
if (!GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
/* else we do a flush too */
|
||||
case GST_EVENT_SEEK_SEGMENT:
|
||||
|
@ -407,7 +414,7 @@ gst_fakesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
src->buffer_count = src->segment_start;
|
||||
src->segment_loop =
|
||||
GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
|
||||
GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
|
||||
break;
|
||||
case GST_EVENT_FLUSH:
|
||||
src->need_flush = TRUE;
|
||||
|
@ -427,7 +434,7 @@ gst_fakesrc_update_functions (GstFakeSrc * src)
|
|||
|
||||
if (src->loop_based) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (src),
|
||||
GST_DEBUG_FUNCPTR (gst_fakesrc_loop));
|
||||
GST_DEBUG_FUNCPTR (gst_fakesrc_loop));
|
||||
} else {
|
||||
gst_element_set_loop_function (GST_ELEMENT (src), NULL);
|
||||
}
|
||||
|
@ -485,13 +492,13 @@ gst_fakesrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
src->data = g_value_get_enum (value);
|
||||
|
||||
if (src->data == FAKESRC_DATA_SUBBUFFER) {
|
||||
if (!src->parent)
|
||||
gst_fakesrc_alloc_parent (src);
|
||||
if (!src->parent)
|
||||
gst_fakesrc_alloc_parent (src);
|
||||
} else {
|
||||
if (src->parent) {
|
||||
gst_buffer_unref (src->parent);
|
||||
src->parent = NULL;
|
||||
}
|
||||
if (src->parent) {
|
||||
gst_buffer_unref (src->parent);
|
||||
src->parent = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ARG_SIZETYPE:
|
||||
|
@ -614,7 +621,7 @@ gst_fakesrc_prepare_buffer (GstFakeSrc * src, GstBuffer * buf)
|
|||
guint8 *ptr = GST_BUFFER_DATA (buf);
|
||||
|
||||
for (i = GST_BUFFER_SIZE (buf); i; i--) {
|
||||
*ptr++ = (gint8) ((255.0) * rand () / (RAND_MAX));
|
||||
*ptr++ = (gint8) ((255.0) * rand () / (RAND_MAX));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -626,7 +633,7 @@ gst_fakesrc_prepare_buffer (GstFakeSrc * src, GstBuffer * buf)
|
|||
guint8 *ptr = GST_BUFFER_DATA (buf);
|
||||
|
||||
for (i = GST_BUFFER_SIZE (buf); i; i--) {
|
||||
*ptr++ = src->pattern_byte++;
|
||||
*ptr++ = src->pattern_byte++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -647,18 +654,18 @@ gst_fakesrc_alloc_buffer (GstFakeSrc * src, guint size)
|
|||
if (size != 0) {
|
||||
switch (src->filltype) {
|
||||
case FAKESRC_FILLTYPE_NOTHING:
|
||||
GST_BUFFER_DATA (buf) = g_malloc (size);
|
||||
break;
|
||||
GST_BUFFER_DATA (buf) = g_malloc (size);
|
||||
break;
|
||||
case FAKESRC_FILLTYPE_NULL:
|
||||
GST_BUFFER_DATA (buf) = g_malloc0 (size);
|
||||
break;
|
||||
GST_BUFFER_DATA (buf) = g_malloc0 (size);
|
||||
break;
|
||||
case FAKESRC_FILLTYPE_RANDOM:
|
||||
case FAKESRC_FILLTYPE_PATTERN:
|
||||
case FAKESRC_FILLTYPE_PATTERN_CONT:
|
||||
default:
|
||||
GST_BUFFER_DATA (buf) = g_malloc (size);
|
||||
gst_fakesrc_prepare_buffer (src, buf);
|
||||
break;
|
||||
GST_BUFFER_DATA (buf) = g_malloc (size);
|
||||
gst_fakesrc_prepare_buffer (src, buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -676,9 +683,9 @@ gst_fakesrc_get_size (GstFakeSrc * src)
|
|||
break;
|
||||
case FAKESRC_SIZETYPE_RANDOM:
|
||||
size =
|
||||
src->sizemin +
|
||||
(guint8) (((gfloat) src->sizemax) * rand () / (RAND_MAX +
|
||||
(gfloat) src->sizemin));
|
||||
src->sizemin +
|
||||
(guint8) (((gfloat) src->sizemax) * rand () / (RAND_MAX +
|
||||
(gfloat) src->sizemin));
|
||||
break;
|
||||
case FAKESRC_SIZETYPE_NULL:
|
||||
default:
|
||||
|
@ -707,19 +714,19 @@ gst_fakesrc_create_buffer (GstFakeSrc * src)
|
|||
case FAKESRC_DATA_SUBBUFFER:
|
||||
/* see if we have a parent to subbuffer */
|
||||
if (!src->parent) {
|
||||
gst_fakesrc_alloc_parent (src);
|
||||
g_assert (src->parent);
|
||||
gst_fakesrc_alloc_parent (src);
|
||||
g_assert (src->parent);
|
||||
}
|
||||
/* see if it's large enough */
|
||||
if ((GST_BUFFER_SIZE (src->parent) - src->parentoffset) >= size) {
|
||||
buf = gst_buffer_create_sub (src->parent, src->parentoffset, size);
|
||||
src->parentoffset += size;
|
||||
buf = gst_buffer_create_sub (src->parent, src->parentoffset, size);
|
||||
src->parentoffset += size;
|
||||
} else {
|
||||
/* the parent is useless now */
|
||||
gst_buffer_unref (src->parent);
|
||||
src->parent = NULL;
|
||||
/* try again (this will allocate a new parent) */
|
||||
return gst_fakesrc_create_buffer (src);
|
||||
/* the parent is useless now */
|
||||
gst_buffer_unref (src->parent);
|
||||
src->parent = NULL;
|
||||
/* try again (this will allocate a new parent) */
|
||||
return gst_fakesrc_create_buffer (src);
|
||||
}
|
||||
gst_fakesrc_prepare_buffer (src, buf);
|
||||
break;
|
||||
|
@ -781,9 +788,9 @@ gst_fakesrc_get (GstPad * pad)
|
|||
g_free (src->last_message);
|
||||
|
||||
src->last_message =
|
||||
g_strdup_printf ("get ******* (%s:%s)> (%d bytes, %"
|
||||
G_GUINT64_FORMAT " ) %p", GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
||||
g_strdup_printf ("get ******* (%s:%s)> (%d bytes, %"
|
||||
G_GUINT64_FORMAT " ) %p", GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
||||
|
||||
g_object_notify (G_OBJECT (src), "last_message");
|
||||
}
|
||||
|
@ -791,7 +798,7 @@ gst_fakesrc_get (GstPad * pad)
|
|||
if (src->signal_handoffs) {
|
||||
GST_LOG_OBJECT (src, "pre handoff emit");
|
||||
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,
|
||||
buf, pad);
|
||||
buf, pad);
|
||||
GST_LOG_OBJECT (src, "post handoff emit");
|
||||
}
|
||||
|
||||
|
@ -856,8 +863,8 @@ gst_fakesrc_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (fakesrc->parent) {
|
||||
gst_buffer_unref (fakesrc->parent);
|
||||
fakesrc->parent = NULL;
|
||||
gst_buffer_unref (fakesrc->parent);
|
||||
fakesrc->parent = NULL;
|
||||
}
|
||||
g_free (fakesrc->last_message);
|
||||
fakesrc->last_message = NULL;
|
||||
|
|
|
@ -82,7 +82,7 @@ gst_fdsink_class_init (GstFdSinkClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
|
||||
g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
|
||||
0, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_fdsink_set_property;
|
||||
gobject_class->get_property = gst_fdsink_get_property;
|
||||
|
@ -114,7 +114,7 @@ gst_fdsink_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
if (GST_BUFFER_DATA (buf)) {
|
||||
GST_DEBUG ("writing %d bytes to file descriptor %d", GST_BUFFER_SIZE (buf),
|
||||
fdsink->fd);
|
||||
fdsink->fd);
|
||||
write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
}
|
||||
|
||||
|
|
|
@ -92,14 +92,14 @@ gst_fdsrc_class_init (GstFdSrcClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
|
||||
g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
|
||||
g_param_spec_ulong ("blocksize", "Block size",
|
||||
"Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
"Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TIMEOUT,
|
||||
g_param_spec_uint64 ("timeout", "Timeout", "Read timeout in nanoseconds",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
|
||||
gst_fdsrc_signals[SIGNAL_TIMEOUT] =
|
||||
g_signal_new ("timeout", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -204,11 +204,11 @@ gst_fdsrc_get (GstPad * pad)
|
|||
|
||||
do {
|
||||
retval = select (1, &readfds, NULL, NULL, tp);
|
||||
} while (retval == -1 && errno == EINTR); /* retry if interrupted */
|
||||
} while (retval == -1 && errno == EINTR); /* retry if interrupted */
|
||||
|
||||
if (retval == -1) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||
("select on file descriptor: %s.", g_strerror (errno)));
|
||||
("select on file descriptor: %s.", g_strerror (errno)));
|
||||
gst_element_set_eos (GST_ELEMENT (src));
|
||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
} else if (retval == 0) {
|
||||
|
@ -219,7 +219,7 @@ gst_fdsrc_get (GstPad * pad)
|
|||
|
||||
do {
|
||||
readbytes = read (src->fd, GST_BUFFER_DATA (buf), src->blocksize);
|
||||
} while (readbytes == -1 && errno == EINTR); /* retry if interrupted */
|
||||
} while (readbytes == -1 && errno == EINTR); /* retry if interrupted */
|
||||
|
||||
if (readbytes > 0) {
|
||||
GST_BUFFER_OFFSET (buf) = src->curoffset;
|
||||
|
@ -234,7 +234,7 @@ gst_fdsrc_get (GstPad * pad)
|
|||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||
("read on file descriptor: %s.", g_strerror (errno)));
|
||||
("read on file descriptor: %s.", g_strerror (errno)));
|
||||
gst_element_set_eos (GST_ELEMENT (src));
|
||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ gst_filesink_get_formats (GstPad * pad)
|
|||
GST_FORMAT_BYTES,
|
||||
0,
|
||||
};
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
@ -77,6 +78,7 @@ gst_filesink_get_query_types (GstPad * pad)
|
|||
GST_QUERY_POSITION,
|
||||
0
|
||||
};
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
|
@ -110,6 +112,7 @@ _do_init (GType filesink_type)
|
|||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
g_type_add_interface_static (filesink_type, GST_TYPE_URI_HANDLER,
|
||||
&urihandler_info);
|
||||
GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0,
|
||||
|
@ -136,7 +139,7 @@ gst_filesink_class_init (GstFileSinkClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
|
||||
g_param_spec_string ("location", "File Location",
|
||||
"Location of the file to write", NULL, G_PARAM_READWRITE));
|
||||
"Location of the file to write", NULL, G_PARAM_READWRITE));
|
||||
|
||||
gst_filesink_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -251,15 +254,15 @@ gst_filesink_open_file (GstFileSink * sink)
|
|||
/* open the file */
|
||||
if (sink->filename == NULL || sink->filename[0] == '\0') {
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
|
||||
(_("No file name specified for writing.")), (NULL));
|
||||
(_("No file name specified for writing.")), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sink->file = fopen (sink->filename, "w");
|
||||
if (sink->file == NULL) {
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
||||
(_("Could not open file \"%s\" for writing."), sink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
(_("Could not open file \"%s\" for writing."), sink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -277,7 +280,7 @@ gst_filesink_close_file (GstFileSink * sink)
|
|||
|
||||
if (fclose (sink->file) != 0) {
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
|
||||
(_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM);
|
||||
(_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM);
|
||||
} else {
|
||||
GST_FLAG_UNSET (sink, GST_FILESINK_OPEN);
|
||||
}
|
||||
|
@ -292,25 +295,25 @@ gst_filesink_pad_query (GstPad * pad, GstQueryType type,
|
|||
switch (type) {
|
||||
case GST_QUERY_TOTAL:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) {
|
||||
*value = sink->data_written; /* FIXME - doesn't the kernel provide
|
||||
such a function? */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) {
|
||||
*value = sink->data_written; /* FIXME - doesn't the kernel provide
|
||||
such a function? */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_QUERY_POSITION:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) {
|
||||
*value = ftell (sink->file);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) {
|
||||
*value = ftell (sink->file);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -336,27 +339,27 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
|||
switch (type) {
|
||||
case GST_EVENT_SEEK:
|
||||
g_return_val_if_fail (GST_EVENT_SEEK_FORMAT (event) == GST_FORMAT_BYTES,
|
||||
FALSE);
|
||||
FALSE);
|
||||
|
||||
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
|
||||
if (fflush (filesink->file))
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
if (fflush (filesink->file))
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_SET);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_CUR);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_END);
|
||||
break;
|
||||
default:
|
||||
g_warning ("unknown seek method!");
|
||||
break;
|
||||
case GST_SEEK_METHOD_SET:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_SET);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_CUR);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_END);
|
||||
break;
|
||||
default:
|
||||
g_warning ("unknown seek method!");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
|
@ -364,16 +367,16 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
|||
gint64 offset;
|
||||
|
||||
if (gst_event_discont_get_value (event, GST_FORMAT_BYTES, &offset))
|
||||
fseek (filesink->file, offset, SEEK_SET);
|
||||
fseek (filesink->file, offset, SEEK_SET);
|
||||
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_FLUSH:
|
||||
if (fflush (filesink->file)) {
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_EOS:
|
||||
|
@ -419,15 +422,15 @@ gst_filesink_chain (GstPad * pad, GstData * _data)
|
|||
back_pending = filesink->data_written - ftell (filesink->file);
|
||||
while (bytes_written < GST_BUFFER_SIZE (buf)) {
|
||||
size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1,
|
||||
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||
filesink->file);
|
||||
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||
filesink->file);
|
||||
|
||||
if (wrote <= 0) {
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
("Only %d of %d bytes written: %s",
|
||||
bytes_written, GST_BUFFER_SIZE (buf), strerror (errno)));
|
||||
break;
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
("Only %d of %d bytes written: %s",
|
||||
bytes_written, GST_BUFFER_SIZE (buf), strerror (errno)));
|
||||
break;
|
||||
}
|
||||
bytes_written += wrote;
|
||||
}
|
||||
|
@ -449,13 +452,13 @@ gst_filesink_change_state (GstElement * element)
|
|||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (GST_FLAG_IS_SET (element, GST_FILESINK_OPEN))
|
||||
gst_filesink_close_file (GST_FILESINK (element));
|
||||
gst_filesink_close_file (GST_FILESINK (element));
|
||||
break;
|
||||
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
if (!GST_FLAG_IS_SET (element, GST_FILESINK_OPEN)) {
|
||||
if (!gst_filesink_open_file (GST_FILESINK (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
if (!gst_filesink_open_file (GST_FILESINK (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -477,6 +480,7 @@ static gchar **
|
|||
gst_filesink_uri_get_protocols (void)
|
||||
{
|
||||
static gchar *protocols[] = { "file", NULL };
|
||||
|
||||
return protocols;
|
||||
}
|
||||
static const gchar *
|
||||
|
|
|
@ -107,11 +107,12 @@ gst_filesrc_get_event_mask (GstPad * pad)
|
|||
{
|
||||
static const GstEventMask masks[] = {
|
||||
{GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
||||
{GST_EVENT_FLUSH, 0},
|
||||
{GST_EVENT_SIZE, 0},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
return masks;
|
||||
}
|
||||
|
||||
|
@ -123,6 +124,7 @@ gst_filesrc_get_query_types (GstPad * pad)
|
|||
GST_QUERY_POSITION,
|
||||
0
|
||||
};
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
|
@ -133,6 +135,7 @@ gst_filesrc_get_formats (GstPad * pad)
|
|||
GST_FORMAT_BYTES,
|
||||
0,
|
||||
};
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
@ -162,6 +165,7 @@ _do_init (GType filesrc_type)
|
|||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
|
||||
&urihandler_info);
|
||||
GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element");
|
||||
|
@ -188,22 +192,22 @@ gst_filesrc_class_init (GstFileSrcClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
|
||||
g_param_spec_int ("fd", "File-descriptor",
|
||||
"File-descriptor for the file being mmap()d", 0, G_MAXINT, 0,
|
||||
G_PARAM_READABLE));
|
||||
"File-descriptor for the file being mmap()d", 0, G_MAXINT, 0,
|
||||
G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
|
||||
g_param_spec_string ("location", "File Location",
|
||||
"Location of the file to read", NULL, G_PARAM_READWRITE));
|
||||
"Location of the file to read", NULL, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
|
||||
g_param_spec_ulong ("blocksize", "Block size",
|
||||
"Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
"Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MMAPSIZE,
|
||||
g_param_spec_ulong ("mmapsize", "mmap() Block Size",
|
||||
"Size in bytes of mmap()d regions", 0, G_MAXULONG, DEFAULT_MMAPSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
"Size in bytes of mmap()d regions", 0, G_MAXULONG, DEFAULT_MMAPSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOUCH,
|
||||
g_param_spec_boolean ("touch", "Touch read data",
|
||||
"Touch data to force disk read", FALSE, G_PARAM_READWRITE));
|
||||
"Touch data to force disk read", FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->dispose = gst_filesrc_dispose;
|
||||
gobject_class->set_property = gst_filesrc_set_property;
|
||||
|
@ -235,7 +239,7 @@ gst_filesrc_init (GstFileSrc * src)
|
|||
src->touch = FALSE;
|
||||
|
||||
src->mapbuf = NULL;
|
||||
src->mapsize = DEFAULT_MMAPSIZE; /* default is 4MB */
|
||||
src->mapsize = DEFAULT_MMAPSIZE; /* default is 4MB */
|
||||
|
||||
src->seek_happened = FALSE;
|
||||
}
|
||||
|
@ -301,12 +305,12 @@ gst_filesrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
break;
|
||||
case ARG_MMAPSIZE:
|
||||
if ((src->mapsize % src->pagesize) == 0) {
|
||||
src->mapsize = g_value_get_ulong (value);
|
||||
g_object_notify (G_OBJECT (src), "mmapsize");
|
||||
src->mapsize = g_value_get_ulong (value);
|
||||
g_object_notify (G_OBJECT (src), "mmapsize");
|
||||
} else {
|
||||
GST_INFO_OBJECT (src,
|
||||
"invalid mapsize, must be a multiple of pagesize, which is %d",
|
||||
src->pagesize);
|
||||
GST_INFO_OBJECT (src,
|
||||
"invalid mapsize, must be a multiple of pagesize, which is %d",
|
||||
src->pagesize);
|
||||
}
|
||||
break;
|
||||
case ARG_TOUCH:
|
||||
|
@ -390,7 +394,7 @@ gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size)
|
|||
return NULL;
|
||||
} else if (mmapregion == MAP_FAILED) {
|
||||
GST_WARNING_OBJECT (src, "mmap (0x%08lx, %d, 0x%llx) failed: %s",
|
||||
(unsigned long) size, src->fd, offset, strerror (errno));
|
||||
(unsigned long) size, src->fd, offset, strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
GST_LOG_OBJECT (src, "mapped region %08lx+%08lx from file into memory at %p",
|
||||
|
@ -435,7 +439,7 @@ gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size)
|
|||
|
||||
mapbase = offset - mod;
|
||||
mapsize =
|
||||
((size + mod + src->pagesize - 1) / src->pagesize) * src->pagesize;
|
||||
((size + mod + src->pagesize - 1) / src->pagesize) * src->pagesize;
|
||||
/* printf("not on page boundaries, resizing map to %d+%d\n",mapbase,mapsize);*/
|
||||
map = gst_filesrc_map_region (src, mapbase, mapsize);
|
||||
if (map == NULL)
|
||||
|
@ -468,10 +472,10 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
|
||||
/* calculate end pointers so we don't have to do so repeatedly later */
|
||||
readsize = src->block_size;
|
||||
readend = src->curoffset + src->block_size; /* note this is the byte *after* the read */
|
||||
readend = src->curoffset + src->block_size; /* note this is the byte *after* the read */
|
||||
mapstart = GST_BUFFER_OFFSET (src->mapbuf);
|
||||
mapsize = GST_BUFFER_SIZE (src->mapbuf);
|
||||
mapend = mapstart + mapsize; /* note this is the byte *after* the map */
|
||||
mapend = mapstart + mapsize; /* note this is the byte *after* the map */
|
||||
|
||||
/* check to see if we're going to overflow the end of the file */
|
||||
if (readend > src->filelen) {
|
||||
|
@ -491,22 +495,22 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
/* ('cause by definition if readend is in the buffer, so's readstart) */
|
||||
if (readend <= mapend) {
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d lives in current mapbuf %lld+%d, creating subbuffer of mapbuf",
|
||||
src->curoffset, (int) readsize, mapstart, mapsize);
|
||||
"read buf %llu+%d lives in current mapbuf %lld+%d, creating subbuffer of mapbuf",
|
||||
src->curoffset, (int) readsize, mapstart, mapsize);
|
||||
buf =
|
||||
gst_buffer_create_sub (src->mapbuf, src->curoffset - mapstart,
|
||||
readsize);
|
||||
gst_buffer_create_sub (src->mapbuf, src->curoffset - mapstart,
|
||||
readsize);
|
||||
GST_BUFFER_OFFSET (buf) = src->curoffset;
|
||||
|
||||
/* if the start actually is within the current mmap region, map an overlap buffer */
|
||||
} else if (src->curoffset < mapend) {
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d starts in mapbuf %d+%d but ends outside, creating new mmap",
|
||||
(unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart,
|
||||
(gint) mapsize);
|
||||
"read buf %llu+%d starts in mapbuf %d+%d but ends outside, creating new mmap",
|
||||
(unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart,
|
||||
(gint) mapsize);
|
||||
buf = gst_filesrc_map_small_region (src, src->curoffset, readsize);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* the only other option is that buffer is totally outside, which means we search for it */
|
||||
|
@ -518,9 +522,9 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
/* or the read buffer fully contains the current mmap region */
|
||||
/* either way, it's really not relevant, we just create a new region anyway */
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d starts before mapbuf %d+%d, but overlaps it",
|
||||
(unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart,
|
||||
(gint) mapsize);
|
||||
"read buf %llu+%d starts before mapbuf %d+%d, but overlaps it",
|
||||
(unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart,
|
||||
(gint) mapsize);
|
||||
buf = gst_filesrc_map_small_region (src, src->curoffset, readsize);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
@ -530,16 +534,16 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
if (buf == NULL) {
|
||||
/* first check to see if there's a map that covers the right region already */
|
||||
GST_LOG_OBJECT (src, "searching for mapbuf to cover %llu+%d",
|
||||
src->curoffset, (int) readsize);
|
||||
src->curoffset, (int) readsize);
|
||||
|
||||
/* if the read buffer crosses a mmap region boundary, create a one-off region */
|
||||
if ((src->curoffset / src->mapsize) != (readend / src->mapsize)) {
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d crosses a %d-byte boundary, creating a one-off",
|
||||
src->curoffset, (int) readsize, (int) src->mapsize);
|
||||
"read buf %llu+%d crosses a %d-byte boundary, creating a one-off",
|
||||
src->curoffset, (int) readsize, (int) src->mapsize);
|
||||
buf = gst_filesrc_map_small_region (src, src->curoffset, readsize);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
/* otherwise we will create a new mmap region and set it to the default */
|
||||
} else {
|
||||
|
@ -548,29 +552,29 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
off_t nextmap = src->curoffset - (src->curoffset % src->mapsize);
|
||||
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d in new mapbuf at %llu+%d, mapping and subbuffering",
|
||||
src->curoffset, readsize, nextmap, src->mapsize);
|
||||
"read buf %llu+%d in new mapbuf at %llu+%d, mapping and subbuffering",
|
||||
src->curoffset, readsize, nextmap, src->mapsize);
|
||||
/* first, we're done with the old mapbuf */
|
||||
gst_buffer_unref (src->mapbuf);
|
||||
mapsize = src->mapsize;
|
||||
|
||||
/* double the mapsize as long as the readsize is smaller */
|
||||
while (readsize - (src->curoffset - nextmap) > mapsize) {
|
||||
GST_LOG_OBJECT (src, "readsize smaller then mapsize %08x %d",
|
||||
readsize, (int) mapsize);
|
||||
mapsize <<= 1;
|
||||
GST_LOG_OBJECT (src, "readsize smaller then mapsize %08x %d",
|
||||
readsize, (int) mapsize);
|
||||
mapsize <<= 1;
|
||||
}
|
||||
/* create a new one */
|
||||
src->mapbuf = gst_filesrc_map_region (src, nextmap, mapsize);
|
||||
if (src->mapbuf == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
/* subbuffer it */
|
||||
buf =
|
||||
gst_buffer_create_sub (src->mapbuf, src->curoffset - nextmap,
|
||||
readsize);
|
||||
gst_buffer_create_sub (src->mapbuf, src->curoffset - nextmap,
|
||||
readsize);
|
||||
GST_BUFFER_OFFSET (buf) =
|
||||
GST_BUFFER_OFFSET (src->mapbuf) + src->curoffset - nextmap;
|
||||
GST_BUFFER_OFFSET (src->mapbuf) + src->curoffset - nextmap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -598,7 +602,7 @@ gst_filesrc_get_read (GstFileSrc * src)
|
|||
readsize = src->block_size;
|
||||
if (src->curoffset + readsize > src->filelen) {
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| src->curoffset + readsize > src->filelen) {
|
||||
|| src->curoffset + readsize > src->filelen) {
|
||||
readsize = src->filelen - src->curoffset;
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +617,7 @@ gst_filesrc_get_read (GstFileSrc * src)
|
|||
}
|
||||
if (ret < readsize) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||
("unexpected end of file."));
|
||||
("unexpected end of file."));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -648,8 +652,8 @@ gst_filesrc_get (GstPad * pad)
|
|||
src->seek_happened = FALSE;
|
||||
GST_DEBUG_OBJECT (src, "sending discont");
|
||||
event =
|
||||
gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset,
|
||||
NULL);
|
||||
gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset,
|
||||
NULL);
|
||||
return GST_DATA (event);
|
||||
}
|
||||
|
||||
|
@ -658,7 +662,7 @@ gst_filesrc_get (GstPad * pad)
|
|||
if (src->curoffset == src->filelen) {
|
||||
if (!gst_filesrc_check_filesize (src) || src->curoffset >= src->filelen) {
|
||||
GST_DEBUG_OBJECT (src, "eos %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
|
||||
src->curoffset, src->filelen);
|
||||
src->curoffset, src->filelen);
|
||||
gst_element_set_eos (GST_ELEMENT (src));
|
||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
}
|
||||
|
@ -697,7 +701,7 @@ gst_filesrc_open_file (GstFileSrc * src)
|
|||
|
||||
if (src->filename == NULL || src->filename[0] == '\0') {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -711,8 +715,8 @@ gst_filesrc_open_file (GstFileSrc * src)
|
|||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL), (NULL));
|
||||
else
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||
(_("Could not open file \"%s\" for reading."), src->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
(_("Could not open file \"%s\" for reading."), src->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
return FALSE;
|
||||
} else {
|
||||
/* check if it is a regular file, otherwise bail out */
|
||||
|
@ -722,7 +726,7 @@ gst_filesrc_open_file (GstFileSrc * src)
|
|||
|
||||
if (!S_ISREG (stat_results.st_mode)) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||
(_("File \"%s\" isn't a regular file."), src->filename), (NULL));
|
||||
(_("File \"%s\" isn't a regular file."), src->filename), (NULL));
|
||||
close (src->fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -780,13 +784,13 @@ gst_filesrc_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
if (!GST_FLAG_IS_SET (element, GST_FILESRC_OPEN)) {
|
||||
if (!gst_filesrc_open_file (GST_FILESRC (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
if (!gst_filesrc_open_file (GST_FILESRC (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (GST_FLAG_IS_SET (element, GST_FILESRC_OPEN))
|
||||
gst_filesrc_close_file (GST_FILESRC (element));
|
||||
gst_filesrc_close_file (GST_FILESRC (element));
|
||||
src->seek_happened = TRUE;
|
||||
break;
|
||||
default:
|
||||
|
@ -808,23 +812,23 @@ gst_filesrc_srcpad_query (GstPad * pad, GstQueryType type,
|
|||
switch (type) {
|
||||
case GST_QUERY_TOTAL:
|
||||
if (*format != GST_FORMAT_BYTES) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
gst_filesrc_check_filesize (src);
|
||||
*value = src->filelen;
|
||||
break;
|
||||
case GST_QUERY_POSITION:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
*value = src->curoffset;
|
||||
break;
|
||||
case GST_FORMAT_PERCENT:
|
||||
if (src->filelen == 0)
|
||||
return FALSE;
|
||||
*value = src->curoffset * GST_FORMAT_PERCENT_MAX / src->filelen;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
*value = src->curoffset;
|
||||
break;
|
||||
case GST_FORMAT_PERCENT:
|
||||
if (src->filelen == 0)
|
||||
return FALSE;
|
||||
*value = src->curoffset * GST_FORMAT_PERCENT_MAX / src->filelen;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -847,44 +851,44 @@ gst_filesrc_srcpad_event (GstPad * pad, GstEvent * event)
|
|||
gint64 offset;
|
||||
|
||||
if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES) {
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
|
||||
offset = GST_EVENT_SEEK_OFFSET (event);
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET:
|
||||
if (offset > src->filelen && (!gst_filesrc_check_filesize (src)
|
||||
|| offset > src->filelen)) {
|
||||
goto error;
|
||||
}
|
||||
src->curoffset = offset;
|
||||
GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
if (offset + src->curoffset > src->filelen)
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| offset + src->curoffset > src->filelen)
|
||||
goto error;
|
||||
src->curoffset += offset;
|
||||
GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
if (ABS (offset) > src->filelen) {
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| ABS (offset) > src->filelen)
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
src->curoffset = src->filelen - ABS (offset);
|
||||
GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
break;
|
||||
case GST_SEEK_METHOD_SET:
|
||||
if (offset > src->filelen && (!gst_filesrc_check_filesize (src)
|
||||
|| offset > src->filelen)) {
|
||||
goto error;
|
||||
}
|
||||
src->curoffset = offset;
|
||||
GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
if (offset + src->curoffset > src->filelen)
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| offset + src->curoffset > src->filelen)
|
||||
goto error;
|
||||
src->curoffset += offset;
|
||||
GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
if (ABS (offset) > src->filelen) {
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| ABS (offset) > src->filelen)
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
src->curoffset = src->filelen - ABS (offset);
|
||||
GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
break;
|
||||
}
|
||||
src->seek_happened = TRUE;
|
||||
src->need_flush = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH;
|
||||
|
@ -892,7 +896,7 @@ gst_filesrc_srcpad_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
case GST_EVENT_SIZE:
|
||||
if (GST_EVENT_SIZE_FORMAT (event) != GST_FORMAT_BYTES) {
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
src->block_size = GST_EVENT_SIZE_VALUE (event);
|
||||
g_object_notify (G_OBJECT (src), "blocksize");
|
||||
|
@ -923,6 +927,7 @@ static gchar **
|
|||
gst_filesrc_uri_get_protocols (void)
|
||||
{
|
||||
static gchar *protocols[] = { "file", NULL };
|
||||
|
||||
return protocols;
|
||||
}
|
||||
static const gchar *
|
||||
|
|
|
@ -94,31 +94,31 @@ gst_identity_class_init (GstIdentityClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
|
||||
g_param_spec_boolean ("loop-based", "Loop-based",
|
||||
"Set to TRUE to use loop-based rather than chain-based scheduling",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"Set to TRUE to use loop-based rather than chain-based scheduling",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SLEEP_TIME,
|
||||
g_param_spec_uint ("sleep-time", "Sleep time",
|
||||
"Microseconds to sleep between processing", 0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"Microseconds to sleep between processing", 0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUPLICATE,
|
||||
g_param_spec_uint ("duplicate", "Duplicate Buffers",
|
||||
"Push the buffers N times", 0, G_MAXUINT, 1, G_PARAM_READWRITE));
|
||||
"Push the buffers N times", 0, G_MAXUINT, 1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ERROR_AFTER,
|
||||
g_param_spec_int ("error_after", "Error After", "Error after N buffers",
|
||||
G_MININT, G_MAXINT, -1, G_PARAM_READWRITE));
|
||||
G_MININT, G_MAXINT, -1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DROP_PROBABILITY,
|
||||
g_param_spec_float ("drop_probability", "Drop Probability",
|
||||
"The Probability a buffer is dropped", 0.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE));
|
||||
"The Probability a buffer is dropped", 0.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last-message", "last-message", "last-message", NULL,
|
||||
G_PARAM_READABLE));
|
||||
G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
|
||||
g_param_spec_boolean ("dump", "Dump", "Dump buffer contents", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gst_identity_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -173,7 +173,7 @@ gst_identity_chain (GstPad * pad, GstData * _data)
|
|||
if (identity->error_after == 0) {
|
||||
gst_buffer_unref (buf);
|
||||
GST_ELEMENT_ERROR (identity, CORE, FAILED,
|
||||
(_("Failed after iterations as requested.")), (NULL));
|
||||
(_("Failed after iterations as requested.")), (NULL));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -181,12 +181,12 @@ gst_identity_chain (GstPad * pad, GstData * _data)
|
|||
if (identity->drop_probability > 0.0) {
|
||||
if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
|
||||
if (identity->last_message != NULL) {
|
||||
g_free (identity->last_message);
|
||||
g_free (identity->last_message);
|
||||
}
|
||||
identity->last_message =
|
||||
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %"
|
||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %"
|
||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_object_notify (G_OBJECT (identity), "last-message");
|
||||
gst_buffer_unref (buf);
|
||||
return;
|
||||
|
@ -200,14 +200,14 @@ gst_identity_chain (GstPad * pad, GstData * _data)
|
|||
if (!identity->silent) {
|
||||
g_free (identity->last_message);
|
||||
identity->last_message =
|
||||
g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, %"
|
||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, %"
|
||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_object_notify (G_OBJECT (identity), "last-message");
|
||||
}
|
||||
|
||||
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
|
||||
buf);
|
||||
buf);
|
||||
|
||||
if (i > 1)
|
||||
gst_buffer_ref (buf);
|
||||
|
@ -259,12 +259,12 @@ gst_identity_set_property (GObject * object, guint prop_id,
|
|||
case ARG_LOOP_BASED:
|
||||
identity->loop_based = g_value_get_boolean (value);
|
||||
if (identity->loop_based) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (identity),
|
||||
gst_identity_loop);
|
||||
gst_pad_set_chain_function (identity->sinkpad, NULL);
|
||||
gst_element_set_loop_function (GST_ELEMENT (identity),
|
||||
gst_identity_loop);
|
||||
gst_pad_set_chain_function (identity->sinkpad, NULL);
|
||||
} else {
|
||||
gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain);
|
||||
gst_element_set_loop_function (GST_ELEMENT (identity), NULL);
|
||||
gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain);
|
||||
gst_element_set_loop_function (GST_ELEMENT (identity), NULL);
|
||||
}
|
||||
break;
|
||||
case ARG_SLEEP_TIME:
|
||||
|
|
|
@ -397,7 +397,7 @@ gst_md5sink_class_init (GstMD5SinkClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5,
|
||||
g_param_spec_string ("md5", "md5", "current value of the md5 sum",
|
||||
"", G_PARAM_READABLE));
|
||||
"", G_PARAM_READABLE));
|
||||
|
||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_md5sink_change_state);
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ gst_md5sink_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
guchar *md5string = g_malloc0 (33);
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
sprintf (md5string + i * 2, "%02x", sink->md5[i]);
|
||||
sprintf (md5string + i * 2, "%02x", sink->md5[i]);
|
||||
g_value_set_string (value, md5string);
|
||||
g_free (md5string);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass)
|
|||
G_STRUCT_OFFSET (GstMultiFileSrcClass, new_file), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATIONS, g_param_spec_pointer ("locations", "locations", "locations", G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATIONS, g_param_spec_pointer ("locations", "locations", "locations", G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
gobject_class->set_property = gst_multifilesrc_set_property;
|
||||
gobject_class->get_property = gst_multifilesrc_get_property;
|
||||
|
@ -149,11 +149,11 @@ gst_multifilesrc_set_property (GObject * object, guint prop_id,
|
|||
|
||||
/* clear the filename if we get a NULL */
|
||||
if (g_value_get_pointer (value) == NULL) {
|
||||
gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
|
||||
src->listptr = NULL;
|
||||
/* otherwise set the new filenames */
|
||||
gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
|
||||
src->listptr = NULL;
|
||||
/* otherwise set the new filenames */
|
||||
} else {
|
||||
src->listptr = g_value_get_pointer (value);
|
||||
src->listptr = g_value_get_pointer (value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -244,7 +244,7 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
|||
|
||||
if (src->currentfilename == NULL || src->currentfilename[0] == '\0') {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -252,8 +252,8 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
|||
src->fd = open ((const char *) src->currentfilename, O_RDONLY);
|
||||
if (src->fd < 0) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||
(_("Could not open file \"%s\" for reading."), src->currentfilename),
|
||||
GST_ERROR_SYSTEM);
|
||||
(_("Could not open file \"%s\" for reading."), src->currentfilename),
|
||||
GST_ERROR_SYSTEM);
|
||||
return FALSE;
|
||||
|
||||
} else {
|
||||
|
@ -267,7 +267,7 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
|||
if (src->map == NULL) {
|
||||
close (src->fd);
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL),
|
||||
("mmap call failed."));
|
||||
("mmap call failed."));
|
||||
return FALSE;
|
||||
}
|
||||
GST_FLAG_SET (src, GST_MULTIFILESRC_OPEN);
|
||||
|
|
|
@ -98,7 +98,7 @@ gst_pipefilter_class_init (GstPipefilterClass * klass)
|
|||
gobject_class->set_property = gst_pipefilter_set_property;
|
||||
gobject_class->get_property = gst_pipefilter_get_property;
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COMMAND, g_param_spec_string ("command", "command", "command", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COMMAND, g_param_spec_string ("command", "command", "command", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
gstelement_class->change_state = gst_pipefilter_change_state;
|
||||
}
|
||||
|
@ -134,9 +134,9 @@ gst_pipefilter_handle_event (GstPad * pad, GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
if (close (pipefilter->fdin[1]) < 0)
|
||||
perror ("close");
|
||||
perror ("close");
|
||||
if (close (pipefilter->fdout[0]) < 0)
|
||||
perror ("close");
|
||||
perror ("close");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -279,8 +279,8 @@ gst_pipefilter_open_file (GstPipefilter * src)
|
|||
close (src->fdin[1]);
|
||||
close (src->fdout[0]);
|
||||
/* child */
|
||||
dup2 (src->fdin[0], STDIN_FILENO); /* set the childs input stream */
|
||||
dup2 (src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
|
||||
dup2 (src->fdin[0], STDIN_FILENO); /* set the childs input stream */
|
||||
dup2 (src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
|
||||
execvp (src->command[0], &src->command[0]);
|
||||
/* will only be reached if execvp has an error */
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL), GST_ERROR_SYSTEM);
|
||||
|
@ -327,7 +327,7 @@ gst_pipefilter_change_state (GstElement * element)
|
|||
} else {
|
||||
if (!GST_FLAG_IS_SET (element, GST_PIPEFILTER_OPEN)) {
|
||||
if (!gst_pipefilter_open_file (GST_PIPEFILTER (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,8 @@ typedef struct
|
|||
GstPad *sinkpad;
|
||||
GstPad *srcpad;
|
||||
GstBuffer *buffer;
|
||||
} GstShaperConnection;
|
||||
}
|
||||
GstShaperConnection;
|
||||
|
||||
GstStaticPadTemplate shaper_src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
|
||||
GST_PAD_SRC,
|
||||
|
@ -80,9 +81,10 @@ gst_shaper_policy_get_type (void)
|
|||
{SHAPER_POLICY_BUFFERSIZE, "2", "sync on buffer size"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!shaper_policy_type) {
|
||||
shaper_policy_type =
|
||||
g_enum_register_static ("GstShaperPolicy", shaper_policy);
|
||||
g_enum_register_static ("GstShaperPolicy", shaper_policy);
|
||||
}
|
||||
return shaper_policy_type;
|
||||
}
|
||||
|
@ -128,13 +130,13 @@ gst_shaper_class_init (GstShaperClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY,
|
||||
g_param_spec_enum ("policy", "Policy", "Shaper policy",
|
||||
GST_TYPE_SHAPER_POLICY, SHAPER_POLICY_TIMESTAMPS, G_PARAM_READWRITE));
|
||||
GST_TYPE_SHAPER_POLICY, SHAPER_POLICY_TIMESTAMPS, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last-message", "last-message", "last-message",
|
||||
NULL, G_PARAM_READABLE));
|
||||
NULL, G_PARAM_READABLE));
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property);
|
||||
|
@ -279,30 +281,30 @@ gst_shaper_loop (GstElement * element)
|
|||
|
||||
/* events are simply pushed ASAP */
|
||||
if (GST_IS_EVENT (buffer)) {
|
||||
/* save event type as it will be unreffed after the next push */
|
||||
GstEventType type = GST_EVENT_TYPE (buffer);
|
||||
/* save event type as it will be unreffed after the next push */
|
||||
GstEventType type = GST_EVENT_TYPE (buffer);
|
||||
|
||||
gst_pad_push (connection->srcpad, GST_DATA (buffer));
|
||||
gst_pad_push (connection->srcpad, GST_DATA (buffer));
|
||||
|
||||
switch (type) {
|
||||
/* on EOS we disable the pad so that we don't pull on
|
||||
* it again and never get more data */
|
||||
case GST_EVENT_EOS:
|
||||
gst_pad_set_active (connection->sinkpad, FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (type) {
|
||||
/* on EOS we disable the pad so that we don't pull on
|
||||
* it again and never get more data */
|
||||
case GST_EVENT_EOS:
|
||||
gst_pad_set_active (connection->sinkpad, FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* we store the buffer */
|
||||
connection->buffer = buffer;
|
||||
/* we store the buffer */
|
||||
connection->buffer = buffer;
|
||||
}
|
||||
}
|
||||
/* FIXME policy stuff goes here */
|
||||
/* find connection with lowest timestamp */
|
||||
if (min == NULL || (connection->buffer != NULL &&
|
||||
(GST_BUFFER_TIMESTAMP (connection->buffer) <
|
||||
GST_BUFFER_TIMESTAMP (min->buffer)))) {
|
||||
(GST_BUFFER_TIMESTAMP (connection->buffer) <
|
||||
GST_BUFFER_TIMESTAMP (min->buffer)))) {
|
||||
min = connection;
|
||||
}
|
||||
connections = g_slist_next (connections);
|
||||
|
|
|
@ -95,34 +95,34 @@ gst_statistics_class_init (GstStatisticsClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS,
|
||||
g_param_spec_int64 ("buffers", "buffers", "total buffers count",
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BYTES,
|
||||
g_param_spec_int64 ("bytes", "bytes", "total bytes count",
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EVENTS,
|
||||
g_param_spec_int64 ("events", "events", "total event count",
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_BUFFER_UPDATE_FREQ, g_param_spec_int64 ("buffer_update_freq",
|
||||
"buffer update freq", "buffer update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"buffer update freq", "buffer update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_BYTES_UPDATE_FREQ, g_param_spec_int64 ("bytes_update_freq",
|
||||
"bytes update freq", "bytes update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"bytes update freq", "bytes update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_EVENT_UPDATE_FREQ, g_param_spec_int64 ("event_update_freq",
|
||||
"event update freq", "event update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"event update freq", "event update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPDATE_ON_EOS,
|
||||
g_param_spec_boolean ("update_on_eos", "update on EOS",
|
||||
"update on EOS event", TRUE, G_PARAM_READWRITE));
|
||||
"update on EOS event", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPDATE,
|
||||
g_param_spec_boolean ("update", "update", "update", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gst_statistics_signals[SIGNAL_UPDATE] =
|
||||
g_signal_new ("update", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -253,14 +253,14 @@ gst_statistics_chain (GstPad * pad, GstData * _data)
|
|||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||
gst_element_set_eos (GST_ELEMENT (statistics));
|
||||
if (statistics->update_on_eos) {
|
||||
update = TRUE;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
if (statistics->update_freq.events) {
|
||||
statistics->update_count.events += 1;
|
||||
if (statistics->update_count.events == statistics->update_freq.events) {
|
||||
statistics->update_count.events = 0;
|
||||
update = TRUE;
|
||||
statistics->update_count.events = 0;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -268,8 +268,8 @@ gst_statistics_chain (GstPad * pad, GstData * _data)
|
|||
if (statistics->update_freq.buffers) {
|
||||
statistics->update_count.buffers += 1;
|
||||
if (statistics->update_count.buffers == statistics->update_freq.buffers) {
|
||||
statistics->update_count.buffers = 0;
|
||||
update = TRUE;
|
||||
statistics->update_count.buffers = 0;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,8 +277,8 @@ gst_statistics_chain (GstPad * pad, GstData * _data)
|
|||
if (statistics->update_freq.bytes) {
|
||||
statistics->update_count.bytes += GST_BUFFER_SIZE (buf);
|
||||
if (statistics->update_count.bytes >= statistics->update_freq.bytes) {
|
||||
statistics->update_count.bytes = 0;
|
||||
update = TRUE;
|
||||
statistics->update_count.bytes = 0;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ gst_statistics_chain (GstPad * pad, GstData * _data)
|
|||
if (statistics->update) {
|
||||
GST_DEBUG ("[%s]: pre update emit", GST_ELEMENT_NAME (statistics));
|
||||
g_signal_emit (G_OBJECT (statistics),
|
||||
gst_statistics_signals[SIGNAL_UPDATE], 0);
|
||||
gst_statistics_signals[SIGNAL_UPDATE], 0);
|
||||
GST_DEBUG ("[%s]: post update emit", GST_ELEMENT_NAME (statistics));
|
||||
}
|
||||
if (!statistics->silent) {
|
||||
|
|
|
@ -95,13 +95,13 @@ gst_tee_class_init (GstTeeClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
||||
g_param_spec_int ("num_pads", "num_pads", "num_pads",
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent",
|
||||
TRUE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last_message", "last_message", "last_message",
|
||||
NULL, G_PARAM_READABLE));
|
||||
NULL, G_PARAM_READABLE));
|
||||
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
|
||||
|
@ -134,7 +134,7 @@ name_pad_compare (gconstpointer a, gconstpointer b)
|
|||
|
||||
g_assert (GST_IS_PAD (pad));
|
||||
|
||||
return strcmp (name, gst_pad_get_name (pad)); /* returns 0 if match */
|
||||
return strcmp (name, gst_pad_get_name (pad)); /* returns 0 if match */
|
||||
}
|
||||
|
||||
static GstPad *
|
||||
|
@ -163,7 +163,7 @@ gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
|||
while (!name) {
|
||||
name = g_strdup_printf ("src%d", i);
|
||||
if (g_list_find_custom ((GList *) pads, (gconstpointer) name,
|
||||
name_pad_compare) != NULL) {
|
||||
name_pad_compare) != NULL) {
|
||||
/* this name is taken, use the next one */
|
||||
++i;
|
||||
g_free (name);
|
||||
|
@ -276,9 +276,9 @@ gst_tee_chain (GstPad * pad, GstData * _data)
|
|||
if (!tee->silent) {
|
||||
g_free (tee->last_message);
|
||||
tee->last_message =
|
||||
g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %"
|
||||
G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (outpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
||||
g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %"
|
||||
G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (outpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
||||
g_object_notify (G_OBJECT (tee), "last_message");
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@ enum
|
|||
};
|
||||
enum
|
||||
{
|
||||
MODE_NORMAL, /* act as identity */
|
||||
MODE_TYPEFIND, /* do typefinding */
|
||||
MODE_NORMAL, /* act as identity */
|
||||
MODE_TYPEFIND, /* do typefinding */
|
||||
};
|
||||
|
||||
|
||||
|
@ -146,16 +146,16 @@ gst_type_find_element_class_init (GstTypeFindElementClass * typefind_class)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_CAPS,
|
||||
g_param_spec_boxed ("caps", _("caps"),
|
||||
_("detected capabilities in stream"), gst_caps_get_type (),
|
||||
G_PARAM_READABLE));
|
||||
_("detected capabilities in stream"), gst_caps_get_type (),
|
||||
G_PARAM_READABLE));
|
||||
g_object_class_install_property (gobject_class, ARG_MINIMUM,
|
||||
g_param_spec_uint ("minimum", _("minimum"),
|
||||
"minimum probability required to accept caps", GST_TYPE_FIND_MINIMUM,
|
||||
GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MINIMUM, G_PARAM_READWRITE));
|
||||
"minimum probability required to accept caps", GST_TYPE_FIND_MINIMUM,
|
||||
GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MINIMUM, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MINIMUM,
|
||||
g_param_spec_uint ("maximum", _("maximum"),
|
||||
"probability to stop typefinding", GST_TYPE_FIND_MINIMUM,
|
||||
GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MAXIMUM, G_PARAM_READWRITE));
|
||||
"probability to stop typefinding", GST_TYPE_FIND_MINIMUM,
|
||||
GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MAXIMUM, G_PARAM_READWRITE));
|
||||
|
||||
gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type",
|
||||
G_TYPE_FROM_CLASS (typefind_class), G_SIGNAL_RUN_LAST,
|
||||
|
@ -259,8 +259,8 @@ gst_type_find_element_src_event_mask (GstPad * pad)
|
|||
{
|
||||
static const GstEventMask mask[] = {
|
||||
{GST_EVENT_SEEK,
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END |
|
||||
GST_SEEK_FLAG_FLUSH},
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END |
|
||||
GST_SEEK_FLAG_FLUSH},
|
||||
/* add more if you want, event masks suck and need to die anyway */
|
||||
{0,}
|
||||
};
|
||||
|
@ -290,7 +290,8 @@ typedef struct
|
|||
|
||||
GList *buffers;
|
||||
GstTypeFindElement *self;
|
||||
} TypeFindEntry;
|
||||
}
|
||||
TypeFindEntry;
|
||||
|
||||
static inline TypeFindEntry *
|
||||
new_entry (void)
|
||||
|
@ -336,7 +337,7 @@ stop_typefinding (GstTypeFindElement * typefind)
|
|||
if (typefind->possibilities != NULL) {
|
||||
/* this should only happen on PAUSED => READY or EOS */
|
||||
GST_LOG_OBJECT (typefind, "freeing remaining %u typefind functions",
|
||||
g_list_length (typefind->possibilities));
|
||||
g_list_length (typefind->possibilities));
|
||||
g_list_foreach (typefind->possibilities, (GFunc) free_entry, NULL);
|
||||
g_list_free (typefind->possibilities);
|
||||
typefind->possibilities = NULL;
|
||||
|
@ -349,7 +350,7 @@ stop_typefinding (GstTypeFindElement * typefind)
|
|||
guint size = gst_buffer_store_get_size (typefind->store, 0);
|
||||
|
||||
if (size
|
||||
&& (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
|
||||
&& (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
|
||||
GST_LOG_OBJECT (typefind, "pushing cached data (%u bytes)", size);
|
||||
gst_pad_push (typefind->src, GST_DATA (buffer));
|
||||
} else {
|
||||
|
@ -357,10 +358,10 @@ stop_typefinding (GstTypeFindElement * typefind)
|
|||
}
|
||||
GST_LOG_OBJECT (typefind, "seeking back to current position %u", size);
|
||||
if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink),
|
||||
gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES,
|
||||
size))) {
|
||||
gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES,
|
||||
size))) {
|
||||
GST_WARNING_OBJECT (typefind,
|
||||
"could not seek to required position %u, hope for the best", size);
|
||||
"could not seek to required position %u, hope for the best", size);
|
||||
}
|
||||
}
|
||||
gst_buffer_store_clear (typefind->store);
|
||||
|
@ -375,25 +376,25 @@ find_element_get_length (gpointer data)
|
|||
|
||||
if (!typefind->stream_length_available) {
|
||||
GST_LOG_OBJECT (entry->self,
|
||||
"'%s' called get_length () but we know it's not available",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
"'%s' called get_length () but we know it's not available",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
return 0;
|
||||
}
|
||||
if (entry->self->stream_length == 0) {
|
||||
typefind->stream_length_available =
|
||||
gst_pad_query (GST_PAD_PEER (entry->self->sink), GST_QUERY_TOTAL,
|
||||
&format, &entry->self->stream_length);
|
||||
gst_pad_query (GST_PAD_PEER (entry->self->sink), GST_QUERY_TOTAL,
|
||||
&format, &entry->self->stream_length);
|
||||
if (format != GST_FORMAT_BYTES)
|
||||
typefind->stream_length_available = FALSE;
|
||||
if (!typefind->stream_length_available) {
|
||||
GST_DEBUG_OBJECT (entry->self,
|
||||
"'%s' called get_length () but it's not available",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
"'%s' called get_length () but it's not available",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
return 0;
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (entry->self,
|
||||
"'%s' called get_length () and it's %" G_GUINT64_FORMAT " bytes",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->self->stream_length);
|
||||
"'%s' called get_length () and it's %" G_GUINT64_FORMAT " bytes",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->self->stream_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,23 +410,23 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event)
|
|||
/* need to do more? */
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
/* this should only happen when we got all available data */
|
||||
entry =
|
||||
(TypeFindEntry *) typefind->possibilities ? typefind->
|
||||
possibilities->data : NULL;
|
||||
if (entry && entry->probability >= typefind->min_probability) {
|
||||
GST_INFO_OBJECT (typefind,
|
||||
"'%s' is the best typefind left after we got all data, using it now (probability %u)",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability);
|
||||
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0,
|
||||
entry->probability, entry->caps);
|
||||
}
|
||||
stop_typefinding (typefind);
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
/* this should only happen when we got all available data */
|
||||
entry =
|
||||
(TypeFindEntry *) typefind->possibilities ? typefind->
|
||||
possibilities->data : NULL;
|
||||
if (entry && entry->probability >= typefind->min_probability) {
|
||||
GST_INFO_OBJECT (typefind,
|
||||
"'%s' is the best typefind left after we got all data, using it now (probability %u)",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability);
|
||||
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0,
|
||||
entry->probability, entry->caps);
|
||||
}
|
||||
stop_typefinding (typefind);
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
default:
|
||||
gst_data_unref (GST_DATA (event));
|
||||
break;
|
||||
gst_data_unref (GST_DATA (event));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
gst_pad_event_default (pad, event);
|
||||
|
@ -449,8 +450,8 @@ find_peek (gpointer data, gint64 offset, guint size)
|
|||
buf = NULL;
|
||||
} else {
|
||||
buf =
|
||||
gst_buffer_store_get_buffer (entry->self->store, length + offset,
|
||||
size);
|
||||
gst_buffer_store_get_buffer (entry->self->store, length + offset,
|
||||
size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,8 +461,8 @@ find_peek (gpointer data, gint64 offset, guint size)
|
|||
} else {
|
||||
if (entry->requested_size == 0) {
|
||||
GST_LOG_OBJECT (entry->self,
|
||||
"setting requested peek (%" G_GINT64_FORMAT ", %u) on '%s'", offset,
|
||||
size, GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
"setting requested peek (%" G_GINT64_FORMAT ", %u) on '%s'", offset,
|
||||
size, GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
entry->requested_offset = offset;
|
||||
entry->requested_size = size;
|
||||
}
|
||||
|
@ -521,160 +522,160 @@ gst_type_find_element_chain (GstPad * pad, GstData * data)
|
|||
|
||||
gst_buffer_store_add_buffer (typefind->store, GST_BUFFER (data));
|
||||
current_offset = GST_BUFFER_OFFSET_IS_VALID (data) ?
|
||||
GST_BUFFER_OFFSET (data) + GST_BUFFER_SIZE (data) :
|
||||
gst_buffer_store_get_size (typefind->store, 0);
|
||||
GST_BUFFER_OFFSET (data) + GST_BUFFER_SIZE (data) :
|
||||
gst_buffer_store_get_size (typefind->store, 0);
|
||||
gst_data_unref (data);
|
||||
if (typefind->possibilities == NULL) {
|
||||
/* not yet started, get all typefinding functions into our "queue" */
|
||||
GList *all_factories = gst_type_find_factory_get_list ();
|
||||
/* not yet started, get all typefinding functions into our "queue" */
|
||||
GList *all_factories = gst_type_find_factory_get_list ();
|
||||
|
||||
GST_INFO_OBJECT (typefind, "starting with %u typefinding functions",
|
||||
g_list_length ((GList *) all_factories));
|
||||
GST_INFO_OBJECT (typefind, "starting with %u typefinding functions",
|
||||
g_list_length ((GList *) all_factories));
|
||||
|
||||
all_factories = g_list_sort (all_factories, compare_type_find_factory);
|
||||
walk = all_factories;
|
||||
while (all_factories) {
|
||||
entry = new_entry ();
|
||||
all_factories = g_list_sort (all_factories, compare_type_find_factory);
|
||||
walk = all_factories;
|
||||
while (all_factories) {
|
||||
entry = new_entry ();
|
||||
|
||||
entry->factory = GST_TYPE_FIND_FACTORY (all_factories->data);
|
||||
entry->self = typefind;
|
||||
entry->probability = 0;
|
||||
typefind->possibilities =
|
||||
g_list_prepend (typefind->possibilities, entry);
|
||||
all_factories = g_list_next (all_factories);
|
||||
}
|
||||
g_list_free (all_factories);
|
||||
entry->factory = GST_TYPE_FIND_FACTORY (all_factories->data);
|
||||
entry->self = typefind;
|
||||
entry->probability = 0;
|
||||
typefind->possibilities =
|
||||
g_list_prepend (typefind->possibilities, entry);
|
||||
all_factories = g_list_next (all_factories);
|
||||
}
|
||||
g_list_free (all_factories);
|
||||
}
|
||||
/* call every typefind function once */
|
||||
walk = entries = typefind->possibilities;
|
||||
GST_INFO_OBJECT (typefind, "iterating %u typefinding functions",
|
||||
g_list_length (entries));
|
||||
g_list_length (entries));
|
||||
typefind->possibilities = NULL;
|
||||
while (walk) {
|
||||
find.data = entry = (TypeFindEntry *) walk->data;
|
||||
walk = g_list_next (walk);
|
||||
entry->probability = 0;
|
||||
entry->requested_offset = 0;
|
||||
entry->requested_size = 0;
|
||||
gst_type_find_factory_call_function (entry->factory, &find);
|
||||
free_entry_buffers (entry);
|
||||
if (entry->probability == 0 && entry->requested_size == 0) {
|
||||
GST_DEBUG_OBJECT (typefind,
|
||||
"'%s' was removed - no chance of being the right plugin",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
free_entry (entry);
|
||||
} else if (entry->probability >= typefind->max_probability) {
|
||||
/* wooha, got caps */
|
||||
GstCaps *found_caps = entry->caps;
|
||||
guint probability = entry->probability;
|
||||
find.data = entry = (TypeFindEntry *) walk->data;
|
||||
walk = g_list_next (walk);
|
||||
entry->probability = 0;
|
||||
entry->requested_offset = 0;
|
||||
entry->requested_size = 0;
|
||||
gst_type_find_factory_call_function (entry->factory, &find);
|
||||
free_entry_buffers (entry);
|
||||
if (entry->probability == 0 && entry->requested_size == 0) {
|
||||
GST_DEBUG_OBJECT (typefind,
|
||||
"'%s' was removed - no chance of being the right plugin",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
free_entry (entry);
|
||||
} else if (entry->probability >= typefind->max_probability) {
|
||||
/* wooha, got caps */
|
||||
GstCaps *found_caps = entry->caps;
|
||||
guint probability = entry->probability;
|
||||
|
||||
GST_INFO_OBJECT (typefind,
|
||||
"'%s' returned %u/%u probability, using it NOW",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), probability,
|
||||
typefind->max_probability);
|
||||
while (walk) {
|
||||
free_entry ((TypeFindEntry *) walk->data);
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
walk = typefind->possibilities;
|
||||
while (walk) {
|
||||
free_entry (walk->data);
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
typefind->possibilities = NULL;
|
||||
g_list_free (typefind->possibilities);
|
||||
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0,
|
||||
probability, found_caps);
|
||||
free_entry (entry);
|
||||
} else {
|
||||
typefind->possibilities =
|
||||
g_list_prepend (typefind->possibilities, entry);
|
||||
}
|
||||
GST_INFO_OBJECT (typefind,
|
||||
"'%s' returned %u/%u probability, using it NOW",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), probability,
|
||||
typefind->max_probability);
|
||||
while (walk) {
|
||||
free_entry ((TypeFindEntry *) walk->data);
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
walk = typefind->possibilities;
|
||||
while (walk) {
|
||||
free_entry (walk->data);
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
typefind->possibilities = NULL;
|
||||
g_list_free (typefind->possibilities);
|
||||
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0,
|
||||
probability, found_caps);
|
||||
free_entry (entry);
|
||||
} else {
|
||||
typefind->possibilities =
|
||||
g_list_prepend (typefind->possibilities, entry);
|
||||
}
|
||||
}
|
||||
g_list_free (entries);
|
||||
/* we may now already have caps or we might be left without functions to try */
|
||||
if (typefind->caps) {
|
||||
stop_typefinding (typefind);
|
||||
stop_typefinding (typefind);
|
||||
} else if (typefind->possibilities == NULL) {
|
||||
GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
|
||||
GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
|
||||
} else {
|
||||
/* set up typefind element for next iteration */
|
||||
typefind->possibilities =
|
||||
g_list_sort (typefind->possibilities, compare_type_find_entry);
|
||||
/* set up typefind element for next iteration */
|
||||
typefind->possibilities =
|
||||
g_list_sort (typefind->possibilities, compare_type_find_entry);
|
||||
|
||||
/* look for typefind functions that require data without seeking */
|
||||
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
if (entry->requested_offset <= current_offset &&
|
||||
entry->requested_offset + entry->requested_size > current_offset)
|
||||
break;
|
||||
}
|
||||
if (!walk) {
|
||||
/* find out if we should seek */
|
||||
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
if (entry->requested_size > 0) {
|
||||
/* FIXME: need heuristic to find out if we should seek */
|
||||
gint64 seek_offset;
|
||||
GstEvent *event;
|
||||
/* look for typefind functions that require data without seeking */
|
||||
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
if (entry->requested_offset <= current_offset &&
|
||||
entry->requested_offset + entry->requested_size > current_offset)
|
||||
break;
|
||||
}
|
||||
if (!walk) {
|
||||
/* find out if we should seek */
|
||||
for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) {
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
if (entry->requested_size > 0) {
|
||||
/* FIXME: need heuristic to find out if we should seek */
|
||||
gint64 seek_offset;
|
||||
GstEvent *event;
|
||||
|
||||
seek_offset =
|
||||
entry->requested_offset >
|
||||
0 ? entry->
|
||||
requested_offset : find_element_get_length (entry) +
|
||||
entry->requested_offset;
|
||||
seek_offset +=
|
||||
gst_buffer_store_get_size (typefind->store, seek_offset);
|
||||
event =
|
||||
gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET,
|
||||
seek_offset);
|
||||
if (gst_pad_send_event (GST_PAD_PEER (typefind->sink), event)) {
|
||||
/* done seeking */
|
||||
GST_DEBUG_OBJECT (typefind,
|
||||
"'%s' was reset - seeked to %" G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
break;
|
||||
} else if (entry->requested_offset < 0) {
|
||||
/* impossible to seek */
|
||||
GST_DEBUG_OBJECT (typefind,
|
||||
"'%s' was reset - couldn't seek to %" G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
entry->requested_size = 0;
|
||||
entry->requested_offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* throw out all entries that can't get more data */
|
||||
walk = g_list_next (typefind->possibilities);
|
||||
while (walk) {
|
||||
GList *cur = walk;
|
||||
seek_offset =
|
||||
entry->requested_offset >
|
||||
0 ? entry->
|
||||
requested_offset : find_element_get_length (entry) +
|
||||
entry->requested_offset;
|
||||
seek_offset +=
|
||||
gst_buffer_store_get_size (typefind->store, seek_offset);
|
||||
event =
|
||||
gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET,
|
||||
seek_offset);
|
||||
if (gst_pad_send_event (GST_PAD_PEER (typefind->sink), event)) {
|
||||
/* done seeking */
|
||||
GST_DEBUG_OBJECT (typefind,
|
||||
"'%s' was reset - seeked to %" G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
break;
|
||||
} else if (entry->requested_offset < 0) {
|
||||
/* impossible to seek */
|
||||
GST_DEBUG_OBJECT (typefind,
|
||||
"'%s' was reset - couldn't seek to %" G_GINT64_FORMAT,
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset);
|
||||
entry->requested_size = 0;
|
||||
entry->requested_offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* throw out all entries that can't get more data */
|
||||
walk = g_list_next (typefind->possibilities);
|
||||
while (walk) {
|
||||
GList *cur = walk;
|
||||
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
walk = g_list_next (walk);
|
||||
if (entry->requested_size == 0) {
|
||||
GST_DEBUG_OBJECT (typefind,
|
||||
"'%s' was removed - higher possibilities available",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
free_entry (entry);
|
||||
typefind->possibilities =
|
||||
g_list_delete_link (typefind->possibilities, cur);
|
||||
}
|
||||
}
|
||||
if (g_list_next (typefind->possibilities) == NULL) {
|
||||
entry = (TypeFindEntry *) typefind->possibilities->data;
|
||||
if (entry->probability > typefind->min_probability) {
|
||||
GST_INFO_OBJECT (typefind,
|
||||
"'%s' is the only typefind left, using it now (probability %u)",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability);
|
||||
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
|
||||
0, entry->probability, entry->caps);
|
||||
free_entry (entry);
|
||||
g_list_free (typefind->possibilities);
|
||||
typefind->possibilities = NULL;
|
||||
stop_typefinding (typefind);
|
||||
}
|
||||
}
|
||||
entry = (TypeFindEntry *) walk->data;
|
||||
walk = g_list_next (walk);
|
||||
if (entry->requested_size == 0) {
|
||||
GST_DEBUG_OBJECT (typefind,
|
||||
"'%s' was removed - higher possibilities available",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
||||
free_entry (entry);
|
||||
typefind->possibilities =
|
||||
g_list_delete_link (typefind->possibilities, cur);
|
||||
}
|
||||
}
|
||||
if (g_list_next (typefind->possibilities) == NULL) {
|
||||
entry = (TypeFindEntry *) typefind->possibilities->data;
|
||||
if (entry->probability > typefind->min_probability) {
|
||||
GST_INFO_OBJECT (typefind,
|
||||
"'%s' is the only typefind left, using it now (probability %u)",
|
||||
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability);
|
||||
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
|
||||
0, entry->probability, entry->caps);
|
||||
free_entry (entry);
|
||||
g_list_free (typefind->possibilities);
|
||||
typefind->possibilities = NULL;
|
||||
stop_typefinding (typefind);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
240
gst/gst.c
240
gst/gst.c
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "gst_private.h"
|
||||
#include "gst-i18n-lib.h"
|
||||
#include <locale.h> /* for LC_ALL */
|
||||
#include <locale.h> /* for LC_ALL */
|
||||
|
||||
#include "gst.h"
|
||||
#include "gstqueue.h"
|
||||
|
@ -114,55 +114,55 @@ enum
|
|||
*/
|
||||
static const GstPoptOption gstreamer_options[] = {
|
||||
{NULL, NUL, POPT_ARG_CALLBACK | POPT_CBFLAG_PRE | POPT_CBFLAG_POST,
|
||||
(void *) &init_popt_callback, 0, NULL, NULL},
|
||||
(void *) &init_popt_callback, 0, NULL, NULL},
|
||||
/* make sure we use our GETTEXT_PACKAGE as the domain for popt translations */
|
||||
{NULL, NUL, POPT_ARG_INTL_DOMAIN, GETTEXT_PACKAGE, 0, NULL, NULL},
|
||||
{"gst-version", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL, ARG_VERSION,
|
||||
N_("Print the GStreamer version"), NULL},
|
||||
N_("Print the GStreamer version"), NULL},
|
||||
{"gst-fatal-warnings", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_FATAL_WARNINGS, N_("Make all warnings fatal"), NULL},
|
||||
ARG_FATAL_WARNINGS, N_("Make all warnings fatal"), NULL},
|
||||
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
{"gst-debug-help", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_DEBUG_HELP, N_("Print available debug categories and exit"), NULL},
|
||||
ARG_DEBUG_HELP, N_("Print available debug categories and exit"), NULL},
|
||||
{"gst-debug-level", NUL, POPT_ARG_INT | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_DEBUG_LEVEL,
|
||||
N_
|
||||
("Default debug level from 1 (only error) to 5 (anything) or 0 for no output"),
|
||||
N_("LEVEL")},
|
||||
ARG_DEBUG_LEVEL,
|
||||
N_
|
||||
("Default debug level from 1 (only error) to 5 (anything) or 0 for no output"),
|
||||
N_("LEVEL")},
|
||||
{"gst-debug", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG,
|
||||
N_
|
||||
("Comma-separated list of category_name:level pairs to set specific levels for the individual categories. Example: GST_AUTOPLUG:5,GST_ELEMENT_*:3"),
|
||||
N_("LIST")},
|
||||
N_
|
||||
("Comma-separated list of category_name:level pairs to set specific levels for the individual categories. Example: GST_AUTOPLUG:5,GST_ELEMENT_*:3"),
|
||||
N_("LIST")},
|
||||
{"gst-debug-no-color", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_DEBUG_NO_COLOR, N_("Disable colored debugging output"), NULL},
|
||||
ARG_DEBUG_NO_COLOR, N_("Disable colored debugging output"), NULL},
|
||||
{"gst-debug-disable", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_DEBUG_DISABLE, N_("Disable debugging")},
|
||||
ARG_DEBUG_DISABLE, N_("Disable debugging")},
|
||||
#endif
|
||||
|
||||
{"gst-disable-cpu-opt", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_DISABLE_CPU_OPT, N_("Disable accelerated CPU instructions"), NULL},
|
||||
ARG_DISABLE_CPU_OPT, N_("Disable accelerated CPU instructions"), NULL},
|
||||
{"gst-plugin-spew", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_PLUGIN_SPEW, N_("Enable verbose plugin loading diagnostics"), NULL},
|
||||
ARG_PLUGIN_SPEW, N_("Enable verbose plugin loading diagnostics"), NULL},
|
||||
{"gst-plugin-path", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_PLUGIN_PATH,
|
||||
N_("path list for loading plugins (separated by '"
|
||||
G_SEARCHPATH_SEPARATOR_S "')"), N_("PATHS")},
|
||||
ARG_PLUGIN_PATH,
|
||||
N_("path list for loading plugins (separated by '"
|
||||
G_SEARCHPATH_SEPARATOR_S "')"), N_("PATHS")},
|
||||
{"gst-plugin-load", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_PLUGIN_LOAD,
|
||||
N_
|
||||
("Comma-separated list of plugins to preload in addition to the list stored in env variable GST_PLUGIN_PATH"),
|
||||
N_("PLUGINS")},
|
||||
ARG_PLUGIN_LOAD,
|
||||
N_
|
||||
("Comma-separated list of plugins to preload in addition to the list stored in env variable GST_PLUGIN_PATH"),
|
||||
N_("PLUGINS")},
|
||||
{"gst-disable-segtrap", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_SEGTRAP_DISABLE,
|
||||
N_("Disable trapping of segmentation faults during plugin loading"),
|
||||
NULL},
|
||||
ARG_SEGTRAP_DISABLE,
|
||||
N_("Disable trapping of segmentation faults during plugin loading"),
|
||||
NULL},
|
||||
{"gst-scheduler", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_SCHEDULER,
|
||||
N_("Scheduler to use ('" GST_SCHEDULER_DEFAULT_NAME
|
||||
"' is the default)"), N_("SCHEDULER")},
|
||||
ARG_SCHEDULER,
|
||||
N_("Scheduler to use ('" GST_SCHEDULER_DEFAULT_NAME
|
||||
"' is the default)"), N_("SCHEDULER")},
|
||||
{"gst-registry", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL,
|
||||
ARG_REGISTRY, N_("Registry to use"), N_("REGISTRY")},
|
||||
ARG_REGISTRY, N_("Registry to use"), N_("REGISTRY")},
|
||||
POPT_TABLEEND
|
||||
};
|
||||
|
||||
|
@ -269,18 +269,18 @@ gst_init_check_with_popt_table (int *argc, char **argv[],
|
|||
GstPoptOption *options;
|
||||
GstPoptOption options_with[] = {
|
||||
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:",
|
||||
NULL},
|
||||
NULL},
|
||||
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (GstPoptOption *) gstreamer_options, 0,
|
||||
"GStreamer options:", NULL},
|
||||
"GStreamer options:", NULL},
|
||||
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (GstPoptOption *) popt_options, 0,
|
||||
"Application options:", NULL},
|
||||
"Application options:", NULL},
|
||||
POPT_TABLEEND
|
||||
};
|
||||
GstPoptOption options_without[] = {
|
||||
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:",
|
||||
NULL},
|
||||
NULL},
|
||||
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (GstPoptOption *) gstreamer_options, 0,
|
||||
"GStreamer options:", NULL},
|
||||
"GStreamer options:", NULL},
|
||||
POPT_TABLEEND
|
||||
};
|
||||
|
||||
|
@ -317,8 +317,8 @@ gst_init_check_with_popt_table (int *argc, char **argv[],
|
|||
|
||||
if (nextopt != -1) {
|
||||
g_print ("Error on option %s: %s.\nRun '%s --help' "
|
||||
"to see a full list of available command line options.\n",
|
||||
poptBadOption (context, 0), poptStrerror (nextopt), (*argv)[0]);
|
||||
"to see a full list of available command line options.\n",
|
||||
poptBadOption (context, 0), poptStrerror (nextopt), (*argv)[0]);
|
||||
|
||||
poptFreeContext (context);
|
||||
return FALSE;
|
||||
|
@ -368,9 +368,9 @@ parse_debug_list (const gchar * list)
|
|||
g_strstrip (values[1]);
|
||||
level = strtol (values[1], NULL, 0);
|
||||
if (level >= 0 && level < GST_LEVEL_COUNT) {
|
||||
GST_DEBUG ("setting debugging to level %d for name \"%s\"",
|
||||
level, values[0]);
|
||||
gst_debug_set_threshold_for_name (values[0], level);
|
||||
GST_DEBUG ("setting debugging to level %d for name \"%s\"",
|
||||
level, values[0]);
|
||||
gst_debug_set_threshold_for_name (values[0], level);
|
||||
}
|
||||
}
|
||||
g_strfreev (values);
|
||||
|
@ -415,10 +415,10 @@ split_and_iterate (const gchar * stringlist, gchar * separator, GFunc iterator,
|
|||
while (strings[j]) {
|
||||
iterator (strings[j], user_data);
|
||||
if (++j == MAX_PATH_SPLIT) {
|
||||
lastlist = g_strdup (strings[j]);
|
||||
g_strfreev (strings);
|
||||
j = 0;
|
||||
break;
|
||||
lastlist = g_strdup (strings[j]);
|
||||
g_strfreev (strings);
|
||||
j = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ init_pre (void)
|
|||
const gchar *homedir;
|
||||
|
||||
_global_registry =
|
||||
gst_xml_registry_new ("global_registry", GLOBAL_REGISTRY_FILE);
|
||||
gst_xml_registry_new ("global_registry", GLOBAL_REGISTRY_FILE);
|
||||
|
||||
#ifdef PLUGINS_USE_BUILDDIR
|
||||
/* location libgstelements.so */
|
||||
|
@ -472,7 +472,7 @@ init_pre (void)
|
|||
gst_registry_add_path (_global_registry, PLUGINS_BUILDDIR "/gst/types");
|
||||
gst_registry_add_path (_global_registry, PLUGINS_BUILDDIR "/gst/autoplug");
|
||||
gst_registry_add_path (_global_registry,
|
||||
PLUGINS_BUILDDIR "/gst/schedulers");
|
||||
PLUGINS_BUILDDIR "/gst/schedulers");
|
||||
gst_registry_add_path (_global_registry, PLUGINS_BUILDDIR "/gst/indexers");
|
||||
#else
|
||||
/* add the main (installed) library path */
|
||||
|
@ -499,13 +499,13 @@ gst_register_core_elements (GstPlugin * plugin)
|
|||
{
|
||||
/* register some standard builtin types */
|
||||
g_assert (gst_element_register (plugin, "bin", GST_RANK_PRIMARY,
|
||||
GST_TYPE_BIN));
|
||||
GST_TYPE_BIN));
|
||||
g_assert (gst_element_register (plugin, "pipeline", GST_RANK_PRIMARY,
|
||||
GST_TYPE_PIPELINE));
|
||||
GST_TYPE_PIPELINE));
|
||||
g_assert (gst_element_register (plugin, "thread", GST_RANK_PRIMARY,
|
||||
GST_TYPE_THREAD));
|
||||
GST_TYPE_THREAD));
|
||||
g_assert (gst_element_register (plugin, "queue", GST_RANK_PRIMARY,
|
||||
GST_TYPE_QUEUE));
|
||||
GST_TYPE_QUEUE));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ init_post (void)
|
|||
/* don't override command-line options */
|
||||
if (g_getenv ("GST_REGISTRY")) {
|
||||
g_object_set (_global_registry, "location", g_getenv ("GST_REGISTRY"),
|
||||
NULL);
|
||||
NULL);
|
||||
_gst_registry_fixed = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -655,12 +655,12 @@ gst_debug_help (void)
|
|||
if (!gst_plugin_is_loaded (plugin)) {
|
||||
#ifndef GST_DISABLE_REGISTRY
|
||||
if (GST_IS_REGISTRY (plugin->manager)) {
|
||||
GST_CAT_LOG (GST_CAT_PLUGIN_LOADING, "loading plugin %s",
|
||||
plugin->desc.name);
|
||||
if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager),
|
||||
plugin) != GST_REGISTRY_OK)
|
||||
GST_CAT_WARNING (GST_CAT_PLUGIN_LOADING, "loading plugin %s failed",
|
||||
plugin->desc.name);
|
||||
GST_CAT_LOG (GST_CAT_PLUGIN_LOADING, "loading plugin %s",
|
||||
plugin->desc.name);
|
||||
if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager),
|
||||
plugin) != GST_REGISTRY_OK)
|
||||
GST_CAT_WARNING (GST_CAT_PLUGIN_LOADING, "loading plugin %s failed",
|
||||
plugin->desc.name);
|
||||
}
|
||||
#endif /* GST_DISABLE_REGISTRY */
|
||||
}
|
||||
|
@ -681,17 +681,17 @@ gst_debug_help (void)
|
|||
gchar *color = gst_debug_construct_term_color (cat->color);
|
||||
|
||||
g_print ("%s%-20s\033[00m %1d %s %s%s\033[00m\n",
|
||||
color,
|
||||
gst_debug_category_get_name (cat),
|
||||
gst_debug_category_get_threshold (cat),
|
||||
gst_debug_level_get_name (gst_debug_category_get_threshold (cat)),
|
||||
color, gst_debug_category_get_description (cat));
|
||||
color,
|
||||
gst_debug_category_get_name (cat),
|
||||
gst_debug_category_get_threshold (cat),
|
||||
gst_debug_level_get_name (gst_debug_category_get_threshold (cat)),
|
||||
color, gst_debug_category_get_description (cat));
|
||||
g_free (color);
|
||||
} else {
|
||||
g_print ("%-20s %1d %s %s\n", gst_debug_category_get_name (cat),
|
||||
gst_debug_category_get_threshold (cat),
|
||||
gst_debug_level_get_name (gst_debug_category_get_threshold (cat)),
|
||||
gst_debug_category_get_description (cat));
|
||||
gst_debug_category_get_threshold (cat),
|
||||
gst_debug_level_get_name (gst_debug_category_get_threshold (cat)),
|
||||
gst_debug_category_get_description (cat));
|
||||
}
|
||||
walk = g_slist_next (walk);
|
||||
}
|
||||
|
@ -711,75 +711,75 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
|
|||
switch (reason) {
|
||||
case POPT_CALLBACK_REASON_PRE:
|
||||
if (!init_pre ())
|
||||
_gst_initialization_failure = TRUE;
|
||||
_gst_initialization_failure = TRUE;
|
||||
break;
|
||||
case POPT_CALLBACK_REASON_OPTION:
|
||||
switch (option->val) {
|
||||
case ARG_VERSION:
|
||||
g_print ("GStreamer Core Library version %s\n", GST_VERSION);
|
||||
exit (0);
|
||||
case ARG_FATAL_WARNINGS:
|
||||
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
||||
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
||||
g_log_set_always_fatal (fatal_mask);
|
||||
break;
|
||||
case ARG_VERSION:
|
||||
g_print ("GStreamer Core Library version %s\n", GST_VERSION);
|
||||
exit (0);
|
||||
case ARG_FATAL_WARNINGS:
|
||||
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
||||
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
||||
g_log_set_always_fatal (fatal_mask);
|
||||
break;
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
case ARG_DEBUG_LEVEL:{
|
||||
gint tmp = 0;
|
||||
case ARG_DEBUG_LEVEL:{
|
||||
gint tmp = 0;
|
||||
|
||||
tmp = strtol (arg, NULL, 0);
|
||||
if (tmp >= 0 && tmp < GST_LEVEL_COUNT) {
|
||||
gst_debug_set_default_threshold (tmp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ARG_DEBUG:
|
||||
parse_debug_list (arg);
|
||||
break;
|
||||
case ARG_DEBUG_NO_COLOR:
|
||||
gst_debug_set_colored (FALSE);
|
||||
break;
|
||||
case ARG_DEBUG_DISABLE:
|
||||
gst_debug_set_active (FALSE);
|
||||
break;
|
||||
case ARG_DEBUG_HELP:
|
||||
gst_debug_help ();
|
||||
exit (0);
|
||||
tmp = strtol (arg, NULL, 0);
|
||||
if (tmp >= 0 && tmp < GST_LEVEL_COUNT) {
|
||||
gst_debug_set_default_threshold (tmp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ARG_DEBUG:
|
||||
parse_debug_list (arg);
|
||||
break;
|
||||
case ARG_DEBUG_NO_COLOR:
|
||||
gst_debug_set_colored (FALSE);
|
||||
break;
|
||||
case ARG_DEBUG_DISABLE:
|
||||
gst_debug_set_active (FALSE);
|
||||
break;
|
||||
case ARG_DEBUG_HELP:
|
||||
gst_debug_help ();
|
||||
exit (0);
|
||||
#endif
|
||||
case ARG_DISABLE_CPU_OPT:
|
||||
_gst_enable_cpu_opt = FALSE;
|
||||
break;
|
||||
case ARG_PLUGIN_SPEW:
|
||||
break;
|
||||
case ARG_PLUGIN_PATH:
|
||||
case ARG_DISABLE_CPU_OPT:
|
||||
_gst_enable_cpu_opt = FALSE;
|
||||
break;
|
||||
case ARG_PLUGIN_SPEW:
|
||||
break;
|
||||
case ARG_PLUGIN_PATH:
|
||||
#ifndef GST_DISABLE_REGISTRY
|
||||
split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func,
|
||||
_user_registry);
|
||||
split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func,
|
||||
_user_registry);
|
||||
#endif /* GST_DISABLE_REGISTRY */
|
||||
break;
|
||||
case ARG_PLUGIN_LOAD:
|
||||
split_and_iterate (arg, ",", prepare_for_load_plugin_func, NULL);
|
||||
break;
|
||||
case ARG_SEGTRAP_DISABLE:
|
||||
_gst_disable_segtrap = TRUE;
|
||||
break;
|
||||
case ARG_SCHEDULER:
|
||||
gst_scheduler_factory_set_default_name (arg);
|
||||
break;
|
||||
case ARG_REGISTRY:
|
||||
break;
|
||||
case ARG_PLUGIN_LOAD:
|
||||
split_and_iterate (arg, ",", prepare_for_load_plugin_func, NULL);
|
||||
break;
|
||||
case ARG_SEGTRAP_DISABLE:
|
||||
_gst_disable_segtrap = TRUE;
|
||||
break;
|
||||
case ARG_SCHEDULER:
|
||||
gst_scheduler_factory_set_default_name (arg);
|
||||
break;
|
||||
case ARG_REGISTRY:
|
||||
#ifndef GST_DISABLE_REGISTRY
|
||||
g_object_set (G_OBJECT (_user_registry), "location", arg, NULL);
|
||||
_gst_registry_fixed = TRUE;
|
||||
g_object_set (G_OBJECT (_user_registry), "location", arg, NULL);
|
||||
_gst_registry_fixed = TRUE;
|
||||
#endif /* GST_DISABLE_REGISTRY */
|
||||
break;
|
||||
default:
|
||||
g_warning ("option %d not recognized", option->val);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
g_warning ("option %d not recognized", option->val);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case POPT_CALLBACK_REASON_POST:
|
||||
if (!init_post ())
|
||||
_gst_initialization_failure = TRUE;
|
||||
_gst_initialization_failure = TRUE;
|
||||
gst_initialized = TRUE;
|
||||
break;
|
||||
}
|
||||
|
|
202
gst/gstbin.c
202
gst/gstbin.c
|
@ -107,7 +107,7 @@ gst_bin_get_type (void)
|
|||
};
|
||||
|
||||
_gst_bin_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstBin", &bin_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstBin", &bin_info, 0);
|
||||
}
|
||||
return _gst_bin_type;
|
||||
}
|
||||
|
@ -292,19 +292,19 @@ gst_bin_set_element_sched (GstElement * element, GstScheduler * sched)
|
|||
if (GST_IS_BIN (element)) {
|
||||
if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element,
|
||||
"child is already a manager, not resetting sched");
|
||||
"child is already a manager, not resetting sched");
|
||||
if (GST_ELEMENT_SCHED (element))
|
||||
gst_scheduler_add_scheduler (sched, GST_ELEMENT_SCHED (element));
|
||||
gst_scheduler_add_scheduler (sched, GST_ELEMENT_SCHED (element));
|
||||
return;
|
||||
}
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element,
|
||||
"setting child bin's scheduler to be the same as the parent's");
|
||||
"setting child bin's scheduler to be the same as the parent's");
|
||||
gst_scheduler_add_element (sched, element);
|
||||
|
||||
/* set the children's schedule */
|
||||
g_list_foreach (GST_BIN (element)->children,
|
||||
(GFunc) gst_bin_set_element_sched, sched);
|
||||
(GFunc) gst_bin_set_element_sched, sched);
|
||||
}
|
||||
/* otherwise, if it's just a regular old element */
|
||||
else {
|
||||
|
@ -322,19 +322,19 @@ gst_bin_set_element_sched (GstElement * element, GstScheduler * sched)
|
|||
|
||||
/* we only operate on real pads */
|
||||
if (!GST_IS_REAL_PAD (pad))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
/* if the peer element exists and is a candidate */
|
||||
if (GST_PAD_PEER (pad)) {
|
||||
if (gst_pad_get_scheduler (GST_PAD_PEER (pad)) == sched) {
|
||||
GST_CAT_LOG (GST_CAT_SCHEDULING,
|
||||
"peer is in same scheduler, telling scheduler");
|
||||
if (gst_pad_get_scheduler (GST_PAD_PEER (pad)) == sched) {
|
||||
GST_CAT_LOG (GST_CAT_SCHEDULING,
|
||||
"peer is in same scheduler, telling scheduler");
|
||||
|
||||
if (GST_PAD_IS_SRC (pad))
|
||||
gst_scheduler_pad_link (sched, pad, GST_PAD_PEER (pad));
|
||||
else
|
||||
gst_scheduler_pad_link (sched, GST_PAD_PEER (pad), pad);
|
||||
}
|
||||
if (GST_PAD_IS_SRC (pad))
|
||||
gst_scheduler_pad_link (sched, pad, GST_PAD_PEER (pad));
|
||||
else
|
||||
gst_scheduler_pad_link (sched, GST_PAD_PEER (pad), pad);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ gst_bin_unset_element_sched (GstElement * element, GstScheduler * sched)
|
|||
{
|
||||
if (GST_ELEMENT_SCHED (element) == NULL) {
|
||||
GST_CAT_DEBUG (GST_CAT_SCHEDULING, "element \"%s\" has no scheduler",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -359,15 +359,15 @@ gst_bin_unset_element_sched (GstElement * element, GstScheduler * sched)
|
|||
|
||||
if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element,
|
||||
"child is already a manager, not unsetting sched");
|
||||
"child is already a manager, not unsetting sched");
|
||||
if (sched) {
|
||||
gst_scheduler_remove_scheduler (sched, GST_ELEMENT_SCHED (element));
|
||||
gst_scheduler_remove_scheduler (sched, GST_ELEMENT_SCHED (element));
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* for each child, remove them from their schedule */
|
||||
g_list_foreach (GST_BIN (element)->children,
|
||||
(GFunc) gst_bin_unset_element_sched, sched);
|
||||
(GFunc) gst_bin_unset_element_sched, sched);
|
||||
|
||||
gst_scheduler_remove_element (GST_ELEMENT_SCHED (element), element);
|
||||
}
|
||||
|
@ -385,19 +385,19 @@ gst_bin_unset_element_sched (GstElement * element, GstScheduler * sched)
|
|||
|
||||
/* we only operate on real pads */
|
||||
if (!GST_IS_REAL_PAD (pad))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
/* if the peer element exists and is a candidate */
|
||||
if (GST_PAD_PEER (pad)) {
|
||||
if (gst_pad_get_scheduler (GST_PAD_PEER (pad)) == sched) {
|
||||
GST_CAT_LOG (GST_CAT_SCHEDULING,
|
||||
"peer is in same scheduler, telling scheduler");
|
||||
if (gst_pad_get_scheduler (GST_PAD_PEER (pad)) == sched) {
|
||||
GST_CAT_LOG (GST_CAT_SCHEDULING,
|
||||
"peer is in same scheduler, telling scheduler");
|
||||
|
||||
if (GST_PAD_IS_SRC (pad))
|
||||
gst_scheduler_pad_unlink (sched, pad, GST_PAD_PEER (pad));
|
||||
else
|
||||
gst_scheduler_pad_unlink (sched, GST_PAD_PEER (pad), pad);
|
||||
}
|
||||
if (GST_PAD_IS_SRC (pad))
|
||||
gst_scheduler_pad_unlink (sched, pad, GST_PAD_PEER (pad));
|
||||
else
|
||||
gst_scheduler_pad_unlink (sched, GST_PAD_PEER (pad), pad);
|
||||
}
|
||||
}
|
||||
}
|
||||
gst_scheduler_remove_element (GST_ELEMENT_SCHED (element), element);
|
||||
|
@ -444,9 +444,9 @@ gst_bin_add_func (GstBin * bin, GstElement * element)
|
|||
|
||||
/* then check to see if the element's name is already taken in the bin */
|
||||
if (gst_object_check_uniqueness (bin->children,
|
||||
GST_ELEMENT_NAME (element)) == FALSE) {
|
||||
GST_ELEMENT_NAME (element)) == FALSE) {
|
||||
g_warning ("Name %s is not unique in bin %s, not adding\n",
|
||||
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin));
|
||||
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -501,8 +501,8 @@ gst_bin_add (GstBin * bin, GstElement * element)
|
|||
bclass->add_element (bin, element);
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (bin, CORE, FAILED, (NULL),
|
||||
("cannot add element %s to bin %s",
|
||||
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin)));
|
||||
("cannot add element %s to bin %s",
|
||||
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,7 +518,7 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
|
|||
/* the element must be in the bin's list of children */
|
||||
if (g_list_find (bin->children, element) == NULL) {
|
||||
g_warning ("no element \"%s\" in bin \"%s\"\n", GST_ELEMENT_NAME (element),
|
||||
GST_ELEMENT_NAME (bin));
|
||||
GST_ELEMENT_NAME (bin));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ gst_bin_child_state_change (GstBin * bin, GstElementState oldstate,
|
|||
bclass->child_state_change (bin, oldstate, newstate, child);
|
||||
} else {
|
||||
g_warning ("cannot signal state change of child %s to bin %s\n",
|
||||
GST_ELEMENT_NAME (child), GST_ELEMENT_NAME (bin));
|
||||
GST_ELEMENT_NAME (child), GST_ELEMENT_NAME (bin));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -666,17 +666,17 @@ gst_bin_child_state_change_func (GstBin * bin, GstElementState oldstate,
|
|||
gint state = (1 << i);
|
||||
|
||||
if (GST_STATE (bin) != state) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin,
|
||||
"highest child state is %s, changing bin state accordingly",
|
||||
gst_element_state_get_name (state));
|
||||
GST_STATE_PENDING (bin) = state;
|
||||
GST_UNLOCK (bin);
|
||||
gst_bin_change_state_norecurse (bin);
|
||||
if (state != GST_STATE (bin)) {
|
||||
g_warning ("%s: state change in callback %d %d",
|
||||
GST_ELEMENT_NAME (bin), state, GST_STATE (bin));
|
||||
}
|
||||
return;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin,
|
||||
"highest child state is %s, changing bin state accordingly",
|
||||
gst_element_state_get_name (state));
|
||||
GST_STATE_PENDING (bin) = state;
|
||||
GST_UNLOCK (bin);
|
||||
gst_bin_change_state_norecurse (bin);
|
||||
if (state != GST_STATE (bin)) {
|
||||
g_warning ("%s: state change in callback %d %d",
|
||||
GST_ELEMENT_NAME (bin), state, GST_STATE (bin));
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -713,8 +713,8 @@ gst_bin_change_state (GstElement * element)
|
|||
|
||||
if (old_state == pending) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_STATES, element,
|
||||
"old and pending state are both %s, returning",
|
||||
gst_element_state_get_name (pending));
|
||||
"old and pending state are both %s, returning",
|
||||
gst_element_state_get_name (pending));
|
||||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -732,38 +732,38 @@ gst_bin_change_state (GstElement * element)
|
|||
old_child_state = GST_STATE (child);
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
||||
"changing state of child %s from current %s to pending %s",
|
||||
GST_ELEMENT_NAME (child), gst_element_state_get_name (old_child_state),
|
||||
gst_element_state_get_name (pending));
|
||||
"changing state of child %s from current %s to pending %s",
|
||||
GST_ELEMENT_NAME (child), gst_element_state_get_name (old_child_state),
|
||||
gst_element_state_get_name (pending));
|
||||
|
||||
switch (gst_element_set_state (child, pending)) {
|
||||
case GST_STATE_FAILURE:
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"child '%s' failed to go to state %d(%s)",
|
||||
GST_ELEMENT_NAME (child),
|
||||
pending, gst_element_state_get_name (pending));
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"child '%s' failed to go to state %d(%s)",
|
||||
GST_ELEMENT_NAME (child),
|
||||
pending, gst_element_state_get_name (pending));
|
||||
|
||||
gst_element_set_state (child, old_child_state);
|
||||
/* There was a check for elements being in the same scheduling group
|
||||
here. Removed by dolphy <julien@moutte.net>. No matter the
|
||||
scheduling group we should always return a failure. This change
|
||||
seems to work on my machine and fixes tons of issues. If anyone
|
||||
want to revert please tell me what it breaks first, Thanks. */
|
||||
GST_STATE_PENDING (element) = old_state;
|
||||
return GST_STATE_FAILURE;
|
||||
break;
|
||||
gst_element_set_state (child, old_child_state);
|
||||
/* There was a check for elements being in the same scheduling group
|
||||
here. Removed by dolphy <julien@moutte.net>. No matter the
|
||||
scheduling group we should always return a failure. This change
|
||||
seems to work on my machine and fixes tons of issues. If anyone
|
||||
want to revert please tell me what it breaks first, Thanks. */
|
||||
GST_STATE_PENDING (element) = old_state;
|
||||
return GST_STATE_FAILURE;
|
||||
break;
|
||||
case GST_STATE_ASYNC:
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"child '%s' is changing state asynchronously",
|
||||
GST_ELEMENT_NAME (child));
|
||||
have_async = TRUE;
|
||||
break;
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"child '%s' is changing state asynchronously",
|
||||
GST_ELEMENT_NAME (child));
|
||||
have_async = TRUE;
|
||||
break;
|
||||
case GST_STATE_SUCCESS:
|
||||
GST_CAT_DEBUG (GST_CAT_STATES,
|
||||
"child '%s' changed state to %d(%s) successfully",
|
||||
GST_ELEMENT_NAME (child), pending,
|
||||
gst_element_state_get_name (pending));
|
||||
break;
|
||||
GST_CAT_DEBUG (GST_CAT_STATES,
|
||||
"child '%s' changed state to %d(%s) successfully",
|
||||
GST_ELEMENT_NAME (child), pending,
|
||||
gst_element_state_get_name (pending));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -858,7 +858,7 @@ gst_bin_get_by_name (GstBin * bin, const gchar * name)
|
|||
GstElement *res = gst_bin_get_by_name (GST_BIN (child), name);
|
||||
|
||||
if (res)
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
children = g_list_next (children);
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ gst_bin_get_by_interface (GstBin * bin, GType interface)
|
|||
|
||||
ret = gst_bin_get_by_interface (GST_BIN (walk->data), interface);
|
||||
if (ret)
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
|
@ -979,7 +979,7 @@ gst_bin_get_all_by_interface (GstBin * bin, GType interface)
|
|||
ret = g_list_prepend (ret, walk->data);
|
||||
if (GST_IS_BIN (walk->data)) {
|
||||
ret = g_list_concat (ret,
|
||||
gst_bin_get_all_by_interface (GST_BIN (walk->data), interface));
|
||||
gst_bin_get_all_by_interface (GST_BIN (walk->data), interface));
|
||||
}
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
|
@ -1020,17 +1020,17 @@ gst_bin_sync_children_state (GstBin * bin)
|
|||
children = children->next;
|
||||
if (GST_STATE (element) != state) {
|
||||
switch (gst_element_set_state (element, state)) {
|
||||
case GST_STATE_SUCCESS:
|
||||
break;
|
||||
case GST_STATE_ASYNC:
|
||||
if (ret == GST_STATE_SUCCESS)
|
||||
ret = GST_STATE_ASYNC;
|
||||
break;
|
||||
case GST_STATE_FAILURE:
|
||||
ret = GST_STATE_FAILURE;
|
||||
default:
|
||||
/* make sure gst_element_set_state never returns this */
|
||||
g_assert_not_reached ();
|
||||
case GST_STATE_SUCCESS:
|
||||
break;
|
||||
case GST_STATE_ASYNC:
|
||||
if (ret == GST_STATE_SUCCESS)
|
||||
ret = GST_STATE_ASYNC;
|
||||
break;
|
||||
case GST_STATE_FAILURE:
|
||||
ret = GST_STATE_FAILURE;
|
||||
default:
|
||||
/* make sure gst_element_set_state never returns this */
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1075,21 +1075,21 @@ gst_bin_restore_thyself (GstObject * object, xmlNodePtr self)
|
|||
while (field) {
|
||||
if (!strcmp (field->name, "children")) {
|
||||
GST_CAT_INFO (GST_CAT_XML, "[%s]: loading children",
|
||||
GST_ELEMENT_NAME (object));
|
||||
GST_ELEMENT_NAME (object));
|
||||
childlist = field->xmlChildrenNode;
|
||||
while (childlist) {
|
||||
if (!strcmp (childlist->name, "element")) {
|
||||
GstElement *element =
|
||||
gst_xml_make_element (childlist, GST_OBJECT (bin));
|
||||
if (!strcmp (childlist->name, "element")) {
|
||||
GstElement *element =
|
||||
gst_xml_make_element (childlist, GST_OBJECT (bin));
|
||||
|
||||
/* it had to be parented to find the pads, now we ref and unparent so
|
||||
* we can add it to the bin */
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_unparent (GST_OBJECT (element));
|
||||
/* it had to be parented to find the pads, now we ref and unparent so
|
||||
* we can add it to the bin */
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_unparent (GST_OBJECT (element));
|
||||
|
||||
gst_bin_add (bin, element);
|
||||
}
|
||||
childlist = childlist->next;
|
||||
gst_bin_add (bin, element);
|
||||
}
|
||||
childlist = childlist->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1115,7 +1115,7 @@ gst_bin_iterate_func (GstBin * bin)
|
|||
}
|
||||
} else {
|
||||
g_warning ("bin \"%s\" is not the managing bin, can't be iterated on!\n",
|
||||
GST_ELEMENT_NAME (bin));
|
||||
GST_ELEMENT_NAME (bin));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -1149,10 +1149,10 @@ gst_bin_iterate (GstBin * bin)
|
|||
|
||||
if (!running) {
|
||||
if (GST_STATE (bin) == GST_STATE_PLAYING &&
|
||||
GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) {
|
||||
GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) {
|
||||
GST_CAT_DEBUG (GST_CAT_DATAFLOW,
|
||||
"[%s]: polling for child shutdown after useless iteration",
|
||||
GST_ELEMENT_NAME (bin));
|
||||
"[%s]: polling for child shutdown after useless iteration",
|
||||
GST_ELEMENT_NAME (bin));
|
||||
g_usleep (1);
|
||||
running = TRUE;
|
||||
}
|
||||
|
|
|
@ -397,10 +397,10 @@ gst_buffer_span (GstBuffer * buf1, guint32 offset, GstBuffer * buf2,
|
|||
|
||||
/* we simply create a subbuffer of the common parent */
|
||||
newbuf = gst_buffer_create_sub (parent,
|
||||
buf1->data - parent->data + offset, len);
|
||||
buf1->data - parent->data + offset, len);
|
||||
} else {
|
||||
GST_CAT_DEBUG (GST_CAT_BUFFER,
|
||||
"slow path taken while spanning buffers %p and %p", buf1, buf2);
|
||||
"slow path taken while spanning buffers %p and %p", buf1, buf2);
|
||||
/* otherwise we simply have to brute-force copy the buffers */
|
||||
newbuf = gst_buffer_new_and_alloc (len);
|
||||
|
||||
|
@ -408,7 +408,7 @@ gst_buffer_span (GstBuffer * buf1, guint32 offset, GstBuffer * buf2,
|
|||
memcpy (newbuf->data, buf1->data + offset, buf1->size - offset);
|
||||
/* copy the second buffer's data across */
|
||||
memcpy (newbuf->data + (buf1->size - offset), buf2->data,
|
||||
len - (buf1->size - offset));
|
||||
len - (buf1->size - offset));
|
||||
/* if the offset is 0, the new buffer has the same timestamp as buf1 */
|
||||
if (offset == 0) {
|
||||
GST_BUFFER_OFFSET (newbuf) = GST_BUFFER_OFFSET (buf1);
|
||||
|
@ -420,10 +420,10 @@ gst_buffer_span (GstBuffer * buf1, guint32 offset, GstBuffer * buf2,
|
|||
* invalid DURATIONS */
|
||||
if (offset == 0 && buf1->size + buf2->size == len) {
|
||||
if (GST_BUFFER_DURATION_IS_VALID (buf1) &&
|
||||
GST_BUFFER_DURATION_IS_VALID (buf2)) {
|
||||
GST_BUFFER_DURATION_IS_VALID (buf2)) {
|
||||
/* add duration */
|
||||
GST_BUFFER_DURATION (newbuf) = GST_BUFFER_DURATION (buf1) +
|
||||
GST_BUFFER_DURATION (buf2);
|
||||
GST_BUFFER_DURATION (buf2);
|
||||
}
|
||||
if (GST_BUFFER_OFFSET_END_IS_VALID (buf2)) {
|
||||
/* add offset_end */
|
||||
|
|
|
@ -53,11 +53,11 @@ gst_caps_get_type (void)
|
|||
|
||||
if (!gst_caps_type) {
|
||||
gst_caps_type = g_boxed_type_register_static ("GstCaps",
|
||||
(GBoxedCopyFunc) gst_caps_copy_conditional,
|
||||
(GBoxedFreeFunc) gst_caps_free);
|
||||
(GBoxedCopyFunc) gst_caps_copy_conditional,
|
||||
(GBoxedFreeFunc) gst_caps_free);
|
||||
|
||||
g_value_register_transform_func (gst_caps_type,
|
||||
G_TYPE_STRING, gst_caps_transform_to_string);
|
||||
G_TYPE_STRING, gst_caps_transform_to_string);
|
||||
}
|
||||
|
||||
return gst_caps_type;
|
||||
|
@ -680,7 +680,8 @@ typedef struct
|
|||
GstStructure *dest;
|
||||
const GstStructure *intersect;
|
||||
gboolean first_run;
|
||||
} IntersectData;
|
||||
}
|
||||
IntersectData;
|
||||
|
||||
static gboolean
|
||||
gst_caps_structure_intersect_field (GQuark id, GValue * val1, gpointer data)
|
||||
|
@ -719,13 +720,13 @@ gst_caps_structure_intersect (const GstStructure * struct1,
|
|||
data.intersect = struct2;
|
||||
data.first_run = TRUE;
|
||||
if (!gst_structure_foreach ((GstStructure *) struct1,
|
||||
gst_caps_structure_intersect_field, &data))
|
||||
gst_caps_structure_intersect_field, &data))
|
||||
goto error;
|
||||
|
||||
data.intersect = struct1;
|
||||
data.first_run = FALSE;
|
||||
if (!gst_structure_foreach ((GstStructure *) struct2,
|
||||
gst_caps_structure_intersect_field, &data))
|
||||
gst_caps_structure_intersect_field, &data))
|
||||
goto error;
|
||||
|
||||
return data.dest;
|
||||
|
@ -763,10 +764,10 @@ gst_caps_structure_union (const GstStructure * struct1,
|
|||
continue;
|
||||
} else {
|
||||
if (gst_value_union (&dest_value, &field1->value, &field2->value)) {
|
||||
gst_structure_set_value (dest, g_quark_to_string (field1->name),
|
||||
&dest_value);
|
||||
gst_structure_set_value (dest, g_quark_to_string (field1->name),
|
||||
&dest_value);
|
||||
} else {
|
||||
ret = gst_value_compare (&field1->value, &field2->value);
|
||||
ret = gst_value_compare (&field1->value, &field2->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -862,7 +863,8 @@ typedef struct _NormalizeForeach
|
|||
{
|
||||
GstCaps *caps;
|
||||
GstStructure *structure;
|
||||
} NormalizeForeach;
|
||||
}
|
||||
NormalizeForeach;
|
||||
|
||||
static gboolean
|
||||
gst_caps_normalize_foreach (GQuark field_id, GValue * value, gpointer ptr)
|
||||
|
@ -915,7 +917,7 @@ gst_caps_normalize (const GstCaps * caps)
|
|||
nf.structure = gst_caps_get_structure (newcaps, i);
|
||||
|
||||
while (!gst_structure_foreach (nf.structure,
|
||||
gst_caps_normalize_foreach, &nf));
|
||||
gst_caps_normalize_foreach, &nf));
|
||||
}
|
||||
|
||||
return newcaps;
|
||||
|
@ -982,7 +984,7 @@ gst_caps_simplify (const GstCaps * caps)
|
|||
for (j = 0; j < gst_caps_get_size (newcaps); j++) {
|
||||
struct2 = gst_caps_get_structure (caps, i);
|
||||
if (gst_caps_structure_simplify (struct2, structure)) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == gst_caps_get_size (newcaps)) {
|
||||
|
@ -1023,7 +1025,7 @@ gst_caps_load_thyself (xmlNodePtr parent)
|
|||
void
|
||||
gst_caps_replace (GstCaps ** caps, GstCaps * newcaps)
|
||||
{
|
||||
#if 0 /* disable this, since too many plugins rely on undefined behavior */
|
||||
#if 0 /* disable this, since too many plugins rely on undefined behavior */
|
||||
#ifdef USE_POISONING
|
||||
//if (newcaps) CAPS_POISON (newcaps);
|
||||
#endif
|
||||
|
@ -1203,12 +1205,12 @@ gst_caps_structure_fixate_field_nearest_int (GstStructure * structure,
|
|||
for (i = 0; i < n; i++) {
|
||||
list_value = gst_value_list_get_value (value, i);
|
||||
if (G_VALUE_TYPE (list_value) == G_TYPE_INT) {
|
||||
int x = g_value_get_int (list_value);
|
||||
int x = g_value_get_int (list_value);
|
||||
|
||||
if (best_index == -1 || (ABS (target - x) < ABS (best - x))) {
|
||||
best_index = i;
|
||||
best = x;
|
||||
}
|
||||
if (best_index == -1 || (ABS (target - x) < ABS (best - x))) {
|
||||
best_index = i;
|
||||
best = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (best_index != -1) {
|
||||
|
@ -1255,12 +1257,12 @@ gst_caps_structure_fixate_field_nearest_double (GstStructure * structure,
|
|||
for (i = 0; i < n; i++) {
|
||||
list_value = gst_value_list_get_value (value, i);
|
||||
if (G_VALUE_TYPE (list_value) == G_TYPE_DOUBLE) {
|
||||
double x = g_value_get_double (list_value);
|
||||
double x = g_value_get_double (list_value);
|
||||
|
||||
if (best_index == -1 || (ABS (target - x) < ABS (best - x))) {
|
||||
best_index = i;
|
||||
best = x;
|
||||
}
|
||||
if (best_index == -1 || (ABS (target - x) < ABS (best - x))) {
|
||||
best_index = i;
|
||||
best = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (best_index != -1) {
|
||||
|
|
|
@ -346,8 +346,9 @@ gst_clock_get_type (void)
|
|||
(GInstanceInitFunc) gst_clock_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
clock_type = g_type_register_static (GST_TYPE_OBJECT, "GstClock",
|
||||
&clock_info, G_TYPE_FLAG_ABSTRACT);
|
||||
&clock_info, G_TYPE_FLAG_ABSTRACT);
|
||||
}
|
||||
return clock_type;
|
||||
}
|
||||
|
@ -380,16 +381,16 @@ gst_clock_class_init (GstClockClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STATS,
|
||||
g_param_spec_boolean ("stats", "Stats", "Enable clock stats",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_DIFF,
|
||||
g_param_spec_int64 ("max-diff", "Max diff",
|
||||
"The maximum amount of time to wait in nanoseconds", 0, G_MAXINT64,
|
||||
DEFAULT_MAX_DIFF, G_PARAM_READWRITE));
|
||||
"The maximum amount of time to wait in nanoseconds", 0, G_MAXINT64,
|
||||
DEFAULT_MAX_DIFF, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EVENT_DIFF,
|
||||
g_param_spec_uint64 ("event-diff", "event diff",
|
||||
"The amount of time that may elapse until 2 events are treated as happening at different times",
|
||||
0, G_MAXUINT64, DEFAULT_EVENT_DIFF,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
"The amount of time that may elapse until 2 events are treated as happening at different times",
|
||||
0, G_MAXUINT64, DEFAULT_EVENT_DIFF,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -475,7 +476,7 @@ gst_clock_set_resolution (GstClock * clock, guint64 resolution)
|
|||
|
||||
if (cclass->change_resolution)
|
||||
clock->resolution =
|
||||
cclass->change_resolution (clock, clock->resolution, resolution);
|
||||
cclass->change_resolution (clock, clock->resolution, resolution);
|
||||
|
||||
return clock->resolution;
|
||||
}
|
||||
|
@ -642,10 +643,10 @@ gst_clock_get_event_time (GstClock * clock)
|
|||
|
||||
if (clock->last_event + clock->max_event_diff >= time) {
|
||||
GST_LOG_OBJECT (clock, "reporting last event time %" G_GUINT64_FORMAT,
|
||||
clock->last_event);
|
||||
clock->last_event);
|
||||
} else {
|
||||
GST_LOG_OBJECT (clock, "reporting new event time %" G_GUINT64_FORMAT,
|
||||
clock->last_event);
|
||||
clock->last_event);
|
||||
clock->last_event = time;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,12 +94,12 @@ _gst_cpu_initialize_i386 (gulong * flags, GString * featurelist)
|
|||
gst_cpuid_i386 (0x80000001, &eax, &ebx, &ecx, &edx);
|
||||
|
||||
if (edx & (1 << 31)) {
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_3DNOW;
|
||||
g_string_append (featurelist, "3DNOW ");
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_3DNOW;
|
||||
g_string_append (featurelist, "3DNOW ");
|
||||
}
|
||||
if (AMD && (edx & (1 << 22))) {
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_MMXEXT;
|
||||
g_string_append (featurelist, "MMXEXT ");
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_MMXEXT;
|
||||
g_string_append (featurelist, "MMXEXT ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ gst_data_get_type (void)
|
|||
|
||||
if (!type)
|
||||
type = g_boxed_type_register_static ("GstData",
|
||||
(GBoxedCopyFunc) gst_data_copy, (GBoxedFreeFunc) gst_data_unref);
|
||||
(GBoxedCopyFunc) gst_data_copy, (GBoxedFreeFunc) gst_data_unref);
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
468
gst/gstelement.c
468
gst/gstelement.c
|
@ -103,8 +103,9 @@ gst_element_get_type (void)
|
|||
(GInstanceInitFunc) gst_element_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
_gst_element_type = g_type_register_static (GST_TYPE_OBJECT, "GstElement",
|
||||
&element_info, G_TYPE_FLAG_ABSTRACT);
|
||||
&element_info, G_TYPE_FLAG_ABSTRACT);
|
||||
}
|
||||
return _gst_element_type;
|
||||
}
|
||||
|
@ -260,7 +261,8 @@ typedef struct
|
|||
{
|
||||
const GParamSpec *pspec;
|
||||
GValue value;
|
||||
} prop_value_t;
|
||||
}
|
||||
prop_value_t;
|
||||
|
||||
static void
|
||||
element_set_property (GstElement * element, const GParamSpec * pspec,
|
||||
|
@ -352,7 +354,7 @@ gst_element_set_pending_properties (GstElement * element)
|
|||
|
||||
while ((prop_value = g_async_queue_try_pop (element->prop_value_queue))) {
|
||||
g_object_set_property ((GObject *) element, prop_value->pspec->name,
|
||||
&prop_value->value);
|
||||
&prop_value->value);
|
||||
g_value_unset (&prop_value->value);
|
||||
g_free (prop_value);
|
||||
}
|
||||
|
@ -446,12 +448,12 @@ gst_element_set_valist (GstElement * element, const gchar * first_property_name,
|
|||
|
||||
if (!pspec) {
|
||||
g_warning ("%s: object class `%s' has no property named `%s'",
|
||||
G_STRLOC, G_OBJECT_TYPE_NAME (object), name);
|
||||
G_STRLOC, G_OBJECT_TYPE_NAME (object), name);
|
||||
break;
|
||||
}
|
||||
if (!(pspec->flags & G_PARAM_WRITABLE)) {
|
||||
g_warning ("%s: property `%s' of object class `%s' is not writable",
|
||||
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (object));
|
||||
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (object));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -515,12 +517,12 @@ gst_element_get_valist (GstElement * element, const gchar * first_property_name,
|
|||
|
||||
if (!pspec) {
|
||||
g_warning ("%s: object class `%s' has no property named `%s'",
|
||||
G_STRLOC, G_OBJECT_TYPE_NAME (object), name);
|
||||
G_STRLOC, G_OBJECT_TYPE_NAME (object), name);
|
||||
break;
|
||||
}
|
||||
if (!(pspec->flags & G_PARAM_READABLE)) {
|
||||
g_warning ("%s: property `%s' of object class `%s' is not readable",
|
||||
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (object));
|
||||
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (object));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -580,7 +582,7 @@ gst_element_set_property (GstElement * element, const gchar * property_name,
|
|||
|
||||
if (!pspec)
|
||||
g_warning ("%s: object class `%s' has no property named `%s'",
|
||||
G_STRLOC, G_OBJECT_TYPE_NAME (object), property_name);
|
||||
G_STRLOC, G_OBJECT_TYPE_NAME (object), property_name);
|
||||
else
|
||||
element_set_property (element, pspec, value);
|
||||
|
||||
|
@ -621,7 +623,7 @@ gst_element_get_property (GstElement * element, const gchar * property_name,
|
|||
|
||||
if (!pspec)
|
||||
g_warning ("%s: object class `%s' has no property named `%s'",
|
||||
G_STRLOC, G_OBJECT_TYPE_NAME (object), property_name);
|
||||
G_STRLOC, G_OBJECT_TYPE_NAME (object), property_name);
|
||||
else {
|
||||
GValue *prop_value, tmp_value = { 0, };
|
||||
|
||||
|
@ -631,11 +633,11 @@ gst_element_get_property (GstElement * element, const gchar * property_name,
|
|||
g_value_reset (value);
|
||||
prop_value = value;
|
||||
} else if (!g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (pspec),
|
||||
G_VALUE_TYPE (value))) {
|
||||
G_VALUE_TYPE (value))) {
|
||||
g_warning
|
||||
("can't retrieve property `%s' of type `%s' as value of type `%s'",
|
||||
pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
("can't retrieve property `%s' of type `%s' as value of type `%s'",
|
||||
pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
g_object_unref (object);
|
||||
return;
|
||||
} else {
|
||||
|
@ -787,8 +789,8 @@ gst_element_clock_wait (GstElement * element, GstClockID id,
|
|||
if (GST_ELEMENT_SCHED (element)) {
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "waiting on scheduler clock");
|
||||
res =
|
||||
gst_scheduler_clock_wait (GST_ELEMENT_SCHED (element), element, id,
|
||||
jitter);
|
||||
gst_scheduler_clock_wait (GST_ELEMENT_SCHED (element), element, id,
|
||||
jitter);
|
||||
} else {
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "no scheduler, returning GST_CLOCK_TIMEOUT");
|
||||
res = GST_CLOCK_TIMEOUT;
|
||||
|
@ -894,7 +896,7 @@ gst_element_set_time (GstElement * element, GstClockTime time)
|
|||
case GST_STATE_PLAYING:
|
||||
event_time = gst_clock_get_event_time (element->clock);
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, element,
|
||||
"clock time %llu: setting element time to %llu", event_time, time);
|
||||
"clock time %llu: setting element time to %llu", event_time, time);
|
||||
element->base_time = event_time - time;
|
||||
break;
|
||||
default:
|
||||
|
@ -925,21 +927,21 @@ gst_element_adjust_time (GstElement * element, GstClockTimeDiff diff)
|
|||
switch (element->current_state) {
|
||||
case GST_STATE_PAUSED:
|
||||
if (diff < 0 && element->base_time < abs (diff)) {
|
||||
g_warning ("attempted to set the current time of element %s below 0",
|
||||
GST_OBJECT_NAME (element));
|
||||
element->base_time = 0;
|
||||
g_warning ("attempted to set the current time of element %s below 0",
|
||||
GST_OBJECT_NAME (element));
|
||||
element->base_time = 0;
|
||||
} else {
|
||||
element->base_time += diff;
|
||||
element->base_time += diff;
|
||||
}
|
||||
break;
|
||||
case GST_STATE_PLAYING:
|
||||
time = gst_clock_get_time (element->clock);
|
||||
if (time < element->base_time - diff) {
|
||||
g_warning ("attempted to set the current time of element %s below 0",
|
||||
GST_OBJECT_NAME (element));
|
||||
element->base_time = time;
|
||||
g_warning ("attempted to set the current time of element %s below 0",
|
||||
GST_OBJECT_NAME (element));
|
||||
element->base_time = time;
|
||||
} else {
|
||||
element->base_time -= diff;
|
||||
element->base_time -= diff;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1059,7 +1061,7 @@ gst_element_add_pad (GstElement * element, GstPad * pad)
|
|||
|
||||
/* then check to see if there's already a pad by that name here */
|
||||
g_return_if_fail (gst_object_check_uniqueness (element->pads,
|
||||
GST_PAD_NAME (pad)) == TRUE);
|
||||
GST_PAD_NAME (pad)) == TRUE);
|
||||
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "adding pad '%s'",
|
||||
GST_STR_NULL (GST_OBJECT_NAME (pad)));
|
||||
|
@ -1114,7 +1116,7 @@ gst_element_add_ghost_pad (GstElement * element, GstPad * pad,
|
|||
|
||||
/* then check to see if there's already a pad by that name here */
|
||||
g_return_val_if_fail (gst_object_check_uniqueness (element->pads,
|
||||
name) == TRUE, NULL);
|
||||
name) == TRUE, NULL);
|
||||
|
||||
ghostpad = gst_ghost_pad_new (name, pad);
|
||||
|
||||
|
@ -1244,7 +1246,7 @@ gst_element_get_static_pad (GstElement * element, const gchar * name)
|
|||
pad = GST_PAD (walk->data);
|
||||
if (strcmp (GST_PAD_NAME (pad), name) == 0) {
|
||||
GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "found pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
return pad;
|
||||
}
|
||||
walk = g_list_next (walk);
|
||||
|
@ -1291,31 +1293,31 @@ gst_element_get_request_pad (GstElement * element, const gchar * name)
|
|||
while (!templ_found && list) {
|
||||
templ = (GstPadTemplate *) list->data;
|
||||
if (templ->presence == GST_PAD_REQUEST) {
|
||||
/* Because of sanity checks in gst_pad_template_new(), we know that %s
|
||||
and %d, occurring at the end of the name_template, are the only
|
||||
possibilities. */
|
||||
GST_CAT_DEBUG (GST_CAT_PADS, "comparing %s to %s", name,
|
||||
templ->name_template);
|
||||
if ((str = strchr (templ->name_template, '%'))
|
||||
&& strncmp (templ->name_template, name,
|
||||
str - templ->name_template) == 0
|
||||
&& strlen (name) > str - templ->name_template) {
|
||||
data = name + (str - templ->name_template);
|
||||
if (*(str + 1) == 'd') {
|
||||
/* it's an int */
|
||||
n = (gint) strtol (data, &endptr, 10);
|
||||
if (endptr && *endptr == '\0') {
|
||||
templ_found = TRUE;
|
||||
req_name = name;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* it's a string */
|
||||
templ_found = TRUE;
|
||||
req_name = name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Because of sanity checks in gst_pad_template_new(), we know that %s
|
||||
and %d, occurring at the end of the name_template, are the only
|
||||
possibilities. */
|
||||
GST_CAT_DEBUG (GST_CAT_PADS, "comparing %s to %s", name,
|
||||
templ->name_template);
|
||||
if ((str = strchr (templ->name_template, '%'))
|
||||
&& strncmp (templ->name_template, name,
|
||||
str - templ->name_template) == 0
|
||||
&& strlen (name) > str - templ->name_template) {
|
||||
data = name + (str - templ->name_template);
|
||||
if (*(str + 1) == 'd') {
|
||||
/* it's an int */
|
||||
n = (gint) strtol (data, &endptr, 10);
|
||||
if (endptr && *endptr == '\0') {
|
||||
templ_found = TRUE;
|
||||
req_name = name;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* it's a string */
|
||||
templ_found = TRUE;
|
||||
req_name = name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
|
@ -1365,7 +1367,7 @@ gst_element_class_add_pad_template (GstElementClass * klass,
|
|||
|
||||
/* avoid registering pad templates with the same name */
|
||||
g_return_if_fail (gst_element_class_get_pad_template (klass,
|
||||
templ->name_template) == NULL);
|
||||
templ->name_template) == NULL);
|
||||
|
||||
klass->padtemplates = g_list_append (klass->padtemplates,
|
||||
gst_object_ref (GST_OBJECT (templ)));
|
||||
|
@ -1521,21 +1523,21 @@ gst_element_get_compatible_pad_template (GstElement * element,
|
|||
*/
|
||||
if (padtempl->direction != compattempl->direction) {
|
||||
GST_CAT_DEBUG (GST_CAT_CAPS,
|
||||
"compatible direction: found %s pad template \"%s\"",
|
||||
padtempl->direction == GST_PAD_SRC ? "src" : "sink",
|
||||
padtempl->name_template);
|
||||
"compatible direction: found %s pad template \"%s\"",
|
||||
padtempl->direction == GST_PAD_SRC ? "src" : "sink",
|
||||
padtempl->name_template);
|
||||
|
||||
intersection = gst_caps_intersect (GST_PAD_TEMPLATE_CAPS (compattempl),
|
||||
GST_PAD_TEMPLATE_CAPS (padtempl));
|
||||
GST_PAD_TEMPLATE_CAPS (padtempl));
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_CAPS, "caps are %scompatible",
|
||||
(intersection ? "" : "not "));
|
||||
(intersection ? "" : "not "));
|
||||
|
||||
if (!gst_caps_is_empty (intersection))
|
||||
newtempl = padtempl;
|
||||
newtempl = padtempl;
|
||||
gst_caps_free (intersection);
|
||||
if (newtempl)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
padlist = g_list_next (padlist);
|
||||
|
@ -1572,9 +1574,9 @@ gst_element_get_pad_from_template (GstElement * element, GstPadTemplate * templ)
|
|||
case GST_PAD_SOMETIMES:
|
||||
ret = gst_element_get_static_pad (element, templ->name_template);
|
||||
if (!ret && presence == GST_PAD_ALWAYS)
|
||||
g_warning
|
||||
("Element %s has an ALWAYS template %s, but no pad of the same name",
|
||||
GST_OBJECT_NAME (element), templ->name_template);
|
||||
g_warning
|
||||
("Element %s has an ALWAYS template %s, but no pad of the same name",
|
||||
GST_OBJECT_NAME (element), templ->name_template);
|
||||
break;
|
||||
|
||||
case GST_PAD_REQUEST:
|
||||
|
@ -1658,7 +1660,7 @@ gst_element_get_compatible_pad_filtered (GstElement * element, GstPad * pad,
|
|||
GstPad *current = GST_PAD (pads->data);
|
||||
|
||||
if (GST_PAD_PEER (current) == NULL &&
|
||||
gst_pad_can_link_filtered (pad, current, filtercaps)) {
|
||||
gst_pad_can_link_filtered (pad, current, filtercaps)) {
|
||||
return current;
|
||||
}
|
||||
pads = g_list_next (pads);
|
||||
|
@ -1745,18 +1747,18 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
|
|||
srcpad = gst_element_get_pad (src, srcpadname);
|
||||
if (!srcpad) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no pad %s:%s",
|
||||
GST_ELEMENT_NAME (src), srcpadname);
|
||||
GST_ELEMENT_NAME (src), srcpadname);
|
||||
return FALSE;
|
||||
} else {
|
||||
if (!(GST_PAD_DIRECTION (srcpad) == GST_PAD_SRC)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is no src pad",
|
||||
GST_DEBUG_PAD_NAME (srcpad));
|
||||
return FALSE;
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is no src pad",
|
||||
GST_DEBUG_PAD_NAME (srcpad));
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_PAD_PEER (srcpad) != NULL) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is already linked",
|
||||
GST_DEBUG_PAD_NAME (srcpad));
|
||||
return FALSE;
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is already linked",
|
||||
GST_DEBUG_PAD_NAME (srcpad));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
srcpads = NULL;
|
||||
|
@ -1768,18 +1770,18 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
|
|||
destpad = gst_element_get_pad (dest, destpadname);
|
||||
if (!destpad) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no pad %s:%s",
|
||||
GST_ELEMENT_NAME (dest), destpadname);
|
||||
GST_ELEMENT_NAME (dest), destpadname);
|
||||
return FALSE;
|
||||
} else {
|
||||
if (!(GST_PAD_DIRECTION (destpad) == GST_PAD_SINK)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is no sink pad",
|
||||
GST_DEBUG_PAD_NAME (destpad));
|
||||
return FALSE;
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is no sink pad",
|
||||
GST_DEBUG_PAD_NAME (destpad));
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_PAD_PEER (destpad) != NULL) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is already linked",
|
||||
GST_DEBUG_PAD_NAME (destpad));
|
||||
return FALSE;
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is already linked",
|
||||
GST_DEBUG_PAD_NAME (destpad));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
destpads = NULL;
|
||||
|
@ -1796,60 +1798,60 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
|
|||
/* loop through the allowed pads in the source, trying to find a
|
||||
* compatible destination pad */
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
|
||||
"looping through allowed src and dest pads");
|
||||
"looping through allowed src and dest pads");
|
||||
do {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "trying src pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (srcpad));
|
||||
GST_DEBUG_PAD_NAME (srcpad));
|
||||
if ((GST_PAD_DIRECTION (srcpad) == GST_PAD_SRC) &&
|
||||
(GST_PAD_PEER (srcpad) == NULL)) {
|
||||
GstPad *temp = gst_element_get_compatible_pad_filtered (dest, srcpad,
|
||||
filtercaps);
|
||||
(GST_PAD_PEER (srcpad) == NULL)) {
|
||||
GstPad *temp = gst_element_get_compatible_pad_filtered (dest, srcpad,
|
||||
filtercaps);
|
||||
|
||||
if (temp && gst_pad_link_filtered (srcpad, temp, filtercaps)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (temp));
|
||||
return TRUE;
|
||||
}
|
||||
if (temp && gst_pad_link_filtered (srcpad, temp, filtercaps)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (temp));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
/* find a better way for this mess */
|
||||
if (srcpads) {
|
||||
srcpads = g_list_next (srcpads);
|
||||
if (srcpads)
|
||||
srcpad = (GstPad *) GST_PAD_REALIZE (srcpads->data);
|
||||
srcpads = g_list_next (srcpads);
|
||||
if (srcpads)
|
||||
srcpad = (GstPad *) GST_PAD_REALIZE (srcpads->data);
|
||||
}
|
||||
} while (srcpads);
|
||||
}
|
||||
if (srcpadname) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s:%s to %s",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_ELEMENT_NAME (dest));
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_ELEMENT_NAME (dest));
|
||||
return FALSE;
|
||||
}
|
||||
if (destpad) {
|
||||
/* loop through the existing pads in the destination */
|
||||
do {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "trying dest pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (destpad));
|
||||
GST_DEBUG_PAD_NAME (destpad));
|
||||
if ((GST_PAD_DIRECTION (destpad) == GST_PAD_SINK) &&
|
||||
(GST_PAD_PEER (destpad) == NULL)) {
|
||||
GstPad *temp = gst_element_get_compatible_pad_filtered (src, destpad,
|
||||
filtercaps);
|
||||
(GST_PAD_PEER (destpad) == NULL)) {
|
||||
GstPad *temp = gst_element_get_compatible_pad_filtered (src, destpad,
|
||||
filtercaps);
|
||||
|
||||
if (temp && gst_pad_link_filtered (temp, destpad, filtercaps)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (temp), GST_DEBUG_PAD_NAME (destpad));
|
||||
return TRUE;
|
||||
}
|
||||
if (temp && gst_pad_link_filtered (temp, destpad, filtercaps)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (temp), GST_DEBUG_PAD_NAME (destpad));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (destpads) {
|
||||
destpads = g_list_next (destpads);
|
||||
if (destpads)
|
||||
destpad = (GstPad *) GST_PAD_REALIZE (destpads->data);
|
||||
destpads = g_list_next (destpads);
|
||||
if (destpads)
|
||||
destpad = (GstPad *) GST_PAD_REALIZE (destpads->data);
|
||||
}
|
||||
} while (destpads);
|
||||
}
|
||||
if (destpadname) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s to %s:%s",
|
||||
GST_ELEMENT_NAME (src), GST_DEBUG_PAD_NAME (destpad));
|
||||
GST_ELEMENT_NAME (src), GST_DEBUG_PAD_NAME (destpad));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1862,28 +1864,28 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
|
|||
while (srctempls) {
|
||||
srctempl = (GstPadTemplate *) srctempls->data;
|
||||
if (srctempl->presence == GST_PAD_REQUEST) {
|
||||
for (l = desttempls; l; l = l->next) {
|
||||
desttempl = (GstPadTemplate *) l->data;
|
||||
if (desttempl->presence == GST_PAD_REQUEST &&
|
||||
desttempl->direction != srctempl->direction) {
|
||||
if (gst_caps_is_always_compatible (gst_pad_template_get_caps
|
||||
(srctempl), gst_pad_template_get_caps (desttempl))) {
|
||||
srcpad =
|
||||
gst_element_get_request_pad (src, srctempl->name_template);
|
||||
destpad =
|
||||
gst_element_get_request_pad (dest, desttempl->name_template);
|
||||
if (gst_pad_link_filtered (srcpad, destpad, filtercaps)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
|
||||
"linked pad %s:%s to pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (destpad));
|
||||
return TRUE;
|
||||
}
|
||||
/* it failed, so we release the request pads */
|
||||
gst_element_release_request_pad (src, srcpad);
|
||||
gst_element_release_request_pad (dest, destpad);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (l = desttempls; l; l = l->next) {
|
||||
desttempl = (GstPadTemplate *) l->data;
|
||||
if (desttempl->presence == GST_PAD_REQUEST &&
|
||||
desttempl->direction != srctempl->direction) {
|
||||
if (gst_caps_is_always_compatible (gst_pad_template_get_caps
|
||||
(srctempl), gst_pad_template_get_caps (desttempl))) {
|
||||
srcpad =
|
||||
gst_element_get_request_pad (src, srctempl->name_template);
|
||||
destpad =
|
||||
gst_element_get_request_pad (dest, desttempl->name_template);
|
||||
if (gst_pad_link_filtered (srcpad, destpad, filtercaps)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
|
||||
"linked pad %s:%s to pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (destpad));
|
||||
return TRUE;
|
||||
}
|
||||
/* it failed, so we release the request pads */
|
||||
gst_element_release_request_pad (src, srcpad);
|
||||
gst_element_release_request_pad (dest, destpad);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
srctempls = srctempls->next;
|
||||
}
|
||||
|
@ -2017,7 +2019,7 @@ gst_element_unlink_pads (GstElement * src, const gchar * srcpadname,
|
|||
destpad = gst_element_get_pad (dest, destpadname);
|
||||
if (srcpad == NULL) {
|
||||
GST_WARNING_OBJECT (dest, "destination element has no pad \"%s\"",
|
||||
destpadname);
|
||||
destpadname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2085,7 +2087,7 @@ gst_element_unlink (GstElement * src, GstElement * dest)
|
|||
/* see if the pad is connected and is really a pad
|
||||
* of dest */
|
||||
if (peerpad && (GST_OBJECT_PARENT (peerpad) == (GstObject *) dest)) {
|
||||
gst_pad_unlink (pad, peerpad);
|
||||
gst_pad_unlink (pad, peerpad);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2100,17 +2102,17 @@ gst_element_error_func (GstElement * element, GstElement * source,
|
|||
/* tell the parent */
|
||||
if (GST_OBJECT_PARENT (element)) {
|
||||
GST_CAT_DEBUG (GST_CAT_ERROR_SYSTEM,
|
||||
"forwarding error \"%s\" from %s to %s", error->message,
|
||||
GST_ELEMENT_NAME (element),
|
||||
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
||||
"forwarding error \"%s\" from %s to %s", error->message,
|
||||
GST_ELEMENT_NAME (element),
|
||||
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
||||
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
g_signal_emit (G_OBJECT (GST_OBJECT_PARENT (element)),
|
||||
gst_element_signals[ERROR], 0, source, error, debug);
|
||||
gst_element_signals[ERROR], 0, source, error, debug);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
GST_CAT_DEBUG (GST_CAT_ERROR_SYSTEM, "forwarded error \"%s\" from %s to %s",
|
||||
error->message, GST_ELEMENT_NAME (element),
|
||||
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
||||
error->message, GST_ELEMENT_NAME (element),
|
||||
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2124,18 +2126,18 @@ gst_element_get_random_pad (GstElement * element, GstPadDirection dir)
|
|||
GstPad *pad = GST_PAD (pads->data);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "checking pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
|
||||
if (GST_PAD_DIRECTION (pad) == dir) {
|
||||
if (GST_PAD_IS_LINKED (pad)) {
|
||||
return pad;
|
||||
return pad;
|
||||
} else {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is not linked",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is not linked",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
}
|
||||
} else {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is in wrong direction",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
}
|
||||
|
||||
pads = g_list_next (pads);
|
||||
|
@ -2203,7 +2205,7 @@ gst_element_send_event (GstElement * element, GstEvent * event)
|
|||
|
||||
if (pad) {
|
||||
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "sending event to random pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
return gst_pad_send_event (GST_PAD_PEER (pad), event);
|
||||
}
|
||||
}
|
||||
|
@ -2371,13 +2373,13 @@ gst_element_convert (GstElement * element,
|
|||
|
||||
if (oclass->convert)
|
||||
return oclass->convert (element,
|
||||
src_format, src_value, dest_format, dest_value);
|
||||
src_format, src_value, dest_format, dest_value);
|
||||
else {
|
||||
GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
|
||||
|
||||
if (pad)
|
||||
return gst_pad_convert (GST_PAD_PEER (pad),
|
||||
src_format, src_value, dest_format, dest_value);
|
||||
src_format, src_value, dest_format, dest_value);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -2456,7 +2458,7 @@ void gst_element_error_full
|
|||
/* if the element was already in error, stop now */
|
||||
if (GST_FLAG_IS_SET (element, GST_ELEMENT_IN_ERROR)) {
|
||||
GST_CAT_INFO (GST_CAT_ERROR_SYSTEM, "recursive ERROR detected in %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
g_free (sent_message);
|
||||
if (debug)
|
||||
g_free (debug);
|
||||
|
@ -2470,7 +2472,7 @@ void gst_element_error_full
|
|||
name = gst_object_get_path_string (GST_OBJECT (element));
|
||||
if (debug)
|
||||
sent_debug = g_strdup_printf ("%s(%d): %s: %s:\n%s",
|
||||
file, line, function, name, debug ? debug : "");
|
||||
file, line, function, name, debug ? debug : "");
|
||||
else
|
||||
sent_debug = NULL;
|
||||
g_free (debug);
|
||||
|
@ -2491,7 +2493,7 @@ void gst_element_error_full
|
|||
ret = gst_element_set_state (element, GST_STATE_PAUSED);
|
||||
if (ret != GST_STATE_SUCCESS) {
|
||||
g_warning ("could not PAUSE element \"%s\" after error, help!",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2546,11 +2548,11 @@ gst_element_set_locked_state (GstElement * element, gboolean locked_state)
|
|||
|
||||
if (locked_state) {
|
||||
GST_CAT_DEBUG (GST_CAT_STATES, "locking state of element %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_FLAG_SET (element, GST_ELEMENT_LOCKED_STATE);
|
||||
} else {
|
||||
GST_CAT_DEBUG (GST_CAT_STATES, "unlocking state of element %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_FLAG_UNSET (element, GST_ELEMENT_LOCKED_STATE);
|
||||
}
|
||||
}
|
||||
|
@ -2640,8 +2642,8 @@ gst_element_set_state (GstElement * element, GstElementState state)
|
|||
|
||||
if (state == curpending) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
||||
"element is already in requested state %s",
|
||||
gst_element_state_get_name (state));
|
||||
"element is already in requested state %s",
|
||||
gst_element_state_get_name (state));
|
||||
return (GST_STATE_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -2664,9 +2666,9 @@ gst_element_set_state (GstElement * element, GstElementState state)
|
|||
|
||||
if (curpending != state) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
||||
"intermediate: setting state from %s to %s",
|
||||
gst_element_state_get_name (GST_STATE (element)),
|
||||
gst_element_state_get_name (curpending));
|
||||
"intermediate: setting state from %s to %s",
|
||||
gst_element_state_get_name (GST_STATE (element)),
|
||||
gst_element_state_get_name (curpending));
|
||||
}
|
||||
|
||||
/* call the state change function so it can set the state */
|
||||
|
@ -2676,31 +2678,31 @@ gst_element_set_state (GstElement * element, GstElementState state)
|
|||
|
||||
switch (return_val) {
|
||||
case GST_STATE_FAILURE:
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"have failed change_state return");
|
||||
goto exit;
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"have failed change_state return");
|
||||
goto exit;
|
||||
case GST_STATE_ASYNC:
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"element will change state async");
|
||||
goto exit;
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"element will change state async");
|
||||
goto exit;
|
||||
case GST_STATE_SUCCESS:
|
||||
/* Last thing we do is verify that a successful state change really
|
||||
* did change the state... */
|
||||
/* if it did not, this is an error - fix the element that does this */
|
||||
if (GST_STATE (element) != curpending) {
|
||||
g_warning ("element %s claimed state-change success,"
|
||||
"but state didn't change to %s. State is %s (%s pending), fix the element",
|
||||
GST_ELEMENT_NAME (element),
|
||||
gst_element_state_get_name (curpending),
|
||||
gst_element_state_get_name (GST_STATE (element)),
|
||||
gst_element_state_get_name (GST_STATE_PENDING (element)));
|
||||
return_val = GST_STATE_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
break;
|
||||
/* Last thing we do is verify that a successful state change really
|
||||
* did change the state... */
|
||||
/* if it did not, this is an error - fix the element that does this */
|
||||
if (GST_STATE (element) != curpending) {
|
||||
g_warning ("element %s claimed state-change success,"
|
||||
"but state didn't change to %s. State is %s (%s pending), fix the element",
|
||||
GST_ELEMENT_NAME (element),
|
||||
gst_element_state_get_name (curpending),
|
||||
gst_element_state_get_name (GST_STATE (element)),
|
||||
gst_element_state_get_name (GST_STATE_PENDING (element)));
|
||||
return_val = GST_STATE_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* somebody added a GST_STATE_ and forgot to do stuff here ! */
|
||||
g_assert_not_reached ();
|
||||
/* somebody added a GST_STATE_ and forgot to do stuff here ! */
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
exit:
|
||||
|
@ -2738,35 +2740,35 @@ gst_element_negotiate_pads (GstElement * element)
|
|||
/* check the parent of the peer pad, if there is no parent do nothing */
|
||||
parent = GST_PAD_PARENT (sinkpad);
|
||||
if (!parent)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
/* skips pads that were already negotiating */
|
||||
if (GST_FLAG_IS_SET (sinkpad, GST_PAD_NEGOTIATING) ||
|
||||
GST_FLAG_IS_SET (srcpad, GST_PAD_NEGOTIATING))
|
||||
continue;
|
||||
GST_FLAG_IS_SET (srcpad, GST_PAD_NEGOTIATING))
|
||||
continue;
|
||||
|
||||
otherstate = GST_STATE (parent);
|
||||
|
||||
/* swap pads if needed */
|
||||
if (!GST_PAD_IS_SRC (srcpad)) {
|
||||
GstRealPad *temp;
|
||||
GstRealPad *temp;
|
||||
|
||||
temp = srcpad;
|
||||
srcpad = sinkpad;
|
||||
sinkpad = temp;
|
||||
temp = srcpad;
|
||||
srcpad = sinkpad;
|
||||
sinkpad = temp;
|
||||
}
|
||||
|
||||
/* only try to negotiate if the peer element is in PAUSED or higher too */
|
||||
if (otherstate >= GST_STATE_READY) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, element,
|
||||
"perform negotiate for %s:%s and %s:%s",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
if (gst_pad_renegotiate (pad) == GST_PAD_LINK_REFUSED)
|
||||
return FALSE;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, element,
|
||||
"perform negotiate for %s:%s and %s:%s",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
if (gst_pad_renegotiate (pad) == GST_PAD_LINK_REFUSED)
|
||||
return FALSE;
|
||||
} else {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, element,
|
||||
"not negotiating %s:%s and %s:%s, not in READY yet",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, element,
|
||||
"not negotiating %s:%s and %s:%s, not in READY yet",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2826,8 +2828,8 @@ gst_element_change_state (GstElement * element)
|
|||
if (old_pending == GST_STATE_VOID_PENDING ||
|
||||
old_state == GST_STATE_PENDING (element)) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
||||
"element is already in the %s state",
|
||||
gst_element_state_get_name (old_state));
|
||||
"element is already in the %s state",
|
||||
gst_element_state_get_name (old_state));
|
||||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2843,30 +2845,30 @@ gst_element_change_state (GstElement * element)
|
|||
switch (old_transition) {
|
||||
case GST_STATE_PLAYING_TO_PAUSED:
|
||||
if (element->clock) {
|
||||
GstClockTime time = gst_clock_get_event_time (element->clock);
|
||||
GstClockTime time = gst_clock_get_event_time (element->clock);
|
||||
|
||||
g_assert (time >= element->base_time);
|
||||
element->base_time = time - element->base_time;
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, element, "setting base time to %"
|
||||
G_GINT64_FORMAT, element->base_time);
|
||||
g_assert (time >= element->base_time);
|
||||
element->base_time = time - element->base_time;
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, element, "setting base time to %"
|
||||
G_GINT64_FORMAT, element->base_time);
|
||||
}
|
||||
gst_element_pads_activate (element, FALSE);
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
gst_element_pads_activate (element, TRUE);
|
||||
if (element->clock) {
|
||||
GstClockTime time = gst_clock_get_event_time (element->clock);
|
||||
GstClockTime time = gst_clock_get_event_time (element->clock);
|
||||
|
||||
element->base_time = time - element->base_time;
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, element, "setting base time to %"
|
||||
G_GINT64_FORMAT, element->base_time);
|
||||
element->base_time = time - element->base_time;
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, element, "setting base time to %"
|
||||
G_GINT64_FORMAT, element->base_time);
|
||||
}
|
||||
break;
|
||||
/* if we are going to paused, we try to negotiate the pads */
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
g_assert (element->base_time == 0);
|
||||
if (!gst_element_negotiate_pads (element))
|
||||
goto failure;
|
||||
goto failure;
|
||||
break;
|
||||
/* going to the READY state clears all pad caps */
|
||||
/* FIXME: Why doesn't this happen on READY => NULL? -- Company */
|
||||
|
@ -2888,9 +2890,9 @@ gst_element_change_state (GstElement * element)
|
|||
/* tell the scheduler if we have one */
|
||||
if (element->sched) {
|
||||
if (gst_scheduler_state_transition (element->sched, element,
|
||||
old_transition) != GST_STATE_SUCCESS) {
|
||||
old_transition) != GST_STATE_SUCCESS) {
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
||||
"scheduler could not change state");
|
||||
"scheduler could not change state");
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
@ -2898,7 +2900,7 @@ gst_element_change_state (GstElement * element)
|
|||
/* tell our parent about the state change */
|
||||
if (parent && GST_IS_BIN (parent)) {
|
||||
gst_bin_child_state_change (GST_BIN (parent), old_state,
|
||||
GST_STATE (element), element);
|
||||
GST_STATE (element), element);
|
||||
}
|
||||
/* at this point the state of the element could have changed again */
|
||||
|
||||
|
@ -2956,9 +2958,9 @@ gst_element_dispose (GObject * object)
|
|||
pad = GST_PAD (pads->data);
|
||||
|
||||
if (GST_PAD_PEER (pad)) {
|
||||
GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "unlinking pad '%s'",
|
||||
GST_OBJECT_NAME (GST_OBJECT (GST_PAD (GST_PAD_PEER (pad)))));
|
||||
gst_pad_unlink (pad, GST_PAD (GST_PAD_PEER (pad)));
|
||||
GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "unlinking pad '%s'",
|
||||
GST_OBJECT_NAME (GST_OBJECT (GST_PAD (GST_PAD_PEER (pad)))));
|
||||
gst_pad_unlink (pad, GST_PAD (GST_PAD_PEER (pad)));
|
||||
}
|
||||
gst_element_remove_pad (element, pad);
|
||||
|
||||
|
@ -3046,14 +3048,14 @@ gst_element_save_thyself (GstObject * object, xmlNodePtr parent)
|
|||
xmlNewChild (param, NULL, "name", spec->name);
|
||||
|
||||
if (G_IS_PARAM_SPEC_STRING (spec))
|
||||
contents = g_value_dup_string (&value);
|
||||
contents = g_value_dup_string (&value);
|
||||
else if (G_IS_PARAM_SPEC_ENUM (spec))
|
||||
contents = g_strdup_printf ("%d", g_value_get_enum (&value));
|
||||
contents = g_strdup_printf ("%d", g_value_get_enum (&value));
|
||||
else if (G_IS_PARAM_SPEC_INT64 (spec))
|
||||
contents = g_strdup_printf ("%" G_GINT64_FORMAT,
|
||||
g_value_get_int64 (&value));
|
||||
contents = g_strdup_printf ("%" G_GINT64_FORMAT,
|
||||
g_value_get_int64 (&value));
|
||||
else
|
||||
contents = g_strdup_value_contents (&value);
|
||||
contents = g_strdup_value_contents (&value);
|
||||
|
||||
xmlNewChild (param, NULL, "value", contents);
|
||||
g_free (contents);
|
||||
|
@ -3097,12 +3099,12 @@ gst_element_restore_thyself (GstObject * object, xmlNodePtr self)
|
|||
xmlNodePtr child = children->xmlChildrenNode;
|
||||
|
||||
while (child) {
|
||||
if (!strcmp (child->name, "name")) {
|
||||
name = xmlNodeGetContent (child);
|
||||
} else if (!strcmp (child->name, "value")) {
|
||||
value = xmlNodeGetContent (child);
|
||||
}
|
||||
child = child->next;
|
||||
if (!strcmp (child->name, "name")) {
|
||||
name = xmlNodeGetContent (child);
|
||||
} else if (!strcmp (child->name, "value")) {
|
||||
value = xmlNodeGetContent (child);
|
||||
}
|
||||
child = child->next;
|
||||
}
|
||||
/* FIXME: can this just be g_object_set ? */
|
||||
gst_util_set_object_arg (G_OBJECT (element), name, value);
|
||||
|
@ -3250,9 +3252,9 @@ gst_element_found_tag_func (GstElement * element, GstElement * source,
|
|||
/* tell the parent */
|
||||
if (GST_OBJECT_PARENT (element)) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_EVENT, element, "forwarding tag event to %s",
|
||||
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
||||
GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
||||
gst_element_emit_found_tag (GST_ELEMENT (GST_OBJECT_PARENT (element)),
|
||||
source, tag_list);
|
||||
source, tag_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3439,45 +3441,45 @@ gst_element_populate_std_props (GObjectClass * klass, const gchar * prop_name,
|
|||
|
||||
if (prop_id == fd_id) {
|
||||
pspec = g_param_spec_int ("fd", "File-descriptor",
|
||||
"File-descriptor for the file being read", 0, G_MAXINT, 0, flags);
|
||||
"File-descriptor for the file being read", 0, G_MAXINT, 0, flags);
|
||||
} else if (prop_id == blocksize_id) {
|
||||
pspec = g_param_spec_ulong ("blocksize", "Block Size",
|
||||
"Block size to read per buffer", 0, G_MAXULONG, 4096, flags);
|
||||
"Block size to read per buffer", 0, G_MAXULONG, 4096, flags);
|
||||
|
||||
} else if (prop_id == bytesperread_id) {
|
||||
pspec = g_param_spec_int ("bytesperread", "Bytes per read",
|
||||
"Number of bytes to read per buffer", G_MININT, G_MAXINT, 0, flags);
|
||||
"Number of bytes to read per buffer", G_MININT, G_MAXINT, 0, flags);
|
||||
|
||||
} else if (prop_id == dump_id) {
|
||||
pspec = g_param_spec_boolean ("dump", "Dump",
|
||||
"Dump bytes to stdout", FALSE, flags);
|
||||
"Dump bytes to stdout", FALSE, flags);
|
||||
|
||||
} else if (prop_id == filesize_id) {
|
||||
pspec = g_param_spec_int64 ("filesize", "File Size",
|
||||
"Size of the file being read", 0, G_MAXINT64, 0, flags);
|
||||
"Size of the file being read", 0, G_MAXINT64, 0, flags);
|
||||
|
||||
} else if (prop_id == mmapsize_id) {
|
||||
pspec = g_param_spec_ulong ("mmapsize", "mmap() Block Size",
|
||||
"Size in bytes of mmap()d regions", 0, G_MAXULONG, 4 * 1048576, flags);
|
||||
"Size in bytes of mmap()d regions", 0, G_MAXULONG, 4 * 1048576, flags);
|
||||
|
||||
} else if (prop_id == location_id) {
|
||||
pspec = g_param_spec_string ("location", "File Location",
|
||||
"Location of the file to read", NULL, flags);
|
||||
"Location of the file to read", NULL, flags);
|
||||
|
||||
} else if (prop_id == offset_id) {
|
||||
pspec = g_param_spec_int64 ("offset", "File Offset",
|
||||
"Byte offset of current read pointer", 0, G_MAXINT64, 0, flags);
|
||||
"Byte offset of current read pointer", 0, G_MAXINT64, 0, flags);
|
||||
|
||||
} else if (prop_id == silent_id) {
|
||||
pspec = g_param_spec_boolean ("silent", "Silent", "Don't produce events",
|
||||
FALSE, flags);
|
||||
FALSE, flags);
|
||||
|
||||
} else if (prop_id == touch_id) {
|
||||
pspec = g_param_spec_boolean ("touch", "Touch read data",
|
||||
"Touch data to force disk read before " "push ()", TRUE, flags);
|
||||
"Touch data to force disk read before " "push ()", TRUE, flags);
|
||||
} else {
|
||||
g_warning ("Unknown - 'standard' property '%s' id %d from klass %s",
|
||||
prop_name, arg_id, g_type_name (G_OBJECT_CLASS_TYPE (klass)));
|
||||
prop_name, arg_id, g_type_name (G_OBJECT_CLASS_TYPE (klass)));
|
||||
pspec = NULL;
|
||||
}
|
||||
|
||||
|
@ -3517,7 +3519,7 @@ gst_element_class_install_std_props (GstElementClass * klass,
|
|||
int flags = va_arg (args, int);
|
||||
|
||||
gst_element_populate_std_props ((GObjectClass *) klass, name, arg_id,
|
||||
flags);
|
||||
flags);
|
||||
|
||||
name = va_arg (args, char *);
|
||||
}
|
||||
|
|
|
@ -58,11 +58,12 @@ gst_element_factory_get_type (void)
|
|||
(GInstanceInitFunc) gst_element_factory_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
elementfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
|
||||
"GstElementFactory", &elementfactory_info, 0);
|
||||
"GstElementFactory", &elementfactory_info, 0);
|
||||
GST_DEBUG_CATEGORY_INIT (element_factory_debug, "GST_ELEMENT_FACTORY",
|
||||
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
|
||||
"element factories keep information about installed elements");
|
||||
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
|
||||
"element factories keep information about installed elements");
|
||||
}
|
||||
return elementfactory_type;
|
||||
}
|
||||
|
@ -202,16 +203,16 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
if (!factory) {
|
||||
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
|
||||
factory =
|
||||
GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
|
||||
GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
|
||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE (factory), name);
|
||||
GST_LOG_OBJECT (factory, "Created new elementfactory for type %s",
|
||||
g_type_name (type));
|
||||
g_type_name (type));
|
||||
} else {
|
||||
g_return_val_if_fail (factory->type == 0, FALSE);
|
||||
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
|
||||
gst_element_factory_cleanup (factory);
|
||||
GST_LOG_OBJECT (factory, "Reuse existing elementfactory for type %s",
|
||||
g_type_name (type));
|
||||
g_type_name (type));
|
||||
}
|
||||
|
||||
factory->type = type;
|
||||
|
@ -223,7 +224,7 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
/* special stuff for URI handling */
|
||||
if (g_type_is_a (type, GST_TYPE_URI_HANDLER)) {
|
||||
GstURIHandlerInterface *iface = (GstURIHandlerInterface *)
|
||||
g_type_interface_peek (klass, GST_TYPE_URI_HANDLER);
|
||||
g_type_interface_peek (klass, GST_TYPE_URI_HANDLER);
|
||||
|
||||
if (!iface || !iface->get_type || !iface->get_protocols)
|
||||
goto error;
|
||||
|
@ -277,13 +278,13 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
|
|||
|
||||
if (name)
|
||||
GST_INFO ("creating \"%s\" named \"%s\"", GST_PLUGIN_FEATURE_NAME (factory),
|
||||
GST_STR_NULL (name));
|
||||
GST_STR_NULL (name));
|
||||
else
|
||||
GST_INFO ("creating \"%s\"", GST_PLUGIN_FEATURE_NAME (factory));
|
||||
|
||||
if (factory->type == 0) {
|
||||
g_critical ("Factory for `%s' has no type",
|
||||
GST_PLUGIN_FEATURE_NAME (factory));
|
||||
GST_PLUGIN_FEATURE_NAME (factory));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -464,7 +465,7 @@ __gst_element_factory_add_interface (GstElementFactory * elementfactory,
|
|||
{
|
||||
g_return_if_fail (GST_IS_ELEMENT_FACTORY (elementfactory));
|
||||
g_return_if_fail (interfacename != NULL);
|
||||
g_return_if_fail (interfacename[0] != '\0'); /* no empty string */
|
||||
g_return_if_fail (interfacename[0] != '\0'); /* no empty string */
|
||||
|
||||
elementfactory->interfaces =
|
||||
g_list_prepend (elementfactory->interfaces, g_strdup (interfacename));
|
||||
|
@ -545,8 +546,8 @@ gst_element_factory_can_src_caps (GstElementFactory * factory,
|
|||
|
||||
if (template->direction == GST_PAD_SRC) {
|
||||
if (gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (template),
|
||||
caps))
|
||||
return TRUE;
|
||||
caps))
|
||||
return TRUE;
|
||||
}
|
||||
templates = g_list_next (templates);
|
||||
}
|
||||
|
@ -579,8 +580,8 @@ gst_element_factory_can_sink_caps (GstElementFactory * factory,
|
|||
|
||||
if (template->direction == GST_PAD_SINK) {
|
||||
if (gst_caps_is_always_compatible (caps,
|
||||
GST_PAD_TEMPLATE_CAPS (template)))
|
||||
return TRUE;
|
||||
GST_PAD_TEMPLATE_CAPS (template)))
|
||||
return TRUE;
|
||||
}
|
||||
templates = g_list_next (templates);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ gst_g_error_get_type (void)
|
|||
|
||||
if (!type)
|
||||
type = g_boxed_type_register_static ("GstGError",
|
||||
(GBoxedCopyFunc) g_error_copy, (GBoxedFreeFunc) g_error_free);
|
||||
(GBoxedCopyFunc) g_error_copy, (GBoxedFreeFunc) g_error_free);
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ _gst_core_errors_init ()
|
|||
N_("GStreamer encountered a general core library error."));
|
||||
TABLE (t, CORE, TOO_LAZY,
|
||||
N_("GStreamer developers were too lazy to assign an error code "
|
||||
"to this error. Please file a bug."));
|
||||
"to this error. Please file a bug."));
|
||||
TABLE (t, CORE, NOT_IMPLEMENTED,
|
||||
N_("Internal GStreamer error: code not implemented. File a bug."));
|
||||
TABLE (t, CORE, STATE_CHANGE,
|
||||
|
@ -93,7 +93,7 @@ _gst_library_errors_init ()
|
|||
N_("GStreamer encountered a general supporting library error."));
|
||||
TABLE (t, LIBRARY, TOO_LAZY,
|
||||
N_("GStreamer developers were too lazy to assign an error code "
|
||||
"to this error. Please file a bug."));
|
||||
"to this error. Please file a bug."));
|
||||
TABLE (t, LIBRARY, INIT, N_("Could not initialize supporting library."));
|
||||
TABLE (t, LIBRARY, SHUTDOWN, N_("Could not close supporting library."));
|
||||
TABLE (t, LIBRARY, SETTINGS, N_("Could not close supporting library."));
|
||||
|
@ -113,7 +113,7 @@ _gst_resource_errors_init ()
|
|||
N_("GStreamer encountered a general supporting library error."));
|
||||
TABLE (t, RESOURCE, TOO_LAZY,
|
||||
N_("GStreamer developers were too lazy to assign an error code "
|
||||
"to this error. Please file a bug."));
|
||||
"to this error. Please file a bug."));
|
||||
TABLE (t, RESOURCE, NOT_FOUND, N_("Resource not found."));
|
||||
TABLE (t, RESOURCE, BUSY, N_("Resource busy or not available."));
|
||||
TABLE (t, RESOURCE, OPEN_READ, N_("Could not open resource for reading."));
|
||||
|
@ -143,10 +143,10 @@ _gst_stream_errors_init ()
|
|||
N_("GStreamer encountered a general supporting library error."));
|
||||
TABLE (t, STREAM, TOO_LAZY,
|
||||
N_("GStreamer developers were too lazy to assign an error code "
|
||||
"to this error. Please file a bug."));
|
||||
"to this error. Please file a bug."));
|
||||
TABLE (t, STREAM, NOT_IMPLEMENTED,
|
||||
N_("Element doesn't implement handling of this stream. "
|
||||
"Please file a bug."));
|
||||
"Please file a bug."));
|
||||
TABLE (t, STREAM, TYPE_NOT_FOUND, N_("Could not determine type of stream."));
|
||||
TABLE (t, STREAM, WRONG_TYPE,
|
||||
N_("The stream is of a different type than handled by this element."));
|
||||
|
@ -205,13 +205,13 @@ QUARK_FUNC (core)
|
|||
else {
|
||||
g_warning ("No error messages for domain %s", g_quark_to_string (domain));
|
||||
return g_strdup_printf (_("No error message for domain %s."),
|
||||
g_quark_to_string (domain));
|
||||
g_quark_to_string (domain));
|
||||
}
|
||||
if (message)
|
||||
return g_strdup (_(message));
|
||||
else
|
||||
return
|
||||
g_strdup_printf (_
|
||||
("No standard error message for domain %s and code %d."),
|
||||
g_quark_to_string (domain), code);
|
||||
g_strdup_printf (_
|
||||
("No standard error message for domain %s and code %d."),
|
||||
g_quark_to_string (domain), code);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <string.h> /* memcpy */
|
||||
#include <string.h> /* memcpy */
|
||||
|
||||
#include "gst_private.h"
|
||||
#include "gstdata_private.h"
|
||||
|
@ -74,12 +74,12 @@ _gst_event_copy (GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_TAG:
|
||||
copy->event_data.structure.structure =
|
||||
gst_tag_list_copy ((GstTagList *) event->event_data.structure.
|
||||
structure);
|
||||
gst_tag_list_copy ((GstTagList *) event->event_data.structure.
|
||||
structure);
|
||||
break;
|
||||
case GST_EVENT_NAVIGATION:
|
||||
copy->event_data.structure.structure =
|
||||
gst_structure_copy (event->event_data.structure.structure);
|
||||
gst_structure_copy (event->event_data.structure.structure);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -98,10 +98,10 @@ _gst_event_free (GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_TAG:
|
||||
if (GST_IS_TAG_LIST (event->event_data.structure.structure)) {
|
||||
gst_tag_list_free (event->event_data.structure.structure);
|
||||
gst_tag_list_free (event->event_data.structure.structure);
|
||||
} else {
|
||||
g_warning ("tag event %p didn't contain a valid tag list!", event);
|
||||
GST_ERROR ("tag event %p didn't contain a valid tag list!", event);
|
||||
g_warning ("tag event %p didn't contain a valid tag list!", event);
|
||||
GST_ERROR ("tag event %p didn't contain a valid tag list!", event);
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_NAVIGATION:
|
||||
|
@ -136,7 +136,7 @@ gst_event_masks_contains (const GstEventMask * masks, GstEventMask * mask)
|
|||
|
||||
while (masks->type) {
|
||||
if (masks->type == mask->type &&
|
||||
(masks->flags & mask->flags) == mask->flags)
|
||||
(masks->flags & mask->flags) == mask->flags)
|
||||
return TRUE;
|
||||
|
||||
masks++;
|
||||
|
@ -233,7 +233,7 @@ gst_event_new_discontinuous_valist (gboolean new_media, GstFormat format1,
|
|||
while (format1 != GST_FORMAT_UNDEFINED && count < 8) {
|
||||
|
||||
GST_EVENT_DISCONT_OFFSET (event, count).format =
|
||||
format1 & GST_SEEK_FORMAT_MASK;
|
||||
format1 & GST_SEEK_FORMAT_MASK;
|
||||
GST_EVENT_DISCONT_OFFSET (event, count).value = va_arg (var_args, gint64);
|
||||
|
||||
format1 = va_arg (var_args, GstFormat);
|
||||
|
|
|
@ -39,7 +39,7 @@ gst_filter_run (const GList * list, GstFilterFunc func, gboolean first,
|
|||
result = g_list_prepend (result, data);
|
||||
|
||||
if (first)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
static GList *_gst_formats = NULL;
|
||||
static GHashTable *_nick_to_format = NULL;
|
||||
static GHashTable *_format_to_nick = NULL;
|
||||
static gint _n_values = 1; /* we start from 1 because 0 reserved for UNDEFINED */
|
||||
static gint _n_values = 1; /* we start from 1 because 0 reserved for UNDEFINED */
|
||||
|
||||
static GstFormatDefinition standard_definitions[] = {
|
||||
{GST_FORMAT_DEFAULT, "default", "Default format for the media type"},
|
||||
|
@ -53,7 +53,7 @@ _gst_format_initialize (void)
|
|||
while (standards->nick) {
|
||||
g_hash_table_insert (_nick_to_format, standards->nick, standards);
|
||||
g_hash_table_insert (_format_to_nick, GINT_TO_POINTER (standards->value),
|
||||
standards);
|
||||
standards);
|
||||
|
||||
_gst_formats = g_list_append (_gst_formats, standards);
|
||||
standards++;
|
||||
|
|
|
@ -66,7 +66,8 @@ typedef struct
|
|||
GstIndexResolverMethod method;
|
||||
GstIndexResolver resolver;
|
||||
gpointer user_data;
|
||||
} ResolverEntry;
|
||||
}
|
||||
ResolverEntry;
|
||||
|
||||
static const ResolverEntry resolvers[] = {
|
||||
{GST_INDEX_RESOLVER_CUSTOM, NULL, NULL},
|
||||
|
@ -81,16 +82,17 @@ gst_index_resolver_get_type (void)
|
|||
static GType index_resolver_type = 0;
|
||||
static GEnumValue index_resolver[] = {
|
||||
{GST_INDEX_RESOLVER_CUSTOM, "GST_INDEX_RESOLVER_CUSTOM",
|
||||
"Use a custom resolver"},
|
||||
"Use a custom resolver"},
|
||||
{GST_INDEX_RESOLVER_GTYPE, "GST_INDEX_RESOLVER_GTYPE",
|
||||
"Resolve an object to its GType[.padname]"},
|
||||
"Resolve an object to its GType[.padname]"},
|
||||
{GST_INDEX_RESOLVER_PATH, "GST_INDEX_RESOLVER_PATH",
|
||||
"Resolve an object to its path in the pipeline"},
|
||||
"Resolve an object to its path in the pipeline"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!index_resolver_type) {
|
||||
index_resolver_type =
|
||||
g_enum_register_static ("GstIndexResolver", index_resolver);
|
||||
g_enum_register_static ("GstIndexResolver", index_resolver);
|
||||
}
|
||||
return index_resolver_type;
|
||||
}
|
||||
|
@ -102,8 +104,8 @@ gst_index_entry_get_type (void)
|
|||
|
||||
if (!index_entry_type) {
|
||||
index_entry_type = g_boxed_type_register_static ("GstIndexEntry",
|
||||
(GBoxedCopyFunc) gst_index_entry_copy,
|
||||
(GBoxedFreeFunc) gst_index_entry_free);
|
||||
(GBoxedCopyFunc) gst_index_entry_copy,
|
||||
(GBoxedFreeFunc) gst_index_entry_free);
|
||||
}
|
||||
return index_entry_type;
|
||||
}
|
||||
|
@ -127,8 +129,9 @@ gst_index_get_type (void)
|
|||
(GInstanceInitFunc) gst_index_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
index_type =
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstIndex", &index_info, 0);
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstIndex", &index_info, 0);
|
||||
}
|
||||
return index_type;
|
||||
}
|
||||
|
@ -154,8 +157,8 @@ gst_index_class_init (GstIndexClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RESOLVER,
|
||||
g_param_spec_enum ("resolver", "Resolver",
|
||||
"Select a predefined object to string mapper",
|
||||
GST_TYPE_INDEX_RESOLVER, GST_INDEX_RESOLVER_PATH, G_PARAM_READWRITE));
|
||||
"Select a predefined object to string mapper",
|
||||
GST_TYPE_INDEX_RESOLVER, GST_INDEX_RESOLVER_PATH, G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -513,10 +516,10 @@ gst_index_gtype_resolver (GstIndex * index, GstObject * writer,
|
|||
GstElement *element = gst_pad_get_parent (GST_PAD (writer));
|
||||
|
||||
*writer_string = g_strdup_printf ("%s.%s",
|
||||
g_type_name (G_OBJECT_TYPE (element)), gst_object_get_name (writer));
|
||||
g_type_name (G_OBJECT_TYPE (element)), gst_object_get_name (writer));
|
||||
} else {
|
||||
*writer_string =
|
||||
g_strdup_printf ("%s", g_type_name (G_OBJECT_TYPE (writer)));
|
||||
g_strdup_printf ("%s", g_type_name (G_OBJECT_TYPE (writer)));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -563,10 +566,10 @@ gst_index_get_writer_id (GstIndex * index, GstObject * writer, gint * id)
|
|||
gboolean res;
|
||||
|
||||
res =
|
||||
index->resolver (index, writer, &writer_string,
|
||||
index->resolver_user_data);
|
||||
index->resolver (index, writer, &writer_string,
|
||||
index->resolver_user_data);
|
||||
if (!res)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
} else {
|
||||
g_warning ("no resolver found");
|
||||
return FALSE;
|
||||
|
@ -800,7 +803,7 @@ gst_index_get_assoc_entry_full (GstIndex * index, gint id,
|
|||
|
||||
if (iclass->get_assoc_entry)
|
||||
return iclass->get_assoc_entry (index, id, method, flags, format, value,
|
||||
func, user_data);
|
||||
func, user_data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -860,8 +863,9 @@ gst_index_factory_get_type (void)
|
|||
(GInstanceInitFunc) gst_index_factory_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
indexfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
|
||||
"GstIndexFactory", &indexfactory_info, 0);
|
||||
"GstIndexFactory", &indexfactory_info, 0);
|
||||
}
|
||||
return indexfactory_type;
|
||||
}
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
#ifdef HAVE_PRINTF_EXTENSION
|
||||
#include <printf.h>
|
||||
#endif
|
||||
#include <stdio.h> /* fprintf */
|
||||
#include <stdio.h> /* fprintf */
|
||||
#include <unistd.h>
|
||||
#include <string.h> /* G_VA_COPY */
|
||||
#include <string.h> /* G_VA_COPY */
|
||||
#include "gstinfo.h"
|
||||
#include "gstlog.h"
|
||||
#include "gst_private.h"
|
||||
|
@ -58,7 +58,8 @@ typedef struct DL_INFO
|
|||
int dli_version;
|
||||
int dli_reserved1;
|
||||
long dli_reserved[4];
|
||||
} Dl_info;
|
||||
}
|
||||
Dl_info;
|
||||
|
||||
#define _RLD_DLADDR 14
|
||||
int dladdr (void *address, Dl_info * dl);
|
||||
|
@ -100,7 +101,8 @@ typedef struct
|
|||
{
|
||||
GPatternSpec *pat;
|
||||
GstDebugLevel level;
|
||||
} LevelNameEntry;
|
||||
}
|
||||
LevelNameEntry;
|
||||
|
||||
/* list of all categories */
|
||||
static GStaticMutex __cat_mutex = G_STATIC_MUTEX_INIT;
|
||||
|
@ -111,7 +113,8 @@ typedef struct
|
|||
{
|
||||
GstLogFunction func;
|
||||
gpointer user_data;
|
||||
} LogFuncEntry;
|
||||
}
|
||||
LogFuncEntry;
|
||||
static GStaticMutex __log_func_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GSList *__log_functions = NULL;
|
||||
|
||||
|
@ -304,7 +307,7 @@ gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level,
|
|||
entry = handler->data;
|
||||
handler = g_slist_next (handler);
|
||||
entry->func (category, level, file, function, line, object, &message,
|
||||
entry->user_data);
|
||||
entry->user_data);
|
||||
}
|
||||
g_free (message.message);
|
||||
va_end (message.arguments);
|
||||
|
@ -402,7 +405,7 @@ gst_debug_construct_term_color (guint colorinfo)
|
|||
}
|
||||
if (colorinfo & GST_DEBUG_BG_MASK) {
|
||||
g_string_append_printf (color, ";4%1d",
|
||||
(colorinfo & GST_DEBUG_BG_MASK) >> 4);
|
||||
(colorinfo & GST_DEBUG_BG_MASK) >> 4);
|
||||
}
|
||||
g_string_append (color, "m");
|
||||
|
||||
|
@ -448,8 +451,8 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
|||
/* color info */
|
||||
if (gst_debug_is_colored ()) {
|
||||
color =
|
||||
gst_debug_construct_term_color (gst_debug_category_get_color
|
||||
(category));
|
||||
gst_debug_construct_term_color (gst_debug_category_get_color
|
||||
(category));
|
||||
clear = "\033[00m";
|
||||
pidcolor = g_strdup_printf ("\033[3%1dm", pid % 6 + 31);
|
||||
} else {
|
||||
|
@ -717,7 +720,7 @@ gst_debug_reset_threshold (gpointer category, gpointer unused)
|
|||
walk = g_slist_next (walk);
|
||||
if (g_pattern_match_string (entry->pat, cat->name)) {
|
||||
GST_LOG ("category %s matches pattern %p - gets set to level %d",
|
||||
cat->name, entry->pat, entry->level);
|
||||
cat->name, entry->pat, entry->level);
|
||||
gst_debug_category_set_threshold (cat, entry->level);
|
||||
goto exit;
|
||||
}
|
||||
|
@ -742,7 +745,7 @@ for_each_threshold_by_entry (gpointer data, gpointer user_data)
|
|||
|
||||
if (g_pattern_match_string (entry->pat, cat->name)) {
|
||||
GST_LOG ("category %s matches pattern %p - gets set to level %d",
|
||||
cat->name, entry->pat, entry->level);
|
||||
cat->name, entry->pat, entry->level);
|
||||
gst_debug_category_set_threshold (cat, entry->level);
|
||||
}
|
||||
}
|
||||
|
@ -1076,7 +1079,7 @@ __cyg_profile_func_enter (void *this_fn, void *call_site)
|
|||
site);
|
||||
stack_trace =
|
||||
g_slist_prepend (stack_trace, g_strdup_printf ("%8p in %s from %p (%s)",
|
||||
this_fn, name, call_site, site));
|
||||
this_fn, name, call_site, site));
|
||||
|
||||
g_free (name);
|
||||
g_free (site);
|
||||
|
|
|
@ -54,7 +54,7 @@ gst_implements_interface_get_type (void)
|
|||
};
|
||||
|
||||
gst_interface_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstImplementsInterface", &gst_interface_info, 0);
|
||||
"GstImplementsInterface", &gst_interface_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (gst_interface_type, GST_TYPE_ELEMENT);
|
||||
}
|
||||
|
@ -97,11 +97,11 @@ gst_element_implements_interface (GstElement * element, GType iface_type)
|
|||
GstImplementsInterfaceClass *ifclass;
|
||||
|
||||
iface = G_TYPE_CHECK_INSTANCE_CAST (G_OBJECT (element),
|
||||
iface_type, GstImplementsInterface);
|
||||
iface_type, GstImplementsInterface);
|
||||
ifclass = GST_IMPLEMENTS_INTERFACE_GET_CLASS (iface);
|
||||
|
||||
if (ifclass->supported != NULL &&
|
||||
ifclass->supported (iface, iface_type) == TRUE) {
|
||||
ifclass->supported (iface, iface_type) == TRUE) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ gst_implements_interface_cast (gpointer from, GType iface_type)
|
|||
|
||||
/* check cast, give warning+fail if it's invalid */
|
||||
if (!(iface = G_TYPE_CHECK_INSTANCE_CAST (from, iface_type,
|
||||
GstImplementsInterface))) {
|
||||
GstImplementsInterface))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ gst_implements_interface_cast (gpointer from, GType iface_type)
|
|||
* is actually implemented */
|
||||
if (GST_IS_ELEMENT (from)) {
|
||||
g_return_val_if_fail (gst_element_implements_interface (GST_ELEMENT (from),
|
||||
iface_type), NULL);
|
||||
iface_type), NULL);
|
||||
}
|
||||
|
||||
return iface;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <string.h> /* memset */
|
||||
#include <string.h> /* memset */
|
||||
|
||||
#include "gstlog.h"
|
||||
#include "gstutils.h"
|
||||
|
@ -32,8 +32,8 @@ typedef struct _GstMemChunkElement GstMemChunkElement;
|
|||
|
||||
struct _GstMemChunkElement
|
||||
{
|
||||
GstTrashStackElement elem; /* make sure we can safely push it on the trashstack */
|
||||
gpointer area; /* pointer to data areas */
|
||||
GstTrashStackElement elem; /* make sure we can safely push it on the trashstack */
|
||||
gpointer area; /* pointer to data areas */
|
||||
};
|
||||
|
||||
struct _GstMemChunk
|
||||
|
|
|
@ -113,9 +113,10 @@ gst_object_get_type (void)
|
|||
(GInstanceInitFunc) gst_object_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
_gst_object_type =
|
||||
g_type_register_static (G_TYPE_OBJECT, "GstObject", &object_info,
|
||||
G_TYPE_FLAG_ABSTRACT);
|
||||
g_type_register_static (G_TYPE_OBJECT, "GstObject", &object_info,
|
||||
G_TYPE_FLAG_ABSTRACT);
|
||||
}
|
||||
return _gst_object_type;
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ gst_object_class_init (GstObjectClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME,
|
||||
g_param_spec_string ("name", "Name", "The name of the object",
|
||||
NULL, G_PARAM_READWRITE));
|
||||
NULL, G_PARAM_READWRITE));
|
||||
|
||||
gst_object_signals[PARENT_SET] =
|
||||
g_signal_new ("parent-set", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -361,11 +362,11 @@ gst_object_dispatch_properties_changed (GObject * object,
|
|||
/* need own category? */
|
||||
for (i = 0; i < n_pspecs; i++) {
|
||||
GST_CAT_LOG (GST_CAT_EVENT, "deep notification from %s to %s (%s)",
|
||||
GST_OBJECT_NAME (object), GST_OBJECT_NAME (gst_object),
|
||||
pspecs[i]->name);
|
||||
GST_OBJECT_NAME (object), GST_OBJECT_NAME (gst_object),
|
||||
pspecs[i]->name);
|
||||
g_signal_emit (gst_object, gst_object_signals[DEEP_NOTIFY],
|
||||
g_quark_from_string (pspecs[i]->name), (GstObject *) object,
|
||||
pspecs[i]);
|
||||
g_quark_from_string (pspecs[i]->name), (GstObject *) object,
|
||||
pspecs[i]);
|
||||
}
|
||||
|
||||
gst_object = GST_OBJECT_PARENT (gst_object);
|
||||
|
@ -390,7 +391,7 @@ void
|
|||
gst_object_default_deep_notify (GObject * object, GstObject * orig,
|
||||
GParamSpec * pspec, gchar ** excluded_props)
|
||||
{
|
||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
||||
gchar *str = 0;
|
||||
gchar *name = NULL;
|
||||
|
||||
|
@ -398,7 +399,7 @@ gst_object_default_deep_notify (GObject * object, GstObject * orig,
|
|||
/* let's not print these out for excluded properties... */
|
||||
while (excluded_props != NULL && *excluded_props != NULL) {
|
||||
if (strcmp (pspec->name, *excluded_props) == 0)
|
||||
return;
|
||||
return;
|
||||
excluded_props++;
|
||||
}
|
||||
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||
|
@ -408,11 +409,11 @@ gst_object_default_deep_notify (GObject * object, GstObject * orig,
|
|||
GEnumValue *enum_value;
|
||||
|
||||
enum_value =
|
||||
g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (pspec->value_type)),
|
||||
g_value_get_enum (&value));
|
||||
g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (pspec->value_type)),
|
||||
g_value_get_enum (&value));
|
||||
|
||||
str = g_strdup_printf ("%s (%d)", enum_value->value_nick,
|
||||
enum_value->value);
|
||||
enum_value->value);
|
||||
} else {
|
||||
str = g_strdup_value_contents (&value);
|
||||
}
|
||||
|
@ -443,7 +444,7 @@ gst_object_set_name_default (GstObject * object)
|
|||
|
||||
if (!object_name_counts) {
|
||||
object_name_counts = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, NULL);
|
||||
g_free, NULL);
|
||||
}
|
||||
|
||||
count = GPOINTER_TO_INT (g_hash_table_lookup (object_name_counts, type_name));
|
||||
|
@ -785,7 +786,7 @@ struct _GstSignalObjectClass
|
|||
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
|
||||
void (*object_loaded) (GstSignalObject * object, GstObject * new,
|
||||
xmlNodePtr self);
|
||||
#endif /* GST_DISABLE_LOADSAVE_REGISTRY */
|
||||
#endif /* GST_DISABLE_LOADSAVE_REGISTRY */
|
||||
};
|
||||
|
||||
static GType
|
||||
|
@ -806,9 +807,10 @@ gst_signal_object_get_type (void)
|
|||
(GInstanceInitFunc) gst_signal_object_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
signal_object_type =
|
||||
g_type_register_static (G_TYPE_OBJECT, "GstSignalObject",
|
||||
&signal_object_info, 0);
|
||||
g_type_register_static (G_TYPE_OBJECT, "GstSignalObject",
|
||||
&signal_object_info, 0);
|
||||
}
|
||||
return signal_object_type;
|
||||
}
|
||||
|
|
388
gst/gstpad.c
388
gst/gstpad.c
|
@ -77,8 +77,9 @@ gst_pad_get_type (void)
|
|||
32,
|
||||
(GInstanceInitFunc) gst_pad_init, NULL
|
||||
};
|
||||
|
||||
_gst_pad_type = g_type_register_static (GST_TYPE_OBJECT, "GstPad",
|
||||
&pad_info, 0);
|
||||
&pad_info, 0);
|
||||
}
|
||||
return _gst_pad_type;
|
||||
}
|
||||
|
@ -158,8 +159,9 @@ gst_real_pad_get_type (void)
|
|||
32,
|
||||
(GInstanceInitFunc) gst_real_pad_init, NULL
|
||||
};
|
||||
|
||||
_gst_real_pad_type = g_type_register_static (GST_TYPE_PAD, "GstRealPad",
|
||||
&pad_info, 0);
|
||||
&pad_info, 0);
|
||||
}
|
||||
return _gst_real_pad_type;
|
||||
}
|
||||
|
@ -198,10 +200,10 @@ gst_real_pad_class_init (GstRealPadClass * klass)
|
|||
/* GTK_ARG_READWRITE, REAL_ARG_ACTIVE); */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), REAL_ARG_ACTIVE,
|
||||
g_param_spec_boolean ("active", "Active", "Whether the pad is active.",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), REAL_ARG_CAPS,
|
||||
g_param_spec_boxed ("caps", "Caps", "The capabilities of the pad",
|
||||
GST_TYPE_CAPS, G_PARAM_READABLE));
|
||||
GST_TYPE_CAPS, G_PARAM_READABLE));
|
||||
|
||||
#ifndef GST_DISABLE_LOADSAVE
|
||||
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_pad_save_thyself);
|
||||
|
@ -422,11 +424,11 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
|||
|
||||
if (active) {
|
||||
GST_CAT_DEBUG (GST_CAT_PADS, "activating pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (realpad));
|
||||
GST_DEBUG_PAD_NAME (realpad));
|
||||
GST_FLAG_UNSET (realpad, GST_PAD_DISABLED);
|
||||
} else {
|
||||
GST_CAT_DEBUG (GST_CAT_PADS, "de-activating pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (realpad));
|
||||
GST_DEBUG_PAD_NAME (realpad));
|
||||
GST_FLAG_SET (realpad, GST_PAD_DISABLED);
|
||||
}
|
||||
|
||||
|
@ -1104,13 +1106,13 @@ gst_pad_link_ready_for_negotiation (GstPadLink * link)
|
|||
parent = GST_PAD_PARENT (link->srcpad);
|
||||
if (!parent || GST_STATE (parent) < GST_STATE_READY) {
|
||||
GST_DEBUG ("parent %s of pad %s:%s is not READY",
|
||||
GST_ELEMENT_NAME (parent), GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
GST_ELEMENT_NAME (parent), GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
return FALSE;
|
||||
}
|
||||
parent = GST_PAD_PARENT (link->sinkpad);
|
||||
if (!parent || GST_STATE (parent) < GST_STATE_READY) {
|
||||
GST_DEBUG ("parent %s of pad %s:%s is not READY",
|
||||
GST_ELEMENT_NAME (parent), GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
GST_ELEMENT_NAME (parent), GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1136,48 +1138,48 @@ gst_pad_link_fixate (GstPadLink * link)
|
|||
for (i = 0; i < 5; i++) {
|
||||
newcaps = NULL;
|
||||
switch (i) {
|
||||
case 0:
|
||||
g_signal_emit (G_OBJECT (link->srcpad),
|
||||
gst_real_pad_signals[REAL_FIXATE], 0, caps, &newcaps);
|
||||
GST_DEBUG ("app srcpad signal fixated to %" GST_PTR_FORMAT, newcaps);
|
||||
break;
|
||||
case 1:
|
||||
g_signal_emit (G_OBJECT (link->sinkpad),
|
||||
gst_real_pad_signals[REAL_FIXATE], 0, caps, &newcaps);
|
||||
GST_DEBUG ("app sinkpad signal fixated to %" GST_PTR_FORMAT, newcaps);
|
||||
break;
|
||||
case 2:
|
||||
if (GST_RPAD_FIXATEFUNC (link->srcpad)) {
|
||||
newcaps =
|
||||
GST_RPAD_FIXATEFUNC (link->srcpad) (GST_PAD (link->srcpad),
|
||||
caps);
|
||||
GST_DEBUG ("srcpad %s:%s fixated to %" GST_PTR_FORMAT,
|
||||
GST_DEBUG_PAD_NAME (link->srcpad), newcaps);
|
||||
} else
|
||||
GST_DEBUG ("srcpad %s:%s doesn't have a fixate function",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
case 0:
|
||||
g_signal_emit (G_OBJECT (link->srcpad),
|
||||
gst_real_pad_signals[REAL_FIXATE], 0, caps, &newcaps);
|
||||
GST_DEBUG ("app srcpad signal fixated to %" GST_PTR_FORMAT, newcaps);
|
||||
break;
|
||||
case 1:
|
||||
g_signal_emit (G_OBJECT (link->sinkpad),
|
||||
gst_real_pad_signals[REAL_FIXATE], 0, caps, &newcaps);
|
||||
GST_DEBUG ("app sinkpad signal fixated to %" GST_PTR_FORMAT, newcaps);
|
||||
break;
|
||||
case 2:
|
||||
if (GST_RPAD_FIXATEFUNC (link->srcpad)) {
|
||||
newcaps =
|
||||
GST_RPAD_FIXATEFUNC (link->srcpad) (GST_PAD (link->srcpad),
|
||||
caps);
|
||||
GST_DEBUG ("srcpad %s:%s fixated to %" GST_PTR_FORMAT,
|
||||
GST_DEBUG_PAD_NAME (link->srcpad), newcaps);
|
||||
} else
|
||||
GST_DEBUG ("srcpad %s:%s doesn't have a fixate function",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
if (GST_RPAD_FIXATEFUNC (link->sinkpad)) {
|
||||
newcaps =
|
||||
GST_RPAD_FIXATEFUNC (link->sinkpad) (GST_PAD (link->sinkpad),
|
||||
caps);
|
||||
GST_DEBUG ("sinkpad %s:%s fixated to %" GST_PTR_FORMAT,
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad), newcaps);
|
||||
} else
|
||||
GST_DEBUG ("sinkpad %s:%s doesn't have a fixate function",
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
break;
|
||||
case 4:
|
||||
newcaps = _gst_pad_default_fixate_func (GST_PAD (link->srcpad), caps);
|
||||
GST_DEBUG ("core fixated to %" GST_PTR_FORMAT, newcaps);
|
||||
break;
|
||||
break;
|
||||
case 3:
|
||||
if (GST_RPAD_FIXATEFUNC (link->sinkpad)) {
|
||||
newcaps =
|
||||
GST_RPAD_FIXATEFUNC (link->sinkpad) (GST_PAD (link->sinkpad),
|
||||
caps);
|
||||
GST_DEBUG ("sinkpad %s:%s fixated to %" GST_PTR_FORMAT,
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad), newcaps);
|
||||
} else
|
||||
GST_DEBUG ("sinkpad %s:%s doesn't have a fixate function",
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
break;
|
||||
case 4:
|
||||
newcaps = _gst_pad_default_fixate_func (GST_PAD (link->srcpad), caps);
|
||||
GST_DEBUG ("core fixated to %" GST_PTR_FORMAT, newcaps);
|
||||
break;
|
||||
}
|
||||
if (newcaps) {
|
||||
gst_caps_free (caps);
|
||||
caps = newcaps;
|
||||
break;
|
||||
gst_caps_free (caps);
|
||||
caps = newcaps;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1193,7 +1195,7 @@ gst_pad_link_call_link_functions (GstPadLink * link)
|
|||
|
||||
if (link->srcnotify && GST_RPAD_LINKFUNC (link->srcpad)) {
|
||||
GST_DEBUG ("calling link function on pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
|
||||
negotiating = GST_FLAG_IS_SET (link->srcpad, GST_PAD_NEGOTIATING);
|
||||
|
||||
|
@ -1209,18 +1211,18 @@ gst_pad_link_call_link_functions (GstPadLink * link)
|
|||
GST_FLAG_UNSET (link->srcpad, GST_PAD_NEGOTIATING);
|
||||
|
||||
GST_DEBUG ("got reply %d from link function on pad %s:%s",
|
||||
res, GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
res, GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
|
||||
if (GST_PAD_LINK_FAILED (res)) {
|
||||
GST_CAT_INFO (GST_CAT_CAPS, "pad %s:%s doesn't accept caps",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if (link->sinknotify && GST_RPAD_LINKFUNC (link->sinkpad)) {
|
||||
GST_DEBUG ("calling link function on pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
|
||||
negotiating = GST_FLAG_IS_SET (link->sinkpad, GST_PAD_NEGOTIATING);
|
||||
|
||||
|
@ -1230,18 +1232,18 @@ gst_pad_link_call_link_functions (GstPadLink * link)
|
|||
|
||||
/* call the link function */
|
||||
res = GST_RPAD_LINKFUNC (link->sinkpad) (GST_PAD (link->sinkpad),
|
||||
link->caps);
|
||||
link->caps);
|
||||
|
||||
/* unset again after negotiating only if we set it */
|
||||
if (!negotiating)
|
||||
GST_FLAG_UNSET (link->sinkpad, GST_PAD_NEGOTIATING);
|
||||
|
||||
GST_DEBUG ("got reply %d from link function on pad %s:%s",
|
||||
res, GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
res, GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
|
||||
if (GST_PAD_LINK_FAILED (res)) {
|
||||
GST_CAT_INFO (GST_CAT_CAPS, "pad %s:%s doesn't accept caps",
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -1406,10 +1408,10 @@ gst_pad_try_set_caps (GstPad * pad, const GstCaps * caps)
|
|||
/* setting non-fixed caps on a pad is not allowed */
|
||||
if (!gst_caps_is_fixed (caps)) {
|
||||
GST_CAT_INFO (GST_CAT_CAPS,
|
||||
"trying to set unfixed caps on pad %s:%s, not allowed",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
"trying to set unfixed caps on pad %s:%s, not allowed",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
g_warning ("trying to set non fixed caps on pad %s:%s, not allowed",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
|
||||
GST_DEBUG ("unfixed caps %" GST_PTR_FORMAT, caps);
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
@ -1564,33 +1566,33 @@ gst_pad_can_link_filtered (GstPad * srcpad, GstPad * sinkpad,
|
|||
|
||||
if ((GST_PAD (realsrc) != srcpad) || (GST_PAD (realsink) != sinkpad)) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "*actually* linking %s:%s and %s:%s",
|
||||
GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
|
||||
GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
|
||||
}
|
||||
/* FIXME: shouldn't we convert this to g_return_val_if_fail? */
|
||||
if (GST_RPAD_PEER (realsrc) != NULL) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real source pad %s:%s has a peer, failed",
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_RPAD_PEER (realsink) != NULL) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has a peer, failed",
|
||||
GST_DEBUG_PAD_NAME (realsink));
|
||||
GST_DEBUG_PAD_NAME (realsink));
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_PAD_PARENT (realsrc) == NULL) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real src pad %s:%s has no parent, failed",
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_PAD_PARENT (realsink) == NULL) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has no parent, failed",
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_pad_check_schedulers (realsrc, realsink)) {
|
||||
g_warning ("linking pads with different scheds requires "
|
||||
"exactly one decoupled element (such as queue)");
|
||||
"exactly one decoupled element (such as queue)");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1609,14 +1611,14 @@ gst_pad_can_link_filtered (GstPad * srcpad, GstPad * sinkpad,
|
|||
|
||||
if (GST_RPAD_DIRECTION (link->srcpad) != GST_PAD_SRC) {
|
||||
GST_CAT_INFO (GST_CAT_PADS,
|
||||
"Real src pad %s:%s is not a source pad, failed",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
"Real src pad %s:%s is not a source pad, failed",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
gst_pad_link_free (link);
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_RPAD_DIRECTION (link->sinkpad) != GST_PAD_SINK) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s is not a sink pad, failed",
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
gst_pad_link_free (link);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1685,33 +1687,33 @@ gst_pad_link_filtered (GstPad * srcpad, GstPad * sinkpad,
|
|||
|
||||
if ((GST_PAD (realsrc) != srcpad) || (GST_PAD (realsink) != sinkpad)) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "*actually* linking %s:%s and %s:%s",
|
||||
GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
|
||||
GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
|
||||
}
|
||||
/* FIXME: shouldn't we convert this to g_return_val_if_fail? */
|
||||
if (GST_RPAD_PEER (realsrc) != NULL) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real source pad %s:%s has a peer, failed",
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_RPAD_PEER (realsink) != NULL) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has a peer, failed",
|
||||
GST_DEBUG_PAD_NAME (realsink));
|
||||
GST_DEBUG_PAD_NAME (realsink));
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_PAD_PARENT (realsrc) == NULL) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real src pad %s:%s has no parent, failed",
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_PAD_PARENT (realsink) == NULL) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has no parent, failed",
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
GST_DEBUG_PAD_NAME (realsrc));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_pad_check_schedulers (realsrc, realsink)) {
|
||||
g_warning ("linking pads with different scheds requires "
|
||||
"exactly one decoupled element (such as queue)");
|
||||
"exactly one decoupled element (such as queue)");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1730,14 +1732,14 @@ gst_pad_link_filtered (GstPad * srcpad, GstPad * sinkpad,
|
|||
|
||||
if (GST_RPAD_DIRECTION (link->srcpad) != GST_PAD_SRC) {
|
||||
GST_CAT_INFO (GST_CAT_PADS,
|
||||
"Real src pad %s:%s is not a source pad, failed",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
"Real src pad %s:%s is not a source pad, failed",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad));
|
||||
gst_pad_link_free (link);
|
||||
return FALSE;
|
||||
}
|
||||
if (GST_RPAD_DIRECTION (link->sinkpad) != GST_PAD_SINK) {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s is not a sink pad, failed",
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
GST_DEBUG_PAD_NAME (link->sinkpad));
|
||||
gst_pad_link_free (link);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1762,12 +1764,12 @@ gst_pad_link_filtered (GstPad * srcpad, GstPad * sinkpad,
|
|||
/* now tell the scheduler */
|
||||
if (src_sched && src_sched == sink_sched) {
|
||||
gst_scheduler_pad_link (src_sched,
|
||||
GST_PAD (link->srcpad), GST_PAD (link->sinkpad));
|
||||
GST_PAD (link->srcpad), GST_PAD (link->sinkpad));
|
||||
} else {
|
||||
GST_CAT_INFO (GST_CAT_PADS,
|
||||
"not telling link to scheduler %s:%s and %s:%s, %p %p",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad), GST_DEBUG_PAD_NAME (link->sinkpad),
|
||||
src_sched, sink_sched);
|
||||
"not telling link to scheduler %s:%s and %s:%s, %p %p",
|
||||
GST_DEBUG_PAD_NAME (link->srcpad), GST_DEBUG_PAD_NAME (link->sinkpad),
|
||||
src_sched, sink_sched);
|
||||
}
|
||||
|
||||
GST_CAT_INFO (GST_CAT_PADS, "linked %s:%s and %s:%s, successful",
|
||||
|
@ -1838,7 +1840,7 @@ gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ)
|
|||
|
||||
if (templ)
|
||||
g_signal_emit (G_OBJECT (templ),
|
||||
gst_pad_template_signals[TEMPL_PAD_CREATED], 0, pad);
|
||||
gst_pad_template_signals[TEMPL_PAD_CREATED], 0, pad);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1885,8 +1887,8 @@ gst_pad_get_scheduler (GstPad * pad)
|
|||
GstRealPad *peer = GST_RPAD_PEER (pad);
|
||||
|
||||
if (peer) {
|
||||
scheduler =
|
||||
gst_element_get_scheduler (gst_pad_get_parent (GST_PAD (peer)));
|
||||
scheduler =
|
||||
gst_element_get_scheduler (gst_pad_get_parent (GST_PAD (peer)));
|
||||
}
|
||||
} else {
|
||||
scheduler = gst_element_get_scheduler (parent);
|
||||
|
@ -1993,17 +1995,17 @@ _gst_pad_default_fixate_foreach (GQuark field_id, GValue * value, gpointer s)
|
|||
|
||||
if (type == GST_TYPE_INT_RANGE) {
|
||||
gst_structure_set (structure, g_quark_to_string (field_id),
|
||||
G_TYPE_INT, gst_value_get_int_range_min (value), NULL);
|
||||
G_TYPE_INT, gst_value_get_int_range_min (value), NULL);
|
||||
return FALSE;
|
||||
}
|
||||
if (type == GST_TYPE_DOUBLE_RANGE) {
|
||||
gst_structure_set (structure, g_quark_to_string (field_id),
|
||||
G_TYPE_DOUBLE, gst_value_get_double_range_min (value), NULL);
|
||||
G_TYPE_DOUBLE, gst_value_get_double_range_min (value), NULL);
|
||||
return FALSE;
|
||||
}
|
||||
if (type == GST_TYPE_LIST) {
|
||||
gst_structure_set_value (structure, g_quark_to_string (field_id),
|
||||
gst_value_list_get_value (value, 0));
|
||||
gst_value_list_get_value (value, 0));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2028,7 +2030,7 @@ _gst_pad_default_fixate_func (GstPad * pad, const GstCaps * caps)
|
|||
|
||||
if (caps->structs->len > 1) {
|
||||
return gst_caps_new_full (gst_structure_copy (gst_caps_get_structure (caps,
|
||||
0)), NULL);
|
||||
0)), NULL);
|
||||
}
|
||||
|
||||
newcaps = gst_caps_copy (caps);
|
||||
|
@ -2110,7 +2112,7 @@ gst_pad_link_prepare (GstPad * srcpad, GstPad * sinkpad,
|
|||
|
||||
if ((GST_PAD (realsrc) != srcpad) || (GST_PAD (realsink) != sinkpad)) {
|
||||
GST_CAT_DEBUG (GST_CAT_PADS, "*actually* linking %s:%s and %s:%s",
|
||||
GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
|
||||
GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
|
||||
}
|
||||
|
||||
g_return_val_if_fail (GST_RPAD_PEER (realsrc) == NULL, NULL);
|
||||
|
@ -2120,14 +2122,14 @@ gst_pad_link_prepare (GstPad * srcpad, GstPad * sinkpad,
|
|||
|
||||
if (!gst_pad_check_schedulers (realsrc, realsink)) {
|
||||
g_warning ("linking pads with different scheds requires "
|
||||
"exactly one decoupled element (such as queue)");
|
||||
"exactly one decoupled element (such as queue)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (GST_RPAD_DIRECTION (realsrc) == GST_RPAD_DIRECTION (realsink)) {
|
||||
g_warning ("%s:%s and %s:%s are both %s pads, failed",
|
||||
GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink),
|
||||
GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC ? "src" : "sink");
|
||||
GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink),
|
||||
GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC ? "src" : "sink");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2175,7 +2177,7 @@ gst_pad_try_relink_filtered (GstPad * srcpad, GstPad * sinkpad,
|
|||
|
||||
if (GST_RPAD_PEER (link->srcpad) != (GstRealPad *) link->sinkpad) {
|
||||
g_warning ("Pads %s:%s and %s:%s were never linked",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
gst_pad_link_free (link);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2289,7 +2291,7 @@ gst_pad_proxy_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
if (otherpad != pad) {
|
||||
ret = gst_pad_try_set_caps (otherpad, caps);
|
||||
if (GST_PAD_LINK_FAILED (ret)) {
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
pads = g_list_next (pads);
|
||||
|
@ -2333,14 +2335,14 @@ gst_pad_proxy_fixate (GstPad * pad, const GstCaps * caps)
|
|||
othercaps = gst_pad_get_negotiated_caps (otherpad);
|
||||
|
||||
if (othercaps) {
|
||||
GstCaps *icaps;
|
||||
GstCaps *icaps;
|
||||
|
||||
icaps = gst_caps_intersect (othercaps, caps);
|
||||
if (!gst_caps_is_empty (icaps)) {
|
||||
return icaps;
|
||||
} else {
|
||||
gst_caps_free (icaps);
|
||||
}
|
||||
icaps = gst_caps_intersect (othercaps, caps);
|
||||
if (!gst_caps_is_empty (icaps)) {
|
||||
return icaps;
|
||||
} else {
|
||||
gst_caps_free (icaps);
|
||||
}
|
||||
}
|
||||
}
|
||||
pads = g_list_next (pads);
|
||||
|
@ -2389,7 +2391,7 @@ gst_pad_set_explicit_caps (GstPad * pad, const GstCaps * caps)
|
|||
link_ret = gst_pad_try_set_caps (pad, caps);
|
||||
if (link_ret == GST_PAD_LINK_REFUSED) {
|
||||
GST_ELEMENT_ERROR (gst_pad_get_parent (pad), CORE, PAD, (NULL),
|
||||
("failed to negotiate (try_set_caps returned REFUSED)"));
|
||||
("failed to negotiate (try_set_caps returned REFUSED)"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2530,8 +2532,8 @@ gst_pad_get_caps (GstPad * pad)
|
|||
|
||||
if (caps == NULL) {
|
||||
g_critical ("pad %s:%s returned NULL caps from getcaps function\n",
|
||||
GST_ELEMENT_NAME (GST_PAD_PARENT (GST_PAD (realpad))),
|
||||
GST_PAD_NAME (realpad));
|
||||
GST_ELEMENT_NAME (GST_PAD_PARENT (GST_PAD (realpad))),
|
||||
GST_PAD_NAME (realpad));
|
||||
caps = gst_caps_new_any ();
|
||||
}
|
||||
|
||||
|
@ -2542,15 +2544,15 @@ gst_pad_get_caps (GstPad * pad)
|
|||
|
||||
caps = GST_PAD_TEMPLATE_CAPS (templ);
|
||||
GST_CAT_DEBUG (GST_CAT_CAPS,
|
||||
"using pad template %p with caps %" GST_PTR_FORMAT, templ, caps);
|
||||
"using pad template %p with caps %" GST_PTR_FORMAT, templ, caps);
|
||||
|
||||
#if 0
|
||||
/* FIXME we should enable something like this someday, but this is
|
||||
* a bit buggy */
|
||||
if (!gst_caps_is_fixed (caps)) {
|
||||
g_warning
|
||||
("pad %s:%s (%p) has no getcaps function and the pad template returns non-fixed caps. Element is probably broken.\n",
|
||||
GST_DEBUG_PAD_NAME (realpad), realpad);
|
||||
("pad %s:%s (%p) has no getcaps function and the pad template returns non-fixed caps. Element is probably broken.\n",
|
||||
GST_DEBUG_PAD_NAME (realpad), realpad);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2644,16 +2646,16 @@ gst_pad_check_compatibility (GstPad * srcpad, GstPad * sinkpad)
|
|||
|
||||
if (GST_PAD_CAPS (srcpad) && GST_PAD_CAPS (sinkpad)) {
|
||||
if (!gst_caps_is_always_compatible (GST_PAD_CAPS (srcpad),
|
||||
GST_PAD_CAPS (sinkpad))) {
|
||||
GST_PAD_CAPS (sinkpad))) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
GST_CAT_DEBUG (GST_CAT_PADS,
|
||||
"could not check capabilities of pads (%s:%s) and (%s:%s) %p %p",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad),
|
||||
GST_PAD_CAPS (srcpad), GST_PAD_CAPS (sinkpad));
|
||||
"could not check capabilities of pads (%s:%s) and (%s:%s) %p %p",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad),
|
||||
GST_PAD_CAPS (srcpad), GST_PAD_CAPS (sinkpad));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -2778,9 +2780,9 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size)
|
|||
|
||||
if (peer->bufferallocfunc) {
|
||||
GST_CAT_DEBUG (GST_CAT_PADS,
|
||||
"calling bufferallocfunc &%s (@%p) of peer pad %s:%s",
|
||||
GST_DEBUG_FUNCPTR_NAME (peer->bufferallocfunc),
|
||||
&peer->bufferallocfunc, GST_DEBUG_PAD_NAME (((GstPad *) peer)));
|
||||
"calling bufferallocfunc &%s (@%p) of peer pad %s:%s",
|
||||
GST_DEBUG_FUNCPTR_NAME (peer->bufferallocfunc),
|
||||
&peer->bufferallocfunc, GST_DEBUG_PAD_NAME (((GstPad *) peer)));
|
||||
return (peer->bufferallocfunc) (GST_PAD (peer), offset, size);
|
||||
} else {
|
||||
return gst_buffer_new_and_alloc (size);
|
||||
|
@ -2813,15 +2815,15 @@ gst_real_pad_dispose (GObject * object)
|
|||
GstPad *ghostpad = GST_PAD (ghostpads->data);
|
||||
|
||||
if (GST_IS_ELEMENT (GST_OBJECT_PARENT (ghostpad))) {
|
||||
GstElement *parent = GST_ELEMENT (GST_OBJECT_PARENT (ghostpad));
|
||||
GstElement *parent = GST_ELEMENT (GST_OBJECT_PARENT (ghostpad));
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_REFCOUNTING,
|
||||
"removing ghost pad from element '%s'", GST_OBJECT_NAME (parent));
|
||||
gst_element_remove_pad (parent, ghostpad);
|
||||
GST_CAT_DEBUG (GST_CAT_REFCOUNTING,
|
||||
"removing ghost pad from element '%s'", GST_OBJECT_NAME (parent));
|
||||
gst_element_remove_pad (parent, ghostpad);
|
||||
} else {
|
||||
/* handle the case where we have some floating ghost pad that was never
|
||||
added to an element */
|
||||
g_object_set (ghostpad, "real-pad", NULL, NULL);
|
||||
/* handle the case where we have some floating ghost pad that was never
|
||||
added to an element */
|
||||
g_object_set (ghostpad, "real-pad", NULL, NULL);
|
||||
}
|
||||
ghostpads = g_list_next (ghostpads);
|
||||
}
|
||||
|
@ -2833,14 +2835,14 @@ gst_real_pad_dispose (GObject * object)
|
|||
|
||||
if (GST_IS_ELEMENT (GST_OBJECT_PARENT (pad))) {
|
||||
GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "removing pad from element '%s'",
|
||||
GST_OBJECT_NAME (GST_OBJECT (GST_ELEMENT (GST_OBJECT_PARENT (pad)))));
|
||||
GST_OBJECT_NAME (GST_OBJECT (GST_ELEMENT (GST_OBJECT_PARENT (pad)))));
|
||||
|
||||
gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad);
|
||||
}
|
||||
|
||||
if (GST_RPAD_EXPLICIT_CAPS (pad)) {
|
||||
GST_ERROR_OBJECT (pad, "still explicit caps %" GST_PTR_FORMAT " set",
|
||||
GST_RPAD_EXPLICIT_CAPS (pad));
|
||||
GST_RPAD_EXPLICIT_CAPS (pad));
|
||||
g_warning ("pad %p has still explicit caps set", pad);
|
||||
gst_caps_replace (&GST_RPAD_EXPLICIT_CAPS (pad), NULL);
|
||||
}
|
||||
|
@ -2871,7 +2873,7 @@ gst_pad_load_and_link (xmlNodePtr self, GstObject * parent)
|
|||
while (field) {
|
||||
if (!strcmp (field->name, "name")) {
|
||||
pad = gst_element_get_pad (GST_ELEMENT (parent),
|
||||
xmlNodeGetContent (field));
|
||||
xmlNodeGetContent (field));
|
||||
} else if (!strcmp (field->name, "peer")) {
|
||||
peer = xmlNodeGetContent (field);
|
||||
}
|
||||
|
@ -2886,8 +2888,8 @@ gst_pad_load_and_link (xmlNodePtr self, GstObject * parent)
|
|||
|
||||
if (split[0] == NULL || split[1] == NULL) {
|
||||
GST_CAT_DEBUG (GST_CAT_XML,
|
||||
"Could not parse peer '%s' for pad %s:%s, leaving unlinked",
|
||||
peer, GST_DEBUG_PAD_NAME (pad));
|
||||
"Could not parse peer '%s' for pad %s:%s, leaving unlinked",
|
||||
peer, GST_DEBUG_PAD_NAME (pad));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2942,7 +2944,7 @@ gst_pad_save_thyself (GstObject * object, xmlNodePtr parent)
|
|||
/* first check to see if the peer's parent's parent is the same */
|
||||
/* we just save it off */
|
||||
content = g_strdup_printf ("%s.%s",
|
||||
GST_OBJECT_NAME (GST_PAD_PARENT (peer)), GST_PAD_NAME (peer));
|
||||
GST_OBJECT_NAME (GST_PAD_PARENT (peer)), GST_PAD_NAME (peer));
|
||||
xmlNewChild (parent, NULL, "peer", content);
|
||||
g_free (content);
|
||||
} else
|
||||
|
@ -3002,7 +3004,7 @@ gst_pad_push (GstPad * pad, GstData * data)
|
|||
|
||||
if (!GST_PAD_IS_LINKED (pad)) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad,
|
||||
"not pushing data %p as pad is unconnected", data);
|
||||
"not pushing data %p as pad is unconnected", data);
|
||||
gst_data_unref (data);
|
||||
return;
|
||||
}
|
||||
|
@ -3012,33 +3014,33 @@ gst_pad_push (GstPad * pad, GstData * data)
|
|||
|
||||
if (!peer) {
|
||||
g_warning ("push on pad %s:%s but it is unlinked",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
} else {
|
||||
if (!GST_IS_EVENT (data) && !GST_PAD_IS_ACTIVE (peer)) {
|
||||
g_warning ("push on peer of pad %s:%s but peer is not active",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
return;
|
||||
}
|
||||
|
||||
if (peer->chainhandler) {
|
||||
if (data) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad,
|
||||
"calling chainhandler &%s of peer pad %s:%s",
|
||||
GST_DEBUG_FUNCPTR_NAME (peer->chainhandler),
|
||||
GST_DEBUG_PAD_NAME (GST_PAD (peer)));
|
||||
if (!gst_probe_dispatcher_dispatch (&peer->probedisp, &data))
|
||||
return;
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad,
|
||||
"calling chainhandler &%s of peer pad %s:%s",
|
||||
GST_DEBUG_FUNCPTR_NAME (peer->chainhandler),
|
||||
GST_DEBUG_PAD_NAME (GST_PAD (peer)));
|
||||
if (!gst_probe_dispatcher_dispatch (&peer->probedisp, &data))
|
||||
return;
|
||||
|
||||
(peer->chainhandler) (GST_PAD (peer), data);
|
||||
return;
|
||||
(peer->chainhandler) (GST_PAD (peer), data);
|
||||
return;
|
||||
} else {
|
||||
g_warning ("trying to push a NULL buffer on pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (peer));
|
||||
return;
|
||||
g_warning ("trying to push a NULL buffer on pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (peer));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
g_warning ("internal error: push on pad %s:%s but it has no chainhandler",
|
||||
GST_DEBUG_PAD_NAME (peer));
|
||||
GST_DEBUG_PAD_NAME (peer));
|
||||
}
|
||||
}
|
||||
/* clean up the mess here */
|
||||
|
@ -3069,31 +3071,31 @@ gst_pad_pull (GstPad * pad)
|
|||
|
||||
if (!peer) {
|
||||
GST_ELEMENT_ERROR (GST_PAD_PARENT (pad), CORE, PAD, (NULL),
|
||||
("pull on pad %s:%s but it was unlinked", GST_DEBUG_PAD_NAME (pad)));
|
||||
("pull on pad %s:%s but it was unlinked", GST_DEBUG_PAD_NAME (pad)));
|
||||
} else {
|
||||
restart:
|
||||
if (peer->gethandler) {
|
||||
GstData *data;
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad,
|
||||
"calling gethandler %s of peer pad %s:%s",
|
||||
GST_DEBUG_FUNCPTR_NAME (peer->gethandler), GST_DEBUG_PAD_NAME (peer));
|
||||
"calling gethandler %s of peer pad %s:%s",
|
||||
GST_DEBUG_FUNCPTR_NAME (peer->gethandler), GST_DEBUG_PAD_NAME (peer));
|
||||
|
||||
data = (peer->gethandler) (GST_PAD (peer));
|
||||
|
||||
if (data) {
|
||||
if (!gst_probe_dispatcher_dispatch (&peer->probedisp, &data))
|
||||
goto restart;
|
||||
return data;
|
||||
if (!gst_probe_dispatcher_dispatch (&peer->probedisp, &data))
|
||||
goto restart;
|
||||
return data;
|
||||
}
|
||||
|
||||
/* no null buffers allowed */
|
||||
GST_ELEMENT_ERROR (GST_PAD_PARENT (pad), CORE, PAD, (NULL),
|
||||
("NULL buffer during pull on %s:%s", GST_DEBUG_PAD_NAME (pad)));
|
||||
("NULL buffer during pull on %s:%s", GST_DEBUG_PAD_NAME (pad)));
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (GST_PAD_PARENT (pad), CORE, PAD, (NULL),
|
||||
("pull on pad %s:%s but the peer pad %s:%s has no gethandler",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer)));
|
||||
("pull on pad %s:%s but the peer pad %s:%s has no gethandler",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer)));
|
||||
}
|
||||
}
|
||||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
||||
|
@ -3199,9 +3201,10 @@ gst_pad_template_get_type (void)
|
|||
32,
|
||||
(GInstanceInitFunc) gst_pad_template_init, NULL
|
||||
};
|
||||
|
||||
padtemplate_type =
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstPadTemplate",
|
||||
&padtemplate_info, 0);
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstPadTemplate",
|
||||
&padtemplate_info, 0);
|
||||
}
|
||||
return padtemplate_type;
|
||||
}
|
||||
|
@ -3261,23 +3264,23 @@ name_is_valid (const gchar * name, GstPadPresence presence)
|
|||
if (presence == GST_PAD_ALWAYS) {
|
||||
if (strchr (name, '%')) {
|
||||
g_warning ("invalid name template %s: conversion specifications are not"
|
||||
" allowed for GST_PAD_ALWAYS padtemplates", name);
|
||||
" allowed for GST_PAD_ALWAYS padtemplates", name);
|
||||
return FALSE;
|
||||
}
|
||||
} else if (presence == GST_PAD_REQUEST) {
|
||||
if ((str = strchr (name, '%')) && strchr (str + 1, '%')) {
|
||||
g_warning ("invalid name template %s: only one conversion specification"
|
||||
" allowed in GST_PAD_REQUEST padtemplate", name);
|
||||
" allowed in GST_PAD_REQUEST padtemplate", name);
|
||||
return FALSE;
|
||||
}
|
||||
if (str && (*(str + 1) != 's' && *(str + 1) != 'd')) {
|
||||
g_warning ("invalid name template %s: conversion specification must be of"
|
||||
" type '%%d' or '%%s' for GST_PAD_REQUEST padtemplate", name);
|
||||
" type '%%d' or '%%s' for GST_PAD_REQUEST padtemplate", name);
|
||||
return FALSE;
|
||||
}
|
||||
if (str && (*(str + 2) != '\0')) {
|
||||
g_warning ("invalid name template %s: conversion specification must"
|
||||
" appear at the end of the GST_PAD_REQUEST padtemplate name", name);
|
||||
" appear at the end of the GST_PAD_REQUEST padtemplate name", name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -3438,8 +3441,9 @@ gst_ghost_pad_get_type (void)
|
|||
(GInstanceInitFunc) gst_ghost_pad_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
_gst_ghost_pad_type = g_type_register_static (GST_TYPE_PAD, "GstGhostPad",
|
||||
&pad_info, 0);
|
||||
&pad_info, 0);
|
||||
}
|
||||
return _gst_ghost_pad_type;
|
||||
}
|
||||
|
@ -3459,7 +3463,7 @@ gst_ghost_pad_class_init (GstGhostPadClass * klass)
|
|||
|
||||
g_object_class_install_property (gobject_class, GPAD_ARG_REAL_PAD,
|
||||
g_param_spec_object ("real-pad", "Real pad",
|
||||
"The real pad for the ghost pad", GST_TYPE_PAD, G_PARAM_READWRITE));
|
||||
"The real pad for the ghost pad", GST_TYPE_PAD, G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3489,14 +3493,14 @@ gst_ghost_pad_set_property (GObject * object, guint prop_id,
|
|||
realpad = g_value_get_object (value);
|
||||
|
||||
if (oldrealpad) {
|
||||
if (realpad == oldrealpad)
|
||||
return;
|
||||
else
|
||||
gst_pad_remove_ghost_pad (oldrealpad, ghostpad);
|
||||
if (realpad == oldrealpad)
|
||||
return;
|
||||
else
|
||||
gst_pad_remove_ghost_pad (oldrealpad, ghostpad);
|
||||
}
|
||||
|
||||
if (realpad)
|
||||
gst_pad_add_ghost_pad (realpad, ghostpad);
|
||||
gst_pad_add_ghost_pad (realpad, ghostpad);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3633,16 +3637,16 @@ gst_pad_event_default_dispatch (GstPad * pad, GstElement * element,
|
|||
/* for all of the internally-linked pads that are actually linked */
|
||||
if (GST_PAD_IS_LINKED (eventpad)) {
|
||||
if (GST_PAD_DIRECTION (eventpad) == GST_PAD_SRC) {
|
||||
/* increase the refcount */
|
||||
gst_event_ref (event);
|
||||
gst_pad_push (eventpad, GST_DATA (event));
|
||||
/* increase the refcount */
|
||||
gst_event_ref (event);
|
||||
gst_pad_push (eventpad, GST_DATA (event));
|
||||
} else {
|
||||
GstPad *peerpad = GST_PAD (GST_RPAD_PEER (eventpad));
|
||||
GstPad *peerpad = GST_PAD (GST_RPAD_PEER (eventpad));
|
||||
|
||||
/* we only send the event on one pad, multi-sinkpad elements
|
||||
* should implement a handler */
|
||||
g_list_free (orig);
|
||||
return gst_pad_send_event (peerpad, event);
|
||||
/* we only send the event on one pad, multi-sinkpad elements
|
||||
* should implement a handler */
|
||||
g_list_free (orig);
|
||||
return gst_pad_send_event (peerpad, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3684,24 +3688,24 @@ gst_pad_event_default (GstPad * pad, GstEvent * event)
|
|||
guint64 time;
|
||||
|
||||
if (gst_element_requires_clock (element) && element->clock) {
|
||||
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)) {
|
||||
gst_element_set_time (element, time);
|
||||
} else {
|
||||
GstFormat format = GST_FORMAT_TIME;
|
||||
guint i;
|
||||
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)) {
|
||||
gst_element_set_time (element, time);
|
||||
} else {
|
||||
GstFormat format = GST_FORMAT_TIME;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < event->event_data.discont.noffsets; i++) {
|
||||
if (gst_pad_convert (pad,
|
||||
event->event_data.discont.offsets[i].format,
|
||||
event->event_data.discont.offsets[i].value, &format,
|
||||
&time)) {
|
||||
gst_element_set_time (element, time);
|
||||
} else if (i == event->event_data.discont.noffsets) {
|
||||
g_warning
|
||||
("can't adjust clock to new time when time not provided");
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < event->event_data.discont.noffsets; i++) {
|
||||
if (gst_pad_convert (pad,
|
||||
event->event_data.discont.offsets[i].format,
|
||||
event->event_data.discont.offsets[i].value, &format,
|
||||
&time)) {
|
||||
gst_element_set_time (element, time);
|
||||
} else if (i == event->event_data.discont.noffsets) {
|
||||
g_warning
|
||||
("can't adjust clock to new time when time not provided");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
@ -3742,7 +3746,7 @@ gst_pad_dispatcher (GstPad * pad, GstPadDispatcherFunction dispatch,
|
|||
if (int_peer) {
|
||||
res = dispatch (GST_PAD (int_peer), data);
|
||||
if (res)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
int_pads = g_list_next (int_pads);
|
||||
}
|
||||
|
@ -3794,7 +3798,8 @@ typedef struct
|
|||
gint64 src_value;
|
||||
GstFormat *dest_format;
|
||||
gint64 *dest_value;
|
||||
} GstPadConvertData;
|
||||
}
|
||||
GstPadConvertData;
|
||||
|
||||
static gboolean
|
||||
gst_pad_convert_dispatcher (GstPad * pad, GstPadConvertData * data)
|
||||
|
@ -3870,7 +3875,7 @@ gst_pad_convert (GstPad * pad,
|
|||
|
||||
if (GST_RPAD_CONVERTFUNC (rpad)) {
|
||||
return GST_RPAD_CONVERTFUNC (rpad) (GST_PAD (rpad), src_format,
|
||||
src_value, dest_format, dest_value);
|
||||
src_value, dest_format, dest_value);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -3881,7 +3886,8 @@ typedef struct
|
|||
GstQueryType type;
|
||||
GstFormat *format;
|
||||
gint64 *value;
|
||||
} GstPadQueryData;
|
||||
}
|
||||
GstPadQueryData;
|
||||
|
||||
static gboolean
|
||||
gst_pad_query_dispatcher (GstPad * pad, GstPadQueryData * data)
|
||||
|
|
|
@ -76,8 +76,9 @@ gst_pipeline_get_type (void)
|
|||
gst_pipeline_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
pipeline_type =
|
||||
g_type_register_static (GST_TYPE_BIN, "GstPipeline", &pipeline_info, 0);
|
||||
g_type_register_static (GST_TYPE_BIN, "GstPipeline", &pipeline_info, 0);
|
||||
}
|
||||
return pipeline_type;
|
||||
}
|
||||
|
@ -122,8 +123,8 @@ gst_pipeline_init (GTypeInstance * instance, gpointer g_class)
|
|||
const gchar *name = gst_scheduler_factory_get_default_name ();
|
||||
|
||||
g_error ("Critical error: could not get scheduler \"%s\"\n"
|
||||
"Are you sure you have a registry ?\n"
|
||||
"Run gst-register as root if you haven't done so yet.", name);
|
||||
"Are you sure you have a registry ?\n"
|
||||
"Run gst-register as root if you haven't done so yet.", name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +169,7 @@ gst_pipeline_change_state (GstElement * element)
|
|||
* might not be in cothread 0 */
|
||||
#if 0
|
||||
if (GST_ELEMENT_SCHED (element)) {
|
||||
gst_scheduler_reset (GST_ELEMENT_SCHED (element));
|
||||
gst_scheduler_reset (GST_ELEMENT_SCHED (element));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
|
138
gst/gstplugin.c
138
gst/gstplugin.c
|
@ -43,7 +43,7 @@ static GList *_gst_plugin_static = NULL;
|
|||
|
||||
/* static variables for segfault handling of plugin loading */
|
||||
static char *_gst_plugin_fault_handler_filename = NULL;
|
||||
extern gboolean *_gst_disable_segtrap; /* see gst.c */
|
||||
extern gboolean *_gst_disable_segtrap; /* see gst.c */
|
||||
static gboolean *_gst_plugin_fault_handler_is_setup = FALSE;
|
||||
|
||||
/* list of valid licenses.
|
||||
|
@ -56,11 +56,11 @@ static gboolean *_gst_plugin_fault_handler_is_setup = FALSE;
|
|||
* QPL: http://www.trolltech.com/licenses/qpl.html
|
||||
*/
|
||||
static gchar *valid_licenses[] = {
|
||||
"LGPL", /* GNU Lesser General Public License */
|
||||
"GPL", /* GNU General Public License */
|
||||
"QPL", /* Trolltech Qt Public License */
|
||||
"GPL/QPL", /* Combi-license of GPL + QPL */
|
||||
GST_LICENSE_UNKNOWN, /* some other license */
|
||||
"LGPL", /* GNU Lesser General Public License */
|
||||
"GPL", /* GNU General Public License */
|
||||
"QPL", /* Trolltech Qt Public License */
|
||||
"GPL/QPL", /* Combi-license of GPL + QPL */
|
||||
GST_LICENSE_UNKNOWN, /* some other license */
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,7 @@ gst_plugin_get_type (void)
|
|||
|
||||
if (plugin_type == 0) {
|
||||
plugin_type = g_boxed_type_register_static ("GstPlugin",
|
||||
(GBoxedCopyFunc) gst_plugin_copy, g_free);
|
||||
(GBoxedCopyFunc) gst_plugin_copy, g_free);
|
||||
}
|
||||
|
||||
return plugin_type;
|
||||
|
@ -111,7 +111,7 @@ _gst_plugin_register_static (GstPluginDesc * desc)
|
|||
if (main_module == NULL) {
|
||||
if (GST_CAT_DEFAULT)
|
||||
GST_LOG ("queueing static plugin \"%s\" for loading later on",
|
||||
desc->name);
|
||||
desc->name);
|
||||
_gst_plugin_static = g_list_prepend (_gst_plugin_static, desc);
|
||||
} else {
|
||||
GstPlugin *plugin;
|
||||
|
@ -121,7 +121,7 @@ _gst_plugin_register_static (GstPluginDesc * desc)
|
|||
plugin = g_new0 (GstPlugin, 1);
|
||||
if (gst_plugin_register_func (plugin, main_module, desc)) {
|
||||
if (GST_CAT_DEFAULT)
|
||||
GST_INFO ("loaded static plugin \"%s\"", desc->name);
|
||||
GST_INFO ("loaded static plugin \"%s\"", desc->name);
|
||||
gst_registry_pool_add_plugin (plugin);
|
||||
}
|
||||
}
|
||||
|
@ -176,21 +176,21 @@ gst_plugin_register_func (GstPlugin * plugin, GModule * module,
|
|||
if (!gst_plugin_check_version (desc->major_version, desc->minor_version)) {
|
||||
if (GST_CAT_DEFAULT)
|
||||
GST_INFO ("plugin \"%s\" has incompatible version, not loading",
|
||||
plugin->filename);
|
||||
plugin->filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!desc->license || !desc->description || !desc->package || !desc->origin) {
|
||||
if (GST_CAT_DEFAULT)
|
||||
GST_INFO ("plugin \"%s\" has incorrect GstPluginDesc, not loading",
|
||||
plugin->filename);
|
||||
plugin->filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_plugin_check_license (desc->license)) {
|
||||
if (GST_CAT_DEFAULT)
|
||||
GST_INFO ("plugin \"%s\" has invalid license \"%s\", not loading",
|
||||
plugin->filename, desc->license);
|
||||
plugin->filename, desc->license);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -300,15 +300,15 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
|||
|
||||
if (g_module_supported () == FALSE) {
|
||||
g_set_error (error,
|
||||
GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_MODULE, "Dynamic loading not supported");
|
||||
GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_MODULE, "Dynamic loading not supported");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (stat (filename, &file_status)) {
|
||||
g_set_error (error,
|
||||
GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_MODULE, "Problem opening file %s\n", filename);
|
||||
GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_MODULE, "Problem opening file %s\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -322,40 +322,40 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
|||
|
||||
plugin = gst_registry_pool_find_plugin (desc->name);
|
||||
if (!plugin) {
|
||||
free_plugin = TRUE;
|
||||
plugin = g_new0 (GstPlugin, 1);
|
||||
plugin->filename = g_strdup (filename);
|
||||
GST_DEBUG ("created new GstPlugin %p for file \"%s\"", plugin,
|
||||
filename);
|
||||
free_plugin = TRUE;
|
||||
plugin = g_new0 (GstPlugin, 1);
|
||||
plugin->filename = g_strdup (filename);
|
||||
GST_DEBUG ("created new GstPlugin %p for file \"%s\"", plugin,
|
||||
filename);
|
||||
} else {
|
||||
free_plugin = FALSE;
|
||||
if (gst_plugin_is_loaded (plugin)) {
|
||||
if (strcmp (plugin->filename, filename) != 0) {
|
||||
GST_WARNING
|
||||
("plugin %p from file \"%s\" with same name %s is already "
|
||||
"loaded, aborting loading of \"%s\"", plugin, plugin->filename,
|
||||
plugin->desc.name, filename);
|
||||
g_set_error (error, GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_NAME_MISMATCH,
|
||||
"already a plugin with name \"%s\" loaded", desc->name);
|
||||
if (free_plugin)
|
||||
g_free (plugin);
|
||||
return NULL;
|
||||
}
|
||||
GST_LOG ("Plugin %p for file \"%s\" already loaded, returning it now",
|
||||
plugin, filename);
|
||||
return plugin;
|
||||
}
|
||||
free_plugin = FALSE;
|
||||
if (gst_plugin_is_loaded (plugin)) {
|
||||
if (strcmp (plugin->filename, filename) != 0) {
|
||||
GST_WARNING
|
||||
("plugin %p from file \"%s\" with same name %s is already "
|
||||
"loaded, aborting loading of \"%s\"", plugin, plugin->filename,
|
||||
plugin->desc.name, filename);
|
||||
g_set_error (error, GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_NAME_MISMATCH,
|
||||
"already a plugin with name \"%s\" loaded", desc->name);
|
||||
if (free_plugin)
|
||||
g_free (plugin);
|
||||
return NULL;
|
||||
}
|
||||
GST_LOG ("Plugin %p for file \"%s\" already loaded, returning it now",
|
||||
plugin, filename);
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
GST_LOG ("Plugin %p for file \"%s\" prepared, calling entry function...",
|
||||
plugin, filename);
|
||||
plugin, filename);
|
||||
|
||||
if (g_module_symbol (module, "plugin_init", &ptr)) {
|
||||
g_print
|
||||
("plugin %p from file \"%s\" exports a symbol named plugin_init\n",
|
||||
plugin, plugin->filename);
|
||||
g_set_error (error, GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_NAME_MISMATCH,
|
||||
"plugin \"%s\" exports a symbol named plugin_init", desc->name);
|
||||
g_print
|
||||
("plugin %p from file \"%s\" exports a symbol named plugin_init\n",
|
||||
plugin, plugin->filename);
|
||||
g_set_error (error, GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_NAME_MISMATCH,
|
||||
"plugin \"%s\" exports a symbol named plugin_init", desc->name);
|
||||
}
|
||||
|
||||
/* this is where we load the actual .so, so let's trap SIGSEGV */
|
||||
|
@ -363,38 +363,38 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
|||
_gst_plugin_fault_handler_filename = plugin->filename;
|
||||
|
||||
if (gst_plugin_register_func (plugin, module, desc)) {
|
||||
/* remove signal handler */
|
||||
_gst_plugin_fault_handler_restore ();
|
||||
_gst_plugin_fault_handler_filename = NULL;
|
||||
GST_INFO ("plugin \"%s\" loaded", plugin->filename);
|
||||
return plugin;
|
||||
/* remove signal handler */
|
||||
_gst_plugin_fault_handler_restore ();
|
||||
_gst_plugin_fault_handler_filename = NULL;
|
||||
GST_INFO ("plugin \"%s\" loaded", plugin->filename);
|
||||
return plugin;
|
||||
} else {
|
||||
/* remove signal handler */
|
||||
_gst_plugin_fault_handler_restore ();
|
||||
GST_DEBUG ("gst_plugin_register_func failed for plugin \"%s\"",
|
||||
filename);
|
||||
/* plugin == NULL */
|
||||
g_set_error (error,
|
||||
GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_MODULE,
|
||||
"gst_plugin_register_func failed for plugin \"%s\"", filename);
|
||||
if (free_plugin)
|
||||
g_free (plugin);
|
||||
return NULL;
|
||||
/* remove signal handler */
|
||||
_gst_plugin_fault_handler_restore ();
|
||||
GST_DEBUG ("gst_plugin_register_func failed for plugin \"%s\"",
|
||||
filename);
|
||||
/* plugin == NULL */
|
||||
g_set_error (error,
|
||||
GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_MODULE,
|
||||
"gst_plugin_register_func failed for plugin \"%s\"", filename);
|
||||
if (free_plugin)
|
||||
g_free (plugin);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
GST_DEBUG ("Could not find plugin entry point in \"%s\"", filename);
|
||||
g_set_error (error,
|
||||
GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_MODULE,
|
||||
"Could not find plugin entry point in \"%s\"", filename);
|
||||
GST_PLUGIN_ERROR,
|
||||
GST_PLUGIN_ERROR_MODULE,
|
||||
"Could not find plugin entry point in \"%s\"", filename);
|
||||
}
|
||||
return NULL;
|
||||
} else {
|
||||
GST_DEBUG ("Error loading plugin %s, reason: %s\n", filename,
|
||||
g_module_error ());
|
||||
g_module_error ());
|
||||
g_set_error (error, GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE,
|
||||
"Error loading plugin %s, reason: %s\n", filename, g_module_error ());
|
||||
"Error loading plugin %s, reason: %s\n", filename, g_module_error ());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -454,11 +454,11 @@ gst_plugin_unload_plugin (GstPlugin * plugin)
|
|||
if (g_module_close (plugin->module)) {
|
||||
plugin->module = NULL;
|
||||
GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" unloaded",
|
||||
plugin->filename);
|
||||
plugin->filename);
|
||||
return TRUE;
|
||||
} else {
|
||||
GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "failed to unload plugin \"%s\"",
|
||||
plugin->filename);
|
||||
plugin->filename);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,10 @@ gst_plugin_feature_get_type (void)
|
|||
(GInstanceInitFunc) gst_plugin_feature_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
plugin_feature_type =
|
||||
g_type_register_static (G_TYPE_OBJECT, "GstPluginFeature",
|
||||
&plugin_feature_info, G_TYPE_FLAG_ABSTRACT);
|
||||
g_type_register_static (G_TYPE_OBJECT, "GstPluginFeature",
|
||||
&plugin_feature_info, G_TYPE_FLAG_ABSTRACT);
|
||||
}
|
||||
return plugin_feature_type;
|
||||
}
|
||||
|
@ -100,11 +101,11 @@ gst_plugin_feature_ensure_loaded (GstPluginFeature * feature)
|
|||
#ifndef GST_DISABLE_REGISTRY
|
||||
if (GST_IS_REGISTRY (plugin->manager)) {
|
||||
GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING,
|
||||
"loading plugin %s for feature", plugin->desc.name);
|
||||
"loading plugin %s for feature", plugin->desc.name);
|
||||
|
||||
if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager),
|
||||
plugin) != GST_REGISTRY_OK)
|
||||
return FALSE;
|
||||
plugin) != GST_REGISTRY_OK)
|
||||
return FALSE;
|
||||
} else
|
||||
#endif /* GST_DISABLE_REGISTRY */
|
||||
return FALSE;
|
||||
|
@ -139,7 +140,7 @@ gst_plugin_feature_type_name_filter (GstPluginFeature * feature,
|
|||
{
|
||||
return ((data->type == 0 || data->type == G_OBJECT_TYPE (feature)) &&
|
||||
(data->name == NULL
|
||||
|| !strcmp (data->name, GST_PLUGIN_FEATURE_NAME (feature))));
|
||||
|| !strcmp (data->name, GST_PLUGIN_FEATURE_NAME (feature))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
static GList *_gst_queries = NULL;
|
||||
static GHashTable *_nick_to_query = NULL;
|
||||
static GHashTable *_query_type_to_nick = NULL;
|
||||
static gint _n_values = 1; /* we start from 1 because 0 reserved for NONE */
|
||||
static gint _n_values = 1; /* we start from 1 because 0 reserved for NONE */
|
||||
|
||||
static GstQueryTypeDefinition standard_definitions[] = {
|
||||
{GST_QUERY_TOTAL, "total", "Total length"},
|
||||
|
@ -55,7 +55,7 @@ _gst_query_type_initialize (void)
|
|||
while (standards->nick) {
|
||||
g_hash_table_insert (_nick_to_query, standards->nick, standards);
|
||||
g_hash_table_insert (_query_type_to_nick,
|
||||
GINT_TO_POINTER (standards->value), standards);
|
||||
GINT_TO_POINTER (standards->value), standards);
|
||||
|
||||
_gst_queries = g_list_append (_gst_queries, standards);
|
||||
standards++;
|
||||
|
|
472
gst/gstqueue.c
472
gst/gstqueue.c
|
@ -69,7 +69,8 @@ typedef struct _GstQueueEventResponse
|
|||
{
|
||||
GstEvent *event;
|
||||
gboolean ret, handled;
|
||||
} GstQueueEventResponse;
|
||||
}
|
||||
GstQueueEventResponse;
|
||||
|
||||
static void gst_queue_base_init (GstQueueClass * klass);
|
||||
static void gst_queue_class_init (GstQueueClass * klass);
|
||||
|
@ -106,6 +107,7 @@ queue_leaky_get_type (void)
|
|||
{GST_QUEUE_LEAK_DOWNSTREAM, "2", "Leaky on Downstream"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!queue_leaky_type) {
|
||||
queue_leaky_type = g_enum_register_static ("GstQueueLeaky", queue_leaky);
|
||||
}
|
||||
|
@ -135,7 +137,7 @@ gst_queue_get_type (void)
|
|||
};
|
||||
|
||||
queue_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstQueue", &queue_info, 0);
|
||||
"GstQueue", &queue_info, 0);
|
||||
}
|
||||
|
||||
return queue_type;
|
||||
|
@ -174,56 +176,56 @@ gst_queue_class_init (GstQueueClass * klass)
|
|||
/* properties */
|
||||
g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_BYTES,
|
||||
g_param_spec_uint ("current-level-bytes", "Current level (kB)",
|
||||
"Current amount of data in the queue (bytes)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READABLE));
|
||||
"Current amount of data in the queue (bytes)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_BUFFERS,
|
||||
g_param_spec_uint ("current-level-buffers", "Current level (buffers)",
|
||||
"Current number of buffers in the queue",
|
||||
0, G_MAXUINT, 0, G_PARAM_READABLE));
|
||||
"Current number of buffers in the queue",
|
||||
0, G_MAXUINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_TIME,
|
||||
g_param_spec_uint64 ("current-level-time", "Current level (ns)",
|
||||
"Current amount of data in the queue (in ns)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READABLE));
|
||||
"Current amount of data in the queue (in ns)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_MAX_SIZE_BYTES,
|
||||
g_param_spec_uint ("max-size-bytes", "Max. size (kB)",
|
||||
"Max. amount of data in the queue (bytes, 0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
"Max. amount of data in the queue (bytes, 0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MAX_SIZE_BUFFERS,
|
||||
g_param_spec_uint ("max-size-buffers", "Max. size (buffers)",
|
||||
"Max. number of buffers in the queue (0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
"Max. number of buffers in the queue (0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MAX_SIZE_TIME,
|
||||
g_param_spec_uint64 ("max-size-time", "Max. size (ns)",
|
||||
"Max. amount of data in the queue (in ns, 0=disable)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
"Max. amount of data in the queue (in ns, 0=disable)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_BYTES,
|
||||
g_param_spec_uint ("min-threshold-bytes", "Min. threshold (kB)",
|
||||
"Min. amount of data in the queue to allow reading (bytes, 0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
"Min. amount of data in the queue to allow reading (bytes, 0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_BUFFERS,
|
||||
g_param_spec_uint ("min-threshold-buffers", "Min. threshold (buffers)",
|
||||
"Min. number of buffers in the queue to allow reading (0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
"Min. number of buffers in the queue to allow reading (0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_TIME,
|
||||
g_param_spec_uint64 ("min-threshold-time", "Min. threshold (ns)",
|
||||
"Min. amount of data in the queue to allow reading (in ns, 0=disable)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
"Min. amount of data in the queue to allow reading (in ns, 0=disable)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_LEAKY,
|
||||
g_param_spec_enum ("leaky", "Leaky",
|
||||
"Where the queue leaks, if at all",
|
||||
GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, G_PARAM_READWRITE));
|
||||
"Where the queue leaks, if at all",
|
||||
GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MAY_DEADLOCK,
|
||||
g_param_spec_boolean ("may_deadlock", "May Deadlock",
|
||||
"The queue may deadlock if it's full and not PLAYING",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"The queue may deadlock if it's full and not PLAYING",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_BLOCK_TIMEOUT,
|
||||
g_param_spec_uint64 ("block_timeout", "Timeout for Block",
|
||||
"Nanoseconds until blocked queue times out and returns filler event. "
|
||||
"Value of -1 disables timeout",
|
||||
0, G_MAXUINT64, -1, G_PARAM_READWRITE));
|
||||
"Nanoseconds until blocked queue times out and returns filler event. "
|
||||
"Value of -1 disables timeout",
|
||||
0, G_MAXUINT64, -1, G_PARAM_READWRITE));
|
||||
|
||||
/* set several parent class virtual functions */
|
||||
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_queue_dispose);
|
||||
|
@ -261,15 +263,15 @@ gst_queue_init (GstQueue * queue)
|
|||
GST_DEBUG_FUNCPTR (gst_queue_handle_src_event));
|
||||
gst_pad_set_active (queue->srcpad, TRUE);
|
||||
|
||||
queue->cur_level.buffers = 0; /* no content */
|
||||
queue->cur_level.bytes = 0; /* no content */
|
||||
queue->cur_level.time = 0; /* no content */
|
||||
queue->max_size.buffers = 100; /* 100 buffers */
|
||||
queue->max_size.bytes = 10 * 1024 * 1024; /* 10 MB */
|
||||
queue->max_size.time = GST_SECOND; /* 1 s. */
|
||||
queue->min_threshold.buffers = 0; /* no threshold */
|
||||
queue->min_threshold.bytes = 0; /* no threshold */
|
||||
queue->min_threshold.time = 0; /* no threshold */
|
||||
queue->cur_level.buffers = 0; /* no content */
|
||||
queue->cur_level.bytes = 0; /* no content */
|
||||
queue->cur_level.time = 0; /* no content */
|
||||
queue->max_size.buffers = 100; /* 100 buffers */
|
||||
queue->max_size.bytes = 10 * 1024 * 1024; /* 10 MB */
|
||||
queue->max_size.time = GST_SECOND; /* 1 s. */
|
||||
queue->min_threshold.buffers = 0; /* no threshold */
|
||||
queue->min_threshold.bytes = 0; /* no threshold */
|
||||
queue->min_threshold.time = 0; /* no threshold */
|
||||
|
||||
queue->leaky = GST_QUEUE_NO_LEAK;
|
||||
queue->may_deadlock = TRUE;
|
||||
|
@ -437,163 +439,163 @@ restart:
|
|||
if (GST_IS_EVENT (data)) {
|
||||
switch (GST_EVENT_TYPE (data)) {
|
||||
case GST_EVENT_FLUSH:
|
||||
STATUS (queue, "received flush event");
|
||||
gst_queue_locked_flush (queue);
|
||||
STATUS (queue, "after flush");
|
||||
break;
|
||||
STATUS (queue, "received flush event");
|
||||
gst_queue_locked_flush (queue);
|
||||
STATUS (queue, "after flush");
|
||||
break;
|
||||
case GST_EVENT_EOS:
|
||||
STATUS (queue, "received EOS");
|
||||
break;
|
||||
STATUS (queue, "received EOS");
|
||||
break;
|
||||
default:
|
||||
/* we put the event in the queue, we don't have to act ourselves */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding event %p of type %d", data, GST_EVENT_TYPE (data));
|
||||
break;
|
||||
/* we put the event in the queue, we don't have to act ourselves */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding event %p of type %d", data, GST_EVENT_TYPE (data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GST_IS_BUFFER (data))
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding buffer %p of size %d", data, GST_BUFFER_SIZE (data));
|
||||
"adding buffer %p of size %d", data, GST_BUFFER_SIZE (data));
|
||||
|
||||
/* We make space available if we're "full" according to whatever
|
||||
* the user defined as "full". Note that this only applies to buffers.
|
||||
* We always handle events and they don't count in our statistics. */
|
||||
if (GST_IS_BUFFER (data) &&
|
||||
((queue->max_size.buffers > 0 &&
|
||||
queue->cur_level.buffers >= queue->max_size.buffers) ||
|
||||
(queue->max_size.bytes > 0 &&
|
||||
queue->cur_level.bytes >= queue->max_size.bytes) ||
|
||||
(queue->max_size.time > 0 &&
|
||||
queue->cur_level.time >= queue->max_size.time))) {
|
||||
queue->cur_level.buffers >= queue->max_size.buffers) ||
|
||||
(queue->max_size.bytes > 0 &&
|
||||
queue->cur_level.bytes >= queue->max_size.bytes) ||
|
||||
(queue->max_size.time > 0 &&
|
||||
queue->cur_level.time >= queue->max_size.time))) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0);
|
||||
g_mutex_lock (queue->qlock);
|
||||
|
||||
/* how are we going to make space for this buffer? */
|
||||
switch (queue->leaky) {
|
||||
/* leak current buffer */
|
||||
/* leak current buffer */
|
||||
case GST_QUEUE_LEAK_UPSTREAM:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue is full, leaking buffer on upstream end");
|
||||
/* now we can clean up and exit right away */
|
||||
g_mutex_unlock (queue->qlock);
|
||||
goto out_unref;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue is full, leaking buffer on upstream end");
|
||||
/* now we can clean up and exit right away */
|
||||
g_mutex_unlock (queue->qlock);
|
||||
goto out_unref;
|
||||
|
||||
/* leak first buffer in the queue */
|
||||
/* leak first buffer in the queue */
|
||||
case GST_QUEUE_LEAK_DOWNSTREAM:{
|
||||
/* this is a bit hacky. We'll manually iterate the list
|
||||
* and find the first buffer from the head on. We'll
|
||||
* unref that and "fix up" the GQueue object... */
|
||||
GList *item;
|
||||
GstData *leak = NULL;
|
||||
/* this is a bit hacky. We'll manually iterate the list
|
||||
* and find the first buffer from the head on. We'll
|
||||
* unref that and "fix up" the GQueue object... */
|
||||
GList *item;
|
||||
GstData *leak = NULL;
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue is full, leaking buffer on downstream end");
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue is full, leaking buffer on downstream end");
|
||||
|
||||
for (item = queue->queue->head; item != NULL; item = item->next) {
|
||||
if (GST_IS_BUFFER (item->data)) {
|
||||
leak = item->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (item = queue->queue->head; item != NULL; item = item->next) {
|
||||
if (GST_IS_BUFFER (item->data)) {
|
||||
leak = item->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we didn't find anything, it means we have no buffers
|
||||
* in here. That cannot happen, since we had >= 1 bufs */
|
||||
g_assert (leak);
|
||||
/* if we didn't find anything, it means we have no buffers
|
||||
* in here. That cannot happen, since we had >= 1 bufs */
|
||||
g_assert (leak);
|
||||
|
||||
/* Now remove it from the list, fixing up the GQueue
|
||||
* CHECKME: is a queue->head the first or the last item? */
|
||||
item = g_list_delete_link (queue->queue->head, item);
|
||||
queue->queue->head = g_list_first (item);
|
||||
queue->queue->tail = g_list_last (item);
|
||||
queue->queue->length--;
|
||||
/* Now remove it from the list, fixing up the GQueue
|
||||
* CHECKME: is a queue->head the first or the last item? */
|
||||
item = g_list_delete_link (queue->queue->head, item);
|
||||
queue->queue->head = g_list_first (item);
|
||||
queue->queue->tail = g_list_last (item);
|
||||
queue->queue->length--;
|
||||
|
||||
/* and unref the data at the end. Twice, because we keep a ref
|
||||
* to make things read-only. Also keep our list uptodate. */
|
||||
queue->cur_level.bytes -= GST_BUFFER_SIZE (data);
|
||||
queue->cur_level.buffers--;
|
||||
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
|
||||
queue->cur_level.time -= GST_BUFFER_DURATION (data);
|
||||
/* and unref the data at the end. Twice, because we keep a ref
|
||||
* to make things read-only. Also keep our list uptodate. */
|
||||
queue->cur_level.bytes -= GST_BUFFER_SIZE (data);
|
||||
queue->cur_level.buffers--;
|
||||
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
|
||||
queue->cur_level.time -= GST_BUFFER_DURATION (data);
|
||||
|
||||
gst_data_unref (data);
|
||||
gst_data_unref (data);
|
||||
break;
|
||||
gst_data_unref (data);
|
||||
gst_data_unref (data);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
g_warning ("Unknown leaky type, using default");
|
||||
/* fall-through */
|
||||
g_warning ("Unknown leaky type, using default");
|
||||
/* fall-through */
|
||||
|
||||
/* don't leak. Instead, wait for space to be available */
|
||||
/* don't leak. Instead, wait for space to be available */
|
||||
case GST_QUEUE_NO_LEAK:
|
||||
STATUS (queue, "pre-full wait");
|
||||
STATUS (queue, "pre-full wait");
|
||||
|
||||
while ((queue->max_size.buffers > 0 &&
|
||||
queue->cur_level.buffers >= queue->max_size.buffers) ||
|
||||
(queue->max_size.bytes > 0 &&
|
||||
queue->cur_level.bytes >= queue->max_size.bytes) ||
|
||||
(queue->max_size.time > 0 &&
|
||||
queue->cur_level.time >= queue->max_size.time)) {
|
||||
/* if there's a pending state change for this queue
|
||||
* or its manager, switch back to iterator so bottom
|
||||
* half of state change executes */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad),
|
||||
GST_ELEMENT (queue))) {
|
||||
goto out_unref;
|
||||
}
|
||||
/* if we got here because we were unlocked after a
|
||||
* flush, we don't need to add the buffer to the
|
||||
* queue again */
|
||||
if (queue->flush) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"not adding pending buffer after flush");
|
||||
goto out_unref;
|
||||
}
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding pending buffer after interrupt");
|
||||
goto restart;
|
||||
}
|
||||
while ((queue->max_size.buffers > 0 &&
|
||||
queue->cur_level.buffers >= queue->max_size.buffers) ||
|
||||
(queue->max_size.bytes > 0 &&
|
||||
queue->cur_level.bytes >= queue->max_size.bytes) ||
|
||||
(queue->max_size.time > 0 &&
|
||||
queue->cur_level.time >= queue->max_size.time)) {
|
||||
/* if there's a pending state change for this queue
|
||||
* or its manager, switch back to iterator so bottom
|
||||
* half of state change executes */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad),
|
||||
GST_ELEMENT (queue))) {
|
||||
goto out_unref;
|
||||
}
|
||||
/* if we got here because we were unlocked after a
|
||||
* flush, we don't need to add the buffer to the
|
||||
* queue again */
|
||||
if (queue->flush) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"not adding pending buffer after flush");
|
||||
goto out_unref;
|
||||
}
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding pending buffer after interrupt");
|
||||
goto restart;
|
||||
}
|
||||
|
||||
if (GST_STATE (queue) != GST_STATE_PLAYING) {
|
||||
/* this means the other end is shut down. Try to
|
||||
* signal to resolve the error */
|
||||
if (!queue->may_deadlock) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
gst_data_unref (data);
|
||||
GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL),
|
||||
("deadlock found, shutting down source pad elements"));
|
||||
/* we don't go to out_unref here, since we want to
|
||||
* unref the buffer *before* calling GST_ELEMENT_ERROR */
|
||||
return;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
}
|
||||
if (GST_STATE (queue) != GST_STATE_PLAYING) {
|
||||
/* this means the other end is shut down. Try to
|
||||
* signal to resolve the error */
|
||||
if (!queue->may_deadlock) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
gst_data_unref (data);
|
||||
GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL),
|
||||
("deadlock found, shutting down source pad elements"));
|
||||
/* we don't go to out_unref here, since we want to
|
||||
* unref the buffer *before* calling GST_ELEMENT_ERROR */
|
||||
return;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
}
|
||||
|
||||
/* OK, we've got a serious issue here. Imagine the situation
|
||||
* where the puller (next element) is sending an event here,
|
||||
* so it cannot pull events from the queue, and we cannot
|
||||
* push data further because the queue is 'full' and therefore,
|
||||
* we wait here (and do not handle events): deadlock! to solve
|
||||
* that, we handle pending upstream events here, too. */
|
||||
gst_queue_handle_pending_events (queue);
|
||||
/* OK, we've got a serious issue here. Imagine the situation
|
||||
* where the puller (next element) is sending an event here,
|
||||
* so it cannot pull events from the queue, and we cannot
|
||||
* push data further because the queue is 'full' and therefore,
|
||||
* we wait here (and do not handle events): deadlock! to solve
|
||||
* that, we handle pending upstream events here, too. */
|
||||
gst_queue_handle_pending_events (queue);
|
||||
|
||||
STATUS (queue, "waiting for item_del signal");
|
||||
g_cond_wait (queue->item_del, queue->qlock);
|
||||
STATUS (queue, "received item_del signal");
|
||||
}
|
||||
STATUS (queue, "waiting for item_del signal");
|
||||
g_cond_wait (queue->item_del, queue->qlock);
|
||||
STATUS (queue, "received item_del signal");
|
||||
}
|
||||
|
||||
STATUS (queue, "post-full wait");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_RUNNING], 0);
|
||||
g_mutex_lock (queue->qlock);
|
||||
break;
|
||||
STATUS (queue, "post-full wait");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_RUNNING], 0);
|
||||
g_mutex_lock (queue->qlock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,63 +647,63 @@ restart:
|
|||
|
||||
if (queue->queue->length == 0 ||
|
||||
(queue->min_threshold.buffers > 0 &&
|
||||
queue->cur_level.buffers < queue->min_threshold.buffers) ||
|
||||
queue->cur_level.buffers < queue->min_threshold.buffers) ||
|
||||
(queue->min_threshold.bytes > 0 &&
|
||||
queue->cur_level.bytes < queue->min_threshold.bytes) ||
|
||||
queue->cur_level.bytes < queue->min_threshold.bytes) ||
|
||||
(queue->min_threshold.time > 0 &&
|
||||
queue->cur_level.time < queue->min_threshold.time)) {
|
||||
queue->cur_level.time < queue->min_threshold.time)) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_UNDERRUN], 0);
|
||||
g_mutex_lock (queue->qlock);
|
||||
|
||||
STATUS (queue, "pre-empty wait");
|
||||
while (queue->queue->length == 0 ||
|
||||
(queue->min_threshold.buffers > 0 &&
|
||||
queue->cur_level.buffers < queue->min_threshold.buffers) ||
|
||||
(queue->min_threshold.bytes > 0 &&
|
||||
queue->cur_level.bytes < queue->min_threshold.bytes) ||
|
||||
(queue->min_threshold.time > 0 &&
|
||||
queue->cur_level.time < queue->min_threshold.time)) {
|
||||
(queue->min_threshold.buffers > 0 &&
|
||||
queue->cur_level.buffers < queue->min_threshold.buffers) ||
|
||||
(queue->min_threshold.bytes > 0 &&
|
||||
queue->cur_level.bytes < queue->min_threshold.bytes) ||
|
||||
(queue->min_threshold.time > 0 &&
|
||||
queue->cur_level.time < queue->min_threshold.time)) {
|
||||
/* if there's a pending state change for this queue or its
|
||||
* manager, switch back to iterator so bottom half of state
|
||||
* change executes. */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad),
|
||||
GST_ELEMENT (queue)))
|
||||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
||||
goto restart;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad),
|
||||
GST_ELEMENT (queue)))
|
||||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
||||
goto restart;
|
||||
}
|
||||
if (GST_STATE (queue) != GST_STATE_PLAYING) {
|
||||
/* this means the other end is shut down */
|
||||
if (!queue->may_deadlock) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL),
|
||||
("deadlock found, shutting down sink pad elements"));
|
||||
goto restart;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
/* this means the other end is shut down */
|
||||
if (!queue->may_deadlock) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL),
|
||||
("deadlock found, shutting down sink pad elements"));
|
||||
goto restart;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
}
|
||||
|
||||
STATUS (queue, "waiting for item_add");
|
||||
|
||||
if (queue->block_timeout != GST_CLOCK_TIME_NONE) {
|
||||
GTimeVal timeout;
|
||||
GTimeVal timeout;
|
||||
|
||||
g_get_current_time (&timeout);
|
||||
g_time_val_add (&timeout, queue->block_timeout / 1000);
|
||||
if (!g_cond_timed_wait (queue->item_add, queue->qlock, &timeout)) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"Sending filler event");
|
||||
return GST_DATA (gst_event_new_filler ());
|
||||
}
|
||||
g_get_current_time (&timeout);
|
||||
g_time_val_add (&timeout, queue->block_timeout / 1000);
|
||||
if (!g_cond_timed_wait (queue->item_add, queue->qlock, &timeout)) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"Sending filler event");
|
||||
return GST_DATA (gst_event_new_filler ());
|
||||
}
|
||||
} else {
|
||||
g_cond_wait (queue->item_add, queue->qlock);
|
||||
g_cond_wait (queue->item_add, queue->qlock);
|
||||
}
|
||||
STATUS (queue, "got item_add signal");
|
||||
}
|
||||
|
@ -746,12 +748,12 @@ restart:
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue \"%s\" eos", GST_ELEMENT_NAME (queue));
|
||||
gst_element_set_eos (GST_ELEMENT (queue));
|
||||
break;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue \"%s\" eos", GST_ELEMENT_NAME (queue));
|
||||
gst_element_set_eos (GST_ELEMENT (queue));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -775,26 +777,26 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
er.handled = FALSE;
|
||||
g_queue_push_tail (queue->events, &er);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"Preparing for loop for event handler");
|
||||
"Preparing for loop for event handler");
|
||||
/* see the chain function on why this is here - it prevents a deadlock */
|
||||
g_cond_signal (queue->item_del);
|
||||
while (!er.handled) {
|
||||
GTimeVal timeout;
|
||||
|
||||
g_get_current_time (&timeout);
|
||||
g_time_val_add (&timeout, 500 * 1000); /* half a second */
|
||||
g_time_val_add (&timeout, 500 * 1000); /* half a second */
|
||||
if (!g_cond_timed_wait (queue->event_done, queue->qlock, &timeout) &&
|
||||
!er.handled) {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"timeout in upstream event handling");
|
||||
/* remove ourselves from the pending list. Since we're
|
||||
* locked, others cannot reference this anymore. */
|
||||
queue->queue->head = g_list_remove (queue->queue->head, &er);
|
||||
queue->queue->head = g_list_first (queue->queue->head);
|
||||
queue->queue->tail = g_list_last (queue->queue->head);
|
||||
queue->queue->length--;
|
||||
res = FALSE;
|
||||
goto handled;
|
||||
!er.handled) {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"timeout in upstream event handling");
|
||||
/* remove ourselves from the pending list. Since we're
|
||||
* locked, others cannot reference this anymore. */
|
||||
queue->queue->head = g_list_remove (queue->queue->head, &er);
|
||||
queue->queue->head = g_list_first (queue->queue->head);
|
||||
queue->queue->tail = g_list_last (queue->queue->head);
|
||||
queue->queue->length--;
|
||||
res = FALSE;
|
||||
goto handled;
|
||||
}
|
||||
}
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue, "Event handled");
|
||||
|
@ -804,16 +806,16 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_FLUSH:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"FLUSH event, flushing queue\n");
|
||||
gst_queue_locked_flush (queue);
|
||||
break;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"FLUSH event, flushing queue\n");
|
||||
gst_queue_locked_flush (queue);
|
||||
break;
|
||||
case GST_EVENT_SEEK:
|
||||
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
|
||||
gst_queue_locked_flush (queue);
|
||||
}
|
||||
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
|
||||
gst_queue_locked_flush (queue);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
handled:
|
||||
|
@ -859,30 +861,30 @@ gst_queue_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
if (!GST_PAD_IS_LINKED (queue->sinkpad)) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue,
|
||||
"queue %s is not linked", GST_ELEMENT_NAME (queue));
|
||||
/* FIXME can this be? */
|
||||
g_cond_signal (queue->item_add);
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue,
|
||||
"queue %s is not linked", GST_ELEMENT_NAME (queue));
|
||||
/* FIXME can this be? */
|
||||
g_cond_signal (queue->item_add);
|
||||
|
||||
ret = GST_STATE_FAILURE;
|
||||
goto error;
|
||||
ret = GST_STATE_FAILURE;
|
||||
goto error;
|
||||
} else {
|
||||
GstScheduler *src_sched, *sink_sched;
|
||||
GstScheduler *src_sched, *sink_sched;
|
||||
|
||||
src_sched = gst_pad_get_scheduler (GST_PAD (queue->srcpad));
|
||||
sink_sched = gst_pad_get_scheduler (GST_PAD (queue->sinkpad));
|
||||
src_sched = gst_pad_get_scheduler (GST_PAD (queue->srcpad));
|
||||
sink_sched = gst_pad_get_scheduler (GST_PAD (queue->sinkpad));
|
||||
|
||||
if (src_sched == sink_sched) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue,
|
||||
"queue %s does not connect different schedulers",
|
||||
GST_ELEMENT_NAME (queue));
|
||||
if (src_sched == sink_sched) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue,
|
||||
"queue %s does not connect different schedulers",
|
||||
GST_ELEMENT_NAME (queue));
|
||||
|
||||
g_warning ("queue %s does not connect different schedulers",
|
||||
GST_ELEMENT_NAME (queue));
|
||||
g_warning ("queue %s does not connect different schedulers",
|
||||
GST_ELEMENT_NAME (queue));
|
||||
|
||||
ret = GST_STATE_FAILURE;
|
||||
goto error;
|
||||
}
|
||||
ret = GST_STATE_FAILURE;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
queue->interrupt = FALSE;
|
||||
break;
|
||||
|
|
|
@ -69,7 +69,7 @@ gst_registry_get_type (void)
|
|||
};
|
||||
|
||||
registry_type = g_type_register_static (G_TYPE_OBJECT, "GstRegistry",
|
||||
®istry_info, G_TYPE_FLAG_ABSTRACT);
|
||||
®istry_info, G_TYPE_FLAG_ABSTRACT);
|
||||
}
|
||||
return registry_type;
|
||||
}
|
||||
|
|
|
@ -306,8 +306,7 @@ gst_registry_pool_find_feature (const gchar * name, GType type)
|
|||
data.type = type;
|
||||
data.name = name;
|
||||
|
||||
walk =
|
||||
gst_registry_pool_feature_filter ((GstPluginFeatureFilter)
|
||||
walk = gst_registry_pool_feature_filter ((GstPluginFeatureFilter)
|
||||
gst_plugin_feature_type_name_filter, TRUE, &data);
|
||||
|
||||
if (walk)
|
||||
|
|
|
@ -55,8 +55,8 @@ gst_scheduler_get_type (void)
|
|||
};
|
||||
|
||||
_gst_scheduler_type =
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstScheduler",
|
||||
&scheduler_info, G_TYPE_FLAG_ABSTRACT);
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstScheduler",
|
||||
&scheduler_info, G_TYPE_FLAG_ABSTRACT);
|
||||
}
|
||||
return _gst_scheduler_type;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ gst_scheduler_add_element (GstScheduler * sched, GstElement * element)
|
|||
/* if it's already in this scheduler, don't bother doing anything */
|
||||
if (GST_ELEMENT_SCHED (element) == sched) {
|
||||
GST_CAT_DEBUG (GST_CAT_SCHEDULING, "element %s already in scheduler %p",
|
||||
GST_ELEMENT_NAME (element), sched);
|
||||
GST_ELEMENT_NAME (element), sched);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -239,12 +239,12 @@ gst_scheduler_add_element (GstScheduler * sched, GstElement * element)
|
|||
if (gst_element_provides_clock (element)) {
|
||||
sched->clock_providers = g_list_prepend (sched->clock_providers, element);
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "added clock provider %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
}
|
||||
if (gst_element_requires_clock (element)) {
|
||||
sched->clock_receivers = g_list_prepend (sched->clock_receivers, element);
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "added clock receiver %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
}
|
||||
|
||||
gst_element_set_scheduler (element, sched);
|
||||
|
@ -305,14 +305,14 @@ gst_scheduler_state_transition (GstScheduler * sched, GstElement * element,
|
|||
switch (transition) {
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
{
|
||||
GstClock *clock = gst_scheduler_get_clock (sched);
|
||||
GstClock *clock = gst_scheduler_get_clock (sched);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK,
|
||||
"scheduler READY to PAUSED clock is %p (%s)", clock,
|
||||
(clock ? GST_OBJECT_NAME (clock) : "nil"));
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK,
|
||||
"scheduler READY to PAUSED clock is %p (%s)", clock,
|
||||
(clock ? GST_OBJECT_NAME (clock) : "nil"));
|
||||
|
||||
gst_scheduler_set_clock (sched, clock);
|
||||
break;
|
||||
gst_scheduler_set_clock (sched, clock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ gst_scheduler_get_clock (GstScheduler * sched)
|
|||
clock = sched->clock;
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler using fixed clock %p (%s)", clock,
|
||||
(clock ? GST_OBJECT_NAME (clock) : "nil"));
|
||||
(clock ? GST_OBJECT_NAME (clock) : "nil"));
|
||||
} else {
|
||||
GList *schedulers = sched->schedulers;
|
||||
GList *providers = sched->clock_providers;
|
||||
|
@ -552,7 +552,7 @@ gst_scheduler_get_clock (GstScheduler * sched)
|
|||
|
||||
clock = gst_scheduler_get_clock (scheduler);
|
||||
if (clock)
|
||||
break;
|
||||
break;
|
||||
|
||||
schedulers = g_list_next (schedulers);
|
||||
}
|
||||
|
@ -623,8 +623,8 @@ gst_scheduler_set_clock (GstScheduler * sched, GstClock * clock)
|
|||
GstElement *element = GST_ELEMENT (receivers->data);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK,
|
||||
"scheduler setting clock %p (%s) on element %s", clock,
|
||||
(clock ? GST_OBJECT_NAME (clock) : "nil"), GST_ELEMENT_NAME (element));
|
||||
"scheduler setting clock %p (%s) on element %s", clock,
|
||||
(clock ? GST_OBJECT_NAME (clock) : "nil"), GST_ELEMENT_NAME (element));
|
||||
|
||||
gst_element_set_clock (element, clock);
|
||||
receivers = g_list_next (receivers);
|
||||
|
@ -633,8 +633,8 @@ gst_scheduler_set_clock (GstScheduler * sched, GstClock * clock)
|
|||
GstScheduler *scheduler = GST_SCHEDULER (schedulers->data);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK,
|
||||
"scheduler setting clock %p (%s) on scheduler %p", clock,
|
||||
(clock ? GST_OBJECT_NAME (clock) : "nil"), scheduler);
|
||||
"scheduler setting clock %p (%s) on scheduler %p", clock,
|
||||
(clock ? GST_OBJECT_NAME (clock) : "nil"), scheduler);
|
||||
gst_scheduler_set_clock (scheduler, clock);
|
||||
schedulers = g_list_next (schedulers);
|
||||
}
|
||||
|
@ -764,8 +764,9 @@ gst_scheduler_factory_get_type (void)
|
|||
(GInstanceInitFunc) gst_scheduler_factory_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
schedulerfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
|
||||
"GstSchedulerFactory", &schedulerfactory_info, 0);
|
||||
"GstSchedulerFactory", &schedulerfactory_info, 0);
|
||||
}
|
||||
return schedulerfactory_type;
|
||||
}
|
||||
|
@ -821,7 +822,7 @@ gst_scheduler_factory_new (const gchar * name, const gchar * longdesc,
|
|||
|
||||
if (!factory) {
|
||||
factory =
|
||||
GST_SCHEDULER_FACTORY (g_object_new (GST_TYPE_SCHEDULER_FACTORY, NULL));
|
||||
GST_SCHEDULER_FACTORY (g_object_new (GST_TYPE_SCHEDULER_FACTORY, NULL));
|
||||
GST_PLUGIN_FEATURE_NAME (factory) = g_strdup (name);
|
||||
} else {
|
||||
g_free (factory->longdesc);
|
||||
|
|
|
@ -60,11 +60,11 @@ gst_structure_get_type (void)
|
|||
|
||||
if (!gst_structure_type) {
|
||||
gst_structure_type = g_boxed_type_register_static ("GstStructure",
|
||||
(GBoxedCopyFunc) gst_structure_copy_conditional,
|
||||
(GBoxedFreeFunc) gst_structure_free);
|
||||
(GBoxedCopyFunc) gst_structure_copy_conditional,
|
||||
(GBoxedFreeFunc) gst_structure_free);
|
||||
|
||||
g_value_register_transform_func (gst_structure_type, G_TYPE_STRING,
|
||||
gst_structure_transform_to_string);
|
||||
gst_structure_transform_to_string);
|
||||
}
|
||||
|
||||
return gst_structure_type;
|
||||
|
@ -362,54 +362,54 @@ gst_structure_set_valist (GstStructure * structure,
|
|||
|
||||
switch (type) {
|
||||
case G_TYPE_INT:
|
||||
i = va_arg (varargs, int);
|
||||
i = va_arg (varargs, int);
|
||||
|
||||
g_value_init (&field.value, G_TYPE_INT);
|
||||
g_value_set_int (&field.value, i);
|
||||
break;
|
||||
g_value_init (&field.value, G_TYPE_INT);
|
||||
g_value_set_int (&field.value, i);
|
||||
break;
|
||||
case G_TYPE_DOUBLE:
|
||||
d = va_arg (varargs, double);
|
||||
d = va_arg (varargs, double);
|
||||
|
||||
g_value_init (&field.value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (&field.value, d);
|
||||
break;
|
||||
g_value_init (&field.value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (&field.value, d);
|
||||
break;
|
||||
case G_TYPE_BOOLEAN:
|
||||
i = va_arg (varargs, int);
|
||||
i = va_arg (varargs, int);
|
||||
|
||||
g_value_init (&field.value, G_TYPE_BOOLEAN);
|
||||
g_value_set_boolean (&field.value, i);
|
||||
break;
|
||||
g_value_init (&field.value, G_TYPE_BOOLEAN);
|
||||
g_value_set_boolean (&field.value, i);
|
||||
break;
|
||||
case G_TYPE_STRING:
|
||||
s = va_arg (varargs, char *);
|
||||
s = va_arg (varargs, char *);
|
||||
|
||||
g_value_init (&field.value, G_TYPE_STRING);
|
||||
g_value_set_string (&field.value, s);
|
||||
break;
|
||||
g_value_init (&field.value, G_TYPE_STRING);
|
||||
g_value_set_string (&field.value, s);
|
||||
break;
|
||||
default:
|
||||
if (type == GST_TYPE_FOURCC) {
|
||||
i = va_arg (varargs, int);
|
||||
if (type == GST_TYPE_FOURCC) {
|
||||
i = va_arg (varargs, int);
|
||||
|
||||
g_value_init (&field.value, GST_TYPE_FOURCC);
|
||||
gst_value_set_fourcc (&field.value, i);
|
||||
} else if (type == GST_TYPE_INT_RANGE) {
|
||||
int min, max;
|
||||
min = va_arg (varargs, int);
|
||||
max = va_arg (varargs, int);
|
||||
g_value_init (&field.value, GST_TYPE_FOURCC);
|
||||
gst_value_set_fourcc (&field.value, i);
|
||||
} else if (type == GST_TYPE_INT_RANGE) {
|
||||
int min, max;
|
||||
min = va_arg (varargs, int);
|
||||
max = va_arg (varargs, int);
|
||||
|
||||
g_value_init (&field.value, GST_TYPE_INT_RANGE);
|
||||
gst_value_set_int_range (&field.value, min, max);
|
||||
} else if (type == GST_TYPE_DOUBLE_RANGE) {
|
||||
double min, max;
|
||||
min = va_arg (varargs, double);
|
||||
max = va_arg (varargs, double);
|
||||
g_value_init (&field.value, GST_TYPE_INT_RANGE);
|
||||
gst_value_set_int_range (&field.value, min, max);
|
||||
} else if (type == GST_TYPE_DOUBLE_RANGE) {
|
||||
double min, max;
|
||||
min = va_arg (varargs, double);
|
||||
max = va_arg (varargs, double);
|
||||
|
||||
g_value_init (&field.value, GST_TYPE_DOUBLE_RANGE);
|
||||
gst_value_set_double_range (&field.value, min, max);
|
||||
} else {
|
||||
g_critical ("unimplemented vararg field type %d\n", (int) type);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
g_value_init (&field.value, GST_TYPE_DOUBLE_RANGE);
|
||||
gst_value_set_double_range (&field.value, min, max);
|
||||
} else {
|
||||
g_critical ("unimplemented vararg field type %d\n", (int) type);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
gst_structure_set_field (structure, &field);
|
||||
|
@ -573,7 +573,7 @@ gst_structure_remove_field (GstStructure * structure, const gchar * fieldname)
|
|||
|
||||
if (field->name == id) {
|
||||
if (G_IS_VALUE (&field->value)) {
|
||||
g_value_unset (&field->value);
|
||||
g_value_unset (&field->value);
|
||||
}
|
||||
structure->fields = g_array_remove_index (structure->fields, i);
|
||||
return;
|
||||
|
@ -951,7 +951,8 @@ typedef struct _GstStructureAbbreviation
|
|||
{
|
||||
char *type_name;
|
||||
GType type;
|
||||
} GstStructureAbbreviation;
|
||||
}
|
||||
GstStructureAbbreviation;
|
||||
|
||||
static GstStructureAbbreviation gst_structure_abbrs[] = {
|
||||
{"int", G_TYPE_INT},
|
||||
|
@ -1054,11 +1055,11 @@ gst_structure_to_string (const GstStructure * structure)
|
|||
GArray *array = g_value_peek_pointer (&field->value);
|
||||
|
||||
if (array->len > 0) {
|
||||
GValue *value = &g_array_index (array, GValue, 0);
|
||||
GValue *value = &g_array_index (array, GValue, 0);
|
||||
|
||||
type = G_VALUE_TYPE (value);
|
||||
type = G_VALUE_TYPE (value);
|
||||
} else {
|
||||
type = G_TYPE_INT;
|
||||
type = G_TYPE_INT;
|
||||
}
|
||||
} else if (G_VALUE_TYPE (&field->value) == GST_TYPE_INT_RANGE) {
|
||||
type = G_TYPE_INT;
|
||||
|
@ -1066,7 +1067,7 @@ gst_structure_to_string (const GstStructure * structure)
|
|||
type = G_TYPE_DOUBLE;
|
||||
}
|
||||
g_string_append_printf (s, ", %s=(%s)%s", g_quark_to_string (field->name),
|
||||
gst_structure_to_abbr (type), t);
|
||||
gst_structure_to_abbr (type), t);
|
||||
g_free (t);
|
||||
}
|
||||
return g_string_free (s, FALSE);
|
||||
|
@ -1171,10 +1172,10 @@ gst_structure_parse_range (gchar * s, gchar ** after, GValue * value,
|
|||
g_value_init (value, range_type);
|
||||
if (range_type == GST_TYPE_DOUBLE_RANGE) {
|
||||
gst_value_set_double_range (value, g_value_get_double (&value1),
|
||||
g_value_get_double (&value2));
|
||||
g_value_get_double (&value2));
|
||||
} else {
|
||||
gst_value_set_int_range (value, g_value_get_int (&value1),
|
||||
g_value_get_int (&value2));
|
||||
g_value_get_int (&value2));
|
||||
}
|
||||
|
||||
*after = s;
|
||||
|
@ -1351,11 +1352,11 @@ gst_structure_parse_value (gchar * str,
|
|||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
g_value_init (value, try_types[i]);
|
||||
ret = gst_value_deserialize (value, value_s);
|
||||
if (ret)
|
||||
break;
|
||||
g_value_unset (value);
|
||||
g_value_init (value, try_types[i]);
|
||||
ret = gst_value_deserialize (value, value_s);
|
||||
if (ret)
|
||||
break;
|
||||
g_value_unset (value);
|
||||
}
|
||||
} else {
|
||||
g_value_init (value, type);
|
||||
|
|
|
@ -63,8 +63,9 @@ gst_system_clock_get_type (void)
|
|||
(GInstanceInitFunc) gst_system_clock_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
clock_type = g_type_register_static (GST_TYPE_CLOCK, "GstSystemClock",
|
||||
&clock_info, 0);
|
||||
&clock_info, 0);
|
||||
}
|
||||
return clock_type;
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ gst_system_clock_wait (GstClock * clock, GstClockEntry * entry)
|
|||
|
||||
if (diff + clock->max_diff < 0) {
|
||||
GST_WARNING_OBJECT (clock, "clock is way behind: %" G_GINT64_FORMAT
|
||||
"s (max allowed is %" G_GINT64_FORMAT "s", -diff, clock->max_diff);
|
||||
"s (max allowed is %" G_GINT64_FORMAT "s", -diff, clock->max_diff);
|
||||
return GST_CLOCK_ENTRY_EARLY;
|
||||
}
|
||||
|
||||
|
|
77
gst/gsttag.c
77
gst/gsttag.c
|
@ -36,14 +36,15 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
GType type; /* type the data is in */
|
||||
GType type; /* type the data is in */
|
||||
|
||||
gchar *nick; /* translated name */
|
||||
gchar *blurb; /* translated description of type */
|
||||
gchar *nick; /* translated name */
|
||||
gchar *blurb; /* translated description of type */
|
||||
|
||||
GstTagMergeFunc merge_func; /* functions to merge the values */
|
||||
GstTagFlag flag; /* type of tag */
|
||||
} GstTagInfo;
|
||||
GstTagMergeFunc merge_func; /* functions to merge the values */
|
||||
GstTagFlag flag; /* type of tag */
|
||||
}
|
||||
GstTagInfo;
|
||||
|
||||
#define TAGLIST "taglist"
|
||||
static GQuark gst_tag_list_quark;
|
||||
|
@ -60,11 +61,11 @@ gst_tag_list_get_type (void)
|
|||
|
||||
if (_gst_tag_list_type == 0) {
|
||||
_gst_tag_list_type = g_boxed_type_register_static ("GstTagList",
|
||||
(GBoxedCopyFunc) gst_tag_list_copy, (GBoxedFreeFunc) gst_tag_list_free);
|
||||
(GBoxedCopyFunc) gst_tag_list_copy, (GBoxedFreeFunc) gst_tag_list_free);
|
||||
|
||||
#if 0
|
||||
g_value_register_transform_func (_gst_tag_list_type, G_TYPE_STRING,
|
||||
_gst_structure_transform_to_string);
|
||||
_gst_structure_transform_to_string);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,7 @@ _gst_tag_initialize (void)
|
|||
G_TYPE_STRING,
|
||||
_("album"),
|
||||
_("album containing this data"), gst_tag_merge_strings_with_comma);
|
||||
gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META, G_TYPE_UINT, /* FIXME: own data type for dates? */
|
||||
gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META, G_TYPE_UINT, /* FIXME: own data type for dates? */
|
||||
_("date"),
|
||||
_("date the data was created (in Julian calendar days)"), NULL);
|
||||
gst_tag_register (GST_TAG_GENRE, GST_TAG_FLAG_META,
|
||||
|
@ -136,7 +137,7 @@ _gst_tag_initialize (void)
|
|||
_
|
||||
("International Standard Recording Code - see http://www.ifpi.org/isrc/"),
|
||||
NULL);
|
||||
gst_tag_register (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META, G_TYPE_STRING, _("organization"), _("organization"), /* FIXME */
|
||||
gst_tag_register (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META, G_TYPE_STRING, _("organization"), _("organization"), /* FIXME */
|
||||
gst_tag_merge_strings_with_comma);
|
||||
gst_tag_register (GST_TAG_COPYRIGHT, GST_TAG_FLAG_META,
|
||||
G_TYPE_STRING, _("copyright"), _("copyright notice of the data"), NULL);
|
||||
|
@ -227,8 +228,8 @@ gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src)
|
|||
/* seperator between two string */
|
||||
str = g_string_append (str, _(", "));
|
||||
str =
|
||||
g_string_append (str, g_value_get_string (gst_value_list_get_value (src,
|
||||
1)));
|
||||
g_string_append (str, g_value_get_string (gst_value_list_get_value (src,
|
||||
1)));
|
||||
}
|
||||
|
||||
g_value_init (dest, G_TYPE_STRING);
|
||||
|
@ -439,7 +440,8 @@ typedef struct
|
|||
{
|
||||
GstStructure *list;
|
||||
GstTagMergeMode mode;
|
||||
} GstTagCopyData;
|
||||
}
|
||||
GstTagCopyData;
|
||||
static void
|
||||
gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode,
|
||||
GQuark tag, GValue * value)
|
||||
|
@ -452,45 +454,46 @@ gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode,
|
|||
if (info->merge_func
|
||||
&& (value2 = gst_structure_id_get_value (list, tag)) != NULL) {
|
||||
GValue dest = { 0, };
|
||||
|
||||
switch (mode) {
|
||||
case GST_TAG_MERGE_REPLACE_ALL:
|
||||
case GST_TAG_MERGE_REPLACE:
|
||||
gst_structure_id_set_value (list, tag, value);
|
||||
break;
|
||||
gst_structure_id_set_value (list, tag, value);
|
||||
break;
|
||||
case GST_TAG_MERGE_PREPEND:
|
||||
gst_value_list_concat (&dest, value, value2);
|
||||
gst_structure_id_set_value (list, tag, &dest);
|
||||
g_value_unset (&dest);
|
||||
break;
|
||||
gst_value_list_concat (&dest, value, value2);
|
||||
gst_structure_id_set_value (list, tag, &dest);
|
||||
g_value_unset (&dest);
|
||||
break;
|
||||
case GST_TAG_MERGE_APPEND:
|
||||
gst_value_list_concat (&dest, value2, value);
|
||||
gst_structure_id_set_value (list, tag, &dest);
|
||||
g_value_unset (&dest);
|
||||
break;
|
||||
gst_value_list_concat (&dest, value2, value);
|
||||
gst_structure_id_set_value (list, tag, &dest);
|
||||
g_value_unset (&dest);
|
||||
break;
|
||||
case GST_TAG_MERGE_KEEP:
|
||||
case GST_TAG_MERGE_KEEP_ALL:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (mode) {
|
||||
case GST_TAG_MERGE_APPEND:
|
||||
case GST_TAG_MERGE_KEEP:
|
||||
if (gst_structure_id_get_value (list, tag) != NULL)
|
||||
break;
|
||||
/* fall through */
|
||||
if (gst_structure_id_get_value (list, tag) != NULL)
|
||||
break;
|
||||
/* fall through */
|
||||
case GST_TAG_MERGE_REPLACE_ALL:
|
||||
case GST_TAG_MERGE_REPLACE:
|
||||
case GST_TAG_MERGE_PREPEND:
|
||||
gst_structure_id_set_value (list, tag, value);
|
||||
break;
|
||||
gst_structure_id_set_value (list, tag, value);
|
||||
break;
|
||||
case GST_TAG_MERGE_KEEP_ALL:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -690,6 +693,7 @@ gst_tag_list_add_valist (GstTagList * list, GstTagMergeMode mode,
|
|||
|
||||
while (tag != NULL) {
|
||||
GValue value = { 0, };
|
||||
|
||||
quark = g_quark_from_string (tag);
|
||||
info = gst_tag_lookup (quark);
|
||||
if (info == NULL)
|
||||
|
@ -736,7 +740,7 @@ gst_tag_list_add_valist_values (GstTagList * list, GstTagMergeMode mode,
|
|||
info = gst_tag_lookup (quark);
|
||||
g_return_if_fail (info != NULL);
|
||||
gst_tag_list_add_value_internal (list, mode, quark, va_arg (var_args,
|
||||
GValue *));
|
||||
GValue *));
|
||||
tag = va_arg (var_args, gchar *);
|
||||
}
|
||||
}
|
||||
|
@ -761,7 +765,8 @@ typedef struct
|
|||
GstTagForeachFunc func;
|
||||
GstTagList *tag_list;
|
||||
gpointer data;
|
||||
} TagForeachData;
|
||||
}
|
||||
TagForeachData;
|
||||
static int
|
||||
structure_foreach_wrapper (GQuark field_id, GValue * value, gpointer user_data)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,8 @@ typedef struct
|
|||
{
|
||||
GstTagMergeMode mode;
|
||||
GstTagList *list;
|
||||
} GstTagData;
|
||||
}
|
||||
GstTagData;
|
||||
|
||||
GType
|
||||
gst_tag_setter_get_type (void)
|
||||
|
@ -46,22 +47,22 @@ gst_tag_setter_get_type (void)
|
|||
|
||||
if (!tag_setter_type) {
|
||||
static const GTypeInfo tag_setter_info = {
|
||||
sizeof (GstTagSetterIFace), /* class_size */
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
sizeof (GstTagSetterIFace), /* class_size */
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0,
|
||||
NULL
|
||||
};
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_tag_interface_debug, "GstTagInterface", 0,
|
||||
"interfaces for tagging");
|
||||
"interfaces for tagging");
|
||||
|
||||
tag_setter_type = g_type_register_static (G_TYPE_INTERFACE, "GstTagSetter",
|
||||
&tag_setter_info, 0);
|
||||
&tag_setter_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (tag_setter_type, GST_TYPE_ELEMENT);
|
||||
|
||||
|
@ -91,7 +92,7 @@ gst_tag_setter_get_data (GstTagSetter * setter)
|
|||
data->list = NULL;
|
||||
data->mode = GST_TAG_MERGE_KEEP;
|
||||
g_object_set_qdata_full (G_OBJECT (setter), gst_tag_key, data,
|
||||
gst_tag_data_free);
|
||||
gst_tag_data_free);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
|
|
@ -36,14 +36,15 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
GType type; /* type the data is in */
|
||||
GType type; /* type the data is in */
|
||||
|
||||
gchar *nick; /* translated name */
|
||||
gchar *blurb; /* translated description of type */
|
||||
gchar *nick; /* translated name */
|
||||
gchar *blurb; /* translated description of type */
|
||||
|
||||
GstTagMergeFunc merge_func; /* functions to merge the values */
|
||||
GstTagFlag flag; /* type of tag */
|
||||
} GstTagInfo;
|
||||
GstTagMergeFunc merge_func; /* functions to merge the values */
|
||||
GstTagFlag flag; /* type of tag */
|
||||
}
|
||||
GstTagInfo;
|
||||
|
||||
#define TAGLIST "taglist"
|
||||
static GQuark gst_tag_list_quark;
|
||||
|
@ -60,11 +61,11 @@ gst_tag_list_get_type (void)
|
|||
|
||||
if (_gst_tag_list_type == 0) {
|
||||
_gst_tag_list_type = g_boxed_type_register_static ("GstTagList",
|
||||
(GBoxedCopyFunc) gst_tag_list_copy, (GBoxedFreeFunc) gst_tag_list_free);
|
||||
(GBoxedCopyFunc) gst_tag_list_copy, (GBoxedFreeFunc) gst_tag_list_free);
|
||||
|
||||
#if 0
|
||||
g_value_register_transform_func (_gst_tag_list_type, G_TYPE_STRING,
|
||||
_gst_structure_transform_to_string);
|
||||
_gst_structure_transform_to_string);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,7 @@ _gst_tag_initialize (void)
|
|||
G_TYPE_STRING,
|
||||
_("album"),
|
||||
_("album containing this data"), gst_tag_merge_strings_with_comma);
|
||||
gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META, G_TYPE_UINT, /* FIXME: own data type for dates? */
|
||||
gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META, G_TYPE_UINT, /* FIXME: own data type for dates? */
|
||||
_("date"),
|
||||
_("date the data was created (in Julian calendar days)"), NULL);
|
||||
gst_tag_register (GST_TAG_GENRE, GST_TAG_FLAG_META,
|
||||
|
@ -136,7 +137,7 @@ _gst_tag_initialize (void)
|
|||
_
|
||||
("International Standard Recording Code - see http://www.ifpi.org/isrc/"),
|
||||
NULL);
|
||||
gst_tag_register (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META, G_TYPE_STRING, _("organization"), _("organization"), /* FIXME */
|
||||
gst_tag_register (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META, G_TYPE_STRING, _("organization"), _("organization"), /* FIXME */
|
||||
gst_tag_merge_strings_with_comma);
|
||||
gst_tag_register (GST_TAG_COPYRIGHT, GST_TAG_FLAG_META,
|
||||
G_TYPE_STRING, _("copyright"), _("copyright notice of the data"), NULL);
|
||||
|
@ -227,8 +228,8 @@ gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src)
|
|||
/* seperator between two string */
|
||||
str = g_string_append (str, _(", "));
|
||||
str =
|
||||
g_string_append (str, g_value_get_string (gst_value_list_get_value (src,
|
||||
1)));
|
||||
g_string_append (str, g_value_get_string (gst_value_list_get_value (src,
|
||||
1)));
|
||||
}
|
||||
|
||||
g_value_init (dest, G_TYPE_STRING);
|
||||
|
@ -439,7 +440,8 @@ typedef struct
|
|||
{
|
||||
GstStructure *list;
|
||||
GstTagMergeMode mode;
|
||||
} GstTagCopyData;
|
||||
}
|
||||
GstTagCopyData;
|
||||
static void
|
||||
gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode,
|
||||
GQuark tag, GValue * value)
|
||||
|
@ -452,45 +454,46 @@ gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode,
|
|||
if (info->merge_func
|
||||
&& (value2 = gst_structure_id_get_value (list, tag)) != NULL) {
|
||||
GValue dest = { 0, };
|
||||
|
||||
switch (mode) {
|
||||
case GST_TAG_MERGE_REPLACE_ALL:
|
||||
case GST_TAG_MERGE_REPLACE:
|
||||
gst_structure_id_set_value (list, tag, value);
|
||||
break;
|
||||
gst_structure_id_set_value (list, tag, value);
|
||||
break;
|
||||
case GST_TAG_MERGE_PREPEND:
|
||||
gst_value_list_concat (&dest, value, value2);
|
||||
gst_structure_id_set_value (list, tag, &dest);
|
||||
g_value_unset (&dest);
|
||||
break;
|
||||
gst_value_list_concat (&dest, value, value2);
|
||||
gst_structure_id_set_value (list, tag, &dest);
|
||||
g_value_unset (&dest);
|
||||
break;
|
||||
case GST_TAG_MERGE_APPEND:
|
||||
gst_value_list_concat (&dest, value2, value);
|
||||
gst_structure_id_set_value (list, tag, &dest);
|
||||
g_value_unset (&dest);
|
||||
break;
|
||||
gst_value_list_concat (&dest, value2, value);
|
||||
gst_structure_id_set_value (list, tag, &dest);
|
||||
g_value_unset (&dest);
|
||||
break;
|
||||
case GST_TAG_MERGE_KEEP:
|
||||
case GST_TAG_MERGE_KEEP_ALL:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (mode) {
|
||||
case GST_TAG_MERGE_APPEND:
|
||||
case GST_TAG_MERGE_KEEP:
|
||||
if (gst_structure_id_get_value (list, tag) != NULL)
|
||||
break;
|
||||
/* fall through */
|
||||
if (gst_structure_id_get_value (list, tag) != NULL)
|
||||
break;
|
||||
/* fall through */
|
||||
case GST_TAG_MERGE_REPLACE_ALL:
|
||||
case GST_TAG_MERGE_REPLACE:
|
||||
case GST_TAG_MERGE_PREPEND:
|
||||
gst_structure_id_set_value (list, tag, value);
|
||||
break;
|
||||
gst_structure_id_set_value (list, tag, value);
|
||||
break;
|
||||
case GST_TAG_MERGE_KEEP_ALL:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -690,6 +693,7 @@ gst_tag_list_add_valist (GstTagList * list, GstTagMergeMode mode,
|
|||
|
||||
while (tag != NULL) {
|
||||
GValue value = { 0, };
|
||||
|
||||
quark = g_quark_from_string (tag);
|
||||
info = gst_tag_lookup (quark);
|
||||
if (info == NULL)
|
||||
|
@ -736,7 +740,7 @@ gst_tag_list_add_valist_values (GstTagList * list, GstTagMergeMode mode,
|
|||
info = gst_tag_lookup (quark);
|
||||
g_return_if_fail (info != NULL);
|
||||
gst_tag_list_add_value_internal (list, mode, quark, va_arg (var_args,
|
||||
GValue *));
|
||||
GValue *));
|
||||
tag = va_arg (var_args, gchar *);
|
||||
}
|
||||
}
|
||||
|
@ -761,7 +765,8 @@ typedef struct
|
|||
GstTagForeachFunc func;
|
||||
GstTagList *tag_list;
|
||||
gpointer data;
|
||||
} TagForeachData;
|
||||
}
|
||||
TagForeachData;
|
||||
static int
|
||||
structure_foreach_wrapper (GQuark field_id, GValue * value, gpointer user_data)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,8 @@ typedef struct
|
|||
{
|
||||
GstTagMergeMode mode;
|
||||
GstTagList *list;
|
||||
} GstTagData;
|
||||
}
|
||||
GstTagData;
|
||||
|
||||
GType
|
||||
gst_tag_setter_get_type (void)
|
||||
|
@ -46,22 +47,22 @@ gst_tag_setter_get_type (void)
|
|||
|
||||
if (!tag_setter_type) {
|
||||
static const GTypeInfo tag_setter_info = {
|
||||
sizeof (GstTagSetterIFace), /* class_size */
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
sizeof (GstTagSetterIFace), /* class_size */
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0,
|
||||
NULL
|
||||
};
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_tag_interface_debug, "GstTagInterface", 0,
|
||||
"interfaces for tagging");
|
||||
"interfaces for tagging");
|
||||
|
||||
tag_setter_type = g_type_register_static (G_TYPE_INTERFACE, "GstTagSetter",
|
||||
&tag_setter_info, 0);
|
||||
&tag_setter_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (tag_setter_type, GST_TYPE_ELEMENT);
|
||||
|
||||
|
@ -91,7 +92,7 @@ gst_tag_setter_get_data (GstTagSetter * setter)
|
|||
data->list = NULL;
|
||||
data->mode = GST_TAG_MERGE_KEEP;
|
||||
g_object_set_qdata_full (G_OBJECT (setter), gst_tag_key, data,
|
||||
gst_tag_data_free);
|
||||
gst_tag_data_free);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
|
104
gst/gstthread.c
104
gst/gstthread.c
|
@ -98,9 +98,10 @@ gst_thread_priority_get_type (void)
|
|||
{G_THREAD_PRIORITY_URGENT, "URGENT", "Urgent Scheduling"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!thread_priority_type) {
|
||||
thread_priority_type =
|
||||
g_enum_register_static ("GstThreadPriority", thread_priority);
|
||||
g_enum_register_static ("GstThreadPriority", thread_priority);
|
||||
}
|
||||
return thread_priority_type;
|
||||
}
|
||||
|
@ -127,8 +128,9 @@ gst_thread_get_type (void)
|
|||
gst_thread_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
thread_type = g_type_register_static (GST_TYPE_BIN, "GstThread",
|
||||
&thread_info, 0);
|
||||
&thread_info, 0);
|
||||
}
|
||||
return thread_type;
|
||||
}
|
||||
|
@ -163,8 +165,8 @@ gst_thread_class_init (gpointer g_class, gpointer class_data)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PRIORITY,
|
||||
g_param_spec_enum ("priority", "Scheduling Policy",
|
||||
"The scheduling priority of the thread", GST_TYPE_THREAD_PRIORITY,
|
||||
G_THREAD_PRIORITY_NORMAL, G_PARAM_READWRITE));
|
||||
"The scheduling priority of the thread", GST_TYPE_THREAD_PRIORITY,
|
||||
G_THREAD_PRIORITY_NORMAL, G_PARAM_READWRITE));
|
||||
|
||||
gst_thread_signals[SHUTDOWN] =
|
||||
g_signal_new ("shutdown", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -207,7 +209,7 @@ gst_thread_init (GTypeInstance * instance, gpointer g_class)
|
|||
thread->lock = g_mutex_new ();
|
||||
thread->cond = g_cond_new ();
|
||||
|
||||
thread->thread_id = (GThread *) NULL; /* set in NULL -> READY */
|
||||
thread->thread_id = (GThread *) NULL; /* set in NULL -> READY */
|
||||
thread->priority = G_THREAD_PRIORITY_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -321,39 +323,39 @@ gst_thread_release_children_locks (GstThread * thread)
|
|||
|
||||
g_assert (element);
|
||||
GST_DEBUG_OBJECT (thread, "waking element \"%s\"",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
elements = g_list_next (elements);
|
||||
|
||||
if (!gst_element_release_locks (element))
|
||||
g_warning ("element %s could not release locks",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
|
||||
pads = GST_ELEMENT_PADS (element);
|
||||
|
||||
while (pads) {
|
||||
if (GST_PAD_PEER (pads->data)) {
|
||||
peer = GST_REAL_PAD (GST_PAD_PEER (pads->data));
|
||||
pads = g_list_next (pads);
|
||||
peer = GST_REAL_PAD (GST_PAD_PEER (pads->data));
|
||||
pads = g_list_next (pads);
|
||||
} else {
|
||||
pads = g_list_next (pads);
|
||||
continue;
|
||||
pads = g_list_next (pads);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!peer)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
peerelement = GST_PAD_PARENT (peer);
|
||||
if (!peerelement)
|
||||
continue; /* FIXME: deal with case where there's no peer */
|
||||
continue; /* FIXME: deal with case where there's no peer */
|
||||
|
||||
if (GST_ELEMENT_SCHED (peerelement) != GST_ELEMENT_SCHED (thread)) {
|
||||
GST_LOG_OBJECT (thread, "element \"%s\" has pad cross sched boundary",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_LOG_OBJECT (thread, "waking element \"%s\"",
|
||||
GST_ELEMENT_NAME (peerelement));
|
||||
if (!gst_element_release_locks (peerelement))
|
||||
g_warning ("element %s could not release locks",
|
||||
GST_ELEMENT_NAME (peerelement));
|
||||
GST_LOG_OBJECT (thread, "element \"%s\" has pad cross sched boundary",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_LOG_OBJECT (thread, "waking element \"%s\"",
|
||||
GST_ELEMENT_NAME (peerelement));
|
||||
if (!gst_element_release_locks (peerelement))
|
||||
g_warning ("element %s could not release locks",
|
||||
GST_ELEMENT_NAME (peerelement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,7 +387,7 @@ gst_thread_catch (GstThread * thread)
|
|||
g_cond_signal (thread->cond);
|
||||
gst_thread_release_children_locks (thread);
|
||||
g_get_current_time (&tv);
|
||||
g_time_val_add (&tv, 1000); /* wait a millisecond to catch the thread */
|
||||
g_time_val_add (&tv, 1000); /* wait a millisecond to catch the thread */
|
||||
wait = g_cond_timed_wait (thread->cond, thread->lock, &tv);
|
||||
}
|
||||
GST_LOG_OBJECT (thread, "caught thread");
|
||||
|
@ -432,10 +434,10 @@ gst_thread_change_state (GstElement * element)
|
|||
/* create the thread */
|
||||
GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING);
|
||||
thread->thread_id = g_thread_create_full (gst_thread_main_loop,
|
||||
thread, STACK_SIZE, FALSE, TRUE, thread->priority, NULL);
|
||||
thread, STACK_SIZE, FALSE, TRUE, thread->priority, NULL);
|
||||
if (!thread->thread_id) {
|
||||
GST_ERROR_OBJECT (element, "g_thread_create_full failed");
|
||||
goto error_out;
|
||||
GST_ERROR_OBJECT (element, "g_thread_create_full failed");
|
||||
goto error_out;
|
||||
}
|
||||
GST_LOG_OBJECT (element, "GThread created");
|
||||
|
||||
|
@ -450,13 +452,13 @@ gst_thread_change_state (GstElement * element)
|
|||
GList *elements = (GList *) gst_bin_get_list (GST_BIN (thread));
|
||||
|
||||
while (elements) {
|
||||
gst_element_enable_threadsafe_properties ((GstElement *) elements->
|
||||
data);
|
||||
elements = g_list_next (elements);
|
||||
gst_element_enable_threadsafe_properties ((GstElement *) elements->
|
||||
data);
|
||||
elements = g_list_next (elements);
|
||||
}
|
||||
/* reset self to spinning */
|
||||
if (thread == gst_thread_get_current ())
|
||||
GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
|
||||
GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
|
||||
break;
|
||||
}
|
||||
case GST_STATE_PLAYING_TO_PAUSED:
|
||||
|
@ -464,9 +466,9 @@ gst_thread_change_state (GstElement * element)
|
|||
GList *elements = (GList *) gst_bin_get_list (GST_BIN (thread));
|
||||
|
||||
while (elements) {
|
||||
gst_element_disable_threadsafe_properties ((GstElement *) elements->
|
||||
data);
|
||||
elements = g_list_next (elements);
|
||||
gst_element_disable_threadsafe_properties ((GstElement *) elements->
|
||||
data);
|
||||
elements = g_list_next (elements);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -479,20 +481,20 @@ gst_thread_change_state (GstElement * element)
|
|||
GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
|
||||
thread->thread_id = NULL;
|
||||
if (thread == gst_thread_get_current ()) {
|
||||
/* or should we continue? */
|
||||
g_warning
|
||||
("Thread %s is destroying itself. Function call will not return!",
|
||||
GST_ELEMENT_NAME (thread));
|
||||
gst_scheduler_reset (GST_ELEMENT_SCHED (thread));
|
||||
/* or should we continue? */
|
||||
g_warning
|
||||
("Thread %s is destroying itself. Function call will not return!",
|
||||
GST_ELEMENT_NAME (thread));
|
||||
gst_scheduler_reset (GST_ELEMENT_SCHED (thread));
|
||||
|
||||
/* unlock and signal - we are out */
|
||||
gst_thread_release (thread);
|
||||
/* unlock and signal - we are out */
|
||||
gst_thread_release (thread);
|
||||
|
||||
GST_INFO_OBJECT (thread, "GThread %p is exiting", g_thread_self ());
|
||||
GST_INFO_OBJECT (thread, "GThread %p is exiting", g_thread_self ());
|
||||
|
||||
g_signal_emit (G_OBJECT (thread), gst_thread_signals[SHUTDOWN], 0);
|
||||
g_signal_emit (G_OBJECT (thread), gst_thread_signals[SHUTDOWN], 0);
|
||||
|
||||
g_thread_exit (NULL);
|
||||
g_thread_exit (NULL);
|
||||
}
|
||||
/* now wait for the thread to destroy itself */
|
||||
g_cond_signal (thread->cond);
|
||||
|
@ -501,10 +503,10 @@ gst_thread_change_state (GstElement * element)
|
|||
break;
|
||||
default:
|
||||
GST_ERROR_OBJECT (element, "unhandled state change! %x",
|
||||
GST_STATE_TRANSITION (element));
|
||||
GST_STATE_TRANSITION (element));
|
||||
g_warning ("thread %s: UNHANDLED STATE CHANGE! %x",
|
||||
GST_STR_NULL (GST_OBJECT_NAME (element)),
|
||||
GST_STATE_TRANSITION (element));
|
||||
GST_STR_NULL (GST_OBJECT_NAME (element)),
|
||||
GST_STATE_TRANSITION (element));
|
||||
/* FIXME: not doable with current threading mess:
|
||||
g_assert_not_reached ();
|
||||
*/
|
||||
|
@ -581,13 +583,13 @@ gst_thread_main_loop (void *arg)
|
|||
status = TRUE;
|
||||
GST_LOG_OBJECT (thread, "starting to iterate");
|
||||
while (status && GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)) {
|
||||
g_mutex_unlock (thread->lock);
|
||||
status = gst_bin_iterate (GST_BIN (thread));
|
||||
if (GST_FLAG_IS_SET (thread, GST_THREAD_MUTEX_LOCKED)) {
|
||||
GST_FLAG_UNSET (thread, GST_THREAD_MUTEX_LOCKED);
|
||||
} else {
|
||||
g_mutex_lock (thread->lock);
|
||||
}
|
||||
g_mutex_unlock (thread->lock);
|
||||
status = gst_bin_iterate (GST_BIN (thread));
|
||||
if (GST_FLAG_IS_SET (thread, GST_THREAD_MUTEX_LOCKED)) {
|
||||
GST_FLAG_UNSET (thread, GST_THREAD_MUTEX_LOCKED);
|
||||
} else {
|
||||
g_mutex_lock (thread->lock);
|
||||
}
|
||||
}
|
||||
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ gst_mutex_new_dummy_impl (void)
|
|||
|
||||
static void
|
||||
gst_mutex_dummy_impl (GMutex * mutex)
|
||||
{ /* NOP */
|
||||
{ /* NOP */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -56,7 +56,7 @@ gst_cond_new_dummy_impl (void)
|
|||
|
||||
static void
|
||||
gst_cond_dummy_impl (GCond * cond)
|
||||
{ /* NOP */
|
||||
{ /* NOP */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -118,17 +118,17 @@ gst_thread_create_dummy_impl (GThreadFunc func, gpointer data,
|
|||
|
||||
static void
|
||||
gst_thread_dummy_impl (void)
|
||||
{ /* NOP */
|
||||
{ /* NOP */
|
||||
}
|
||||
|
||||
static void
|
||||
gst_thread_dummy_impl_1 (gpointer thread)
|
||||
{ /* NOP */
|
||||
{ /* NOP */
|
||||
}
|
||||
|
||||
static void
|
||||
gst_thread_set_priority_dummy_impl (gpointer thread, GThreadPriority priority)
|
||||
{ /* NOP */
|
||||
{ /* NOP */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -138,23 +138,24 @@ gst_thread_equal_dummy_impl (gpointer thread1, gpointer thread2)
|
|||
}
|
||||
|
||||
GThreadFunctions gst_thread_dummy_functions = {
|
||||
gst_mutex_new_dummy_impl,
|
||||
(void (*)(GMutex *)) gst_mutex_dummy_impl,
|
||||
gst_mutex_trylock_dummy_impl,
|
||||
(void (*)(GMutex *)) gst_mutex_dummy_impl,
|
||||
gst_mutex_dummy_impl,
|
||||
gst_cond_new_dummy_impl,
|
||||
(void (*)(GCond *)) gst_cond_dummy_impl,
|
||||
(void (*)(GCond *)) gst_cond_dummy_impl,
|
||||
(void (*)(GCond *, GMutex *)) gst_cond_dummy_impl,
|
||||
gst_cond_timed_wait_dummy_impl,
|
||||
gst_cond_dummy_impl,
|
||||
gst_private_new_dummy_impl,
|
||||
gst_private_get_dummy_impl,
|
||||
gst_private_set_dummy_impl,
|
||||
gst_thread_create_dummy_impl,
|
||||
gst_thread_dummy_impl,
|
||||
gst_thread_dummy_impl_1,
|
||||
gst_thread_dummy_impl,
|
||||
gst_thread_set_priority_dummy_impl,
|
||||
gst_thread_dummy_impl_1, gst_thread_equal_dummy_impl};
|
||||
gst_mutex_new_dummy_impl,
|
||||
(void (*)(GMutex *)) gst_mutex_dummy_impl,
|
||||
gst_mutex_trylock_dummy_impl,
|
||||
(void (*)(GMutex *)) gst_mutex_dummy_impl,
|
||||
gst_mutex_dummy_impl,
|
||||
gst_cond_new_dummy_impl,
|
||||
(void (*)(GCond *)) gst_cond_dummy_impl,
|
||||
(void (*)(GCond *)) gst_cond_dummy_impl,
|
||||
(void (*)(GCond *, GMutex *)) gst_cond_dummy_impl,
|
||||
gst_cond_timed_wait_dummy_impl,
|
||||
gst_cond_dummy_impl,
|
||||
gst_private_new_dummy_impl,
|
||||
gst_private_get_dummy_impl,
|
||||
gst_private_set_dummy_impl,
|
||||
gst_thread_create_dummy_impl,
|
||||
gst_thread_dummy_impl,
|
||||
gst_thread_dummy_impl_1,
|
||||
gst_thread_dummy_impl,
|
||||
gst_thread_set_priority_dummy_impl,
|
||||
gst_thread_dummy_impl_1, gst_thread_equal_dummy_impl
|
||||
};
|
||||
|
|
|
@ -121,8 +121,8 @@ gst_trace_text_flush (GstTrace * trace)
|
|||
|
||||
for (i = 0; i < trace->bufoffset; i++) {
|
||||
snprintf (str, STRSIZE, "%20" G_GINT64_FORMAT " %10d %10d %s\n",
|
||||
trace->buf[i].timestamp,
|
||||
trace->buf[i].sequence, trace->buf[i].data, trace->buf[i].message);
|
||||
trace->buf[i].timestamp,
|
||||
trace->buf[i].sequence, trace->buf[i].data, trace->buf[i].message);
|
||||
write (trace->fd, str, strlen (str));
|
||||
}
|
||||
trace->bufoffset = 0;
|
||||
|
@ -340,8 +340,8 @@ gst_alloc_trace_print (const GstAllocTrace * trace)
|
|||
g_print (", dumping live memory: ");
|
||||
|
||||
while (mem_live) {
|
||||
g_print ("%p ", mem_live->data);
|
||||
mem_live = g_slist_next (mem_live);
|
||||
g_print ("%p ", mem_live->data);
|
||||
mem_live = g_slist_next (mem_live);
|
||||
}
|
||||
g_print ("\ntotal %d", g_slist_length (trace->mem_live));
|
||||
}
|
||||
|
|
|
@ -56,10 +56,11 @@ gst_type_find_factory_get_type (void)
|
|||
gst_type_find_factory_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
typefind_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
|
||||
"GstTypeFindFactory", &typefind_info, 0);
|
||||
"GstTypeFindFactory", &typefind_info, 0);
|
||||
GST_DEBUG_CATEGORY_INIT (gst_type_find_debug, "GST_TYPEFIND",
|
||||
GST_DEBUG_FG_GREEN, "typefinding subsystem");
|
||||
GST_DEBUG_FG_GREEN, "typefinding subsystem");
|
||||
}
|
||||
|
||||
return typefind_type;
|
||||
|
@ -120,7 +121,7 @@ gst_type_find_load_plugin (GstTypeFind * find, gpointer data)
|
|||
if (factory->function == gst_type_find_load_plugin) {
|
||||
/* looks like we didn't get a real typefind function */
|
||||
g_warning ("could not load valid typefind function for feature '%s'\n",
|
||||
GST_PLUGIN_FEATURE_NAME (factory));
|
||||
GST_PLUGIN_FEATURE_NAME (factory));
|
||||
} else {
|
||||
g_assert (factory->function);
|
||||
gst_type_find_factory_call_function (factory, find);
|
||||
|
@ -231,7 +232,7 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
GST_INFO ("registering typefind function for %s", name);
|
||||
factory =
|
||||
GST_TYPE_FIND_FACTORY (gst_registry_pool_find_feature (name,
|
||||
GST_TYPE_TYPE_FIND_FACTORY));
|
||||
GST_TYPE_TYPE_FIND_FACTORY));
|
||||
if (!factory) {
|
||||
factory = g_object_new (GST_TYPE_TYPE_FIND_FACTORY, NULL);
|
||||
GST_DEBUG_OBJECT (factory, "using new typefind factory for %s", name);
|
||||
|
|
18
gst/gsturi.c
18
gst/gsturi.c
|
@ -54,11 +54,12 @@ gst_uri_handler_get_type (void)
|
|||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
urihandler_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstURIHandler", &urihandler_info, 0);
|
||||
"GstURIHandler", &urihandler_info, 0);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_uri_handler_debug, "GST_URI", GST_DEBUG_BOLD,
|
||||
"handling of URIs");
|
||||
"handling of URIs");
|
||||
}
|
||||
return urihandler_type;
|
||||
}
|
||||
|
@ -69,8 +70,8 @@ gst_uri_handler_base_init (gpointer g_class)
|
|||
|
||||
if (!initialized) {
|
||||
g_signal_new ("new-uri", GST_TYPE_URI_HANDLER, G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstURIHandlerInterface, new_uri), NULL, NULL,
|
||||
gst_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
G_STRUCT_OFFSET (GstURIHandlerInterface, new_uri), NULL, NULL,
|
||||
gst_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +201,8 @@ typedef struct
|
|||
{
|
||||
GstURIType type;
|
||||
gchar *protocol;
|
||||
} SearchEntry;
|
||||
}
|
||||
SearchEntry;
|
||||
static gboolean
|
||||
search_by_entry (GstPluginFeature * feature, gpointer search_entry)
|
||||
{
|
||||
|
@ -265,7 +267,7 @@ gst_element_make_from_uri (const GstURIType type, const gchar * uri,
|
|||
|
||||
if (!possibilities) {
|
||||
GST_DEBUG ("No %s for URI '%s'", type == GST_URI_SINK ? "sink" : "source",
|
||||
uri);
|
||||
uri);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -273,11 +275,11 @@ gst_element_make_from_uri (const GstURIType type, const gchar * uri,
|
|||
walk = possibilities;
|
||||
while (walk) {
|
||||
if ((ret = gst_element_factory_create (GST_ELEMENT_FACTORY (walk->data),
|
||||
elementname)) != NULL) {
|
||||
elementname)) != NULL) {
|
||||
GstURIHandler *handler = GST_URI_HANDLER (ret);
|
||||
|
||||
if (gst_uri_handler_set_uri (handler, uri))
|
||||
break;
|
||||
break;
|
||||
g_object_unref (ret);
|
||||
ret = NULL;
|
||||
}
|
||||
|
|
148
gst/gstutils.c
148
gst/gstutils.c
|
@ -56,7 +56,7 @@ gst_util_dump_mem (guchar * mem, guint size)
|
|||
|
||||
if (j == 16 || i == size) {
|
||||
g_print ("%08x (%p): %-48.48s %-16.16s\n", i - j, mem + i - j,
|
||||
string->str, chars->str);
|
||||
string->str, chars->str);
|
||||
g_string_set_size (string, 0);
|
||||
g_string_set_size (chars, 0);
|
||||
j = 0;
|
||||
|
@ -122,7 +122,7 @@ gst_util_set_value_from_string (GValue * value, const gchar * value_str)
|
|||
gboolean i = FALSE;
|
||||
|
||||
if (!strncmp ("true", value_str, 4))
|
||||
i = TRUE;
|
||||
i = TRUE;
|
||||
g_value_set_boolean (value, i);
|
||||
break;
|
||||
}
|
||||
|
@ -176,95 +176,95 @@ gst_util_set_object_arg (GObject * object, const gchar * name,
|
|||
GParamSpec *paramspec;
|
||||
|
||||
paramspec =
|
||||
g_object_class_find_property (G_OBJECT_GET_CLASS (object), name);
|
||||
g_object_class_find_property (G_OBJECT_GET_CLASS (object), name);
|
||||
|
||||
if (!paramspec) {
|
||||
return;
|
||||
}
|
||||
|
||||
GST_DEBUG ("paramspec->flags is %d, paramspec->value_type is %d",
|
||||
paramspec->flags, (gint) paramspec->value_type);
|
||||
paramspec->flags, (gint) paramspec->value_type);
|
||||
|
||||
if (paramspec->flags & G_PARAM_WRITABLE) {
|
||||
switch (paramspec->value_type) {
|
||||
case G_TYPE_STRING:
|
||||
g_object_set (G_OBJECT (object), name, value, NULL);
|
||||
break;
|
||||
case G_TYPE_ENUM:
|
||||
case G_TYPE_INT:{
|
||||
gint i;
|
||||
case G_TYPE_STRING:
|
||||
g_object_set (G_OBJECT (object), name, value, NULL);
|
||||
break;
|
||||
case G_TYPE_ENUM:
|
||||
case G_TYPE_INT:{
|
||||
gint i;
|
||||
|
||||
sscanf (value, "%d", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_UINT:{
|
||||
guint i;
|
||||
sscanf (value, "%d", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_UINT:{
|
||||
guint i;
|
||||
|
||||
sscanf (value, "%u", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_LONG:{
|
||||
glong i;
|
||||
sscanf (value, "%u", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_LONG:{
|
||||
glong i;
|
||||
|
||||
sscanf (value, "%ld", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_ULONG:{
|
||||
gulong i;
|
||||
sscanf (value, "%ld", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_ULONG:{
|
||||
gulong i;
|
||||
|
||||
sscanf (value, "%lu", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_BOOLEAN:{
|
||||
gboolean i = FALSE;
|
||||
sscanf (value, "%lu", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_BOOLEAN:{
|
||||
gboolean i = FALSE;
|
||||
|
||||
if (!g_ascii_strncasecmp ("true", value, 4))
|
||||
i = TRUE;
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_CHAR:{
|
||||
gchar i;
|
||||
if (!g_ascii_strncasecmp ("true", value, 4))
|
||||
i = TRUE;
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_CHAR:{
|
||||
gchar i;
|
||||
|
||||
sscanf (value, "%c", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_UCHAR:{
|
||||
guchar i;
|
||||
sscanf (value, "%c", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_UCHAR:{
|
||||
guchar i;
|
||||
|
||||
sscanf (value, "%c", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_FLOAT:{
|
||||
gfloat i;
|
||||
sscanf (value, "%c", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_FLOAT:{
|
||||
gfloat i;
|
||||
|
||||
sscanf (value, "%f", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_DOUBLE:{
|
||||
gfloat i;
|
||||
sscanf (value, "%f", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_DOUBLE:{
|
||||
gfloat i;
|
||||
|
||||
sscanf (value, "%g", &i);
|
||||
g_object_set (G_OBJECT (object), name, (gdouble) i, NULL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (G_IS_PARAM_SPEC_ENUM (paramspec)) {
|
||||
gint i;
|
||||
sscanf (value, "%g", &i);
|
||||
g_object_set (G_OBJECT (object), name, (gdouble) i, NULL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (G_IS_PARAM_SPEC_ENUM (paramspec)) {
|
||||
gint i;
|
||||
|
||||
sscanf (value, "%d", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
} else if (paramspec->value_type == GST_TYPE_URI) {
|
||||
g_object_set (G_OBJECT (object), name, value, NULL);
|
||||
}
|
||||
break;
|
||||
sscanf (value, "%d", &i);
|
||||
g_object_set (G_OBJECT (object), name, i, NULL);
|
||||
} else if (paramspec->value_type == GST_TYPE_URI) {
|
||||
g_object_set (G_OBJECT (object), name, value, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ gst_print_pad_caps (GString * buf, gint indent, GstPad * pad)
|
|||
if (!caps) {
|
||||
string_append_indent (buf, indent);
|
||||
g_string_printf (buf, "%s:%s has no capabilities",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
} else {
|
||||
char *s;
|
||||
|
||||
|
@ -331,7 +331,7 @@ void
|
|||
gst_print_element_args (GString * buf, gint indent, GstElement * element)
|
||||
{
|
||||
guint width;
|
||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
||||
gchar *str = 0;
|
||||
GParamSpec *spec, **specs, **walk;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ gst_value_list_array_copy (const GArray * src)
|
|||
g_array_set_size (dest, src->len);
|
||||
for (i = 0; i < src->len; i++) {
|
||||
gst_value_init_and_copy (&g_array_index (dest, GValue, i),
|
||||
&g_array_index (src, GValue, i));
|
||||
&g_array_index (src, GValue, i));
|
||||
}
|
||||
|
||||
return dest;
|
||||
|
@ -113,7 +113,7 @@ gst_value_collect_list (GValue * value, guint n_collect_values,
|
|||
value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
|
||||
} else {
|
||||
value->data[0].v_pointer =
|
||||
gst_value_list_array_copy ((GArray *) collect_values[0].v_pointer);
|
||||
gst_value_list_array_copy ((GArray *) collect_values[0].v_pointer);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -126,10 +126,10 @@ gst_value_lcopy_list (const GValue * value, guint n_collect_values,
|
|||
|
||||
if (!dest)
|
||||
return g_strdup_printf ("value location for `%s' passed as NULL",
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
if (!value->data[0].v_pointer)
|
||||
return g_strdup_printf ("invalid value given for `%s'",
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
|
||||
*dest = (GArray *) value->data[0].v_pointer;
|
||||
} else {
|
||||
|
@ -220,7 +220,7 @@ gst_value_list_concat (GValue * dest, const GValue * value1,
|
|||
if (GST_VALUE_HOLDS_LIST (value1)) {
|
||||
for (i = 0; i < value1_length; i++) {
|
||||
gst_value_init_and_copy (&g_array_index (array, GValue, i),
|
||||
gst_value_list_get_value (value1, i));
|
||||
gst_value_list_get_value (value1, i));
|
||||
}
|
||||
} else {
|
||||
gst_value_init_and_copy (&g_array_index (array, GValue, 0), value1);
|
||||
|
@ -229,11 +229,11 @@ gst_value_list_concat (GValue * dest, const GValue * value1,
|
|||
if (GST_VALUE_HOLDS_LIST (value2)) {
|
||||
for (i = 0; i < value2_length; i++) {
|
||||
gst_value_init_and_copy (&g_array_index (array, GValue,
|
||||
i + value1_length), gst_value_list_get_value (value2, i));
|
||||
i + value1_length), gst_value_list_get_value (value2, i));
|
||||
}
|
||||
} else {
|
||||
gst_value_init_and_copy (&g_array_index (array, GValue, value1_length),
|
||||
value2);
|
||||
value2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ gst_value_compare_list (const GValue * value1, const GValue * value2)
|
|||
for (j = 0; j < array1->len; j++) {
|
||||
v2 = &g_array_index (array2, GValue, j);
|
||||
if (gst_value_compare (v1, v2) == GST_VALUE_EQUAL)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
if (j == array1->len) {
|
||||
return GST_VALUE_UNORDERED;
|
||||
|
@ -353,7 +353,7 @@ gst_value_lcopy_fourcc (const GValue * value, guint n_collect_values,
|
|||
|
||||
if (!fourcc_p)
|
||||
return g_strdup_printf ("value location for `%s' passed as NULL",
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
|
||||
*fourcc_p = value->data[0].v_int;
|
||||
|
||||
|
@ -395,7 +395,7 @@ gst_value_transform_fourcc_string (const GValue * src_value,
|
|||
g_ascii_isprint ((fourcc >> 16) & 0xff) &&
|
||||
g_ascii_isprint ((fourcc >> 24) & 0xff)) {
|
||||
dest_value->data[0].v_pointer =
|
||||
g_strdup_printf (GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
||||
g_strdup_printf (GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
||||
} else {
|
||||
dest_value->data[0].v_pointer = g_strdup_printf ("0x%08x", fourcc);
|
||||
}
|
||||
|
@ -482,10 +482,10 @@ gst_value_lcopy_int_range (const GValue * value, guint n_collect_values,
|
|||
|
||||
if (!int_range_start)
|
||||
return g_strdup_printf ("start value location for `%s' passed as NULL",
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
if (!int_range_end)
|
||||
return g_strdup_printf ("end value location for `%s' passed as NULL",
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
|
||||
*int_range_start = value->data[0].v_int;
|
||||
*int_range_end = value->data[1].v_int;
|
||||
|
@ -597,10 +597,10 @@ gst_value_lcopy_double_range (const GValue * value, guint n_collect_values,
|
|||
|
||||
if (!double_range_start)
|
||||
return g_strdup_printf ("start value location for `%s' passed as NULL",
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
if (!double_range_end)
|
||||
return g_strdup_printf ("end value location for `%s' passed as NULL",
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
|
||||
*double_range_start = value->data[0].v_double;
|
||||
*double_range_end = value->data[1].v_double;
|
||||
|
@ -653,9 +653,9 @@ gst_value_transform_double_range_string (const GValue * src_value,
|
|||
|
||||
dest_value->data[0].v_pointer = g_strdup_printf ("[%s,%s]",
|
||||
g_ascii_dtostr (s1, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
src_value->data[0].v_double),
|
||||
src_value->data[0].v_double),
|
||||
g_ascii_dtostr (s2, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
src_value->data[1].v_double));
|
||||
src_value->data[1].v_double));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1059,16 +1059,16 @@ gst_value_intersect_list (GValue * dest, const GValue * value1,
|
|||
if (gst_value_intersect (&intersection, cur, value2)) {
|
||||
/* append value */
|
||||
if (!ret) {
|
||||
gst_value_init_and_copy (dest, &intersection);
|
||||
ret = TRUE;
|
||||
gst_value_init_and_copy (dest, &intersection);
|
||||
ret = TRUE;
|
||||
} else if (GST_VALUE_HOLDS_LIST (dest)) {
|
||||
gst_value_list_append_value (dest, &intersection);
|
||||
gst_value_list_append_value (dest, &intersection);
|
||||
} else {
|
||||
GValue temp = { 0, };
|
||||
GValue temp = { 0, };
|
||||
|
||||
gst_value_init_and_copy (&temp, dest);
|
||||
g_value_unset (dest);
|
||||
gst_value_list_concat (dest, &temp, &intersection);
|
||||
gst_value_init_and_copy (&temp, dest);
|
||||
g_value_unset (dest);
|
||||
gst_value_list_concat (dest, &temp, &intersection);
|
||||
}
|
||||
g_value_unset (&intersection);
|
||||
}
|
||||
|
@ -1142,7 +1142,7 @@ gst_value_can_union (const GValue * value1, const GValue * value2)
|
|||
for (i = 0; i < gst_value_union_funcs->len; i++) {
|
||||
union_info = &g_array_index (gst_value_union_funcs, GstValueUnionInfo, i);
|
||||
if (union_info->type1 == G_VALUE_TYPE (value1) &&
|
||||
union_info->type2 == G_VALUE_TYPE (value2))
|
||||
union_info->type2 == G_VALUE_TYPE (value2))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1162,7 @@ gst_value_union (GValue * dest, const GValue * value1, const GValue * value2)
|
|||
for (i = 0; i < gst_value_union_funcs->len; i++) {
|
||||
union_info = &g_array_index (gst_value_union_funcs, GstValueUnionInfo, i);
|
||||
if (union_info->type1 == G_VALUE_TYPE (value1) &&
|
||||
union_info->type2 == G_VALUE_TYPE (value2)) {
|
||||
union_info->type2 == G_VALUE_TYPE (value2)) {
|
||||
return union_info->func (dest, value1, value2);
|
||||
}
|
||||
}
|
||||
|
@ -1205,9 +1205,9 @@ gst_value_can_intersect (const GValue * value1, const GValue * value2)
|
|||
|
||||
for (i = 0; i < gst_value_intersect_funcs->len; i++) {
|
||||
intersect_info = &g_array_index (gst_value_intersect_funcs,
|
||||
GstValueIntersectInfo, i);
|
||||
GstValueIntersectInfo, i);
|
||||
if (intersect_info->type1 == G_VALUE_TYPE (value1) &&
|
||||
intersect_info->type2 == G_VALUE_TYPE (value2))
|
||||
intersect_info->type2 == G_VALUE_TYPE (value2))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1234,14 +1234,14 @@ gst_value_intersect (GValue * dest, const GValue * value1,
|
|||
|
||||
for (i = 0; i < gst_value_intersect_funcs->len; i++) {
|
||||
intersect_info = &g_array_index (gst_value_intersect_funcs,
|
||||
GstValueIntersectInfo, i);
|
||||
GstValueIntersectInfo, i);
|
||||
if (intersect_info->type1 == G_VALUE_TYPE (value1) &&
|
||||
intersect_info->type2 == G_VALUE_TYPE (value2)) {
|
||||
intersect_info->type2 == G_VALUE_TYPE (value2)) {
|
||||
ret = intersect_info->func (dest, value1, value2);
|
||||
return ret;
|
||||
}
|
||||
if (intersect_info->type1 == G_VALUE_TYPE (value2) &&
|
||||
intersect_info->type2 == G_VALUE_TYPE (value1)) {
|
||||
intersect_info->type2 == G_VALUE_TYPE (value1)) {
|
||||
ret = intersect_info->func (dest, value2, value1);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1357,6 +1357,7 @@ _gst_value_initialize (void)
|
|||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
//const GTypeFundamentalInfo finfo = { G_TYPE_FLAG_DERIVABLE, };
|
||||
|
||||
gst_value_table = g_array_new (FALSE, FALSE, sizeof (GstValueTable));
|
||||
|
@ -1382,9 +1383,10 @@ _gst_value_initialize (void)
|
|||
gst_value_serialize_fourcc,
|
||||
gst_value_deserialize_fourcc,
|
||||
};
|
||||
|
||||
info.value_table = &value_table;
|
||||
gst_type_fourcc =
|
||||
g_type_register_static (G_TYPE_BOXED, "GstFourcc", &info, 0);
|
||||
g_type_register_static (G_TYPE_BOXED, "GstFourcc", &info, 0);
|
||||
gst_value.type = gst_type_fourcc;
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
@ -1406,9 +1408,10 @@ _gst_value_initialize (void)
|
|||
gst_value_serialize_int_range,
|
||||
gst_value_deserialize_int_range,
|
||||
};
|
||||
|
||||
info.value_table = &value_table;
|
||||
gst_type_int_range =
|
||||
g_type_register_static (G_TYPE_BOXED, "GstIntRange", &info, 0);
|
||||
g_type_register_static (G_TYPE_BOXED, "GstIntRange", &info, 0);
|
||||
gst_value.type = gst_type_int_range;
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
@ -1430,9 +1433,10 @@ _gst_value_initialize (void)
|
|||
gst_value_serialize_double_range,
|
||||
gst_value_deserialize_double_range,
|
||||
};
|
||||
|
||||
info.value_table = &value_table;
|
||||
gst_type_double_range =
|
||||
g_type_register_static (G_TYPE_BOXED, "GstDoubleRange", &info, 0);
|
||||
g_type_register_static (G_TYPE_BOXED, "GstDoubleRange", &info, 0);
|
||||
gst_value.type = gst_type_double_range;
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
@ -1454,9 +1458,10 @@ _gst_value_initialize (void)
|
|||
gst_value_serialize_list,
|
||||
gst_value_deserialize_list,
|
||||
};
|
||||
|
||||
info.value_table = &value_table;
|
||||
gst_type_list =
|
||||
g_type_register_static (G_TYPE_BOXED, "GstValueList", &info, 0);
|
||||
g_type_register_static (G_TYPE_BOXED, "GstValueList", &info, 0);
|
||||
gst_value.type = gst_type_list;
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
@ -1468,6 +1473,7 @@ _gst_value_initialize (void)
|
|||
gst_value_serialize_int,
|
||||
gst_value_deserialize_int,
|
||||
};
|
||||
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
||||
|
@ -1478,6 +1484,7 @@ _gst_value_initialize (void)
|
|||
gst_value_serialize_double,
|
||||
gst_value_deserialize_double,
|
||||
};
|
||||
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
||||
|
@ -1488,6 +1495,7 @@ _gst_value_initialize (void)
|
|||
gst_value_serialize_string,
|
||||
gst_value_deserialize_string,
|
||||
};
|
||||
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
||||
|
@ -1498,6 +1506,7 @@ _gst_value_initialize (void)
|
|||
gst_value_serialize_boolean,
|
||||
gst_value_deserialize_boolean,
|
||||
};
|
||||
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
||||
|
|
13
gst/gstxml.c
13
gst/gstxml.c
|
@ -60,6 +60,7 @@ gst_xml_get_type (void)
|
|||
(GInstanceInitFunc) gst_xml_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
xml_type = g_type_register_static (GST_TYPE_OBJECT, "GstXML", &xml_info, 0);
|
||||
}
|
||||
return xml_type;
|
||||
|
@ -168,14 +169,14 @@ gst_xml_write_file (GstElement * element, FILE * out)
|
|||
|
||||
if (cur->charset != XML_CHAR_ENCODING_UTF8) {
|
||||
xmlGenericError (xmlGenericErrorContext,
|
||||
"xmlDocDump: document not in UTF8\n");
|
||||
"xmlDocDump: document not in UTF8\n");
|
||||
return -1;
|
||||
}
|
||||
if (enc != XML_CHAR_ENCODING_UTF8) {
|
||||
handler = xmlFindCharEncodingHandler (encoding);
|
||||
if (handler == NULL) {
|
||||
xmlFree ((char *) cur->encoding);
|
||||
cur->encoding = NULL;
|
||||
xmlFree ((char *) cur->encoding);
|
||||
cur->encoding = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -368,10 +369,10 @@ gst_xml_get_element (GstXML * xml, const guchar * name)
|
|||
return top;
|
||||
} else {
|
||||
if (GST_IS_BIN (top)) {
|
||||
element = gst_bin_get_by_name (GST_BIN (top), name);
|
||||
element = gst_bin_get_by_name (GST_BIN (top), name);
|
||||
|
||||
if (element)
|
||||
return element;
|
||||
if (element)
|
||||
return element;
|
||||
}
|
||||
}
|
||||
topelements = g_list_next (topelements);
|
||||
|
|
|
@ -78,7 +78,8 @@ typedef struct
|
|||
gint nformats;
|
||||
GstFormat *format;
|
||||
GArray *array;
|
||||
} GstFileIndexId;
|
||||
}
|
||||
GstFileIndexId;
|
||||
|
||||
typedef struct _GstFileIndex GstFileIndex;
|
||||
typedef struct _GstFileIndexClass GstFileIndexClass;
|
||||
|
@ -106,7 +107,7 @@ struct _GstFileIndex
|
|||
gint next_id;
|
||||
GHashTable *id_index;
|
||||
|
||||
GstIndexEntry *ret_entry; /* hack to avoid leaking memory */
|
||||
GstIndexEntry *ret_entry; /* hack to avoid leaking memory */
|
||||
};
|
||||
|
||||
struct _GstFileIndexClass
|
||||
|
@ -164,9 +165,10 @@ gst_file_index_get_type (void)
|
|||
(GInstanceInitFunc) gst_file_index_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
file_index_type =
|
||||
g_type_register_static (GST_TYPE_INDEX, "GstFileIndex",
|
||||
&file_index_info, 0);
|
||||
g_type_register_static (GST_TYPE_INDEX, "GstFileIndex",
|
||||
&file_index_info, 0);
|
||||
}
|
||||
return file_index_type;
|
||||
}
|
||||
|
@ -193,7 +195,7 @@ gst_file_index_class_init (GstFileIndexClass * klass)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_LOCATION,
|
||||
g_param_spec_string ("location", "File Location",
|
||||
"Location of the index file", NULL, G_PARAM_READWRITE));
|
||||
"Location of the index file", NULL, G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -251,7 +253,7 @@ gst_file_index_dispose (GObject * object)
|
|||
g_hash_table_destroy (index->id_index);
|
||||
index->id_index = NULL;
|
||||
|
||||
gst_index_entry_free (index->ret_entry); /* hack */
|
||||
gst_index_entry_free (index->ret_entry); /* hack */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
@ -299,7 +301,7 @@ gst_file_index_get_writer_id (GstIndex * _index,
|
|||
|
||||
if (match) {
|
||||
GST_CAT_WARNING_OBJECT (DC, index, "Duplicate matches for writer '%s'",
|
||||
writer_string);
|
||||
writer_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -320,10 +322,10 @@ gst_file_index_get_writer_id (GstIndex * _index,
|
|||
if (cx.ii) {
|
||||
match = TRUE;
|
||||
GST_CAT_DEBUG_OBJECT (DC, index, "Resolved writer '%s' again",
|
||||
writer_string);
|
||||
writer_string);
|
||||
} else
|
||||
GST_CAT_WARNING_OBJECT (DC, index, "Can't resolve writer '%s'",
|
||||
writer_string);
|
||||
writer_string);
|
||||
}
|
||||
|
||||
return match;
|
||||
|
@ -384,73 +386,73 @@ gst_file_index_load (GstFileIndex * index)
|
|||
xmlNodePtr writer;
|
||||
|
||||
for (writer = part->children; writer; writer = writer->next) {
|
||||
xmlChar *datafile = xmlGetProp (writer, "datafile");
|
||||
gchar *path = g_strdup_printf ("%s/%s", index->location, datafile);
|
||||
int fd;
|
||||
GstFileIndexId *id_index;
|
||||
xmlNodePtr wpart;
|
||||
xmlChar *entries_str;
|
||||
gpointer array_data;
|
||||
xmlChar *datafile = xmlGetProp (writer, "datafile");
|
||||
gchar *path = g_strdup_printf ("%s/%s", index->location, datafile);
|
||||
int fd;
|
||||
GstFileIndexId *id_index;
|
||||
xmlNodePtr wpart;
|
||||
xmlChar *entries_str;
|
||||
gpointer array_data;
|
||||
|
||||
free (datafile);
|
||||
free (datafile);
|
||||
|
||||
fd = open (path, O_RDONLY);
|
||||
g_free (path);
|
||||
if (fd < 0) {
|
||||
GST_CAT_ERROR_OBJECT (DC, index,
|
||||
"Can't open '%s': %s", path, strerror (errno));
|
||||
continue;
|
||||
}
|
||||
fd = open (path, O_RDONLY);
|
||||
g_free (path);
|
||||
if (fd < 0) {
|
||||
GST_CAT_ERROR_OBJECT (DC, index,
|
||||
"Can't open '%s': %s", path, strerror (errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
id_index = g_new0 (GstFileIndexId, 1);
|
||||
id_index->id_desc = xmlGetProp (writer, "id");
|
||||
id_index = g_new0 (GstFileIndexId, 1);
|
||||
id_index->id_desc = xmlGetProp (writer, "id");
|
||||
|
||||
for (wpart = writer->children; wpart; wpart = wpart->next) {
|
||||
if (strcmp (wpart->name, "formats") == 0) {
|
||||
xmlChar *count_str = xmlGetProp (wpart, "count");
|
||||
gint fx = 0;
|
||||
xmlNodePtr format;
|
||||
for (wpart = writer->children; wpart; wpart = wpart->next) {
|
||||
if (strcmp (wpart->name, "formats") == 0) {
|
||||
xmlChar *count_str = xmlGetProp (wpart, "count");
|
||||
gint fx = 0;
|
||||
xmlNodePtr format;
|
||||
|
||||
id_index->nformats = atoi (count_str);
|
||||
free (count_str);
|
||||
id_index->nformats = atoi (count_str);
|
||||
free (count_str);
|
||||
|
||||
id_index->format = g_new (GstFormat, id_index->nformats);
|
||||
id_index->format = g_new (GstFormat, id_index->nformats);
|
||||
|
||||
for (format = wpart->children; format; format = format->next) {
|
||||
xmlChar *nick = xmlGetProp (format, "nick");
|
||||
GstFormat fmt = gst_format_get_by_nick (nick);
|
||||
for (format = wpart->children; format; format = format->next) {
|
||||
xmlChar *nick = xmlGetProp (format, "nick");
|
||||
GstFormat fmt = gst_format_get_by_nick (nick);
|
||||
|
||||
if (fmt == GST_FORMAT_UNDEFINED)
|
||||
GST_CAT_ERROR_OBJECT (DC, index, "format '%s' undefined", nick);
|
||||
g_assert (fx < id_index->nformats);
|
||||
id_index->format[fx++] = fmt;
|
||||
free (nick);
|
||||
}
|
||||
} else
|
||||
GST_CAT_INFO_OBJECT (DC, index, "unknown wpart '%s'", wpart->name);
|
||||
}
|
||||
if (fmt == GST_FORMAT_UNDEFINED)
|
||||
GST_CAT_ERROR_OBJECT (DC, index, "format '%s' undefined", nick);
|
||||
g_assert (fx < id_index->nformats);
|
||||
id_index->format[fx++] = fmt;
|
||||
free (nick);
|
||||
}
|
||||
} else
|
||||
GST_CAT_INFO_OBJECT (DC, index, "unknown wpart '%s'", wpart->name);
|
||||
}
|
||||
|
||||
g_assert (id_index->nformats > 0);
|
||||
_fc_alloc_array (id_index);
|
||||
g_assert (id_index->array->data == NULL); /* little bit risky */
|
||||
g_assert (id_index->nformats > 0);
|
||||
_fc_alloc_array (id_index);
|
||||
g_assert (id_index->array->data == NULL); /* little bit risky */
|
||||
|
||||
entries_str = xmlGetProp (writer, "entries");
|
||||
id_index->array->len = atoi (entries_str);
|
||||
free (entries_str);
|
||||
entries_str = xmlGetProp (writer, "entries");
|
||||
id_index->array->len = atoi (entries_str);
|
||||
free (entries_str);
|
||||
|
||||
array_data =
|
||||
mmap (NULL, ARRAY_TOTAL_SIZE (id_index), PROT_READ, MAP_SHARED, fd,
|
||||
0);
|
||||
close (fd);
|
||||
if (array_data == MAP_FAILED) {
|
||||
GST_CAT_ERROR_OBJECT (DC, index,
|
||||
"mmap %s failed: %s", path, strerror (errno));
|
||||
continue;
|
||||
}
|
||||
array_data =
|
||||
mmap (NULL, ARRAY_TOTAL_SIZE (id_index), PROT_READ, MAP_SHARED, fd,
|
||||
0);
|
||||
close (fd);
|
||||
if (array_data == MAP_FAILED) {
|
||||
GST_CAT_ERROR_OBJECT (DC, index,
|
||||
"mmap %s failed: %s", path, strerror (errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
id_index->array->data = array_data;
|
||||
id_index->array->data = array_data;
|
||||
|
||||
index->unresolved = g_slist_prepend (index->unresolved, id_index);
|
||||
index->unresolved = g_slist_prepend (index->unresolved, id_index);
|
||||
}
|
||||
} else
|
||||
GST_CAT_INFO_OBJECT (DC, index, "unknown part '%s'", part->name);
|
||||
|
@ -472,11 +474,11 @@ gst_file_index_set_property (GObject * object,
|
|||
switch (prop_id) {
|
||||
case ARG_LOCATION:
|
||||
if (index->location)
|
||||
g_free (index->location);
|
||||
g_free (index->location);
|
||||
index->location = g_value_dup_string (value);
|
||||
|
||||
if (index->location && !g_hash_table_size (index->id_index))
|
||||
gst_file_index_load (index);
|
||||
gst_file_index_load (index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -512,7 +514,7 @@ _file_index_id_save_xml (gpointer _key, GstFileIndexId * ii, xmlNodePtr writers)
|
|||
xmlSetProp (writer, "id", ii->id_desc);
|
||||
g_snprintf (buf, bufsize, "%d", ii->array->len);
|
||||
xmlSetProp (writer, "entries", buf);
|
||||
g_snprintf (buf, bufsize, "%d", ii->id); /* any unique number is OK */
|
||||
g_snprintf (buf, bufsize, "%d", ii->id); /* any unique number is OK */
|
||||
xmlSetProp (writer, "datafile", buf);
|
||||
|
||||
formats = xmlNewChild (writer, NULL, "formats", NULL);
|
||||
|
@ -604,7 +606,7 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id)
|
|||
|
||||
if (mkdir (index->location, 0777) && errno != EEXIST) {
|
||||
GST_CAT_ERROR_OBJECT (DC, index,
|
||||
"mkdir %s: %s", index->location, strerror (errno));
|
||||
"mkdir %s: %s", index->location, strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -705,11 +707,11 @@ _fc_bsearch (GArray * ary,
|
|||
if (cmp == 0) {
|
||||
/* if there are multiple matches then scan for the first match */
|
||||
while (mid > 0 &&
|
||||
(*compare) (sample, ary->data + (mid - 1) * stride, user_data) == 0)
|
||||
--mid;
|
||||
(*compare) (sample, ary->data + (mid - 1) * stride, user_data) == 0)
|
||||
--mid;
|
||||
|
||||
if (ret)
|
||||
*ret = mid;
|
||||
*ret = mid;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -726,12 +728,12 @@ _fc_bsearch (GArray * ary,
|
|||
|
||||
if (cmp < 0) {
|
||||
if (ret)
|
||||
*ret = tx;
|
||||
*ret = tx;
|
||||
return FALSE;
|
||||
}
|
||||
if (cmp == 0) {
|
||||
if (ret)
|
||||
*ret = tx;
|
||||
*ret = tx;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -772,7 +774,7 @@ gst_file_index_add_association (GstIndex * index, GstIndexEntry * entry)
|
|||
|
||||
id_index->nformats = GST_INDEX_NASSOCS (entry);
|
||||
GST_CAT_LOG_OBJECT (DC, fileindex, "creating %d formats for %d",
|
||||
id_index->nformats, entry->id);
|
||||
id_index->nformats, entry->id);
|
||||
id_index->format = g_new (GstFormat, id_index->nformats);
|
||||
for (fx = 0; fx < id_index->nformats; fx++)
|
||||
id_index->format[fx] = GST_INDEX_ASSOC_FORMAT (entry, fx);
|
||||
|
@ -781,14 +783,14 @@ gst_file_index_add_association (GstIndex * index, GstIndexEntry * entry)
|
|||
/* only sanity checking */
|
||||
if (id_index->nformats != GST_INDEX_NASSOCS (entry))
|
||||
GST_CAT_WARNING_OBJECT (DC, fileindex, "arity change %d -> %d",
|
||||
id_index->nformats, GST_INDEX_NASSOCS (entry));
|
||||
id_index->nformats, GST_INDEX_NASSOCS (entry));
|
||||
else {
|
||||
gint fx;
|
||||
|
||||
for (fx = 0; fx < id_index->nformats; fx++)
|
||||
if (id_index->format[fx] != GST_INDEX_ASSOC_FORMAT (entry, fx))
|
||||
GST_CAT_WARNING_OBJECT (DC, fileindex, "format[%d] changed %d -> %d",
|
||||
fx, id_index->format[fx], GST_INDEX_ASSOC_FORMAT (entry, fx));
|
||||
if (id_index->format[fx] != GST_INDEX_ASSOC_FORMAT (entry, fx))
|
||||
GST_CAT_WARNING_OBJECT (DC, fileindex, "format[%d] changed %d -> %d",
|
||||
fx, id_index->format[fx], GST_INDEX_ASSOC_FORMAT (entry, fx));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -803,8 +805,8 @@ gst_file_index_add_association (GstIndex * index, GstIndexEntry * entry)
|
|||
if (exact) {
|
||||
/* maybe overwrite instead? */
|
||||
GST_CAT_DEBUG_OBJECT (DC, index,
|
||||
"Ignoring duplicate index association at %lld",
|
||||
GST_INDEX_ASSOC_VALUE (entry, 0));
|
||||
"Ignoring duplicate index association at %lld",
|
||||
GST_INDEX_ASSOC_VALUE (entry, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -872,7 +874,7 @@ gst_file_index_add_entry (GstIndex * index, GstIndexEntry * entry)
|
|||
break;
|
||||
case GST_INDEX_ENTRY_OBJECT:
|
||||
GST_CAT_ERROR_OBJECT (DC, index,
|
||||
"gst_file_index_add_object not implemented");
|
||||
"gst_file_index_add_object not implemented");
|
||||
break;
|
||||
case GST_INDEX_ENTRY_FORMAT:
|
||||
/*
|
||||
|
@ -880,7 +882,7 @@ gst_file_index_add_entry (GstIndex * index, GstIndexEntry * entry)
|
|||
GST_INDEX_ENTRY_* can probably go away.
|
||||
*/
|
||||
GST_CAT_DEBUG_OBJECT (DC, index,
|
||||
"gst_file_index_add_format not implemented");
|
||||
"gst_file_index_add_format not implemented");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -922,7 +924,7 @@ gst_file_index_get_assoc_entry (GstIndex * index,
|
|||
|
||||
if (formatx == -1) {
|
||||
GST_CAT_WARNING_OBJECT (DC, fileindex,
|
||||
"%s, format %d not available", __FUNCTION__, format);
|
||||
"%s, format %d not available", __FUNCTION__, format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -938,11 +940,11 @@ gst_file_index_get_assoc_entry (GstIndex * index,
|
|||
return NULL;
|
||||
else if (method == GST_INDEX_LOOKUP_BEFORE) {
|
||||
if (mx == 0)
|
||||
return NULL;
|
||||
return NULL;
|
||||
mx -= 1;
|
||||
} else if (method == GST_INDEX_LOOKUP_AFTER) {
|
||||
if (mx == id_index->array->len)
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -952,11 +954,11 @@ gst_file_index_get_assoc_entry (GstIndex * index,
|
|||
if (method != GST_INDEX_LOOKUP_EXACT)
|
||||
while ((GINT32_FROM_BE (ARRAY_ROW_FLAGS (row_data)) & flags) != flags) {
|
||||
if (method == GST_INDEX_LOOKUP_BEFORE)
|
||||
mx -= 1;
|
||||
mx -= 1;
|
||||
else if (method == GST_INDEX_LOOKUP_AFTER)
|
||||
mx += 1;
|
||||
mx += 1;
|
||||
if (mx < 0 || mx >= id_index->array->len)
|
||||
return NULL;
|
||||
return NULL;
|
||||
row_data = id_index->array->data + mx * ARRAY_ROW_SIZE (id_index);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,13 +66,15 @@ typedef struct
|
|||
GstFormat format;
|
||||
gint offset;
|
||||
GTree *tree;
|
||||
} GstMemIndexFormatIndex;
|
||||
}
|
||||
GstMemIndexFormatIndex;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint id;
|
||||
GHashTable *format_index;
|
||||
} GstMemIndexId;
|
||||
}
|
||||
GstMemIndexId;
|
||||
|
||||
typedef struct _GstMemIndex GstMemIndex;
|
||||
typedef struct _GstMemIndexClass GstMemIndexClass;
|
||||
|
@ -136,9 +138,10 @@ gst_mem_index_get_type (void)
|
|||
(GInstanceInitFunc) gst_mem_index_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
mem_index_type =
|
||||
g_type_register_static (GST_TYPE_INDEX, "GstMemIndex", &mem_index_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_INDEX, "GstMemIndex", &mem_index_info,
|
||||
0);
|
||||
}
|
||||
return mem_index_type;
|
||||
}
|
||||
|
@ -293,7 +296,8 @@ typedef struct
|
|||
gint64 low_diff;
|
||||
GstIndexEntry *higher;
|
||||
gint64 high_diff;
|
||||
} GstMemIndexSearchData;
|
||||
}
|
||||
GstMemIndexSearchData;
|
||||
|
||||
static gint
|
||||
mem_index_search (gconstpointer a, gconstpointer b)
|
||||
|
@ -382,16 +386,16 @@ gst_mem_index_get_assoc_entry (GstIndex * index, gint id,
|
|||
entry = NULL;
|
||||
|
||||
while (l_entry) {
|
||||
entry = (GstIndexEntry *) l_entry->data;
|
||||
entry = (GstIndexEntry *) l_entry->data;
|
||||
|
||||
if (entry->id == id && (GST_INDEX_ASSOC_FLAGS (entry) & flags) == flags)
|
||||
break;
|
||||
if (entry->id == id && (GST_INDEX_ASSOC_FLAGS (entry) & flags) == flags)
|
||||
break;
|
||||
|
||||
if (method == GST_INDEX_LOOKUP_BEFORE)
|
||||
l_entry = g_list_next (l_entry);
|
||||
else if (method == GST_INDEX_LOOKUP_AFTER) {
|
||||
l_entry = g_list_previous (l_entry);
|
||||
}
|
||||
if (method == GST_INDEX_LOOKUP_BEFORE)
|
||||
l_entry = g_list_next (l_entry);
|
||||
else if (method == GST_INDEX_LOOKUP_AFTER) {
|
||||
l_entry = g_list_previous (l_entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ gst_xml_registry_get_type (void)
|
|||
};
|
||||
|
||||
xml_registry_type = g_type_register_static (GST_TYPE_REGISTRY,
|
||||
"GstXMLRegistry", &xml_registry_info, 0);
|
||||
"GstXMLRegistry", &xml_registry_info, 0);
|
||||
}
|
||||
return xml_registry_type;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ gst_xml_registry_class_init (GstXMLRegistryClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LOCATION,
|
||||
g_param_spec_string ("location", "Location",
|
||||
"Location of the registry file", NULL, G_PARAM_READWRITE));
|
||||
"Location of the registry file", NULL, G_PARAM_READWRITE));
|
||||
|
||||
gstregistry_class->load = GST_DEBUG_FUNCPTR (gst_xml_registry_load);
|
||||
gstregistry_class->save = GST_DEBUG_FUNCPTR (gst_xml_registry_save);
|
||||
|
@ -236,21 +236,21 @@ gst_xml_registry_set_property (GObject * object, guint prop_id,
|
|||
switch (prop_id) {
|
||||
case PROP_LOCATION:
|
||||
if (registry->open) {
|
||||
CLASS (object)->close_func (registry);
|
||||
g_return_if_fail (registry->open == FALSE);
|
||||
CLASS (object)->close_func (registry);
|
||||
g_return_if_fail (registry->open == FALSE);
|
||||
}
|
||||
|
||||
if (registry->location)
|
||||
g_free (registry->location);
|
||||
g_free (registry->location);
|
||||
|
||||
registry->location = g_strdup (g_value_get_string (value));
|
||||
GST_REGISTRY (registry)->flags = 0x0;
|
||||
|
||||
if (CLASS (object)->get_perms_func)
|
||||
CLASS (object)->get_perms_func (registry);
|
||||
CLASS (object)->get_perms_func (registry);
|
||||
|
||||
if (CLASS (object)->add_path_list_func)
|
||||
CLASS (object)->add_path_list_func (registry);
|
||||
CLASS (object)->add_path_list_func (registry);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -311,11 +311,11 @@ make_dir (gchar * filename)
|
|||
if (stat (dirname, &dirstat) == -1 && errno == ENOENT) {
|
||||
if (mkdir (dirname, dirmode) != 0) {
|
||||
if (make_dir (dirname) != TRUE) {
|
||||
g_free (dirname);
|
||||
return FALSE;
|
||||
g_free (dirname);
|
||||
return FALSE;
|
||||
} else {
|
||||
if (mkdir (dirname, dirmode) != 0)
|
||||
return FALSE;
|
||||
if (mkdir (dirname, dirmode) != 0)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ gst_xml_registry_add_path_list_func (GstXMLRegistry * registry)
|
|||
|
||||
if (error) {
|
||||
GST_ERROR ("parsing registry %s: %s\n",
|
||||
registry->location, error->message);
|
||||
registry->location, error->message);
|
||||
goto finished;
|
||||
}
|
||||
|
||||
|
@ -426,8 +426,8 @@ plugin_times_older_than_recurse (gchar * path, time_t regtime)
|
|||
|
||||
if (pathtime > regtime) {
|
||||
GST_CAT_INFO (GST_CAT_PLUGIN_LOADING,
|
||||
"time for %s was %ld; more recent than registry time of %ld\n",
|
||||
path, (long) pathtime, (long) regtime);
|
||||
"time for %s was %ld; more recent than registry time of %ld\n",
|
||||
path, (long) pathtime, (long) regtime);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -436,13 +436,13 @@ plugin_times_older_than_recurse (gchar * path, time_t regtime)
|
|||
while ((dirent = readdir (dir))) {
|
||||
/* don't want to recurse in place or backwards */
|
||||
if (strcmp (dirent->d_name, ".") && strcmp (dirent->d_name, "..")) {
|
||||
pluginname = g_strjoin ("/", path, dirent->d_name, NULL);
|
||||
if (!plugin_times_older_than_recurse (pluginname, regtime)) {
|
||||
g_free (pluginname);
|
||||
closedir (dir);
|
||||
return FALSE;
|
||||
}
|
||||
g_free (pluginname);
|
||||
pluginname = g_strjoin ("/", path, dirent->d_name, NULL);
|
||||
if (!plugin_times_older_than_recurse (pluginname, regtime)) {
|
||||
g_free (pluginname);
|
||||
closedir (dir);
|
||||
return FALSE;
|
||||
}
|
||||
g_free (pluginname);
|
||||
}
|
||||
}
|
||||
closedir (dir);
|
||||
|
@ -459,8 +459,8 @@ plugin_times_older_than (GList * paths, time_t regtime)
|
|||
|
||||
while (paths) {
|
||||
GST_CAT_LOG (GST_CAT_PLUGIN_LOADING,
|
||||
"comparing plugin times from %s with %ld",
|
||||
(gchar *) paths->data, (long) regtime);
|
||||
"comparing plugin times from %s with %ld",
|
||||
(gchar *) paths->data, (long) regtime);
|
||||
if (!plugin_times_older_than_recurse (paths->data, regtime))
|
||||
return FALSE;
|
||||
paths = g_list_next (paths);
|
||||
|
@ -487,16 +487,16 @@ gst_xml_registry_open_func (GstXMLRegistry * registry, GstXMLRegistryMode mode)
|
|||
if (!(gst_registry->flags & GST_REGISTRY_EXISTS)) {
|
||||
/* if it's not writable, then don't bother */
|
||||
if (!(gst_registry->flags & GST_REGISTRY_WRITABLE)) {
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT, "Registry isn't writable");
|
||||
return FALSE;
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT, "Registry isn't writable");
|
||||
return FALSE;
|
||||
}
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT,
|
||||
"Registry doesn't exist, trying to build...");
|
||||
"Registry doesn't exist, trying to build...");
|
||||
gst_registry_rebuild (gst_registry);
|
||||
gst_registry_save (gst_registry);
|
||||
/* FIXME: verify that the flags actually get updated ! */
|
||||
if (!(gst_registry->flags & GST_REGISTRY_EXISTS)) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
/* at this point we know it exists */
|
||||
|
@ -504,32 +504,32 @@ gst_xml_registry_open_func (GstXMLRegistry * registry, GstXMLRegistryMode mode)
|
|||
|
||||
if (!plugin_times_older_than (paths, get_time (registry->location))) {
|
||||
if (gst_registry->flags & GST_REGISTRY_WRITABLE) {
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT, "Registry out of date, rebuilding...");
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT, "Registry out of date, rebuilding...");
|
||||
|
||||
gst_registry_rebuild (gst_registry);
|
||||
gst_registry_rebuild (gst_registry);
|
||||
|
||||
gst_registry_save (gst_registry);
|
||||
gst_registry_save (gst_registry);
|
||||
|
||||
if (!plugin_times_older_than (paths, get_time (registry->location))) {
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT,
|
||||
"Registry still out of date, something is wrong...");
|
||||
return FALSE;
|
||||
}
|
||||
if (!plugin_times_older_than (paths, get_time (registry->location))) {
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT,
|
||||
"Registry still out of date, something is wrong...");
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT,
|
||||
"Can't write to this registry and it's out of date, ignoring it");
|
||||
return FALSE;
|
||||
GST_CAT_INFO (GST_CAT_GST_INIT,
|
||||
"Can't write to this registry and it's out of date, ignoring it");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_GST_INIT, "opening registry %s for reading",
|
||||
registry->location);
|
||||
registry->location);
|
||||
registry->regfile = fopen (registry->location, "r");
|
||||
} else if (mode == GST_XML_REGISTRY_WRITE) {
|
||||
g_return_val_if_fail (gst_registry->flags & GST_REGISTRY_WRITABLE, FALSE);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_GST_INIT, "opening registry %s for writing",
|
||||
registry->location);
|
||||
registry->location);
|
||||
registry->regfile = fopen (registry->location, "w");
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ gst_xml_registry_load_plugin (GstRegistry * registry, GstPlugin * plugin)
|
|||
if (!plugin) {
|
||||
if (error) {
|
||||
g_warning ("could not load plugin %s: %s", plugin->desc.name,
|
||||
error->message);
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
return GST_REGISTRY_PLUGIN_LOAD_ERROR;
|
||||
|
@ -842,7 +842,7 @@ gst_xml_registry_parse_padtemplate (GMarkupParseContext * context,
|
|||
registry->caps = gst_caps_from_string (s);
|
||||
if (registry->caps == NULL) {
|
||||
g_critical ("Could not parse caps: length %d, content: %*s\n", text_len,
|
||||
text_len, text);
|
||||
text_len, text);
|
||||
}
|
||||
g_free (s);
|
||||
return TRUE;
|
||||
|
@ -864,62 +864,62 @@ gst_xml_registry_start_element (GMarkupParseContext * context,
|
|||
switch (xmlregistry->state) {
|
||||
case GST_XML_REGISTRY_NONE:
|
||||
if (!strcmp (element_name, "GST-PluginRegistry")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_TOP;
|
||||
xmlregistry->state = GST_XML_REGISTRY_TOP;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_TOP:
|
||||
if (!strncmp (element_name, "plugin", 6)) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PLUGIN;
|
||||
xmlregistry->parser = gst_xml_registry_parse_plugin;
|
||||
xmlregistry->current_plugin = (GstPlugin *) g_new0 (GstPlugin, 1);
|
||||
xmlregistry->state = GST_XML_REGISTRY_PLUGIN;
|
||||
xmlregistry->parser = gst_xml_registry_parse_plugin;
|
||||
xmlregistry->current_plugin = (GstPlugin *) g_new0 (GstPlugin, 1);
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_PLUGIN:
|
||||
if (!strncmp (element_name, "feature", 7)) {
|
||||
gint i = 0;
|
||||
GstPluginFeature *feature = NULL;
|
||||
gint i = 0;
|
||||
GstPluginFeature *feature = NULL;
|
||||
|
||||
xmlregistry->state = GST_XML_REGISTRY_FEATURE;
|
||||
xmlregistry->state = GST_XML_REGISTRY_FEATURE;
|
||||
|
||||
while (attribute_names[i]) {
|
||||
if (!strncmp (attribute_names[i], "typename", 8)) {
|
||||
feature =
|
||||
GST_PLUGIN_FEATURE (g_object_new (g_type_from_name
|
||||
(attribute_values[i]), NULL));
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (feature) {
|
||||
xmlregistry->current_feature = feature;
|
||||
while (attribute_names[i]) {
|
||||
if (!strncmp (attribute_names[i], "typename", 8)) {
|
||||
feature =
|
||||
GST_PLUGIN_FEATURE (g_object_new (g_type_from_name
|
||||
(attribute_values[i]), NULL));
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (feature) {
|
||||
xmlregistry->current_feature = feature;
|
||||
|
||||
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
||||
GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
|
||||
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
||||
GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
|
||||
|
||||
factory->padtemplates = NULL;
|
||||
xmlregistry->parser = gst_xml_registry_parse_element_factory;
|
||||
break;
|
||||
} else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
||||
xmlregistry->parser = gst_xml_registry_parse_type_find_factory;
|
||||
} else if (GST_IS_SCHEDULER_FACTORY (feature)) {
|
||||
xmlregistry->parser = gst_xml_registry_parse_scheduler_factory;
|
||||
GST_SCHEDULER_FACTORY (feature)->type = 0;
|
||||
} else if (GST_IS_INDEX_FACTORY (feature)) {
|
||||
xmlregistry->parser = gst_xml_registry_parse_index_factory;
|
||||
} else {
|
||||
g_warning ("unknown feature type");
|
||||
}
|
||||
}
|
||||
factory->padtemplates = NULL;
|
||||
xmlregistry->parser = gst_xml_registry_parse_element_factory;
|
||||
break;
|
||||
} else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
||||
xmlregistry->parser = gst_xml_registry_parse_type_find_factory;
|
||||
} else if (GST_IS_SCHEDULER_FACTORY (feature)) {
|
||||
xmlregistry->parser = gst_xml_registry_parse_scheduler_factory;
|
||||
GST_SCHEDULER_FACTORY (feature)->type = 0;
|
||||
} else if (GST_IS_INDEX_FACTORY (feature)) {
|
||||
xmlregistry->parser = gst_xml_registry_parse_index_factory;
|
||||
} else {
|
||||
g_warning ("unknown feature type");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_FEATURE:
|
||||
if (!strncmp (element_name, "padtemplate", 11)) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PADTEMPLATE;
|
||||
xmlregistry->parser = gst_xml_registry_parse_padtemplate;
|
||||
xmlregistry->name_template = NULL;
|
||||
xmlregistry->direction = 0;
|
||||
xmlregistry->presence = 0;
|
||||
xmlregistry->caps = NULL;
|
||||
xmlregistry->state = GST_XML_REGISTRY_PADTEMPLATE;
|
||||
xmlregistry->parser = gst_xml_registry_parse_padtemplate;
|
||||
xmlregistry->name_template = NULL;
|
||||
xmlregistry->direction = 0;
|
||||
xmlregistry->presence = 0;
|
||||
xmlregistry->caps = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -940,41 +940,41 @@ gst_xml_registry_end_element (GMarkupParseContext * context,
|
|||
switch (xmlregistry->state) {
|
||||
case GST_XML_REGISTRY_TOP:
|
||||
if (!strcmp (element_name, "GST-PluginRegistry")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_NONE;
|
||||
xmlregistry->state = GST_XML_REGISTRY_NONE;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_PLUGIN:
|
||||
if (!strcmp (element_name, "plugin")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_TOP;
|
||||
xmlregistry->parser = NULL;
|
||||
gst_registry_add_plugin (GST_REGISTRY (xmlregistry),
|
||||
xmlregistry->current_plugin);
|
||||
xmlregistry->state = GST_XML_REGISTRY_TOP;
|
||||
xmlregistry->parser = NULL;
|
||||
gst_registry_add_plugin (GST_REGISTRY (xmlregistry),
|
||||
xmlregistry->current_plugin);
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_FEATURE:
|
||||
if (!strcmp (element_name, "feature")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PLUGIN;
|
||||
xmlregistry->parser = gst_xml_registry_parse_plugin;
|
||||
gst_plugin_add_feature (xmlregistry->current_plugin,
|
||||
xmlregistry->current_feature);
|
||||
xmlregistry->current_feature = NULL;
|
||||
xmlregistry->state = GST_XML_REGISTRY_PLUGIN;
|
||||
xmlregistry->parser = gst_xml_registry_parse_plugin;
|
||||
gst_plugin_add_feature (xmlregistry->current_plugin,
|
||||
xmlregistry->current_feature);
|
||||
xmlregistry->current_feature = NULL;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_PADTEMPLATE:
|
||||
if (!strcmp (element_name, "padtemplate")) {
|
||||
GstPadTemplate *template;
|
||||
GstPadTemplate *template;
|
||||
|
||||
template = gst_pad_template_new (xmlregistry->name_template,
|
||||
xmlregistry->direction, xmlregistry->presence, xmlregistry->caps);
|
||||
template = gst_pad_template_new (xmlregistry->name_template,
|
||||
xmlregistry->direction, xmlregistry->presence, xmlregistry->caps);
|
||||
|
||||
g_free (xmlregistry->name_template);
|
||||
xmlregistry->name_template = NULL;
|
||||
xmlregistry->caps = NULL;
|
||||
g_free (xmlregistry->name_template);
|
||||
xmlregistry->name_template = NULL;
|
||||
xmlregistry->caps = NULL;
|
||||
|
||||
__gst_element_factory_add_pad_template (GST_ELEMENT_FACTORY
|
||||
(xmlregistry->current_feature), template);
|
||||
xmlregistry->state = GST_XML_REGISTRY_FEATURE;
|
||||
xmlregistry->parser = gst_xml_registry_parse_element_factory;
|
||||
__gst_element_factory_add_pad_template (GST_ELEMENT_FACTORY
|
||||
(xmlregistry->current_feature), template);
|
||||
xmlregistry->state = GST_XML_REGISTRY_FEATURE;
|
||||
xmlregistry->parser = gst_xml_registry_parse_element_factory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -996,7 +996,7 @@ gst_xml_registry_text (GMarkupParseContext * context, const gchar * text,
|
|||
//gst_plugin_add_path (g_strndup (text, text_len));
|
||||
} else if (xmlregistry->parser) {
|
||||
xmlregistry->parser (context, open_tag, text, text_len, xmlregistry,
|
||||
error);
|
||||
error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1026,17 +1026,17 @@ gst_xml_registry_paths_start_element (GMarkupParseContext * context,
|
|||
switch (xmlregistry->state) {
|
||||
case GST_XML_REGISTRY_NONE:
|
||||
if (!strcmp (element_name, "GST-PluginRegistry")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_TOP;
|
||||
xmlregistry->state = GST_XML_REGISTRY_TOP;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_TOP:
|
||||
if (!strcmp (element_name, "gst-registry-paths")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS;
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_PATHS:
|
||||
if (!strcmp (element_name, "path")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATH;
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATH;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1053,12 +1053,12 @@ gst_xml_registry_paths_end_element (GMarkupParseContext * context,
|
|||
switch (xmlregistry->state) {
|
||||
case GST_XML_REGISTRY_PATH:
|
||||
if (!strcmp (element_name, "path")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS;
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_PATHS:
|
||||
if (!strcmp (element_name, "gst-plugin-paths")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS_DONE;
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS_DONE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1074,7 +1074,7 @@ gst_xml_registry_paths_text (GMarkupParseContext * context, const gchar * text,
|
|||
|
||||
if (xmlregistry->state == GST_XML_REGISTRY_PATH)
|
||||
gst_registry_add_path (GST_REGISTRY (xmlregistry), g_strndup (text,
|
||||
text_len));
|
||||
text_len));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1183,12 +1183,12 @@ gst_xml_registry_save_feature (GstXMLRegistry * xmlregistry,
|
|||
gchar **protocol;
|
||||
|
||||
PUT_ESCAPED ("uri_type",
|
||||
factory->uri_type == GST_URI_SINK ? "sink" : "source");
|
||||
factory->uri_type == GST_URI_SINK ? "sink" : "source");
|
||||
g_assert (factory->uri_protocols);
|
||||
protocol = factory->uri_protocols;
|
||||
while (*protocol) {
|
||||
PUT_ESCAPED ("uri_protocol", *protocol);
|
||||
protocol++;
|
||||
PUT_ESCAPED ("uri_protocol", *protocol);
|
||||
protocol++;
|
||||
}
|
||||
}
|
||||
} else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
||||
|
@ -1200,8 +1200,8 @@ gst_xml_registry_save_feature (GstXMLRegistry * xmlregistry,
|
|||
}
|
||||
if (factory->extensions) {
|
||||
while (factory->extensions[i]) {
|
||||
PUT_ESCAPED ("extension", factory->extensions[i]);
|
||||
i++;
|
||||
PUT_ESCAPED ("extension", factory->extensions[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else if (GST_IS_SCHEDULER_FACTORY (feature)) {
|
||||
|
@ -1231,7 +1231,7 @@ gst_xml_registry_save_plugin (GstXMLRegistry * xmlregistry, GstPlugin * plugin)
|
|||
GstPluginFeature *feature = GST_PLUGIN_FEATURE (walk->data);
|
||||
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, "<feature typename=\"%s\">\n",
|
||||
g_type_name (G_OBJECT_TYPE (feature)));
|
||||
g_type_name (G_OBJECT_TYPE (feature)));
|
||||
gst_xml_registry_save_feature (xmlregistry, feature);
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, "</feature>\n");
|
||||
|
||||
|
@ -1305,20 +1305,20 @@ gst_xml_registry_rebuild_recurse (GstXMLRegistry * registry,
|
|||
gchar *dirname;
|
||||
|
||||
if (*dirent == '=') {
|
||||
/* =build, =inst, etc. -- automake distcheck directories */
|
||||
continue;
|
||||
/* =build, =inst, etc. -- automake distcheck directories */
|
||||
continue;
|
||||
}
|
||||
|
||||
dirname = g_strjoin ("/", directory, dirent, NULL);
|
||||
ret =
|
||||
g_list_concat (ret, gst_xml_registry_rebuild_recurse (registry,
|
||||
dirname));
|
||||
g_list_concat (ret, gst_xml_registry_rebuild_recurse (registry,
|
||||
dirname));
|
||||
g_free (dirname);
|
||||
}
|
||||
g_dir_close (dir);
|
||||
} else {
|
||||
if ((temp = strstr (directory, G_MODULE_SUFFIX)) &&
|
||||
(!strcmp (temp, G_MODULE_SUFFIX))) {
|
||||
(!strcmp (temp, G_MODULE_SUFFIX))) {
|
||||
ret = g_list_prepend (ret, g_strdup (directory));
|
||||
}
|
||||
}
|
||||
|
@ -1341,10 +1341,10 @@ gst_xml_registry_rebuild (GstRegistry * registry)
|
|||
gchar *path = (gchar *) walk->data;
|
||||
|
||||
GST_CAT_INFO (GST_CAT_PLUGIN_LOADING,
|
||||
"Rebuilding registry %p in directory %s...", registry, path);
|
||||
"Rebuilding registry %p in directory %s...", registry, path);
|
||||
|
||||
plugins = g_list_concat (plugins,
|
||||
gst_xml_registry_rebuild_recurse (xmlregistry, path));
|
||||
gst_xml_registry_rebuild_recurse (xmlregistry, path));
|
||||
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
|
@ -1359,8 +1359,8 @@ gst_xml_registry_rebuild (GstRegistry * registry)
|
|||
g_assert (walk->data);
|
||||
plugin = gst_plugin_load_file ((gchar *) walk->data, NULL);
|
||||
if (plugin) {
|
||||
prune = g_list_prepend (prune, walk->data);
|
||||
gst_registry_add_plugin (registry, plugin);
|
||||
prune = g_list_prepend (prune, walk->data);
|
||||
gst_registry_add_plugin (registry, plugin);
|
||||
}
|
||||
|
||||
walk = g_list_next (walk);
|
||||
|
@ -1380,11 +1380,11 @@ gst_xml_registry_rebuild (GstRegistry * registry)
|
|||
while (walk) {
|
||||
if ((plugin = gst_plugin_load_file ((gchar *) walk->data, &error))) {
|
||||
g_warning ("Bizarre behavior: plugin %s actually loaded",
|
||||
(gchar *) walk->data);
|
||||
(gchar *) walk->data);
|
||||
gst_registry_add_plugin (registry, plugin);
|
||||
} else {
|
||||
GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "Plugin %s failed to load: %s",
|
||||
(gchar *) walk->data, error->message);
|
||||
(gchar *) walk->data, error->message);
|
||||
|
||||
g_free (walk->data);
|
||||
g_error_free (error);
|
||||
|
|
|
@ -83,13 +83,15 @@ typedef enum
|
|||
GST_BASIC_SCHEDULER_STATE_STOPPED,
|
||||
GST_BASIC_SCHEDULER_STATE_ERROR,
|
||||
GST_BASIC_SCHEDULER_STATE_RUNNING,
|
||||
} GstBasicSchedulerState;
|
||||
}
|
||||
GstBasicSchedulerState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* something important has changed inside the scheduler */
|
||||
GST_BASIC_SCHEDULER_CHANGE = GST_SCHEDULER_FLAG_LAST,
|
||||
} GstBasicSchedulerFlags;
|
||||
}
|
||||
GstBasicSchedulerFlags;
|
||||
|
||||
struct _GstBasicScheduler
|
||||
{
|
||||
|
@ -198,8 +200,8 @@ gst_basic_scheduler_get_type (void)
|
|||
};
|
||||
|
||||
_gst_basic_scheduler_type =
|
||||
g_type_register_static (GST_TYPE_SCHEDULER,
|
||||
"Gst" COTHREADS_NAME_CAPITAL "Scheduler", &scheduler_info, 0);
|
||||
g_type_register_static (GST_TYPE_SCHEDULER,
|
||||
"Gst" COTHREADS_NAME_CAPITAL "Scheduler", &scheduler_info, 0);
|
||||
}
|
||||
return _gst_basic_scheduler_type;
|
||||
}
|
||||
|
@ -302,7 +304,7 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|||
gst_object_ref (GST_OBJECT (element));
|
||||
do {
|
||||
GST_CAT_DEBUG (debug_dataflow, "calling loopfunc %s for element %s",
|
||||
GST_DEBUG_FUNCPTR_NAME (element->loopfunc), name);
|
||||
GST_DEBUG_FUNCPTR_NAME (element->loopfunc), name);
|
||||
(element->loopfunc) (element);
|
||||
GST_CAT_DEBUG (debug_dataflow, "element %s ended loop function", name);
|
||||
|
||||
|
@ -343,38 +345,38 @@ gst_basic_scheduler_chain_wrapper (int argc, char **argv)
|
|||
pads = element->pads;
|
||||
|
||||
while (pads) {
|
||||
GstPad *pad = GST_PAD (pads->data);
|
||||
GstRealPad *realpad;
|
||||
GstPad *pad = GST_PAD (pads->data);
|
||||
GstRealPad *realpad;
|
||||
|
||||
if (!GST_IS_REAL_PAD (pad))
|
||||
continue;
|
||||
if (!GST_IS_REAL_PAD (pad))
|
||||
continue;
|
||||
|
||||
realpad = GST_REAL_PAD (pad);
|
||||
realpad = GST_REAL_PAD (pad);
|
||||
|
||||
if (GST_RPAD_DIRECTION (realpad) == GST_PAD_SINK &&
|
||||
GST_PAD_IS_LINKED (realpad) &&
|
||||
g_slist_find (already_iterated, pad) == NULL) {
|
||||
GstData *data;
|
||||
if (GST_RPAD_DIRECTION (realpad) == GST_PAD_SINK &&
|
||||
GST_PAD_IS_LINKED (realpad) &&
|
||||
g_slist_find (already_iterated, pad) == NULL) {
|
||||
GstData *data;
|
||||
|
||||
GST_CAT_DEBUG (debug_dataflow, "pulling data from %s:%s", name,
|
||||
GST_PAD_NAME (pad));
|
||||
data = gst_pad_pull (pad);
|
||||
if (data) {
|
||||
if (GST_IS_EVENT (data) && !GST_ELEMENT_IS_EVENT_AWARE (element)) {
|
||||
gst_pad_send_event (pad, GST_EVENT (data));
|
||||
} else {
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"calling chain function of %s:%s %p", name,
|
||||
GST_PAD_NAME (pad), data);
|
||||
GST_RPAD_CHAINFUNC (realpad) (pad, data);
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"calling chain function of element %s done", name);
|
||||
}
|
||||
}
|
||||
already_iterated = g_slist_prepend (already_iterated, pad);
|
||||
break;
|
||||
}
|
||||
pads = g_list_next (pads);
|
||||
GST_CAT_DEBUG (debug_dataflow, "pulling data from %s:%s", name,
|
||||
GST_PAD_NAME (pad));
|
||||
data = gst_pad_pull (pad);
|
||||
if (data) {
|
||||
if (GST_IS_EVENT (data) && !GST_ELEMENT_IS_EVENT_AWARE (element)) {
|
||||
gst_pad_send_event (pad, GST_EVENT (data));
|
||||
} else {
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"calling chain function of %s:%s %p", name,
|
||||
GST_PAD_NAME (pad), data);
|
||||
GST_RPAD_CHAINFUNC (realpad) (pad, data);
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"calling chain function of element %s done", name);
|
||||
}
|
||||
}
|
||||
already_iterated = g_slist_prepend (already_iterated, pad);
|
||||
break;
|
||||
}
|
||||
pads = g_list_next (pads);
|
||||
}
|
||||
} while (pads != NULL);
|
||||
g_slist_free (already_iterated);
|
||||
|
@ -414,22 +416,22 @@ gst_basic_scheduler_src_wrapper (int argc, char **argv)
|
|||
while (pads) {
|
||||
|
||||
if (!GST_IS_REAL_PAD (pads->data))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
realpad = GST_REAL_PAD (pads->data);
|
||||
|
||||
pads = g_list_next (pads);
|
||||
if (GST_RPAD_DIRECTION (realpad) == GST_PAD_SRC
|
||||
&& GST_PAD_IS_USABLE (realpad)) {
|
||||
GST_CAT_DEBUG (debug_dataflow, "calling _getfunc for %s:%s",
|
||||
GST_DEBUG_PAD_NAME (realpad));
|
||||
g_return_val_if_fail (GST_RPAD_GETFUNC (realpad) != NULL, 0);
|
||||
data = GST_RPAD_GETFUNC (realpad) (GST_PAD (realpad));
|
||||
if (data) {
|
||||
GST_CAT_DEBUG (debug_dataflow, "calling gst_pad_push on pad %s:%s %p",
|
||||
GST_DEBUG_PAD_NAME (realpad), data);
|
||||
gst_pad_push (GST_PAD (realpad), data);
|
||||
}
|
||||
&& GST_PAD_IS_USABLE (realpad)) {
|
||||
GST_CAT_DEBUG (debug_dataflow, "calling _getfunc for %s:%s",
|
||||
GST_DEBUG_PAD_NAME (realpad));
|
||||
g_return_val_if_fail (GST_RPAD_GETFUNC (realpad) != NULL, 0);
|
||||
data = GST_RPAD_GETFUNC (realpad) (GST_PAD (realpad));
|
||||
if (data) {
|
||||
GST_CAT_DEBUG (debug_dataflow, "calling gst_pad_push on pad %s:%s %p",
|
||||
GST_DEBUG_PAD_NAME (realpad), data);
|
||||
gst_pad_push (GST_PAD (realpad), data);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
|
||||
|
@ -466,7 +468,7 @@ gst_basic_scheduler_chainhandler_proxy (GstPad * pad, GstData * data)
|
|||
*/
|
||||
while (GST_RPAD_BUFPEN (GST_RPAD_PEER (pad)) != NULL && --loop_count) {
|
||||
GST_CAT_DEBUG (debug_dataflow, "switching to %p to empty bufpen %d",
|
||||
GST_ELEMENT_THREADSTATE (parent), loop_count);
|
||||
GST_ELEMENT_THREADSTATE (parent), loop_count);
|
||||
|
||||
do_element_switch (parent);
|
||||
|
||||
|
@ -481,7 +483,7 @@ gst_basic_scheduler_chainhandler_proxy (GstPad * pad, GstData * data)
|
|||
|
||||
if (loop_count == 0) {
|
||||
GST_ELEMENT_ERROR (parent, CORE, SCHEDULER, (NULL),
|
||||
("(internal error) basic: maximum number of switches exceeded"));
|
||||
("(internal error) basic: maximum number of switches exceeded"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -538,7 +540,7 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad)
|
|||
while (GST_RPAD_BUFPEN (pad) == NULL) {
|
||||
|
||||
GST_CAT_DEBUG (debug_dataflow, "switching to \"%s\": %p to fill bufpen",
|
||||
GST_ELEMENT_NAME (parent), GST_ELEMENT_THREADSTATE (parent));
|
||||
GST_ELEMENT_NAME (parent), GST_ELEMENT_THREADSTATE (parent));
|
||||
|
||||
do_element_switch (parent);
|
||||
|
||||
|
@ -547,7 +549,7 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad)
|
|||
GST_CAT_DEBUG (debug_dataflow, "new pad in mid-switch!");
|
||||
pad = (GstPad *) GST_RPAD_PEER (peer);
|
||||
if (!pad) {
|
||||
GST_ELEMENT_ERROR (parent, CORE, PAD, (NULL), ("pad unlinked"));
|
||||
GST_ELEMENT_ERROR (parent, CORE, PAD, (NULL), ("pad unlinked"));
|
||||
}
|
||||
parent = GST_PAD_PARENT (pad);
|
||||
peer = GST_RPAD_PEER (pad);
|
||||
|
@ -630,25 +632,25 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain)
|
|||
/* if the element has a loopfunc... */
|
||||
if (element->loopfunc != NULL) {
|
||||
wrapper_function =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_loopfunc_wrapper);
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_loopfunc_wrapper);
|
||||
GST_DEBUG ("element '%s' is a loop-based", GST_ELEMENT_NAME (element));
|
||||
} else {
|
||||
/* otherwise we need to decide what kind of cothread
|
||||
* if it's not DECOUPLED, we decide based on
|
||||
* whether it's a source or not */
|
||||
if (!decoupled) {
|
||||
/* if it doesn't have any sinks, it must be a source (duh) */
|
||||
if (element->numsinkpads == 0) {
|
||||
wrapper_function =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_src_wrapper);
|
||||
GST_DEBUG ("element '%s' is a source, using _src_wrapper",
|
||||
GST_ELEMENT_NAME (element));
|
||||
} else {
|
||||
wrapper_function =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_chain_wrapper);
|
||||
GST_DEBUG ("element '%s' is a filter, using _chain_wrapper",
|
||||
GST_ELEMENT_NAME (element));
|
||||
}
|
||||
/* if it doesn't have any sinks, it must be a source (duh) */
|
||||
if (element->numsinkpads == 0) {
|
||||
wrapper_function =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_src_wrapper);
|
||||
GST_DEBUG ("element '%s' is a source, using _src_wrapper",
|
||||
GST_ELEMENT_NAME (element));
|
||||
} else {
|
||||
wrapper_function =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_chain_wrapper);
|
||||
GST_DEBUG ("element '%s' is a filter, using _chain_wrapper",
|
||||
GST_ELEMENT_NAME (element));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -661,108 +663,108 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain)
|
|||
pads = g_list_next (pads);
|
||||
|
||||
if (!GST_IS_REAL_PAD (pad))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
peerpad = GST_PAD_PEER (pad);
|
||||
if (peerpad) {
|
||||
GstElement *peerelement = GST_ELEMENT (GST_PAD_PARENT (peerpad));
|
||||
gboolean different_sched =
|
||||
(peerelement->sched != GST_SCHEDULER (chain->sched));
|
||||
gboolean peer_decoupled =
|
||||
GST_FLAG_IS_SET (peerelement, GST_ELEMENT_DECOUPLED);
|
||||
GstElement *peerelement = GST_ELEMENT (GST_PAD_PARENT (peerpad));
|
||||
gboolean different_sched =
|
||||
(peerelement->sched != GST_SCHEDULER (chain->sched));
|
||||
gboolean peer_decoupled =
|
||||
GST_FLAG_IS_SET (peerelement, GST_ELEMENT_DECOUPLED);
|
||||
|
||||
GST_DEBUG ("inspecting pad %s:%s", GST_DEBUG_PAD_NAME (peerpad));
|
||||
GST_DEBUG ("inspecting pad %s:%s", GST_DEBUG_PAD_NAME (peerpad));
|
||||
|
||||
/* we don't need to check this for decoupled elements */
|
||||
if (!decoupled) {
|
||||
/* if the peer element is in another schedule,
|
||||
* it's not decoupled and we are not decoupled
|
||||
* either, we have an error */
|
||||
if (different_sched && !peer_decoupled) {
|
||||
GST_ELEMENT_ERROR (element, CORE, SCHEDULER, (NULL),
|
||||
("element \"%s\" is not decoupled but has pads in different schedulers",
|
||||
GST_ELEMENT_NAME (element)));
|
||||
return FALSE;
|
||||
}
|
||||
/* ok, the peer is in a different scheduler and is decoupled,
|
||||
* we need to set the
|
||||
* handlers so we can talk with it */
|
||||
else if (different_sched) {
|
||||
if (GST_RPAD_DIRECTION (peerpad) == GST_PAD_SINK) {
|
||||
GST_DEBUG ("copying chain func into push proxy for peer %s:%s",
|
||||
GST_DEBUG_PAD_NAME (peerpad));
|
||||
GST_RPAD_CHAINHANDLER (peerpad) = GST_RPAD_CHAINFUNC (peerpad);
|
||||
} else {
|
||||
GST_DEBUG ("copying get func into pull proxy for peer %s:%s",
|
||||
GST_DEBUG_PAD_NAME (peerpad));
|
||||
GST_RPAD_GETHANDLER (peerpad) = GST_RPAD_GETFUNC (peerpad);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* in any case we need to copy the eventfunc into the handler */
|
||||
GST_RPAD_EVENTHANDLER (peerpad) = GST_RPAD_EVENTFUNC (peerpad);
|
||||
/* we don't need to check this for decoupled elements */
|
||||
if (!decoupled) {
|
||||
/* if the peer element is in another schedule,
|
||||
* it's not decoupled and we are not decoupled
|
||||
* either, we have an error */
|
||||
if (different_sched && !peer_decoupled) {
|
||||
GST_ELEMENT_ERROR (element, CORE, SCHEDULER, (NULL),
|
||||
("element \"%s\" is not decoupled but has pads in different schedulers",
|
||||
GST_ELEMENT_NAME (element)));
|
||||
return FALSE;
|
||||
}
|
||||
/* ok, the peer is in a different scheduler and is decoupled,
|
||||
* we need to set the
|
||||
* handlers so we can talk with it */
|
||||
else if (different_sched) {
|
||||
if (GST_RPAD_DIRECTION (peerpad) == GST_PAD_SINK) {
|
||||
GST_DEBUG ("copying chain func into push proxy for peer %s:%s",
|
||||
GST_DEBUG_PAD_NAME (peerpad));
|
||||
GST_RPAD_CHAINHANDLER (peerpad) = GST_RPAD_CHAINFUNC (peerpad);
|
||||
} else {
|
||||
GST_DEBUG ("copying get func into pull proxy for peer %s:%s",
|
||||
GST_DEBUG_PAD_NAME (peerpad));
|
||||
GST_RPAD_GETHANDLER (peerpad) = GST_RPAD_GETFUNC (peerpad);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* in any case we need to copy the eventfunc into the handler */
|
||||
GST_RPAD_EVENTHANDLER (peerpad) = GST_RPAD_EVENTFUNC (peerpad);
|
||||
}
|
||||
|
||||
/* if the element is DECOUPLED or outside the manager, we have to chain */
|
||||
if (decoupled) {
|
||||
/* set the chain proxies */
|
||||
if (GST_RPAD_DIRECTION (pad) == GST_PAD_SINK) {
|
||||
GST_DEBUG ("copying chain function into push proxy for %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_RPAD_CHAINHANDLER (pad) = GST_RPAD_CHAINFUNC (pad);
|
||||
} else {
|
||||
GST_DEBUG ("copying get function into pull proxy for %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_RPAD_GETHANDLER (pad) = GST_RPAD_GETFUNC (pad);
|
||||
}
|
||||
/* set the chain proxies */
|
||||
if (GST_RPAD_DIRECTION (pad) == GST_PAD_SINK) {
|
||||
GST_DEBUG ("copying chain function into push proxy for %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_RPAD_CHAINHANDLER (pad) = GST_RPAD_CHAINFUNC (pad);
|
||||
} else {
|
||||
GST_DEBUG ("copying get function into pull proxy for %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_RPAD_GETHANDLER (pad) = GST_RPAD_GETFUNC (pad);
|
||||
}
|
||||
}
|
||||
/* otherwise we really are a cothread */
|
||||
else {
|
||||
if (GST_RPAD_DIRECTION (pad) == GST_PAD_SINK) {
|
||||
GST_DEBUG ("setting cothreaded push proxy for sinkpad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_RPAD_CHAINHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_chainhandler_proxy);
|
||||
GST_RPAD_EVENTHANDLER (pad) = GST_RPAD_EVENTFUNC (pad);
|
||||
} else {
|
||||
GST_DEBUG ("setting cothreaded pull proxy for srcpad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_RPAD_GETHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_gethandler_proxy);
|
||||
/* the gethandler proxy function can queue a buffer in the bufpen, we need
|
||||
* to remove this buffer when a flush event is sent on the pad */
|
||||
GST_RPAD_EVENTHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_eventhandler_proxy);
|
||||
}
|
||||
if (GST_RPAD_DIRECTION (pad) == GST_PAD_SINK) {
|
||||
GST_DEBUG ("setting cothreaded push proxy for sinkpad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_RPAD_CHAINHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_chainhandler_proxy);
|
||||
GST_RPAD_EVENTHANDLER (pad) = GST_RPAD_EVENTFUNC (pad);
|
||||
} else {
|
||||
GST_DEBUG ("setting cothreaded pull proxy for srcpad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_RPAD_GETHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_gethandler_proxy);
|
||||
/* the gethandler proxy function can queue a buffer in the bufpen, we need
|
||||
* to remove this buffer when a flush event is sent on the pad */
|
||||
GST_RPAD_EVENTHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_eventhandler_proxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* need to set up the cothread now */
|
||||
if (wrapper_function != NULL) {
|
||||
if (GST_ELEMENT_THREADSTATE (element) == NULL) {
|
||||
GST_DEBUG ("about to create a cothread, wrapper for '%s' is &%s",
|
||||
GST_ELEMENT_NAME (element),
|
||||
GST_DEBUG_FUNCPTR_NAME (wrapper_function));
|
||||
do_cothread_create (GST_ELEMENT_THREADSTATE (element),
|
||||
chain->sched->context, wrapper_function, 0, (char **) element);
|
||||
if (GST_ELEMENT_THREADSTATE (element) == NULL) {
|
||||
GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, (NULL),
|
||||
("could not create cothread for \"%s\"",
|
||||
GST_ELEMENT_NAME (element)));
|
||||
return FALSE;
|
||||
}
|
||||
GST_DEBUG ("created cothread %p for '%s'",
|
||||
GST_ELEMENT_THREADSTATE (element), GST_ELEMENT_NAME (element));
|
||||
GST_DEBUG ("about to create a cothread, wrapper for '%s' is &%s",
|
||||
GST_ELEMENT_NAME (element),
|
||||
GST_DEBUG_FUNCPTR_NAME (wrapper_function));
|
||||
do_cothread_create (GST_ELEMENT_THREADSTATE (element),
|
||||
chain->sched->context, wrapper_function, 0, (char **) element);
|
||||
if (GST_ELEMENT_THREADSTATE (element) == NULL) {
|
||||
GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, (NULL),
|
||||
("could not create cothread for \"%s\"",
|
||||
GST_ELEMENT_NAME (element)));
|
||||
return FALSE;
|
||||
}
|
||||
GST_DEBUG ("created cothread %p for '%s'",
|
||||
GST_ELEMENT_THREADSTATE (element), GST_ELEMENT_NAME (element));
|
||||
} else {
|
||||
/* set the cothread wrapper function */
|
||||
GST_DEBUG ("about to set the wrapper function for '%s' to &%s",
|
||||
GST_ELEMENT_NAME (element),
|
||||
GST_DEBUG_FUNCPTR_NAME (wrapper_function));
|
||||
do_cothread_setfunc (GST_ELEMENT_THREADSTATE (element),
|
||||
chain->sched->context, wrapper_function, 0, (char **) element);
|
||||
GST_DEBUG ("set wrapper function for '%s' to &%s",
|
||||
GST_ELEMENT_NAME (element),
|
||||
GST_DEBUG_FUNCPTR_NAME (wrapper_function));
|
||||
/* set the cothread wrapper function */
|
||||
GST_DEBUG ("about to set the wrapper function for '%s' to &%s",
|
||||
GST_ELEMENT_NAME (element),
|
||||
GST_DEBUG_FUNCPTR_NAME (wrapper_function));
|
||||
do_cothread_setfunc (GST_ELEMENT_THREADSTATE (element),
|
||||
chain->sched->context, wrapper_function, 0, (char **) element);
|
||||
GST_DEBUG ("set wrapper function for '%s' to &%s",
|
||||
GST_ELEMENT_NAME (element),
|
||||
GST_DEBUG_FUNCPTR_NAME (wrapper_function));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -807,8 +809,8 @@ gst_basic_scheduler_chain_destroy (GstSchedulerChain * chain)
|
|||
sched->num_chains--;
|
||||
|
||||
/* destroy the chain */
|
||||
g_list_free (chain->disabled); /* should be empty... */
|
||||
g_list_free (chain->elements); /* ditto */
|
||||
g_list_free (chain->disabled); /* should be empty... */
|
||||
g_list_free (chain->elements); /* ditto */
|
||||
|
||||
GST_INFO ("destroyed chain %p, now are %d chains in sched %p", chain,
|
||||
sched->num_chains, sched);
|
||||
|
@ -829,11 +831,11 @@ gst_basic_scheduler_chain_add_element (GstSchedulerChain * chain,
|
|||
/* add the element to either the main list or the disabled list */
|
||||
if (GST_STATE (element) == GST_STATE_PLAYING) {
|
||||
GST_INFO ("adding element \"%s\" to chain %p enabled",
|
||||
GST_ELEMENT_NAME (element), chain);
|
||||
GST_ELEMENT_NAME (element), chain);
|
||||
chain->elements = g_list_prepend (chain->elements, element);
|
||||
} else {
|
||||
GST_INFO ("adding element \"%s\" to chain %p disabled",
|
||||
GST_ELEMENT_NAME (element), chain);
|
||||
GST_ELEMENT_NAME (element), chain);
|
||||
chain->disabled = g_list_prepend (chain->disabled, element);
|
||||
}
|
||||
chain->num_elements++;
|
||||
|
@ -861,7 +863,7 @@ gst_basic_scheduler_chain_enable_element (GstSchedulerChain * chain,
|
|||
|
||||
/* reschedule the chain */
|
||||
return gst_basic_scheduler_cothreaded_chain (GST_BIN (GST_SCHEDULER (chain->
|
||||
sched)->parent), chain);
|
||||
sched)->parent), chain);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -962,9 +964,9 @@ gst_basic_scheduler_chain_elements (GstBasicScheduler * sched,
|
|||
GST_INFO ("merging chain %p into chain %p", chain2, chain1);
|
||||
/* take the contents of chain2 and merge them into chain1 */
|
||||
chain1->disabled =
|
||||
g_list_concat (chain1->disabled, g_list_copy (chain2->disabled));
|
||||
g_list_concat (chain1->disabled, g_list_copy (chain2->disabled));
|
||||
chain1->elements =
|
||||
g_list_concat (chain1->elements, g_list_copy (chain2->elements));
|
||||
g_list_concat (chain1->elements, g_list_copy (chain2->elements));
|
||||
chain1->num_elements += chain2->num_elements;
|
||||
/* FIXME chain changed here */
|
||||
/* gst_basic_scheduler_cothreaded_chain(chain->sched->parent,chain); */
|
||||
|
@ -1042,16 +1044,16 @@ gst_basic_scheduler_chain_recursive_add (GstSchedulerChain * chain,
|
|||
pads = g_list_next (pads);
|
||||
|
||||
GST_DEBUG ("have pad %s:%s, checking for valid peer",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
/* if the peer exists and could be in the same chain */
|
||||
if (GST_PAD_PEER (pad)) {
|
||||
GST_DEBUG ("has peer %s:%s", GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)));
|
||||
peerelement = GST_PAD_PARENT (GST_PAD_PEER (pad));
|
||||
if (GST_ELEMENT_SCHED (GST_PAD_PARENT (pad)) ==
|
||||
GST_ELEMENT_SCHED (peerelement)) {
|
||||
GST_DEBUG ("peer \"%s\" is valid for same chain",
|
||||
GST_ELEMENT_NAME (peerelement));
|
||||
gst_basic_scheduler_chain_recursive_add (chain, peerelement, remove);
|
||||
GST_ELEMENT_SCHED (peerelement)) {
|
||||
GST_DEBUG ("peer \"%s\" is valid for same chain",
|
||||
GST_ELEMENT_NAME (peerelement));
|
||||
gst_basic_scheduler_chain_recursive_add (chain, peerelement, remove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1124,13 +1126,13 @@ gst_basic_scheduler_remove_element (GstScheduler * sched, GstElement * element)
|
|||
|
||||
if (g_list_find (bsched->elements, element)) {
|
||||
GST_INFO ("removing element \"%s\" from scheduler",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
|
||||
/* if we are removing the currently scheduled element */
|
||||
if (bsched->current == element) {
|
||||
GST_FLAG_SET (element, GST_ELEMENT_COTHREAD_STOPPING);
|
||||
if (element->post_run_func)
|
||||
element->post_run_func (element);
|
||||
element->post_run_func (element);
|
||||
bsched->current = NULL;
|
||||
}
|
||||
/* find what chain the element is in */
|
||||
|
@ -1176,17 +1178,17 @@ gst_basic_scheduler_state_transition (GstScheduler * sched,
|
|||
/* remove it from the chain */
|
||||
if (chain) {
|
||||
if (transition == GST_STATE_PLAYING_TO_PAUSED) {
|
||||
gst_basic_scheduler_chain_disable_element (chain, element);
|
||||
gst_basic_scheduler_chain_disable_element (chain, element);
|
||||
} else if (transition == GST_STATE_PAUSED_TO_PLAYING) {
|
||||
if (!gst_basic_scheduler_chain_enable_element (chain, element)) {
|
||||
GST_INFO ("could not enable element \"%s\"",
|
||||
GST_ELEMENT_NAME (element));
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
if (!gst_basic_scheduler_chain_enable_element (chain, element)) {
|
||||
GST_INFO ("could not enable element \"%s\"",
|
||||
GST_ELEMENT_NAME (element));
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GST_INFO ("element \"%s\" not found in any chain, no state change",
|
||||
GST_ELEMENT_NAME (element));
|
||||
GST_ELEMENT_NAME (element));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1266,7 +1268,7 @@ gst_basic_scheduler_pad_link (GstScheduler * sched, GstPad * srcpad,
|
|||
|
||||
if (GST_ELEMENT_SCHED (srcelement) == GST_ELEMENT_SCHED (sinkelement)) {
|
||||
GST_INFO ("peer %s:%s is in same scheduler, chaining together",
|
||||
GST_DEBUG_PAD_NAME (sinkpad));
|
||||
GST_DEBUG_PAD_NAME (sinkpad));
|
||||
gst_basic_scheduler_chain_elements (bsched, srcelement, sinkelement);
|
||||
}
|
||||
}
|
||||
|
@ -1352,7 +1354,7 @@ gst_basic_scheduler_pad_select (GstScheduler * sched, GList * padlist)
|
|||
pad = GST_PAD (padlist->data);
|
||||
|
||||
GST_RPAD_CHAINHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_select_proxy);
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_select_proxy);
|
||||
|
||||
padlist = g_list_next (padlist);
|
||||
}
|
||||
|
@ -1397,71 +1399,71 @@ gst_basic_scheduler_iterate (GstScheduler * sched)
|
|||
/* all we really have to do is switch to the first child */
|
||||
/* FIXME this should be lots more intelligent about where to start */
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"starting iteration via cothreads using %s scheduler", _SCHEDULER_NAME);
|
||||
"starting iteration via cothreads using %s scheduler", _SCHEDULER_NAME);
|
||||
|
||||
if (chain->elements) {
|
||||
entry = NULL; /*MattH ADDED? */
|
||||
entry = NULL; /*MattH ADDED? */
|
||||
GST_DEBUG ("there are %d elements in this chain", chain->num_elements);
|
||||
elements = chain->elements;
|
||||
while (elements) {
|
||||
entry = GST_ELEMENT (elements->data);
|
||||
elements = g_list_next (elements);
|
||||
if (GST_FLAG_IS_SET (entry, GST_ELEMENT_DECOUPLED)) {
|
||||
GST_DEBUG ("entry \"%s\" is DECOUPLED, skipping",
|
||||
GST_ELEMENT_NAME (entry));
|
||||
entry = NULL;
|
||||
} else if (GST_FLAG_IS_SET (entry, GST_ELEMENT_INFINITE_LOOP)) {
|
||||
GST_DEBUG ("entry \"%s\" is not valid, skipping",
|
||||
GST_ELEMENT_NAME (entry));
|
||||
entry = NULL;
|
||||
} else
|
||||
break;
|
||||
entry = GST_ELEMENT (elements->data);
|
||||
elements = g_list_next (elements);
|
||||
if (GST_FLAG_IS_SET (entry, GST_ELEMENT_DECOUPLED)) {
|
||||
GST_DEBUG ("entry \"%s\" is DECOUPLED, skipping",
|
||||
GST_ELEMENT_NAME (entry));
|
||||
entry = NULL;
|
||||
} else if (GST_FLAG_IS_SET (entry, GST_ELEMENT_INFINITE_LOOP)) {
|
||||
GST_DEBUG ("entry \"%s\" is not valid, skipping",
|
||||
GST_ELEMENT_NAME (entry));
|
||||
entry = NULL;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
if (entry) {
|
||||
GstSchedulerState state;
|
||||
GstSchedulerState state;
|
||||
|
||||
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
|
||||
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
|
||||
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"set COTHREAD_STOPPING flag on \"%s\"(@%p)",
|
||||
GST_ELEMENT_NAME (entry), entry);
|
||||
if (GST_ELEMENT_THREADSTATE (entry)) {
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"set COTHREAD_STOPPING flag on \"%s\"(@%p)",
|
||||
GST_ELEMENT_NAME (entry), entry);
|
||||
if (GST_ELEMENT_THREADSTATE (entry)) {
|
||||
|
||||
do_switch_from_main (entry);
|
||||
do_switch_from_main (entry);
|
||||
|
||||
state = GST_SCHEDULER_STATE (sched);
|
||||
/* if something changed, return - go on else */
|
||||
if (GST_FLAG_IS_SET (bsched, GST_BASIC_SCHEDULER_CHANGE) &&
|
||||
state != GST_SCHEDULER_STATE_ERROR)
|
||||
return GST_SCHEDULER_STATE_RUNNING;
|
||||
} else {
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"cothread switch not possible, element has no threadstate");
|
||||
return GST_SCHEDULER_STATE_ERROR;
|
||||
}
|
||||
state = GST_SCHEDULER_STATE (sched);
|
||||
/* if something changed, return - go on else */
|
||||
if (GST_FLAG_IS_SET (bsched, GST_BASIC_SCHEDULER_CHANGE) &&
|
||||
state != GST_SCHEDULER_STATE_ERROR)
|
||||
return GST_SCHEDULER_STATE_RUNNING;
|
||||
} else {
|
||||
GST_CAT_DEBUG (debug_dataflow,
|
||||
"cothread switch not possible, element has no threadstate");
|
||||
return GST_SCHEDULER_STATE_ERROR;
|
||||
}
|
||||
|
||||
/* following is a check to see if the chain was interrupted due to a
|
||||
* top-half state_change(). (i.e., if there's a pending state.)
|
||||
*
|
||||
* if it was, return to gstthread.c::gst_thread_main_loop() to
|
||||
* execute the state change.
|
||||
*/
|
||||
GST_CAT_DEBUG (debug_dataflow, "cothread switch ended or interrupted");
|
||||
/* following is a check to see if the chain was interrupted due to a
|
||||
* top-half state_change(). (i.e., if there's a pending state.)
|
||||
*
|
||||
* if it was, return to gstthread.c::gst_thread_main_loop() to
|
||||
* execute the state change.
|
||||
*/
|
||||
GST_CAT_DEBUG (debug_dataflow, "cothread switch ended or interrupted");
|
||||
|
||||
if (state != GST_SCHEDULER_STATE_RUNNING) {
|
||||
GST_CAT_INFO (debug_dataflow, "scheduler is not running, in state %d",
|
||||
state);
|
||||
return state;
|
||||
}
|
||||
if (state != GST_SCHEDULER_STATE_RUNNING) {
|
||||
GST_CAT_INFO (debug_dataflow, "scheduler is not running, in state %d",
|
||||
state);
|
||||
return state;
|
||||
}
|
||||
|
||||
scheduled++;
|
||||
scheduled++;
|
||||
} else {
|
||||
GST_CAT_INFO (debug_dataflow,
|
||||
"no entry in this chain, trying the next one");
|
||||
GST_CAT_INFO (debug_dataflow,
|
||||
"no entry in this chain, trying the next one");
|
||||
}
|
||||
} else {
|
||||
GST_CAT_INFO (debug_dataflow,
|
||||
"no enabled elements in this chain, trying the next one");
|
||||
"no enabled elements in this chain, trying the next one");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ gst_bytestream_get_next_buf (GstByteStream * bs)
|
|||
|
||||
/* have to check to see if we merged with the head buffer */
|
||||
if (end == bs->buflist) {
|
||||
bs->headbufavail += GST_BUFFER_SIZE (nextbuf);
|
||||
bs->headbufavail += GST_BUFFER_SIZE (nextbuf);
|
||||
}
|
||||
|
||||
gst_buffer_unref (lastbuf);
|
||||
|
@ -226,7 +226,7 @@ gst_bytestream_fill_bytes (GstByteStream * bs, guint32 len)
|
|||
/* as long as we don't have enough, we get more buffers */
|
||||
while (bs->listavail < len) {
|
||||
GST_DEBUG ("fill_bytes: there are %d bytes in the list, we need %d",
|
||||
bs->listavail, len);
|
||||
bs->listavail, len);
|
||||
if (!gst_bytestream_get_next_buf (bs))
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -267,12 +267,12 @@ gst_bytestream_peek (GstByteStream * bs, GstBuffer ** buf, guint32 len)
|
|||
if (!gst_bytestream_fill_bytes (bs, len)) {
|
||||
/* we must have an event coming up */
|
||||
if (bs->listavail > 0) {
|
||||
/* we have some data left, len will be shrunk to the amount of data available */
|
||||
len = bs->listavail;
|
||||
/* we have some data left, len will be shrunk to the amount of data available */
|
||||
len = bs->listavail;
|
||||
} else {
|
||||
/* there is no data */
|
||||
*buf = retbuf;
|
||||
return 0;
|
||||
/* there is no data */
|
||||
*buf = retbuf;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
GST_DEBUG ("peek: there are now %d bytes in the list", bs->listavail);
|
||||
|
@ -286,14 +286,14 @@ gst_bytestream_peek (GstByteStream * bs, GstBuffer ** buf, guint32 len)
|
|||
GST_DEBUG ("peek: headbufavail is %d", bs->headbufavail);
|
||||
if (len <= bs->headbufavail) {
|
||||
GST_DEBUG ("peek: there are enough bytes in headbuf (need %d, have %d)",
|
||||
len, bs->headbufavail);
|
||||
len, bs->headbufavail);
|
||||
/* create a sub-buffer of the headbuf */
|
||||
retbuf =
|
||||
gst_buffer_create_sub (headbuf,
|
||||
GST_BUFFER_SIZE (headbuf) - bs->headbufavail, len);
|
||||
gst_buffer_create_sub (headbuf,
|
||||
GST_BUFFER_SIZE (headbuf) - bs->headbufavail, len);
|
||||
GST_BUFFER_OFFSET (retbuf) =
|
||||
GST_BUFFER_OFFSET (headbuf) + GST_BUFFER_SIZE (headbuf) -
|
||||
bs->headbufavail;
|
||||
GST_BUFFER_OFFSET (headbuf) + GST_BUFFER_SIZE (headbuf) -
|
||||
bs->headbufavail;
|
||||
|
||||
}
|
||||
/* otherwise we need to figure out how to assemble one */
|
||||
|
@ -351,12 +351,12 @@ gst_bytestream_peek_bytes (GstByteStream * bs, guint8 ** data, guint32 len)
|
|||
if (!gst_bytestream_fill_bytes (bs, len)) {
|
||||
/* we must have an event coming up */
|
||||
if (bs->listavail > 0) {
|
||||
/* we have some data left, len will be shrunk to the amount of data available */
|
||||
len = bs->listavail;
|
||||
/* we have some data left, len will be shrunk to the amount of data available */
|
||||
len = bs->listavail;
|
||||
} else {
|
||||
/* there is no data */
|
||||
*data = NULL;
|
||||
return 0;
|
||||
/* there is no data */
|
||||
*data = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
GST_DEBUG ("peek_bytes: there are now %d bytes in the list", bs->listavail);
|
||||
|
@ -370,12 +370,12 @@ gst_bytestream_peek_bytes (GstByteStream * bs, guint8 ** data, guint32 len)
|
|||
GST_DEBUG ("peek_bytes: headbufavail is %d", bs->headbufavail);
|
||||
if (len <= bs->headbufavail) {
|
||||
GST_DEBUG
|
||||
("peek_bytes: there are enough bytes in headbuf (need %d, have %d)",
|
||||
len, bs->headbufavail);
|
||||
("peek_bytes: there are enough bytes in headbuf (need %d, have %d)",
|
||||
len, bs->headbufavail);
|
||||
/* create a sub-buffer of the headbuf */
|
||||
*data =
|
||||
GST_BUFFER_DATA (headbuf) + (GST_BUFFER_SIZE (headbuf) -
|
||||
bs->headbufavail);
|
||||
GST_BUFFER_DATA (headbuf) + (GST_BUFFER_SIZE (headbuf) -
|
||||
bs->headbufavail);
|
||||
|
||||
}
|
||||
/* otherwise we need to figure out how to assemble one */
|
||||
|
@ -413,12 +413,12 @@ gst_bytestream_assemble (GstByteStream * bs, guint32 len)
|
|||
buf = GST_BUFFER (walk->data);
|
||||
if (GST_BUFFER_SIZE (buf) < (len - copied)) {
|
||||
GST_DEBUG ("assemble: copying %d bytes from buf to output offset %d",
|
||||
GST_BUFFER_SIZE (buf), copied);
|
||||
GST_BUFFER_SIZE (buf), copied);
|
||||
memcpy (data + copied, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
copied += GST_BUFFER_SIZE (buf);
|
||||
} else {
|
||||
GST_DEBUG ("assemble: copying %d bytes from buf to output offset %d",
|
||||
len - copied, copied);
|
||||
len - copied, copied);
|
||||
memcpy (data + copied, GST_BUFFER_DATA (buf), len - copied);
|
||||
copied = len;
|
||||
}
|
||||
|
@ -496,8 +496,8 @@ gst_bytestream_flush_fast (GstByteStream * bs, guint32 len)
|
|||
headbuf = GST_BUFFER (bs->buflist->data);
|
||||
|
||||
GST_DEBUG ("flush: analyzing buffer that's %d bytes long, offset %"
|
||||
G_GUINT64_FORMAT, GST_BUFFER_SIZE (headbuf),
|
||||
GST_BUFFER_OFFSET (headbuf));
|
||||
G_GUINT64_FORMAT, GST_BUFFER_SIZE (headbuf),
|
||||
GST_BUFFER_OFFSET (headbuf));
|
||||
|
||||
/* if there's enough to complete the flush */
|
||||
if (bs->headbufavail > len) {
|
||||
|
@ -521,10 +521,10 @@ gst_bytestream_flush_fast (GstByteStream * bs, guint32 len)
|
|||
|
||||
/* record the new headbufavail */
|
||||
if (bs->buflist) {
|
||||
bs->headbufavail = GST_BUFFER_SIZE (GST_BUFFER (bs->buflist->data));
|
||||
GST_DEBUG ("flush: next headbuf is %d bytes", bs->headbufavail);
|
||||
bs->headbufavail = GST_BUFFER_SIZE (GST_BUFFER (bs->buflist->data));
|
||||
GST_DEBUG ("flush: next headbuf is %d bytes", bs->headbufavail);
|
||||
} else {
|
||||
GST_DEBUG ("flush: no more bytes at all");
|
||||
GST_DEBUG ("flush: no more bytes at all");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -557,8 +557,8 @@ gst_bytestream_seek (GstByteStream * bs, gint64 offset, GstSeekType method)
|
|||
|
||||
GST_DEBUG ("bs: send event\n");
|
||||
if (gst_pad_send_event (GST_PAD (peer), gst_event_new_seek (GST_FORMAT_BYTES |
|
||||
(method & GST_SEEK_METHOD_MASK) |
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
|
||||
(method & GST_SEEK_METHOD_MASK) |
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
|
||||
gst_bytestream_flush_fast (bs, bs->listavail);
|
||||
|
||||
/* we set the seek flag here. We cannot pull the pad here
|
||||
|
@ -590,7 +590,7 @@ gst_bytestream_tell (GstByteStream * bs)
|
|||
format = GST_FORMAT_BYTES;
|
||||
|
||||
if (gst_pad_query (GST_PAD_PEER (bs->pad), GST_QUERY_POSITION, &format,
|
||||
&value)) {
|
||||
&value)) {
|
||||
return value - bs->listavail;
|
||||
}
|
||||
|
||||
|
@ -753,8 +753,8 @@ gst_bytestream_print_status (GstByteStream * bs)
|
|||
walk = g_slist_next (walk);
|
||||
|
||||
GST_DEBUG ("STATUS: buffer starts at %" G_GUINT64_FORMAT
|
||||
" and is %d bytes long", GST_BUFFER_OFFSET (buf),
|
||||
GST_BUFFER_SIZE (buf));
|
||||
" and is %d bytes long", GST_BUFFER_OFFSET (buf),
|
||||
GST_BUFFER_SIZE (buf));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,9 @@ gst_dparam_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_dparam_init,
|
||||
};
|
||||
|
||||
dparam_type =
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstDParam", &dparam_info, 0);
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstDParam", &dparam_info, 0);
|
||||
}
|
||||
return dparam_type;
|
||||
}
|
||||
|
@ -97,20 +98,20 @@ gst_dparam_class_init (GstDParamClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALUE_FLOAT,
|
||||
g_param_spec_float ("value_float", "Float Value",
|
||||
"The value that should be changed if gfloat is the type",
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_READWRITE));
|
||||
"The value that should be changed if gfloat is the type",
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALUE_DOUBLE,
|
||||
g_param_spec_double ("value_double", "Double Value",
|
||||
"The value that should be changed if gdouble is the type",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
"The value that should be changed if gdouble is the type",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALUE_INT,
|
||||
g_param_spec_int ("value_int", "Integer Value",
|
||||
"The value that should be changed if gint is the type",
|
||||
G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
"The value that should be changed if gint is the type",
|
||||
G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALUE_INT64,
|
||||
g_param_spec_int64 ("value_int64", "64 bit Integer Value",
|
||||
"The value that should be changed if gint64 is the type",
|
||||
G_MININT64, G_MAXINT64, 0, G_PARAM_READWRITE));
|
||||
"The value that should be changed if gint64 is the type",
|
||||
G_MININT64, G_MAXINT64, 0, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->dispose = gst_dparam_dispose;
|
||||
|
||||
|
@ -197,38 +198,38 @@ gst_dparam_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
switch (prop_id) {
|
||||
case ARG_VALUE_FLOAT:
|
||||
GST_DEBUG ("setting value from %g to %g", dparam->value_float,
|
||||
g_value_get_float (value));
|
||||
g_value_get_float (value));
|
||||
dparam->value_float = g_value_get_float (value);
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) =
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam);
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam);
|
||||
GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE;
|
||||
break;
|
||||
|
||||
case ARG_VALUE_DOUBLE:
|
||||
GST_DEBUG ("setting value from %g to %g",
|
||||
dparam->value_double, g_value_get_double (value));
|
||||
dparam->value_double, g_value_get_double (value));
|
||||
dparam->value_double = g_value_get_double (value);
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) =
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam);
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam);
|
||||
GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE;
|
||||
break;
|
||||
|
||||
case ARG_VALUE_INT:
|
||||
GST_DEBUG ("setting value from %d to %d", dparam->value_int,
|
||||
g_value_get_int (value));
|
||||
g_value_get_int (value));
|
||||
dparam->value_int = g_value_get_int (value);
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) =
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam);
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam);
|
||||
GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE;
|
||||
break;
|
||||
|
||||
case ARG_VALUE_INT64:
|
||||
GST_DEBUG ("setting value from %"
|
||||
G_GINT64_FORMAT " to %"
|
||||
G_GINT64_FORMAT, dparam->value_int64, g_value_get_int64 (value));
|
||||
G_GINT64_FORMAT " to %"
|
||||
G_GINT64_FORMAT, dparam->value_int64, g_value_get_int64 (value));
|
||||
dparam->value_int64 = g_value_get_int64 (value);
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) =
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam);
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam);
|
||||
GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE;
|
||||
break;
|
||||
|
||||
|
|
|
@ -73,9 +73,10 @@ gst_dpsmooth_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_dpsmooth_init,
|
||||
};
|
||||
|
||||
dpsmooth_type =
|
||||
g_type_register_static (GST_TYPE_DPARAM, "GstDParamSmooth",
|
||||
&dpsmooth_info, 0);
|
||||
g_type_register_static (GST_TYPE_DPARAM, "GstDParamSmooth",
|
||||
&dpsmooth_info, 0);
|
||||
}
|
||||
return dpsmooth_type;
|
||||
}
|
||||
|
@ -96,27 +97,27 @@ gst_dpsmooth_class_init (GstDParamSmoothClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPDATE_PERIOD,
|
||||
g_param_spec_int64 ("update_period",
|
||||
"Update Period (nanoseconds)",
|
||||
"Number of nanoseconds between updates",
|
||||
0LL, G_MAXINT64, 2000000LL, G_PARAM_READWRITE));
|
||||
"Update Period (nanoseconds)",
|
||||
"Number of nanoseconds between updates",
|
||||
0LL, G_MAXINT64, 2000000LL, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SLOPE_TIME,
|
||||
g_param_spec_int64 ("slope_time",
|
||||
"Slope Time (nanoseconds)",
|
||||
"The time period to define slope_delta by",
|
||||
0LL, G_MAXINT64, 10000000LL, G_PARAM_READWRITE));
|
||||
"Slope Time (nanoseconds)",
|
||||
"The time period to define slope_delta by",
|
||||
0LL, G_MAXINT64, 10000000LL, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_SLOPE_DELTA_FLOAT,
|
||||
g_param_spec_float ("slope_delta_float", "Slope Delta float",
|
||||
"The amount a float value can change for a given slope_time",
|
||||
0.0F, G_MAXFLOAT, 0.2F, G_PARAM_READWRITE));
|
||||
"The amount a float value can change for a given slope_time",
|
||||
0.0F, G_MAXFLOAT, 0.2F, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_SLOPE_DELTA_DOUBLE,
|
||||
g_param_spec_double ("slope_delta_double", "Slope Delta double",
|
||||
"The amount a double value can change for a given slope_time",
|
||||
0.0, G_MAXDOUBLE, 0.2, G_PARAM_READWRITE));
|
||||
"The amount a double value can change for a given slope_time",
|
||||
0.0, G_MAXDOUBLE, 0.2, G_PARAM_READWRITE));
|
||||
|
||||
/*gstobject_class->save_thyself = gst_dparam_save_thyself; */
|
||||
|
||||
|
@ -149,13 +150,13 @@ gst_dpsmooth_new (GType type)
|
|||
case G_TYPE_FLOAT:{
|
||||
dparam->do_update_func = gst_dpsmooth_do_update_float;
|
||||
g_signal_connect (G_OBJECT (dpsmooth), "value_changed",
|
||||
G_CALLBACK (gst_dpsmooth_value_changed_float), NULL);
|
||||
G_CALLBACK (gst_dpsmooth_value_changed_float), NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_DOUBLE:{
|
||||
dparam->do_update_func = gst_dpsmooth_do_update_double;
|
||||
g_signal_connect (G_OBJECT (dpsmooth), "value_changed",
|
||||
G_CALLBACK (gst_dpsmooth_value_changed_double), NULL);
|
||||
G_CALLBACK (gst_dpsmooth_value_changed_double), NULL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -189,7 +190,7 @@ gst_dpsmooth_set_property (GObject * object, guint prop_id,
|
|||
case ARG_SLOPE_TIME:
|
||||
dpsmooth->slope_time = g_value_get_int64 (value);
|
||||
GST_DEBUG ("dpsmooth->slope_time:%"
|
||||
G_GINT64_FORMAT, dpsmooth->slope_time);
|
||||
G_GINT64_FORMAT, dpsmooth->slope_time);
|
||||
GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE;
|
||||
break;
|
||||
|
||||
|
@ -309,7 +310,7 @@ gst_dpsmooth_do_update_float (GstDParam * dparam, gint64 timestamp,
|
|||
}
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp;
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) =
|
||||
dpsmooth->start_interp + dpsmooth->update_period;
|
||||
dpsmooth->start_interp + dpsmooth->update_period;
|
||||
|
||||
GST_DEBUG ("interp started at %" G_GINT64_FORMAT, timestamp);
|
||||
|
||||
|
@ -420,7 +421,7 @@ gst_dpsmooth_do_update_double (GstDParam * dparam, gint64 timestamp,
|
|||
}
|
||||
GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp;
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) =
|
||||
dpsmooth->start_interp + dpsmooth->update_period;
|
||||
dpsmooth->start_interp + dpsmooth->update_period;
|
||||
|
||||
GST_DEBUG ("interp started at %" G_GINT64_FORMAT, timestamp);
|
||||
|
||||
|
|
|
@ -92,9 +92,10 @@ gst_dpman_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_dpman_init,
|
||||
};
|
||||
|
||||
dpman_type =
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstDParamManager",
|
||||
&dpman_info, 0);
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstDParamManager",
|
||||
&dpman_info, 0);
|
||||
}
|
||||
return dpman_type;
|
||||
}
|
||||
|
@ -127,7 +128,7 @@ gst_dpman_class_init (GstDParamManagerClass * klass)
|
|||
gst_dpman_signals[NEW_REQUIRED_DPARAM] =
|
||||
g_signal_new ("new-required-dparam", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDParamManagerClass,
|
||||
new_required_dparam), NULL, NULL, gst_marshal_VOID__STRING,
|
||||
new_required_dparam), NULL, NULL, gst_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
}
|
||||
|
||||
|
@ -590,7 +591,7 @@ gst_dpman_bypass_dparam (GstDParamManager * dpman, gchar * dparam_name)
|
|||
|
||||
if (dpwrap->dparam != NULL) {
|
||||
g_warning ("Bypassing attached dparam '%s'. It will be detached",
|
||||
dparam_name);
|
||||
dparam_name);
|
||||
gst_dpman_detach_dparam (dpman, dparam_name);
|
||||
}
|
||||
}
|
||||
|
@ -659,8 +660,8 @@ gst_dpman_state_change (GstElement * element, gint old_state, gint new_state,
|
|||
dparam = dpwrap->dparam;
|
||||
|
||||
if (dparam) {
|
||||
GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE;
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = 0LL;
|
||||
GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE;
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = 0LL;
|
||||
}
|
||||
/* some dparams treat the first update after the pipeline starts differently */
|
||||
dpwrap->update_info = GST_DPARAM_UPDATE_FIRST;
|
||||
|
@ -709,39 +710,39 @@ gst_dpman_preprocess_synchronous (GstDParamManager * dpman, guint frames,
|
|||
dpwrap = (GstDParamWrapper *) dwraps->data;
|
||||
|
||||
if (dpwrap->dparam &&
|
||||
GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam) &&
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam) <= timestamp) {
|
||||
GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam) &&
|
||||
GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam) <= timestamp) {
|
||||
|
||||
switch (dpwrap->update_method) {
|
||||
|
||||
/* direct method - set the value directly in the struct of the element */
|
||||
case GST_DPMAN_DIRECT:
|
||||
GST_DPARAM_DO_UPDATE (dpwrap->dparam, timestamp, dpwrap->value,
|
||||
dpwrap->update_info);
|
||||
GST_DEBUG ("doing direct update");
|
||||
/* direct method - set the value directly in the struct of the element */
|
||||
case GST_DPMAN_DIRECT:
|
||||
GST_DPARAM_DO_UPDATE (dpwrap->dparam, timestamp, dpwrap->value,
|
||||
dpwrap->update_info);
|
||||
GST_DEBUG ("doing direct update");
|
||||
|
||||
gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data);
|
||||
break;
|
||||
gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data);
|
||||
break;
|
||||
|
||||
/* callback method - call the element's callback so it can do what it likes */
|
||||
case GST_DPMAN_CALLBACK:
|
||||
GST_DPARAM_DO_UPDATE (dpwrap->dparam, timestamp, dpwrap->value,
|
||||
dpwrap->update_info);
|
||||
GST_DEBUG ("doing callback update");
|
||||
/* callback method - call the element's callback so it can do what it likes */
|
||||
case GST_DPMAN_CALLBACK:
|
||||
GST_DPARAM_DO_UPDATE (dpwrap->dparam, timestamp, dpwrap->value,
|
||||
dpwrap->update_info);
|
||||
GST_DEBUG ("doing callback update");
|
||||
|
||||
GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value);
|
||||
break;
|
||||
GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value);
|
||||
break;
|
||||
|
||||
case GST_DPMAN_ARRAY:
|
||||
/* FIXME do array method checking here */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case GST_DPMAN_ARRAY:
|
||||
/* FIXME do array method checking here */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (dpwrap->update_info == GST_DPARAM_UPDATE_FIRST) {
|
||||
/* it is not the first update anymore */
|
||||
dpwrap->update_info = GST_DPARAM_UPDATE_NORMAL;
|
||||
/* it is not the first update anymore */
|
||||
dpwrap->update_info = GST_DPARAM_UPDATE_NORMAL;
|
||||
}
|
||||
}
|
||||
dwraps = g_list_next (dwraps);
|
||||
|
@ -796,68 +797,68 @@ gst_dpman_preprocess_asynchronous (GstDParamManager * dpman, guint frames,
|
|||
|
||||
current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam);
|
||||
if (current_time > dpman->time_buffer_ends) {
|
||||
/* not due for an update in this buffer */
|
||||
dwraps = g_list_next (dwraps);
|
||||
continue;
|
||||
/* not due for an update in this buffer */
|
||||
dwraps = g_list_next (dwraps);
|
||||
continue;
|
||||
}
|
||||
if (current_time < timestamp) {
|
||||
current_time = timestamp;
|
||||
current_time = timestamp;
|
||||
}
|
||||
|
||||
if (current_time == timestamp) {
|
||||
/* we are overdue for an update. lets do it now */
|
||||
/* we are overdue for an update. lets do it now */
|
||||
|
||||
GST_DPARAM_DO_UPDATE (dpwrap->dparam, current_time, dpwrap->value,
|
||||
dpwrap->update_info);
|
||||
GST_DPARAM_DO_UPDATE (dpwrap->dparam, current_time, dpwrap->value,
|
||||
dpwrap->update_info);
|
||||
|
||||
if (dpwrap->update_info == GST_DPARAM_UPDATE_FIRST) {
|
||||
/* it is not the first update anymore */
|
||||
dpwrap->update_info = GST_DPARAM_UPDATE_NORMAL;
|
||||
}
|
||||
if (dpwrap->update_info == GST_DPARAM_UPDATE_FIRST) {
|
||||
/* it is not the first update anymore */
|
||||
dpwrap->update_info = GST_DPARAM_UPDATE_NORMAL;
|
||||
}
|
||||
|
||||
switch (dpwrap->update_method) {
|
||||
switch (dpwrap->update_method) {
|
||||
|
||||
/* direct method - set the value directly in the struct of the element */
|
||||
case GST_DPMAN_DIRECT:
|
||||
GST_DEBUG ("doing direct update");
|
||||
gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data);
|
||||
break;
|
||||
/* direct method - set the value directly in the struct of the element */
|
||||
case GST_DPMAN_DIRECT:
|
||||
GST_DEBUG ("doing direct update");
|
||||
gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data);
|
||||
break;
|
||||
|
||||
/* callback method - call the element's callback so it can do what it likes */
|
||||
case GST_DPMAN_CALLBACK:
|
||||
GST_DEBUG ("doing callback update");
|
||||
GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* callback method - call the element's callback so it can do what it likes */
|
||||
case GST_DPMAN_CALLBACK:
|
||||
GST_DEBUG ("doing callback update");
|
||||
GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam);
|
||||
current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam);
|
||||
|
||||
if (!GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam) ||
|
||||
current_time > dpman->time_buffer_ends) {
|
||||
/* not due for an update in this buffer */
|
||||
dwraps = g_list_next (dwraps);
|
||||
continue;
|
||||
}
|
||||
if (!GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam) ||
|
||||
current_time > dpman->time_buffer_ends) {
|
||||
/* not due for an update in this buffer */
|
||||
dwraps = g_list_next (dwraps);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
dpwrap->next_update_frame =
|
||||
(guint) (current_time - timestamp) / dpman->rate_ratio;
|
||||
(guint) (current_time - timestamp) / dpman->rate_ratio;
|
||||
updates_pending = TRUE;
|
||||
|
||||
GST_DEBUG ("timestamp start: %"
|
||||
G_GINT64_FORMAT " end: %"
|
||||
G_GINT64_FORMAT " current: %"
|
||||
G_GINT64_FORMAT, timestamp, dpman->time_buffer_ends, current_time);
|
||||
G_GINT64_FORMAT " end: %"
|
||||
G_GINT64_FORMAT " current: %"
|
||||
G_GINT64_FORMAT, timestamp, dpman->time_buffer_ends, current_time);
|
||||
|
||||
}
|
||||
dwraps = g_list_next (dwraps);
|
||||
}
|
||||
if (updates_pending) {
|
||||
GST_DPMAN_DPARAMS_LIST (dpman) =
|
||||
g_list_sort (GST_DPMAN_DPARAMS_LIST (dpman),
|
||||
(GCompareFunc) gst_dpman_dpwrap_compare);
|
||||
g_list_sort (GST_DPMAN_DPARAMS_LIST (dpman),
|
||||
(GCompareFunc) gst_dpman_dpwrap_compare);
|
||||
dwraps = GST_DPMAN_DPARAMS_LIST (dpman);
|
||||
dpwrap = (GstDParamWrapper *) dwraps->data;
|
||||
|
||||
|
@ -865,7 +866,7 @@ gst_dpman_preprocess_asynchronous (GstDParamManager * dpman, guint frames,
|
|||
dpman->frames_to_process = dpman->next_update_frame;
|
||||
|
||||
GST_DEBUG ("next update frame %u, frames to process %u",
|
||||
dpman->next_update_frame, dpman->frames_to_process);
|
||||
dpman->next_update_frame, dpman->frames_to_process);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -896,29 +897,29 @@ gst_dpman_process_asynchronous (GstDParamManager * dpman, guint frame_count)
|
|||
|
||||
if (frame_count != dpwrap->next_update_frame) {
|
||||
g_warning ("frame count %u does not match update frame %u",
|
||||
frame_count, dpwrap->next_update_frame);
|
||||
frame_count, dpwrap->next_update_frame);
|
||||
}
|
||||
|
||||
while (dpwrap) {
|
||||
|
||||
current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam);
|
||||
GST_DPARAM_DO_UPDATE (dpwrap->dparam, current_time, dpwrap->value,
|
||||
dpwrap->update_info);
|
||||
dpwrap->update_info);
|
||||
switch (dpwrap->update_method) {
|
||||
|
||||
/* direct method - set the value directly in the struct of the element */
|
||||
/* direct method - set the value directly in the struct of the element */
|
||||
case GST_DPMAN_DIRECT:
|
||||
GST_DEBUG ("doing direct update");
|
||||
gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data);
|
||||
break;
|
||||
GST_DEBUG ("doing direct update");
|
||||
gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data);
|
||||
break;
|
||||
|
||||
/* callback method - call the element's callback so it can do what it likes */
|
||||
/* callback method - call the element's callback so it can do what it likes */
|
||||
case GST_DPMAN_CALLBACK:
|
||||
GST_DEBUG ("doing callback update");
|
||||
GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value);
|
||||
break;
|
||||
GST_DEBUG ("doing callback update");
|
||||
GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
dpwrap->next_update_frame = dpman->num_frames;
|
||||
|
@ -927,16 +928,16 @@ gst_dpman_process_asynchronous (GstDParamManager * dpman, guint frame_count)
|
|||
if (GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam)) {
|
||||
current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam);
|
||||
if (current_time <= dpman->time_buffer_ends) {
|
||||
dpwrap->next_update_frame =
|
||||
(guint) (current_time -
|
||||
dpman->time_buffer_starts) / dpman->rate_ratio;
|
||||
dpwrap->next_update_frame =
|
||||
(guint) (current_time -
|
||||
dpman->time_buffer_starts) / dpman->rate_ratio;
|
||||
}
|
||||
}
|
||||
|
||||
if ((dwraps = g_list_next (dwraps))) {
|
||||
dpwrap = (GstDParamWrapper *) dwraps->data;
|
||||
if (frame_count == dpwrap->next_update_frame) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dpwrap = NULL;
|
||||
|
@ -944,8 +945,8 @@ gst_dpman_process_asynchronous (GstDParamManager * dpman, guint frame_count)
|
|||
|
||||
if (needs_resort && g_list_length (GST_DPMAN_DPARAMS_LIST (dpman)) > 1) {
|
||||
GST_DPMAN_DPARAMS_LIST (dpman) =
|
||||
g_list_sort (GST_DPMAN_DPARAMS_LIST (dpman),
|
||||
(GCompareFunc) gst_dpman_dpwrap_compare);
|
||||
g_list_sort (GST_DPMAN_DPARAMS_LIST (dpman),
|
||||
(GCompareFunc) gst_dpman_dpwrap_compare);
|
||||
}
|
||||
|
||||
dwraps = GST_DPMAN_DPARAMS_LIST (dpman);
|
||||
|
@ -955,12 +956,12 @@ gst_dpman_process_asynchronous (GstDParamManager * dpman, guint frame_count)
|
|||
dpman->next_update_frame = dpman->num_frames;
|
||||
dpman->frames_to_process = dpman->num_frames - frame_count;
|
||||
GST_DEBUG ("no more updates, frames to process %u",
|
||||
dpman->frames_to_process);
|
||||
dpman->frames_to_process);
|
||||
} else {
|
||||
dpman->next_update_frame = dpwrap->next_update_frame;
|
||||
dpman->frames_to_process = dpman->next_update_frame - frame_count;
|
||||
GST_DEBUG ("next update frame %u, frames to process %u",
|
||||
dpman->next_update_frame, dpman->frames_to_process);
|
||||
dpman->next_update_frame, dpman->frames_to_process);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -42,9 +42,10 @@ gst_dp_linint_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_dp_linint_init,
|
||||
};
|
||||
|
||||
dp_linint_type =
|
||||
g_type_register_static (GST_TYPE_DPARAM, "GstDParamLinInterp",
|
||||
&dp_linint_info, 0);
|
||||
g_type_register_static (GST_TYPE_DPARAM, "GstDParamLinInterp",
|
||||
&dp_linint_info, 0);
|
||||
}
|
||||
return dp_linint_type;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,10 @@ gst_unitconv_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_unitconv_init,
|
||||
};
|
||||
|
||||
unitconv_type =
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstUnitConvert",
|
||||
&unitconv_info, 0);
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstUnitConvert",
|
||||
&unitconv_info, 0);
|
||||
}
|
||||
return unitconv_type;
|
||||
}
|
||||
|
@ -223,68 +224,68 @@ _gst_unitconv_initialize (void)
|
|||
|
||||
gst_unitconv_register_unit ("frequency", TRUE, TRUE,
|
||||
g_param_spec_float ("hertz", "Hz", "Frequency in hertz",
|
||||
0, G_MAXFLOAT, 0, 0));
|
||||
0, G_MAXFLOAT, 0, 0));
|
||||
|
||||
gst_unitconv_register_unit ("frequency", FALSE, TRUE,
|
||||
g_param_spec_float ("hertz-rate-bound", "Hz",
|
||||
"Frequency in hertz, bound by the sample rate", 0.0, G_MAXFLOAT, 0.0,
|
||||
0));
|
||||
"Frequency in hertz, bound by the sample rate", 0.0, G_MAXFLOAT, 0.0,
|
||||
0));
|
||||
|
||||
gst_unitconv_register_unit ("frequency", FALSE, FALSE,
|
||||
g_param_spec_string ("twelve-tone-scale", "note",
|
||||
"Name of the note from the western twelve tone scale", "C", 0));
|
||||
"Name of the note from the western twelve tone scale", "C", 0));
|
||||
|
||||
gst_unitconv_register_unit ("frequency", FALSE, FALSE,
|
||||
g_param_spec_int ("midi-note", "midi note",
|
||||
"MIDI note value of the frequency", 1, 127, 1, 0));
|
||||
"MIDI note value of the frequency", 1, 127, 1, 0));
|
||||
|
||||
/* time based units */
|
||||
gst_unitconv_register_unit ("time", TRUE, FALSE,
|
||||
g_param_spec_float ("seconds", "s", "Time in seconds",
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
|
||||
gst_unitconv_register_unit ("time", FALSE, FALSE,
|
||||
g_param_spec_int64 ("nanoseconds", "ns", "Time in nanoseconds",
|
||||
G_MININT64, G_MAXINT64, 0, 0));
|
||||
G_MININT64, G_MAXINT64, 0, 0));
|
||||
|
||||
gst_unitconv_register_unit ("time", FALSE, FALSE,
|
||||
g_param_spec_int64 ("samples", "samples", "Time in number of samples",
|
||||
G_MININT64, G_MAXINT64, 0, 0));
|
||||
G_MININT64, G_MAXINT64, 0, 0));
|
||||
|
||||
gst_unitconv_register_convert_property ("samples",
|
||||
g_param_spec_int ("samplerate", "samplerate", "samplerate",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
|
||||
|
||||
/* magnitude based units */
|
||||
gst_unitconv_register_unit ("magnitude", TRUE, FALSE,
|
||||
g_param_spec_float ("scalar", "scalar", "Magnitude as a scalar",
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
|
||||
gst_unitconv_register_unit ("magnitude", FALSE, FALSE,
|
||||
g_param_spec_int ("scalar-int", "scalar int",
|
||||
"Magnitude as an integer scalar", G_MININT, G_MAXINT, 0, 0));
|
||||
"Magnitude as an integer scalar", G_MININT, G_MAXINT, 0, 0));
|
||||
|
||||
gst_unitconv_register_unit ("magnitude", FALSE, TRUE,
|
||||
g_param_spec_float ("decibel", "dB", "Magnitude in decibels",
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
|
||||
gst_unitconv_register_unit ("magnitude", FALSE, FALSE,
|
||||
g_param_spec_float ("percent", "%", "Magnitude in percent",
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
|
||||
/* generic units */
|
||||
gst_unitconv_register_unit ("float_default", TRUE, FALSE,
|
||||
g_param_spec_float ("float", "float", "Float value",
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
-G_MAXFLOAT, G_MAXFLOAT, 0, 0));
|
||||
|
||||
gst_unitconv_register_unit ("int_default", TRUE, FALSE,
|
||||
g_param_spec_int ("int", "int", "Integer value",
|
||||
G_MININT, G_MAXINT, 0, 0));
|
||||
G_MININT, G_MAXINT, 0, 0));
|
||||
|
||||
gst_unitconv_register_unit ("int64_default", TRUE, FALSE,
|
||||
g_param_spec_int64 ("int64", "int64", "64 bit integer value",
|
||||
G_MININT, G_MAXINT, 0, 0));
|
||||
G_MININT, G_MAXINT, 0, 0));
|
||||
|
||||
|
||||
gst_unitconv_add_core_converters ();
|
||||
|
@ -312,7 +313,7 @@ gst_unitconv_register_unit (const gchar * domain_name,
|
|||
if (is_domain_default) {
|
||||
/* check if an default unit already exists for this domain */
|
||||
g_return_val_if_fail (g_hash_table_lookup (_gst_unit_domain_defaults,
|
||||
domain_name) == NULL, FALSE);
|
||||
domain_name) == NULL, FALSE);
|
||||
}
|
||||
|
||||
GST_DEBUG ("creating unit: %s", unit_name);
|
||||
|
@ -330,7 +331,7 @@ gst_unitconv_register_unit (const gchar * domain_name,
|
|||
|
||||
if (is_domain_default) {
|
||||
g_hash_table_insert (_gst_unit_domain_defaults, g_strdup (domain_name),
|
||||
unit);
|
||||
unit);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -50,9 +50,9 @@ unsigned long _getbits_masks[] = {
|
|||
#ifdef unused
|
||||
unsigned long _getbits_64_minus_index[] = {
|
||||
64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46,
|
||||
45, 44, 43, 42, 41,
|
||||
45, 44, 43, 42, 41,
|
||||
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22,
|
||||
21, 20, 19, 18, 17,
|
||||
21, 20, 19, 18, 17,
|
||||
16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
|
||||
};
|
||||
|
||||
|
|
|
@ -69,9 +69,10 @@ gst_aggregator_sched_get_type (void)
|
|||
{AGGREGATOR_CHAIN, "4", "Chain Based"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!aggregator_sched_type) {
|
||||
aggregator_sched_type =
|
||||
g_enum_register_static ("GstAggregatorSched", aggregator_sched);
|
||||
g_enum_register_static ("GstAggregatorSched", aggregator_sched);
|
||||
}
|
||||
return aggregator_sched_type;
|
||||
}
|
||||
|
@ -117,17 +118,17 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
||||
g_param_spec_int ("num_pads", "Num pads", "The number of source pads",
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "Silent", "Don't produce messages",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCHED,
|
||||
g_param_spec_enum ("sched", "Scheduling",
|
||||
"The type of scheduling this element should use",
|
||||
GST_TYPE_AGGREGATOR_SCHED, AGGREGATOR_CHAIN, G_PARAM_READWRITE));
|
||||
"The type of scheduling this element should use",
|
||||
GST_TYPE_AGGREGATOR_SCHED, AGGREGATOR_CHAIN, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last_message", "Last message",
|
||||
"The current state of the element", NULL, G_PARAM_READABLE));
|
||||
"The current state of the element", NULL, G_PARAM_READABLE));
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
|
||||
|
@ -192,7 +193,7 @@ gst_aggregator_update_functions (GstAggregator * aggregator)
|
|||
|
||||
if (AGGREGATOR_IS_LOOP_BASED (aggregator)) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (aggregator),
|
||||
GST_DEBUG_FUNCPTR (gst_aggregator_loop));
|
||||
GST_DEBUG_FUNCPTR (gst_aggregator_loop));
|
||||
} else {
|
||||
gst_element_set_loop_function (GST_ELEMENT (aggregator), NULL);
|
||||
}
|
||||
|
@ -271,9 +272,9 @@ gst_aggregator_push (GstAggregator * aggregator, GstPad * pad, GstBuffer * buf,
|
|||
g_free (aggregator->last_message);
|
||||
|
||||
aggregator->last_message =
|
||||
g_strdup_printf ("%10.10s ******* (%s:%s)a (%d bytes, %"
|
||||
G_GUINT64_FORMAT ")", debug, GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_strdup_printf ("%10.10s ******* (%s:%s)a (%d bytes, %"
|
||||
G_GUINT64_FORMAT ")", debug, GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
g_object_notify (G_OBJECT (aggregator), "last_message");
|
||||
}
|
||||
|
@ -306,11 +307,11 @@ gst_aggregator_loop (GstElement * element)
|
|||
* and that the peer pad is also enabled.
|
||||
*/
|
||||
if (GST_PAD_IS_USABLE (pad)) {
|
||||
buf = GST_BUFFER (gst_pad_pull (pad));
|
||||
debug = "loop";
|
||||
buf = GST_BUFFER (gst_pad_pull (pad));
|
||||
debug = "loop";
|
||||
|
||||
/* then push it forward */
|
||||
gst_aggregator_push (aggregator, pad, buf, debug);
|
||||
/* then push it forward */
|
||||
gst_aggregator_push (aggregator, pad, buf, debug);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -64,7 +64,7 @@ debug_buffers (GstBufferStore * store)
|
|||
g_printerr ("BUFFERS in store:\n");
|
||||
while (walk) {
|
||||
g_print ("%15" G_GUINT64_FORMAT " - %7u\n", GST_BUFFER_OFFSET (walk->data),
|
||||
GST_BUFFER_SIZE (walk->data));
|
||||
GST_BUFFER_SIZE (walk->data));
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
g_printerr ("\n");
|
||||
|
@ -127,14 +127,14 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
|
|||
store->buffers && GST_BUFFER_OFFSET_IS_VALID (store->buffers->data)) {
|
||||
/* we assumed valid offsets, but suddenly they are not anymore */
|
||||
GST_DEBUG_OBJECT (store,
|
||||
"attempting to add buffer %p with invalid offset to store with valid offset, abort",
|
||||
buffer);
|
||||
"attempting to add buffer %p with invalid offset to store with valid offset, abort",
|
||||
buffer);
|
||||
return FALSE;
|
||||
} else if (!store->buffers
|
||||
|| !GST_BUFFER_OFFSET_IS_VALID (store->buffers->data)) {
|
||||
/* the starting buffer had an invalid offset, in that case we assume continuous buffers */
|
||||
GST_LOG_OBJECT (store, "adding buffer %p with invalid offset and size %u",
|
||||
buffer, GST_BUFFER_SIZE (buffer));
|
||||
buffer, GST_BUFFER_SIZE (buffer));
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
store->buffers = g_list_append (store->buffers, buffer);
|
||||
return TRUE;
|
||||
|
@ -145,9 +145,9 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
|
|||
|
||||
g_assert (GST_BUFFER_OFFSET_IS_VALID (buffer));
|
||||
GST_LOG_OBJECT (store,
|
||||
"attempting to add buffer %p with offset %" G_GUINT64_FORMAT
|
||||
" and size %u", buffer, GST_BUFFER_OFFSET (buffer),
|
||||
GST_BUFFER_SIZE (buffer));
|
||||
"attempting to add buffer %p with offset %" G_GUINT64_FORMAT
|
||||
" and size %u", buffer, GST_BUFFER_OFFSET (buffer),
|
||||
GST_BUFFER_SIZE (buffer));
|
||||
/* we keep a sorted list of non-overlapping buffers */
|
||||
walk = store->buffers;
|
||||
while (walk) {
|
||||
|
@ -155,88 +155,88 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
|
|||
current_list = walk;
|
||||
walk = g_list_next (walk);
|
||||
if (GST_BUFFER_OFFSET (current) < GST_BUFFER_OFFSET (buffer)) {
|
||||
continue;
|
||||
continue;
|
||||
} else if (GST_BUFFER_OFFSET (current) == GST_BUFFER_OFFSET (buffer)) {
|
||||
guint needed_size;
|
||||
guint needed_size;
|
||||
|
||||
if (walk) {
|
||||
needed_size = MIN (GST_BUFFER_SIZE (buffer),
|
||||
GST_BUFFER_OFFSET (walk->data) - GST_BUFFER_OFFSET (current));
|
||||
} else {
|
||||
needed_size = GST_BUFFER_SIZE (buffer);
|
||||
}
|
||||
if (needed_size <= GST_BUFFER_SIZE (current)) {
|
||||
buffer = NULL;
|
||||
break;
|
||||
} else {
|
||||
if (needed_size < GST_BUFFER_SIZE (buffer)) {
|
||||
/* need to create subbuffer to not have overlapping data */
|
||||
GstBuffer *sub = gst_buffer_create_sub (buffer, 0, needed_size);
|
||||
if (walk) {
|
||||
needed_size = MIN (GST_BUFFER_SIZE (buffer),
|
||||
GST_BUFFER_OFFSET (walk->data) - GST_BUFFER_OFFSET (current));
|
||||
} else {
|
||||
needed_size = GST_BUFFER_SIZE (buffer);
|
||||
}
|
||||
if (needed_size <= GST_BUFFER_SIZE (current)) {
|
||||
buffer = NULL;
|
||||
break;
|
||||
} else {
|
||||
if (needed_size < GST_BUFFER_SIZE (buffer)) {
|
||||
/* need to create subbuffer to not have overlapping data */
|
||||
GstBuffer *sub = gst_buffer_create_sub (buffer, 0, needed_size);
|
||||
|
||||
g_assert (sub);
|
||||
buffer = sub;
|
||||
} else {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
}
|
||||
/* replace current buffer with new one */
|
||||
GST_INFO_OBJECT (store,
|
||||
"replacing buffer %p with buffer %p with offset %" G_GINT64_FORMAT
|
||||
" and size %u", current_list->data, buffer,
|
||||
GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
gst_data_unref (GST_DATA (current_list->data));
|
||||
current_list->data = buffer;
|
||||
buffer = NULL;
|
||||
break;
|
||||
}
|
||||
g_assert (sub);
|
||||
buffer = sub;
|
||||
} else {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
}
|
||||
/* replace current buffer with new one */
|
||||
GST_INFO_OBJECT (store,
|
||||
"replacing buffer %p with buffer %p with offset %" G_GINT64_FORMAT
|
||||
" and size %u", current_list->data, buffer,
|
||||
GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
gst_data_unref (GST_DATA (current_list->data));
|
||||
current_list->data = buffer;
|
||||
buffer = NULL;
|
||||
break;
|
||||
}
|
||||
} else if (GST_BUFFER_OFFSET (current) > GST_BUFFER_OFFSET (buffer)) {
|
||||
GList *previous = g_list_previous (current_list);
|
||||
guint64 start_offset = previous ?
|
||||
GST_BUFFER_OFFSET (previous->data) +
|
||||
GST_BUFFER_SIZE (previous->data) : 0;
|
||||
GList *previous = g_list_previous (current_list);
|
||||
guint64 start_offset = previous ?
|
||||
GST_BUFFER_OFFSET (previous->data) +
|
||||
GST_BUFFER_SIZE (previous->data) : 0;
|
||||
|
||||
if (start_offset == GST_BUFFER_OFFSET (current)) {
|
||||
buffer = NULL;
|
||||
break;
|
||||
} else {
|
||||
/* we have data to insert */
|
||||
if (start_offset > GST_BUFFER_OFFSET (buffer) ||
|
||||
GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) >
|
||||
GST_BUFFER_OFFSET (current)) {
|
||||
GstBuffer *sub;
|
||||
if (start_offset == GST_BUFFER_OFFSET (current)) {
|
||||
buffer = NULL;
|
||||
break;
|
||||
} else {
|
||||
/* we have data to insert */
|
||||
if (start_offset > GST_BUFFER_OFFSET (buffer) ||
|
||||
GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) >
|
||||
GST_BUFFER_OFFSET (current)) {
|
||||
GstBuffer *sub;
|
||||
|
||||
/* need a subbuffer */
|
||||
start_offset = GST_BUFFER_OFFSET (buffer) > start_offset ? 0 :
|
||||
start_offset - GST_BUFFER_OFFSET (buffer);
|
||||
sub = gst_buffer_create_sub (buffer, start_offset,
|
||||
MIN (GST_BUFFER_SIZE (buffer),
|
||||
GST_BUFFER_OFFSET (current) - start_offset -
|
||||
GST_BUFFER_OFFSET (buffer)));
|
||||
g_assert (sub);
|
||||
GST_BUFFER_OFFSET (sub) = start_offset + GST_BUFFER_OFFSET (buffer);
|
||||
buffer = sub;
|
||||
} else {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
}
|
||||
GST_INFO_OBJECT (store,
|
||||
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
|
||||
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
store->buffers =
|
||||
g_list_insert_before (store->buffers, current_list, buffer);
|
||||
buffer = NULL;
|
||||
break;
|
||||
}
|
||||
/* need a subbuffer */
|
||||
start_offset = GST_BUFFER_OFFSET (buffer) > start_offset ? 0 :
|
||||
start_offset - GST_BUFFER_OFFSET (buffer);
|
||||
sub = gst_buffer_create_sub (buffer, start_offset,
|
||||
MIN (GST_BUFFER_SIZE (buffer),
|
||||
GST_BUFFER_OFFSET (current) - start_offset -
|
||||
GST_BUFFER_OFFSET (buffer)));
|
||||
g_assert (sub);
|
||||
GST_BUFFER_OFFSET (sub) = start_offset + GST_BUFFER_OFFSET (buffer);
|
||||
buffer = sub;
|
||||
} else {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
}
|
||||
GST_INFO_OBJECT (store,
|
||||
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
|
||||
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
store->buffers =
|
||||
g_list_insert_before (store->buffers, current_list, buffer);
|
||||
buffer = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buffer) {
|
||||
gst_data_ref (GST_DATA (buffer));
|
||||
GST_INFO_OBJECT (store,
|
||||
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
|
||||
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
|
||||
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
|
||||
if (current_list) {
|
||||
g_list_append (current_list, buffer);
|
||||
g_list_append (current_list, buffer);
|
||||
} else {
|
||||
g_assert (store->buffers == NULL);
|
||||
store->buffers = g_list_prepend (NULL, buffer);
|
||||
g_assert (store->buffers == NULL);
|
||||
store->buffers = g_list_prepend (NULL, buffer);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -352,47 +352,47 @@ gst_buffer_store_get_buffer (GstBufferStore * store, guint64 offset, guint size)
|
|||
do_nothing_loop (); */
|
||||
} else if (cur_offset == offset && GST_BUFFER_SIZE (current) == size) {
|
||||
GST_LOG_OBJECT (store,
|
||||
"found matching buffer %p for offset %" G_GUINT64_FORMAT
|
||||
" and size %u", current, offset, size);
|
||||
"found matching buffer %p for offset %" G_GUINT64_FORMAT
|
||||
" and size %u", current, offset, size);
|
||||
ret = current;
|
||||
gst_data_ref (GST_DATA (ret));
|
||||
GST_LOG_OBJECT (store, "refcount %d", GST_DATA_REFCOUNT_VALUE (ret));
|
||||
break;
|
||||
} else if (cur_offset + GST_BUFFER_SIZE (current) > offset) {
|
||||
if (cur_offset + GST_BUFFER_SIZE (current) >= offset + size) {
|
||||
ret = gst_buffer_create_sub (current, offset - cur_offset, size);
|
||||
GST_LOG_OBJECT (store,
|
||||
"created subbuffer %p from buffer %p for offset %llu and size %u",
|
||||
ret, current, offset, size);
|
||||
break;
|
||||
ret = gst_buffer_create_sub (current, offset - cur_offset, size);
|
||||
GST_LOG_OBJECT (store,
|
||||
"created subbuffer %p from buffer %p for offset %llu and size %u",
|
||||
ret, current, offset, size);
|
||||
break;
|
||||
}
|
||||
/* uh, the requested data spans some buffers */
|
||||
ret = gst_buffer_new_and_alloc (size);
|
||||
GST_LOG_OBJECT (store, "created buffer %p for offset %" G_GUINT64_FORMAT
|
||||
" and size %u, will fill with data now", ret, offset, size);
|
||||
" and size %u, will fill with data now", ret, offset, size);
|
||||
data = GST_BUFFER_DATA (ret);
|
||||
tmp = GST_BUFFER_SIZE (current) - offset + cur_offset;
|
||||
memcpy (data, GST_BUFFER_DATA (current) + offset - cur_offset, tmp);
|
||||
data += tmp;
|
||||
size -= tmp;
|
||||
while (size) {
|
||||
if (walk == NULL ||
|
||||
(have_offset &&
|
||||
GST_BUFFER_OFFSET (current) + GST_BUFFER_SIZE (current) !=
|
||||
GST_BUFFER_OFFSET (walk->data))) {
|
||||
GST_DEBUG_OBJECT (store,
|
||||
"not all data for offset %" G_GUINT64_FORMAT
|
||||
" and remaining size %u available, aborting", offset, size);
|
||||
gst_data_unref (GST_DATA (ret));
|
||||
ret = NULL;
|
||||
goto out;
|
||||
}
|
||||
current = GST_BUFFER (walk->data);
|
||||
walk = g_list_next (walk);
|
||||
tmp = MIN (GST_BUFFER_SIZE (current), size);
|
||||
memcpy (data, GST_BUFFER_DATA (current), tmp);
|
||||
data += tmp;
|
||||
size -= tmp;
|
||||
if (walk == NULL ||
|
||||
(have_offset &&
|
||||
GST_BUFFER_OFFSET (current) + GST_BUFFER_SIZE (current) !=
|
||||
GST_BUFFER_OFFSET (walk->data))) {
|
||||
GST_DEBUG_OBJECT (store,
|
||||
"not all data for offset %" G_GUINT64_FORMAT
|
||||
" and remaining size %u available, aborting", offset, size);
|
||||
gst_data_unref (GST_DATA (ret));
|
||||
ret = NULL;
|
||||
goto out;
|
||||
}
|
||||
current = GST_BUFFER (walk->data);
|
||||
walk = g_list_next (walk);
|
||||
tmp = MIN (GST_BUFFER_SIZE (current), size);
|
||||
memcpy (data, GST_BUFFER_DATA (current), tmp);
|
||||
data += tmp;
|
||||
size -= tmp;
|
||||
}
|
||||
}
|
||||
if (!have_offset) {
|
||||
|
@ -437,8 +437,8 @@ gst_buffer_store_get_size (GstBufferStore * store, guint64 offset)
|
|||
}
|
||||
while (walk) {
|
||||
if (have_offset && counting &&
|
||||
cur_offset + GST_BUFFER_SIZE (current) !=
|
||||
GST_BUFFER_OFFSET (walk->data)) {
|
||||
cur_offset + GST_BUFFER_SIZE (current) !=
|
||||
GST_BUFFER_OFFSET (walk->data)) {
|
||||
break;
|
||||
}
|
||||
current = GST_BUFFER (walk->data);
|
||||
|
@ -450,11 +450,11 @@ gst_buffer_store_get_size (GstBufferStore * store, guint64 offset)
|
|||
ret += GST_BUFFER_SIZE (current);
|
||||
} else {
|
||||
if (cur_offset > offset)
|
||||
return 0;
|
||||
return 0;
|
||||
if (cur_offset + GST_BUFFER_SIZE (current) > offset) {
|
||||
/* we have at least some bytes */
|
||||
ret = cur_offset + GST_BUFFER_SIZE (current) - offset;
|
||||
counting = TRUE;
|
||||
/* we have at least some bytes */
|
||||
ret = cur_offset + GST_BUFFER_SIZE (current) - offset;
|
||||
counting = TRUE;
|
||||
}
|
||||
}
|
||||
if (!have_offset) {
|
||||
|
|
|
@ -81,7 +81,7 @@ plugin_init (GstPlugin * plugin)
|
|||
|
||||
while ((*my_elements).name) {
|
||||
if (!gst_element_register (plugin, (*my_elements).name, (*my_elements).rank,
|
||||
((*my_elements).type) ()))
|
||||
((*my_elements).type) ()))
|
||||
return FALSE;
|
||||
my_elements++;
|
||||
}
|
||||
|
|
|
@ -70,22 +70,23 @@ gst_fakesink_state_error_get_type (void)
|
|||
static GEnumValue fakesink_state_error[] = {
|
||||
{FAKESINK_STATE_ERROR_NONE, "0", "No state change errors"},
|
||||
{FAKESINK_STATE_ERROR_NULL_READY, "1",
|
||||
"Fail state change from NULL to READY"},
|
||||
"Fail state change from NULL to READY"},
|
||||
{FAKESINK_STATE_ERROR_READY_PAUSED, "2",
|
||||
"Fail state change from READY to PAUSED"},
|
||||
"Fail state change from READY to PAUSED"},
|
||||
{FAKESINK_STATE_ERROR_PAUSED_PLAYING, "3",
|
||||
"Fail state change from PAUSED to PLAYING"},
|
||||
"Fail state change from PAUSED to PLAYING"},
|
||||
{FAKESINK_STATE_ERROR_PLAYING_PAUSED, "4",
|
||||
"Fail state change from PLAYING to PAUSED"},
|
||||
"Fail state change from PLAYING to PAUSED"},
|
||||
{FAKESINK_STATE_ERROR_PAUSED_READY, "5",
|
||||
"Fail state change from PAUSED to READY"},
|
||||
"Fail state change from PAUSED to READY"},
|
||||
{FAKESINK_STATE_ERROR_READY_NULL, "6",
|
||||
"Fail state change from READY to NULL"},
|
||||
"Fail state change from READY to NULL"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesink_state_error_type) {
|
||||
fakesink_state_error_type =
|
||||
g_enum_register_static ("GstFakeSinkStateError", fakesink_state_error);
|
||||
g_enum_register_static ("GstFakeSinkStateError", fakesink_state_error);
|
||||
}
|
||||
return fakesink_state_error_type;
|
||||
}
|
||||
|
@ -133,27 +134,27 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SINKS,
|
||||
g_param_spec_int ("num_sinks", "Number of sinks",
|
||||
"The number of sinkpads", 1, G_MAXINT, 1, G_PARAM_READABLE));
|
||||
"The number of sinkpads", 1, G_MAXINT, 1, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STATE_ERROR,
|
||||
g_param_spec_enum ("state_error", "State Error",
|
||||
"Generate a state change error", GST_TYPE_FAKESINK_STATE_ERROR,
|
||||
FAKESINK_STATE_ERROR_NONE, G_PARAM_READWRITE));
|
||||
"Generate a state change error", GST_TYPE_FAKESINK_STATE_ERROR,
|
||||
FAKESINK_STATE_ERROR_NONE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last_message", "Last Message",
|
||||
"The message describing current status", NULL, G_PARAM_READABLE));
|
||||
"The message describing current status", NULL, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
|
||||
g_param_spec_boolean ("sync", "Sync", "Sync on the clock", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_HANDOFFS,
|
||||
g_param_spec_boolean ("signal-handoffs", "Signal handoffs",
|
||||
"Send a signal before unreffing the buffer", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
"Send a signal before unreffing the buffer", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "Silent",
|
||||
"Don't produce last_message events", FALSE, G_PARAM_READWRITE));
|
||||
"Don't produce last_message events", FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
|
||||
g_param_spec_boolean ("dump", "Dump", "Dump received bytes to stdout",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gst_fakesink_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -316,22 +317,22 @@ gst_fakesink_chain (GstPad * pad, GstData * _data)
|
|||
g_free (fakesink->last_message);
|
||||
|
||||
fakesink->last_message =
|
||||
g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
|
||||
g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
|
||||
|
||||
g_object_notify (G_OBJECT (fakesink), "last_message");
|
||||
}
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
if (fakesink->sync && fakesink->clock) {
|
||||
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
|
||||
if (fakesink->sync && fakesink->clock) {
|
||||
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
|
||||
|
||||
gst_element_set_time (GST_ELEMENT (fakesink), value);
|
||||
}
|
||||
gst_element_set_time (GST_ELEMENT (fakesink), value);
|
||||
}
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -344,19 +345,19 @@ gst_fakesink_chain (GstPad * pad, GstData * _data)
|
|||
g_free (fakesink->last_message);
|
||||
|
||||
fakesink->last_message =
|
||||
g_strdup_printf ("chain ******* (%s:%s)< (%d bytes, timestamp: %"
|
||||
G_GINT64_FORMAT ", duration: %" G_GINT64_FORMAT ", offset: %"
|
||||
G_GINT64_FORMAT ", flags: %d) %p", GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf),
|
||||
GST_BUFFER_DURATION (buf), GST_BUFFER_OFFSET (buf),
|
||||
GST_BUFFER_FLAGS (buf), buf);
|
||||
g_strdup_printf ("chain ******* (%s:%s)< (%d bytes, timestamp: %"
|
||||
G_GINT64_FORMAT ", duration: %" G_GINT64_FORMAT ", offset: %"
|
||||
G_GINT64_FORMAT ", flags: %d) %p", GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf),
|
||||
GST_BUFFER_DURATION (buf), GST_BUFFER_OFFSET (buf),
|
||||
GST_BUFFER_FLAGS (buf), buf);
|
||||
|
||||
g_object_notify (G_OBJECT (fakesink), "last_message");
|
||||
}
|
||||
|
||||
if (fakesink->signal_handoffs)
|
||||
g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0,
|
||||
buf, pad);
|
||||
buf, pad);
|
||||
|
||||
if (fakesink->dump) {
|
||||
gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
|
@ -373,27 +374,27 @@ gst_fakesink_change_state (GstElement * element)
|
|||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_NULL_TO_READY:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_NULL_READY)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_READY_PAUSED)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_PAUSED_PLAYING)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_PLAYING_TO_PAUSED:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_PLAYING_PAUSED)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_PAUSED_READY)
|
||||
goto error;
|
||||
goto error;
|
||||
break;
|
||||
case GST_STATE_READY_TO_NULL:
|
||||
if (fakesink->state_error == FAKESINK_STATE_ERROR_READY_NULL)
|
||||
goto error;
|
||||
goto error;
|
||||
g_free (fakesink->last_message);
|
||||
fakesink->last_message = NULL;
|
||||
break;
|
||||
|
|
|
@ -95,9 +95,10 @@ gst_fakesrc_output_get_type (void)
|
|||
{FAKESRC_GET_ALWAYS_SUCEEDS, "8", "'_get' Always succeeds"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesrc_output_type) {
|
||||
fakesrc_output_type =
|
||||
g_enum_register_static ("GstFakeSrcOutput", fakesrc_output);
|
||||
g_enum_register_static ("GstFakeSrcOutput", fakesrc_output);
|
||||
}
|
||||
return fakesrc_output_type;
|
||||
}
|
||||
|
@ -112,6 +113,7 @@ gst_fakesrc_data_get_type (void)
|
|||
{FAKESRC_DATA_SUBBUFFER, "2", "Subbuffer data"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesrc_data_type) {
|
||||
fakesrc_data_type = g_enum_register_static ("GstFakeSrcData", fakesrc_data);
|
||||
}
|
||||
|
@ -127,12 +129,13 @@ gst_fakesrc_sizetype_get_type (void)
|
|||
{FAKESRC_SIZETYPE_NULL, "1", "Send empty buffers"},
|
||||
{FAKESRC_SIZETYPE_FIXED, "2", "Fixed size buffers (sizemax sized)"},
|
||||
{FAKESRC_SIZETYPE_RANDOM, "3",
|
||||
"Random sized buffers (sizemin <= size <= sizemax)"},
|
||||
"Random sized buffers (sizemin <= size <= sizemax)"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesrc_sizetype_type) {
|
||||
fakesrc_sizetype_type =
|
||||
g_enum_register_static ("GstFakeSrcSizeType", fakesrc_sizetype);
|
||||
g_enum_register_static ("GstFakeSrcSizeType", fakesrc_sizetype);
|
||||
}
|
||||
return fakesrc_sizetype_type;
|
||||
}
|
||||
|
@ -148,12 +151,13 @@ gst_fakesrc_filltype_get_type (void)
|
|||
{FAKESRC_FILLTYPE_RANDOM, "3", "Fill buffers with random crap"},
|
||||
{FAKESRC_FILLTYPE_PATTERN, "4", "Fill buffers with pattern 0x00 -> 0xff"},
|
||||
{FAKESRC_FILLTYPE_PATTERN_CONT, "5",
|
||||
"Fill buffers with pattern 0x00 -> 0xff that spans buffers"},
|
||||
"Fill buffers with pattern 0x00 -> 0xff that spans buffers"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!fakesrc_filltype_type) {
|
||||
fakesrc_filltype_type =
|
||||
g_enum_register_static ("GstFakeSrcFillType", fakesrc_filltype);
|
||||
g_enum_register_static ("GstFakeSrcFillType", fakesrc_filltype);
|
||||
}
|
||||
return fakesrc_filltype_type;
|
||||
}
|
||||
|
@ -201,56 +205,56 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
|
||||
g_param_spec_int ("num-sources", "num-sources", "Number of sources",
|
||||
1, G_MAXINT, 1, G_PARAM_READABLE));
|
||||
1, G_MAXINT, 1, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
|
||||
g_param_spec_boolean ("loop-based", "loop-based",
|
||||
"Enable loop-based operation", FALSE, G_PARAM_READWRITE));
|
||||
"Enable loop-based operation", FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT,
|
||||
g_param_spec_enum ("output", "output", "Output method (currently unused)",
|
||||
GST_TYPE_FAKESRC_OUTPUT, FAKESRC_FIRST_LAST_LOOP, G_PARAM_READWRITE));
|
||||
GST_TYPE_FAKESRC_OUTPUT, FAKESRC_FIRST_LAST_LOOP, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DATA,
|
||||
g_param_spec_enum ("data", "data", "Data allocation method",
|
||||
GST_TYPE_FAKESRC_DATA, FAKESRC_DATA_ALLOCATE, G_PARAM_READWRITE));
|
||||
GST_TYPE_FAKESRC_DATA, FAKESRC_DATA_ALLOCATE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZETYPE,
|
||||
g_param_spec_enum ("sizetype", "sizetype",
|
||||
"How to determine buffer sizes", GST_TYPE_FAKESRC_SIZETYPE,
|
||||
FAKESRC_SIZETYPE_NULL, G_PARAM_READWRITE));
|
||||
"How to determine buffer sizes", GST_TYPE_FAKESRC_SIZETYPE,
|
||||
FAKESRC_SIZETYPE_NULL, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMIN,
|
||||
g_param_spec_int ("sizemin", "sizemin", "Minimum buffer size", 0,
|
||||
G_MAXINT, DEFAULT_SIZEMIN, G_PARAM_READWRITE));
|
||||
G_MAXINT, DEFAULT_SIZEMIN, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX,
|
||||
g_param_spec_int ("sizemax", "sizemax", "Maximum buffer size", 0,
|
||||
G_MAXINT, DEFAULT_SIZEMAX, G_PARAM_READWRITE));
|
||||
G_MAXINT, DEFAULT_SIZEMAX, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PARENTSIZE,
|
||||
g_param_spec_int ("parentsize", "parentsize",
|
||||
"Size of parent buffer for sub-buffered allocation", 0, G_MAXINT,
|
||||
DEFAULT_PARENTSIZE, G_PARAM_READWRITE));
|
||||
"Size of parent buffer for sub-buffered allocation", 0, G_MAXINT,
|
||||
DEFAULT_PARENTSIZE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILLTYPE,
|
||||
g_param_spec_enum ("filltype", "filltype",
|
||||
"How to fill the buffer, if at all", GST_TYPE_FAKESRC_FILLTYPE,
|
||||
FAKESRC_FILLTYPE_NULL, G_PARAM_READWRITE));
|
||||
"How to fill the buffer, if at all", GST_TYPE_FAKESRC_FILLTYPE,
|
||||
FAKESRC_FILLTYPE_NULL, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PATTERN,
|
||||
g_param_spec_string ("pattern", "pattern", "pattern", NULL,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_BUFFERS,
|
||||
g_param_spec_int ("num-buffers", "num-buffers",
|
||||
"Number of buffers to output before sending EOS", G_MININT, G_MAXINT,
|
||||
0, G_PARAM_READWRITE));
|
||||
"Number of buffers to output before sending EOS", G_MININT, G_MAXINT,
|
||||
0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EOS,
|
||||
g_param_spec_boolean ("eos", "eos", "Send out the EOS event?", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last-message", "last-message",
|
||||
"The last status message", NULL, G_PARAM_READABLE));
|
||||
"The last status message", NULL, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "Silent",
|
||||
"Don't produce last_message events", FALSE, G_PARAM_READWRITE));
|
||||
"Don't produce last_message events", FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_HANDOFFS,
|
||||
g_param_spec_boolean ("signal-handoffs", "Signal handoffs",
|
||||
"Send a signal before pushing the buffer", FALSE, G_PARAM_READWRITE));
|
||||
"Send a signal before pushing the buffer", FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
|
||||
g_param_spec_boolean ("dump", "Dump", "Dump produced bytes to stdout",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gst_fakesrc_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -334,6 +338,7 @@ gst_fakesrc_get_formats (GstPad * pad)
|
|||
GST_FORMAT_DEFAULT,
|
||||
0,
|
||||
};
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
@ -347,6 +352,7 @@ gst_fakesrc_get_query_types (GstPad * pad)
|
|||
GST_QUERY_SEGMENT_END,
|
||||
0,
|
||||
};
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
|
@ -384,6 +390,7 @@ gst_fakesrc_get_event_mask (GstPad * pad)
|
|||
{GST_EVENT_FLUSH, 0},
|
||||
{0, 0},
|
||||
};
|
||||
|
||||
return masks;
|
||||
}
|
||||
|
||||
|
@ -399,7 +406,7 @@ gst_fakesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
src->buffer_count = GST_EVENT_SEEK_OFFSET (event);
|
||||
|
||||
if (!GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
/* else we do a flush too */
|
||||
case GST_EVENT_SEEK_SEGMENT:
|
||||
|
@ -407,7 +414,7 @@ gst_fakesrc_event_handler (GstPad * pad, GstEvent * event)
|
|||
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
src->buffer_count = src->segment_start;
|
||||
src->segment_loop =
|
||||
GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
|
||||
GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
|
||||
break;
|
||||
case GST_EVENT_FLUSH:
|
||||
src->need_flush = TRUE;
|
||||
|
@ -427,7 +434,7 @@ gst_fakesrc_update_functions (GstFakeSrc * src)
|
|||
|
||||
if (src->loop_based) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (src),
|
||||
GST_DEBUG_FUNCPTR (gst_fakesrc_loop));
|
||||
GST_DEBUG_FUNCPTR (gst_fakesrc_loop));
|
||||
} else {
|
||||
gst_element_set_loop_function (GST_ELEMENT (src), NULL);
|
||||
}
|
||||
|
@ -485,13 +492,13 @@ gst_fakesrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
src->data = g_value_get_enum (value);
|
||||
|
||||
if (src->data == FAKESRC_DATA_SUBBUFFER) {
|
||||
if (!src->parent)
|
||||
gst_fakesrc_alloc_parent (src);
|
||||
if (!src->parent)
|
||||
gst_fakesrc_alloc_parent (src);
|
||||
} else {
|
||||
if (src->parent) {
|
||||
gst_buffer_unref (src->parent);
|
||||
src->parent = NULL;
|
||||
}
|
||||
if (src->parent) {
|
||||
gst_buffer_unref (src->parent);
|
||||
src->parent = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ARG_SIZETYPE:
|
||||
|
@ -614,7 +621,7 @@ gst_fakesrc_prepare_buffer (GstFakeSrc * src, GstBuffer * buf)
|
|||
guint8 *ptr = GST_BUFFER_DATA (buf);
|
||||
|
||||
for (i = GST_BUFFER_SIZE (buf); i; i--) {
|
||||
*ptr++ = (gint8) ((255.0) * rand () / (RAND_MAX));
|
||||
*ptr++ = (gint8) ((255.0) * rand () / (RAND_MAX));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -626,7 +633,7 @@ gst_fakesrc_prepare_buffer (GstFakeSrc * src, GstBuffer * buf)
|
|||
guint8 *ptr = GST_BUFFER_DATA (buf);
|
||||
|
||||
for (i = GST_BUFFER_SIZE (buf); i; i--) {
|
||||
*ptr++ = src->pattern_byte++;
|
||||
*ptr++ = src->pattern_byte++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -647,18 +654,18 @@ gst_fakesrc_alloc_buffer (GstFakeSrc * src, guint size)
|
|||
if (size != 0) {
|
||||
switch (src->filltype) {
|
||||
case FAKESRC_FILLTYPE_NOTHING:
|
||||
GST_BUFFER_DATA (buf) = g_malloc (size);
|
||||
break;
|
||||
GST_BUFFER_DATA (buf) = g_malloc (size);
|
||||
break;
|
||||
case FAKESRC_FILLTYPE_NULL:
|
||||
GST_BUFFER_DATA (buf) = g_malloc0 (size);
|
||||
break;
|
||||
GST_BUFFER_DATA (buf) = g_malloc0 (size);
|
||||
break;
|
||||
case FAKESRC_FILLTYPE_RANDOM:
|
||||
case FAKESRC_FILLTYPE_PATTERN:
|
||||
case FAKESRC_FILLTYPE_PATTERN_CONT:
|
||||
default:
|
||||
GST_BUFFER_DATA (buf) = g_malloc (size);
|
||||
gst_fakesrc_prepare_buffer (src, buf);
|
||||
break;
|
||||
GST_BUFFER_DATA (buf) = g_malloc (size);
|
||||
gst_fakesrc_prepare_buffer (src, buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -676,9 +683,9 @@ gst_fakesrc_get_size (GstFakeSrc * src)
|
|||
break;
|
||||
case FAKESRC_SIZETYPE_RANDOM:
|
||||
size =
|
||||
src->sizemin +
|
||||
(guint8) (((gfloat) src->sizemax) * rand () / (RAND_MAX +
|
||||
(gfloat) src->sizemin));
|
||||
src->sizemin +
|
||||
(guint8) (((gfloat) src->sizemax) * rand () / (RAND_MAX +
|
||||
(gfloat) src->sizemin));
|
||||
break;
|
||||
case FAKESRC_SIZETYPE_NULL:
|
||||
default:
|
||||
|
@ -707,19 +714,19 @@ gst_fakesrc_create_buffer (GstFakeSrc * src)
|
|||
case FAKESRC_DATA_SUBBUFFER:
|
||||
/* see if we have a parent to subbuffer */
|
||||
if (!src->parent) {
|
||||
gst_fakesrc_alloc_parent (src);
|
||||
g_assert (src->parent);
|
||||
gst_fakesrc_alloc_parent (src);
|
||||
g_assert (src->parent);
|
||||
}
|
||||
/* see if it's large enough */
|
||||
if ((GST_BUFFER_SIZE (src->parent) - src->parentoffset) >= size) {
|
||||
buf = gst_buffer_create_sub (src->parent, src->parentoffset, size);
|
||||
src->parentoffset += size;
|
||||
buf = gst_buffer_create_sub (src->parent, src->parentoffset, size);
|
||||
src->parentoffset += size;
|
||||
} else {
|
||||
/* the parent is useless now */
|
||||
gst_buffer_unref (src->parent);
|
||||
src->parent = NULL;
|
||||
/* try again (this will allocate a new parent) */
|
||||
return gst_fakesrc_create_buffer (src);
|
||||
/* the parent is useless now */
|
||||
gst_buffer_unref (src->parent);
|
||||
src->parent = NULL;
|
||||
/* try again (this will allocate a new parent) */
|
||||
return gst_fakesrc_create_buffer (src);
|
||||
}
|
||||
gst_fakesrc_prepare_buffer (src, buf);
|
||||
break;
|
||||
|
@ -781,9 +788,9 @@ gst_fakesrc_get (GstPad * pad)
|
|||
g_free (src->last_message);
|
||||
|
||||
src->last_message =
|
||||
g_strdup_printf ("get ******* (%s:%s)> (%d bytes, %"
|
||||
G_GUINT64_FORMAT " ) %p", GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
||||
g_strdup_printf ("get ******* (%s:%s)> (%d bytes, %"
|
||||
G_GUINT64_FORMAT " ) %p", GST_DEBUG_PAD_NAME (pad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
||||
|
||||
g_object_notify (G_OBJECT (src), "last_message");
|
||||
}
|
||||
|
@ -791,7 +798,7 @@ gst_fakesrc_get (GstPad * pad)
|
|||
if (src->signal_handoffs) {
|
||||
GST_LOG_OBJECT (src, "pre handoff emit");
|
||||
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,
|
||||
buf, pad);
|
||||
buf, pad);
|
||||
GST_LOG_OBJECT (src, "post handoff emit");
|
||||
}
|
||||
|
||||
|
@ -856,8 +863,8 @@ gst_fakesrc_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (fakesrc->parent) {
|
||||
gst_buffer_unref (fakesrc->parent);
|
||||
fakesrc->parent = NULL;
|
||||
gst_buffer_unref (fakesrc->parent);
|
||||
fakesrc->parent = NULL;
|
||||
}
|
||||
g_free (fakesrc->last_message);
|
||||
fakesrc->last_message = NULL;
|
||||
|
|
|
@ -82,7 +82,7 @@ gst_fdsink_class_init (GstFdSinkClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
|
||||
g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
|
||||
0, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_fdsink_set_property;
|
||||
gobject_class->get_property = gst_fdsink_get_property;
|
||||
|
@ -114,7 +114,7 @@ gst_fdsink_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
if (GST_BUFFER_DATA (buf)) {
|
||||
GST_DEBUG ("writing %d bytes to file descriptor %d", GST_BUFFER_SIZE (buf),
|
||||
fdsink->fd);
|
||||
fdsink->fd);
|
||||
write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
}
|
||||
|
||||
|
|
|
@ -92,14 +92,14 @@ gst_fdsrc_class_init (GstFdSrcClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
|
||||
g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
|
||||
g_param_spec_ulong ("blocksize", "Block size",
|
||||
"Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
"Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TIMEOUT,
|
||||
g_param_spec_uint64 ("timeout", "Timeout", "Read timeout in nanoseconds",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
|
||||
gst_fdsrc_signals[SIGNAL_TIMEOUT] =
|
||||
g_signal_new ("timeout", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -204,11 +204,11 @@ gst_fdsrc_get (GstPad * pad)
|
|||
|
||||
do {
|
||||
retval = select (1, &readfds, NULL, NULL, tp);
|
||||
} while (retval == -1 && errno == EINTR); /* retry if interrupted */
|
||||
} while (retval == -1 && errno == EINTR); /* retry if interrupted */
|
||||
|
||||
if (retval == -1) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||
("select on file descriptor: %s.", g_strerror (errno)));
|
||||
("select on file descriptor: %s.", g_strerror (errno)));
|
||||
gst_element_set_eos (GST_ELEMENT (src));
|
||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
} else if (retval == 0) {
|
||||
|
@ -219,7 +219,7 @@ gst_fdsrc_get (GstPad * pad)
|
|||
|
||||
do {
|
||||
readbytes = read (src->fd, GST_BUFFER_DATA (buf), src->blocksize);
|
||||
} while (readbytes == -1 && errno == EINTR); /* retry if interrupted */
|
||||
} while (readbytes == -1 && errno == EINTR); /* retry if interrupted */
|
||||
|
||||
if (readbytes > 0) {
|
||||
GST_BUFFER_OFFSET (buf) = src->curoffset;
|
||||
|
@ -234,7 +234,7 @@ gst_fdsrc_get (GstPad * pad)
|
|||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||
("read on file descriptor: %s.", g_strerror (errno)));
|
||||
("read on file descriptor: %s.", g_strerror (errno)));
|
||||
gst_element_set_eos (GST_ELEMENT (src));
|
||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ gst_filesink_get_formats (GstPad * pad)
|
|||
GST_FORMAT_BYTES,
|
||||
0,
|
||||
};
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
@ -77,6 +78,7 @@ gst_filesink_get_query_types (GstPad * pad)
|
|||
GST_QUERY_POSITION,
|
||||
0
|
||||
};
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
|
@ -110,6 +112,7 @@ _do_init (GType filesink_type)
|
|||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
g_type_add_interface_static (filesink_type, GST_TYPE_URI_HANDLER,
|
||||
&urihandler_info);
|
||||
GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0,
|
||||
|
@ -136,7 +139,7 @@ gst_filesink_class_init (GstFileSinkClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
|
||||
g_param_spec_string ("location", "File Location",
|
||||
"Location of the file to write", NULL, G_PARAM_READWRITE));
|
||||
"Location of the file to write", NULL, G_PARAM_READWRITE));
|
||||
|
||||
gst_filesink_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -251,15 +254,15 @@ gst_filesink_open_file (GstFileSink * sink)
|
|||
/* open the file */
|
||||
if (sink->filename == NULL || sink->filename[0] == '\0') {
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
|
||||
(_("No file name specified for writing.")), (NULL));
|
||||
(_("No file name specified for writing.")), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sink->file = fopen (sink->filename, "w");
|
||||
if (sink->file == NULL) {
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
||||
(_("Could not open file \"%s\" for writing."), sink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
(_("Could not open file \"%s\" for writing."), sink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -277,7 +280,7 @@ gst_filesink_close_file (GstFileSink * sink)
|
|||
|
||||
if (fclose (sink->file) != 0) {
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
|
||||
(_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM);
|
||||
(_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM);
|
||||
} else {
|
||||
GST_FLAG_UNSET (sink, GST_FILESINK_OPEN);
|
||||
}
|
||||
|
@ -292,25 +295,25 @@ gst_filesink_pad_query (GstPad * pad, GstQueryType type,
|
|||
switch (type) {
|
||||
case GST_QUERY_TOTAL:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) {
|
||||
*value = sink->data_written; /* FIXME - doesn't the kernel provide
|
||||
such a function? */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) {
|
||||
*value = sink->data_written; /* FIXME - doesn't the kernel provide
|
||||
such a function? */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_QUERY_POSITION:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) {
|
||||
*value = ftell (sink->file);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) {
|
||||
*value = ftell (sink->file);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -336,27 +339,27 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
|||
switch (type) {
|
||||
case GST_EVENT_SEEK:
|
||||
g_return_val_if_fail (GST_EVENT_SEEK_FORMAT (event) == GST_FORMAT_BYTES,
|
||||
FALSE);
|
||||
FALSE);
|
||||
|
||||
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
|
||||
if (fflush (filesink->file))
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
if (fflush (filesink->file))
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_SET);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_CUR);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_END);
|
||||
break;
|
||||
default:
|
||||
g_warning ("unknown seek method!");
|
||||
break;
|
||||
case GST_SEEK_METHOD_SET:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_SET);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_CUR);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_END);
|
||||
break;
|
||||
default:
|
||||
g_warning ("unknown seek method!");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
|
@ -364,16 +367,16 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
|||
gint64 offset;
|
||||
|
||||
if (gst_event_discont_get_value (event, GST_FORMAT_BYTES, &offset))
|
||||
fseek (filesink->file, offset, SEEK_SET);
|
||||
fseek (filesink->file, offset, SEEK_SET);
|
||||
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_FLUSH:
|
||||
if (fflush (filesink->file)) {
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_EOS:
|
||||
|
@ -419,15 +422,15 @@ gst_filesink_chain (GstPad * pad, GstData * _data)
|
|||
back_pending = filesink->data_written - ftell (filesink->file);
|
||||
while (bytes_written < GST_BUFFER_SIZE (buf)) {
|
||||
size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1,
|
||||
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||
filesink->file);
|
||||
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||
filesink->file);
|
||||
|
||||
if (wrote <= 0) {
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
("Only %d of %d bytes written: %s",
|
||||
bytes_written, GST_BUFFER_SIZE (buf), strerror (errno)));
|
||||
break;
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
("Only %d of %d bytes written: %s",
|
||||
bytes_written, GST_BUFFER_SIZE (buf), strerror (errno)));
|
||||
break;
|
||||
}
|
||||
bytes_written += wrote;
|
||||
}
|
||||
|
@ -449,13 +452,13 @@ gst_filesink_change_state (GstElement * element)
|
|||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (GST_FLAG_IS_SET (element, GST_FILESINK_OPEN))
|
||||
gst_filesink_close_file (GST_FILESINK (element));
|
||||
gst_filesink_close_file (GST_FILESINK (element));
|
||||
break;
|
||||
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
if (!GST_FLAG_IS_SET (element, GST_FILESINK_OPEN)) {
|
||||
if (!gst_filesink_open_file (GST_FILESINK (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
if (!gst_filesink_open_file (GST_FILESINK (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -477,6 +480,7 @@ static gchar **
|
|||
gst_filesink_uri_get_protocols (void)
|
||||
{
|
||||
static gchar *protocols[] = { "file", NULL };
|
||||
|
||||
return protocols;
|
||||
}
|
||||
static const gchar *
|
||||
|
|
|
@ -107,11 +107,12 @@ gst_filesrc_get_event_mask (GstPad * pad)
|
|||
{
|
||||
static const GstEventMask masks[] = {
|
||||
{GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
||||
{GST_EVENT_FLUSH, 0},
|
||||
{GST_EVENT_SIZE, 0},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
return masks;
|
||||
}
|
||||
|
||||
|
@ -123,6 +124,7 @@ gst_filesrc_get_query_types (GstPad * pad)
|
|||
GST_QUERY_POSITION,
|
||||
0
|
||||
};
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
|
@ -133,6 +135,7 @@ gst_filesrc_get_formats (GstPad * pad)
|
|||
GST_FORMAT_BYTES,
|
||||
0,
|
||||
};
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
@ -162,6 +165,7 @@ _do_init (GType filesrc_type)
|
|||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
|
||||
&urihandler_info);
|
||||
GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element");
|
||||
|
@ -188,22 +192,22 @@ gst_filesrc_class_init (GstFileSrcClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
|
||||
g_param_spec_int ("fd", "File-descriptor",
|
||||
"File-descriptor for the file being mmap()d", 0, G_MAXINT, 0,
|
||||
G_PARAM_READABLE));
|
||||
"File-descriptor for the file being mmap()d", 0, G_MAXINT, 0,
|
||||
G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
|
||||
g_param_spec_string ("location", "File Location",
|
||||
"Location of the file to read", NULL, G_PARAM_READWRITE));
|
||||
"Location of the file to read", NULL, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
|
||||
g_param_spec_ulong ("blocksize", "Block size",
|
||||
"Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
"Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MMAPSIZE,
|
||||
g_param_spec_ulong ("mmapsize", "mmap() Block Size",
|
||||
"Size in bytes of mmap()d regions", 0, G_MAXULONG, DEFAULT_MMAPSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
"Size in bytes of mmap()d regions", 0, G_MAXULONG, DEFAULT_MMAPSIZE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOUCH,
|
||||
g_param_spec_boolean ("touch", "Touch read data",
|
||||
"Touch data to force disk read", FALSE, G_PARAM_READWRITE));
|
||||
"Touch data to force disk read", FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->dispose = gst_filesrc_dispose;
|
||||
gobject_class->set_property = gst_filesrc_set_property;
|
||||
|
@ -235,7 +239,7 @@ gst_filesrc_init (GstFileSrc * src)
|
|||
src->touch = FALSE;
|
||||
|
||||
src->mapbuf = NULL;
|
||||
src->mapsize = DEFAULT_MMAPSIZE; /* default is 4MB */
|
||||
src->mapsize = DEFAULT_MMAPSIZE; /* default is 4MB */
|
||||
|
||||
src->seek_happened = FALSE;
|
||||
}
|
||||
|
@ -301,12 +305,12 @@ gst_filesrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
break;
|
||||
case ARG_MMAPSIZE:
|
||||
if ((src->mapsize % src->pagesize) == 0) {
|
||||
src->mapsize = g_value_get_ulong (value);
|
||||
g_object_notify (G_OBJECT (src), "mmapsize");
|
||||
src->mapsize = g_value_get_ulong (value);
|
||||
g_object_notify (G_OBJECT (src), "mmapsize");
|
||||
} else {
|
||||
GST_INFO_OBJECT (src,
|
||||
"invalid mapsize, must be a multiple of pagesize, which is %d",
|
||||
src->pagesize);
|
||||
GST_INFO_OBJECT (src,
|
||||
"invalid mapsize, must be a multiple of pagesize, which is %d",
|
||||
src->pagesize);
|
||||
}
|
||||
break;
|
||||
case ARG_TOUCH:
|
||||
|
@ -390,7 +394,7 @@ gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size)
|
|||
return NULL;
|
||||
} else if (mmapregion == MAP_FAILED) {
|
||||
GST_WARNING_OBJECT (src, "mmap (0x%08lx, %d, 0x%llx) failed: %s",
|
||||
(unsigned long) size, src->fd, offset, strerror (errno));
|
||||
(unsigned long) size, src->fd, offset, strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
GST_LOG_OBJECT (src, "mapped region %08lx+%08lx from file into memory at %p",
|
||||
|
@ -435,7 +439,7 @@ gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size)
|
|||
|
||||
mapbase = offset - mod;
|
||||
mapsize =
|
||||
((size + mod + src->pagesize - 1) / src->pagesize) * src->pagesize;
|
||||
((size + mod + src->pagesize - 1) / src->pagesize) * src->pagesize;
|
||||
/* printf("not on page boundaries, resizing map to %d+%d\n",mapbase,mapsize);*/
|
||||
map = gst_filesrc_map_region (src, mapbase, mapsize);
|
||||
if (map == NULL)
|
||||
|
@ -468,10 +472,10 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
|
||||
/* calculate end pointers so we don't have to do so repeatedly later */
|
||||
readsize = src->block_size;
|
||||
readend = src->curoffset + src->block_size; /* note this is the byte *after* the read */
|
||||
readend = src->curoffset + src->block_size; /* note this is the byte *after* the read */
|
||||
mapstart = GST_BUFFER_OFFSET (src->mapbuf);
|
||||
mapsize = GST_BUFFER_SIZE (src->mapbuf);
|
||||
mapend = mapstart + mapsize; /* note this is the byte *after* the map */
|
||||
mapend = mapstart + mapsize; /* note this is the byte *after* the map */
|
||||
|
||||
/* check to see if we're going to overflow the end of the file */
|
||||
if (readend > src->filelen) {
|
||||
|
@ -491,22 +495,22 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
/* ('cause by definition if readend is in the buffer, so's readstart) */
|
||||
if (readend <= mapend) {
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d lives in current mapbuf %lld+%d, creating subbuffer of mapbuf",
|
||||
src->curoffset, (int) readsize, mapstart, mapsize);
|
||||
"read buf %llu+%d lives in current mapbuf %lld+%d, creating subbuffer of mapbuf",
|
||||
src->curoffset, (int) readsize, mapstart, mapsize);
|
||||
buf =
|
||||
gst_buffer_create_sub (src->mapbuf, src->curoffset - mapstart,
|
||||
readsize);
|
||||
gst_buffer_create_sub (src->mapbuf, src->curoffset - mapstart,
|
||||
readsize);
|
||||
GST_BUFFER_OFFSET (buf) = src->curoffset;
|
||||
|
||||
/* if the start actually is within the current mmap region, map an overlap buffer */
|
||||
} else if (src->curoffset < mapend) {
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d starts in mapbuf %d+%d but ends outside, creating new mmap",
|
||||
(unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart,
|
||||
(gint) mapsize);
|
||||
"read buf %llu+%d starts in mapbuf %d+%d but ends outside, creating new mmap",
|
||||
(unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart,
|
||||
(gint) mapsize);
|
||||
buf = gst_filesrc_map_small_region (src, src->curoffset, readsize);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* the only other option is that buffer is totally outside, which means we search for it */
|
||||
|
@ -518,9 +522,9 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
/* or the read buffer fully contains the current mmap region */
|
||||
/* either way, it's really not relevant, we just create a new region anyway */
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d starts before mapbuf %d+%d, but overlaps it",
|
||||
(unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart,
|
||||
(gint) mapsize);
|
||||
"read buf %llu+%d starts before mapbuf %d+%d, but overlaps it",
|
||||
(unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart,
|
||||
(gint) mapsize);
|
||||
buf = gst_filesrc_map_small_region (src, src->curoffset, readsize);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
@ -530,16 +534,16 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
if (buf == NULL) {
|
||||
/* first check to see if there's a map that covers the right region already */
|
||||
GST_LOG_OBJECT (src, "searching for mapbuf to cover %llu+%d",
|
||||
src->curoffset, (int) readsize);
|
||||
src->curoffset, (int) readsize);
|
||||
|
||||
/* if the read buffer crosses a mmap region boundary, create a one-off region */
|
||||
if ((src->curoffset / src->mapsize) != (readend / src->mapsize)) {
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d crosses a %d-byte boundary, creating a one-off",
|
||||
src->curoffset, (int) readsize, (int) src->mapsize);
|
||||
"read buf %llu+%d crosses a %d-byte boundary, creating a one-off",
|
||||
src->curoffset, (int) readsize, (int) src->mapsize);
|
||||
buf = gst_filesrc_map_small_region (src, src->curoffset, readsize);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
/* otherwise we will create a new mmap region and set it to the default */
|
||||
} else {
|
||||
|
@ -548,29 +552,29 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
off_t nextmap = src->curoffset - (src->curoffset % src->mapsize);
|
||||
|
||||
GST_LOG_OBJECT (src,
|
||||
"read buf %llu+%d in new mapbuf at %llu+%d, mapping and subbuffering",
|
||||
src->curoffset, readsize, nextmap, src->mapsize);
|
||||
"read buf %llu+%d in new mapbuf at %llu+%d, mapping and subbuffering",
|
||||
src->curoffset, readsize, nextmap, src->mapsize);
|
||||
/* first, we're done with the old mapbuf */
|
||||
gst_buffer_unref (src->mapbuf);
|
||||
mapsize = src->mapsize;
|
||||
|
||||
/* double the mapsize as long as the readsize is smaller */
|
||||
while (readsize - (src->curoffset - nextmap) > mapsize) {
|
||||
GST_LOG_OBJECT (src, "readsize smaller then mapsize %08x %d",
|
||||
readsize, (int) mapsize);
|
||||
mapsize <<= 1;
|
||||
GST_LOG_OBJECT (src, "readsize smaller then mapsize %08x %d",
|
||||
readsize, (int) mapsize);
|
||||
mapsize <<= 1;
|
||||
}
|
||||
/* create a new one */
|
||||
src->mapbuf = gst_filesrc_map_region (src, nextmap, mapsize);
|
||||
if (src->mapbuf == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
/* subbuffer it */
|
||||
buf =
|
||||
gst_buffer_create_sub (src->mapbuf, src->curoffset - nextmap,
|
||||
readsize);
|
||||
gst_buffer_create_sub (src->mapbuf, src->curoffset - nextmap,
|
||||
readsize);
|
||||
GST_BUFFER_OFFSET (buf) =
|
||||
GST_BUFFER_OFFSET (src->mapbuf) + src->curoffset - nextmap;
|
||||
GST_BUFFER_OFFSET (src->mapbuf) + src->curoffset - nextmap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -598,7 +602,7 @@ gst_filesrc_get_read (GstFileSrc * src)
|
|||
readsize = src->block_size;
|
||||
if (src->curoffset + readsize > src->filelen) {
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| src->curoffset + readsize > src->filelen) {
|
||||
|| src->curoffset + readsize > src->filelen) {
|
||||
readsize = src->filelen - src->curoffset;
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +617,7 @@ gst_filesrc_get_read (GstFileSrc * src)
|
|||
}
|
||||
if (ret < readsize) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||
("unexpected end of file."));
|
||||
("unexpected end of file."));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -648,8 +652,8 @@ gst_filesrc_get (GstPad * pad)
|
|||
src->seek_happened = FALSE;
|
||||
GST_DEBUG_OBJECT (src, "sending discont");
|
||||
event =
|
||||
gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset,
|
||||
NULL);
|
||||
gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset,
|
||||
NULL);
|
||||
return GST_DATA (event);
|
||||
}
|
||||
|
||||
|
@ -658,7 +662,7 @@ gst_filesrc_get (GstPad * pad)
|
|||
if (src->curoffset == src->filelen) {
|
||||
if (!gst_filesrc_check_filesize (src) || src->curoffset >= src->filelen) {
|
||||
GST_DEBUG_OBJECT (src, "eos %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
|
||||
src->curoffset, src->filelen);
|
||||
src->curoffset, src->filelen);
|
||||
gst_element_set_eos (GST_ELEMENT (src));
|
||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
}
|
||||
|
@ -697,7 +701,7 @@ gst_filesrc_open_file (GstFileSrc * src)
|
|||
|
||||
if (src->filename == NULL || src->filename[0] == '\0') {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -711,8 +715,8 @@ gst_filesrc_open_file (GstFileSrc * src)
|
|||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL), (NULL));
|
||||
else
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||
(_("Could not open file \"%s\" for reading."), src->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
(_("Could not open file \"%s\" for reading."), src->filename),
|
||||
GST_ERROR_SYSTEM);
|
||||
return FALSE;
|
||||
} else {
|
||||
/* check if it is a regular file, otherwise bail out */
|
||||
|
@ -722,7 +726,7 @@ gst_filesrc_open_file (GstFileSrc * src)
|
|||
|
||||
if (!S_ISREG (stat_results.st_mode)) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||
(_("File \"%s\" isn't a regular file."), src->filename), (NULL));
|
||||
(_("File \"%s\" isn't a regular file."), src->filename), (NULL));
|
||||
close (src->fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -780,13 +784,13 @@ gst_filesrc_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
if (!GST_FLAG_IS_SET (element, GST_FILESRC_OPEN)) {
|
||||
if (!gst_filesrc_open_file (GST_FILESRC (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
if (!gst_filesrc_open_file (GST_FILESRC (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (GST_FLAG_IS_SET (element, GST_FILESRC_OPEN))
|
||||
gst_filesrc_close_file (GST_FILESRC (element));
|
||||
gst_filesrc_close_file (GST_FILESRC (element));
|
||||
src->seek_happened = TRUE;
|
||||
break;
|
||||
default:
|
||||
|
@ -808,23 +812,23 @@ gst_filesrc_srcpad_query (GstPad * pad, GstQueryType type,
|
|||
switch (type) {
|
||||
case GST_QUERY_TOTAL:
|
||||
if (*format != GST_FORMAT_BYTES) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
gst_filesrc_check_filesize (src);
|
||||
*value = src->filelen;
|
||||
break;
|
||||
case GST_QUERY_POSITION:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
*value = src->curoffset;
|
||||
break;
|
||||
case GST_FORMAT_PERCENT:
|
||||
if (src->filelen == 0)
|
||||
return FALSE;
|
||||
*value = src->curoffset * GST_FORMAT_PERCENT_MAX / src->filelen;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
*value = src->curoffset;
|
||||
break;
|
||||
case GST_FORMAT_PERCENT:
|
||||
if (src->filelen == 0)
|
||||
return FALSE;
|
||||
*value = src->curoffset * GST_FORMAT_PERCENT_MAX / src->filelen;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -847,44 +851,44 @@ gst_filesrc_srcpad_event (GstPad * pad, GstEvent * event)
|
|||
gint64 offset;
|
||||
|
||||
if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES) {
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
|
||||
offset = GST_EVENT_SEEK_OFFSET (event);
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET:
|
||||
if (offset > src->filelen && (!gst_filesrc_check_filesize (src)
|
||||
|| offset > src->filelen)) {
|
||||
goto error;
|
||||
}
|
||||
src->curoffset = offset;
|
||||
GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
if (offset + src->curoffset > src->filelen)
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| offset + src->curoffset > src->filelen)
|
||||
goto error;
|
||||
src->curoffset += offset;
|
||||
GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
if (ABS (offset) > src->filelen) {
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| ABS (offset) > src->filelen)
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
src->curoffset = src->filelen - ABS (offset);
|
||||
GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
break;
|
||||
case GST_SEEK_METHOD_SET:
|
||||
if (offset > src->filelen && (!gst_filesrc_check_filesize (src)
|
||||
|| offset > src->filelen)) {
|
||||
goto error;
|
||||
}
|
||||
src->curoffset = offset;
|
||||
GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
if (offset + src->curoffset > src->filelen)
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| offset + src->curoffset > src->filelen)
|
||||
goto error;
|
||||
src->curoffset += offset;
|
||||
GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
if (ABS (offset) > src->filelen) {
|
||||
if (!gst_filesrc_check_filesize (src)
|
||||
|| ABS (offset) > src->filelen)
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
src->curoffset = src->filelen - ABS (offset);
|
||||
GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT,
|
||||
src->curoffset);
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
break;
|
||||
}
|
||||
src->seek_happened = TRUE;
|
||||
src->need_flush = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH;
|
||||
|
@ -892,7 +896,7 @@ gst_filesrc_srcpad_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
case GST_EVENT_SIZE:
|
||||
if (GST_EVENT_SIZE_FORMAT (event) != GST_FORMAT_BYTES) {
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
src->block_size = GST_EVENT_SIZE_VALUE (event);
|
||||
g_object_notify (G_OBJECT (src), "blocksize");
|
||||
|
@ -923,6 +927,7 @@ static gchar **
|
|||
gst_filesrc_uri_get_protocols (void)
|
||||
{
|
||||
static gchar *protocols[] = { "file", NULL };
|
||||
|
||||
return protocols;
|
||||
}
|
||||
static const gchar *
|
||||
|
|
|
@ -94,31 +94,31 @@ gst_identity_class_init (GstIdentityClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
|
||||
g_param_spec_boolean ("loop-based", "Loop-based",
|
||||
"Set to TRUE to use loop-based rather than chain-based scheduling",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"Set to TRUE to use loop-based rather than chain-based scheduling",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SLEEP_TIME,
|
||||
g_param_spec_uint ("sleep-time", "Sleep time",
|
||||
"Microseconds to sleep between processing", 0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"Microseconds to sleep between processing", 0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUPLICATE,
|
||||
g_param_spec_uint ("duplicate", "Duplicate Buffers",
|
||||
"Push the buffers N times", 0, G_MAXUINT, 1, G_PARAM_READWRITE));
|
||||
"Push the buffers N times", 0, G_MAXUINT, 1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ERROR_AFTER,
|
||||
g_param_spec_int ("error_after", "Error After", "Error after N buffers",
|
||||
G_MININT, G_MAXINT, -1, G_PARAM_READWRITE));
|
||||
G_MININT, G_MAXINT, -1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DROP_PROBABILITY,
|
||||
g_param_spec_float ("drop_probability", "Drop Probability",
|
||||
"The Probability a buffer is dropped", 0.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE));
|
||||
"The Probability a buffer is dropped", 0.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last-message", "last-message", "last-message", NULL,
|
||||
G_PARAM_READABLE));
|
||||
G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
|
||||
g_param_spec_boolean ("dump", "Dump", "Dump buffer contents", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gst_identity_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -173,7 +173,7 @@ gst_identity_chain (GstPad * pad, GstData * _data)
|
|||
if (identity->error_after == 0) {
|
||||
gst_buffer_unref (buf);
|
||||
GST_ELEMENT_ERROR (identity, CORE, FAILED,
|
||||
(_("Failed after iterations as requested.")), (NULL));
|
||||
(_("Failed after iterations as requested.")), (NULL));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -181,12 +181,12 @@ gst_identity_chain (GstPad * pad, GstData * _data)
|
|||
if (identity->drop_probability > 0.0) {
|
||||
if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
|
||||
if (identity->last_message != NULL) {
|
||||
g_free (identity->last_message);
|
||||
g_free (identity->last_message);
|
||||
}
|
||||
identity->last_message =
|
||||
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %"
|
||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %"
|
||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_object_notify (G_OBJECT (identity), "last-message");
|
||||
gst_buffer_unref (buf);
|
||||
return;
|
||||
|
@ -200,14 +200,14 @@ gst_identity_chain (GstPad * pad, GstData * _data)
|
|||
if (!identity->silent) {
|
||||
g_free (identity->last_message);
|
||||
identity->last_message =
|
||||
g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, %"
|
||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, %"
|
||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
g_object_notify (G_OBJECT (identity), "last-message");
|
||||
}
|
||||
|
||||
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
|
||||
buf);
|
||||
buf);
|
||||
|
||||
if (i > 1)
|
||||
gst_buffer_ref (buf);
|
||||
|
@ -259,12 +259,12 @@ gst_identity_set_property (GObject * object, guint prop_id,
|
|||
case ARG_LOOP_BASED:
|
||||
identity->loop_based = g_value_get_boolean (value);
|
||||
if (identity->loop_based) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (identity),
|
||||
gst_identity_loop);
|
||||
gst_pad_set_chain_function (identity->sinkpad, NULL);
|
||||
gst_element_set_loop_function (GST_ELEMENT (identity),
|
||||
gst_identity_loop);
|
||||
gst_pad_set_chain_function (identity->sinkpad, NULL);
|
||||
} else {
|
||||
gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain);
|
||||
gst_element_set_loop_function (GST_ELEMENT (identity), NULL);
|
||||
gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain);
|
||||
gst_element_set_loop_function (GST_ELEMENT (identity), NULL);
|
||||
}
|
||||
break;
|
||||
case ARG_SLEEP_TIME:
|
||||
|
|
|
@ -397,7 +397,7 @@ gst_md5sink_class_init (GstMD5SinkClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5,
|
||||
g_param_spec_string ("md5", "md5", "current value of the md5 sum",
|
||||
"", G_PARAM_READABLE));
|
||||
"", G_PARAM_READABLE));
|
||||
|
||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_md5sink_change_state);
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ gst_md5sink_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
guchar *md5string = g_malloc0 (33);
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
sprintf (md5string + i * 2, "%02x", sink->md5[i]);
|
||||
sprintf (md5string + i * 2, "%02x", sink->md5[i]);
|
||||
g_value_set_string (value, md5string);
|
||||
g_free (md5string);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass)
|
|||
G_STRUCT_OFFSET (GstMultiFileSrcClass, new_file), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATIONS, g_param_spec_pointer ("locations", "locations", "locations", G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATIONS, g_param_spec_pointer ("locations", "locations", "locations", G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
gobject_class->set_property = gst_multifilesrc_set_property;
|
||||
gobject_class->get_property = gst_multifilesrc_get_property;
|
||||
|
@ -149,11 +149,11 @@ gst_multifilesrc_set_property (GObject * object, guint prop_id,
|
|||
|
||||
/* clear the filename if we get a NULL */
|
||||
if (g_value_get_pointer (value) == NULL) {
|
||||
gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
|
||||
src->listptr = NULL;
|
||||
/* otherwise set the new filenames */
|
||||
gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
|
||||
src->listptr = NULL;
|
||||
/* otherwise set the new filenames */
|
||||
} else {
|
||||
src->listptr = g_value_get_pointer (value);
|
||||
src->listptr = g_value_get_pointer (value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -244,7 +244,7 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
|||
|
||||
if (src->currentfilename == NULL || src->currentfilename[0] == '\0') {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -252,8 +252,8 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
|||
src->fd = open ((const char *) src->currentfilename, O_RDONLY);
|
||||
if (src->fd < 0) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||
(_("Could not open file \"%s\" for reading."), src->currentfilename),
|
||||
GST_ERROR_SYSTEM);
|
||||
(_("Could not open file \"%s\" for reading."), src->currentfilename),
|
||||
GST_ERROR_SYSTEM);
|
||||
return FALSE;
|
||||
|
||||
} else {
|
||||
|
@ -267,7 +267,7 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
|||
if (src->map == NULL) {
|
||||
close (src->fd);
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL),
|
||||
("mmap call failed."));
|
||||
("mmap call failed."));
|
||||
return FALSE;
|
||||
}
|
||||
GST_FLAG_SET (src, GST_MULTIFILESRC_OPEN);
|
||||
|
|
|
@ -98,7 +98,7 @@ gst_pipefilter_class_init (GstPipefilterClass * klass)
|
|||
gobject_class->set_property = gst_pipefilter_set_property;
|
||||
gobject_class->get_property = gst_pipefilter_get_property;
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COMMAND, g_param_spec_string ("command", "command", "command", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COMMAND, g_param_spec_string ("command", "command", "command", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
gstelement_class->change_state = gst_pipefilter_change_state;
|
||||
}
|
||||
|
@ -134,9 +134,9 @@ gst_pipefilter_handle_event (GstPad * pad, GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
if (close (pipefilter->fdin[1]) < 0)
|
||||
perror ("close");
|
||||
perror ("close");
|
||||
if (close (pipefilter->fdout[0]) < 0)
|
||||
perror ("close");
|
||||
perror ("close");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -279,8 +279,8 @@ gst_pipefilter_open_file (GstPipefilter * src)
|
|||
close (src->fdin[1]);
|
||||
close (src->fdout[0]);
|
||||
/* child */
|
||||
dup2 (src->fdin[0], STDIN_FILENO); /* set the childs input stream */
|
||||
dup2 (src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
|
||||
dup2 (src->fdin[0], STDIN_FILENO); /* set the childs input stream */
|
||||
dup2 (src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
|
||||
execvp (src->command[0], &src->command[0]);
|
||||
/* will only be reached if execvp has an error */
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL), GST_ERROR_SYSTEM);
|
||||
|
@ -327,7 +327,7 @@ gst_pipefilter_change_state (GstElement * element)
|
|||
} else {
|
||||
if (!GST_FLAG_IS_SET (element, GST_PIPEFILTER_OPEN)) {
|
||||
if (!gst_pipefilter_open_file (GST_PIPEFILTER (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ typedef struct _GstQueueEventResponse
|
|||
{
|
||||
GstEvent *event;
|
||||
gboolean ret, handled;
|
||||
} GstQueueEventResponse;
|
||||
}
|
||||
GstQueueEventResponse;
|
||||
|
||||
static void gst_queue_base_init (GstQueueClass * klass);
|
||||
static void gst_queue_class_init (GstQueueClass * klass);
|
||||
|
@ -106,6 +107,7 @@ queue_leaky_get_type (void)
|
|||
{GST_QUEUE_LEAK_DOWNSTREAM, "2", "Leaky on Downstream"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!queue_leaky_type) {
|
||||
queue_leaky_type = g_enum_register_static ("GstQueueLeaky", queue_leaky);
|
||||
}
|
||||
|
@ -135,7 +137,7 @@ gst_queue_get_type (void)
|
|||
};
|
||||
|
||||
queue_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstQueue", &queue_info, 0);
|
||||
"GstQueue", &queue_info, 0);
|
||||
}
|
||||
|
||||
return queue_type;
|
||||
|
@ -174,56 +176,56 @@ gst_queue_class_init (GstQueueClass * klass)
|
|||
/* properties */
|
||||
g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_BYTES,
|
||||
g_param_spec_uint ("current-level-bytes", "Current level (kB)",
|
||||
"Current amount of data in the queue (bytes)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READABLE));
|
||||
"Current amount of data in the queue (bytes)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_BUFFERS,
|
||||
g_param_spec_uint ("current-level-buffers", "Current level (buffers)",
|
||||
"Current number of buffers in the queue",
|
||||
0, G_MAXUINT, 0, G_PARAM_READABLE));
|
||||
"Current number of buffers in the queue",
|
||||
0, G_MAXUINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_TIME,
|
||||
g_param_spec_uint64 ("current-level-time", "Current level (ns)",
|
||||
"Current amount of data in the queue (in ns)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READABLE));
|
||||
"Current amount of data in the queue (in ns)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_MAX_SIZE_BYTES,
|
||||
g_param_spec_uint ("max-size-bytes", "Max. size (kB)",
|
||||
"Max. amount of data in the queue (bytes, 0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
"Max. amount of data in the queue (bytes, 0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MAX_SIZE_BUFFERS,
|
||||
g_param_spec_uint ("max-size-buffers", "Max. size (buffers)",
|
||||
"Max. number of buffers in the queue (0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
"Max. number of buffers in the queue (0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MAX_SIZE_TIME,
|
||||
g_param_spec_uint64 ("max-size-time", "Max. size (ns)",
|
||||
"Max. amount of data in the queue (in ns, 0=disable)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
"Max. amount of data in the queue (in ns, 0=disable)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_BYTES,
|
||||
g_param_spec_uint ("min-threshold-bytes", "Min. threshold (kB)",
|
||||
"Min. amount of data in the queue to allow reading (bytes, 0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
"Min. amount of data in the queue to allow reading (bytes, 0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_BUFFERS,
|
||||
g_param_spec_uint ("min-threshold-buffers", "Min. threshold (buffers)",
|
||||
"Min. number of buffers in the queue to allow reading (0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
"Min. number of buffers in the queue to allow reading (0=disable)",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_TIME,
|
||||
g_param_spec_uint64 ("min-threshold-time", "Min. threshold (ns)",
|
||||
"Min. amount of data in the queue to allow reading (in ns, 0=disable)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
"Min. amount of data in the queue to allow reading (in ns, 0=disable)",
|
||||
0, G_MAXUINT64, 0, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_LEAKY,
|
||||
g_param_spec_enum ("leaky", "Leaky",
|
||||
"Where the queue leaks, if at all",
|
||||
GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, G_PARAM_READWRITE));
|
||||
"Where the queue leaks, if at all",
|
||||
GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MAY_DEADLOCK,
|
||||
g_param_spec_boolean ("may_deadlock", "May Deadlock",
|
||||
"The queue may deadlock if it's full and not PLAYING",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"The queue may deadlock if it's full and not PLAYING",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_BLOCK_TIMEOUT,
|
||||
g_param_spec_uint64 ("block_timeout", "Timeout for Block",
|
||||
"Nanoseconds until blocked queue times out and returns filler event. "
|
||||
"Value of -1 disables timeout",
|
||||
0, G_MAXUINT64, -1, G_PARAM_READWRITE));
|
||||
"Nanoseconds until blocked queue times out and returns filler event. "
|
||||
"Value of -1 disables timeout",
|
||||
0, G_MAXUINT64, -1, G_PARAM_READWRITE));
|
||||
|
||||
/* set several parent class virtual functions */
|
||||
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_queue_dispose);
|
||||
|
@ -261,15 +263,15 @@ gst_queue_init (GstQueue * queue)
|
|||
GST_DEBUG_FUNCPTR (gst_queue_handle_src_event));
|
||||
gst_pad_set_active (queue->srcpad, TRUE);
|
||||
|
||||
queue->cur_level.buffers = 0; /* no content */
|
||||
queue->cur_level.bytes = 0; /* no content */
|
||||
queue->cur_level.time = 0; /* no content */
|
||||
queue->max_size.buffers = 100; /* 100 buffers */
|
||||
queue->max_size.bytes = 10 * 1024 * 1024; /* 10 MB */
|
||||
queue->max_size.time = GST_SECOND; /* 1 s. */
|
||||
queue->min_threshold.buffers = 0; /* no threshold */
|
||||
queue->min_threshold.bytes = 0; /* no threshold */
|
||||
queue->min_threshold.time = 0; /* no threshold */
|
||||
queue->cur_level.buffers = 0; /* no content */
|
||||
queue->cur_level.bytes = 0; /* no content */
|
||||
queue->cur_level.time = 0; /* no content */
|
||||
queue->max_size.buffers = 100; /* 100 buffers */
|
||||
queue->max_size.bytes = 10 * 1024 * 1024; /* 10 MB */
|
||||
queue->max_size.time = GST_SECOND; /* 1 s. */
|
||||
queue->min_threshold.buffers = 0; /* no threshold */
|
||||
queue->min_threshold.bytes = 0; /* no threshold */
|
||||
queue->min_threshold.time = 0; /* no threshold */
|
||||
|
||||
queue->leaky = GST_QUEUE_NO_LEAK;
|
||||
queue->may_deadlock = TRUE;
|
||||
|
@ -437,163 +439,163 @@ restart:
|
|||
if (GST_IS_EVENT (data)) {
|
||||
switch (GST_EVENT_TYPE (data)) {
|
||||
case GST_EVENT_FLUSH:
|
||||
STATUS (queue, "received flush event");
|
||||
gst_queue_locked_flush (queue);
|
||||
STATUS (queue, "after flush");
|
||||
break;
|
||||
STATUS (queue, "received flush event");
|
||||
gst_queue_locked_flush (queue);
|
||||
STATUS (queue, "after flush");
|
||||
break;
|
||||
case GST_EVENT_EOS:
|
||||
STATUS (queue, "received EOS");
|
||||
break;
|
||||
STATUS (queue, "received EOS");
|
||||
break;
|
||||
default:
|
||||
/* we put the event in the queue, we don't have to act ourselves */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding event %p of type %d", data, GST_EVENT_TYPE (data));
|
||||
break;
|
||||
/* we put the event in the queue, we don't have to act ourselves */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding event %p of type %d", data, GST_EVENT_TYPE (data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GST_IS_BUFFER (data))
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding buffer %p of size %d", data, GST_BUFFER_SIZE (data));
|
||||
"adding buffer %p of size %d", data, GST_BUFFER_SIZE (data));
|
||||
|
||||
/* We make space available if we're "full" according to whatever
|
||||
* the user defined as "full". Note that this only applies to buffers.
|
||||
* We always handle events and they don't count in our statistics. */
|
||||
if (GST_IS_BUFFER (data) &&
|
||||
((queue->max_size.buffers > 0 &&
|
||||
queue->cur_level.buffers >= queue->max_size.buffers) ||
|
||||
(queue->max_size.bytes > 0 &&
|
||||
queue->cur_level.bytes >= queue->max_size.bytes) ||
|
||||
(queue->max_size.time > 0 &&
|
||||
queue->cur_level.time >= queue->max_size.time))) {
|
||||
queue->cur_level.buffers >= queue->max_size.buffers) ||
|
||||
(queue->max_size.bytes > 0 &&
|
||||
queue->cur_level.bytes >= queue->max_size.bytes) ||
|
||||
(queue->max_size.time > 0 &&
|
||||
queue->cur_level.time >= queue->max_size.time))) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0);
|
||||
g_mutex_lock (queue->qlock);
|
||||
|
||||
/* how are we going to make space for this buffer? */
|
||||
switch (queue->leaky) {
|
||||
/* leak current buffer */
|
||||
/* leak current buffer */
|
||||
case GST_QUEUE_LEAK_UPSTREAM:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue is full, leaking buffer on upstream end");
|
||||
/* now we can clean up and exit right away */
|
||||
g_mutex_unlock (queue->qlock);
|
||||
goto out_unref;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue is full, leaking buffer on upstream end");
|
||||
/* now we can clean up and exit right away */
|
||||
g_mutex_unlock (queue->qlock);
|
||||
goto out_unref;
|
||||
|
||||
/* leak first buffer in the queue */
|
||||
/* leak first buffer in the queue */
|
||||
case GST_QUEUE_LEAK_DOWNSTREAM:{
|
||||
/* this is a bit hacky. We'll manually iterate the list
|
||||
* and find the first buffer from the head on. We'll
|
||||
* unref that and "fix up" the GQueue object... */
|
||||
GList *item;
|
||||
GstData *leak = NULL;
|
||||
/* this is a bit hacky. We'll manually iterate the list
|
||||
* and find the first buffer from the head on. We'll
|
||||
* unref that and "fix up" the GQueue object... */
|
||||
GList *item;
|
||||
GstData *leak = NULL;
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue is full, leaking buffer on downstream end");
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue is full, leaking buffer on downstream end");
|
||||
|
||||
for (item = queue->queue->head; item != NULL; item = item->next) {
|
||||
if (GST_IS_BUFFER (item->data)) {
|
||||
leak = item->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (item = queue->queue->head; item != NULL; item = item->next) {
|
||||
if (GST_IS_BUFFER (item->data)) {
|
||||
leak = item->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we didn't find anything, it means we have no buffers
|
||||
* in here. That cannot happen, since we had >= 1 bufs */
|
||||
g_assert (leak);
|
||||
/* if we didn't find anything, it means we have no buffers
|
||||
* in here. That cannot happen, since we had >= 1 bufs */
|
||||
g_assert (leak);
|
||||
|
||||
/* Now remove it from the list, fixing up the GQueue
|
||||
* CHECKME: is a queue->head the first or the last item? */
|
||||
item = g_list_delete_link (queue->queue->head, item);
|
||||
queue->queue->head = g_list_first (item);
|
||||
queue->queue->tail = g_list_last (item);
|
||||
queue->queue->length--;
|
||||
/* Now remove it from the list, fixing up the GQueue
|
||||
* CHECKME: is a queue->head the first or the last item? */
|
||||
item = g_list_delete_link (queue->queue->head, item);
|
||||
queue->queue->head = g_list_first (item);
|
||||
queue->queue->tail = g_list_last (item);
|
||||
queue->queue->length--;
|
||||
|
||||
/* and unref the data at the end. Twice, because we keep a ref
|
||||
* to make things read-only. Also keep our list uptodate. */
|
||||
queue->cur_level.bytes -= GST_BUFFER_SIZE (data);
|
||||
queue->cur_level.buffers--;
|
||||
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
|
||||
queue->cur_level.time -= GST_BUFFER_DURATION (data);
|
||||
/* and unref the data at the end. Twice, because we keep a ref
|
||||
* to make things read-only. Also keep our list uptodate. */
|
||||
queue->cur_level.bytes -= GST_BUFFER_SIZE (data);
|
||||
queue->cur_level.buffers--;
|
||||
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
|
||||
queue->cur_level.time -= GST_BUFFER_DURATION (data);
|
||||
|
||||
gst_data_unref (data);
|
||||
gst_data_unref (data);
|
||||
break;
|
||||
gst_data_unref (data);
|
||||
gst_data_unref (data);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
g_warning ("Unknown leaky type, using default");
|
||||
/* fall-through */
|
||||
g_warning ("Unknown leaky type, using default");
|
||||
/* fall-through */
|
||||
|
||||
/* don't leak. Instead, wait for space to be available */
|
||||
/* don't leak. Instead, wait for space to be available */
|
||||
case GST_QUEUE_NO_LEAK:
|
||||
STATUS (queue, "pre-full wait");
|
||||
STATUS (queue, "pre-full wait");
|
||||
|
||||
while ((queue->max_size.buffers > 0 &&
|
||||
queue->cur_level.buffers >= queue->max_size.buffers) ||
|
||||
(queue->max_size.bytes > 0 &&
|
||||
queue->cur_level.bytes >= queue->max_size.bytes) ||
|
||||
(queue->max_size.time > 0 &&
|
||||
queue->cur_level.time >= queue->max_size.time)) {
|
||||
/* if there's a pending state change for this queue
|
||||
* or its manager, switch back to iterator so bottom
|
||||
* half of state change executes */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad),
|
||||
GST_ELEMENT (queue))) {
|
||||
goto out_unref;
|
||||
}
|
||||
/* if we got here because we were unlocked after a
|
||||
* flush, we don't need to add the buffer to the
|
||||
* queue again */
|
||||
if (queue->flush) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"not adding pending buffer after flush");
|
||||
goto out_unref;
|
||||
}
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding pending buffer after interrupt");
|
||||
goto restart;
|
||||
}
|
||||
while ((queue->max_size.buffers > 0 &&
|
||||
queue->cur_level.buffers >= queue->max_size.buffers) ||
|
||||
(queue->max_size.bytes > 0 &&
|
||||
queue->cur_level.bytes >= queue->max_size.bytes) ||
|
||||
(queue->max_size.time > 0 &&
|
||||
queue->cur_level.time >= queue->max_size.time)) {
|
||||
/* if there's a pending state change for this queue
|
||||
* or its manager, switch back to iterator so bottom
|
||||
* half of state change executes */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad),
|
||||
GST_ELEMENT (queue))) {
|
||||
goto out_unref;
|
||||
}
|
||||
/* if we got here because we were unlocked after a
|
||||
* flush, we don't need to add the buffer to the
|
||||
* queue again */
|
||||
if (queue->flush) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"not adding pending buffer after flush");
|
||||
goto out_unref;
|
||||
}
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"adding pending buffer after interrupt");
|
||||
goto restart;
|
||||
}
|
||||
|
||||
if (GST_STATE (queue) != GST_STATE_PLAYING) {
|
||||
/* this means the other end is shut down. Try to
|
||||
* signal to resolve the error */
|
||||
if (!queue->may_deadlock) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
gst_data_unref (data);
|
||||
GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL),
|
||||
("deadlock found, shutting down source pad elements"));
|
||||
/* we don't go to out_unref here, since we want to
|
||||
* unref the buffer *before* calling GST_ELEMENT_ERROR */
|
||||
return;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
}
|
||||
if (GST_STATE (queue) != GST_STATE_PLAYING) {
|
||||
/* this means the other end is shut down. Try to
|
||||
* signal to resolve the error */
|
||||
if (!queue->may_deadlock) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
gst_data_unref (data);
|
||||
GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL),
|
||||
("deadlock found, shutting down source pad elements"));
|
||||
/* we don't go to out_unref here, since we want to
|
||||
* unref the buffer *before* calling GST_ELEMENT_ERROR */
|
||||
return;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
}
|
||||
|
||||
/* OK, we've got a serious issue here. Imagine the situation
|
||||
* where the puller (next element) is sending an event here,
|
||||
* so it cannot pull events from the queue, and we cannot
|
||||
* push data further because the queue is 'full' and therefore,
|
||||
* we wait here (and do not handle events): deadlock! to solve
|
||||
* that, we handle pending upstream events here, too. */
|
||||
gst_queue_handle_pending_events (queue);
|
||||
/* OK, we've got a serious issue here. Imagine the situation
|
||||
* where the puller (next element) is sending an event here,
|
||||
* so it cannot pull events from the queue, and we cannot
|
||||
* push data further because the queue is 'full' and therefore,
|
||||
* we wait here (and do not handle events): deadlock! to solve
|
||||
* that, we handle pending upstream events here, too. */
|
||||
gst_queue_handle_pending_events (queue);
|
||||
|
||||
STATUS (queue, "waiting for item_del signal");
|
||||
g_cond_wait (queue->item_del, queue->qlock);
|
||||
STATUS (queue, "received item_del signal");
|
||||
}
|
||||
STATUS (queue, "waiting for item_del signal");
|
||||
g_cond_wait (queue->item_del, queue->qlock);
|
||||
STATUS (queue, "received item_del signal");
|
||||
}
|
||||
|
||||
STATUS (queue, "post-full wait");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_RUNNING], 0);
|
||||
g_mutex_lock (queue->qlock);
|
||||
break;
|
||||
STATUS (queue, "post-full wait");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_RUNNING], 0);
|
||||
g_mutex_lock (queue->qlock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,63 +647,63 @@ restart:
|
|||
|
||||
if (queue->queue->length == 0 ||
|
||||
(queue->min_threshold.buffers > 0 &&
|
||||
queue->cur_level.buffers < queue->min_threshold.buffers) ||
|
||||
queue->cur_level.buffers < queue->min_threshold.buffers) ||
|
||||
(queue->min_threshold.bytes > 0 &&
|
||||
queue->cur_level.bytes < queue->min_threshold.bytes) ||
|
||||
queue->cur_level.bytes < queue->min_threshold.bytes) ||
|
||||
(queue->min_threshold.time > 0 &&
|
||||
queue->cur_level.time < queue->min_threshold.time)) {
|
||||
queue->cur_level.time < queue->min_threshold.time)) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_UNDERRUN], 0);
|
||||
g_mutex_lock (queue->qlock);
|
||||
|
||||
STATUS (queue, "pre-empty wait");
|
||||
while (queue->queue->length == 0 ||
|
||||
(queue->min_threshold.buffers > 0 &&
|
||||
queue->cur_level.buffers < queue->min_threshold.buffers) ||
|
||||
(queue->min_threshold.bytes > 0 &&
|
||||
queue->cur_level.bytes < queue->min_threshold.bytes) ||
|
||||
(queue->min_threshold.time > 0 &&
|
||||
queue->cur_level.time < queue->min_threshold.time)) {
|
||||
(queue->min_threshold.buffers > 0 &&
|
||||
queue->cur_level.buffers < queue->min_threshold.buffers) ||
|
||||
(queue->min_threshold.bytes > 0 &&
|
||||
queue->cur_level.bytes < queue->min_threshold.bytes) ||
|
||||
(queue->min_threshold.time > 0 &&
|
||||
queue->cur_level.time < queue->min_threshold.time)) {
|
||||
/* if there's a pending state change for this queue or its
|
||||
* manager, switch back to iterator so bottom half of state
|
||||
* change executes. */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad),
|
||||
GST_ELEMENT (queue)))
|
||||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
||||
goto restart;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad),
|
||||
GST_ELEMENT (queue)))
|
||||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
||||
goto restart;
|
||||
}
|
||||
if (GST_STATE (queue) != GST_STATE_PLAYING) {
|
||||
/* this means the other end is shut down */
|
||||
if (!queue->may_deadlock) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL),
|
||||
("deadlock found, shutting down sink pad elements"));
|
||||
goto restart;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
/* this means the other end is shut down */
|
||||
if (!queue->may_deadlock) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL),
|
||||
("deadlock found, shutting down sink pad elements"));
|
||||
goto restart;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
}
|
||||
|
||||
STATUS (queue, "waiting for item_add");
|
||||
|
||||
if (queue->block_timeout != GST_CLOCK_TIME_NONE) {
|
||||
GTimeVal timeout;
|
||||
GTimeVal timeout;
|
||||
|
||||
g_get_current_time (&timeout);
|
||||
g_time_val_add (&timeout, queue->block_timeout / 1000);
|
||||
if (!g_cond_timed_wait (queue->item_add, queue->qlock, &timeout)) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"Sending filler event");
|
||||
return GST_DATA (gst_event_new_filler ());
|
||||
}
|
||||
g_get_current_time (&timeout);
|
||||
g_time_val_add (&timeout, queue->block_timeout / 1000);
|
||||
if (!g_cond_timed_wait (queue->item_add, queue->qlock, &timeout)) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"Sending filler event");
|
||||
return GST_DATA (gst_event_new_filler ());
|
||||
}
|
||||
} else {
|
||||
g_cond_wait (queue->item_add, queue->qlock);
|
||||
g_cond_wait (queue->item_add, queue->qlock);
|
||||
}
|
||||
STATUS (queue, "got item_add signal");
|
||||
}
|
||||
|
@ -746,12 +748,12 @@ restart:
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue \"%s\" eos", GST_ELEMENT_NAME (queue));
|
||||
gst_element_set_eos (GST_ELEMENT (queue));
|
||||
break;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"queue \"%s\" eos", GST_ELEMENT_NAME (queue));
|
||||
gst_element_set_eos (GST_ELEMENT (queue));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -775,26 +777,26 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
er.handled = FALSE;
|
||||
g_queue_push_tail (queue->events, &er);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"Preparing for loop for event handler");
|
||||
"Preparing for loop for event handler");
|
||||
/* see the chain function on why this is here - it prevents a deadlock */
|
||||
g_cond_signal (queue->item_del);
|
||||
while (!er.handled) {
|
||||
GTimeVal timeout;
|
||||
|
||||
g_get_current_time (&timeout);
|
||||
g_time_val_add (&timeout, 500 * 1000); /* half a second */
|
||||
g_time_val_add (&timeout, 500 * 1000); /* half a second */
|
||||
if (!g_cond_timed_wait (queue->event_done, queue->qlock, &timeout) &&
|
||||
!er.handled) {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"timeout in upstream event handling");
|
||||
/* remove ourselves from the pending list. Since we're
|
||||
* locked, others cannot reference this anymore. */
|
||||
queue->queue->head = g_list_remove (queue->queue->head, &er);
|
||||
queue->queue->head = g_list_first (queue->queue->head);
|
||||
queue->queue->tail = g_list_last (queue->queue->head);
|
||||
queue->queue->length--;
|
||||
res = FALSE;
|
||||
goto handled;
|
||||
!er.handled) {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"timeout in upstream event handling");
|
||||
/* remove ourselves from the pending list. Since we're
|
||||
* locked, others cannot reference this anymore. */
|
||||
queue->queue->head = g_list_remove (queue->queue->head, &er);
|
||||
queue->queue->head = g_list_first (queue->queue->head);
|
||||
queue->queue->tail = g_list_last (queue->queue->head);
|
||||
queue->queue->length--;
|
||||
res = FALSE;
|
||||
goto handled;
|
||||
}
|
||||
}
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue, "Event handled");
|
||||
|
@ -804,16 +806,16 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_FLUSH:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"FLUSH event, flushing queue\n");
|
||||
gst_queue_locked_flush (queue);
|
||||
break;
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"FLUSH event, flushing queue\n");
|
||||
gst_queue_locked_flush (queue);
|
||||
break;
|
||||
case GST_EVENT_SEEK:
|
||||
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
|
||||
gst_queue_locked_flush (queue);
|
||||
}
|
||||
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
|
||||
gst_queue_locked_flush (queue);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
handled:
|
||||
|
@ -859,30 +861,30 @@ gst_queue_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
if (!GST_PAD_IS_LINKED (queue->sinkpad)) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue,
|
||||
"queue %s is not linked", GST_ELEMENT_NAME (queue));
|
||||
/* FIXME can this be? */
|
||||
g_cond_signal (queue->item_add);
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue,
|
||||
"queue %s is not linked", GST_ELEMENT_NAME (queue));
|
||||
/* FIXME can this be? */
|
||||
g_cond_signal (queue->item_add);
|
||||
|
||||
ret = GST_STATE_FAILURE;
|
||||
goto error;
|
||||
ret = GST_STATE_FAILURE;
|
||||
goto error;
|
||||
} else {
|
||||
GstScheduler *src_sched, *sink_sched;
|
||||
GstScheduler *src_sched, *sink_sched;
|
||||
|
||||
src_sched = gst_pad_get_scheduler (GST_PAD (queue->srcpad));
|
||||
sink_sched = gst_pad_get_scheduler (GST_PAD (queue->sinkpad));
|
||||
src_sched = gst_pad_get_scheduler (GST_PAD (queue->srcpad));
|
||||
sink_sched = gst_pad_get_scheduler (GST_PAD (queue->sinkpad));
|
||||
|
||||
if (src_sched == sink_sched) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue,
|
||||
"queue %s does not connect different schedulers",
|
||||
GST_ELEMENT_NAME (queue));
|
||||
if (src_sched == sink_sched) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue,
|
||||
"queue %s does not connect different schedulers",
|
||||
GST_ELEMENT_NAME (queue));
|
||||
|
||||
g_warning ("queue %s does not connect different schedulers",
|
||||
GST_ELEMENT_NAME (queue));
|
||||
g_warning ("queue %s does not connect different schedulers",
|
||||
GST_ELEMENT_NAME (queue));
|
||||
|
||||
ret = GST_STATE_FAILURE;
|
||||
goto error;
|
||||
}
|
||||
ret = GST_STATE_FAILURE;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
queue->interrupt = FALSE;
|
||||
break;
|
||||
|
|
|
@ -58,7 +58,8 @@ typedef struct
|
|||
GstPad *sinkpad;
|
||||
GstPad *srcpad;
|
||||
GstBuffer *buffer;
|
||||
} GstShaperConnection;
|
||||
}
|
||||
GstShaperConnection;
|
||||
|
||||
GstStaticPadTemplate shaper_src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
|
||||
GST_PAD_SRC,
|
||||
|
@ -80,9 +81,10 @@ gst_shaper_policy_get_type (void)
|
|||
{SHAPER_POLICY_BUFFERSIZE, "2", "sync on buffer size"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!shaper_policy_type) {
|
||||
shaper_policy_type =
|
||||
g_enum_register_static ("GstShaperPolicy", shaper_policy);
|
||||
g_enum_register_static ("GstShaperPolicy", shaper_policy);
|
||||
}
|
||||
return shaper_policy_type;
|
||||
}
|
||||
|
@ -128,13 +130,13 @@ gst_shaper_class_init (GstShaperClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY,
|
||||
g_param_spec_enum ("policy", "Policy", "Shaper policy",
|
||||
GST_TYPE_SHAPER_POLICY, SHAPER_POLICY_TIMESTAMPS, G_PARAM_READWRITE));
|
||||
GST_TYPE_SHAPER_POLICY, SHAPER_POLICY_TIMESTAMPS, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last-message", "last-message", "last-message",
|
||||
NULL, G_PARAM_READABLE));
|
||||
NULL, G_PARAM_READABLE));
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property);
|
||||
|
@ -279,30 +281,30 @@ gst_shaper_loop (GstElement * element)
|
|||
|
||||
/* events are simply pushed ASAP */
|
||||
if (GST_IS_EVENT (buffer)) {
|
||||
/* save event type as it will be unreffed after the next push */
|
||||
GstEventType type = GST_EVENT_TYPE (buffer);
|
||||
/* save event type as it will be unreffed after the next push */
|
||||
GstEventType type = GST_EVENT_TYPE (buffer);
|
||||
|
||||
gst_pad_push (connection->srcpad, GST_DATA (buffer));
|
||||
gst_pad_push (connection->srcpad, GST_DATA (buffer));
|
||||
|
||||
switch (type) {
|
||||
/* on EOS we disable the pad so that we don't pull on
|
||||
* it again and never get more data */
|
||||
case GST_EVENT_EOS:
|
||||
gst_pad_set_active (connection->sinkpad, FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (type) {
|
||||
/* on EOS we disable the pad so that we don't pull on
|
||||
* it again and never get more data */
|
||||
case GST_EVENT_EOS:
|
||||
gst_pad_set_active (connection->sinkpad, FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* we store the buffer */
|
||||
connection->buffer = buffer;
|
||||
/* we store the buffer */
|
||||
connection->buffer = buffer;
|
||||
}
|
||||
}
|
||||
/* FIXME policy stuff goes here */
|
||||
/* find connection with lowest timestamp */
|
||||
if (min == NULL || (connection->buffer != NULL &&
|
||||
(GST_BUFFER_TIMESTAMP (connection->buffer) <
|
||||
GST_BUFFER_TIMESTAMP (min->buffer)))) {
|
||||
(GST_BUFFER_TIMESTAMP (connection->buffer) <
|
||||
GST_BUFFER_TIMESTAMP (min->buffer)))) {
|
||||
min = connection;
|
||||
}
|
||||
connections = g_slist_next (connections);
|
||||
|
|
|
@ -95,34 +95,34 @@ gst_statistics_class_init (GstStatisticsClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS,
|
||||
g_param_spec_int64 ("buffers", "buffers", "total buffers count",
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BYTES,
|
||||
g_param_spec_int64 ("bytes", "bytes", "total bytes count",
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EVENTS,
|
||||
g_param_spec_int64 ("events", "events", "total event count",
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT64, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_BUFFER_UPDATE_FREQ, g_param_spec_int64 ("buffer_update_freq",
|
||||
"buffer update freq", "buffer update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"buffer update freq", "buffer update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_BYTES_UPDATE_FREQ, g_param_spec_int64 ("bytes_update_freq",
|
||||
"bytes update freq", "bytes update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"bytes update freq", "bytes update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_EVENT_UPDATE_FREQ, g_param_spec_int64 ("event_update_freq",
|
||||
"event update freq", "event update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"event update freq", "event update frequency", 0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPDATE_ON_EOS,
|
||||
g_param_spec_boolean ("update_on_eos", "update on EOS",
|
||||
"update on EOS event", TRUE, G_PARAM_READWRITE));
|
||||
"update on EOS event", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPDATE,
|
||||
g_param_spec_boolean ("update", "update", "update", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gst_statistics_signals[SIGNAL_UPDATE] =
|
||||
g_signal_new ("update", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -253,14 +253,14 @@ gst_statistics_chain (GstPad * pad, GstData * _data)
|
|||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||
gst_element_set_eos (GST_ELEMENT (statistics));
|
||||
if (statistics->update_on_eos) {
|
||||
update = TRUE;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
if (statistics->update_freq.events) {
|
||||
statistics->update_count.events += 1;
|
||||
if (statistics->update_count.events == statistics->update_freq.events) {
|
||||
statistics->update_count.events = 0;
|
||||
update = TRUE;
|
||||
statistics->update_count.events = 0;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -268,8 +268,8 @@ gst_statistics_chain (GstPad * pad, GstData * _data)
|
|||
if (statistics->update_freq.buffers) {
|
||||
statistics->update_count.buffers += 1;
|
||||
if (statistics->update_count.buffers == statistics->update_freq.buffers) {
|
||||
statistics->update_count.buffers = 0;
|
||||
update = TRUE;
|
||||
statistics->update_count.buffers = 0;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,8 +277,8 @@ gst_statistics_chain (GstPad * pad, GstData * _data)
|
|||
if (statistics->update_freq.bytes) {
|
||||
statistics->update_count.bytes += GST_BUFFER_SIZE (buf);
|
||||
if (statistics->update_count.bytes >= statistics->update_freq.bytes) {
|
||||
statistics->update_count.bytes = 0;
|
||||
update = TRUE;
|
||||
statistics->update_count.bytes = 0;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ gst_statistics_chain (GstPad * pad, GstData * _data)
|
|||
if (statistics->update) {
|
||||
GST_DEBUG ("[%s]: pre update emit", GST_ELEMENT_NAME (statistics));
|
||||
g_signal_emit (G_OBJECT (statistics),
|
||||
gst_statistics_signals[SIGNAL_UPDATE], 0);
|
||||
gst_statistics_signals[SIGNAL_UPDATE], 0);
|
||||
GST_DEBUG ("[%s]: post update emit", GST_ELEMENT_NAME (statistics));
|
||||
}
|
||||
if (!statistics->silent) {
|
||||
|
|
|
@ -95,13 +95,13 @@ gst_tee_class_init (GstTeeClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
||||
g_param_spec_int ("num_pads", "num_pads", "num_pads",
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent",
|
||||
TRUE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
||||
g_param_spec_string ("last_message", "last_message", "last_message",
|
||||
NULL, G_PARAM_READABLE));
|
||||
NULL, G_PARAM_READABLE));
|
||||
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
|
||||
|
@ -134,7 +134,7 @@ name_pad_compare (gconstpointer a, gconstpointer b)
|
|||
|
||||
g_assert (GST_IS_PAD (pad));
|
||||
|
||||
return strcmp (name, gst_pad_get_name (pad)); /* returns 0 if match */
|
||||
return strcmp (name, gst_pad_get_name (pad)); /* returns 0 if match */
|
||||
}
|
||||
|
||||
static GstPad *
|
||||
|
@ -163,7 +163,7 @@ gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
|||
while (!name) {
|
||||
name = g_strdup_printf ("src%d", i);
|
||||
if (g_list_find_custom ((GList *) pads, (gconstpointer) name,
|
||||
name_pad_compare) != NULL) {
|
||||
name_pad_compare) != NULL) {
|
||||
/* this name is taken, use the next one */
|
||||
++i;
|
||||
g_free (name);
|
||||
|
@ -276,9 +276,9 @@ gst_tee_chain (GstPad * pad, GstData * _data)
|
|||
if (!tee->silent) {
|
||||
g_free (tee->last_message);
|
||||
tee->last_message =
|
||||
g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %"
|
||||
G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (outpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
||||
g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %"
|
||||
G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (outpad),
|
||||
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
||||
g_object_notify (G_OBJECT (tee), "last_message");
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue