DLNA Development

Preface

Digital Living Network Alliance (DLNA) (originally named Digital Home Working Group, DHWG) was founded by a group of PC and consumer electronics companies in June 2003 (with Intel in the lead role) to develop and promote a set of interoperability guidelines for sharing digital media among multimedia devices under the auspice of a certification standard. DLNA certified devices include smartphones, tablets, PCs, TV sets and storage servers; in a typical use case, a user sends videos, pictures or music from their smartphone or storage server through their home WLAN to a TV set or tablet for display.

DLNA divides the whole applications into 5 functional components. From bottom to top are: : network interconnection; network protocol; media transmission; device discovery, control and management; media format.

Important Concepts of DLNA

Home NetWork Device(HND)

It refers to home devices with relatively large sizes and full functions, which can be distinguished from mobile devices. It mainly refers to the five categories of devices as follows:

  1. Digital Media Server (DMS): store content and make it available to networked digital media players (DMP) and digital media renderers (DMR). Examples include PCs and network-attached storage (NAS) devices.

  2. DDigital Media Player (DMP): find content on digital media servers (DMS) and provide playback and rendering capabilities. Examples include TVs, stereos and home theaters, wireless monitors and game consoles.

  3. Digital Media Controller (DMC): find content on digital media servers (DMS) and instruct digital media renderers (DMR) to play the content. Content doesn’t stream from or through the DMC. Examples include tablet computers, Wi-Fi enabled digital cameras and smartphones.

  4. Digital Media Renderer (DMR): play content as instructed by a digital media controller (DMC), which will find content from a digital media server (DMS). Examples include TVs, audio/video receivers, video displays and remote speakers for music. It is possible for a single device (e.g. TV, A/V receiver, etc.) to function both as a DMR (receives “pushed” content from DMS) and DMP (“pulls” content from DMS)

  5. Generally, digital media players (DMP) and digital media controllers (DMC) with print capability can print to DMPr. Examples include networked photo printers and networked all-in-one printers

Mobile Handheld Devices(MHD)

MHD, compared to home devices, has relatively simple functions with different media format supports.

  1. Mobile Digital Media Server (M-DMS): store content and make it available to wired/wireless networked mobile digital media players (M-DMP), and digital media renderers. Examples include mobile phones and portable music players.

  2. Mobile Digital Media Player (M-DMP): find and play content on a digital media server (DMS) or mobile digital media server (M-DMS). Examples include mobile phones and mobile media tablets designed for viewing multimedia content.

  3. Mobile Digital Media Uploader (M-DMU): send (upload) content to a digital media server (DMS) or mobile digital media server (M-DMS). Examples include digital cameras and mobile phones.

  4. Mobile Digital Media Downloader (M-DMD): find and store (download) content from a digital media server (DMS) or mobile digital media server (M-DMS). Examples include portable music players and mobile phones.

  5. Mobile Digital Media Controller (M-DMC): find content on a digital media server (DMS) or mobile digital media server (M-DMS) and send it to digital media renderers (DMR). Examples include personal digital assistants (PDAs) and mobile phones.

Networked Infrastructure Devices (NID)

  1. Mobile Network Connectivity Function (M-NCF): provide a bridge between mobile handheld device network connectivity and home network connectivity.

  2. Media Interoperability Unit (MIU): provide content transformation between required media formats for home network and mobile handheld devices.

DLNA Framework

DLNA framework is an interconnection system, so it is logically similar to OSI (Open System Interconnection) seven-layer network model.

DLNA framework consists of 7 layers shown as follows:

_images/frame.png

  1. NetWorking Connectivity: it covers physical connection standards, including the wired connection, such as Ethernet compliant with IEEE802.3; the wireless connection, such as WIFI with IEEE802.11a/g, andIt can realize 54Mbps; the bluetooth (802.15), etc. with very mature technology. Now OFDM and MIMO (802.11n) can already achieve 300Mbps, and it has already surpassed the popular 100Mbps Ethernet, but the product has not been popularized and will be used in the future.

  2. NetWorking Stack: The interconnection transmission of DLNA is normally based on IPV4 protocol stack and TCP or UDP will be applicable. This layer is equivalent to the OSI network layer.

  3. Device Discovery & Control. This layer, as the Basic protocol framework of DLNA, is relatively essential. DLNA uses UPnP protocol to discover and control devices.

  4. Media Management. It includes media identification, management, distribution and recording (storage), UPnP AV Architecture:1 and UPnP Printer Architecture:1 The two UPnP documents will explain the media management.

  5. Media Transport: This layer uses the HTTP (HyperText Transfer Protocol) hypertext transfer protocol.It is the media transmission protocol that we usually use online. HTTP adopts TCP for reliable transmission or HTTP with mixed UDP. The latest version of HTTP now is HTTP1.1 and the optional protocol is RTP.

  6. Media Formats. Formats here are referred to as encoding format Codec. The encoding formats we usually talk about, such as Mpeg-2, AVC, x264, are video encoding formats; PCM, mp3 (MPEG-2 Layer 3), aac, flac are audio encoding formats. While avi, rmvb and mkv are media packaging formats, including video, audio and possibly subtitle streams. For example, a file with the suffix mkv, its video Codec is x264, the audio is aac, and its video and audio encoding belongs to Mpeg-4 Codec Family.

Development Guidance

Since we have briefly known DLNA in the first three sections, we will build a DLNA environment to make M-DMS (NetEase Cloud Music Player) push music to DMR (ROC-RK3308-CC).

We create the DMR role with gmrender-resurrect open source codes and find a mobile phone installed NetEase Cloud Player to act as M-DMS.

compilation

Version Confirmation

Before compilation, we need to confirm the versions of gmrender-resurrect and libupnp to ensure the versions meet the following requirements:

  • gmrender-resurrect 版本:33600ab663f181c4f4f5c48aba25bf961760a300

  • Libupnp 版本:1.6.21

The package configuration information of Buildroot is contained in the corresponding folder under the Buildroot/package file. Each folder contains 3 files:*.in, *.hash and *.mk, wherein

  • *.in contains the switch macro in makeconfig

  • *.hash contains he HASH value and version of code compression package.

  • *.mk contains the code compilation and version information.

For example, to check the version of gmrender-resurrect:

cat buildroot/package/gmrender-resurrect/gmrender-resurrect.mk
################################################################################
#
# gmrender-resurrect
#
################################################################################

GMRENDER_RESURRECT_VERSION = 33600ab663f181c4f4f5c48aba25bf961760a300
GMRENDER_RESURRECT_SITE = $(call github,hzeller,gmrender-resurrect,$(GMRENDER_RESURRECT_VERSION))
# Original distribution does not have default configure,
# so we need to autoreconf:
GMRENDER_RESURRECT_AUTORECONF = YES
GMRENDER_RESURRECT_LICENSE = GPL-2.0+
GMRENDER_RESURRECT_LICENSE_FILES = COPYING
GMRENDER_RESURRECT_DEPENDENCIES = gstreamer1 libupnp

define GMRENDER_RESURRECT_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 $(TOPDIR)/package/gmrender-resurrect/gmrender_service.sh \
	$(TARGET_DIR)/sbin
endef

$(eval $(autotools-package))

The version is shown as: 33600ab663f181c4f4f5c48aba25bf961760a300。

Configuration

Make configuration according to following steps before compilation:

  • Set environment variable, run source buildroot/build/envsetup.sh, select configuration [1]

  • run make menuconfig, choose CKAGE_GMRENDER_RESURRECT [=y]

Compile gmrender-resurrect

  • If SDK has not been compiled, use build.sh to make full compilation.

  • If SDK has been compiled, run make gmrender-resurrect-rebuild to compile gmrender-resurrect only and the corresponding libraries.

After gmrender-resurrect has been compiled independently, run ‘make’ to generate rootfs. Then, run ./mkfirmware.sh to generate rockdev/rootfs.img.

After the compilation has been completed, follow the instructions in “burning_firmware” to burn the file system to the board and start operation.

Running

Before DLNA starts, the board needs to access to the network. Refer to WIFI Network Configuration for WIFI network configuration; or use Ethernet.

Starting DLNA:

gmediarender -f rk3308

When Ready for rendering is shown, it means successful start and waiting for a phone connection (rk3308 as DMR will be found by phone).

Test

Connect phone to LAN (in the same network segment as RK3308), open NetEase Cloud Player and select a song.

_images/p1.png

_images/p2.png

When the icon specified by the red arrow is shown as above, click to open as shown blow.

_images/p3.png

When rk3308 is shown, select the song and it will be pushed to the RK3308, the progress bar for playback will be displayed on the phone.

_images/p4.png

During playback, you can adjust the volume and switch the up and down tracks.