Archive for January, 2010

Published by Arto Jarvinen on 31 Jan 2010

Threads and devices

“Device” – isn’t that a funny word? I’m not a native English speaker so I don’t know but I get the feeling that engineers are sometimes running out of imagination and sometimes they (or I should really say “we” as I’m as guilty as the next guy) associate along very convoluted paths. Anyway…

The graphics “device” is a piece of software that represents the graphics output unit of the PC. It is in effect a COM object that obeys all the intricate and very mathematical rules of COM programming. It’s today used for pretty much everything you write or draw on the display. In MPC-HC the graphics device sometimes needs to be “reset”, meaning that memory needs to be reallocated due to a new video pixel format or some other reason.

If a COM object like the graphics device is created on one thread and naively destroyed or reset (reallocation of memory) on another, a dangling pointer to the object may remain on the thread of creation. This may cause all kinds of strange behavior. The safest thing (and the recommended thing according to Microsoft docs [1][2]) is therefore to create, reset and destroy the graphics device object on one and the same thread. This is not done in MPC-HC today and my plan is to fix that.

Another funny thing is that the exclusive mode full-screen will keep rendering through ALT+TAB and clicking on other windows, unlike other exclusive mode full-screen applications. The thing with exclusive mode is exactly that an application in this mode is supposed to have exclusive access to the driver without passing through any window manager and without sharing the device with any other application that may bother it. I may need to edit this post later if I find that this is a feature, not a bug. But that will be then.

My plan is to make it possible to toggle between windowed mode and exclusive mode (aka D3D) full-screen while streaming. This worked in my old player so at least it is feasible. But as always, time is scarce so don’t start holding your breath just yet.

Links

[1] IDirect3DDevice9::Reset

[2] Creating a Device (Direct3D 9)

Published by Arto Jarvinen on 06 Jan 2010

Voddler woes

I have just joined as a beta-tester of Voddler, the “Spotify for movies”. It is currently beta-tested in Sweden (only). Unfortunately I don’t have any good news to report yet as I can not get the client up and running at all. It seems to be very sensitive to router settings, firewalls etc. Even disabling every millimeter of protection, and enabling UPNP in the router as per the user guide, I can’t get it to pass the initial test. I’m not alone having these problems it seems.

I do like the idea that the client is built on open source but of course I’m missing a Linux client. The client is still a bit clunky. You can’t use the mouse for instance. That is not a big deal for an HTPC that you control with a remote. It is a bit inconvenient on the desktop though.

I’m sure they (or I) will figure it out eventually. The concept is totally right. I’m a happy subscriber to Spotify Premium and wouldn’t hesitate to shell out a similar amount to get access to a stable stream of good movies.

Unfortunately my small switch broke so there is no easy way currently for me to connect to the Internet directly, without a router. And I will still want to use the program through a router in the end as I want all my computers on the same network. But before that I guess I need a new switch for some unprotected troubleshooting. I did sign up as a beta-tester after all.

Links

[1] www.voddler.com

Published by Arto Jarvinen on 02 Jan 2010

Time to write some code

Christmas
Time to write some code.

Christmas is a blessing in many ways, not the least because I chose to take four days of vacation to catch up with some hobby projects and some horse riding after a hectic fall work-wise. As seen from an earlier post I built a new HTPC and also took time to do some changes in the GothSync code. I was perhaps procrastinating a bit since I was afraid that I had been struck by amnesia and that I would have to learn everything all over again. I haven’t looked much into the code since my summer vacation. Starting from scratch would have been a little bit like going to the gym after half a year of sedentary life: it would have hurt! Luckily some synapses remained intact and it wasn’t too hard to catch up and do what I had planned to do a long time.

I added the Sync Renderer (I will probably drop the “Goth” part for brevity and because it seems to give associations to the kind of music that my teenage son is listening to) as an optional renderer to the regular build of MPC-HC. This means that all the other renderers are intact. When I started experimenting I took a shortcut and hacked away on two of the existing renderers, effectively destroying the original renderers. They are now restored.

The Sync Renderer is now added as the last option in the increasingly long list of available renderers. Once it is selected, further synchronization options can be selected from the Synchronization options page. For more documentation, see the Get started page (may be slightly out of date when I write this).

The new version has been committed into the trunk (main development branch) of MPC-HC at SourceForge. Executables are available through the Download page.

Please give any feedback either as a comment here or on this thread at Doom9′s. Report bugs on the SourceForge bug tracker. (A comment on Doom9′s thread would be useful even if you submit a formal bug report. I haven’t got used to visiting the bug tracker regularly yet since I just recently added my code to MPC-HC trunk.)