File: example-root-container.c

package info (click to toggle)
rygel 0.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 31,444 kB
  • ctags: 44,883
  • sloc: ansic: 221,452; sh: 11,478; xml: 1,554; makefile: 1,107
file content (78 lines) | stat: -rw-r--r-- 2,702 bytes parent folder | download
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
/*
 * 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 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 program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include "example-root-container.h"

/**
 * Our derived MediaContainer.
 * In this example, we just derive from the SimpleContainer,
 * but a real-world server plugin might need something more sophisticated.
 */

enum  {
  RYGEL_EXAMPLE_ROOT_CONTAINER_DUMMY_PROPERTY
};

G_DEFINE_TYPE (RygelExampleRootContainer, rygel_example_root_container, RYGEL_TYPE_SIMPLE_CONTAINER)

RygelExampleRootContainer* rygel_example_root_container_new (const gchar *title);

static RygelExampleRootContainer*
rygel_example_root_container_construct (GType object_type, const gchar *title) {
  RygelExampleRootContainer *self;
  RygelMediaItem *item;

  g_return_val_if_fail (title != NULL, NULL);
  
  self = (RygelExampleRootContainer*) rygel_simple_container_construct_root (object_type, title);

  item = rygel_music_item_new ("test 1", (RygelMediaContainer*) self, "Test 1", RYGEL_MUSIC_ITEM_UPNP_CLASS);
  rygel_media_item_add_uri (item, "file:///home/murrayc/Music/Madness/05_Baggy_Trousers.mp3");
  rygel_media_item_set_mime_type (item, "audio/mpeg");
  rygel_simple_container_add_child_item ((RygelSimpleContainer*) self, item);
  g_object_unref (item);
  
  item = rygel_music_item_new ("test 2", (RygelMediaContainer*) self, "Test 1", RYGEL_MUSIC_ITEM_UPNP_CLASS);
  rygel_media_item_add_uri (item, "file:///home/murrayc/Music/08%20Busload%20of%20Faith.mp3");
  rygel_media_item_set_mime_type (item, "audio/mpeg");
  rygel_simple_container_add_child_item ((RygelSimpleContainer*) self, item);
  g_object_unref (item);

  return self;
}


RygelExampleRootContainer*
rygel_example_root_container_new (const gchar *title) {
  return rygel_example_root_container_construct (RYGEL_EXAMPLE_TYPE_ROOT_CONTAINER, title);
}


static void
rygel_example_root_container_class_init (RygelExampleRootContainerClass *klass) {
}


static void
rygel_example_root_container_init (RygelExampleRootContainer *self) {
}