#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, char const *absStartTime, char const *absEndTime) |
| static Boolean | isAbsoluteURL (char const *url) |
| static char * | getLine (char *startOfLine) |
| static char* createRangeString | ( | double | start, | |
| double | end, | |||
| char const * | absStartTime, | |||
| char const * | absEndTime | |||
| ) | [static] |
Definition at line 495 of file RTSPClient.cpp.
References NULL, Numeric, and strDup().
Referenced by RTSPClient::sendRequest().
00495 { 00496 char buf[100]; 00497 00498 if (absStartTime != NULL) { 00499 // Create a "Range:" header that specifies 'absolute' time values: 00500 00501 if (absEndTime == NULL) { 00502 // There's no end time: 00503 snprintf(buf, sizeof buf, "Range: clock=%s-\r\n", absStartTime); 00504 } else { 00505 // There's both a start and an end time; include them both in the "Range:" hdr 00506 snprintf(buf, sizeof buf, "Range: clock=%s-%s\r\n", absStartTime, absEndTime); 00507 } 00508 } else { 00509 // Create a "Range:" header that specifies relative (i.e., NPT) time values: 00510 00511 if (start < 0) { 00512 // We're resuming from a PAUSE; there's no "Range:" header at all 00513 buf[0] = '\0'; 00514 } else if (end < 0) { 00515 // There's no end time: 00516 Locale l("C", Numeric); 00517 sprintf(buf, "Range: npt=%.3f-\r\n", start); 00518 } else { 00519 // There's both a start and an end time; include them both in the "Range:" hdr 00520 Locale l("C", Numeric); 00521 sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end); 00522 } 00523 } 00524 00525 return strDup(buf); 00526 }
| static char* createScaleString | ( | float | scale, | |
| float | currentScale | |||
| ) | [static] |
Definition at line 482 of file RTSPClient.cpp.
References Numeric, and strDup().
Referenced by RTSPClient::sendRequest().
00482 { 00483 char buf[100]; 00484 if (scale == 1.0f && currentScale == 1.0f) { 00485 // This is the default value; we don't need a "Scale:" header: 00486 buf[0] = '\0'; 00487 } else { 00488 Locale l("C", Numeric); 00489 sprintf(buf, "Scale: %f\r\n", scale); 00490 } 00491 00492 return strDup(buf); 00493 }
| static char* createSessionString | ( | char const * | sessionId | ) | [static] |
Definition at line 471 of file RTSPClient.cpp.
References NULL, and strDup().
Referenced by RTSPClient::sendRequest().
00471 { 00472 char* sessionStr; 00473 if (sessionId != NULL) { 00474 sessionStr = new char[20+strlen(sessionId)]; 00475 sprintf(sessionStr, "Session: %s\r\n", sessionId); 00476 } else { 00477 sessionStr = strDup(""); 00478 } 00479 return sessionStr; 00480 }
| static char* getLine | ( | char * | startOfLine | ) | [static] |
Definition at line 1377 of file RTSPClient.cpp.
References NULL.
Referenced by SIPClient::getResponseCode(), RTSPClient::handleResponseBytes(), and setupSubsession().
01377 { 01378 // returns the start of the next line, or NULL if none. Note that this modifies the input string to add '\0' characters. 01379 for (char* ptr = startOfLine; *ptr != '\0'; ++ptr) { 01380 // Check for the end of line: \r\n (but also accept \r or \n by itself): 01381 if (*ptr == '\r' || *ptr == '\n') { 01382 // We found the end of the line 01383 if (*ptr == '\r') { 01384 *ptr++ = '\0'; 01385 if (*ptr == '\n') ++ptr; 01386 } else { 01387 *ptr++ = '\0'; 01388 } 01389 return ptr; 01390 } 01391 } 01392 01393 return NULL; 01394 }
| static Boolean isAbsoluteURL | ( | char const * | url | ) | [static] |
Definition at line 1215 of file RTSPClient.cpp.
Referenced by RTSPClient::constructSubsessionURL().
01215 { 01216 // Assumption: "url" is absolute if it contains a ':', before any 01217 // occurrence of '/' 01218 while (*url != '\0' && *url != '/') { 01219 if (*url == ':') return True; 01220 ++url; 01221 } 01222 01223 return False; 01224 }
1.5.2