~ubuntu-branches/ubuntu/precise/rhythmbox/precise-201203091205

« back to all changes in this revision

Viewing changes to backends/rb-player.h

Tags: upstream-0.9.5
ImportĀ upstreamĀ versionĀ 0.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  arch-tag: Interface to audio backend  
 
3
 *
 
4
 *  Copyright (C) 2003 Jorn Baayen <jorn@nl.linux.org>
 
5
 *  Copyright (C) 2003 Colin Walters <walters@verbum.org>
 
6
 *
 
7
 *  This program is free software; you can redistribute it and/or modify
 
8
 *  it under the terms of the GNU General Public License as published by
 
9
 *  the Free Software Foundation; either version 2 of the License, or
 
10
 *  (at your option) any later version.
 
11
 *
 
12
 *  This program is distributed in the hope that it will be useful,
 
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 *  GNU General Public License for more details.
 
16
 *
 
17
 *  You should have received a copy of the GNU General Public License
 
18
 *  along with this program; if not, write to the Free Software
 
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 
20
 *
 
21
 */
 
22
 
 
23
#ifndef __RB_PLAYER_H
 
24
#define __RB_PLAYER_H
 
25
 
 
26
#include <glib-object.h>
 
27
#include "rb-metadata.h"
 
28
 
 
29
G_BEGIN_DECLS
 
30
 
 
31
typedef enum
 
32
{
 
33
        RB_PLAYER_ERROR_NO_AUDIO,
 
34
        RB_PLAYER_ERROR_GENERAL,
 
35
        RB_PLAYER_ERROR_INTERNAL
 
36
} RBPlayerError;
 
37
 
 
38
#define RB_PLAYER_ERROR rb_player_error_quark ()
 
39
 
 
40
GQuark rb_player_error_quark (void);
 
41
 
 
42
#define RB_TYPE_PLAYER         (rb_player_get_type ())
 
43
#define RB_PLAYER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_PLAYER, RBPlayer))
 
44
#define RB_IS_PLAYER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_PLAYER))
 
45
#define RB_PLAYER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), RB_TYPE_PLAYER, RBPlayerIface))
 
46
 
 
47
typedef struct _RBPlayer RBPlayer;
 
48
 
 
49
typedef struct
 
50
{
 
51
        GTypeInterface  g_iface;
 
52
 
 
53
        /* virtual functions */
 
54
        gboolean        (*open)                 (RBPlayer *player,
 
55
                                                 const char *uri,
 
56
                                                 GError **error);
 
57
        gboolean        (*opened)               (RBPlayer *player);
 
58
        gboolean        (*close)                (RBPlayer *player,
 
59
                                                 GError **error);
 
60
 
 
61
        gboolean        (*play)                 (RBPlayer *player,
 
62
                                                 GError **error);
 
63
        void            (*pause)                (RBPlayer *player);
 
64
        gboolean        (*playing)              (RBPlayer *player);
 
65
 
 
66
        void            (*set_volume)           (RBPlayer *player,
 
67
                                                 float volume);
 
68
        float           (*get_volume)           (RBPlayer *player);
 
69
        void            (*set_replaygain)       (RBPlayer *player,
 
70
                                                 double track_gain,
 
71
                                                 double track_peak,
 
72
                                                 double album_gain,
 
73
                                                 double album_peak);
 
74
 
 
75
        gboolean        (*seekable)             (RBPlayer *player);
 
76
        void            (*set_time)             (RBPlayer *player,
 
77
                                                 long time);
 
78
        long            (*get_time)             (RBPlayer *player);
 
79
 
 
80
        /* signals */
 
81
        void            (*eos)                  (RBPlayer *player);
 
82
        void            (*info)                 (RBPlayer *player,
 
83
                                                 RBMetaDataField field,
 
84
                                                 GValue *value);
 
85
        void            (*buffering)            (RBPlayer *player,
 
86
                                                 guint progress);
 
87
        void            (*error)                (RBPlayer *player,
 
88
                                                 GError *error);
 
89
        void            (*tick)                 (RBPlayer *player,
 
90
                                                 long elapsed);
 
91
} RBPlayerIface;
 
92
 
 
93
GType           rb_player_get_type   (void);
 
94
RBPlayer *      rb_player_new        (GError **error);
 
95
 
 
96
gboolean        rb_player_open       (RBPlayer *player,
 
97
                                      const char *uri,
 
98
                                      GError **error);
 
99
gboolean        rb_player_opened     (RBPlayer *player);
 
100
gboolean        rb_player_close      (RBPlayer *player, GError **error);
 
101
 
 
102
gboolean        rb_player_play       (RBPlayer *player, GError **error);
 
103
void            rb_player_pause      (RBPlayer *player);
 
104
gboolean        rb_player_playing    (RBPlayer *player);
 
105
 
 
106
void            rb_player_set_volume (RBPlayer *player, float volume);
 
107
float           rb_player_get_volume (RBPlayer *player);
 
108
void            rb_player_set_replaygain (RBPlayer *player,
 
109
                                          double track_gain, double track_peak,
 
110
                                          double album_gain, double album_peak);
 
111
 
 
112
gboolean        rb_player_seekable   (RBPlayer *player);
 
113
void            rb_player_set_time   (RBPlayer *player, long time);
 
114
long            rb_player_get_time   (RBPlayer *player);
 
115
 
 
116
 
 
117
/* only to be used by subclasses */
 
118
void    _rb_player_emit_eos (RBPlayer *player);
 
119
void    _rb_player_emit_info (RBPlayer *player, RBMetaDataField field, GValue *value);
 
120
void    _rb_player_emit_buffering (RBPlayer *player, guint progress);
 
121
void    _rb_player_emit_error (RBPlayer *player, GError *error);
 
122
void    _rb_player_emit_tick (RBPlayer *player, long elapsed);
 
123
 
 
124
G_END_DECLS
 
125
 
 
126
#endif /* __RB_PLAYER_H */