mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
audio: update for clock provider API change
This commit is contained in:
parent
b4cdf008dd
commit
468d1dde89
3 changed files with 22 additions and 12 deletions
|
@ -305,7 +305,6 @@ gst_audio_base_sink_init (GstAudioBaseSink * audiobasesink)
|
|||
|
||||
audiobasesink->buffer_time = DEFAULT_BUFFER_TIME;
|
||||
audiobasesink->latency_time = DEFAULT_LATENCY_TIME;
|
||||
audiobasesink->provide_clock = DEFAULT_PROVIDE_CLOCK;
|
||||
audiobasesink->priv->slave_method = DEFAULT_SLAVE_METHOD;
|
||||
audiobasesink->priv->drift_tolerance = DEFAULT_DRIFT_TOLERANCE;
|
||||
audiobasesink->priv->alignment_threshold = DEFAULT_ALIGNMENT_THRESHOLD;
|
||||
|
@ -320,6 +319,10 @@ gst_audio_base_sink_init (GstAudioBaseSink * audiobasesink)
|
|||
basesink->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
|
||||
|
||||
gst_base_sink_set_last_buffer_enabled (basesink, FALSE);
|
||||
if (DEFAULT_PROVIDE_CLOCK)
|
||||
GST_OBJECT_FLAG_SET (basesink, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
else
|
||||
GST_OBJECT_FLAG_UNSET (basesink, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -360,7 +363,7 @@ gst_audio_base_sink_provide_clock (GstElement * elem)
|
|||
goto wrong_state;
|
||||
|
||||
GST_OBJECT_LOCK (sink);
|
||||
if (!sink->provide_clock)
|
||||
if (!GST_OBJECT_FLAG_IS_SET (sink, GST_ELEMENT_FLAG_PROVIDE_CLOCK))
|
||||
goto clock_disabled;
|
||||
|
||||
clock = GST_CLOCK_CAST (gst_object_ref (sink->provided_clock));
|
||||
|
@ -563,7 +566,10 @@ gst_audio_base_sink_set_provide_clock (GstAudioBaseSink * sink,
|
|||
g_return_if_fail (GST_IS_AUDIO_BASE_SINK (sink));
|
||||
|
||||
GST_OBJECT_LOCK (sink);
|
||||
sink->provide_clock = provide;
|
||||
if (provide)
|
||||
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
else
|
||||
GST_OBJECT_FLAG_UNSET (sink, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
GST_OBJECT_UNLOCK (sink);
|
||||
}
|
||||
|
||||
|
@ -586,7 +592,7 @@ gst_audio_base_sink_get_provide_clock (GstAudioBaseSink * sink)
|
|||
g_return_val_if_fail (GST_IS_AUDIO_BASE_SINK (sink), FALSE);
|
||||
|
||||
GST_OBJECT_LOCK (sink);
|
||||
result = sink->provide_clock;
|
||||
result = GST_OBJECT_FLAG_IS_SET (sink, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
GST_OBJECT_UNLOCK (sink);
|
||||
|
||||
return result;
|
||||
|
|
|
@ -121,7 +121,6 @@ struct _GstAudioBaseSink {
|
|||
guint64 next_sample;
|
||||
|
||||
/* clock */
|
||||
gboolean provide_clock;
|
||||
GstClock *provided_clock;
|
||||
|
||||
/* with g_atomic_; currently rendering eos */
|
||||
|
|
|
@ -73,8 +73,6 @@ gst_audio_base_src_slave_method_get_type (void)
|
|||
|
||||
struct _GstAudioBaseSrcPrivate
|
||||
{
|
||||
gboolean provide_clock;
|
||||
|
||||
/* the clock slaving algorithm in use */
|
||||
GstAudioBaseSrcSlaveMethod slave_method;
|
||||
};
|
||||
|
@ -240,7 +238,10 @@ gst_audio_base_src_init (GstAudioBaseSrc * audiobasesrc)
|
|||
|
||||
audiobasesrc->buffer_time = DEFAULT_BUFFER_TIME;
|
||||
audiobasesrc->latency_time = DEFAULT_LATENCY_TIME;
|
||||
audiobasesrc->priv->provide_clock = DEFAULT_PROVIDE_CLOCK;
|
||||
if (DEFAULT_PROVIDE_CLOCK)
|
||||
GST_OBJECT_FLAG_SET (audiobasesrc, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
else
|
||||
GST_OBJECT_FLAG_UNSET (audiobasesrc, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
audiobasesrc->priv->slave_method = DEFAULT_SLAVE_METHOD;
|
||||
/* reset blocksize we use latency time to calculate a more useful
|
||||
* value based on negotiated format. */
|
||||
|
@ -250,6 +251,7 @@ gst_audio_base_src_init (GstAudioBaseSrc * audiobasesrc)
|
|||
(GstAudioClockGetTimeFunc) gst_audio_base_src_get_time, audiobasesrc,
|
||||
NULL);
|
||||
|
||||
|
||||
/* we are always a live source */
|
||||
gst_base_src_set_live (GST_BASE_SRC (audiobasesrc), TRUE);
|
||||
/* we operate in time */
|
||||
|
@ -295,7 +297,7 @@ gst_audio_base_src_provide_clock (GstElement * elem)
|
|||
goto wrong_state;
|
||||
|
||||
GST_OBJECT_LOCK (src);
|
||||
if (!src->priv->provide_clock)
|
||||
if (!GST_OBJECT_FLAG_IS_SET (src, GST_ELEMENT_FLAG_PROVIDE_CLOCK))
|
||||
goto clock_disabled;
|
||||
|
||||
clock = GST_CLOCK_CAST (gst_object_ref (src->clock));
|
||||
|
@ -364,7 +366,10 @@ gst_audio_base_src_set_provide_clock (GstAudioBaseSrc * src, gboolean provide)
|
|||
g_return_if_fail (GST_IS_AUDIO_BASE_SRC (src));
|
||||
|
||||
GST_OBJECT_LOCK (src);
|
||||
src->priv->provide_clock = provide;
|
||||
if (provide)
|
||||
GST_OBJECT_FLAG_SET (src, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
else
|
||||
GST_OBJECT_FLAG_UNSET (src, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
}
|
||||
|
||||
|
@ -387,7 +392,7 @@ gst_audio_base_src_get_provide_clock (GstAudioBaseSrc * src)
|
|||
g_return_val_if_fail (GST_IS_AUDIO_BASE_SRC (src), FALSE);
|
||||
|
||||
GST_OBJECT_LOCK (src);
|
||||
result = src->priv->provide_clock;
|
||||
result = GST_OBJECT_FLAG_IS_SET (src, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
|
||||
return result;
|
||||
|
@ -398,7 +403,7 @@ gst_audio_base_src_get_provide_clock (GstAudioBaseSrc * src)
|
|||
* @src: a #GstAudioBaseSrc
|
||||
* @method: the new slave method
|
||||
*
|
||||
* Controls how clock slaving will be performed in @src.
|
||||
* Controls how clock slaving will be performed in @src.
|
||||
*
|
||||
* Since: 0.10.20
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue