[media] Add sub-second resolution for the duration

The duration in ClutterMedia is currently expressed in integer multiples
of a second. This does not offer enough granularity for media playback
that has fractionary durations -- 2.3 seconds; 1 minute, 23.4 seconds;
1 hour, 23 minutes, 4.5 seconds; etc.

The duration value should be expressed in seconds with a sub-second
granularity; for this reason, a double should be used insted of an
unsigned integer.

The semantics haven't changed: the :duration property still exposes
seconds.
This commit is contained in:
Emmanuele Bassi 2009-02-24 16:16:25 +00:00
parent dd3c760cc5
commit bff6ce414a
2 changed files with 8 additions and 8 deletions

View File

@ -160,11 +160,11 @@ clutter_media_base_init (gpointer g_iface)
*
* Since: 0.2
*/
pspec = g_param_spec_uint ("duration",
"Duration",
"The duration of the stream, in seconds",
0, G_MAXUINT, 0,
CLUTTER_PARAM_READABLE);
pspec = g_param_spec_double ("duration",
"Duration",
"The duration of the stream, in seconds",
0, G_MAXDOUBLE, 0,
CLUTTER_PARAM_READABLE);
g_object_interface_install_property (g_iface, pspec);
/**
@ -442,10 +442,10 @@ clutter_media_get_buffer_fill (ClutterMedia *media)
*
* Since: 0.2
*/
guint
gdouble
clutter_media_get_duration (ClutterMedia *media)
{
guint retval = 0;
gdouble retval = 0;
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), 0);

View File

@ -72,7 +72,7 @@ void clutter_media_set_audio_volume (ClutterMedia *media,
gdouble clutter_media_get_audio_volume (ClutterMedia *media);
gboolean clutter_media_get_can_seek (ClutterMedia *media);
gdouble clutter_media_get_buffer_fill (ClutterMedia *media);
guint clutter_media_get_duration (ClutterMedia *media);
gdouble clutter_media_get_duration (ClutterMedia *media);
G_END_DECLS