Debian Codegraph @

ext/adaptivedemux2/dash/gstxmlhelper.h

raw
1 /* GStreamer
2 *
3 * Copyright (C) 2019 Collabora Ltd.
4 * Author: Stéphane Cerveau <[email protected]>
5 *
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.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 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library (COPYING); if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21 #ifndef __GST_XMLHELPER_H__
22 #define __GST_XMLHELPER_H__
23
24 #include <libxml/parser.h>
25 #include <libxml/tree.h>
26 #include <gst/gst.h>
27 #include "gstmpd-prelude.h"
28 #include "gstdash_debug.h"
29
30 G_BEGIN_DECLS
31
32 typedef struct _GstXMLRange GstXMLRange;
33 typedef struct _GstXMLRatio GstXMLRatio;
34 typedef struct _GstXMLFrameRate GstXMLFrameRate;
35 typedef struct _GstXMLConditionalUintType GstXMLConditionalUintType;
36
37 struct _GstXMLRange
38 {
39 guint64 first_byte_pos;
40 guint64 last_byte_pos;
41 };
42
43 struct _GstXMLRatio
44 {
45 guint num;
46 guint den;
47 };
48
49 struct _GstXMLFrameRate
50 {
51 guint num;
52 guint den;
53 };
54
55 struct _GstXMLConditionalUintType
56 {
57 gboolean flag;
58 guint value;
59 };
60
61 GstXMLRange *gst_xml_helper_clone_range (GstXMLRange * range);
62 GstXMLRatio *gst_xml_helper_clone_ratio (GstXMLRatio * ratio);
63 GstXMLFrameRate *gst_xml_helper_clone_frame_rate (GstXMLFrameRate * frameRate);
64
65 /* XML property get method */
66 gboolean gst_xml_helper_get_prop_validated_string (xmlNode * a_node,
67 const gchar * property_name, gchar ** property_value,
68 gboolean (*validator) (const char *));
69 gboolean gst_xml_helper_get_prop_string (xmlNode * a_node,
70 const gchar * property_name, gchar ** property_value);
71 gboolean gst_xml_helper_get_prop_string_stripped (xmlNode * a_node,
72 const gchar * property_name, gchar ** property_value);
73 gboolean gst_xml_helper_get_ns_prop_string (xmlNode * a_node,
74 const gchar * ns_name, const gchar * property_name,
75 gchar ** property_value);
76 gboolean gst_xml_helper_get_prop_string_vector_type (xmlNode * a_node,
77 const gchar * property_name, gchar *** property_value);
78 gboolean gst_xml_helper_get_prop_signed_integer (xmlNode * a_node,
79 const gchar * property_name, gint default_val, gint * property_value);
80 gboolean gst_xml_helper_get_prop_unsigned_integer (xmlNode * a_node,
81 const gchar * property_name, guint default_val, guint * property_value);
82 gboolean gst_xml_helper_get_prop_unsigned_integer_64 (xmlNode *
83 a_node, const gchar * property_name, guint64 default_val,
84 guint64 * property_value);
85 gboolean gst_xml_helper_get_prop_uint_vector_type (xmlNode * a_node,
86 const gchar * property_name, guint ** property_value, guint * value_size);
87 gboolean gst_xml_helper_get_prop_double (xmlNode * a_node,
88 const gchar * property_name, gdouble * property_value);
89 gboolean gst_xml_helper_get_prop_boolean (xmlNode * a_node,
90 const gchar * property_name, gboolean default_val,
91 gboolean * property_value);
92 gboolean gst_xml_helper_get_prop_range (xmlNode * a_node,
93 const gchar * property_name, GstXMLRange ** property_value);
94 gboolean gst_xml_helper_get_prop_ratio (xmlNode * a_node,
95 const gchar * property_name, GstXMLRatio ** property_value);
96 gboolean gst_xml_helper_get_prop_framerate (xmlNode * a_node,
97 const gchar * property_name, GstXMLFrameRate ** property_value);
98 gboolean gst_xml_helper_get_prop_cond_uint (xmlNode * a_node,
99 const gchar * property_name, GstXMLConditionalUintType ** property_value);
100 gboolean gst_xml_helper_get_prop_dateTime (xmlNode * a_node,
101 const gchar * property_name, GstDateTime ** property_value);
102 gboolean gst_xml_helper_get_prop_duration (xmlNode * a_node,
103 const gchar * property_name, guint64 default_value,
104 guint64 * property_value);
105 gboolean gst_xml_helper_get_prop_string_no_whitespace (xmlNode * a_node,
106 const gchar * property_name, gchar ** property_value);
107
108 /* XML node get method */
109 gboolean gst_xml_helper_get_node_content (xmlNode * a_node,
110 gchar ** content);
111 gchar *gst_xml_helper_get_node_namespace (xmlNode * a_node,
112 const gchar * prefix);
113 gboolean gst_xml_helper_get_node_as_string (xmlNode * a_node,
114 gchar ** content);
115
116 /* XML property set method */
117 void gst_xml_helper_set_prop_string (xmlNodePtr node, const gchar * name, gchar* value);
118 void gst_xml_helper_set_prop_boolean (xmlNodePtr node, const gchar * name, gboolean value);
119 void gst_xml_helper_set_prop_int (xmlNodePtr root, const gchar * name, gint value);
120 void gst_xml_helper_set_prop_uint (xmlNodePtr root, const gchar * name, guint value);
121 void gst_xml_helper_set_prop_int64 (xmlNodePtr node, const gchar * name, gint64 value);
122 void gst_xml_helper_set_prop_uint64 (xmlNodePtr node, const gchar * name, guint64 value);
123 void gst_xml_helper_set_prop_uint_vector_type (xmlNode * a_node, const gchar * name, guint * value, guint value_size);
124 void gst_xml_helper_set_prop_double (xmlNodePtr node, const gchar * name, gdouble value);
125 void gst_xml_helper_set_prop_date_time (xmlNodePtr node, const gchar * name, GstDateTime* value);
126 void gst_xml_helper_set_prop_duration (xmlNode * node, const gchar * name, guint64 value);
127 void gst_xml_helper_set_prop_ratio (xmlNodePtr node, const gchar * name, GstXMLRatio* value);
128 void gst_xml_helper_set_prop_framerate (xmlNodePtr node, const gchar * name, GstXMLFrameRate* value);
129 void gst_xml_helper_set_prop_range (xmlNodePtr node, const gchar * name, GstXMLRange* value);
130 void gst_xml_helper_set_prop_cond_uint (xmlNode * a_node, const gchar * property_name, GstXMLConditionalUintType * cond);
131 void gst_xml_helper_set_content (xmlNodePtr node, gchar * content);
132
133 G_END_DECLS
134 #endif /* __GST_XMLHELPER_H__ */