[Mplayer-cvslog] CVS: main/libmpdemux Makefile,1.58,1.59 network.c,1.75,1.76

Roberto Togni CVS rtognimp at mplayerhq.hu
Thu Apr 17 22:39:45 CEST 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv21859

Modified Files:
	Makefile network.c 
Log Message:
Real rstp:// streaming support, ported from xine

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/Makefile,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- Makefile	10 Apr 2003 10:59:12 -0000	1.58
+++ Makefile	17 Apr 2003 20:39:41 -0000	1.59
@@ -4,6 +4,7 @@
 include ../config.mak
 
 SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c demux_ts.c
+SRCS += realrtsp/asmrp.c realrtsp/real.c realrtsp/rmff.c realrtsp/rtsp.c realrtsp/rtsp_session.c realrtsp/sdpplin.c realrtsp/xbuffer.c
 ifeq ($(XMMS_PLUGINS),yes)
 SRCS += demux_xmms.c
 endif 

Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- network.c	10 Apr 2003 10:55:18 -0000	1.75
+++ network.c	17 Apr 2003 20:39:41 -0000	1.76
@@ -28,6 +28,7 @@
 #include "rtp.h"
 #endif
 #include "pnm.h"
+#include "realrtsp/rtsp_session.h"
 
 #include "../version.h"
 
@@ -582,6 +583,20 @@
 		
 		// Checking for RTSP
 		if( !strcasecmp(url->protocol, "rtsp") ) {
+			// Checking for Real rtsp://
+			// Extension based detection, should be replaced with something based on server answer
+			extension = NULL;
+			if( url->file!=NULL )
+				for( i=strlen(url->file) ; i>0 ; i-- )
+					if( url->file[i]=='.' ) {
+						extension=(url->file)+i+1;
+						break;
+			}
+			if (!strcasecmp(extension, "rm")) {
+				*file_format = DEMUXER_TYPE_REAL;
+				return 0;
+			}
+			mp_msg(MSGT_NETWORK,MSGL_INFO,"Not a Realmedia rtsp url. Trying standard rtsp protocol.\n");
 #ifdef STREAMING_LIVE_DOT_COM
 			*file_format = DEMUXER_TYPE_RTP;
 			return 0;
@@ -864,6 +879,48 @@
 }
 
 
+int
+realrtsp_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl ) {
+	return rtsp_session_read(stream_ctrl->data, buffer, size);
+}
+
+
+int
+realrtsp_streaming_start( stream_t *stream ) {
+	int fd;
+	rtsp_session_t *rtsp;
+	char *mrl;
+	int port;
+	char aport[10];
+	if( stream==NULL ) return -1;
+
+	fd = connect2Server( stream->streaming_ctrl->url->hostname,
+		port = (stream->streaming_ctrl->url->port ? stream->streaming_ctrl->url->port : 554) );
+	printf("rtsp:// fd=%d\n",fd);
+	if(fd<0) return -1;
+	
+	sprintf(aport,"%d",port);
+	mrl = (char *)malloc(strlen(stream->streaming_ctrl->url->url)+1+10+1);
+	strcpy(mrl,stream->streaming_ctrl->url->url);
+	strcat(mrl,":");
+	strcat(mrl,aport);
+	rtsp = rtsp_session_start(fd,mrl, stream->streaming_ctrl->url->file,
+		stream->streaming_ctrl->url->hostname, port);
+	free(mrl);
+	if(!rtsp) return -1;
+
+	stream->fd=fd;
+	stream->streaming_ctrl->data=rtsp;
+
+	stream->streaming_ctrl->streaming_read = realrtsp_streaming_read;
+//	stream->streaming_ctrl->streaming_seek = nop_streaming_seek;
+	stream->streaming_ctrl->prebuffer_size = 128*1024;  // 8 KBytes
+	stream->streaming_ctrl->buffering = 1;
+	stream->streaming_ctrl->status = streaming_playing_e;
+	return 0;
+}
+
+
 #ifndef STREAMING_LIVE_DOT_COM
 // Start listening on a UDP port. If multicast, join the group.
 int
@@ -1008,6 +1065,12 @@
 		ret = pnm_streaming_start( stream );
 	} else
 	
+	if( (!strcasecmp( stream->streaming_ctrl->url->protocol, "rtsp")) &&
+			(*demuxer_type == DEMUXER_TYPE_REAL)) {
+		stream->fd = -1;
+		ret = realrtsp_streaming_start( stream );
+	} else
+
 	// For connection-oriented streams, we can usually determine the streaming type.
 	switch( *demuxer_type ) {
 		case DEMUXER_TYPE_ASF:



More information about the MPlayer-cvslog mailing list