From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Raymond Yau <superquad.vortex2@gmail.com>,
david.henningsson@canonical.com
Subject: Re: [PATCH v2] Fix forward/rewind support in iec958 plugin
Date: Fri, 25 Apr 2014 12:00:03 +0600 [thread overview]
Message-ID: <5359F9E3.10107@gmail.com> (raw)
In-Reply-To: <CAN8cciadq+=36DcMufwDD=M5=0EAdnkUxPv8b9Ga5JHWqg1-Hg@mail.gmail.com>
25.04.2014 05:02, Raymond Yau wrote:
>
>
> >
> > 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 ?
>
Sorry, I don't understand the question, please reask differently if I am
answering something else than what you mean here.
Neither a52 nor dca plugins use seeking under normal operation (when
they themselves are not being seeked), they just write zeros when needed
due to the IEC 61937-5 wrapping. Their implementations are in fact not
seekable (they only pretend), and I will e-mail patches that enforce this.
What I mean in the patch is the following scenario involving an
application that writes stereo data directly to the iec958 plugin.
1. Write 1920 samples.
2. Rewind 1919 samples.
3. Write 1919 samples.
Let's suppose that the counter was 0 initially, and the application
pointer points at sample 0. Then, while encoding this to iec958
subframes, the plugin would start the preamble sequence with Z. Result:
ZYXYXYXYXY... in the output buffer after step 1. Z repeats every 192
frames, as required by the standard. And the first subframe (with Z) now
contains the first bit of the first status word. After writing 1920
samples, the counter is still at 0, because it counts modulo 192.
After step 2, the application pointer points at sample 1, but the
counter is 0 in the unpatched version and 1 in the patched one.
After step 3, the unpatched version writes the Z preamble and the first
bit of the first status word. Result: ZYZYXYXYXY... The patched version
writes the second bit of the first status word, i.e. just what should be
in the buffer. Also, it puts the X preamble. Result: ZYXYXYXYXY..., just
what there should be.
So, after the patch, the iec958 plugin properly supports arbitrary
seeking, just like a normal hardware device, and should be just as
usable by hypothetical seekable versions of the a52 and dca plugins.
--
Alexander E. Patrakov
next prev parent reply other threads:[~2014-04-25 6:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 18:40 [PATCH] Fix forward/rewind support in iec958 plugin Alexander E. Patrakov
2014-04-24 11:19 ` David Henningsson
2014-04-24 14:40 ` [PATCH v2] " Alexander E. Patrakov
2014-04-24 23:02 ` Raymond Yau
2014-04-25 6:00 ` Alexander E. Patrakov [this message]
2014-04-25 8:09 ` Clemens Ladisch
2014-04-28 16:10 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5359F9E3.10107@gmail.com \
--to=patrakov@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=david.henningsson@canonical.com \
--cc=superquad.vortex2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox