Using the DoIP technology, it is very easy to create ambient lighting in a room. Ambient lighting is also known as 'Ambilight', a function found on the more expensive televisions from Philips. Such televisions typically have a few LED or CCFL lights on their back, which illuminate the wall to which the television is mounted with a color that is generated from the image that is currently displayed (i.e. the average of all colors on the screen, the most occurring color, etc.). Ambilight has a few different 'modes' which determine how fast the color changes, how saturated it will be, etcetera.
The popular, open-source VLC Player (which is available for almost all popular platforms) is capable of distilling an ambient color from a video stream in real-time, using the AtmoLight module. This module was originally written for specific lighting controllers (connected over a serial connection). Luckily, it is possible to change this module to output the colors over the network as multicast OSC messages. A fabric can then listen for those messages and send the color change messages to the appropriate devices.
Because we have to change the source code of the AtmoLight module, you will need the VLC source code to be able to compile it into a usable binary. On the Videolan.org Wiki, instructions can be found for checking out the code (from Git or by downloading a tarball with a snapshot) and compiling it (Windows, OS X, Unix). It is probably wise to try to make this work first before trying to change the source code; the build process is pretty complicated, because it needs a lot of external libraries.
For some reason, the atmolight module is not compiled by default under OS X. To make sure it is compiled, edit the configure.ac file in the vlc/ directory before running the './bootstrap' command (or change it and run ./bootstrap again). Look for the lines that define the 'atmo' module and remove the 'if'-statement that disables building atmo when not on linux or windows. This means that in the following fragment (current version of configure.ac, yours may be different), you should remnove lines 4599 and 4603.
4592 dnl
4593 dnl AtmoLight (homebrew AmbiLight)
4594 dnl
4595 AC_ARG_ENABLE(atmo,
4596 AS_HELP_STRING([--disable-atmo],[AtmoLight (homebrew Philips ambilight)
4597 (broken, default disabled)]),, [enable_atmo="no"])
4598 AS_IF([test "${enable_atmo}" != no], [
4599 AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
4600 AC_LANG_PUSH(C++)
4601 VLC_ADD_PLUGIN([atmo])
4602 AC_LANG_POP(C++)
4603 ])
4604 ])''
A patch for the AtmoLight module can be downloaded here, which changes the module in such a way that it outputs a single OSC message (with tag /ep/ambient/color,iii) over UDP multicast (224.0.0.2, port 2122) instead of to the specified serial connection. This is kind of a quick and dirty hack: the settings fields for the serial stuff are still there. Also, the current patch limits the rate at which the OSC messages are sent to half the rate of the original atmo module.
If all goes well, you should now have your own version of the VLC player (check by going to the VLC about screen; it should say 'compiled by' followed by your local username). Also check whether the Atmo-module is present and enable it by going to the preferences screen. Click 'advanced' and go to Video → Video filters. Enable the check mark in front of 'atmo' and go to the settings page of AtmoLight for further configuration.
Now, all that is needed is a fabric to translate the OSC color messages that the AtmoLight module sends into something that your lighting equipment understands. In most cases, lights that are connected using DoIP support the /ep/basic/color/set message; in this case, the following fabric file does the job:
<?xml version='1.0' ?> <fabric id="AmbientLightingService" package="com.tjshow.ambi" title="Ambilight" author="Tommy van der Vorst"> <group id="inep" direction="in"> <connection type="udp" address="224.0.0.2" format="osc" port="2122" /> </group> <group id="leds" direction="out"> <discover type="ep"> <supports method="/ep/basic/color/set"/> </discover> </group> <variable id="enabled" type="bool" value="1" /> <rule id="setenabled" name="Enabled"> <pattern>/com/tjshow/ambilight/enable</pattern> <parameter id="enabled" type="bool" friendly-name="Enabled" default="1" bind-value="enabled"/> <script> state.enabled = message[0]; </script> </rule> <rule id="hello" name="Set ambient light color"> <pattern>/ep/basic/color/ambient</pattern> <parameter id="r" type="int32" friendly-name="Red" min="0" max="255" default="0"/> <parameter id="g" type="int32" friendly-name="Green" min="0" max="255" default="0"/> <parameter id="b" type="int32" friendly-name="Blue" min="0" max="255" default="0"/> <script> if(state.enabled) { send("leds", new Message("/ep/basic/color/set", message[0],message[1],message[2])); } </script> </rule> </fabric>
It is probably wise to make this more advanced (i.e. adding an 'enabled' switch somewhere, limiting the rate of changes, using fade instead of set to make it smoother, etc).
It should be possible to distribute only the compiled module file (libatmolight-.dylib on OS X, probably called libatmolight*.so under Linux and atmolight.dll under Windows - please double-check this). Note that the module source code as well as the VLC source code is licenced under the GPL; this means that if you change it, you will have to publish your changes to the source code (among other things).