-
Notifications
You must be signed in to change notification settings - Fork 12
/
example-renderer-plugin.c
96 lines (71 loc) · 2.88 KB
/
example-renderer-plugin.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* Copyright (C) 2012 Intel Corporation
*
* This file is part of Rygel.
*
* Rygel 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.1 of the License, or (at your option) any later version.
*
* Rygel 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
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "example-renderer-plugin.h"
#include "example-player.h"
#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 (RygelExampleRendererPlugin, rygel_example_renderer_plugin, RYGEL_TYPE_MEDIA_RENDERER_PLUGIN)
static RygelExamplePlayer *player;
void
module_init (RygelPluginLoader* loader) {
RygelExampleRendererPlugin* plugin;
g_return_if_fail (loader != NULL);
if (rygel_plugin_loader_plugin_disabled (loader, RYGEL_EXAMPLE_RENDERER_PLUGIN_NAME)) {
g_message ("Plugin '%s' disabled by user. Ignoring.",
RYGEL_EXAMPLE_RENDERER_PLUGIN_NAME);
return;
}
plugin = rygel_example_renderer_plugin_new ();
rygel_plugin_loader_add_plugin (loader, RYGEL_PLUGIN (plugin));
g_object_unref (plugin);
}
static RygelExampleRendererPlugin*
rygel_example_renderer_plugin_construct (GType object_type) {
RygelExampleRendererPlugin *self;
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;
}
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 (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 (RygelExampleRendererPlugin *self) {
}