Mercurial > mplayer.hg
changeset 17153:c0b147bdf49d
Harcoded eng strings on libmpdemux/network.c to help_mp
author | reynaldo |
---|---|
date | Sat, 10 Dec 2005 01:40:18 +0000 |
parents | 3486af55e68b |
children | 1aeadf8c95a6 |
files | help/help_mp-en.h libmpdemux/network.c |
diffstat | 2 files changed, 53 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/help/help_mp-en.h Fri Dec 09 17:06:47 2005 +0000 +++ b/help/help_mp-en.h Sat Dec 10 01:40:18 2005 +0000 @@ -1376,3 +1376,25 @@ #define MSGTR_MPDEMUX_CUEREAD_CannotReadNBytesOfPayload "[bincue] Couldn't read %d bytes of payload\n" #define MSGTR_MPDEMUX_CUEREAD_CueStreamInfo_FilenameTrackTracksavail "CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n" +// network.c + +#define MSGTR_MPDEMUX_NW_UnknownAF "Unknown address family %d\n" +#define MSGTR_MPDEMUX_NW_ResolvingHostForAF "Resolving %s for %s...\n" +#define MSGTR_MPDEMUX_NW_CantResolv "Couldn't resolve name for %s: %s\n" +#define MSGTR_MPDEMUX_NW_ConnectingToServer "Connecting to server %s[%s]:%d ...\n" +#define MSGTR_MPDEMUX_NW_CantConnect2Server "Failed to connect to server with %s\n" +#define MSGTR_MPDEMUX_NW_SelectFailed "Select failed.\n" +#define MSGTR_MPDEMUX_NW_ConnTimeout "Connection timeout.\n" +#define MSGTR_MPDEMUX_NW_GetSockOptFailed "getsockopt failed : %s\n" +#define MSGTR_MPDEMUX_NW_ConnectError "Connect error : %s\n" +#define MSGTR_MPDEMUX_NW_InvalidProxySettingTryingWithout "Invalid proxy setting...Trying without proxy.\n" +#define MSGTR_MPDEMUX_NW_CantResolvTryingWithoutProxy "Could not find resolve remote hostname for AF_INET. Trying without proxy.\n" +#define MSGTR_MPDEMUX_NW_ErrSendingHTTPRequest "Error while sending HTTP request: didn't sent all the request.\n" +#define MSGTR_MPDEMUX_NW_ReadFailed "Read failed.\n" +#define MSGTR_MPDEMUX_NW_Read0CouldBeEOF "http_read_response read 0 -ie- EOF\n" +#define MSGTR_MPDEMUX_NW_AuthFailed "Authentication failed. Please use the option -user and -passwd to provide your username/password for a list of URLs, or form an URL like: http://username:password@hostname/file\n" +#define MSGTR_MPDEMUX_NW_AuthRequiredFor "Authentication required for %s\n" +#define MSGTR_MPDEMUX_NW_AuthRequired "Authentication required.\n" +#define MSGTR_MPDEMUX_NW_NoPasswdProvidedTryingBlank "No password provided, trying blank password.\n" +#define MSGTR_MPDEMUX_NW_ErrServerReturned "Server return %d: %s\n" +#define MSGTR_MPDEMUX_NW_CacheSizeSetTo "Cache size set to %d KBytes\n"
--- a/libmpdemux/network.c Fri Dec 09 17:06:47 2005 +0000 +++ b/libmpdemux/network.c Sat Dec 10 01:40:18 2005 +0000 @@ -16,6 +16,9 @@ #include "config.h" +#include "mp_msg.h" +#include "help_mp.h" + #ifndef HAVE_WINSOCK2 #define closesocket close #else @@ -93,7 +96,7 @@ streaming_ctrl_t *streaming_ctrl; streaming_ctrl = (streaming_ctrl_t*)malloc(sizeof(streaming_ctrl_t)); if( streaming_ctrl==NULL ) { - mp_msg(MSGT_NETWORK,MSGL_FATAL,"Failed to allocate memory\n"); + mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); return NULL; } memset( streaming_ctrl, 0, sizeof(streaming_ctrl_t) ); @@ -165,7 +168,7 @@ case AF_INET6: our_s_addr = (void *) &server_address.six.sin6_addr; break; #endif default: - mp_msg(MSGT_NETWORK,MSGL_ERR, "Unknown address family %d:\n", af); + mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af); return -2; } @@ -182,7 +185,7 @@ if ( inet_addr(host)==INADDR_NONE ) #endif { - if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,"Resolving %s for %s...\n", host, af2String(af)); + if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ResolvingHostForAF, host, af2String(af)); #ifdef HAVE_GETHOSTBYNAME2 hp=(struct hostent*)gethostbyname2( host, af ); @@ -190,7 +193,7 @@ hp=(struct hostent*)gethostbyname( host ); #endif if( hp==NULL ) { - if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,"Couldn't resolve name for %s: %s\n", af2String(af), host); + if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_CantResolv, af2String(af), host); return -2; } @@ -217,7 +220,7 @@ break; #endif default: - mp_msg(MSGT_NETWORK,MSGL_ERR, "Unknown address family %d:\n", af); + mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af); return -2; } @@ -226,7 +229,7 @@ #else inet_ntop(af, our_s_addr, buf, 255); #endif - if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s[%s]:%d ...\n", host, buf , port ); + if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port ); // Turn the socket as non blocking so we can timeout on the connection #ifndef HAVE_WINSOCK2 @@ -241,7 +244,7 @@ #else if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) { #endif - if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to connect to server with %s\n", af2String(af)); + if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_CantConnect2Server, af2String(af)); closesocket(socket_server_fd); return -1; } @@ -252,11 +255,11 @@ FD_SET( socket_server_fd, &set ); // When the connection will be made, we will have a writable fd while((ret = select(socket_server_fd+1, NULL, &set, NULL, &tv)) == 0) { - if( ret<0 ) mp_msg(MSGT_NETWORK,MSGL_ERR,"select failed\n"); + if( ret<0 ) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_SelectFailed); else if(ret > 0) break; else if(count > 30 || mp_input_check_interrupt(500)) { if(count > 30) - mp_msg(MSGT_NETWORK,MSGL_ERR,"Connection timeout\n"); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ConnTimeout); else mp_msg(MSGT_NETWORK,MSGL_V,"Connection interuppted by user\n"); return -3; @@ -279,11 +282,11 @@ err_len = sizeof(int); ret = getsockopt(socket_server_fd,SOL_SOCKET,SO_ERROR,&err,&err_len); if(ret < 0) { - mp_msg(MSGT_NETWORK,MSGL_ERR,"getsockopt failed : %s\n",strerror(errno)); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_GetSockOptFailed,strerror(errno)); return -2; } if(err > 0) { - mp_msg(MSGT_NETWORK,MSGL_ERR,"Connect error : %s\n",strerror(err)); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ConnectError,strerror(err)); return -1; } @@ -335,14 +338,15 @@ URL_t *proxy_url = url_new( proxy ); if( proxy_url==NULL ) { - mp_msg(MSGT_NETWORK,MSGL_WARN,"Invalid proxy setting...Trying without proxy.\n"); + mp_msg(MSGT_NETWORK,MSGL_WARN, + MSGTR_MPDEMUX_NW_InvalidProxySettingTryingWithout); return url_out; } #ifdef HAVE_AF_INET6 if (network_ipv4_only_proxy && (gethostbyname(url->hostname)==NULL)) { mp_msg(MSGT_NETWORK,MSGL_WARN, - "Could not find resolve remote hostname for AF_INET. Trying without proxy.\n"); + MSGTR_MPDEMUX_NW_CantResolvTryingWithoutProxy); url_free(proxy_url); return url_out; } @@ -352,7 +356,7 @@ len = strlen( proxy_url->hostname ) + strlen( url->url ) + 20; // 20 = http_proxy:// + port new_url = malloc( len+1 ); if( new_url==NULL ) { - mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); + mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); url_free(proxy_url); return url_out; } @@ -435,7 +439,7 @@ ret = send( fd, http_hdr->buffer, http_hdr->buffer_size, 0 ); if( ret!=(int)http_hdr->buffer_size ) { - mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while sending HTTP request: didn't sent all the request\n"); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ErrSendingHTTPRequest); goto err_out; } @@ -461,12 +465,12 @@ do { i = recv( fd, response, BUFFER_SIZE, 0 ); if( i<0 ) { - mp_msg(MSGT_NETWORK,MSGL_ERR,"Read failed\n"); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ReadFailed); http_free( http_hdr ); return NULL; } if( i==0 ) { - mp_msg(MSGT_NETWORK,MSGL_ERR,"http_read_response read 0 -ie- EOF\n"); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_Read0CouldBeEOF); http_free( http_hdr ); return NULL; } @@ -481,9 +485,7 @@ char *aut; if( *auth_retry==1 ) { - mp_msg(MSGT_NETWORK,MSGL_ERR,"Authentication failed\n"); - mp_msg(MSGT_NETWORK,MSGL_ERR,"Please use the option -user and -passwd to provide your username/password for a list of URLs,\n"); - mp_msg(MSGT_NETWORK,MSGL_ERR,"or form an URL like: http://username:password@hostname/file\n"); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_AuthFailed); return -1; } if( *auth_retry>0 ) { @@ -502,30 +504,28 @@ char *aut_space; aut_space = strstr(aut, "realm="); if( aut_space!=NULL ) aut_space += 6; - mp_msg(MSGT_NETWORK,MSGL_INFO,"Authentication required for %s\n", aut_space); + mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_AuthRequiredFor, aut_space); } else { - mp_msg(MSGT_NETWORK,MSGL_INFO,"Authentication required\n"); + mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_AuthRequired); } if( network_username ) { url->username = strdup(network_username); if( url->username==NULL ) { - mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); + mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); return -1; } } else { - mp_msg(MSGT_NETWORK,MSGL_ERR,"Unable to read the username\n"); - mp_msg(MSGT_NETWORK,MSGL_ERR,"Please use the option -user and -passwd to provide your username/password for a list of URLs,\n"); - mp_msg(MSGT_NETWORK,MSGL_ERR,"or form an URL like: http://username:password@hostname/file\n"); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_AuthFailed); return -1; } if( network_password ) { url->password = strdup(network_password); if( url->password==NULL ) { - mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); + mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); return -1; } } else { - mp_msg(MSGT_NETWORK,MSGL_INFO,"No password provided, trying blank password\n"); + mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_NoPasswdProvidedTryingBlank); } (*auth_retry)++; return 0; @@ -558,7 +558,7 @@ } break; default: - mp_msg(MSGT_NETWORK,MSGL_ERR,"Server return %d: %s\n", http_hdr->status_code, http_hdr->reason_phrase ); + mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ErrServerReturned, http_hdr->status_code, http_hdr->reason_phrase ); close( fd ); fd = -1; } @@ -580,7 +580,7 @@ //printf("streaming_bufferize\n"); streaming_ctrl->buffer = (char*)malloc(size); if( streaming_ctrl->buffer==NULL ) { - mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); + mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); return -1; } memcpy( streaming_ctrl->buffer, buffer, size ); @@ -640,7 +640,7 @@ stream_cache_size = (stream->streaming_ctrl->prebuffer_size/1024)*5; if( stream_cache_size<64 ) stream_cache_size = 64; // 16KBytes min buffer } - mp_msg(MSGT_NETWORK,MSGL_INFO,"Cache size set to %d KBytes\n", stream_cache_size); + mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_CacheSizeSetTo, stream_cache_size); } }