2
* Ekiga -- A VoIP and Video-Conferencing application
3
* Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com>
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 (at
8
* your option) any later version. This program is distributed in the hope
9
* that it will be useful, but WITHOUT ANY WARRANTY; without even the
10
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
* See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program; if not, write to the Free Software Foundation, Inc.,
15
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
* Ekiga is licensed under the GPL license and as a special exception, you
18
* have permission to link or otherwise combine this program with the
19
* programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
20
* applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
21
* programs, as long as you do follow the requirements of the GNU GPL for all
22
* the rest of the software thus combined.
27
* audiooutput-manager-null.cpp - description
28
* ------------------------------------------
29
* begin : written in 2008 by Matthias Schneider
30
* copyright : (c) 2008 by Matthias Schneider
31
* description : declaration of a NULL audio output manager
35
#include "audiooutput-manager-null.h"
37
#define DEVICE_TYPE "Ekiga"
38
#define DEVICE_SOURCE "Ekiga"
39
#define DEVICE_NAME "SILENT"
41
GMAudioOutputManager_null::GMAudioOutputManager_null (Ekiga::ServiceCore & _core)
44
gmref_ptr<Ekiga::Runtime> smart = core.get ("runtime");
45
smart->reference (); // take a reference in the main thread
47
current_state[Ekiga::primary].opened = false;
48
current_state[Ekiga::secondary].opened = false;
51
GMAudioOutputManager_null::~GMAudioOutputManager_null ()
53
runtime->unreference (); // leave a reference in the main thread
56
void GMAudioOutputManager_null::get_devices(std::vector <Ekiga::AudioOutputDevice> & devices)
58
Ekiga::AudioOutputDevice device;
59
device.type = DEVICE_TYPE;
60
device.source = DEVICE_SOURCE;
61
device.name = DEVICE_NAME;
62
devices.push_back(device);
66
bool GMAudioOutputManager_null::set_device (Ekiga::AudioOutputPS ps, const Ekiga::AudioOutputDevice & device)
68
if ( ( device.type == DEVICE_TYPE ) &&
69
( device.source == DEVICE_SOURCE) &&
70
( device.name == DEVICE_NAME) ) {
72
PTRACE(4, "GMAudioOutputManager_null\tSetting Device[" << ps << "] " << device);
73
current_state[ps].device = device;
79
bool GMAudioOutputManager_null::open (Ekiga::AudioOutputPS ps, unsigned channels, unsigned samplerate, unsigned bits_per_sample)
81
current_state[ps].channels = channels;
82
current_state[ps].samplerate = samplerate;
83
current_state[ps].bits_per_sample = bits_per_sample;
84
current_state[ps].opened = true;
86
PTRACE(4, "GMAudioOutputManager_null\tOpening Device[" << ps << "] " << current_state[ps].device);
87
PTRACE(4, "GMAudioOutputManager_null\tOpening Device with " << channels << "-" << samplerate << "/" << bits_per_sample);
89
adaptive_delay[ps].Restart();
91
Ekiga::AudioOutputSettings settings;
93
settings.modifyable = false;
94
runtime->run_in_main (sigc::bind (device_opened.make_slot (), ps, current_state[ps].device, settings));
99
void GMAudioOutputManager_null::close(Ekiga::AudioOutputPS ps)
101
current_state[ps].opened = false;
102
runtime->run_in_main (sigc::bind (device_closed.make_slot (), ps, current_state[ps].device));
106
bool GMAudioOutputManager_null::set_frame_data (Ekiga::AudioOutputPS ps,
107
const char */*data*/,
109
unsigned & bytes_written)
111
if (!current_state[ps].opened) {
112
PTRACE(1, "GMAudioOutputManager_null\tTrying to get frame from closed device[" << ps << "]");
116
bytes_written = size;
118
adaptive_delay[ps].Delay(size * 8 / current_state[ps].bits_per_sample * 1000 / current_state[ps].samplerate);
122
bool GMAudioOutputManager_null::has_device(const std::string & /*sink*/, const std::string & /*device_name*/, Ekiga::AudioOutputDevice & /*device*/)