[pvrusb2] MPEG stream distribution

Phil Endecott spam_from_pvrusb2 at chezphil.org
Fri Feb 17 17:54:46 CST 2006


Dear All,

I have been writing some code to distribute an MPEG stream (e.g. from 
the PVRUSB2's /dev/video0) to multiple applications.  (Normally it's not 
possible for more than one process to read from /dev/video0 
simultaneously.)  My code is a simple daemon that opens the input stream 
and accepts TCP connections; each TCP connection gets sent what's 
arriving from the input at that time.  It would be good if the 
connections could be via filesystem nodes rather than TCP sockets; any 
ideas how to do that?

My intention is to add some code to perform synchronisation when a new 
connection is made, i.e. to wait for the next I-frame before starting to 
send data.  But I don't know enough about the MPEG format to do that 
yet, and the applications that I've tried don't seem to complain much 
about being dropped in to the middle of the stream.

One reason why I want this is so that I can capture single-frame 
snapshots without stopping whatever else is listening.  To help with 
this I have another short program that tries to read exactly one 
(I)-frame from its input, and then terminates.

I will make this code available in due course, but I wanted to mention 
it now in case any readers are particularly interested and/or could 
help, especially with the MPEG parsing aspects.

In doing this I have encountered the question of what should happen when 
  an application does not read its input as fast as the MPEG source is 
supplying it.  Mike, what does the driver do in this case?  Is there a 
finite kernel buffer?  If it overruns, is there an error, or is it just 
discarded?

Cheers,

--Phil.



More information about the pvrusb2 mailing list