unsigned char status[24];
unsigned int byteswap;
unsigned char preamble[3]; /* B/M/W or Z/X/Y */
+ snd_pcm_fast_ops_t fops;
};
enum { PREAMBLE_Z, PREAMBLE_X, PREAMBLE_Y };
snd_pcm_dump(iec->plug.gen.slave, out);
}
+static snd_pcm_sframes_t snd_pcm_iec958_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ unsigned int counter_decrement;
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ snd_pcm_sframes_t result = snd_pcm_plugin_rewind(pcm, frames);
+ if (result <= 0)
+ return result;
+
+ counter_decrement = result % 192;
+ iec->counter += 192 - counter_decrement;
+ iec->counter %= 192;
+ return result;
+}
+
+static snd_pcm_sframes_t snd_pcm_iec958_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+
+{
+ unsigned int counter_increment;
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ snd_pcm_sframes_t result = snd_pcm_plugin_rewind(pcm, frames);
+ if (result <= 0)
+ return result;
+
+ counter_increment = result % 192;
+ iec->counter += counter_increment;
+ iec->counter %= 192;
+ return result;
+}
+
static const snd_pcm_ops_t snd_pcm_iec958_ops = {
.close = snd_pcm_generic_close,
.info = snd_pcm_generic_info,
return err;
}
pcm->ops = &snd_pcm_iec958_ops;
- pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+
+ iec->fops = snd_pcm_plugin_fast_ops;
+ iec->fops.rewind = snd_pcm_iec958_rewind;
+ iec->fops.forward = snd_pcm_iec958_forward;
+ pcm->fast_ops = &iec->fops;
+
pcm->private_data = iec;
pcm->poll_fd = slave->poll_fd;
pcm->poll_events = slave->poll_events;
return snd_pcm_mmap_hw_avail(pcm);
}
-static snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
{
snd_pcm_plugin_t *plugin = pcm->private_data;
snd_pcm_sframes_t n = snd_pcm_mmap_hw_avail(pcm);
return snd_pcm_mmap_avail(pcm);
}
-static snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
{
snd_pcm_plugin_t *plugin = pcm->private_data;
snd_pcm_sframes_t n = snd_pcm_mmap_avail(pcm);
snd1_pcm_plugin_undo_read_generic
#define snd_pcm_plugin_undo_write_generic \
snd1_pcm_plugin_undo_write_generic
+#define snd_pcm_plugin_rewind \
+ snd1_pcm_plugin_rewind
+#define snd_pcm_plugin_forward \
+ snd1_pcm_plugin_forward
void snd_pcm_plugin_init(snd_pcm_plugin_t *plugin);
+snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
extern const snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;