mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
Fixed a serious bug in gst_props_new: properties with a 0 value causes a segfault
Original commit message from CVS: Fixed a serious bug in gst_props_new: properties with a 0 value causes a segfault Fixed a possible bug in gstautoplug when one of the constructed paths was empty Commented out a too liberal assert in gstscheduler.c Added GST_BUFFER_DISCONTINUOUS tried to fix asyndisksrc
This commit is contained in:
parent
a80b0c26d5
commit
fe6128b118
10 changed files with 92 additions and 29 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//#define GST_DEBUG_ENABLED
|
||||
#define GST_DEBUG_ENABLED
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gstautoplug.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//#define GST_DEBUG_ENABLED
|
||||
#define GST_DEBUG_ENABLED
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gstbin.h"
|
||||
|
|
|
@ -73,6 +73,7 @@ typedef enum {
|
|||
GST_BUFFER_DONTFREE,
|
||||
GST_BUFFER_FLUSH,
|
||||
GST_BUFFER_EOS,
|
||||
GST_BUFFER_DISCONTINUOUS,
|
||||
} GstBufferFlags;
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue