Bundle fallback ringback and busy tone audio files
Most desktop Linux sound themes lack telephony events like phone-outgoing-calling and phone-outgoing-busy, causing gsound playback to fail silently. Bundle OGG Vorbis fallback files and pass GSOUND_ATTR_MEDIA_FILENAME alongside GSOUND_ATTR_EVENT_ID so libcanberra falls back to the bundled audio when the theme event is not found.
This commit is contained in:
@@ -110,3 +110,10 @@ if compile_schemas.found()
|
||||
args: ['--strict', '--dry-run', meson.current_source_dir()],
|
||||
)
|
||||
endif
|
||||
|
||||
# Sounds (fallback for systems without telephony events in sound theme)
|
||||
install_data(
|
||||
'sounds/phone-outgoing-calling.oga',
|
||||
'sounds/phone-outgoing-busy.oga',
|
||||
install_dir: join_paths(datadir, calls_name, 'sounds'),
|
||||
)
|
||||
|
||||
BIN
data/sounds/phone-outgoing-busy.oga
Normal file
BIN
data/sounds/phone-outgoing-busy.oga
Normal file
Binary file not shown.
BIN
data/sounds/phone-outgoing-calling.oga
Normal file
BIN
data/sounds/phone-outgoing-calling.oga
Normal file
Binary file not shown.
@@ -78,6 +78,8 @@ config_data.set_quoted('APP_DATA_NAME', calls_name)
|
||||
config_data.set_quoted('GETTEXT_PACKAGE', calls_name)
|
||||
config_data.set_quoted('LOCALEDIR', full_localedir)
|
||||
config_data.set_quoted('PLUGIN_LIBDIR', full_calls_plugin_libdir)
|
||||
config_data.set_quoted('CALLS_SOUNDS_DIR',
|
||||
join_paths(prefix, get_option('datadir'), calls_name, 'sounds'))
|
||||
config_data.set_quoted('PACKAGE_URL', calls_homepage)
|
||||
config_data.set_quoted('PACKAGE_VERSION', calls_version)
|
||||
config_data.set('PACKAGE_URL_RAW', calls_homepage)
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include "calls-media-playback.h"
|
||||
|
||||
#include "calls-config.h"
|
||||
|
||||
#include <gsound.h>
|
||||
|
||||
|
||||
@@ -96,6 +98,23 @@ playback_event_to_string (PlaybackEvent event)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
playback_event_to_filename (PlaybackEvent event)
|
||||
{
|
||||
switch (event) {
|
||||
case PLAYBACK_CALLING:
|
||||
return CALLS_SOUNDS_DIR "/phone-outgoing-calling.oga";
|
||||
|
||||
case PLAYBACK_BUSY:
|
||||
return CALLS_SOUNDS_DIR "/phone-outgoing-busy.oga";
|
||||
|
||||
case PLAYBACK_LAST:
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
calls_media_playback_dispose (GObject *object)
|
||||
{
|
||||
@@ -182,11 +201,13 @@ static void
|
||||
playback_data (MediaPlaybackData *data)
|
||||
{
|
||||
const char *event_id;
|
||||
const char *filename;
|
||||
|
||||
g_assert (CALLS_IS_MEDIA_PLAYBACK (data->self));
|
||||
g_assert (data->self->context);
|
||||
|
||||
event_id = playback_event_to_string (data->event);
|
||||
filename = playback_event_to_filename (data->event);
|
||||
|
||||
if (!event_id) {
|
||||
g_warning ("No event id found for %d", data->event);
|
||||
@@ -201,6 +222,7 @@ playback_data (MediaPlaybackData *data)
|
||||
data,
|
||||
GSOUND_ATTR_CANBERRA_CACHE_CONTROL, "volatile",
|
||||
GSOUND_ATTR_EVENT_ID, event_id,
|
||||
GSOUND_ATTR_MEDIA_FILENAME, filename,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user