changeset 17650:d6e575c86bb8

Allows the LIVE555 library to forces the client's port to be used when reading from an RTP/RTSP source. Patch from Benjamin Zores <ben@geexbox.org> and Patrick Labatut <plabatut@gmail.com>
author bertrand
date Sun, 19 Feb 2006 13:27:27 +0000
parents a6a8b4287538
children 2b7ef01809fb
files DOCS/man/en/mplayer.1 DOCS/man/fr/mplayer.1 cfg-mplayer.h libmpdemux/demux_rtp.cpp
diffstat 4 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Sun Feb 19 10:15:18 2006 +0000
+++ b/DOCS/man/en/mplayer.1	Sun Feb 19 13:27:27 2006 +0000
@@ -1346,6 +1346,12 @@
 not pass incoming UDP packets (see http://www.live555.com/\:mplayer/).
 .
 .TP
+.B \-rtsp-port (LIVE555 only)
+Used with 'rtsp://' URLs to forces the client's port number.
+This option may be useful if you're behind a router and want to forward the
+RTSP stream from the server to a specific client.
+.
+.TP
 .B \-saveidx <filename>
 Force index rebuilding and dump the index to <filename>.
 Currently this only works with AVI files.
--- a/DOCS/man/fr/mplayer.1	Sun Feb 19 10:15:18 2006 +0000
+++ b/DOCS/man/fr/mplayer.1	Sun Feb 19 13:27:27 2006 +0000
@@ -1426,6 +1426,13 @@
 qui bloque les paquets UDP entrants (voir http://www.live.com/\:mplayer/).
 .
 .TP
+.B \-rtsp-port (LIVE555 uniquement)
+Utilisé avec 'rtsp://', URLs pour forcer l'utilisation d'un port particulier
+au niveau du client.
+Cette option peut être utile si vous êtes derrière un routeur et souhaitez
+redistribuer le flux RTSP du serveur vers un client spécifique.
+.
+.TP
 .B \-saveidx <nomfichier>
 Force la reconstruction de l'index et le sauvegarde dans <nomfichier>.
 Pour l'instant cela ne fonctionne qu'avec les fichiers AVI.
--- a/cfg-mplayer.h	Sun Feb 19 10:15:18 2006 +0000
+++ b/cfg-mplayer.h	Sun Feb 19 13:27:27 2006 +0000
@@ -86,6 +86,7 @@
 #ifdef STREAMING_LIVE555
 extern int isSDPFile;
 extern int rtspStreamOverTCP;
+extern int rtsp_port;
 #endif
 
 #ifdef HAVE_NEW_GUI
@@ -296,8 +297,10 @@
         {"sdp", "-sdp is obsolete, use sdp://file instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
 	// -rtsp-stream-over-tcp option, specifying TCP streaming of RTP/RTCP
         {"rtsp-stream-over-tcp", &rtspStreamOverTCP, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+        {"rtsp-port", &rtsp_port, CONF_TYPE_INT, CONF_RANGE, -1, 65535, NULL},
 #else
 	{"rtsp-stream-over-tcp", "RTSP support requires the \"LIVE555 Streaming Media\" libraries.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+        {"rtsp-port", "RTSP support requires the \"LIVE555 Streaming Media\" libraries.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
 #endif
 
 //---------------------- mplayer-only options ------------------------
--- a/libmpdemux/demux_rtp.cpp	Sun Feb 19 10:15:18 2006 +0000
+++ b/libmpdemux/demux_rtp.cpp	Sun Feb 19 13:27:27 2006 +0000
@@ -90,6 +90,7 @@
 }
 
 int rtspStreamOverTCP = 0; 
+int rtsp_port = 0; 
 
 extern "C" int audio_id, video_id, dvdsub_id;
 extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
@@ -174,10 +175,13 @@
 	continue;
       }
 
+      if (rtsp_port)
+          subsession->setClientPortNum (rtsp_port);
+      
       if (!subsession->initiate()) {
 	fprintf(stderr, "Failed to initiate \"%s/%s\" RTP subsession: %s\n", subsession->mediumName(), subsession->codecName(), env->getResultMsg());
       } else {
-	fprintf(stderr, "Initiated \"%s/%s\" RTP subsession\n", subsession->mediumName(), subsession->codecName());
+	fprintf(stderr, "Initiated \"%s/%s\" RTP subsession on port %d\n", subsession->mediumName(), subsession->codecName(), subsession->clientPortNum());
 
 	// Set the OS's socket receive buffer sufficiently large to avoid
 	// incoming packets getting dropped between successive reads from this