MPD 0.17~git
|
00001 /* 00002 * Copyright (C) 2003-2011 The Music Player Daemon Project 00003 * http://www.musicpd.org 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 /* 00021 * Based on the RTSP client by Shiro Ninomiya <shiron@snino.com> 00022 */ 00023 00024 #ifndef MPD_RTSP_CLIENT_H 00025 #define MPD_RTSP_CLIENT_H 00026 00027 #include <stdbool.h> 00028 #include <glib.h> 00029 00030 #ifdef WIN32 00031 #include <ws2tcpip.h> 00032 #include <winsock.h> 00033 #else 00034 #include <netinet/in.h> 00035 #endif 00036 00037 struct key_data { 00038 char *key; 00039 char *data; 00040 struct key_data *next; 00041 }; 00042 00043 struct rtspcl_data { 00044 GMutex *mutex; 00045 GCond *cond; 00046 00047 GQueue *received_lines; 00048 00049 struct tcp_socket *tcp_socket; 00050 00051 char url[128]; 00052 int cseq; 00053 struct key_data *exthds; 00054 char *session; 00055 char *transport; 00056 unsigned short server_port; 00057 unsigned short control_port; 00058 struct in_addr host_addr; 00059 struct in_addr local_addr; 00060 const char *useragent; 00061 00062 }; 00063 00067 static inline GQuark 00068 rtsp_client_quark(void) 00069 { 00070 return g_quark_from_static_string("rtsp_client"); 00071 } 00072 00073 void 00074 free_kd(struct key_data *kd); 00075 00076 char * 00077 kd_lookup(struct key_data *kd, const char *key); 00078 00079 G_GNUC_MALLOC 00080 struct rtspcl_data * 00081 rtspcl_open(void); 00082 00083 bool 00084 rtspcl_connect(struct rtspcl_data *rtspcld, const char *host, short destport, 00085 const char *sid, GError **error_r); 00086 00087 void 00088 rtspcl_close(struct rtspcl_data *rtspcld); 00089 00090 void 00091 rtspcl_add_exthds(struct rtspcl_data *rtspcld, const char *key, char *data); 00092 00093 bool 00094 exec_request(struct rtspcl_data *rtspcld, const char *cmd, 00095 const char *content_type, const char *content, 00096 int get_response, 00097 const struct key_data *hds, struct key_data **kd, 00098 GError **error_r); 00099 00100 bool 00101 rtspcl_set_parameter(struct rtspcl_data *rtspcld, const char *parameter, 00102 GError **error_r); 00103 00104 void 00105 rtspcl_set_useragent(struct rtspcl_data *rtspcld, const char *name); 00106 00107 bool 00108 rtspcl_announce_sdp(struct rtspcl_data *rtspcld, const char *sdp, 00109 GError **error_r); 00110 00111 bool 00112 rtspcl_setup(struct rtspcl_data *rtspcld, struct key_data **kd, 00113 int control_port, int ntp_port, 00114 GError **error_r); 00115 00116 bool 00117 rtspcl_record(struct rtspcl_data *rtspcld, 00118 int seq_num, int rtptime, 00119 GError **error_r); 00120 00121 char * 00122 rtspcl_local_ip(struct rtspcl_data *rtspcld); 00123 00124 #endif