robot9706 / VirtualCameraDriver

Windows virtual camera driver using the AVStream minidriver.
MIT License
154 stars 73 forks source link

Unable to compile #1

Closed Raj123456788 closed 4 years ago

Raj123456788 commented 4 years ago

image Please let me know what I am missing?

robot9706 commented 4 years ago

Windows SDK or WDK.

Check the Windows driver samples repo from Microsoft for info.

Raj123456788 commented 4 years ago

image I have installed both?

Raj123456788 commented 4 years ago

Please answer if possible?

robot9706 commented 4 years ago

Check your include directories and try to build Debug/x86.

Raj123456788 commented 4 years ago

image image The files are there but Still same issue

Raj123456788 commented 4 years ago

Please send me your project property pages. I can try to have the same environment as yours.

Raj123456788 commented 4 years ago

I tried this You need to add WDK headers path to your vcxproj include directories: vcxproj properties -> C/C++ -> General -> Additional Include Directories

C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\km

Now I am getting below error now. 1>------ Rebuild All started: Project: avshws, Configuration: Debug Win32 ------ 1>capture.cpp 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\ntdef.h(201,1): fatal error C1189: #error: "No Target Architecture" 1>device.cpp 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\ntdef.h(201,1): fatal error C1189: #error: "No Target Architecture" 1>filter.cpp 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\ntdef.h(201,1): fatal error C1189: #error: "No Target Architecture" 1>hwsim.cpp 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\ntdef.h(201,1): fatal error C1189: #error: "No Target Architecture" 1>image.cpp 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\ntdef.h(201,1): fatal error C1189: #error: "No Target Architecture" 1>Generating Code... 1>Done building project "avshws.vcxproj" -- FAILED. 1> 1>Project Performance Summary: 1> 613 ms C:\Users\rkulkarni\Downloads\VirtualCameraDriver-master\Driver\avshws\avshws.vcxproj 1 calls 1> 1>Target Performance Summary: 1> 0 ms BeforeClCompile 1 calls 1> 0 ms GetResolvedWinMD 1 calls 1> 0 ms _CheckWindowsSDKInstalled 1 calls 1> 0 ms SetCABuildNativeEnvironmentVariables 1 calls 1> 0 ms BuildCompileTraverse 1 calls 1> 0 ms ExpandSDKReferences 1 calls 1> 0 ms AfterResolveReferences 1 calls 1> 0 ms BuildGenerateSources 1 calls 1> 0 ms InitializeBuildStatus 1 calls 1> 0 ms BuildGenerateSourcesTraverse 1 calls 1> 0 ms BeforeBuildGenerateSources 1 calls 1> 0 ms PreBuildEvent 1 calls 1> 0 ms _SelectedFiles 1 calls 1> 0 ms SelectCustomBuild 1 calls 1> 0 ms ComputeCustomBuildOutput 1 calls 1> 0 ms CopyFileToFolders 1 calls 1> 0 ms _Xsd 1 calls 1> 0 ms MakeDirsForMidl 1 calls 1> 0 ms ComputeMIDLGeneratedCompileInputs 1 calls 1> 0 ms AfterMidl 1 calls 1> 0 ms _Midl 1 calls 1> 0 ms AfterBuildGenerateSources 1 calls 1> 0 ms AfterBuildGenerateSourcesEvent 1 calls 1> 0 ms ComputeCLInputPDBName 1 calls 1> 0 ms _BuildGenerateSourcesAction 1 calls 1> 0 ms ResolveProjectReferences 1 calls 1> 0 ms MakeDirsForCl 1 calls 1> 0 ms _PrepareForRebuild 1 calls 1> 0 ms BeforeRebuild 1 calls 1> 0 ms _PrepareForClean 1 calls 1> 0 ms BeforeClean 1 calls 1> 0 ms FixupCLCompileOptions 1 calls 1> 0 ms AssignProjectConfiguration 1 calls 1> 0 ms _SplitProjectReferencesByFileExistence 1 calls 1> 0 ms PrepareProjectReferences 1 calls 1> 0 ms CleanReferencedProjects 1 calls 1> 0 ms GetFrameworkPaths 1 calls 1> 0 ms ComputeReferenceCLInput 1 calls 1> 0 ms BeforeCppClean 1 calls 1> 0 ms FindReferenceAssembliesForReferences 1 calls 1> 0 ms AfterCppClean 1 calls 1> 0 ms PGInstrumentedClean 1 calls 1> 0 ms CppClean 1 calls 1> 0 ms Clean 1 calls 1> 0 ms _PrepareForBuild 1 calls 1> 0 ms _PrepareForReferenceResolution 1 calls 1> 0 ms BeforeResolveReferences 1 calls 1> 0 ms AfterClean 1 calls 1> 1 ms _CheckForInvalidConfigurationAndPlatform 1 calls 1> 1 ms SelectClCompile 1 calls 1> 1 ms WarnCompileDuplicatedFilename 1 calls 1> 1 ms ResolveAssemblyReferences 1 calls 1> 1 ms CustomBuild 1 calls 1> 1 ms ResolveSDKReferences 1 calls 1> 1 ms GetReferenceAssemblyPaths 1 calls 1> 1 ms CoreCppClean 1 calls 1> 1 ms CleanPublishFolder 1 calls 1> 1 ms _GetProjectReferenceTargetFrameworkProperties 1 calls 1> 1 ms SetTelemetryEnvironmentVariables 1 calls 1> 2 ms PrepareForBuild 1 calls 1> 2 ms SetBuildDefaultEnvironmentVariables 1 calls 1> 2 ms ResolveReferences 1 calls 1> 3 ms CoreClean 1 calls 1> 581 ms ClCompile 1 calls 1> 1>Task Performance Summary: 1> 0 ms Delete 4 calls 1> 0 ms ReadLinesFromFile 2 calls 1> 0 ms FindUnderPath 2 calls 1> 0 ms RemoveDuplicates 1 calls 1> 0 ms MakeDir 7 calls 1> 0 ms WriteLinesToFile 3 calls 1> 0 ms AssignProjectConfiguration 1 calls 1> 0 ms MSBuild 1 calls 1> 0 ms CppClean 1 calls 1> 0 ms CheckVCToolsetVersion 1 calls 1> 0 ms Touch 1 calls 1> 1 ms Message 2 calls 1> 1 ms GetOutOfDateItems 3 calls 1> 2 ms SetEnv 8 calls 1> 581 ms CL 1 calls

robot9706 commented 4 years ago

My "property pages" are in the project file. (https://github.com/robot9706/VirtualCameraDriver/blob/master/Driver/avshws/avshws.vcxproj)

I don't know why it doesn't compile for you. I'm think it's some environment issue. Try compiling a driver from the Microsoft Windows driver samples and follow their tutorial if that works, then this will work too.

Raj123456788 commented 4 years ago

I tried running the UserDriverStaticImage It is giving runtime error also EDSDKLib is missing. My purpose is to send a static image to this driver. How can I install this driver and send the static images? image

Raj123456788 commented 4 years ago

Able to compile now. bcdedit.exe -set TESTSIGNING ON I ran this on command line and installed from .inf file but it still does not install the driver. I don't see the GUID in that userdriverstaticimage dropdown. Almost there please suggest. image

Raj123456788 commented 4 years ago

It should also show in DeviceManager as well.

robot9706 commented 4 years ago

If you'd read the readme you'd know that: UserDriverCanon: This application can push the live view of a Canon EOS camera to the driver, essentially turning it into a webcam. EDSDK not included in this repository!

You also need to copy the DriverInterface.dll to the directory of the app you are trying to use, because it's not found there.

Also if you managed to build the driver, then again from the readme: After building the driver (Windows SDK and Windows Driver Kit required) the inf can be installed using hdwwiz.exe (can be launched in CMD).

Raj123456788 commented 4 years ago

I tried that too on Win 10 image

robot9706 commented 4 years ago

You might need to generate your own key to sign the driver, and install that key to the top level thrusted certificate store (or something like that), also you can only use these drivers if your Windows is in test mode.

You can also check the logfile of the driver installer, it's something like C:\Windows\INF it's called setupapi.dev.log.

Raj123456788 commented 4 years ago

Got it working had to build it as 64bit and it works and shows the image. One last thing EDSDK not included in this repository.Can you please give me the link to download or tell me how can I get one.

robot9706 commented 4 years ago

You can find it on GitHub, but you only need it if you have a Canon EOS camera that you want to use as a video source.

Raj123456788 commented 4 years ago

Thank you very much for your help!

robot9706 commented 4 years ago

You might also need to install the EOS utility to grab the native DLLs for the EDSDK since it's just a wrapper.

Also the are multiple versions of EDSDK, the one used by this project is called EDSDKLib (For example this could work). I cannot include the SDK in this repo because of licensing issues.

Raj123456788 commented 4 years ago

Hey Buddy, I am trying to create a add so that angular apps can also use it. I am getting DeviceEnumeration.obj : error LNK2001: unresolved external symbol IID_IBaseFilter DeviceEnumeration.obj : error LNK2001: unresolved external symbol CLSID_SystemDeviceEnum DeviceEnumeration.obj : error LNK2001: unresolved external symbol CLSID_VideoInputDeviceCategory

Can you educate me what are these symbols?

robot9706 commented 4 years ago

Those are system device enumerator GUIDs, they are part of the Windows SDK (strmiids.lib).

Raj123456788 commented 4 years ago

Hey Buddy, need your help. I am callingin C++: SSetDevice("@device:pnp:\\?\root#unknown#0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global", 80); It is returning 0 why? I just got the string from GetDevicePath. Works in wpf app. What is that I am missing. stuck since 2 days man :( why activeDevice->Init() false?

Raj123456788 commented 4 years ago

tell me what should I pass in SetDevice for SetDevice to return 1? I got the above value from your wpf app.

robot9706 commented 4 years ago

No idea... step through the code to see what goes wrong.

Raj123456788 commented 4 years ago

Cannot step through since I am calling from JavaScript.Apart from Init() is there anything I need to do before calling SetDevice?

robot9706 commented 4 years ago

Nothing afaik, but the threads need to be MTA for the COM interface to work.

Raj123456788 commented 4 years ago

Thanks for the help. I have a request trying to write below C# code in C++ : Can you suggest something(my input is .png) public static bool SetData(IntPtr data, int stride, int width, int height, string opffilename) {

        Bitmap videoBuffer = new Bitmap(opffilename);
        BitmapData imageLock = videoBuffer.LockBits(new Rectangle(0, 0, videoBuffer.Width, videoBuffer.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
        return (Native.SetBuffer(imageLock.Scan0, imageLock.Stride, imageLock.Width, imageLock.Height) > 0);
        //return (Native.SetBuffer(data, stride, width, height) > 0); 
    }

Do I need to edit the driverInterace.cpp? This will be really helpful.

Raj123456788 commented 4 years ago

I figured it out. Thanks!

Raj123456788 commented 4 years ago

still seeing issue with by any chance Bitmap videoBuffer = new Bitmap(opffilename); BitmapData imageLock = videoBuffer.LockBits(new Rectangle(0, 0, videoBuffer.Width, videoBuffer.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); return (Native.SetBuffer(imageLock.Scan0, imageLock.Stride, imageLock.Width, imageLock.Height) > 0); //return (Native.SetBuffer(data, stride, width, height) > 0); } C++ equivalent that I can add to DriverInterface.cpp?