Updated Slovenian translation
[profile/ivi/rygel.git] / examples / standalone-renderer-gst.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-gst.
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-core.h"
41
42 int main(int argc, char *argv[])
43 {
44     GstElement *playbin, *sink, *asink;
45     RygelPlaybinRenderer *renderer;
46     GError *error = NULL;
47     GMainLoop *loop;
48
49     g_type_init ();
50     gst_init (&argc, &argv);
51
52     g_set_application_name ("Standalone-Renderer");
53
54     renderer = rygel_playbin_renderer_new ("LibRygel renderer demo");
55     playbin = rygel_playbin_renderer_get_playbin (renderer);
56     sink = gst_element_factory_make ("cacasink", NULL);
57     g_object_set (G_OBJECT (sink),
58                   "dither", 53,
59                   "anti-aliasing", TRUE,
60                   NULL);
61
62     asink = gst_element_factory_make ("pulsesink", NULL);
63
64     g_object_set (G_OBJECT (playbin),
65                   "video-sink", sink,
66                   "audio-sink", asink,
67                   NULL);
68
69     if (argc >= 2) {
70         rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (renderer), argv[1]);
71     } else {
72         rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (renderer), "eth0");
73     }
74
75     loop = g_main_loop_new (NULL, FALSE);
76     g_main_loop_run (loop);
77
78     return 0;
79 }