~ubuntu-branches/ubuntu/lucid/alsa-lib/lucid

« back to all changes in this revision

Viewing changes to src/pcm/pcm_params.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-11-04 19:04:11 UTC
  • mfrom: (1.1.12 upstream) (2.2.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091104190411-igse8f4bzca8dq5x
Tags: 1.0.21a-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/rules:
    + Don't bail when removing include/alsa
  - debian/control: Add Vcs-Bzr URI
  - Add configuration files for bluetooth/bluez-alsa and pulseaudio
  - debian/libasound2.install: Ship smixer plugins for native and bi-arch
    packages
  - drop libcxxtools-dev build dependency, its in universe
  - debian/patches/Fix-fpe-snd_pcm_mmap_begin.patch: Handle attempts to
    divide by zero

Show diffs side-by-side

added added

removed removed

Lines of Context:
1081
1081
static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
1082
1082
{
1083
1083
        int err;
 
1084
        const char *compat = getenv("LIBASOUND_COMPAT");
1084
1085
#ifdef CHOOSE_DEBUG
1085
1086
        snd_output_t *log;
1086
1087
        snd_output_stdio_attach(&log, stderr, 0);
1103
1104
        err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, NULL, 0);
1104
1105
        if (err < 0)
1105
1106
                return err;
1106
 
        err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, NULL, 0);
1107
 
        if (err < 0)
1108
 
                return err;
1109
 
        err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, NULL, 0);
1110
 
        if (err < 0)
1111
 
                return err;
1112
 
        err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL, 0);
1113
 
        if (err < 0)
1114
 
                return err;
 
1107
        if (compat && *compat) {
 
1108
                /* old mode */
 
1109
                err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, NULL, 0);
 
1110
                if (err < 0)
 
1111
                        return err;
 
1112
                err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, NULL, 0);
 
1113
                if (err < 0)
 
1114
                        return err;
 
1115
                err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL, 0);
 
1116
                if (err < 0)
 
1117
                        return err;
 
1118
        } else {
 
1119
                /* determine buffer size first */
 
1120
                err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL, 0);
 
1121
                if (err < 0)
 
1122
                        return err;
 
1123
                err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, NULL, 0);
 
1124
                if (err < 0)
 
1125
                        return err;
 
1126
                err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, NULL, 0);
 
1127
                if (err < 0)
 
1128
                        return err;
 
1129
        }
1115
1130
        err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, NULL, 0);
1116
1131
        if (err < 0)
1117
1132
                return err;