[Live-devel] please help with understanding trick mode

Ross Finlayson finlayson at live555.com
Wed Sep 13 15:37:02 PDT 2006


>I have some questions about understanding trick mode. When I look through
>the WAV and MP3 trick mode implementations, I notice that the file pointers
>are skipped ahead by using the scale factor, like in
>WAVAudioFileSource::doGetNextFrame -->
>
>                                                                            
>  // We read every 'fScaleFactor'th sample:                                 
>  00222     fFrameSize = 0;                                                 
>  00223     while (bytesToRead > 0) {                                       
>  00224       size_t bytesRead = fread(fTo, 1, bytesPerSample, fFid);       
>  00225       if (bytesRead <= 0) break;                                    
>  00226       fTo += bytesRead;                                             
>  00227       fFrameSize += bytesRead;                                      
>  00228       bytesToRead -= bytesRead;                                     
>  00229                                                                     
>  00230       // Seek to the appropriate place for the next sample:         
>  00231       fseek(fFid, (fScaleFactor-1)*bytesPerSample, SEEK_CUR);       
>                                                                            
>  So, what I think this does is: skip a little ahead, read a short sample,  
>  repeat.  So is LIVE actually just playing little "chunks" of the audio    
>  stream

Yes.  This works because samples in WAV audio files are self 
contained, and independent - so it's possible to get n-times speedup 
simply by selecting every nth sample in the file.

Unfortunately many other media types (especially MPEG Transport 
Streams) are not like this, so this simple approach won't work for 
them.

>I also notice this in the FAQ:
>Support for 'trick play' (fast forward and reverse play) on MPEG Transport
>Stream files has been implemented, but as a custom project - not part of
>the public "LIVE555 Streaming Media" source code release. (It is possible,
>however, that sometime in late 2006, similar functionality might also
>become part of the public "LIVE555 Streaming Media" code.)
>Any updates to this information?

Yes.  Replace "possible" with "likely".
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list