On 2010-05-28, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote:

> i've tried everything -- how do other people get movie posters and/or grab
> movie frames?

With classic QuickTime if there was no poster frame specifically set in the 
movie QuickTime would reliably return the first frame. With QuickTimeKit that 
is ... inconsistent. Safest to just grab the first frame yourself.

As for capturing frames, here's the I believe currently recommended way to do 
it:

   NSDictionary *imageAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
      QTMovieFrameImageTypeNSImage, QTMovieFrameImageType,
      [NSArray arrayWithObject:@"NSBitmapImageRep"], 
QTMovieFrameImageRepresentationsType,
      [NSNumber numberWithBool:YES], QTMovieFrameImageDeinterlaceFields,
      [NSNumber numberWithBool:YES], QTMovieFrameImageHighQuality,
      [NSNumber numberWithBool:YES], QTMovieFrameImageSingleField,
      nil
   ];

   QTTime captureTime = [0 .. self.movie.duration];

   NSError *captureError = nil;
   NSImage *captureFullFrame = [self.movie frameImageAtTime:captureTime
      withAttributes:imageAttrs
      error:&captureError
   ];

That allows for a variety of other image types besides 
QTMovieFrameImageTypeNSImage, but is QuickTime 7.2 dependent. If you need older 
version compatibility, use

- (NSImage *)frameImageAtTime:(QTTime)time;

Either way, these should only be called on the main thread. Theoretically you 
can detach movies and move them around between threads, but you have a good 
chance of running into issues doing so, particularly if you're working with 
QTKit captured movies; something about the rendering context I think, although 
the details are old enough to be kinda fuzzy now. Safer to just call 
performSelectorOnMainThread: to get each grabbed frame if you've got a 
background renderer or suchlike, I'd say.

-- 
Alex Curylo -- a...@alexcurylo.com -- http://www.alexcurylo.com/

"...the variable PI can be given that value [3.141592653589793] with
 a DATA statement. This simplifies the modifying of the program,
 should the value of PI ever change." -- SDS Sigma series Fortran manual 



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to