File: init.cc

package info (click to toggle)
gstreamermm-1.0 1.10.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,464 kB
  • sloc: xml: 68,148; cpp: 6,109; sh: 4,187; makefile: 246; perl: 236
file content (157 lines) | stat: -rw-r--r-- 2,996 bytes parent folder | download | duplicates (5)
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
/* 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.
 */

#include <gstreamermm/init.h>
#include <gstreamermm/wrap_init.h>
#include <glibmm/init.h>
#include <gst/gst.h>

namespace Gst
{

static void initialize_wrap_system()
{
  static bool s_init = false;
  if(!s_init)
  {
    //For Glib::wrap(), for Glib::Object-derived classes.
    Gst::wrap_init(); 
    s_init = true;
  }
}

void init(int& argc, char**& argv)
{
  static bool s_init = false;
  if(!s_init)
  {
    Glib::init();
    gst_init(&argc, &argv);
    initialize_wrap_system();
    s_init = true;
  }
}

void init()
{
  static bool s_init = false;
  if(!s_init)
  {
    Glib::init();
    gst_init(nullptr, nullptr);
    initialize_wrap_system();
    s_init = true;
  }
}

bool init_check(int& argc, char**& argv)
{
  static bool s_init = false;
  static bool result = false;

  if(!s_init)
  {
    Glib::init();

    GError* gerror = nullptr;
    result = gst_init_check(&argc, &argv, &gerror);

    if(gerror)
      ::Glib::Error::throw_exception(gerror);

    initialize_wrap_system();
    s_init = true;
  }

  return result;
}

bool init_check()
{
  static bool s_init = false;
  static bool result = false;

  if(!s_init)
  {
    Glib::init();

    GError* gerror = nullptr;
    result = gst_init_check(nullptr, nullptr, &gerror);

    if(gerror)
      ::Glib::Error::throw_exception(gerror);

    initialize_wrap_system();
    s_init = true;
  }

  return result;
}

bool is_initialized()
{
  return static_cast<bool>(gst_is_initialized());
}

void deinit()
{
  gst_deinit();
}

Glib::OptionGroup get_option_group()
{
  return Glib::OptionGroup(gst_init_get_option_group());
}

void version(guint& major, guint& minor, guint& micro, guint& nano)
{
  gst_version(&major, &minor, &micro, &nano);
}

Glib::ustring version_string()
{
  return Glib::ustring(gst_version_string());
}

bool segtrap_is_enabled()
{
  return gst_segtrap_is_enabled();
}

void segtrap_set_enabled(bool enabled)
{
  gst_segtrap_set_enabled(enabled);
}

bool registry_fork_is_enabled()
{
  return gst_registry_fork_is_enabled();
}

void registry_fork_set_enabled(bool enabled)
{
  gst_registry_fork_set_enabled(enabled);
}

bool update_registry()
{
  return gst_update_registry();
}

}