1 /* Copyright (C) Alexandre Rosenfeld 2010 <alexandre.rosenfeld@gmail.com> 2 * 3 * This library is free software; you can redistribute it and/or 4 * modify it under the terms of the GNU Lesser General Public 5 * License as published by the Free Software Foundation; either 6 * version 2.1 of the License, or (at your option) any later version. 7 * 8 * This library is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public 14 * License along with this library; if not, write to the Free Software 15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 */ 17 18 #ifndef _DACP_PLAYER_H_ 19 #define _DACP_PLAYER_H_ 20 21 #include <glib-object.h> 22 23 #include "daap-record.h" 24 25 G_BEGIN_DECLS 26 /** 27 * DACP_TYPE_PLAYER: 28 * 29 * The type for #DACPPlayer. 30 */ 31 #define DACP_TYPE_PLAYER (dacp_player_get_type ()) 32 /** 33 * DACP_PLAYER: 34 * @o: Object which is subject to casting. 35 * 36 * Casts a #DACPPlayer or derived pointer into a (DACPPlayer *) pointer. 37 * Depending on the current debugging level, this function may invoke 38 * certain runtime checks to identify invalid casts. 39 */ 40 #define DACP_PLAYER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DACP_TYPE_PLAYER, DACPPlayer)) 41 /** 42 * IS_DACP_PLAYER: 43 * @o: Instance to check for being a %DACP_TYPE_PLAYER. 44 * 45 * Checks whether a valid #GTypeInstance pointer is of type %DACP_TYPE_PLAYER. 46 */ 47 #define IS_DACP_PLAYER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DACP_TYPE_PLAYER)) 48 /** 49 * DACP_PLAYER_GET_INTERFACE: 50 * @o: a #DACPPlayer instance. 51 * 52 * Get the insterface structure associated to a #DACPPlayer instance. 53 * 54 * Returns: pointer to object interface structure. 55 */ 56 #define DACP_PLAYER_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), \ 57 DACP_TYPE_PLAYER, DACPPlayerIface)) 58 typedef struct _DACPPlayerIface DACPPlayerIface; 59 typedef struct _DACPPlayer DACPPlayer; 60 61 typedef enum 62 { 63 DACP_REPEAT_NONE = 0, 64 DACP_REPEAT_SINGLE = 1, 65 DACP_REPEAT_ALL = 2 66 } DACPRepeatState; 67 68 typedef enum 69 { 70 DACP_PLAY_STOPPED = 2, 71 DACP_PLAY_PAUSED = 3, 72 DACP_PLAY_PLAYING = 4 73 } DACPPlayState; 74 75 struct _DACPPlayerIface 76 { 77 GTypeInterface parent_class; 78 79 DAAPRecord *(*now_playing_record) (DACPPlayer * player); 80 guchar *(*now_playing_artwork) (DACPPlayer * player, 81 guint width, guint height); 82 void (*play_pause) (DACPPlayer * player); 83 void (*pause) (DACPPlayer * player); 84 void (*next_item) (DACPPlayer * player); 85 void (*prev_item) (DACPPlayer * player); 86 87 void (*cue_clear) (DACPPlayer * player); 88 void (*cue_play) (DACPPlayer * player, GList * records, guint index); 89 }; 90 91 GType dacp_player_get_type (void); 92 93 /** 94 * dacp_player_now_playing_record: 95 * @player: a player 96 */ 97 DAAPRecord *dacp_player_now_playing_record (DACPPlayer * player); 98 99 /** 100 * dacp_player_now_playing_artwork: 101 * @player: a player 102 * @width: width 103 * @height: height 104 */ 105 guchar *dacp_player_now_playing_artwork (DACPPlayer * player, 106 guint width, guint height); 107 108 /** 109 * dacp_player_play_pause: 110 * @player: a player 111 */ 112 void dacp_player_play_pause (DACPPlayer * player); 113 114 /** 115 * dacp_player_pause: 116 * @player: a player 117 */ 118 void dacp_player_pause (DACPPlayer * player); 119 120 /** 121 * dacp_player_next_item: 122 * @player: a player 123 */ 124 void dacp_player_next_item (DACPPlayer * player); 125 126 /** 127 * dacp_player_now_prev_item: 128 * @player: a player 129 */ 130 void dacp_player_prev_item (DACPPlayer * player); 131 132 /** 133 * dacp_player_cue_clear: 134 * @player: a player 135 */ 136 void dacp_player_cue_clear (DACPPlayer * player); 137 138 /** 139 * dacp_player_cue_play: 140 * @player: a player 141 * @records : a list of records 142 * @index: an index 143 */ 144 void dacp_player_cue_play (DACPPlayer * player, GList * records, guint index); 145 146 G_END_DECLS 147 #endif /* _DACP_PLAYER_H_ */ 148