[alsa-devel] [PATCH v2] Fix forward/rewind support in iec958 plugin
Raymond Yau
superquad.vortex2 at gmail.com
Fri Apr 25 01:02:20 CEST 2014
>
> When forwarding or rewinding, the frame counter was not updated. This
> could result in corrupted channel status words or misplaced Z-type
> preamble.
Do you mean it is the responsibility for a52 and dca plugin to return the
SAFE value returned by snd_pcm_rewindable and snd_pcm_forwardable since
they enocde the audio and padding zeros and write to IEC958 ?
>
> +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;
> +}
> +
More information about the Alsa-devel
mailing list