Closed apavlenko closed 8 years ago
A prototype implemented: transparent encoding/decoding from/to base64 inside XMPDataSource. See rv/compression_prototype branch for details.
Each compression method should be implemented as a class implementing ICompressor interface:
void compress(const string& in, string& out);
void decompress(const string& in, string& out);
string getId();
If user wants to use his own compression method, the function vmf::registerCompressor(ICompressor*)
should be called before that.
Exporting metadata to separate file is performed now using IReader
and IWriter
interfaces.
I propose to create CompressionReader
class derived from IReader
interface.
It should use the following user-provided instances of interfaces:
ICompressor
to decompress dataIReader
to parse dataThe same for CompressionWriter
class.
To write metadata to video file a user now calls the method vmf::MetadataStream::save()
or saveTo(string)
.
I propose to add the optional argument ICompressor*
to the methods.
Implementation of the in-video metadata compression should be the following:
XMPDataSource::loadXMPStructs()
and XMPDataSource::saveXMPStructs()
as an intermediate layerCompressedXMPDataSource
taking ICompressor*
as the constructor argumentI suggest
class ICompressor
{
public:
void compress(const std::string& in, vmf_rawbuffer& out);
void decompress(const vmf_rawbuffer& in, std::string& out);
const std::string& getID();
};
since VMF uses vmf_rawbuffer
type for arbitrary binary data (BTW, vmf_rawbuffer
implementation can be improved).
Also vmf::registerCompressor(std::shared_ptr<ICompressor> compressor)
is much safer than use of naked pointer.
I'm not sure we really need CompressedXMPDataSource
as an inheritor of XMPDataSource
for compression support - please consider possibility of adding compression-related code directly into XMPDataSource
. (Same for IReader
and IWriter
.)
Requirements: