/* Get the SDP attributes for the stream config */ char* getSdpPayloadForStreamConfig(int rtspClientVersion, int *length) { PSDP_OPTION attributeList; int offset; char* payload; char urlSafeAddr[URLSAFESTRING_LEN]; addrToUrlSafeString(&RemoteAddr, urlSafeAddr); attributeList = getAttributesList(urlSafeAddr); if (attributeList == NULL) { return NULL; } payload = malloc(MAX_SDP_HEADER_LEN + MAX_SDP_TAIL_LEN + getSerializedAttributeListSize(attributeList)); if (payload == NULL) { freeAttributeList(attributeList); return NULL; } offset = fillSdpHeader(payload, rtspClientVersion, urlSafeAddr); offset += fillSerializedAttributeList(&payload[offset], attributeList); offset += fillSdpTail(&payload[offset]); freeAttributeList(attributeList); *length = offset; return payload; }
/* Get the SDP attributes for the stream config */ char* getSdpPayloadForStreamConfig(PSTREAM_CONFIGURATION streamConfig, struct in_addr targetAddress, int rtspClientVersion, int *length) { PSDP_OPTION attributeList; int offset; char* payload; attributeList = getAttributesList(streamConfig, targetAddress); if (attributeList == NULL) { return NULL; } payload = malloc(MAX_SDP_HEADER_LEN + MAX_SDP_TAIL_LEN + getSerializedAttributeListSize(attributeList)); if (payload == NULL) { freeAttributeList(attributeList); return NULL; } offset = fillSdpHeader(payload, targetAddress, rtspClientVersion); offset += fillSerializedAttributeList(&payload[offset], attributeList); offset += fillSdpTail(&payload[offset]); freeAttributeList(attributeList); *length = offset; return payload; }