1 /* GStreamer
2 *
3 * Copyright (C) 2019 Collabora Ltd.
4 * Author: Stéphane Cerveau <scerveau@collabora.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
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 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21 #include "gstmpdlocationnode.h"
22 #include "gstmpdparser.h"
23
24 G_DEFINE_TYPE (GstMPDLocationNode, gst_mpd_location_node, GST_TYPE_MPD_NODE);
25
26 /* GObject VMethods */
27
28 static void
gst_mpd_location_node_finalize(GObject * object)29 gst_mpd_location_node_finalize (GObject * object)
30 {
31 GstMPDLocationNode *self = GST_MPD_LOCATION_NODE (object);
32
33 g_free (self->location);
34
35 G_OBJECT_CLASS (gst_mpd_location_node_parent_class)->finalize (object);
36 }
37
38 /* Base class */
39
40 static xmlNodePtr
gst_mpd_location_get_xml_node(GstMPDNode * node)41 gst_mpd_location_get_xml_node (GstMPDNode * node)
42 {
43 xmlNodePtr location_xml_node = NULL;
44 GstMPDLocationNode *self = GST_MPD_LOCATION_NODE (node);
45
46 location_xml_node = xmlNewNode (NULL, (xmlChar *) "Location");
47
48 if (self->location)
49 gst_xml_helper_set_content (location_xml_node, self->location);
50
51 return location_xml_node;
52 }
53
54 static void
gst_mpd_location_node_class_init(GstMPDLocationNodeClass * klass)55 gst_mpd_location_node_class_init (GstMPDLocationNodeClass * klass)
56 {
57 GObjectClass *object_class;
58 GstMPDNodeClass *m_klass;
59
60 object_class = G_OBJECT_CLASS (klass);
61 object_class->finalize = gst_mpd_location_node_finalize;
62
63 m_klass = GST_MPD_NODE_CLASS (klass);
64 m_klass->get_xml_node = gst_mpd_location_get_xml_node;
65 }
66
67 static void
gst_mpd_location_node_init(GstMPDLocationNode * self)68 gst_mpd_location_node_init (GstMPDLocationNode * self)
69 {
70 self->location = NULL;
71 }
72
73 GstMPDLocationNode *
gst_mpd_location_node_new(void)74 gst_mpd_location_node_new (void)
75 {
76 return g_object_new (GST_TYPE_MPD_LOCATION_NODE, NULL);
77 }
78
79 void
gst_mpd_location_node_free(GstMPDLocationNode * self)80 gst_mpd_location_node_free (GstMPDLocationNode * self)
81 {
82 if (self)
83 gst_object_unref (self);
84 }
85