Purpose: The goal of this project is to allow programmers who create managed applications to use the interfaces in Vista's/Windows 7 Media Foundation. If you are not a programmer, or are not running on Vista (or Windows 7), there is nothing in this project that you are going to find useful.
If you have questions, comments, or just want to offer encouragement, post a message to this project's forum at https://sourceforge.net/p/mfnet/discussion/711229/.
Downloads including samples, library, and the complete source code are at https://sourceforge.net/projects/mfnet/files/.
Related libraries can be found at:
November 22, 2012
I said back in March on the project's home page that I was seeking helpers for work on v2.1. While I heard back from a few people, most disappeared after just 1-2 emails. The amount of actual work provided by volunteers was disappointingly limited.
I found this particularly frustrating, since there really wasn't that much work to be done and it doesn't require particularly advanced programmers to do it. Surely somewhere among the nearly 4,000 downloads since then, there must be at least some folks willing to donate some time.
Still, I myself use a number of OS projects without volunteering to help on them, so I can't really fault people for not stepping up.
But as a result, I am not (currently) planning on doing any more development work on MF.Net.
I will continue to respond to posts in the forum that strike me as interesting, and if people report bugs, I may look at them too. We'll see.
Will I ever do more work on this project? Maybe. But without at least one (and preferably more) committed volunteers to work on it with me, probably not.
As of this posting, all the work I have done post v2.0 is checked into the project's CVS under src and samples. I wanted to make sure none of it would be lost. This work includes a few updates beyond what is in the released downloads. In particular:
I hope that having a centralized place that contains all the classes, structures, enums, and interfaces for Media Foundation is something you are finding useful, and that the samples give you some idea of how to get started with MF.Net. Remember that you have the complete source code to the project (all c#) and in a pinch can resolve any outstanding problems yourself.
March 9, 2012
If you are interested in offering to help with the release of v2.1, see the thread at https://sourceforge.net/projects/mfnet/forums/forum/711231/topic/5104305. If you don't have access to the Developers forum, send me an email at https://sourceforge.net/u/snarfle/profile/send_message.
March 7, 2012
V2.0 has been released and is now ready for download in the Files area. Both the library and the samples have been updated, so make sure you grab the 2.0 version of both.
March 1, 2012
Yes, it has been a while, but I've dusted off the files and am working to release v2.0. I have trimmed down the list of tasks I am trying to achieve for this release by removing #5 (see list below). v2.1 will target these interfaces for testing.
If you are available to help review the beta, check out the thread in the forum (https://sourceforge.net/projects/mfnet/forums/forum/711229/topic/5056914). But hurry. The plan is to ship this on March 7th.
August 22, 2009
There are several tasks I'm trying to accomplish for v2.0:
As of today, the first two items on the list are done and checked in. The samples are probably next on the todo list. If you have any preferences about which interfaces need to go on the list to be tested for v2.0, feel free to share you thoughts in the forum at https://sourceforge.net/forum/message.php?msg_id=7578031. If you are willing to help create the tests for your chosen interface, that's going to push it to the top of the list.
June 10, 2009
In v1.1 I have tested all the Vista MF interfaces I intend to test. Along with the updated library, I have also released an updated samples project which includes my EVRPresenter sample. You can download both of them in the Downloads area.
v2.0 (if and when there is such a thing), will include definitions of the new W7 interfaces. MF only has 20 new interfaces in W7. How hard can it be? v2.0 will probably also use HRESULTS instead of exceptions (see discussion below).
May 21, 2009
I now have a working customer presenter for the EVR written in c#. Woo hoo!
This was a huge project and there was some finicky work required. However, the question now is, what do I do with it? It doesn't really fit as a sample for this project, since it uses DirectShow. And it doesn't fit there cuz it uses MF. It's a little small for its own project. And really, it's pretty complex to even be called a sample.
May 20, 2009
Thank you to all the people who responded to the "Do you want another release?" thread. It always feels good to know people are using what I'm writing.
Since there does appear to be some interest, I've decided to do at least one more release, and possibly two.
In the first release, I am going to attack the remaining Vista interfaces. I have picked out the ones I intend to do and have already started creating tests for them. This includes the last of the easy interfaces, and all of the remaining ones I find to be interesting. If there is some particular interface you need, this would be the time to mention it. Check out your docs\Interfaces.txt for the status of the existing interfaces. If you need an interface enough to request it, be prepared to help create the test for it.
The second release will contain the W7 interfaces. Looks like they added about 20 interfaces. I don't have W7 installed, so I don't yet have a way to write any tests for the new interfaces, but hopefully soon.
And while we are talking about an update to the library, a new question has arisen. There is a major difference between the way DSNet returns errors (uses an HRESULT), and the way MFNet returns errors (throws exceptions). However, I'm considering changing MF to be like DS.
There are several reasons that throwing exceptions are better than returning HRESULTS:
There are also reasons that using HRESULTS are better than exceptions:
As you can see, the benefits for exceptions are mostly cosmetic. The functional items for HRESULTS are rather compelling.
I hate to do it. I *like* the exception model, and I really appreciate the cleaner code that results. But I'm definitely leaning that way. I just created a project where the slow performance of many exceptions being thrown was a problem. So unless someone can throw some weight on the "exceptions" side of the scale, that's probably what I'll do.
If you have any feedback on these subjects, feel free to start a thread over in the forum.
And if I'm going to do this and shatter backward compatibility, it makes sense to do it now, before the big W7 rush of downloads (he dreams).
March 21, 2009
So, here we are a year and a half later. I still haven't really heard any feedback from anyone. To my surprise, there have been over 1,000 downloads of the library. On the other hand, there have been less than 10 threads in the forum over the entire lifetime of the project. I'm interpreting that to mean that while people are grabbing a copy of the library in case they ever need it, very few people are actually using it.
Looking forward, Microsoft has added a bunch of new interfaces to Windows 7 (http://msdn.microsoft.com/en-us/library/bb970511(VS.85).aspx). They are designed to make MF much easier to use, as well as expanding the functionality. Obviously these features will only work in W7 (and beyond).
So, the question is, does anyone think we need to add these definitions to this library? Or is there just not enough interest in using Media Foundation from c# to make it worth the effort?
Post your thoughts here: https://sourceforge.net/forum/message.php?msg_id=6903604.
September 23, 2007
Well, I'm a little late, but it's not my fault! My (only) Vista box died on me. Kinda hard to work on a project that only works on Vista if you don't have any working Vista computers. I just got it back from HP on Friday. I will say that it was a HUGE relief to go back to an operating system that doesn't fight you at every turn for a few days. I may leave this Vista box on the shelf and just use my XP box again. Except when I'm working on this project.
In any case, I've done what I intended to do for v1.0. In fact, I've added even more samples than I intended, so make sure you download both the updated lib, and the updated samples.
I know this release isn't going to be perfect, but until I hear from others, I don't know what else to work on. So, if you like it, hate it, or even if you just use it, drop a note over at the forum (http://sourceforge.net/forum/forum.php?forum_id=711229) and let me know what you think.
Here is a list of interfaces that have been tested for v1.0
These interfaces are defined in the library, but aren't yet tested.
September 1, 2007
I have just checked in the WavSink sample. That's the last of the samples (yay). I've made a number of changes to the library over time, so I'm going to need to re-run the test suite to make sure I haven't broken things that *used* to work. Plan still looks like v1.0 in mid-September.
WavSink, like WavSource has run into an MF bug. There are a couple of Microsoft's COM objects that don't correctly support QueryInterface. Managed code *really* doesn't care for that. So, there are a couple more interfaces in the Alt.cs file. When MS releases fixes, hopefully these declarations won't be needed any more. Using IntPtrs instead of the actual interfaces for these methods works, but eventually I'm sure this is going to be a problem for someone.
Found yet another interesting bug in the PropVariant class. The problem came when a Blob was being sent to an implementation of IMFStreamSink. The code worked correctly, but as the program was ending, the finalizer was called on the PropVariant. This was a real problem since the PropVariant had already been freed by the routine that called me so the finalizer was crashing. I had no business trying to free the thing, it didn't belong to me. Tracking this down took time, but I think I've come up with an elegant solution.
August 21, 2007
I've taken a break from testing interfaces, and have been focusing on converting the MF samples to c#. MF comes with 8 samples and my plan is to convert 7 of them. The 8th (DXVA2_VideoProc) uses DirectX interfaces which are (way) beyond the scope of my efforts for this library. If someone who knows more about DirectDraw wants to step forward and help, that would be great. Failing that, this small corner of MF won't be accessible from managed code.
In the meantime, I have converted 6 of the 7 samples, and have started work on the 7th. Finishing this sample seems like a reasonable milestone, so that's probably the point at which I'll declare v1.0. I've made enough changes now that I want people who are downloading to get that it's probably time. Look for v1.0 in mid-September.
I continue to make minor tweaks to the library. Found an interesting bug in my PropVariant class the other day. The class is declared using LayoutKind.Explicit, so I didn't realize that the VariantType field was overlapping the reserved1 field. Wasn't a problem until I ran into something that was using the reserved1 field. Changing the VariantType to a short (which is what it should have been in the first place) solved the problem.
August 03, 2007
I'm continuing to create tests for interfaces and I have made a number of changes to the existing code. Oddly enough, some code that worked fine in 64bit (my main dev machine) didn't work in 32bit. Required a bit of cleanup.
My original plan was to do a release with just a selection of interfaces. However, I've revised that plan. Now I'm going to see about testing all of them for release v1.0. We'll see.
I've got a total of 4 samples working now:
If you are doing work and need some particular interfaces done sooner rather than later, or are looking for a release with the latest samples/fixes, drop me a note over in the forum and I'll see if I can find a clean stopping point.
July 18, 2007
I have been doing some more work on the library. I now have one more sample (a c# version of MFT_GrayScale), a couple more tested interfaces, and a few fixes for the code that was released in the beta. However, I'm holding off on doing another release until I hear back from people. If you have a minute, please, scribble a few lines for this message thread (http://sourceforge.net/forum/forum.php?thread_id=1781387&forum_id=711229) and let me know what you think of this project.
An interesting note: I was never able to get the DirectShow base classes to work with c#. However, it appears that one of the benefits of Media Foundation is that the re-design is more compatible with managed code (whether by design or just happenstance, I couldn't say). I have now written two "filters" for MF in c#: One a source filter, and one a transform filter. While I haven't done any detailed performance comparisons, they seem to give comparable results to the c++ samples on which they are based.
July 14, 2007
Beta 1 is now ready.
I have created 2 zip files (one for samples, one for the library) and they are available in the Downloads section (see above). I am now looking for people to read the docs, compile/run the samples, and let me know what they think.
July 9, 2007
Much progress has been made. I have changed all the interfaces to remove the PreserveSig attribute, and wrote tests for 33 of them. Next step is to create some documentation.
Sometime in the next few days, I could use some help making sure v1 of the product is ready. If you are interested, drop me a line at https://sourceforge.net/u/snarfle/profile/send_message.
July 1, 2007
Right now, this project is still in its early stages. At this point it is just barely past the "proof of concept" state.
Included in the project is the code for the library, and two samples that use it.
The library has the definitions for all of the Media Foundation interfaces, plus all the structures and enums that they use (at least I *think* it does). It also contains definitions for a few helper classes (MFError, COMBase).
The two samples are translations of the c++ MF samples BasicPlayer and WavSource. Both samples run (at least on my machine). As of today, these samples don't even have readmes. To find out what they do, read the c++ docs for the related sample. To get WavSource to run, you'll also need to know how to use regasm.
I am still planning on large-scale changes to the library. So, while you are welcome to download and study this code, I wouldn't recommend doing any significant development based on it just yet.