pwlib patch for proper video4l device detection

Steve Ames steve at virtual-voodoo.com
Wed Jan 17 19:51:05 UTC 2007


No objections. I don't use video so I'm happy to see patches from people who
are. Instead of using

#if 1

could you use

#if defined(P_FREEBSD)

(or some other FreeBSD specific variable)  instead so that this patch can be
sent upstream and used on both FreeBSD and other OS? I'll happily forward
the patch onto the powers that be at voxgratia.

-Steve

Luigi Rizzo wrote:
> Hi pwlib maintainers (and multimedia people),
> pwlib does the detection of video4linux devices using the
> major/minor numbers, which makes no sense on FreeBSD where
> we have devfs.
>
> The patch at
> http://info.iet.unipi.it/~luigi/FreeBSD/patch-zz-vidinput_v4l fixes
> this - it is relatively simple, see below (apart from
> whitespace issues).
>
> If you don't have objections i would like to commit it to
> the port, so that things like ekiga can access the webcams.
>
> Suitable v4l drivers are
> in ports/multimedia/pwcbsd and at
> http://info.iet.unipi.it/~luigi/FreeBSD/usb-cameras.html
>
> cheers
> luigi
>
> --- plugins/vidinput_v4l/vidinput_v4l.cxx.orig Sat Jun 10 17:57:46
> 2006 +++ plugins/vidinput_v4l/vidinput_v4l.cxx Tue Jan 16 19:19:18
> 2007 @@ -474,7 +474,15 @@
>        if (devdir.GetInfo(info) && info.type ==
>          PFileInfo::CharDevice) { struct stat s;
>          if (lstat(devname, &s) == 0) {
> -
> +#if 1
> +          int l = strlen(filename);
> +          int num = filename[l-1] - '0';
> +          if (filename[0] == 'v' && filename[1] == 'i' &&
> filename[2] == 'd' && +                num >= 0 && num < 10) {
> +        //cout << "reading device " << devname << " minor " << num
> << "\n"; +                 vid.SetAt(num, devname);
> +          }
> +#else
>            static const int deviceNumbers[] = { 81 };
>            for (PINDEX i = 0; i < PARRAYSIZE(deviceNumbers); i++) {
>              if (MAJOR(s.st_rdev) == deviceNumbers[i]) {
> @@ -484,6 +492,7 @@
>                }
>              }
>            }
> +#endif
>          }
>        }
>      }




More information about the freebsd-multimedia mailing list