I'm trying to understand how a mkv is created from scratch. I found the libmatroska and libembl libraries for the document structure creation of the embl and matroska but there is no documentation available on the project repo. I'm trying to understand one of the testcase in their repo, i tried to ran it on my machine but I was it was generating a invalid mkv. However on debugging i found that the newBlockGroup is null after adding the data0 frame. and later it tries to free the memory that pointer is pointing to.
please can someone explain me why is this happening?
Thanks
KaxBlockGroup *MyNewBlock, *MyLastBlockTrk1 = nullptr, *MyLastBlockTrk2 = nullptr, *MyNewBlock2;
auto *data7 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
Clust1.AddFrame(MyTrack1, 250 * TIMECODE_SCALE, *data7, MyNewBlock, LACING_EBML);
if (MyNewBlock != nullptr)
MyLastBlockTrk1 = MyNewBlock;
auto *data0 = new DataBuffer((binary *)"TOTOTOTO", countof("TOTOTOTO"));
Clust1.AddFrame(MyTrack1, 260 * TIMECODE_SCALE, *data0, MyNewBlock, LACING_EBML);
if (MyNewBlock != nullptr)
MyLastBlockTrk1 = MyNewBlock;
auto *data6 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
Clust1.AddFrame(MyTrack1, 270 * TIMECODE_SCALE, *data6, MyNewBlock, LACING_EBML);
if (MyNewBlock != nullptr) {
MyLastBlockTrk1 = MyNewBlock;
} else {
MyLastBlockTrk1->SetBlockDuration(50 * TIMECODE_SCALE);
}
I tried to pass the lacing the lacing type to the add frame but i guess it won't make any difference.