
mp4v2 - issue #96
No way to leave a file untouched if settings tags for writing fails
Consider what mp4tags.cpp does to write a file. It's basically:
MP4FileHandle h = MP4Modify( mp4 ); const MP4Tags* mdata = MP4TagsAlloc(); MP4TagsFetch( mdata, h );
< make a bunch of changes >
MP4TagsStore( mdata, h ); MP4TagsFree( mdata ); MP4Close( h );
The trouble is, MP4TagsStore (or really any operation after calling MP4Modify) can fail. By itself, that's not so bad, but let's assume we want to give up in the middle and not write the file after all. The way MP4Modify and MP4Close (really MP4File::Modify and MP4File::Close) work makes it hard to leave the file alone. It'd be nice if this code in MP4File::Close were optional:
if( IsWriteMode() ) {
SetIntegerProperty( "moov.mvhd.modificationTime", MP4GetAbsTimestamp() );
FinishWrite();
}
I'll come up with patch if people agree this is good idea.
Comment #1
Posted on Jun 26, 2011 by Happy LionNot sure if you can use it, but I added an optional flag argument to MP4Close(), so maybe you could pass in a flag to skip the FinishWrite() call?
Status: Accepted
Labels:
Type-Enhancement
Priority-Medium