ekiga r6255 - in trunk: . lib/engine/audioinput/skel lib/engine/audiooutput/null lib/engine/audiooutput/ptlib lib/engine/audiooutput/skel lib/engine/display/common lib/engine/display/skel lib/engine/hal/skel lib/engine/vidinput/mlogo lib/engine/vidinput/ptlib lib/engine/vidinput/skel src/devices
- From: mschneid svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6255 - in trunk: . lib/engine/audioinput/skel lib/engine/audiooutput/null lib/engine/audiooutput/ptlib lib/engine/audiooutput/skel lib/engine/display/common lib/engine/display/skel lib/engine/hal/skel lib/engine/vidinput/mlogo lib/engine/vidinput/ptlib lib/engine/vidinput/skel src/devices
- Date: Wed, 14 May 2008 18:55:28 +0100 (BST)
Author: mschneid
Date: Wed May 14 17:55:27 2008
New Revision: 6255
URL: http://svn.gnome.org/viewvc/ekiga?rev=6255&view=rev
Log:
More documentation...
Modified:
trunk/ChangeLog
trunk/lib/engine/audioinput/skel/audioinput-manager.h
trunk/lib/engine/audiooutput/null/audiooutput-manager-null.cpp
trunk/lib/engine/audiooutput/null/audiooutput-manager-null.h
trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.cpp
trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.h
trunk/lib/engine/audiooutput/skel/audiooutput-core.cpp
trunk/lib/engine/audiooutput/skel/audiooutput-core.h
trunk/lib/engine/audiooutput/skel/audiooutput-manager.h
trunk/lib/engine/display/common/display-manager-common.cpp
trunk/lib/engine/display/common/display-manager-common.h
trunk/lib/engine/display/skel/display-core.cpp
trunk/lib/engine/display/skel/display-core.h
trunk/lib/engine/display/skel/display-manager.h
trunk/lib/engine/hal/skel/hal-manager.h
trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp
trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h
trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp
trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h
trunk/lib/engine/vidinput/skel/vidinput-core.cpp
trunk/lib/engine/vidinput/skel/vidinput-core.h
trunk/lib/engine/vidinput/skel/vidinput-manager.h
trunk/src/devices/videoinput.cpp
trunk/src/devices/videoinput.h
trunk/src/devices/videooutput.cpp
Modified: trunk/lib/engine/audioinput/skel/audioinput-manager.h
==============================================================================
--- trunk/lib/engine/audioinput/skel/audioinput-manager.h (original)
+++ trunk/lib/engine/audioinput/skel/audioinput-manager.h Wed May 14 17:55:27 2008
@@ -44,57 +44,120 @@
{
/**
- * @addtogroup vidinput
+ * @addtogroup audioinput
* @{
*/
-
-
+ /** Generic implementation for the Ekiga::AudioInputManager class.
+ *
+ * Each AudioInputManager will represent a specific backend able to record audio.
+ * Each AudioInputManager will manage one or more devices.
+ * The AudioInputCore will control the different managers and their devices.
+ */
class AudioInputManager
{
public:
- /* The constructor
+ /** The constructor
*/
AudioInputManager () {}
- /* The destructor
+ /** The destructor
*/
~AudioInputManager () {}
- /*
- * AUDIOINPUT MANAGEMENT
- */
+ /*** API for audio input ***/
- /** Create a call based on the remote uri given as parameter
- * @param uri an uri
- * @return true if a Ekiga::Call could be created
+ /** Get a list of all devices supported by the manager.
+ * Add it to the list of devices already collected by the core.
+ * @param devices a vector of device names to be filled by the manager.
*/
+ virtual void get_devices (std::vector <AudioInputDevice> & devices) = 0;
- virtual void get_devices (std::vector <AudioInputDevice> & _devices) = 0;
-
+ /** Set the current device.
+ * Must be called before opening the device.
+ * In case a different device of the same manager was opened before, it must be
+ * closed before setting the new device.
+ * @param device the device to be used.
+ */
virtual bool set_device (const AudioInputDevice & device) = 0;
+ /** Open the device.
+ * The device must be opened before calling get_frame_data(), set_buffer_size() and set_volume().
+ * Requires the set_device() to be called before.
+ * Returns false if the device cannot be opened. Also sends a GUI callback to the main thread in that case.
+ * @param channels number of channels (1=mono, 2=stereo).
+ * @param samplerate the samplerate.
+ * @param bits_per_sample the number bits per sample.
+ * @return true if the opening succeeded. False if the device cannot be opened.
+ */
virtual bool open (unsigned channels, unsigned samplerate, unsigned bits_per_sample) = 0;
+ /** Close the device.
+ */
virtual void close() {};
+ /** Set the buffer size.
+ * The buffer size must be set before calling get_frame_data().
+ * Requires the device to be opened.
+ * @param buffer_size the size of each buffer in bytes.
+ * @param num_buffers the number of buffers.
+ */
virtual void set_buffer_size (unsigned /*buffer_size*/, unsigned /*num_buffers*/) {};
+ /** Get one audio buffer.
+ * This function will block until the buffer is completely filled.
+ * Requires the device to be opened and the buffer size to be set.
+ * Returns false if reading the device fails. Also sends a GUI callback to the main thread in that case.
+ * @param data a pointer to the buffer that is to be filled. The memory has to be allocated already.
+ * @param size the size of the buffer to be filled.
+ * @param bytes_read returns the number of bytes actually read into the buffer. Should be equal to size.
+ * @return false if the reading failed.
+ */
virtual bool get_frame_data (char *data,
unsigned size,
unsigned & bytes_read) = 0;
- virtual void set_volume (unsigned /* volume */ ) {};
+ /** Set the volume level for the current device.
+ * Requires the device to be opened.
+ * @param volume the new volume (0..255).
+ */
+ virtual void set_volume (unsigned /*volume*/) {};
- virtual bool has_device (const std::string & source, const std::string & device_name, AudioInputDevice & device) = 0;
+ /** Returns true if a specific device is supported by the manager.
+ * If the device specified by source and device_name is supported by the manager, true
+ * is returned and an AudioOutputDevice structure filled with the respective details.
+ * This function is used by the core to map added or removed devices to managers and AudioOutputDevices.
+ * @param source the source type of the device (e.g. alsa, oss, etc.).
+ * @param device_name the name of the device.
+ * @param device in case the device is supported by the manager, this structure will be filled with the device details.
+ * @return true if the device is supported by the manager.
+ */
+ virtual bool has_device (const std::string & source, const std::string & device_name, AudioInputDevice & device) = 0;
- sigc::signal<void, AudioInputDevice, AudioInputErrorCodes> device_error;
+
+ /*** API to act on AudioInputDevice events ***/
+
+ /** This signal is emitted when an audio input device is opened.
+ * @param device the audio input device that was opened.
+ * @param config the current audio input device configuration (current volume, etc.).
+ */
sigc::signal<void, AudioInputDevice, AudioInputConfig> device_opened;
+
+ /** This signal is emitted when an audio input device is closed.
+ * @param device the audio input device that was closed.
+ */
sigc::signal<void, AudioInputDevice> device_closed;
+ /** This signal is emitted when an error occurs when opening a audio input device.
+ * @param device the audio input device that caused the error.
+ * @param error_code the audio input device error code.
+ */
+ sigc::signal<void, AudioInputDevice, AudioInputErrorCodes> device_error;
+
+
protected:
typedef struct ManagerState {
bool opened;
Modified: trunk/lib/engine/audiooutput/null/audiooutput-manager-null.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/null/audiooutput-manager-null.cpp (original)
+++ trunk/lib/engine/audiooutput/null/audiooutput-manager-null.cpp Wed May 14 17:55:27 2008
@@ -99,16 +99,16 @@
bool GMAudioOutputManager_null::set_frame_data (Ekiga::AudioOutputPrimarySecondary primarySecondary,
- char */*data*/,
+ const char */*data*/,
unsigned size,
- unsigned & written)
+ unsigned & bytes_written)
{
if (!current_state[primarySecondary].opened) {
PTRACE(1, "GMAudioOutputManager_null\tTrying to get frame from closed device[" << primarySecondary << "]");
return true;
}
- written = size;
+ bytes_written = size;
adaptive_delay[primarySecondary].Delay(size * 8 / current_state[primarySecondary].bits_per_sample * 1000 / current_state[primarySecondary].samplerate);
return true;
Modified: trunk/lib/engine/audiooutput/null/audiooutput-manager-null.h
==============================================================================
--- trunk/lib/engine/audiooutput/null/audiooutput-manager-null.h (original)
+++ trunk/lib/engine/audiooutput/null/audiooutput-manager-null.h Wed May 14 17:55:27 2008
@@ -80,9 +80,9 @@
virtual void close(Ekiga::AudioOutputPrimarySecondary primarySecondary);
virtual bool set_frame_data (Ekiga::AudioOutputPrimarySecondary primarySecondary,
- char *data,
+ const char *data,
unsigned size,
- unsigned & written);
+ unsigned & bytes_written);
virtual bool has_device (const std::string & sink, const std::string & device_name, Ekiga::AudioOutputDevice & device);
protected:
Modified: trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.cpp (original)
+++ trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.cpp Wed May 14 17:55:27 2008
@@ -153,12 +153,12 @@
bool GMAudioOutputManager_ptlib::set_frame_data (Ekiga::AudioOutputPrimarySecondary primarySecondary,
- char *data,
+ const char *data,
unsigned size,
- unsigned & written)
+ unsigned & bytes_written)
{
bool ret = false;
- written = 0;
+ bytes_written = 0;
if (!current_state[primarySecondary].opened) {
PTRACE(1, "GMAudioOutputManager_ptlib\tTrying to get frame from closed device[" << primarySecondary << "]");
@@ -168,7 +168,7 @@
if (output_device[primarySecondary]) {
ret = output_device[primarySecondary]->Write ((void*)data, size);
if (ret) {
- written = output_device[primarySecondary]->GetLastWriteCount();
+ bytes_written = output_device[primarySecondary]->GetLastWriteCount();
}
else {
PTRACE(1, "GMAudioOutputManager_ptlib\tEncountered error while trying to write data");
Modified: trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.h (original)
+++ trunk/lib/engine/audiooutput/ptlib/audiooutput-manager-ptlib.h Wed May 14 17:55:27 2008
@@ -81,9 +81,9 @@
virtual void set_buffer_size (Ekiga::AudioOutputPrimarySecondary primarySecondary, unsigned buffer_size, unsigned num_buffers);
virtual bool set_frame_data (Ekiga::AudioOutputPrimarySecondary primarySecondary,
- char *data,
+ const char *data,
unsigned size,
- unsigned & written);
+ unsigned & bytes_written);
virtual void set_volume (Ekiga::AudioOutputPrimarySecondary primarySecondary, unsigned volume );
Modified: trunk/lib/engine/audiooutput/skel/audiooutput-core.cpp
==============================================================================
--- trunk/lib/engine/audiooutput/skel/audiooutput-core.cpp (original)
+++ trunk/lib/engine/audiooutput/skel/audiooutput-core.cpp Wed May 14 17:55:27 2008
@@ -227,19 +227,19 @@
}
-void AudioOutputCore::set_frame_data (char *data,
+void AudioOutputCore::set_frame_data (const char *data,
unsigned size,
- unsigned & written)
+ unsigned & bytes_written)
{
PWaitAndSignal m_pri(var_mutex[primary]);
if (current_manager[primary]) {
- if (!current_manager[primary]->set_frame_data(primary,data, size, written)) {
+ if (!current_manager[primary]->set_frame_data(primary, data, size, bytes_written)) {
internal_close(primary);
internal_set_primary_fallback();
internal_open(primary, current_primary_config.channels, current_primary_config.samplerate, current_primary_config.bits_per_sample);
if (current_manager[primary])
- current_manager[primary]->set_frame_data(primary,data, size, written); // the default device must always return true
+ current_manager[primary]->set_frame_data(primary, data, size, bytes_written); // the default device must always return true
}
PWaitAndSignal m_vol(vol_mutex);
@@ -250,10 +250,10 @@
}
if (calculate_average)
- calculate_average_level((const short*) data, written);
+ calculate_average_level((const short*) data, bytes_written);
}
-void AudioOutputCore::play_buffer(AudioOutputPrimarySecondary primarySecondary, char* buffer, unsigned long len, unsigned channels, unsigned sample_rate, unsigned bps)
+void AudioOutputCore::play_buffer(AudioOutputPrimarySecondary primarySecondary, const char* buffer, unsigned long len, unsigned channels, unsigned sample_rate, unsigned bps)
{
switch (primarySecondary) {
case primary:
@@ -395,10 +395,10 @@
current_manager[primarySecondary]->close(primarySecondary);
}
-void AudioOutputCore::internal_play(AudioOutputPrimarySecondary primarySecondary, char* buffer, unsigned long len, unsigned channels, unsigned sample_rate, unsigned bps)
+void AudioOutputCore::internal_play(AudioOutputPrimarySecondary primarySecondary, const char* buffer, unsigned long len, unsigned channels, unsigned sample_rate, unsigned bps)
{
unsigned long pos = 0;
- unsigned written = 0;
+ unsigned bytes_written = 0;
if (!internal_open ( primarySecondary, channels, sample_rate, bps))
return;
@@ -406,7 +406,7 @@
if (current_manager[primarySecondary]) {
current_manager[primarySecondary]->set_buffer_size (primarySecondary, 320, 4);
do {
- if (!current_manager[primarySecondary]->set_frame_data(primarySecondary, buffer+pos, std::min((unsigned)320, (unsigned) (len - pos)), written))
+ if (!current_manager[primarySecondary]->set_frame_data(primarySecondary, buffer+pos, std::min((unsigned)320, (unsigned) (len - pos)), bytes_written))
break;
pos += 320;
} while (pos < len);
Modified: trunk/lib/engine/audiooutput/skel/audiooutput-core.h
==============================================================================
--- trunk/lib/engine/audiooutput/skel/audiooutput-core.h (original)
+++ trunk/lib/engine/audiooutput/skel/audiooutput-core.h Wed May 14 17:55:27 2008
@@ -147,11 +147,11 @@
void set_buffer_size (unsigned buffer_size, unsigned num_buffers);
- void set_frame_data (char *data, unsigned size, unsigned & written);
+ void set_frame_data (const char *data, unsigned size, unsigned & bytes_written);
void set_volume (AudioOutputPrimarySecondary primarySecondary, unsigned volume);
- void play_buffer(AudioOutputPrimarySecondary primarySecondary, char* buffer, unsigned long len, unsigned channels, unsigned sample_rate, unsigned bps);
+ void play_buffer(AudioOutputPrimarySecondary primarySecondary, const char* buffer, unsigned long len, unsigned channels, unsigned sample_rate, unsigned bps);
void start_average_collection () { calculate_average = true; }
@@ -184,7 +184,7 @@
void internal_set_device (AudioOutputPrimarySecondary primarySecondary, const AudioOutputDevice & audiooutput_device);
bool internal_open (AudioOutputPrimarySecondary primarySecondary, unsigned channels, unsigned samplerate, unsigned bits_per_sample);
void internal_close(AudioOutputPrimarySecondary primarySecondary);
- void internal_play(AudioOutputPrimarySecondary primarySecondary, char* buffer, unsigned long len, unsigned channels, unsigned sample_rate, unsigned bps);
+ void internal_play(AudioOutputPrimarySecondary primarySecondary, const char* buffer, unsigned long len, unsigned channels, unsigned sample_rate, unsigned bps);
void internal_set_primary_fallback();
void calculate_average_level (const short *buffer, unsigned size);
Modified: trunk/lib/engine/audiooutput/skel/audiooutput-manager.h
==============================================================================
--- trunk/lib/engine/audiooutput/skel/audiooutput-manager.h (original)
+++ trunk/lib/engine/audiooutput/skel/audiooutput-manager.h Wed May 14 17:55:27 2008
@@ -44,55 +44,125 @@
{
/**
- * @addtogroup vidinput
+ * @addtogroup audiooutput
* @{
*/
+
+ /** Generic implementation for the Ekiga::AudioOutputManager class.
+ *
+ * Each AudioOutputManager will represent a specific backend able to play back audio.
+ * Each AudioOutputManager will manage one or more devices.
+ * The AudioOutputCore will control the different managers and their devices.
+ */
class AudioOutputManager
{
public:
- /* The constructor
+ /** The constructor
*/
AudioOutputManager () {}
- /* The destructor
+ /** The destructor
*/
~AudioOutputManager () {}
- /*
- * AUDIOINPUT MANAGEMENT
- */
-
- /** Create a call based on the remote uri given as parameter
- * @param uri an uri
- * @return true if a Ekiga::Call could be created
- */
+ /*** API for audio output ***/
+ /** Get a list of all devices supported by the manager.
+ * Add it to the list of devices already collected by the core.
+ * @param devices a vector of device names to be filled by the manager.
+ */
virtual void get_devices (std::vector <AudioOutputDevice> & devices) = 0;
+ /** Set the current device.
+ * Must be called before opening the device.
+ * In case a different device of the same manager was opened before, it must be
+ * closed before setting the new device.
+ * @param prim whether to set the primary or secondary device.
+ * @param device the device to be used.
+ */
virtual bool set_device (AudioOutputPrimarySecondary primarySecondary, const AudioOutputDevice & device) = 0;
+ /** Open the device.
+ * The device must be opened before calling set_frame_data(), set_buffer_size() and set_volume().
+ * Requires the set_device() to be called before.
+ * Returns false if the device cannot be opened. Also sends a GUI callback to the main thread in that case.
+ * @param prim whether the device shall be opened as primary or secondary device.
+ * @param channels number of channels (1=mono, 2=stereo).
+ * @param samplerate the samplerate.
+ * @param bits_per_sample the number bits per sample.
+ * @return true if the opening succeeded. False if the device cannot be opened.
+ */
virtual bool open (AudioOutputPrimarySecondary primarySecondary, unsigned channels, unsigned samplerate, unsigned bits_per_sample) = 0;
+ /** Close the device.
+ */
+ virtual void close (AudioOutputPrimarySecondary /*primarySecondary*/) {};
+
+ /** Set the buffer size.
+ * The buffer size must be set before calling set_frame_data().
+ * Requires the device to be opened.
+ * @param prim whether buffers of the primary or secodnary device shall be set.
+ * @param buffer_size the size of each buffer in bytes.
+ * @param num_buffers the number of buffers.
+ */
virtual void set_buffer_size (AudioOutputPrimarySecondary /*primarySecondary*/, unsigned /*buffer_size*/, unsigned /*num_buffers*/) {};
+ /** Set one audio buffer.
+ * Requires the device to be opened and the buffer size to be set.
+ * Returns false if writing the device fails. Also sends a GUI callback to the main thread in that case.
+ * @param data a pointer to the buffer with the data to be written. It will not be freed.
+ * @param size the size of the buffer to be written.
+ * @param bytes_written returns the number of bytes actually written. Should be equal to size.
+ * @return false if the writing failed.
+ */
virtual bool set_frame_data (AudioOutputPrimarySecondary primarySecondary,
- char *data,
+ const char *data,
unsigned size,
- unsigned & written) = 0;
-
- virtual void close (AudioOutputPrimarySecondary /*primarySecondary*/) {};
+ unsigned & bytes_written) = 0;
+ /** Set the volume level for the current device.
+ * Requires the device to be opened.
+ * @param prim wether the volume of the primary or secondary device shall be set.
+ * @param volume the new volume (0..255).
+ */
virtual void set_volume (AudioOutputPrimarySecondary /*primarySecondary*/, unsigned /* volume */ ) {};
+ /** Returns true if a specific device is supported by the manager.
+ * If the device specified by sink and device_name is supported by the manager, true
+ * is returned and an AudioOutputDevice structure filled with the respective details.
+ * @param sink the sink type of the device (e.g. alsa, oss, etc.).
+ * @param device_name the name of the device.
+ * @param device in case the device is supported by the manager, this structure will be filled with the device details.
+ * @return true if the device is supported by the manager.
+ */
virtual bool has_device (const std::string & sink, const std::string & device_name, AudioOutputDevice & device) = 0;
- sigc::signal<void, AudioOutputPrimarySecondary, AudioOutputDevice, AudioOutputErrorCodes> device_error;
+
+ /*** API to act on AudioOutputDevice events ***/
+
+ /** This signal is emitted when an audio output device is opened.
+ * @param prim whether the primary or secondary audio output device was opened.
+ * @param device the audio output device that was opened.
+ * @param config the current audio output device configuration (current volume, etc.).
+ */
sigc::signal<void, AudioOutputPrimarySecondary, AudioOutputDevice, AudioOutputConfig> device_opened;
+
+ /** This signal is emitted when an audio output device is closed.
+ * @param prim whether the primary or secondary audio output device was closed.
+ * @param device the audio output device that was closed.
+ */
sigc::signal<void, AudioOutputPrimarySecondary, AudioOutputDevice> device_closed;
+ /** This signal is emitted when an error occurs when opening an audio output device.
+ * @param prim whether the primary or secondary audio output device caused the error.
+ * @param device the audio output device that caused the error.
+ * @param error_code the audio output device error code.
+ */
+ sigc::signal<void, AudioOutputPrimarySecondary, AudioOutputDevice, AudioOutputErrorCodes> device_error;
+
protected:
typedef struct ManagerState {
bool opened;
Modified: trunk/lib/engine/display/common/display-manager-common.cpp
==============================================================================
--- trunk/lib/engine/display/common/display-manager-common.cpp (original)
+++ trunk/lib/engine/display/common/display-manager-common.cpp Wed May 14 17:55:27 2008
@@ -56,14 +56,14 @@
{
}
-void GMVideoOutputManager::start ()
+void GMVideoOutputManager::open ()
{
init_thread = true;
run_thread.Signal();
thread_initialised.Wait();
}
-void GMVideoOutputManager::stop ()
+void GMVideoOutputManager::close ()
{
uninit_thread = true;
@@ -120,12 +120,11 @@
var_mutex.Signal ();
}
-void GMVideoOutputManager::set_frame_data (unsigned width,
- unsigned height,
- const char* data,
- bool local,
- int devices_nbr
-)
+void GMVideoOutputManager::set_frame_data (const char* data,
+ unsigned width,
+ unsigned height,
+ bool local,
+ int devices_nbr)
{
DisplayInfo local_display_info;
Modified: trunk/lib/engine/display/common/display-manager-common.h
==============================================================================
--- trunk/lib/engine/display/common/display-manager-common.h (original)
+++ trunk/lib/engine/display/common/display-manager-common.h Wed May 14 17:55:27 2008
@@ -93,9 +93,9 @@
*/
virtual ~GMVideoOutputManager (void);
- virtual void start ();
+ virtual void open ();
- virtual void stop ();
+ virtual void close ();
/* DESCRIPTION : /
* BEHAVIOR : Copy the frame data to a local structur and signal
@@ -105,9 +105,9 @@
* a boolean whether frame is a local or remote one
* and the number of opened devices .
*/
- virtual void set_frame_data (unsigned width,
+ virtual void set_frame_data (const char* data,
+ unsigned width,
unsigned height,
- const char* data,
bool local,
int devices_nbr);
Modified: trunk/lib/engine/display/skel/display-core.cpp
==============================================================================
--- trunk/lib/engine/display/skel/display-core.cpp (original)
+++ trunk/lib/engine/display/skel/display-core.cpp Wed May 14 17:55:27 2008
@@ -117,7 +117,7 @@
for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
iter != managers.end ();
iter++) {
- (*iter)->start ();
+ (*iter)->open ();
}
}
@@ -138,7 +138,7 @@
for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
iter != managers.end ();
iter++) {
- (*iter)->stop ();
+ (*iter)->close ();
}
display_stats.rx_width = display_stats.rx_height = display_stats.rx_fps = 0;
display_stats.tx_width = display_stats.tx_height = display_stats.tx_fps = 0;
@@ -146,9 +146,9 @@
display_stats.tx_frames = 0;
}
-void DisplayCore::set_frame_data (unsigned width,
+void DisplayCore::set_frame_data (const char *data,
+ unsigned width,
unsigned height,
- const char *data,
bool local,
int devices_nbr)
{
@@ -184,7 +184,7 @@
for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
iter != managers.end ();
iter++) {
- (*iter)->set_frame_data (width, height, data, local, devices_nbr);
+ (*iter)->set_frame_data (data,width, height, local, devices_nbr);
}
}
Modified: trunk/lib/engine/display/skel/display-core.h
==============================================================================
--- trunk/lib/engine/display/skel/display-core.h (original)
+++ trunk/lib/engine/display/skel/display-core.h Wed May 14 17:55:27 2008
@@ -118,9 +118,9 @@
void stop ();
- void set_frame_data (unsigned width,
+ void set_frame_data (const char *data,
+ unsigned width,
unsigned height,
- const char *data,
bool local,
int devices_nbr);
Modified: trunk/lib/engine/display/skel/display-manager.h
==============================================================================
--- trunk/lib/engine/display/skel/display-manager.h (original)
+++ trunk/lib/engine/display/skel/display-manager.h Wed May 14 17:55:27 2008
@@ -44,46 +44,69 @@
{
/**
- * @addtogroup display
+ * @addtogroup videooutput
* @{
*/
+ /** Generic implementation for the Ekiga::VideoOutputManager class.
+ *
+ * Each VideoOutputManager represents a sink for video frames.
+ * A VideoOutputManager can display the video signal, record single frames or record video signal.
+ * The VideoOutputCore will control the different managers and pass the frames to all of them.
+ */
class VideoOutputManager
{
public:
- /* The constructor
+ /** The constructor
*/
VideoOutputManager () {}
- /* The destructor
+ /** The destructor
*/
~VideoOutputManager () {}
- /*
- * DISPLAY MANAGEMENT
- */
+ /*** API for video output ***/
- /** Create a call based on the remote uri given as parameter
- * @param uri an uri
- * @return true if a Ekiga::Call could be created
+ /** Open the device.
+ * The device must be opened before calling set_frame_data().
*/
- virtual void start () { };
+ virtual void open () { };
- virtual void stop () { };
+ /** Close the device.
+ */
+ virtual void close () { };
- virtual void set_frame_data (unsigned width,
+ /** Set one video frame buffer.
+ * Requires the device to be opened.
+ * @param data a pointer to the buffer with the data to be written. It will not be freed.
+ * @param width the width in pixels of the frame to be written.
+ * @param height the height in pixels of the frame to be written.
+ * @param local true if the frame is a frame of the local video source, false if it is from the remote end.
+ * @param devices_nbr 1 if only local or remote device has been opened, 2 if both have been opened. //FIXME
+ */
+ virtual void set_frame_data (const char *data,
+ unsigned width,
unsigned height,
- const char *data,
bool local,
int devices_nbr) = 0;
virtual void set_display_info (const DisplayInfo &) { };
+
+ /*** API to act on VideoOutputDevice events ***/
+
+ /** This signal is emitted when a video output device is opened.
+ * @param hw_accel_status actual hardware acceleration support active on the video output device opened).
+ */
sigc::signal<void, HwAccelStatus> device_opened;
+
+ /** This signal is emitted when a video output device is closed.
+ */
sigc::signal<void> device_closed;
+
sigc::signal<void, DisplayMode> display_mode_changed;
sigc::signal<void, FSToggle> fullscreen_mode_changed;
sigc::signal<void, unsigned, unsigned> display_size_changed;
Modified: trunk/lib/engine/hal/skel/hal-manager.h
==============================================================================
--- trunk/lib/engine/hal/skel/hal-manager.h (original)
+++ trunk/lib/engine/hal/skel/hal-manager.h Wed May 14 17:55:27 2008
@@ -48,6 +48,12 @@
* @{
*/
+ /** Generic implementation for the Ekiga::HalManager class.
+ *
+ * Each HalManager will represent a specific backend able to detect devices being removed or added
+ * and network devices going up and down (typically one per platform)
+ * On each event, the HalManager sends a signal to the main thread.
+ */
class HalManager
{
@@ -64,53 +70,53 @@
/*** API to act on HAL events ***/
- /** This signal is emitted when a video input device is added to the system
- * @param: source : the video input framework (e.g. video4linux, etc.)
- * device : the device name
- * capabilities : source-dependent device capabilites (e.g. V4L1 or V4L2 for video4linux)
+ /** This signal is emitted when a video input device is added to the system.
+ * @param source the video input framework (e.g. video4linux, etc.).
+ * @param device the device name.
+ * @param capabilities source-dependent device capabilites (e.g. V4L1 or V4L2 for video4linux).
*/
sigc::signal<void, std::string, std::string, unsigned> video_input_device_added;
- /** This signal is emitted when a video input device is removed from the system
- * @param: source : the video input framework (e.g. video4linux, etc.)
- * device : the device name
- * capabilities : source-dependent device capabilites (e.g. V4L1 or V4L2 for video4linux)
+ /** This signal is emitted when a video input device is removed from the system.
+ * @param source the video input framework (e.g. video4linux, etc.).
+ * @param device the device name.
+ * @param capabilities source-dependent device capabilites (e.g. V4L1 or V4L2 for video4linux).
*/
sigc::signal<void, std::string, std::string, unsigned> video_input_device_removed;
- /** This signal is emitted when an audio input device is added to the system
- * @param: source : the audio input framework (e.g. alsa, oss, etc.)
- * device : the device name
+ /** This signal is emitted when an audio input device is added to the system.
+ * @param source the audio input framework (e.g. alsa, oss, etc.).
+ * @param device the device name.
*/
sigc::signal<void, std::string, std::string> audio_input_device_added;
- /** This signal is emitted when an audio input device is removed from the system
- * @param: source : the audio input framework (e.g. alsa, oss, etc.)
- * device : the device name
+ /** This signal is emitted when an audio input device is removed from the system.
+ * @param source the audio input framework (e.g. alsa, oss, etc.).
+ * @param device the device name.
*/
sigc::signal<void, std::string, std::string> audio_input_device_removed;
- /** This signal is emitted when an audio output device is added to the system
- * @param: source : the audio output framework (e.g. alsa, oss, etc.)
- * device : the device name
+ /** This signal is emitted when an audio output device is added to the system.
+ * @param source the audio output framework (e.g. alsa, oss, etc.).
+ * @param device the device name.
*/
sigc::signal<void, std::string, std::string> audio_output_device_added;
- /** This signal is emitted when an audio output device is removed from the system
- * @param: source : the audio output framework (e.g. alsa, oss, etc.)
- * device : the device name
+ /** This signal is emitted when an audio output device is removed from the system.
+ * @param source the audio output framework (e.g. alsa, oss, etc.).
+ * @param device the device name.
*/
sigc::signal<void, std::string, std::string> audio_output_device_removed;
- /** This signal is emitted when a network device comes up
- * @param: interface_name : The interface name (e.g. eth0, etc.)
- * ip4_address : The IPv4 address (e.g. "192.168.0.1")
+ /** This signal is emitted when a network device comes up.
+ * @param interface_name the interface name (e.g. eth0, etc.).
+ * @param ip4_address the IPv4 address (e.g. "192.168.0.1").
*/
sigc::signal<void, std::string, std::string> network_interface_up;
- /** This signal is emitted when a network device goes down
- * @param: interface_name : The interface name (e.g. eth0, etc.)
- * ip4_address : The IPv4 address (e.g. "192.168.0.1")
+ /** This signal is emitted when a network device goes down.
+ * @param interface_name the interface name (e.g. eth0, etc.).
+ * @param ip4_address the IPv4 address (e.g. "192.168.0.1").
*/
sigc::signal<void, std::string, std::string> network_interface_down;
};
Modified: trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp
==============================================================================
--- trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp (original)
+++ trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp Wed May 14 17:55:27 2008
@@ -110,9 +110,9 @@
runtime.run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
}
-bool GMVideoInputManager_mlogo::get_frame_data (unsigned & width,
- unsigned & height,
- char *data)
+bool GMVideoInputManager_mlogo::get_frame_data (char *data,
+ unsigned & width,
+ unsigned & height)
{
if (!current_state.opened) {
PTRACE(1, "GMVideoInputManager_mlogo\tTrying to get frame from closed device");
Modified: trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h
==============================================================================
--- trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h (original)
+++ trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h Wed May 14 17:55:27 2008
@@ -79,9 +79,9 @@
virtual void close();
- virtual bool get_frame_data (unsigned & width,
- unsigned & height,
- char *data);
+ virtual bool get_frame_data (char *data,
+ unsigned & width,
+ unsigned & height);
virtual bool has_device (const std::string & source, const std::string & device_name, unsigned capabilities, Ekiga::VidInputDevice & device);
Modified: trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp (original)
+++ trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp Wed May 14 17:55:27 2008
@@ -157,9 +157,9 @@
runtime.run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
}
-bool GMVideoInputManager_ptlib::get_frame_data (unsigned & width,
- unsigned & height,
- char *data)
+bool GMVideoInputManager_ptlib::get_frame_data (char *data,
+ unsigned & width,
+ unsigned & height)
{
bool ret = false;
if (!current_state.opened) {
Modified: trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h (original)
+++ trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h Wed May 14 17:55:27 2008
@@ -77,9 +77,9 @@
virtual void close();
- virtual bool get_frame_data (unsigned & width,
- unsigned & height,
- char *data);
+ virtual bool get_frame_data (char *data,
+ unsigned & width,
+ unsigned & height);
virtual void set_colour (unsigned colour );
virtual void set_brightness (unsigned brightness );
Modified: trunk/lib/engine/vidinput/skel/vidinput-core.cpp
==============================================================================
--- trunk/lib/engine/vidinput/skel/vidinput-core.cpp (original)
+++ trunk/lib/engine/vidinput/skel/vidinput-core.cpp Wed May 14 17:55:27 2008
@@ -100,8 +100,8 @@
unsigned height = 144;;
while (!stop_thread) {
- vidinput_core.get_frame_data(width, height, frame);
- display_core.set_frame_data(width, height, frame, true, 1);
+ vidinput_core.get_frame_data(frame, width, height);
+ display_core.set_frame_data(frame, width, height, true, 1);
// We have to sleep some time outside the mutex lock
// to give other threads time to get the mutex
@@ -335,14 +335,14 @@
stream_config.active = false;
}
-void VidInputCore::get_frame_data (unsigned & width,
- unsigned & height,
- char *data)
+void VidInputCore::get_frame_data (char *data,
+ unsigned & width,
+ unsigned & height)
{
PWaitAndSignal m(var_mutex);
if (current_manager) {
- if (!current_manager->get_frame_data(width, height, data)) {
+ if (!current_manager->get_frame_data(data, width, height)) {
internal_close();
@@ -355,7 +355,7 @@
internal_open(stream_config.width, stream_config.height, stream_config.fps);
if (current_manager)
- current_manager->get_frame_data(width, height, data); // the default device must always return true
+ current_manager->get_frame_data(data, width, height); // the default device must always return true
}
apply_settings();
}
Modified: trunk/lib/engine/vidinput/skel/vidinput-core.h
==============================================================================
--- trunk/lib/engine/vidinput/skel/vidinput-core.h (original)
+++ trunk/lib/engine/vidinput/skel/vidinput-core.h Wed May 14 17:55:27 2008
@@ -166,9 +166,9 @@
void stop_stream ();
- void get_frame_data (unsigned & width,
- unsigned & height,
- char *data);
+ void get_frame_data (char *data,
+ unsigned & width,
+ unsigned & height);
void set_colour (unsigned colour);
Modified: trunk/lib/engine/vidinput/skel/vidinput-manager.h
==============================================================================
--- trunk/lib/engine/vidinput/skel/vidinput-manager.h (original)
+++ trunk/lib/engine/vidinput/skel/vidinput-manager.h Wed May 14 17:55:27 2008
@@ -48,56 +48,130 @@
* @{
*/
-
-
+ /** Generic implementation for the Ekiga::VideoInputManager class.
+ *
+ * Each VideoInputManager will represent a specific backend able to record video.
+ * Each VideoInputManager will manage one or more devices.
+ * The VideoInputCore will control the different managers and their devices.
+ */
class VideoInputManager
{
public:
- /* The constructor
+ /** The constructor
*/
VideoInputManager () {}
- /* The destructor
+ /** The destructor
*/
~VideoInputManager () {}
- /*
- * VIDINOUT MANAGEMENT
- */
-
- /** Create a call based on the remote uri given as parameter
- * @param uri an uri
- * @return true if a Ekiga::Call could be created
- */
+ /*** API for video input ***/
+ /** Get a list of all devices supported by the manager.
+ * Add it to the list of devices already collected by the core.
+ * @param devices a vector of device names to be filled by the manager.
+ */
virtual void get_devices (std::vector <VidInputDevice> & devices) = 0;
- virtual bool set_device (const VidInputDevice & device, int channel, VideoFormat format) = 0;
+ /** Set the current device.
+ * Must be called before opening the device.
+ * In case a different device of the same manager was opened before, it must be
+ * closed before setting the new device.
+ * @param device the device to be used.
+ * @param channel the channel for which the device shall be opened later.
+ * @param format the video formar to be used (PAL, NTSC, ...).
- virtual void set_image_data (unsigned /* width */, unsigned /* height */, const char* /*data*/ ) {};
+ */
+ virtual bool set_device (const VidInputDevice & device, int channel, VideoFormat format) = 0;
+ /** Open the device.
+ * The device must be opened before calling get_frame_data and set_* functions.
+ * Requires the set_device() to be called before.
+ * Returns false if the device cannot be opened. Also sends a GUI callback to the main thread in that case.
+ * @param width the frame width in pixels for which frames shall be supplied.
+ * @param height the frame width in pixels for which frames shall be supplied.
+ * @param fps the frame rate in frames per second in which frames shall be supplied.
+ * @return true if the opening succeeded. False if the device cannot be opened.
+ */
virtual bool open (unsigned width, unsigned height, unsigned fps) = 0;
+ /** Close the device.
+ */
virtual void close() {};
- virtual bool get_frame_data (unsigned & width,
- unsigned & height,
- char *data) = 0;
+ /** Get one video frame buffer.
+ * This function will block until the buffer is completely filled.
+ * Requires the device to be opened.
+ * Returns false if reading the device fails. Also sends a GUI callback to the main thread in that case.
+ * @param data a pointer to the frame buffer that is to be filled. The memory has to be allocated already.
+ * @param width returns the actual width of the frame read.
+ * @param height returns the actual height of the frame read.
+ * @return false if the reading failed.
+ */
+ virtual bool get_frame_data (char * data,
+ unsigned & width,
+ unsigned & height) = 0;
- virtual void set_colour (unsigned /* colour */ ) {};
+ virtual void set_image_data (unsigned /* width */, unsigned /* height */, const char* /*data*/ ) {};
+
+ /** Set the colour for the current input device.
+ * Requires the device to be opened.
+ * @param colour the new colour (0..255).
+ */
+ virtual void set_colour (unsigned /* colour */ ) {};
+
+ /** Set the brightness for the current input device.
+ * Requires the device to be opened.
+ * @param brightness the new brightness (0..255).
+ */
virtual void set_brightness (unsigned /* brightness */ ) {};
- virtual void set_whiteness (unsigned /* whiteness */ ) {};
- virtual void set_contrast (unsigned /* contrast */ ) {};
+
+ /** Set the whiteness for the current input device.
+ * Requires the device to be opened.
+ * @param whiteness the new whiteness (0..255).
+ */
+ virtual void set_whiteness (unsigned /* whiteness */ ) {};
+
+ /** Set the contrast for the current input device.
+ * Requires the device to be opened.
+ * @param contrast the new contrast (0..255).
+ */
+ virtual void set_contrast (unsigned /* contrast */ ) {};
+ /** Returns true if a specific device is supported by the manager.
+ * If the device specified by source and device_name is supported by the manager, true
+ * is returned and an VideoInputDevice structure filled with the respective details.
+ * This function is used by the core to map added or removed devices to managers and VideoInputDevices.
+ * @param source the source type of the device (e.g. alsa, oss, etc.).
+ * @param device_name the name of the device.
+ * @param device in case the device is supported by the manager, this structure will be filled with the device details.
+ * @return true if the device is supported by the manager.
+ */
virtual bool has_device (const std::string & source, const std::string & device_name, unsigned capabilities, VidInputDevice & device) = 0;
-
- sigc::signal<void, VidInputDevice, VideoInputErrorCodes> device_error;
+
+
+ /*** API to act on VidInputDevice events ***/
+
+ /** This signal is emitted when a video input device is opened.
+ * @param device the video input device that was opened.
+ * @param config the current video input device configuration (current brightness, colour, etc.).
+ */
sigc::signal<void, VidInputDevice, VidInputConfig> device_opened;
+
+ /** This signal is emitted when a video input device is closed.
+ * @param device the video input device that was closed.
+ */
sigc::signal<void, VidInputDevice> device_closed;
+ /** This signal is emitted when an error occurs when opening a video input device.
+ * @param device the video input device that caused the error.
+ * @param error_code the video input device error code.
+ */
+ sigc::signal<void, VidInputDevice, VideoInputErrorCodes> device_error;
+
protected:
typedef struct ManagerState {
bool opened;
Modified: trunk/src/devices/videoinput.cpp
==============================================================================
--- trunk/src/devices/videoinput.cpp (original)
+++ trunk/src/devices/videoinput.cpp Wed May 14 17:55:27 2008
@@ -156,12 +156,12 @@
bool
-PVideoInputDevice_EKIGA::GetFrameData (BYTE *a,
+PVideoInputDevice_EKIGA::GetFrameData (BYTE *frame,
PINDEX *i)
{
unsigned width;
unsigned height;
- vidinput_core.get_frame_data(width, height, (char*)a);
+ vidinput_core.get_frame_data((char*)frame, width, height);
*i = width * height * 3 / 2;
@@ -174,7 +174,7 @@
{
unsigned width;
unsigned height;
- vidinput_core.get_frame_data(width, height, (char*)frame);
+ vidinput_core.get_frame_data((char*)frame, width, height);
*i = width * height * 3 / 2;
return true;
Modified: trunk/src/devices/videoinput.h
==============================================================================
--- trunk/src/devices/videoinput.h (original)
+++ trunk/src/devices/videoinput.h Wed May 14 17:55:27 2008
@@ -100,7 +100,7 @@
* BEHAVIOR : /
* PRE : /
*/
- virtual bool GetFrameData (BYTE *a, PINDEX *i = NULL);
+ virtual bool GetFrameData (BYTE *frame, PINDEX *i = NULL);
/* DESCRIPTION : The destructor
Modified: trunk/src/devices/videooutput.cpp
==============================================================================
--- trunk/src/devices/videooutput.cpp (original)
+++ trunk/src/devices/videooutput.cpp Wed May 14 17:55:27 2008
@@ -155,7 +155,7 @@
is_active = TRUE;
devices_nbr = PMIN (2, devices_nbr+1);
}
- display_core.set_frame_data(width, height, (char*) data, (device_id == LOCAL), devices_nbr);
+ display_core.set_frame_data((const char*) data, width, height, (device_id == LOCAL), devices_nbr);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]