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:
@@ -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