~ubuntu-branches/ubuntu/maverick/ekiga/maverick

« back to all changes in this revision

Viewing changes to lib/engine/videooutput/x/videooutput-manager-x.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Eugen Dedu, Eugen Dedu, Loic Minier
  • Date: 2008-09-27 10:00:00 UTC
  • mfrom: (1.1.8 upstream)
  • mto: (1.4.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 38.
  • Revision ID: james.westby@ubuntu.com-20080927100000-l5k5werb6czr5b3h
Tags: 3.0.1-1
[ Eugen Dedu ]
* New version.  (Closes: #500089).
* Add our own changelog file in /usr/share/doc.
* Remove gnomemeeting transitional package.
* Discover new interfaces.  (Closes: #488199).
* Compile with dbus support.  (Closes: #467212).
* Numeric keypad inserts digits at correct position.  (Closes: #440159).
* Use libnotify upon call.  (Closes: #412604).
* Symlink identical GNOME help files, to reduce size.  (Closes: #505536).
* Explicitely build-depends on a few dev packages, even if they were
  pulled out anyway by the other dependencies.

[ Loic Minier ]
* Use clean:: instead of clean: in rules.
* Don't disable Uploaders: generation for control.in -> control generation
  in rules.
* Fix some tabs which were size 4 anyway.
* Generate a PO template during build by calling intltool-update -p in
  install; thanks Ubuntu and Martin Pitt; closes: #505535.
* Also let the -dbg depend on ${misc:Depends}.
* Cleanup rules; in particular, use dpkg-parsechangelog and honor
  distclean/clean failures, remove old clean rules, commented out stuff,
  gtk-only stuff.
* Pass -s to dh_* in binary-arch.
* Use debian/*.links and debian/*.manpages instead of symlink manually or
  passing files to dh_installman.
* Use ftp.gnome.org in copyright.
* Switch to quilt and fix target deps in the process; build-dep on quilt
  instead of dpatch; rename news.dpatch to 00_news.patch and refresh;
  replace 00list with series.
* Install autotools-dev config.guess and .sub after patching.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Ekiga -- A VoIP and Video-Conferencing application
 
2
 * Copyright (C) 2000-2007 Damien Sandras
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program 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
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software Foundation,
 
16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
 *
 
19
 * Ekiga is licensed under the GPL license and as a special exception,
 
20
 * you have permission to link or otherwise combine this program with the
 
21
 * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
 
22
 * without applying the requirements of the GNU GPL to the OPAL, OpenH323
 
23
 * and PWLIB programs, as long as you do follow the requirements of the
 
24
 * GNU GPL for all the rest of the software thus combined.
 
25
 */
 
26
 
 
27
 
 
28
/*
 
29
 *                         videooutput-manager-x.cpp -  description
 
30
 *                         ----------------------------------
 
31
 *   begin                : Sun Nov 19 2006
 
32
 *   copyright            : (C) 2006-2008 by Matthias Schneider
 
33
 *                          (C) 2000-2008 by Damien Sandras
 
34
 *   description          : Class to allow video output to a X/XVideo
 
35
 *                          accelerated window
 
36
 */
 
37
 
 
38
#include "videooutput-manager-x.h"
 
39
 
 
40
#include "xwindow.h"
 
41
 
 
42
#ifdef HAVE_XV
 
43
#include "xvwindow.h"
 
44
#endif
 
45
 
 
46
GMVideoOutputManager_x::GMVideoOutputManager_x (Ekiga::ServiceCore & _core)
 
47
: GMVideoOutputManager(_core)
 
48
{
 
49
  /* Internal stuff */
 
50
  lxWindow = NULL;
 
51
  rxWindow = NULL;
 
52
 
 
53
  rDisplay = XOpenDisplay (NULL);
 
54
  lDisplay = XOpenDisplay (NULL);
 
55
 
 
56
  pip_window_available = true;
 
57
 
 
58
  end_thread = false;
 
59
  init_thread = false;
 
60
  uninit_thread = false;
 
61
 
 
62
  this->Resume ();
 
63
  thread_created.Wait ();
 
64
}
 
65
 
 
66
GMVideoOutputManager_x::~GMVideoOutputManager_x ()
 
67
{
 
68
  end_thread = true;
 
69
  run_thread.Signal();
 
70
  thread_ended.Wait();
 
71
 
 
72
  if (lDisplay) 
 
73
    XCloseDisplay (lDisplay);
 
74
  if (rDisplay)
 
75
    XCloseDisplay (rDisplay);
 
76
}
 
77
 
 
78
bool
 
79
GMVideoOutputManager_x::frame_display_change_needed ()
 
80
{
 
81
    switch (current_frame.mode) 
 
82
    {
 
83
      case Ekiga::VO_MODE_LOCAL:
 
84
          if (!lxWindow) 
 
85
            return true;
 
86
          break;
 
87
      case Ekiga::VO_MODE_REMOTE:
 
88
          if (!rxWindow) 
 
89
            return true;
 
90
          break;
 
91
      case Ekiga::VO_MODE_FULLSCREEN:
 
92
      case Ekiga::VO_MODE_PIP:
 
93
      case Ekiga::VO_MODE_PIP_WINDOW:
 
94
          if (!rxWindow || (pip_window_available && (!lxWindow)) )
 
95
              return true;
 
96
          break;
 
97
     case Ekiga::VO_MODE_UNSET:
 
98
     default:
 
99
          break;
 
100
    }
 
101
  return GMVideoOutputManager::frame_display_change_needed ();
 
102
 
 
103
}
 
104
 
 
105
void
 
106
GMVideoOutputManager_x::setup_frame_display ()
 
107
{
 
108
  Ekiga::DisplayInfo local_display_info;
 
109
 
 
110
  if (video_disabled)
 
111
    return;
 
112
 
 
113
  get_display_info(local_display_info);
 
114
 
 
115
  switch (current_frame.mode) {
 
116
  case Ekiga::VO_MODE_LOCAL:
 
117
    runtime.run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.local_width * current_frame.zoom / 100), (unsigned) (current_frame.local_height * current_frame.zoom / 100)));
 
118
    break;
 
119
  case Ekiga::VO_MODE_REMOTE:
 
120
  case Ekiga::VO_MODE_PIP:
 
121
    runtime.run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.remote_width * current_frame.zoom / 100), (unsigned) (current_frame.remote_height * current_frame.zoom / 100)));
 
122
    break;
 
123
  case Ekiga::VO_MODE_FULLSCREEN:
 
124
    runtime.run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
 
125
    break;
 
126
  case Ekiga::VO_MODE_PIP_WINDOW:
 
127
    runtime.run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
 
128
    break;
 
129
  case Ekiga::VO_MODE_UNSET:
 
130
  default:
 
131
    PTRACE (1, "GMVideoOutputManager_X\tDisplay variable not set");
 
132
    return;
 
133
    break;
 
134
  }
 
135
 
 
136
  if ((!local_display_info.widget_info_set) || (!local_display_info.config_info_set) ||
 
137
      (local_display_info.mode == Ekiga::VO_MODE_UNSET) || (local_display_info.zoom == 0) || (current_frame.zoom == 0)) {
 
138
    PTRACE(4, "GMVideoOutputManager_X\tWidget not yet realized or gconf info not yet set, not opening display");
 
139
    return;
 
140
  }
 
141
 
 
142
  close_frame_display ();
 
143
 
 
144
  pip_window_available = false;
 
145
 
 
146
  current_frame.accel = Ekiga::VO_ACCEL_NONE;
 
147
 
 
148
  switch (current_frame.mode) {
 
149
// VO_MODE_LOCAL ------------------------------------------------------------------
 
150
  case Ekiga::VO_MODE_LOCAL:
 
151
    PTRACE(4, "GMVideoOutputManager_X\tOpening VO_MODE_LOCAL display with image of " << current_frame.local_width << "x" << current_frame.local_height);
 
152
#ifdef HAVE_XV
 
153
    if (!local_display_info.disable_hw_accel) {
 
154
      lxWindow = new XVWindow ();
 
155
      if (lxWindow->Init (lDisplay, 
 
156
                            local_display_info.window, 
 
157
                            local_display_info.gc,
 
158
                            local_display_info.x,
 
159
                            local_display_info.y,
 
160
                            (int) (current_frame.local_width * current_frame.zoom / 100), 
 
161
                            (int) (current_frame.local_height * current_frame.zoom / 100),
 
162
                            current_frame.local_width, 
 
163
                            current_frame.local_height)) {
 
164
        current_frame.accel = Ekiga::VO_ACCEL_ALL;
 
165
        PTRACE(4, "GMVideoOutputManager_X\tVO_MODE_LOCAL: Successfully opened XV Window");
 
166
      }
 
167
      else {
 
168
        delete lxWindow;
 
169
        lxWindow = NULL;
 
170
        current_frame.accel = Ekiga::VO_ACCEL_NONE;
 
171
        PTRACE(4, "GMVideoOutputManager_X\tVO_MODE_LOCAL: Could not open XV Window");
 
172
      }
 
173
    }
 
174
#endif                     
 
175
    if (current_frame.accel == Ekiga::VO_ACCEL_NONE) {
 
176
      PTRACE(3, "GMVideoOutputManager_X\tFalling back to SW" << ((local_display_info.disable_hw_accel) 
 
177
                                      ? " since HW acceleration was deactivated by configuration" 
 
178
                                      : " since HW acceleration failed to initalize"));
 
179
      lxWindow = new XWindow ();
 
180
      if (lxWindow->Init (lDisplay, 
 
181
                            local_display_info.window, 
 
182
                            local_display_info.gc,
 
183
                            local_display_info.x,
 
184
                            local_display_info.y,
 
185
                           (int) (current_frame.local_width * current_frame.zoom / 100), 
 
186
                           (int) (current_frame.local_height * current_frame.zoom / 100),
 
187
                           current_frame.local_width, 
 
188
                           current_frame.local_height)) {
 
189
       lxWindow->SetSwScalingAlgo(local_display_info.sw_scaling_algorithm);
 
190
       PTRACE(4, "GMVideoOutputManager_X\tVO_MODE_LOCAL: Successfully opened X Window");
 
191
      }
 
192
      else {
 
193
        delete lxWindow;
 
194
        lxWindow = NULL;
 
195
        video_disabled = true;
 
196
        current_frame.accel = Ekiga::VO_ACCEL_NO_VIDEO;
 
197
        PTRACE(1, "GMVideoOutputManager_X\tVO_MODE_LOCAL: Could not open X Window - no video");
 
198
      }
 
199
    }
 
200
    
 
201
    last_frame.embedded_x = local_display_info.x;
 
202
    last_frame.embedded_y = local_display_info.y;
 
203
 
 
204
    last_frame.mode = Ekiga::VO_MODE_LOCAL;
 
205
    last_frame.local_width = current_frame.local_width;
 
206
    last_frame.local_height = current_frame.local_height;
 
207
    last_frame.zoom = current_frame.zoom;
 
208
    break;
 
209
 
 
210
// VO_MODE_REMOTE ----------------------------------------------------------------
 
211
  case Ekiga::VO_MODE_REMOTE:
 
212
    PTRACE(4, "GMVideoOutputManager_X\tOpening VO_MODE_REMOTE display with image of " << current_frame.remote_width << "x" << current_frame.remote_height);
 
213
#ifdef HAVE_XV
 
214
    if (!local_display_info.disable_hw_accel) {
 
215
      rxWindow = new XVWindow ();
 
216
      if (rxWindow->Init (rDisplay, 
 
217
                          local_display_info.window, 
 
218
                          local_display_info.gc,
 
219
                          local_display_info.x,
 
220
                          local_display_info.y,
 
221
                          (int) (current_frame.remote_width * current_frame.zoom / 100), 
 
222
                          (int) (current_frame.remote_height * current_frame.zoom / 100),
 
223
                          current_frame.remote_width, 
 
224
                          current_frame.remote_height)) {
 
225
       current_frame.accel = Ekiga::VO_ACCEL_ALL;
 
226
       PTRACE(4, "GMVideoOutputManager_X\tVO_MODE_REMOTE: Successfully opened XV Window");
 
227
     }
 
228
     else {
 
229
       delete rxWindow;
 
230
       rxWindow = NULL;
 
231
       current_frame.accel = Ekiga::VO_ACCEL_NONE;
 
232
       PTRACE(1, "GMVideoOutputManager_X\tVO_MODE_LOCAL: Could not open XV Window");
 
233
 
 
234
     }
 
235
    }
 
236
#endif                     
 
237
    if (current_frame.accel == Ekiga::VO_ACCEL_NONE) {
 
238
      PTRACE(3, "GMVideoOutputManager_X\tFalling back to SW" << ((local_display_info.disable_hw_accel) 
 
239
                                      ? " since HW acceleration was deactivated by configuration" 
 
240
                                      : " since HW acceleration failed to initalize"));
 
241
      rxWindow = new XWindow ();
 
242
      if ( rxWindow->Init (rDisplay, 
 
243
                             local_display_info.window, 
 
244
                             local_display_info.gc,
 
245
                             local_display_info.x,
 
246
                             local_display_info.y,
 
247
                             (int) (current_frame.remote_width * current_frame.zoom / 100), 
 
248
                             (int) (current_frame.remote_height * current_frame.zoom / 100),
 
249
                             current_frame.remote_width, 
 
250
                             current_frame.remote_height)) {
 
251
        rxWindow->SetSwScalingAlgo(local_display_info.sw_scaling_algorithm);
 
252
        PTRACE(4, "GMVideoOutputManager_X\tVO_MODE_REMOTE: Successfully opened X Window");
 
253
      }
 
254
      else {
 
255
        delete rxWindow;
 
256
        rxWindow = NULL;
 
257
        video_disabled = true;
 
258
        current_frame.accel = Ekiga::VO_ACCEL_NO_VIDEO;
 
259
        PTRACE(1, "GMVideoOutputManager_X\tVO_MODE_REMOTE: Could not open X Window - no video");
 
260
      }
 
261
    }
 
262
 
 
263
    last_frame.embedded_x = local_display_info.x;
 
264
    last_frame.embedded_y = local_display_info.y;
 
265
 
 
266
    last_frame.mode = Ekiga::VO_MODE_REMOTE;
 
267
    last_frame.remote_width = current_frame.remote_width;
 
268
    last_frame.remote_height = current_frame.remote_height;
 
269
    last_frame.zoom = current_frame.zoom;
 
270
    break;
 
271
 
 
272
// PIP_VIDEO ------------------------------------------------------------------
 
273
  case Ekiga::VO_MODE_FULLSCREEN:
 
274
  case Ekiga::VO_MODE_PIP:
 
275
  case Ekiga::VO_MODE_PIP_WINDOW:
 
276
    PTRACE(4, "GMVideoOutputManager_X\tOpening display " << current_frame.mode << " with images of " 
 
277
            << current_frame.local_width << "x" << current_frame.local_height << "(local) and " 
 
278
            << current_frame.remote_width << "x" << current_frame.remote_height << "(remote)");
 
279
#ifdef HAVE_XV
 
280
    if (!local_display_info.disable_hw_accel) {
 
281
      rxWindow = new XVWindow ();
 
282
      if (rxWindow->Init ( rDisplay, 
 
283
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.window : DefaultRootWindow (rDisplay), 
 
284
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.gc : NULL,
 
285
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.x : 0,
 
286
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.y : 0,
 
287
                             (int) (current_frame.remote_width * current_frame.zoom / 100), 
 
288
                             (int) (current_frame.remote_height * current_frame.zoom / 100),
 
289
                             current_frame.remote_width, 
 
290
                             current_frame.remote_height)) {
 
291
        current_frame.accel = Ekiga::VO_ACCEL_REMOTE_ONLY;
 
292
        PTRACE(4, "GMVideoOutputManager_X\tPIP: Successfully opened remote XV Window");
 
293
      }
 
294
      else 
 
295
      {
 
296
        delete rxWindow;
 
297
        rxWindow = NULL;
 
298
        current_frame.accel = Ekiga::VO_ACCEL_NONE;
 
299
        PTRACE(1, "GMVideoOutputManager_X\tPIP: Could not open remote XV Window");
 
300
      }
 
301
    }
 
302
#endif                     
 
303
    if (current_frame.accel == Ekiga::VO_ACCEL_NONE) {
 
304
      PTRACE(3, "GMVideoOutputManager_X\tFalling back to SW" << ((local_display_info.disable_hw_accel) 
 
305
                                      ? " since HW acceleration was deactivated by configuration" 
 
306
                                      : " since HW acceleration failed to initalize"));
 
307
      rxWindow = new XWindow ();
 
308
      if (rxWindow->Init ( rDisplay, 
 
309
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.window : DefaultRootWindow (rDisplay), 
 
310
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.gc : NULL,
 
311
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.x : 0,
 
312
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.y : 0,
 
313
                             (int) (current_frame.remote_width * current_frame.zoom / 100), 
 
314
                             (int) (current_frame.remote_height * current_frame.zoom / 100),
 
315
                             current_frame.remote_width, 
 
316
                             current_frame.remote_height)) {
 
317
        rxWindow->SetSwScalingAlgo(local_display_info.sw_scaling_algorithm);
 
318
        PTRACE(4, "GMVideoOutputManager_X\tPIP: Successfully opened remote X Window");
 
319
      }
 
320
      else {
 
321
        delete rxWindow;
 
322
        rxWindow = NULL;
 
323
        video_disabled = true;
 
324
        current_frame.accel = Ekiga::VO_ACCEL_NO_VIDEO;
 
325
        PTRACE(1, "GMVideoOutputManager_X\tPIP: Could not open remote X Window - no video");
 
326
      }
 
327
    }
 
328
 
 
329
 
 
330
#ifdef HAVE_XV
 
331
    if (current_frame.accel == Ekiga::VO_ACCEL_REMOTE_ONLY) {
 
332
      lxWindow = new XVWindow();
 
333
      if (lxWindow->Init (   rxWindow->GetDisplay (), 
 
334
                             rxWindow->GetWindowHandle (),
 
335
                             rxWindow->GetGC (),
 
336
                             (int) (current_frame.remote_width * current_frame.zoom  / 100 * 2 / 3), 
 
337
                             (int) (current_frame.remote_height * current_frame.zoom  / 100 * 2 / 3), 
 
338
                             (int) (current_frame.remote_width * current_frame.zoom  / 100 / 3), 
 
339
                             (int) (current_frame.remote_height * current_frame.zoom  / 100 / 3),
 
340
                             current_frame.local_width, 
 
341
                             current_frame.local_height)) {
 
342
        current_frame.accel = Ekiga::VO_ACCEL_ALL;
 
343
        pip_window_available = true;
 
344
        PTRACE(4, "GMVideoOutputManager_X\tPIP: Successfully opened local XV Window");
 
345
      }
 
346
      else {
 
347
        delete lxWindow;
 
348
        lxWindow = NULL;
 
349
        pip_window_available = false;
 
350
        PTRACE(1, "GMVideoOutputManager_X\tPIP: Could not open local XV Window");
 
351
      }
 
352
    }
 
353
#endif
 
354
    if ((current_frame.accel != Ekiga::VO_ACCEL_ALL) && (local_display_info.allow_pip_sw_scaling)) {
 
355
      PTRACE(3, "GMVideoOutputManager_X\tFalling back to SW" << ((local_display_info.disable_hw_accel) 
 
356
                                      ? " since HW acceleration was deactivated by configuration" 
 
357
                                      : " since HW acceleration failed to initalize"));
 
358
      lxWindow = new XWindow ();
 
359
      if (lxWindow->Init ( lDisplay, 
 
360
                             rxWindow->GetWindowHandle (),
 
361
                             (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.gc : NULL,
 
362
                             (int) (current_frame.remote_width * current_frame.zoom  / 100 * 2 / 3), 
 
363
                             (int) (current_frame.remote_height * current_frame.zoom  / 100 * 2 / 3), 
 
364
                             (int) (current_frame.remote_width * current_frame.zoom  / 100 / 3), 
 
365
                             (int) (current_frame.remote_height * current_frame.zoom  / 100 / 3),
 
366
                             current_frame.local_width, 
 
367
                             current_frame.local_height)) {
 
368
       lxWindow->SetSwScalingAlgo(local_display_info.sw_scaling_algorithm);
 
369
       pip_window_available = true;
 
370
       PTRACE(4, "GMVideoOutputManager_X\tPIP: Successfully opened local X Window");
 
371
     }
 
372
     else {
 
373
       delete lxWindow;
 
374
       lxWindow = NULL;
 
375
       pip_window_available = false;
 
376
       PTRACE(4, "GMVideoOutputManager_X\tPIP: Could not open local X Window - picture-in-picture disabled");
 
377
      }
 
378
    }
 
379
 
 
380
    if ((current_frame.accel != Ekiga::VO_ACCEL_ALL) && (!local_display_info.allow_pip_sw_scaling)) {
 
381
      PTRACE(3, "GMVideoOutputManager_X\tNot opening PIP window since HW acceleration is not available and SW fallback is disabled by configuration");
 
382
      current_frame.accel = Ekiga::VO_ACCEL_ALL;
 
383
    }
 
384
 
 
385
    if (rxWindow && lxWindow) {
 
386
 
 
387
      rxWindow->RegisterSlave (lxWindow);
 
388
      lxWindow->RegisterMaster (rxWindow);
 
389
    }     
 
390
 
 
391
    if (rxWindow && current_frame.mode == Ekiga::VO_MODE_FULLSCREEN) 
 
392
      rxWindow->ToggleFullscreen ();
 
393
    
 
394
    if ((current_frame.mode != Ekiga::VO_MODE_PIP_WINDOW) && (current_frame.mode != Ekiga::VO_MODE_FULLSCREEN)) {
 
395
      last_frame.embedded_x = local_display_info.x;
 
396
      last_frame.embedded_y = local_display_info.y;
 
397
    }
 
398
 
 
399
    last_frame.mode = current_frame.mode;
 
400
    last_frame.local_width = current_frame.local_width;
 
401
    last_frame.local_height = current_frame.local_height;
 
402
    last_frame.remote_width = current_frame.remote_width;
 
403
    last_frame.remote_height = current_frame.remote_height;
 
404
    last_frame.zoom = current_frame.zoom;
 
405
    break;
 
406
 
 
407
  case Ekiga::VO_MODE_UNSET:
 
408
  default:
 
409
    return;
 
410
    break;
 
411
  }
 
412
 
 
413
  if (local_display_info.on_top) {
 
414
 
 
415
    if (lxWindow)
 
416
      lxWindow->ToggleOntop ();
 
417
    if (rxWindow)
 
418
      rxWindow->ToggleOntop ();
 
419
  }
 
420
 
 
421
  last_frame.both_streams_active = current_frame.both_streams_active;
 
422
  if (video_disabled) {
 
423
    runtime.run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
 
424
  }
 
425
  else {
 
426
    runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
 
427
  }
 
428
}
 
429
 
 
430
void
 
431
GMVideoOutputManager_x::close_frame_display ()
 
432
{
 
433
  runtime.run_in_main (device_closed.make_slot ());
 
434
 
 
435
  if (rxWindow) 
 
436
    rxWindow->RegisterSlave (NULL);
 
437
  if (lxWindow) 
 
438
    lxWindow->RegisterMaster (NULL);
 
439
 
 
440
  if (lxWindow) {
 
441
    delete lxWindow;
 
442
    lxWindow = NULL;
 
443
  }
 
444
 
 
445
  if (rxWindow) {
 
446
    delete rxWindow;
 
447
    rxWindow = NULL;
 
448
  }
 
449
}
 
450
 
 
451
void
 
452
GMVideoOutputManager_x::display_frame (const char *frame,
 
453
                             unsigned width,
 
454
                             unsigned height)
 
455
{
 
456
  if (rxWindow)
 
457
    rxWindow->ProcessEvents();
 
458
 
 
459
  if (lxWindow)
 
460
    lxWindow->ProcessEvents();
 
461
 
 
462
  if  ((current_frame.mode == Ekiga::VO_MODE_LOCAL) && (lxWindow))
 
463
    lxWindow->PutFrame ((uint8_t *) frame, width, height);
 
464
 
 
465
  if  ((current_frame.mode == Ekiga::VO_MODE_REMOTE) && (rxWindow))
 
466
    rxWindow->PutFrame ((uint8_t *) frame, width, height);
 
467
}
 
468
 
 
469
void
 
470
GMVideoOutputManager_x::display_pip_frames (const char *local_frame,
 
471
                                 unsigned lf_width,
 
472
                                 unsigned lf_height,
 
473
                                 const char *remote_frame,
 
474
                                 unsigned rf_width,
 
475
                                 unsigned rf_height)
 
476
{
 
477
  if (rxWindow)
 
478
    rxWindow->ProcessEvents();
 
479
 
 
480
  if (lxWindow)
 
481
    lxWindow->ProcessEvents();
 
482
 
 
483
  if (current_frame.mode == Ekiga::VO_MODE_FULLSCREEN && rxWindow && !rxWindow->IsFullScreen ())
 
484
    runtime.run_in_main (sigc::bind (fullscreen_mode_changed.make_slot (), Ekiga::VO_FS_OFF));
 
485
 
 
486
  if (rxWindow && (update_required.remote || (!update_required.remote && !update_required.local)))
 
487
    rxWindow->PutFrame ((uint8_t *) remote_frame, rf_width, rf_height);
 
488
 
 
489
  if (lxWindow && (update_required.local  || (!update_required.remote && !update_required.local)))
 
490
    lxWindow->PutFrame ((uint8_t *) local_frame, lf_width, lf_height);
 
491
}
 
492
 
 
493
void
 
494
GMVideoOutputManager_x::sync (UpdateRequired sync_required)
 
495
{
 
496
  if (rxWindow && (sync_required.remote || (!sync_required.remote && !sync_required.local))) {
 
497
    rxWindow->Sync();
 
498
  }
 
499
 
 
500
  if (lxWindow && (sync_required.local  || (!sync_required.remote && !sync_required.local))) {
 
501
    lxWindow->Sync();
 
502
  }
 
503
}
 
504