int bytes_per_frame;
};
-static int oss_pre_select(struct sched *s, struct writer_node *wn)
-{
- struct private_oss_write_data *powd = wn->private_data;
- struct writer_node_group *wng = wn->wng;
-
- if (*wng->loaded - wn->written < powd->bytes_per_frame)
- return 0;
- para_fd_set(powd->fd, &s->wfds, &s->max_fileno);
- return 1;
-}
-
static void oss_pre_select_btr(struct sched *s, struct task *t)
{
struct writer_node *wn = container_of(t, struct writer_node, task);
s->timeout.tv_usec = 1;
}
-static int oss_post_select(struct sched *s, struct writer_node *wn)
-{
- int ret;
- struct private_oss_write_data *powd = wn->private_data;
- struct writer_node_group *wng = wn->wng;
- size_t frames, bytes = *wng->loaded - wn->written;
- char *data = *wng->bufp + wn->written;
-
- if (*wng->input_error < 0 && bytes < powd->bytes_per_frame) {
- wn->written = *wng->loaded;
- return *wng->input_error;
- }
- frames = bytes / powd->bytes_per_frame;
- if (!frames) /* less than a single frame available */
- goto out;
- if (!FD_ISSET(powd->fd, &s->wfds))
- goto out;
- ret = write_nonblock(powd->fd, data, frames * powd->bytes_per_frame, 0);
- if (ret < 0)
- return ret;
- wn->written += ret;
-out:
- return 1;
-}
-
static void oss_close(struct writer_node *wn)
{
struct private_oss_write_data *powd = wn->private_data;
oss_cmdline_parser_init(&dummy);
w->open = oss_open;
w->close = oss_close;
- w->pre_select = oss_pre_select;
w->pre_select_btr = oss_pre_select_btr;
- w->post_select = oss_post_select;
w->post_select_btr = oss_post_select_btr;
w->parse_config = oss_parse_config;
w->free_config = oss_free_config;