# HG changeset patch # User leo_sobral # Date 1173538885 0 # Node ID 2127788267bdd2ae6ae8f02070ea386c8bd983eb # Parent 7b062aa36323ae6e1914f37b973df3f4bb18429a [svn r416] added static to socket_send function from gmyth_vlc.c diff -r 7b062aa36323 -r 2127788267bd gmyth/src/gmyth_vlc.c --- a/gmyth/src/gmyth_vlc.c Fri Mar 09 17:57:59 2007 +0000 +++ b/gmyth/src/gmyth_vlc.c Sat Mar 10 15:01:25 2007 +0000 @@ -35,7 +35,9 @@ #include "gmyth_debug.h" #include "gmyth_socket.h" - +/* static functions */ +static int _socket_send(int socket, gchar* msg); +static int _socket_recv(int socket, gchar* buf); /** Primitive function to send a message through the socket * @@ -43,7 +45,8 @@ * @param msg the message itself * @return 0 if success */ -int socket_send(int socket, gchar* msg) +static int +_socket_send(int socket, gchar* msg) { size_t size = strlen(msg) + 2; // (\n + \0) gchar* final = (gchar *)g_malloc0(sizeof(gchar) * size); @@ -63,7 +66,8 @@ * @param buf Buffer to put the message * @return 0 if success */ -int socket_recv(int socket, gchar* buf) +static int +_socket_recv(int socket, gchar* buf) { int numbytes = 0; @@ -86,7 +90,8 @@ * @param the params for the option * @return 0 if success */ -int gmyth_vlc_setup_output(GMythVlc *vlc, int output, \ +int +gmyth_vlc_setup_output(GMythVlc *vlc, int output, \ gchar* kind, gchar* opts) { int ret; @@ -96,14 +101,13 @@ g_snprintf(msg, size, "setup output%d %s %s", output,\ kind, opts); - ret = socket_send(vlc->sockfd, msg); + ret = _socket_send(vlc->sockfd, msg); g_free(msg); return ret; } - /** Function to clean the playlist * * @param vlc structure with options for vlc @@ -111,9 +115,10 @@ * @param file the file we want to insert in the playlist * @return 0 if success */ -int gmyth_vlc_clean_playlist(GMythVlc *vlc) +int +gmyth_vlc_clean_playlist(GMythVlc *vlc) { - return socket_send(vlc->sockfd, "del all"); + return _socket_send(vlc->sockfd, "del all"); } @@ -124,7 +129,8 @@ * @param command play, stop or pause(just for vod) * @return 0 if success */ -int gmyth_vlc_control_input(GMythVlc *vlc, int output, \ +int +gmyth_vlc_control_input(GMythVlc *vlc, int output, \ gchar* command) { size_t size = 25; @@ -132,7 +138,7 @@ g_snprintf(msg, size, "control output%d %s", output,\ command); - int ret = socket_send(vlc->sockfd, msg); + int ret = _socket_send(vlc->sockfd, msg); g_free(msg); return ret; @@ -147,7 +153,8 @@ * @param file the file we want to insert in the playlist * @return 0 if success */ -int gmyth_vlc_create_input(GMythVlc *vlc, int output,\ +int +gmyth_vlc_create_input(GMythVlc *vlc, int output,\ gchar* file) { return gmyth_vlc_setup_output(vlc, output, "input",\ @@ -162,7 +169,8 @@ * @param port * @return 0 if success */ -int gmyth_vlc_create_channel(GMythVlc *vlc, gchar* type,\ +int +gmyth_vlc_create_channel(GMythVlc *vlc, gchar* type,\ int port, int vcodec) { int ret; @@ -171,7 +179,7 @@ g_snprintf(msg, size, "new output%d %s enabled loop", \ vlc->n_outputs, type); - ret = socket_send(vlc->sockfd, msg); + ret = _socket_send(vlc->sockfd, msg); if (ret > -1) { @@ -218,7 +226,8 @@ * @param passwd the password for telnet interface * @return 0 if success */ -int gmyth_vlc_connect(GMythVlc *vlc, GMythBackendInfo *backend_info,\ +int +gmyth_vlc_connect(GMythVlc *vlc, GMythBackendInfo *backend_info,\ gchar* passwd, int port) { int numbytes; @@ -250,15 +259,15 @@ // Receive the Password's Prompt - numbytes = socket_recv(vlc->sockfd, vlc->buf); + numbytes = _socket_recv(vlc->sockfd, vlc->buf); // Send the Password. We don't have to // care about passwords being sent in plain text // because telnet protocol does it. - socket_send(vlc->sockfd, passwd); + _socket_send(vlc->sockfd, passwd); // Receive the Welcome msg - numbytes = socket_recv(vlc->sockfd, vlc->buf); + numbytes = _socket_recv(vlc->sockfd, vlc->buf); if (numbytes > -1) if (strncmp(vlc->buf,"\r\nWrong password.", 17) == 0) { @@ -277,7 +286,8 @@ * @param backend_info infos about the backend * @return 0 if success */ -int gmyth_vlc_disconnect(GMythVlc *vlc) +int +gmyth_vlc_disconnect(GMythVlc *vlc) { int ret;