All of lore.kernel.org
 help / color / mirror / Atom feed
From: est@hyperreal.org
To: linux-sound@vger.kernel.org
Subject: mp3 seeking
Date: Tue, 26 Oct 1999 17:20:29 +0000	[thread overview]
Message-ID: <marc-linux-sound-94096104300746@msgid-missing> (raw)

Andy Lo A Foe discourseth:
> A segment holds a number of decoded frames (usually 2 or 3) and also
> remembers the number of the first frame. So lets say we want to play 
> a mp3 backwards starting at frame 1000. The tricky part is to keep the
> ringbuffer full with the right frames all the time. As soon as one segment
> is used up by the audio reader thread it releases a semaphore on which the
> audio decoder thread is blocking on. The audio decoder thread wakes up and
> check if there are any segments that needs to be filled. But wait you say,
> what if you need to fill a segment with frames 1000 to 998? Decoding frame
> 1000, then 999 and then 998 won't work because of the way mp3s are
> encoded. What do you do then? You seek to frame 995 and start decoding
> from there. You throw all data away up to and including frame 997. By this
> time your mp3 decoding engine is recovered from the 'seek' operation.

Andy,

First, I must thank you for alsaplayer since I'm using an adaptation
of your adaptation of the mpg123 code in the next major release of
oolaboola.  I'm encapsulating it in a separate process (called
mp3serv) to get re-entrancy.  I may move to the xing decoder but the
process interface will remain the same.

Now to the question of seeking. :)

My understanding was that it *may* take more than 3 frames of priming
to resynchronize.  One of the xing/freemap people got me the logic but
I haven't implemented it yet.

Another issue is how to find a given frame in the first place.  Given
that each frame may have an extra byte of padding, a multiplication is
(audibly!) unreliable.  I've implemented a table-of-contents mechanism
to deal with this.

Best,

Eric

             reply	other threads:[~1999-10-26 17:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-26 17:20 est [this message]
1999-10-27 14:02 ` mp3 seeking Andy Lo A Foe

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=marc-linux-sound-94096104300746@msgid-missing \
    --to=est@hyperreal.org \
    --cc=linux-sound@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.