jb, 28y

VideoLAN

VLC media player development and general info on VideoLAN.

Entries feed - Comments feed

Sunday, June 9 2013

Follow-up report about the WinRT port

News

Hello,

Like last post, I've spent too much time working on VLC than writing updates and communicating, and I'm sorry again.

We are still working a lot of time, with almost a couple of persons spending most of their time on the WinRT port of VLC media player.

The biggest issue is that we have not managed to pass the store validation yet, because the VLC backend is not ready yet. I'll explain in this blog post where we are.

VLC backend on WinRT

Reminder: So, the core of VLC and most of the modules, named libVLC, are the target to adapt to run on WinRT. The UI will integrate this core to show the videos.

As I previously explained, the build process of VLC is not integrated with Windows Tools, notably Visual Studio, because VLC uses Unix Tools to run on all platforms. This is one of the reasons why VLC media player works on Windows, Linux, BSD, Solaris, iOS, Android, OS/2 and so many other operating systems.

The main objective of the KickStarter was the compliance of this core to the WinRT Store Application limitations. We're almost there, but not quite.

The issues we were facing with the compliance were mainly 2 things:

  • Extra Security,
  • Forbidden APIs.

The security enforcements (SafeSEH, packagedlibraries) where quickly done (and backported to the main VLC port). The forbidden symbols were a bit more complex.

Forbidden calls

When we started the project, we had over 600 unique symbols (Windows API calls) used in VLC, for a total of over 15000.

We are now at 16 left. And 32 more if we activate the networking code. This is cool, but not enough, since we must be at 0 to enter the store.

I'll explain now how we did it.

Simple symbols replacements

Some symbols were easy to replace, when you knew that you are targeting only Windows 8, because they had some similar methods.

So, for each symbol, we provided a replacement with a newer API. This was quite long, but easy to do :)

You can see the result of our work here: mingw-w64 code.

Removal of code and Unicode

The second part was to remove some code in VLC that was not meant to be used in WinRT mode; this was mostly the code for the Console, the multimedia timers and some NT services. This improved the port of VLC media player for Windows, not only the one on WinRT.

We also removed some code from libVLC to move it to VLC, when it made sense. This is a good move for libVLC, in general.

Finally, we moved all the code of VLC and the dependencies (8 millions LoC) to UNICODE and Wide Chars. Once again, a task not too difficult, but a bit boring and long.

Most of that part was done mid-March. Then we hit a wall.

MSVCRT

The wall is called MSVCRT, aka Microsoft C Runtime, the equivalent of the libc, the C standard library,

Every version of Visual Studio and Windows comes with a new version, with version numbers from 2.0 to 11.0. It is often a dependency headache for big projects. Most open source projects use the old version named msvcrt.dll, the version 6.0.

But on WinRT, one MUST use MSVCRT 11.0 in order to pass the validation. This meant that we had to modify our compiler and toolchain to be able to link with this version.

This took us weeks of work, reading documentation, testing, asking Microsoft, doing it step by step and finally arriving to the result.

First, we had some mismatch between Debug and Release versions of the libraries when trying the validation. But as we were doing it manually, it was quite hard to understand what was going on, and the documentation was very scarce.

And then, running the application with MSVCRT 110 was just crashing without meaningful messages or usable debug reports or crashes.

When we asked Microsoft, some engineers told us that this could not possibly succeed, since the validation would not allow application compiled with 3rd party compilers to link with MSVCRT110. We did not want to believe them, since this would have killed the project.

And, they were wrong. We did it, but this took us way more time than anything we had anticipated. The final work was shared and integrated in our toolchain, Mingw-W64. All other open source applications will benefit from that, from now on.

COM RoAPI

So, the final piece is composed of symbols that only have replacements using the WinRT APIs.

Those WinRT APIs are a bit like extensions of Windows COM APIs. They work in a similar way, and are usable with methods similar to CoCreateInstance, named RoActivateInstance. However, they are not the same. People using Visual Studio, use a language named C++/CX that has a bit of magic to hide all the details.

But, of course, we need Visual Studio to use C++/CX. And we have GCC, targeting C code :D
Again, accessing those APIs directly from C code compiled with GCC should not be possible (according to some engineers), but we have been trying that path for quite a bit of time.

2 weeks ago, we had a good success: we were able to call a simple functions from a sample code, using RoActivateInstance. So, the hardest part was done.

What we are doing now is just rewriting the Microsoft WinRT headers and adapting the toolchain to munch those and call those symbols. We're working full time on that part!

Conclusion: tl;dr

It's been a hard time working on this port, with many more technical issues than expected. Therefore, we've been slower than expected.

We've done things that people (even from Microsoft) advised us against, and so far we've passed all the issues. So a great outcome is arriving!

We have a bit of work still to go on rewriting the headers to call the new WinRT APIs, and kill the remaining 16 symbols. We're working full time to fix those! :)

Tuesday, April 2 2013

New report about the WinRT port

News and Excuses

I must start this post by sharing some excuses of not doing enough updates lately.

The main reason is that we've been mostly under-water with the current development, that took most of our time.

News and report

The good news is that we have had tremendous progress...

The bad is that we have still a bit of work to do before sharing it on the store, as I will explain soon.

Pictures

But first, the current pictures:

Current start screen

Metro Start Screen

Metro Main Screen

Fully working playback

Metro Playback

Metro Playback 2

Technical update

If you followed closely, our main work, in addition to the UI, was to fight and replace the forbidden symbols not allowed on Windows App Store mode.

We've been quite efficient at that, working closely with Mingw-w64 project and GCC developers.

The biggest result is that we have now cut down 90% of our symbols, that are forbidden on Metro Mode.

We mostly did this by:

  • replacing our forbidden calls with newer authorized equivalent calls,
  • modifying gcc and Mingw-w64,
  • writing new code in a special library of ours,
  • writing dummy functions,
  • disabling VLC code that would not work on the Metro platform,
  • moving VLC to MSVCRT 11.0,
  • moving all the VLC codebase to UNICODE and WideChars to fit the new requirements.

We did also a lot of minor things to help the integration of libVLC and VLC in this modern platform.

What are we working on now:

We are now mainly working on 2 things:

  • make VLC work with MSVCRT 11.0 without crashing ;)
  • write headers and C/C++ code to access the new fashion of COM APIs in which WinRT is written in.

What we are gonna work just after:

  • ARM, ARM, ARM,
  • WP8

Goodies

They are gonna get shipped soon :)

Wednesday, February 13 2013

Over 25000!

After my 20000 mark, I have now over 25,000 posts on the Videolan Forums...

You can check my profile.

Of course, I am getting closer to VLC_help, who is at 25,600+ posts... And the total number of post is above 32000.

The usual amount of trolls, aggressions and misunderstanding are still present, because most people still do not understand the concepts of volunteer, open source and free. But well, haters gonna hate.

Tuesday, February 12 2013

Technical update on the WinRT port

Status

So, a few weeks have passed, and I have not spoken a lot about the port on WinRT/Metro/Windows RT/WP8.

Of course, some of you will complain, but the main reason for that, is that I've been very busy on VLC :)

So here is what we did :)

VLC engine

The biggest part of the work resides in the port of the VLC engine to a WinRT compatible runtime.

A lot of the work we've done so far has been on that.

More specifically, we have:

  • ported VLC APIs call to UNICODE (wide chars),
  • allowed VLC to be compiled for Windows 8 API targets,
  • upgraded some VLC Win32 API calls,
  • removed some code-path when compiling for WinRT,
  • fixed some issues on mingw-w64 toolchain for Windows 8,
  • prepared a compatibility library,
  • changed our packaging for WinRT,
  • improved our audio output for Windows.

Winstore compatibility library

A lot of work has been and will be on this library, so let me speak a bit more about it.

Instead of ifdef-ing the VLC code everywhere for WinRT, we decided to reimplement the forbidden calls in a library that would expose the same old Win32 functions, but implemented with the allowed APIs.

The biggest advantage of this approach is that you don't need to modify a lot of your common codebase, and that you don't need to hack all the libraries that are linked to VLC. And this would have been a huge task. Moreover, it allows to adapt to newer versions of Windows more easily. Moreover, this library will be usable by every other project.

But as you can imagine, doing that is quite tricky, since we don't modify VLC, we don't modify the headers, but we insert it at link time...

We have done some of the work, but we still have a huge amount of work to do, notably on threads and Winsock reimplementation.

This library is hosted in the mingw-w64 repository and will be my focus for a bit of time.

Application

Above the VLC engine (libVLC), we have a CX/C++ wrapper, in order to expose VLC functions to the application, since libVLC is plain C, and it is compiled in Visual Studio.

Above the wrapper, we have the main application.

This application is written in C#, compiled in Visual Studio, and uses the wrapper in order to access playback functions.

So far, the application has a basic media library, and playback support using VLC engine. The media library UI follows more or less what we've shown in the KickStarter. The player UI wasn't shown, but it looks a bit like the normal Video application, in order to match the official style.

The video, so far, is rendered into a memory buffer from libVLC and then is displayed using Direct2D in a video surface. This is not yet the best method, but it is good enough for now.

What's next

So, what are we going to work on now:

  • the winstore compat library
  • the winstore compat library (threads) ,
  • the winstore compat library (MSVCRT),
  • the interface, in order to match our promises,
  • the audio and video outputs, to go faster.

A lot of the work is going to go faster now that we have done correctly the beginning and a beta as soon as possible for our backers.

Monday, February 11 2013

Opinion sur la consultation publique lancée par la Hadopi

Sur l’initiative de la consultation publique

Au début de l’année 2012, VideoLAN a saisi la Hadopi, dans la cadre de sa mission de régulation des mesures techniques de protection, sur la question suivante :

De quelle manière l’association VideoLAN, éditrice du logiciel libre VLC media player, peut-elle mettre à disposition des utilisateurs une version du logiciel VLC media player permettant la lecture de l’ensemble des disques couramment regroupés sous l’appellation « Blu-Ray » et comportant des mesures techniques de protection (MTP), dans le respect de ses statuts et de l’esprit du logiciel ?

Cette question est posée à la Hadopi en sa qualité d’autorité publique indépendante, dotée, par application des dispositions de l’article L.331-36 du Code de la propriété intellectuelle, du pouvoir de rendre un avis sur toute question relative à l’interopérabilité et donc d’interpréter les dispositions en la matière.

Le 6 février 2013, VideoLAN a appris que la Hadopi avait ouvert une consultation publique spécifiquement sur la question qui lui est posée et sur laquelle elle doit répondre depuis maintenant plus d’un an.

Malgré la demande de la Hadopi, VideoLAN ne peut répondre officiellement à cette consultation publique, dans les modalités prescrites. En effet, l’association ne peut être à la fois demandeur à la saisine et consultant « disposant d’une expertise dans ce domaine ».

Ainsi, nous entendons informer le plus grand nombre de son argumentation juridique relative à la notion d’information essentielle à l’interopérabilité.

Vous pouvez trouvez ici, en pdf, une opinion sur le sujet.

Tuesday, December 11 2012

Why we need a KickStarter for VLC on Metro

KickStarter for VLC on Metro

As you might have heard, some developers of the VideoLAN team have started a kickstarter quest to crowdfound a port of VLC on WinRT.

The reason for this kickstarter is that porting VLC to WinRT will be hard and long, if we don't speed it up.

And yet, quite a few people seem to think the task will be simple, like on neowin or Hacker News.

I'm all for funding 40k pounds for VLC (they deserve it), but 40k under the guise of Metro seems a bit much, no?

I dont know but just creating a metro UI shouldn't be that hard should it?

The Windows RT app should be trivial to make... As long as they aren't using Win32 API's, it should just be a matter of recompiling for RT and correcting whatever few bugs they encounter.

Well, no, this is not too much.
We are not the kind of person asking money for nothing, I think we've proven that during all those years.

Let me explain why.

Why we need a KickStarter for VLC on Metro

Designing a UI above VLC, for the "Modern Experience" is quite easy, and we've already done a few proofs of concept.
Finding a designer would be simple and 1k$ for the project would be too much already :) It would take a couple of months and we would be done with it.

The issue is to get on the store. And this is hard.

Why is that?

VLC (and its underlying libraries, including codecs, networking access or demuxers) represents around 7 Million Lines of Code in C, C++ and ASM languages. And all of this code is following C99 standard and has inline ASM.

Visual Studio cannot eat that code in any way. Believe me, we tried. A lot. So we need to compile the VLC for Windows on Linux, using gcc and mingw.

Unfortunately, this does not work on WinRT ("Modern UI" or whatever you like to call it). WinRT restricts a lot the Win32 APIs. And only the Windows Store knows which ones are allowed.

For example, the BSD sockets are gone... Yes, this is not a joke.
They work on Linux, Windows, Mac, iOS, Solaris, Android, QNX, WP8, WinCE but not WinRT.

Roadmap

So, we need to:

  • change and update our toolchains,
  • fix MingW for WinRT, in the best way we can,
  • link to the newer Windows runtime,
  • list the problematic APIs,
  • rewrite the code that is using Win32 APIs since 10 years (and in all underlying libraries too...),
  • drop some modules or isolate some code,
  • write new replacement code,
  • write a new interface above all this,
  • design the interface correctly,
  • fix the code using windows HWND,
  • port the audio and video outputs,
  • work-around the sandbox for DVD and BluRay playback,
  • probably write a WinSock2 replacement library to build all the cross-platform libraries that expect a BSD-socket-like library,
  • port to ARM,
  • etc...

Add to that the need to modify MingW to output dlls that we can load on ARM (Windows RT) and do the same project for the different APIs present on WP8.

Conclusion

As you can see, a lot of the work is not really on VLC, but on being able to compile for WinRT with open source tools, since Microsoft tools are not enough. And a lot of work will be work-around the limitations of WinRT.

Of course, a lot of the work will be re-usable to other projects.

So, yes, we will need quite a few developers to do all that. We can do the Android route, and it might take a couple of years to get it there, or we can try to get some money to speed it up...

- page 1 of 24


Jean-Baptiste KEMPF | jean-baptiste.kempf _(at)_ via.ecp.fr | Powered by Chaussure | xHtml et CSS valide