[Live-devel] MPEG2TransportStreamIndexer and pipes

Warren Young warren at etr-usa.com
Wed May 30 11:34:51 PDT 2012


On 5/30/2012 7:22 AM, Anthony Brown wrote:
> rewriting main() to use stdin
> would allow it to be used on the end of a pipe or redirection.... yes?

This much looks easy to do.  The indexer gets its input data from a 
ByteStreamFileSource, and one of its virtual ctors (createNew()) takes a 
FILE* instead of the file name used by the stock version.  Just pass 
"stdin" here.  (http://goo.gl/ymW1e)

> My ultimate goal here is to record a transport stream from firewire and
> write it to disk while simultaneously generating an index file to allow
> me to stream the file with trick play capability while it is still being
> recorded.

This is the hard part.

I assume you're using the live555MediaServer RTSP server here.  It has a 
couple of weaknesses that fight what you want to do.

First, it doesn't keep reloading an index file as it changes on disk. It 
just loads it up once when it creates the stream.

Second and worse, live555MediaServer keeps a cache of stream objects 
indexed by URL, so as long as the URL doesn't change, it will reuse 
existing stream objects.  This means that if the .tsx file doesn't exist 
when the stream starts the first time, each time you request that URL 
and thereby cause the server to re-use its cached copy instead of 
rebuilding it, you don't get trick play support.  Maybe there are ways 
to kick stale streams out of the cache, but our workaround so far has 
been to restart the RTSP server after generating .tsx files for .ts 
files in use.

To get live555MediaServer to do what you want, I'd suggest modifying the 
code to keep the .tsx file's modification time at load time, then before 
each attempt to use info parsed from the .tsx file, check the mtime 
again and reload the data if it's changed.

I hope you provide it as a patch instead of forking your copy, if only 
because it would be a widely useful improvement.

Take a look at this before starting:

	http://www.suacommunity.com/dictionary/stat-entry.php

Notice that there is no _fstat().


More information about the live-devel mailing list