static gint64
rygel_example_player_real_get_position (RygelMediaPlayer *base);
+static gboolean
+rygel_example_player_real_get_can_seek (RygelMediaPlayer *base);
+
static void
_rygel_example_player_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static const gchar* RYGEL_EXAMPLE_PLAYER_MIME_TYPES[] = {"image/jpeg", "image/png", NULL};
RygelExamplePlayer*
-rygel_example_player_construct (GType object_type) {
- RygelExamplePlayer *self;
-
-
- return self;
-}
-
-
-RygelExamplePlayer*
rygel_example_player_new (void) {
- return rygel_example_player_construct (RYGEL_EXAMPLE_TYPE_PLAYER);
+ return g_object_new (RYGEL_EXAMPLE_TYPE_PLAYER, NULL);
}
iface->set_volume = rygel_example_player_real_set_volume;
iface->get_duration = rygel_example_player_real_get_duration;
iface->get_position = rygel_example_player_real_get_position;
+ iface->get_can_seek = rygel_example_player_real_get_can_seek;
}
static void
static void
rygel_example_player_init (RygelExamplePlayer *self) {
- self->priv = RYGEL_EXAMPLE_PLAYER_GET_PRIVATE (self);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ RYGEL_EXAMPLE_TYPE_PLAYER,
+ RygelExamplePlayerPrivate);
self->priv->_playback_state = g_strdup ("NO_MEDIA_PRESENT");
self->priv->_uri = NULL;
return self->priv->_position;
}
+static gboolean
+rygel_example_player_real_get_can_seek (RygelMediaPlayer *base) {
+ return FALSE;
+}
+
+
static void
_rygel_example_player_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) {
RygelMediaPlayer *base = RYGEL_MEDIA_PLAYER (object);
g_value_set_int64 (value, rygel_media_player_get_position (base));
break;
case RYGEL_EXAMPLE_PLAYER_CAN_SEEK:
- g_value_set_boolean (value, FALSE);
+ g_value_set_boolean (value, rygel_media_player_get_can_seek (base));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#include "example-renderer-plugin.h"
#include "example-player.h"
-#define RYGEL_EXAMPLE_RENDERER_PLUGIN_NAME "ExampleRenderPluginC"
+#define RYGEL_EXAMPLE_RENDERER_PLUGIN_NAME "ExampleRendererPluginC"
enum {
RYGEL_EXAMPLE_RENDERER_PLUGIN_DUMMY_PROPERTY
#define RYGEL_EXAMPLE_RENDERER_PLUGIN_TITLE "Example Render Plugin C"
#define RYGEL_EXAMPLE_RENDERER_PLUGIN_DESCRIPTION "An example Rygel renderer plugin implemented in C."
-G_DEFINE_TYPE (RygelExampleRenderPlugin, rygel_example_renderer_plugin, RYGEL_TYPE_MEDIA_RENDERER_PLUGIN)
+G_DEFINE_TYPE (RygelExampleRendererPlugin, rygel_example_renderer_plugin, RYGEL_TYPE_MEDIA_RENDERER_PLUGIN)
+
+static RygelExamplePlayer *player;
void
module_init (RygelPluginLoader* loader) {
- RygelExampleRenderPlugin* plugin;
+ RygelExampleRendererPlugin* plugin;
g_return_if_fail (loader != NULL);
}
-RygelExampleRenderPlugin*
+RygelExampleRendererPlugin*
rygel_example_renderer_plugin_construct (GType object_type) {
- RygelExampleRenderPlugin *self;
- RygelExampleRootContainer *root_container;
+ RygelExampleRendererPlugin *self;
- root_container =
- rygel_example_root_container_new (RYGEL_EXAMPLE_RENDERER_PLUGIN_TITLE);
- self = (RygelExampleRenderPlugin*) rygel_media_renderer_plugin_construct (object_type,
- (RygelMediaContainer*) root_container, RYGEL_EXAMPLE_RENDERER_PLUGIN_NAME,
- RYGEL_EXAMPLE_RENDERER_PLUGIN_DESCRIPTION, RYGEL_PLUGIN_CAPABILITIES_NONE);
- g_object_unref (root_container);
+ self = (RygelExampleRendererPlugin*) rygel_media_renderer_plugin_construct (object_type,
+ RYGEL_EXAMPLE_RENDERER_PLUGIN_NAME, NULL, RYGEL_EXAMPLE_RENDERER_PLUGIN_DESCRIPTION,
+ RYGEL_PLUGIN_CAPABILITIES_NONE);
return self;
}
-RygelExampleRenderPlugin*
+RygelExampleRendererPlugin*
rygel_example_renderer_plugin_new (void) {
return rygel_example_renderer_plugin_construct (RYGEL_EXAMPLE_TYPE_RENDERER_PLUGIN);
}
+static RygelMediaPlayer *
+rygel_example_renderer_plugin_get_player (RygelMediaRendererPlugin* plugin)
+{
+ if (player == NULL) {
+ player = rygel_example_player_new ();
+ }
+
+ return RYGEL_EXAMPLE_PLAYER (g_object_ref (player));
+}
+
static void
-rygel_example_renderer_plugin_class_init (RygelExampleRenderPluginClass *klass) {
+rygel_example_renderer_plugin_class_init (RygelExampleRendererPluginClass *klass) {
+ RygelMediaRendererPluginClass *plugin_class;
+
+ plugin_class = RYGEL_EXAMPLE_RENDERER_PLUGIN_CLASS (klass);
+ plugin_class->get_player = rygel_example_renderer_plugin_get_player;
}
static void
-rygel_example_renderer_plugin_init (RygelExampleRenderPlugin *self) {
+rygel_example_renderer_plugin_init (RygelExampleRendererPlugin *self) {
}