• 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 "gstmpdnode.h"
22 
23 G_DEFINE_TYPE (GstMPDNode, gst_mpd_node, GST_TYPE_OBJECT);
24 
25 /* GObject VMethods */
26 
27 static void
gst_mpd_node_class_init(GstMPDNodeClass * klass)28 gst_mpd_node_class_init (GstMPDNodeClass * klass)
29 {
30 }
31 
32 static void
gst_mpd_node_init(GstMPDNode * self)33 gst_mpd_node_init (GstMPDNode * self)
34 {
35 }
36 
37 void
gst_mpd_node_get_list_item(gpointer data,gpointer user_data)38 gst_mpd_node_get_list_item (gpointer data, gpointer user_data)
39 {
40   GstMPDNode *node = (GstMPDNode *) data;
41   xmlNodePtr parent_xml_node = (xmlNodePtr) user_data;
42   xmlNodePtr new_xml_node = gst_mpd_node_get_xml_pointer (node);
43 
44   xmlAddChild (parent_xml_node, new_xml_node);
45 }
46 
47 void
gst_mpd_node_add_child_node(GstMPDNode * child,xmlNodePtr parent)48 gst_mpd_node_add_child_node (GstMPDNode * child, xmlNodePtr parent)
49 {
50   xmlNodePtr new_xml_node = gst_mpd_node_get_xml_pointer (child);
51   xmlAddChild (parent, new_xml_node);
52 }
53 
54 gboolean
gst_mpd_node_get_xml_buffer(GstMPDNode * node,gchar ** xml_content,int * xml_size)55 gst_mpd_node_get_xml_buffer (GstMPDNode * node, gchar ** xml_content,
56     int *xml_size)
57 {
58   GstMPDNodeClass *klass;
59 
60   klass = GST_MPD_NODE_GET_CLASS (node);
61   if (klass->get_xml_buffer)
62     return klass->get_xml_buffer (node, xml_content, xml_size);
63   else
64     return FALSE;
65 }
66 
67 xmlNodePtr
gst_mpd_node_get_xml_pointer(GstMPDNode * node)68 gst_mpd_node_get_xml_pointer (GstMPDNode * node)
69 {
70   GstMPDNodeClass *klass;
71   if (!node)
72     return NULL;
73   klass = GST_MPD_NODE_GET_CLASS (node);
74   if (klass->get_xml_node)
75     return klass->get_xml_node (node);
76   else
77     return NULL;
78 }
79