1 #ifndef __MPD_INTERNAL_LIB_
2 #define __MPD_INTERNAL_LIB_
4 #include "libmpdclient.h"
7 typedef struct _MpdData_real
{
17 mpd_PlaylistFile
*playlist
;
19 mpd_OutputEntity
*output_dev
; /* from devices */
22 void (*freefunc
)(void *userdata
);
24 struct _MpdData_real
*next
;
25 /* Previous MpdData in the list */
26 struct _MpdData_real
*prev
;
27 struct _MpdData_real
*first
;
32 typedef struct _MpdQueue MpdQueue
;
33 typedef struct _MpdServerState
{
34 /* information needed to detect changes on mpd's side */
36 long long storedplaylistid
;
40 unsigned long dbUpdateTime
;
49 unsigned int samplerate
;
52 unsigned long playlistLength
;
58 /* internal use only */
59 typedef struct _MpdCommand
{
66 typedef struct _MpdObj
{
67 /* defines if we are connected */
68 /* This should be made true if and only if the connection is up and running */
70 /* information needed to connect to mpd */
74 float connection_timeout
;
76 /* mpd's structures */
77 mpd_Connection
*connection
;
80 mpd_Song
*CurrentSong
;
82 /* used to store/detect serverside status changes */
83 MpdServerState CurrentState
;
84 MpdServerState OldState
;
86 /* new style signals */
88 ErrorCallback the_error_callback
;
89 void *the_error_signal_userdata
;
90 /* song status changed */
91 StatusChangedCallback the_status_changed_callback
;
92 void *the_status_changed_signal_userdata
;
93 /* (dis)connect signal */
94 ConnectionChangedCallback the_connection_changed_callback
;
95 void *the_connection_changed_signal_userdata
;
102 /* internal values */
103 /* this "locks" the connections. so we can't have to commands competing with eachother */
104 short int connection_lock
;
109 /* TODO: this is a temporary implementation, I want something nice with commands that are and aren't allowed to use.
110 * so use commands and notcommands functions
111 *TODO: Make a callback when a commando isn't allowed, so the client application can actually offer the user to enter password
113 MpdCommand
* commands
;
115 * tag type for a search
121 * For tracking changed outputs.
122 * A hack for retarted mpd
131 typedef enum MpdQueueType
{
135 MPD_QUEUE_DELETE_POS
,
136 MPD_QUEUE_COMMAND
/* abuse!!! */
139 typedef struct _MpdQueue
{
140 struct _MpdQueue
*next
;
141 struct _MpdQueue
*prev
;
142 struct _MpdQueue
*first
;
144 /* what item to queue, (add/load/remove)*/
146 /* for adding files/load playlist/adding streams */
152 /* Internal Queue struct functions */
153 MpdQueue
* mpd_new_queue_struct ();
154 void mpd_queue_get_next (MpdObj
*mi
);
156 /* Internal Data struct functions */
157 MpdData
* mpd_new_data_struct (void);
158 MpdData
* mpd_new_data_struct_append (MpdData
* data
);
159 MpdData
* mpd_data_concatenate (MpdData
* const first
, MpdData
* const second
);
160 MpdData
* mpd_data_get_next_real (MpdData
* const data
, int kill_list
);
161 /* more internal stuff*/
164 * @param mi a #MpdObj
166 * Checks if mpd_stats is availible, and updates when needed.
168 * @returns a #MpdError
170 int mpd_stats_check(MpdObj
*mi
);
172 int mpd_lock_conn(MpdObj
*mi
);
173 int mpd_unlock_conn(MpdObj
*mi
);
174 /*MpdData * mpd_playlist_sort_artist_list(MpdData *data);*/
175 MpdData
* mpd_misc_sort_tag_list(MpdData
*data
);
179 char * strndup (const char *s
, size_t n
);
182 int mpd_server_get_allowed_commands(MpdObj
*mi
);
183 typedef enum _MpdSearchType
{
184 MPD_SEARCH_TYPE_NONE
,
185 MPD_SEARCH_TYPE_FIND
,
186 MPD_SEARCH_TYPE_SEARCH
,
187 MPD_SEARCH_TYPE_LIST
,
188 MPD_SEARCH_TYPE_PLAYLIST_FIND
,
189 MPD_SEARCH_TYPE_PLAYLIST_SEARCH
,
190 MPD_SEARCH_TYPE_STATS
192 int mpd_server_update_outputs(MpdObj
*mi
);