DLNA Service

Introduction

The KreaTV DLNA service is used to access media files on Digital Media Servers (DMS) in the home network. The Set-Top-Box acts as a Digital Media Player (DMP) and is compliant with the DLNA 1.5 Networked Device Interoperability Guidelines. In order to play a media file from a media server the following steps need to be taken:

Using the Service

Discovering media servers

The DLNA service is the start point for all DLNA functionality. The method IToiDlnaService::GetMediaServers() is used to get the current list of available servers. By subscribing to events the application can be notified when servers appear and disappear from the network. The object returned by IToiDlnaService::CreateContentDirectoryInstance() let the application communicate directly with the DLNA service in a remote server.

Using the Content Directory Service

Since this service communicates with a remote server, and DLNA allows requests to take up to 30 seconds, many methods are executed asynchronously. In KreaTV a generic interface IToiOperationManager is used to handle asynchronous methods. Each service that utilize this kind of methods provide its own IToiOperationManager instance. In IToiContentDirectoryService this instance can be retrieved by calling GetCdsOperationManager().

To browse the root directory of a media server, the application first creates an asynchronous operation identifier by calling IToiOperationManager::CreateOperation() and subscribes to operation events. The next step is to call IToiDlnaContentDirectoryService::Browse() with that identifier as parameter to start the asynchronous operation. The method Browse() lists CDS objects in a specific container. The root container identifier can be retrieved from method IToiDlnaContentDirectoryService::GetRootContainerId(). The Browse() method also provides means to optimize the response time by defining how many object to get and an offset to use.

As soon as any object has been retrieved the application is notified by an event from the Operation Manager where the result parameter is set to IToiDlnaContentDirectoryService::OP_RESULT_OBJECT. This means that CDS objects can be read by calling IToiDlnaContentDirectoryService::GetOperationObjectResult(). The objects returned will have property values corresponding to the properties listed in the call to Browse(). If only playback is wanted the IToiDlnaContentDirectoryService::PROPERTY_RES is the property to use.

Playback and Rendering

The PROPERTY_RES includes the URL that can be passed to IToiMediaPlayer::Open() or used to load an image. The DLNA services are not involved in any other way during playback or rendering.

Configure the Service

To make DLNA service work, an iip called kreatv-option-dlnamediacontroller must be added at build time.

Some Tips

See also: TOI DLNA Service Interface