gstreamer_core/gst/gststructure.h
changeset 0 0e761a78d257
child 8 4a7fac7dd34a
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /* GStreamer
       
     2  * Copyright (C) 2003 David A. Schleef <ds@schleef.org>
       
     3  *
       
     4  * This library is free software; you can redistribute it and/or
       
     5  * modify it under the terms of the GNU Library General Public
       
     6  * License as published by the Free Software Foundation; either
       
     7  * version 2 of the License, or (at your option) any later version.
       
     8  *
       
     9  * This library is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12  * Library General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU Library General Public
       
    15  * License along with this library; if not, write to the
       
    16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    17  * Boston, MA 02111-1307, USA.
       
    18  */
       
    19 
       
    20 #ifndef __GST_STRUCTURE_H__
       
    21 #define __GST_STRUCTURE_H__
       
    22 
       
    23 #include <gst/gstconfig.h>
       
    24 #include <glib-object.h>
       
    25 #include <gst/gstclock.h>
       
    26 #include <gst/glib-compat.h>
       
    27 
       
    28 G_BEGIN_DECLS
       
    29 
       
    30 #define GST_TYPE_STRUCTURE             (gst_structure_get_type ())
       
    31 #define GST_STRUCTURE(object)          ((GstStructure *)(object))
       
    32 #define GST_IS_STRUCTURE(object)       ((object) && (GST_STRUCTURE(object)->type == GST_TYPE_STRUCTURE))
       
    33 
       
    34 typedef struct _GstStructure GstStructure;
       
    35 
       
    36 /**
       
    37  * GstStructureForeachFunc:
       
    38  * @field_id: the #GQuark of the field name
       
    39  * @value: the #GValue of the field
       
    40  * @user_data: user data
       
    41  *
       
    42  * A function that will be called in gst_structure_foreach(). The function may
       
    43  * not modify @value.
       
    44  *
       
    45  * Returns: TRUE if the foreach operation should continue, FALSE if
       
    46  * the foreach operation should stop with FALSE.
       
    47  */
       
    48 typedef gboolean (*GstStructureForeachFunc) (GQuark   field_id,
       
    49 					     const GValue * value,
       
    50 					     gpointer user_data);
       
    51 
       
    52 /**
       
    53  * GstStructureMapFunc:
       
    54  * @field_id: the #GQuark of the field name
       
    55  * @value: the #GValue of the field
       
    56  * @user_data: user data
       
    57  *
       
    58  * A function that will be called in gst_structure_map_in_place(). The function
       
    59  * may modify @value.
       
    60  *
       
    61  * Returns: TRUE if the map operation should continue, FALSE if
       
    62  * the map operation should stop with FALSE.
       
    63  */
       
    64 typedef gboolean (*GstStructureMapFunc)     (GQuark   field_id,
       
    65 					     GValue * value,
       
    66 					     gpointer user_data);
       
    67 
       
    68 /**
       
    69  * GstStructure:
       
    70  * @type: the GType of a structure
       
    71  *
       
    72  * The GstStructure object. Most fields are private.
       
    73  */
       
    74 struct _GstStructure {
       
    75   GType type;
       
    76 
       
    77   /*< private >*/
       
    78   GQuark name;
       
    79 
       
    80   /* owned by parent structure, NULL if no parent */
       
    81   gint *parent_refcount;
       
    82 
       
    83   GArray *fields;
       
    84 
       
    85   gpointer _gst_reserved;
       
    86 };
       
    87 #ifdef __SYMBIAN32__
       
    88 IMPORT_C
       
    89 #endif
       
    90 
       
    91 
       
    92 GType                   gst_structure_get_type             (void);
       
    93 #ifdef __SYMBIAN32__
       
    94 IMPORT_C
       
    95 #endif
       
    96 
       
    97 
       
    98 GstStructure *          gst_structure_empty_new            (const gchar *            name);
       
    99 #ifdef __SYMBIAN32__
       
   100 IMPORT_C
       
   101 #endif
       
   102 
       
   103 GstStructure *          gst_structure_id_empty_new         (GQuark                   quark);
       
   104 #ifdef __SYMBIAN32__
       
   105 IMPORT_C
       
   106 #endif
       
   107 
       
   108 GstStructure *          gst_structure_new                  (const gchar *            name,
       
   109 					                    const gchar *            firstfield,
       
   110 							    ...);
       
   111 #ifdef __SYMBIAN32__
       
   112 IMPORT_C
       
   113 #endif
       
   114 
       
   115 GstStructure *          gst_structure_new_valist           (const gchar *            name,
       
   116 						            const gchar *            firstfield,
       
   117 							    va_list                  varargs);
       
   118 #ifdef __SYMBIAN32__
       
   119 IMPORT_C
       
   120 #endif
       
   121 
       
   122 GstStructure *          gst_structure_copy                 (const GstStructure      *structure);
       
   123 #ifdef __SYMBIAN32__
       
   124 IMPORT_C
       
   125 #endif
       
   126 
       
   127 void			gst_structure_set_parent_refcount  (GstStructure            *structure,
       
   128                                                             gint            *refcount);
       
   129 #ifdef __SYMBIAN32__
       
   130 IMPORT_C
       
   131 #endif
       
   132 
       
   133 void                    gst_structure_free                 (GstStructure            *structure);
       
   134 #ifdef __SYMBIAN32__
       
   135 IMPORT_C
       
   136 #endif
       
   137 
       
   138 
       
   139 G_CONST_RETURN gchar *  gst_structure_get_name             (const GstStructure      *structure);
       
   140 #ifdef __SYMBIAN32__
       
   141 IMPORT_C
       
   142 #endif
       
   143 
       
   144 GQuark			gst_structure_get_name_id          (const GstStructure      *structure);
       
   145 #ifdef __SYMBIAN32__
       
   146 IMPORT_C
       
   147 #endif
       
   148 
       
   149 gboolean                gst_structure_has_name             (const GstStructure      *structure,
       
   150 							    const gchar             *name);
       
   151 #ifdef __SYMBIAN32__
       
   152 IMPORT_C
       
   153 #endif
       
   154 
       
   155 void                    gst_structure_set_name             (GstStructure            *structure,
       
   156 							    const gchar             *name);
       
   157 #ifdef __SYMBIAN32__
       
   158 IMPORT_C
       
   159 #endif
       
   160 
       
   161 
       
   162 void                    gst_structure_id_set_value         (GstStructure            *structure,
       
   163 							    GQuark                   field,
       
   164 							    const GValue            *value);
       
   165 #ifdef __SYMBIAN32__
       
   166 IMPORT_C
       
   167 #endif
       
   168 
       
   169 void                    gst_structure_set_value            (GstStructure            *structure,
       
   170 							    const gchar             *fieldname,
       
   171 							    const GValue            *value);
       
   172 #ifdef __SYMBIAN32__
       
   173 IMPORT_C
       
   174 #endif
       
   175 
       
   176 void                    gst_structure_set                  (GstStructure            *structure,
       
   177 							    const gchar             *fieldname,
       
   178 							    ...) G_GNUC_NULL_TERMINATED;
       
   179 #ifdef __SYMBIAN32__
       
   180 IMPORT_C
       
   181 #endif
       
   182 
       
   183 
       
   184 void                    gst_structure_set_valist           (GstStructure            *structure,
       
   185 							    const gchar             *fieldname,
       
   186 							    va_list varargs);
       
   187 #ifdef __SYMBIAN32__
       
   188 IMPORT_C
       
   189 #endif
       
   190 
       
   191 
       
   192 void                    gst_structure_id_set                (GstStructure            *structure,
       
   193 							    GQuark                   fieldname,
       
   194 							    ...) G_GNUC_NULL_TERMINATED;
       
   195 #ifdef __SYMBIAN32__
       
   196 IMPORT_C
       
   197 #endif
       
   198 
       
   199 
       
   200 void                    gst_structure_id_set_valist         (GstStructure            *structure,
       
   201 							    GQuark                   fieldname,
       
   202 							    va_list varargs);
       
   203 #ifdef __SYMBIAN32__
       
   204 IMPORT_C
       
   205 #endif
       
   206 
       
   207 
       
   208 
       
   209 G_CONST_RETURN GValue * gst_structure_id_get_value         (const GstStructure      *structure,
       
   210 							    GQuark                   field);
       
   211 #ifdef __SYMBIAN32__
       
   212 IMPORT_C
       
   213 #endif
       
   214 
       
   215 G_CONST_RETURN GValue * gst_structure_get_value            (const GstStructure      *structure,
       
   216 							    const gchar             *fieldname);
       
   217 #ifdef __SYMBIAN32__
       
   218 IMPORT_C
       
   219 #endif
       
   220 
       
   221 void                    gst_structure_remove_field         (GstStructure            *structure,
       
   222 							    const gchar             *fieldname);
       
   223 #ifdef __SYMBIAN32__
       
   224 IMPORT_C
       
   225 #endif
       
   226 
       
   227 void                    gst_structure_remove_fields        (GstStructure            *structure,
       
   228 							     const gchar            *fieldname,
       
   229 							    ...) G_GNUC_NULL_TERMINATED;
       
   230 #ifdef __SYMBIAN32__
       
   231 IMPORT_C
       
   232 #endif
       
   233 
       
   234 void                    gst_structure_remove_fields_valist (GstStructure             *structure,
       
   235 							    const gchar             *fieldname,
       
   236 							    va_list                  varargs);
       
   237 #ifdef __SYMBIAN32__
       
   238 IMPORT_C
       
   239 #endif
       
   240 
       
   241 void                    gst_structure_remove_all_fields    (GstStructure            *structure);
       
   242 #ifdef __SYMBIAN32__
       
   243 IMPORT_C
       
   244 #endif
       
   245 
       
   246 
       
   247 GType                   gst_structure_get_field_type       (const GstStructure      *structure,
       
   248 							    const gchar             *fieldname);
       
   249 #ifdef __SYMBIAN32__
       
   250 IMPORT_C
       
   251 #endif
       
   252 
       
   253 gboolean                gst_structure_foreach              (const GstStructure      *structure,
       
   254 							    GstStructureForeachFunc  func,
       
   255 							    gpointer                 user_data);
       
   256 #ifdef __SYMBIAN32__
       
   257 IMPORT_C
       
   258 #endif
       
   259 
       
   260 gboolean                gst_structure_map_in_place         (GstStructure            *structure,
       
   261 							    GstStructureMapFunc      func,
       
   262 							    gpointer                 user_data);
       
   263 #ifdef __SYMBIAN32__
       
   264 IMPORT_C
       
   265 #endif
       
   266 
       
   267 gint                    gst_structure_n_fields             (const GstStructure      *structure);
       
   268 #ifdef __SYMBIAN32__
       
   269 IMPORT_C
       
   270 #endif
       
   271 
       
   272 const gchar *           gst_structure_nth_field_name       (const GstStructure      *structure, guint index);
       
   273 #ifdef __SYMBIAN32__
       
   274 IMPORT_C
       
   275 #endif
       
   276 
       
   277 gboolean                gst_structure_has_field            (const GstStructure      *structure,
       
   278 							    const gchar             *fieldname);
       
   279 #ifdef __SYMBIAN32__
       
   280 IMPORT_C
       
   281 #endif
       
   282 
       
   283 gboolean                gst_structure_has_field_typed      (const GstStructure      *structure,
       
   284 							    const gchar             *fieldname,
       
   285 							    GType                    type);
       
   286 
       
   287 /* utility functions */
       
   288 #ifdef __SYMBIAN32__
       
   289 IMPORT_C
       
   290 #endif
       
   291 
       
   292 gboolean                gst_structure_get_boolean          (const GstStructure      *structure,
       
   293 							    const gchar             *fieldname,
       
   294 							    gboolean                *value);
       
   295 #ifdef __SYMBIAN32__
       
   296 IMPORT_C
       
   297 #endif
       
   298 
       
   299 gboolean                gst_structure_get_int              (const GstStructure      *structure,
       
   300 							    const gchar             *fieldname,
       
   301 							    gint                    *value);
       
   302 #ifdef __SYMBIAN32__
       
   303 IMPORT_C
       
   304 #endif
       
   305 
       
   306 gboolean                gst_structure_get_uint             (const GstStructure      *structure,
       
   307 							    const gchar             *fieldname,
       
   308 							    guint                   *value);
       
   309 #ifdef __SYMBIAN32__
       
   310 IMPORT_C
       
   311 #endif
       
   312 
       
   313 gboolean                gst_structure_get_fourcc           (const GstStructure      *structure,
       
   314 							    const gchar             *fieldname,
       
   315 							    guint32                 *value);
       
   316 #ifdef __SYMBIAN32__
       
   317 IMPORT_C
       
   318 #endif
       
   319 
       
   320 gboolean                gst_structure_get_double           (const GstStructure      *structure,
       
   321 							    const gchar             *fieldname,
       
   322 							    gdouble                 *value);
       
   323 #ifdef __SYMBIAN32__
       
   324 IMPORT_C
       
   325 #endif
       
   326 
       
   327 gboolean                gst_structure_get_date             (const GstStructure      *structure,
       
   328 							    const gchar             *fieldname,
       
   329                                                             GDate                  **value);
       
   330 #ifdef __SYMBIAN32__
       
   331 IMPORT_C
       
   332 #endif
       
   333 
       
   334 gboolean                gst_structure_get_clock_time       (const GstStructure      *structure,
       
   335 							    const gchar             *fieldname,
       
   336 							    GstClockTime            *value);
       
   337 #ifdef __SYMBIAN32__
       
   338 IMPORT_C
       
   339 #endif
       
   340 
       
   341 G_CONST_RETURN gchar *  gst_structure_get_string           (const GstStructure      *structure,
       
   342 							    const gchar             *fieldname);
       
   343 #ifdef __SYMBIAN32__
       
   344 IMPORT_C
       
   345 #endif
       
   346 
       
   347 gboolean                gst_structure_get_enum             (const GstStructure      *structure,
       
   348 							    const gchar             *fieldname,
       
   349 							    GType                    enumtype,
       
   350 							    gint                    *value);
       
   351 #ifdef __SYMBIAN32__
       
   352 IMPORT_C
       
   353 #endif
       
   354 
       
   355 gboolean                gst_structure_get_fraction         (const GstStructure      *structure,
       
   356 							    const gchar             *fieldname,
       
   357 							    gint *value_numerator,
       
   358 							    gint *value_denominator);
       
   359 #ifdef __SYMBIAN32__
       
   360 IMPORT_C
       
   361 #endif
       
   362 
       
   363 
       
   364 gchar *                 gst_structure_to_string            (const GstStructure      *structure);
       
   365 #ifdef __SYMBIAN32__
       
   366 IMPORT_C
       
   367 #endif
       
   368 
       
   369 GstStructure *          gst_structure_from_string          (const gchar             *string,
       
   370 							    gchar                  **end);
       
   371 #ifdef __SYMBIAN32__
       
   372 IMPORT_C
       
   373 #endif
       
   374 
       
   375 
       
   376 gboolean                 gst_structure_fixate_field_nearest_int    (GstStructure *structure,
       
   377 									 const char   *field_name,
       
   378 									 int           target);
       
   379 #ifdef __SYMBIAN32__
       
   380 IMPORT_C
       
   381 #endif
       
   382 
       
   383 gboolean                 gst_structure_fixate_field_nearest_double (GstStructure *structure,
       
   384 									 const char   *field_name,
       
   385 									 double        target);
       
   386 #ifdef __SYMBIAN32__
       
   387 IMPORT_C
       
   388 #endif
       
   389 
       
   390 
       
   391 gboolean                 gst_structure_fixate_field_boolean (GstStructure *structure,
       
   392 									 const char   *field_name,
       
   393 									 gboolean        target);
       
   394 #ifdef __SYMBIAN32__
       
   395 IMPORT_C
       
   396 #endif
       
   397 
       
   398 gboolean                 gst_structure_fixate_field_nearest_fraction (GstStructure *structure,
       
   399 									 const char   *field_name,
       
   400 									 const gint target_numerator,
       
   401 									 const gint target_denominator);
       
   402 
       
   403 G_END_DECLS
       
   404 
       
   405 #endif
       
   406