mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
gst/: clean up used memory in this elements correctly on teardown (closes #137279)
Original commit message from CVS: reviewed by Benjamin Otte <otte@gnome.org> * gst/autoplug/gstspider.c: (gst_spider_dispose): * gst/elements/gstaggregator.c: (gst_aggregator_finalize), (gst_aggregator_class_init), (gst_aggregator_init): * gst/elements/gstfilesrc.c: (gst_filesrc_init), (gst_filesrc_dispose), (gst_filesrc_set_location): * gst/elements/gstidentity.c: (gst_identity_finalize), (gst_identity_class_init), (gst_identity_chain): * gst/elements/gstmultifilesrc.c: (gst_multifilesrc_open_file): * gst/elements/gststatistics.c: (gst_statistics_finalize), (gst_statistics_class_init): * gst/elements/gsttee.c: (gst_tee_finalize), (gst_tee_class_init), (gst_tee_get_property): clean up used memory in this elements correctly on teardown (closes #137279)
This commit is contained in:
parent
5033bd37b9
commit
c903ce8a27
14 changed files with 190 additions and 34 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
||||||
|
2004-03-21 Tim-Philipp Müller <t.i.m@zen.co.uk>
|
||||||
|
|
||||||
|
reviewed by Benjamin Otte <otte@gnome.org>
|
||||||
|
|
||||||
|
* gst/autoplug/gstspider.c: (gst_spider_dispose):
|
||||||
|
* gst/elements/gstaggregator.c: (gst_aggregator_finalize),
|
||||||
|
(gst_aggregator_class_init), (gst_aggregator_init):
|
||||||
|
* gst/elements/gstfilesrc.c: (gst_filesrc_init),
|
||||||
|
(gst_filesrc_dispose), (gst_filesrc_set_location):
|
||||||
|
* gst/elements/gstidentity.c: (gst_identity_finalize),
|
||||||
|
(gst_identity_class_init), (gst_identity_chain):
|
||||||
|
* gst/elements/gstmultifilesrc.c: (gst_multifilesrc_open_file):
|
||||||
|
* gst/elements/gststatistics.c: (gst_statistics_finalize),
|
||||||
|
(gst_statistics_class_init):
|
||||||
|
* gst/elements/gsttee.c: (gst_tee_finalize), (gst_tee_class_init),
|
||||||
|
(gst_tee_get_property):
|
||||||
|
clean up used memory in this elements correctly on teardown (closes
|
||||||
|
#137279)
|
||||||
|
|
||||||
2004-03-20 Colin Walters <walters@redhat.com>
|
2004-03-20 Colin Walters <walters@redhat.com>
|
||||||
|
|
||||||
* gst/registries/gstxmlregistry.c:
|
* gst/registries/gstxmlregistry.c:
|
||||||
|
|
|
@ -196,6 +196,7 @@ gst_spider_dispose (GObject * object)
|
||||||
|
|
||||||
spider = GST_SPIDER (object);
|
spider = GST_SPIDER (object);
|
||||||
g_list_free (spider->factories);
|
g_list_free (spider->factories);
|
||||||
|
spider->factories = NULL;
|
||||||
|
|
||||||
((GObjectClass *) parent_class)->dispose (object);
|
((GObjectClass *) parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ static GstPad *gst_aggregator_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * temp, const gchar * unused);
|
GstPadTemplate * temp, const gchar * unused);
|
||||||
static void gst_aggregator_update_functions (GstAggregator * aggregator);
|
static void gst_aggregator_update_functions (GstAggregator * aggregator);
|
||||||
|
|
||||||
|
static void gst_aggregator_finalize (GObject * object);
|
||||||
static void gst_aggregator_set_property (GObject * object, guint prop_id,
|
static void gst_aggregator_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_aggregator_get_property (GObject * object, guint prop_id,
|
static void gst_aggregator_get_property (GObject * object, guint prop_id,
|
||||||
|
@ -106,6 +107,20 @@ gst_aggregator_base_init (gpointer g_class)
|
||||||
gst_static_pad_template_get (&aggregator_src_template));
|
gst_static_pad_template_get (&aggregator_src_template));
|
||||||
gst_element_class_set_details (gstelement_class, &gst_aggregator_details);
|
gst_element_class_set_details (gstelement_class, &gst_aggregator_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_aggregator_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstAggregator *aggregator;
|
||||||
|
|
||||||
|
aggregator = GST_AGGREGATOR (object);
|
||||||
|
|
||||||
|
g_list_free (aggregator->sinkpads);
|
||||||
|
g_free (aggregator->last_message);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_aggregator_class_init (GstAggregatorClass * klass)
|
gst_aggregator_class_init (GstAggregatorClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +130,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
gstelement_class = (GstElementClass *) klass;
|
gstelement_class = (GstElementClass *) klass;
|
||||||
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
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",
|
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));
|
||||||
|
@ -130,6 +144,7 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
||||||
g_param_spec_string ("last_message", "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->finalize = GST_DEBUG_FUNCPTR (gst_aggregator_finalize);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
|
||||||
|
|
||||||
|
@ -148,6 +163,7 @@ gst_aggregator_init (GstAggregator * aggregator)
|
||||||
aggregator->sinkpads = NULL;
|
aggregator->sinkpads = NULL;
|
||||||
aggregator->silent = FALSE;
|
aggregator->silent = FALSE;
|
||||||
aggregator->sched = AGGREGATOR_LOOP;
|
aggregator->sched = AGGREGATOR_LOOP;
|
||||||
|
aggregator->last_message = NULL;
|
||||||
|
|
||||||
gst_aggregator_update_functions (aggregator);
|
gst_aggregator_update_functions (aggregator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,6 +233,7 @@ gst_filesrc_init (GstFileSrc * src)
|
||||||
src->filename = NULL;
|
src->filename = NULL;
|
||||||
src->fd = 0;
|
src->fd = 0;
|
||||||
src->filelen = 0;
|
src->filelen = 0;
|
||||||
|
src->uri = NULL;
|
||||||
|
|
||||||
src->curoffset = 0;
|
src->curoffset = 0;
|
||||||
src->block_size = DEFAULT_BLOCKSIZE;
|
src->block_size = DEFAULT_BLOCKSIZE;
|
||||||
|
@ -251,12 +252,14 @@ gst_filesrc_dispose (GObject * object)
|
||||||
|
|
||||||
src = GST_FILESRC (object);
|
src = GST_FILESRC (object);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
||||||
|
|
||||||
if (src->filename)
|
|
||||||
g_free (src->filename);
|
g_free (src->filename);
|
||||||
if (src->uri)
|
|
||||||
g_free (src->uri);
|
g_free (src->uri);
|
||||||
|
|
||||||
|
/* dispose may be called multiple times */
|
||||||
|
src->filename = NULL;
|
||||||
|
src->uri = NULL;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -266,10 +269,9 @@ gst_filesrc_set_location (GstFileSrc * src, const gchar * location)
|
||||||
if (GST_STATE (src) != GST_STATE_READY && GST_STATE (src) != GST_STATE_NULL)
|
if (GST_STATE (src) != GST_STATE_READY && GST_STATE (src) != GST_STATE_NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (src->filename)
|
|
||||||
g_free (src->filename);
|
g_free (src->filename);
|
||||||
if (src->uri)
|
|
||||||
g_free (src->uri);
|
g_free (src->uri);
|
||||||
|
|
||||||
/* clear the filename if we get a NULL (is that possible?) */
|
/* clear the filename if we get a NULL (is that possible?) */
|
||||||
if (location == NULL) {
|
if (location == NULL) {
|
||||||
src->filename = NULL;
|
src->filename = NULL;
|
||||||
|
|
|
@ -68,6 +68,7 @@ enum
|
||||||
GST_BOILERPLATE_FULL (GstIdentity, gst_identity, GstElement, GST_TYPE_ELEMENT,
|
GST_BOILERPLATE_FULL (GstIdentity, gst_identity, GstElement, GST_TYPE_ELEMENT,
|
||||||
_do_init);
|
_do_init);
|
||||||
|
|
||||||
|
static void gst_identity_finalize (GObject * object);
|
||||||
static void gst_identity_set_property (GObject * object, guint prop_id,
|
static void gst_identity_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_identity_get_property (GObject * object, guint prop_id,
|
static void gst_identity_get_property (GObject * object, guint prop_id,
|
||||||
|
@ -84,6 +85,19 @@ gst_identity_base_init (gpointer g_class)
|
||||||
|
|
||||||
gst_element_class_set_details (gstelement_class, &gst_identity_details);
|
gst_element_class_set_details (gstelement_class, &gst_identity_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_identity_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstIdentity *identity;
|
||||||
|
|
||||||
|
identity = GST_IDENTITY (object);
|
||||||
|
|
||||||
|
g_free (identity->last_message);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_identity_class_init (GstIdentityClass * klass)
|
gst_identity_class_init (GstIdentityClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -125,6 +139,7 @@ gst_identity_class_init (GstIdentityClass * klass)
|
||||||
G_STRUCT_OFFSET (GstIdentityClass, handoff), NULL, NULL,
|
G_STRUCT_OFFSET (GstIdentityClass, handoff), NULL, NULL,
|
||||||
gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, GST_TYPE_BUFFER);
|
gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, GST_TYPE_BUFFER);
|
||||||
|
|
||||||
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
|
||||||
}
|
}
|
||||||
|
@ -180,9 +195,7 @@ gst_identity_chain (GstPad * pad, GstData * _data)
|
||||||
|
|
||||||
if (identity->drop_probability > 0.0) {
|
if (identity->drop_probability > 0.0) {
|
||||||
if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
|
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 =
|
identity->last_message =
|
||||||
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %"
|
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %"
|
||||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||||
|
|
|
@ -248,7 +248,7 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open the file */
|
/* open the file. FIXME: do we need to use O_LARGEFILE here? */
|
||||||
src->fd = open ((const char *) src->currentfilename, O_RDONLY);
|
src->fd = open ((const char *) src->currentfilename, O_RDONLY);
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||||
|
@ -260,9 +260,12 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
||||||
/* find the file length */
|
/* find the file length */
|
||||||
src->size = lseek (src->fd, 0, SEEK_END);
|
src->size = lseek (src->fd, 0, SEEK_END);
|
||||||
lseek (src->fd, 0, SEEK_SET);
|
lseek (src->fd, 0, SEEK_SET);
|
||||||
/* map the file into memory */
|
/* map the file into memory.
|
||||||
|
* FIXME: don't map the whole file at once, there might
|
||||||
|
* be restrictions set. Get max size via getrlimit
|
||||||
|
* or re-try with smaller size if mmap fails with ENOMEM? */
|
||||||
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
||||||
madvise (src->map, src->size, 2);
|
madvise (src->map, src->size, MADV_SEQUENTIAL);
|
||||||
/* collapse state if that failed */
|
/* collapse state if that failed */
|
||||||
if (src->map == NULL) {
|
if (src->map == NULL) {
|
||||||
close (src->fd);
|
close (src->fd);
|
||||||
|
|
|
@ -64,6 +64,7 @@ enum
|
||||||
GST_BOILERPLATE_FULL (GstStatistics, gst_statistics, GstElement,
|
GST_BOILERPLATE_FULL (GstStatistics, gst_statistics, GstElement,
|
||||||
GST_TYPE_ELEMENT, _do_init);
|
GST_TYPE_ELEMENT, _do_init);
|
||||||
|
|
||||||
|
static void gst_statistics_finalize (GObject * object);
|
||||||
static void gst_statistics_set_property (GObject * object, guint prop_id,
|
static void gst_statistics_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_statistics_get_property (GObject * object, guint prop_id,
|
static void gst_statistics_get_property (GObject * object, guint prop_id,
|
||||||
|
@ -85,6 +86,23 @@ gst_statistics_base_init (gpointer g_class)
|
||||||
|
|
||||||
gst_element_class_set_details (gstelement_class, &gst_statistics_details);
|
gst_element_class_set_details (gstelement_class, &gst_statistics_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_statistics_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstStatistics *statistics;
|
||||||
|
|
||||||
|
statistics = GST_STATISTICS (object);
|
||||||
|
|
||||||
|
if (statistics->timer)
|
||||||
|
g_timer_destroy (statistics->timer);
|
||||||
|
|
||||||
|
if (statistics->last_timer)
|
||||||
|
g_timer_destroy (statistics->last_timer);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_statistics_class_init (GstStatisticsClass * klass)
|
gst_statistics_class_init (GstStatisticsClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -129,6 +147,7 @@ gst_statistics_class_init (GstStatisticsClass * klass)
|
||||||
G_STRUCT_OFFSET (GstStatisticsClass, update), NULL, NULL,
|
G_STRUCT_OFFSET (GstStatisticsClass, update), NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_statistics_finalize);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ GST_BOILERPLATE_FULL (GstTee, gst_tee, GstElement, GST_TYPE_ELEMENT, _do_init);
|
||||||
static GstPad *gst_tee_request_new_pad (GstElement * element,
|
static GstPad *gst_tee_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * temp, const gchar * unused);
|
GstPadTemplate * temp, const gchar * unused);
|
||||||
|
|
||||||
|
static void gst_tee_finalize (GObject * object);
|
||||||
static void gst_tee_set_property (GObject * object, guint prop_id,
|
static void gst_tee_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_tee_get_property (GObject * object, guint prop_id,
|
static void gst_tee_get_property (GObject * object, guint prop_id,
|
||||||
|
@ -83,6 +84,19 @@ gst_tee_base_init (gpointer g_class)
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
gst_static_pad_template_get (&tee_src_template));
|
gst_static_pad_template_get (&tee_src_template));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_tee_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstTee *tee;
|
||||||
|
|
||||||
|
tee = GST_TEE (object);
|
||||||
|
|
||||||
|
g_free (tee->last_message);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_tee_class_init (GstTeeClass * klass)
|
gst_tee_class_init (GstTeeClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -104,6 +118,7 @@ gst_tee_class_init (GstTeeClass * klass)
|
||||||
NULL, G_PARAM_READABLE));
|
NULL, G_PARAM_READABLE));
|
||||||
|
|
||||||
|
|
||||||
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tee_finalize);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
|
||||||
|
|
||||||
|
@ -233,7 +248,7 @@ gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
g_value_set_boolean (value, tee->silent);
|
g_value_set_boolean (value, tee->silent);
|
||||||
break;
|
break;
|
||||||
case ARG_LAST_MESSAGE:
|
case ARG_LAST_MESSAGE:
|
||||||
g_value_set_string ((GValue *) value, tee->last_message);
|
g_value_set_string (value, tee->last_message);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
|
@ -83,6 +83,7 @@ static GstPad *gst_aggregator_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * temp, const gchar * unused);
|
GstPadTemplate * temp, const gchar * unused);
|
||||||
static void gst_aggregator_update_functions (GstAggregator * aggregator);
|
static void gst_aggregator_update_functions (GstAggregator * aggregator);
|
||||||
|
|
||||||
|
static void gst_aggregator_finalize (GObject * object);
|
||||||
static void gst_aggregator_set_property (GObject * object, guint prop_id,
|
static void gst_aggregator_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_aggregator_get_property (GObject * object, guint prop_id,
|
static void gst_aggregator_get_property (GObject * object, guint prop_id,
|
||||||
|
@ -106,6 +107,20 @@ gst_aggregator_base_init (gpointer g_class)
|
||||||
gst_static_pad_template_get (&aggregator_src_template));
|
gst_static_pad_template_get (&aggregator_src_template));
|
||||||
gst_element_class_set_details (gstelement_class, &gst_aggregator_details);
|
gst_element_class_set_details (gstelement_class, &gst_aggregator_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_aggregator_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstAggregator *aggregator;
|
||||||
|
|
||||||
|
aggregator = GST_AGGREGATOR (object);
|
||||||
|
|
||||||
|
g_list_free (aggregator->sinkpads);
|
||||||
|
g_free (aggregator->last_message);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_aggregator_class_init (GstAggregatorClass * klass)
|
gst_aggregator_class_init (GstAggregatorClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +130,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
gstelement_class = (GstElementClass *) klass;
|
gstelement_class = (GstElementClass *) klass;
|
||||||
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
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",
|
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));
|
||||||
|
@ -130,6 +144,7 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
||||||
g_param_spec_string ("last_message", "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->finalize = GST_DEBUG_FUNCPTR (gst_aggregator_finalize);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
|
||||||
|
|
||||||
|
@ -148,6 +163,7 @@ gst_aggregator_init (GstAggregator * aggregator)
|
||||||
aggregator->sinkpads = NULL;
|
aggregator->sinkpads = NULL;
|
||||||
aggregator->silent = FALSE;
|
aggregator->silent = FALSE;
|
||||||
aggregator->sched = AGGREGATOR_LOOP;
|
aggregator->sched = AGGREGATOR_LOOP;
|
||||||
|
aggregator->last_message = NULL;
|
||||||
|
|
||||||
gst_aggregator_update_functions (aggregator);
|
gst_aggregator_update_functions (aggregator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,6 +233,7 @@ gst_filesrc_init (GstFileSrc * src)
|
||||||
src->filename = NULL;
|
src->filename = NULL;
|
||||||
src->fd = 0;
|
src->fd = 0;
|
||||||
src->filelen = 0;
|
src->filelen = 0;
|
||||||
|
src->uri = NULL;
|
||||||
|
|
||||||
src->curoffset = 0;
|
src->curoffset = 0;
|
||||||
src->block_size = DEFAULT_BLOCKSIZE;
|
src->block_size = DEFAULT_BLOCKSIZE;
|
||||||
|
@ -251,12 +252,14 @@ gst_filesrc_dispose (GObject * object)
|
||||||
|
|
||||||
src = GST_FILESRC (object);
|
src = GST_FILESRC (object);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
||||||
|
|
||||||
if (src->filename)
|
|
||||||
g_free (src->filename);
|
g_free (src->filename);
|
||||||
if (src->uri)
|
|
||||||
g_free (src->uri);
|
g_free (src->uri);
|
||||||
|
|
||||||
|
/* dispose may be called multiple times */
|
||||||
|
src->filename = NULL;
|
||||||
|
src->uri = NULL;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -266,10 +269,9 @@ gst_filesrc_set_location (GstFileSrc * src, const gchar * location)
|
||||||
if (GST_STATE (src) != GST_STATE_READY && GST_STATE (src) != GST_STATE_NULL)
|
if (GST_STATE (src) != GST_STATE_READY && GST_STATE (src) != GST_STATE_NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (src->filename)
|
|
||||||
g_free (src->filename);
|
g_free (src->filename);
|
||||||
if (src->uri)
|
|
||||||
g_free (src->uri);
|
g_free (src->uri);
|
||||||
|
|
||||||
/* clear the filename if we get a NULL (is that possible?) */
|
/* clear the filename if we get a NULL (is that possible?) */
|
||||||
if (location == NULL) {
|
if (location == NULL) {
|
||||||
src->filename = NULL;
|
src->filename = NULL;
|
||||||
|
|
|
@ -68,6 +68,7 @@ enum
|
||||||
GST_BOILERPLATE_FULL (GstIdentity, gst_identity, GstElement, GST_TYPE_ELEMENT,
|
GST_BOILERPLATE_FULL (GstIdentity, gst_identity, GstElement, GST_TYPE_ELEMENT,
|
||||||
_do_init);
|
_do_init);
|
||||||
|
|
||||||
|
static void gst_identity_finalize (GObject * object);
|
||||||
static void gst_identity_set_property (GObject * object, guint prop_id,
|
static void gst_identity_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_identity_get_property (GObject * object, guint prop_id,
|
static void gst_identity_get_property (GObject * object, guint prop_id,
|
||||||
|
@ -84,6 +85,19 @@ gst_identity_base_init (gpointer g_class)
|
||||||
|
|
||||||
gst_element_class_set_details (gstelement_class, &gst_identity_details);
|
gst_element_class_set_details (gstelement_class, &gst_identity_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_identity_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstIdentity *identity;
|
||||||
|
|
||||||
|
identity = GST_IDENTITY (object);
|
||||||
|
|
||||||
|
g_free (identity->last_message);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_identity_class_init (GstIdentityClass * klass)
|
gst_identity_class_init (GstIdentityClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -125,6 +139,7 @@ gst_identity_class_init (GstIdentityClass * klass)
|
||||||
G_STRUCT_OFFSET (GstIdentityClass, handoff), NULL, NULL,
|
G_STRUCT_OFFSET (GstIdentityClass, handoff), NULL, NULL,
|
||||||
gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, GST_TYPE_BUFFER);
|
gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, GST_TYPE_BUFFER);
|
||||||
|
|
||||||
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
|
||||||
}
|
}
|
||||||
|
@ -180,9 +195,7 @@ gst_identity_chain (GstPad * pad, GstData * _data)
|
||||||
|
|
||||||
if (identity->drop_probability > 0.0) {
|
if (identity->drop_probability > 0.0) {
|
||||||
if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) {
|
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 =
|
identity->last_message =
|
||||||
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %"
|
g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, %"
|
||||||
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
G_GINT64_FORMAT ")", GST_DEBUG_PAD_NAME (identity->sinkpad),
|
||||||
|
|
|
@ -248,7 +248,7 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open the file */
|
/* open the file. FIXME: do we need to use O_LARGEFILE here? */
|
||||||
src->fd = open ((const char *) src->currentfilename, O_RDONLY);
|
src->fd = open ((const char *) src->currentfilename, O_RDONLY);
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||||
|
@ -260,9 +260,12 @@ gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad)
|
||||||
/* find the file length */
|
/* find the file length */
|
||||||
src->size = lseek (src->fd, 0, SEEK_END);
|
src->size = lseek (src->fd, 0, SEEK_END);
|
||||||
lseek (src->fd, 0, SEEK_SET);
|
lseek (src->fd, 0, SEEK_SET);
|
||||||
/* map the file into memory */
|
/* map the file into memory.
|
||||||
|
* FIXME: don't map the whole file at once, there might
|
||||||
|
* be restrictions set. Get max size via getrlimit
|
||||||
|
* or re-try with smaller size if mmap fails with ENOMEM? */
|
||||||
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
|
||||||
madvise (src->map, src->size, 2);
|
madvise (src->map, src->size, MADV_SEQUENTIAL);
|
||||||
/* collapse state if that failed */
|
/* collapse state if that failed */
|
||||||
if (src->map == NULL) {
|
if (src->map == NULL) {
|
||||||
close (src->fd);
|
close (src->fd);
|
||||||
|
|
|
@ -64,6 +64,7 @@ enum
|
||||||
GST_BOILERPLATE_FULL (GstStatistics, gst_statistics, GstElement,
|
GST_BOILERPLATE_FULL (GstStatistics, gst_statistics, GstElement,
|
||||||
GST_TYPE_ELEMENT, _do_init);
|
GST_TYPE_ELEMENT, _do_init);
|
||||||
|
|
||||||
|
static void gst_statistics_finalize (GObject * object);
|
||||||
static void gst_statistics_set_property (GObject * object, guint prop_id,
|
static void gst_statistics_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_statistics_get_property (GObject * object, guint prop_id,
|
static void gst_statistics_get_property (GObject * object, guint prop_id,
|
||||||
|
@ -85,6 +86,23 @@ gst_statistics_base_init (gpointer g_class)
|
||||||
|
|
||||||
gst_element_class_set_details (gstelement_class, &gst_statistics_details);
|
gst_element_class_set_details (gstelement_class, &gst_statistics_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_statistics_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstStatistics *statistics;
|
||||||
|
|
||||||
|
statistics = GST_STATISTICS (object);
|
||||||
|
|
||||||
|
if (statistics->timer)
|
||||||
|
g_timer_destroy (statistics->timer);
|
||||||
|
|
||||||
|
if (statistics->last_timer)
|
||||||
|
g_timer_destroy (statistics->last_timer);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_statistics_class_init (GstStatisticsClass * klass)
|
gst_statistics_class_init (GstStatisticsClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -129,6 +147,7 @@ gst_statistics_class_init (GstStatisticsClass * klass)
|
||||||
G_STRUCT_OFFSET (GstStatisticsClass, update), NULL, NULL,
|
G_STRUCT_OFFSET (GstStatisticsClass, update), NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_statistics_finalize);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ GST_BOILERPLATE_FULL (GstTee, gst_tee, GstElement, GST_TYPE_ELEMENT, _do_init);
|
||||||
static GstPad *gst_tee_request_new_pad (GstElement * element,
|
static GstPad *gst_tee_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * temp, const gchar * unused);
|
GstPadTemplate * temp, const gchar * unused);
|
||||||
|
|
||||||
|
static void gst_tee_finalize (GObject * object);
|
||||||
static void gst_tee_set_property (GObject * object, guint prop_id,
|
static void gst_tee_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_tee_get_property (GObject * object, guint prop_id,
|
static void gst_tee_get_property (GObject * object, guint prop_id,
|
||||||
|
@ -83,6 +84,19 @@ gst_tee_base_init (gpointer g_class)
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
gst_static_pad_template_get (&tee_src_template));
|
gst_static_pad_template_get (&tee_src_template));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_tee_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstTee *tee;
|
||||||
|
|
||||||
|
tee = GST_TEE (object);
|
||||||
|
|
||||||
|
g_free (tee->last_message);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_tee_class_init (GstTeeClass * klass)
|
gst_tee_class_init (GstTeeClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -104,6 +118,7 @@ gst_tee_class_init (GstTeeClass * klass)
|
||||||
NULL, G_PARAM_READABLE));
|
NULL, G_PARAM_READABLE));
|
||||||
|
|
||||||
|
|
||||||
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tee_finalize);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
|
||||||
|
|
||||||
|
@ -233,7 +248,7 @@ gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
g_value_set_boolean (value, tee->silent);
|
g_value_set_boolean (value, tee->silent);
|
||||||
break;
|
break;
|
||||||
case ARG_LAST_MESSAGE:
|
case ARG_LAST_MESSAGE:
|
||||||
g_value_set_string ((GValue *) value, tee->last_message);
|
g_value_set_string (value, tee->last_message);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
Loading…
Reference in a new issue