audio: clean up headers

This commit is contained in:
Wim Taymans 2011-06-21 18:17:59 +02:00
parent 2e837743c3
commit a58805216a
4 changed files with 24 additions and 35 deletions

View file

@ -102,7 +102,7 @@ gst_audio_clock_init (GstAudioClock * clock)
{ {
GST_DEBUG_OBJECT (clock, "init"); GST_DEBUG_OBJECT (clock, "init");
clock->last_time = 0; clock->last_time = 0;
clock->abidata.ABI.time_offset = 0; clock->time_offset = 0;
GST_OBJECT_FLAG_SET (clock, GST_CLOCK_FLAG_CAN_SET_MASTER); GST_OBJECT_FLAG_SET (clock, GST_CLOCK_FLAG_CAN_SET_MASTER);
} }
@ -111,9 +111,9 @@ gst_audio_clock_dispose (GObject * object)
{ {
GstAudioClock *clock = GST_AUDIO_CLOCK (object); GstAudioClock *clock = GST_AUDIO_CLOCK (object);
if (clock->abidata.ABI.destroy_notify && clock->user_data) if (clock->destroy_notify && clock->user_data)
clock->abidata.ABI.destroy_notify (clock->user_data); clock->destroy_notify (clock->user_data);
clock->abidata.ABI.destroy_notify = NULL; clock->destroy_notify = NULL;
clock->user_data = NULL; clock->user_data = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
@ -168,7 +168,7 @@ gst_audio_clock_new_full (const gchar * name, GstAudioClockGetTimeFunc func,
aclock->func = func; aclock->func = func;
aclock->user_data = user_data; aclock->user_data = user_data;
aclock->abidata.ABI.destroy_notify = destroy_notify; aclock->destroy_notify = destroy_notify;
return (GstClock *) aclock; return (GstClock *) aclock;
} }
@ -193,7 +193,7 @@ gst_audio_clock_reset (GstAudioClock * clock, GstClockTime time)
else else
time_offset = -(time - clock->last_time); time_offset = -(time - clock->last_time);
clock->abidata.ABI.time_offset = time_offset; clock->time_offset = time_offset;
GST_DEBUG_OBJECT (clock, GST_DEBUG_OBJECT (clock,
"reset clock to %" GST_TIME_FORMAT ", last %" GST_TIME_FORMAT ", offset %" "reset clock to %" GST_TIME_FORMAT ", last %" GST_TIME_FORMAT ", offset %"
@ -219,7 +219,7 @@ gst_audio_clock_get_internal_time (GstClock * clock)
if (result == GST_CLOCK_TIME_NONE) { if (result == GST_CLOCK_TIME_NONE) {
result = aclock->last_time; result = aclock->last_time;
} else { } else {
result += aclock->abidata.ABI.time_offset; result += aclock->time_offset;
/* clock must be increasing */ /* clock must be increasing */
if (aclock->last_time < result) if (aclock->last_time < result)
aclock->last_time = result; aclock->last_time = result;
@ -256,7 +256,7 @@ gst_audio_clock_get_time (GstClock * clock)
result = aclock->func (clock, aclock->user_data); result = aclock->func (clock, aclock->user_data);
if (result == GST_CLOCK_TIME_NONE) { if (result == GST_CLOCK_TIME_NONE) {
GST_DEBUG_OBJECT (clock, "no time, reuse last"); GST_DEBUG_OBJECT (clock, "no time, reuse last");
result = aclock->last_time - aclock->abidata.ABI.time_offset; result = aclock->last_time - aclock->time_offset;
} }
GST_DEBUG_OBJECT (clock, GST_DEBUG_OBJECT (clock,
@ -285,7 +285,7 @@ gst_audio_clock_adjust (GstClock * clock, GstClockTime time)
aclock = GST_AUDIO_CLOCK_CAST (clock); aclock = GST_AUDIO_CLOCK_CAST (clock);
result = time + aclock->abidata.ABI.time_offset; result = time + aclock->time_offset;
return result; return result;
} }

View file

@ -68,19 +68,14 @@ struct _GstAudioClock {
/*< protected >*/ /*< protected >*/
GstAudioClockGetTimeFunc func; GstAudioClockGetTimeFunc func;
gpointer user_data; gpointer user_data;
GDestroyNotify destroy_notify;
GstClockTime last_time;
/*< private >*/ /*< private >*/
union { GstClockTime last_time;
struct { GstClockTimeDiff time_offset;
GstClockTimeDiff time_offset;
GDestroyNotify destroy_notify; gpointer _gst_reserved[GST_PADDING];
} ABI;
/* adding + 0 to mark ABI change to be undone later */
gpointer _gst_reserved[GST_PADDING + 0];
} abidata;
}; };
struct _GstAudioClockClass { struct _GstAudioClockClass {

View file

@ -826,7 +826,7 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
/* if PLAYING is interrupted, /* if PLAYING is interrupted,
* arrange to have clock running when going to PLAYING again */ * arrange to have clock running when going to PLAYING again */
g_atomic_int_set (&sink->abidata.ABI.eos_rendering, 1); g_atomic_int_set (&sink->eos_rendering, 1);
/* need to start playback before we can drain, but only when /* need to start playback before we can drain, but only when
* we have successfully negotiated a format and thus acquired the * we have successfully negotiated a format and thus acquired the
@ -845,7 +845,7 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
GST_DEBUG_OBJECT (sink, "drained audio"); GST_DEBUG_OBJECT (sink, "drained audio");
} }
g_atomic_int_set (&sink->abidata.ABI.eos_rendering, 0); g_atomic_int_set (&sink->eos_rendering, 0);
return TRUE; return TRUE;
} }
@ -1570,8 +1570,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop)); GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
/* bring to position in the ringbuffer */ /* bring to position in the ringbuffer */
time_offset = time_offset = GST_AUDIO_CLOCK_CAST (sink->provided_clock)->time_offset;
GST_AUDIO_CLOCK_CAST (sink->provided_clock)->abidata.ABI.time_offset;
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"time offset %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset)); "time offset %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset));
if (render_start > time_offset) if (render_start > time_offset)
@ -1953,7 +1952,7 @@ gst_base_audio_sink_change_state (GstElement * element,
gst_ring_buffer_may_start (sink->ringbuffer, TRUE); gst_ring_buffer_may_start (sink->ringbuffer, TRUE);
if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL || if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL ||
g_atomic_int_get (&sink->abidata.ABI.eos_rendering) || eos) { g_atomic_int_get (&sink->eos_rendering) || eos) {
/* we always start the ringbuffer in pull mode immediatly */ /* we always start the ringbuffer in pull mode immediatly */
/* sync rendering on eos needs running clock, /* sync rendering on eos needs running clock,
* and others need running clock when finished rendering eos */ * and others need running clock when finished rendering eos */

View file

@ -124,17 +124,13 @@ struct _GstBaseAudioSink {
gboolean provide_clock; gboolean provide_clock;
GstClock *provided_clock; GstClock *provided_clock;
/* with g_atomic_; currently rendering eos */
gboolean eos_rendering;
/*< private >*/ /*< private >*/
GstBaseAudioSinkPrivate *priv; GstBaseAudioSinkPrivate *priv;
union { gpointer _gst_reserved[GST_PADDING];
struct {
/*< protected >*/
/* with g_atomic_; currently rendering eos */
gboolean eos_rendering;
} ABI;
gpointer _gst_reserved[GST_PADDING - 1];
} abidata;
}; };
/** /**
@ -158,9 +154,8 @@ struct _GstBaseAudioSinkClass {
/* subclass payloader */ /* subclass payloader */
GstBuffer* (*payload) (GstBaseAudioSink *sink, GstBuffer* (*payload) (GstBaseAudioSink *sink,
GstBuffer *buffer); GstBuffer *buffer);
/*< private >*/ /*< private >*/
gpointer _gst_reserved[GST_PADDING - 1]; gpointer _gst_reserved[GST_PADDING];
}; };
GType gst_base_audio_sink_get_type(void); GType gst_base_audio_sink_get_type(void);