~ubuntu-branches/ubuntu/jaunty/ekiga/jaunty-updates

« back to all changes in this revision

Viewing changes to lib/engine/engine.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2008-12-07 10:30:45 UTC
  • mfrom: (1.2.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20081207103045-iaurrjo4p7d1nngo
Tags: 3.0.1-1ubuntu1
* Merge to Debian experimental, to get Ekiga 3. (LP: #274085) Remaining
  Ubuntu changes:
  - Launchpad Integration: (Ubuntu specific)
    + debian/control.in: Add liblaunchpad-integration-dev build dependency.
    + Add ubuntu_lpi.patch: Call launchpad_integration_add_items() in main() and
      check for the launchpad-integration pkg-config module.
    + Add autoconf.patch: autoconf changes from above patch.
  - Add ubuntu_desktop-file-onlyshowin.patch: Show ekiga in Mobile, too.
    (Ubuntu specific).
  - debian/control.in: Add missing fdupes build dependency for identical
    GNOME help file symlinking. (Debian #505536)
* Drop 42_change_pixmaps.dpatch: Many of the old icons do not exist any
  more, some have been replaced, and keeping the remaining three would make
  them look very inconsistent.
* Convert our dpatches to quilt patches and rewrite them for new upstream
  version.
* Add migrate_2.0_settings.patch: Properly migrate settings from
  2.0. Taken from upstream SVN, thanks to Damien Sandras!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* Ekiga -- A VoIP and Video-Conferencing application
 
3
 * Copyright (C) 2000-2007 Damien Sandras
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software Foundation,
 
17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
18
 *
 
19
 *
 
20
 * Ekiga is licensed under the GPL license and as a special exception,
 
21
 * you have permission to link or otherwise combine this program with the
 
22
 * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
 
23
 * without applying the requirements of the GNU GPL to the OPAL, OpenH323
 
24
 * and PWLIB programs, as long as you do follow the requirements of the
 
25
 * GNU GPL for all the rest of the software thus combined.
 
26
 */
 
27
 
 
28
 
 
29
/*
 
30
 *                         engine.cpp  -  description
 
31
 *                         ------------------------------------------
 
32
 *   begin                : written in 2007 by Damien Sandras
 
33
 *   copyright            : (c) 2007 by Damien Sandras
 
34
 *   description          : Vroom.
 
35
 *
 
36
 */
 
37
 
 
38
#include "config.h"
 
39
 
 
40
#include "engine.h"
 
41
 
 
42
#include "services.h"
 
43
 
 
44
#include "presence-core.h"
 
45
#include "account-core.h"
 
46
#include "contact-core.h"
 
47
#include "call-core.h"
 
48
#include "chat-core.h"
 
49
#include "videooutput-core.h"
 
50
#include "videoinput-core.h"
 
51
#include "audioinput-core.h"
 
52
#include "audiooutput-core.h"
 
53
#include "hal-core.h"
 
54
#include "history-main.h"
 
55
#include "local-roster-main.h"
 
56
#include "local-roster-bridge.h"
 
57
#include "gtk-core-main.h"
 
58
#include "gtk-frontend.h"
 
59
#include "gmconf-personal-details-main.h"
 
60
 
 
61
#ifndef WIN32
 
62
#include "videooutput-main-x.h"
 
63
#endif
 
64
 
 
65
#ifdef HAVE_DX
 
66
#include "videooutput-main-dx.h"
 
67
#endif
 
68
 
 
69
#include "videoinput-main-mlogo.h"
 
70
#include "audioinput-main-null.h"
 
71
#include "audiooutput-main-null.h"
 
72
 
 
73
#include "videoinput-main-ptlib.h"
 
74
#include "audioinput-main-ptlib.h"
 
75
#include "audiooutput-main-ptlib.h"
 
76
 
 
77
#ifdef HAVE_DBUS
 
78
#include "hal-main-dbus.h"
 
79
#endif
 
80
 
 
81
#include "opal-main.h"
 
82
 
 
83
#ifdef HAVE_AVAHI
 
84
#include "avahi-main.h"
 
85
#include "avahi-publisher-main.h"
 
86
#endif
 
87
 
 
88
#ifdef HAVE_EDS
 
89
#include "evolution-main.h"
 
90
#endif
 
91
 
 
92
#ifdef HAVE_LDAP
 
93
#include "ldap-main.h"
 
94
#endif
 
95
 
 
96
 
 
97
void
 
98
engine_init (int argc,
 
99
             char *argv [],
 
100
             Ekiga::Runtime *runtime,
 
101
             Ekiga::ServiceCore * &core)
 
102
{
 
103
  core = new Ekiga::ServiceCore; 
 
104
 
 
105
  /* VideoInputCore depends on VideoOutputCore and must this              *
 
106
   * be constructed thereafter                                      */
 
107
 
 
108
  Ekiga::AccountCore *account_core = new Ekiga::AccountCore;
 
109
  Ekiga::PresenceCore *presence_core = NULL;
 
110
  Ekiga::ContactCore *contact_core = new Ekiga::ContactCore;
 
111
  Ekiga::CallCore *call_core = new Ekiga::CallCore;
 
112
  Ekiga::ChatCore *chat_core = new Ekiga::ChatCore;
 
113
  Ekiga::VideoOutputCore *videooutput_core = new Ekiga::VideoOutputCore;
 
114
  Ekiga::VideoInputCore *videoinput_core = new Ekiga::VideoInputCore(*runtime, *videooutput_core);
 
115
  Ekiga::AudioOutputCore *audiooutput_core = new Ekiga::AudioOutputCore(*runtime);  
 
116
  Ekiga::AudioInputCore *audioinput_core = new Ekiga::AudioInputCore(*runtime, *audiooutput_core);
 
117
  Ekiga::HalCore *hal_core = new Ekiga::HalCore;
 
118
 
 
119
 
 
120
  /* The last item in the following list will be destroyed first.   *
 
121
   * - VideoInputCore must be destroyed before VideoOutputCore since its  *
 
122
   *   PreviewManager may call functions of VideoOutputCore.            *
 
123
   * - The runtime should be destroyed last since other core        *
 
124
   *   components may still call runtime functions until destroyed  *
 
125
   *   (e.g. VideoOutputCore).                                          */
 
126
   
 
127
  core->add (*runtime);
 
128
  core->add (*account_core);
 
129
  core->add (*contact_core);
 
130
  core->add (*chat_core);
 
131
  core->add (*videooutput_core);
 
132
  core->add (*videoinput_core);
 
133
  core->add (*audiooutput_core);
 
134
  core->add (*audioinput_core);
 
135
  core->add (*hal_core);
 
136
  core->add (*call_core);
 
137
 
 
138
  if (!gmconf_personal_details_init (*core, &argc, &argv)) {
 
139
    delete core;
 
140
    return;
 
141
  }
 
142
 
 
143
  presence_core = new Ekiga::PresenceCore (*core);
 
144
  core->add (*presence_core);
 
145
 
 
146
#ifndef WIN32
 
147
  if (!videooutput_x_init (*core, &argc, &argv)) {
 
148
    delete core;
 
149
    return;
 
150
  }
 
151
#endif
 
152
 
 
153
#ifdef HAVE_DX
 
154
  if (!videooutput_dx_init (*core, &argc, &argv)) {
 
155
    delete core;
 
156
    return;
 
157
  }
 
158
#endif
 
159
 
 
160
  if (!videoinput_mlogo_init (*core, &argc, &argv)) {
 
161
    delete core;
 
162
    return;
 
163
  }
 
164
 
 
165
  if (!audioinput_null_init (*core, &argc, &argv)) {
 
166
    delete core;
 
167
    return;
 
168
  }
 
169
 
 
170
  if (!audiooutput_null_init (*core, &argc, &argv)) {
 
171
    delete core;
 
172
    return;
 
173
  }
 
174
 
 
175
  if (!videoinput_ptlib_init (*core, &argc, &argv)) {
 
176
    delete core;
 
177
    return;
 
178
  }
 
179
 
 
180
  if (!audioinput_ptlib_init (*core, &argc, &argv)) {
 
181
    delete core;
 
182
    return;
 
183
  }
 
184
 
 
185
  if (!audiooutput_ptlib_init (*core, &argc, &argv)) {
 
186
    delete core;
 
187
    return;
 
188
  }
 
189
 
 
190
#ifdef HAVE_DBUS
 
191
  if (!hal_dbus_init (*core, &argc, &argv)) {
 
192
    delete core;
 
193
    return;
 
194
  }
 
195
#endif
 
196
 
 
197
  if (!opal_init (*core, &argc, &argv)) {
 
198
    delete core;
 
199
    return;
 
200
  }
 
201
 
 
202
#ifdef HAVE_AVAHI
 
203
  if (!avahi_init (*core, &argc, &argv)) {
 
204
    delete core;
 
205
    return;
 
206
  }
 
207
  
 
208
  if (!avahi_publisher_init (*core, &argc, &argv)) {
 
209
    delete core;
 
210
    return;
 
211
  }
 
212
#endif
 
213
 
 
214
#ifdef HAVE_EDS
 
215
  if (!evolution_init (*core, &argc, &argv)) {
 
216
    delete core;
 
217
    return;
 
218
  }
 
219
#endif
 
220
 
 
221
#ifdef HAVE_LDAP
 
222
  if (!ldap_init (*core, &argc, &argv)) {
 
223
    delete core;
 
224
    return;
 
225
  }
 
226
#endif
 
227
 
 
228
  if (!history_init (*core, &argc, &argv)) {
 
229
 
 
230
    delete core;
 
231
    return;
 
232
  }
 
233
 
 
234
  if (!gtk_core_init (*core, &argc, &argv)) {
 
235
    delete core;
 
236
    return;
 
237
  }
 
238
 
 
239
  if (!gtk_frontend_init (*core, &argc, &argv)) {
 
240
    delete core;
 
241
    return;
 
242
  }
 
243
 
 
244
  if (!local_roster_init (*core, &argc, &argv)) {
 
245
    delete core;
 
246
    return;
 
247
  }
 
248
 
 
249
  if (!local_roster_bridge_init (*core, &argc, &argv)) {
 
250
    delete core;
 
251
    return;
 
252
  }
 
253
 
 
254
  videooutput_core->setup_conf_bridge();
 
255
  videoinput_core->setup_conf_bridge();
 
256
  audiooutput_core->setup_conf_bridge();
 
257
  audioinput_core->setup_conf_bridge();
 
258
 
 
259
  sigc::connection conn;
 
260
  conn = hal_core->videoinput_device_added.connect (sigc::mem_fun (videoinput_core, &Ekiga::VideoInputCore::add_device));
 
261
  conn = hal_core->videoinput_device_removed.connect (sigc::mem_fun (videoinput_core, &Ekiga::VideoInputCore::remove_device));
 
262
  conn = hal_core->audiooutput_device_added.connect (sigc::mem_fun (audiooutput_core, &Ekiga::AudioOutputCore::add_device));
 
263
  conn = hal_core->audiooutput_device_removed.connect (sigc::mem_fun (audiooutput_core, &Ekiga::AudioOutputCore::remove_device));
 
264
  conn = hal_core->audioinput_device_added.connect (sigc::mem_fun (audioinput_core, &Ekiga::AudioInputCore::add_device));
 
265
  conn = hal_core->audioinput_device_removed.connect (sigc::mem_fun (audioinput_core, &Ekiga::AudioInputCore::remove_device));
 
266
  // std::vector<sigc::connection> connections;
 
267
  //connections.push_back (conn);
 
268
}