From db2b4d916c760ba2996888ec41270b797edd3b43 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 2 Dec 2005 11:36:50 +0000 Subject: [PATCH] gst/gstutils.c: Small cleanup. Original commit message from CVS: * gst/gstutils.c: (gst_util_uint64_scale_int64), (gst_util_uint64_scale_int): Small cleanup. * libs/gst/base/gstbasesink.c: (gst_base_sink_handle_object): Add debug log line. * libs/gst/base/gstbasetransform.c: (gst_base_transform_event): Add FIXME. --- ChangeLog | 12 +++++++++++ gst/gstutils.c | 34 +++++++++++++++----------------- libs/gst/base/gstbasesink.c | 1 + libs/gst/base/gstbasetransform.c | 2 ++ 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index c340fe2662..e641463e83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-12-02 Wim Taymans + + * gst/gstutils.c: (gst_util_uint64_scale_int64), + (gst_util_uint64_scale_int): + Small cleanup. + + * libs/gst/base/gstbasesink.c: (gst_base_sink_handle_object): + Add debug log line. + + * libs/gst/base/gstbasetransform.c: (gst_base_transform_event): + Add FIXME. + 2005-12-02 Thomas Vander Stichele * win32/MANIFEST: diff --git a/gst/gstutils.c b/gst/gstutils.c index 80cf78355a..bc1c66f8ba 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -428,12 +428,11 @@ static guint64 gst_util_uint64_scale_int64 (guint64 val, guint64 num, guint64 denom) { GstUInt64 a0, a1, b0, b1, c0, ct, c1, result; - GstUInt64 v, n, d; + GstUInt64 v, n; /* prepare input */ v.ll = val; n.ll = num; - d.ll = denom; /* do 128 bits multiply * nh nl @@ -551,6 +550,7 @@ guint64 gst_util_uint64_scale_int (guint64 val, gint num, gint denom) { GstUInt64 result; + GstUInt64 low, high; g_return_val_if_fail (denom > 0, G_MAXUINT64); g_return_val_if_fail (num >= 0, G_MAXUINT64); @@ -561,27 +561,25 @@ gst_util_uint64_scale_int (guint64 val, gint num, gint denom) if (num == 1 && denom == 1) return val; - if (val <= G_MAXUINT32) { + if (val <= G_MAXUINT32) /* simple case */ - result.ll = val * num / denom; - } else { - GstUInt64 low, high; + return val * num / denom; - /* do 96 bits mult/div */ - low.ll = val; - result.ll = ((guint64) low.l.low) * num; - high.ll = ((guint64) low.l.high) * num + (result.l.high); + /* do 96 bits mult/div */ + low.ll = val; + result.ll = ((guint64) low.l.low) * num; + high.ll = ((guint64) low.l.high) * num + (result.l.high); - low.ll = high.ll / denom; - result.l.high = high.ll % denom; - result.ll /= denom; + low.ll = high.ll / denom; + result.l.high = high.ll % denom; + result.ll /= denom; - /* avoid overflow */ - if (low.ll + result.l.high > G_MAXUINT32) - goto overflow; + /* avoid overflow */ + if (low.ll + result.l.high > G_MAXUINT32) + goto overflow; + + result.l.high += low.l.low; - result.l.high += low.l.low; - } return result.ll; overflow: diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 2f143dd97b..1ef74d589b 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -722,6 +722,7 @@ dropping: { GstBuffer *buf; + GST_DEBUG_OBJECT (basesink, "dropping buffer"); buf = GST_BUFFER (g_queue_pop_tail (basesink->preroll_queue)); gst_buffer_unref (buf); diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index c1e7a9eb1e..75c680fb15 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1060,6 +1060,8 @@ gst_base_transform_event (GstPad * pad, GstEvent * event) if (bclass->event) ret = bclass->event (trans, event); + /* FIXME, do this in the default event handler so the subclass can do + * something different. */ if (ret) ret = gst_pad_event_default (pad, event);