~ubuntu-branches/ubuntu/karmic/ekiga/karmic

« back to all changes in this revision

Viewing changes to lib/engine/audiooutput/audiooutput-manager.h

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2009-03-17 15:14:12 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090317151412-no6uq0wl8zz2hsw3
Tags: 3.2.0-0ubuntu1
* New upstream release (LP: #341367)
  - Better NAT support in case of Cone NAT
  - Uniformise detection of libnotify; fix compilation with mingw
  - Fix "URL completion combobox shows identical completions"
  - Fix "Assistant loosing values when going backward"
  - Fix GmConf settings when compiled with another package name
  - Fix unregistration of accounts
  - Fix build with --enable-kde
  - Fixed possible crash when retrieving presence information
  - New translations: crh, or
  - Updated translations: as, bg, bn_IN, da, de, el, eu, gl, gu, hi, hu,
    ja, kn, ko, ku, lt, ml, mr, or, pt, ro, ru, ta, te, tr
  - New help translation: en_GB
  - Updated help translation: fr
  - Better NAT support in case of Cone NAT
  - There is now only one H.263 plugin implementing both H.263 and H.263+
  - Allow several ALSA devices to have the same name
  - Added support for the G.722 audio codec: G.722 is a 16 kHz wideband
    audio codec advertised as HD Voice by the famous Polycom. It is a
    great boost in quality and interoperability
  - Added support for the CELT ultral-low delay audio codec: CELT delivers
    high quality audio at 32 kHz or 48 kHz, allowing to transmit music in
    high quality, with low delay and low bitrate
  - Added support for SIP dialog-info notifications: they allow displaying
    notifications of incoming calls in the roster. With software like
    kamailio or Asterisk, it allows being informed of incoming calls
    reaching your colleagues
  - Largely improved LDAP support: the OpenLDAP guys contributed several
    patches to provide state-of-the-art LDAP support in the Ekiga address
    book. The new code even supports authentication
  - Killed the gconf_test_age test, Ekiga can now finally work with
    badly installed GConf schemas
  - Better handling of multiple network interfaces with dynamic addition
    and removal
  - Added settings migration from Ekiga 2.0.x.
  - Other various fixes, cleanups, removal of deprecated symbols etc.
  - New translations: crh, or
  - New help translation: en_GB, eu
  - Updated many translations and help
  - Experimental features:
    * Significant improvements in IPv6 support
    * Gstreamer audio and video capture support near to be finished...
* debian/patches/migrate_2.0_settings.patch:
  - Removed, migration is now upstream
* debian/patches/00_news.patch
  - Removed
* debian/patches/ubuntu_lpi.patch:
  - Modified to work with 3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * Ekiga -- A VoIP and Video-Conferencing application
 
4
 * Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com>
 
5
 
 
6
 * This program is free software; you can  redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or (at
 
9
 * your option) any later version. This program is distributed in the hope
 
10
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
 
11
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
12
 * See the GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along
 
15
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
16
 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
 * Ekiga is licensed under the GPL license and as a special exception, you
 
19
 * have permission to link or otherwise combine this program with the
 
20
 * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
 
21
 * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
 
22
 * programs, as long as you do follow the requirements of the GNU GPL for all
 
23
 * the rest of the software thus combined.
 
24
 */
 
25
 
 
26
 
 
27
/*
 
28
 *                         audiooutput-manager.h  -  description
 
29
 *                         ------------------------------------------
 
30
 *   begin                : written in 2008 by Matthias Schneider
 
31
 *   copyright            : (c) 2008 by Matthias Schneider
 
32
 *   description          : Declaration of the interface of an audiooutput manager
 
33
 *                          implementation backend.
 
34
 *
 
35
 */
 
36
 
 
37
 
 
38
#ifndef __AUDIOOUTPUT_MANAGER_H__
 
39
#define __AUDIOOUTPUT_MANAGER_H__
 
40
 
 
41
#include <vector>
 
42
#include <sigc++/sigc++.h>
 
43
 
 
44
#include "audiooutput-info.h"
 
45
 
 
46
namespace Ekiga
 
47
{
 
48
 
 
49
/**
 
50
 * @addtogroup audiooutput
 
51
 * @{
 
52
 */
 
53
 
 
54
  /** Generic implementation for the Ekiga::AudioOutputManager class.
 
55
   *
 
56
   * Each AudioOutputManager will represent a specific backend able to play back audio.
 
57
   * Each AudioOutputManager will manage one or more devices.
 
58
   * The AudioOutputCore will control the different managers and their devices.
 
59
   */
 
60
  class AudioOutputManager
 
61
    {
 
62
 
 
63
  public:
 
64
 
 
65
      /** The constructor
 
66
       */
 
67
      AudioOutputManager () {}
 
68
 
 
69
      /** The destructor
 
70
       */
 
71
      virtual ~AudioOutputManager () {}
 
72
 
 
73
 
 
74
      /*** API for audio output ***/
 
75
 
 
76
      /** Get a list of all devices supported by the manager.
 
77
       * Add it to the list of devices already collected by the core.
 
78
       * @param devices a vector of device names to be filled by the manager.
 
79
       */
 
80
      virtual void get_devices (std::vector <AudioOutputDevice> & devices) = 0;
 
81
 
 
82
      /** Set the current device.
 
83
       * Must be called before opening the device.
 
84
       * In case a different device of the same manager was opened before, it must be 
 
85
       * closed before setting the new device.
 
86
       * @param prim whether to set the primary or secondary device.
 
87
       * @param device the device to be used.
 
88
       */
 
89
      virtual bool set_device (AudioOutputPS ps, const AudioOutputDevice & device) = 0;
 
90
 
 
91
      /** Open the device.
 
92
       * The device must be opened before calling set_frame_data(), set_buffer_size() and set_volume().
 
93
       * Requires the set_device() to be called before.
 
94
       * Returns false if the device cannot be opened. Also sends a GUI callback to the main thread in that case.
 
95
       * @param prim whether the device shall be opened as primary or secondary device.
 
96
       * @param channels number of channels (1=mono, 2=stereo).
 
97
       * @param samplerate the samplerate.
 
98
       * @param bits_per_sample the number bits per sample.
 
99
       * @return true if the opening succeeded. False if the device cannot be opened.
 
100
       */
 
101
      virtual bool open (AudioOutputPS ps, unsigned channels, unsigned samplerate, unsigned bits_per_sample) = 0;
 
102
 
 
103
      /** Close the device.
 
104
       */
 
105
      virtual void close (AudioOutputPS /*ps*/) {};
 
106
 
 
107
      /** Set the buffer size.
 
108
       * The buffer size must be set before calling set_frame_data().
 
109
       * Requires the device to be opened.
 
110
       * @param prim whether buffers of the primary or secodnary device shall be set.
 
111
       * @param buffer_size the size of each buffer in bytes.
 
112
       * @param num_buffers the number of buffers.
 
113
       */
 
114
      virtual void set_buffer_size (AudioOutputPS /*ps*/, unsigned /*buffer_size*/, unsigned /*num_buffers*/) {};
 
115
 
 
116
      /** Set one audio buffer.
 
117
       * Requires the device to be opened and the buffer size to be set.
 
118
       * Returns false if writing the device fails. Also sends a GUI callback to the main thread in that case.
 
119
       * @param data a pointer to the buffer with the data to be written. It will not be freed.
 
120
       * @param size the size of the buffer to be written.
 
121
       * @param bytes_written returns the number of bytes actually written. Should be equal to size.
 
122
       * @return false if the writing failed.
 
123
       */
 
124
      virtual bool set_frame_data (AudioOutputPS ps, 
 
125
                                   const char *data,
 
126
                                   unsigned size,
 
127
                                   unsigned & bytes_written) = 0;
 
128
 
 
129
      /** Set the volume level for the current device.
 
130
       * Requires the device to be opened.
 
131
       * @param prim wether the volume of the primary or secondary device shall be set.
 
132
       * @param volume the new volume (0..255).
 
133
       */
 
134
      virtual void set_volume (AudioOutputPS /*ps*/, unsigned /* volume */ ) {};
 
135
 
 
136
      /** Returns true if a specific device is supported by the manager.
 
137
       * If the device specified by sink and device_name is supported by the manager, true
 
138
       * is returned and an AudioOutputDevice structure filled with the respective details.
 
139
       * @param sink the sink type of the device (e.g. alsa, oss, etc.).
 
140
       * @param device_name the name of the device.
 
141
       * @param device in case the device is supported by the manager, this structure will be filled with the device details.
 
142
       * @return true if the device is supported by the manager.
 
143
       */
 
144
      virtual bool has_device (const std::string & sink, const std::string & device_name, AudioOutputDevice & device) = 0;
 
145
 
 
146
 
 
147
      /*** API to act on AudioOutputDevice events ***/
 
148
 
 
149
      /** This signal is emitted when an audio output device is opened.
 
150
       * @param prim whether the primary or secondary audio output device was opened.
 
151
       * @param device the audio output device that was opened.
 
152
       * @param config the current audio output device configuration (current volume, etc.).
 
153
       */
 
154
      sigc::signal3<void, AudioOutputPS, AudioOutputDevice, AudioOutputSettings> device_opened;
 
155
 
 
156
      /** This signal is emitted when an audio output device is closed.
 
157
       * @param prim whether the primary or secondary audio output device was closed.
 
158
       * @param device the audio output device that was closed.
 
159
       */
 
160
      sigc::signal2<void, AudioOutputPS, AudioOutputDevice> device_closed;
 
161
 
 
162
      /** This signal is emitted when an error occurs when opening an audio output device.
 
163
       * @param prim whether the primary or secondary audio output device caused the error.
 
164
       * @param device the audio output device that caused the error.
 
165
       * @param error_code the audio output device error code.
 
166
       */
 
167
      sigc::signal3<void, AudioOutputPS, AudioOutputDevice, AudioOutputErrorCodes> device_error;
 
168
 
 
169
  protected:  
 
170
      typedef struct ManagerState {
 
171
        bool opened;
 
172
        unsigned channels;
 
173
        unsigned samplerate;
 
174
        unsigned bits_per_sample;
 
175
        AudioOutputDevice device;
 
176
      } ManagerState;
 
177
 
 
178
      ManagerState current_state[2];
 
179
  };
 
180
/**
 
181
 * @}
 
182
 */
 
183
 
 
184
};
 
185
 
 
186
#endif