• 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 "gstmpdmetricsrangenode.h"
22 #include "gstmpdparser.h"
23 
24 G_DEFINE_TYPE (GstMPDMetricsRangeNode, gst_mpd_metrics_range_node,
25     GST_TYPE_MPD_NODE);
26 
27 /* Base class */
28 
29 static xmlNodePtr
gst_mpd_metrics_range_get_xml_node(GstMPDNode * node)30 gst_mpd_metrics_range_get_xml_node (GstMPDNode * node)
31 {
32   xmlNodePtr metrics_range_xml_node = NULL;
33   GstMPDMetricsRangeNode *self = GST_MPD_METRICS_RANGE_NODE (node);
34 
35   metrics_range_xml_node = xmlNewNode (NULL, (xmlChar *) "Range");
36 
37   if (self->starttime)
38     gst_xml_helper_set_prop_duration (metrics_range_xml_node, "starttime",
39         self->starttime);
40   if (self->duration)
41     gst_xml_helper_set_prop_duration (metrics_range_xml_node, "duration",
42         self->duration);
43 
44   return metrics_range_xml_node;
45 }
46 
47 static void
gst_mpd_metrics_range_node_class_init(GstMPDMetricsRangeNodeClass * klass)48 gst_mpd_metrics_range_node_class_init (GstMPDMetricsRangeNodeClass * klass)
49 {
50   GstMPDNodeClass *m_klass;
51 
52   m_klass = GST_MPD_NODE_CLASS (klass);
53 
54   m_klass->get_xml_node = gst_mpd_metrics_range_get_xml_node;
55 }
56 
57 static void
gst_mpd_metrics_range_node_init(GstMPDMetricsRangeNode * self)58 gst_mpd_metrics_range_node_init (GstMPDMetricsRangeNode * self)
59 {
60   self->starttime = 0;          /* [ms] */
61   self->duration = 0;           /* [ms] */
62 }
63 
64 GstMPDMetricsRangeNode *
gst_mpd_metrics_range_node_new(void)65 gst_mpd_metrics_range_node_new (void)
66 {
67   return g_object_new (GST_TYPE_MPD_METRICS_RANGE_NODE, NULL);
68 }
69 
70 void
gst_mpd_metrics_range_node_free(GstMPDMetricsRangeNode * self)71 gst_mpd_metrics_range_node_free (GstMPDMetricsRangeNode * self)
72 {
73   if (self)
74     gst_object_unref (self);
75 }
76