testProgs/openRTSP.cpp

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // Copyright (c) 1996-2008, Live Networks, Inc.  All rights reserved
00017 // A RTSP client test program that opens a RTSP URL argument,
00018 // and extracts the data from each incoming RTP stream.
00019 
00020 #include "playCommon.hh"
00021 
00022 Medium* createClient(UsageEnvironment& env,
00023                      int verbosityLevel, char const* applicationName) {
00024   extern portNumBits tunnelOverHTTPPortNum;
00025   return RTSPClient::createNew(env, verbosityLevel, applicationName,
00026                                tunnelOverHTTPPortNum);
00027 }
00028 
00029 char* getOptionsResponse(Medium* client, char const* url,
00030                          char* username, char* password) {
00031   RTSPClient* rtspClient = (RTSPClient*)client;
00032   return rtspClient->sendOptionsCmd(url, username, password);
00033 }
00034 
00035 char* getSDPDescriptionFromURL(Medium* client, char const* url,
00036                                char const* username, char const* password,
00037                                char const* /*proxyServerName*/,
00038                                unsigned short /*proxyServerPortNum*/,
00039                                unsigned short /*clientStartPort*/) {
00040   RTSPClient* rtspClient = (RTSPClient*)client;
00041   char* result;
00042   if (username != NULL && password != NULL) {
00043     result = rtspClient->describeWithPassword(url, username, password);
00044   } else {
00045     result = rtspClient->describeURL(url);
00046   }
00047 
00048   extern unsigned statusCode;
00049   statusCode = rtspClient->describeStatus();
00050   return result;
00051 }
00052 
00053 Boolean clientSetupSubsession(Medium* client, MediaSubsession* subsession,
00054                               Boolean streamUsingTCP) {
00055   if (client == NULL || subsession == NULL) return False;
00056   RTSPClient* rtspClient = (RTSPClient*)client;
00057   return rtspClient->setupMediaSubsession(*subsession,
00058                                           False, streamUsingTCP);
00059 }
00060 
00061 Boolean clientStartPlayingSession(Medium* client,
00062                                   MediaSession* session) {
00063   extern double initialSeekTime, duration, scale;
00064   double endTime = initialSeekTime;
00065   if (scale > 0) {
00066     if (duration <= 0) endTime = -1.0f;
00067     else endTime = initialSeekTime + duration;
00068   } else {
00069     endTime = initialSeekTime - duration;
00070     if (endTime < 0) endTime = 0.0f;
00071   }
00072 
00073   if (client == NULL || session == NULL) return False;
00074   RTSPClient* rtspClient = (RTSPClient*)client;
00075   return rtspClient->playMediaSession(*session, (float)initialSeekTime, (float)endTime, (float)scale);
00076 }
00077 
00078 Boolean clientTearDownSession(Medium* client,
00079                               MediaSession* session) {
00080   if (client == NULL || session == NULL) return False;
00081   RTSPClient* rtspClient = (RTSPClient*)client;
00082   return rtspClient->teardownMediaSession(*session);
00083 }
00084 
00085 Boolean allowProxyServers = False;
00086 Boolean controlConnectionUsesTCP = True;
00087 Boolean supportCodecSelection = False;
00088 char const* clientProtocolName = "RTSP";

Generated on Tue Oct 7 15:38:10 2008 for live by  doxygen 1.5.2