1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 
3 /*
4  *  Goo
5  *
6  *  Copyright (C) 2004-2009 Free Software Foundation, Inc.
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU 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  *  This program 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 General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef GOO_PLAYER_H
23 #define GOO_PLAYER_H
24 
25 #include <glib.h>
26 #include <gio/gio.h>
27 #include <brasero3/brasero-drive.h>
28 #include "track-info.h"
29 #include "album-info.h"
30 
31 #define GOO_TYPE_PLAYER              (goo_player_get_type ())
32 #define GOO_PLAYER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOO_TYPE_PLAYER, GooPlayer))
33 #define GOO_PLAYER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GOO_TYPE_PLAYER, GooPlayerClass))
34 #define GOO_IS_PLAYER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GOO_TYPE_PLAYER))
35 #define GOO_IS_PLAYER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GOO_TYPE_PLAYER))
36 #define GOO_PLAYER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GOO_TYPE_PLAYER, GooPlayerClass))
37 
38 typedef struct _GooPlayer        GooPlayer;
39 typedef struct _GooPlayerClass   GooPlayerClass;
40 typedef struct _GooPlayerPrivate GooPlayerPrivate;
41 
42 typedef enum {
43 	GOO_PLAYER_ACTION_NONE,
44 	GOO_PLAYER_ACTION_LIST,
45 	GOO_PLAYER_ACTION_SEEK_SONG,
46 	GOO_PLAYER_ACTION_SEEK,
47 	GOO_PLAYER_ACTION_PLAY,
48 	GOO_PLAYER_ACTION_PAUSE,
49 	GOO_PLAYER_ACTION_STOP,
50 	GOO_PLAYER_ACTION_MEDIUM_REMOVED,
51 	GOO_PLAYER_ACTION_MEDIUM_ADDED,
52 	GOO_PLAYER_ACTION_UPDATE,
53 	GOO_PLAYER_ACTION_METADATA,
54 	GOO_PLAYER_ACTION_STARTED_NEXT
55 } GooPlayerAction;
56 
57 typedef enum {
58 	GOO_PLAYER_STATE_ERROR,
59 	GOO_PLAYER_STATE_NO_DISC,
60 	GOO_PLAYER_STATE_DATA_DISC,
61 	GOO_PLAYER_STATE_STOPPED,
62 	GOO_PLAYER_STATE_PLAYING,
63 	GOO_PLAYER_STATE_PAUSED,
64 	GOO_PLAYER_STATE_SEEKING,
65 	GOO_PLAYER_STATE_LISTING,
66 	GOO_PLAYER_STATE_UPDATING,
67 	GOO_PLAYER_STATE_EJECTING
68 } GooPlayerState;
69 
70 struct _GooPlayer
71 {
72 	GObject __parent;
73 	GooPlayerPrivate *priv;
74 };
75 
76 struct _GooPlayerClass
77 {
78 	GObjectClass __parent_class;
79 
80 	/*<signals>*/
81 
82 	void        (*start)             (GooPlayer       *player,
83 					  GooPlayerAction  action);
84 	void        (*done)              (GooPlayer       *player,
85 					  GooPlayerAction  action,
86 					  GError          *error);
87         void        (*progress)          (GooPlayer       *player,
88 					  double           fraction);
89         void        (*message)           (GooPlayer       *player,
90 					  const char      *msg);
91 	void        (*state_changed)     (GooPlayer       *player);
92 };
93 
94 GType            goo_player_get_type            (void);
95 GooPlayer *      goo_player_new                 (BraseroDrive    *drive);
96 void             goo_player_set_drive           (GooPlayer       *player,
97 						 BraseroDrive    *drive);
98 BraseroDrive *   goo_player_get_drive           (GooPlayer       *player);
99 const char *     goo_player_get_device          (GooPlayer       *player);
100 gboolean         goo_player_is_audio_cd         (GooPlayer       *player);
101 void             goo_player_hibernate           (GooPlayer       *player,
102 						 gboolean         hibernate);
103 gboolean         goo_player_is_hibernate        (GooPlayer       *player);
104 void             goo_player_update              (GooPlayer       *player);
105 void             goo_player_list                (GooPlayer       *player);
106 void             goo_player_seek_track          (GooPlayer       *player,
107 						 int              track_to_play);
108 int              goo_player_get_current_track   (GooPlayer       *player);
109 void             goo_player_set_next_track	(GooPlayer       *player,
110 						 int              next_track_to_play);
111 void             goo_player_skip_to             (GooPlayer       *player,
112 						 guint            seconds);
113 void             goo_player_play                (GooPlayer       *player);
114 void             goo_player_pause               (GooPlayer       *player);
115 void             goo_player_stop                (GooPlayer       *player);
116 void             goo_player_eject               (GooPlayer       *player);
117 GooPlayerAction  goo_player_get_action          (GooPlayer       *player);
118 GooPlayerState   goo_player_get_state           (GooPlayer       *player);
119 const char *     goo_player_get_discid          (GooPlayer       *player);
120 void             goo_player_set_album           (GooPlayer       *player,
121 						 AlbumInfo       *album);
122 AlbumInfo *      goo_player_get_album           (GooPlayer       *player);
123 void             goo_player_set_audio_volume    (GooPlayer       *player,
124 						 double           vol);
125 double           goo_player_get_audio_volume    (GooPlayer       *player);
126 gboolean         goo_player_get_is_busy         (GooPlayer       *player);
127 
128 #endif /* GOO_PLAYER_H */
129