[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[519] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-08 07:53:13
|
Revision: 519 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=519&view=rev Author: nickols_k Date: 2012-12-08 07:53:03 +0000 (Sat, 08 Dec 2012) Log Message: ----------- move libinput into private of class Tcp Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libmpstream/asf_mmst_streaming.cpp mplayerxp/libmpstream/asf_streaming.cpp mplayerxp/libmpstream/cddb.cpp mplayerxp/libmpstream/librtsp/rtsp_session.cpp mplayerxp/libmpstream/librtsp/rtsp_session.h mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/network.h mplayerxp/libmpstream/s_cdd.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/libmpstream/s_dvdread.cpp mplayerxp/libmpstream/s_file.cpp mplayerxp/libmpstream/s_ftp.cpp mplayerxp/libmpstream/s_lavc.cpp mplayerxp/libmpstream/s_network.cpp mplayerxp/libmpstream/s_null.cpp mplayerxp/libmpstream/s_oss.cpp mplayerxp/libmpstream/s_rtsp.cpp mplayerxp/libmpstream/s_tv.cpp mplayerxp/libmpstream/s_udp.cpp mplayerxp/libmpstream/s_vcdnav.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libmpstream/stream_internal.h mplayerxp/libmpstream/tcp.cpp mplayerxp/libmpstream/tcp.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/Makefile 2012-12-08 07:53:03 UTC (rev 519) @@ -107,7 +107,7 @@ ./version.sh `$(CC) --version` $(MAKE) dep -dep: +dep: version.h $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend $(DO_MAKE) Modified: mplayerxp/libmpstream/asf_mmst_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_mmst_streaming.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/asf_mmst_streaming.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -517,7 +517,7 @@ path=unescpath; if( url1->port==0 ) url1->port=1755; - tcp.open(networking->libinput, url1->hostname, url1->port, Tcp::IP4); + tcp.open(url1->hostname, url1->port, Tcp::IP4); if( !tcp.established()) { delete path; return MPXP_False; Modified: mplayerxp/libmpstream/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_streaming.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/asf_streaming.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -749,7 +749,7 @@ } else { if( url->port==0 ) url->port = 80; } - tcp.open(networking->libinput, url->hostname, url->port, Tcp::IP4); + tcp.open(url->hostname, url->port, Tcp::IP4); if( !tcp.established()) return MPXP_False; http_hdr = asf_http_request( networking ); Modified: mplayerxp/libmpstream/cddb.cpp =================================================================== --- mplayerxp/libmpstream/cddb.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/cddb.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -144,7 +144,7 @@ int __FASTCALL__ cddb_http_request(const char *command, int (*reply_parser)(HTTP_header_t*,cddb_data_t*), cddb_data_t *cddb_data) { char request[4096]; int ret = 0; - Tcp* tcp; + Tcp tcp(cddb_data->libinput,-1); URL_t *url; HTTP_header_t *http_hdr; @@ -159,16 +159,14 @@ return -1; } - tcp = http_send_request(cddb_data->libinput,url,0); - if( !tcp ) { + if(http_send_request(tcp,url,0)!=MPXP_Ok) { MSG_ERR("failed to send the http request\n"); return -1; } - http_hdr = http_read_response( *tcp ); + http_hdr = http_read_response( tcp ); if( http_hdr==NULL ) { MSG_ERR("Failed to read the http response\n"); - delete tcp; return -1; } @@ -188,7 +186,6 @@ http_free( http_hdr ); url_free( url ); - delete tcp; return ret; } @@ -494,7 +491,7 @@ } user_name = getenv("LOGNAME"); } - sprintf( cddb_data->cddb_hello, "&hello=%s+%s+%s", user_name, host_name, "MPlayerXP"); + sprintf( cddb_data->cddb_hello, "&hello=%s+%s+%s+%s", user_name, host_name, "MPlayerXP", VERSION); } int __FASTCALL__ cddb_retrieve(cddb_data_t *cddb_data) { Modified: mplayerxp/libmpstream/librtsp/rtsp_session.cpp =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp_session.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/librtsp/rtsp_session.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -219,7 +219,7 @@ return rtsp_session; } -int rtsp_session_read (rtsp_session_t *self, char *data, int len) { +int rtsp_session_read (libinput_t* libinput,rtsp_session_t *self, char *data, int len) { if (self->real_session) { int to_copy=len; @@ -267,7 +267,7 @@ else if (self->rtp_session) { int l = 0; - Tcp tcp(self->rtp_session->rtp_socket); + Tcp tcp(libinput,self->rtp_session->rtp_socket); l = read_rtp_from_server (tcp, data, len); /* send RTSP and RTCP keepalive */ Modified: mplayerxp/libmpstream/librtsp/rtsp_session.h =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp_session.h 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/librtsp/rtsp_session.h 2012-12-08 07:53:03 UTC (rev 519) @@ -36,7 +36,7 @@ rtsp_session_t *rtsp_session_start(Tcp& tcp, char **mrl, char *path, char *host, int port, int *redir, uint32_t bandwidth, char *user, char *pass); -int rtsp_session_read(rtsp_session_t *session, char *data, int len); +int rtsp_session_read(libinput_t* libinput,rtsp_session_t *session, char *data, int len); void rtsp_session_end(rtsp_session_t *session); Modified: mplayerxp/libmpstream/network.cpp =================================================================== --- mplayerxp/libmpstream/network.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/network.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -94,13 +94,12 @@ { "misc/ultravox", Demuxer::Type_NSV} }; -networking_t* new_networking(libinput_t*libinput) { +networking_t* new_networking() { networking_t *networking = new(zeromem) networking_t; if( networking==NULL ) { MSG_FATAL(MSGTR_OutOfMemory); return NULL; } - networking->libinput=libinput; return networking; } @@ -166,11 +165,10 @@ return url_out; } -Tcp* http_send_request(libinput_t* libinput, URL_t *url, off_t pos ) { +MPXP_Rc http_send_request(Tcp& tcp, URL_t *url, off_t pos ) { HTTP_header_t *http_hdr; URL_t *server_url; char str[256]; - Tcp* tcp=NULL; int ret; int proxy = 0; // Boolean @@ -215,17 +213,19 @@ if( proxy ) { if( url->port==0 ) url->port = 8080; // Default port for the proxy server - tcp = new Tcp(libinput, url->hostname, url->port, Tcp::IP4); + tcp.close(); + tcp.open(url->hostname, url->port, Tcp::IP4); url_free( server_url ); server_url = NULL; } else { if( server_url->port==0 ) server_url->port = 80; // Default port for the web server - tcp = new Tcp(libinput, server_url->hostname, server_url->port, Tcp::IP4); + tcp.close(); + tcp.open(server_url->hostname, server_url->port, Tcp::IP4); } - if(!tcp->established()) goto err_out; + if(!tcp.established()) goto err_out; MSG_DBG2("Request: [%s]\n", http_hdr->buffer ); - ret = tcp->write((uint8_t*)(http_hdr->buffer), http_hdr->buffer_size); + ret = tcp.write((uint8_t*)(http_hdr->buffer), http_hdr->buffer_size); if( ret!=(int)http_hdr->buffer_size ) { MSG_ERR("Error while sending HTTP request: didn't sent all the request\n"); goto err_out; @@ -233,13 +233,12 @@ http_free( http_hdr ); - return tcp; + return MPXP_Ok; err_out: - if (tcp) delete tcp; http_free(http_hdr); if (proxy && server_url) url_free(server_url); - return NULL; + return MPXP_False; } HTTP_header_t* http_read_response( Tcp& tcp ) { @@ -323,13 +322,9 @@ off_t http_seek(Tcp& tcp, networking_t *networking, off_t pos ) { HTTP_header_t *http_hdr = NULL; - Tcp* other_tcp; tcp.close(); - other_tcp = http_send_request(networking->libinput, networking->url, pos ); - if(! other_tcp->established() ) return 0; - tcp=*other_tcp; - delete other_tcp; + if(http_send_request(tcp,networking->url, pos)==MPXP_Ok) return 0; http_hdr = http_read_response(tcp); @@ -398,7 +393,7 @@ #endif // HTTP based protocol if( !strcasecmp(url->protocol, "http") || !strcasecmp(url->protocol, "http_proxy") ) { - tcp = *http_send_request(networking->libinput, url, 0 ); + http_send_request(tcp, url, 0 ); if(!tcp.established()) goto err_out; http_hdr = http_read_response(tcp); @@ -565,7 +560,7 @@ MPXP_Rc ret; if( !tcp.established() ) { - tcp = *http_send_request(networking->libinput, networking->url,0); + http_send_request(tcp, networking->url,0); if( !tcp.established() ) return MPXP_False; http_hdr = http_read_response(tcp); if( http_hdr==NULL ) return MPXP_False; @@ -655,7 +650,7 @@ MPXP_Rc pnm_networking_start(Tcp& tcp,networking_t *networking ) { pnm_t *pnm; - tcp.open(networking->libinput, networking->url->hostname, + tcp.open(networking->url->hostname, networking->url->port ? networking->url->port : 7070); if(!tcp.established()) return MPXP_False; Modified: mplayerxp/libmpstream/network.h =================================================================== --- mplayerxp/libmpstream/network.h 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/network.h 2012-12-08 07:53:03 UTC (rev 519) @@ -47,20 +47,19 @@ int (*networking_read)( Tcp& fd, char *buffer, int buffer_size, networking_t *stream_ctrl ); int (*networking_seek)( Tcp& fd, off_t pos, networking_t *stream_ctrl ); any_t*data; - libinput_t* libinput; /**< provides possibility to inperrupt network streams */ }; extern void fixup_network_stream_cache(networking_t *s); extern MPXP_Rc networking_start(Tcp& fd,networking_t *n, URL_t *url); extern int networking_bufferize(networking_t *networking,unsigned char *buffer, int size); -extern networking_t *new_networking(libinput_t* libinput); +extern networking_t *new_networking(); extern void free_networking( networking_t *networking ); extern URL_t* check4proxies( URL_t *url ); int nop_networking_read(Tcp& fd, char *buffer, int size, networking_t *stream_ctrl ); int nop_networking_seek(Tcp& fd, off_t pos, networking_t *stream_ctrl ); -Tcp* http_send_request(libinput_t* libinput,URL_t *url, off_t pos); +MPXP_Rc http_send_request(Tcp& tcp,URL_t *url, off_t pos); HTTP_header_t *http_read_response(Tcp& fd); int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry); Modified: mplayerxp/libmpstream/s_cdd.cpp =================================================================== --- mplayerxp/libmpstream/s_cdd.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_cdd.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -20,10 +20,10 @@ namespace mpxp { class Cdda_Stream_Interface : public Stream_Interface { public: - Cdda_Stream_Interface(); + Cdda_Stream_Interface(libinput_t* libinput); virtual ~Cdda_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -39,14 +39,15 @@ track_t track_idx; }; -Cdda_Stream_Interface::Cdda_Stream_Interface():track_idx(255) {} +Cdda_Stream_Interface::Cdda_Stream_Interface(libinput_t* libinput) + :Stream_Interface(libinput), + track_idx(255) {} Cdda_Stream_Interface::~Cdda_Stream_Interface() {} -MPXP_Rc Cdda_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) +MPXP_Rc Cdda_Stream_Interface::open(const char *filename,unsigned flags) { const char *param; char *device; - UNUSED(libinput); UNUSED(flags); if(strcmp(filename,"help") == 0) { MSG_HINT("Usage: cdda://<@device><#trackno>\n"); @@ -114,7 +115,7 @@ return MPXP_False; } -static Stream_Interface* query_cdda_interface() { return new(zeromem) Cdda_Stream_Interface; } +static Stream_Interface* query_cdda_interface(libinput_t* libinput) { return new(zeromem) Cdda_Stream_Interface(libinput); } extern const stream_interface_info_t cdda_stream = { @@ -125,15 +126,19 @@ class Cddb_Stream_Interface : public Cdda_Stream_Interface { public: - Cddb_Stream_Interface(); + Cddb_Stream_Interface(libinput_t* libinput); virtual ~Cddb_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); + private: + libinput_t* libinput; }; -Cddb_Stream_Interface::Cddb_Stream_Interface() {} +Cddb_Stream_Interface::Cddb_Stream_Interface(libinput_t*_libinput) + :Cdda_Stream_Interface(_libinput), + libinput(_libinput) {} Cddb_Stream_Interface::~Cddb_Stream_Interface() {} -MPXP_Rc Cddb_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) +MPXP_Rc Cddb_Stream_Interface::open(const char *filename,unsigned flags) { #ifdef HAVE_STREAMING const char *param; @@ -153,7 +158,7 @@ #endif } -static Stream_Interface* query_cddb_interface() { return new(zeromem) Cddb_Stream_Interface; } +static Stream_Interface* query_cddb_interface(libinput_t* libinput) { return new(zeromem) Cddb_Stream_Interface(libinput); } extern const stream_interface_info_t cddb_stream = { "cddb://", Modified: mplayerxp/libmpstream/s_dvdnav.cpp =================================================================== --- mplayerxp/libmpstream/s_dvdnav.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_dvdnav.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -50,10 +50,10 @@ class DvdNav_Stream_Interface : public Stream_Interface { public: - DvdNav_Stream_Interface(); + DvdNav_Stream_Interface(libinput_t* libinput); virtual ~DvdNav_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -93,8 +93,9 @@ float _stream_pts; }; -DvdNav_Stream_Interface::DvdNav_Stream_Interface() - :hlev(*new dvdnav_highlight_event_t) {} +DvdNav_Stream_Interface::DvdNav_Stream_Interface(libinput_t* libinput) + :Stream_Interface(libinput), + hlev(*new dvdnav_highlight_event_t) {} DvdNav_Stream_Interface::~DvdNav_Stream_Interface() { dvdnav_close(dvdnav); delete &hlev; @@ -178,13 +179,12 @@ return 0; } -MPXP_Rc DvdNav_Stream_Interface::open(libinput_t*libinput,const char *_filename,unsigned flags) +MPXP_Rc DvdNav_Stream_Interface::open(const char *_filename,unsigned flags) { const char *param; char *dvd_device; int ntitles; UNUSED(flags); - UNUSED(libinput); filename=_filename; param=mrl_parse_line(_filename,NULL,NULL,&dvd_device,NULL); if(strcmp(param,"help") == 0) { @@ -590,7 +590,7 @@ return MPXP_False; } -static Stream_Interface* query_interface() { return new(zeromem) DvdNav_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) DvdNav_Stream_Interface(libinput); } extern const stream_interface_info_t dvdnav_stream = { Modified: mplayerxp/libmpstream/s_dvdread.cpp =================================================================== --- mplayerxp/libmpstream/s_dvdread.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_dvdread.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -51,10 +51,10 @@ class DvdRead_Stream_Interface : public Stream_Interface { public: - DvdRead_Stream_Interface(); + DvdRead_Stream_Interface(libinput_t* libinput); virtual ~DvdRead_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -111,10 +111,9 @@ off_t _end_pos; }; -DvdRead_Stream_Interface::DvdRead_Stream_Interface() - :dvd_chapter(1),dvd_angle(1) -{ -} +DvdRead_Stream_Interface::DvdRead_Stream_Interface(libinput_t* libinput) + :Stream_Interface(libinput), + dvd_chapter(1),dvd_angle(1) {} DvdRead_Stream_Interface::~DvdRead_Stream_Interface() {} static const char * dvd_audio_stream_types[8] = @@ -589,7 +588,7 @@ dvd_angle=1; } -MPXP_Rc DvdRead_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) +MPXP_Rc DvdRead_Stream_Interface::open(const char *filename,unsigned flags) { UNUSED(flags); int dvd_title; @@ -598,7 +597,6 @@ char param[256]; last_title=-1; - UNUSED(libinput); if(strcmp(filename,"help") == 0 || strlen(filename)==10) { MSG_HINT("Usage: dvdread://<@device>#<titleno>-<lasttitle>,<chapter>-<lastchapter>,<angle>\n"); return MPXP_False; @@ -778,7 +776,7 @@ return MPXP_False; } -static Stream_Interface* query_interface() { return new(zeromem) DvdRead_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) DvdRead_Stream_Interface(libinput); } extern const stream_interface_info_t dvdread_stream = { Modified: mplayerxp/libmpstream/s_file.cpp =================================================================== --- mplayerxp/libmpstream/s_file.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_file.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -22,10 +22,10 @@ namespace mpxp { class File_Stream_Interface : public Stream_Interface { public: - File_Stream_Interface(); + File_Stream_Interface(libinput_t* libinput); virtual ~File_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -41,13 +41,14 @@ off_t end_pos; }; -File_Stream_Interface::File_Stream_Interface():fd(0),was_open(0),spos(0) {} +File_Stream_Interface::File_Stream_Interface(libinput_t*l) + :Stream_Interface(l), + fd(0),was_open(0),spos(0) {} File_Stream_Interface::~File_Stream_Interface() {} -MPXP_Rc File_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) +MPXP_Rc File_Stream_Interface::open(const char *filename,unsigned flags) { UNUSED(flags); - UNUSED(libinput); if(strcmp(filename,"-")==0) fd=0; else fd=::open(filename,O_RDONLY); if(fd<0) { @@ -112,7 +113,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_file_interface() { return new(zeromem) File_Stream_Interface; } +static Stream_Interface* query_file_interface(libinput_t* libinput) { return new(zeromem) File_Stream_Interface(libinput); } extern const stream_interface_info_t file_stream = { @@ -123,21 +124,20 @@ class Stdin_Stream_Interface : public File_Stream_Interface { public: - Stdin_Stream_Interface(); + Stdin_Stream_Interface(libinput_t* libinput); virtual ~Stdin_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); }; -Stdin_Stream_Interface::Stdin_Stream_Interface() {} +Stdin_Stream_Interface::Stdin_Stream_Interface(libinput_t*l):File_Stream_Interface(l) {} Stdin_Stream_Interface::~Stdin_Stream_Interface() {} -MPXP_Rc Stdin_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) { - UNUSED(libinput); +MPXP_Rc Stdin_Stream_Interface::open(const char *filename,unsigned flags) { UNUSED(filename); - return File_Stream_Interface::open(NULL,"-",flags); + return File_Stream_Interface::open("-",flags); } -static Stream_Interface* query_stdin_interface() { return new(zeromem) Stdin_Stream_Interface; } +static Stream_Interface* query_stdin_interface(libinput_t* libinput) { return new(zeromem) Stdin_Stream_Interface(libinput); } extern const stream_interface_info_t stdin_stream = { Modified: mplayerxp/libmpstream/s_ftp.cpp =================================================================== --- mplayerxp/libmpstream/s_ftp.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_ftp.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -27,10 +27,10 @@ namespace mpxp { class Ftp_Stream_Interface : public Stream_Interface { public: - Ftp_Stream_Interface(); + Ftp_Stream_Interface(libinput_t* libinput); virtual ~Ftp_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -52,7 +52,6 @@ int port; const char* filename; URL_t* url; - libinput_t* libinput; char* cput,*cget; Tcp tcp; @@ -62,7 +61,9 @@ off_t file_len; }; -Ftp_Stream_Interface::Ftp_Stream_Interface():tcp(-1) {} +Ftp_Stream_Interface::Ftp_Stream_Interface(libinput_t* libinput) + :Stream_Interface(libinput), + tcp(libinput,-1) {} Ftp_Stream_Interface::~Ftp_Stream_Interface() { SendCmd("QUIT",NULL); if(buf) delete buf; @@ -210,7 +211,7 @@ } sscanf(par+1,"%u,%u,%u,%u,%u,%u",&num[0],&num[1],&num[2],&num[3],&num[4],&num[5]); snprintf(str,127,"%d.%d.%d.%d",num[0],num[1],num[2],num[3]); - tcp.open(libinput,str,(num[4]<<8)+num[5]); + tcp.open(str,(num[4]<<8)+num[5]); if(fd < 0) MSG_ERR("[ftp] failed to create data connection\n"); return 1; @@ -312,14 +313,13 @@ if(tcp.established()) tcp.close(); } -MPXP_Rc Ftp_Stream_Interface::open(libinput_t*_libinput,const char *_filename,unsigned flags) +MPXP_Rc Ftp_Stream_Interface::open(const char *_filename,unsigned flags) { int resp; char str[256],rsp_txt[256]; char *uname; UNUSED(flags); - libinput=_libinput; if(!(uname=new char [strlen(_filename)+7])) return MPXP_False; strcpy(uname,"ftp://"); strcat(uname,_filename); @@ -339,7 +339,7 @@ MSG_V("FTP: Opening ~%s :%s @%s :%i %s\n",user,pass,host,port,filename); // Open the control connection - tcp.open(libinput,host,port); + tcp.open(host,port); if(!tcp.established()) { url_free(url); @@ -428,7 +428,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_interface() { return new(zeromem) Ftp_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Ftp_Stream_Interface(libinput); } /* "reuse a bit of code from ftplib written by Thomas Pfau", */ extern const stream_interface_info_t ftp_stream = Modified: mplayerxp/libmpstream/s_lavc.cpp =================================================================== --- mplayerxp/libmpstream/s_lavc.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_lavc.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -13,10 +13,10 @@ namespace mpxp { class Lavs_Stream_Interface : public Stream_Interface { public: - Lavs_Stream_Interface(); + Lavs_Stream_Interface(libinput_t* libinput); virtual ~Lavs_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -31,7 +31,9 @@ off_t end_pos; }; -Lavs_Stream_Interface::Lavs_Stream_Interface():ctx(NULL),end_pos(-1) {} +Lavs_Stream_Interface::Lavs_Stream_Interface(libinput_t*libinput) + :Stream_Interface(libinput), + ctx(NULL),end_pos(-1) {} Lavs_Stream_Interface::~Lavs_Stream_Interface() { if(ctx) ffurl_close(ctx); } @@ -64,12 +66,11 @@ void Lavs_Stream_Interface::close() {} -MPXP_Rc Lavs_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) +MPXP_Rc Lavs_Stream_Interface::open(const char *filename,unsigned flags) { int64_t _size; UNUSED(flags); - UNUSED(libinput); av_register_all(); MSG_V("[lavc] Opening %s\n", filename); @@ -84,7 +85,7 @@ off_t Lavs_Stream_Interface::size() const { return end_pos; } off_t Lavs_Stream_Interface::sector_size() const { return STREAM_BUFFER_SIZE; } -static Stream_Interface* query_interface() { return new(zeromem) Lavs_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Lavs_Stream_Interface(libinput); } extern const stream_interface_info_t lavs_stream = { Modified: mplayerxp/libmpstream/s_network.cpp =================================================================== --- mplayerxp/libmpstream/s_network.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_network.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -23,10 +23,10 @@ namespace mpxp { class Network_Stream_Interface : public Stream_Interface { public: - Network_Stream_Interface(); + Network_Stream_Interface(libinput_t* libinput); virtual ~Network_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -42,7 +42,9 @@ networking_t* networking; }; -Network_Stream_Interface::Network_Stream_Interface():tcp(-1) {} +Network_Stream_Interface::Network_Stream_Interface(libinput_t* libinput) + :Stream_Interface(libinput), + tcp(libinput,-1) {} Network_Stream_Interface::~Network_Stream_Interface() { if(url) { url_free(url); @@ -50,12 +52,12 @@ } } -MPXP_Rc Network_Stream_Interface::open(libinput_t* libinput,const char *filename,unsigned flags) +MPXP_Rc Network_Stream_Interface::open(const char *filename,unsigned flags) { UNUSED(flags); url = url_new(filename); if(url) { - networking=new_networking(libinput); + networking=new_networking(); if(networking_start(tcp,networking,url)!=MPXP_Ok){ MSG_ERR(MSGTR_UnableOpenURL, filename); url_free(url); @@ -113,7 +115,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_interface() { return new(zeromem) Network_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Network_Stream_Interface(libinput); } extern const stream_interface_info_t network_stream = { Modified: mplayerxp/libmpstream/s_null.cpp =================================================================== --- mplayerxp/libmpstream/s_null.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_null.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -10,10 +10,10 @@ namespace mpxp { class Null_Stream_Interface : public Stream_Interface { public: - Null_Stream_Interface(); + Null_Stream_Interface(libinput_t* libinput); virtual ~Null_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -24,11 +24,10 @@ virtual off_t sector_size() const; }; -Null_Stream_Interface::Null_Stream_Interface() {} +Null_Stream_Interface::Null_Stream_Interface(libinput_t*libinput):Stream_Interface(libinput) {} Null_Stream_Interface::~Null_Stream_Interface() {} -MPXP_Rc Null_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) { - UNUSED(libinput); +MPXP_Rc Null_Stream_Interface::open(const char *filename,unsigned flags) { UNUSED(filename); UNUSED(flags); return MPXP_False; @@ -47,7 +46,7 @@ off_t Null_Stream_Interface::size() const { return 0; } off_t Null_Stream_Interface::sector_size() const { return 0; } -static Stream_Interface* query_interface() { return new(zeromem) Null_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Null_Stream_Interface(libinput); } extern const stream_interface_info_t null_stream = { Modified: mplayerxp/libmpstream/s_oss.cpp =================================================================== --- mplayerxp/libmpstream/s_oss.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_oss.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -30,10 +30,10 @@ namespace mpxp { class Oss_Stream_Interface : public Stream_Interface { public: - Oss_Stream_Interface(); + Oss_Stream_Interface(libinput_t* libinput); virtual ~Oss_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -51,17 +51,17 @@ unsigned _sector_size; }; -Oss_Stream_Interface::Oss_Stream_Interface() {} +Oss_Stream_Interface::Oss_Stream_Interface(libinput_t* libinput) + :Stream_Interface(libinput) {} Oss_Stream_Interface::~Oss_Stream_Interface() {} -MPXP_Rc Oss_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) +MPXP_Rc Oss_Stream_Interface::open(const char *filename,unsigned flags) { char *args; char *oss_device,*comma; unsigned tmp,param; int err; UNUSED(flags); - UNUSED(libinput); if(strcmp(filename,"help") == 0) { MSG_HINT("Usage: oss://<@device>#<channels>,<samplerate>,<sampleformat>\n"); return MPXP_False; @@ -270,7 +270,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_interface() { return new(zeromem) Oss_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Oss_Stream_Interface(libinput); } extern const stream_interface_info_t oss_stream = { Modified: mplayerxp/libmpstream/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream/s_rtsp.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_rtsp.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -29,10 +29,10 @@ namespace mpxp { class Rtsp_Stream_Interface : public Stream_Interface { public: - Rtsp_Stream_Interface(); + Rtsp_Stream_Interface(libinput_t* libinput); virtual ~Rtsp_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -46,16 +46,20 @@ networking_t* networking; Tcp tcp; + libinput_t* libinput; }; -Rtsp_Stream_Interface::Rtsp_Stream_Interface():tcp(-1) {} +Rtsp_Stream_Interface::Rtsp_Stream_Interface(libinput_t* _libinput) + :Stream_Interface(_libinput), + tcp(_libinput,-1), + libinput(_libinput) {} Rtsp_Stream_Interface::~Rtsp_Stream_Interface() {} #define RTSP_DEFAULT_PORT 554 int Rtsp_Stream_Interface::read(stream_packet_t*sp) { - return rtsp_session_read (reinterpret_cast<rtsp_session_t*>(networking->data), sp->buf, sp->len); + return rtsp_session_read (libinput,reinterpret_cast<rtsp_session_t*>(networking->data), sp->buf, sp->len); } off_t Rtsp_Stream_Interface::seek(off_t newpos) { return newpos; } @@ -94,12 +98,12 @@ do { redirected = 0; - tcp.open(networking->libinput,networking->url->hostname, + tcp.open(networking->url->hostname, port = (networking->url->port ? networking->url->port : RTSP_DEFAULT_PORT)); if (!tcp.established() && !networking->url->port) - tcp.open(networking->libinput,networking->url->hostname, + tcp.open(networking->url->hostname, port = 7070); if (!tcp.established()) return MPXP_False; file = networking->url->file; @@ -137,14 +141,14 @@ extern int network_bandwidth; extern int index_mode; -MPXP_Rc Rtsp_Stream_Interface::open(libinput_t* libinput,const char *filename,unsigned flags) +MPXP_Rc Rtsp_Stream_Interface::open(const char *filename,unsigned flags) { URL_t *url; UNUSED(flags); if(strncmp(filename,"rtsp://",7)!=0) return MPXP_False; MSG_V("STREAM_RTSP, URL: %s\n", filename); - networking = new_networking(libinput); + networking = new_networking(); if (!networking) return MPXP_False; networking->bandwidth = network_bandwidth; @@ -166,7 +170,7 @@ off_t Rtsp_Stream_Interface::size() const { return 0; } off_t Rtsp_Stream_Interface::sector_size() const { return 1; } -static Stream_Interface* query_interface() { return new(zeromem) Rtsp_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Rtsp_Stream_Interface(libinput); } /* "reuse a bit of code from ftplib written by Thomas Pfau", */ extern const stream_interface_info_t rtsp_stream = Modified: mplayerxp/libmpstream/s_tv.cpp =================================================================== --- mplayerxp/libmpstream/s_tv.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_tv.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -581,10 +581,10 @@ /* fill demux->video and demux->audio */ class Tv_Stream_Interface : public Stream_Interface { public: - Tv_Stream_Interface(); + Tv_Stream_Interface(libinput_t* libinput); virtual ~Tv_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -598,13 +598,12 @@ tvi_handle_t* priv; }; -Tv_Stream_Interface::Tv_Stream_Interface() { } +Tv_Stream_Interface::Tv_Stream_Interface(libinput_t*libinput):Stream_Interface(libinput) {} Tv_Stream_Interface::~Tv_Stream_Interface() { delete priv; } -MPXP_Rc Tv_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) +MPXP_Rc Tv_Stream_Interface::open(const char *filename,unsigned flags) { UNUSED(flags); - UNUSED(libinput); mrl_parse_params(filename,tvopts_conf); /* create tvi handler */ if(!(priv = tv_begin())) goto tv_err; @@ -665,7 +664,7 @@ off_t Tv_Stream_Interface::size() const { return -1; } off_t Tv_Stream_Interface::sector_size() const { return 0; } -static Stream_Interface* query_interface() { return new(zeromem) Tv_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Tv_Stream_Interface(libinput); } extern const stream_interface_info_t tv_stream = { Modified: mplayerxp/libmpstream/s_udp.cpp =================================================================== --- mplayerxp/libmpstream/s_udp.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_udp.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -28,10 +28,10 @@ namespace mpxp { class Udp_Stream_Interface : public Stream_Interface { public: - Udp_Stream_Interface(); + Udp_Stream_Interface(libinput_t* libinput); virtual ~Udp_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -48,7 +48,10 @@ Tcp tcp; }; -Udp_Stream_Interface::Udp_Stream_Interface():udp(-1),tcp(-1) {} +Udp_Stream_Interface::Udp_Stream_Interface(libinput_t* libinput) + :Stream_Interface(libinput), + udp(-1), + tcp(libinput,-1) {} Udp_Stream_Interface::~Udp_Stream_Interface() {} int Udp_Stream_Interface::read(stream_packet_t*sp) @@ -89,12 +92,12 @@ } extern int network_bandwidth; -MPXP_Rc Udp_Stream_Interface::open(libinput_t* libinput,const char *filename,unsigned flags) +MPXP_Rc Udp_Stream_Interface::open(const char *filename,unsigned flags) { URL_t *url; UNUSED(flags); MSG_V("STREAM_UDP, URL: %s\n", filename); - networking = new_networking(libinput); + networking = new_networking(); if (!networking) return MPXP_False; networking->bandwidth = network_bandwidth; @@ -119,7 +122,7 @@ off_t Udp_Stream_Interface::size() const { return 0; } off_t Udp_Stream_Interface::sector_size() const { return 1; } -static Stream_Interface* query_interface() { return new(zeromem) Udp_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Udp_Stream_Interface(libinput); } /* "reuse a bit of code from ftplib written by Thomas Pfau", */ extern const stream_interface_info_t rtsp_stream = Modified: mplayerxp/libmpstream/s_vcdnav.cpp =================================================================== --- mplayerxp/libmpstream/s_vcdnav.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/s_vcdnav.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -31,10 +31,10 @@ class VcdNav_Stream_Interface : public Stream_Interface { public: - VcdNav_Stream_Interface(); + VcdNav_Stream_Interface(libinput_t* libinput); virtual ~VcdNav_Stream_Interface(); - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags); + virtual MPXP_Rc open(const char *filename,unsigned flags); virtual int read(stream_packet_t * sp); virtual off_t seek(off_t off); virtual off_t tell() const; @@ -63,7 +63,8 @@ lsn_t vcd_sector_lsn; }; -VcdNav_Stream_Interface::VcdNav_Stream_Interface() {} +VcdNav_Stream_Interface::VcdNav_Stream_Interface(libinput_t* libinput) + :Stream_Interface(libinput) {} VcdNav_Stream_Interface::~VcdNav_Stream_Interface() { vcdinfo_close(fd); if(track) delete track; @@ -82,7 +83,7 @@ } } -MPXP_Rc VcdNav_Stream_Interface::open(libinput_t*libinput,const char *filename,unsigned flags) +MPXP_Rc VcdNav_Stream_Interface::open(const char *filename,unsigned flags) { const char *param; char *device,*dev; @@ -90,7 +91,6 @@ int vcd_track=-1; vcdinfo_open_return_t open_rc; UNUSED(flags); - UNUSED(libinput); if(strcmp(filename,"help") == 0) { MSG_HINT("Usage: vcdnav://<@device><#trackno>\n"); return MPXP_False; @@ -267,7 +267,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_interface() { return new(zeromem) VcdNav_Stream_Interface; } +static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) VcdNav_Stream_Interface(libinput); } extern const stream_interface_info_t vcdnav_stream = { Modified: mplayerxp/libmpstream/stream.cpp =================================================================== --- mplayerxp/libmpstream/stream.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/stream.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -132,9 +132,9 @@ mrl_len=strlen(sdrivers[i]->mrl); if(strncmp(filename,sdrivers[i]->mrl,mrl_len)==0||sdrivers[i]->mrl[0]=='*') { MSG_V("Opening %s ... ",sdrivers[i]->mrl); - Stream_Interface* drv = sdrivers[i]->query_interface(); + Stream_Interface* drv = sdrivers[i]->query_interface(libinput); if(sdrivers[i]->mrl[0]=='*') mrl_len=0; - if(drv->open(libinput,&filename[mrl_len],0)==MPXP_Ok) { + if(drv->open(&filename[mrl_len],0)==MPXP_Ok) { MSG_V("OK\n"); *ff = file_format; driver_info=sdrivers[i]; @@ -147,9 +147,9 @@ MSG_V("False\n"); } } - Stream_Interface* file_drv = file_stream.query_interface(); + Stream_Interface* file_drv = file_stream.query_interface(libinput); /* Last hope if not mrl specified */ - if(file_drv->open(libinput,filename,0)) { + if(file_drv->open(filename,0)) { *ff = file_format; driver_info=&file_stream; driver=file_drv; Modified: mplayerxp/libmpstream/stream_internal.h =================================================================== --- mplayerxp/libmpstream/stream_internal.h 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/stream_internal.h 2012-12-08 07:53:03 UTC (rev 519) @@ -10,7 +10,7 @@ /** Stream-driver interface */ class Stream_Interface : public Opaque { public: - Stream_Interface() {} + Stream_Interface(libinput_t*) {} virtual ~Stream_Interface() {} /** Opens stream with given name * @param libinput points libinput2 @@ -18,7 +18,7 @@ * @param filename points MRL of stream (vcdnav://, file://, http://, ...) * @param flags currently unused and filled as 0 **/ - virtual MPXP_Rc open(libinput_t* libinput,const char *filename,unsigned flags) = 0; + virtual MPXP_Rc open(const char *filename,unsigned flags) = 0; /** Reads next packet from stream * @param _this points structure which identifies stream @@ -66,7 +66,7 @@ struct stream_interface_info_t { const char* mrl; /**< MRL of stream driver */ const char* descr; /**< description of the driver */ - Stream_Interface* (*query_interface)(); + Stream_Interface* (*query_interface)(libinput_t*); }; } // namespace mpxp #endif Modified: mplayerxp/libmpstream/tcp.cpp =================================================================== --- mplayerxp/libmpstream/tcp.cpp 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/tcp.cpp 2012-12-08 07:53:03 UTC (rev 519) @@ -51,7 +51,7 @@ // return -2 for fatal error, like unable to resolve name, connection timeout... // return -1 is unable to connect to a particular port -void Tcp::open(libinput_t* libinput,const char *host, int port, tcp_af_e af) { +void Tcp::open(const char *host, int port, tcp_af_e af) { socklen_t err_len; int ret,count = 0; fd_set set; @@ -224,16 +224,18 @@ } } -Tcp::Tcp(libinput_t* libinput,const char *host,int port,tcp_af_e af) +Tcp::Tcp(libinput_t* _libinput,const char *host,int port,tcp_af_e af) :_fd(-1), - _error(Tcp::Err_None) + _error(Tcp::Err_None), + libinput(_libinput) { - open(libinput,host,port,af); + open(host,port,af); } -Tcp::Tcp(net_fd_t fd) +Tcp::Tcp(libinput_t* _libinput,net_fd_t fd) :_fd(fd), - _error(Tcp::Err_None) + _error(Tcp::Err_None), + libinput(_libinput) { } Modified: mplayerxp/libmpstream/tcp.h =================================================================== --- mplayerxp/libmpstream/tcp.h 2012-12-07 17:50:52 UTC (rev 518) +++ mplayerxp/libmpstream/tcp.h 2012-12-08 07:53:03 UTC (rev 519) @@ -38,7 +38,7 @@ Err_Port =-1, /* unable to connect to a particular port */ Err_None =0 /* no error */ }; - Tcp(net_fd_t fd); + Tcp(libinput_t* libinput,net_fd_t fd); Tcp(libinput_t* libinput,const char *host,int port,tcp_af_e af=Tcp::IP4); virtual ~Tcp(); @@ -49,13 +49,14 @@ virtual int has_data(int timeout) const; virtual tcp_error_e error() const; - virtual void open(libinput_t* libinput,const char *host,int port,tcp_af_e af=Tcp::IP4); + virtual void open(const char *host,int port,tcp_af_e af=Tcp::IP4); virtual int read(uint8_t* buf,unsigned len,int flags=0); virtual int write(const uint8_t* buf,unsigned len,int flags=0) const; virtual void close(); private: net_fd_t _fd; tcp_error_e _error; + libinput_t* libinput; }; } // namespace mpxp #endif /* TCP_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |