00001 /* C++ wrapper for libshout2 00002 * 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Lesser General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2.1 of the License, or (at your option) any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 * 00017 * For questions regarding this program contact 00018 * Daniel Holth <dholth@fastmail.fm> 00019 */ 00020 00029 #ifndef __SHOUTCC_H__ 00030 #define __SHOUTCC_H__ 00031 00032 #include <shout/shout.h> 00033 #include <string> 00034 00035 00036 class ShoutMetadata; 00037 00039 00042 class ShoutErr { 00043 public: 00045 int ern; 00047 std::string err; 00048 00049 ShoutErr(int n); 00050 ShoutErr(int n, std::string e) { 00051 this->ern = n; 00052 this->err = e; } 00053 }; 00054 00056 class Shout { 00057 private: 00059 shout_t *self; 00060 00061 public: 00062 shout_t *get_self() { return this->self; } 00063 00064 Shout(); 00065 ~Shout(); 00066 00067 void check(int code); 00068 00069 const char *get_error(); 00070 00071 int get_errno(); 00072 00073 bool get_connected(); 00074 00075 void set_host(const char *host); 00076 const char *get_host(); 00077 00078 void set_port(unsigned short port); 00079 unsigned short get_port(); 00080 00081 void set_password(const char *password); 00082 const char *get_password(); 00083 00084 void set_mount(const char *mount); 00085 const char *get_mount(); 00086 00087 void set_name(const char *name); 00088 const char *get_name(); 00089 00090 void set_url(const char *url); 00091 const char *get_url(); 00092 00093 void set_genre(const char *genre); 00094 const char *get_genre(); 00095 00096 void set_user(const char *username); 00097 const char *get_user(); 00098 00099 void set_agent(const char *username); 00100 const char *get_agent(); 00101 00102 void set_description(const char *description); 00103 const char *get_description(); 00104 00105 void set_dumpfile(const char *dumpfile); 00106 const char *get_dumpfile(); 00107 00108 void set_audio_info(const char *name, const char *value); 00109 const char *get_audio_info(const char *name); 00110 00111 void set_public(unsigned int make_public); 00112 unsigned int get_public(); 00113 00114 void set_format(unsigned int format); 00115 unsigned int get_format(); 00116 00117 void set_protocol(unsigned int protocol); 00118 unsigned int get_protocol(); 00119 00120 void open(); 00121 void close(); 00122 void send(const unsigned char *data, size_t len); 00123 ssize_t send_raw(const unsigned char *data, size_t len); 00124 void sync(); 00125 int delay(); 00126 00127 void set_metadata(ShoutMetadata *metadata); 00128 00129 void set_nonblocking(bool unblocking); 00130 bool get_nonblocking(); 00131 00132 ssize_t queuelen(); 00133 }; 00134 00136 class ShoutMetadata { 00137 public: 00138 shout_metadata_t *self; 00139 00140 ShoutMetadata() { this->self = shout_metadata_new(); } 00141 ~ShoutMetadata() { shout_metadata_free(this->self); } 00142 00143 void add(const char *name, const char *value) { shout_metadata_add(this->self, name, value); } 00144 }; 00145 00146 #endif
1.4.7