[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.12-122-gc0815de

Lennart Poettering gitmailer-noreply at 0pointer.de
Fri Oct 3 10:49:27 PDT 2008


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  28af9944fe0560229efdcf9f0180568fd5a444c3 (commit)

- Log -----------------------------------------------------------------
c0815de... allow - in sample names
-----------------------------------------------------------------------

Summary of changes:
 src/pulsecore/core-scache.c |   31 +++++++++++++++++++------------
 src/pulsecore/namereg.c     |    1 +
 2 files changed, 20 insertions(+), 12 deletions(-)

-----------------------------------------------------------------------

commit c0815deb4add5ae4598de7c2c0589d1f5dc1c641
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 3 19:49:15 2008 +0200

    allow - in sample names

diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c
index 814dff5..1d080e1 100644
--- a/src/pulsecore/core-scache.c
+++ b/src/pulsecore/core-scache.c
@@ -98,7 +98,7 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) {
     pa_assert(c);
     pa_assert(name);
 
-    if ((e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, 0))) {
+    if ((e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, FALSE))) {
         if (e->memchunk.memblock)
             pa_memblock_unref(e->memchunk.memblock);
 
@@ -111,7 +111,7 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) {
     } else {
         e = pa_xnew(pa_scache_entry, 1);
 
-        if (!pa_namereg_register(c, name, PA_NAMEREG_SAMPLE, e, 1)) {
+        if (!pa_namereg_register(c, name, PA_NAMEREG_SAMPLE, e, TRUE)) {
             pa_xfree(e);
             return NULL;
         }
@@ -134,9 +134,9 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) {
     e->lazy = FALSE;
     e->last_used_time = 0;
 
-    memset(&e->sample_spec, 0, sizeof(e->sample_spec));
+    pa_sample_spec_init(&e->sample_spec);
     pa_channel_map_init(&e->channel_map);
-    pa_cvolume_reset(&e->volume, PA_CHANNELS_MAX);
+    pa_cvolume_init(&e->volume);
 
     pa_proplist_sets(e->proplist, PA_PROP_MEDIA_ROLE, "event");
 
@@ -159,10 +159,12 @@ int pa_scache_add_item(
     pa_assert(c);
     pa_assert(name);
     pa_assert(!ss || pa_sample_spec_valid(ss));
-    pa_assert(!map || (pa_channel_map_valid(map) && ss && ss->channels == map->channels));
+    pa_assert(!map || (pa_channel_map_valid(map) && ss && pa_channel_map_compatible(map, ss)));
 
-    if (ss && !map)
+    if (ss && !map) {
         pa_channel_map_init_extend(&tmap, ss->channels, PA_CHANNEL_MAP_DEFAULT);
+        map = &tmap;
+    }
 
     if (chunk && chunk->length > PA_SCACHE_ENTRY_SIZE_MAX)
         return -1;
@@ -170,12 +172,13 @@ int pa_scache_add_item(
     if (!(e = scache_add_item(c, name)))
         return -1;
 
-    memset(&e->sample_spec, 0, sizeof(e->sample_spec));
+    pa_sample_spec_init(&e->sample_spec);
     pa_channel_map_init(&e->channel_map);
+    pa_cvolume_init(&e->volume);
 
     if (ss) {
         e->sample_spec = *ss;
-        e->volume.channels = e->sample_spec.channels;
+        pa_cvolume_reset(&e->volume, ss->channels);
     }
 
     if (map)
@@ -310,17 +313,21 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
     pa_assert(name);
     pa_assert(sink);
 
-    if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, 1)))
+    if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, FALSE)))
         return -1;
 
     if (e->lazy && !e->memchunk.memblock) {
+        pa_channel_map old_channel_map = e->channel_map;
+
         if (pa_sound_file_load(c->mempool, e->filename, &e->sample_spec, &e->channel_map, &e->memchunk) < 0)
             return -1;
 
         pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE|PA_SUBSCRIPTION_EVENT_CHANGE, e->index);
 
-        if (e->volume.channels > e->sample_spec.channels)
-            e->volume.channels = e->sample_spec.channels;
+        if (pa_cvolume_valid(&e->volume))
+            pa_cvolume_remap(&e->volume, &old_channel_map, &e->channel_map);
+        else
+            pa_cvolume_reset(&e->volume, e->sample_spec.channels);
     }
 
     if (!e->memchunk.memblock)
@@ -383,7 +390,7 @@ uint32_t pa_scache_get_id_by_name(pa_core *c, const char *name) {
     pa_assert(c);
     pa_assert(name);
 
-    if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, 0)))
+    if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, FALSE)))
         return PA_IDXSET_INVALID;
 
     return e->index;
diff --git a/src/pulsecore/namereg.c b/src/pulsecore/namereg.c
index ad702e4..ecd8def 100644
--- a/src/pulsecore/namereg.c
+++ b/src/pulsecore/namereg.c
@@ -51,6 +51,7 @@ static pa_bool_t is_valid_char(char c) {
         (c >= 'A' && c <= 'Z') ||
         (c >= '0' && c <= '9') ||
         c == '.' ||
+        c == '-' ||
         c == '_';
 }
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list