diff --git a/ChangeLog b/ChangeLog index 27121c5d2a..73e59145aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,43 @@ +2005-03-21 Wim Taymans + + * gst/Makefile.am: + * gst/autoplug/gstsearchfuncs.c: (gst_autoplug_caps_intersect): + * gst/autoplug/gstspider.c: (gst_spider_identity_plug), + (gst_spider_plug_from_srcpad): + * gst/autoplug/gstspideridentity.c: (gst_spider_identity_getcaps), + (gst_spider_identity_change_state), + (gst_spider_identity_sink_loop_type_finding): + * gst/elements/gstaggregator.c: (gst_aggregator_class_init): + * gst/elements/gstfakesrc.c: (gst_fakesrc_event_handler), + (gst_fakesrc_loop), (gst_fakesrc_activate): + * gst/elements/gstfakesrc.h: + * gst/elements/gstfdsink.c: (gst_fdsink_class_init): + * gst/elements/gstfdsrc.c: (gst_fdsrc_class_init): + * gst/elements/gstfilesink.c: (gst_filesink_class_init), + (gst_filesink_handle_event): + * gst/elements/gstmd5sink.c: (gst_md5sink_class_init): + * gst/elements/gstmultifilesrc.c: (gst_multifilesrc_class_init): + * gst/elements/gstshaper.c: (gst_shaper_class_init): + * gst/elements/gststatistics.c: (gst_statistics_class_init): + * gst/elements/gsttypefindelement.c: (free_entry), + (gst_type_find_element_handle_event): + * gst/gstbin.c: (gst_bin_add_func), (gst_bin_add), + (gst_bin_remove_func), (gst_bin_remove): + * gst/gstbin.h: + * gst/gstbuffer.c: + * gst/gstcaps.h: + * gst/gstelement.c: (gst_element_get_state_func), + (gst_element_lost_state): + * gst/gstevent.h: + * gst/gstpad.h: + * gst/gstpipeline.c: + * gst/gstqueue.h: + * libs/gst/bytestream/bytestream.c: + * libs/gst/dataprotocol/Makefile.am: + * tools/Makefile.am: + * tools/gst-launch.c: + Small cleanups, backports from HEAD. + 2005-03-10 Wim Taymans * gst/base/gstbasesink.c: (gst_basesink_change_state): diff --git a/common b/common index b2638c1007..131c263212 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit b2638c100721f67b280c3b43b21f1ce1c9b5e316 +Subproject commit 131c2632127e6f061b5270d8f80651782a4fdd13 diff --git a/gst/Makefile.am b/gst/Makefile.am index fc7a37e317..bed913cf60 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -187,6 +187,7 @@ gst_headers = \ gstsystemclock.h \ gsttag.h \ gsttaginterface.h \ + gsttask.h \ gsttrace.h \ gsttrashstack.h \ gsttypefind.h \ @@ -198,8 +199,7 @@ gst_headers = \ gstregistry.h \ gstregistrypool.h \ gstparse.h \ - gstxml.h \ - gsttask.h + gstxml.h libgstreamer_@GST_MAJORMINOR@include_HEADERS = $(gst_headers) nodist_libgstreamer_@GST_MAJORMINOR@include_HEADERS = \ @@ -215,15 +215,6 @@ noinst_HEADERS = \ gstarch.h \ cothreads.h -#if GST_DISABLE_OMEGA_COTHREADS -#libcothreads_la_SOURCES = -#libcothreads_la_CFLAGS = -#else -#libcothreads_la_SOURCES = cothreads.c -#libcothreads_la_CFLAGS = $(libgstreamer_@GST_MAJORMINOR@_la_CFLAGS) -#endif - - gstmarshal.h: gstmarshal.list glib-genmarshal --header --prefix=gst_marshal $(srcdir)/gstmarshal.list > gstmarshal.h.tmp mv gstmarshal.h.tmp gstmarshal.h diff --git a/gst/autoplug/gstsearchfuncs.c b/gst/autoplug/gstsearchfuncs.c index bfc251b74e..a0f7362ede 100644 --- a/gst/autoplug/gstsearchfuncs.c +++ b/gst/autoplug/gstsearchfuncs.c @@ -65,12 +65,12 @@ gst_autoplug_caps_intersect (const GstCaps * src, const GstCaps * sink) /* if the caps can't link, there is no intersection */ if (gst_caps_is_empty (caps)) { - gst_caps_free (caps); + gst_caps_unref (caps); return FALSE; } /* hurrah, we can link, now remove the intersection */ - gst_caps_free (caps); + gst_caps_unref (caps); return TRUE; } diff --git a/gst/autoplug/gstspider.c b/gst/autoplug/gstspider.c index 86a359e006..4bc001a655 100644 --- a/gst/autoplug/gstspider.c +++ b/gst/autoplug/gstspider.c @@ -464,11 +464,11 @@ gst_spider_identity_plug (GstSpiderIdentity * ident) 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); + gst_caps_unref (src_caps); return; } } - gst_caps_free (src_caps); + gst_caps_unref (src_caps); } /* get the direction of our ident */ @@ -491,7 +491,7 @@ gst_spider_identity_plug (GstSpiderIdentity * ident) } /* now iterate all possible pads and link when needed */ - padlist = gst_element_get_pad_list (GST_ELEMENT (spider)); + padlist = GST_ELEMENT (spider)->pads; for (; padlist; padlist = padlist->next) { GstPad *otherpad; GstSpiderIdentity *peer; @@ -697,8 +697,8 @@ gst_spider_plug_from_srcpad (GstSpiderConnection * conn, GstPad * srcpad) caps1 = gst_pad_get_caps (srcpad); caps2 = gst_pad_get_caps (conn->src->sink); plugpath = gst_autoplug_sp (caps1, caps2, spider->factories); - gst_caps_free (caps1); - gst_caps_free (caps2); + gst_caps_unref (caps1); + gst_caps_unref (caps2); /* prints out the path that was found for plugging */ /* g_print ("found path from %s to %s:\n", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src)); diff --git a/gst/autoplug/gstspideridentity.c b/gst/autoplug/gstspideridentity.c index eed53526dd..832c617e01 100644 --- a/gst/autoplug/gstspideridentity.c +++ b/gst/autoplug/gstspideridentity.c @@ -224,6 +224,7 @@ gst_spider_identity_chain (GstPad * pad, GstBuffer * buf) gst_buffer_unref (buf); } } + GstSpiderIdentity * gst_spider_identity_new_src (gchar * name) { @@ -288,7 +289,7 @@ gst_spider_identity_getcaps (GstPad * pad) if (ident->caps) { GstCaps *ret2 = gst_caps_intersect (ident->caps, ret); - gst_caps_free (ret); + gst_caps_unref (ret); ret = ret2; } return ret; @@ -387,12 +388,12 @@ gst_spider_identity_change_state (GstElement * element) 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); + gst_caps_unref (caps); break; } else { gst_spider_identity_plug (ident); } - gst_caps_free (caps); + gst_caps_unref (caps); } /* autoplug on src */ if ((GST_RPAD_PEER (ident->src) != NULL) @@ -478,7 +479,7 @@ typedef struct GstCaps *caps; } SpiderTypeFind; -guint8 * +static guint8 * spider_find_peek (gpointer data, gint64 offset, guint size) { SpiderTypeFind *find = (SpiderTypeFind *) data; @@ -527,7 +528,7 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity * ident) if (!gst_caps_is_empty (find.caps) && !gst_caps_is_any (find.caps)) { goto plug; } else { - gst_caps_free (find.caps); + gst_caps_unref (find.caps); find.caps = NULL; } diff --git a/gst/elements/gstaggregator.c b/gst/elements/gstaggregator.c index 702bfb8144..ddd806cf51 100644 --- a/gst/elements/gstaggregator.c +++ b/gst/elements/gstaggregator.c @@ -137,6 +137,9 @@ gst_aggregator_class_init (GstAggregatorClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property); + 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)); @@ -152,8 +155,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass) "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->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property); gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_aggregator_request_new_pad); diff --git a/gst/elements/gstfakesrc.c b/gst/elements/gstfakesrc.c index 4877d07b5c..cb5f7dc210 100644 --- a/gst/elements/gstfakesrc.c +++ b/gst/elements/gstfakesrc.c @@ -408,7 +408,7 @@ gst_fakesrc_event_handler (GstPad * pad, GstEvent * event) { GstFakeSrc *src; - src = GST_FAKESRC (gst_object_get_parent (GST_OBJECT (pad))); + src = GST_FAKESRC (GST_PAD_PARENT (pad)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: @@ -914,7 +914,7 @@ gst_fakesrc_loop (GstPad * pad) return; pause: - gst_task_pause (src->task); + gst_task_pause (GST_RPAD_TASK (pad)); GST_STREAM_UNLOCK (pad); return; } @@ -933,11 +933,11 @@ gst_fakesrc_activate (GstPad * pad, GstActivateMode mode) g_return_val_if_fail (fakesrc->has_loop, FALSE); if (GST_ELEMENT_SCHEDULER (fakesrc)) { GST_STREAM_LOCK (pad); - fakesrc->task = + GST_RPAD_TASK (pad) = gst_scheduler_create_task (GST_ELEMENT_SCHEDULER (fakesrc), (GstTaskFunction) gst_fakesrc_loop, pad); - gst_task_start (fakesrc->task); + gst_task_start (GST_RPAD_TASK (pad)); GST_STREAM_UNLOCK (pad); result = TRUE; } @@ -952,10 +952,10 @@ gst_fakesrc_activate (GstPad * pad, GstActivateMode mode) /* step 2, make sure streaming finishes */ GST_STREAM_LOCK (pad); /* step 3, stop the task */ - if (fakesrc->task) { - gst_task_stop (fakesrc->task); - gst_object_unref (GST_OBJECT (fakesrc->task)); - fakesrc->task = NULL; + if (GST_RPAD_TASK (pad)) { + gst_task_stop (GST_RPAD_TASK (pad)); + gst_object_unref (GST_OBJECT (GST_RPAD_TASK (pad))); + GST_RPAD_TASK (pad) = NULL; } GST_STREAM_UNLOCK (pad); diff --git a/gst/elements/gstfakesrc.h b/gst/elements/gstfakesrc.h index 4560370a05..a5251b85f3 100644 --- a/gst/elements/gstfakesrc.h +++ b/gst/elements/gstfakesrc.h @@ -80,8 +80,6 @@ struct _GstFakeSrc { gboolean has_getrange; gboolean eos; - GstTask *task; - GstFakeSrcOutputType output; GstFakeSrcDataType data; GstFakeSrcSizeType sizetype; diff --git a/gst/elements/gstfdsink.c b/gst/elements/gstfdsink.c index 411dd0a32e..1fca02c387 100644 --- a/gst/elements/gstfdsink.c +++ b/gst/elements/gstfdsink.c @@ -88,13 +88,12 @@ gst_fdsink_class_init (GstFdSinkClass * klass) gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = gst_fdsink_set_property; + gobject_class->get_property = gst_fdsink_get_property; 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)); - - gobject_class->set_property = gst_fdsink_set_property; - gobject_class->get_property = gst_fdsink_get_property; } static void diff --git a/gst/elements/gstfdsrc.c b/gst/elements/gstfdsrc.c index ca33db3c25..e658cd3a9d 100644 --- a/gst/elements/gstfdsrc.c +++ b/gst/elements/gstfdsrc.c @@ -103,6 +103,9 @@ gst_fdsrc_class_init (GstFdSrcClass * klass) gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = gst_fdsrc_set_property; + gobject_class->get_property = gst_fdsrc_get_property; + 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)); @@ -119,9 +122,6 @@ gst_fdsrc_class_init (GstFdSrcClass * klass) G_STRUCT_OFFSET (GstFdSrcClass, timeout), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - gobject_class->set_property = gst_fdsrc_set_property; - gobject_class->get_property = gst_fdsrc_get_property; - gstelement_class->change_state = gst_fdsrc_change_state; } diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index 992febf746..1386758a3c 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -145,6 +145,8 @@ gst_filesink_class_init (GstFileSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = gst_filesink_set_property; + gobject_class->get_property = gst_filesink_get_property; g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION, g_param_spec_string ("location", "File Location", @@ -155,8 +157,6 @@ gst_filesink_class_init (GstFileSinkClass * klass) G_STRUCT_OFFSET (GstFileSinkClass, handoff), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - gobject_class->set_property = gst_filesink_set_property; - gobject_class->get_property = gst_filesink_get_property; gobject_class->dispose = gst_filesink_dispose; } static void @@ -363,6 +363,7 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event) GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE, (_("Error while writing to file \"%s\"."), filesink->filename), GST_ERROR_SYSTEM); + return FALSE; } } diff --git a/gst/elements/gstmd5sink.c b/gst/elements/gstmd5sink.c index 63c939e10a..4ebbb4c4f0 100644 --- a/gst/elements/gstmd5sink.c +++ b/gst/elements/gstmd5sink.c @@ -392,7 +392,6 @@ gst_md5sink_class_init (GstMD5SinkClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5, diff --git a/gst/elements/gstmultifilesrc.c b/gst/elements/gstmultifilesrc.c index f781844865..ea951736c0 100644 --- a/gst/elements/gstmultifilesrc.c +++ b/gst/elements/gstmultifilesrc.c @@ -107,6 +107,8 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + gobject_class->set_property = gst_multifilesrc_set_property; + gobject_class->get_property = gst_multifilesrc_get_property; gst_multifilesrc_signals[NEW_FILE] = g_signal_new ("new-file", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -114,16 +116,11 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass) 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_HAVENEWMEDIA, g_param_spec_boolean ("newmedia", "newmedia", "generate new media events?", FALSE, G_PARAM_READWRITE)); - - gobject_class->set_property = gst_multifilesrc_set_property; - gobject_class->get_property = gst_multifilesrc_get_property; - gstelement_class->change_state = gst_multifilesrc_change_state; } diff --git a/gst/elements/gstshaper.c b/gst/elements/gstshaper.c index 9b4f19bb6d..c14ab36a18 100644 --- a/gst/elements/gstshaper.c +++ b/gst/elements/gstshaper.c @@ -127,6 +127,8 @@ gst_shaper_class_init (GstShaperClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY, g_param_spec_enum ("policy", "Policy", "Shaper policy", @@ -138,9 +140,6 @@ gst_shaper_class_init (GstShaperClass * klass) g_param_spec_string ("last-message", "last-message", "last-message", 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); - gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_shaper_request_new_pad); } diff --git a/gst/elements/gststatistics.c b/gst/elements/gststatistics.c index 82744ff6f4..ef6cca3bca 100644 --- a/gst/elements/gststatistics.c +++ b/gst/elements/gststatistics.c @@ -124,6 +124,8 @@ gst_statistics_class_init (GstStatisticsClass * klass) gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS, g_param_spec_int64 ("buffers", "buffers", "total buffers count", @@ -162,8 +164,6 @@ gst_statistics_class_init (GstStatisticsClass * klass) 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->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property); } static void diff --git a/gst/elements/gsttypefindelement.c b/gst/elements/gsttypefindelement.c index 8bc760eb3e..9c7b162444 100644 --- a/gst/elements/gsttypefindelement.c +++ b/gst/elements/gsttypefindelement.c @@ -350,7 +350,7 @@ free_entry (TypeFindEntry * entry) free_entry_buffers (entry); if (entry->caps) - gst_caps_free (entry->caps); + gst_caps_unref (entry->caps); g_free (entry); } static void @@ -484,6 +484,7 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event) g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0, entry->probability, entry->caps); stop_typefinding (typefind); + push_buffer_store (typefind); gst_pad_event_default (pad, event); } else { gst_pad_event_default (pad, event); diff --git a/gst/gstbin.c b/gst/gstbin.c index 36da418ba4..8911fb63c5 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -346,8 +346,8 @@ gst_bin_add_func (GstBin * bin, GstElement * element) goto duplicate_name; /* set the element's parent and add the element to the bin's list of children */ - if (G_UNLIKELY (!gst_object_set_parent (GST_OBJECT (element), - GST_OBJECT (bin)))) + if (G_UNLIKELY (!gst_object_set_parent (GST_OBJECT_CAST (element), + GST_OBJECT_CAST (bin)))) goto had_parent; bin->children = g_list_prepend (bin->children, element); @@ -471,12 +471,12 @@ gst_bin_remove_func (GstBin * bin, GstElement * element) /* we ref here because after the _unparent() the element can be disposed * and we still need it to fire a signal. */ - gst_object_ref (GST_OBJECT (element)); - gst_object_unparent (GST_OBJECT (element)); + gst_object_ref (GST_OBJECT_CAST (element)); + gst_object_unparent (GST_OBJECT_CAST (element)); g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_REMOVED], 0, element); /* element is really out of our control now */ - gst_object_unref (GST_OBJECT (element)); + gst_object_unref (GST_OBJECT_CAST (element)); return TRUE; @@ -629,12 +629,6 @@ gst_bin_iterate_recurse (GstBin * bin) return result; } -GstIterator * -gst_bin_iterate_recurse_up (GstBin * bin) -{ - return NULL; -} - /* returns 0 if the element is a sink, this is made so that * we can use this function as a filter * @@ -718,6 +712,8 @@ bin_element_is_sink (GstElement * child, GstBin * bin) * Each element will have its refcount increased, so unref * after usage. * + * The sink elements are those without any linked srcpads. + * * Returns: a #GstIterator of #GstElements. gst_iterator_free after use. * * MT safe. @@ -1170,6 +1166,7 @@ gst_bin_get_by_interface (GstBin * bin, GType interface) * * Returns: An iterator for the elements inside the bin implementing the interface. * + * MT safe. */ GstIterator * gst_bin_iterate_all_by_interface (GstBin * bin, GType interface) diff --git a/gst/gstbin.h b/gst/gstbin.h index d644591877..6f0d94818d 100644 --- a/gst/gstbin.h +++ b/gst/gstbin.h @@ -117,7 +117,6 @@ GstElement* gst_bin_get_by_interface (GstBin *bin, GType interface); /* retrieve multiple children */ GstIterator* gst_bin_iterate_elements (GstBin *bin); GstIterator* gst_bin_iterate_recurse (GstBin *bin); -GstIterator* gst_bin_iterate_recurse_up (GstBin *bin); GstIterator* gst_bin_iterate_sinks (GstBin *bin); GstIterator* gst_bin_iterate_all_by_interface (GstBin *bin, GType interface); diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index af4c87ed1f..fd3feadd26 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -271,7 +271,8 @@ gst_buffer_new_and_alloc (guint size) * Returns: the #GstCaps, or NULL if there was an error or there * were no caps on this buffer. */ -/* FIXME can we make this threadsafe without a lock on the buffer? */ +/* FIXME can we make this threadsafe without a lock on the buffer? + * We can use compare and swap and atomic reads. */ GstCaps * gst_buffer_get_caps (GstBuffer * buffer) { @@ -289,7 +290,10 @@ gst_buffer_get_caps (GstBuffer * buffer) * be increased and any previous caps on the buffer will be * unreffed. */ -/* FIXME can we make this threadsafe without a lock on the buffer? */ +/* FIXME can we make this threadsafe without a lock on the buffer? + * We can use compare and swap and atomic reads. Another idea is to + * not attach the caps to the buffer but use an event to signal a caps + * change. */ void gst_buffer_set_caps (GstBuffer * buffer, GstCaps * caps) { diff --git a/gst/gstcaps.h b/gst/gstcaps.h index 84eb9204d8..e0c21f7e5d 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -148,13 +148,6 @@ void gst_caps_replace (GstCaps gchar * gst_caps_to_string (const GstCaps *caps); GstCaps * gst_caps_from_string (const gchar *string); -gboolean gst_caps_structure_fixate_field_nearest_int (GstStructure *structure, - const char *field_name, - int target); -gboolean gst_caps_structure_fixate_field_nearest_double (GstStructure *structure, - const char *field_name, - double target); - G_END_DECLS #endif /* __GST_CAPS_H__ */ diff --git a/gst/gstevent.h b/gst/gstevent.h index c8a6dbdd9e..515f0bca72 100644 --- a/gst/gstevent.h +++ b/gst/gstevent.h @@ -35,7 +35,7 @@ G_BEGIN_DECLS GST_EXPORT GType _gst_event_type; /** - * GstBufferFlag: + * GstEventType: * @GST_EVENT_UNKNOWN: * @GST_EVENT_EOS: * @GST_EVENT_FLUSH: @@ -59,6 +59,7 @@ typedef enum { GST_EVENT_NAVIGATION = 10, GST_EVENT_TAG = 11 } GstEventType; +#define GST_EVENT_ANY GST_EVENT_NAVIGATION #define GST_EVENT_TRACE_NAME "GstEvent" diff --git a/gst/gstpad.h b/gst/gstpad.h index ade5a0f40b..fc28d5d786 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -478,7 +478,6 @@ void gst_pad_set_activate_function (GstPad *pad, GstPadActivateFunction activ void gst_pad_set_loop_function (GstPad *pad, GstPadLoopFunction loop); void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain); void gst_pad_set_getrange_function (GstPad *pad, GstPadGetRangeFunction get); - void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event); void gst_pad_set_event_mask_function (GstPad *pad, GstPadEventMaskFunction mask_func); G_CONST_RETURN GstEventMask* diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index 7cbbb7749b..e3e5705c1a 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -313,7 +313,6 @@ pipeline_bus_handler (GstBus * bus, GstMessage * message, return result; } - /** * gst_pipeline_new: * @name: name of new pipeline diff --git a/gst/gstqueue.h b/gst/gstqueue.h index c953e8e160..9ff1c86805 100644 --- a/gst/gstqueue.h +++ b/gst/gstqueue.h @@ -26,8 +26,6 @@ #include -#include - G_BEGIN_DECLS @@ -88,7 +86,7 @@ struct _GstQueue { GCond *item_add; /* signals buffers now available for reading */ GCond *item_del; /* signals space now available for writing */ - gpointer _gst_reserved[GST_PADDING - 1]; + gpointer _gst_reserved[GST_PADDING]; }; struct _GstQueueClass { diff --git a/libs/gst/bytestream/bytestream.c b/libs/gst/bytestream/bytestream.c index 8e5b4cc66d..760d04a928 100644 --- a/libs/gst/bytestream/bytestream.c +++ b/libs/gst/bytestream/bytestream.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "bytestream.h" GST_DEBUG_CATEGORY_STATIC (debug_bs); diff --git a/libs/gst/dataprotocol/Makefile.am b/libs/gst/dataprotocol/Makefile.am index 85a8a69653..7aa14e25f8 100644 --- a/libs/gst/dataprotocol/Makefile.am +++ b/libs/gst/dataprotocol/Makefile.am @@ -22,3 +22,10 @@ install-data-local: as-libtool-install-data-local uninstall-local: as-libtool-uninstall-local include $(top_srcdir)/common/as-libtool.mak +# regression test +check_PROGRAMS = dataprotocol-test +dataprotocol_test_SOURCES = dataprotocol-test.c dataprotocol.c +dataprotocol_test_CFLAGS = $(GST_LIB_CFLAGS) -I$(top_srcdir)/libs -DGST_ENABLE_NEW +dataprotocol_test_LDADD = $(GST_OBJ_LIBS) + +TESTS = $(check_PROGRAMS) diff --git a/plugins/elements/gstaggregator.c b/plugins/elements/gstaggregator.c index 702bfb8144..ddd806cf51 100644 --- a/plugins/elements/gstaggregator.c +++ b/plugins/elements/gstaggregator.c @@ -137,6 +137,9 @@ gst_aggregator_class_init (GstAggregatorClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property); + 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)); @@ -152,8 +155,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass) "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->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property); gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_aggregator_request_new_pad); diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 4877d07b5c..cb5f7dc210 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -408,7 +408,7 @@ gst_fakesrc_event_handler (GstPad * pad, GstEvent * event) { GstFakeSrc *src; - src = GST_FAKESRC (gst_object_get_parent (GST_OBJECT (pad))); + src = GST_FAKESRC (GST_PAD_PARENT (pad)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: @@ -914,7 +914,7 @@ gst_fakesrc_loop (GstPad * pad) return; pause: - gst_task_pause (src->task); + gst_task_pause (GST_RPAD_TASK (pad)); GST_STREAM_UNLOCK (pad); return; } @@ -933,11 +933,11 @@ gst_fakesrc_activate (GstPad * pad, GstActivateMode mode) g_return_val_if_fail (fakesrc->has_loop, FALSE); if (GST_ELEMENT_SCHEDULER (fakesrc)) { GST_STREAM_LOCK (pad); - fakesrc->task = + GST_RPAD_TASK (pad) = gst_scheduler_create_task (GST_ELEMENT_SCHEDULER (fakesrc), (GstTaskFunction) gst_fakesrc_loop, pad); - gst_task_start (fakesrc->task); + gst_task_start (GST_RPAD_TASK (pad)); GST_STREAM_UNLOCK (pad); result = TRUE; } @@ -952,10 +952,10 @@ gst_fakesrc_activate (GstPad * pad, GstActivateMode mode) /* step 2, make sure streaming finishes */ GST_STREAM_LOCK (pad); /* step 3, stop the task */ - if (fakesrc->task) { - gst_task_stop (fakesrc->task); - gst_object_unref (GST_OBJECT (fakesrc->task)); - fakesrc->task = NULL; + if (GST_RPAD_TASK (pad)) { + gst_task_stop (GST_RPAD_TASK (pad)); + gst_object_unref (GST_OBJECT (GST_RPAD_TASK (pad))); + GST_RPAD_TASK (pad) = NULL; } GST_STREAM_UNLOCK (pad); diff --git a/plugins/elements/gstfakesrc.h b/plugins/elements/gstfakesrc.h index 4560370a05..a5251b85f3 100644 --- a/plugins/elements/gstfakesrc.h +++ b/plugins/elements/gstfakesrc.h @@ -80,8 +80,6 @@ struct _GstFakeSrc { gboolean has_getrange; gboolean eos; - GstTask *task; - GstFakeSrcOutputType output; GstFakeSrcDataType data; GstFakeSrcSizeType sizetype; diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index 411dd0a32e..1fca02c387 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -88,13 +88,12 @@ gst_fdsink_class_init (GstFdSinkClass * klass) gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = gst_fdsink_set_property; + gobject_class->get_property = gst_fdsink_get_property; 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)); - - gobject_class->set_property = gst_fdsink_set_property; - gobject_class->get_property = gst_fdsink_get_property; } static void diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index ca33db3c25..e658cd3a9d 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -103,6 +103,9 @@ gst_fdsrc_class_init (GstFdSrcClass * klass) gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = gst_fdsrc_set_property; + gobject_class->get_property = gst_fdsrc_get_property; + 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)); @@ -119,9 +122,6 @@ gst_fdsrc_class_init (GstFdSrcClass * klass) G_STRUCT_OFFSET (GstFdSrcClass, timeout), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - gobject_class->set_property = gst_fdsrc_set_property; - gobject_class->get_property = gst_fdsrc_get_property; - gstelement_class->change_state = gst_fdsrc_change_state; } diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 992febf746..1386758a3c 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -145,6 +145,8 @@ gst_filesink_class_init (GstFileSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = gst_filesink_set_property; + gobject_class->get_property = gst_filesink_get_property; g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION, g_param_spec_string ("location", "File Location", @@ -155,8 +157,6 @@ gst_filesink_class_init (GstFileSinkClass * klass) G_STRUCT_OFFSET (GstFileSinkClass, handoff), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - gobject_class->set_property = gst_filesink_set_property; - gobject_class->get_property = gst_filesink_get_property; gobject_class->dispose = gst_filesink_dispose; } static void @@ -363,6 +363,7 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event) GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE, (_("Error while writing to file \"%s\"."), filesink->filename), GST_ERROR_SYSTEM); + return FALSE; } } diff --git a/plugins/elements/gstmd5sink.c b/plugins/elements/gstmd5sink.c index 63c939e10a..4ebbb4c4f0 100644 --- a/plugins/elements/gstmd5sink.c +++ b/plugins/elements/gstmd5sink.c @@ -392,7 +392,6 @@ gst_md5sink_class_init (GstMD5SinkClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5, diff --git a/plugins/elements/gstmultifilesrc.c b/plugins/elements/gstmultifilesrc.c index f781844865..ea951736c0 100644 --- a/plugins/elements/gstmultifilesrc.c +++ b/plugins/elements/gstmultifilesrc.c @@ -107,6 +107,8 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + gobject_class->set_property = gst_multifilesrc_set_property; + gobject_class->get_property = gst_multifilesrc_get_property; gst_multifilesrc_signals[NEW_FILE] = g_signal_new ("new-file", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -114,16 +116,11 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass) 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_HAVENEWMEDIA, g_param_spec_boolean ("newmedia", "newmedia", "generate new media events?", FALSE, G_PARAM_READWRITE)); - - gobject_class->set_property = gst_multifilesrc_set_property; - gobject_class->get_property = gst_multifilesrc_get_property; - gstelement_class->change_state = gst_multifilesrc_change_state; } diff --git a/plugins/elements/gstqueue.h b/plugins/elements/gstqueue.h index c953e8e160..9ff1c86805 100644 --- a/plugins/elements/gstqueue.h +++ b/plugins/elements/gstqueue.h @@ -26,8 +26,6 @@ #include -#include - G_BEGIN_DECLS @@ -88,7 +86,7 @@ struct _GstQueue { GCond *item_add; /* signals buffers now available for reading */ GCond *item_del; /* signals space now available for writing */ - gpointer _gst_reserved[GST_PADDING - 1]; + gpointer _gst_reserved[GST_PADDING]; }; struct _GstQueueClass { diff --git a/plugins/elements/gstshaper.c b/plugins/elements/gstshaper.c index 9b4f19bb6d..c14ab36a18 100644 --- a/plugins/elements/gstshaper.c +++ b/plugins/elements/gstshaper.c @@ -127,6 +127,8 @@ gst_shaper_class_init (GstShaperClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY, g_param_spec_enum ("policy", "Policy", "Shaper policy", @@ -138,9 +140,6 @@ gst_shaper_class_init (GstShaperClass * klass) g_param_spec_string ("last-message", "last-message", "last-message", 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); - gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_shaper_request_new_pad); } diff --git a/plugins/elements/gststatistics.c b/plugins/elements/gststatistics.c index 82744ff6f4..ef6cca3bca 100644 --- a/plugins/elements/gststatistics.c +++ b/plugins/elements/gststatistics.c @@ -124,6 +124,8 @@ gst_statistics_class_init (GstStatisticsClass * klass) gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS, g_param_spec_int64 ("buffers", "buffers", "total buffers count", @@ -162,8 +164,6 @@ gst_statistics_class_init (GstStatisticsClass * klass) 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->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property); } static void diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 8bc760eb3e..9c7b162444 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -350,7 +350,7 @@ free_entry (TypeFindEntry * entry) free_entry_buffers (entry); if (entry->caps) - gst_caps_free (entry->caps); + gst_caps_unref (entry->caps); g_free (entry); } static void @@ -484,6 +484,7 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event) g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0, entry->probability, entry->caps); stop_typefinding (typefind); + push_buffer_store (typefind); gst_pad_event_default (pad, event); } else { gst_pad_event_default (pad, event); diff --git a/tools/Makefile.am b/tools/Makefile.am index e97797b59c..f4f09573cb 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -37,7 +37,7 @@ bin_PROGRAMS = \ $(GST_REGISTRY_SRC) $(GST_REGISTRY_SRC_V) \ $(GST_LOADSAVE_SRC) $(GST_LOADSAVE_SRC_V) \ $(GST_OTHER_SRC) $(GST_OTHER_SRC_V) -bin_SCRIPTS = +bin_SCRIPTS = gst-feedback-@GST_MAJORMINOR@ # make sure each versioned tool has the right source file and flags if !GST_DISABLE_REGISTRY diff --git a/tools/gst-launch.c b/tools/gst-launch.c index d8314e48d6..20f7db07db 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -410,7 +410,6 @@ event_loop (GstElement * pipeline, gboolean blocking) return TRUE; } - int main (int argc, char *argv[]) {