My overall goal is to capture the desktop screen and encapsulate in a webm container with encoding such as VP8 or VP9. I can save it as a file, but my intention is to stream the video to a webbrowser and using mediasource extension to view the content.
Now am stuck att writing/reading the data of memory using avio_alloc_context .
avio_alloc_context(ioBuffer, IOBUFSIZE, 1, nullptr, readFromBuffer, writeToBuffer, nullptr);
Does anyone have code snippets for both read and write functions?
From this question i found the write function:
std::vector<uint8_t> outputData;
int mediaMuxCallback(void *opaque, uint8_t *buf, int bufSize)
{
outputData.insert(outputData.end(), buf, buf + bufSize);
return bufSize;
}
- How should the read function be implemented any idea?
- Is a vector the best alternative or how about an IStream which one is easier?