summaryrefslogtreecommitdiff
path: root/src/librygel-renderer/rygel-media-player.vala
blob: 68ecd0a1ae12494eaca4eeadad169124c9dc15d4 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * Copyright (C) 2008 OpenedHand Ltd.
 * Copyright (C) 2009,2010 Nokia Corporation.
 * Copyright (C) 2012 Intel Corporation.
 *
 * Author: Jorn Baayen <jorn@openedhand.com>
 *         Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *
 * 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.
 */

/**
 * This interface maps UPnP AVTransport:2 methods to the plugin's specific implementation.
 *
 * This interface is useful only when implementing Rygel renderer plugins.
 * Instances of this interface are retrieved from
 * rygel_media_renderer_plugin_get_player().
 */
public interface Rygel.MediaPlayer : GLib.Object {

    /* TODO: Use an enum instead. */
    /// The state as a UPnP playback state string such as PAUSED_PLAYBACK, "STOPPED" or "PLAYING"
    public abstract string playback_state { owned get; set; }

    /// The URI of the current media.
    public abstract string? uri { owned get; set; }

    /// The volume as a value between 0.0 and 1.0
    public abstract double volume { get; set; }

    /// Duration of the current media in microseconds
    public abstract int64 duration { get; }

    /**
     * A DIDLLite document describing the current media URI or null.
     * The document is either the one received from a UPnP control point or
     * one generated by the implementing class.
     */
    public abstract string? metadata { owned get; set; }

    /// The mime-type of the currently-playing media
    public abstract string? mime_type { owned get; set; }

    /// The current media supports time-based seeking
    public abstract bool can_seek { get; }

    /**
     * The contents of the contentFeatures.dlna.org HTTP header,
     * containing the 4th field of the protocol info for the current
     * media URI. Or null if the header does not exist or the media
     * does not have DLNA information attached.
     */
    public abstract string? content_features { owned get; set; }

    /// The duration as a human-readable string, in HH:MM:SS format
    public string duration_as_str {
        owned get {
            return TimeUtils.time_to_string (duration);
        }
    }

    /// Position in the current media in microseconds
    public abstract int64 position { get; }

    /// The position as a human-readable string, in HH:MM:SS format
    public string position_as_str {
        owned get {
            return TimeUtils.time_to_string (position);
        }
    }

    /**
     * Seek to a point in the current media that is
     * this many microseconds after the start.
     */
    public abstract bool seek (int64 time);

    /**
     * Return the protocols supported by this renderer,
     * such as "http-get" and "rtsp".
     */
    public abstract string[] get_protocols ();

    /// Return the MIME types supported by this renderer.
    public abstract string[] get_mime_types ();
}