Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned MyRTSPClient::sendSetParametersCommand(
- MediaSession& session
- ,responseHandler* responseHandler
- ,unsigned int parameterCount
- ,char const** parameterNames
- ,char const** parameterValues
- ,Authenticator* authenticator)
- {
- if (authenticator != NULL)
- fCurrentAuthenticator = *authenticator;
- //Construct the parameters section.
- //First figure out how long of a string we will need to store
- //each name value \r\n pair.
- int parameterSectionLen = 0;
- for( int i = 0; i != parameterCount; ++i )
- {
- parameterSectionLen += strlen(parameterNames[i]);
- parameterSectionLen += strlen(parameterValues[i]);
- parameterSectionLen += 4; //+4 is for the ": " between the value and the parameter and the \r\n after the parameter "name: value"
- }
- //Now new a string big enough to hold the formated parameter list.
- char* paramString = new char[parameterSectionLen+1];
- char* pos = paramString;
- //Now format all the parameter "name: value\r\n" lines.
- for( int i = 0; i != parameterCount; ++i )
- {
- pos += sprintf( pos, "%s: %s\r\n", parameterNames[i], parameterValues[i] );
- }
- unsigned result = sendRequest(new RequestRecord(++fCSeq, "SET_PARAMETER", responseHandler, &session, NULL, False, 0.0, 0.0, 0.0, paramString));
- delete[] paramString;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement