[gst-devel] Presuming the data flow after EOS & Accessing a file by two applications

Arnout Vandecappelle arnout at mind.be
Thu May 14 18:51:09 CEST 2009


 With the index I mean a table of pointers into the stream that is typically 
used by demuxers to seek in the stream.  When you want to seek to a position 
in time, the demuxer can look up in the index which byte position corresponds 
to that time, and request a seek in bytes upstream.  Typically, this index is 
present in the muxed file.  In a matroska file (which I'm most familiar 
with), the index is written at the end of the file.  Also, it is only written 
when the stream has finished, because before that time the size of the index 
isn't known, nor the offset at which it should be written.

 When parsing a stream, the demuxer will read the index and store it 
internally.  If no index is present, it will typically disable seeking 
altogether.  However, it could also build the index dynamically, based on the 
data that passes through the demuxer.  For every buffer that is pushed out of 
the demuxer, you write its timestamp and offset into the dynamic index.  (Not 
actually for every buffer, the index would become too large...  Let's say 
every 10 keyframes, for instance).

 When seeking with this dynamic index, the behaviour is slightly different 
than with the normal index.  With the dynamic index, it is possible to seek 
forward, beyond the duration already stored in the index.  In that case, you 
shouldn't return an error, but you should continue parsing the stream 
(without pushing out any buffers) until you have the seek position.

 Note that implementing all this is not going to be easy.  It requires a much 
deeper understanding of GStreamer than to implement a new element...

 Regards,
 Arnout

On Thursday 14 May 2009 13:18:52 Jyoti wrote:
> Hi Arnout,
>
> Thanks for the reply and the information about the possible solutions.
>
> I would be greatful if you can tell me more about the index.
> As of my knowledge the index has the info on the number of
>  audio and video streams in media stream, with their proprties (like
> width & height of a video stream). If I am not wrong the "av_write_trailer"
> function in gstffmpegmux.c helps writing the index in muxers.
>
> Now if I am opting fourth option can I parse whole file. As
> the incoming data is from live source, and the duration is not known.
> Can you hint me on how do I build index ?
>
> Thanks.



-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  D206 D44B 5155 DF98 550D  3F2A 2213 88AA A1C7 C933




More information about the gstreamer-devel mailing list