Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#116966 - 18/09/2002 15:57 flac/ogg/libmad seeking/skipping/scanning
grgcombs
addict

Registered: 03/07/2001
Posts: 663
Loc: Dallas, TX
I'm looking to figure out how to implement skimming through a track while holding down fast forward or rewind, when using flac/ogg/libmad decoders. If you haven't guessed, this is for RioPlay. Everyone seems to call this functionality by different names, so I figured that I would describe it in long words, as above, to ensure we're on the same page and understand each other.

Each decoder seems to have some similar jargon, but I'm not quite sure if they all do the same thing, and if their "built-in" functionality is at all what we would want to use to implement the desired feature.

FLAC has the following in it's documenation:
Seeking is exposed through the FLAC__seekable_stream_decoder_seek_absolute() method. At any point after the seekable stream decoder has been initialized, the user can call this function to seek to an exact sample within the stream.

LibMAD has mad_stream_skip ... I'm not quite entirely sure what it does and if it's what I'm looking for.

Xiph Ogg has the following functions which may or may not be what I'm looking for: ov_pcm_seek, ov_pcm_seek_page, ov_time_seek.

I guess my question is, when it comes to attemtping to implement this feature, should I try a more generic aproach, like simply reading in a portion of a given file and feeding that little tidbit of data to the proper decoder, and skipping ahead through that file at regular intervals to capture more tiny bits of audio data, dumping it out to the decoder as needed? Or should I continue to explore the built in functionality of each of these decoders to implement this feature?

Greg
_________________________

Top
#116967 - 18/09/2002 17:19 Re: flac/ogg/libmad seeking/skipping/scanning [Re: grgcombs]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
I'd say using the functions provided would be better.

If you seek through the file and provide the decoder with chunks out of it, you'll have to understand the file format to know how big to make the jumps. If you just seek a preset amount for each file type then the jumps in time would vary greatly.

Maybe you could abstract it to an intermediate layer. Then if you ever want to add another codec then it would just a matter of writing the correct module and compiling it in. If you then use dynamic libraries you wouldn't even need to recompile the main app.

- Trevor

Top
#116968 - 18/09/2002 19:22 Re: flac/ogg/libmad seeking/skipping/scanning [Re: tman]
grgcombs
addict

Registered: 03/07/2001
Posts: 663
Loc: Dallas, TX
That's about what I figured ... and what I was afraid of ;-) Now I've got to figure out how to implement this ... Nobody seems to be big on documentation on little used features ;-)

Greg
_________________________

Top
#116969 - 18/09/2002 20:54 RioPlay seeking/skipping/scanning [Re: grgcombs]
grgcombs
addict

Registered: 03/07/2001
Posts: 663
Loc: Dallas, TX
If anyone has a bug that's telling them they should pick up another programming hobby, I would sure like someone to take up this seeking/skipping/scanning business for RioPlay ... I'm totally lost as to where to begin with this black magic stuff.

Greg
_________________________

Top
#116970 - 18/09/2002 22:44 Re: flac/ogg/libmad seeking/skipping/scanning [Re: grgcombs]
jcoalson
new poster

Registered: 04/09/2002
Posts: 15
In reply to:


That's about what I figured ... and what I was afraid of ;-) Now I've got to figure out how to implement this ... Nobody seems to be big on documentation on little used features ;-)




Speaking for FLAC, I would say use the seek routine provided. Lossless streams can have widely fluctuating bitrates and frame sizes. If you don't choose carefully you might not resync and get audio before seeking again.

As for docs... check the flac 1.0.4 beta; all the APIs are documented via Doxygen. Start with doc/html/api/index.html and go from there.

I'll be able to help a little more after the 1.0.4 release goes out this week.

Josh
_________________________
FLAC - Free Lossless Audio Codec

Top