From 67b21a903302e8975a6b0db3f206ac3fff8799a2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 23 Nov 2005 13:08:54 +0000 Subject: [PATCH] gst-libs/gst/audio/gstbaseaudiosink.c: Fix for calibration API change. Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init), (gst_base_audio_sink_set_clock), (gst_base_audio_sink_render), (gst_base_audio_sink_change_state): Fix for calibration API change. --- ChangeLog | 7 +++++++ gst-libs/gst/audio/gstbaseaudiosink.c | 19 ++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 650cbfd..eb24d83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-11-23 Wim Taymans + + * gst-libs/gst/audio/gstbaseaudiosink.c: + (gst_base_audio_sink_class_init), (gst_base_audio_sink_set_clock), + (gst_base_audio_sink_render), (gst_base_audio_sink_change_state): + Fix for calibration API change. + 2005-11-23 msmith,,, * gst-libs/gst/audio/multichannel.c: diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c index 0d2bbf0..f92099b 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.c +++ b/gst-libs/gst/audio/gstbaseaudiosink.c @@ -420,6 +420,8 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) guint samples; gint bps; gdouble crate; + GstClockTime crate_num; + GstClockTime crate_denom; GstClockTime cinternal, cexternal; sink = GST_BASE_AUDIO_SINK (bsink); @@ -463,10 +465,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) goto out_of_segment; gst_clock_get_calibration (sink->provided_clock, &cinternal, &cexternal, - &crate); - GST_DEBUG_OBJECT (sink, - "internal %" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT ", rate %g", - cinternal, cexternal, crate); + &crate_num, &crate_denom); /* bring buffer timestamp to stream time */ render_time = render_diff; @@ -504,6 +503,11 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) } no_sync: + crate = ((gdouble) crate_num) / crate_denom; + GST_DEBUG_OBJECT (sink, + "internal %" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT ", rate %g", + cinternal, cexternal, crate); + /* clip length based on rate */ samples = MIN (samples, samples / (crate * ABS (bsink->segment.rate))); @@ -594,17 +598,18 @@ gst_base_audio_sink_change_state (GstElement * element, /* FIXME, this is not yet accurate enough for smooth playback */ if (gst_clock_get_master (sink->provided_clock)) { GstClockTime time; - gdouble rate; + GstClockTime rate_num, rate_denom; time = gst_clock_get_internal_time (sink->provided_clock); GST_DEBUG_OBJECT (sink, "time: %" GST_TIME_FORMAT, GST_TIME_ARGS (time)); - gst_clock_get_calibration (sink->provided_clock, NULL, NULL, &rate); + gst_clock_get_calibration (sink->provided_clock, NULL, NULL, &rate_num, + &rate_denom); /* Does not work yet. */ gst_clock_set_calibration (sink->provided_clock, - time, element->base_time, rate); + time, element->base_time, rate_num, rate_denom); } break; } -- 2.7.4