How to embed vlc in my windows form application with c# - c#

I'm trying to make an app that can control my IP cameras.VLC media player can do this but I don't know how to embed it in my app to add features to it like capture a picture.What should I do?

The VideoLAN Wiki has links about the .Net Interface to VLC as well as C# bindings for libvlc, which is the underlying library of VLC.
You will find there several projects such as VLCdotNet which seems to be something that you can use.
You can also get into the .Net Interface to VLC by looking at the sources of the DMediaPlayer on CodePlex.

Related

Writing a Simple Video Viewer/Frame Grabber in C# for a USB Camera

I'm a complete beginner in C#, but I'm trying to write a very simple application in C# (VS2013) to simply view video stream or capture frames from a Sony FCB-EV7500 camera. The camera connects to a small USB3 board using CN401, and the board connects to the laptop via USB3. I can view video in VLC for example, but i'd like to write code in a C# application to get video/grab frames.
Google searching this brought me to DirectShow which apparently is only a C++ library. There used to be a DirectShow.NET wrapper available here: http://directshownet.sourceforge.net/about.html but it seems they haven't updated the project since 2010 and a lot of functions/interfaces at that time remained untested.
Are there any commonly used libraries for accomplishing this in C#? Perhaps something included in the .NET framework? Thanks for any advice or direction.
You really don't want to be marshaling full frame rate video into a C# application.
You should probably take a look at the .net bindings for gstreamer, I have personally only used the C and python bindings so YMMV. If that doesn't work you will need to:
Use direct show, gstreamer, or ffmpeg to deal with media.
Write a native wrapper around your media handling code.
Write C# code to interop with your wrapper.
depending on if you are using winforms or wpf you will either use a NativeWindow or D3DImageSource as your render target.

How to call a printer with OPOS in Windows 8

I am trying to develop a POS for Windows 8.
Unfortunately I have no experiences with handling external devices like POS-printers, displays , scanners etc.
For this moment I only want to find a way, to print my bills on a POS-printer.
After some research I found out, that there is a driver standard called OPOS. If I understand that right, than every POS-printer which comes with a OPOS-driver can be called in my application. Is that right?
And: if it is: where can I find an implementation for that (or an example) ?
I tried to use Microsoft's "POS for .NET" - but that is very old stuff and does not work in Windows 8 apps.
Can you please give me some tipps and tricks?
Check out http://www.monroecs.com and download the latest Common Control Objects for OPOS (version 1.14 as of this writing.) Then use COM Interop to access them from your .Net app. Or write your code in C++ and interface directly with them.

Get Video from webcam / Ip-camera

I'm trying to implement camera security in my application. I got some SDK's from some security companys to implement there system but they all use ActiveX. My view right now is that ActiveX is kinda old?
But what is the newest way to get video from devices and display (stream) them on a screen?
What control to use in .net 4.5 WPF (and Windows 8)
I'm working on video WPF app for two years now and we had a fundamental problem with video and WPF which was never resolved, and that's variable fps-rate. This blog post goes into details.
There's also a nice library called Media Kit (by Jeremiah Morrill), it might be suitable for your problem.
In our solution we had no choice but to expose HWND's for our rendering DirectX engine. We accomplished this by using HwndHost class and extending it to our custom WPF control. Note this is the base class for windows forms host, so you get the same amount of problems as with WinForms-WPF inter op.
Also, ActiveX is the only way to display professional camera video streams in web interfaces, it's still a defacto industry standard, you'll get it from MOXA, Acti, Vivotek and various other camera equipment manufactureres.
One more thing, if you need to perform some advanced analysis of video, I'd suggest OpenCV.

VLC remotely control from C#

i'm trying to control the VLC Media Player from C#. I tried getting a handle on the window with the FindWindow() command from .Net but as i found out the name of the window changes every time a file is played. The biggest problem i have is sending wm_commands to vlc..This approach worked with Winamp and Windows Media Player but with VLC it appears that it won't work.
I read that VLC can be controlled from a browser but i don't whant that...i've seen in it's settings that it has some hot keys that can be called..but they can be changed and if i call them from my code somehow...and the user changes them..bummer...
i'm a little bit stuck..any help would be fantastic...
Sorin
I have some code that is able to control it using sockets on the RC interface. This worked to a degree but has a lot of quirks. go to full screen seems to do nothing for a few seconds after play is invoked. Overall it sort of works.
The other options are:
Write a DirectDraw filter (very hard) but once this is done VLC can be used instead of or in conjunction with FFMPEG. Existing code that drives media player could use vlc.
Write an interop wrapper for libvlc, recently the VLC team split out libvlccore from libvlc so to the best of my knowledge all the interop is out of date. Once you write a wrapper you could embed vlc in a windows app. (if you need to support x64 you need to compile these libs under x64.
Look through the VLC code and find out if there is a way to send these windows messages.
EDIT This appears to have come out this week.
As Eoin mentioned, libvlc can be used to interact with VLC. As a C# user, you may want to try the .NET bindings offered by the libvlc-sharp project.
Edit: Seems like this project has not been maintained for years. I will leave the link anyway, in case you wish to take a look at it and maybe put some of its source to use.
Have you looked at libvlc
You might be able to wrap that up in a library and interact with VLC through that.
If what you are trying to do is control a previously running executable, check out the Process class to enumerate through all the current processes or do it by name. Check the executable to match vlc.exe. You can then get a handle to the main window and do some P/Invoke to send messages as you are doing with your other executables. This is obviously riddled with potential problems such as if the there are changes to the keyboard shotcuts.
How use libvlc in C++ http://unick-soft.ru/art/files/libvlcProject.zip
I think, use libvlc in C# very similar.
There's also the rc interface and even a telnet one: http://wiki.videolan.org/Console
However, I'd prefer libvlc if possible.

Embedding Flash Player in a C++ or Java application?

I would like to embed Flash Player directly inside a C++ or Java application.
I found an article that describes how to do this for C#:
http://www.adobe.com/devnet/flash/articles/stock_history03.html
Unfortunately, I have no experience with C#, COM or ActiveX. I need someone to translate this code to C++, allowing me to embed the Flash Player into a Win32 Window. Ultimately I'd like to use this information to embed Flash into a Java application.
I am looking for three main functionalities:
Ability to play a Flash movie
Ability to receive events (such as mouse clicks)
Ability to send events
Edit: I prefer an open-source solution if possible.
I don't know how to embed flash in C++, but Christopher Deckers (of SWTSwing fame) has developed an interesting hack which allows it to be embedded in Java. You can find more information in the Javalobby announcement thread.
Here is an updated link: https://github.com/Chrriis/DJ-Native-Swing
I gave the same answer not long ago. Check out SWHX:
http://haxe.org/com/libs/swhx
http://code.google.com/p/screenweaver-hx/
http://code.google.com/p/screenweaver-hx/source/browse/trunk/src/np_host.c
Cheers!
Juan
If it has to be open source I'd consider Gnash, an open source flash implementation.
It works on all major platforms, supports most multimedia codecs and is supposed to be embeddable in applications through nsapi.
If you want to go with a commercial solution, I'd recommend Scaleform GFx. It's not cheap, though, but it's damn good.
One simple way to create a Flash player in your window: AtlAxCreateControlEx.
To receive and send events, you will need a sink: AtlAdvise. You will need to define the functions receiving events on the ActionScript (i.e. Flash) side too.
What you should use is Netscape Plugin API. It's native and it's what all the good browsers use to load flash player plugin. While the actual flash player is not open source, this API is.
If you're not gonna ship a copy of flashplayer with your app:
Your app should check at runtime for flash player and should alert the user if it doesn't find it (usually by giving a link to Adobe to download it).
Flashplayer plugin is usually installed at %AppData%\Mozilla\plugins on Windows.
Take a look at FlashDX. It is open-source and free.
I personally haven't tried this but say in case of SWT/Java you could embed SWT browser window in you SWT/Java application and in the browser view you could put content with flash content, then communicate say with Merapi bridge with flash movie and java.

Categories