#include "MediaHelper.h" //#include #include #include SPropRecord* parseSPropParameterSets(char const* sPropParameterSetsStr, int& numSPropRecords) { // Make a copy of the input string, so we can replace the commas with '\0's: char* inStr = strDup(sPropParameterSetsStr); if (inStr == NULL) { numSPropRecords = 0; return NULL; } // Count the number of commas (and thus the number of parameter sets): numSPropRecords = 1; char* s; for (s = inStr; *s != '\0'; ++s) { if (*s == ',') { ++numSPropRecords; *s = '\0'; } } // Allocate and fill in the result array: SPropRecord* resultArray = new SPropRecord[numSPropRecords]; s = inStr; for (unsigned i = 0; i < numSPropRecords; ++i) { resultArray[i].sPropBytes = nullptr; resultArray[i].sPropLength = 0; unsigned sPropLength = 0; uint8_t* tmp = base64Decode(s, sPropLength, True); if (tmp != nullptr && sPropLength > 0) { resultArray[i].sPropBytes = new uint8_t[256]; memcpy(resultArray[i].sPropBytes, tmp, sPropLength); } delete[] tmp; //base64_decode(s, strlen(s), (char*)resultArray[i].sPropBytes, &sPropLength, 0); resultArray[i].sPropLength = sPropLength; s += strlen(s) + 1; } delete[] inStr; return resultArray; }