summaryrefslogtreecommitdiff
path: root/ext/dash/gstxmlhelper.h
blob: af3e8ff9e13e5b01538f5db5587d5e912e61c3fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* GStreamer
 *
 * Copyright (C) 2019 Collabora Ltd.
 *   Author: Stéphane Cerveau <scerveau@collabora.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library (COPYING); if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
#ifndef __GST_XMLHELPER_H__
#define __GST_XMLHELPER_H__

#include <libxml/parser.h>
#include <libxml/tree.h>
#include <gst/gst.h>

G_BEGIN_DECLS

typedef struct _GstXMLRange                  GstXMLRange;
typedef struct _GstXMLRatio                  GstXMLRatio;
typedef struct _GstXMLFrameRate              GstXMLFrameRate;
typedef struct _GstXMLConditionalUintType    GstXMLConditionalUintType;

struct _GstXMLRange
{
  guint64 first_byte_pos;
  guint64 last_byte_pos;
};

struct _GstXMLRatio
{
  guint num;
  guint den;
};

struct _GstXMLFrameRate
{
  guint num;
  guint den;
};

struct _GstXMLConditionalUintType
{
  gboolean flag;
  guint value;
};

GstXMLRange *gst_xml_helper_clone_range (GstXMLRange * range);
GstXMLRatio *gst_xml_helper_clone_ratio (GstXMLRatio * ratio);
GstXMLFrameRate *gst_xml_helper_clone_frame_rate (GstXMLFrameRate * frameRate);

/* XML property get method */
gboolean gst_xml_helper_get_prop_validated_string (xmlNode * a_node,
    const gchar * property_name, gchar ** property_value,
    gboolean (*validator) (const char *));
gboolean gst_xml_helper_get_prop_string (xmlNode * a_node,
    const gchar * property_name, gchar ** property_value);
gboolean gst_xml_helper_get_prop_string_stripped (xmlNode * a_node,
    const gchar * property_name, gchar ** property_value);
gboolean gst_xml_helper_get_ns_prop_string (xmlNode * a_node,
    const gchar * ns_name, const gchar * property_name,
    gchar ** property_value);
gboolean gst_xml_helper_get_prop_string_vector_type (xmlNode * a_node,
    const gchar * property_name, gchar *** property_value);
gboolean gst_xml_helper_get_prop_signed_integer (xmlNode * a_node,
    const gchar * property_name, gint default_val, gint * property_value);
gboolean gst_xml_helper_get_prop_unsigned_integer (xmlNode * a_node,
    const gchar * property_name, guint default_val, guint * property_value);
gboolean gst_xml_helper_get_prop_unsigned_integer_64 (xmlNode *
    a_node, const gchar * property_name, guint64 default_val,
    guint64 * property_value);
gboolean gst_xml_helper_get_prop_uint_vector_type (xmlNode * a_node,
    const gchar * property_name, guint ** property_value, guint * value_size);
gboolean gst_xml_helper_get_prop_double (xmlNode * a_node,
    const gchar * property_name, gdouble * property_value);
gboolean gst_xml_helper_get_prop_boolean (xmlNode * a_node,
    const gchar * property_name, gboolean default_val,
    gboolean * property_value);
gboolean gst_xml_helper_get_prop_range (xmlNode * a_node,
    const gchar * property_name, GstXMLRange ** property_value);
gboolean gst_xml_helper_get_prop_ratio (xmlNode * a_node,
    const gchar * property_name, GstXMLRatio ** property_value);
gboolean gst_xml_helper_get_prop_framerate (xmlNode * a_node,
    const gchar * property_name, GstXMLFrameRate ** property_value);
gboolean gst_xml_helper_get_prop_cond_uint (xmlNode * a_node,
    const gchar * property_name, GstXMLConditionalUintType ** property_value);
gboolean gst_xml_helper_get_prop_dateTime (xmlNode * a_node,
    const gchar * property_name, GstDateTime ** property_value);
gboolean gst_xml_helper_get_prop_duration (xmlNode * a_node,
    const gchar * property_name, guint64 default_value,
    guint64 * property_value);
gboolean gst_xml_helper_get_prop_string_no_whitespace (xmlNode * a_node,
    const gchar * property_name, gchar ** property_value);

/* XML node get method */
gboolean gst_xml_helper_get_node_content (xmlNode * a_node,
    gchar ** content);
gchar *gst_xml_helper_get_node_namespace (xmlNode * a_node,
    const gchar * prefix);
gboolean gst_xml_helper_get_node_as_string (xmlNode * a_node,
    gchar ** content);

/* XML property set method */
void gst_xml_helper_set_prop_string (xmlNodePtr node, const gchar * name, gchar* value);
void gst_xml_helper_set_prop_boolean (xmlNodePtr node, const gchar * name, gboolean value);
void gst_xml_helper_set_prop_int (xmlNodePtr root, const gchar * name, gint value);
void gst_xml_helper_set_prop_uint (xmlNodePtr root, const gchar * name, guint value);
void gst_xml_helper_set_prop_int64 (xmlNodePtr node, const gchar * name, gint64 value);
void gst_xml_helper_set_prop_uint64 (xmlNodePtr node, const gchar * name, guint64 value);
void gst_xml_helper_set_prop_uint_vector_type (xmlNode * a_node,  const gchar * name, guint * value, guint value_size);
void gst_xml_helper_set_prop_double (xmlNodePtr node, const gchar * name, gdouble value);
void gst_xml_helper_set_prop_date_time (xmlNodePtr node, const gchar * name, GstDateTime* value);
void gst_xml_helper_set_prop_duration (xmlNode * node, const gchar * name, guint64 value);
void gst_xml_helper_set_prop_ratio (xmlNodePtr node, const gchar * name, GstXMLRatio* value);
void gst_xml_helper_set_prop_framerate (xmlNodePtr node, const gchar * name, GstXMLFrameRate* value);
void gst_xml_helper_set_prop_range (xmlNodePtr node, const gchar * name, GstXMLRange* value);
void gst_xml_helper_set_prop_cond_uint (xmlNode * a_node, const gchar * property_name, GstXMLConditionalUintType * cond);
void gst_xml_helper_set_content (xmlNodePtr node, gchar * content);

G_END_DECLS
#endif /* __GST_XMLHELPER_H__ */