[Live-devel] Read from device file problem

Gordon Smith spider.karma+live555.com at gmail.com
Thu Apr 2 10:06:52 PDT 2009


On Tue, Mar 31, 2009 at 2:10 PM, Gordon Smith
<spider.karma+live555.com at gmail.com> wrote:
>
> Hello -
>
> After modification for input of filename, testMPEG2TransportStreamer
> can read from pipe, but not read directly from device file.
> The fread() in ByteStreamFileSource returns EIO and reads zero bytes
> for direct read.
>
> Device file /dev/video2 is saa7134-empress device on Linux debian
> 2.6.26-1-686, live-2009-03-22, latest v4l-dvb modules.
>
> Reading /dev/video2 directly results in EIO and zero bytes read.
>
>   $ sudo ./testMPEG2TransportStreamer /dev/video2

FYI, I modified testMPEG2TransportStreamer, ByteStreamFileSource,
FramedFileSource and InputFile and was able to read a v4l2 device
file.

The modifications did the following:
  - Use low level I/O: open, read, etc. in place of fread, etc.
  - Use select (with timeout) before call to read
  - Ignore EIO (2 or 3 occur at startup but shouldn't)
  - Remove file seek

> FYI, using cat piped to testMPEG2TransportStreamer starts well, but
> begins to continuously lose data after about 2 to 4 minutes.
> Using setvbuf to increase buffer to 32k or 64k did not help.
>
>   $ cat /dev/video2 | sudo ./testMPEG2TransportStreamer stdin
>

I still get data loss after a few minutes with direct read, but that
may be a problem with the device module.

- Gordon


More information about the live-devel mailing list