[polypaudio-commits] r777 - in /trunk/src/polypcore: core-scache.c sound-file.c sound-file.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat Apr 22 14:50:19 PDT 2006


Author: lennart
Date: Sat Apr 22 23:50:15 2006
New Revision: 777

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=777&root=polypaudio&view=rev
Log:
when loading sound files, initialize channel map data properly

Modified:
    trunk/src/polypcore/core-scache.c
    trunk/src/polypcore/sound-file.c
    trunk/src/polypcore/sound-file.h

Modified: trunk/src/polypcore/core-scache.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/core-scache.c?rev=777&root=polypaudio&r1=776&r2=777&view=diff
==============================================================================
--- trunk/src/polypcore/core-scache.c (original)
+++ trunk/src/polypcore/core-scache.c Sat Apr 22 23:50:15 2006
@@ -157,6 +157,7 @@
 
 int pa_scache_add_file(pa_core *c, const char *name, const char *filename, uint32_t *idx) {
     pa_sample_spec ss;
+    pa_channel_map map;
     pa_memchunk chunk;
     int r;
 
@@ -167,10 +168,10 @@
         filename = buf;
 #endif
 
-    if (pa_sound_file_load(filename, &ss, &chunk, c->memblock_stat) < 0)
+    if (pa_sound_file_load(filename, &ss, &map, &chunk, c->memblock_stat) < 0)
         return -1;
         
-    r = pa_scache_add_item(c, name, &ss, NULL, &chunk, idx);
+    r = pa_scache_add_item(c, name, &ss, &map, &chunk, idx);
     pa_memblock_unref(chunk.memblock);
 
     return r;
@@ -252,7 +253,7 @@
         return -1;
 
     if (e->lazy && !e->memchunk.memblock) {
-        if (pa_sound_file_load(e->filename, &e->sample_spec, &e->memchunk, c->memblock_stat) < 0)
+        if (pa_sound_file_load(e->filename, &e->sample_spec, &e->channel_map, &e->memchunk, c->memblock_stat) < 0)
             return -1;
 
         pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE|PA_SUBSCRIPTION_EVENT_CHANGE, e->index);

Modified: trunk/src/polypcore/sound-file.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/sound-file.c?rev=777&root=polypaudio&r1=776&r2=777&view=diff
==============================================================================
--- trunk/src/polypcore/sound-file.c (original)
+++ trunk/src/polypcore/sound-file.c Sat Apr 22 23:50:15 2006
@@ -35,7 +35,7 @@
 
 #define MAX_FILE_SIZE (1024*1024)
 
-int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_memchunk *chunk, pa_memblock_stat *s) {
+int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_channel_map *map, pa_memchunk *chunk, pa_memblock_stat *s) {
     SNDFILE*sf = NULL;
     SF_INFO sfinfo;
     int ret = -1;
@@ -74,6 +74,9 @@
         pa_log(__FILE__": Unsupported sample format in file %s", fname);
         goto finish;
     }
+
+    if (map)
+        pa_channel_map_init_auto(map, ss->channels);
     
     if ((l = pa_frame_size(ss)*sfinfo.frames) > MAX_FILE_SIZE) {
         pa_log(__FILE__": File too large");

Modified: trunk/src/polypcore/sound-file.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/sound-file.h?rev=777&root=polypaudio&r1=776&r2=777&view=diff
==============================================================================
--- trunk/src/polypcore/sound-file.h (original)
+++ trunk/src/polypcore/sound-file.h Sat Apr 22 23:50:15 2006
@@ -23,9 +23,10 @@
 ***/
 
 #include <polyp/sample.h>
+#include <polyp/channelmap.h>
 #include <polypcore/memchunk.h>
 
-int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_memchunk *chunk, pa_memblock_stat *s);
+int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_channel_map *map, pa_memchunk *chunk, pa_memblock_stat *s);
 
 int pa_sound_file_too_big_to_cache(const char *fname);
 




More information about the pulseaudio-commits mailing list