The UPnP Media Renderer
UPnP Media Renderer's software implementation
In this chapter I describe the functionalities provided by the Java classes that compose the UPnP Media Renderer. This is an overview but you can find a detailed documentation within the sources.
AudioPlayer
This class is a simple implementation of an MP3 player based on mpg123 which supports retrieval of MPEG audio files via the HTTP protocol. The class interacts directly with mpg123 through a well defined set of bash instructions. On the other side, the methods are called by the AVTransport class which in turn is invoked by the main class (Rasplayer) when an UPnP action (setUri, getState, play, pause, stop, seek) is sent from the control point and received by the main class of the renderer. We assume to treat MP3 files which are MPEG Layer III, version 1 compliant, so assuming that each frame is composed by 1152 samples and the sampling frequency is 44100 Hz, we can find the frame duration:
frame duration [milliseconds per frame] =
(samples per frame / samples per second ) * 1000 =
(1152 / 44100) * 1000 ≅ 26 ms
This fact has been very useful for the implementation of the seek method which allows to change the playback position by converting a relative time (REL_TIME) to the right number of frames to skip. Another important thing to say is that I've applied a patch to mpg123 in order to be able to retrieve the playback time and send it to the UPnP Control Point. I've written a detailed documentation here.