liveMedia/RTSPClient.cpp File Reference

#include "RTSPClient.hh"
#include "RTSPCommon.hh"
#include "Base64.hh"
#include "Locale.hh"
#include <GroupsockHelper.hh>
#include "our_md5.h"

Include dependency graph for RTSPClient.cpp:

Go to the source code of this file.

Functions

static char * createSessionString (char const *sessionId)
static char * createScaleString (float scale, float currentScale)
static char * createRangeString (double start, double end)
static Boolean isAbsoluteURL (char const *url)
static char * getLine (char *startOfLine)


Function Documentation

static char* createRangeString ( double  start,
double  end 
) [static]

Definition at line 480 of file RTSPClient.cpp.

References Numeric, and strDup().

Referenced by RTSPClient::sendRequest().

00480                                                          {
00481   char buf[100];
00482   if (start < 0) {
00483     // We're resuming from a PAUSE; there's no "Range:" header at all
00484     buf[0] = '\0';
00485   } else if (end < 0) {
00486     // There's no end time:
00487     Locale l("C", Numeric);
00488     sprintf(buf, "Range: npt=%.3f-\r\n", start);
00489   } else {
00490     // There's both a start and an end time; include them both in the "Range:" hdr
00491     Locale l("C", Numeric);
00492     sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end);
00493   }
00494 
00495   return strDup(buf);
00496 }

static char* createScaleString ( float  scale,
float  currentScale 
) [static]

Definition at line 467 of file RTSPClient.cpp.

References Numeric, and strDup().

Referenced by RTSPClient::sendRequest().

00467                                                                 {
00468   char buf[100];
00469   if (scale == 1.0f && currentScale == 1.0f) {
00470     // This is the default value; we don't need a "Scale:" header:
00471     buf[0] = '\0';
00472   } else {
00473     Locale l("C", Numeric);
00474     sprintf(buf, "Scale: %f\r\n", scale);
00475   }
00476 
00477   return strDup(buf);
00478 }

static char* createSessionString ( char const *  sessionId  )  [static]

Definition at line 456 of file RTSPClient.cpp.

References NULL, and strDup().

Referenced by RTSPClient::sendRequest().

00456                                                         {
00457   char* sessionStr;
00458   if (sessionId != NULL) {
00459     sessionStr = new char[20+strlen(sessionId)];
00460     sprintf(sessionStr, "Session: %s\r\n", sessionId);
00461   } else {
00462     sessionStr = strDup("");
00463   }
00464   return sessionStr;
00465 }

static char* getLine ( char *  startOfLine  )  [static]

Definition at line 1321 of file RTSPClient.cpp.

References NULL.

Referenced by SIPClient::getResponseCode(), and RTSPClient::handleResponseBytes().

01321                                         {
01322   // returns the start of the next line, or NULL if none.  Note that this modifies the input string to add '\0' characters.
01323   for (char* ptr = startOfLine; *ptr != '\0'; ++ptr) {
01324     // Check for the end of line: \r\n (but also accept \r or \n by itself):
01325     if (*ptr == '\r' || *ptr == '\n') {
01326       // We found the end of the line
01327       if (*ptr == '\r') {
01328         *ptr++ = '\0';
01329         if (*ptr == '\n') ++ptr;
01330       } else {
01331         *ptr++ = '\0';
01332       }
01333       return ptr;
01334     }
01335   }
01336 
01337   return NULL;
01338 }

static Boolean isAbsoluteURL ( char const *  url  )  [static]

Definition at line 1158 of file RTSPClient.cpp.

References False, and True.

Referenced by RTSPClient::constructSubsessionURL().

01158                                               {
01159   // Assumption: "url" is absolute if it contains a ':', before any
01160   // occurrence of '/'
01161   while (*url != '\0' && *url != '/') {
01162     if (*url == ':') return True;
01163     ++url;
01164   }
01165 
01166   return False;
01167 }


Generated on Thu Feb 2 23:53:56 2012 for live by  doxygen 1.5.2