moonlight 2.0 preview, WCF, and mooncodecs

| 14 Comments | No TrackBacks

As most of you may know, Moonlight 2.0 preview was released last week. We Japanese are in holiday week, so I blog about it this late. Here I write about two completely different stack; WCF and custom media codecs.

WCF in moonlight 2.0

Mono itself does not officially support WCF, but the development originally started back in late 2005 (there was of course no .NET 3.0). I had been working on several different stuff, but I got back to this WCF land since January to fulfill WCF need in Moonlight.

The entire WCF stack is huge and contains lots of extra(neous) stuff, but the parts used in Silverlight 2.0 is not. There is only BasicHttpBinding without WS-* complication. There is no service stack. There is no System.ServiceModel.Configuration (I hate them!). They have been mostly implemented in the context of full WCF at the time I (re)started the development.

However, there are some parts that are significantly different from the full WCF and/or that need significant rewrite our hacks from years ago. The threading model changes, for example, is totally different (and yes, I like the newer async idea). There is “ServiceReferences.ClientConfig” support instead of the full configuration stack (it is not enabled yet though). There are some new serialization feature such as object reference support.

There are still things marked as TODO on our Status pages, but as far as I know there is no missing major feature.

There is a couple of silverlight sites that used WCF and needed those fixes. Hardrock Memorabria, NBC Olympics (which I cannot really watch the videos from Japan!), OpenStreetMap (the one from figment engine; I took a sshot) or even a helicopter game (no, SOAP does not help your helicopter fly up; it’s all about registering high score).

Now I moved to non-moonlight WCF hacking. WCF in mono is different story, and I’ll write about it too somewhat soon.


In my previous post from about a month ago, I wrote about MoonVorbis and custom media stream support in Silverlight 3. The next day, one of my local mono community friends hacked another custom media stream source for MS IMA ADPCM. Also, no sooner, Olivier Dufour posted C# port of Java Dirac encoder.

They are based on the moonvorbis sample and hence they still need to be improved, but so far I have collected them and put in our svn as module “mooncodecs”. (csdirac was based on full CLR, so the corresponding code in this module includes some fixes by Geoff “kangaroo” Norton).

The project aims to be in uses for Silverlight 3, not only for Moonlight. The each of the codecs has a MonoDevelop solution file, which should work in Visual Studio 2008 too. Also, ideally they should also be useful for non-silverlight environment. I haven’t created solutions for full CLR, but it should be possible.

We welcome more open source managed codec contributions :-)


I have been writing some toy stuff these days. I may write about them too, but not today yet.

No TrackBacks

TrackBack URL:



About csdirac translation of jirac.
The mediastreamsource must be delete.

In fact all video container must be in a single directory :
ogg, wmv, avi, mkv, mpeg,...
we have to cut sound part from video part and use a system to register supported video/soung format in container.

And use a common interface between format.
I see that csogg work only for vorbis currently. But ogg can be use for video and dirac too.

I am working on bitsharp (udp tracker system) currently...
Hope I will have time and motivation to get back to moonlight codec.

Hi Olivier,

Well, yes I know they must be reorganized. Though I thought it had better be imported as they are at the first stage, and then reorder once the development proceeds, depending on the direction.

If things does not go forward, then current layout of the projects is still better than the ideal one. I'll make the changes once I got some time to do it, or my hobby stuff gets to need it.

no problem. You have done well by collapsing all codec but I want to inform you that csdirac is not usable as that and still need some work.

So, today, if one wants to put a video on the web, in a totally open source fashion, what should he do?

- People that use Flash -> plainly wrong, as there's no open source Flash (well, Gnash and the others are pretty immature, please).

- Use Silverlight 1? Shitty JavaScript, and no support of custom codecs.

- Use Silverlight 2? Moonlight is a preview for this version yet, and no support of custom codecs.

- Use Silverlight 3? It's not even released.

So, you cannot put an OGG video on the web today and watch it with a totally open source web browser and open source plugin. Right? How long do we have to wait? I guess this is the reason why Moz guys are pushing for their native-video-support-on-the-browser efforts.

thanks for the link to my OpenStreetMap app - glad it works now!


Well, read the Open Source Definition. There is no term about "release". Any extra condition you mention (such as "released") are not in the terms. They are *your* arbitrary requirements, not about open source. Hence:
> So, you cannot put an OGG video on the web today and watch it with a totally open source web browser
This is wrong.

Probably you assume that Moonlight 2.0 does not support custom media stream. That's wrong. ML2 has a couple of new features in SL3. Check our release notes.

Yeah, sure, but this would work only on Linux. When I mean the web, of course I mean the "cross-platform" web ;)

Then your argument is either based on misunderstanding or of contradiction. Like moonlight 2.0 is released as preview, Silverlight 3 is (of course) released as preview, so
> - Use Silverlight 3? It's not even released.
is just wrong. And anyone can build open source codecs like we do (BTW as I wrote in this entry, it can be used in silverlight 3 too).

Or if you mean "silverlight is not open source" (why do you stick to opensourceness on the proprietary OSes then?) then it contradicts the fact that you listed silverlight 1 to 3 from the first point.

"I guess this is the reason why Moz guys are pushing for their native-video-support-on-the-browser efforts."

So which released version of Moz supports this? Since you're hung up over "already released"ness?

I've just attempted to compile moonvorbis.sln, but it seems that the csvorbis.moonlight project is missing - as are the rest of the files in the csvorbis directory.

Is this an oversight, or am I doing it wrong?


I think there are a few files missing in the csvorbis repository.

/trunk/mooncodecs/csvorbis/csvorbis.sln is looking for csvorbis\csvorbis.csproj and OggDecoder\OggDecoder.csproj


/trunk/mooncodecs/csvorbis/moonvorbis.sln is looking for

Oops, I'm sorry, left your comments without noticing. I'll check those project files tomorrow.

I was just trying the client/server example from wcf part 2. The example works fine. (using Mono 2.6.1)

I modified it to use NetTcpBinding, and return a byte array. When I return a 20 byte array, it works fine. When I return a 2 MB array, it gets an exception about the message size:
Unhandled Exception: System.InvalidOperationException: The message is too large.
at System.ServiceModel.Channels.TcpBinaryFrameManager.ReadSizedChunk () [0x00000] in :0
at System.ServiceModel.Channels.TcpBinaryFrameManager.ReadSizedMessage () [0x00000] in :0

I tried setting MaxReceivedMessageSize and MaxBufferSize on client and server, but it always fails. Any suggestions?


Hi Kris,

You most likely hit some bug, I haven't tried such large message bytes yet. Other than that, I am experiencing some TCP binary messaging issues, which is in fact blocking me to write about tcp bindings :/ I'm going to dig it in depth, so please be patient.

Leave a comment