mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 09:38:17 +00:00
gst/base/gstbasesrc.c: use conversions
Original commit message from CVS: * gst/base/gstbasesrc.c: (gst_base_src_query): use conversions * gst/gstutils.c: (gst_guint64_to_gdouble), (gst_gdouble_to_guint64), (gst_util_uint64_scale): * gst/gstutils.h: externalize, basesrc uses it obviously the implementation needs testing
This commit is contained in:
parent
78c180ea28
commit
e2af9ca6c6
5 changed files with 28 additions and 12 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2005-10-10 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* gst/base/gstbasesrc.c: (gst_base_src_query):
|
||||||
|
use conversions
|
||||||
|
* gst/gstutils.c: (gst_guint64_to_gdouble),
|
||||||
|
(gst_gdouble_to_guint64), (gst_util_uint64_scale):
|
||||||
|
* gst/gstutils.h:
|
||||||
|
externalize, basesrc uses it
|
||||||
|
obviously the implementation needs testing
|
||||||
|
|
||||||
2005-10-10 Wim Taymans <wim@fluendo.com>
|
2005-10-10 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* tests/sched/Makefile.am:
|
* tests/sched/Makefile.am:
|
||||||
|
|
|
@ -338,7 +338,7 @@ gst_base_src_query (GstPad * pad, GstQuery * query)
|
||||||
case GST_FORMAT_PERCENT:
|
case GST_FORMAT_PERCENT:
|
||||||
b = gst_base_src_get_size (src, &ui64);
|
b = gst_base_src_get_size (src, &ui64);
|
||||||
i64 = GST_FORMAT_PERCENT_MAX;
|
i64 = GST_FORMAT_PERCENT_MAX;
|
||||||
i64 *= b ? (src->offset / (gdouble) ui64) : 1.0;
|
i64 *= b ? (src->offset / gst_guint64_to_gdouble (ui64)) : 1.0;
|
||||||
gst_query_set_position (query, GST_FORMAT_PERCENT,
|
gst_query_set_position (query, GST_FORMAT_PERCENT,
|
||||||
i64, GST_FORMAT_PERCENT_MAX);
|
i64, GST_FORMAT_PERCENT_MAX);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -302,8 +302,8 @@ gst_util_set_object_arg (GObject * object, const gchar * name,
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* work around error C2520: conversion from unsigned __int64 to double
|
/* work around error C2520: conversion from unsigned __int64 to double
|
||||||
* not implemented, use signed __int64 */
|
* not implemented, use signed __int64 */
|
||||||
static gdouble
|
gdouble
|
||||||
guint64_to_gdouble (guint64 value)
|
gst_guint64_to_gdouble (guint64 value)
|
||||||
{
|
{
|
||||||
if (value & 0x8000000000000000)
|
if (value & 0x8000000000000000)
|
||||||
return (gdouble) ((gint64) value) + (gdouble) 18446744073709551616.;
|
return (gdouble) ((gint64) value) + (gdouble) 18446744073709551616.;
|
||||||
|
@ -311,18 +311,15 @@ guint64_to_gdouble (guint64 value)
|
||||||
return (gdouble) ((gint64) value);
|
return (gdouble) ((gint64) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gdouble
|
guint64
|
||||||
gdouble_to_guint64 (gdouble value)
|
gst_gdouble_to_guint64 (gdouble value)
|
||||||
{
|
{
|
||||||
if (value < (gdouble) 9223372036854775808.) /* 1 << 63 */
|
if (value < (gdouble) 9223372036854775808.) /* 1 << 63 */
|
||||||
return ((guint64) ((gint64) value));
|
return ((guint64) ((gint64) value));
|
||||||
|
|
||||||
value -= 9223372036854775808.;
|
value -= (gdouble) 18446744073709551616.;
|
||||||
return ((guint64) ((gint64) value)) + 1LL << 63;
|
return ((guint64) ((gint64) value));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define gdouble_to_guint64(value) ((guint64) (value))
|
|
||||||
#define guint64_to_gdouble(value) ((gdouble) (value))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -339,7 +336,8 @@ guint64
|
||||||
gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom)
|
gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom)
|
||||||
{
|
{
|
||||||
/* implement me with fixed point, if you care */
|
/* implement me with fixed point, if you care */
|
||||||
return val * ((guint64_to_gdouble (num)) / guint64_to_gdouble (denom));
|
return gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) *
|
||||||
|
((gst_guint64_to_gdouble (num)) / gst_guint64_to_gdouble (denom)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------
|
/* -----------------------------------------------------
|
||||||
|
|
|
@ -33,6 +33,14 @@ void gst_util_set_value_from_string (GValue *value, const gchar *value_str);
|
||||||
void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar *value);
|
void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar *value);
|
||||||
void gst_util_dump_mem (const guchar *mem, guint size);
|
void gst_util_dump_mem (const guchar *mem, guint size);
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
guint64 gst_gdouble_to_guint64 (gdouble value);
|
||||||
|
gdouble gst_guint64_to_gdouble (guint64 value);
|
||||||
|
#else
|
||||||
|
#define gst_gdouble_to_guint64(value) ((guint64) (value))
|
||||||
|
#define gst_guint64_to_gdouble(value) ((gdouble) (value))
|
||||||
|
#endif
|
||||||
|
|
||||||
guint64 gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom);
|
guint64 gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom);
|
||||||
|
|
||||||
void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad);
|
void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad);
|
||||||
|
|
|
@ -338,7 +338,7 @@ gst_base_src_query (GstPad * pad, GstQuery * query)
|
||||||
case GST_FORMAT_PERCENT:
|
case GST_FORMAT_PERCENT:
|
||||||
b = gst_base_src_get_size (src, &ui64);
|
b = gst_base_src_get_size (src, &ui64);
|
||||||
i64 = GST_FORMAT_PERCENT_MAX;
|
i64 = GST_FORMAT_PERCENT_MAX;
|
||||||
i64 *= b ? (src->offset / (gdouble) ui64) : 1.0;
|
i64 *= b ? (src->offset / gst_guint64_to_gdouble (ui64)) : 1.0;
|
||||||
gst_query_set_position (query, GST_FORMAT_PERCENT,
|
gst_query_set_position (query, GST_FORMAT_PERCENT,
|
||||||
i64, GST_FORMAT_PERCENT_MAX);
|
i64, GST_FORMAT_PERCENT_MAX);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue