summaryrefslogtreecommitdiff
path: root/indra/media_plugins/webkit/linux_volume_catcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/media_plugins/webkit/linux_volume_catcher.cpp')
-rw-r--r--indra/media_plugins/webkit/linux_volume_catcher.cpp72
1 files changed, 37 insertions, 35 deletions
diff --git a/indra/media_plugins/webkit/linux_volume_catcher.cpp b/indra/media_plugins/webkit/linux_volume_catcher.cpp
index 6068c7610b..d61b00cf67 100644
--- a/indra/media_plugins/webkit/linux_volume_catcher.cpp
+++ b/indra/media_plugins/webkit/linux_volume_catcher.cpp
@@ -72,6 +72,7 @@ public:
// for internal use - can't be private because used from our C callbacks
+ bool loadsyms();
void init();
void cleanup();
@@ -85,13 +86,15 @@ public:
pa_glib_mainloop *mMainloop;
pa_context *mPAContext;
bool mConnected;
+ bool mGotSyms;
};
LinuxVolumeCatcherImpl::LinuxVolumeCatcherImpl()
: mDesiredVolume(0.0f),
mMainloop(NULL),
mPAContext(NULL),
- mConnected(false)
+ mConnected(false),
+ mGotSyms(false)
{
init();
}
@@ -106,23 +109,23 @@ void LinuxVolumeCatcherImpl::init()
// try to be as defensive as possible because PA's interface is a
// bit fragile and (for our purposes) we'd rather simply not function
// than crash
- mMainloop = pa_glib_mainloop_new(g_main_context_default());
+ mMainloop = llpa_glib_mainloop_new(g_main_context_default());
if (mMainloop)
{
- pa_mainloop_api *api = pa_glib_mainloop_get_api(mMainloop);
+ pa_mainloop_api *api = llpa_glib_mainloop_get_api(mMainloop);
if (api)
{
- pa_proplist *proplist = pa_proplist_new();
+ pa_proplist *proplist = llpa_proplist_new();
if (proplist)
{
- pa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "multimedia-player");
- pa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "com.secondlife.viewer.mediaplugvoladjust");
- pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "SL Plugin Volume Adjuster");
- pa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, "1");
+ llpa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "multimedia-player");
+ llpa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "com.secondlife.viewer.mediaplugvoladjust");
+ llpa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "SL Plugin Volume Adjuster");
+ llpa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, "1");
// plain old pa_context_new() is broken!
- mPAContext = pa_context_new_with_proplist(api, NULL, proplist);
- pa_proplist_free(proplist);
+ mPAContext = llpa_context_new_with_proplist(api, NULL, proplist);
+ llpa_proplist_free(proplist);
}
}
}
@@ -131,9 +134,9 @@ void LinuxVolumeCatcherImpl::init()
// PA context to a PA daemon.
if (mPAContext)
{
- pa_context_set_state_callback(mPAContext, callback_context_state, this);
+ llpa_context_set_state_callback(mPAContext, callback_context_state, this);
pa_context_flags_t cflags = (pa_context_flags)0; // maybe add PA_CONTEXT_NOAUTOSPAWN?
- if (pa_context_connect(mPAContext, NULL, cflags, NULL) >= 0)
+ if (llpa_context_connect(mPAContext, NULL, cflags, NULL) >= 0)
{
// Okay! We haven't definitely connected, but we
// haven't definitely failed yet.
@@ -152,14 +155,14 @@ void LinuxVolumeCatcherImpl::cleanup()
if (mPAContext)
{
- pa_context_disconnect(mPAContext);
- pa_context_unref(mPAContext);
+ llpa_context_disconnect(mPAContext);
+ llpa_context_unref(mPAContext);
mPAContext = NULL;
}
if (mMainloop)
{
- pa_glib_mainloop_free(mMainloop);
+ llpa_glib_mainloop_free(mMainloop);
mMainloop = NULL;
}
}
@@ -187,22 +190,22 @@ void LinuxVolumeCatcherImpl::connected_okay()
pa_operation *op;
// fetch global list of existing sinkinputs
- if ((op = pa_context_get_sink_input_info_list(mPAContext,
- callback_discovered_sinkinput,
- this)))
+ if ((op = llpa_context_get_sink_input_info_list(mPAContext,
+ callback_discovered_sinkinput,
+ this)))
{
- pa_operation_unref(op);
+ llpa_operation_unref(op);
}
// subscribe to future global sinkinput changes
- pa_context_set_subscribe_callback(mPAContext,
- callback_subscription_alert,
- this);
- if ((op = pa_context_subscribe(mPAContext, (pa_subscription_mask_t)
- (PA_SUBSCRIPTION_MASK_SINK_INPUT),
- NULL, NULL)))
+ llpa_context_set_subscribe_callback(mPAContext,
+ callback_subscription_alert,
+ this);
+ if ((op = llpa_context_subscribe(mPAContext, (pa_subscription_mask_t)
+ (PA_SUBSCRIPTION_MASK_SINK_INPUT),
+ NULL, NULL)))
{
- pa_operation_unref(op);
+ llpa_operation_unref(op);
}
}
@@ -218,8 +221,8 @@ void LinuxVolumeCatcherImpl::update_all_volumes(F32 volume)
void LinuxVolumeCatcherImpl::update_index_volume(U32 index, F32 volume)
{
static pa_cvolume cvol;
- pa_cvolume_set(&cvol, mSinkInputNumChannels[index],
- pa_sw_volume_from_linear(volume));
+ llpa_cvolume_set(&cvol, mSinkInputNumChannels[index],
+ llpa_sw_volume_from_linear(volume));
pa_context *c = mPAContext;
uint32_t idx = index;
@@ -228,9 +231,9 @@ void LinuxVolumeCatcherImpl::update_index_volume(U32 index, F32 volume)
void *userdata = NULL; // okay as null
pa_operation *op;
- if ((op = pa_context_set_sink_input_volume(c, idx, cvolumep, cb, userdata)))
+ if ((op = llpa_context_set_sink_input_volume(c, idx, cvolumep, cb, userdata)))
{
- pa_operation_unref(op);
+ llpa_operation_unref(op);
}
}
@@ -243,7 +246,7 @@ void callback_discovered_sinkinput(pa_context *context, const pa_sink_input_info
if (0 == eol)
{
pa_proplist *proplist = sii->proplist;
- pid_t sinkpid = atoll(pa_proplist_gets(proplist, PA_PROP_APPLICATION_PROCESS_ID));
+ pid_t sinkpid = atoll(llpa_proplist_gets(proplist, PA_PROP_APPLICATION_PROCESS_ID));
if (sinkpid == getpid()) // does the discovered sinkinput belong to this process?
{
@@ -256,7 +259,6 @@ void callback_discovered_sinkinput(pa_context *context, const pa_sink_input_info
if (is_new)
{
// new!
- fprintf(stderr, "\nJACKPOT!\n");
impl->update_index_volume(sii->index, impl->mDesiredVolume);
}
else
@@ -285,9 +287,9 @@ void callback_subscription_alert(pa_context *context, pa_subscription_event_type
{
// ask for more info about this new sinkinput
pa_operation *op;
- if ((op = pa_context_get_sink_input_info(impl->mPAContext, index, callback_discovered_sinkinput, impl)))
+ if ((op = llpa_context_get_sink_input_info(impl->mPAContext, index, callback_discovered_sinkinput, impl)))
{
- pa_operation_unref(op);
+ llpa_operation_unref(op);
}
}
break;
@@ -301,7 +303,7 @@ void callback_context_state(pa_context *context, void *userdata)
LinuxVolumeCatcherImpl *impl = dynamic_cast<LinuxVolumeCatcherImpl*>((LinuxVolumeCatcherImpl*)userdata);
llassert(impl);
- switch (pa_context_get_state(context))
+ switch (llpa_context_get_state(context))
{
case PA_CONTEXT_READY:
impl->mConnected = true;