diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-06-23 06:26:22 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-06-23 06:26:22 -0400 |
commit | 3357d4c75f1fb67e7304998c4ad4e9a9fed66fa4 (patch) | |
tree | ceba46966a5a1112a05d257d8ecb25ae5eee95e0 /sound/core/oss/pcm_oss.c | |
parent | 364f6c717deef4a3ac4982e670fa9846b43cd060 (diff) | |
parent | ee98689be1b054897ff17655008c3048fe88be94 (diff) |
Automatic merge with /usr/src/ntfs-2.6.git.
Diffstat (limited to 'sound/core/oss/pcm_oss.c')
-rw-r--r-- | sound/core/oss/pcm_oss.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 1a805020f57a..cab30977e7c0 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -125,17 +125,26 @@ int snd_pcm_plugin_append(snd_pcm_plugin_t *plugin) | |||
125 | static long snd_pcm_oss_bytes(snd_pcm_substream_t *substream, long frames) | 125 | static long snd_pcm_oss_bytes(snd_pcm_substream_t *substream, long frames) |
126 | { | 126 | { |
127 | snd_pcm_runtime_t *runtime = substream->runtime; | 127 | snd_pcm_runtime_t *runtime = substream->runtime; |
128 | snd_pcm_uframes_t buffer_size = snd_pcm_lib_buffer_bytes(substream); | 128 | long buffer_size = snd_pcm_lib_buffer_bytes(substream); |
129 | frames = frames_to_bytes(runtime, frames); | 129 | long bytes = frames_to_bytes(runtime, frames); |
130 | if (buffer_size == runtime->oss.buffer_bytes) | 130 | if (buffer_size == runtime->oss.buffer_bytes) |
131 | return frames; | 131 | return bytes; |
132 | return (runtime->oss.buffer_bytes * frames) / buffer_size; | 132 | #if BITS_PER_LONG >= 64 |
133 | return runtime->oss.buffer_bytes * bytes / buffer_size; | ||
134 | #else | ||
135 | { | ||
136 | u64 bsize = (u64)runtime->oss.buffer_bytes * (u64)bytes; | ||
137 | u32 rem; | ||
138 | div64_32(&bsize, buffer_size, &rem); | ||
139 | return (long)bsize; | ||
140 | } | ||
141 | #endif | ||
133 | } | 142 | } |
134 | 143 | ||
135 | static long snd_pcm_alsa_frames(snd_pcm_substream_t *substream, long bytes) | 144 | static long snd_pcm_alsa_frames(snd_pcm_substream_t *substream, long bytes) |
136 | { | 145 | { |
137 | snd_pcm_runtime_t *runtime = substream->runtime; | 146 | snd_pcm_runtime_t *runtime = substream->runtime; |
138 | snd_pcm_uframes_t buffer_size = snd_pcm_lib_buffer_bytes(substream); | 147 | long buffer_size = snd_pcm_lib_buffer_bytes(substream); |
139 | if (buffer_size == runtime->oss.buffer_bytes) | 148 | if (buffer_size == runtime->oss.buffer_bytes) |
140 | return bytes_to_frames(runtime, bytes); | 149 | return bytes_to_frames(runtime, bytes); |
141 | return bytes_to_frames(runtime, (buffer_size * bytes) / runtime->oss.buffer_bytes); | 150 | return bytes_to_frames(runtime, (buffer_size * bytes) / runtime->oss.buffer_bytes); |
@@ -464,7 +473,8 @@ static int snd_pcm_oss_change_params(snd_pcm_substream_t *substream) | |||
464 | sw_params->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; | 473 | sw_params->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; |
465 | sw_params->period_step = 1; | 474 | sw_params->period_step = 1; |
466 | sw_params->sleep_min = 0; | 475 | sw_params->sleep_min = 0; |
467 | sw_params->avail_min = 1; | 476 | sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? |
477 | 1 : runtime->period_size; | ||
468 | sw_params->xfer_align = 1; | 478 | sw_params->xfer_align = 1; |
469 | if (atomic_read(&runtime->mmap_count) || | 479 | if (atomic_read(&runtime->mmap_count) || |
470 | (substream->oss.setup && substream->oss.setup->nosilence)) { | 480 | (substream->oss.setup && substream->oss.setup->nosilence)) { |
@@ -1527,12 +1537,15 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str | |||
1527 | snd_pcm_oss_simulate_fill(substream, delay); | 1537 | snd_pcm_oss_simulate_fill(substream, delay); |
1528 | info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; | 1538 | info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; |
1529 | } else { | 1539 | } else { |
1530 | delay = snd_pcm_oss_bytes(substream, delay) + fixup; | 1540 | delay = snd_pcm_oss_bytes(substream, delay); |
1531 | info.blocks = delay / runtime->oss.period_bytes; | 1541 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
1532 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | 1542 | info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; |
1533 | info.bytes = (runtime->oss.bytes - delay) & INT_MAX; | 1543 | info.bytes = (runtime->oss.bytes - delay) & INT_MAX; |
1534 | else | 1544 | } else { |
1545 | delay += fixup; | ||
1546 | info.blocks = delay / runtime->oss.period_bytes; | ||
1535 | info.bytes = (runtime->oss.bytes + delay) & INT_MAX; | 1547 | info.bytes = (runtime->oss.bytes + delay) & INT_MAX; |
1548 | } | ||
1536 | } | 1549 | } |
1537 | if (copy_to_user(_info, &info, sizeof(info))) | 1550 | if (copy_to_user(_info, &info, sizeof(info))) |
1538 | return -EFAULT; | 1551 | return -EFAULT; |