This file is indexed.

/usr/include/gstreamermm-1.0/gstreamermm/register.h is in libgstreamermm-1.0-dev 1.4.3+dfsg-5.

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
/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2008 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.
 */

#ifndef REGISTER_H_
#define REGISTER_H_

#include <glib-object.h>
#include <glibmm/property.h>
#include <gstreamermm/padtemplate.h>

namespace Gst
{

template<class DerivedCppType>
static GType
register_mm_type(const gchar * type_name=typeid(DerivedCppType).name());

template<typename DerivedCppType>
class ElementClass
{
  friend GType register_mm_type<DerivedCppType>(const gchar * type_name);
  GstElementClass* klass;
  ElementClass(typename DerivedCppType::BaseClassType* klass): klass((GstElementClass*)klass){}
  ElementClass(ElementClass const&);
  void operator=(ElementClass const&);
public:
  void add_pad_template(const Glib::RefPtr<Gst::PadTemplate>& tpl)
  {
    gst_element_class_add_pad_template(klass, tpl->gobj());
  }
  void set_metadata(const Glib::ustring& longname, const Glib::ustring& classification,
                    const Glib::ustring& description, const Glib::ustring& author)
  {
    gst_element_class_set_metadata(klass, longname.c_str(), classification.c_str(), description.c_str(), author.c_str());
  }

  void add_metadata(const Glib::ustring& key, const Glib::ustring& value)
  {
  	gst_element_class_add_metadata(klass ,key.c_str(), value.c_str());
  }

  const GstElementClass* gobj() const { return klass; }
  GstElementClass* gobj() { return klass; }
};

template<class DerivedCppType>
static GType
register_mm_type(const gchar * type_name)
{
    struct GlibCppType
    {
        typename DerivedCppType::BaseObjectType parent;
        DerivedCppType *self;
        static void init(GlibCppType *instance, gpointer /* g_class */)
        {
            //instance->parent will be passed to C++ base of DerivedCppType; this will cause registerging "self" as MM wrapper of "parent"
            instance->self = new DerivedCppType(&instance->parent);

        }
        static void base_init(typename DerivedCppType::BaseClassType *klass)
        {
            Gst::ElementClass<DerivedCppType> element_class(klass);
	    DerivedCppType::base_init(&element_class);
        }
        static void finalize(GObject *object)
        {
            //the following will destroy q_data, among which MM wrapper to this "object" is stored. This will cause implicit delete on "self", since it is registered as wrapper of "object".
            (G_OBJECT_CLASS(g_type_class_peek_parent(G_OBJECT_GET_CLASS(object))))->finalize(object);
        }
    };

    struct GlibCppTypeClass
    {
        typename DerivedCppType::BaseClassType  parent_class;
        /* nothing more */
        static void init (GlibCppTypeClass * klass, gpointer data)
        {
            DerivedCppType::CppClassType::class_init_function((void*)klass, (void*)data);
            GObjectClass *gobject_class;

            gobject_class = (GObjectClass *) klass;
//          gstelement_class = (GstElementClass *) klass;

            gobject_class->get_property = &Glib::custom_get_property_callback;
            gobject_class->set_property = &Glib::custom_set_property_callback;
            gobject_class->finalize =  &GlibCppType::finalize;
        }

      static void base_init(typename DerivedCppType::BaseClassType * /* klass */)
        {
            Gst::init();
        }
    };

    // the "most derived" pure glib type
    GType parent_type = DerivedCppType::get_base_type();

    /* The typedef for GType may be gulong or gsize, depending on the
     * system and whether the compiler is c++ or not. The g_once_init_*
     * functions always take a gsize * though ... */
    static volatile gsize gonce_data = 0;
    if (g_once_init_enter (&gonce_data)) {
        GTypeInfo info;

        info.class_size = sizeof(GlibCppTypeClass);
        info.base_init = (GBaseInitFunc)&GlibCppType::base_init;
        info.base_finalize = 0;
        info.class_init = (GClassInitFunc) &GlibCppTypeClass::init;
        info.class_finalize = 0;
        info.class_data = 0;
        info.instance_size = sizeof(GlibCppType);
        info.n_preallocs = 0;
        info.instance_init = (GInstanceInitFunc) &GlibCppType::init;
        info.value_table = 0;

        GType _type = g_type_register_static(parent_type, type_name, &info, (GTypeFlags)0);
        g_once_init_leave(&gonce_data, (gsize) _type);
    }
    return (GType) gonce_data;
}

} /*namespace Gst*/


#endif /* REGISTER_H_ */