+2007-11-21 Wim Taymans <wim.taymans@gmail.com>
+
+ * docs/libs/gst-plugins-base-libs-sections.txt:
+ * gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
+ (gst_base_audio_sink_set_provide_clock),
+ (gst_base_audio_sink_get_provide_clock),
+ (gst_base_audio_sink_set_slave_method),
+ (gst_base_audio_sink_get_slave_method),
+ (gst_base_audio_sink_set_property),
+ (gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
+ (gst_base_audio_sink_none_slaving),
+ (gst_base_audio_sink_handle_slaving):
+ * gst-libs/gst/audio/gstbaseaudiosink.h:
+ Expose methods for some object properties so that subclasses can more
+ easily configure them.
+ Added slave method none, that completely disables slaving to the
+ internal clock.
+ API: gst_base_audio_sink_set_provide_clock()
+ API: gst_base_audio_sink_get_provide_clock()
+ API: gst_base_audio_sink_set_slave_method()
+ API: gst_base_audio_sink_get_slave_method()
+
+ * gst-libs/gst/audio/gstbaseaudiosrc.c:
+ (gst_base_audio_src_set_provide_clock),
+ (gst_base_audio_src_get_provide_clock),
+ (gst_base_audio_src_set_property),
+ (gst_base_audio_src_get_property), (gst_base_audio_src_create):
+ * gst-libs/gst/audio/gstbaseaudiosrc.h:
+ Expose methods for some object properties so that subclasses can more
+ easily configure them.
+ API: gst_base_audio_src_set_provide_clock()
+ API: gst_base_audio_src_get_provide_clock()
+
2007-11-20 Wim Taymans <wim.taymans@gmail.com>
Patch by: Joe Peterson <lavajoe at gentoo dot org>
static const GEnumValue slave_method[] = {
{GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE, "Resampling slaving", "resample"},
{GST_BASE_AUDIO_SINK_SLAVE_SKEW, "Skew slaving", "skew"},
+ {GST_BASE_AUDIO_SINK_SLAVE_NONE, "No slaving", "none"},
{0, NULL, NULL},
};
return result;
}
+/**
+ * gst_base_audio_sink_set_provide_clock:
+ * @sink: a #GstBaseAudioSink
+ * @provide: new state
+ *
+ * Controls whether @sink will provide a clock or not. If @provide is %TRUE,
+ * gst_element_provide_clock() will return a clock that reflects the datarate
+ * of @sink. If @provide is %FALSE, gst_element_provide_clock() will return NULL.
+ *
+ * Since: 0.10.16
+ */
+void
+gst_base_audio_sink_set_provide_clock (GstBaseAudioSink * sink,
+ gboolean provide)
+{
+ g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
+
+ GST_OBJECT_LOCK (sink);
+ sink->provide_clock = provide;
+ GST_OBJECT_UNLOCK (sink);
+}
+
+/**
+ * gst_base_audio_sink_get_provide_clock:
+ * @sink: a #GstBaseAudioSink
+ *
+ * Queries whether @sink will provide a clock or not. See also
+ * gst_base_audio_sink_set_provide_clock.
+ *
+ * Returns: %TRUE if @sink will provide a clock.
+ *
+ * Since: 0.10.16
+ */
+gboolean
+gst_base_audio_sink_get_provide_clock (GstBaseAudioSink * sink)
+{
+ gboolean result;
+
+ g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), FALSE);
+
+ GST_OBJECT_LOCK (sink);
+ result = sink->provide_clock;
+ GST_OBJECT_UNLOCK (sink);
+
+ return result;
+}
+
+/**
+ * gst_base_audio_sink_set_slave_method:
+ * @sink: a #GstBaseAudioSink
+ * @method: the new slave method
+ *
+ * Controls how clock slaving will be performed in @sink.
+ *
+ * Since: 0.10.16
+ */
+void
+gst_base_audio_sink_set_slave_method (GstBaseAudioSink * sink,
+ GstBaseAudioSinkSlaveMethod method)
+{
+ g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
+
+ GST_OBJECT_LOCK (sink);
+ sink->priv->slave_method = method;
+ GST_OBJECT_UNLOCK (sink);
+}
+
+/**
+ * gst_base_audio_sink_get_slave_method:
+ * @sink: a #GstBaseAudioSink
+ *
+ * Get the current slave method used by @sink.
+ *
+ * Returns: The current slave method used by @sink.
+ *
+ * Since: 0.10.16
+ */
+GstBaseAudioSinkSlaveMethod
+gst_base_audio_sink_get_slave_method (GstBaseAudioSink * sink)
+{
+ GstBaseAudioSinkSlaveMethod result;
+
+ g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1);
+
+ GST_OBJECT_LOCK (sink);
+ result = sink->priv->slave_method;
+ GST_OBJECT_UNLOCK (sink);
+
+ return result;
+}
+
static void
gst_base_audio_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
sink->latency_time = g_value_get_int64 (value);
break;
case PROP_PROVIDE_CLOCK:
- GST_OBJECT_LOCK (sink);
- sink->provide_clock = g_value_get_boolean (value);
- GST_OBJECT_UNLOCK (sink);
+ gst_base_audio_sink_set_provide_clock (sink, g_value_get_boolean (value));
break;
case PROP_SLAVE_METHOD:
- sink->priv->slave_method = g_value_get_enum (value);
+ gst_base_audio_sink_set_slave_method (sink, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_value_set_int64 (value, sink->latency_time);
break;
case PROP_PROVIDE_CLOCK:
- GST_OBJECT_LOCK (sink);
- g_value_set_boolean (value, sink->provide_clock);
- GST_OBJECT_UNLOCK (sink);
+ g_value_set_boolean (value, gst_base_audio_sink_get_provide_clock (sink));
break;
case PROP_SLAVE_METHOD:
- g_value_set_enum (value, sink->priv->slave_method);
+ g_value_set_enum (value, gst_base_audio_sink_get_slave_method (sink));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
*srender_stop = render_stop;
}
+/* apply the clock offset but do no slaving otherwise */
+static void
+gst_base_audio_sink_none_slaving (GstBaseAudioSink * sink,
+ GstClockTime render_start, GstClockTime render_stop,
+ GstClockTime * srender_start, GstClockTime * srender_stop)
+{
+ GstClockTime cinternal, cexternal, crate_num, crate_denom;
+
+ /* get calibration parameters to compensate for offsets */
+ gst_clock_get_calibration (sink->provided_clock, &cinternal, &cexternal,
+ &crate_num, &crate_denom);
+
+ /* convert, ignoring speed */
+ render_start = clock_convert_external (render_start, cinternal, cexternal,
+ crate_num, crate_denom, sink->priv->us_latency);
+ render_stop = clock_convert_external (render_stop, cinternal, cexternal,
+ crate_num, crate_denom, sink->priv->us_latency);
+
+ *srender_start = render_start;
+ *srender_stop = render_stop;
+}
+
/* converts render_start and render_stop to their slaved values */
static void
gst_base_audio_sink_handle_slaving (GstBaseAudioSink * sink,
gst_base_audio_sink_skew_slaving (sink, render_start, render_stop,
srender_start, srender_stop);
break;
+ case GST_BASE_AUDIO_SINK_SLAVE_NONE:
+ gst_base_audio_sink_none_slaving (sink, render_start, render_stop,
+ srender_start, srender_stop);
+ break;
default:
g_warning ("unknown slaving method %d", sink->priv->slave_method);
break;
return TRUE;
}
+/**
+ * gst_base_audio_src_set_provide_clock:
+ * @src: a #GstBaseAudioSrc
+ * @provide: new state
+ *
+ * Controls whether @src will provide a clock or not. If @provide is %TRUE,
+ * gst_element_provide_clock() will return a clock that reflects the datarate
+ * of @src. If @provide is %FALSE, gst_element_provide_clock() will return NULL.
+ *
+ * Since: 0.10.16
+ */
+void
+gst_base_audio_src_set_provide_clock (GstBaseAudioSrc * src, gboolean provide)
+{
+ g_return_if_fail (GST_IS_BASE_AUDIO_SRC (src));
+
+ GST_OBJECT_LOCK (src);
+ src->priv->provide_clock = provide;
+ GST_OBJECT_UNLOCK (src);
+}
+
+/**
+ * gst_base_audio_src_get_provide_clock:
+ * @src: a #GstBaseAudioSrc
+ *
+ * Queries whether @src will provide a clock or not. See also
+ * gst_base_audio_src_set_provide_clock.
+ *
+ * Returns: %TRUE if @src will provide a clock.
+ *
+ * Since: 0.10.16
+ */
+gboolean
+gst_base_audio_src_get_provide_clock (GstBaseAudioSrc * src)
+{
+ gboolean result;
+
+ g_return_val_if_fail (GST_IS_BASE_AUDIO_SRC (src), FALSE);
+
+ GST_OBJECT_LOCK (src);
+ result = src->priv->provide_clock;
+ GST_OBJECT_UNLOCK (src);
+
+ return result;
+}
+
static void
gst_base_audio_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
src->latency_time = g_value_get_int64 (value);
break;
case PROP_PROVIDE_CLOCK:
- GST_OBJECT_LOCK (src);
- src->priv->provide_clock = g_value_get_boolean (value);
- GST_OBJECT_UNLOCK (src);
+ gst_base_audio_src_set_provide_clock (src, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
g_value_set_int64 (value, src->latency_time);
break;
case PROP_PROVIDE_CLOCK:
- GST_OBJECT_LOCK (src);
- g_value_set_boolean (value, src->priv->provide_clock);
- GST_OBJECT_UNLOCK (src);
+ g_value_set_boolean (value, gst_base_audio_src_get_provide_clock (src));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);