| | |
| | | #include "PL_H264Decoder.h"
|
| | | #include "MaterialBuffer.h"
|
| | | #include "MediaHelper.h"
|
| | | #include "logger.h"
|
| | |
|
| | | #include <H264VideoRTPSource.hh> // for SPropRecord
|
| | | #include <libbase64.h>
|
| | | #include <liveMedia/H264VideoRTPSource.hh> // for SPropRecord
|
| | | //#include <libbase64.h>
|
| | |
|
| | | extern "C"
|
| | | {
|
| | |
| | | {
|
| | | H264Decoder_Internal* in = (H264Decoder_Internal*)internal;
|
| | |
|
| | | }
|
| | |
|
| | | SPropRecord* parseSPropParameterSets(char const* sPropParameterSetsStr, size_t& 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 = new uint8_t[256];
|
| | | |
| | | size_t sPropLength = 0;
|
| | | base64_decode(s, strlen(s), (char*)resultArray[i].sPropBytes, &sPropLength, 0);
|
| | | resultArray[i].sPropLength = sPropLength;
|
| | | |
| | | s += strlen(s) + 1; |
| | | } |
| | | |
| | | delete[] inStr; |
| | | return resultArray; |
| | | }
|
| | |
|
| | | bool initH264DecoderEnv(H264Decoder_Internal* in,
|
| | |
| | | if (fmtp.empty())
|
| | | return false;
|
| | |
|
| | | size_t numSPropRecords = 0;
|
| | | int numSPropRecords = 0;
|
| | | SPropRecord *p_record = parseSPropParameterSets(fmtp.c_str(), numSPropRecords);
|
| | | if (numSPropRecords < 2)
|
| | | {
|