bool CRTSPClient::UpdateDuration() { char* sdpDescription= getSDPDescription(); if (sdpDescription == NULL) { LogDebug("UpdateStreamDuration: Failed to get a SDP description from URL %s %s", m_url ,m_env->getResultMsg() ); return false; } //LogDebug("Opened URL %s %s",url,sdpDescription); char* range=strstr(sdpDescription,"a=range:npt="); if (range!=NULL) { char *pStart = range+strlen("a=range:npt="); char *pEnd = strstr(range,"-") ; if (pEnd!=NULL) { pEnd++ ; double Start=atof(pStart) ; double End=atof(pEnd) ; //LogDebug("rangestart:%f rangeend:%f", Start,End); m_duration=((End-Start)*1000.0); } } }
std::string RTSPResponse::getDESCRIBE(double maxRange = -1.0) { std::string ret(common); std::string sdps = getSDPDescription(maxRange); ret += "Content-Base: " + rtspRequest->getUrl() + "/\r\n" + "Content-type: application/sdp\r\n" + "Content-length: " + std::to_string(sdps.size()) + "\r\n\r\n" + sdps; return ret; }
void continueAfterOPTIONS(RTSPClient*, int resultCode, char* resultString) { if (sendOptionsRequestOnly) { if (resultCode != 0) { *env << clientProtocolName << " \"OPTIONS\" request failed: " << resultString << "\n"; } else { *env << clientProtocolName << " \"OPTIONS\" request returned: " << resultString << "\n"; } shutdown(); } delete[] resultString; // Next, get a SDP description for the stream: getSDPDescription(continueAfterDESCRIBE); }