[Live-devel] please help with understanding trick mode

xcsmith at rockwellcollins.com xcsmith at rockwellcollins.com
Wed Sep 13 13:54:44 PDT 2006


Hello LIVE!

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, instead of simulating what an analog tape would sound like(you     
 hear everything, but at a higher pitch)if you played it faster?            
                                                                            
 I am looking at this code because I want to have trick mode available to a 
 client that can only read Transport Streams.  I don't think it will work   
 to just skip the file pointer a little ahead in a TS file?  Also, my TS    
 files will contain 1 MPEG2 video ES and 1 MPEG2 audio ES, both of them     
 synchronized with TS PCR set. Doesn't a decoder expect that only video key 
 frames will be sent during trick mode?  I don't see any way to set a       
 constant so that if I seek my file pointer ahead in my file by that        
 amount, I will get a key frame on my next call to doGetNextFrame().        
                                                                            
 So, now I have to rip out my ES streams, parse them out so I can set       
 DSM-CC trick mode flags, find only the key frames, and put just the key    
 frames back in a transport stream to send?                                 
                                                                            
 Can you please tell me if I am thinking the correct way about this, and/or 
 provide advice on how to approach this problem?  I've tried to understand  
 it by reading the FAQ, but I don't understand how it can work to jump the  
 file pointer ahead in my TS file by a set amount, or how doing so can set  
 the DSM-CC trick mode flag so that the decoder will ignore ES presentation 
 times.                                                                     
                                                                            
                                                                            


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?

Thanks!
~Medra



More information about the live-devel mailing list