summaryrefslogtreecommitdiff
path: root/tests/rtspserver.pl
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-02-01 12:05:08 +0000
committerYang Tse <yangsita@gmail.com>2010-02-01 12:05:08 +0000
commit35fbeda0032860929292896f73ab37a274cb5fa1 (patch)
tree16495b58a5e3768697b9d43e79cb5dc63537cb45 /tests/rtspserver.pl
parent715e3a806f333320f3d8a1172d7f000db59edcf6 (diff)
downloadcurl-35fbeda0032860929292896f73ab37a274cb5fa1.tar.gz
Test suite support for RTSP
Diffstat (limited to 'tests/rtspserver.pl')
-rwxr-xr-xtests/rtspserver.pl109
1 files changed, 109 insertions, 0 deletions
diff --git a/tests/rtspserver.pl b/tests/rtspserver.pl
new file mode 100755
index 000000000..2bdc54a76
--- /dev/null
+++ b/tests/rtspserver.pl
@@ -0,0 +1,109 @@
+#!/usr/bin/env perl
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+# $Id$
+#***************************************************************************
+
+BEGIN {
+ @INC=(@INC, $ENV{'srcdir'}, '.');
+}
+
+use strict;
+use warnings;
+
+use serverhelp qw(
+ server_pidfilename
+ server_logfilename
+ );
+
+my $verbose = 0; # set to 1 for debugging
+my $port = 8990; # just a default
+my $ipvnum = 4; # default IP version of rtsp server
+my $idnum = 1; # dafault rtsp server instance number
+my $proto = 'rtsp'; # protocol the rtsp server speaks
+my $pidfile; # rtsp server pid file
+my $logfile; # rtsp server log file
+my $srcdir;
+
+my $flags = "";
+my $path = '.';
+my $logdir = $path .'/log';
+
+while(@ARGV) {
+ if($ARGV[0] eq '--pidfile') {
+ if($ARGV[1]) {
+ $pidfile = $ARGV[1];
+ shift @ARGV;
+ }
+ }
+ elsif($ARGV[0] eq '--logfile') {
+ if($ARGV[1]) {
+ $logfile = $ARGV[1];
+ shift @ARGV;
+ }
+ }
+ elsif($ARGV[0] eq '--srcdir') {
+ if($ARGV[1]) {
+ $srcdir = $ARGV[1];
+ shift @ARGV;
+ }
+ }
+ elsif($ARGV[0] eq '--ipv4') {
+ $ipvnum = 4;
+ }
+ elsif($ARGV[0] eq '--ipv6') {
+ $ipvnum = 6;
+ }
+ elsif($ARGV[0] eq '--port') {
+ if($ARGV[1] =~ /^(\d+)$/) {
+ $port = $1;
+ shift @ARGV;
+ }
+ }
+ elsif($ARGV[0] eq '--id') {
+ if($ARGV[1] =~ /^(\d+)$/) {
+ $idnum = $1 if($1 > 0);
+ shift @ARGV;
+ }
+ }
+ elsif($ARGV[0] eq '--verbose') {
+ $verbose = 1;
+ }
+ else {
+ print STDERR "\nWarning: rtspserver.pl unknown parameter: $ARGV[0]\n";
+ }
+ shift @ARGV;
+}
+
+if(!$srcdir) {
+ $srcdir = $ENV{'srcdir'} || '.';
+}
+if(!$pidfile) {
+ $pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
+}
+if(!$logfile) {
+ $logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
+}
+
+$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
+$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
+
+exec("server/rtspd $flags");