From: <wt...@ke...> - 2008-09-24 15:04:10
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Wed Sep 24 2008 15:03:55 UTC Log message: * libs/gst/base/gstbasetransform.c: (gst_base_transform_prepare_output_buffer): Take new caps ref because our old one might have been gone when the subclass performs a gst_pad_set_caps() on the srcpad. See #548764. Modified files: . : ChangeLog libs/gst/base : gstbasetransform.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4063&r2=1.4064 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c.diff?r1=1.123&r2=1.124 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4063 retrieving revision 1.4064 diff -u -d -r1.4063 -r1.4064 --- ChangeLog 16 Sep 2008 15:35:04 -0000 1.4063 +++ ChangeLog 24 Sep 2008 15:03:38 -0000 1.4064 @@ -1,3 +1,10 @@ +2008-09-24 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasetransform.c: + (gst_base_transform_prepare_output_buffer): + Take new caps ref because our old one might have been gone when the + subclass performs a gst_pad_set_caps() on the srcpad. See #548764. 2008-09-15 Stefan Kost <en...@us...> * configure.ac: Index: gstbasetransform.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v retrieving revision 1.123 retrieving revision 1.124 diff -u -d -r1.123 -r1.124 --- gstbasetransform.c 20 Aug 2008 10:52:08 -0000 1.123 +++ gstbasetransform.c 24 Sep 2008 15:03:40 -0000 1.124 @@ -1117,6 +1117,10 @@ bclass->prepare_output_buffer (trans, in_buf, outsize, oldcaps, out_buf); + /* get a new ref to the srcpad caps, the prepare_output_buffer function can + * update the pad caps if it wants */ + oldcaps = GST_PAD_CAPS (trans->srcpad); /* FIXME 0.11: * decrease refcount again if vmethod returned refcounted in_buf. This * is because we need to make sure that the buffer is writable for the |
From: <wt...@ke...> - 2008-10-06 08:59:40
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Mon Oct 06 2008 08:58:40 UTC Log message: * libs/gst/base/gstbasesink.c: (gst_base_sink_get_position), (gst_base_sink_query): Improve position reporting while flushing and other intermediate state changes. Fixes #553874. Modified files: . : ChangeLog libs/gst/base : gstbasesink.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4071&r2=1.4072 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.c.diff?r1=1.214&r2=1.215 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4071 retrieving revision 1.4072 diff -u -d -r1.4071 -r1.4072 --- ChangeLog 6 Oct 2008 08:45:39 -0000 1.4071 +++ ChangeLog 6 Oct 2008 08:58:23 -0000 1.4072 @@ -1,5 +1,12 @@ 2008-10-06 Wim Taymans <wim...@co...> + * libs/gst/base/gstbasesink.c: (gst_base_sink_get_position), + (gst_base_sink_query): + Improve position reporting while flushing and other intermediate state + changes. Fixes #553874. + +2008-10-06 Wim Taymans <wim...@co...> Patch by: Antoine Tremblay <hexa00 at gmail dot com> * gst/gstpad.c: (gst_pad_link_check_compatible_unlocked): Index: gstbasesink.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.c,v retrieving revision 1.214 retrieving revision 1.215 diff -u -d -r1.214 -r1.215 --- gstbasesink.c 19 Aug 2008 16:47:06 -0000 1.214 +++ gstbasesink.c 6 Oct 2008 08:58:25 -0000 1.215 @@ -3225,7 +3225,7 @@ static gboolean gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format, - gint64 * cur) + gint64 * cur, gboolean * upstream) { GstClock *clock; gboolean res = FALSE; @@ -3320,8 +3320,8 @@ break; } default: - /* cannot answer other than TIME, we return FALSE, which will - * send the query upstream. */ + /* cannot answer other than TIME, ask to send the query upstream. */ + *upstream = TRUE; } @@ -3347,7 +3347,7 @@ wrong_state: { - /* in NULL or READY we always return 0 */ + /* in NULL or READY we always return FALSE and -1 */ GST_DEBUG_OBJECT (basesink, "position in wrong state, return -1"); res = FALSE; *cur = -1; @@ -3356,10 +3356,12 @@ no_sync: - /* report last seen timestamp if any, else return FALSE so - * that upstream can answer */ + /* report last seen timestamp if any, else ask upstream to answer */ if ((*cur = basesink->priv->current_sstart) != -1) res = TRUE; + else GST_DEBUG_OBJECT (basesink, "no sync, res %d, POSITION %" GST_TIME_FORMAT, res, GST_TIME_ARGS (*cur)); GST_OBJECT_UNLOCK (basesink); @@ -3379,15 +3381,17 @@ { gint64 cur = 0; GstFormat format; + gboolean upstream = FALSE; gst_query_parse_position (query, &format, NULL); GST_DEBUG_OBJECT (basesink, "position format %d", format); /* first try to get the position based on the clock */ - if ((res = gst_base_sink_get_position (basesink, format, &cur))) { + if ((res = + gst_base_sink_get_position (basesink, format, &cur, &upstream))) { gst_query_set_position (query, format, cur); - } else { + } else if (upstream) { /* fallback to peer query */ res = gst_base_sink_peer_query (basesink, query); } |
From: <wt...@ke...> - 2008-10-08 14:21:41
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Wed Oct 08 2008 14:21:27 UTC Log message: * libs/gst/base/gstbasesink.c: (gst_base_sink_send_event): Forward LATENCY events upstreams so that elements know about the total pipeline latency. Fixes #555307. Modified files: . : ChangeLog libs/gst/base : gstbasesink.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4090&r2=1.4091 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.c.diff?r1=1.215&r2=1.216 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4090 retrieving revision 1.4091 diff -u -d -r1.4090 -r1.4091 --- ChangeLog 8 Oct 2008 11:20:15 -0000 1.4090 +++ ChangeLog 8 Oct 2008 14:21:10 -0000 1.4091 @@ -1,3 +1,9 @@ +2008-10-08 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasesink.c: (gst_base_sink_send_event): + Forward LATENCY events upstreams so that elements know about the total + pipeline latency. Fixes #555307. 2008-10-08 Jan Schmidt <jan...@su...> * plugins/elements/gstqueue.c: Index: gstbasesink.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.c,v retrieving revision 1.215 retrieving revision 1.216 diff -u -d -r1.215 -r1.216 --- gstbasesink.c 6 Oct 2008 08:58:25 -0000 1.215 +++ gstbasesink.c 8 Oct 2008 14:21:13 -0000 1.216 @@ -1605,6 +1605,9 @@ * to a state change to READY or a FLUSH event (in which case this function * returns #GST_FLOW_WRONG_STATE). * + * 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 @@ -3128,13 +3131,9 @@ GST_DEBUG_OBJECT (basesink, "latency set to %" GST_TIME_FORMAT, GST_TIME_ARGS (latency)); - /* don't forward, yet. FIXME. The latency event should likely be forwarded - * to upstream element so that they can configure themselves. Each element - * would subtract the amount of LATENCY it can maximally compensate for. - * It's currently not very useful; even if this sink cannot compensate for - * all the latency, upstream will block while this sink waits which will - * trigger implicit buffering and latency there. */ - forward = FALSE; + /* We forward this event so that all elements know about the global pipeline + * latency. This is interesting for an element when it wants to figure out + * when a particular piece of data will be rendered. */ break; } default: |
From: <wt...@ke...> - 2008-10-16 13:57:16
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Thu Oct 16 2008 13:57:06 UTC Log message: * libs/gst/base/gstbasesrc.c: (gst_base_src_class_init): Update some docs. Modified files: . : ChangeLog libs/gst/base : gstbasesrc.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4107&r2=1.4108 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesrc.c.diff?r1=1.165&r2=1.166 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4107 retrieving revision 1.4108 diff -u -d -r1.4107 -r1.4108 --- ChangeLog 14 Oct 2008 17:10:40 -0000 1.4107 +++ ChangeLog 16 Oct 2008 13:56:49 -0000 1.4108 @@ -1,3 +1,8 @@ +2008-10-16 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasesrc.c: (gst_base_src_class_init): + Update some docs. 2008-10-14 Tim-Philipp Müller <tim.muller at collabora co uk> * gst/gstquark.c: (_priv_gst_quarks_initialize): Index: gstbasesrc.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesrc.c,v retrieving revision 1.165 retrieving revision 1.166 diff -u -d -r1.165 -r1.166 --- gstbasesrc.c 10 Oct 2008 10:01:36 -0000 1.165 +++ gstbasesrc.c 16 Oct 2008 13:56:52 -0000 1.166 @@ -328,12 +328,13 @@ g_object_class_install_property (gobject_class, PROP_BLOCKSIZE, g_param_spec_ulong ("blocksize", "Block size", - "Size in bytes to read per buffer (0 = default)", 0, G_MAXULONG, + "Size in bytes to read per buffer (-1 = default)", 0, G_MAXULONG, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_NUM_BUFFERS, g_param_spec_int ("num-buffers", "num-buffers", - "Number of buffers to output before sending EOS", -1, G_MAXINT, - DEFAULT_NUM_BUFFERS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + "Number of buffers to output before sending EOS (-1 = unlimited)", + -1, G_MAXINT, DEFAULT_NUM_BUFFERS, G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_TYPEFIND, g_param_spec_boolean ("typefind", "Typefind", "Run typefind before negotiating", DEFAULT_TYPEFIND, @@ -597,7 +598,8 @@ * @src: the source * @blocksize: the new blocksize in bytes * - * Set the number of bytes that @src will push out with each buffer. + * Set the number of bytes that @src will push out with each buffer. When + * @blocksize is set to -1, a default length will be used. * Since: 0.10.22 */ |
From: <wt...@ke...> - 2008-10-17 13:28:25
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Fri Oct 17 2008 13:28:15 UTC Log message: * libs/gst/base/gstbasesink.c: (gst_base_sink_pad_activate_pull), (gst_base_sink_query): Query the total number of bytes when activating the pad in pull mode. Implement duration query in pull mode by using the installed pad convert function to convert from bytes to the requested format. Modified files: . : ChangeLog libs/gst/base : gstbasesink.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4109&r2=1.4110 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.c.diff?r1=1.219&r2=1.220 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4109 retrieving revision 1.4110 diff -u -d -r1.4109 -r1.4110 --- ChangeLog 16 Oct 2008 14:09:15 -0000 1.4109 +++ ChangeLog 17 Oct 2008 13:27:55 -0000 1.4110 @@ -1,3 +1,11 @@ +2008-10-17 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasesink.c: (gst_base_sink_pad_activate_pull), + (gst_base_sink_query): + Query the total number of bytes when activating the pad in pull mode. + Implement duration query in pull mode by using the installed pad convert + function to convert from bytes to the requested format. 2008-10-16 Wim Taymans <wim...@co...> * docs/libs/gstreamer-libs-sections.txt: Index: gstbasesink.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.c,v retrieving revision 1.219 retrieving revision 1.220 diff -u -d -r1.219 -r1.220 --- gstbasesink.c 16 Oct 2008 14:09:17 -0000 1.219 +++ gstbasesink.c 17 Oct 2008 13:27:59 -0000 1.220 @@ -3290,20 +3290,40 @@ bclass = GST_BASE_SINK_GET_CLASS (basesink); if (active) { + GstFormat format; + gint64 duration; /* we mark we have a newsegment here because pull based * mode works just fine without having a newsegment before the * first buffer */ - gst_segment_init (&basesink->segment, GST_FORMAT_BYTES); - gst_segment_init (basesink->abidata.ABI.clip_segment, GST_FORMAT_BYTES); + format = GST_FORMAT_BYTES; + gst_segment_init (&basesink->segment, format); + gst_segment_init (basesink->abidata.ABI.clip_segment, format); GST_OBJECT_LOCK (basesink); basesink->have_newsegment = TRUE; GST_OBJECT_UNLOCK (basesink); + /* get the peer duration in bytes */ + result = gst_pad_query_peer_duration (pad, &format, &duration); + if (result) { + GST_DEBUG_OBJECT (basesink, + "setting duration in bytes to %" G_GINT64_FORMAT, duration); + gst_segment_set_duration (basesink->abidata.ABI.clip_segment, format, + duration); + gst_segment_set_duration (&basesink->segment, format, duration); + } else { + GST_DEBUG_OBJECT (basesink, "unknown duration"); + } if (bclass->activate_pull) result = bclass->activate_pull (basesink, TRUE); else result = FALSE; + if (!result) + goto activate_failed; /* but if starting the thread fails, set it back */ if (!result) basesink->pad_mode = GST_ACTIVATE_NONE; @@ -3325,6 +3345,13 @@ gst_object_unref (basesink); return result; + /* ERRORS */ +activate_failed: + { + GST_ERROR_OBJECT (basesink, "subclass failed to activate in pull mode"); + return FALSE; + } } /* send an event to our sinkpad peer. */ @@ -3627,9 +3654,39 @@ break; } case GST_QUERY_DURATION: - GST_DEBUG_OBJECT (basesink, "duration query"); - res = gst_base_sink_peer_query (basesink, query); + { + GstFormat format, uformat; + gint64 duration, uduration; + gst_query_parse_duration (query, &format, NULL); + GST_DEBUG_OBJECT (basesink, "duration query in format %s", + gst_format_get_name (format)); + if (basesink->pad_mode == GST_ACTIVATE_PULL) { + uformat = GST_FORMAT_BYTES; + /* get the duration in bytes, in pull mode that's all we are sure to + * know. */ + res = gst_pad_query_peer_duration (basesink->sinkpad, &uformat, + &uduration); + if (res && format != uformat) { + /* convert to the requested format */ + res = gst_pad_query_convert (basesink->sinkpad, uformat, uduration, + &format, &duration); + } else { + duration = uduration; + } + if (res) { + /* set the result */ + gst_query_set_duration (query, format, duration); + } else { + /* in push mode we simply forward upstream */ + res = gst_base_sink_peer_query (basesink, query); + } case GST_QUERY_LATENCY: { gboolean live, us_live; |
From: <wt...@ke...> - 2008-10-20 15:18:34
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Mon Oct 20 2008 15:18:28 UTC Log message: * libs/gst/base/gstbasesink.c: (gst_base_sink_default_do_seek), (gst_base_sink_default_prepare_seek_segment), (gst_base_sink_perform_seek), (gst_base_sink_get_position_last), (gst_base_sink_get_position_paused), (gst_base_sink_get_position), (gst_base_sink_query): Implement more seeking in pull mode. Use pad convert functions to convert position to the requested format. Fix position/duration reporting in pull mode. Implement position and duration reporting in other formats than time. * libs/gst/base/gstbasesink.h: Add member to keep track of when the segment is playing. Modified files: . : ChangeLog libs/gst/base : gstbasesink.c gstbasesink.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4114&r2=1.4115 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.c.diff?r1=1.220&r2=1.221 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.h.diff?r1=1.52&r2=1.53 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4114 retrieving revision 1.4115 diff -u -d -r1.4114 -r1.4115 --- ChangeLog 20 Oct 2008 13:32:05 -0000 1.4114 +++ ChangeLog 20 Oct 2008 15:18:11 -0000 1.4115 @@ -1,5 +1,20 @@ 2008-10-20 Wim Taymans <wim...@co...> + * libs/gst/base/gstbasesink.c: (gst_base_sink_default_do_seek), + (gst_base_sink_default_prepare_seek_segment), + (gst_base_sink_perform_seek), (gst_base_sink_get_position_last), + (gst_base_sink_get_position_paused), (gst_base_sink_get_position), + (gst_base_sink_query): + Implement more seeking in pull mode. + Use pad convert functions to convert position to the requested format. + Fix position/duration reporting in pull mode. + Implement position and duration reporting in other formats than time. + + * libs/gst/base/gstbasesink.h: + Add member to keep track of when the segment is playing. +2008-10-20 Wim Taymans <wim...@co...> * gst/gstpad.c: (gst_pad_configure_src): When we use gst_pad_alloc_buffer() without wanting to set the caps we also don't need to check if the caps are compatible because the caller Index: gstbasesink.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.c,v retrieving revision 1.220 retrieving revision 1.221 diff -u -d -r1.220 -r1.221 --- gstbasesink.c 17 Oct 2008 13:27:59 -0000 1.220 +++ gstbasesink.c 20 Oct 2008 15:18:13 -0000 1.221 @@ -216,6 +216,8 @@ GstCaps *pull_caps; guint blocksize; + gboolean discont; }; #define DO_RUNNING_AVG(avg,val,size) (((val) + ((size)-1) * (avg)) / (size)) @@ -305,6 +307,10 @@ GstPad * pad, gboolean flushing); static gboolean gst_base_sink_default_activate_pull (GstBaseSink * basesink, gboolean active); +static gboolean gst_base_sink_default_do_seek (GstBaseSink * sink, + GstSegment * segment); +static gboolean gst_base_sink_default_prepare_seek_segment (GstBaseSink * sink, + GstEvent * event, GstSegment * segment); static GstStateChangeReturn gst_base_sink_change_state (GstElement * element, GstStateChange transition); @@ -2931,50 +2937,201 @@ } } +static gboolean +gst_base_sink_default_do_seek (GstBaseSink * sink, GstSegment * segment) +{ + gboolean res = TRUE; + /* update our offset if the start/stop position was updated */ + if (segment->format == GST_FORMAT_BYTES) { + segment->time = segment->start; + } else if (segment->start == 0) { + /* seek to start, we can implement a default for this. */ + segment->time = 0; + } else { + res = FALSE; + GST_INFO_OBJECT (sink, "Can't do a default seek"); + } + return res; +} +#define SEEK_TYPE_IS_RELATIVE(t) (((t) != GST_SEEK_TYPE_NONE) && ((t) != GST_SEEK_TYPE_SET)) +gst_base_sink_default_prepare_seek_segment (GstBaseSink * sink, + GstEvent * event, GstSegment * segment) + /* By default, we try one of 2 things: + * - For absolute seek positions, convert the requested position to our + * configured processing format and place it in the output segment \ + * - For relative seek positions, convert our current (input) values to the + * seek format, adjust by the relative seek offset and then convert back to + * the processing format + */ + GstSeekType cur_type, stop_type; + gint64 cur, stop; + GstSeekFlags flags; + GstFormat seek_format, dest_format; + gdouble rate; + gboolean update; + gst_event_parse_seek (event, &rate, &seek_format, &flags, + &cur_type, &cur, &stop_type, &stop); + dest_format = segment->format; + if (seek_format == dest_format) { + gst_segment_set_seek (segment, rate, seek_format, flags, + cur_type, cur, stop_type, stop, &update); + return TRUE; + if (cur_type != GST_SEEK_TYPE_NONE) { + /* FIXME: Handle seek_cur & seek_end by converting the input segment vals */ + res = + gst_pad_query_convert (sink->sinkpad, seek_format, cur, &dest_format, + &cur); + cur_type = GST_SEEK_TYPE_SET; + if (res && stop_type != GST_SEEK_TYPE_NONE) { + gst_pad_query_convert (sink->sinkpad, seek_format, stop, &dest_format, + &stop); + stop_type = GST_SEEK_TYPE_SET; + /* And finally, configure our output segment in the desired format */ + gst_segment_set_seek (segment, rate, dest_format, flags, cur_type, cur, + stop_type, stop, &update); + if (!res) + goto no_format; +no_format: + { + GST_DEBUG_OBJECT (sink, "undefined format given, seek aborted."); + return FALSE; /* perform a seek, only executed in pull mode */ static gboolean -gst_base_sink_perform_seek (GstBaseSink * basesink, GstPad * pad, - GstEvent * event) +gst_base_sink_perform_seek (GstBaseSink * sink, GstPad * pad, GstEvent * event) { gboolean flush; gdouble rate; - GstFormat seek_format; GstSeekFlags flags; GstSeekType cur_type, stop_type; + gboolean seekseg_configured = FALSE; gint64 cur, stop; + gboolean update, res = TRUE; + GstSegment seeksegment; + dest_format = sink->segment.format; if (event) { - GST_DEBUG_OBJECT (basesink, "performing seek with event %p", event); + GST_DEBUG_OBJECT (sink, "performing seek with event %p", event); gst_event_parse_seek (event, &rate, &seek_format, &flags, &cur_type, &cur, &stop_type, &stop); flush = flags & GST_SEEK_FLAG_FLUSH; } else { - GST_DEBUG_OBJECT (basesink, "performing seek without event"); + GST_DEBUG_OBJECT (sink, "performing seek without event"); flush = FALSE; if (flush) { - GST_DEBUG_OBJECT (basesink, "flushing upstream"); + GST_DEBUG_OBJECT (sink, "flushing upstream"); gst_pad_push_event (pad, gst_event_new_flush_start ()); - gst_base_sink_flush_start (basesink, pad); + gst_base_sink_flush_start (sink, pad); - GST_DEBUG_OBJECT (basesink, "pausing pulling thread"); + GST_DEBUG_OBJECT (sink, "pausing pulling thread"); GST_PAD_STREAM_LOCK (pad); + /* If we configured the seeksegment above, don't overwrite it now. Otherwise + * copy the current segment info into the temp segment that we can actually + * attempt the seek with. We only update the real segment if the seek suceeds. */ + if (!seekseg_configured) { + memcpy (&seeksegment, &sink->segment, sizeof (GstSegment)); + /* now configure the final seek segment */ + if (event) { + if (sink->segment.format != seek_format) { + /* OK, here's where we give the subclass a chance to convert the relative + * seek into an absolute one in the processing format. We set up any + * absolute seek above, before taking the stream lock. */ + if (!gst_base_sink_default_prepare_seek_segment (sink, event, + &seeksegment)) { + GST_DEBUG_OBJECT (sink, + "Preparing the seek failed after flushing. " "Aborting seek"); + res = FALSE; + } + } else { + /* The seek format matches our processing format, no need to ask the + * the subclass to configure the segment. */ + gst_segment_set_seek (&seeksegment, rate, seek_format, flags, + cur_type, cur, stop_type, stop, &update); + } + } + /* Else, no seek event passed, so we're just (re)starting the + current segment. */ + if (res) { + GST_DEBUG_OBJECT (sink, "segment configured from %" G_GINT64_FORMAT + " to %" G_GINT64_FORMAT ", position %" G_GINT64_FORMAT, + seeksegment.start, seeksegment.stop, seeksegment.last_stop); + /* do the seek, segment.last_stop contains the new position. */ + res = gst_base_sink_default_do_seek (sink, &seeksegment); - GST_DEBUG_OBJECT (basesink, "stop flushing upstream"); + GST_DEBUG_OBJECT (sink, "stop flushing upstream"); gst_pad_push_event (pad, gst_event_new_flush_stop ()); - gst_base_sink_flush_stop (basesink, pad); - } else { - GST_DEBUG_OBJECT (basesink, "restarting pulling thread"); + gst_base_sink_flush_stop (sink, pad); + } else if (res && sink->abidata.ABI.running) { + /* we are running the current segment and doing a non-flushing seek, + * close the segment first based on the last_stop. */ + GST_DEBUG_OBJECT (sink, "closing running segment %" G_GINT64_FORMAT + " to %" G_GINT64_FORMAT, sink->segment.start, sink->segment.last_stop); + /* The subclass must have converted the segment to the processing format + * by now */ + if (res && seeksegment.format != dest_format) { + GST_DEBUG_OBJECT (sink, "Subclass failed to prepare a seek segment " + "in the correct format. Aborting seek."); + /* if successfull seek, we update our real segment and push + * out the new segment. */ + memcpy (&sink->segment, &seeksegment, sizeof (GstSegment)); + if (sink->segment.flags & GST_SEEK_FLAG_SEGMENT) { + gst_element_post_message (GST_ELEMENT (sink), + gst_message_new_segment_start (GST_OBJECT (sink), + sink->segment.format, sink->segment.last_stop)); + sink->priv->discont = TRUE; + sink->abidata.ABI.running = TRUE; GST_PAD_STREAM_UNLOCK (pad); - return FALSE; /* with STREAM_LOCK @@ -3429,28 +3586,63 @@ * for EOS and for making sure that we don't report a position we * have not reached yet. */ -gst_base_sink_get_position_last (GstBaseSink * basesink, gint64 * cur) +gst_base_sink_get_position_last (GstBaseSink * basesink, GstFormat format, + gint64 * cur) - /* return last observed stream time */ - *cur = basesink->priv->current_sstop; + GstFormat oformat; + GstSegment *segment; + gboolean ret = TRUE; + segment = &basesink->segment; + oformat = segment->format; + if (oformat == GST_FORMAT_TIME) { + /* return last observed stream time, we keep the stream time around in the + * time format. */ + *cur = basesink->priv->current_sstop; + /* convert last stop to stream time */ + *cur = gst_segment_to_stream_time (segment, oformat, segment->last_stop); + if (*cur != -1 && oformat != format) { + /* convert to the target format if we need to */ + ret = + gst_pad_query_convert (basesink->sinkpad, oformat, *cur, &format, cur); GST_DEBUG_OBJECT (basesink, "POSITION: %" GST_TIME_FORMAT, GST_TIME_ARGS (*cur)); - return TRUE; + return ret; /* get the position when we are PAUSED, this is the stream time of the buffer * that prerolled. If no buffer is prerolled (we are still flushing), this * value will be -1. */ -gst_base_sink_get_position_paused (GstBaseSink * basesink, gint64 * cur) +gst_base_sink_get_position_paused (GstBaseSink * basesink, GstFormat format, gboolean res; gint64 time; GstSegment *segment; - *cur = basesink->priv->current_sstart; - segment = basesink->abidata.ABI.clip_segment; + /* we don't use the clip segment in pull mode, when seeking we update the + * main segment directly with the new segment values without it having to be + * activated by the rendering after preroll */ + if (basesink->pad_mode == GST_ACTIVATE_PUSH) + segment = basesink->abidata.ABI.clip_segment; + else + segment = &basesink->segment; + *cur = basesink->priv->current_sstart; time = segment->time; @@ -3468,13 +3660,16 @@ } else { /* reverse, next expected timestamp is segment->stop. We use the function * to get things right for negative applied_rates. */ - *cur = - gst_segment_to_stream_time (segment, GST_FORMAT_TIME, segment->stop); + *cur = gst_segment_to_stream_time (segment, oformat, segment->stop); GST_DEBUG_OBJECT (basesink, "reverse POSITION: %" GST_TIME_FORMAT, GST_TIME_ARGS (*cur)); } res = (*cur != -1); + if (res && oformat != format) { return res; @@ -3485,102 +3680,114 @@ GstClock *clock; gboolean res = FALSE; + GstFormat oformat, tformat; + GstClockTime now, base, latency; + gint64 time, accum, duration; + gint64 last; - switch (format) { - /* we can answer time format */ - case GST_FORMAT_TIME: - { - GstClockTime now, base, latency; - gint64 time, accum, duration; - gdouble rate; - gint64 last; + GST_OBJECT_LOCK (basesink); + /* our intermediate time format */ + tformat = GST_FORMAT_TIME; + /* get the format in the segment */ + oformat = basesink->segment.format; - GST_OBJECT_LOCK (basesink); + /* can only give answer based on the clock if not EOS */ + if (G_UNLIKELY (basesink->eos)) + goto in_eos; - /* can only give answer based on the clock if not EOS */ - if (G_UNLIKELY (basesink->eos)) - goto in_eos; + /* we can only get the segment when we are not NULL or READY */ + if (!basesink->have_newsegment) + goto wrong_state; - /* we can only get the segment when we are not NULL or READY */ - if (!basesink->have_newsegment) - goto wrong_state; + /* when not in PLAYING or when we're busy with a state change, we + * cannot read from the clock so we report time based on the + * last seen timestamp. */ + if (GST_STATE (basesink) != GST_STATE_PLAYING || + GST_STATE_PENDING (basesink) != GST_STATE_VOID_PENDING) + goto in_pause; - /* when not in PLAYING or when we're busy with a state change, we - * cannot read from the clock so we report time based on the - * last seen timestamp. */ - if (GST_STATE (basesink) != GST_STATE_PLAYING || - GST_STATE_PENDING (basesink) != GST_STATE_VOID_PENDING) - goto in_pause; + /* we need to sync on the clock. */ + if (basesink->sync == FALSE) + goto no_sync; - /* we need to sync on the clock. */ - if (basesink->sync == FALSE) - goto no_sync; + /* and we need a clock */ + if (G_UNLIKELY ((clock = GST_ELEMENT_CLOCK (basesink)) == NULL)) - /* and we need a clock */ - if (G_UNLIKELY ((clock = GST_ELEMENT_CLOCK (basesink)) == NULL)) + /* collect all data we need holding the lock */ + if (GST_CLOCK_TIME_IS_VALID (basesink->segment.time)) + time = basesink->segment.time; + time = 0; - /* collect all data we need holding the lock */ - if (GST_CLOCK_TIME_IS_VALID (basesink->segment.time)) - time = basesink->segment.time; - else - time = 0; + if (GST_CLOCK_TIME_IS_VALID (basesink->segment.stop)) + duration = basesink->segment.stop - basesink->segment.start; + duration = 0; - if (GST_CLOCK_TIME_IS_VALID (basesink->segment.stop)) - duration = basesink->segment.stop - basesink->segment.start; - duration = 0; + base = GST_ELEMENT_CAST (basesink)->base_time; + accum = basesink->segment.accum; + rate = basesink->segment.rate * basesink->segment.applied_rate; + gst_base_sink_get_position_last (basesink, format, &last); + latency = basesink->priv->latency; - base = GST_ELEMENT_CAST (basesink)->base_time; - accum = basesink->segment.accum; - rate = basesink->segment.rate * basesink->segment.applied_rate; - gst_base_sink_get_position_last (basesink, &last); - latency = basesink->priv->latency; + gst_object_ref (clock); + /* need to release the object lock before we can get the time, + * a clock might take the LOCK of the provider, which could be + * a basesink subclass. */ + GST_OBJECT_UNLOCK (basesink); - gst_object_ref (clock); - /* need to release the object lock before we can get the time, - * a clock might take the LOCK of the provider, which could be - * a basesink subclass. */ - GST_OBJECT_UNLOCK (basesink); + now = gst_clock_get_time (clock); - now = gst_clock_get_time (clock); + if (oformat != tformat) { + /* convert accum, time and duration to time */ + if (!gst_pad_query_convert (basesink->sinkpad, oformat, accum, &tformat, + &accum)) + goto convert_failed; + if (!gst_pad_query_convert (basesink->sinkpad, oformat, duration, &tformat, + &duration)) + if (!gst_pad_query_convert (basesink->sinkpad, oformat, time, &tformat, + &time)) - /* subtract base time and accumulated time from the clock time. - * Make sure we don't go negative. This is the current time in - * the segment which we need to scale with the combined - * rate and applied rate. */ - base += accum; - base += latency; - base = MIN (now, base); + /* subtract base time and accumulated time from the clock time. + * Make sure we don't go negative. This is the current time in + * the segment which we need to scale with the combined + * rate and applied rate. */ + base += accum; + base += latency; + base = MIN (now, base); - /* for negative rates we need to count back from from the segment - * duration. */ - if (rate < 0.0) - time += duration; + /* for negative rates we need to count back from from the segment + * duration. */ + if (rate < 0.0) + time += duration; - *cur = time + gst_guint64_to_gdouble (now - base) * rate; + *cur = time + gst_guint64_to_gdouble (now - base) * rate; - /* never report more than last seen position */ - if (last != -1) - *cur = MIN (last, *cur); + /* never report more than last seen position */ + if (last != -1) + *cur = MIN (last, *cur); - gst_object_unref (clock); + gst_object_unref (clock); - res = TRUE; + GST_DEBUG_OBJECT (basesink, + "now %" GST_TIME_FORMAT " - base %" GST_TIME_FORMAT " - accum %" + GST_TIME_FORMAT " + time %" GST_TIME_FORMAT, + GST_TIME_ARGS (now), GST_TIME_ARGS (base), + GST_TIME_ARGS (accum), GST_TIME_ARGS (time)); - GST_DEBUG_OBJECT (basesink, - "now %" GST_TIME_FORMAT " - base %" GST_TIME_FORMAT " - accum %" - GST_TIME_FORMAT " + time %" GST_TIME_FORMAT, - GST_TIME_ARGS (now), GST_TIME_ARGS (base), - GST_TIME_ARGS (accum), GST_TIME_ARGS (time)); - break; - } - default: - /* cannot answer other than TIME, ask to send the query upstream. */ - *upstream = TRUE; + if (oformat != format) { + /* convert time to final format */ + if (!gst_pad_query_convert (basesink->sinkpad, tformat, *cur, &format, cur)) + res = TRUE; done: GST_DEBUG_OBJECT (basesink, "res: %d, POSITION: %" GST_TIME_FORMAT, res, GST_TIME_ARGS (*cur)); @@ -3590,14 +3797,14 @@ in_eos: { GST_DEBUG_OBJECT (basesink, "position in EOS"); - res = gst_base_sink_get_position_last (basesink, cur); + res = gst_base_sink_get_position_last (basesink, format, cur); GST_OBJECT_UNLOCK (basesink); goto done; in_pause: GST_DEBUG_OBJECT (basesink, "position in PAUSED"); - res = gst_base_sink_get_position_paused (basesink, cur); + res = gst_base_sink_get_position_paused (basesink, format, cur); @@ -3623,6 +3830,12 @@ return res; +convert_failed: + GST_DEBUG_OBJECT (basesink, "convert failed, try upstream"); + *upstream = TRUE; @@ -3667,19 +3880,24 @@ uformat = GST_FORMAT_BYTES; /* get the duration in bytes, in pull mode that's all we are sure to - * know. */ + * know. We have to explicitly get this value from upstream instead of + * using our cached value because it might change. Duration caching + * should be done at a higher level. */ res = gst_pad_query_peer_duration (basesink->sinkpad, &uformat, &uduration); - if (res && format != uformat) { - /* convert to the requested format */ - res = gst_pad_query_convert (basesink->sinkpad, uformat, uduration, - &format, &duration); - } else { - duration = uduration; - } if (res) { - /* set the result */ - gst_query_set_duration (query, format, duration); + gst_segment_set_duration (&basesink->segment, uformat, uduration); + if (format != uformat) { + /* convert to the requested format */ + res = gst_pad_query_convert (basesink->sinkpad, uformat, uduration, + &format, &duration); + } else { + duration = uduration; + } + if (res) { + /* set the result */ + gst_query_set_duration (query, format, duration); } } else { /* in push mode we simply forward upstream */ Index: gstbasesink.h RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.h,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- gstbasesink.h 16 Oct 2008 14:09:18 -0000 1.52 +++ gstbasesink.h 20 Oct 2008 15:18:14 -0000 1.53 @@ -95,6 +95,7 @@ GstSegment *clip_segment; /* max amount of time a buffer can be late, -1 no limit. */ gint64 max_lateness; + gboolean running; } ABI; gpointer _gst_reserved[GST_PADDING_LARGE - 1]; } abidata; |
From: <wt...@ke...> - 2008-10-21 16:31:02
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Tue Oct 21 2008 16:30:55 UTC Log message: * libs/gst/base/gstbasetransform.c: (gst_base_transform_prepare_output_buffer), (gst_base_transform_buffer_alloc), (gst_base_transform_suggest): Protect sink_alloc caps with the sinkpad lock to avoid nasty caps refcount problems as seen in banshee and maybe also in farsight2. Remove atomic int now that we need to take the lock anyways. Modified files: . : ChangeLog libs/gst/base : gstbasetransform.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4115&r2=1.4116 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c.diff?r1=1.126&r2=1.127 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4115 retrieving revision 1.4116 diff -u -d -r1.4115 -r1.4116 --- ChangeLog 20 Oct 2008 15:18:11 -0000 1.4115 +++ ChangeLog 21 Oct 2008 16:30:38 -0000 1.4116 @@ -1,3 +1,12 @@ +2008-10-21 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasetransform.c: + (gst_base_transform_prepare_output_buffer), + (gst_base_transform_buffer_alloc), (gst_base_transform_suggest): + Protect sink_alloc caps with the sinkpad lock to avoid nasty caps + refcount problems as seen in banshee and maybe also in farsight2. + Remove atomic int now that we need to take the lock anyways. 2008-10-20 Wim Taymans <wim...@co...> * libs/gst/base/gstbasesink.c: (gst_base_sink_default_do_seek), Index: gstbasetransform.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v retrieving revision 1.126 retrieving revision 1.127 diff -u -d -r1.126 -r1.127 --- gstbasetransform.c 20 Oct 2008 13:29:06 -0000 1.126 +++ gstbasetransform.c 21 Oct 2008 16:30:41 -0000 1.127 @@ -251,7 +251,7 @@ /* upstream caps and size suggestions */ GstCaps *sink_suggest; guint size_suggest; - gint suggest_pending; + gboolean suggest_pending; gboolean reconfigure; }; @@ -1224,7 +1224,7 @@ gst_caps_unref (priv->sink_suggest); priv->sink_suggest = gst_caps_ref (othercaps); priv->size_suggest = size_suggest; - g_atomic_int_set (&trans->priv->suggest_pending, 1); + trans->priv->suggest_pending = TRUE; GST_OBJECT_UNLOCK (trans->sinkpad); } gst_caps_unref (othercaps); @@ -1366,7 +1366,7 @@ GstBaseTransform *trans; GstBaseTransformPrivate *priv; GstFlowReturn res; - gboolean proxy, suggest; + gboolean proxy, suggest, same_caps; @@ -1384,8 +1384,12 @@ /* we remember our previous alloc request to quickly see if we can proxy or * not. We skip this check if we have a pending suggestion. */ - if (g_atomic_int_get (&priv->suggest_pending) == 0 && caps && - gst_caps_is_equal (priv->sink_alloc, caps)) { + GST_OBJECT_LOCK (pad); + same_caps = !priv->suggest_pending && caps && + gst_caps_is_equal (priv->sink_alloc, caps); + GST_OBJECT_UNLOCK (pad); + if (same_caps) { /* we have seen this before, see below if we need to proxy */ GST_DEBUG_OBJECT (trans, "have old caps"); sink_suggest = caps; @@ -1414,7 +1418,7 @@ size_suggest = size; suggest = FALSE; } - g_atomic_int_set (&priv->suggest_pending, 0); + priv->suggest_pending = FALSE; GST_OBJECT_UNLOCK (pad); /* check if we actually handle this format on the sinkpad */ @@ -1462,7 +1466,10 @@ } /* remember the new caps */ gst_caps_replace (&priv->sink_alloc, sink_suggest); proxy = priv->proxy_alloc; GST_DEBUG_OBJECT (trans, "doing default alloc, proxy %d", proxy); @@ -1487,11 +1494,13 @@ if (!gst_caps_is_equal (newcaps, caps)) { GST_DEBUG_OBJECT (trans, "caps are new"); /* we have new caps, see if we can proxy downstream */ - if (gst_pad_peer_accept_caps (trans->sinkpad, newcaps)) { + if (gst_pad_peer_accept_caps (pad, newcaps)) { /* peer accepts the caps, return a buffer in this format */ GST_DEBUG_OBJECT (trans, "peer accepted new caps"); /* remember the format */ + GST_OBJECT_LOCK (pad); gst_caps_replace (&priv->sink_alloc, newcaps); + GST_OBJECT_UNLOCK (pad); } else { GST_DEBUG_OBJECT (trans, "peer did not accept new caps"); /* peer does not accept the caps, free the buffer we received and @@ -2306,7 +2315,7 @@ caps = gst_caps_copy (caps); trans->priv->sink_suggest = caps; trans->priv->size_suggest = size; - g_atomic_int_set (&trans->priv->suggest_pending, 1); + trans->priv->suggest_pending = TRUE; GST_DEBUG_OBJECT (trans, "new suggest %" GST_PTR_FORMAT, caps); GST_OBJECT_UNLOCK (trans->sinkpad); } |
From: <wt...@ke...> - 2008-10-24 09:45:54
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Fri Oct 24 2008 09:41:33 UTC Log message: * libs/gst/base/gstbasetransform.c: (gst_base_transform_prepare_output_buffer), (gst_base_transform_getrange): Clear the output buffer variable. Cleanups to the error path in the getrange function. Fixes #557649. Modified files: . : ChangeLog libs/gst/base : gstbasetransform.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4123&r2=1.4124 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c.diff?r1=1.127&r2=1.128 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4123 retrieving revision 1.4124 diff -u -d -r1.4123 -r1.4124 --- ChangeLog 23 Oct 2008 12:52:56 -0000 1.4123 +++ ChangeLog 24 Oct 2008 09:41:16 -0000 1.4124 @@ -1,3 +1,12 @@ +2008-10-24 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasetransform.c: + (gst_base_transform_prepare_output_buffer), + (gst_base_transform_getrange): + Clear the output buffer variable. + Cleanups to the error path in the getrange function. + Fixes #557649. 2008-10-23 Sebastian Dröge <sl...@ci...> * plugins/elements/gstfdsrc.c: (gst_fd_src_create): Index: gstbasetransform.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v retrieving revision 1.127 retrieving revision 1.128 diff -u -d -r1.127 -r1.128 --- gstbasetransform.c 21 Oct 2008 16:30:41 -0000 1.127 +++ gstbasetransform.c 24 Oct 2008 09:41:19 -0000 1.128 @@ -1074,6 +1074,8 @@ priv = trans->priv; + *out_buf = NULL; /* figure out how to allocate a buffer based on the current configuration */ if (trans->passthrough) { GST_DEBUG_OBJECT (trans, "doing passthrough alloc"); @@ -1863,15 +1865,25 @@ trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); ret = gst_pad_pull_range (trans->sinkpad, offset, length, &inbuf); - if (ret == GST_FLOW_OK) { - GST_BASE_TRANSFORM_LOCK (trans); - ret = gst_base_transform_handle_buffer (trans, inbuf, buffer); - GST_BASE_TRANSFORM_UNLOCK (trans); - } + if (G_UNLIKELY (ret != GST_FLOW_OK)) + goto pull_error; + GST_BASE_TRANSFORM_LOCK (trans); + ret = gst_base_transform_handle_buffer (trans, inbuf, buffer); + GST_BASE_TRANSFORM_UNLOCK (trans); +done: gst_object_unref (trans); return ret; + /* ERRORS */ +pull_error: + { + GST_DEBUG_OBJECT (trans, "failed to pull a buffer: %s", + gst_flow_get_name (ret)); + goto done; + } } static GstFlowReturn |
From: <wt...@ke...> - 2008-10-27 15:03:09
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Mon Oct 27 2008 15:03:02 UTC Log message: * libs/gst/base/gstbasetransform.c: (gst_base_transform_find_transform), (gst_base_transform_getrange): If we have a fixate function, call it even if we already have fixed caps because the subclass might add some caps. Makes audioconvert add a default channel layout. Modified files: . : ChangeLog libs/gst/base : gstbasetransform.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4124&r2=1.4125 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c.diff?r1=1.128&r2=1.129 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4124 retrieving revision 1.4125 diff -u -d -r1.4124 -r1.4125 --- ChangeLog 24 Oct 2008 09:41:16 -0000 1.4124 +++ ChangeLog 27 Oct 2008 15:02:46 -0000 1.4125 @@ -1,3 +1,11 @@ +2008-10-27 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasetransform.c: + (gst_base_transform_find_transform), (gst_base_transform_getrange): + If we have a fixate function, call it even if we already have fixed caps + because the subclass might add some caps. Makes audioconvert add a + default channel layout. 2008-10-24 Wim Taymans <wim...@co...> * libs/gst/base/gstbasetransform.c: Index: gstbasetransform.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v retrieving revision 1.128 retrieving revision 1.129 diff -u -d -r1.128 -r1.129 --- gstbasetransform.c 24 Oct 2008 09:41:19 -0000 1.128 +++ gstbasetransform.c 27 Oct 2008 15:02:48 -0000 1.129 @@ -896,6 +896,18 @@ gst_pad_fixate_caps (otherpad, othercaps); } GST_DEBUG_OBJECT (trans, "after fixating %" GST_PTR_FORMAT, othercaps); + } else { + /* else caps are fixed but the subclass may want to add fields */ + if (klass->fixate_caps) { + othercaps = gst_caps_make_writable (othercaps); + GST_DEBUG_OBJECT (trans, "doing fixate %" GST_PTR_FORMAT + " using caps %" GST_PTR_FORMAT + " on pad %s:%s using fixate_caps vmethod", othercaps, caps, + GST_DEBUG_PAD_NAME (otherpad)); + klass->fixate_caps (trans, GST_PAD_DIRECTION (pad), caps, othercaps); + } } /* caps should be fixed now, if not we have to fail. */ |
From: <wt...@ke...> - 2008-11-20 14:23:29
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Thu Nov 20 2008 14:23:20 UTC Log message: * libs/gst/base/gstbasesink.c: (gst_base_sink_set_render_delay): Changing the render delay changes the latency and so we must post a latency message. Modified files: . : ChangeLog libs/gst/base : gstbasesink.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4164&r2=1.4165 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.c.diff?r1=1.222&r2=1.223 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4164 retrieving revision 1.4165 diff -u -d -r1.4164 -r1.4165 --- ChangeLog 20 Nov 2008 10:35:47 -0000 1.4164 +++ ChangeLog 20 Nov 2008 14:23:03 -0000 1.4165 @@ -1,5 +1,11 @@ 2008-11-20 Wim Taymans <wim...@co...> + * libs/gst/base/gstbasesink.c: (gst_base_sink_set_render_delay): + Changing the render delay changes the latency and so we must post a + latency message. + +2008-11-20 Wim Taymans <wim...@co...> * gst/gstquery.c: * gst/gstquery.h: Add GstQueryType for custom queries instead of having to use the Index: gstbasesink.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.c,v retrieving revision 1.222 retrieving revision 1.223 diff -u -d -r1.222 -r1.223 --- gstbasesink.c 4 Nov 2008 15:56:54 -0000 1.222 +++ gstbasesink.c 20 Nov 2008 14:23:05 -0000 1.223 @@ -1025,13 +1025,22 @@ void gst_base_sink_set_render_delay (GstBaseSink * sink, GstClockTime delay) { + GstClockTime old_render_delay; g_return_if_fail (GST_IS_BASE_SINK (sink)); GST_OBJECT_LOCK (sink); + old_render_delay = sink->priv->render_delay; sink->priv->render_delay = delay; GST_LOG_OBJECT (sink, "set render delay to %" GST_TIME_FORMAT, GST_TIME_ARGS (delay)); GST_OBJECT_UNLOCK (sink); + if (delay != old_render_delay) { + GST_DEBUG_OBJECT (sink, "posting latency changed"); + gst_element_post_message (GST_ELEMENT_CAST (sink), + gst_message_new_latency (GST_OBJECT_CAST (sink))); + } } /** |
From: <wt...@ke...> - 2008-11-21 17:15:12
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Fri Nov 21 2008 17:15:02 UTC Log message: * libs/gst/base/gstbasetransform.c: (gst_base_transform_init), (gst_base_transform_getcaps), (gst_base_transform_find_transform), (gst_base_transform_acceptcaps), (gst_base_transform_getrange): Add beginnings of a more optimized acceptcaps function than the default core one. Modified files: . : ChangeLog libs/gst/base : gstbasetransform.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4169&r2=1.4170 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c.diff?r1=1.129&r2=1.130 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4169 retrieving revision 1.4170 diff -u -d -r1.4169 -r1.4170 --- ChangeLog 21 Nov 2008 16:48:45 -0000 1.4169 +++ ChangeLog 21 Nov 2008 17:14:46 -0000 1.4170 @@ -1,5 +1,13 @@ 2008-11-21 Wim Taymans <wim...@co...> + * libs/gst/base/gstbasetransform.c: (gst_base_transform_init), + (gst_base_transform_getcaps), (gst_base_transform_find_transform), + (gst_base_transform_acceptcaps), (gst_base_transform_getrange): + Add beginnings of a more optimized acceptcaps function than the default + core one. + +2008-11-21 Wim Taymans <wim...@co...> * gst/gstpad.c: (gst_pad_accept_caps): Avoid getting the acceptcaps function too early. Index: gstbasetransform.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v retrieving revision 1.129 retrieving revision 1.130 diff -u -d -r1.129 -r1.130 --- gstbasetransform.c 27 Oct 2008 15:02:48 -0000 1.129 +++ gstbasetransform.c 21 Nov 2008 17:14:48 -0000 1.130 @@ -314,6 +314,7 @@ static GstFlowReturn gst_base_transform_chain (GstPad * pad, GstBuffer * buffer); static GstCaps *gst_base_transform_getcaps (GstPad * pad); +static gboolean gst_base_transform_acceptcaps (GstPad * pad, GstCaps * caps); static gboolean gst_base_transform_setcaps (GstPad * pad, GstCaps * caps); static GstFlowReturn gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); @@ -381,6 +382,8 @@ trans->sinkpad = gst_pad_new_from_template (pad_template, "sink"); gst_pad_set_getcaps_function (trans->sinkpad, GST_DEBUG_FUNCPTR (gst_base_transform_getcaps)); + gst_pad_set_acceptcaps_function (trans->sinkpad, + GST_DEBUG_FUNCPTR (gst_base_transform_acceptcaps)); gst_pad_set_setcaps_function (trans->sinkpad, GST_DEBUG_FUNCPTR (gst_base_transform_setcaps)); gst_pad_set_event_function (trans->sinkpad, @@ -399,6 +402,8 @@ trans->srcpad = gst_pad_new_from_template (pad_template, "src"); gst_pad_set_getcaps_function (trans->srcpad, + gst_pad_set_acceptcaps_function (trans->srcpad, gst_pad_set_event_function (trans->srcpad, GST_DEBUG_FUNCPTR (gst_base_transform_src_event)); gst_pad_set_checkgetrange_function (trans->srcpad, @@ -615,6 +620,7 @@ temp = gst_caps_intersect (caps, templ); GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp); gst_caps_unref (caps); /* then see what we can transform this to */ caps = gst_base_transform_transform_caps (trans, GST_PAD_DIRECTION (otherpad), temp); @@ -632,7 +638,7 @@ /* this is what we can do */ caps = temp; } else { - /* no peer, our padtemplate is enough then */ + /* no peer or the peer can do anything, our padtemplate is enough then */ caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); } @@ -962,6 +968,67 @@ } +static gboolean +gst_base_transform_acceptcaps (GstPad * pad, GstCaps * caps) +{ + GstBaseTransform *trans; + GstPad *otherpad; + GstCaps *othercaps = NULL; + gboolean ret = TRUE; + trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); + otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; + /* we need fixed caps for the check, fall back to the default implementation + * if we don't */ + if (!gst_caps_is_fixed (caps)) { + GstCaps *intersect; + GST_DEBUG_OBJECT (pad, "non fixed accept caps %" GST_PTR_FORMAT, caps); + othercaps = gst_pad_get_caps (pad); + if (!othercaps) + goto no_transform_possible; + intersect = gst_caps_intersect (othercaps, caps); + GST_DEBUG_OBJECT (pad, "intersection %" GST_PTR_FORMAT, intersect); + ret = !gst_caps_is_empty (intersect); + gst_caps_unref (intersect); + if (!ret) + } else { + GST_DEBUG_OBJECT (pad, "accept caps %" GST_PTR_FORMAT, caps); + /* find best possible caps for the other pad as a way to see if we can + * transform this caps. */ + othercaps = gst_base_transform_find_transform (trans, pad, caps); + if (!othercaps || gst_caps_is_empty (othercaps)) + GST_DEBUG_OBJECT (pad, "we can transform to %" GST_PTR_FORMAT, othercaps); + } +done: + if (othercaps) + gst_caps_unref (othercaps); + gst_object_unref (trans); + return ret; + /* ERRORS */ +no_transform_possible: + { + GST_WARNING_OBJECT (trans, + "transform could not transform %" GST_PTR_FORMAT + " in anything we support", caps); + ret = FALSE; + goto done; +} /* called when new caps arrive on the sink or source pad, * We try to find the best caps for the other side using our _find_transform() * function. If there are caps, we configure the transform for this new |
From: <wt...@ke...> - 2008-11-22 15:09:39
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Sat Nov 22 2008 15:09:34 UTC Log message: * libs/gst/base/gstbasetransform.c: (gst_base_transform_acceptcaps): Rename a variable to make the code clearer. Modified files: . : ChangeLog libs/gst/base : gstbasetransform.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4172&r2=1.4173 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c.diff?r1=1.130&r2=1.131 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4172 retrieving revision 1.4173 diff -u -d -r1.4172 -r1.4173 --- ChangeLog 21 Nov 2008 20:57:13 -0000 1.4172 +++ ChangeLog 22 Nov 2008 15:09:17 -0000 1.4173 @@ -1,3 +1,9 @@ +2008-11-22 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasetransform.c: + (gst_base_transform_acceptcaps): + Rename a variable to make the code clearer. 2008-11-21 Stefan Kost <en...@us...> * plugins/elements/gstidentity.c: Index: gstbasetransform.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v retrieving revision 1.130 retrieving revision 1.131 diff -u -d -r1.130 -r1.131 --- gstbasetransform.c 21 Nov 2008 17:14:48 -0000 1.130 +++ gstbasetransform.c 22 Nov 2008 15:09:20 -0000 1.131 @@ -982,20 +982,24 @@ /* we need fixed caps for the check, fall back to the default implementation * if we don't */ if (!gst_caps_is_fixed (caps)) { - GstCaps *intersect; + GstCaps *allowed, *intersect; GST_DEBUG_OBJECT (pad, "non fixed accept caps %" GST_PTR_FORMAT, caps); - othercaps = gst_pad_get_caps (pad); - if (!othercaps) + /* get all the formats we can handle on this pad */ + allowed = gst_pad_get_caps (pad); + if (!allowed) goto no_transform_possible; - intersect = gst_caps_intersect (othercaps, caps); + /* intersect with the requested format */ + intersect = gst_caps_intersect (allowed, caps); GST_DEBUG_OBJECT (pad, "intersection %" GST_PTR_FORMAT, intersect); + /* we can accept if the intersection is not empty */ ret = !gst_caps_is_empty (intersect); gst_caps_unref (intersect); + gst_caps_unref (allowed); if (!ret) |
From: <wt...@ke...> - 2008-11-24 15:28:13
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Mon Nov 24 2008 15:28:09 UTC Log message: * libs/gst/base/gstbasetransform.c: (gst_base_transform_acceptcaps): Revert quick accepcaps attempt, it's not fully equivalent to the old behaviour and thus causes regressions. Modified files: . : ChangeLog libs/gst/base : gstbasetransform.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4175&r2=1.4176 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c.diff?r1=1.131&r2=1.132 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4175 retrieving revision 1.4176 diff -u -d -r1.4175 -r1.4176 --- ChangeLog 24 Nov 2008 11:56:41 -0000 1.4175 +++ ChangeLog 24 Nov 2008 15:27:53 -0000 1.4176 @@ -1,3 +1,10 @@ +2008-11-24 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasetransform.c: + (gst_base_transform_acceptcaps): + Revert quick accepcaps attempt, it's not fully equivalent to the old + behaviour and thus causes regressions. 2008-11-24 Edward Hervey <edw...@co...> * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): Index: gstbasetransform.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v retrieving revision 1.131 retrieving revision 1.132 diff -u -d -r1.131 -r1.132 --- gstbasetransform.c 22 Nov 2008 15:09:20 -0000 1.131 +++ gstbasetransform.c 24 Nov 2008 15:27:55 -0000 1.132 @@ -979,9 +979,12 @@ trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; +#if 0 /* we need fixed caps for the check, fall back to the default implementation * if we don't */ - if (!gst_caps_is_fixed (caps)) { + if (!gst_caps_is_fixed (caps)) +#endif + { GstCaps *allowed, *intersect; GST_DEBUG_OBJECT (pad, "non fixed accept caps %" GST_PTR_FORMAT, caps); @@ -1003,7 +1006,9 @@ if (!ret) goto no_transform_possible; - } else { + } + else { GST_DEBUG_OBJECT (pad, "accept caps %" GST_PTR_FORMAT, caps); /* find best possible caps for the other pad as a way to see if we can @@ -1014,6 +1019,7 @@ GST_DEBUG_OBJECT (pad, "we can transform to %" GST_PTR_FORMAT, othercaps); } done: if (othercaps) |
From: <wt...@ke...> - 2008-12-08 18:36:01
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Mon Dec 08 2008 18:35:59 UTC Log message: * libs/gst/base/gstbasetransform.c: (gst_base_transform_prepare_output_buffer), (gst_base_transform_getrange), (gst_base_transform_chain): * libs/gst/base/gstbasetransform.h: Add vmethod that is called before we start the transform and which can be used to configure the transform, such as dynamic properties. Modified files: . : ChangeLog libs/gst/base : gstbasetransform.c gstbasetransform.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4182&r2=1.4183 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c.diff?r1=1.132&r2=1.133 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasetransform.h.diff?r1=1.40&r2=1.41 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4182 retrieving revision 1.4183 diff -u -d -r1.4182 -r1.4183 --- ChangeLog 5 Dec 2008 20:32:01 -0000 1.4182 +++ ChangeLog 8 Dec 2008 18:35:42 -0000 1.4183 @@ -1,3 +1,12 @@ +2008-12-08 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasetransform.c: + (gst_base_transform_prepare_output_buffer), + (gst_base_transform_getrange), (gst_base_transform_chain): + * libs/gst/base/gstbasetransform.h: + Add vmethod that is called before we start the transform and which can + be used to configure the transform, such as dynamic properties. 2008-12-05 David Schleef <ds...@sc...> * gst/gst.c: Index: gstbasetransform.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- gstbasetransform.c 24 Nov 2008 15:27:55 -0000 1.132 +++ gstbasetransform.c 8 Dec 2008 18:35:44 -0000 1.133 @@ -1185,6 +1185,7 @@ /* only discard it when the input was not writable, otherwise, we reuse * the input buffer. */ discard = gst_buffer_is_writable (in_buf); + GST_DEBUG_OBJECT (trans, "discard: %d", discard); } else { GST_DEBUG_OBJECT (trans, "getting output size for copy transform"); /* copy transform, figure out the output size */ @@ -1948,6 +1949,7 @@ guint length, GstBuffer ** buffer) { GstBaseTransform *trans; + GstBaseTransformClass *klass; GstFlowReturn ret; GstBuffer *inbuf; @@ -1957,6 +1959,10 @@ if (G_UNLIKELY (ret != GST_FLOW_OK)) goto pull_error; + klass = GST_BASE_TRANSFORM_GET_CLASS (trans); + if (klass->before_transform) + klass->before_transform (trans, inbuf); GST_BASE_TRANSFORM_LOCK (trans); ret = gst_base_transform_handle_buffer (trans, inbuf, buffer); GST_BASE_TRANSFORM_UNLOCK (trans); @@ -1979,6 +1985,7 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer) GstClockTime last_stop = GST_CLOCK_TIME_NONE; GstBuffer *outbuf = NULL; @@ -1993,6 +2000,10 @@ last_stop = GST_BUFFER_TIMESTAMP (buffer); } + klass->before_transform (trans, buffer); /* protect transform method and concurrent buffer alloc */ ret = gst_base_transform_handle_buffer (trans, buffer, &outbuf); Index: gstbasetransform.h RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- gstbasetransform.h 20 Aug 2008 10:52:09 -0000 1.40 +++ gstbasetransform.h 8 Dec 2008 18:35:44 -0000 1.41 @@ -182,6 +182,10 @@ * analysis can return a subbuffer or even just * increment the reference to the input buffer (if in * passthrough mode) + * @before_transform: Optional. Since 0.10.22 + * This method is called right before the base class will + * start processing. Dynamic properties or other delayed + * configuration could be performed in this method. * * Subclasses can override any of the available virtual methods or not, as * needed. At minimum either @transform or @transform_ip need to be overridden. @@ -231,8 +235,10 @@ /* src event */ gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event); + void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer); /*< private >*/ - gpointer _gst_reserved[GST_PADDING_LARGE - 1]; + gpointer _gst_reserved[GST_PADDING_LARGE - 2]; }; GType gst_base_transform_get_type (void); |
From: <wt...@ke...> - 2008-12-15 12:48:18
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Mon Dec 15 2008 12:48:14 UTC Log message: * libs/gst/base/gstbasesink.c: (gst_base_sink_class_init), (gst_base_sink_init), (gst_base_sink_set_property), (gst_base_sink_get_property): Expose the render-delay as a property so things like appsink can use it to tweak the synchronisation. Modified files: . : ChangeLog libs/gst/base : gstbasesink.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4191&r2=1.4192 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.c.diff?r1=1.224&r2=1.225 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4191 retrieving revision 1.4192 diff -u -d -r1.4191 -r1.4192 --- ChangeLog 10 Dec 2008 15:19:43 -0000 1.4191 +++ ChangeLog 15 Dec 2008 12:47:57 -0000 1.4192 @@ -1,3 +1,11 @@ +2008-12-15 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasesink.c: (gst_base_sink_class_init), + (gst_base_sink_init), (gst_base_sink_set_property), + (gst_base_sink_get_property): + Expose the render-delay as a property so things like appsink can use it + to tweak the synchronisation. 2008-12-10 Peter Kjellerstedt <pk...@ax...> * libs/gst/check/gstcheck.h: Allow check tests to use Index: gstbasesink.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.c,v retrieving revision 1.224 retrieving revision 1.225 diff -u -d -r1.224 -r1.225 --- gstbasesink.c 24 Nov 2008 20:02:55 -0000 1.224 +++ gstbasesink.c 15 Dec 2008 12:47:59 -0000 1.225 @@ -247,6 +247,7 @@ #define DEFAULT_ASYNC TRUE #define DEFAULT_TS_OFFSET 0 #define DEFAULT_BLOCKSIZE 4096 +#define DEFAULT_RENDER_DELAY 0 enum { @@ -259,6 +260,7 @@ PROP_TS_OFFSET, PROP_LAST_BUFFER, PROP_BLOCKSIZE, + PROP_RENDER_DELAY, PROP_LAST }; @@ -403,7 +405,6 @@ g_param_spec_int64 ("ts-offset", "TS Offset", "Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64, DEFAULT_TS_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** * GstBaseSink:last-buffer * @@ -417,7 +418,6 @@ gst_param_spec_mini_object ("last-buffer", "Last Buffer", "The last buffer received in the sink", GST_TYPE_BUFFER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); * GstBaseSink:blocksize @@ -429,6 +429,19 @@ g_param_spec_uint ("blocksize", "Block size", "Size in bytes to pull per buffer (0 = default)", 0, G_MAXUINT, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GstBaseSink:render-delay + * + * The additional delay between synchronisation and actual rendering of the + * media. This property will add additional latency to the device in order to + * make other sinks compensate for the delay. + * Since: 0.10.22 + */ + g_object_class_install_property (gobject_class, PROP_RENDER_DELAY, + 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)); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_base_sink_change_state); @@ -581,7 +594,7 @@ g_atomic_int_set (&priv->qos_enabled, DEFAULT_QOS); priv->async_enabled = DEFAULT_ASYNC; priv->ts_offset = DEFAULT_TS_OFFSET; - priv->render_delay = 0; + priv->render_delay = DEFAULT_RENDER_DELAY; priv->blocksize = DEFAULT_BLOCKSIZE; GST_OBJECT_FLAG_SET (basesink, GST_ELEMENT_IS_SINK); @@ -1145,6 +1158,9 @@ case PROP_BLOCKSIZE: gst_base_sink_set_blocksize (sink, g_value_get_uint (value)); break; + case PROP_RENDER_DELAY: + gst_base_sink_set_render_delay (sink, g_value_get_uint64 (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1184,6 +1200,9 @@ g_value_set_uint (value, gst_base_sink_get_blocksize (sink)); + g_value_set_uint64 (value, gst_base_sink_get_render_delay (sink)); |
From: <wt...@ke...> - 2009-01-05 15:43:12
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Mon Jan 05 2009 15:43:07 UTC Log message: * libs/gst/base/gstbasesink.c: (gst_base_sink_get_position_last), (gst_base_sink_get_position_paused), (gst_base_sink_get_position): Release the object lock before calling the query convert pad functions to avoid deadlocks. Modified files: . : ChangeLog libs/gst/base : gstbasesink.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4213&r2=1.4214 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.c.diff?r1=1.225&r2=1.226 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4213 retrieving revision 1.4214 diff -u -d -r1.4213 -r1.4214 --- ChangeLog 5 Jan 2009 15:40:58 -0000 1.4213 +++ ChangeLog 5 Jan 2009 15:42:51 -0000 1.4214 @@ -1,5 +1,12 @@ 2009-01-05 Wim Taymans <wim...@co...> + * libs/gst/base/gstbasesink.c: (gst_base_sink_get_position_last), + (gst_base_sink_get_position_paused), (gst_base_sink_get_position): + Release the object lock before calling the query convert pad functions + to avoid deadlocks. + +2009-01-05 Wim Taymans <wim...@co...> * gst/gstbus.c: (gst_bus_wakeup_main_context): The lock order should be maincontext > OBJECT_LOCK so we need to release the object lock when waking up the mainloop to avoid deadlocks. Index: gstbasesink.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.c,v retrieving revision 1.225 retrieving revision 1.226 diff -u -d -r1.225 -r1.226 --- gstbasesink.c 15 Dec 2008 12:47:59 -0000 1.225 +++ gstbasesink.c 5 Jan 2009 15:42:53 -0000 1.226 @@ -3629,7 +3629,7 @@ /* get the end position of the last seen object, this is used * for EOS and for making sure that we don't report a position we - * have not reached yet. */ + * have not reached yet. With LOCK. */ static gboolean gst_base_sink_get_position_last (GstBaseSink * basesink, GstFormat format, gint64 * cur) @@ -3651,9 +3651,13 @@ } if (*cur != -1 && oformat != format) { - /* convert to the target format if we need to */ + GST_OBJECT_UNLOCK (basesink); + /* convert to the target format if we need to, release lock first */ ret = gst_pad_query_convert (basesink->sinkpad, oformat, *cur, &format, cur); + if (!ret) + *cur = -1; + GST_OBJECT_LOCK (basesink); GST_DEBUG_OBJECT (basesink, "POSITION: %" GST_TIME_FORMAT, @@ -3664,7 +3668,7 @@ /* get the position when we are PAUSED, this is the stream time of the buffer * that prerolled. If no buffer is prerolled (we are still flushing), this - * value will be -1. */ + * value will be -1. With LOCK. */ gst_base_sink_get_position_paused (GstBaseSink * basesink, GstFormat format, @@ -3710,10 +3714,15 @@ GST_TIME_ARGS (*cur)); } res = (*cur != -1); if (res && oformat != format) { res = + if (!res) return res; @@ -3774,10 +3783,13 @@ base = GST_ELEMENT_CAST (basesink)->base_time; accum = basesink->segment.accum; rate = basesink->segment.rate * basesink->segment.applied_rate; - gst_base_sink_get_position_last (basesink, format, &last); latency = basesink->priv->latency; gst_object_ref (clock); + /* this function might release the LOCK */ + gst_base_sink_get_position_last (basesink, format, &last); /* need to release the object lock before we can get the time, * a clock might take the LOCK of the provider, which could be * a basesink subclass. */ |
From: <wt...@ke...> - 2009-01-09 15:43:36
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: wtay Date: Fri Jan 09 2009 15:43:31 UTC Log message: * libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state), (gst_base_sink_wait_clock): * libs/gst/base/gstbasesink.h: Fix documentation for the wait_clock method, rename basesink -> sink for consistency. Modified files: . : ChangeLog libs/gst/base : gstbasesink.c gstbasesink.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.4218&r2=1.4219 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.c.diff?r1=1.226&r2=1.227 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/base/gstbasesink.h.diff?r1=1.53&r2=1.54 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.4218 retrieving revision 1.4219 diff -u -d -r1.4218 -r1.4219 --- ChangeLog 8 Jan 2009 13:41:17 -0000 1.4218 +++ ChangeLog 9 Jan 2009 15:43:14 -0000 1.4219 @@ -1,3 +1,11 @@ +2009-01-09 Wim Taymans <wim...@co...> + + * libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state), + (gst_base_sink_wait_clock): + * libs/gst/base/gstbasesink.h: + Fix documentation for the wait_clock method, rename basesink -> sink + for consistency. 2009-01-08 Stefan Kost <en...@us...> * gst/gst.c: Index: gstbasesink.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.c,v retrieving revision 1.226 retrieving revision 1.227 diff -u -d -r1.226 -r1.227 --- gstbasesink.c 5 Jan 2009 15:42:53 -0000 1.226 +++ gstbasesink.c 9 Jan 2009 15:43:17 -0000 1.227 @@ -1346,6 +1346,7 @@ /* make sure we notify the subclass of async playing */ if (bclass->async_play) { + GST_WARNING_OBJECT (basesink, "deprecated async_play"); ret = bclass->async_play (basesink); if (ret == GST_STATE_CHANGE_FAILURE) goto async_failed; @@ -1644,7 +1645,7 @@ * Returns: #GstClockReturn */ GstClockReturn -gst_base_sink_wait_clock (GstBaseSink * basesink, GstClockTime time, +gst_base_sink_wait_clock (GstBaseSink * sink, GstClockTime time, GstClockTimeDiff * jitter) { GstClockID id; @@ -1654,51 +1655,51 @@ if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time))) goto invalid_time; - GST_OBJECT_LOCK (basesink); - if (G_UNLIKELY (!basesink->sync)) + GST_OBJECT_LOCK (sink); + if (G_UNLIKELY (!sink->sync)) goto no_sync; - if (G_UNLIKELY ((clock = GST_ELEMENT_CLOCK (basesink)) == NULL)) + if (G_UNLIKELY ((clock = GST_ELEMENT_CLOCK (sink)) == NULL)) goto no_clock; /* add base_time to running_time to get the time against the clock */ - time += GST_ELEMENT_CAST (basesink)->base_time; + time += GST_ELEMENT_CAST (sink)->base_time; id = gst_clock_new_single_shot_id (clock, time); - GST_OBJECT_UNLOCK (basesink); + GST_OBJECT_UNLOCK (sink); /* A blocking wait is performed on the clock. We save the ClockID * so we can unlock the entry at any time. While we are blocking, we * release the PREROLL_LOCK so that other threads can interrupt the * entry. */ - basesink->clock_id = id; + sink->clock_id = id; /* release the preroll lock while waiting */ - GST_PAD_PREROLL_UNLOCK (basesink->sinkpad); + GST_PAD_PREROLL_UNLOCK (sink->sinkpad); ret = gst_clock_id_wait (id, jitter); - GST_PAD_PREROLL_LOCK (basesink->sinkpad); + GST_PAD_PREROLL_LOCK (sink->sinkpad); gst_clock_id_unref (id); - basesink->clock_id = NULL; + sink->clock_id = NULL; return ret; /* no syncing needed */ invalid_time: { - GST_DEBUG_OBJECT (basesink, "time not valid, no sync needed"); + GST_DEBUG_OBJECT (sink, "time not valid, no sync needed"); return GST_CLOCK_BADTIME; } no_sync: - GST_DEBUG_OBJECT (basesink, "sync disabled"); - GST_OBJECT_UNLOCK (basesink); + GST_DEBUG_OBJECT (sink, "sync disabled"); + GST_OBJECT_UNLOCK (sink); no_clock: - GST_DEBUG_OBJECT (basesink, "no clock, can't sync"); + GST_DEBUG_OBJECT (sink, "no clock, can't sync"); } Index: gstbasesink.h RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesink.h,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- gstbasesink.h 20 Oct 2008 15:18:14 -0000 1.53 +++ gstbasesink.h 9 Jan 2009 15:43:17 -0000 1.54 @@ -227,7 +227,7 @@ void gst_base_sink_set_blocksize (GstBaseSink *sink, guint blocksize); guint gst_base_sink_get_blocksize (GstBaseSink *sink); -GstClockReturn gst_base_sink_wait_clock (GstBaseSink * basesink, GstClockTime time, +GstClockReturn gst_base_sink_wait_clock (GstBaseSink *sink, GstClockTime time, GstClockTimeDiff * jitter); GstFlowReturn gst_base_sink_wait_eos (GstBaseSink *sink, GstClockTime time, GstClockTimeDiff *jitter); |