[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[520] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-08 08:15:19
|
Revision: 520 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=520&view=rev Author: nickols_k Date: 2012-12-08 08:15:09 +0000 (Sat, 08 Dec 2012) Log Message: ----------- enable RTSP_SESSION Modified Paths: -------------- mplayerxp/configure mplayerxp/libmpstream/librtsp/rtsp_session.cpp mplayerxp/libmpstream/librtsp/rtsp_session.h mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/realrtsp/Makefile mplayerxp/libmpstream/realrtsp/md5.h mplayerxp/libmpstream/s_rtsp.cpp mplayerxp/libmpstream/tcp.cpp mplayerxp/libmpstream/tcp.h Removed Paths: ------------- mplayerxp/libmpstream/realrtsp/md5.cpp Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/configure 2012-12-08 08:15:09 UTC (rev 520) @@ -1155,8 +1155,9 @@ #include "$srcdir/../lavc/libpostproc/postprocess.h" #include "$srcdir/../lavc/libswscale/swscale.h" #include "$srcdir/../lavc/libswscale/rgb2rgb.h" +#include "$srcdir/../lavc/libavutil/audioconvert.h" #include "$srcdir/../lavc/libavutil/fifo.h" -#include "$srcdir/../lavc/libavutil/audioconvert.h" +#include "$srcdir/../lavc/libavutil/md5.h" #include "$srcdir/../lavc/libswresample/swresample.h" #include "$srcdir/../lavc/libavformat/riff.h" #include "$srcdir/../lavc/libavformat/avformat.h" Modified: mplayerxp/libmpstream/librtsp/rtsp_session.cpp =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp_session.cpp 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/librtsp/rtsp_session.cpp 2012-12-08 08:15:09 UTC (rev 520) @@ -219,7 +219,7 @@ return rtsp_session; } -int rtsp_session_read (libinput_t* libinput,rtsp_session_t *self, char *data, int len) { +int rtsp_session_read (Tcp& tcp,rtsp_session_t *self, char *data, int len) { if (self->real_session) { int to_copy=len; @@ -267,9 +267,9 @@ else if (self->rtp_session) { int l = 0; - Tcp tcp(libinput,self->rtp_session->rtp_socket); + Tcp _tcp(tcp.get_libinput(),self->rtp_session->rtp_socket); - l = read_rtp_from_server (tcp, data, len); + l = read_rtp_from_server (_tcp, data, len); /* send RTSP and RTCP keepalive */ rtcp_send_rr (self->s, self->rtp_session); Modified: mplayerxp/libmpstream/librtsp/rtsp_session.h =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp_session.h 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/librtsp/rtsp_session.h 2012-12-08 08:15:09 UTC (rev 520) @@ -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(libinput_t* libinput,rtsp_session_t *session, char *data, int len); +int rtsp_session_read(Tcp& tcp,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-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/network.cpp 2012-12-08 08:15:09 UTC (rev 520) @@ -44,6 +44,7 @@ #ifndef STREAMING_LIVE_DOT_COM #include "rtp.h" #endif +#include "librtsp/rtsp_session.h" #include "version.h" #include "stream_msg.h" @@ -666,41 +667,42 @@ return MPXP_Ok; } -#ifdef HAVE_RTSP_SESSION_H int -realrtsp_networking_read( int fd, char *buffer, int size, networking_t *stream_ctrl ) { - return rtsp_session_read(stream_ctrl->data, buffer, size); +realrtsp_networking_read( Tcp& tcp, char *buffer, int size, networking_t *networking ) { + return rtsp_session_read(tcp,reinterpret_cast<rtsp_session_t*>(networking->data), buffer, size); } -MPXP_Rc realrtsp_networking_start( net_fd_t* fd, networking_t *stream ) { +MPXP_Rc realrtsp_networking_start( Tcp& tcp, networking_t *networking ) { rtsp_session_t *rtsp; char *mrl; char *file; int port; int redirected, temp; - if( stream==NULL ) return MPXP_False; temp = 5; // counter so we don't get caught in infinite redirections (you never know) do { redirected = 0; port = networking->url->port ? networking->url->port : 554; - *fd = tcp_connect2Server( networking->url->hostname, port, 1); - if(*fd<0 && !networking->url->port) - *fd = tcp_connect2Server( networking->url->hostname,port = 7070, 1 ); - if(*fd<0) return MPXP_False; + tcp.close(); + tcp.open( networking->url->hostname, port, Tcp::IP4); + if(!tcp.established() && !networking->url->port) + tcp.open( networking->url->hostname,port = 7070, Tcp::IP4); + if(!tcp.established()) return MPXP_False; file = networking->url->file; if (file[0] == '/') file++; - mrl = mp_malloc(sizeof(char)*(strlen(networking->url->hostname)+strlen(file)+16)); + mrl = new char [strlen(networking->url->hostname)+strlen(file)+16]; sprintf(mrl,"rtsp://%s:%i/%s",networking->url->hostname,port,file); - rtsp = rtsp_session_start(fd,&mrl, file, - networking->url->hostname, port, &redirected); + rtsp = rtsp_session_start(tcp,&mrl, file, + networking->url->hostname, port, &redirected, + network_bandwidth,networking->url->username, + networking->url->password); if ( redirected == 1 ) { url_free(networking->url); networking->url = url_new(mrl); - closesocket(fd); + tcp.close(); } delete mrl; temp--; @@ -717,7 +719,6 @@ networking->status = networking_playing_e; return MPXP_Ok; } -#endif // HAVE_RTSP_SESSION_H #ifndef STREAMING_LIVE_DOT_COM @@ -774,7 +775,6 @@ return MPXP_False; } } -#ifdef HAVE_RTSP_SESSION_H else if( !strcasecmp( networking->url->protocol, "rtsp")) { if ((rc = realrtsp_networking_start( tcp, networking )) < 0) { MSG_INFO("Not a Realmedia rtsp url. Trying standard rtsp protocol.\n"); @@ -788,7 +788,6 @@ #endif } } -#endif else if(!strcasecmp( networking->url->protocol, "udp")) { tcp.close(); rc = rtp_networking_start(tcp, networking, 1); Modified: mplayerxp/libmpstream/realrtsp/Makefile =================================================================== --- mplayerxp/libmpstream/realrtsp/Makefile 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/realrtsp/Makefile 2012-12-08 08:15:09 UTC (rev 520) @@ -2,7 +2,7 @@ LIBNAME = librealrtsp.a -CXXSRCS= real.cpp xbuffer.cpp asmrp.cpp md5.cpp rmff.cpp sdpplin.cpp +CXXSRCS= real.cpp xbuffer.cpp asmrp.cpp rmff.cpp sdpplin.cpp SRCS = OBJS=$(SRCS:.c=.o) CXXOBJS=$(CXXSRCS:.cpp=.o) Deleted: mplayerxp/libmpstream/realrtsp/md5.cpp =================================================================== --- mplayerxp/libmpstream/realrtsp/md5.cpp 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/realrtsp/md5.cpp 2012-12-08 08:15:09 UTC (rev 520) @@ -1,165 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* - * Copyright (C) 2006 Michael Niedermayer (mic...@gm...) - * Copyright (C) 2003-2005 by Christopher R. Hertel (cr...@ub...) - * - * References: - * IETF RFC 1321: The MD5 Message-Digest Algorithm - * Ron Rivest. IETF, April, 1992 - * - * based on http://ubiqx.org/libcifs/source/Auth/MD5.c - * from Christopher R. Hertel (cr...@ub...) - * Simplified, cleaned and IMO redundant comments removed by michael. - * - * If you use gcc, then version 4.1 or later and -fomit-frame-pointer is - * strongly recommended. - * - * This file is part of FFmpeg. - * - * FFmpeg is mp_free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include <string.h> - -#include "osdep/bswap.h" -#include "md5.h" - -typedef struct AVMD5{ - uint64_t len; - uint8_t block[64]; - uint32_t ABCD[4]; -} AVMD5; - -const int av_md5_size= sizeof(AVMD5); - -static const uint8_t S[4][4] = { - { 7, 12, 17, 22 }, /* Round 1 */ - { 5, 9, 14, 20 }, /* Round 2 */ - { 4, 11, 16, 23 }, /* Round 3 */ - { 6, 10, 15, 21 } /* Round 4 */ -}; - -static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32) - 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* Round 1 */ - 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, - 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, - 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, - - 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, /* Round 2 */ - 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, - 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, - 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, - - 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, /* Round 3 */ - 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, - 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, - 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, - - 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, /* Round 4 */ - 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, - 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, - 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, -}; - -#define CORE(i, a, b, c, d) \ - t = S[i>>4][i&3];\ - a += T[i];\ -\ - if(i<32){\ - if(i<16) a += (d ^ (b&(c^d))) + X[ i &15 ];\ - else a += (c ^ (d&(c^b))) + X[ (1+5*i)&15 ];\ - }else{\ - if(i<48) a += (b^c^d) + X[ (5+3*i)&15 ];\ - else a += (c^(b|~d)) + X[ ( 7*i)&15 ];\ - }\ - a = b + (( a << t ) | ( a >> (32 - t) )); - -static void body(uint32_t ABCD[4], uint32_t X[16]){ - - int t; - int i; - unsigned int a= ABCD[3]; - unsigned int b= ABCD[2]; - unsigned int c= ABCD[1]; - unsigned int d= ABCD[0]; - -#ifdef WORDS_BIGENDIAN - for(i=0; i<16; i++) - X[i]= bswap_32(X[i]); -#endif - -#ifdef CONFIG_SMALL - for( i = 0; i < 64; i++ ){ - CORE(i,a,b,c,d) - t=d; d=c; c=b; b=a; a=t; - } -#else -#define CORE2(i) CORE(i,a,b,c,d) CORE((i+1),d,a,b,c) CORE((i+2),c,d,a,b) CORE((i+3),b,c,d,a) -#define CORE4(i) CORE2(i) CORE2((i+4)) CORE2((i+8)) CORE2((i+12)) -CORE4(0) CORE4(16) CORE4(32) CORE4(48) -#endif - - ABCD[0] += d; - ABCD[1] += c; - ABCD[2] += b; - ABCD[3] += a; -} - -void av_md5_init(AVMD5 *ctx){ - ctx->len = 0; - - ctx->ABCD[0] = 0x10325476; - ctx->ABCD[1] = 0x98badcfe; - ctx->ABCD[2] = 0xefcdab89; - ctx->ABCD[3] = 0x67452301; -} - -void av_md5_update(AVMD5 *ctx, const char *src, const int len){ - int i, j; - - j= ctx->len & 63; - ctx->len += len; - - for( i = 0; i < len; i++ ){ - ctx->block[j++] = src[i]; - if( 64 == j ){ - body(ctx->ABCD, (uint32_t*) ctx->block); - j = 0; - } - } -} - -void av_md5_final(AVMD5 *ctx, uint8_t *dst){ - int i; - uint64_t finalcount= le2me_64(ctx->len<<3); - - av_md5_update(ctx, "\200", 1); - while((ctx->len & 63)<56) - av_md5_update(ctx, "", 1); - - av_md5_update(ctx, (const uint8_t *)&finalcount, 8); - - for(i=0; i<4; i++) - ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]); -} - -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){ - AVMD5 ctx[1]; - - av_md5_init(ctx); - av_md5_update(ctx, src, len); - av_md5_final(ctx, dst); -} Modified: mplayerxp/libmpstream/realrtsp/md5.h =================================================================== --- mplayerxp/libmpstream/realrtsp/md5.h 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/realrtsp/md5.h 2012-12-08 08:15:09 UTC (rev 520) @@ -59,14 +59,7 @@ # define AV_WL16(p, d) AV_WN16(p, d) # endif -extern const int av_md5_size; +#include "mp_conf_lavc.h" -struct AVMD5; - -void av_md5_init(struct AVMD5 *ctx); -void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); -void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); - #endif /* FFMPEG_MD5_H */ Modified: mplayerxp/libmpstream/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream/s_rtsp.cpp 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/s_rtsp.cpp 2012-12-08 08:15:09 UTC (rev 520) @@ -46,20 +46,18 @@ networking_t* networking; Tcp tcp; - libinput_t* libinput; }; Rtsp_Stream_Interface::Rtsp_Stream_Interface(libinput_t* _libinput) :Stream_Interface(_libinput), - tcp(_libinput,-1), - libinput(_libinput) {} + tcp(_libinput,-1) {} Rtsp_Stream_Interface::~Rtsp_Stream_Interface() {} #define RTSP_DEFAULT_PORT 554 int Rtsp_Stream_Interface::read(stream_packet_t*sp) { - return rtsp_session_read (libinput,reinterpret_cast<rtsp_session_t*>(networking->data), sp->buf, sp->len); + return rtsp_session_read (tcp,reinterpret_cast<rtsp_session_t*>(networking->data), sp->buf, sp->len); } off_t Rtsp_Stream_Interface::seek(off_t newpos) { return newpos; } Modified: mplayerxp/libmpstream/tcp.cpp =================================================================== --- mplayerxp/libmpstream/tcp.cpp 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/tcp.cpp 2012-12-08 08:15:09 UTC (rev 520) @@ -266,5 +266,5 @@ int Tcp::write(const uint8_t* buf,unsigned len,int flags) const { return ::send(_fd,buf,len,flags); } int Tcp::established() const { return _fd > 0; } Tcp::tcp_error_e Tcp::error() const { return _error; } - +libinput_t* Tcp::get_libinput() const { return libinput; } } // namespace mpxp Modified: mplayerxp/libmpstream/tcp.h =================================================================== --- mplayerxp/libmpstream/tcp.h 2012-12-08 07:53:03 UTC (rev 519) +++ mplayerxp/libmpstream/tcp.h 2012-12-08 08:15:09 UTC (rev 520) @@ -48,6 +48,7 @@ virtual int established() const; virtual int has_data(int timeout) const; virtual tcp_error_e error() const; + virtual libinput_t* get_libinput() const; 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |