Video capture class with 5 tests.
Update
Okay, just finished setting up all this on my other computer which has a ATI TV card in it. test01 was a success with it.
Now, the TV card is /dev/video0. How do I access video1 and video2 ? Which is the other webcams I have.
n2c
Now, the TV card is /dev/video0. How do I access video1 and video2 ? Which is the other webcams I have.
n2c
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
from my *.bi file sorry i can't test it self ATM i'm not at home and here are only windows without any cam.
Joshy
try this (it's normaly simple but without linux)
Code: Select all
' if your video device are not on /dev/video0 or
' you switch to an other device you can change it
' with dev.Device "/dev/the_other_name"
' NOTE: any open device will be disconnect and closed
' any fbgfx Image as capture target must be recreated
' ImageDestroy Image
' dev.Device="/dev/video1"
' if dev.IsError then print dev.LastError
' Image=ImageCreate(dev.CurentWidth,dev.CurentHeight)
' dev.FillImage Image
Joshy
try this (it's normaly simple but without linux)
Code: Select all
#include "v4l1device.bi"
'
' main
'
Dim As V4L1DEVICE Dev
Dim As Any Ptr Img
If Dev.IsError Then
Print Dev.LastError
Beep:Sleep:End 1
End If
Dev.Device="/dev/video1"
If Dev.IsError Then
Print Dev.LastError
Beep:Sleep:End 1
End If
ScreenRes Dev.CurentWidth,Dev.CurentHeight,24
Img=ImageCreate(Dev.CurentWidth,Dev.CurentHeight)
dev.Connect
dev.FillImage Img
Put (0,0),Img
Sleep
So far, I get nothing when trying to access the webcams on either computer.
One computer I'm doing most of the testing on, has only one video capture dev, the philips webcam. And is /dev/video0.
I also tried what you have posted above, with /dev/video2. Which is a Logitech Zoom, and I think it uses the pwc driver. Anyway it works under camstream.
n2c
One computer I'm doing most of the testing on, has only one video capture dev, the philips webcam. And is /dev/video0.
I also tried what you have posted above, with /dev/video2. Which is a Logitech Zoom, and I think it uses the pwc driver. Anyway it works under camstream.
n2c
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
That's seams to be a great contrib Joshy
But all your test program fails to open my video device
"/dev/video0"
it says : V4L1 can't open [/dev/video0] !
but the device exist and works!
So I just look around and I guess that you expect a 32 bit architecture.... you use ASM INT &h80 to invoke kernel service...
but I swear this way do not work under 64 bits (have to use SYSCALL instead...)
That my guess by looking around with Google .... I 'm dummy with Linux and ASM together.
Hope you will succeed to fix that ... Your contrib looks really great
But all your test program fails to open my video device
"/dev/video0"
it says : V4L1 can't open [/dev/video0] !
but the device exist and works!
So I just look around and I guess that you expect a 32 bit architecture.... you use ASM INT &h80 to invoke kernel service...
but I swear this way do not work under 64 bits (have to use SYSCALL instead...)
That my guess by looking around with Google .... I 'm dummy with Linux and ASM together.
Hope you will succeed to fix that ... Your contrib looks really great
Here a quick and dirty implementation that works with my webcam on my linux (OpenSuse 10.3 x86_64)
Code: Select all
' Test for redcrab's webcam : fbvideo.bas
' default webcam at /dev/video0
' default webcam config : BGR 888 per pixel, 640x480
' Display the webcam image in a window with default config
#define W 640
#define H 480
dim n as integer
dim d as ubyte
dim scr as ubyte ptr
dim as integer i,maxi
n = freefile
screenres W,H,32
open PIPE "cat /dev/video0" for input as #n
maxi = W * H * 4
i = 0
screenlock
scr = screenptr
while not eof(n)
get #n,,d,1
scr[i]=d
i = i +1
if (i mod 4) = 3 then i=i+1
if i >= maxi then
screenunlock
screensync
i=0
screenlock
end if
if multikey(1) then exit while
wend
screenunlock
close #n
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
*bump*
hello redcrab
if you have connected your video device and any other app is capturing can you post the result of lsmod (as root) please?
kernals>=2.6.2 will often use VFL2 and my code is based on VFL1
on my distro is an layer (modul) to make VFL1 usable with VFL2
this is why i will see you lsmod output
now i have six cams tested on Win and Lin with my code without any problem's
(of course without any complex codec simple RGB capturing)
thanx joshy
hello redcrab
if you have connected your video device and any other app is capturing can you post the result of lsmod (as root) please?
kernals>=2.6.2 will often use VFL2 and my code is based on VFL1
on my distro is an layer (modul) to make VFL1 usable with VFL2
this is why i will see you lsmod output
now i have six cams tested on Win and Lin with my code without any problem's
(of course without any complex codec simple RGB capturing)
thanx joshy
pretty nice but you should not call the linux APIs by interrupt. It's not just
a bad idea doing this on your own. It's a bad idea to call them by software
interrupt since they are damn slow...
On pentium 2 and newer there are a special asm opcodes for doing
system calls (sysenter / sysexit).
http://manugarg.googlepages.com/systemc ... ux2_6.html
a bad idea doing this on your own. It's a bad idea to call them by software
interrupt since they are damn slow...
On pentium 2 and newer there are a special asm opcodes for doing
system calls (sysenter / sysexit).
http://manugarg.googlepages.com/systemc ... ux2_6.html
-
- Posts: 206
- Joined: Aug 27, 2005 2:02
- Location: Istanbul, Turkey
I was just trying this on a Ubuntu netbook, with n build in camera (/dev/video0) and an external webcam (/dev/video1), But with both devices I get, when running test01.bas:
V4L1 can't open [/dev/video0] ! or
V4L1 can't open [/dev/video1] !
Some details about the camera's:
V4L1 can't open [/dev/video0] ! or
V4L1 can't open [/dev/video1] !
Some details about the camera's:
Code: Select all
P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/video4linux/video1
N: video1
S: char/81:1
S: v4l/by-id/usb-046d_Camera-video-index0
S: v4l/by-path/pci-0000:00:1d.0-usb-0:1:1.0-video-index0
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/video4linux/video1
E: MAJOR=81
E: MINOR=1
E: DEVNAME=/dev/video1
E: SUBSYSTEM=video4linux
E: ID_V4L_VERSION=2
E: ID_V4L_PRODUCT=Camera
E: ID_V4L_CAPABILITIES=:capture:
E: ID_VENDOR=046d
E: ID_VENDOR_ENC=046d
E: ID_VENDOR_ID=046d
E: ID_MODEL=Camera
E: ID_MODEL_ENC=Camera
E: ID_MODEL_ID=0840
E: ID_REVISION=0100
E: ID_SERIAL=046d_Camera
E: ID_TYPE=generic
E: ID_BUS=usb
E: ID_USB_INTERFACES=:ffffff:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=STV06xx
E: ID_PATH=pci-0000:00:1d.0-usb-0:1:1.0
E: ACL_MANAGE=1
E: DEVLINKS=/dev/char/81:1 /dev/v4l/by-id/usb-046d_Camera-video-index0 /dev/v4l/by-path/pci-0000:00:1d.0-usb-0:1:1.0-video-index0
P: /devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8:1.0/video4linux/video0
N: video0
S: char/81:0
S: v4l/by-id/usb-Namuga._WebCam_SCB-0340N-video-index0
S: v4l/by-path/pci-0000:00:1d.7-usb-0:8:1.0-video-index0
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8:1.0/video4linux/video0
E: MAJOR=81
E: MINOR=0
E: DEVNAME=/dev/video0
E: SUBSYSTEM=video4linux
E: ID_V4L_VERSION=2
E: ID_V4L_PRODUCT=WebCam SCB-0340N
E: ID_V4L_CAPABILITIES=:capture:
E: ID_VENDOR=Namuga.
E: ID_VENDOR_ENC=Namuga.
E: ID_VENDOR_ID=0ac8
E: ID_MODEL=WebCam_SCB-0340N
E: ID_MODEL_ENC=WebCam\x20SCB-0340N
E: ID_MODEL_ID=c33f
E: ID_REVISION=0100
E: ID_SERIAL=Namuga._WebCam_SCB-0340N
E: ID_TYPE=video
E: ID_BUS=usb
E: ID_USB_INTERFACES=:0e0100:0e0200:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=uvcvideo
E: ID_PATH=pci-0000:00:1d.7-usb-0:8:1.0
E: ACL_MANAGE=1
E: DEVLINKS=/dev/char/81:0 /dev/v4l/by-id/usb-Namuga._WebCam_SCB-0340N-video-index0 /dev/v4l/by-path/pci-0000:00:1d.7-usb-0:8:1.0-video-index0
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
badidea wrote:I was just trying this on a Ubuntu netbook, with n build in camera (/dev/video0) and an external webcam (/dev/video1), But with both devices I get, when running test01.bas:
V4L1 can't open [/dev/video0] ! or
V4L1 can't open [/dev/video1] !
Your devices are V4L2 only.E: ID_V4L_VERSION=2
My devices are V4L V2 devices too but it has modules for V4L V1 too.
The *.bi file is old and video 4 linux V1 compatible.
You need a V4LV2 include file.
Joshy
Ok, thanks for explaining.
I guess a "V4LV2 include file" has not been made by anyone yet? Would it be a lot of work to do this?
Edit:
Looking at this document http://v4l2spec.bytesex.org/spec-single/v4l2.html the answer to my 2nd question probably is: yes.
I guess a "V4LV2 include file" has not been made by anyone yet? Would it be a lot of work to do this?
Edit:
Looking at this document http://v4l2spec.bytesex.org/spec-single/v4l2.html the answer to my 2nd question probably is: yes.
Re: Video capture class with 5 tests.
How can i get it work on ARM with these ASM inline?