2 * Copyright (C) 2010 Nokia Corporation.
4 * Authors: Arun Raghavan <arun.raghavan@collabora.co.uk>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include "gupnp-dlna-information.h"
24 G_DEFINE_TYPE (GUPnPDLNAInformation, gupnp_dlna_information, G_TYPE_OBJECT)
26 #define GET_PRIVATE(o) \
27 (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
28 GUPNP_TYPE_DLNA_INFORMATION, \
29 GUPnPDLNAInformationPrivate))
31 typedef struct _GUPnPDLNAInformationPrivate GUPnPDLNAInformationPrivate;
33 struct _GUPnPDLNAInformationPrivate {
34 GstDiscovererInformation *info;
47 gupnp_dlna_information_get_property (GObject *object,
52 GUPnPDLNAInformation *self = GUPNP_DLNA_INFORMATION (object);
53 GUPnPDLNAInformationPrivate *priv = GET_PRIVATE (self);
55 switch (property_id) {
57 g_value_set_string (value, priv->name);
61 g_value_set_string (value, priv->mime);
64 case PROP_DISCOVERER_INFO:
65 g_value_set_boxed (value, priv->info);
69 G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
77 gupnp_dlna_information_set_property (GObject *object,
82 GUPnPDLNAInformation *self = GUPNP_DLNA_INFORMATION (object);
83 GUPnPDLNAInformationPrivate *priv = GET_PRIVATE (self);
85 switch (property_id) {
88 priv->name = g_value_dup_string (value);
93 priv->mime = g_value_dup_string (value);
96 case PROP_DISCOVERER_INFO:
98 gst_discoverer_information_free (priv->info);
99 priv->info = g_value_dup_boxed (value);
103 G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
112 gupnp_dlna_information_finalize (GObject *object)
114 GUPnPDLNAInformation *self = GUPNP_DLNA_INFORMATION (object);
115 GUPnPDLNAInformationPrivate *priv = GET_PRIVATE (self);
120 gst_discoverer_information_free (priv->info);
122 G_OBJECT_CLASS (gupnp_dlna_information_parent_class)->finalize (object);
126 gupnp_dlna_information_class_init (GUPnPDLNAInformationClass *klass)
128 GObjectClass *object_class = G_OBJECT_CLASS (klass);
131 g_type_class_add_private (klass, sizeof (GUPnPDLNAInformation));
133 object_class->get_property = gupnp_dlna_information_get_property;
134 object_class->set_property = gupnp_dlna_information_set_property;
135 object_class->finalize = gupnp_dlna_information_finalize;
137 pspec = g_param_spec_string ("name",
139 "The name of the DLNA profile"
140 "corresponding to the strream",
142 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
143 g_object_class_install_property (object_class, PROP_DLNA_NAME, pspec);
145 pspec = g_param_spec_string ("mime",
146 "DLNA profile MIME type corresponding"
148 "The MIME type of the DLNA profile",
150 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
151 g_object_class_install_property (object_class, PROP_DLNA_NAME, pspec);
153 pspec = g_param_spec_boxed ("info",
155 "Metadata of the stream in an"
156 "GstDiscovererInformation structure",
157 GST_TYPE_DISCOVERER_INFORMATION,
158 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
159 g_object_class_install_property (object_class,
160 PROP_DISCOVERER_INFO,
165 gupnp_dlna_information_init (GUPnPDLNAInformation *self)
167 GUPnPDLNAInformationPrivate *priv = GET_PRIVATE (self);
174 GUPnPDLNAInformation*
175 gupnp_dlna_information_new (gchar *name,
177 GstDiscovererInformation *info)
179 return g_object_new (GUPNP_TYPE_DLNA_INFORMATION,
187 gupnp_dlna_information_get_name (GUPnPDLNAInformation *self)
189 GUPnPDLNAInformationPrivate *priv = GET_PRIVATE (self);
194 gupnp_dlna_information_get_mime (GUPnPDLNAInformation *self)
196 GUPnPDLNAInformationPrivate *priv = GET_PRIVATE (self);
200 GstDiscovererInformation *
201 gupnp_dlna_information_get_info (GUPnPDLNAInformation *self)
203 GUPnPDLNAInformationPrivate *priv = GET_PRIVATE (self);