diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-02-22 14:11:59 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-02-22 14:11:59 +0100 |
commit | 238b9a57cc022aec7ebd52d908ac5e24d76c3183 (patch) | |
tree | 9563e2353a2c427a40fae0e7de0ed73c2348c402 /libs/gst | |
parent | 90fff577f0661c1ec7a0f2c324d5b69d1d1d040e (diff) | |
parent | cc5edeefcd7772ac645fa0b8b91cfe7be201d78a (diff) |
Merge branch 'master' into 0.11
Conflicts:
configure.ac
gst/gstelement.c
gst/gstelement.h
gst/gstpad.c
gst/gstutils.c
libs/gst/base/Makefile.am
libs/gst/check/Makefile.am
libs/gst/controller/Makefile.am
libs/gst/dataprotocol/Makefile.am
libs/gst/net/Makefile.am
win32/common/libgstreamer.def
Diffstat (limited to 'libs/gst')
27 files changed, 491 insertions, 199 deletions
diff --git a/libs/gst/base/Makefile.am b/libs/gst/base/Makefile.am index 4ba90e956..c7000eda8 100644 --- a/libs/gst/base/Makefile.am +++ b/libs/gst/base/Makefile.am @@ -61,8 +61,12 @@ GstBase-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstbase-@GST_MAJORMINO --strip-prefix=Gst \ -I$(top_srcdir) \ -I$(top_srcdir)/libs \ + -I$(top_builddir) \ + -I$(top_builddir)/libs \ $(gir_cincludes) \ --add-include-path=$(top_builddir)/gst \ + --library-path=$(top_builddir)/gst \ + --library=$(top_builddir)/gst/libgstreamer-0.11.la \ --library=libgstbase-0.11.la \ --include=Gst-0.11 \ --libtool="$(top_builddir)/libtool" \ diff --git a/libs/gst/base/gstadapter.c b/libs/gst/base/gstadapter.c index f4b1c508d..75944a902 100644 --- a/libs/gst/base/gstadapter.c +++ b/libs/gst/base/gstadapter.c @@ -191,7 +191,7 @@ gst_adapter_finalize (GObject * object) * * Creates a new #GstAdapter. Free with g_object_unref(). * - * Returns: a new #GstAdapter + * Returns: (transfer full): a new #GstAdapter */ GstAdapter * gst_adapter_new (void) @@ -285,7 +285,7 @@ copy_into_unchecked (GstAdapter * adapter, guint8 * dest, guint skip, /** * gst_adapter_push: * @adapter: a #GstAdapter - * @buf: a #GstBuffer to add to queue in the adapter + * @buf: (transfer full): a #GstBuffer to add to queue in the adapter * * Adds the data from @buf to the data stored inside @adapter and takes * ownership of the buffer. @@ -386,7 +386,8 @@ gst_adapter_try_to_merge_up (GstAdapter * adapter, guint size) * * Returns #NULL if @size bytes are not available. * - * Returns: a pointer to the first @size bytes of data, or NULL. + * Returns: (transfer none) (array length=size): a pointer to the first + * @size bytes of data, or NULL */ const guint8 * gst_adapter_peek (GstAdapter * adapter, guint size) @@ -459,7 +460,7 @@ gst_adapter_peek (GstAdapter * adapter, guint size) /** * gst_adapter_copy: * @adapter: a #GstAdapter - * @dest: the memory where to copy to + * @dest: (out caller-allocates) (array length=size): the memory to copy into * @offset: the bytes offset in the adapter to start from * @size: the number of bytes to copy * @@ -608,7 +609,10 @@ gst_adapter_take_internal (GstAdapter * adapter, guint nbytes) * * Caller owns returned value. g_free after usage. * - * Returns: oven-fresh hot data, or #NULL if @nbytes bytes are not available + * Free-function: g_free + * + * Returns: (transfer full) (array length=nbytes): oven-fresh hot data, or + * #NULL if @nbytes bytes are not available */ guint8 * gst_adapter_take (GstAdapter * adapter, guint nbytes) @@ -644,10 +648,12 @@ gst_adapter_take (GstAdapter * adapter, guint nbytes) * * Caller owns returned value. gst_buffer_unref() after usage. * - * Since: 0.10.6 + * Free-function: gst_buffer_unref * - * Returns: a #GstBuffer containing the first @nbytes of the adapter, - * or #NULL if @nbytes bytes are not available + * Returns: (transfer full): a #GstBuffer containing the first @nbytes of + * the adapter, or #NULL if @nbytes bytes are not available + * + * Since: 0.10.6 */ GstBuffer * gst_adapter_take_buffer (GstAdapter * adapter, guint nbytes) @@ -714,16 +720,17 @@ done: * @adapter: a #GstAdapter * @nbytes: the number of bytes to take * - * Returns a #GSList of buffers containing the first @nbytes bytes of the + * Returns a #GList of buffers containing the first @nbytes bytes of the * @adapter. The returned bytes will be flushed from the adapter. * When the caller can deal with individual buffers, this function is more - * performant because no memory should be coppied. + * performant because no memory should be copied. * * Caller owns returned list and contained buffers. gst_buffer_unref() each - * buffer in the list before freeng the list after usage. + * buffer in the list before freeing the list after usage. * - * Returns: a #GSList of buffers containing the first @nbytes of the adapter, - * or #NULL if @nbytes bytes are not available + * Returns: (element-type Gst.Buffer) (transfer full): a #GList of buffers + * containing the first @nbytes of the adapter, or #NULL if @nbytes bytes + * are not available * * Since: 0.10.31 */ @@ -820,7 +827,7 @@ gst_adapter_available_fast (GstAdapter * adapter) /** * gst_adapter_prev_timestamp: * @adapter: a #GstAdapter - * @distance: pointer to location for distance or NULL + * @distance: (out) (allow-none): pointer to location for distance, or NULL * * Get the timestamp that was before the current byte in the adapter. When * @distance is given, the amount of bytes between the timestamp and the current diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 7a3fb74f5..040c25f82 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -196,12 +196,14 @@ struct _GstBaseSinkPrivate GstClockTime current_rstart; GstClockTime current_rstop; GstClockTimeDiff current_jitter; + /* the running time of the previous buffer */ + GstClockTime prev_rstart; /* EOS sync time in running time */ GstClockTime eos_rtime; /* last buffer that arrived in time, running time */ - GstClockTime last_in_time; + GstClockTime last_render_time; /* when the last buffer left the sink, running time */ GstClockTime last_left; @@ -209,6 +211,7 @@ struct _GstBaseSinkPrivate GstClockTime avg_pt; GstClockTime avg_duration; gdouble avg_rate; + GstClockTime avg_in_diff; /* these are done on system time. avg_jitter and avg_render are * compared to eachother to see if the rendering time takes a @@ -259,6 +262,10 @@ struct _GstBaseSinkPrivate /* Cached GstClockID */ GstClockID cached_clock_id; + + /* for throttling and QoS */ + GstClockTime earliest_in_time; + GstClockTime throttle_time; }; #define DO_RUNNING_AVG(avg,val,size) (((val) + ((size)-1) * (avg)) / (size)) @@ -299,6 +306,7 @@ enum #define DEFAULT_BLOCKSIZE 4096 #define DEFAULT_RENDER_DELAY 0 #define DEFAULT_ENABLE_LAST_BUFFER TRUE +#define DEFAULT_THROTTLE_TIME 0 enum { @@ -313,6 +321,7 @@ enum PROP_LAST_BUFFER, PROP_BLOCKSIZE, PROP_RENDER_DELAY, + PROP_THROTTLE_TIME, PROP_LAST }; @@ -396,7 +405,7 @@ static GstFlowReturn gst_base_sink_pad_buffer_alloc (GstPad * pad, /* check if an object was too late */ static gboolean gst_base_sink_is_too_late (GstBaseSink * basesink, - GstMiniObject * obj, GstClockTime start, GstClockTime stop, + GstMiniObject * obj, GstClockTime rstart, GstClockTime rstop, GstClockReturn status, GstClockTimeDiff jitter); static GstFlowReturn gst_base_sink_preroll_object (GstBaseSink * basesink, guint8 obj_type, GstMiniObject * obj); @@ -506,6 +515,7 @@ gst_base_sink_class_init (GstBaseSinkClass * klass) * * Since: 0.10.22 */ + /* FIXME 0.11: blocksize property should be int, otherwise min>max.. */ g_object_class_install_property (gobject_class, PROP_BLOCKSIZE, g_param_spec_uint ("blocksize", "Block size", "Size in bytes to pull per buffer (0 = default)", 0, G_MAXUINT, @@ -523,6 +533,19 @@ gst_base_sink_class_init (GstBaseSinkClass * klass) g_param_spec_uint64 ("render-delay", "Render Delay", "Additional render delay of the sink in nanoseconds", 0, G_MAXUINT64, DEFAULT_RENDER_DELAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GstBaseSink:throttle-time + * + * The time to insert between buffers. This property can be used to control + * the maximum amount of buffers per second to render. Setting this property + * to a value bigger than 0 will make the sink create THROTTLE QoS events. + * + * Since: 0.10.33 + */ + g_object_class_install_property (gobject_class, PROP_THROTTLE_TIME, + g_param_spec_uint64 ("throttle-time", "Throttle time", + "The time to keep between rendered buffers (unused)", 0, G_MAXUINT64, + DEFAULT_THROTTLE_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_base_sink_change_state); @@ -688,6 +711,7 @@ gst_base_sink_init (GstBaseSink * basesink, gpointer g_class) priv->blocksize = DEFAULT_BLOCKSIZE; priv->cached_clock_id = NULL; g_atomic_int_set (&priv->enable_last_buffer, DEFAULT_ENABLE_LAST_BUFFER); + priv->throttle_time = DEFAULT_THROTTLE_TIME; GST_OBJECT_FLAG_SET (basesink, GST_ELEMENT_IS_SINK); } @@ -945,9 +969,11 @@ gst_base_sink_get_ts_offset (GstBaseSink * sink) * * The #GstCaps on the buffer can be used to determine the type of the buffer. * - * Returns: a #GstBuffer. gst_buffer_unref() after usage. This function returns - * NULL when no buffer has arrived in the sink yet or when the sink is not in - * PAUSED or PLAYING. + * Free-function: gst_buffer_unref + * + * Returns: (transfer full): a #GstBuffer. gst_buffer_unref() after usage. + * This function returns NULL when no buffer has arrived in the sink yet + * or when the sink is not in PAUSED or PLAYING. * * Since: 0.10.15 */ @@ -1069,10 +1095,10 @@ gst_base_sink_get_latency (GstBaseSink * sink) /** * gst_base_sink_query_latency: * @sink: the sink - * @live: if the sink is live - * @upstream_live: if an upstream element is live - * @min_latency: the min latency of the upstream elements - * @max_latency: the max latency of the upstream elements + * @live: (out) (allow-none): if the sink is live + * @upstream_live: (out) (allow-none): if an upstream element is live + * @min_latency: (out) (allow-none): the min latency of the upstream elements + * @max_latency: (out) (allow-none): the max latency of the upstream elements * * Query the sink for the latency parameters. The latency will be queried from * the upstream elements. @live will be TRUE if @sink is configured to @@ -1242,6 +1268,7 @@ gst_base_sink_get_render_delay (GstBaseSink * sink) * * Since: 0.10.22 */ +/* FIXME 0.11: blocksize property should be int, otherwise min>max.. */ void gst_base_sink_set_blocksize (GstBaseSink * sink, guint blocksize) { @@ -1264,6 +1291,7 @@ gst_base_sink_set_blocksize (GstBaseSink * sink, guint blocksize) * * Since: 0.10.22 */ +/* FIXME 0.11: blocksize property should be int, otherwise min>max.. */ guint gst_base_sink_get_blocksize (GstBaseSink * sink) { @@ -1278,6 +1306,53 @@ gst_base_sink_get_blocksize (GstBaseSink * sink) return res; } +/** + * gst_base_sink_set_throttle_time: + * @sink: a #GstBaseSink + * @throttle: the throttle time in nanoseconds + * + * Set the time that will be inserted between rendered buffers. This + * can be used to control the maximum buffers per second that the sink + * will render. + * + * Since: 0.10.33 + */ +void +gst_base_sink_set_throttle_time (GstBaseSink * sink, guint64 throttle) +{ + g_return_if_fail (GST_IS_BASE_SINK (sink)); + + GST_OBJECT_LOCK (sink); + sink->priv->throttle_time = throttle; + GST_LOG_OBJECT (sink, "set throttle_time to %" G_GUINT64_FORMAT, throttle); + GST_OBJECT_UNLOCK (sink); +} + +/** + * gst_base_sink_get_throttle_time: + * @sink: a #GstBaseSink + * + * Get the time that will be inserted between frames to control the + * maximum buffers per second. + * + * Returns: the number of nanoseconds @sink will put between frames. + * + * Since: 0.10.33 + */ +guint64 +gst_base_sink_get_throttle_time (GstBaseSink * sink) +{ + guint64 res; + + g_return_val_if_fail (GST_IS_BASE_SINK (sink), 0); + + GST_OBJECT_LOCK (sink); + res = sink->priv->throttle_time; + GST_OBJECT_UNLOCK (sink); + + return res; +} + static void gst_base_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) @@ -1315,6 +1390,9 @@ gst_base_sink_set_property (GObject * object, guint prop_id, case PROP_ENABLE_LAST_BUFFER: gst_base_sink_set_last_buffer_enabled (sink, g_value_get_boolean (value)); break; + case PROP_THROTTLE_TIME: + gst_base_sink_set_throttle_time (sink, g_value_get_uint64 (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1358,6 +1436,9 @@ gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value, case PROP_RENDER_DELAY: g_value_set_uint64 (value, gst_base_sink_get_render_delay (sink)); break; + case PROP_THROTTLE_TIME: + g_value_set_uint64 (value, gst_base_sink_get_throttle_time (sink)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1960,7 +2041,7 @@ again: } /* set last stop position */ - if (G_LIKELY (cstop != GST_CLOCK_TIME_NONE)) + if (G_LIKELY (stop != GST_CLOCK_TIME_NONE && cstop != GST_CLOCK_TIME_NONE)) gst_segment_set_last_stop (segment, GST_FORMAT_TIME, cstop); else gst_segment_set_last_stop (segment, GST_FORMAT_TIME, cstart); @@ -2054,7 +2135,7 @@ gst_base_sink_adjust_time (GstBaseSink * basesink, GstClockTime time) * gst_base_sink_wait_clock: * @sink: the sink * @time: the running_time to be reached - * @jitter: the jitter to be filled with time diff (can be NULL) + * @jitter: (out) (allow-none): the jitter to be filled with time diff, or NULL * * This function will block until @time is reached. It is usually called by * subclasses that use their own internal synchronisation. @@ -2072,7 +2153,7 @@ gst_base_sink_adjust_time (GstBaseSink * basesink, GstClockTime time) * return and is not adjusted with any latency or offset configured in the * sink. * - * Since 0.10.20 + * Since: 0.10.20 * * Returns: #GstClockReturn */ @@ -2164,10 +2245,10 @@ no_clock: * This function should only be called with the PREROLL_LOCK held, like in the * render function. * - * Since: 0.10.11 - * * Returns: #GST_FLOW_OK if the preroll completed and processing can * continue. Any other return value should be returned from the render vmethod. + * + * Since: 0.10.11 */ GstFlowReturn gst_base_sink_wait_preroll (GstBaseSink * sink) @@ -2199,10 +2280,27 @@ step_unlocked: } } +static inline guint8 +get_object_type (GstMiniObject * obj) +{ + guint8 obj_type; + + if (G_LIKELY (GST_IS_BUFFER (obj))) + obj_type = _PR_IS_BUFFER; + else if (GST_IS_EVENT (obj)) + obj_type = _PR_IS_EVENT; + else if (GST_IS_BUFFER_LIST (obj)) + obj_type = _PR_IS_BUFFERLIST; + else + obj_type = _PR_IS_NOTHING; + + return obj_type; +} + /** * gst_base_sink_do_preroll: * @sink: the sink - * @obj: the object that caused the preroll + * @obj: (transfer none): the mini object that caused the preroll * * If the @sink spawns its own thread for pulling buffers from upstream it * should call this method after it has pulled a buffer. If the element needed @@ -2211,10 +2309,10 @@ step_unlocked: * * This function should be called with the PREROLL_LOCK held. * - * Since 0.10.22 - * * Returns: #GST_FLOW_OK if the preroll completed and processing can * continue. Any other return value should be returned from the render vmethod. + * + * Since: 0.10.22 */ GstFlowReturn gst_base_sink_do_preroll (GstBaseSink * sink, GstMiniObject * obj) @@ -2222,15 +2320,10 @@ gst_base_sink_do_preroll (GstBaseSink * sink, GstMiniObject * obj) GstFlowReturn ret; while (G_UNLIKELY (sink->need_preroll)) { - guint8 obj_type = _PR_IS_NOTHING; + guint8 obj_type; GST_DEBUG_OBJECT (sink, "prerolling object %p", obj); - if (G_LIKELY (GST_IS_BUFFER (obj))) - obj_type = _PR_IS_BUFFER; - else if (GST_IS_EVENT (obj)) - obj_type = _PR_IS_EVENT; - else if (GST_IS_BUFFER_LIST (obj)) - obj_type = _PR_IS_BUFFERLIST; + obj_type = get_object_type (obj); ret = gst_base_sink_preroll_object (sink, obj_type, obj); if (ret != GST_FLOW_OK) @@ -2259,7 +2352,7 @@ preroll_failed: * gst_base_sink_wait_eos: * @sink: the sink * @time: the running_time to be reached - * @jitter: the jitter to be filled with time diff (can be NULL) + * @jitter: (out) (allow-none): the jitter to be filled with time diff, or NULL * * This function will block until @time is reached. It is usually called by * subclasses that use their own internal synchronisation but want to let the @@ -2271,9 +2364,9 @@ preroll_failed: * The @time argument should be the running_time of when the EOS should happen * and will be adjusted with any latency and offset configured in the sink. * - * Since 0.10.15 - * * Returns: #GstFlowReturn + * + * Since: 0.10.15 */ GstFlowReturn gst_base_sink_wait_eos (GstBaseSink * sink, GstClockTime time, @@ -2401,6 +2494,27 @@ do_step: /* save sync time for eos when the previous object needed sync */ priv->eos_rtime = (do_sync ? priv->current_rstop : GST_CLOCK_TIME_NONE); + /* calculate inter frame spacing */ + if (G_UNLIKELY (priv->prev_rstart != -1 && priv->prev_rstart < rstart)) { + GstClockTime in_diff; + + in_diff = rstart - priv->prev_rstart; + + if (priv->avg_in_diff == -1) + priv->avg_in_diff = in_diff; + else + priv->avg_in_diff = UPDATE_RUNNING_AVG (priv->avg_in_diff, in_diff); + + GST_LOG_OBJECT (basesink, "avg frame diff %" GST_TIME_FORMAT, + GST_TIME_ARGS (priv->avg_in_diff)); + + } + priv->prev_rstart = rstart; + + if (G_UNLIKELY (priv->earliest_in_time != -1 + && rstart < priv->earliest_in_time)) + goto qos_dropped; + again: /* first do preroll, this makes sure we commit our state * to PAUSED and can continue to PLAYING. We cannot perform @@ -2487,6 +2601,12 @@ not_syncable: GST_DEBUG_OBJECT (basesink, "non syncable object %p", obj); return GST_FLOW_OK; } +qos_dropped: + { + GST_DEBUG_OBJECT (basesink, "dropped because of QoS %p", obj); + *late = TRUE; + return GST_FLOW_OK; + } flushing: { GST_DEBUG_OBJECT (basesink, "we are flushing"); @@ -2501,7 +2621,7 @@ preroll_failed: } static gboolean -gst_base_sink_send_qos (GstBaseSink * basesink, +gst_base_sink_send_qos (GstBaseSink * basesink, GstQOSType type, gdouble proportion, GstClockTime time, GstClockTimeDiff diff) { GstEvent *event; @@ -2509,10 +2629,10 @@ gst_base_sink_send_qos (GstBaseSink * basesink, /* generate Quality-of-Service event */ GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, basesink, - "qos: proportion: %lf, diff %" G_GINT64_FORMAT ", timestamp %" - GST_TIME_FORMAT, proportion, diff, GST_TIME_ARGS (time)); + "qos: type %d, proportion: %lf, diff %" G_GINT64_FORMAT ", timestamp %" + GST_TIME_FORMAT, type, proportion, diff, GST_TIME_ARGS (time)); - event = gst_event_new_qos (proportion, diff, time); + event = gst_event_new_qos_full (type, proportion, diff, time); /* send upstream */ res = gst_pad_push_event (basesink->sinkpad, event); @@ -2560,10 +2680,10 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped) } /* calculate duration of the buffer */ - if (GST_CLOCK_TIME_IS_VALID (stop)) + if (GST_CLOCK_TIME_IS_VALID (stop) && stop != start) duration = stop - start; else - duration = GST_CLOCK_TIME_NONE; + duration = priv->avg_in_diff; /* if we have the time when the last buffer left us, calculate * processing time */ @@ -2578,11 +2698,11 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped) } GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, sink, "start: %" GST_TIME_FORMAT - ", entered %" GST_TIME_FORMAT ", left %" GST_TIME_FORMAT ", pt: %" - GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT ",jitter %" - G_GINT64_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (entered), - GST_TIME_ARGS (left), GST_TIME_ARGS (pt), GST_TIME_ARGS (duration), - jitter); + ", stop %" GST_TIME_FORMAT ", entered %" GST_TIME_FORMAT ", left %" + GST_TIME_FORMAT ", pt: %" GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT + ",jitter %" G_GINT64_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (stop), + GST_TIME_ARGS (entered), GST_TIME_ARGS (left), GST_TIME_ARGS (pt), + GST_TIME_ARGS (duration), jitter); GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, sink, "avg_duration: %" GST_TIME_FORMAT ", avg_pt: %" GST_TIME_FORMAT ", avg_rate: %g", @@ -2606,7 +2726,7 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped) gst_guint64_to_gdouble (priv->avg_pt) / gst_guint64_to_gdouble (priv->avg_duration); else - rate = 0.0; + rate = 1.0; if (GST_CLOCK_TIME_IS_VALID (priv->last_left)) { if (dropped || priv->avg_rate < 0.0) { @@ -2626,6 +2746,9 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped) if (priv->avg_rate >= 0.0) { + GstQOSType type; + GstClockTimeDiff diff; + /* if we have a valid rate, start sending QoS messages */ if (priv->current_jitter < 0) { /* make sure we never go below 0 when adding the jitter to the @@ -2633,8 +2756,20 @@ gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped) if (priv->current_rstart < -priv->current_jitter) priv->current_jitter = -priv->current_rstart; } - gst_base_sink_send_qos (sink, priv->avg_rate, priv->current_rstart, - priv->current_jitter); + + if (priv->throttle_time > 0) { + diff = priv->throttle_time; + type = GST_QOS_TYPE_THROTTLE; + } else { + diff = priv->current_jitter; + if (diff <= 0) + type = GST_QOS_TYPE_OVERFLOW; + else + type = GST_QOS_TYPE_UNDERFLOW; + } + + gst_base_sink_send_qos (sink, type, priv->avg_rate, priv->current_rstart, + diff); } /* record when this buffer will leave us */ @@ -2649,12 +2784,15 @@ gst_base_sink_reset_qos (GstBaseSink * sink) priv = sink->priv; - priv->last_in_time = GST_CLOCK_TIME_NONE; + priv->last_render_time = GST_CLOCK_TIME_NONE; + priv->prev_rstart = GST_CLOCK_TIME_NONE; + priv->earliest_in_time = GST_CLOCK_TIME_NONE; priv->last_left = GST_CLOCK_TIME_NONE; priv->avg_duration = GST_CLOCK_TIME_NONE; priv->avg_pt = GST_CLOCK_TIME_NONE; priv->avg_rate = -1.0; priv->avg_render = GST_CLOCK_TIME_NONE; + priv->avg_in_diff = GST_CLOCK_TIME_NONE; priv->rendered = 0; priv->dropped = 0; @@ -2662,7 +2800,7 @@ gst_base_sink_reset_qos (GstBaseSink * sink) /* Checks if the object was scheduled too late. * - * start/stop contain the raw timestamp start and stop values + * rstart/rstop contain the running_time start and stop values * of the object. * * status and jitter contain the return values from the clock wait. @@ -2671,7 +2809,7 @@ gst_base_sink_reset_qos (GstBaseSink * sink) */ static gboolean gst_base_sink_is_too_late (GstBaseSink * basesink, GstMiniObject * obj, - GstClockTime start, GstClockTime stop, + GstClockTime rstart, GstClockTime rstop, GstClockReturn status, GstClockTimeDiff jitter) { gboolean late; @@ -2697,38 +2835,45 @@ gst_base_sink_is_too_late (GstBaseSink * basesink, GstMiniObject * obj, goto not_buffer; /* can't do check if we don't have a timestamp */ - if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (start))) + if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (rstart))) goto no_timestamp; /* we can add a valid stop time */ - if (GST_CLOCK_TIME_IS_VALID (stop)) - max_lateness += stop; - else - max_lateness += start; + if (GST_CLOCK_TIME_IS_VALID (rstop)) + max_lateness += rstop; + else { + max_lateness += rstart; + /* no stop time, use avg frame diff */ + if (priv->avg_in_diff != -1) + max_lateness += priv->avg_in_diff; + } /* if the jitter bigger than duration and lateness we are too late */ - if ((late = start + jitter > max_lateness)) { + if ((late = rstart + jitter > max_lateness)) { GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, basesink, "buffer is too late %" GST_TIME_FORMAT - " > %" GST_TIME_FORMAT, GST_TIME_ARGS (start + jitter), + " > %" GST_TIME_FORMAT, GST_TIME_ARGS (rstart + jitter), GST_TIME_ARGS (max_lateness)); /* !!emergency!!, if we did not receive anything valid for more than a * second, render it anyway so the user sees something */ - if (GST_CLOCK_TIME_IS_VALID (priv->last_in_time) && - start - priv->last_in_time > GST_SECOND) { + if (GST_CLOCK_TIME_IS_VALID (priv->last_render_time) && + rstart - priv->last_render_time > GST_SECOND) { late = FALSE; GST_ELEMENT_WARNING (basesink, CORE, CLOCK, (_("A lot of buffers are being dropped.")), ("There may be a timestamping problem, or this computer is too slow.")); GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, basesink, "**emergency** last buffer at %" GST_TIME_FORMAT " > GST_SECOND", - GST_TIME_ARGS (priv->last_in_time)); + GST_TIME_ARGS (priv->last_render_time)); } } done: - if (!late || !GST_CLOCK_TIME_IS_VALID (priv->last_in_time)) { - priv->last_in_time = start; + if (!late || !GST_CLOCK_TIME_IS_VALID (priv->last_render_time)) { + priv->last_render_time = rstart; + /* the next allowed input timestamp */ + if (priv->throttle_time > 0) + priv->earliest_in_time = rstart + priv->throttle_time; } return late; @@ -3122,14 +3267,15 @@ gst_base_sink_queue_object_unlocked (GstBaseSink * basesink, GstPad * pad, q = basesink->preroll_queue; while (G_UNLIKELY (!g_queue_is_empty (q))) { GstMiniObject *o; + guint8 ot; o = g_queue_pop_head (q); GST_DEBUG_OBJECT (basesink, "rendering queued object %p", o); + ot = get_object_type (o); + /* do something with the return value */ - ret = - gst_base_sink_render_object (basesink, pad, - GST_IS_BUFFER (o) ? _PR_IS_BUFFER : _PR_IS_EVENT, o); + ret = gst_base_sink_render_object (basesink, pad, ot, o); if (ret != GST_FLOW_OK) goto dequeue_failed; } @@ -3224,10 +3370,10 @@ gst_base_sink_flush_start (GstBaseSink * basesink, GstPad * pad) * anymore */ GST_PAD_STREAM_LOCK (pad); gst_base_sink_reset_qos (basesink); + /* and we need to commit our state again on the next + * prerolled buffer */ + basesink->playing_async = TRUE; if (basesink->priv->async_enabled) { - /* and we need to commit our state again on the next - * prerolled buffer */ - basesink->playing_async = TRUE; gst_element_lost_state (GST_ELEMENT_CAST (basesink)); } else { basesink->priv->have_latency = TRUE; @@ -3271,7 +3417,7 @@ gst_base_sink_event (GstPad * pad, GstEvent * event) bclass = GST_BASE_SINK_GET_CLASS (basesink); - GST_DEBUG_OBJECT (basesink, "reveived event %p %" GST_PTR_FORMAT, event, + GST_DEBUG_OBJECT (basesink, "received event %p %" GST_PTR_FORMAT, event, event); switch (GST_EVENT_TYPE (event)) { diff --git a/libs/gst/base/gstbasesink.h b/libs/gst/base/gstbasesink.h index e91cb2cfe..a4215b8de 100644 --- a/libs/gst/base/gstbasesink.h +++ b/libs/gst/base/gstbasesink.h @@ -233,6 +233,10 @@ GstClockTime gst_base_sink_get_render_delay (GstBaseSink *sink); void gst_base_sink_set_blocksize (GstBaseSink *sink, guint blocksize); guint gst_base_sink_get_blocksize (GstBaseSink *sink); +/* throttle-time */ +void gst_base_sink_set_throttle_time (GstBaseSink *sink, guint64 throttle); +guint64 gst_base_sink_get_throttle_time (GstBaseSink *sink); + GstClockReturn gst_base_sink_wait_clock (GstBaseSink *sink, GstClockTime time, GstClockTimeDiff * jitter); GstFlowReturn gst_base_sink_wait_eos (GstBaseSink *sink, GstClockTime time, diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 9768f5644..287047567 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -240,6 +240,7 @@ struct _GstBaseSrcPrivate /* pending tags to be pushed in the data stream */ GList *pending_tags; + volatile gint have_tags; /* QoS *//* with LOCK */ gboolean qos_enabled; @@ -345,6 +346,7 @@ gst_base_src_class_init (GstBaseSrcClass * klass) gobject_class->set_property = gst_base_src_set_property; gobject_class->get_property = gst_base_src_get_property; +/* FIXME 0.11: blocksize property should be int, not ulong (min is >max here) */ g_object_class_install_property (gobject_class, PROP_BLOCKSIZE, g_param_spec_ulong ("blocksize", "Block size", "Size in bytes to read per buffer (-1 = default)", 0, G_MAXULONG, @@ -436,6 +438,7 @@ gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class) gst_base_src_set_format (basesrc, GST_FORMAT_BYTES); basesrc->data.ABI.typefind = DEFAULT_TYPEFIND; basesrc->priv->do_timestamp = DEFAULT_DO_TIMESTAMP; + g_atomic_int_set (&basesrc->priv->have_tags, FALSE); GST_OBJECT_FLAG_UNSET (basesrc, GST_BASE_SRC_STARTED); GST_OBJECT_FLAG_SET (basesrc, GST_ELEMENT_IS_SOURCE); @@ -488,12 +491,14 @@ gst_base_src_wait_playing (GstBaseSrc * src) { g_return_val_if_fail (GST_IS_BASE_SRC (src), GST_FLOW_ERROR); - /* block until the state changes, or we get a flush, or something */ - GST_DEBUG_OBJECT (src, "live source waiting for running state"); - GST_LIVE_WAIT (src); - if (src->priv->flushing) - goto flushing; - GST_DEBUG_OBJECT (src, "live source unlocked"); + do { + /* block until the state changes, or we get a flush, or something */ + GST_DEBUG_OBJECT (src, "live source waiting for running state"); + GST_LIVE_WAIT (src); + GST_DEBUG_OBJECT (src, "live source unlocked"); + if (src->priv->flushing) + goto flushing; + } while (G_UNLIKELY (!src->live_running)); return GST_FLOW_OK; @@ -580,9 +585,9 @@ gst_base_src_set_format (GstBaseSrc * src, GstFormat format) /** * gst_base_src_query_latency: * @src: the source - * @live: if the source is live - * @min_latency: the min latency of the source - * @max_latency: the max latency of the source + * @live: (out) (allow-none): if the source is live + * @min_latency: (out) (allow-none): the min latency of the source + * @max_latency: (out) (allow-none): the max latency of the source * * Query the source for the latency parameters. @live will be TRUE when @src is * configured as a live source. @min_latency will be set to the difference @@ -638,6 +643,7 @@ gst_base_src_query_latency (GstBaseSrc * src, gboolean * live, * * Since: 0.10.22 */ +/* FIXME 0.11: blocksize property should be int, not ulong */ void gst_base_src_set_blocksize (GstBaseSrc * src, gulong blocksize) { @@ -658,6 +664,7 @@ gst_base_src_set_blocksize (GstBaseSrc * src, gulong blocksize) * * Since: 0.10.22 */ +/* FIXME 0.11: blocksize property should be int, not ulong */ gulong gst_base_src_get_blocksize (GstBaseSrc * src) { @@ -1582,6 +1589,7 @@ gst_base_src_send_event (GstElement * element, GstEvent * event) /* Insert tag in the dataflow */ GST_OBJECT_LOCK (src); src->priv->pending_tags = g_list_append (src->priv->pending_tags, event); + g_atomic_int_set (&src->priv->have_tags, TRUE); GST_OBJECT_UNLOCK (src); event = NULL; result = TRUE; @@ -2093,7 +2101,7 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length, again: if (src->is_live) { - while (G_UNLIKELY (!src->live_running)) { + if (G_UNLIKELY (!src->live_running)) { ret = gst_base_src_wait_playing (src); if (ret != GST_FLOW_OK) goto stopped; @@ -2348,7 +2356,7 @@ gst_base_src_loop (GstPad * pad) gint64 position; gboolean eos; gulong blocksize; - GList *tags, *tmp; + GList *tags = NULL, *tmp; eos = FALSE; @@ -2405,11 +2413,14 @@ gst_base_src_loop (GstPad * pad) } src->priv->newsegment_pending = FALSE; - GST_OBJECT_LOCK (src); - /* take the tags */ - tags = src->priv->pending_tags; - src->priv->pending_tags = NULL; - GST_OBJECT_UNLOCK (src); + if (g_atomic_int_get (&src->priv->have_tags)) { + GST_OBJECT_LOCK (src); + /* take the tags */ + tags = src->priv->pending_tags; + src->priv->pending_tags = NULL; + g_atomic_int_set (&src->priv->have_tags, FALSE); + GST_OBJECT_UNLOCK (src); + } /* Push out pending tags if any */ if (G_UNLIKELY (tags != NULL)) { diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index ba0262766..7b4d5195f 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1489,6 +1489,12 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans, gst_buffer_unref (*out_buf); *out_buf = NULL; } + } else if (outsize != newsize) { + GST_WARNING_OBJECT (trans, "Caps did not change but allocated size does " + "not match expected size (%d != %d)", newsize, outsize); + if (in_buf != *out_buf) + gst_buffer_unref (*out_buf); + *out_buf = NULL; } /* these are the final output caps */ @@ -1750,6 +1756,20 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size, if (gst_caps_is_empty (sink_suggest)) goto not_supported; + /* try the alloc caps if it is still not fixed */ + if (!gst_caps_is_fixed (sink_suggest)) { + GstCaps *intersect; + + GST_DEBUG_OBJECT (trans, "Checking if the input caps is compatible " + "with the non-fixed caps suggestion"); + intersect = gst_caps_intersect (sink_suggest, caps); + if (!gst_caps_is_empty (intersect)) { + GST_DEBUG_OBJECT (trans, "It is, using it"); + gst_caps_replace (&sink_suggest, caps); + } + gst_caps_unref (intersect); + } + /* be safe and call default fixate */ sink_suggest = gst_caps_make_writable (sink_suggest); gst_pad_fixate_caps (GST_BASE_TRANSFORM_SINK_PAD (trans), sink_suggest); @@ -2757,7 +2777,7 @@ gst_base_transform_set_gap_aware (GstBaseTransform * trans, gboolean gap_aware) /** * gst_base_transform_suggest: * @trans: a #GstBaseTransform - * @caps: caps to suggest + * @caps: (transfer none): caps to suggest * @size: buffer size to suggest * * Instructs @trans to suggest new @caps upstream. A copy of @caps will be diff --git a/libs/gst/base/gstbitreader.c b/libs/gst/base/gstbitreader.c index 1dd8979e4..a4393992c 100644 --- a/libs/gst/base/gstbitreader.c +++ b/libs/gst/base/gstbitreader.c @@ -43,7 +43,9 @@ * * Create a new #GstBitReader instance, which will read from @data. * - * Returns: a new #GstBitReader instance + * Free-function: gst_bit_reader_free + * + * Returns: (transfer full): a new #GstBitReader instance * * Since: 0.10.22 */ @@ -65,7 +67,9 @@ gst_bit_reader_new (const guint8 * data, guint size) * Create a new #GstBitReader instance, which will read from the * #GstBuffer @buffer. * - * Returns: a new #GstBitReader instance + * Free-function: gst_bit_reader_free + * + * Returns: (transfer full): a new #GstBitReader instance * * Since: 0.10.22 */ @@ -80,7 +84,7 @@ gst_bit_reader_new_from_buffer (const GstBuffer * buffer) /** * gst_bit_reader_free: - * @reader: a #GstBitReader instance + * @reader: (in) (transfer full): a #GstBitReader instance * * Frees a #GstBitReader instance, which was previously allocated by * gst_bit_reader_new() or gst_bit_reader_new_from_buffer(). @@ -98,7 +102,7 @@ gst_bit_reader_free (GstBitReader * reader) /** * gst_bit_reader_init: * @reader: a #GstBitReader instance - * @data: Data from which the #GstBitReader should read + * @data: (in) (array length=size): data from which the bit reader should read * @size: Size of @data in bytes * * Initializes a #GstBitReader instance to read from @data. This function @@ -119,7 +123,7 @@ gst_bit_reader_init (GstBitReader * reader, const guint8 * data, guint size) /** * gst_bit_reader_init_from_buffer: * @reader: a #GstBitReader instance - * @buffer: Buffer from which the #GstBitReader should read + * @buffer: (transfer none): Buffer from which the #GstBitReader should read * * Initializes a #GstBitReader instance to read from @buffer. This function * can be called on already initialized instances. diff --git a/libs/gst/base/gstbytereader-docs.h b/libs/gst/base/gstbytereader-docs.h index 91747601e..01b8326a0 100644 --- a/libs/gst/base/gstbytereader-docs.h +++ b/libs/gst/base/gstbytereader-docs.h @@ -608,7 +608,7 @@ gdouble gst_byte_reader_peek_float64_be_unchecked (GstByteReader * reader); * gst_byte_reader_peek_data_unchecked: * @reader: a #GstByteReader instance * - * Returns: a constant pointer to the current data position + * Returns: (transfer none): a constant pointer to the current data position * * Since: 0.10.25 */ @@ -622,7 +622,8 @@ const guint8 * gst_byte_reader_peek_data_unchecked (GstByteReader * reader); * if at least @size bytes are left. Advances the current read position by * @size bytes. * - * Returns: a constant pointer to the current data position. + * Returns: (transfer none) (array length=size): a constant pointer to the + * current data position. * * Since: 0.10.25 */ @@ -636,8 +637,10 @@ const guint8 * gst_byte_reader_get_data_unchecked (GstByteReader * reader, guint * without checking if at least @size bytes are left. Advances the current read * position by @size bytes. * - * Returns: a newly-allocated copy of the data @size bytes in size. Free with - * g_free() when no longer needed. + * Free-function: g_free + * + * Returns: (transfer full) (array length=size): a newly-allocated copy of the + * data @size bytes in size. Free with g_free() when no longer needed. * * Since: 0.10.25 */ diff --git a/libs/gst/base/gstbytereader.c b/libs/gst/base/gstbytereader.c index d8796aaa6..e0cc7237f 100644 --- a/libs/gst/base/gstbytereader.c +++ b/libs/gst/base/gstbytereader.c @@ -43,12 +43,15 @@ /** * gst_byte_reader_new: - * @data: Data from which the #GstByteReader should read + * @data: (in) (transfer none) (array length=size): data from which the + * #GstByteReader should read * @size: Size of @data in bytes * * Create a new #GstByteReader instance, which will read from @data. * - * Returns: a new #GstByteReader instance + * Free-function: gst_byte_reader_free + * + * Returns: (transfer full): a new #GstByteReader instance * * Since: 0.10.22 */ @@ -65,12 +68,14 @@ gst_byte_reader_new (const guint8 * data, guint size) /** * gst_byte_reader_new_from_buffer: - * @buffer: Buffer from which the #GstByteReader should read + * @buffer: (transfer none): Buffer from which the #GstByteReader should read * * Create a new #GstByteReader instance, which will read from the * #GstBuffer @buffer. * - * Returns: a new #GstByteReader instance + * Free-function: gst_byte_reader_free + * + * Returns: (transfer full): a new #GstByteReader instance * * Since: 0.10.22 */ @@ -85,7 +90,7 @@ gst_byte_reader_new_from_buffer (const GstBuffer * buffer) /** * gst_byte_reader_free: - * @reader: a #GstByteReader instance + * @reader: (in) (transfer full): a #GstByteReader instance * * Frees a #GstByteReader instance, which was previously allocated by * gst_byte_reader_new() or gst_byte_reader_new_from_buffer(). @@ -103,7 +108,8 @@ gst_byte_reader_free (GstByteReader * reader) /** * gst_byte_reader_init: * @reader: a #GstByteReader instance - * @data: Data from which the #GstByteReader should read + * @data: (in) (transfer none) (array length=size): data from which + * the #GstByteReader should read * @size: Size of @data in bytes * * Initializes a #GstByteReader instance to read from @data. This function @@ -124,7 +130,7 @@ gst_byte_reader_init (GstByteReader * reader, const guint8 * data, guint size) /** * gst_byte_reader_init_from_buffer: * @reader: a #GstByteReader instance - * @buffer: Buffer from which the #GstByteReader should read + * @buffer: (transfer none): Buffer from which the #GstByteReader should read * * Initializes a #GstByteReader instance to read from @buffer. This function * can be called on already initialized instances. @@ -852,7 +858,8 @@ GST_BYTE_READER_PEEK_GET(64,gdouble,float64_be) * gst_byte_reader_get_data: * @reader: a #GstByteReader instance * @size: Size in bytes - * @val: Pointer to a #guint8 to store the result + * @val: (out) (transfer none) (array length=size): address of a + * #guint8 pointer variable in which to store the result * * Returns a constant pointer to the current data * position if at least @size bytes are left and @@ -874,7 +881,8 @@ gst_byte_reader_get_data (GstByteReader * reader, guint size, * gst_byte_reader_peek_data: * @reader: a #GstByteReader instance * @size: Size in bytes - * @val: Pointer to a #guint8 to store the result + * @val: (out) (transfer none) (array length=size): address of a + * #guint8 pointer variable in which to store the result * * Returns a constant pointer to the current data * position if at least @size bytes are left and @@ -896,11 +904,14 @@ gst_byte_reader_peek_data (const GstByteReader * reader, guint size, * gst_byte_reader_dup_data: * @reader: a #GstByteReader instance * @size: Size in bytes - * @val: Pointer to a #guint8 to store the result + * @val: (out) (transfer full) (array length=size): address of a + * #guint8 pointer variable in which to store the result + * + * Free-function: g_free * * Returns a newly-allocated copy of the current data * position if at least @size bytes are left and - * updates the current position. + * updates the current position. Free with g_free() when no longer needed. * * Returns: %TRUE if successful, %FALSE otherwise. * @@ -1107,7 +1118,8 @@ GST_BYTE_READER_SKIP_STRING (32); /** * gst_byte_reader_peek_string: * @reader: a #GstByteReader instance - * @str: Pointer to a #gchar to store the result + * @str: (out) (transfer none) (array zero-terminated=1): address of a + * #gchar pointer varieble in which to store the result * * Returns a constant pointer to the current data position if there is * a NUL-terminated string in the data (this could be just a NUL terminator). @@ -1124,7 +1136,8 @@ GST_BYTE_READER_SKIP_STRING (32); /** * gst_byte_reader_peek_string_utf8: * @reader: a #GstByteReader instance - * @str: Pointer to a #gchar to store the result + * @str: (out) (transfer none) (array zero-terminated=1): address of a + * #gchar pointer varieble in which to store the result * * Returns a constant pointer to the current data position if there is * a NUL-terminated string in the data (this could be just a NUL terminator). @@ -1158,7 +1171,8 @@ gst_byte_reader_peek_string_utf8 (const GstByteReader * reader, /** * gst_byte_reader_get_string_utf8: * @reader: a #GstByteReader instance - * @str: Pointer to a #gchar to store the result + * @str: (out) (transfer none) (array zero-terminated=1): address of a + * #gchar pointer varieble in which to store the result * * Returns a constant pointer to the current data position if there is * a NUL-terminated string in the data (this could be just a NUL terminator), @@ -1215,7 +1229,10 @@ gst_byte_reader_dup_string_utf##bits (GstByteReader * reader, type ** str) \ /** * gst_byte_reader_dup_string_utf8: * @reader: a #GstByteReader instance - * @str: address of a string pointer to store the result + * @str: (out) (transfer full) (array zero-terminated=1): address of a + * #gchar pointer varieble in which to store the result + * + * Free-function: g_free * * FIXME:Reads (copies) a NUL-terminated string in the #GstByteReader instance, * advancing the current position to the byte after the string. This will work @@ -1234,7 +1251,10 @@ GST_BYTE_READER_DUP_STRING (8, gchar); /** * gst_byte_reader_dup_string_utf16: * @reader: a #GstByteReader instance - * @str: address of a #guint16 pointer to store the result + * @str: (out) (transfer full) (array zero-terminated=1): address of a + * #guint16 pointer varieble in which to store the result + * + * Free-function: g_free * * Returns a newly-allocated copy of the current data position if there is * a NUL-terminated UTF-16 string in the data (this could be an empty string @@ -1259,7 +1279,10 @@ GST_BYTE_READER_DUP_STRING (16, guint16); /** * gst_byte_reader_dup_string_utf32: * @reader: a #GstByteReader instance - * @str: address of a #guint32 pointer to store the result + * @str: (out) (transfer full) (array zero-terminated=1): address of a + * #guint32 pointer varieble in which to store the result + * + * Free-function: g_free * * Returns a newly-allocated copy of the current data position if there is * a NUL-terminated UTF-32 string in the data (this could be an empty string diff --git a/libs/gst/base/gstbytewriter-docs.h b/libs/gst/base/gstbytewriter-docs.h index e7a3d70cc..da4c20efa 100644 --- a/libs/gst/base/gstbytewriter-docs.h +++ b/libs/gst/base/gstbytewriter-docs.h @@ -291,7 +291,7 @@ void gst_byte_writer_put_float64_le_unchecked (GstByteWriter *writer, gdouble va /** * gst_byte_writer_put_data_unchecked: * @writer: #GstByteWriter instance - * @data: Data to write + * @data: (in) (transfer none) (array length=size): Data to write * @size: Size of @data in bytes * * Writes @size bytes of @data to @writer without diff --git a/libs/gst/base/gstbytewriter.c b/libs/gst/base/gstbytewriter.c index 6aa940ac8..25564f7d9 100644 --- a/libs/gst/base/gstbytewriter.c +++ b/libs/gst/base/gstbytewriter.c @@ -43,7 +43,9 @@ * * Creates a new, empty #GstByteWriter instance * - * Returns: a new, empty #GstByteWriter instance + * Free-function: gst_byte_writer_free + * + * Returns: (transfer full): a new, empty #GstByteWriter instance * * Since: 0.10.26 */ @@ -64,7 +66,9 @@ gst_byte_writer_new (void) * Creates a new #GstByteWriter instance with the given * initial data size. * - * Returns: a new #GstByteWriter instance + * Free-function: gst_byte_writer_free + * + * Returns: (transfer full): a new #GstByteWriter instance * * Since: 0.10.26 */ @@ -91,7 +95,9 @@ gst_byte_writer_new_with_size (guint size, gboolean fixed) * memory area. If @initialized is %TRUE it is possible to * read @size bytes from the #GstByteWriter from the beginning. * - * Returns: a new #GstByteWriter instance + * Free-function: gst_byte_writer_free + * + * Returns: (transfer full): a new #GstByteWriter instance * * Since: 0.10.26 */ @@ -120,7 +126,9 @@ gst_byte_writer_new_with_data (guint8 * data, guint size, gboolean initialized) * * <note>@buffer must be writable</note> * - * Returns: a new #GstByteWriter instance + * Free-function: gst_byte_writer_free + * + * Returns: (transfer full): a new #GstByteWriter instance * * Since: 0.10.26 */ @@ -179,7 +187,8 @@ gst_byte_writer_init_with_size (GstByteWriter * writer, guint size, /** * gst_byte_writer_init_with_data: * @writer: #GstByteWriter instance - * @data: Memory area for writing + * @data: (in callee-allocated) (array length=size) (transfer none): Memory + * area for writing * @size: Size of @data in bytes * @initialized: If %TRUE the complete data can be read from the beginning * @@ -207,7 +216,7 @@ gst_byte_writer_init_with_data (GstByteWriter * writer, guint8 * data, /** * gst_byte_writer_init_with_buffer: * @writer: #GstByteWriter instance - * @buffer: Buffer used for writing + * @buffer: (transfer none): Buffer used for writing * @initialized: If %TRUE the complete data can be read from the beginning * * Initializes @writer with the given @@ -253,7 +262,9 @@ gst_byte_writer_reset (GstByteWriter * writer) * * Resets @writer and returns the current data. * - * Returns: the current data. g_free() after usage. + * Free-function: g_free + * + * Returns: (transfer full): the current data. g_free() after usage. * * Since: 0.10.26 */ @@ -279,7 +290,10 @@ gst_byte_writer_reset_and_get_data (GstByteWriter * writer) * * Resets @writer and returns the current data as buffer. * - * Returns: the current data as buffer. gst_buffer_unref() after usage. + * Free-function: gst_buffer_unref + * + * Returns: (transfer full): the current data as buffer. gst_buffer_unref() + * after usage. * * Since: 0.10.26 */ @@ -300,7 +314,7 @@ gst_byte_writer_reset_and_get_buffer (GstByteWriter * writer) /** * gst_byte_writer_free: - * @writer: #GstByteWriter instance + * @writer: (in) (transfer full): #GstByteWriter instance * * Frees @writer and all memory allocated by it. * @@ -317,12 +331,14 @@ gst_byte_writer_free (GstByteWriter * writer) /** * gst_byte_writer_free_and_get_data: - * @writer: #GstByteWriter instance + * @writer: (in) (transfer full): #GstByteWriter instance * * Frees @writer and all memory allocated by it except * the current data, which is returned. * - * Returns: the current data. g_free() after usage. + * Free-function: g_free + * + * Returns: (transfer full): the current data. g_free() after usage. * * Since: 0.10.26 */ @@ -341,12 +357,15 @@ gst_byte_writer_free_and_get_data (GstByteWriter * writer) /** * gst_byte_writer_free_and_get_buffer: - * @writer: #GstByteWriter instance + * @writer: (in) (transfer full): #GstByteWriter instance * * Frees @writer and all memory allocated by it except * the current data, which is returned as #GstBuffer. * - * Returns: the current data as buffer. gst_buffer_unref() after usage. + * Free-function: gst_buffer_unref + * + * Returns: (transfer full): the current data as buffer. gst_buffer_unref() + * after usage. * * Since: 0.10.26 */ @@ -721,7 +740,8 @@ CREATE_WRITE_STRING_FUNC (32, guint32); /** * gst_byte_writer_put_string_utf8: * @writer: #GstByteWriter instance - * @data: UTF8 string to write + * @data: (transfer none) (array zero-terminated=1) (type utf8): UTF8 string to + * write * * Writes a NUL-terminated UTF8 string to @writer (including the terminator). * @@ -732,7 +752,7 @@ CREATE_WRITE_STRING_FUNC (32, guint32); /** * gst_byte_writer_put_string_utf16: * @writer: #GstByteWriter instance - * @data: UTF16 string to write + * @data: (transfer none) (array zero-terminated=1): UTF16 string to write * * Writes a NUL-terminated UTF16 string to @writer (including the terminator). * @@ -743,7 +763,7 @@ CREATE_WRITE_STRING_FUNC (32, guint32); /** * gst_byte_writer_put_string_utf32: * @writer: #GstByteWriter instance - * @data: UTF32 string to write + * @data: (transfer none) (array zero-terminated=1): UTF32 string to write * * Writes a NUL-terminated UTF32 string to @writer (including the terminator). * @@ -754,7 +774,7 @@ CREATE_WRITE_STRING_FUNC (32, guint32); /** * gst_byte_writer_put_data: * @writer: #GstByteWriter instance - * @data: Data to write + * @data: (transfer none) (array length=size): Data to write * @size: Size of @data in bytes * * Writes @size bytes of @data to @writer. diff --git a/libs/gst/base/gstbytewriter.h b/libs/gst/base/gstbytewriter.h index 72554a5ed..186480d6c 100644 --- a/libs/gst/base/gstbytewriter.h +++ b/libs/gst/base/gstbytewriter.h @@ -154,7 +154,7 @@ gboolean gst_byte_writer_put_string_utf32 (GstByteWriter *writer, const guint32 /** * gst_byte_writer_put_string: * @writer: #GstByteWriter instance - * @data: Null terminated string + * @data: (in) (array zero-terminated=1): Null terminated string * * Write a NUL-terminated string to @writer (including the terminator). The * string is assumed to be in an 8-bit encoding (e.g. ASCII,UTF-8 or diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c index 2259e2a61..8d0aa14d9 100644 --- a/libs/gst/base/gstcollectpads.c +++ b/libs/gst/base/gstcollectpads.c @@ -166,7 +166,7 @@ gst_collect_pads_finalize (GObject * object) * * Create a new instance of #GstCollectPads. * - * Returns: a new #GstCollectPads, or NULL in case of an error. + * Returns: (transfer full): a new #GstCollectPads, or NULL in case of an error. * * MT safe. */ @@ -184,7 +184,7 @@ gst_collect_pads_new (void) * gst_collect_pads_set_function: * @pads: the collectspads to use * @func: the function to set - * @user_data: user data passed to the function + * @user_data: (closure): user data passed to the function * * Set the callback function and user data that will be called when * all the pads added to the collection have buffers queued. @@ -241,7 +241,7 @@ unref_data (GstCollectData * data) /** * gst_collect_pads_add_pad: * @pads: the collectspads to use - * @pad: the pad to add + * @pad: (transfer none): the pad to add * @size: the size of the returned #GstCollectData structure * * Add a pad to the collection of collect pads. The pad has to be @@ -276,7 +276,7 @@ gst_collect_pads_add_pad (GstCollectPads * pads, GstPad * pad, guint size) /** * gst_collect_pads_add_pad_full: * @pads: the collectspads to use - * @pad: the pad to add + * @pad: (transfer none): the pad to add * @size: the size of the returned #GstCollectData structure * @destroy_notify: function to be called before the returned #GstCollectData * structure is freed @@ -362,7 +362,7 @@ find_pad (GstCollectData * data, GstPad * pad) * gst_collect_pads_set_clip_function: * @pads: the collectspads to use * @clipfunc: clip function to install - * @user_data: user data to pass to @clip_func + * @user_data: (closure): user data to pass to @clip_func * * Install a clipping function that is called right after a buffer is received * on a pad managed by @pads. See #GstCollectDataClipFunction for more info. @@ -387,7 +387,7 @@ gst_collect_pads_set_clip_function (GstCollectPads * pads, /** * gst_collect_pads_remove_pad: * @pads: the collectspads to use - * @pad: the pad to remove + * @pad: (transfer none): the pad to remove * * Remove a pad from the collection of collect pads. This function will also * free the #GstCollectData and all the resources that were allocated with @@ -473,7 +473,7 @@ unknown_pad: /** * gst_collect_pads_is_active: - * @pads: the collectspads to use + * @pads: (transfer none): the collectspads to use * @pad: the pad to check * * Check if a pad is active. @@ -741,7 +741,7 @@ gst_collect_pads_stop (GstCollectPads * pads) * should be called with the @pads LOCK held, such as in the callback * handler. * - * Returns: The buffer in @data or NULL if no buffer is queued. + * Returns: (transfer full): The buffer in @data or NULL if no buffer is queued. * should unref the buffer after usage. * * MT safe. @@ -773,8 +773,10 @@ gst_collect_pads_peek (GstCollectPads * pads, GstCollectData * data) * should be called with the @pads LOCK held, such as in the callback * handler. * - * Returns: The buffer in @data or NULL if no buffer was queued. - * You should unref the buffer after usage. + * Free-function: gst_buffer_unref + * + * Returns: (transfer full): The buffer in @data or NULL if no buffer was + * queued. You should unref the buffer after usage. * * MT safe. */ @@ -883,7 +885,7 @@ not_filled: * gst_collect_pads_read: * @pads: the collectspads to query * @data: the data to use - * @bytes: a pointer to a byte array + * @bytes: (out) (transfer none) (array length=size): a pointer to a byte array * @size: the number of bytes to read * * Get a pointer in @bytes where @size bytes can be read from the @@ -931,11 +933,13 @@ gst_collect_pads_read (GstCollectPads * pads, GstCollectData * data, * * This function should be called with @pads LOCK held, such as in the callback. * - * Since: 0.10.18 + * Free-function: gst_buffer_unref + * + * Returns: (transfer full): a #GstBuffer. The size of the buffer can be less + * that requested. A return of NULL signals that the pad is end-of-stream. + * Unref the buffer with gst_buffer_unref() after use. * - * Returns: A #GstBuffer. The size of the buffer can be less that requested. - * A return of NULL signals that the pad is end-of-stream. - * Unref the buffer after use. + * Since: 0.10.18 * * MT safe. */ @@ -975,11 +979,13 @@ gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data, * * This function should be called with @pads LOCK held, such as in the callback. * - * Since: 0.10.18 + * Free-function: gst_buffer_unref * - * Returns: A #GstBuffer. The size of the buffer can be less that requested. - * A return of NULL signals that the pad is end-of-stream. - * Unref the buffer after use. + * Returns: (transfer full): a #GstBuffer. The size of the buffer can be less + * that requested. A return of NULL signals that the pad is end-of-stream. + * Unref the buffer after use. + * + * Since: 0.10.18 * * MT safe. */ diff --git a/libs/gst/base/gsttypefindhelper.c b/libs/gst/base/gsttypefindhelper.c index e586e3911..8695b9291 100644 --- a/libs/gst/base/gsttypefindhelper.c +++ b/libs/gst/base/gsttypefindhelper.c @@ -217,11 +217,12 @@ helper_find_get_length (gpointer data) /** * gst_type_find_helper_get_range_ext: * @obj: A #GstObject that will be passed as first argument to @func - * @func: A generic #GstTypeFindHelperGetRangeFunction that will be used - * to access data at random offsets when doing the typefinding + * @func: (scope call): A generic #GstTypeFindHelperGetRangeFunction that will + * be used to access data at random offsets when doing the typefinding * @size: The length in bytes - * @extension: extenstion of the media - * @prob: location to store the probability of the found caps, or #NULL + * @extension: extension of the media + * @prob: (out) (allow-none): location to store the probability of the found + * caps, or #NULL * * Utility function to do pull-based typefinding. Unlike gst_type_find_helper() * however, this function will use the specified function @func to obtain the @@ -236,8 +237,10 @@ helper_find_get_length (gpointer data) * functions for the given extension, which might speed up the typefinding * in many cases. * - * Returns: The #GstCaps corresponding to the data stream. - * Returns #NULL if no #GstCaps matches the data stream. + * Free-function: gst_caps_unref + * + * Returns: (transfer full): the #GstCaps corresponding to the data stream. + * Returns #NULL if no #GstCaps matches the data stream. * * Since: 0.10.26 */ @@ -345,10 +348,11 @@ gst_type_find_helper_get_range_ext (GstObject * obj, /** * gst_type_find_helper_get_range: * @obj: A #GstObject that will be passed as first argument to @func - * @func: A generic #GstTypeFindHelperGetRangeFunction that will be used - * to access data at random offsets when doing the typefinding + * @func: (scope call): A generic #GstTypeFindHelperGetRangeFunction that will + * be used to access data at random offsets when doing the typefinding * @size: The length in bytes - * @prob: location to store the probability of the found caps, or #NULL + * @prob: (out) (allow-none): location to store the probability of the found + * caps, or #NULL * * Utility function to do pull-based typefinding. Unlike gst_type_find_helper() * however, this function will use the specified function @func to obtain the @@ -359,8 +363,10 @@ gst_type_find_helper_get_range_ext (GstObject * obj, * callback can then call the upstream peer pad with offsets adjusted for the * tag size, for example). * - * Returns: The #GstCaps corresponding to the data stream. - * Returns #NULL if no #GstCaps matches the data stream. + * Free-function: gst_caps_unref + * + * Returns: (transfer full): the #GstCaps corresponding to the data stream. + * Returns #NULL if no #GstCaps matches the data stream. */ GstCaps * gst_type_find_helper_get_range (GstObject * obj, @@ -377,8 +383,10 @@ gst_type_find_helper_get_range (GstObject * obj, * * Tries to find what type of data is flowing from the given source #GstPad. * - * Returns: The #GstCaps corresponding to the data stream. - * Returns #NULL if no #GstCaps matches the data stream. + * Free-function: gst_caps_unref + * + * Returns: (transfer full): the #GstCaps corresponding to the data stream. + * Returns #NULL if no #GstCaps matches the data stream. */ GstCaps * @@ -471,8 +479,9 @@ buf_helper_find_suggest (gpointer data, guint probability, const GstCaps * caps) /** * gst_type_find_helper_for_buffer: * @obj: object doing the typefinding, or NULL (used for logging) - * @buf: a #GstBuffer with data to typefind - * @prob: location to store the probability of the found caps, or #NULL + * @buf: (in) (transfer none): a #GstBuffer with data to typefind + * @prob: (out) (allow-none): location to store the probability of the found + * caps, or #NULL * * Tries to find what type of data is contained in the given #GstBuffer, the * assumption being that the buffer represents the beginning of the stream or @@ -485,8 +494,11 @@ buf_helper_find_suggest (gpointer data, guint probability, const GstCaps * caps) * and the caps with the highest probability will be returned, or #NULL if * the content of the buffer could not be identified. * - * Returns: The #GstCaps corresponding to the data, or #NULL if no type could - * be found. The caller should free the caps returned with gst_caps_unref(). + * Free-function: gst_caps_unref + * + * Returns: (transfer full): the #GstCaps corresponding to the data, or #NULL + * if no type could be found. The caller should free the caps returned + * with gst_caps_unref(). */ GstCaps * gst_type_find_helper_for_buffer (GstObject * obj, GstBuffer * buf, @@ -540,7 +552,7 @@ gst_type_find_helper_for_buffer (GstObject * obj, GstBuffer * buf, /** * gst_type_find_helper_for_extension: - * @obj: object doing the typefinding, or NULL (used for logging) + * @obj: (allow-none): object doing the typefinding, or NULL (used for logging) * @extension: an extension * * Tries to find the best #GstCaps associated with @extension. @@ -549,8 +561,11 @@ gst_type_find_helper_for_buffer (GstObject * obj, GstBuffer * buf, * of rank. The caps of the first typefinder that can handle @extension will be * returned. * - * Returns: The #GstCaps corresponding to @extension, or #NULL if no type could - * be found. The caller should free the caps returned with gst_caps_unref(). + * Free-function: gst_caps_unref + * + * Returns: (transfer full): the #GstCaps corresponding to @extension, or + * #NULL if no type could be found. The caller should free the caps + * returned with gst_caps_unref(). * * Since: 0.10.23 */ diff --git a/libs/gst/check/Makefile.am b/libs/gst/check/Makefile.am index 0040ba5e3..567c3a2b0 100644 --- a/libs/gst/check/Makefile.am +++ b/libs/gst/check/Makefile.am @@ -121,8 +121,12 @@ GstCheck-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstcheck-@GST_MAJORMI --strip-prefix=Gst \ -I$(top_srcdir) \ -I$(top_srcdir)/libs \ + -I$(top_builddir) \ + -I$(top_builddir)/libs \ $(gir_cincludes) \ --add-include-path=$(top_builddir)/gst \ + --library-path=$(top_builddir)/gst \ + --library=$(top_builddir)/gst/libgstreamer-0.11.la \ --library=libgstcheck-0.11.la \ --include=Gst-0.11 \ --libtool="$(top_builddir)/libtool" \ diff --git a/libs/gst/check/gstcheck.c b/libs/gst/check/gstcheck.c index 77634c22c..c4370a3ae 100644 --- a/libs/gst/check/gstcheck.c +++ b/libs/gst/check/gstcheck.c @@ -571,19 +571,22 @@ gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes) gint gst_check_run_suite (Suite * suite, const gchar * name, const gchar * fname) { + SRunner *sr; + gchar *xmlfilename = NULL; gint nf; - SRunner *sr = srunner_create (suite); + sr = srunner_create (suite); if (g_getenv ("GST_CHECK_XML")) { /* how lucky we are to have __FILE__ end in .c */ - gchar *xmlfilename = g_strdup_printf ("%sheck.xml", fname); + xmlfilename = g_strdup_printf ("%sheck.xml", fname); srunner_set_xml (sr, xmlfilename); } srunner_run_all (sr, CK_NORMAL); nf = srunner_ntests_failed (sr); + g_free (xmlfilename); srunner_free (sr); return nf; } diff --git a/libs/gst/check/gstconsistencychecker.c b/libs/gst/check/gstconsistencychecker.c index 5253b4c99..ded047e1d 100644 --- a/libs/gst/check/gstconsistencychecker.c +++ b/libs/gst/check/gstconsistencychecker.c @@ -79,6 +79,7 @@ source_pad_data_cb (GstPad * pad, GstMiniObject * data, break; case GST_EVENT_TAG: GST_DEBUG_OBJECT (pad, "tag %" GST_PTR_FORMAT, event->structure); + /* fall through */ default: if (GST_EVENT_IS_SERIALIZED (event) && GST_EVENT_IS_DOWNSTREAM (event)) { fail_if (consist->eos, "Event received after EOS"); diff --git a/libs/gst/controller/Makefile.am b/libs/gst/controller/Makefile.am index a21de5699..187cfe8b2 100644 --- a/libs/gst/controller/Makefile.am +++ b/libs/gst/controller/Makefile.am @@ -45,10 +45,15 @@ GstController-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstcontroller-@G --nsversion=@GST_MAJORMINOR@ \ --strip-prefix=Gst \ -I$(top_srcdir) \ + -I$(top_srcdir)/libs \ + -I$(top_builddir) \ + -I$(top_builddir)/libs \ $(gir_cincludes) \ --add-include-path=$(top_builddir)/gst \ - --library=libgstcontroller-@GST_MAJORMINOR@.la \ - --include=Gst-@GST_MAJORMINOR@ \ + --library-path=$(top_builddir)/gst \ + --library=$(top_builddir)/gst/libgstreamer-0.11.la \ + --library=libgstcontroller-0.11.la \ + --include=Gst-0.11 \ --libtool="$(top_builddir)/libtool" \ --pkg gstreamer-@GST_MAJORMINOR@ \ --pkg-export gstreamer-controller-@GST_MAJORMINOR@ \ diff --git a/libs/gst/controller/gstcontroller.c b/libs/gst/controller/gstcontroller.c index 8ebc13b69..1675278a8 100644 --- a/libs/gst/controller/gstcontroller.c +++ b/libs/gst/controller/gstcontroller.c @@ -752,7 +752,7 @@ gst_controller_get_value_arrays (GstController * self, * * All fields of @value_array must be filled correctly. Especially the * @value_array->values array must be big enough to keep the requested amount - * of values. + * of values (as indicated by the nbsamples field). * * The type of the values in the array is the same as the property's type. * diff --git a/libs/gst/controller/gstcontroller.h b/libs/gst/controller/gstcontroller.h index 92f7478a1..ce666a544 100644 --- a/libs/gst/controller/gstcontroller.h +++ b/libs/gst/controller/gstcontroller.h @@ -30,8 +30,8 @@ #include <glib/gprintf.h> #include <gst/gst.h> -#include "gstcontrolsource.h" -#include "gstinterpolationcontrolsource.h" +#include <gst/controller/gstcontrolsource.h> +#include <gst/controller/gstinterpolationcontrolsource.h> G_BEGIN_DECLS diff --git a/libs/gst/controller/gstcontrollerprivate.h b/libs/gst/controller/gstcontrollerprivate.h index 9b578c83e..6b5dcd990 100644 --- a/libs/gst/controller/gstcontrollerprivate.h +++ b/libs/gst/controller/gstcontrollerprivate.h @@ -27,8 +27,8 @@ #include <glib-object.h> #include <gst/gst.h> -#include "gstcontroller.h" -#include "gstcontrolsource.h" +#include <gst/controller/gstcontroller.h> +#include <gst/controller/gstcontrolsource.h> G_BEGIN_DECLS diff --git a/libs/gst/controller/gstinterpolationcontrolsource.h b/libs/gst/controller/gstinterpolationcontrolsource.h index bac004101..1f14755c3 100644 --- a/libs/gst/controller/gstinterpolationcontrolsource.h +++ b/libs/gst/controller/gstinterpolationcontrolsource.h @@ -27,7 +27,7 @@ #include <glib-object.h> #include <gst/gst.h> -#include "gstcontrolsource.h" +#include <gst/controller/gstcontrolsource.h> G_BEGIN_DECLS diff --git a/libs/gst/controller/gstlfocontrolsource.h b/libs/gst/controller/gstlfocontrolsource.h index b74a2a345..d61ad0689 100644 --- a/libs/gst/controller/gstlfocontrolsource.h +++ b/libs/gst/controller/gstlfocontrolsource.h @@ -27,7 +27,7 @@ #include <glib-object.h> #include <gst/gst.h> -#include "gstcontrolsource.h" +#include <gst/controller/gstcontrolsource.h> G_BEGIN_DECLS diff --git a/libs/gst/dataprotocol/Makefile.am b/libs/gst/dataprotocol/Makefile.am index 0ff881cab..5c376d1d7 100644 --- a/libs/gst/dataprotocol/Makefile.am +++ b/libs/gst/dataprotocol/Makefile.am @@ -35,8 +35,11 @@ GstDataprotocol-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstdataprotoco --strip-prefix=Gst \ --nsversion=@GST_MAJORMINOR@ \ -I$(top_srcdir) \ + -I$(top_builddir) \ $(gir_cincludes) \ --add-include-path=$(top_builddir)/gst \ + --library-path=$(top_builddir)/gst \ + --library=$(top_builddir)/gst/libgstreamer-@GST_MAJORMINOR@.la \ --library=libgstdataprotocol-@GST_MAJORMINOR@.la \ --include=Gst-@GST_MAJORMINOR@ \ --libtool="$(top_builddir)/libtool" \ diff --git a/libs/gst/net/Makefile.am b/libs/gst/net/Makefile.am index 87dfcef35..c20344965 100644 --- a/libs/gst/net/Makefile.am +++ b/libs/gst/net/Makefile.am @@ -28,7 +28,7 @@ BUILT_GIRSOURCES = GstNet-@GST_MAJORMINOR@.gir gir_headers=$(patsubst %,$(srcdir)/%, $(libgstnet_@GST_MAJORMINOR@_include_HEADERS)) gir_sources=$(patsubst %,$(srcdir)/%, $(libgstnet_@GST_MAJORMINOR@_la_SOURCES)) -gir_cincludes=$(patsubst %,--c-include='gst/net/%',$(libgstbase_@GST_MAJORMINOR@_include_HEADERS)) +gir_cincludes=--c-include="gst/net/gstnet.h" GstNet-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstnet-@GST_MAJORMINOR@.la $(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \ @@ -37,8 +37,12 @@ GstNet-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstnet-@GST_MAJORMINOR@ --nsversion=@GST_MAJORMINOR@ \ -I$(top_srcdir) \ -I$(top_srcdir)/libs \ + -I$(top_builddir) \ + -I$(top_builddir)/libs \ $(gir_cincludes) \ --add-include-path=$(top_builddir)/gst \ + --library-path=$(top_builddir)/gst \ + --library=$(top_builddir)/gst/libgstreamer-@GST_MAJORMINOR@.la \ --library=libgstnet-@GST_MAJORMINOR@.la \ --include=Gst-@GST_MAJORMINOR@ \ --libtool="$(top_builddir)/libtool" \ diff --git a/libs/gst/net/gstnettimeprovider.c b/libs/gst/net/gstnettimeprovider.c index 446e61035..b04d28243 100644 --- a/libs/gst/net/gstnettimeprovider.c +++ b/libs/gst/net/gstnettimeprovider.c @@ -352,7 +352,7 @@ gst_net_time_provider_start (GstNetTimeProvider * self) { gint ru; struct sockaddr_in my_addr; - guint len; + socklen_t len; int port; gint ret; GError *error; @@ -373,8 +373,11 @@ gst_net_time_provider_start (GstNetTimeProvider * self) my_addr.sin_family = AF_INET; /* host byte order */ my_addr.sin_port = htons ((gint16) self->port); /* short, network byte order */ my_addr.sin_addr.s_addr = INADDR_ANY; - if (self->address) - inet_aton (self->address, &my_addr.sin_addr); + if (self->address) { + ret = inet_aton (self->address, &my_addr.sin_addr); + if (ret == 0) + goto invalid_address_error; + } GST_DEBUG_OBJECT (self, "binding on port %d", self->port); ret = @@ -384,13 +387,7 @@ gst_net_time_provider_start (GstNetTimeProvider * self) goto bind_error; len = sizeof (my_addr); -#ifdef G_OS_WIN32 - ret = - getsockname (self->priv->sock.fd, (struct sockaddr *) &my_addr, - (gint *) & len); -#else ret = getsockname (self->priv->sock.fd, (struct sockaddr *) &my_addr, &len); -#endif if (ret < 0) goto getsockname_error; @@ -428,6 +425,14 @@ setsockopt_error: g_strerror (errno), errno); return FALSE; } +invalid_address_error: + { + close (self->priv->sock.fd); + self->priv->sock.fd = -1; + GST_ERROR_OBJECT (self, "invalid network address %s: %s (%d)", + self->address, g_strerror (errno), errno); + return FALSE; + } bind_error: { close (self->priv->sock.fd); diff --git a/libs/gst/net/gstnettimeprovider.h b/libs/gst/net/gstnettimeprovider.h index 204d781e8..c9609e16a 100644 --- a/libs/gst/net/gstnettimeprovider.h +++ b/libs/gst/net/gstnettimeprovider.h @@ -35,6 +35,10 @@ G_BEGIN_DECLS #ifdef G_OS_WIN32 #include <winsock2.h> +#include <ws2tcpip.h> +#ifndef socklen_t +#define socklen_t int +#endif #else #include <netdb.h> #include <sys/socket.h> |