freeMXF.org

Open discussion about freeMXF.org tools and MXF in general
It is currently Thu Mar 28, 2024 1:47 pm
Board index » MXF Categories » freeMXF.org Tools



Post new topic Reply to topic  [ 2 posts ] 
Author
Search for:
Message

Offline
Rookie

Joined: Thu May 31, 2007 10:10 am
Posts: 1

Post Posted: Thu May 31, 2007 11:24 am 
Top  
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

 Profile  

Offline
Insider

Joined: Thu Apr 15, 2004 10:39 am
Posts: 198
Location: Scotland

Post Posted: Thu May 31, 2007 4:40 pm 
Top  
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);

 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Jump to:  


Who is online

Users browsing this forum: No registered users and 50 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group :: Style based on FI Subice by phpBBservice.nl :: All times are UTC