This file is indexed.

/usr/include/gstreamermm-1.0/gstreamermm/structure.h is in libgstreamermm-1.0-dev 1.10.0+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
// Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
#ifndef _GSTREAMERMM_STRUCTURE_H
#define _GSTREAMERMM_STRUCTURE_H


#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>

/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2008-2016 The gstreamermm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gstreamermm/clock.h>
#include <gstreamermm/enums.h>
#include <gstreamermm/value.h>
#include <glibmm/date.h>
#include <glibmm/datetime.h>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _GstStructure GstStructure; }
#endif

namespace Gst
{

/**
 * Generic class containing fields of names and values.
 * A Gst::Structure is a collection of key/value pairs. The keys are expressed
 * as GQuarks and the values can be of any GType.
 *
 * In addition to the key/value pairs, a Gst::Structure also has a name. The name
 * starts with a letter and can be filled by letters, numbers and any of "/-_.:".
 *
 * Gst::Structure is used by various GStreamer subsystems to store information
 * in a flexible and extensible way. A Gst::Structure does not have a refcount
 * because it usually is part of a higher level object such as Gst::Caps,
 * Gst::Message, Gst::Event, Gst::Query.
 *
 * A Gst::Structure can be created with constructor, which take a name
 * and an optional set of key/value pairs along with the types of the values.
 *
 * Field values can be changed with set_field() or set_fields().
 *
 * Field values can be retrieved with gst_get_field().
 *
 * Fields can be removed with remove_field().
 *
 * Strings in structures must be ASCII or UTF-8 encoded.
 *
 * Be aware that the current Gst::Caps / Gst::Structure serialization into string
 * has limited support for nested Gst::Caps / Gst::Structure fields. It can only
 * support one level of nesting. Using more levels will lead to unexpected
 * behavior when using serialization features, such as Gst::Caps::to_string() or
 * gst_value_serialize() and their counterparts.
 *
 * Last reviewed on 2016-07-12 (1.8.0)
 */
class Structure
{
 public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  using CppObjectType = Structure;
  using BaseObjectType = GstStructure;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

  /** Get the GType for this class, for use with the underlying GObject type system.
   */
  static GType get_type() G_GNUC_CONST;

  Structure();

  explicit Structure(GstStructure* gobject, bool make_a_copy = true);

  Structure(const Structure& other);
  Structure& operator=(const Structure& other);

  Structure(Structure&& other) noexcept;
  Structure& operator=(Structure&& other) noexcept;

  ~Structure() noexcept;

  void swap(Structure& other) noexcept;

  ///Provides access to the underlying C instance.
  GstStructure*       gobj()       { return gobject_; }

  ///Provides access to the underlying C instance.
  const GstStructure* gobj() const { return gobject_; }

  ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
  GstStructure* gobj_copy() const;

protected:
  GstStructure* gobject_;

private:

  
public:
  /** Creates a Structure with the given @a name. Parses the list of variable
   * arguments and sets fields to the values listed. Variable arguments
   * should be passed as field name and value
   */
  template<class ...DataTypes>
  explicit Structure(const Glib::ustring &name, DataTypes... data);

  /** Creates a Gst::Structure from a string representation.
   *
   * @param the_string A string representation of a Gst::Structure. See to_string().
   * @return A Structure. This will be invalid (see operator=) when the string 
   * could not be parsed.
   */
  static Structure create_from_string(const Glib::ustring& the_string);
  

  /** Use this to discover if the Structure is a valid object.
   */
  operator const void*() const;

  /** Release the ownership of underlying GstStructure instance.
   *
   * Gst::Structure's underlying instance is set to nullptr, therefore underlying
   * object can't be accessed through this Gst::Structure anymore.
   * @return an underlying instance of GstStructure object.
   *
   * Most users should not use release(). It can spoil the automatic destruction
   * of the managed object.
   */
  GstStructure* release() noexcept;

  
  /** Get the name of @a structure as a string.
   * 
   * @return The name of the structure.
   */
  Glib::ustring get_name() const;
  
  /** Checks if the structure has the given name
   * 
   * @param name Structure name to check for.
   * @return <tt>true</tt> if @a name matches the name of the structure.
   */
  bool has_name(const Glib::ustring& name) const;
  
  /** Sets the name of the structure to the given @a name.  The string
   * provided is copied before being used. It must not be empty, start with a
   * letter and can be followed by letters, numbers and any of "/-_.:".
   * 
   * @param name The new name of the structure.
   */
  void set_name(const Glib::ustring& name);
  
  /** Get the name of @a structure as a GQuark.
   * 
   * @return The quark representing the name of the structure.
   */
  Glib::QueryQuark get_name_id() const;
  
  /** Removes all fields in a GstStructure.
   */
  void remove_all_fields();
  
  /** Finds the field with the given name, and returns the type of the
   * value it contains.  If the field is not found, G_TYPE_INVALID is
   * returned.
   * 
   * @param fieldname The name of the field.
   * @return The Value of the field.
   */
  GType get_field_type(const Glib::ustring& fieldname) const;
  
  /** Get the number of fields in the structure.
   * 
   * @return The number of fields in the structure.
   */
  int size() const;
  
  /** Get the name of the given field number, counting from 0 onwards.
   * 
   * @param index The index to get the name of.
   * @return The name of the given field number.
   */
  Glib::ustring get_nth_field_name(guint index) const;
  
  /** Converts @a structure to a human-readable string representation.
   * 
   * For debugging purposes its easier to do something like this:
   * 
   * [C example ellipted]
   * This prints the structure in human readable form.
   * 
   * The current implementation of serialization will lead to unexpected results
   * when there are nested Gst::Caps / Gst::Structure deeper than one level.
   * 
   * @return A pointer to string allocated by Glib::malloc().
   */
  Glib::ustring to_string() const;
  
  /** Fixates a Gst::Structure by changing the given field to the nearest
   * integer to @a target that is a subset of the existing field.
   * 
   * @param name A field in @a structure.
   * @param target The target value of the fixation.
   * @return <tt>true</tt> if the structure could be fixated.
   */
  bool fixate_field_nearest_int(const Glib::ustring& name, int target);
  
  /** Fixates a Gst::Structure by changing the given field to the nearest
   * double to @a target that is a subset of the existing field.
   * 
   * @param name A field in @a structure.
   * @param target The target value of the fixation.
   * @return <tt>true</tt> if the structure could be fixated.
   */
  bool fixate_field_nearest_double(const Glib::ustring& name, double target);
  
  /** Fixates a Gst::Structure by changing the given @a name field to the given
   *  @a target string if that field is not fixed yet.
   * 
   * @param name A field in @a structure.
   * @param target The target value of the fixation.
   * @return <tt>true</tt> if the structure could be fixated.
   */
  bool fixate_field_string(const Glib::ustring& name, const Glib::ustring& target);
  
  /** Fixates a Gst::Structure by changing the given field with its fixated value.
   * 
   * @param name A field in @a structure.
   * @return <tt>true</tt> if the structure field could be fixated.
   */
  bool fixate_field(const Glib::ustring& name);
  
  /** Fixates a Gst::Structure by changing the given @a name field to the given
   *  @a target boolean if that field is not fixed yet.
   * 
   * @param name A field in @a structure.
   * @param target The target value of the fixation.
   * @return <tt>true</tt> if the structure could be fixated.
   */
  bool fixate_field_boolean(const Glib::ustring& name, bool target);
  
  /** Intersects @a struct1 and @a struct2 and returns the intersection.
   * 
   * @param struct2 A Gst::Structure.
   * @return Intersection of @a struct1 and @a struct2.
   */
  Gst::Structure intersect(const Gst::Structure& struct2) const;
  
  /** Tests if the two Gst::Structure are equal.
   * 
   * @param struct2 A Gst::Structure.
   * @return <tt>true</tt> if the two structures have the same name and field.
   */
  bool is_equal(const Gst::Structure& struct2) const;
  
  /** Checks if @a subset is a subset of @a superset, i.e.\ has the same
   * structure name and for all fields that are existing in @a superset,
   *  @a subset has a value that is a subset of the value in @a superset.
   * 
   * @param superset A potentially greater Gst::Structure.
   * @return <tt>true</tt> if @a subset is a subset of @a superset.
   */
  bool is_subset(const Gst::Structure& superset) const;
  
  /** Tries intersecting @a struct1 and @a struct2 and reports whether the result
   * would not be empty.
   * 
   * @param struct2 A Gst::Structure.
   * @return <tt>true</tt> if intersection would not be empty.
   */
  bool can_intersect(const Gst::Structure& struct2) const;
  
  /** Fixate all values in @a structure using gst_value_fixate().
   *  @a structure will be modified in-place and should be writable.
   */
  void fixate();
  
  /** Read the GstFlagSet flags and mask out of the structure into the
   * provided pointers.
   * 
   * @param fieldname The name of a field.
   * @param value_flags A pointer to a <tt>unsigned int</tt> for the flags field.
   * @param value_mask A pointer to a <tt>unsigned int</tt> for the mask field.
   * @return <tt>true</tt> if the values could be set correctly. If there was no field
   * with @a fieldname or the existing field did not contain a GstFlagSet, this
   * function returns <tt>false</tt>.
   */
  bool get_flagset(const Glib::ustring& fieldname, guint& value_flags, guint& value_mask) const;

  
  /** Check if @a structure contains a field named @a fieldname.
   * 
   * @param fieldname The name of a field.
   * @return <tt>true</tt> if the structure contains a field with the given name.
   */
  bool has_field(const Glib::ustring& fieldname) const;
  

  /** Check if @a structure contains a field named @a fieldname and with GType @a type.
   * 
   * @param fieldname The name of a field.
   * @param type The type of a value.
   * @return <tt>true</tt> if the structure contains a field with the given name and type.
   */
  bool has_field(const Glib::ustring& fieldname, GType type) const;
  

  /** Get the value of the field with name @a fieldname.
   *
   * @param fieldname The name of the field to get.
   * @param value The Value class in which to store the value.
   */
  void get_field(const Glib::ustring& fieldname, Glib::ValueBase& value) const;

  /** Get the value of the field with name @a fieldname.
   *
   * @param fieldname The name of the field to get.
   * @param value The Value class in which to store the value.
   */
  template<typename DataType>
  void get_field(const Glib::ustring& fieldname, Glib::Value<DataType>& value) const;

    /** Gets the value of field @a fieldname with GType enum type @a enumtype
   * into integer @a value.  Caller is responsible for making sure the
   * field exists and has the correct type.  A call to this method would look
   * like so:
   * @code
   * ...
   * int state;
   * structure.get_field("state", Glib::Value<Gst::State>::value_type(),
   * state);
   * ...
   * @endcode
   *
   * @param fieldname The name of a field.
   * @param enumtype The enum GType of the field.
   * @param value An output parameter that will be set with the value.
   * @return true if @a value could be set correctly. If there was no field
   * with @a fieldname or the existing field did not contain an enum, this
   * function returns false.
   */
  bool get_field(const Glib::ustring& fieldname, GType enumtype, int& value) const;
  

  /** Gets the value of field @a fieldname into DataType @a value.
   * The caller is responsible for making sure the field exists and has the
   * correct type.
   *
   * @param fieldname The name of a field.
   * @param value The DataType to set.
   */
  template<typename DataType>
  bool get_field(const Glib::ustring& fieldname, DataType& value) const;

  // These are ignored because they are useful in the C API but are either
  // variable argument functions or their functionality is already provided.
  

  /** Sets the field with name @a fieldname to value. If the field does not
   * exist, it is created. If the field exists, the previous value is replaced
   * and freed.
   *
   * @param fieldname The name of the field to set.
   * @param value The value to set the field to.
   */
  void set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value);
  

  /** Sets the field with name @a fieldname to value. If the field does not
   * exist, it is created. If the field exists, the previous value is replaced
   * and freed.
   *
   * @param fieldname The name of the field to set.
   * @param value The value to set the field to.
   */
  template<typename DataType>
  void set_field(const Glib::ustring& fieldname, const Glib::Value<DataType>& value);

  /** Sets the field with name @a fieldname to value. If the field does not
   * exist, it is created. If the field exists, the previous value is replaced
   * and freed.
   *
   * @param fieldname The name of the field to set.
   * @param value The value to set the field to.
   */
  void set_field(const Glib::ustring& fieldname, const char* value);

  /** Sets the fields with name @a fieldname to values. If one of the fields does not
   * exist, it is created. If the field exists, the previous value is replaced
   * and freed.
   *
   * @param fieldname The name of the field to set.
   * @param value The value to set the field to.
   * @param further_data List of pairs of the format: fieldname, value.
   */
  template<class DataType, class ...DataTypes>
  void set_fields(const Glib::ustring & fieldname, const DataType& value, DataTypes ...further_data);

  /** Sets the field with name @a fieldname to the value @a value of the enum
   * type @a enum_type. If the field does not exist, it is created. If the
   * field exists, the previous value is replaced and freed.  Caller is
   * responsible for making sure that @a value is a valid @a enumtype.  A call
   * to this method would look like so:
   * @code
   * ...
   * structure.set_field("state", Glib::Value<Gst::State>::value_type(),
   * Gst::STATE_PAUSED);
   * ...
   * @endcode
   *
   * @param fieldname The name of the field to set.
   * @param enumtype The enum GType that @a value should be treated as.
   * @param value The value to set the field to.
   */
  void set_field(const Glib::ustring& fieldname, GType enumtype, int value);

  /** Sets the field with name @a fieldname field to the DataType @a value.
   * If the field does not exist, it is created. If the field exists,
   * the previous value is replaced and freed. Please note that when setting
   * fields to special types such as Gst::Fourcc and Gst::Fraction and
   * Glib::Date they are converted to the GStreamer GTypes and thus when
   * attempting to get these fields back as GValues, they will have the
   * GStreamer GType.
   *
   * @param fieldname The name of the field to set.
   * @param value The value to set the field to.
   */
  template<typename DataType>
  void set_field(const Glib::ustring& fieldname, const DataType& value);

  // These take ownership of the GValue so they are not wrapped.
  

  /** Removes the field with name @a fieldname. If the field with the given
   * name does not exist, the structure is unchanged.
   *
   * @param fieldname The name of the field to remove.
   */
  void remove_field(const Glib::ustring& fieldname);
  

  /** For example,
   * bool on_foreach(const Glib::ustring& id, const Glib::ValueBase& value);.
   * The on_foreach function should return true if the foreach operation should
   * continue, or false if the operation should stop with false.
   */
  typedef sigc::slot<bool, const Glib::ustring&, const Glib::ValueBase&> SlotForeach;

  /** Calls the provided slot once for each field in the Gst::Structure. The
   * slot must not modify the fields. See also map_in_place().
   *
   * @param slot A slot to call for each field.
   * @return true if the supplied slot returns true For each of the fields,
   * false otherwise.
   */
  bool foreach(const SlotForeach& slot);
  

  /** For example,
   * bool on_map(const Glib::ustring& id, Glib::ValueBase& value);.
   * The map function should return true if the map operation should continue,
   * or false if the operation should stop with false.
   */
  typedef sigc::slot<bool, const Glib::ustring&, Glib::ValueBase&> SlotMap;

  /** Calls the provided slot once for each field in the Gst::Structure. In
   * contrast to foreach(), the function may modify but not delete the fields.
   * The structure must be mutable.
   *
   * @param slot A slot to call for each field.
   * @return true if the supplied slot returns true For each of the fields,
   * false otherwise.
   */
  bool map_in_place(const SlotMap& slot);
  

  /** Fixates a Gst::Structure by changing the given field to the nearest
   * fraction to given Gst::Fraction that is a subset of the existing field.
   *
   * @param field_name A field in structure.
   * @param target The target value of the fixation.
   * @return true If the structure could be fixated.
   */
  bool fixate_nearest_fraction(const Glib::ustring& field_name, const Gst::Fraction& target);
  

  //Variable argument functions are ignored.
  

private:
  // This method is used for varadic template recursion
  void set_fields() {}


};

template<class ...DataTypes>
Structure::Structure(const Glib::ustring &name, DataTypes... data)
{
  gobject_ = gst_structure_new_empty(name.c_str());
  set_fields(data...);
}

template<class DataType, class ...DataTypes>
void Structure::set_fields(const Glib::ustring & name, const DataType& data, DataTypes ...further_data)
{
  this->set_field(name, data);
  this->set_fields(further_data...);
}

template<typename DataType>
bool Structure::get_field(const Glib::ustring& fieldname, DataType& value) const
{
  typedef Glib::Value<DataType> ValueType;

  bool ret = ValueType::value_type() == get_field_type(fieldname);

  if (ret)
  {
    ValueType v;
    this->get_field(fieldname, reinterpret_cast<Glib::ValueBase&>(v));
    value = v.get();
  }

  return ret;
}

template<typename DataType>
void Structure::set_field(const Glib::ustring& fieldname, const DataType& value)
{
  typedef Glib::Value<DataType> ValueType;
  ValueType v;
  v.init(ValueType::value_type());
  v.set(value);
  this->set_field(fieldname, reinterpret_cast<const Glib::ValueBase&>(v));
}

template<typename DataType>
void Structure::get_field(const Glib::ustring& fieldname, Glib::Value<DataType>& value) const
{
  get_field(fieldname, reinterpret_cast<Glib::ValueBase&>(value));
}

template<typename DataType>
void Structure::set_field(const Glib::ustring& fieldname, const Glib::Value<DataType>& value)
{
  set_field(fieldname, reinterpret_cast<const Glib::ValueBase&>(value));
}

} //namespace Gst


namespace Gst
{

/** @relates Gst::Structure
 * @param lhs The left-hand side
 * @param rhs The right-hand side
 */
inline void swap(Structure& lhs, Structure& rhs) noexcept
  { lhs.swap(rhs); }

} // namespace Gst

namespace Glib
{

/** A Glib::wrap() method for this object.
 *
 * @param object The C instance.
 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
 * @result A C++ instance that wraps this C instance.
 *
 * @relates Gst::Structure
 */
Gst::Structure wrap(GstStructure* object, bool take_copy = false);

#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <>
class Value<Gst::Structure> : public Glib::Value_Boxed<Gst::Structure>
{};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

} // namespace Glib


#endif /* _GSTREAMERMM_STRUCTURE_H */