Author: richard
Date: Fri Feb  6 06:23:24 2009
New Revision: 4077

URL: http://svn.slimdevices.com?rev=4077&root=Jive&view=rev
Log:
 r4...@harrypotter (orig r4075):  richard | 2009-02-06 14:20:10 +0000
 Bug: 10704
 Description:
 Fix playing different sample rates.
 
 
 r4...@harrypotter (orig r4076):  richard | 2009-02-06 14:22:14 +0000
 Bug: 10704
 Description:
 Include the alsa rate conversion plugin.
 
 

Modified:
    7.4/branches/pango/   (props changed)
    
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/alsa/alsa-lib_1.0.18.bb
    
7.4/branches/pango/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c

Propchange: 7.4/branches/pango/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Feb  6 06:23:24 2009
@@ -4,7 +4,7 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.2/trunk:2921
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/private-branches/jive-refresh:3653
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/trunk:3993
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:4069
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:4076
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/alsa/alsa-lib_1.0.18.bb
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/alsa/alsa-lib_1.0.18.bb?rev=4077&root=Jive&r1=4076&r2=4077&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/alsa/alsa-lib_1.0.18.bb
 (original)
+++ 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/alsa/alsa-lib_1.0.18.bb
 Fri Feb  6 06:23:24 2009
@@ -3,7 +3,7 @@
 SECTION = "libs/multimedia"
 LICENSE = "GPL"
 
-PR = "1"
+PR = "2"
 
 # configure.in sets -D__arm__ on the command line for any arm system
 # (not just those with the ARM instruction set), this should be removed,
@@ -30,7 +30,7 @@
             --disable-alisp \
             --enable-old-symbols \
             --disable-python \
-            --with-pcm-plugins=hw,plug,multi,route,empty"
+            --with-pcm-plugins=hw,plug,multi,rate,route,empty"
 
 do_stage () {
        oe_libinstall -so -C src libasound ${STAGING_LIBDIR}/

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c?rev=4077&root=Jive&r1=4076&r2=4077&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c 
(original)
+++ 
7.4/branches/pango/squeezeplay/src/squeezeplay/src/audio/decode/decode_alsa.c 
Fri Feb  6 06:23:24 2009
@@ -32,7 +32,6 @@
        u32_t flags;
        unsigned int buffer_time;
        unsigned int period_count;
-       unsigned int rate_max;
 
        /* alsa pcm state */
        snd_pcm_t *pcm;
@@ -63,6 +62,7 @@
 static snd_output_t *output;
 
 /* player state */
+static unsigned int playback_max_rate = 44100;
 static struct decode_alsa *playback_state;
 static struct decode_alsa *effects_state;
 
@@ -266,18 +266,6 @@
                return err;
        }
 
-       /* Find maximum supported hardware rate */
-       if ((err = snd_pcm_hw_params_set_rate_resample(state->pcm, 
state->hw_params, 0)) < 0) {
-               DEBUG_ERROR("Resampling setup failed: %s\n", snd_strerror(err));
-               return err;
-       }
-
-       if ((err = snd_pcm_hw_params_get_rate_max(state->hw_params, &val, 
&dir)) < 0) {
-               DEBUG_ERROR("hwparam rate max error: %s", snd_strerror(err));
-               return err;
-       }
-       state->rate_max = val;
-
        /* set hardware resampling */
        if ((err = snd_pcm_hw_params_set_rate_resample(state->pcm, 
state->hw_params, 1)) < 0) {
                DEBUG_ERROR("Resampling setup failed: %s\n", snd_strerror(err));
@@ -371,22 +359,38 @@
 }
 
 
-static int pcm_test(const char *name) {
-       struct decode_alsa tmp_state;
-       int err;
-
-       memset(&tmp_state, 0, sizeof(struct decode_alsa));
-       tmp_state.name = name;
-       tmp_state.buffer_time = ALSA_DEFAULT_BUFFER_TIME;
-       tmp_state.period_count = ALSA_DEFAULT_PERIOD_COUNT;
-       tmp_state.new_sample_rate = 44100;
-       if ((err = pcm_open(&tmp_state)) < 0) {
-               return err;
-       }
-
-       pcm_close(&tmp_state);
-
-       return 0;
+static int pcm_test(const char *name, unsigned int *max_rate) {
+       snd_pcm_t *pcm;
+       snd_pcm_hw_params_t *hw_params;
+       int dir, err = 0;
+
+       if ((err = snd_pcm_open(&pcm, name, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+               goto test_error;
+       }
+
+       if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0) {
+               goto test_close;
+       }
+
+       if ((err = snd_pcm_hw_params_any(pcm, hw_params)) < 0) {
+               goto test_close;
+       }
+
+       /* Find maximum supported hardware rate */
+       if ((err = snd_pcm_hw_params_set_rate_resample(pcm, hw_params, 0)) < 0) 
{
+               goto test_close;
+       }
+
+       if ((err = snd_pcm_hw_params_get_rate_max(hw_params, max_rate, &dir)) < 
0) {
+               goto test_close;
+       }
+
+ test_close:
+       snd_pcm_close(pcm);
+       snd_pcm_hw_params_free(hw_params);
+
+ test_error:
+       return err;
 }
 
 
@@ -708,7 +712,7 @@
 
 
 static void decode_alsa_info(unsigned int *rate_max) {
-       *rate_max = playback_state->rate_max;
+       *rate_max = playback_max_rate;
 }
 
 
@@ -733,12 +737,12 @@
 
 
        /* test if device is available */
-       if (pcm_test(playback_device) < 0) {
+       if (pcm_test(playback_device, &playback_max_rate) < 0) {
                lua_pop(L, 2);
                return 0;
        }
 
-       if (effects_device && pcm_test(effects_device) < 0) {
+       if (effects_device && pcm_test(effects_device, NULL) < 0) {
                effects_device = NULL;
        }
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to