[ekiga] Made the opal audio code fetch engine services at startup
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Made the opal audio code fetch engine services at startup
- Date: Wed, 23 Jan 2013 16:56:22 +0000 (UTC)
commit 28f2e47a2df950fb50270935292ce0a1b554d5ad
Author: Julien Puydt <jpuydt free fr>
Date: Wed Jan 23 16:30:40 2013 +0100
Made the opal audio code fetch engine services at startup
lib/engine/components/opal/opal-audio.cpp | 18 +++++++++---------
lib/engine/components/opal/opal-audio.h | 15 ++++++++-------
lib/engine/components/opal/opal-plugins-hook.cpp | 22 +++++++++++++++-------
3 files changed, 32 insertions(+), 23 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-audio.cpp b/lib/engine/components/opal/opal-audio.cpp
index ff7fee4..9042e6d 100644
--- a/lib/engine/components/opal/opal-audio.cpp
+++ b/lib/engine/components/opal/opal-audio.cpp
@@ -40,24 +40,24 @@
#include "opal-audio.h"
-PSoundChannel_EKIGA::PSoundChannel_EKIGA (Ekiga::ServiceCore & _core):
- core (_core),
- audioinput_core (core.get<Ekiga::AudioInputCore> ("audioinput-core")),
- audiooutput_core (core.get<Ekiga::AudioOutputCore> ("audiooutput-core"))
+PSoundChannel_EKIGA::PSoundChannel_EKIGA (boost::shared_ptr<Ekiga::AudioInputCore> _audioinput_core,
+ boost::shared_ptr<Ekiga::AudioOutputCore> _audiooutput_core):
+ audioinput_core (_audioinput_core),
+ audiooutput_core (_audiooutput_core)
{
opened = false;
}
PSoundChannel_EKIGA::PSoundChannel_EKIGA (const PString & /*_device*/,
- Directions dir,
+ Directions dir,
unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample,
- Ekiga::ServiceCore & _core):
- core (_core),
- audioinput_core (core.get<Ekiga::AudioInputCore> ("audioinput-core")),
- audiooutput_core (core.get<Ekiga::AudioOutputCore> ("audiooutput-core"))
+ boost::shared_ptr<Ekiga::AudioInputCore> _audioinput_core,
+ boost::shared_ptr<Ekiga::AudioOutputCore> _audiooutput_core):
+ audioinput_core (_audioinput_core),
+ audiooutput_core (_audiooutput_core)
{
opened = false;
Open (device, dir, numChannels, sampleRate, bitsPerSample);
diff --git a/lib/engine/components/opal/opal-audio.h b/lib/engine/components/opal/opal-audio.h
index 6dcd828..cefaa6d 100644
--- a/lib/engine/components/opal/opal-audio.h
+++ b/lib/engine/components/opal/opal-audio.h
@@ -48,13 +48,15 @@
class PSoundChannel_EKIGA : public PSoundChannel {
PCLASSINFO(PSoundChannel_EKIGA, PSoundChannel);
public:
- PSoundChannel_EKIGA(Ekiga::ServiceCore & core);
+ PSoundChannel_EKIGA(boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core,
+ boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core);
PSoundChannel_EKIGA(const PString &device,
- PSoundChannel::Directions dir,
- unsigned numChannels,
- unsigned sampleRate,
- unsigned bitsPerSample,
- Ekiga::ServiceCore & _core);
+ PSoundChannel::Directions dir,
+ unsigned numChannels,
+ unsigned sampleRate,
+ unsigned bitsPerSample,
+ boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core,
+ boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core);
~PSoundChannel_EKIGA();
static PString GetDefaultDevice(PSoundChannel::Directions);
bool Open(const PString & _device,
@@ -91,7 +93,6 @@ public:
PINDEX storedVolume;
- Ekiga::ServiceCore & core;
boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core;
boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core;
bool opened;
diff --git a/lib/engine/components/opal/opal-plugins-hook.cpp b/lib/engine/components/opal/opal-plugins-hook.cpp
index f58b442..4dbdd77 100644
--- a/lib/engine/components/opal/opal-plugins-hook.cpp
+++ b/lib/engine/components/opal/opal-plugins-hook.cpp
@@ -47,12 +47,21 @@ class PSoundChannel_EKIGA_PluginServiceDescriptor : public PDevicePluginServiceD
{
public:
- PSoundChannel_EKIGA_PluginServiceDescriptor (Ekiga::ServiceCore& core_): core(core_)
- { }
+ PSoundChannel_EKIGA_PluginServiceDescriptor (Ekiga::ServiceCore& core):
+ audioinput_core(core.get<Ekiga::AudioInputCore> ("audioinput-core")),
+ audiooutput_core(core.get<Ekiga::AudioOutputCore> ("audiooutput-core"))
+ {}
virtual PObject* CreateInstance (int) const
- { return new PSoundChannel_EKIGA (core); }
-
+ {
+ // FIXME: if that happens in a thread, that's bad...
+ boost::shared_ptr<Ekiga::AudioInputCore> input = audioinput_core.lock ();
+ boost::shared_ptr<Ekiga::AudioOutputCore> output = audiooutput_core.lock ();
+ if (input && output)
+ return new PSoundChannel_EKIGA (input, output);
+ else
+ return NULL;
+ }
virtual PStringArray GetDeviceNames(int) const
{ return PStringList ("EKIGA"); }
@@ -62,9 +71,8 @@ public:
{ return deviceName.Find ("EKIGA") == 0; }
private:
-
- Ekiga::ServiceCore& core;
-
+ boost::weak_ptr<Ekiga::AudioInputCore> audioinput_core;
+ boost::weak_ptr<Ekiga::AudioOutputCore> audiooutput_core;
};
class PVideoInputDevice_EKIGA_PluginServiceDescriptor : public PDevicePluginServiceDescriptor
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]