[MPlayer-dev-eng] [PATCH] set RTSP client port
Patrick Labatut
plabatut at gmail.com
Sun Jan 15 12:35:17 CET 2006
Hi,
The attached tiny patch allows to set the RTSP client port (useful to
receive streams on a machine located behind a router using port forwarding).
A similar option already exists in VLC SVN version.
-------------- next part --------------
diff -Naur ../mplayer-CVS-20060115.orig/DOCS/man/en/mplayer.1 ./DOCS/man/en/mplayer.1
--- ../mplayer-CVS-20060115.orig/DOCS/man/en/mplayer.1 2006-01-08 20:06:13.000000000 +0100
+++ ./DOCS/man/en/mplayer.1 2006-01-15 11:56:58.000000000 +0100
@@ -1303,6 +1303,13 @@
not pass incoming UDP packets (see http://www.live555.com/\:mplayer/).
.
.TP
+.B \-rtsp-client-port <port> (LIVE555 only)
+Used with 'rtsp://' URLs to specify that the resulting incoming RTP and RTCP
+packets be streamed using the provided port.
+This option may be useful if you want to receive streams on a machine located
+behind a router using port forwarding.
+.
+.TP
.B \-saveidx <filename>
Force index rebuilding and dump the index to <filename>.
Currently this only works with AVI files.
diff -Naur ../mplayer-CVS-20060115.orig/DOCS/man/fr/mplayer.1 ./DOCS/man/fr/mplayer.1
--- ../mplayer-CVS-20060115.orig/DOCS/man/fr/mplayer.1 2006-01-08 22:41:01.000000000 +0100
+++ ./DOCS/man/fr/mplayer.1 2006-01-15 11:57:09.000000000 +0100
@@ -1382,6 +1382,13 @@
qui bloque les paquets UDP entrants (voir http://www.live.com/\:mplayer/).
.
.TP
+.B \-rtsp-client-port <port> (LIVE555 uniquement)
+Utilisé avec 'rtsp://', URLs pour indiquer que les paquets RTP et RTCP
+entrants seront envoyés vers le port indiqué.
+Cette option peut être utile si vous souhaitez recevoir des flux sur une
+machine située derrière un routeur en utilisant une redirection de port.
+.
+.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.
diff -Naur ../mplayer-CVS-20060115.orig/cfg-mplayer.h ./cfg-mplayer.h
--- ../mplayer-CVS-20060115.orig/cfg-mplayer.h 2006-01-15 10:46:39.000000000 +0100
+++ ./cfg-mplayer.h 2006-01-15 11:25:22.000000000 +0100
@@ -86,6 +86,7 @@
#ifdef STREAMING_LIVE555
extern int isSDPFile;
extern int rtspStreamOverTCP;
+extern int rtspClientPort;
#endif
#ifdef HAVE_NEW_GUI
@@ -296,8 +297,11 @@
{"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-client-port option, specifying client ports for RTP/RTCP streaming
+ {"rtsp-client-port", &rtspClientPort, CONF_TYPE_INT, CONF_RANGE, 1025, 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-client-port", "RTSP support requires the \"LIVE555 Streaming Media\" libraries.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
#endif
//---------------------- mplayer-only options ------------------------
diff -Naur ../mplayer-CVS-20060115.orig/libmpdemux/demux_rtp.cpp ./libmpdemux/demux_rtp.cpp
--- ../mplayer-CVS-20060115.orig/libmpdemux/demux_rtp.cpp 2006-01-15 10:53:46.000000000 +0100
+++ ./libmpdemux/demux_rtp.cpp 2006-01-15 11:25:22.000000000 +0100
@@ -90,6 +90,7 @@
}
int rtspStreamOverTCP = 0;
+int rtspClientPort = -1;
extern "C" int audio_id, video_id, dvdsub_id;
extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
@@ -174,6 +175,9 @@
continue;
}
+ if (rtspClientPort != -1)
+ subsession->setClientPortNum(rtspClientPort);
+
if (!subsession->initiate()) {
fprintf(stderr, "Failed to initiate \"%s/%s\" RTP subsession: %s\n", subsession->mediumName(), subsession->codecName(), env->getResultMsg());
} else {
More information about the MPlayer-dev-eng
mailing list