• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Creating movie on background thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating movie on background thread


  • Subject: Creating movie on background thread
  • From: "Roger Herikstad" <email@hidden>
  • Date: Tue, 2 Sep 2008 12:50:19 +0800

Hi lists,
 Sorry for the cross-posting, but I thought my issue to relevant for
both lists. I need to create an image sequence of some plots from a
graphing application that i'm writing, and I would like to be able to
do this on a background thread. Basically, I ask my app to plot some
signals on screen (~1000 individual signals) and once I'm happy with
how the signals look, I'd like to create an image sequence so that if
I want to look at those signals again, I have only to load up the
movie instead of plotting them again. I'm using an NSOperation object
for constructing my movie. The relevant code is

- (void)createMovieInRect:(NSRect)aRect
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSError *error = [NSError errorWithDomain: @"thisDomain" code: 1
userInfo: nil];
    QTMovie *movie = [[QTMovie alloc] initToWritableFile: output_file
error: &error];
    //QTMovie *movie = [QTMovie movie];

    //NSImage *image = NULL;
    QTTime duration = QTMakeTime(1,10);

    NSDictionary *attribs = nil;
    attribs = [NSDictionary dictionaryWithObjectsAndKeys:@"avc1",
               QTAddImageCodecType,
               [NSNumber numberWithLong:codecHighQuality],
               QTAddImageCodecQuality,
               nil];
    QTTime dur;
    BOOL success = NO;
    int i;
    NSLog([NSString stringWithFormat: @"Creating movie of %d
frames\n",num_waves ]);

    for(i=0;i< num_waves;i++)
    {
        [_image release];
        _image = NULL;
        [self setdrawWaves: [NSIndexSet indexSetWithIndex: i]];
        [self drawInRect: aRect];
        [movie addImage: [self image] forDuration: duration
withAttributes: attribs];
        success = [movie updateMovieFile];
        CGContextRestoreGState(context);

    }

    [movie release];
    [_image release];
    [pool release];
}

When I create my operation object and add it to the queue, the process
of creating the movie seems exceedingly slow, 1 hour+ to create a
movie consisting of 1,000 images. My question is, is there something
in the QTKit that prevents it from working properly on a background
thread? There are probably other issues with my code that could be
optimised, but I just wanted to rule out multi-threading problems.
Thanks!

~ Roger
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Creating movie on background thread
      • From: Quincey Morris <email@hidden>
    • Re: Creating movie on background thread
      • From: James Chen <email@hidden>
  • Prev by Date: NSDateFormatter and Display Value bindings
  • Next by Date: Re: Creating movie on background thread
  • Previous by thread: Re: NSDateFormatter and Display Value bindings
  • Next by thread: Re: Creating movie on background thread
  • Index(es):
    • Date
    • Thread