mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-16 08:56:42 -05:00
Renamed status field in state
This commit is contained in:
parent
c323849bac
commit
0888689aec
4 changed files with 25 additions and 25 deletions
|
|
@ -210,7 +210,7 @@ int snd_pcm_stream_state(snd_pcm_t *pcm, int stream)
|
||||||
str = &pcm->stream[stream];
|
str = &pcm->stream[stream];
|
||||||
assert(str->open);
|
assert(str->open);
|
||||||
if (str->mmap_control)
|
if (str->mmap_control)
|
||||||
return str->mmap_control->status;
|
return str->mmap_control->state;
|
||||||
return pcm->ops->stream_state(pcm, stream);
|
return pcm->ops->stream_state(pcm, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ static ssize_t snd_pcm_hw_stream_state(snd_pcm_t *pcm, int stream)
|
||||||
status.stream = stream;
|
status.stream = stream;
|
||||||
if (ioctl(fd, SND_PCM_IOCTL_STREAM_STATUS, status) < 0)
|
if (ioctl(fd, SND_PCM_IOCTL_STREAM_STATUS, status) < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
return status.status;
|
return status.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t snd_pcm_hw_stream_byte_io(snd_pcm_t *pcm, int stream, int update UNUSED)
|
static ssize_t snd_pcm_hw_stream_byte_io(snd_pcm_t *pcm, int stream, int update UNUSED)
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ static int snd_pcm_mmap_playback_ready(snd_pcm_t *pcm)
|
||||||
{
|
{
|
||||||
snd_pcm_stream_t *str;
|
snd_pcm_stream_t *str;
|
||||||
str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
|
str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
|
||||||
if (str->mmap_control->status == SND_PCM_STATUS_XRUN)
|
if (str->mmap_control->state == SND_PCM_STATE_XRUN)
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
return snd_pcm_mmap_playback_bytes_avail(str) >= str->setup.bytes_min;
|
return snd_pcm_mmap_playback_bytes_avail(str) >= str->setup.bytes_min;
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +67,7 @@ static int snd_pcm_mmap_capture_ready(snd_pcm_t *pcm)
|
||||||
snd_pcm_stream_t *str;
|
snd_pcm_stream_t *str;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
|
str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
|
||||||
if (str->mmap_control->status == SND_PCM_STATUS_XRUN) {
|
if (str->mmap_control->state == SND_PCM_STATE_XRUN) {
|
||||||
ret = -EPIPE;
|
ret = -EPIPE;
|
||||||
if (str->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
|
if (str->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
|
|
@ -86,7 +86,7 @@ int snd_pcm_mmap_ready(snd_pcm_t *pcm, int stream)
|
||||||
str = &pcm->stream[stream];
|
str = &pcm->stream[stream];
|
||||||
ctrl = str->mmap_control;
|
ctrl = str->mmap_control;
|
||||||
assert(ctrl);
|
assert(ctrl);
|
||||||
assert(ctrl->status >= SND_PCM_STATUS_PREPARED);
|
assert(ctrl->state >= SND_PCM_STATE_PREPARED);
|
||||||
if (stream == SND_PCM_STREAM_PLAYBACK) {
|
if (stream == SND_PCM_STREAM_PLAYBACK) {
|
||||||
return snd_pcm_mmap_playback_ready(pcm);
|
return snd_pcm_mmap_playback_ready(pcm);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -170,7 +170,7 @@ int snd_pcm_mmap_stream_state(snd_pcm_t *pcm, int stream)
|
||||||
assert(stream >= 0 && stream <= 1);
|
assert(stream >= 0 && stream <= 1);
|
||||||
str = &pcm->stream[stream];
|
str = &pcm->stream[stream];
|
||||||
assert(str->mmap_control);
|
assert(str->mmap_control);
|
||||||
return str->mmap_control->status;
|
return str->mmap_control->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
int snd_pcm_mmap_stream_byte_io(snd_pcm_t *pcm, int stream)
|
int snd_pcm_mmap_stream_byte_io(snd_pcm_t *pcm, int stream)
|
||||||
|
|
@ -204,12 +204,12 @@ ssize_t snd_pcm_mmap_stream_seek(snd_pcm_t *pcm, int stream, off_t offset)
|
||||||
byte_data = str->mmap_control->byte_data;
|
byte_data = str->mmap_control->byte_data;
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
return byte_data;
|
return byte_data;
|
||||||
switch (str->mmap_control->status) {
|
switch (str->mmap_control->state) {
|
||||||
case SND_PCM_STATUS_RUNNING:
|
case SND_PCM_STATE_RUNNING:
|
||||||
if (str->setup.mode == SND_PCM_MODE_FRAME)
|
if (str->setup.mode == SND_PCM_MODE_FRAME)
|
||||||
snd_pcm_stream_byte_io(pcm, stream, 1);
|
snd_pcm_stream_byte_io(pcm, stream, 1);
|
||||||
break;
|
break;
|
||||||
case SND_PCM_STATUS_PREPARED:
|
case SND_PCM_STATE_PREPARED:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
|
|
@ -249,11 +249,11 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channel
|
||||||
|
|
||||||
str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
|
str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
|
||||||
ctrl = str->mmap_control;
|
ctrl = str->mmap_control;
|
||||||
assert(ctrl->status >= SND_PCM_STATUS_PREPARED);
|
assert(ctrl->state >= SND_PCM_STATE_PREPARED);
|
||||||
if (str->setup.mode == SND_PCM_MODE_FRAGMENT) {
|
if (str->setup.mode == SND_PCM_MODE_FRAGMENT) {
|
||||||
assert(frames % str->frames_per_frag == 0);
|
assert(frames % str->frames_per_frag == 0);
|
||||||
} else {
|
} else {
|
||||||
if (ctrl->status == SND_PCM_STATUS_RUNNING &&
|
if (ctrl->state == SND_PCM_STATE_RUNNING &&
|
||||||
str->mode & SND_PCM_NONBLOCK)
|
str->mode & SND_PCM_NONBLOCK)
|
||||||
snd_pcm_stream_byte_io(pcm, SND_PCM_STREAM_PLAYBACK, 1);
|
snd_pcm_stream_byte_io(pcm, SND_PCM_STREAM_PLAYBACK, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -265,7 +265,7 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channel
|
||||||
return ready;
|
return ready;
|
||||||
if (!ready) {
|
if (!ready) {
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
if (ctrl->status != SND_PCM_STATUS_RUNNING)
|
if (ctrl->state != SND_PCM_STATE_RUNNING)
|
||||||
return result > 0 ? result : -EPIPE;
|
return result > 0 ? result : -EPIPE;
|
||||||
if (str->mode & SND_PCM_NONBLOCK)
|
if (str->mode & SND_PCM_NONBLOCK)
|
||||||
return result > 0 ? result : -EAGAIN;
|
return result > 0 ? result : -EAGAIN;
|
||||||
|
|
@ -282,13 +282,13 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channel
|
||||||
assert(frames1 > 0);
|
assert(frames1 > 0);
|
||||||
mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_STREAM_PLAYBACK);
|
mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_STREAM_PLAYBACK);
|
||||||
snd_pcm_areas_copy(channels, offset, str->channels, mmap_offset, str->setup.format.channels, frames1, str->setup.format.format);
|
snd_pcm_areas_copy(channels, offset, str->channels, mmap_offset, str->setup.format.channels, frames1, str->setup.format.format);
|
||||||
if (ctrl->status == SND_PCM_STATUS_XRUN)
|
if (ctrl->state == SND_PCM_STATE_XRUN)
|
||||||
return result > 0 ? result : -EPIPE;
|
return result > 0 ? result : -EPIPE;
|
||||||
snd_pcm_stream_seek(pcm, SND_PCM_STREAM_PLAYBACK, frames1 * str->bits_per_frame / 8);
|
snd_pcm_stream_seek(pcm, SND_PCM_STREAM_PLAYBACK, frames1 * str->bits_per_frame / 8);
|
||||||
frames -= frames1;
|
frames -= frames1;
|
||||||
offset += frames1;
|
offset += frames1;
|
||||||
result += frames1;
|
result += frames1;
|
||||||
if (ctrl->status == SND_PCM_STATUS_PREPARED &&
|
if (ctrl->state == SND_PCM_STATE_PREPARED &&
|
||||||
(str->setup.start_mode == SND_PCM_START_DATA ||
|
(str->setup.start_mode == SND_PCM_START_DATA ||
|
||||||
(str->setup.start_mode == SND_PCM_START_FULL &&
|
(str->setup.start_mode == SND_PCM_START_FULL &&
|
||||||
!snd_pcm_mmap_playback_ready(pcm)))) {
|
!snd_pcm_mmap_playback_ready(pcm)))) {
|
||||||
|
|
@ -407,15 +407,15 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channels
|
||||||
|
|
||||||
str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
|
str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
|
||||||
ctrl = str->mmap_control;
|
ctrl = str->mmap_control;
|
||||||
assert(ctrl->status >= SND_PCM_STATUS_PREPARED);
|
assert(ctrl->state >= SND_PCM_STATE_PREPARED);
|
||||||
if (str->setup.mode == SND_PCM_MODE_FRAGMENT) {
|
if (str->setup.mode == SND_PCM_MODE_FRAGMENT) {
|
||||||
assert(frames % str->frames_per_frag == 0);
|
assert(frames % str->frames_per_frag == 0);
|
||||||
} else {
|
} else {
|
||||||
if (ctrl->status == SND_PCM_STATUS_RUNNING &&
|
if (ctrl->state == SND_PCM_STATE_RUNNING &&
|
||||||
str->mode & SND_PCM_NONBLOCK)
|
str->mode & SND_PCM_NONBLOCK)
|
||||||
snd_pcm_stream_byte_io(pcm, SND_PCM_STREAM_CAPTURE, 1);
|
snd_pcm_stream_byte_io(pcm, SND_PCM_STREAM_CAPTURE, 1);
|
||||||
}
|
}
|
||||||
if (ctrl->status == SND_PCM_STATUS_PREPARED &&
|
if (ctrl->state == SND_PCM_STATE_PREPARED &&
|
||||||
str->setup.start_mode == SND_PCM_START_DATA) {
|
str->setup.start_mode == SND_PCM_START_DATA) {
|
||||||
err = snd_pcm_stream_go(pcm, SND_PCM_STREAM_CAPTURE);
|
err = snd_pcm_stream_go(pcm, SND_PCM_STREAM_CAPTURE);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
|
@ -429,7 +429,7 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channels
|
||||||
return ready;
|
return ready;
|
||||||
if (!ready) {
|
if (!ready) {
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
if (ctrl->status != SND_PCM_STATUS_RUNNING)
|
if (ctrl->state != SND_PCM_STATE_RUNNING)
|
||||||
return result > 0 ? result : -EPIPE;
|
return result > 0 ? result : -EPIPE;
|
||||||
if (str->mode & SND_PCM_NONBLOCK)
|
if (str->mode & SND_PCM_NONBLOCK)
|
||||||
return result > 0 ? result : -EAGAIN;
|
return result > 0 ? result : -EAGAIN;
|
||||||
|
|
@ -446,7 +446,7 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channels
|
||||||
assert(frames1 > 0);
|
assert(frames1 > 0);
|
||||||
mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_STREAM_CAPTURE);
|
mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_STREAM_CAPTURE);
|
||||||
snd_pcm_areas_copy(str->channels, mmap_offset, channels, offset, str->setup.format.channels, frames1, str->setup.format.format);
|
snd_pcm_areas_copy(str->channels, mmap_offset, channels, offset, str->setup.format.channels, frames1, str->setup.format.format);
|
||||||
if (ctrl->status == SND_PCM_STATUS_XRUN &&
|
if (ctrl->state == SND_PCM_STATE_XRUN &&
|
||||||
str->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
|
str->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
|
||||||
return result > 0 ? result : -EPIPE;
|
return result > 0 ? result : -EPIPE;
|
||||||
snd_pcm_stream_seek(pcm, SND_PCM_STREAM_CAPTURE, frames1 * str->bits_per_frame / 8);
|
snd_pcm_stream_seek(pcm, SND_PCM_STREAM_CAPTURE, frames1 * str->bits_per_frame / 8);
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ static ssize_t mmap_src_channels(snd_pcm_plugin_t *plugin,
|
||||||
stream = &data->slave->stream[plugin->stream];
|
stream = &data->slave->stream[plugin->stream];
|
||||||
|
|
||||||
setup = &stream->setup;
|
setup = &stream->setup;
|
||||||
if (ctrl->status < SND_PCM_STATUS_PREPARED)
|
if (ctrl->state < SND_PCM_STATE_PREPARED)
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
|
|
||||||
ready = snd_pcm_mmap_ready(data->slave, plugin->stream);
|
ready = snd_pcm_mmap_ready(data->slave, plugin->stream);
|
||||||
|
|
@ -71,7 +71,7 @@ static ssize_t mmap_src_channels(snd_pcm_plugin_t *plugin,
|
||||||
return ready;
|
return ready;
|
||||||
if (!ready) {
|
if (!ready) {
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
if (ctrl->status != SND_PCM_STATUS_RUNNING)
|
if (ctrl->state != SND_PCM_STATE_RUNNING)
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
if (stream->mode & SND_PCM_NONBLOCK)
|
if (stream->mode & SND_PCM_NONBLOCK)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
@ -129,9 +129,9 @@ static ssize_t mmap_dst_channels(snd_pcm_plugin_t *plugin,
|
||||||
|
|
||||||
setup = &stream->setup;
|
setup = &stream->setup;
|
||||||
ctrl = data->control;
|
ctrl = data->control;
|
||||||
if (ctrl->status < SND_PCM_STATUS_PREPARED)
|
if (ctrl->state < SND_PCM_STATE_PREPARED)
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
if (ctrl->status == SND_PCM_STATUS_PREPARED &&
|
if (ctrl->state == SND_PCM_STATE_PREPARED &&
|
||||||
stream->setup.start_mode == SND_PCM_START_DATA) {
|
stream->setup.start_mode == SND_PCM_START_DATA) {
|
||||||
err = snd_pcm_stream_go(data->slave, plugin->stream);
|
err = snd_pcm_stream_go(data->slave, plugin->stream);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
|
@ -142,7 +142,7 @@ static ssize_t mmap_dst_channels(snd_pcm_plugin_t *plugin,
|
||||||
return ready;
|
return ready;
|
||||||
if (!ready) {
|
if (!ready) {
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
if (ctrl->status != SND_PCM_STATUS_RUNNING)
|
if (ctrl->state != SND_PCM_STATE_RUNNING)
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
if (stream->mode & SND_PCM_NONBLOCK)
|
if (stream->mode & SND_PCM_NONBLOCK)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
@ -202,7 +202,7 @@ static ssize_t mmap_playback_transfer(snd_pcm_plugin_t *plugin,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
snd_pcm_stream_seek(data->slave, SND_PCM_STREAM_PLAYBACK, frames * str->bits_per_frame / 8);
|
snd_pcm_stream_seek(data->slave, SND_PCM_STREAM_PLAYBACK, frames * str->bits_per_frame / 8);
|
||||||
if (ctrl->status == SND_PCM_STATUS_PREPARED &&
|
if (ctrl->state == SND_PCM_STATE_PREPARED &&
|
||||||
(str->setup.start_mode == SND_PCM_START_DATA ||
|
(str->setup.start_mode == SND_PCM_START_DATA ||
|
||||||
(str->setup.start_mode == SND_PCM_START_FULL &&
|
(str->setup.start_mode == SND_PCM_START_FULL &&
|
||||||
!snd_pcm_mmap_ready(data->slave, plugin->stream)))) {
|
!snd_pcm_mmap_ready(data->slave, plugin->stream)))) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue