[vlc] Allow playback of empty character devices

Ed Schouten ed at fxq.nl
Thu Oct 26 15:29:53 CEST 2006


Hello everyone,

I'm currently working at a project at school to develop a set top box
running FreeBSD. We're using the cxm driver for a Hauppauge TV card. The
cxm driver creates a device, /dev/cxm0, which spits out MPEG-2 generated
by the MPEG-2 encoder on the TV card.

VLC has a check in the file access module to fail when files are empty.
This disallows using the following command:

$ vlc /dev/cxm0

The only thing that works:

$ cat /dev/cxm0 | vlc -

The disadvantage is that FreeBSD spends a lot of time in piperd, sending
data from cat to vlc. The following patch adds a check to make 0 bytes
character devices unseekable:

%%%
--- modules/access/file.c	Sat May  6 17:52:18 2006
+++ modules/access/file.c	Thu Oct 26 15:14:10 2006
@@ -275,6 +275,11 @@
         return VLC_EGENERIC;
     }
 
+    if (S_ISCHR(stat_info.st_mode) && !p_access->info.i_size) {
+        /* Allow playback of empty character devices */
+        p_sys->b_seekable = VLC_FALSE;
+    }
+
     if( p_sys->b_seekable && !p_access->info.i_size )
     {
         /* FIXME that's bad because all others access will be probed */
%%%

Yours,
-- 
 Ed Schouten <ed at fxq.nl>
 WWW: http://g-rave.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc/attachments/20061026/f29f7465/attachment.sig>


More information about the vlc mailing list