49bdeb231a6488f84ed627fe628d211d65394e78
[profile/ivi/rygel.git] / examples / standalone-renderer.c
1 /*
2  * Copyright (C) 2012 Openismus GmbH.
3  *
4  * Author: Jens Georg <jensg@openismus.com>
5  *
6  * This file is part of Rygel.
7  *
8  * Rygel is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Rygel is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22
23 /*
24  * Demo application for librygel-renderer.
25  *
26  * Creates a simple stand-alone UPnP renderer that renders any visual content
27  * in ASCII-art using GStreamer's cacasink element.
28  *
29  * Usage:
30  *   standalone-renderer [<network device>]
31  *
32  * If no network device is given on the commandline, the program falls back to
33  * eth0.
34  *
35  * To do anything useful, another UPnP server + UPnP controller is necessary
36  * to tell it which media file to show.
37  */
38
39 #include "rygel-renderer-gst.h"
40 #include "rygel-renderer-gst.h"
41 #include "rygel-core.h"
42
43 int main(int argc, char *argv[])
44 {
45     GstElement *sink, *asink;
46     RygelPlaybinPlayer *player;
47     RygelPlaybinRenderer *renderer;
48     GError *error = NULL;
49     GMainLoop *loop;
50
51     g_type_init ();
52     gst_init (&argc, &argv);
53
54     g_set_application_name ("Standalone-Renderer");
55
56     renderer = rygel_playbin_renderer_new ("LibRygel renderer demo");
57     player = rygel_playbin_player_get_default ();
58     sink = gst_element_factory_make ("cacasink", NULL);
59     g_object_set (G_OBJECT (sink),
60                   "dither", 53,
61                   "anti-aliasing", TRUE,
62                   NULL);
63
64     asink = gst_element_factory_make ("pulsesink", NULL);
65
66     g_object_set (G_OBJECT (rygel_playbin_player_get_playbin (player)),
67                   "video-sink", sink,
68                   "audio-sink", asink,
69                   NULL);
70
71     if (argc >= 2) {
72         rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (renderer), argv[1]);
73     } else {
74         rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (renderer), "eth0");
75     }
76
77     loop = g_main_loop_new (NULL, FALSE);
78     g_main_loop_run (loop);
79
80     return 0;
81 }