summaryrefslogtreecommitdiff
path: root/examples/standalone-renderer.c
blob: f9f52014e5456c222e1e0159ead1539d7df9b578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * Copyright (C) 2012 Openismus GmbH.
 *
 * Author: Jens Georg <jensg@openismus.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

/*
 * Demo application for librygel-renderer.
 *
 * Creates a simple stand-alone UPnP renderer that renders any visual content
 * in ASCII-art using GStreamer's cacasink element.
 *
 * Usage:
 *   standalone-renderer [<network device>]
 *
 * If no network device is given on the commandline, the program falls back to
 * eth0.
 *
 * To do anything useful, another UPnP server + UPnP controller is necessary
 * to tell it which media file to show.
 */

#include "rygel-renderer.h"
#include "rygel-core.h"

int main(int argc, char *argv[])
{
    GstElement *sink, *asink;
    RygelPlaybinPlayer *player;
    RygelPlaybinRenderer *renderer;
    GError *error = NULL;
    GMainLoop *loop;

    g_type_init ();
    gst_init (&argc, &argv);

    g_set_application_name ("Standalone-Renderer");

    renderer = rygel_playbin_renderer_new ("LibRygel renderer demo");
    player = rygel_playbin_player_get_default ();
    sink = gst_element_factory_make ("cacasink", NULL);
    g_object_set (G_OBJECT (sink),
                  "dither", 53,
                  "anti-aliasing", TRUE,
                  NULL);

    asink = gst_element_factory_make ("pulsesink", NULL);

    g_object_set (G_OBJECT (rygel_playbin_player_get_playbin (player)),
                  "video-sink", sink,
                  "audio-sink", asink,
                  NULL);

    if (argc >= 2) {
        rygel_playbin_renderer_add_interface (renderer, argv[1]);
    } else {
        rygel_playbin_renderer_add_interface (renderer, "eth0");
    }

    loop = g_main_loop_new (NULL, FALSE);
    g_main_loop_run (loop);

    return 0;
}