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
current_state[Ekiga::primary].opened = false;
45
current_state[Ekiga::secondary].opened = false;
48
GMAudioOutputManager_null::~GMAudioOutputManager_null ()
52
void GMAudioOutputManager_null::get_devices(std::vector <Ekiga::AudioOutputDevice> & devices)
55
Ekiga::AudioOutputDevice device;
56
device.type = DEVICE_TYPE;
57
device.source = DEVICE_SOURCE;
58
device.name = DEVICE_NAME;
59
devices.push_back(device);
64
bool GMAudioOutputManager_null::set_device (Ekiga::AudioOutputPS ps, const Ekiga::AudioOutputDevice & device)
66
if ( ( device.type == DEVICE_TYPE ) &&
67
( device.source == DEVICE_SOURCE) &&
68
( device.name == DEVICE_NAME) ) {
70
PTRACE(4, "GMAudioOutputManager_null\tSetting Device[" << ps << "] " << device);
71
current_state[ps].device = device;
77
bool GMAudioOutputManager_null::open (Ekiga::AudioOutputPS ps, unsigned channels, unsigned samplerate, unsigned bits_per_sample)
79
current_state[ps].channels = channels;
80
current_state[ps].samplerate = samplerate;
81
current_state[ps].bits_per_sample = bits_per_sample;
82
current_state[ps].opened = true;
84
PTRACE(4, "GMAudioOutputManager_null\tOpening Device[" << ps << "] " << current_state[ps].device);
85
PTRACE(4, "GMAudioOutputManager_null\tOpening Device with " << channels << "-" << samplerate << "/" << bits_per_sample);
87
adaptive_delay[ps].Restart();
89
Ekiga::AudioOutputSettings settings;
91
settings.modifyable = false;
92
Ekiga::Runtime::run_in_main (boost::bind (&GMAudioOutputManager_null::device_opened_in_main, this, ps, current_state[ps].device, settings));
97
void GMAudioOutputManager_null::close(Ekiga::AudioOutputPS ps)
99
current_state[ps].opened = false;
100
Ekiga::Runtime::run_in_main (boost::bind (&GMAudioOutputManager_null::device_closed_in_main, this, ps, current_state[ps].device));
104
bool GMAudioOutputManager_null::set_frame_data (Ekiga::AudioOutputPS ps,
105
const char */*data*/,
107
unsigned & bytes_written)
109
if (!current_state[ps].opened) {
110
PTRACE(1, "GMAudioOutputManager_null\tTrying to get frame from closed device[" << ps << "]");
114
bytes_written = size;
116
adaptive_delay[ps].Delay(size * 8 / current_state[ps].bits_per_sample * 1000 / current_state[ps].samplerate);
120
bool GMAudioOutputManager_null::has_device(const std::string & /*sink*/, const std::string & /*device_name*/, Ekiga::AudioOutputDevice & /*device*/)
126
GMAudioOutputManager_null::device_opened_in_main (Ekiga::AudioOutputPS ps,
127
Ekiga::AudioOutputDevice device,
128
Ekiga::AudioOutputSettings settings)
130
device_opened (ps, device, settings);
134
GMAudioOutputManager_null::device_closed_in_main (Ekiga::AudioOutputPS ps,
135
Ekiga::AudioOutputDevice device)
137
device_closed (ps, device);