I recently bought a 40" Samsung LED Smart TV (UN40ES6100F) as a second TV for the bedroom. My primary TV, a 52" Samsung LCD, lives in the living room and is connected to a HTPC with XBMC, an xbox 360, turntable and a receiver and a 5.1 surround sound system.

My goal with the new TV was to keep it simple. Hang it in the bedroom, stream content to it. The TV comes with an app called AllShare, which is designed to allow you to stream personal media files to it. It turns out that AllShare uses DLNA (an open standard), which uses UPNP for media management, discovery and control.

Great, I thought. There are a number of linux programs for streaming media via DLNA, and after a quick search, I decided to use Mediatomb. After a quick apt-get install mediatomb, I was on my way. Or so I thought. At this point, after launching the AllShare app on my TV, I was able to view the mediatomb share, though the share was empty. Bug reports reported that the new Samsung Smart TVs violate RFC2396, for which a patch was provided. The fix for this bug is provided in the previous link, but the instructions were a bit confusing, so here is how I patched mediatomb to work with my new Samsung Smart TV.

Too lazy, didn't read

Installing mediatomb, with the patch

All of these steps were performed as root and you should be able to copy and paste them. Let me know if this does not work.

apt-get install dpkg-dev devscripts fakeroot
apt-get build-dep mediatomb
apt-get source -d mediatomb
dpkg-source -x mediatomb_0.12.1-0ubuntu4.dsc
echo mediatomb-urifix.patch &gt;&gt;  mediatomb-0.12.1/debian/patches/series</p>
<p>cat &gt; mediatomb-0.12.1/debian/patches/mediatomb-urifix.patch &lt;&lt; EOF
--- a/tombupnp/upnp/src/genlib/net/uri/uri.c
+++ b/tombupnp/upnp/src/genlib/net/uri/uri.c
@@ -1042,7 +1042,8 @@
         out-&gt;path_type = REL_PATH;
<p>-    if( ( ( begin_hostport + 1 ) &lt; max ) &amp;&amp; ( in[begin_hostport] == '/' )
+    //parse hostport only if scheme was found
+    if( ( begin_hostport &gt; 0 ) &amp;&amp; ( ( begin_hostport + 1 ) &lt; max ) &amp;&amp; ( in[begin_hostport] == '/' )
         &amp;&amp; ( in[begin_hostport + 1] == '/' ) ) {
         begin_hostport += 2;</p>
<p>@@ -1059,6 +1060,12 @@
         out-&gt;hostport.text.size = 0;
         out-&gt;hostport.text.buff = 0;
         begin_path = begin_hostport;
+        //remove excessive leading slashes (fix for Samsung Smart TV 2012)
+        while( ( ( begin_path + 1 ) &lt; max ) &amp;&amp; ( in[begin_path] == '/' ) &amp;&amp; ( in[begin_path + 1] == '/') ) {
+            begin_path++;
+        }
<p>     begin_fragment =
<p>cd mediatomb-0.12.1/
dch -i 'Samsung Smart TV 2012 fix by swiergot'
dpkg-buildpackage -rfakeroot
cd ..
dpkg -i mediatomb-common_0.12.1-0ubuntu5_amd64.deb mediatomb-daemon_0.12.1-0ubuntu5_all.deb  mediatomb_0.12.1-0ubuntu5_all.deb

The config file

wget http://pastie.org/pastes/5397054/download -O /etc/mediatomb/config.xml
service mediatomb restart

Great success!

You should now be able to browse to the mediatomb web interface on port 49152, add directories to the database, and then launch your AllShare app to browse and play your media files.