{"id":54,"date":"2014-03-04T14:48:00","date_gmt":"2014-03-04T14:48:00","guid":{"rendered":"https:\/\/blafaselblub.wordpress.com\/2014\/03\/04\/tp-link-based-dlna-music-player"},"modified":"2018-01-08T10:49:43","modified_gmt":"2018-01-08T09:49:43","slug":"tp-link-based-dlna-music-player","status":"publish","type":"post","link":"https:\/\/blog.alexander-tuxen.de\/index.php\/2014\/03\/04\/tp-link-based-dlna-music-player\/","title":{"rendered":"TP-Link based DLNA Music Player"},"content":{"rendered":"<p>Everybody is building some kind of multimedia stuff with a Raspberry Pi these days. I&#8217;m no exception as I also have one connected to my (really shitty Philips) TV, running RaspBMC. But that&#8217;s not what this post is about, and it&#8217;s also pretty lame, since there isn&#8217;t really that much to it.<\/p>\n<p><b>Objective<\/b><br \/>\n<b><br \/>\n<\/b>I also wanted something to connect to my stereo to play music, but I didn&#8217;t want to use a Pi for that for these reasons:<\/p>\n<ul>\n<li>It&#8217;s rather wasteful. The Pi including a power supply and an SD-Card costs about 50,-\u20ac and I wouldn&#8217;t even use most of the hardware it comes with.<\/li>\n<li>The SD-Card will break eventually. Depending on how much logging I would forget\/neglect to disable, rather sooner than later.<\/li>\n<li>It doesn&#8217;t have wifi and I have no ethernet in the dining room where the stereo sits.<\/li>\n<li>The audio output of the Pi sucks. Plain and simple. It&#8217;s about as far from HiFi as Fox News is from being a news network. So I&#8217;d have to use an external <a href=\"http:\/\/en.wikipedia.org\/wiki\/Digital-to-analog_converter\">DAC<\/a> to get decent audio output from it.<\/li>\n<li>It&#8217;s about as lame as using a Pi for video playback. Perhaps even more so.<\/li>\n<\/ul>\n<div>Now that we have established that a Raspberry Pi just isn&#8217;t the right tool for the job, what is? A cheap chinese wifi router seems to be a perfect fit, provided it has enough power to decode MP3s, OGGs, and FLACs (and it has). The only thing missing is the audio output, but that can be added as a USB device, the same way it would have to be done with a RasPi. Also, it obviously has wifi and it&#8217;s a lot cheaper than a RasPi.<\/div>\n<div>\n<b>Hardware<\/b><br \/>\n<b><br \/>\n<\/b><\/div>\n<div>I went for a TP-Link WR841N V7.2 because that&#8217;s what I had lying around. I also had a Behringer USB DAC collecting dust. If anyone wants to replicate this project, I&#8217;d recommend getting another kind of router, since the WR841N doesn&#8217;t have a USB port. The processor does, however, but I had to solder the D+ and D- wires to some tiny ass resistors on the board and generate the +5V from the routers 9V supply voltage myself. Any version more recent than 7.2 of the router doesn&#8217;t even have traces for the data pins and the processor comes in a QFN package, so you&#8217;d have to cut away part of the processor package and solder the data lines directly to the processor pins. Some people have done that, but I&#8217;m just not that sick. I might be a cheap bastard, but putting a Dremel to a QFN package is where I draw the line.<\/div>\n<div><\/div>\n<table class=\"tr-caption-container\" style=\"margin-left: auto; margin-right: auto; text-align: center;\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a href=\"http:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0288.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-135\" src=\"http:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0288-1024x683.jpg\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0288-1024x683.jpg 1024w, https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0288-300x200.jpg 300w, https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0288-768x512.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">Somewhere left of the processor are R601 and R602 where D+ and D- surface<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Other than adding those data lines the hardware side of this build isn&#8217;t too interesting, so I will spare you the details.<\/p>\n<table class=\"tr-caption-container\" style=\"margin-left: auto; margin-right: auto; text-align: center;\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a href=\"http:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0290.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-136\" src=\"http:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0290-1024x683.jpg\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0290-1024x683.jpg 1024w, https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0290-300x200.jpg 300w, https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0290-768x512.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">Botched up a 7805 voltage regulator and a few caps on a piece of perfboard<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><b>OpenWRT<\/b><br \/>\n<b><br \/>\n<\/b>Since these cheap routers only have a few megs of flash, they can only run special embedded Linux distributions like <a href=\"https:\/\/openwrt.org\/\">OpenWRT<\/a>, which is what I am using. But even with that, there was no way of fitting all the needed packages in there, so I added a flashdrive to deal with that. Since the processor only has one USB port a USB hub was also needed. That was actually the only thing I had to buy for this project.<\/div>\n<div><\/div>\n<div>The OpenWRT project provides lots of documentation about <a href=\"http:\/\/wiki.openwrt.org\/doc\/howto\/obtain.firmware.generate\">building minimal images<\/a> and putting its <a href=\"http:\/\/wiki.openwrt.org\/doc\/howto\/extroot\">root filesystem on an external storage<\/a>, so I&#8217;ve done just that. With plenty of storage to install the needed packages, it&#8217;s for the hard part: Building the software.<\/div>\n<div>\n<b>GStreamer and gmrender-resurrect<\/b><br \/>\n<b><br \/>\n<\/b><\/div>\n<div>There are quite a lot of projects out there that achieve a similar goal, but it seems that all of them use <a href=\"http:\/\/www.musicpd.org\/\">mpd<\/a>\u00a0for streaming. Frankly, I don&#8217;t like mpd very much, mainly because all clients I&#8217;ve seen so far lack in usability. Also, it seems to me that while it even supports gapless playback, it&#8217;s unlikely to be adopted by manufacturers (if it were, there would be a few commercially available players by now). DLNA on the other hand looks like it&#8217;s quickly becoming a de-facto industry standard as it already has been adopted by some very reputable HiFi manufacturers like Linn, Marantz, Denon and others.<\/p>\n<p>For DLNA-Support there is a project based on the\u00a0<a href=\"http:\/\/gstreamer.freedesktop.org\/\">gstreamer framework<\/a>, called\u00a0<a href=\"https:\/\/github.com\/hzeller\/gmrender-resurrect\">gmrender-resurrect<\/a>, and also an\u00a0<a href=\"https:\/\/github.com\/JiapengLi\/OpenWrt-gmediarender\">OpenWRT port<\/a>\u00a0of it. OpenWRT packages can be built using either the <a href=\"http:\/\/wiki.openwrt.org\/doc\/howto\/obtain.firmware.sdk\">OpenWRT SDK<\/a> or the <a href=\"http:\/\/wiki.openwrt.org\/about\/toolchain\">OpenWRT buildroot<\/a>. If you can live with the hopelessly outdated gstreamer packages provided by OpenWRT, it&#8217;s just a matter of building the gmrender-resurrect package and you&#8217;re done. I couldn&#8217;t, however, so I built packages for the current version of gstreamer, too, which took me forever.<\/div>\n<div><\/div>\n<div>I&#8217;d like to point out that no real coding or porting work was done on my part. I just updated and fixed a few Makefiles to make it build. All the real work was done by other people.<\/div>\n<p>&nbsp;<\/p>\n<div>\n<table class=\"tr-caption-container\" style=\"margin-left: auto; margin-right: auto; text-align: center;\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a href=\"http:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0285.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-138\" src=\"http:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0285-1024x683.jpg\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0285-1024x683.jpg 1024w, https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0285-300x200.jpg 300w, https:\/\/blog.alexander-tuxen.de\/wp-content\/uploads\/2014\/03\/IMG_0285-768x512.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">The finished thing: Router, USB-Hub, Flashdrive, USB-DAC<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>All patches needed to compile gmrender-resurrect and gstreamer (including plugins) are available on my <a href=\"https:\/\/github.com\/alibenpeng\">github<\/a>.<\/div>\n<div>\n<b>What it can do<\/b><br \/>\n<b><br \/>\n<\/b>These little routers are really amazing. With this I am now able to play music from any DLNA source (fileserver, phone, tablet, laptop, you name it&#8230;) to the stereo in my dining room. I&#8217;m using BubbleUPNP on Android as control point and it really works great! Also, it still acts as a WDS-router.<\/p>\n<p><b>Where to go from here<\/b><\/p>\n<p>There&#8217;s a lot more that can be done, given that all the LEDs and buttons in the router are actually GPIOs. So adding a LCD and putting it in a nice enclosure (like an old CD-Player) with Play\/Pause\/Skip-buttons should be pretty easy.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Everybody is building some kind of multimedia stuff with a Raspberry Pi these days. I&#8217;m no exception as I also have one connected to my (really shitty Philips) TV, running RaspBMC. But that&#8217;s not what this post is about, and &hellip; <a href=\"https:\/\/blog.alexander-tuxen.de\/index.php\/2014\/03\/04\/tp-link-based-dlna-music-player\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,4],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/posts\/54"}],"collection":[{"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":2,"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/posts\/54\/revisions"}],"predecessor-version":[{"id":139,"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/posts\/54\/revisions\/139"}],"wp:attachment":[{"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/media?parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/categories?post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.alexander-tuxen.de\/index.php\/wp-json\/wp\/v2\/tags?post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}