# Implementing Renderers

## Implementing Renderers: Overview

This library may be used to create in-process UPnP/DLNA Renderers, or Players, via the RygelMediaRenderer class. For instance, this may be used to add UPnP/DLNA Renderer or Player capability to an existing media player application. See the derived RygelPlaybinRenderer class, from librygel-renderer-gst, to see how this can be done with GStreamer.

## Implementing Renderers: Full Example

The external rygel-gst-0-10-fullscreen-renderer project provides a Rygel Renderer executable that uses an older GStreamer version and is an example of an external Rygel Renderer implemented in C, based on the implementation code in librygel-renderer-gst. It plays content via UPnP.

The RygelPlaybinPlayer class implements the RygelMediaPlayer interface, providing implementations for its virtual functions. For instance, see the `rygel_playbin_player_real_set_uri()` function, which delegates to the member GstPlaybin GstElement. The base class responds appropriately to UPnP messages, calling these virtual functions to request the specific behaviour.

The RygelPlaybinRenderer class, derived from RygelMediaRenderer, provides the singleton instance of that player to its base class and has a `rygel_playbin_renderer_get_playbin()` function for convenience.

Our `main()` instantiates our derived renderer and calls `rygel_playbin_renderer_get_playbin()` to get its GStreamer playbin element. We then use `gst_x_overlay_set_window_handle()` in our `GtkWidget:realize` signal handler. We connect the renderer to a network interface via `rygel_media_device_add_interface`, allowing the renderer to respond to UPnP messages.