News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

WebCam Video

Started by PriNet, November 28, 2015, 08:50:52 PM

Previous topic - Next topic

PriNet

"hutch"... go figure.... in my quest here, I have seen your name alot... now you can figure out who i is !....Anyway... I'm up upon an issue. I am writing a simple webcam procedure so i can access the camera on one of my computers in the shop so I can just "click the app" and it starts streaming the webcam to my main computer here. Ok, everything was going just fine, until, i tried using the following program on windows 7. No matter what I try, as soon as I start the program, win7 asks for a device in the "built in" video dialog that comes with (I know ancient) the vfw32 api. Unless someone can explain to me how to "set" the device i want (i can figure out which device I want by the "capGetDriverDescription") without the stupid "Video Source Dialog" popping up at initialization ? I have been doing (alot) of research and "almost" come to the conclusion I am going to have to convert to "DirectShow", but, alas, I find very little information on that for MASM(32)... Can anyone let me know how to set the video source I want (possibly how to access the drop down box so I can set it manually?) and get around this? -or- of course I would be happy if someone could point me to some information on how to switch over to "DirectShow" and accomplish the same basic thing I have done already? Again, the internet offers very little for MASM(32)... I am open to any input here, just trying to get rid of the annoying "Source Dialog" window when I can already figure out which one I want. Ok, I hope I explained what I'm after sorta clearish here, so here is the (working) code I promised if anyone else can use it (hopefully you'll put "PriNet" mention somewhere *heh*):

Oh yea, don't bash me too hard on this program... it's my first assembly program since 1980 on an Altair 8086.... *heh*
There has GOT to be a harder way...

hutch--

Hi Gary,

You seem to know more about video than I do as multi-media is not really my area but we do have some members who have experience in this area so they may be able to help you. What you will need is a decent grasp of how MASM works and this will take some practice as you have to master both Intel mnemonics and notation as well as the Windows API function set. Also keep in mind that much of modern graphics is done with libraries that are specific to certain types of video cards so there may not be a lot of processing done at the x86 level.

Farabi

All of my notes was at home, I think I can help you. Somehow Im experimenting on a local wifi server using XAMPP and android. I used Windows 8.1 as the server. I tried using android, but its too small, and it was difficult using Java and OOP, you know, I had some alergic with OOP, each time I saw it, I cant think, I cant remember and I cant learn, not even using google, and each time I saw my manager, sudenly Im afraid and I have to get out of the office  :greensml:

Seriously, once Im experimenting for the local wifi server for the video communication, but you know, I wont using it. If I were younger, I might using it, I`ve forgeting how to use photoshop.  :greensml:

I think if you remind me, on january I'll provide the source.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

PriNet

Thanx for getting back to me so soon guys... I hope I can be helped (beyond a psychologist anyway). And it's too funny cause all of a sudden I'm seeing names & faces of people I recognize from the internet in my little quest here. Thanx again guys, hope to share what I can with all of ya.
-G
There has GOT to be a harder way...

Siekmanski

Hi Gary,

I have a webcam example in DirectShow for you.
I'll post it when I'm at home.

Marinus
Creative coders use backward thinking techniques as a strategy.

PriNet

Yup, I should have signed up here 2 weeks ago !
There has GOT to be a harder way...

Siekmanski

Hi Gary,

This is a DirectShow Direct3D9 WebCam example.
It enumerates all webcams and screen resolutions. ( also HD resolutions )
I made this for my Car Computer to have a front and back camera.
The reason I made it for Direct3D9 is that I can write other stuff on the Camera Screen. ( gps speed rpm gear etc. )

Press F1 to toggle Full Screen.
You can start this example also in Full Screen mode if you want. ( line 1035 D3D9_WebCam.Asm )
Creative coders use backward thinking techniques as a strategy.

PriNet

omg.... *lol*.... that's considerably more complicated !.... ok, let me spend a few days digesting this one....which compiler did you use? I don't recognize the "rap" file ? Thanx "Siekmanski", I appreciate it ! -and- I may be busy trying to understand this one... I really prefer comprehending code rather than copy/paste. And I promise to get your "credit where credit due" in there somewhere *heh* Thanx again.
-G
There has GOT to be a harder way...

Siekmanski

The "rap" file is the project file of the RadASM programming environment.
I used the Masm assembler and linker from Visual Studio 2013 to build this project.

It may look a bit complicated, but that's because Direct3D9 is used in this example.
You can strip that part if you like.

The camera writes it's data to a memory buffer which you can read and copy to your own screen buffer.
So, you don't need Direct3D9.

Look at the "Update_frame" proc  how to fetch the webcam data from the buffer.

    coinvoke g_pSampleGrabber,ISampleGrabber,GetCurrentBuffer,addr Video_buffer_size,pVideo_buffer
Creative coders use backward thinking techniques as a strategy.

PriNet

Well, I'm still digesting this one seikmanski... This is going to take some study, but, thanx muchly, this is going to help I believe, alot.... (of course it would have been easier if the old-school vfw worked...*lol*). I may be gone for awhile researchin'.... but I'll be back with results.... it looked like my vfw example was kinda popular, I'll need to post what I learn from this !
-G
There has GOT to be a harder way...

PriNet

Hate to bother you again siekmanski, but i have been stepping through your code for a few hours now and was starting to transpose it to masm. I can find no reference in masm for a "coinvoke" other than a defined macro. Is this something else specific to radasm? can i port this to "invoke" in masm or is this something different that radasm uses ? i couldn't find any "macro" in your code to define this "coinvoke", if this is just a compiler difference i'll (of course) use masm's "invoke" and then continue with the de-ciphering. Like i say, i like to understand code... copy/paste doesn't teach anyone anything...*lol*
There has GOT to be a harder way...

Siekmanski

DirectShow uses COM.
Coinvoke is a macro for the interfaces used in the Component Object Model. ( COM )
You can find the macro in Includes/dx9macros.inc

All the source code is written in MASM syntax.

I only use RadASM as my programming editor, you can use your own with these MASM-sources.
Creative coders use backward thinking techniques as a strategy.

jj2007

Quote from: PriNet on November 29, 2015, 06:54:07 PMLike i say, i like to understand code... copy/paste doesn't teach anyone anything...*lol*

Gary,

COM is powerful, you can tap lots of interesting stuff, but prepare for a steep learning curve. Few people here can master COM, I have dabbled a bit but nope, I don't master it after ten years of x86 coding. More on this.

Here is a simple example by Vortex.

PriNet

So much for my simple little program... *heh*... but? i'm game,  guess i have alot of research ahead of me. When you quit learning, it's time to buy a plot... Thanx for everyone's direction, i'm off to learn cambodian :)
There has GOT to be a harder way...

Siekmanski

#14
Hi Gary,

Just read your first post again.
As far as I understand the thing is, when you start your app the the source dialog pops up and you don't want this to happen?
Do you have multiple camera's connected to your computer?
Do you want to make a choice which camera to use when you start your app without using the source dialog ?
If so, that can also be done the "old way" with the vfw32 api.

edit: try this example first and than if you like, we can write it the way you want. (i'll have to do some Dutch -> English translations then)
Creative coders use backward thinking techniques as a strategy.