[vlc-devel] Fwd: SoC 3D Stereoscopy update

Andrew Price messiahandrw at gmail.com
Wed May 25 10:35:27 CEST 2011

Hello everyone!

I'm going to follow to introduce myself and my project and where I am up to.

I'm Andrew Price, a Computer Science Honours student from the University of
Adelaide in South Australia. For SoC 2011 I will be
adding stereoscopic (3D!) support to VLC. I posted a much larger proposal
(several pages long) a while ago on the mailing list with a really in-depth
description of my project.

For the first stage I'm working on getting side-by-side 3D (SBS) videos
working with the nVidia 3D Vision Kit on Windows. Eventually I will support
alternative input formats and different display formats (eventually support
the red/cyan anaglyph glasses and 3D TVs).

Right now I'm focusing purely on the nVidia 3D Vision shutter glasses for
the first stage of my project. It was actually really simple to get this
working straight away on Windows in VLC using the NVAPI with the Direct3D
video output module. However, this requires statically linking to the NVAPI
SDK library and violates the GPL so unfortunately I can't provide the code
just yet (I can release screen-shots to prove it's working). The NVAPI is
also Windows only so another solution will be needed to support the nVidia
glasses for other platforms. I'll talk about the last problem first, then
about solving the licensing problem.

The official nVidia NVAPI SDK, which is used for controlling nVidia hardware
(reading hardware monitors, overclocking, enabling 3d, etc) is a Windows
only API. I eventually want to support Linux and OS X, so I did some
research into this and came across this interesting post:

I found the GPL'd libnvstusb (http://sourceforge.net/projects/libnvstusb/)
that allows you to manually control the USB dongle that controls the shutter
glasses. The driver is cross-platform and based on libusb. Unlike NVAPI,
there is no automatic synchronization so it'll require a dedicate thread
that is flipping the glasses at the refresh rate of the screen at the exact
point it refreshes.

To use libusb on Windows it requires a libusb driver to be installed. I
tried to install the libusb driver for the nVidia 3D Vision dongle but
Windows forces you to uninstall the actual 3D Vision driver since you can't
have more than one driver attached to the same USB device installed at the
same time. I think libusb will be great on Linux and OS X, but not practical
on Windows since it means the user will have to swap drivers each time they
want to watch a video, then swap back to use the glasses for another
purpose. I will eventually support libusb for Linux and OS X and as an
alternative to NVAPI for Windows.

For Windows, I want users to be able to start VLC and suddenly be able to
use their 3D glasses without going through the long process of uinstalling
and swapping drivers. The NVAPI SDK lets me do this, but requires linking to
a proprietary library (nvapi.lib/nvapi,h) so VLC will be shipping
with proprietary code which violates the GPL.

I've discovered that the nVidia display drivers install 'nvapi.dll' in to
the system. nvapi.dll exposes one symbol: nvapi_QueryInterface which can be
used to get pointers to the methods for enabling the shutter glasses. It's
possible that I could dynamically load nvapi.dll and avoid using and linking
with the NVAPI SDK altogether. Since nvapi.dll is a system library that is
already installed, I believe dynamically loading it doesn't not violate the
GPL because VLC will not ship with or contain any proprietary code. This is
the same way VLC loads the Direct3D library without violating the GPL. If
nvapi.dll is not found then we can use libnvstusb as a backup driver.

In the upcoming weeks I'm going to experiment with dynamically loading
nvapi.dll and querying for and using the functions to enable the 3D shutter
glasses without having to link to any proprietary code or use the NVAPI
headers. This will involve a lot of trial and error so I'll work on this in
a test program before moving it into VLC.

I think it'll be a good idea if I started a blog to post regularly updates
of my progress on rather than the mailing list. Does anybody have a
suggestion on where I should host a blog? I still have a couple of weeks of
my studies left (our winter break hasn't started in the southern hemisphere
yet) and then my exams (I only have 2!).

Good luck everyone on their SoC projects!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110525/a3b3b2fc/attachment.html>

More information about the vlc-devel mailing list