2703499ebc11fc5a3fdbcab1a2c56783a9f03ac0
[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 *playbin, *sink, *asink;
46     RygelPlaybinRenderer *renderer;
47     GError *error = NULL;
48     GMainLoop *loop;
49
50     g_type_init ();
51     gst_init (&argc, &argv);
52
53     g_set_application_name ("Standalone-Renderer");
54
55     renderer = rygel_playbin_renderer_new ("LibRygel renderer demo");
56     playbin = rygel_playbin_renderer_get_playbin (renderer);
57     sink = gst_element_factory_make ("cacasink", NULL);
58     g_object_set (G_OBJECT (sink),
59                   "dither", 53,
60                   "anti-aliasing", TRUE,
61                   NULL);
62
63     asink = gst_element_factory_make ("pulsesink", NULL);
64
65     g_object_set (G_OBJECT (playbin),
66                   "video-sink", sink,
67                   "audio-sink", asink,
68                   NULL);
69
70     if (argc >= 2) {
71         rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (renderer), argv[1]);
72     } else {
73         rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (renderer), "eth0");
74     }
75
76     loop = g_main_loop_new (NULL, FALSE);
77     g_main_loop_run (loop);
78
79     return 0;
80 }