mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
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.
This commit is contained in:
parent
45fce73f08
commit
db2b4d916c
4 changed files with 31 additions and 18 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2005-12-02 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* 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 <thomas at apestaart dot org>
|
2005-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* win32/MANIFEST:
|
* win32/MANIFEST:
|
||||||
|
|
|
@ -428,12 +428,11 @@ static guint64
|
||||||
gst_util_uint64_scale_int64 (guint64 val, guint64 num, guint64 denom)
|
gst_util_uint64_scale_int64 (guint64 val, guint64 num, guint64 denom)
|
||||||
{
|
{
|
||||||
GstUInt64 a0, a1, b0, b1, c0, ct, c1, result;
|
GstUInt64 a0, a1, b0, b1, c0, ct, c1, result;
|
||||||
GstUInt64 v, n, d;
|
GstUInt64 v, n;
|
||||||
|
|
||||||
/* prepare input */
|
/* prepare input */
|
||||||
v.ll = val;
|
v.ll = val;
|
||||||
n.ll = num;
|
n.ll = num;
|
||||||
d.ll = denom;
|
|
||||||
|
|
||||||
/* do 128 bits multiply
|
/* do 128 bits multiply
|
||||||
* nh nl
|
* nh nl
|
||||||
|
@ -551,6 +550,7 @@ guint64
|
||||||
gst_util_uint64_scale_int (guint64 val, gint num, gint denom)
|
gst_util_uint64_scale_int (guint64 val, gint num, gint denom)
|
||||||
{
|
{
|
||||||
GstUInt64 result;
|
GstUInt64 result;
|
||||||
|
GstUInt64 low, high;
|
||||||
|
|
||||||
g_return_val_if_fail (denom > 0, G_MAXUINT64);
|
g_return_val_if_fail (denom > 0, G_MAXUINT64);
|
||||||
g_return_val_if_fail (num >= 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)
|
if (num == 1 && denom == 1)
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
if (val <= G_MAXUINT32) {
|
if (val <= G_MAXUINT32)
|
||||||
/* simple case */
|
/* simple case */
|
||||||
result.ll = val * num / denom;
|
return val * num / denom;
|
||||||
} else {
|
|
||||||
GstUInt64 low, high;
|
|
||||||
|
|
||||||
/* do 96 bits mult/div */
|
/* do 96 bits mult/div */
|
||||||
low.ll = val;
|
low.ll = val;
|
||||||
result.ll = ((guint64) low.l.low) * num;
|
result.ll = ((guint64) low.l.low) * num;
|
||||||
high.ll = ((guint64) low.l.high) * num + (result.l.high);
|
high.ll = ((guint64) low.l.high) * num + (result.l.high);
|
||||||
|
|
||||||
low.ll = high.ll / denom;
|
low.ll = high.ll / denom;
|
||||||
result.l.high = high.ll % denom;
|
result.l.high = high.ll % denom;
|
||||||
result.ll /= denom;
|
result.ll /= denom;
|
||||||
|
|
||||||
/* avoid overflow */
|
/* avoid overflow */
|
||||||
if (low.ll + result.l.high > G_MAXUINT32)
|
if (low.ll + result.l.high > G_MAXUINT32)
|
||||||
goto overflow;
|
goto overflow;
|
||||||
|
|
||||||
|
result.l.high += low.l.low;
|
||||||
|
|
||||||
result.l.high += low.l.low;
|
|
||||||
}
|
|
||||||
return result.ll;
|
return result.ll;
|
||||||
|
|
||||||
overflow:
|
overflow:
|
||||||
|
|
|
@ -722,6 +722,7 @@ dropping:
|
||||||
{
|
{
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (basesink, "dropping buffer");
|
||||||
buf = GST_BUFFER (g_queue_pop_tail (basesink->preroll_queue));
|
buf = GST_BUFFER (g_queue_pop_tail (basesink->preroll_queue));
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
|
@ -1060,6 +1060,8 @@ gst_base_transform_event (GstPad * pad, GstEvent * event)
|
||||||
if (bclass->event)
|
if (bclass->event)
|
||||||
ret = bclass->event (trans, event);
|
ret = bclass->event (trans, event);
|
||||||
|
|
||||||
|
/* FIXME, do this in the default event handler so the subclass can do
|
||||||
|
* something different. */
|
||||||
if (ret)
|
if (ret)
|
||||||
ret = gst_pad_event_default (pad, event);
|
ret = gst_pad_event_default (pad, event);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue