diff --git a/gst/elements/gstasyncdisksrc.c b/gst/elements/gstasyncdisksrc.c index b9d47ae01c..86d93ecd92 100644 --- a/gst/elements/gstasyncdisksrc.c +++ b/gst/elements/gstasyncdisksrc.c @@ -121,7 +121,6 @@ gst_asyncdisksrc_init (GstAsyncDiskSrc *asyncdisksrc) { // GST_FLAG_SET (asyncdisksrc, GST_SRC_ASYNC); - g_print("init\n"); asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_pad_set_get_function (asyncdisksrc->srcpad,gst_asyncdisksrc_get); gst_pad_set_getregion_function (asyncdisksrc->srcpad,gst_asyncdisksrc_get_region); @@ -245,6 +244,8 @@ gst_asyncdisksrc_get (GstPad *pad) src->curoffset += GST_BUFFER_SIZE (buf); + g_print ("offset %d\n", src->curoffset); + if (src->new_seek) { GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH); src->new_seek = FALSE; @@ -291,6 +292,8 @@ gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size) GST_BUFFER_OFFSET (buf) = offset; GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE); + g_print ("offset %d\n", offset); + if ((offset + size) > src->size) { GST_BUFFER_SIZE (buf) = src->size - offset; // FIXME: set the buffer's EOF bit here @@ -327,6 +330,7 @@ gboolean gst_asyncdisksrc_open_file (GstAsyncDiskSrc *src) return FALSE; } GST_FLAG_SET (src, GST_ASYNCDISKSRC_OPEN); + src->new_seek = FALSE; } return TRUE; } @@ -348,13 +352,14 @@ gst_asyncdisksrc_close_file (GstAsyncDiskSrc *src) src->map = NULL; src->curoffset = 0; src->seq = 0; + src->new_seek = FALSE; GST_FLAG_UNSET (src, GST_ASYNCDISKSRC_OPEN); } -static -GstElementStateReturn gst_asyncdisksrc_change_state (GstElement *element) +static GstElementStateReturn +gst_asyncdisksrc_change_state (GstElement *element) { g_return_val_if_fail (GST_IS_ASYNCDISKSRC (element), GST_STATE_FAILURE); diff --git a/gst/gstautoplug.c b/gst/gstautoplug.c index 8b05e2bb29..15169aeef5 100644 --- a/gst/gstautoplug.c +++ b/gst/gstautoplug.c @@ -20,7 +20,7 @@ * Boston, MA 02111-1307, USA. */ -//#define GST_DEBUG_ENABLED +#define GST_DEBUG_ENABLED #include "gst_private.h" #include "gstautoplug.h" diff --git a/gst/gstbin.c b/gst/gstbin.c index 6e766a066f..ad1ec93a7b 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -20,7 +20,7 @@ * Boston, MA 02111-1307, USA. */ -//#define GST_DEBUG_ENABLED +#define GST_DEBUG_ENABLED #include "gst_private.h" #include "gstbin.h" diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h index 5f5a13f00c..86bcdc0384 100644 --- a/gst/gstbuffer.h +++ b/gst/gstbuffer.h @@ -73,6 +73,7 @@ typedef enum { GST_BUFFER_DONTFREE, GST_BUFFER_FLUSH, GST_BUFFER_EOS, + GST_BUFFER_DISCONTINUOUS, } GstBufferFlags; diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index b6a44161c6..0e974e3693 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -20,7 +20,7 @@ * Boston, MA 02111-1307, USA. */ -//#define GST_DEBUG_ENABLED +#define GST_DEBUG_ENABLED #include "gst_private.h" #include "gstpipeline.h" @@ -360,7 +360,9 @@ gst_pipeline_autoplug (GstPipeline *pipeline) pad = (GstPad *)gst_element_get_pad_list (element)->data; base_factories[i] = factories[i] = gst_autoplug_caps (src_caps, pad->caps); - i++; + // if we have a succesfull connection, proceed + if (factories[i] != NULL) + i++; elements = g_list_next(elements); } diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 25f2485502..3fade713ba 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -260,7 +260,6 @@ gst_plugin_load_absolute (gchar *name) if (module != NULL) { if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) { if ((plugin = (initfunc)(module))) { -// DEBUG("gstplugin: plugin %s loaded\n", plugin->name); INFO(0,"plugin %s loaded", plugin->name); plugin->filename = g_strdup(name); plugin->loaded = TRUE; @@ -403,17 +402,21 @@ gst_plugin_load_elementfactory (gchar *name) while (plugins) { plugin = (GstPlugin *)plugins->data; factories = plugin->elements; + while (factories) { factory = (GstElementFactory*)(factories->data); + if (!strcmp(factory->name,name)) { if (!plugin->loaded) { gchar *filename = g_strdup (plugin->filename); -// DEBUG("gstplugin: loading element factory %s from plugin %s\n", name, plugin->name); + gchar *pluginname = g_strdup (plugin->name); + INFO("loaded elementfactory %s from plugin %s",name,plugin->name); gst_plugin_remove(plugin); if (!gst_plugin_load_absolute(filename)) { - DEBUG("gstplugin: error loading element factory %s from plugin %s\n", name, plugin->name); + DEBUG("gstplugin: error loading element factory %s from plugin %s\n", name, pluginname); } + g_free (pluginname); g_free (filename); } factory = gst_plugin_find_elementfactory(name); @@ -446,18 +449,22 @@ gst_plugin_load_typefactory (gchar *mime) while (plugins) { plugin = (GstPlugin *)plugins->data; factories = plugin->types; + while (factories) { factory = (GstTypeFactory*)(factories->data); + if (!strcmp(factory->mime,mime)) { if (!plugin->loaded) { gchar *filename = g_strdup (plugin->filename); -// DEBUG("gstplugin: loading type factory for \"%s\" from plugin %s\n", mime, plugin->name); + gchar *pluginname = g_strdup (plugin->name); + INFO(GST_INFO_PLUGIN_LOAD,"loading type factory for \"%s\" from plugin %s",mime,plugin->name); gst_plugin_remove(plugin); if (!gst_plugin_load_absolute(filename)) { - DEBUG("gstplugin: error loading type factory \"%s\" from plugin %s\n", mime, plugin->name); + DEBUG("gstplugin: error loading type factory \"%s\" from plugin %s\n", mime, pluginname); } g_free (filename); + g_free (pluginname); } return; } diff --git a/gst/gstprops.c b/gst/gstprops.c index 6e03d114e1..766b0e4315 100644 --- a/gst/gstprops.c +++ b/gst/gstprops.c @@ -20,7 +20,7 @@ * Boston, MA 02111-1307, USA. */ -#define DEBUG_ENABLED +#define GST_DEBUG_ENABLED #include "gst_private.h" #include "gstprops.h" @@ -29,6 +29,14 @@ static gboolean gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2); +static guint _arg_len[] = { + 0, // GST_PROPS_END_ID_NUM = 0, + 0, // GST_PROPS_LIST_ID_NUM, + 1, // GST_PROPS_INT_ID_NUM, + 2, // GST_PROPS_INT_RANGE_ID_NUM, + 1, // GST_PROPS_FOURCC_ID_NUM, + 1, // GST_PROPS_BOOL_ID_NUM, +}; void _gst_props_initialize (void) @@ -177,32 +185,66 @@ gst_props_new (GstPropsFactoryEntry entry, ...) va_list var_args; GstPropsFactoryEntry value; gint i = 0; - gint size; + gint size, skip; GstPropsFactoryEntry *factory; + gboolean inlist = FALSE; + GstProps *props; +#define add_value(value) {\ + DEBUG ("%d %p\n", i, value);\ + factory[i++] = value; \ + if (i >= size) { \ + size += 16; \ + factory = (GstPropsFactoryEntry *) g_realloc (factory, size*sizeof(GstPropsFactoryEntry));\ + }\ +} size = 16; factory = (GstPropsFactoryEntry *) g_malloc (size*sizeof(GstPropsFactoryEntry)); va_start (var_args, entry); - + // property name value = (GstPropsFactoryEntry) entry; - + + // properties while (value) { - DEBUG ("%p\n", value); + if (!inlist) { + // add name + add_value (value); - factory[i++] = value; - - if (i >= size) { - size += 16; - factory = (GstPropsFactoryEntry *) g_realloc (factory, size*sizeof(GstPropsFactoryEntry)); + // get value + value = va_arg (var_args, GstPropsFactoryEntry); } + switch (GPOINTER_TO_INT (value)) { + case GST_PROPS_END_ID: + g_assert (inlist == TRUE); - value = va_arg (var_args, GstPropsFactoryEntry); + inlist = FALSE; + skip = 0; + break; + case GST_PROPS_LIST_ID: + { + g_assert (inlist == FALSE); + + skip = 0; + inlist = TRUE; + break; + } + default: + skip = _arg_len[GPOINTER_TO_INT (value)]; + break; + } + do { + add_value (value); + value = va_arg (var_args, GstPropsFactoryEntry); + } + while (skip--); } factory[i++] = NULL; - return gst_props_register (factory); + props = gst_props_register (factory); + + return props; } /** diff --git a/gst/gstprops.h b/gst/gstprops.h index 57079b1d7a..c60c7646fb 100644 --- a/gst/gstprops.h +++ b/gst/gstprops.h @@ -42,6 +42,7 @@ typedef enum { GST_PROPS_BOOL_ID_NUM, } GstPropsId; +#define GST_PROPS_END_ID GINT_TO_POINTER(GST_PROPS_END_ID_NUM) #define GST_PROPS_LIST_ID GINT_TO_POINTER(GST_PROPS_LIST_ID_NUM) #define GST_PROPS_INT_ID GINT_TO_POINTER(GST_PROPS_INT_ID_NUM) #define GST_PROPS_INT_RANGE_ID GINT_TO_POINTER(GST_PROPS_INT_RANGE_ID_NUM) diff --git a/gst/gstscheduler.c b/gst/gstscheduler.c index 35f0e66803..8a551aa6e0 100644 --- a/gst/gstscheduler.c +++ b/gst/gstscheduler.c @@ -20,7 +20,7 @@ * Boston, MA 02111-1307, USA. */ -//#define GST_DEBUG_ENABLED +#define GST_DEBUG_ENABLED #include "gst_private.h" #include "gstscheduler.h" @@ -398,7 +398,7 @@ void gst_bin_schedule_func(GstBin *bin) { g_assert(pad->peer != NULL); g_assert(pad->peer->parent != NULL); - g_assert(GST_ELEMENT(pad->peer->parent)->manager != NULL); + //g_assert(GST_ELEMENT(pad->peer->parent)->manager != NULL); DEBUG("peer pad %p\n", pad->peer); // only bother with if the pad's peer's parent is this bin or it's DECOUPLED diff --git a/plugins/elements/gstasyncdisksrc.c b/plugins/elements/gstasyncdisksrc.c index b9d47ae01c..86d93ecd92 100644 --- a/plugins/elements/gstasyncdisksrc.c +++ b/plugins/elements/gstasyncdisksrc.c @@ -121,7 +121,6 @@ gst_asyncdisksrc_init (GstAsyncDiskSrc *asyncdisksrc) { // GST_FLAG_SET (asyncdisksrc, GST_SRC_ASYNC); - g_print("init\n"); asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_pad_set_get_function (asyncdisksrc->srcpad,gst_asyncdisksrc_get); gst_pad_set_getregion_function (asyncdisksrc->srcpad,gst_asyncdisksrc_get_region); @@ -245,6 +244,8 @@ gst_asyncdisksrc_get (GstPad *pad) src->curoffset += GST_BUFFER_SIZE (buf); + g_print ("offset %d\n", src->curoffset); + if (src->new_seek) { GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH); src->new_seek = FALSE; @@ -291,6 +292,8 @@ gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size) GST_BUFFER_OFFSET (buf) = offset; GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE); + g_print ("offset %d\n", offset); + if ((offset + size) > src->size) { GST_BUFFER_SIZE (buf) = src->size - offset; // FIXME: set the buffer's EOF bit here @@ -327,6 +330,7 @@ gboolean gst_asyncdisksrc_open_file (GstAsyncDiskSrc *src) return FALSE; } GST_FLAG_SET (src, GST_ASYNCDISKSRC_OPEN); + src->new_seek = FALSE; } return TRUE; } @@ -348,13 +352,14 @@ gst_asyncdisksrc_close_file (GstAsyncDiskSrc *src) src->map = NULL; src->curoffset = 0; src->seq = 0; + src->new_seek = FALSE; GST_FLAG_UNSET (src, GST_ASYNCDISKSRC_OPEN); } -static -GstElementStateReturn gst_asyncdisksrc_change_state (GstElement *element) +static GstElementStateReturn +gst_asyncdisksrc_change_state (GstElement *element) { g_return_val_if_fail (GST_IS_ASYNCDISKSRC (element), GST_STATE_FAILURE);