开发者

How can I initialize a QTMovie object with certain attributes using writable data?

开发者 https://www.devze.com 2022-12-27 19:52 出处:网络
I\'m trying to create an empty QTMovie object that I can add segments to, and开发者_开发百科 then play. This is easy to do with something like:

I'm trying to create an empty QTMovie object that I can add segments to, and开发者_开发百科 then play. This is easy to do with something like:

movie = [[QTMovie alloc] initToWritableData:[NSMutableData dataWithCapacity:1048576] error:&error];

I can then use -insertSegmentOfMovie to insert segments from other movies into this one so I can play it back. The problem is that I also need to set a certain attribute when creating the QTMovie object. In particular, I need to set the QTMovieRateChangesPreservePitchAttribute attribute, so that I can alter playback speed during playback without changing pitch. This attribute cannot be written after the movie is initialized.

So, I can create the QTMovie object like this:

movie = [[QTMovie alloc] initWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], QTMovieRateChangesPreservePitchAttribute, nil] error:&error];

Unfortunately, this is not editable. I've tried setting the QTMovieEditableAttribute as well on creation, but it does not help. I still get an exception when I try to insert anything into this movie. I presume this is because there is no writable file or data reference associated with the QTMovie.

Any ideas on how to solve this?

0

精彩评论

暂无评论...
验证码 换一张
取 消