Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using multi input camera(bt878 chip) and have connected two cameras to chip. When I try to get the driver description I am getting only one driver.When I send the command to preview the video I can see the first camera.If I change the frame rate I can see the second camera also.But I am not knowing how to access both the cameras at the same time.(If I try to connect the same driver with the different frame rate its accessing the first camera but not the second camera )

Here is the sample code

VB
Sub LoadDeviceList()
    Dim strName As String = Space(100)
    Dim strVer As String = Space(100)
    Dim bReturn As Boolean
    Dim x As Integer = 0
    Do
        bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)
        If bReturn Then lstDevices.Items.Add(strName.Trim)
        x += 1
    Loop Until bReturn = False
End Sub

Private Sub OpenPreviewWindow()
    Dim iHeight As Integer = picCapture.Height
    Dim iWidth As Integer = picCapture.Width
    hHwnd = capCreateCaptureWindowA("camera1", WS_VISIBLE Or WS_CHILD, 0, 0, 640, 480, picCapture.Handle.ToInt32, 0)
    hHwnd1 = capCreateCaptureWindowA("camera2", WS_VISIBLE Or WS_CHILD, 0, 0, 640, 480, picCapture1.Handle.ToInt32, 0)
    If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
        SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)
        SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)
        SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)
        SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, picCapture.Width, picCapture.Height, SWP_NOMOVE Or SWP_NOZORDER)
        btnSave.Enabled = True
        btnStop.Enabled = True
        btnStart.Enabled = False
    Else
        DestroyWindow(hHwnd)
        btnSave.Enabled = False
    End If

    If SendMessage(hHwnd1, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then

        SendMessage(hHwnd1, WM_CAP_SET_SCALE, True, 0)
        SendMessage(hHwnd1, WM_CAP_SET_PREVIEWRATE, 66, 0)
        SendMessage(hHwnd1, WM_CAP_SET_PREVIEW, True, 0)
        SetWindowPos(hHwnd1, HWND_BOTTOM, 0, 0, picCapture1.Width, picCapture1.Height, SWP_NOMOVE Or SWP_NOZORDER)
        btnSave.Enabled = True
        btnStop.Enabled = True
        btnStart.Enabled = False
    Else
        DestroyWindow(hHwnd)
        btnSave.Enabled = False
    End If
End Sub
Posted
Updated 22-Nov-14 21:40pm
v2
Comments
SoMad 23-Nov-14 3:38am    
How many driver entries do you see for the card in your Windows Device Manager?

If you have an SDK from the manufacturer, do yourself a favor and use that instead of fighting with Video For Windows.

Soren Madsen
krish0969 24-Nov-14 2:41am    
Unfortunately I dont have the SDK.I can see only one driverentry in the device manager for the card
[no name] 24-Nov-14 9:45am    
Create a NEW instance of the capture method. I also agree with SoMad.
krish0969 24-Nov-14 12:56pm    
Hi,
Thanks for the reply .Unfortuantely I dont have the SDK for that .Regarding your reply,I already created a new instance for the capCreateCaptureWindowA for the second camera
hHwnd1 = capCreateCaptureWindowA
Is there any other changes I need to do to make it work.Does Directshow will help me to sort out this issue
[no name] 24-Nov-14 14:28pm    
What do you mean DirectShow? If you mean, DirectX, no.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900