For video:
Solution #1 is optimal. It is no different from using the Interop library
for DirectShow, the only big difference is that the DX team custom coded a
type library wrapper rather than have one that is auto-generated. This
means they do a lot of the marshalling of various types for you to make your
life easier, and supposedly make the libraries run faster. In most cases,
Managed DirectX is 97% the speed of DirectX accessed through C#. There are
some issues if you are constantly loading resources or changing vertex
buffers since all of this stuff has to be marshalled, but that can be
optimized out in most cases (basically, this can be optimized out for most
cases where you would use C# instead of C++).
Solution #2 is a bit more kludgy than solution #1. You have to learn what
kinds of types are expected in many cases, especially where IntPtr's are
being used and you have to pass things using memory. It is pretty solid
(though so is solution #1, I'm not sure which problems Mike is having) and
you shouldn't have too many problems once you get the initial playback
working.
Solution #3 is probably the easiest. You can use a type library wrapper
around the various components that ships with Media Player and have it play
all of your video back for you. If done correctly you can host a media
player control right inside of your Windows Forms application and fully
customize the playback UI if you desire. I'd say #3 is going to give you
the broadest support for Video, while #1 and #2 are going to offer you more
customization (placing filters in the DirectShow stream for example that
modify the output).
If video is really turning into a big problem for people in the Managed
world speak up. I'd be happy to sit down and write up a couple of tutorials
surrounding the kinds of things I've done with video. I'm guessing most
people haven't put a large amount of time into examining video since the
time to place it in an application versus the pay-off isn't spectacular.
--
Justin Rogers
DigiTec Web Consultants, LLC.
"Michael Mayer" <mi**@mag37.com> wrote in message
news:eI*************@TK2MSFTNGP11.phx.gbl...
"Dafna m" <mo***@012.net.il> wrote in message
news:eX***************@tk2msftngp13.phx.gbl... Please HELP
1. How can I display an array of images from diffrent types(jpeg,
bmp..)(In C#)
Can I also display video files?(In C#)
There are many ways to do this. See PictureBox, and the classes Image and
Bitmap. Note that Bitmap can load from files from many, many types.
This link should give you more than enough info for what you want for
pictures.
http://www.codeproject.com/cs/media/
I'd first look at the article "How to load/display images"
http://www.codeproject.com/cs/media/quickview.asp
As for videos, you have three choices (probably more than this)
1) Managed DirectX 9 and the AudioVideoPlayback class
- Uses all C# code
- Documentation is not very good
- Lots of annoying bugs in the library.
- Requires DirectX 9 is installed on clients.
Here's DirectX9 SDK link:
http://www.microsoft.com/downloads/d...displaylang=en
I found I had to use a LOT of workarounds to get the AudioVideoPlayback to
"play" nicely - but that was only when I started messing with the volume
level of the sound. If you don't mess with volume, it's not too hard to
get this working.
2) DirectX DirectShow and interop
- Uses Interop to get to non-native code (more complicated code)
- Much better documentation
- More stable libraries (less bugs)
- Requires only DirectX 8 or so
There are two articles on the above codeproject link on using this.
3) Use Windows Media Player ActiveX control
I've only used this slightly, didn't have much success myself.
http://msdn.microsoft.com/library/de...9seriessdk.asp
I'll be happy to answer any more detailed (or more specific) questions
that you have.
--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com