Hi all (and Marc :)
I am using ProtoBuf-Net in my .NET application to serialize the following : (in .proto format)
message ProtoScreenBuffer {
optional int32 MediaId = 1;
optional bytes Data = 2;
optional bool LastBuffer = 3;
optional int64 StartTime = 4;
optional int64 StopTime = 5;
optional int32 Flags = 6;
optional int32 BufferSubType = 7;
optional int32 BufferType = 8;
optional Guid Guid = 9;
repeated int32 EncryptedDataStart = 10;
repeated int32 EncryptedDataLength = 11;
}
My aim is to serialize this and inject it into an ASF file, as a single sample.
I call this to serialize :
MemoryStream ms = new MemoryStream();
Serializer.Serialize<ProtoScreenBuffer>(ms, ProtoScreenBuffer.CreateProtoScreenBuffer (buffer));
then I get a byte array from the ms object :
ms.ToArray();
and I put this byte array in the ASF. The big problem is on my C++ app which reads the ASF sample just fine, I get a memory access violation when I try to deserialize it :(
this is my C++ code :
m_screenBuffer.ParseFromArray(serBuffer, dwInputDataLen);
(where m_screenBuffer is ProtoScreenBuffer, serBuffer is the raw byte array I got from the ASF file, and dwInputDataLen is the length of it.)
Are any of the things I'm doing here wrong , for what I'm trying to do (serialize in C# .NET and deserialize in C++?)
Thanks alot.
Roey