freeMXF.org http://freemxf.org/forum/ |
|
question about the WritePartition method http://freemxf.org/forum/viewtopic.php?f=2&t=80 |
Page 1 of 1 |
Author: | robert [ Thu May 31, 2007 11:24 am ] |
Post subject: | question about the WritePartition method |
Hey Matt! Thank you for the great MXFLib! I have a short question: Is there a possibility to write small parts of the MXF-Body and all ending up in a single partition using the Bodywriter? The reason for the question is that i would like to abort the writing upon user request. The code should look like (Writer is of class BodyWriter): Code: // End header partition Writer->EndPartition(); while (!Writer->BodyDone()) { // write a couple of edit units Writer->WritePartition(50,0); // check if user wants to abort ..... } instead of just Code: Writer->WriteBody(); which puts everything in one large partition but can take a while to finish. From the documentation and the code in essence.cpp I assume propably yes but I managed to do it only with changes to BodyWriter::WriteEssence and that doesn't seem right Also: I probably overlook some special case, but shouldn't line 2597 in essence.cpp rather be: Code: if(ThisSize >= RemainingDuration)
Otherwise always one more edit unit is written than in the WritePartition-Call specified? Thank you, best regards, Robert |
Author: | Matt Beard [ Thu May 31, 2007 4:40 pm ] |
Post subject: | |
The +1 thing is (if my memory serves me correctly) because the last edit unit is stored for next time a body partition is started. I do like the idea of being able to cancel a write part way through, but this would be quite difficult to make work from within the BodyWriter for clip-wrapping as it passes the entire clip (or details of it!) down to a lower level. My recommendation would be to write a version of EssenceSource that works as a "filter", passing calls to all methods through to another essence source, but with a hook in GetEssenceDataSize, GetEssenceData and EndOfData to flag that the essence has ended if a test shows that the cancel button has been pressed. Then rather than: Code: BodyStreamPtr MyStream = new BodyStream(OriginalSource); ... you do: Code: EssenceSourcePtr NewSource = new FilterSource(OriginalSource);
BodyStreamPtr MyStream = new BodyStream(NewSource); |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |