Archive for the 'QuickTime' Category

Apple documentation search that works

Sunday, March 6th, 2011

You’ve probably tried searching Apple’s developer documentation like this:

The filter field on the ADC documentation library navigation page.

Edit: That’s the filter field, which is not what this post is about. The filter sucks. This isn’t just an easy way to use the filter field; it’s an entirely different solution. Read on.

You’ve probably been searching it like this:


(And yes, I know about That often isn’t much better than without it. Again, read on.)

There is a better way.

Better than that: A best way.


First, you must use Google Chrome or OmniWeb.

Go to your list of custom searches. In Chrome, open the Preferences and click on Manage:

Screenshot with arrow pointing to the Manage button.

In OmniWeb, open the Preferences and click on Shortcuts:

Screenshot of OmniWeb's Shortcuts pane.

Then add one or both of these searches:

For the Mac

Chrome OmniWeb
Name ADC Mac OS X Library
Keyword adcmac adcmac@

For iOS

Chrome OmniWeb
Name ADC iOS Library
Keyword adcios adcios@


Notice how the results page gives you both guides and references at once, even giving specific-chapter links when relevant. You even get relevant technotes and Q&As. No wild goose chases, no PDF mines, no third-party old backup copies, no having to scroll past six hits of mailing-list threads and Stack Overflow questions. You get the docs, the right docs, and nothing but the docs.

For this specific purpose, you now have something better than Google.

How to be notified every frame while a QuickTime movie is playing

Thursday, January 17th, 2008

Use SetMovieDrawingCompleteProc.

Before you mention QTMovieTimeDidChangeNotification: No, that doesn’t do the job. QTMovieTimeDidChangeNotification is not posted during playback; it’s only posted when the time is changed for some other reason.

Notes on Sapiens

Tuesday, October 2nd, 2007

Sapiens, which I found on the DFLL, is a new app launcher that serves as a mouse-based counterpart to Quicksilver.

(Of course, Quicksilver can do a lot more than launch applications. Sapiens can’t, so it’s a counterpart in only the app-launching aspect.)

One thing I noticed is that when it’s running, it gets two Dock tiles:

One of them is the application bundle as I see it in the Finder, which is what I added to the Dock myself, and which is no longer running; the other is the application behind the running Sapiens process, which appears in the Dock for only that reason.

That’s if you add it to the Dock from the Finder, of course. That’s what I did. If you just drag the running process into place, you’ll have only one tile.

The reason for this weird behavior is that Sapiens is actually two applications: The front-end app (which, I guess, just checks whether you’ve run Sapiens before and shows you the intro movie if you haven’t seen it yet), and the real app (which runs in the background and is the real app-launcher app).

Speaking of the intro movie:

The Resources folder for the front-end app contains the introductory movie as a Shockwave Flash (SWF) file, and an HTML file to display it.


Seriously, this is a Mac application. QuickTime is always available, and it’s a lot easier to put a QuickTime movie into a QTMovieView (just type the name into the field in IB) than it is to put a Flash movie into a WebView. (And I don’t think you even need the HTML file. You could just load the SWF file itself into the WebView.)

The idea is cool, and the app seems to implement it well enough. If I see any other weirdness, I’ll add it here.

Four headers worth reading

Tuesday, August 7th, 2007
  • <Foundation/FoundationErrors.h>
  • <AppKit/AppKitErrors.h>
  • <CoreData/CoreDataErrors.h>
  • <WebKit/WebKitErrors.h>

These four headers define error codes in NSCocoaErrorDomain, which you can use in and expect from NSError instances.

There’s also <QuickTime/QuickTimeErrors.h>, but its error codes are OSStatuses (usable with NSOSStatusErrorDomain), which makes them better-known to begin with.

WWDC 2007 session videos are out

Monday, July 30th, 2007

If you attended WWDC, you can head over to ADC on iTunes and see what you missed.

Report-an-Apple-Bug Friday! 55

Friday, April 13th, 2007

This bug is QuickTime does not allow protected MPEG-4 video files to be opened. It was filed on 2007-04-13 at 15:51 PDT.


NSMovieView vs QTMovieView

Friday, June 2nd, 2006

I mentioned in my previous post that you should use QTMovieView rather than NSMovieView because QTMovieView is so much more efficient.

There is, however, one reason to use NSMovieView, and it’s the controller thumb:

A window with an NSMovieView, showing off its hourglass-shaped controller thumb.
NSMovieView with QuickTime 7.0.2.

A MoviePlayer 2.5.1 window, showing off QuickTime 6.0.3's controller thumb.
MoviePlayer 2.5.1 with QuickTime 6.0.3.

A window with a QTMovieView, showing off its plain round controller thumb.
QTMovieView with QuickTime 7.0.2.

Does anyone know how I can get QTMovieView to use the same controller thumb that NSMovieView and QuickTime 6 use?

And no, the “Speed” field and progress bar are not part of the QTMovieView.

UPDATE 2006-06-10: wootest says that the above is the editing controller, so you get it by making the movie editable. I’ve tried it and it works. The code is:

[movie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute];


Technorati tags: .

Enhancing QuickTime performance

Friday, June 2nd, 2006

I use a 450 MHz G4 Cube, so I tend to look hard at minimizing any large drains on my CPU. Such drains include playback of large video files (such as the 540p version of MacBreak). So I’ve been experimenting on and off with faster ways of playing back QuickTime movies. Here are my findings.

First, do not use NSMovieView. In my app, the NSMovieView used 50% of my CPU at all times — even when the movie was paused. Bad, bad, bad. And the frame rate sucked, too. (UPDATE 23:50 PDT: It seems like NSMovieView simply draws the entire frame periodically and unconditionally. The CPU usage changed based on the size of the window.) When I replaced it with QTMovieView, the CPU usage went way down, and the frame rate became watchable.

Second, Apple has a document called Enhancing Movie Playback Performance. Read it, learn it, live it.

Some of its information bears expanding-upon, though:

  • These are basic QuickTime functions, not QTKit. Both NSMovie and QTMovie allow you to get the raw QuickTime Movie, which you pass to these functions.

  • Prerolling actually involves two steps. First, call PrePrerollMovie. (No, I am not making this up.) Then, call PrerollMovie.

  • Remember MoviePlayer? It had two checkboxes for enhancing speed:

    Screenshot of MoviePlayer's Info window for a MacBreak episode, showing the “video_main” track, Preload options.

    Preload is obvious; it corresponds to LoadMovieIntoRam. Cache hint is not so obvious; what it does is keep movie data in RAM after it has been played (for looping). This corresponds to the keepInRam option to LoadMovieIntoRam.

    If you use keepInRam, be sure to call LoadMovieIntoRam with the unkeepInRam and flushFromRam options when you’re done with the movie, so that the memory used will be freed.

    Note that in MoviePlayer, you could only set preload options per-track (there was a “Movie” category, but you could not set preload options for it). So this actually corresponds to LoadTrackIntoRam. I find LoadMovieIntoRam more useful for my situation; obviously, you should use whichever one of LoadMovieIntoRam, LoadTrackIntoRam, or LoadMediaIntoRam is appropriate for yours.

  • Preloading all of a movie is very expensive, especially if the movie is large (MacBreak takes about 20 seconds to load — that’s forever in user time). Use it only if you have to, and show a progress indicator if you do. If you can, preload sections at a time — I might, for example, load 30 seconds every 1 second starting from file open.

Third, I suggest making sure that your QTMovieView is set to preserve aspect ratio. I don’t know whether aspect ratio distortion has a negative effect on QT performance — especially if the movie is being scaled anyway — but having this turned on can’t hurt.

Technorati tags: , .