libmpdclient.h   libmpdclient.h 
/* libmpdclient /* libmpdclient
* (c)2002 by Warren Dukes (shank@mercury.chem.pitt.edu) * (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org * This project's homepage is: http://www.musicpd.org
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
skipping to change at line 24 skipping to change at line 24
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software * License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
*/ */
#ifndef LIBMPDCLIENT_H #ifndef LIBMPDCLIENT_H
#define LIBMPDCLIENT_H #define LIBMPDCLIENT_H
#include <sys/param.h> #include <sys/param.h>
#include <sys/time.h>
#define MPD_BUFFER_MAX_LENGTH 50000 #define MPD_BUFFER_MAX_LENGTH 50000
#define MPD_WELCOME_MESSAGE "OK MPD " #define MPD_WELCOME_MESSAGE "OK MPD "
#define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */ #define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */
#define MPD_ERROR_SYSTEM 11 /* system error */ #define MPD_ERROR_SYSTEM 11 /* system error */
#define MPD_ERROR_UNKHOST 12 /* unknown host */ #define MPD_ERROR_UNKHOST 12 /* unknown host */
#define MPD_ERROR_CONNPORT 13 /* problems connecting to port on host */ #define MPD_ERROR_CONNPORT 13 /* problems connecting to port on host */
#define MPD_ERROR_NOTMPD 14 /* mpd not running on port at host */ #define MPD_ERROR_NOTMPD 14 /* mpd not running on port at host */
#define MPD_ERROR_NORESPONSE 15 /* no response on attempting to connect * / #define MPD_ERROR_NORESPONSE 15 /* no response on attempting to connect * /
skipping to change at line 68 skipping to change at line 69
/* this will be set to 1 if there is an error, 0 if not */ /* this will be set to 1 if there is an error, 0 if not */
int error; int error;
/* DON'T TOUCH any of the rest of this stuff */ /* DON'T TOUCH any of the rest of this stuff */
int sock; int sock;
char buffer[MPD_BUFFER_MAX_LENGTH+1]; char buffer[MPD_BUFFER_MAX_LENGTH+1];
int buflen; int buflen;
int bufstart; int bufstart;
int doneProcessing; int doneProcessing;
int commandList; int commandList;
mpd_ReturnElement * returnElement; mpd_ReturnElement * returnElement;
int timeout; /* timeout in seconds */ struct timeval timeout;
} mpd_Connection; } mpd_Connection;
/* mpd_newConnection /* mpd_newConnection
* use this to open a new connection * use this to open a new connection
* you should use mpd_closeConnection, when your done with the connection, * you should use mpd_closeConnection, when your done with the connection,
* even if an error has occurred * even if an error has occurred
* _timeout_ is the connection timeout period in seconds * _timeout_ is the connection timeout period in seconds
*/ */
mpd_Connection * mpd_newConnection(const char * host, int port, int timeout mpd_Connection * mpd_newConnection(const char * host, int port, float timeo
); ut);
void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout);
/* mpd_closeConnection /* mpd_closeConnection
* use this to close a connection and free'ing subsequent memory * use this to close a connection and free'ing subsequent memory
*/ */
void mpd_closeConnection(mpd_Connection * connection); void mpd_closeConnection(mpd_Connection * connection);
/* mpd_clearError /* mpd_clearError
* clears error * clears error
*/ */
void mpd_clearError(mpd_Connection * connection); void mpd_clearError(mpd_Connection * connection);
skipping to change at line 116 skipping to change at line 119
/* 1 if repeat is on, 0 otherwise */ /* 1 if repeat is on, 0 otherwise */
int repeat; int repeat;
/* 1 if random is on, 0 otherwise */ /* 1 if random is on, 0 otherwise */
int random; int random;
/* playlist length */ /* playlist length */
int playlistLength; int playlistLength;
/* playlist, use this to determine when the playlist has changed */ /* playlist, use this to determine when the playlist has changed */
long long playlist; long long playlist;
/* use with MPD_STATUS_STATE_* to determine state of player */ /* use with MPD_STATUS_STATE_* to determine state of player */
int state; int state;
/* crossfade setting in seconds */
int crossfade;
/* if in PLAY or PAUSE state, this is the number of the currently /* if in PLAY or PAUSE state, this is the number of the currently
* playing song in the playlist, beginning with 0 * playing song in the playlist, beginning with 0
*/ */
int song; int song;
/* time in seconds that have elapsed in the currently playing/paused /* time in seconds that have elapsed in the currently playing/paused
* song * song
*/ */
int elapsedTime; int elapsedTime;
/* length in seconds of the currently playing/paused song */ /* length in seconds of the currently playing/paused song */
int totalTime; int totalTime;
/* current bit rate in kbs */ /* current bit rate in kbs */
int bitRate; int bitRate;
/* audio sample rate */
unsigned int sampleRate;
/* audio bits */
int bits;
/* audio channels */
int channels;
/* error */ /* error */
char * error; char * error;
} mpd_Status; } mpd_Status;
/* mpd_getStatus /* mpd_getStatus
* returns status info, be sure to free it with mpd_freeStatus() * returns status info, be sure to free it with mpd_freeStatus()
*/ */
mpd_Status * mpd_getStatus(mpd_Connection * connection); mpd_Status * mpd_getStatus(mpd_Connection * connection);
/* mpd_freeStatus /* mpd_freeStatus
* free's status info malloc'd and returned by mpd_getStatus * free's status info malloc'd and returned by mpd_getStatus
*/ */
void mpd_freeStatus(mpd_Status * status); void mpd_freeStatus(mpd_Status * status);
typedef struct _mpd_Stats {
int numberOfArtists;
int numberOfAlbums;
int numberOfSongs;
unsigned long uptime;
unsigned long dbUpdateTime;
unsigned long playTime;
unsigned long dbPlayTime;
} mpd_Stats;
mpd_Stats * mpd_getStats(mpd_Connection * connection);
void mpd_freeStats(mpd_Stats * stats);
/* SONG STUFF */ /* SONG STUFF */
#define MPD_SONG_NO_TIME -1 #define MPD_SONG_NO_TIME -1
/* mpd_Song /* mpd_Song
* for storing song info returned by mpd * for storing song info returned by mpd
*/ */
typedef struct _mpd_Song { typedef struct _mpd_Song {
/* filename of song */ /* filename of song */
char * file; char * file;
skipping to change at line 276 skipping to change at line 301
/* INFO COMMANDS AND STUFF */ /* INFO COMMANDS AND STUFF */
/* use this function to loop over after calling Info/Listall functions */ /* use this function to loop over after calling Info/Listall functions */
mpd_InfoEntity * mpd_getNextInfoEntity(mpd_Connection * connection); mpd_InfoEntity * mpd_getNextInfoEntity(mpd_Connection * connection);
/* songNum of -1, means to display the whole list */ /* songNum of -1, means to display the whole list */
void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum); void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum);
void mpd_sendListallCommand(mpd_Connection * connection, const char * dir); void mpd_sendListallCommand(mpd_Connection * connection, const char * dir);
void mpd_sendListallInfoCommand(mpd_Connection * connection, const char * d
ir);
void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir); void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir);
#define MPD_TABLE_ARTIST 0 #define MPD_TABLE_ARTIST 0
#define MPD_TABLE_ALBUM 1 #define MPD_TABLE_ALBUM 1
#define MPD_TABLE_TITLE 2 #define MPD_TABLE_TITLE 2
#define MPD_TABLE_FILENAME 3 #define MPD_TABLE_FILENAME 3
void mpd_sendSearchCommand(mpd_Connection * connection, int table, void mpd_sendSearchCommand(mpd_Connection * connection, int table,
const char * str); const char * str);
skipping to change at line 346 skipping to change at line 373
void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to); void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to);
void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2) ; void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2) ;
void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time); void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time);
void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode); void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode);
void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode); void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode);
void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange);
/* WARNING: don't use volume command, its depreacted */
void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange); void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange);
void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds);
int mpd_getCrossfade(mpd_Connection * connection);
void mpd_sendUpdateCommand(mpd_Connection * connection); void mpd_sendUpdateCommand(mpd_Connection * connection);
void mpd_sendPasswordCommand(mpd_Connection * connection, const char * pass
);
/* after executing a command, when your done with it to get its status /* after executing a command, when your done with it to get its status
* (you want to check connection->error for an error) * (you want to check connection->error for an error)
*/ */
void mpd_finishCommand(mpd_Connection * connection); void mpd_finishCommand(mpd_Connection * connection);
/* command list stuff, use this to do things like add files very quickly */ /* command list stuff, use this to do things like add files very quickly */
void mpd_sendCommandListBegin(mpd_Connection * connection); void mpd_sendCommandListBegin(mpd_Connection * connection);
void mpd_sendCommandListEnd(mpd_Connection * connection); void mpd_sendCommandListEnd(mpd_Connection * connection);
 End of changes. 11 change blocks. 
4 lines changed or deleted 42 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/