2006-09-01 13:26:47 -04:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Authored By: Matthew Allum <mallum@openedhand.com>
|
|
|
|
* Emmanuele Bassi <ebassi@linux.intel.com>
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
|
|
|
* Copyright (C) 2006 OpenedHand
|
2009-01-16 05:38:36 -05:00
|
|
|
* Copyright (C) 2009 Intel Corp.
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-16 05:38:36 -05:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:clutter-media
|
2009-01-16 05:38:36 -05:00
|
|
|
* @short_description: An interface for controlling playback of media data
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
2008-11-07 13:00:59 -05:00
|
|
|
* #ClutterMedia is an interface for controlling playback of media sources.
|
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Clutter core does not provide an implementation of this interface, but
|
|
|
|
* other integration libraries like Clutter-GStreamer implement it to offer
|
|
|
|
* a uniform API for applications.
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* #ClutterMedia is available since Clutter 0.2
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2006-09-01 13:26:47 -04:00
|
|
|
#include "config.h"
|
2007-10-12 04:17:00 -04:00
|
|
|
#endif
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2010-06-11 10:49:46 -04:00
|
|
|
#include "clutter-debug.h"
|
|
|
|
#include "clutter-enum-types.h"
|
|
|
|
#include "clutter-marshal.h"
|
2006-09-01 13:26:47 -04:00
|
|
|
#include "clutter-media.h"
|
|
|
|
#include "clutter-main.h"
|
|
|
|
#include "clutter-private.h" /* for DBG */
|
|
|
|
|
2007-07-29 05:11:57 -04:00
|
|
|
enum
|
|
|
|
{
|
2008-11-21 11:18:38 -05:00
|
|
|
EOS_SIGNAL,
|
|
|
|
ERROR_SIGNAL, /* can't be called 'ERROR' otherwise it clashes with wingdi.h */
|
2007-07-29 05:11:57 -04:00
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint media_signals[LAST_SIGNAL] = { 0, };
|
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
static void
|
|
|
|
clutter_media_base_init (gpointer g_iface)
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
static gboolean was_initialized = FALSE;
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
if (G_UNLIKELY (!was_initialized))
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
GParamSpec *pspec = NULL;
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
was_initialized = TRUE;
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
/**
|
|
|
|
* ClutterMedia:uri:
|
|
|
|
*
|
|
|
|
* The location of a media file, expressed as a valid URI.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
pspec = g_param_spec_string ("uri",
|
|
|
|
"URI",
|
|
|
|
"URI of a media file",
|
|
|
|
NULL,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
/**
|
|
|
|
* ClutterMedia:playing:
|
|
|
|
*
|
|
|
|
* Whether the #ClutterMedia actor is playing.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
pspec = g_param_spec_boolean ("playing",
|
|
|
|
"Playing",
|
|
|
|
"Wheter the actor is playing",
|
|
|
|
FALSE,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
/**
|
|
|
|
* ClutterMedia:progress:
|
|
|
|
*
|
|
|
|
* The current progress of the playback, as a normalized
|
|
|
|
* value between 0.0 and 1.0.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
pspec = g_param_spec_double ("progress",
|
|
|
|
"Progress",
|
|
|
|
"Current progress of the playback",
|
|
|
|
0.0, 1.0, 0.0,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
|
|
|
|
2009-12-28 11:52:43 -05:00
|
|
|
/**
|
|
|
|
* ClutterMedia:subtitle-uri:
|
|
|
|
*
|
|
|
|
* The location of a subtitle file, expressed as a valid URI.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
pspec = g_param_spec_string ("subtitle-uri",
|
|
|
|
"Subtitle URI",
|
|
|
|
"URI of a subtitle file",
|
|
|
|
NULL,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
|
|
|
|
2010-01-06 06:48:46 -05:00
|
|
|
/**
|
|
|
|
* ClutterMedia:subtitle-font-name:
|
|
|
|
*
|
|
|
|
* The font used to display subtitles. The font description has to
|
|
|
|
* follow the same grammar as the one recognized by
|
|
|
|
* pango_font_description_from_string().
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
pspec = g_param_spec_string ("subtitle-font-name",
|
|
|
|
"Subtitle Font Name",
|
|
|
|
"The font used to display subtitles",
|
|
|
|
NULL,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
/**
|
|
|
|
* ClutterMedia:audio-volume:
|
|
|
|
*
|
|
|
|
* The volume of the audio, as a normalized value between
|
|
|
|
* 0.0 and 1.0.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
pspec = g_param_spec_double ("audio-volume",
|
|
|
|
"Audio Volume",
|
|
|
|
"The volume of the audio",
|
|
|
|
0.0, 1.0, 0.5,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ClutterMedia:can-seek:
|
|
|
|
*
|
|
|
|
* Whether the current stream is seekable.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
pspec = g_param_spec_boolean ("can-seek",
|
|
|
|
"Can Seek",
|
|
|
|
"Whether the current stream is seekable",
|
|
|
|
FALSE,
|
|
|
|
CLUTTER_PARAM_READABLE);
|
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ClutterMedia:buffer-fill:
|
|
|
|
*
|
|
|
|
* The fill level of the buffer for the current stream,
|
|
|
|
* as a value between 0.0 and 1.0.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
pspec = g_param_spec_double ("buffer-fill",
|
|
|
|
"Buffer Fill",
|
|
|
|
"The fill level of the buffer",
|
|
|
|
0.0, 1.0, 0.0,
|
|
|
|
CLUTTER_PARAM_READABLE);
|
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ClutterMedia:duration:
|
|
|
|
*
|
|
|
|
* The duration of the current stream, in seconds
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
2009-02-24 11:16:25 -05:00
|
|
|
pspec = g_param_spec_double ("duration",
|
|
|
|
"Duration",
|
|
|
|
"The duration of the stream, in seconds",
|
|
|
|
0, G_MAXDOUBLE, 0,
|
|
|
|
CLUTTER_PARAM_READABLE);
|
2009-01-16 05:38:36 -05:00
|
|
|
g_object_interface_install_property (g_iface, pspec);
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2007-07-29 05:11:57 -04:00
|
|
|
/**
|
|
|
|
* ClutterMedia::eos:
|
|
|
|
* @media: the #ClutterMedia instance that received the signal
|
|
|
|
*
|
|
|
|
* The ::eos signal is emitted each time the media stream ends.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
2008-11-21 11:18:38 -05:00
|
|
|
media_signals[EOS_SIGNAL] =
|
2007-07-29 05:11:57 -04:00
|
|
|
g_signal_new ("eos",
|
|
|
|
CLUTTER_TYPE_MEDIA,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2009-01-16 05:38:36 -05:00
|
|
|
G_STRUCT_OFFSET (ClutterMediaIface, eos),
|
2007-07-29 05:11:57 -04:00
|
|
|
NULL, NULL,
|
2010-06-11 10:49:46 -04:00
|
|
|
_clutter_marshal_VOID__VOID,
|
2007-07-29 05:11:57 -04:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
/**
|
|
|
|
* ClutterMedia::error:
|
|
|
|
* @media: the #ClutterMedia instance that received the signal
|
|
|
|
* @error: the #GError
|
|
|
|
*
|
|
|
|
* The ::error signal is emitted each time an error occurred.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
2008-11-21 11:18:38 -05:00
|
|
|
media_signals[ERROR_SIGNAL] =
|
2007-07-29 05:11:57 -04:00
|
|
|
g_signal_new ("error",
|
|
|
|
CLUTTER_TYPE_MEDIA,
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2009-01-16 05:38:36 -05:00
|
|
|
G_STRUCT_OFFSET (ClutterMediaIface, error),
|
2007-07-29 05:11:57 -04:00
|
|
|
NULL, NULL,
|
2010-06-11 10:49:46 -04:00
|
|
|
_clutter_marshal_VOID__POINTER,
|
2007-07-29 05:11:57 -04:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
G_TYPE_POINTER);
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
|
|
|
|
GType
|
|
|
|
clutter_media_get_type (void)
|
|
|
|
{
|
|
|
|
static GType media_type = 0;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (media_type == 0))
|
|
|
|
{
|
|
|
|
const GTypeInfo media_info = {
|
|
|
|
sizeof (ClutterMediaIface), /* class size */
|
|
|
|
clutter_media_base_init, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
};
|
|
|
|
|
|
|
|
media_type = g_type_register_static (G_TYPE_INTERFACE,
|
|
|
|
I_("ClutterMedia"),
|
|
|
|
&media_info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return media_type;
|
|
|
|
}
|
|
|
|
|
2006-09-01 13:26:47 -04:00
|
|
|
/**
|
|
|
|
* clutter_media_set_uri:
|
2009-01-16 05:38:36 -05:00
|
|
|
* @media: a #ClutterMedia
|
|
|
|
* @uri: the URI of the media stream
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Sets the URI of @media to @uri.
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_media_set_uri (ClutterMedia *media,
|
2009-01-16 05:38:36 -05:00
|
|
|
const gchar *uri)
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_MEDIA(media));
|
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
g_object_set (G_OBJECT (media), "uri", uri, NULL);
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_media_get_uri:
|
2009-01-16 05:38:36 -05:00
|
|
|
* @media: a #ClutterMedia
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
|
|
|
* Retrieves the URI from @media.
|
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Return value: the URI of the media stream. Use g_free()
|
|
|
|
* to free the returned string
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
2009-01-16 05:38:36 -05:00
|
|
|
gchar *
|
2006-09-01 13:26:47 -04:00
|
|
|
clutter_media_get_uri (ClutterMedia *media)
|
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
gchar *retval = NULL;
|
|
|
|
|
2006-09-01 13:26:47 -04:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
|
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
g_object_get (G_OBJECT (media), "uri", &retval, NULL);
|
|
|
|
|
|
|
|
return retval;
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_media_set_playing:
|
2009-01-16 05:38:36 -05:00
|
|
|
* @media: a #ClutterMedia
|
|
|
|
* @playing: %TRUE to start playing
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Starts or stops playing of @media.
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_media_set_playing (ClutterMedia *media,
|
|
|
|
gboolean playing)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_MEDIA(media));
|
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
g_object_set (G_OBJECT (media), "playing", playing, NULL);
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_media_get_playing:
|
|
|
|
* @media: A #ClutterMedia object
|
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Retrieves the playing status of @media.
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Return value: %TRUE if playing, %FALSE if stopped.
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_media_get_playing (ClutterMedia *media)
|
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
gboolean is_playing = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), FALSE);
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
g_object_get (G_OBJECT (media), "playing", &is_playing, NULL);
|
|
|
|
|
|
|
|
return is_playing;
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-01-16 05:38:36 -05:00
|
|
|
* clutter_media_set_progress:
|
|
|
|
* @media: a #ClutterMedia
|
|
|
|
* @progress: the progress of the playback, between 0.0 and 1.0
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Sets the playback progress of @media. The @progress is
|
|
|
|
* a normalized value between 0.0 (begin) and 1.0 (end).
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Since: 1.0
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
void
|
2009-01-16 05:38:36 -05:00
|
|
|
clutter_media_set_progress (ClutterMedia *media,
|
|
|
|
gdouble progress)
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
g_return_if_fail (CLUTTER_IS_MEDIA (media));
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
g_object_set (G_OBJECT (media), "progress", progress, NULL);
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-01-16 05:38:36 -05:00
|
|
|
* clutter_media_get_progress:
|
|
|
|
* @media: a #ClutterMedia
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Retrieves the playback progress of @media.
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Return value: the playback progress, between 0.0 and 1.0
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Since: 1.0
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
2009-01-16 05:38:36 -05:00
|
|
|
gdouble
|
|
|
|
clutter_media_get_progress (ClutterMedia *media)
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
gdouble retval = 0.0;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0);
|
|
|
|
|
|
|
|
g_object_get (G_OBJECT (media), "progress", &retval, NULL);
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
return retval;
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
2009-12-28 11:52:43 -05:00
|
|
|
/**
|
|
|
|
* clutter_media_set_subtitle_uri:
|
|
|
|
* @media: a #ClutterMedia
|
|
|
|
* @uri: the URI of a subtitle file
|
|
|
|
*
|
|
|
|
* Sets the location of a subtitle file to display while playing @media.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_media_set_subtitle_uri (ClutterMedia *media,
|
|
|
|
const char *uri)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_MEDIA (media));
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (media), "subtitle-uri", uri, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_media_get_subtitle_uri:
|
|
|
|
* @media: a #ClutterMedia
|
|
|
|
*
|
|
|
|
* Retrieves the URI of the subtitle file in use.
|
|
|
|
*
|
|
|
|
* Return value: the URI of the subtitle file. Use g_free()
|
|
|
|
* to free the returned string
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
gchar *
|
|
|
|
clutter_media_get_subtitle_uri (ClutterMedia *media)
|
|
|
|
{
|
|
|
|
gchar *retval = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
|
|
|
|
|
|
|
|
g_object_get (G_OBJECT (media), "subtitle-uri", &retval, NULL);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2010-01-06 06:48:46 -05:00
|
|
|
/**
|
|
|
|
* clutter_media_set_subtitle_font_name:
|
|
|
|
* @media: a #ClutterMedia
|
|
|
|
* @font_name: a font name, or %NULL to set the default font name
|
|
|
|
*
|
|
|
|
* Sets the font used by the subtitle renderer. The @font_name string must be
|
|
|
|
* either %NULL, which means that the default font name of the underlying
|
|
|
|
* implementation will be used; or must follow the grammar recognized by
|
|
|
|
* pango_font_description_from_string() like:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* clutter_media_set_subtitle_font_name (media, "Sans 24pt");
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_media_set_subtitle_font_name (ClutterMedia *media,
|
|
|
|
const char *font_name)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_MEDIA (media));
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (media), "subtitle-font-name", font_name, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_media_get_subtitle_font_name:
|
|
|
|
* @media: a #ClutterMedia
|
|
|
|
*
|
|
|
|
* Retrieves the font name currently used.
|
|
|
|
*
|
|
|
|
* Return value: a string containing the font name. Use g_free()
|
|
|
|
* to free the returned string
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
gchar *
|
|
|
|
clutter_media_get_subtitle_font_name (ClutterMedia *media)
|
|
|
|
{
|
|
|
|
gchar *retval = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), NULL);
|
|
|
|
|
|
|
|
g_object_get (G_OBJECT (media), "subtitle-font-name", &retval, NULL);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2006-09-01 13:26:47 -04:00
|
|
|
/**
|
2009-01-16 05:38:36 -05:00
|
|
|
* clutter_media_set_audio_volume:
|
|
|
|
* @media: a #ClutterMedia
|
|
|
|
* @volume: the volume as a double between 0.0 and 1.0
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
|
|
|
* Sets the playback volume of @media to @volume.
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Since: 1.0
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
void
|
2009-01-16 05:38:36 -05:00
|
|
|
clutter_media_set_audio_volume (ClutterMedia *media,
|
|
|
|
gdouble volume)
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_MEDIA(media));
|
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
g_object_set (G_OBJECT (media), "audio-volume", volume, NULL);
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
/**
|
2009-01-16 05:38:36 -05:00
|
|
|
* clutter_media_get_audio_volume:
|
|
|
|
* @media: a #ClutterMedia
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2006-09-01 13:26:47 -04:00
|
|
|
* Retrieves the playback volume of @media.
|
|
|
|
*
|
|
|
|
* Return value: The playback volume between 0.0 and 1.0
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Since: 1.0
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
2009-01-16 05:38:36 -05:00
|
|
|
gdouble
|
|
|
|
clutter_media_get_audio_volume (ClutterMedia *media)
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
gdouble retval = 0.0;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0.0);
|
|
|
|
|
|
|
|
g_object_get (G_OBJECT (media), "audio-volume", &retval, NULL);
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
return retval;
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_media_get_can_seek:
|
2009-01-16 05:38:36 -05:00
|
|
|
* @media: a #ClutterMedia
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
|
|
|
* Retrieves whether @media is seekable or not.
|
|
|
|
*
|
2008-02-15 10:18:02 -05:00
|
|
|
* Return value: %TRUE if @media can seek, %FALSE otherwise.
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_media_get_can_seek (ClutterMedia *media)
|
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), FALSE);
|
|
|
|
|
|
|
|
g_object_get (G_OBJECT (media), "can-seek", &retval, NULL);
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
return retval;
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-01-16 05:38:36 -05:00
|
|
|
* clutter_media_get_buffer_fill:
|
|
|
|
* @media: a #ClutterMedia
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
|
|
|
* Retrieves the amount of the stream that is buffered.
|
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Return value: the fill level, between 0.0 and 1.0
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Since: 1.0
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
2009-01-16 05:38:36 -05:00
|
|
|
gdouble
|
|
|
|
clutter_media_get_buffer_fill (ClutterMedia *media)
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
2009-01-16 05:38:36 -05:00
|
|
|
gdouble retval = 0.0;
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA (media), 0);
|
|
|
|
|
|
|
|
g_object_get (G_OBJECT (media), "buffer-fill", &retval, NULL);
|
|
|
|
|
|
|
|
return retval;
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_media_get_duration:
|
2009-01-16 05:38:36 -05:00
|
|
|
* @media: a #ClutterMedia
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
|
|
|
* Retrieves the duration of the media stream that @media represents.
|
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Return value: the duration of the media stream, in seconds
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
2009-02-24 11:16:25 -05:00
|
|
|
gdouble
|
2006-09-01 13:26:47 -04:00
|
|
|
clutter_media_get_duration (ClutterMedia *media)
|
|
|
|
{
|
2009-02-24 11:16:25 -05:00
|
|
|
gdouble retval = 0;
|
2009-01-16 05:38:36 -05:00
|
|
|
|
2006-09-01 13:26:47 -04:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_MEDIA(media), 0);
|
|
|
|
|
2009-01-16 05:38:36 -05:00
|
|
|
g_object_get (G_OBJECT (media), "duration", &retval, NULL);
|
|
|
|
|
|
|
|
return retval;
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* helper funcs */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_media_set_filename:
|
2009-01-16 05:38:36 -05:00
|
|
|
* @media: a #ClutterMedia
|
|
|
|
* @filename: A filename
|
2006-09-01 13:26:47 -04:00
|
|
|
*
|
2009-01-16 05:38:36 -05:00
|
|
|
* Sets the source of @media using a file path.
|
2008-11-07 13:00:59 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-09-01 13:26:47 -04:00
|
|
|
*/
|
|
|
|
void
|
2007-07-29 05:11:57 -04:00
|
|
|
clutter_media_set_filename (ClutterMedia *media,
|
|
|
|
const gchar *filename)
|
2006-09-01 13:26:47 -04:00
|
|
|
{
|
|
|
|
gchar *uri;
|
2007-07-29 05:11:57 -04:00
|
|
|
GError *uri_error = NULL;
|
|
|
|
|
|
|
|
if (!g_path_is_absolute (filename))
|
|
|
|
{
|
|
|
|
gchar *abs_path;
|
2006-09-01 13:26:47 -04:00
|
|
|
|
2007-07-29 05:11:57 -04:00
|
|
|
abs_path = g_build_filename (g_get_current_dir (), filename, NULL);
|
|
|
|
uri = g_filename_to_uri (abs_path, NULL, &uri_error);
|
|
|
|
g_free (abs_path);
|
|
|
|
}
|
|
|
|
else
|
2008-11-07 13:00:59 -05:00
|
|
|
uri = g_filename_to_uri (filename, NULL, &uri_error);
|
2007-07-29 05:11:57 -04:00
|
|
|
|
|
|
|
if (uri_error)
|
|
|
|
{
|
2008-11-21 11:18:38 -05:00
|
|
|
g_signal_emit (media, media_signals[ERROR_SIGNAL], 0, uri_error);
|
2007-07-29 05:11:57 -04:00
|
|
|
g_error_free (uri_error);
|
|
|
|
return;
|
|
|
|
}
|
2006-09-01 13:26:47 -04:00
|
|
|
|
|
|
|
clutter_media_set_uri (media, uri);
|
|
|
|
|
2007-07-29 05:11:57 -04:00
|
|
|
g_free (uri);
|
2006-09-01 13:26:47 -04:00
|
|
|
}
|