• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "gstmpdsnode.h"
22 #include "gstmpdparser.h"
23 
24 G_DEFINE_TYPE (GstMPDSNode, gst_mpd_s_node, GST_TYPE_MPD_NODE);
25 
26 /* Base class */
27 
28 static xmlNodePtr
gst_mpd_s_get_xml_node(GstMPDNode * node)29 gst_mpd_s_get_xml_node (GstMPDNode * node)
30 {
31   xmlNodePtr s_xml_node = NULL;
32   GstMPDSNode *self = GST_MPD_S_NODE (node);
33 
34   s_xml_node = xmlNewNode (NULL, (xmlChar *) "S");
35 
36   if (self->t)
37     gst_xml_helper_set_prop_uint64 (s_xml_node, "t", self->t);
38 
39   if (self->d)
40     gst_xml_helper_set_prop_uint64 (s_xml_node, "d", self->d);
41 
42   if (self->r)
43     gst_xml_helper_set_prop_int (s_xml_node, "r", self->r);
44 
45   return s_xml_node;
46 }
47 
48 static void
gst_mpd_s_node_class_init(GstMPDSNodeClass * klass)49 gst_mpd_s_node_class_init (GstMPDSNodeClass * klass)
50 {
51   GstMPDNodeClass *m_klass;
52 
53   m_klass = GST_MPD_NODE_CLASS (klass);
54 
55   m_klass->get_xml_node = gst_mpd_s_get_xml_node;
56 }
57 
58 static void
gst_mpd_s_node_init(GstMPDSNode * self)59 gst_mpd_s_node_init (GstMPDSNode * self)
60 {
61   self->t = 0;
62   self->d = 0;
63   self->r = 0;
64 }
65 
66 GstMPDSNode *
gst_mpd_s_node_new(void)67 gst_mpd_s_node_new (void)
68 {
69   return g_object_new (GST_TYPE_MPD_S_NODE, NULL);
70 }
71 
72 void
gst_mpd_s_node_free(GstMPDSNode * self)73 gst_mpd_s_node_free (GstMPDSNode * self)
74 {
75   if (self)
76     gst_object_unref (self);
77 }
78 
79 GstMPDSNode *
gst_mpd_s_node_clone(GstMPDSNode * s_node)80 gst_mpd_s_node_clone (GstMPDSNode * s_node)
81 {
82   GstMPDSNode *clone = NULL;
83 
84   if (s_node) {
85     clone = gst_mpd_s_node_new ();
86     clone->t = s_node->t;
87     clone->d = s_node->d;
88     clone->r = s_node->r;
89   }
90 
91   return clone;
92 }
93